text
stringlengths
10
2.72M
package com.mpt.android.funzone; import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkInfo; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.InterstitialAd; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.initialization.InitializationStatus; import com.google.android.gms.ads.initialization.OnInitializationCompleteListener; public class MainActivity extends AppCompatActivity { private Button button; private Button button1; private AdView mAdView; private Button button2; private Button button3; private Button buttona; private InterstitialAd mInterstitialAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MobileAds.initialize(this, new OnInitializationCompleteListener() { @Override public void onInitializationComplete(InitializationStatus initializationStatus) { } }); mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId("ca-app-pub-2123879779632365/9181528592"); mInterstitialAd.loadAd(new AdRequest.Builder().build()); mAdView = findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); // MobileAds.initialize(this, new OnInitializationCompleteListener() { // @Override // public void onInitializationComplete(InitializationStatus initializationStatus) { // } // }); button = findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } else { Log.d("TAG", "The interstitial wasn't loaded yet."); } Bubble(); } }); button1 = findViewById(R.id.cannonbtn); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } else { Log.d("TAG", "The interstitial wasn't loaded yet."); } Cannon(); } }); button2 = findViewById(R.id.surgerybtn); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } else { Log.d("TAG", "The interstitial wasn't loaded yet."); } Surgery(); } }); button3 = findViewById(R.id.snkbtn); button3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } else { Log.d("TAG", "The interstitial wasn't loaded yet."); } Snake(); } }); buttona = findViewById(R.id.aboutus); buttona.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } else { Log.d("TAG", "The interstitial wasn't loaded yet."); } about(); } }); // mAdView = findViewById(R.id.adView); // AdRequest adRequest = new AdRequest.Builder().build(); //mAdView.loadAd(adRequest); } private void Bubble() { Intent intent = new Intent(MainActivity.this, BubbleShooter.class); startActivity(intent); } private void Cannon() { Intent intent = new Intent(MainActivity.this, Main2Activity.class); startActivity(intent); } private void Surgery() { Intent intent = new Intent(MainActivity.this, Main3Activity.class); startActivity(intent); } private void Snake() { Intent intent = new Intent(MainActivity.this, Main4Activity.class); startActivity(intent); } private void about() { Intent intent = new Intent(MainActivity.this, AboutUs.class); startActivity(intent); } }
import javafx.event.EventHandler; import javafx.geometry.Point3D; import javafx.scene.Group; import javafx.scene.image.Image; import javafx.scene.input.MouseEvent; import javafx.scene.paint.PhongMaterial; import javafx.scene.shape.Cylinder; public class Piece extends Square { private Player player; private boolean isEmpty; private Group group; private int height; private Cylinder piece; private int row; private int col; public Piece(Group g, int height, int row, int col) { this.row = row; this.col = col; this.height = height; group = g; isEmpty = true; } public Piece() { isEmpty = true; } public Piece(boolean team) { player = new Player(team); Cylinder c = new Cylinder(10, 20); } public Piece(boolean team, Group g, int x, int y) { player = new Player(team); group = g; this.row = x; this.col = y; activatePiece(team); } public void activatePiece(boolean team) { player = new Player(team); piece = new Cylinder(50, 30); PhongMaterial material = new PhongMaterial(); if (team) { material.setDiffuseMap(new Image(getClass().getResourceAsStream("/photos/amogus.jpg"))); } else { material.setDiffuseMap(new Image(getClass().getResourceAsStream("/photos/blue.jpg"))); } isEmpty = false; piece.setMaterial(material); group.getChildren().add(piece); piece.translateXProperty().set(row * 140); piece.translateYProperty().set(col * 140); piece.translateZProperty().set(30 * height + 10); piece.rotationAxisProperty().set(new Point3D(1,0,0)); piece.rotateProperty().set(90); actions(); } public void actions() { piece.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { BoardSquare sqr = Board.getBoardSquare(col, row); sqr.setMaterial("/photos/glow.jpg", sqr.getBox()); } }); piece.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { BoardSquare sqr = Board.getBoardSquare(col, row); sqr.setMaterial("/photos/square.jpg", sqr.getBox()); } }); piece.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { int height = Board.getOpenSquareHeight(col, row); Board.addUserPiece(Board.getTurn(), col, row); System.out.println(Board.isGameDone(col, row, height, Board.getTurn())); Board.changeTurn(); } }); } public boolean isEmpty() { return isEmpty; } public boolean getTeam() { return player.getTeam(); } public String toString () { return getTeam() ? "X" : "Y"; } }
package jwscert.rest.services.ejb; import javax.ejb.Stateless; import javax.ws.rs.GET; import javax.ws.rs.Path; @Path("/ejbwar1") @Stateless public class MyEjbResource1 { @GET public String Hello(){ return "Hello word MyEjbResource"; } }
package com.tencent.mm.plugin.webview.ui.tools.jsapi; import android.content.Intent; import android.widget.Toast; import com.tencent.mm.R; import com.tencent.mm.aa.q; import com.tencent.mm.model.am.b.a; import com.tencent.mm.model.au; import com.tencent.mm.model.c; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.x; class g$89 implements a { final /* synthetic */ g qiK; final /* synthetic */ Intent val$intent; g$89(g gVar, Intent intent) { this.qiK = gVar; this.val$intent = intent; } public final void x(String str, boolean z) { int i = 42; if (g.j(this.qiK) == null) { x.w("MicroMsg.MsgHandler", "getNow callback, msghandler has already been detached!"); g.a(this.qiK, g.k(this.qiK), "profile:fail", null); return; } if (g.l(this.qiK) != null) { g.l(this.qiK).dismiss(); } au.HU(); com.tencent.mm.l.a Yg = c.FR().Yg(str); if (Yg == null || ((int) Yg.dhP) <= 0) { au.HU(); Yg = c.FR().Yd(str); } if (Yg == null || ((int) Yg.dhP) <= 0) { z = false; } else { str = Yg.field_username; } if (z) { com.tencent.mm.aa.c.J(str, 3); q.KJ().jO(str); this.val$intent.addFlags(268435456); this.val$intent.putExtra("Contact_User", str); if (Yg.ckW()) { if (g.m(this.qiK) != null) { i = g.m(this.qiK).getInt("Contact_Scene", 42); } h.mEJ.k(10298, Yg.field_username + "," + i); this.val$intent.putExtra("Contact_Scene", i); } g.a(this.qiK, this.val$intent); g.a(this.qiK, g.k(this.qiK), "profile:ok", null); return; } Toast.makeText(ad.getContext(), g.j(this.qiK).getString(R.l.fmt_self_qrcode_getting_err, new Object[]{Integer.valueOf(3), Integer.valueOf(-1)}), 0).show(); g.a(this.qiK, g.k(this.qiK), "profile:fail", null); } }
package com.hsw.demofeibo01.controller; import com.hsw.demofeibo01.domain.stu; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController public class demoController { @Autowired private demoController demoController; @GetMapping(value = "/findAll") public List<stu> findAll(){ return demoController.findAll(); } }
package com.demo.service; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import com.demo.bindservice.IMyCountService; public class RemoteBind extends Activity { private ServiceConnection serviceConnection = new ServiceConnection() { private IMyCountService remotecountService; @Override public void onServiceConnected(ComponentName name, IBinder service) { try { remotecountService = IMyCountService.Stub.asInterface(service); Log.v("RemoteBind", "on serivce connected, count is " + remotecountService.getCount()); } catch (RemoteException e) { throw new RuntimeException(e); } } @Override public void onServiceDisconnected(ComponentName name) { remotecountService = null; } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.bindService(new Intent("com.demo.service.RemoteCountService"), this.serviceConnection, BIND_AUTO_CREATE); } @Override protected void onDestroy() { this.unbindService(serviceConnection); super.onDestroy(); } }
package com.example.asyncimageloader; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.GridView; import android.widget.Toast; public class MainActivity extends Activity { private GridView mGridView; private String [] imageThumbUrls = Images.imageThumbUrls; private ImageAdapter mImageAdapter; private FileUtils fileUtils; private Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContext = this; Toast.makeText(this, mContext.getCacheDir().getPath(), 10).show(); fileUtils = new FileUtils(this); mGridView = (GridView) findViewById(R.id.gridView); mImageAdapter = new ImageAdapter(this, mGridView, imageThumbUrls); mGridView.setAdapter(mImageAdapter); registerForContextMenu(mGridView); } //自己改变 @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub menu.setHeaderTitle("CacheManager"); menu.add("删除手机中图片缓存"); } @Override public boolean onContextItemSelected(MenuItem item) { // TODO Auto-generated method stub //获取上下文信息 AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); //获取位置信息 fileUtils.deleteFile(); Toast.makeText(getApplication(), "清空缓存成功", Toast.LENGTH_SHORT).show(); return super.onContextItemSelected(item); } // @Override protected void onDestroy() { mImageAdapter.cancelTask(); super.onDestroy(); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add("删除手机中图片缓存"); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 0: fileUtils.deleteFile(); Toast.makeText(getApplication(), "清空缓存成功", Toast.LENGTH_SHORT).show(); break; } return super.onOptionsItemSelected(item); } }
package test; public class QueueList { public static class QueueArray<E>{ //设定队列,队的容量,前端和后端,元素数量。 //前端为队头元素位置,后端下标为队尾元素后一个位置。 private int size = 5 ; private Object[] que_arr ; private int front ; private int rear ; private int count ; //初始化队列 public QueueArray(){ que_arr =new Object [size] ; this.front = 0 ; this.rear = 0 ; this.count = 0; } /** * 入队 * @param data */ public void In(E data){ //判断是否队满 if (count == size){ throw new RuntimeException("队满"); } //添加数据,元素总数+1 que_arr[rear] = data ; ++count; //队尾标号的增加 if (rear+1 >= size){ rear = 0; }else{ ++rear; } } /** * 出队 * @return 队头的元素 */ public Object Out(){ if (count == 0){ throw new RuntimeException("队空"); } Object data = que_arr[front]; que_arr[front] = null ; --count; if (front+1 >= size){ front = 0; }else{ ++front; } return data; } /** * 输出 */ public void print(){ System.out.print("["); for (int i = 0 ; i<size ; i++){ if (i == size-1){ System.out.print(que_arr[size-1]+"]"); }else{ System.out.print(que_arr[i]+","); } } System.out.println("count:"+count+" front:"+front+" rear:"+rear); } } //用链表创建队列 public static class QueueLinked<E>{ private int size; private Node header; //创建指向链表末端结点的指针 Node p; //初始化链表 public QueueLinked(){ header = new Node(); size = 0 ; p = header; } //创建结点 public class Node{ //创建数据域和地址域 private E data; private Node next; //构建方法使结点元素的改变 public Node(E data,Node next){ this.data = data; this.next = next; } //初始化结点 public Node(){ this(null,null); } } /** * 入队 * @param data 需要入队的数据 */ public void In(E data){ //创建结点 Node newnode = new Node(); //赋予数据 newnode.data = data; //将结点添加到当前链表末端之后 p.next = newnode; //p指向新结点,其地址域指向队首 p = newnode; newnode.next = header.next; //结点数+1 ++size; } public E Out(){ //判断队列是否为空 if (size == 0){ throw new RuntimeException("队空"); } //创建指针指向删除的结点 Node del = header.next; //队首数据输出 E data = del.data; //删除队首结点 //如果队列中只有一个结点,头结点地址域null if (size == 1){ header.next = null ; //否则头结点地址域指向第二个结点 }else{ header.next = del.next; } //队尾地址域指向新队首 p.next = header.next; //将删除的结点清空 del.data = null ; del.next = null ; //总数-1 --size; //返回队首数据 return data; } /** * 打印 */ public void print(){ Node q = header.next; for (int i = 0 ; i<size ; i++){ if (i == size-1){ System.out.print(q.data); }else{ System.out.print(q.data+","); q = q.next; } } System.out.println("——size:"+size+" ; p.next:"+p.next.data); } } //主函数测试 public static void main(String[] args){ /*QueueArray<Object> queue = new QueueArray<>(); //queue.Out(); queue.In(1); queue.In(2); queue.In(3); queue.print(); queue.Out(); queue.print(); queue.In(4); queue.In(5); queue.In(6); //queue.In(7); queue.print(); queue.Out(); queue.Out(); queue.Out(); queue.print(); queue.In(7); queue.Out(); queue.Out(); queue.print();*/ QueueLinked<Object> queue2 = new QueueLinked<>(); //queue2.Out(); queue2.In(1); queue2.In(2); queue2.In(3); queue2.print(); queue2.Out(); queue2.Out(); queue2.print(); } }
package com.involves.converter; public interface Convertable { }
/*Copyright [2018] [Jurgen Emanuels] 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 za.co.samtakie.samtakieradio.utilities; import android.content.ContentValues; import android.content.Context; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import za.co.samtakie.samtakieradio.provider.Contract; @SuppressWarnings("WeakerAccess") public class OpenRadioJsonUtils { public static final String RADIO_ID = "ID"; public static final String RADIO_NAME = "radio_name"; public static final String RADIO_LINK = "radio_link"; public static final String RADIO_IMAGE = "radio_image"; @SuppressWarnings("unused") public static ContentValues[] getSimpleRadioStringFromJson(Context context, String jsonResponse) throws JSONException{ JSONObject radioJsonObject = new JSONObject(jsonResponse); JSONArray radioArray = radioJsonObject.getJSONArray("online_radio"); ContentValues[] radioContentValues = new ContentValues[radioArray.length()]; for(int i = 0; i < radioArray.length(); i++){ ContentValues radioValues = new ContentValues(); //Log.d("Json Util ", radioArray.getString(i)); String radioName; int radioID; String radioLink; String radioImage; JSONObject jsonObject = radioArray.getJSONObject(i); radioID = jsonObject.getInt(RADIO_ID); radioName = jsonObject.getString(RADIO_NAME); radioLink = jsonObject.getString(RADIO_LINK); radioImage = jsonObject.getString(RADIO_IMAGE); radioValues.put(Contract.RadioEntry.COLUMN_ONLINE_RADIO_ID, radioID); radioValues.put(Contract.RadioEntry.COLUMN_ONLINE_RADIO_NAME, radioName); radioValues.put(Contract.RadioEntry.COLUMN_ONLINE_RADIO_LINK, radioLink); radioValues.put(Contract.RadioEntry.COLUMN_ONLINE_RADIO_IMAGE, radioImage); radioContentValues[i] = radioValues; } return radioContentValues; } }
package com.example.spring05.dao; import javax.inject.Inject; import org.apache.ibatis.session.SqlSession; import org.springframework.stereotype.Repository; import com.example.spring05.model.MemberVO; @Repository public class LoginDAOImpl implements LoginDAO { @Inject private SqlSession sqlSession; @Override public MemberVO login(MemberVO login) throws Exception { return sqlSession.selectOne("login.login", login); } }
package com.tencent.mm.plugin.appbrand.launching.a; import android.util.Pair; import com.tencent.mm.ab.b; import com.tencent.mm.ab.l; import com.tencent.mm.by.f; import com.tencent.mm.k.g; import com.tencent.mm.plugin.appbrand.app.e; import com.tencent.mm.plugin.appbrand.appcache.ac; import com.tencent.mm.plugin.appbrand.appcache.u; import com.tencent.mm.plugin.appbrand.config.q; import com.tencent.mm.plugin.appbrand.launching.ILaunchWxaAppInfoNotify; import com.tencent.mm.plugin.appbrand.launching.t; import com.tencent.mm.plugin.appbrand.r.c; import com.tencent.mm.plugin.appbrand.s.j; import com.tencent.mm.protocal.c.aqk; import com.tencent.mm.protocal.c.aql; import com.tencent.mm.protocal.c.bhp; import com.tencent.mm.protocal.c.cgg; import com.tencent.mm.protocal.c.chd; import com.tencent.mm.protocal.c.chh; import com.tencent.mm.protocal.c.chx; import com.tencent.mm.sdk.platformtools.x; import java.util.Locale; public final class a extends com.tencent.mm.ab.a<aql> { final b diG; final String fdE; public volatile t ggV; public volatile boolean ggm; protected final /* synthetic */ void a(int i, int i2, String str, bhp bhp, l lVar) { String str2; aql aql = (aql) bhp; int i3 = lVar == null ? 1 : 0; if (aql == null) { str2 = "NULL"; } else { if (aql.rSV == null) { str2 = "NULL_API_INFO"; } else { str2 = "api_info~ fg:" + (aql.rSV.rsl == null ? "NULL" : Integer.valueOf(aql.rSV.rsl.lR.length)); if (aql.rSV.rsm != null) { if (aql.rSV.rsm.size() > 0) { str2 = str2 + " | bg:" + ((com.tencent.mm.bk.b) aql.rSV.rsm.get(0)).lR.length; } if (aql.rSV.rsm.size() > 1) { str2 = str2 + " | suspend:" + ((com.tencent.mm.bk.b) aql.rSV.rsm.get(1)).lR.length; } } str2 = str2 + "~"; } str2 = aql.rSU == null ? str2 + " || NULL_LAUNCH" : str2 + " || launch " + aql.rSU.qZk; } x.i("MicroMsg.AppBrand.CgiLaunchWxaApp", "onCgiBack, errType %d, errCode %d, errMsg %s, req[appId %s, bg %B, sync %B, libVersion %d], resp[%s]", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str, getAppId(), Boolean.valueOf(akP()), Boolean.valueOf(this.ggm), Integer.valueOf(akQ().rSP.rUD), str2}); if (i == 0 && i2 == 0 && aql != null) { if (i3 != 0) { this.ggV = new t(); this.ggV.field_appId = getAppId(); this.ggV.a(aql); } else { this.ggV = e.abb().a(getAppId(), aql); } this.ggV.ggm = this.ggm; ac.a(akQ().rSP.rUD, aql.rSX); if (aql.rSU != null) { if (aql.rSU.rSL) { e.abg().a(q.rY(getAppId()), akO(), akP(), aan(), 1, this.fdE); } if (!this.ggm) { ILaunchWxaAppInfoNotify.gfI.a(getAppId(), akO(), this.fdE, this.ggV); } } } else if (this.ggm) { int i4 = j.app_brand_preparing_permission_sync_timeout; Object[] objArr = new Object[1]; objArr[0] = String.format(Locale.US, " (%d,%d)", new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}); com.tencent.mm.plugin.appbrand.launching.x.um(com.tencent.mm.plugin.appbrand.launching.x.getMMString(i4, objArr)); } } public a(String str, boolean z, cgg cgg, chx chx, chh chh, String str2, int i) { this.ggm = false; this.fdE = str2; aqk aqk = new aqk(); aqk.jQb = str; aqk.rSN = cgg; aqk.rKO = z ? 1 : 2; aqk.rSQ = chx; aqk.rSR = chh; chd chd = new chd(); chd.rUD = i; if (i > 0) { u abn = e.abn(); if (abn != null) { com.tencent.mm.plugin.appbrand.appcache.t tVar = new com.tencent.mm.plugin.appbrand.appcache.t(); tVar.field_key = "@LibraryAppId"; tVar.field_version = i; if (abn.b(tVar, new String[]{"key", "version"})) { chd.rca = (int) tVar.field_updateTime; chd.sBh = tVar.field_scene; } } } aqk.rSP = chd; try { if (com.tencent.mm.compatible.e.q.deU.dbw) { x.i("MicroMsg.AppBrand.CgiLaunchWxaApp", "DeviceInfo isLimit benchmarkLevel"); aqk.rST = -2; } else { aqk.rST = g.AT().getInt("ClientBenchmarkLevel", 0); } } catch (Throwable e) { x.printErrStackTrace("MicroMsg.AppBrand.CgiLaunchWxaApp", e, "read performanceLevel", new Object[0]); } com.tencent.mm.ab.b.a aVar = new com.tencent.mm.ab.b.a(); aVar.dIF = 1122; aVar.uri = "/cgi-bin/mmbiz-bin/wxaattr/launchwxaapp"; aVar.dIG = aqk; aVar.dIH = new aql(); b KT = aVar.KT(); this.diG = KT; this.diG = KT; } public a(String str, cgg cgg, String str2, int i) { this(str, false, cgg, null, null, str2, i); } private String getAppId() { return ((aqk) this.diG.dID.dIL).jQb; } private int akO() { return ((aqk) this.diG.dID.dIL).rSN.rRb; } private boolean akP() { return ((aqk) this.diG.dID.dIL).rSN.rUB > 0; } private int aan() { return ((aqk) this.diG.dID.dIL).rSN.otY; } private aqk akQ() { return (aqk) this.diG.dID.dIL; } public final void akR() { c.Em().H(new Runnable() { public final void run() { a.this.ggm = false; a.this.KM(); } }); } public final synchronized f<com.tencent.mm.ab.a.a<aql>> KM() { f<com.tencent.mm.ab.a.a<aql>> c; Pair am = ((com.tencent.mm.plugin.appbrand.appcache.a.d.e) e.x(com.tencent.mm.plugin.appbrand.appcache.a.d.e.class)).am(getAppId(), aan()); int i; if (am.first != null) { x.i("MicroMsg.AppBrand.CgiLaunchWxaApp", "before run, get issued data by appId(%s) scene(%d)", new Object[]{getAppId(), Integer.valueOf(aan())}); i = com.tencent.mm.plugin.appbrand.appcache.a.c.a.fiY; com.tencent.mm.plugin.appbrand.appcache.a.c.a.n(((Long) am.second).longValue(), 106); c = com.tencent.mm.by.g.c(new 2(this, am)); } else { if (!this.ggm) { am = ((com.tencent.mm.plugin.appbrand.appcache.a.d.b) e.x(com.tencent.mm.plugin.appbrand.appcache.a.d.b.class)).w(getAppId(), 2, aan()); if (((Boolean) am.first).booleanValue()) { i = com.tencent.mm.plugin.appbrand.appcache.a.c.a.fiY; com.tencent.mm.plugin.appbrand.appcache.a.c.a.n((long) ((Integer) am.second).intValue(), 168); x.i("MicroMsg.AppBrand.CgiLaunchWxaApp", "async launch with appid(%s) scene(%d) blocked", new Object[]{getAppId(), Integer.valueOf(aan())}); c = com.tencent.mm.by.g.c(new com.tencent.mm.vending.g.c.a<com.tencent.mm.ab.a.a<aql>>() { public final /* synthetic */ Object call() { return com.tencent.mm.ab.a.a.a(3, 99999999, "Async Launch Blocked", null, null, a.this); } }); } } c = super.KM(); } return c; } }
package gr.athena.innovation.fagi.core.function.phone; import gr.athena.innovation.fagi.core.function.IFunction; import org.apache.jena.rdf.model.Literal; import gr.athena.innovation.fagi.core.function.IFunctionTwoLiteralParameters; /** * Class for evaluating if the first phone number has more digits than the other. * * @author nkarag */ public class PhoneHasMoreDigits implements IFunction, IFunctionTwoLiteralParameters { /** * Checks if the first phone number has more digits than the second. * * @param literalA the literal of A. * @param literalB the literal of B. * @return true if the literals have the same language tag, false otherwise. */ @Override public boolean evaluate(Literal literalA, Literal literalB) { if(literalA == null || literalB == null){ return false; } int a = countDigits(literalA.getString()); int b = countDigits(literalB.getString()); return a > b; } @Override public String getName() { String className = this.getClass().getSimpleName().toLowerCase(); return className; } private static int countDigits(String value){ int count = 0; for (int i = 0, len = value.length(); i < len; i++) { if (Character.isDigit(value.charAt(i))) { count++; } } return count; } }
package com.example.demo.repository.salesRepository; import com.example.demo.entity.sales.Order; import com.example.demo.entity.user.Client; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface OrderRepository extends JpaRepository<Order, Long> { }
package biz.mydailyhoroscope; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class HoroscopeFragmentAdapter extends FragmentPagerAdapter { protected static String[] CONTENT = new String[]{"6", "5", "4", "3", "2", "Yesterday", "Today"}; public HoroscopeFragmentAdapter(FragmentManager fm, String[] dayOfTheWeek) { super(fm); CONTENT = dayOfTheWeek; } @Override public Fragment getItem(int position) { int daysOffset = Helpers.positionSwitch(position); return HoroscopeFragment.newInstance(CONTENT[position % CONTENT.length], daysOffset); } @Override public int getCount() { return CONTENT.length; } @Override public CharSequence getPageTitle(int position) { return HoroscopeFragmentAdapter.CONTENT[position % CONTENT.length]; } public void setCount(int count) { if (count > 0 && count <= 10) { notifyDataSetChanged(); } } }
package com.facebook.react.views.image; import com.facebook.drawee.e.q; import com.facebook.react.bridge.JSApplicationIllegalArgumentException; public class ImageResizeMode { public static q.b defaultValue() { return q.b.g; } public static q.b toScaleType(String paramString) { if ("contain".equals(paramString)) return q.b.c; if ("cover".equals(paramString)) return q.b.g; if ("stretch".equals(paramString)) return q.b.a; if ("center".equals(paramString)) return q.b.f; if (paramString == null) return defaultValue(); StringBuilder stringBuilder = new StringBuilder("Invalid resize mode: '"); stringBuilder.append(paramString); stringBuilder.append("'"); throw new JSApplicationIllegalArgumentException(stringBuilder.toString()); } } /* Location: C:\Users\august\Desktop\tik\df_rn_kit\classes.jar.jar!\com\facebook\react\views\image\ImageResizeMode.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package day22arraylist; import java.util.Arrays; public class OdevSorusu01 { public static void main(String[] args) { //arr1 = { {1,2},{3,4,5}, {6} } int arr1[][] = { {1,2},{3,4,5}, {6} }; int arr2[][] = { {7,8},{9,10,11}, {12} }; int sum=0; for(int i=0; i<arr1.length; i++) { for(int j=0; j<arr1[i].length; j++) { sum= sum + arr1[i][j]; } } System.out.println(sum); int sum1=0; for(int l=0; l<arr2.length; l++) { for(int k=0; k<arr2[l].length; k++) { sum1=sum1+arr2[l][k]; } } System.out.println(sum1); System.out.println(sum+sum1); } }
/** * Write a description of Part2 here. * * @author (your name) * @version (a version number or a date) */ public class Part2 { public String findSimpleGene (String dna, String startCodon, String stopCodon) { int indexStart = dna.indexOf(startCodon); if(indexStart == -1) return ""; int indexStop = dna.indexOf(stopCodon,indexStart + 3 ); if(indexStop == -1) return ""; if((indexStop - indexStart)%3 != 0) return ""; return dna.substring(indexStart, indexStop +3); } public void testSimpleGene () { String dna = "AAAGTGGTTAA"; //no ATG System.out.print(findSimpleGene(dna,"ATG","TAA")); dna = "AAATGGTTGGTATTGTATGGGAATTTTGG"; //no TAA System.out.print(findSimpleGene(dna, "ATG", "TAA")); dna = "AAAAGGTTAATGGTATGTTAA"; // multiple of 3 System.out.print(findSimpleGene(dna, "ATG", "TAA")); dna = "AAATTGGATGTTTTTAAGGTTAA"; // not multiple of 3 System.out.print(findSimpleGene(dna, "ATG", "TAA")); } }
/* * Copyright: 2020 forchange Inc. All rights reserved. */ package com.research.api.datasteam; import lombok.Data; import lombok.NoArgsConstructor; import java.util.HashMap; import java.util.Map; /** * @fileName: User.java * @description: User.java类说明 * @author: by echo huang * @date: 2020-02-15 21:09 */ @Data @NoArgsConstructor public class User { private Integer id; private String name; private Integer sex; public User(Integer id, String name, Integer sex) { this.id = id; this.name = name; this.sex = sex; } public Map<String, Object> map() { Map<String, Object> data = new HashMap<>(); data.put("id", this.id); data.put("name", this.name); data.put("sex", this.sex); return data; } }
package com.tencent.mm.plugin.appbrand.page; import com.tencent.mm.sdk.platformtools.bd; import com.tencent.mm.sdk.platformtools.x; import java.util.Iterator; import java.util.LinkedList; class u$4 extends bd<Boolean> { final /* synthetic */ u goS; u$4(u uVar, Boolean bool) { this.goS = uVar; super(1000, bool, (byte) 0); } private Boolean ame() { try { u uVar = this.goS; LinkedList linkedList = new LinkedList(); for (u$b u_b : uVar.goM) { linkedList.add(Integer.valueOf(u_b.id)); } Iterator it = linkedList.iterator(); while (it.hasNext()) { uVar.lu(((Integer) it.next()).intValue()); } } catch (Exception e) { x.e("MicroMsg.AppBrandWebViewCustomViewContainer", "removeAll error " + e); } return Boolean.valueOf(false); } }
package com.it.userportrait.map; import com.alibaba.fastjson.JSONObject; import com.it.userportrait.analy.WoolEntity; import com.it.userportrait.bean.Order; import com.it.userportrait.util.DateUtils; import org.apache.flink.api.common.functions.MapFunction; import java.util.Date; public class WoolAnlayMap implements MapFunction<String, WoolEntity> { @Override public WoolEntity map(String s) throws Exception { Order youfanorder = JSONObject.parseObject(s, Order.class); long userid = youfanorder.getUserid(); Date orderDate = youfanorder.getCreateTime(); long orderDateLong = orderDate.getTime(); long couponId = youfanorder.getCouponId(); WoolEntity woolEntity = new WoolEntity(); woolEntity.setUserid(userid); long timeinfo = DateUtils.getCurrentDayStart(orderDateLong); woolEntity.setTimeinfo(timeinfo+""); String groupField = "wooluser=="+timeinfo+"=="+userid; woolEntity.setGroupField(groupField); if(couponId>0){ woolEntity.setNumbers(1l); } return woolEntity; } }
import java.util.ArrayList; public class Container { private int weightLimit; private ArrayList<Suitcase> list; public Container(int weightLimit) { this.weightLimit = weightLimit; this.list = new ArrayList<Suitcase>(); } public void addSuitcase(Suitcase suitcase) { if (getWeight() + suitcase.getWeight() > this.weightLimit) { return; } else { this.list.add(suitcase); } } public int getWeight() { int weight = 0; for (Suitcase element : this.list) { weight += element.totalWeight(); } return weight; } public String toString() { return this.list.size() + " suitcases (" + getWeight() + " kg)"; } public void printThings() { for (Suitcase element : this.list) { element.printThings(); } } }
package com.tencent.mm.ui.a; import android.content.Context; import android.os.Vibrator; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; import android.view.View; import android.view.accessibility.AccessibilityManager; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.w; import com.tencent.mm.w.a.i; import java.util.Locale; public final class a { private AccessibilityManager gD; Vibrator hni; public Context rc; TextToSpeech tqQ = null; /* renamed from: com.tencent.mm.ui.a.a$1 */ class AnonymousClass1 implements OnInitListener { final /* synthetic */ String efo; AnonymousClass1(String str) { this.efo = str; } public final void onInit(int i) { if (a.this.tqQ != null) { a.this.tqQ.setLanguage(w.chL() ? Locale.CHINESE : Locale.ENGLISH); a.this.tqQ.speak(this.efo, 0, null); } } } private static class a { private static final a tqS = new a(ad.getContext()); } public a(Context context) { this.rc = context; this.gD = (AccessibilityManager) this.rc.getSystemService("accessibility"); } public final boolean cqW() { return this.gD.isEnabled() && this.gD.isTouchExplorationEnabled(); } public final void a(View view, String str, int i, String str2, String str3) { if (cqW() && this.rc != null && view != null && str != null && str2 != null && str3 != null) { b bVar = new b(); bVar.ZU(str); if (i > 0) { bVar.ZU(this.rc.getResources().getQuantityString(i.conversation_item_desc_unread, 1, new Object[]{Integer.valueOf(i)})); } bVar.ZU(str2).ZU(str3); bVar.dl(view); } } public final void J(View view, int i) { if (cqW() && this.rc != null && view != null) { int max = Math.max(i, 1); b bVar = new b(); bVar.ZU(this.rc.getResources().getQuantityString(i.chatting_voice_item_desc, max, new Object[]{Integer.valueOf(max)})); bVar.dl(view); } } }
package com.lec.ex4_Object; public class CardMain { public static void main(String[] args) { Card[] cards = { new Card('♥', 2), /// single quotation char new Card('◆', 7), new Card('♣', 8) }; Card yours = new Card('♣', 8); System.out.println("당신 카드: " + yours); for (int idx = 0; idx < cards.length; idx++) { System.out.println(cards[idx]); if (yours.equals(cards[idx])) { System.out.println("-당신 카드와 일치합니다"); } else { System.out.println("-당신 카드와 일치하지 않습니다"); } // if } // for }// main }// class
package com.lxy.dao; import java.io.FileOutputStream; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.OutputFormat; import org.dom4j.io.SAXReader; import org.dom4j.io.XMLWriter; import com.lxy.domain.Student; /** * 操作XML(增删改查) * @author 15072 * */ public class StuDao { /** * 向student.xml中添加学生信息 * 部分bug:无法自动一直往根节点后添加子节点 * @throws Exception */ public void addStu(Student stu) throws Exception { //操作XML,添加学生信息 //1. 获取解析器对象 SAXReader reader = new SAXReader(); //2. 解析XML,返回Document对象 Document document = reader.read("src/student.xml"); //3. 获取根节点 Element root = document.getRootElement(); root.addElement("student"); Element student = (Element) root.elements("student").get(1); student.addElement("num").setText(stu.getNum()); student.addElement("name").setText(stu.getName()); student.addElement("desc").setText(stu.getDesc()); //回写 OutputFormat format = OutputFormat.createPrettyPrint(); XMLWriter writer = new XMLWriter(new FileOutputStream("src/student.xml"), format); writer.write(document); writer.close(); } /** * 通过num删除学生信息 * @param num */ public void delStu(String num) { //删除学生信息 } /** * 通过num修改学生信息 */ public void updateStu(String num) { //修改学生信息 } /** * 通过num查询学生信息 * @param num * @return */ public Student selStu(String num) { //修改学生信息 return null; } }
/** * */ /** * @author pc * */ package com.nic.projectproposal.model;
package com.bingo.code.example.design.command.degeneration; public class Client { public static void main(String[] args) { //׼��Ҫ���������� Command cmd = new PrintService("�˻�������ģʽʾ��"); //��������������� Invoker invoker = new Invoker(); invoker.setCmd(cmd); //���°�ť����������ִ������ invoker.startPrint(); } }
package com.yoeki.kalpnay.hrporatal.Payroll; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class TotalAmount { @SerializedName("Type") @Expose private Object type; @SerializedName("EarningAmount") @Expose private String earningAmount; @SerializedName("DeductionAmount") @Expose private String deductionAmount; @SerializedName("GrossAmount") @Expose private String grossAmount; public Object getType() { return type; } public void setType(Object type) { this.type = type; } public String getEarningAmount() { return earningAmount; } public void setEarningAmount(String earningAmount) { this.earningAmount = earningAmount; } public String getDeductionAmount() { return deductionAmount; } public void setDeductionAmount(String deductionAmount) { this.deductionAmount = deductionAmount; } public String getGrossAmount() { return grossAmount; } public void setGrossAmount(String grossAmount) { this.grossAmount = grossAmount; } }
package com.mysql.cj.protocol; import com.mysql.cj.exceptions.CJOperationNotSupportedException; import com.mysql.cj.exceptions.ExceptionFactory; import java.io.IOException; import java.util.concurrent.CompletableFuture; public interface MessageSender<M extends Message> { default void send(byte[] message, int messageLen, byte messageSequence) throws IOException { throw (CJOperationNotSupportedException)ExceptionFactory.createException(CJOperationNotSupportedException.class, "Not supported"); } default void send(M message) { throw (CJOperationNotSupportedException)ExceptionFactory.createException(CJOperationNotSupportedException.class, "Not supported"); } default CompletableFuture<?> send(M message, CompletableFuture<?> future, Runnable callback) { throw (CJOperationNotSupportedException)ExceptionFactory.createException(CJOperationNotSupportedException.class, "Not supported"); } default void setMaxAllowedPacket(int maxAllowedPacket) { throw (CJOperationNotSupportedException)ExceptionFactory.createException(CJOperationNotSupportedException.class, "Not supported"); } default MessageSender<M> undecorateAll() { return this; } default MessageSender<M> undecorate() { return this; } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\protocol\MessageSender.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package colorswitch; /** * Fait le rendu de dessiner un cercle(des deux cercles) de l'obstacle TwoRoundedCircles. */ public class RoundedCircle extends Obstacle { /** * Les attributs à utiliser. */ private double width; private int level, color; /** * Constructeur * @param x -- * @param y représentent le centre du cercle RoundedCircle à dessiner. * @param width Largeur du cercle. * @param level Le niveau actuel. */ public RoundedCircle(double x, double y, double width, int level) { super(x,y); this.width = width; this.level = level; this.color = (int) (Math.random() * 4); } /** * * @return La largeur actuelle. */ @Override public double getWidth() { return width; } /** * * @param width remplace la largeur actuelle lors de l'appel de la méthode. */ public void setWidth(double width) { this.width = width; } /** * * @return Retourne la largeur du cercle aussi. */ @Override public double getHeight() { return width; } @Override public void tick(double dt) { // rien à faire. } /** * * @return La couleur actuelle du cercle. */ public int getColor() { return color; } /** * * @param color Le numéro de la couleur à remplacer par la couleur actuelle. */ public void setColor(int color) { this.color = color; } /** * La méthode checkIntersection se trouve dans la classe abstraite Entity. * @param player La sorcière représente par un cercle. * @return Vrai si le cercle s'intersecte avec player, faux sinon. */ @Override public boolean intersects(Player player) { return this.checkIntersection(player, this.color); } }
package myapplication.aps.com.myapplication; @SuppressWarnings("WeakerAccess") public class BluetoothConnectException extends Exception { public BluetoothConnectException(Throwable cause) { super(cause); } }
package cl.evilcorp.perritos2.domain.presenter; public interface IPresenterList { void loadBreeds(); }
package com.team_linne.digimov.service; import com.team_linne.digimov.exception.GenreNotFoundException; import com.team_linne.digimov.model.Genre; import com.team_linne.digimov.repository.GenreRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class GenreService { @Autowired GenreRepository genreRepository; @Autowired MovieService movieService; public List<Genre> getAll() { return genreRepository.findAll(); } public Genre getById(String id) { return genreRepository.findById(id).orElseThrow(GenreNotFoundException::new); } public Genre create(Genre genre) { return genreRepository.save(genre); } public Genre update(String id, Genre genreUpdate) { Genre genre = this.getById(id); genreUpdate.setId(id); return this.create(genreUpdate); } public void delete(String id) { Genre genre = this.getById(id); genreRepository.deleteById(id); if (movieService != null) { movieService.deleteGenreId(id); } } }
package com.sinotao.business.dao; import tk.mybatis.mapper.common.Mapper; import com.sinotao.business.dao.entity.InterfaceData; public interface InterfaceDataDao extends Mapper<InterfaceData>{ }
/* * --------------------------------------------------------------------------------------------------------------------- * Brigham Young University - Project MEDIA StillFace DataCenter * --------------------------------------------------------------------------------------------------------------------- * The contents of this file contribute to the ProjectMEDIA DataCenter for managing and analyzing data obtained from the * results of StillFace observational experiments. * * This code is free, open-source software. You may distribute or modify the code, but Brigham Young University or any * parties involved in the development and production of this code as downloaded from the remote repository are not * responsible for any repercussions that come as a result of the modifications. */ package com.byu.pmedia.model; /** * Inner-class that holds information about StillFaceCodes and their counts within a dataset. This is a * necessary wrapper for filling the three JavaFX TableViews that hold summative code information. * @author Braden Hitchcock */ public class StillFaceCodeCount implements Comparable<StillFaceCodeCount>{ /* Holds the name of the Code */ private String name; /* Holds the number of occurrences of the code in the dataset*/ private int count; /** * Constructor for a StillFaceCodeCount object. Creates a new instance. * * @param name The name of the code * @param count The number of occurances of the code */ public StillFaceCodeCount(String name, int count) { this.name = name; this.count = count; } public String getName() { return name; } public int getCount() { return count; } /** * Allows a collection of StillFaceCodeCount objects to be sorted in descending order * * @param stillFaceCodeCounts The object to compare this object to * @return 0 if the two are equal, greater than one if this object's counts are less than the * comparison object, and less than one if this object's counts are greater than the * comparison object */ @Override public int compareTo(StillFaceCodeCount stillFaceCodeCounts) { int compareCount = stillFaceCodeCounts.getCount(); return compareCount - this.count; } }
package orgvictoryaxon.photofeed.main.di; import javax.inject.Singleton; import dagger.Component; import orgvictoryaxon.photofeed.PhotoFeedAppModule; import orgvictoryaxon.photofeed.domain.di.DomainModule; import orgvictoryaxon.photofeed.lib.di.LibsModule; import orgvictoryaxon.photofeed.main.ui.MainActivity; /** * Created by VictorYaxon. */ @Singleton @Component(modules = {MainModule.class, DomainModule.class, LibsModule.class, PhotoFeedAppModule.class}) public interface MainComponent { void inject(MainActivity activity); }
package org.fuserleer.crypto; import java.util.List; import java.util.Objects; import org.fuserleer.collections.Bloom; import org.fuserleer.ledger.StateDecision; import org.fuserleer.serialization.DsonOutput; import org.fuserleer.serialization.DsonOutput.Output; import org.fuserleer.utils.Numbers; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class VoteCertificate extends Certificate { @JsonProperty("signers") @DsonOutput(value = {Output.API, Output.WIRE, Output.PERSIST}) private Bloom signers; @JsonProperty("signature") @DsonOutput(value = {Output.API, Output.WIRE, Output.PERSIST}) private BLSSignature signature; @SuppressWarnings("unused") protected VoteCertificate() { super(); } protected VoteCertificate(final StateDecision decision, final Bloom signers, final BLSSignature signature) throws CryptoException { super(decision); Objects.requireNonNull(signature, "Signature is null"); Objects.requireNonNull(signers, "Identities is null"); Numbers.isZero(signers.count(), "Signers is empty"); this.signers = signers; this.signature = signature; } public final Bloom getSigners() { return this.signers; } public final BLSSignature getSignature() { return this.signature; } protected abstract Hash getTarget() throws CryptoException; final boolean verify(final List<BLSPublicKey> identities) throws CryptoException { Objects.requireNonNull(identities, "Identity is null"); Numbers.isZero(identities.size(), "Identities is empty"); BLSPublicKey aggregated = BLS12381.aggregatePublicKey(identities); return BLS12381.verify(aggregated, this.signature, getTarget().toByteArray()); } }
package com.cognitive.newswizard.service.entity; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "feed_source") public class FeedSourceEntity { @Id private final String id; private final String name; private final String url; private final Long lastRead; /** * Points to parent feed source group */ private final String feedSourceGroupId; private final String code; public FeedSourceEntity(final String id, final String name, final String url, final Long lastRead, final String feedSourceGroupId, final String code) { super(); this.id = id; this.name = name; this.url = url; this.lastRead = lastRead; this.feedSourceGroupId = feedSourceGroupId; this.code = code; } public String getId() { return id; } public String getName() { return name; } public String getUrl() { return url; } public Long getLastRead() { return lastRead; } public String getFeedSourceGroupId() { return feedSourceGroupId; } public String getCode() { return code; } }
package edu.tacoma.uw.myang12.pocketdungeon.authenticate; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; import edu.tacoma.uw.myang12.pocketdungeon.MainMenuActivity; import edu.tacoma.uw.myang12.pocketdungeon.R; import edu.tacoma.uw.myang12.pocketdungeon.model.User; /** * Login fragment to login a user account. */ public class LoginFragment extends Fragment { private LoginFragmentListener mLoginFragmentListener; private JSONObject mUserJSON; public LoginFragment() { // Required empty public constructor } public interface LoginFragmentListener { void login(String email, String pwd); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /** Inflate the layout for this fragment. * Get email and password from user entry. */ View view = inflater.inflate(R.layout.fragment_login, container, false); getActivity().setTitle("Sign In"); mLoginFragmentListener = (LoginFragmentListener) getActivity(); final EditText emailText = view.findViewById(R.id.email); final EditText pwdText = view.findViewById(R.id.password); Button loginButton = view.findViewById(R.id.button_login); TextView txtRegister = view.findViewById(R.id.text_register); /** when user clicks on the login button */ loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String email = emailText.getText().toString(); String password = pwdText.getText().toString(); StringBuilder url = new StringBuilder(getString(R.string.login)); if (TextUtils.isEmpty(email) || !email.contains("@")) { Toast.makeText(v.getContext(), "Enter valid email address", Toast.LENGTH_SHORT).show(); emailText.requestFocus(); } else if (TextUtils.isEmpty(password) || password.length() < 6) { Toast.makeText(v.getContext(), "Enter valid password (at least 6 characters)", Toast.LENGTH_SHORT).show(); pwdText.requestFocus(); } /** construct a JSONObject to build a formatted message to send. */ mUserJSON = new JSONObject(); try { mUserJSON.put(User.EMAIL, email); mUserJSON.put(User.PASSWORD, password); new LoginFragment.LoginAsyncTask().execute(url.toString()); } catch (JSONException e) { e.printStackTrace(); } mLoginFragmentListener.login(email, password); } }); /** when user clicks on the 'Don't have an account' text, open register screen */ txtRegister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RegisterFragment registerFragment = new RegisterFragment(); getActivity().getSupportFragmentManager().beginTransaction() .replace(R.id.sign_in_fragment_id, registerFragment) .addToBackStack(null) .commit(); } }); return view; } /** Send post request to server, check login credentials. */ private class LoginAsyncTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... urls) { String response = ""; HttpURLConnection urlConnection = null; for (String url : urls) { try { URL urlObject = new URL(url); urlConnection = (HttpURLConnection) urlObject.openConnection(); urlConnection.setRequestMethod("POST"); urlConnection.setRequestProperty("Content-Type", "application/json"); urlConnection.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(urlConnection.getOutputStream()); // For Debugging Log.i("LOGIN", mUserJSON.toString()); wr.write(mUserJSON.toString()); wr.flush(); wr.close(); /** get response from server*/ InputStream content = urlConnection.getInputStream(); BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) { response += s; } } catch (Exception e) { response = "Unable to login, Reason: " + e.getMessage(); } finally { if (urlConnection != null) urlConnection.disconnect(); } } return response; } /** actions after received response from server */ @Override protected void onPostExecute(String s) { super.onPostExecute(s); try { JSONObject jsonObject = new JSONObject(s); /** If login successfully, go to main screen. * Get userId and save to SharedPreferences. */ if (jsonObject.getBoolean("success")) { Toast.makeText(getActivity(), "Login Successfully", Toast.LENGTH_SHORT).show(); SharedPreferences mSharedPreferences = getActivity().getSharedPreferences(getString(R.string.LOGIN_PREFS), Context.MODE_PRIVATE); mSharedPreferences.edit() .putInt(getString(R.string.USERID), jsonObject.getInt("memberId")) .commit(); Intent intent = new Intent(getActivity(), MainMenuActivity.class); startActivity(intent); getActivity().finish(); } /** If login failed, show error message. */ else { Toast.makeText(getActivity(), "Login Failed: invalid email/password." , Toast.LENGTH_SHORT).show(); Log.e("LOGIN", jsonObject.getString("error")); } } catch (JSONException e) { e.getMessage(); } } } }
package pdl2Explorer.pdl2; import java.util.ArrayList; import pdl2Explorer.antlr.generated.PDLType; public class PDL2Variable { String identifier; PDLType type; ArrayList<PDL2Variable> subVariables = new ArrayList<PDL2Variable>(); public String getIdentifier() { return identifier; } public void setIdentifier(String identifier) { this.identifier = identifier; } public PDLType getType() { return type; } public void setType(PDLType type) { this.type = type; } public void addSubVariables(PDL2Variable value) { subVariables.add(value); } }
package mg.egg.eggc.compiler.libegg.java; import java.io.Serializable; import java.util.Vector; import mg.egg.eggc.compiler.libegg.base.TDS; import mg.egg.eggc.runtime.libjava.EGGException; import mg.egg.eggc.runtime.libjava.EGGOptions; public class CompJava implements Serializable { private static final long serialVersionUID = 1L; transient private TDS table; private String nom; public String getNom() { return nom; } public String getNomClasse() { return nom + 'C'; } public void setNom(String n) { nom = n; } private StringBuffer corps; public StringBuffer getCorps() { return corps; } public void setCorps(String pack, Vector<String> incs) { EGGOptions options = table.getOptions(); corps = new StringBuffer(); corps.append("package " + pack + ";\n"); corps.append("import mg.egg.eggc.runtime.libjava.ISourceUnit;\n"); corps.append("import mg.egg.eggc.runtime.libjava.SourceUnit;\n"); corps.append("import mg.egg.eggc.runtime.libjava.problem.IProblem;\n"); corps.append("import mg.egg.eggc.runtime.libjava.problem.ProblemReporter;\n"); corps.append("import mg.egg.eggc.runtime.libjava.problem.ProblemRequestor;\n"); corps.append("import java.io.*;\n"); corps.append("public class " + getNomClasse() + " implements Serializable {\n"); corps.append(" private static final long serialVersionUID = 1L;\n"); corps.append(" public static void main(String[] args){\n"); corps.append(" System.err.println(\"version \" + \"" + options.getVersion() + "\");\n"); corps.append(" try {\n"); corps.append(" ISourceUnit cu = new SourceUnit(args[0]);\n"); corps.append(" ProblemReporter prp = new ProblemReporter(cu);\n"); corps.append(" ProblemRequestor prq = new ProblemRequestor();\n"); corps.append(" //new EGGOptionsAnalyzer(cu).analyse();\n"); corps.append(" " + table.getNom() + " compilo = new " + getNom() + "(prp);\n"); corps.append(" prq.beginReporting();\n"); corps.append(" compilo.set_eval(true);\n"); corps.append(" compilo.compile(cu);\n"); corps.append(" for(IProblem problem : prp.getAllProblems())\n"); corps.append(" prq.acceptProblem(problem );\n"); corps.append(" prq.endReporting();\n"); corps.append(" System.exit(0);\n"); corps.append(" }\n"); corps.append(" catch(Exception e){\n"); corps.append(" e.printStackTrace();\n"); corps.append(" System.exit(1);\n"); corps.append(" }\n"); corps.append(" }\n"); corps.append(" }\n"); } public CompJava(TDS t) { table = t; nom = t.getNom(); } public void finaliser(String pack, Vector<String> incs) throws EGGException { setCorps(pack, incs); table.getCompilationUnit().createFile(getNomClasse() + ".java", corps.toString()); } }
import java.io.*; import java.net.*; import java.util.ArrayList; class Sender { Infos infos; Sender(Infos infos) { this.setInfos(infos); } public void start() throws Exception { int number = 0; Infos infos = this.getInfos(); boolean ok = false; String campos[], user, mensagem = ""; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Digite seu nome:"); user = inFromUser.readLine(); // enquanto o endereco IP nao estiver correto, requisita o usuario por um while(!ok) try { System.out.println("\nDigite o IP da pessoa quem quer conversar:"); // para uso padrao infos.setIPAddress(InetAddress.getByName(inFromUser.readLine())); ok = true; } catch(UnknownHostException uhe) { System.out.println("Endereco invalido.\n"); } infos.setPort(13337); // ok = false; // enquanto a porta nao estiver correta, requisita o usuario por uma // while(!ok) // try // { // System.out.println("\nDigite a porta:"); // infos.setPort(Integer.parseInt(inFromUser.readLine())); // ok = true; // } // catch(NumberFormatException uhe) // { // System.out.println("Porta invalida.\n"); // } System.out.println("\n------------------------------------------------------------\n"); // infos dos comando para usuario System.out.println("Comandos:"); System.out.println("#connect:\t conectar-se ao IP e porta designadas"); System.out.println("#accept:\t aceitar um request"); System.out.println("#bye:\t\t desconectar da conversa"); System.out.println(); // enquanto nao pedir pra sair while(ok) { System.out.print("\r\t\t\t\t\t"); mensagem = inFromUser.readLine(); switch(mensagem) { // se for pra conectar e estiver no estado idle case("#connect"): //testa e muda estado pra REQSENT if(infos.testAndSwitchStatus(infos.IDLE, infos.REQSENT)) { // define um novo chtcode infos.setChtCode((int) (Math.random()*10000)); // monta a mensagem de requisicao mensagem = "CHT;" + (new java.util.Date()).getTime() + ";" + infos.getChtCode() + ";" + infos.getMyCode() + ";" + user + ";"; // Envia e informa usuario infos.send(mensagem); System.out.println("\n---->Chat request sent\n"); System.out.print("\r\t\t\t\t\t"); // espera pra ver se conectou for(int i=0; !infos.isStatus(infos.CONNECTED) && i<30; i++) Thread.sleep(500); // se nao foi aceito dentro do tempo, volta pra idle e informa usuario if(infos.testAndSwitchStatus(infos.REQSENT, infos.IDLE)) System.out.println("\n---->Connection failed\n"); } else System.out.println("Already connected/waiting response"); break; // se for pra aceitar requisicao case("#accept"): // se recebeu uma requisicao, muda pra conectado if(infos.testAndSwitchStatus(infos.REQREC, infos.CONNECTED)) { // monta mensagem de envio mensagem = "ACC;" + (new java.util.Date()).getTime() + ";" + infos.getChtCode() + ";" + infos.getMyCode() + ";" + infos.getUsrCode() + ";" + user + ";"; // envia mensagem infos.send(mensagem); // informa usuario System.out.println("\n---->Request accepted"); System.out.println("---->Connected\n"); } else System.out.println("No request received"); break; case("#bye"): // se estiver conectado muda pra idle if(infos.testAndSwitchStatus(infos.CONNECTED, infos.IDLE)) { // monta mensagem mensagem = "BYE;" + (new java.util.Date()).getTime() + ";" + infos.getChtCode() + ";" + infos.getMyCode() + ";" + infos.getUsrCode() + ";"; // envia mensagem infos.send(mensagem); // informa usuario System.out.println("\n---->Disconnected\n"); ok = false; } else System.out.println("Not connected"); break; // se nao for um dos outros comandos, eh uma mensagem normal default: // se estiver conectado if(infos.isStatus(infos.CONNECTED)) { // monta mensagem mensagem = "MSG;" + (new java.util.Date()).getTime() + ";" + infos.getChtCode() + ";" + infos.getMyCode() + ";" + infos.getUsrCode() + ";" + (number++) + ";" + mensagem + ";"; infos.addMensagem(mensagem); // envia infos.send(mensagem); } else System.out.println("Not connected"); break; } } } public void setInfos(Infos infos) { this.infos = infos; } public Infos getInfos() { return this.infos; } }
package org.ms.iknow.persistence.repo.memory; public abstract class Entry { private boolean locked = false; private static final long TIME_OUT = 5000L; private static final long DELAY = 2L; public void lock() { int delay = 0; while (delay < TIME_OUT) { if (this.locked) { try { Thread.sleep(DELAY); } catch (InterruptedException e) { e.printStackTrace(); } delay += DELAY; } else { this.locked = true; return; } } System.out.println("\n +++ ERROR: Timeout while try to lock entry!\n"); } public void unlock() { this.locked = false; } public boolean isLocked() { return this.locked; } }
package babylanguage.babyapp.learntotalk.memoryGame; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import babylanguage.babyapp.appscommon.data.AppData; import babylanguage.babyapp.learntotalk.R; public class MemoryAdapter extends BaseAdapter { private Context context; private final MemoryCard[] memoryCards; private OnMemoryCardClickListener listener; private int cardHeight; public MemoryAdapter(Context context, MemoryCard[] memoryCards, OnMemoryCardClickListener listener) { this.context = context; this.memoryCards = memoryCards; this.listener = listener; } public void setCardHeight(int cardHeight){ this.cardHeight = cardHeight; } public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView = inflater.inflate(R.layout.memory_button, null); ViewGroup.LayoutParams layoutParams = gridView.getLayoutParams(); if(layoutParams == null){ gridView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, this.cardHeight)); } else { layoutParams.height = this.cardHeight; } ImageButton imageView = gridView.findViewById(R.id.memory_card); MemoryCard card = memoryCards[position]; if(card.isOpen){ imageView.setImageResource(card.cardData.image); } else{ imageView.setImageResource(MemoryCard.close_image); } imageView.setTag(context.getResources().getString(card.cardData.title)); layoutParams = imageView.getLayoutParams(); if(layoutParams == null){ imageView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, this.cardHeight)); } else { layoutParams.height = this.cardHeight; } imageView.setId(card.id); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(MemoryAdapter.this.listener != null){ MemoryAdapter.this.listener.onClick(v.getId()); } }}); return gridView; } @Override public int getCount() { return memoryCards.length; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return position; } }
package com.souschef.sork.sous_chef; import android.Manifest; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.os.Handler; import android.os.PowerManager; import android.speech.RecognitionListener; import android.speech.RecognizerIntent; import android.speech.SpeechRecognizer; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.ImageButton; import android.widget.Toast; import com.gigamole.library.PulseView; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; public class VoiceUI extends AppCompatActivity implements SensorEventListener { private final static String TAG = VoiceUI.class.getName(); private final static int SENSOR_SENSITIVITY = 1; //to keep screen on protected PowerManager.WakeLock wakeLock; private SpeechRecognizer speechRecognizer; //to post changes to progress bar private Handler handler = new Handler(); //intent for speechRecognition Intent speechIntent; boolean killCommanded = false; //The start button private ImageButton startButton; //PulseView private PulseView pulseView; private SensorManager sensorManager; private Sensor proximitySensor; //Text to speech private Speaker speaker; CommandMonitor monitor; //legal commands private static final String[] VALID_COMMANDS = { "next task", "next", "continue", "next please", "continue please", "previous task", "previous", "repeat", "start timer", "start", "pause timer", "pause", "reset timer", "reset", "show ingredients", "ingredients", "return", "hide ingredients", "hide" }; private static final String wrongString = "I'm sorry, I didn't get that. Please try again"; private static final int VALID_COMMANDS_SIZE = VALID_COMMANDS.length; //permissions final int PERMISSION_CODE = 1; final String[] PERMISSIONS = {Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); startButton = findViewById(R.id.startButton); startButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startListeningButton(); } }); pulseView = findViewById(R.id.pulseView); sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); proximitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); speaker = new Speaker(this); startListeningButton(); } // @Override protected void startListeningButton() { speaker.readText(""); if (hasPermissions(this, PERMISSIONS)) { speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this); SpeechListener recognitionListener = new SpeechListener(); speechRecognizer.setRecognitionListener((recognitionListener)); speechIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); speechIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.souschef.sork.sous_chef"); // Given a hint to the recognizer about what the user is going to say speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); //Specifiy how many results you want to receive. The results will be sorted where the first result is the one with higher confidence. speechIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 20); speechIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true); //acquire the wakelock to keep the screen on until user exits/closes the app final PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); this.wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG); this.wakeLock.acquire(); //Start Listening speechRecognizer.startListening(speechIntent); pulseView.startPulse(); } else { new AlertDialog.Builder(this) .setTitle("Permission needed") .setMessage("All of these permissions are needed so that Sous Chef can hear and understand you") .setPositiveButton("ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ActivityCompat.requestPermissions(VoiceUI.this, PERMISSIONS, PERMISSION_CODE); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); VoiceUI.this.finish(); } }) .create().show(); } } public static boolean hasPermissions(Context context, String... permissions) { if (context != null && permissions != null) { for (String permission : permissions) { if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { return false; } } } return true; } //Implemented method from SensorEventListener. @Override protected void onResume() { // Register a listener for the sensor. super.onResume(); sensorManager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL); } //Implemented method from SensorEventListener. @Override protected void onPause() { // Be sure to unregister the sensor when the activity pauses. super.onPause(); sensorManager.unregisterListener(this); } //Implemented method from SensorEventListener. Decides what happens when sensor changes. @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { if (event.values[0] >= -SENSOR_SENSITIVITY && event.values[0] <= SENSOR_SENSITIVITY) { startListeningButton(); } } } //Implemented method from SensorEventListener. @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } private class SpeechListener implements RecognitionListener { @Override public void onReadyForSpeech(Bundle params) { Log.d(TAG, "on ready for speech"); } @Override public void onBeginningOfSpeech() { Log.d(TAG, "Beginning of speech"); } @Override public void onRmsChanged(float rmsdB) { Log.d(TAG, "RMS changed"); } @Override public void onBufferReceived(byte[] buffer) { Log.d(TAG, "buffer recieved"); } @Override public void onEndOfSpeech() { Log.d(TAG, "End of Speech"); pulseView.finishPulse(); //Toast.makeText(VoiceUI.this, "I have stopped listening", Toast.LENGTH_SHORT).show(); } @Override public void onError(int error) { //if (critical error) then exit if (error == SpeechRecognizer.ERROR_CLIENT) { Log.d(TAG, "Client error"); } else if (error == SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS) { Log.d(TAG, "DUDE, you need permissions"); } else { Log.d(TAG, "Other error"); } //speechRecognizer.destroy(); // pulseView.finishPulse(); } @Override public void onResults(Bundle results) { Log.d(TAG, "on result"); ArrayList<String> matches = null; if (results != null) { matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION); if (matches != null) { Log.d(TAG, "Results are: " + matches.toString()); final ArrayList<String> matchesStrings = matches; processCommand(matchesStrings); } } } @Override public void onPartialResults(Bundle partialResults) { Log.d(TAG, "Partial results"); } @Override public void onEvent(int eventType, Bundle params) { Log.d(TAG, "on Event"); } } private void processCommand(ArrayList<String> matchesStrings) { String response = wrongString; int maxStrings = matchesStrings.size(); boolean resultFound = true; for (int i = 0; i < VALID_COMMANDS_SIZE && resultFound; i++) { for (int j = 0; j < maxStrings && resultFound; j++) { if (StringUtils.getLevenshteinDistance(matchesStrings.get(j), VALID_COMMANDS[i]) < (VALID_COMMANDS[i].length() / 3)) { response = getResponse(i); } } } if (!resultFound) { speechRecognizer.cancel(); pulseView.finishPulse(); } final String finalResponse = response; speaker.readText(finalResponse); if (finalResponse.equals(wrongString)) { Toast.makeText(this, wrongString, Toast.LENGTH_SHORT).show(); } } private String getResponse(int command) { String returnString = wrongString; switch (command) { case 0: returnString = "next task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 1: returnString = "next task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 2: returnString = "next task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 3: returnString = "next task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 4: returnString = "next task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 5: returnString = "previous task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 6: returnString = "previous task"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 7: returnString = "repeat"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 8: returnString = "start timer"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 9: returnString = "start timer"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 10: returnString = "pause timer"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 11: returnString = "pause timer"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 12: returnString = "reset timer"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 13: returnString = "reset timer"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 14: returnString = "show ingredients"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 15: returnString = "show ingredients"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 16: returnString = "return"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 17: returnString = "return"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; case 18: returnString = "return"; CommandMonitor.getMonitor().setCommand(returnString); finish(); break; } finish(); return returnString; } }
package fr.lteconsulting.servlet.vue; import java.io.IOException; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import fr.lteconsulting.DonneesScope; import fr.lteconsulting.Joueur; import fr.lteconsulting.Partie; import fr.lteconsulting.dao.PartieDao; @WebServlet( "/partie.html" ) public class PartieServlet extends VueServlet { private static final long serialVersionUID = 1L; @EJB private PartieDao partieDao; @Override protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { String identifiantPartie = request.getParameter( "id" ); Partie partie = partieDao.getPartie( identifiantPartie ); if( partie == null ) { response.sendRedirect( "index.html" ); return; } if( partie.getJoueurs().size() < 2 ) { vuePartieEnAttente( partie, request, response ); } else { Joueur joueurConnecte = DonneesScope.getJoueurSession( request ); vuePartie( joueurConnecte, partie.getPlateau(), partie, joueurConnecte.getId().equals( partie.getJoueurCourant().getId() ), request, response ); } } }
package com.commercetools.pspadapter.payone.config; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.function.Function; import static java.util.Optional.empty; import static java.util.Optional.ofNullable; import static org.apache.commons.lang3.StringUtils.isNotBlank; /** * @author fhaertig * @since 15.12.15 */ public class PropertyProvider { public static final String TENANTS = "TENANTS"; public static final String PAYONE_API_VERSION = "PAYONE_API_VERSION"; public static final String PAYONE_REQUEST_ENCODING = "PAYONE_REQUEST_ENCODING"; public static final String PAYONE_SOLUTION_NAME = "PAYONE_SOLUTION_NAME"; public static final String PAYONE_SOLUTION_VERSION = "PAYONE_SOLUTION_VERSION"; public static final String PAYONE_INTEGRATOR_NAME = "PAYONE_INTEGRATOR_NAME"; public static final String PAYONE_INTEGRATOR_VERSION = "PAYONE_INTEGRATOR_VERSION"; public static final String LOG_LEVEL = "LOG_LEVEL"; public static final String PAYONE_API_URL = "PAYONE_API_URL"; public static final String HIDE_CUSTOMER_PERSONAL_DATA = "HIDE_CUSTOMER_PERSONAL_DATA"; private final Map<String, String> internalProperties; private final List<Function<String, String>> propertiesGetters; public PropertyProvider() { String implementationTitle = ofNullable(getClass().getPackage().getImplementationTitle()).orElse("DEBUG-TITLE"); String implementationVersion = ofNullable(getClass().getPackage().getImplementationVersion()).orElse("DEBUG-VERSION"); internalProperties = new HashMap<>(); internalProperties.put(PAYONE_API_VERSION, "3.9"); internalProperties.put(PAYONE_REQUEST_ENCODING, "UTF-8"); internalProperties.put(PAYONE_SOLUTION_NAME, "commercetools-platform"); internalProperties.put(PAYONE_SOLUTION_VERSION, "1"); internalProperties.put(PAYONE_INTEGRATOR_NAME, implementationTitle); internalProperties.put(PAYONE_INTEGRATOR_VERSION, implementationVersion); propertiesGetters = new ArrayList<>(); propertiesGetters.add(System::getProperty); propertiesGetters.add(System::getenv); propertiesGetters.add(internalProperties::get); } /** * Try to get a property by name in the next order:<ul> * <li>fetch from runtime properties (<i>-D</i> java arguments) using {@link System#getProperty(String)}</li> * <li>fetch from environment variables using {@link System#getenv(String)}</li> * <li>fetch from hardcoded {@link #internalProperties} map.</li> * </ul> * <p> * If neither of them exists - empty {@link Optional} is returned. * * @param propertyName the name of the requested property, must not be null * @return the property, an empty Optional if not present; empty values are treated as present */ public Optional<String> getProperty(final String propertyName) { return isNotBlank(propertyName) ? propertiesGetters.stream() .map(getter -> getter.apply(propertyName)) .filter(Objects::nonNull) .findFirst() : empty(); } /** * Gets a mandatory non-empty property. * * @param propertyName the name of the requested property, must not be null * @return the property value * @throws IllegalStateException if the property isn't defined or empty */ public String getMandatoryNonEmptyProperty(final String propertyName) { return getProperty(propertyName) .filter(value -> !value.isEmpty()) .orElseThrow(() -> createIllegalStateException(propertyName)); } private IllegalStateException createIllegalStateException(final String propertyName) { return new IllegalStateException("Value of " + propertyName + " is required and can not be empty!"); } public List<Function<String, String>> getPropertiesGetters() { return propertiesGetters; } }
package com.example.retail.models.itemcategories; import javax.persistence.*; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.time.LocalDateTime; @Entity @Table(name = "item_categories") public class ItemCategories { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "item_category_tableid") private Integer itemCategoryTableId; @NotNull @NotEmpty @Column(name = "item_category") private String itemCategory; @NotNull @NotEmpty @Column(name = "item_sub_category") private String itemSubCategory; @Column(name = "item_category_sub_id", unique = true) @NotNull @NotEmpty private String itemCategorySubId; @Column(name = "item_category_info") private String itemCategoryInfo; @NotEmpty @NotNull @Column(name = "item_category_last_updated_by") private String itemCategoryLastUpdatedBy; @NotNull @Column(name = "item_category_last_updated_on") private LocalDateTime itemCategoryLastUpdatedOn; public ItemCategories() {} public ItemCategories(@NotNull @NotEmpty String itemCategory, @NotNull @NotEmpty String itemSubCategory, @NotNull @NotEmpty String itemCategorySubId, String itemCategoryInfo, @NotEmpty @NotNull String itemCategoryLastUpdatedBy, @NotNull LocalDateTime itemCategoryLastUpdatedOn) { this.itemCategory = itemCategory; this.itemSubCategory = itemSubCategory; this.itemCategorySubId = itemCategorySubId; this.itemCategoryInfo = itemCategoryInfo; this.itemCategoryLastUpdatedBy = itemCategoryLastUpdatedBy; this.itemCategoryLastUpdatedOn = itemCategoryLastUpdatedOn; } public Integer getItemCategoryTableId() { return itemCategoryTableId; } public void setItemCategoryTableId(Integer itemCategoryTableId) { this.itemCategoryTableId = itemCategoryTableId; } public String getItemCategory() { return itemCategory; } public void setItemCategory(String itemCategory) { this.itemCategory = itemCategory; } public String getItemSubCategory() { return itemSubCategory; } public void setItemSubCategory(String itemSubCategory) { this.itemSubCategory = itemSubCategory; } public String getItemCategorySubId() { return itemCategorySubId; } public void setItemCategorySubId(String itemCategorySubId) { this.itemCategorySubId = itemCategorySubId; } public String getItemCategoryInfo() { return itemCategoryInfo; } public void setItemCategoryInfo(String itemCategoryInfo) { this.itemCategoryInfo = itemCategoryInfo; } public String getItemCategoryLastUpdatedBy() { return itemCategoryLastUpdatedBy; } public void setItemCategoryLastUpdatedBy(String itemCategoryLastUpdatedBy) { this.itemCategoryLastUpdatedBy = itemCategoryLastUpdatedBy; } public LocalDateTime getItemCategoryLastUpdatedOn() { return itemCategoryLastUpdatedOn; } public void setItemCategoryLastUpdatedOn(LocalDateTime itemCategoryLastUpdatedOn) { this.itemCategoryLastUpdatedOn = itemCategoryLastUpdatedOn; } }
package pl.lua.aws.core.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import pl.lua.aws.core.model.TournamentEntity; @Repository public interface TournamentRepository extends JpaRepository<TournamentEntity,Long> { }
package com.dayuanit.shop.service; import java.util.List; import java.util.Map; import java.util.Set; public interface RedisService { boolean hasKey(String key); void setListPCA(String key, List<Map<String, String>> value); List<Map<String, String>> getPCA(String key); String popPayMsg(); void saveCartId(List<Integer> cartIds, Integer userId); Set<Integer> getCartId(Integer userId); void deleteKey(String key); }
package closest; public class Solutiontest { public static void main (String []args){ Solution s = new Solution (); int array[] = {1,5}; System.out.println(s.closest(array, 6)); } }
class Solution { public String reverseVowels(String s) { ArrayList<Character> vowels = new ArrayList<>(); for(char c : s.toCharArray()){ if(isVowel(Character.toLowerCase(c))) vowels.add(c); } int currIndexOfVowel = vowels.size() - 1; char[] sArray = s.toCharArray(); for(int i=0; i<sArray.length;i++){ if(isVowel(Character.toLowerCase(sArray[i]))){ sArray[i] = vowels.get(currIndexOfVowel--); } } return new String(sArray); } public boolean isVowel(char c){ if(c == 'a' || c == 'e' || c== 'i' || c=='o' || c=='u') return true; return false; } }
package org.search.flight.model.passengers; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import org.search.flight.model.Discount; public abstract class Passenger { private List<Discount> discountList = new ArrayList<Discount>(0); private String name; private String gender; private int age; private BigDecimal price = new BigDecimal(0); public Passenger(String name, String gender, int age) { this.name = name; this.gender = gender; this.age = age; } public Passenger(){ } public Passenger(Passenger passenger) { } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the gender */ public String getGender() { return gender; } /** * @param gender the gender to set */ public void setGender(String gender) { this.gender = gender; } /** * @return the age */ public int getAge() { return age; } /** * @param age the age to set */ public void setAge(int age) { this.age = age; } public List<Discount> getDiscountList() { return discountList; } public void setTarifas(List<Discount> discountList) { this.discountList = discountList; } public void addTarifa(Discount discount){ this.discountList.add(discount); } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public String getFormatPrice() { return price.setScale(2, BigDecimal.ROUND_HALF_EVEN).toString() + "€"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + age; result = prime * result + ((gender == null) ? 0 : gender.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((price == null) ? 0 : price.hashCode()); result = prime * result + ((discountList == null) ? 0 : discountList.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Passenger other = (Passenger) obj; if (age != other.age) return false; if (gender == null) { if (other.gender != null) return false; } else if (!gender.equals(other.gender)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (price == null) { if (other.price != null) return false; } else if (!price.equals(other.price)) return false; if (discountList == null) { if (other.discountList != null) return false; } else if (!discountList.equals(other.discountList)) return false; return true; } @Override public String toString() { return "Passenger [discountList=" + discountList + ", name=" + name + ", gender=" + gender + ", age=" + age + ", price=" + price + "]"; } }
package com.chf.proxy; /** * ${DESCRIPTION} * * @author 温柔一刀 * @create 2018-04-07 10:32 **/ public class User { public void say(){ System.out.println("user say().............."); } }
package ga.trialVector; import ga.Individual; /** * Abstract class for Trial Vector used in Differential Evolution. */ public abstract class TrialVector { protected Individual one; protected Individual two; protected Individual three; protected double beta; /** * Constructs a trial vector given three individuals. * * @param one best individual in population * @param two randomly selected individual * @param three randomly selected individual * @param beta learning rate */ public TrialVector(Individual one, Individual two, Individual three, double beta) { super(); this.one = one; this.two = two; this.three = three; this.beta = beta; } /** * Creates a vector based on the best individual in the population * and two randomly selected individuals. * * @return An individual whose genes are the newly created vector. */ public abstract Individual getTrialVector(); }
import java.io.IOException; public class Test4 { private static void assertPerfect(Maze m) { assert(m.isPerfect()) : "maze is not perfect"; } public static void main(String[] args) throws IOException { //Pour s'assurer que les assert's sont activés if (!Test4.class.desiredAssertionStatus()) { System.err.println("Vous devez activer l'option -ea de la JVM"); System.err.println("(Run As -> Run configurations -> Arguments -> VM Arguments)"); System.exit(1); } System.out.print("testing whether generateWilson() generates perfect mazes... "); Maze m = new Maze(25, 25); m.generateWilson(); assertPerfect(m); for(int k = 0; k < 10; ++k) { m = new Maze(5, 5, false); m.generateWilson(); assertPerfect(m); } System.out.println("\t[OK]"); System.out.print("testing uniformity of generateWilson()... "); Maze m3 = new Maze("maze3.txt", false); int cnt = 0; // Chernoff bound parameters final int nbMazes = 192; final int K = 1000000; final double mu = K / (double) nbMazes; final double eps = 0.01; final double delta = Math.sqrt( 3*Math.log(2/eps)/mu ); for(int k = 0; k < K; ++k) { m = new Maze(3, 3, false); m.generateWilson(); m.clearMarks(); if(m.equals(m3)) ++cnt; } assert( cnt > (1-delta)*mu && cnt < (1+delta)*mu ) : "not uniform"; System.out.println("\t\t\t[OK]"); } }
package com.university.wanstudy.view; import android.content.Context; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.university.wanstudy.R; /** * 自定义TopBar * 构造函数使用this调用的好处 * 方便我们统一管理,无论从那个构造进入,都会调用三个参数的构造 */ public class TopBar extends LinearLayout implements View.OnClickListener { private static final String TAG = TopBar.class.getSimpleName(); private ImageView back; private TextView title; private Context context; public TopBar(Context context) { this(context, null); } public TopBar(Context context, AttributeSet attrs) { this(context, attrs, 0); } public TopBar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; //实例化inflater来填充布局 LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.topbar, this, true); //findViewById查找子view back = ((ImageView) findViewById(R.id.topbar_back)); title = ((TextView) findViewById(R.id.topbar_title)); title.setTextColor(Color.WHITE); //默认都是隐藏,只有设置属性时才显示出来 back.setVisibility(INVISIBLE); title.setVisibility(INVISIBLE); } /** * 设置Title * * @param content */ public void setTitle(String content) { title.setVisibility(VISIBLE); title.setText(content); } /** * 设置回退按钮 */ public void setBack() { back.setVisibility(VISIBLE); back.setOnClickListener(this); } /** * 设置回退监听 */ public void setBackListener(OnClickListener listener) { back.setVisibility(VISIBLE); back.setOnClickListener(listener); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.topbar_back: //调用Activity的finish方法 Log.e(TAG, "回退"); ((AppCompatActivity) context).finish(); break; } } }
package jp.abyss.sysparticle.api.particle.model; import jp.abyss.sysparticle.api.particle.PointParticleListEditable; public interface FreePointParticle extends PointParticleModel, PointParticleListEditable, HierarchicalModel { }
/* * 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 safeflyeu.view; import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListModel; import javax.swing.JOptionPane; import safeflyeu.controller.ObradaKorisnik; import safeflyeu.controller.ObradaOsiguranje; import safeflyeu.model.Korisnik; import safeflyeu.model.Osiguranje; import safeflyeu.pomocno.SafeFlyEUException; /** * * @author labak */ public class Korisnici extends javax.swing.JFrame { private final ObradaKorisnik obradaEntitet; private static DefaultComboBoxModel<Osiguranje> modelOsiguranje; /** * Creates new form Korisnici */ public Korisnici() { initComponents(); obradaEntitet = new ObradaKorisnik(); DefaultComboBoxModel<Osiguranje> os = new DefaultComboBoxModel<>(); Osiguranje o = new Osiguranje(); o.setId(0); o.setNaziv("Odaberite osiguranje"); os.addElement(o); new ObradaOsiguranje().getLista().forEach((s) -> { os.addElement(s); }); cmbOsiguranja.setModel(os); ucitajPodatke(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); lstEntiteti = new javax.swing.JList<>(); jButton1 = new javax.swing.JButton(); btnDodaj = new javax.swing.JButton(); btnPromjena = new javax.swing.JButton(); btnBrisanje = new javax.swing.JButton(); txtOib = new javax.swing.JTextField(); txtEmail = new javax.swing.JTextField(); txtPrezime = new javax.swing.JTextField(); txtIme = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); cmbOsiguranja = new javax.swing.JComboBox<>(); txtUvjet = new javax.swing.JTextField(); chbLimitator = new javax.swing.JCheckBox(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Korisnici"); setUndecorated(true); jLabel1.setText("Ime"); jLabel2.setText("Prezime"); jLabel3.setText("Email"); jLabel4.setText("Oib"); jLabel5.setText("Osiguranje"); lstEntiteti.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { lstEntitetiValueChanged(evt); } }); jScrollPane1.setViewportView(lstEntiteti); jButton1.setText("Exit"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); btnDodaj.setText("Dodaj"); btnDodaj.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDodajActionPerformed(evt); } }); btnPromjena.setText("Promjena"); btnPromjena.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPromjenaActionPerformed(evt); } }); btnBrisanje.setText("Brisanje"); btnBrisanje.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBrisanjeActionPerformed(evt); } }); jLabel6.setText("Korisnici"); txtUvjet.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txtUvjetKeyReleased(evt); } }); chbLimitator.setSelected(true); chbLimitator.setText("Limitiraj na 50 rezultata"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(txtUvjet)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(chbLimitator) .addComponent(jLabel1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(cmbOsiguranja, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtOib) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addComponent(jLabel4) .addComponent(jLabel3) .addComponent(jLabel2) .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txtPrezime, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtIme, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(88, 88, 88)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(btnDodaj, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(46, 46, 46) .addComponent(btnPromjena, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(39, 39, 39) .addComponent(btnBrisanje, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(52, Short.MAX_VALUE)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6)) .addGap(16, 16, 16) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(chbLimitator) .addComponent(txtUvjet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(19, 19, 19) .addComponent(jLabel1) .addGap(7, 7, 7) .addComponent(txtIme, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel2) .addGap(9, 9, 9) .addComponent(txtPrezime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtOib, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(3, 3, 3) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cmbOsiguranja, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1))) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnBrisanje) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnDodaj) .addComponent(btnPromjena))) .addContainerGap(34, Short.MAX_VALUE)) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed dispose(); }//GEN-LAST:event_jButton1ActionPerformed private void btnDodajActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDodajActionPerformed Korisnik entitet = new Korisnik(); preuzmiVrijednosti(entitet); try { obradaEntitet.save(entitet); } catch (SafeFlyEUException e) { JOptionPane.showConfirmDialog(null, e.getMessage()); return; } ucitajPodatke(); ocistiPolja(); }//GEN-LAST:event_btnDodajActionPerformed private void btnPromjenaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPromjenaActionPerformed Korisnik entitet = lstEntiteti.getSelectedValue(); if (entitet == null) { JOptionPane.showConfirmDialog(null, "Prvo odaberite korisnika"); } preuzmiVrijednosti(entitet); try { obradaEntitet.save(entitet); } catch (SafeFlyEUException e) { JOptionPane.showConfirmDialog(null, e.getMessage()); return; } ucitajPodatke(); ocistiPolja(); }//GEN-LAST:event_btnPromjenaActionPerformed private void btnBrisanjeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrisanjeActionPerformed Korisnik entitet = lstEntiteti.getSelectedValue(); if (entitet == null) { JOptionPane.showConfirmDialog(null, "Prvo odaberite korisnika"); } try { obradaEntitet.obrisi(entitet); ucitajPodatke(); ocistiPolja(); } catch (SafeFlyEUException ex) { JOptionPane.showMessageDialog(null, "Ne mogu obrisati"); } }//GEN-LAST:event_btnBrisanjeActionPerformed private void lstEntitetiValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstEntitetiValueChanged if (evt.getValueIsAdjusting()) { return; } Korisnik entitet = lstEntiteti.getSelectedValue(); if (entitet == null) { return; } ocistiPolja(); txtIme.setText(entitet.getIme()); txtPrezime.setText(entitet.getPrezime()); txtEmail.setText(entitet.getEmail()); txtOib.setText(entitet.getOib()); modelOsiguranje = (DefaultComboBoxModel<Osiguranje>) cmbOsiguranja.getModel(); for (int i = 0; i < modelOsiguranje.getSize(); i++) { if (modelOsiguranje.getElementAt(i).getId() == entitet.getOsiguranje().getId()) { cmbOsiguranja.setSelectedIndex(i); break; } } }//GEN-LAST:event_lstEntitetiValueChanged private void txtUvjetKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtUvjetKeyReleased //if(evt.getKeyCode()==KeyEvent.VK_ENTER){ ucitajPodatke(); // } }//GEN-LAST:event_txtUvjetKeyReleased /** * @param args the command line arguments */ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnBrisanje; private javax.swing.JButton btnDodaj; private javax.swing.JButton btnPromjena; private javax.swing.JCheckBox chbLimitator; private javax.swing.JComboBox<Osiguranje> cmbOsiguranja; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JList<Korisnik> lstEntiteti; private javax.swing.JTextField txtEmail; private javax.swing.JTextField txtIme; private javax.swing.JTextField txtOib; private javax.swing.JTextField txtPrezime; private javax.swing.JTextField txtUvjet; // End of variables declaration//GEN-END:variables private void ocistiPolja() { txtIme.setText(""); txtPrezime.setText(""); txtEmail.setText(""); txtOib.setText(""); cmbOsiguranja.setSelectedIndex(0); } private void preuzmiVrijednosti(Korisnik entitet) { entitet.setIme(txtIme.getText()); entitet.setPrezime(txtPrezime.getText()); entitet.setEmail(txtEmail.getText()); entitet.setOib(txtOib.getText()); entitet.getOsiguranje((Osiguranje) cmbOsiguranja.getSelectedItem()); } private void ucitajPodatke() { DefaultListModel<Korisnik> m = new DefaultListModel<>(); for (Korisnik entitet : obradaEntitet.getLista()) { m.addElement(entitet); } lstEntiteti.setModel(m); } // private class DuzeUcitanjeEntiteta extends Thread { // // @Override // public void run() { // DefaultListModel<Korisnik> m = new DefaultListModel<>(); // for (Korisnik k : obradaEntitet.getLista(txtUvjet.getText().trim(), chbLimitator.isSelected())) { // m.addElement(k); // } // lstEntiteti.setModel(m); // } // // } }
package com.freak.printtool.hardware.print.bean; /** * 这是标签打印机 * * @anthor dmin * created at 2017/7/18 12:05 * 现在是没有等级和规格 */ /** * 增加自定义编码 * * @author Freak * @date 2019/8/13. */ public class ProductLabelBean { //商品id private String productId; // 名字 private String name; // private List<Specifications> specifications;//规格 // private List<SpecificationValues> specificationValues;//这是规则 具体的形式 // private String grade;//等级 现在的json没有这个字段 // 产地 private String producer; // 零售价 private String price; // 计量单位 private String unit; // 条码 需要去掉商家id private String sn; //会员价 private String cash; //积分 private String eprice; //新增 //库存 private String stock; //是否称重 private String isWeighing; //是否自定义编码 private String isCustom; //是否多个条码,打印标签时使用 private boolean multiCode; private String type; private String supervisor;//物价员 private String rank;//等级 private String specification;//规格 private boolean isChecked; public boolean isChecked() { return isChecked; } public void setChecked(boolean checked) { isChecked = checked; } public String getSupervisor() { return supervisor; } public void setSupervisor(String supervisor) { this.supervisor = supervisor; } public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } public String getSpecification() { return specification; } public void setSpecification(String specification) { this.specification = specification; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getProducer() { return producer; } public void setProducer(String producer) { this.producer = producer; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getSn() { return sn; } public void setSn(String sn) { this.sn = sn; } public String getCash() { return cash; } public void setCash(String cash) { this.cash = cash; } public String getEprice() { return eprice; } public void setEprice(String eprice) { this.eprice = eprice; } public String getCashAndEPrice() { return this.getCash() + " " + this.getEprice(); } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getStock() { return stock; } public void setStock(String stock) { this.stock = stock; } public String getIsWeighing() { return isWeighing; } public void setIsWeighing(String isWeighing) { this.isWeighing = isWeighing; } public String getIsCustom() { return isCustom; } public void setIsCustom(String isCustom) { this.isCustom = isCustom; } public boolean isMultiCode() { return multiCode; } public void setMultiCode(boolean multiCode) { this.multiCode = multiCode; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public String toString() { return "ProductLabelBean{" + "productId='" + productId + '\'' + ", name='" + name + '\'' + ", producer='" + producer + '\'' + ", price='" + price + '\'' + ", unit='" + unit + '\'' + ", sn='" + sn + '\'' + ", cash='" + cash + '\'' + ", eprice='" + eprice + '\'' + ", stock='" + stock + '\'' + ", isWeighing='" + isWeighing + '\'' + ", isCustom='" + isCustom + '\'' + ", multiCode=" + multiCode + ", type='" + type + '\'' + ", supervisor='" + supervisor + '\'' + ", rank='" + rank + '\'' + ", specification='" + specification + '\'' + '}'; } }
package phor.uber.web; import java.util.Arrays; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; /** * Controller for all RESTful search queries done by the Front End. * * @author Ben * */ @Controller public class SearchController extends AbstractController{ protected final Log logger = LogFactory.getLog(getClass()); private static final String AC_QUERY = "http://localhost:9200/locations/_suggest"; private static final String SEARCH_QUERY = "http://localhost:9200/locations/_search"; private static final String BYID_QUERY = "http://localhost:9200/locations/sf/"; private static final String[] STEM_FIELDS = {"actor_1", "actor_2", "actor_3", "title", "locations", "production_company", "distributor", "writer", "director", "release_year"}; @RequestMapping(value={"/","/index.html","/index.htm"}, method=RequestMethod.GET) public String home( HttpServletRequest req, Model model ){ setFrontEndVariables(model, req); return "home"; } @RequestMapping(value="/byid/{id}", method=RequestMethod.GET) public String byId( @PathVariable long id, Model model ){ return sendElasticSearch(BYID_QUERY+id, model); } @RequestMapping(value="/selectAll", method=RequestMethod.GET) public String selectAll(Model model){ /* "fields" : ["lat", "lng", "title"], "query" : { "match_all": {} } */ JSONArray jarr = new JSONArray(); jarr.add("lat"); jarr.add("lng"); jarr.add("title"); JSONObject jobj2 = new JSONObject(); jobj2.put("match_all", new JSONObject()); JSONObject jobj = new JSONObject(); jobj.put("fields", jarr); jobj.put("query", jobj2); return sendElasticSearch(SEARCH_QUERY+"?size=900", jobj.toJSONString(), model); } @RequestMapping(value="/autocomplete/{stem}", method=RequestMethod.GET) public String autocomplete( @PathVariable String stem, Model model ){ /* { "loc_suggest":{ "text":"to", "completion": { "field" : "auto_complete" } } } */ JSONObject jobj1 = new JSONObject(); jobj1.put("text", stem); JSONObject jobj2 = new JSONObject(); jobj2.put("field", "auto_complete"); jobj1.put("completion", jobj2); JSONObject jobj = new JSONObject(); jobj.put("suggest", jobj1); return sendElasticSearch(AC_QUERY, jobj.toJSONString(), model); } @RequestMapping(value="/exactSearch", method=RequestMethod.POST) public void explicitSearch( @RequestParam("search") String searchString, HttpServletResponse resp){ /* { "query" : { "query_string" : { "query": "Valencia St. from 16th to 17th", "default_operator" : "AND" } } } */ JSONObject jobj2 = new JSONObject(); jobj2.put("query", searchString); jobj2.put("default_operator", "AND"); JSONObject jobj1 = new JSONObject(); jobj1.put("query_string", jobj2); JSONObject jobj = new JSONObject(); jobj.put("query", jobj1); sendElasticSearch(SEARCH_QUERY, jobj.toJSONString(), resp); } @RequestMapping(value="/looseSearch", method=RequestMethod.POST) public void looseSearch( @RequestParam("search") String searchString, HttpServletResponse resp ){ /* { "query" : { "query_string" : { "fields" : ["actor_1", "actor_2", "actor_3", "title", "locations", "production_company", "distributor", "writer"], "query": "Valencia St. from 16th to 17th", } } } */ JSONArray fieldArr = new JSONArray(); fieldArr.addAll(Arrays.asList(STEM_FIELDS)); JSONObject jobj2 = new JSONObject(); jobj2.put("query", searchString); jobj2.put("fields", fieldArr); JSONObject jobj1 = new JSONObject(); jobj1.put("query_string", jobj2); JSONObject jobj = new JSONObject(); jobj.put("query", jobj1); sendElasticSearch(SEARCH_QUERY, jobj.toJSONString(), resp); } @RequestMapping(value="/byField/{fieldName}/{searchString}", method=RequestMethod.GET) public String searchByField( @PathVariable String fieldName, @PathVariable String searchString, Model model ){ /* { "query" : { "query_string" : { "fields" : ["fieldName"], "query": "Valencia St. from 16th to 17th", "default_operator" : "AND" } } } */ JSONArray fieldArr = new JSONArray(); fieldArr.add(fieldName); JSONObject jobj2 = new JSONObject(); jobj2.put("query", searchString); jobj2.put("fields", fieldArr); jobj2.put("default_operator", "AND"); JSONObject jobj1 = new JSONObject(); jobj1.put("query_string", jobj2); JSONObject jobj = new JSONObject(); jobj.put("query", jobj1); return sendElasticSearch(SEARCH_QUERY, jobj.toJSONString(), model); } ///////////////////////////////////////////////////// ///////////////////////////////////////////////////// ///////////////////////////////////////////////////// }
package Concurrency;/** * Created by pc on 2018/2/17. */ import Util.Listoff; /** * describe: * * @author xxx * @date4 {YEAR}/02/17 */ public class BasicThreads { public static void main(String[] args){ Thread t = new Thread(new Listoff()); t.start(); System.out.print("waiting for listoff"); } }
package com.pangpang6.hadoop.hadoop2.tq; import com.pangpang6.utils.MyJSONMapper; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; /** * Created by jiangjiguang on 2018/3/25. */ public class TQReducer extends Reducer<Weather, IntWritable, Text, NullWritable> { private static final Logger logger = LoggerFactory.getLogger(TQReducer.class); @Override protected void reduce(Weather key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { logger.info(String.format("reduce: key=%s, values", key.toString(), MyJSONMapper.nonDefaultMapper().toJSONString(values))); int flag = 0; for (IntWritable i : values) { flag++; if (flag > 32) { break; } String msg = key.toString() + "-" + i.get(); context.write(new Text(msg), NullWritable.get()); } } }
package visualizations.drawmodifiers; import graphana.graphs.visualization.drawmodifiers.ProjectionPlane; import graphana.graphs.visualization.drawmodifiers.VertexFixedSizeShape; import graphana.model.mathobjects.DimensionD; import graphana.model.mathobjects.Vector2D; import java.awt.*; /** * Rectangular shape with manually adjustable dimensions * * @author Andreas Fender */ public class FixedRectShape extends VertexFixedSizeShape { public final static FixedRectShape DEFAULT = new FixedRectShape(); public final static FixedRectShape ENTITY = new FixedRectShape(1, 1); private double halfWidth; private double halfHeight; /** * Creates an instance with the given dimensions */ public FixedRectShape(double halfWidth, double halfHeight) { this.halfWidth = halfWidth; this.halfHeight = halfHeight; } /** * Creates an instance with the x and y dimensions 0.06 and 0.045 */ public FixedRectShape() { this(0.06f, 0.045f); } /** * Given a direction from the center, returns the position on the edge of the rectangle with the given dimensions * * @param direction the direction from center outwards * @param rX the x dimension of the rectangle * @param rY the y dimension of the rectangle * @return the position on the rectangle edge as a vector */ public static Vector2D getDockingCoordinates(Vector2D direction, double rX, double rY) { if (Math.abs(direction.getX()) * rY <= Math.abs(direction.getY() * rX)) return new Vector2D(Math.signum(direction.getY()) * rY / direction.getY() * direction.getX(), Math.signum (direction.getY()) * rY); else return new Vector2D(Math.signum(direction.getX()) * rX, Math.signum(direction.getX()) * rX / direction .getX() * direction.getY()); } @Override public void draw(Graphics gfx, int x, int y, ProjectionPlane plane, boolean filled, DimensionD scale) { int rX = (int) (plane.projWidth(halfWidth * scale.getX())); int rY = (int) (plane.projHeight(halfHeight * scale.getY())); if (filled) gfx.fillRect(x - rX, y - rY, 2 * rX, 2 * rY); else gfx.drawRect(x - rX, y - rY, 2 * rX, 2 * rY); } @Override public boolean pick(double relX, double relY, DimensionD scale) { double rX = halfWidth * scale.getX(); double rY = halfHeight * scale.getY(); return (relX <= rX) && (relX >= -rX) && (relY <= rY) && (relY >= -rY); } @Override public Vector2D normalizedDockingCoordinates(Vector2D direction, DimensionD scale) { return getDockingCoordinates(direction, halfWidth * scale.getX(), halfHeight * scale.getY()); } @Override public double getWidth() { return halfWidth * 2; } @Override public double getHeight() { return halfHeight * 2; } }
package assemAssist.model.order.singleTaskOrder; import java.util.Arrays; import java.util.List; import org.joda.time.DateTime; import org.joda.time.Duration; import assemAssist.model.exceptions.IllegalDeadlineException; import assemAssist.model.factoryline.workStation.WorkStation; import assemAssist.model.option.VehicleOption; import assemAssist.model.order.Customer; import assemAssist.model.order.OrderVisitor; import assemAssist.model.order.order.ModifiableOrder; import com.google.common.base.Optional; /** * A {@link SingleTaskOrder} which is modifiable. * * @author SWOP Group 3 * @version 3.0 * @see SingleTaskOrder */ public class ModifiableSingleTaskOrder extends ModifiableOrder implements SingleTaskOrder { private static final Duration DEFAULT_EXPECTED_TIME_AT_WORKSTATION = Duration .standardMinutes(60); /** * Initialises a new single task order with a given customer, option and * optional deadline. * * @param customer * The customer who placed the order * @param option * The option for which the tasks have to be executed * @param deadline * The optional deadline for this single task order * @throws IllegalDeadlineException * Thrown when one of the given deadline is not valid */ public ModifiableSingleTaskOrder(Customer customer, VehicleOption option, Optional<DateTime> deadline) throws IllegalDeadlineException { super(customer, Arrays.asList(option)); if (!isValidDeadline(deadline)) { throw new IllegalDeadlineException("The given deadline is invalid."); } this.deadline = deadline; } /** * {@inheritDoc} */ @Override public boolean isValidDeadline(Optional<DateTime> deadline) { return deadline != null; } /** * {@inheritDoc} */ @Override public boolean isValidOptions(List<VehicleOption> options) { if (options == null || options.size() != 1 || options.get(0) == null) { return false; } return true; } /** * {@inheritDoc} */ @Override public Duration getExpectedTimeAtWorkstation(WorkStation station) throws IllegalArgumentException { if (station == null) { throw new IllegalArgumentException("The given workstation is invalid."); } if (station.areCompleteableTasks(getTasks())) { return DEFAULT_EXPECTED_TIME_AT_WORKSTATION; } else { return Duration.ZERO; } } /** * {@inheritDoc} */ @Override public Optional<DateTime> getDeadline() { return deadline; } private Optional<DateTime> deadline; /** * {@inheritDoc} */ @Override public <T> T accept(OrderVisitor<T> visitor) { return visitor.visit(this); } /** * {@inheritDoc} */ @Override public SingleTaskOrder getOrderProxy() { return new SingleTaskOrderProxy(this); } }
package com.voidm.demo; import com.sun.jna.Library; import com.sun.jna.Native; /** * @author voidm * @date 2020/12/7 */ // <dependency> // <groupId>net.java.dev.jna</groupId> // <artifactId>jna-platform</artifactId> // <version>5.2.0</version> // </dependency> public class DllCalledMyDLLDemo { /* MyDll-Project.dll int echoAge() { MessageBox(NULL, TEXT("Hello,world!"), TEXT(""), MB_OK); return 12; } */ public interface Dll extends Library { // 调用自定义 DLL Dll instance = (Dll) Native.load("MyDll-Project", Dll.class); int echoAge(int age ); } public static void main(String[] args) { System.out.println(Dll.instance.echoAge(122)); } }
package laioffer.June28th; import common.TreeNode; import common.Utils; import java.util.LinkedList; import java.util.List; import java.util.Queue; /** * Created by mengzhou on 6/28/17. */ public class ZigZagOrderTraversal { public List<Integer> zigZag(TreeNode root) { List<Integer> res = new LinkedList<>(); if(root == null) return res; Queue<TreeNode> queue = new LinkedList<>(); queue.add(root); queue.add(null); int layer = 1; int pos = 0; while(!queue.isEmpty()) { TreeNode node = queue.poll(); if(node == null) { layer++; } else { if(layer % 2 == 0) { res.add(node.val); pos = res.size(); } else { res.add(pos, node.val); } if(node.left != null) queue.offer(node.left); if(node.right != null) queue.offer(node.right); if(queue.peek() == null) { queue.offer(null); } } } return res; } public static void main(String[] args) { ZigZagOrderTraversal app = new ZigZagOrderTraversal(); Utils.printList(app.zigZag(Utils.buildTree("1, 2, 3, #, #, 4"))); Utils.printList(app.zigZag(Utils.buildTree("5, 3, 8, 1, 4, #, 11"))); } }
package com.tencent.d.a.b; import android.os.Build.VERSION; import com.tencent.d.a.c.c; import java.security.spec.AlgorithmParameterSpec; public abstract class a { public abstract a M(String... strArr); public abstract a N(String... strArr); public abstract AlgorithmParameterSpec cFH(); public abstract a cFI(); public static a acE(String str) { if (!com.tencent.d.a.a.cFz()) { c.e("Soter.KeyGenParameterSpecCompatBuilder", "soter: not support soter. return dummy", new Object[0]); return new a(); } else if (VERSION.SDK_INT >= 23) { return new b(str); } else { return new c(str); } } public static String[] O(String[] strArr) { return (strArr == null || strArr.length <= 0) ? strArr : (String[]) strArr.clone(); } }
package com.golubov.model; import javax.persistence.Entity; import javax.persistence.Id; import java.io.Serializable; import java.math.BigDecimal; /** * Created by SGolubov on 7/28/2015. */ @Entity public class CcyEntity implements Serializable { private static final long serialVersionUID = -5306337999074811800L; @Id private String ccy; private BigDecimal value; public CcyEntity() { } public CcyEntity(String ccy, BigDecimal value) { this.ccy = ccy; this.value = value; } public String getCcy() { return ccy; } public void setCcy(String ccy) { this.ccy = ccy; } public BigDecimal getValue() { return value; } public void setValue(BigDecimal value) { this.value = value; } }
package com.jst.web.question; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.jst.model.QuestionsTag; import com.jst.myservice.question.QuestionsTagService; import com.jst.utils.JsonUtils; import com.jst.ztree.ZtreeNode; @Controller @RequestMapping("/admin/questions") public class QuestionsTagController { @Autowired private QuestionsTagService questionsTagService; @RequestMapping("/toQuestionsTagList") public ModelAndView toQuestionsTag() { ModelAndView mv=new ModelAndView(); List<ZtreeNode> list=questionsTagService.listAll(); String json=JsonUtils.objectToJson(list); mv.addObject("json", json); mv.setViewName("/manager/QuestionsTag"); return mv; } @RequestMapping("/delQuestionsTag") @ResponseBody public String delQuestionsTag(int qtid) { // System.out.println(qtid); questionsTagService.delete(qtid); return "redirect:/admin/questions/toQuestionsTagList"; } @RequestMapping("/save") public String insertTag(QuestionsTag questionsTag) { questionsTag.setCreate_time(new Date()); questionsTagService.save(questionsTag); // System.out.println(questionsTag); return "redirect:/admin/questions/toQuestionsTagList"; } @RequestMapping("/updateTag") @ResponseBody public String updateTag(@RequestParam(value = "id", defaultValue = "0") int qtid,@RequestParam(value = "name", defaultValue = "null")String tagName) { QuestionsTag questionsTag=new QuestionsTag(); questionsTag.setQuestions_tag_id(qtid); questionsTag.setQuestions_tag_name(tagName); questionsTag.setCreate_time(new Date()); System.out.println(questionsTag); questionsTagService.update(questionsTag); return "redirect:/admin/questions/toQuestionsTagList"; } }
package cristianjlp.menu_probest; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; /** * Created by Cristianjlp on 24/10/2017. */ public class Ejerciciouno extends AppCompatActivity{ private EditText etNumeros; private TextView tv4, mostrarCadena; ArrayList<Double> lista = new ArrayList<>(); double media,varVarianza; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ejerciciouno); tv4=(TextView)findViewById(R.id.tv4); etNumeros=(EditText)findViewById(R.id.editTextNumeros); mostrarCadena=(TextView)findViewById(R.id.tvCadena); } public void agregar_valores(View view){ String cadena=etNumeros.getText().toString(); if (cadena.equals("")){ Toast toast1 = Toast.makeText(getApplicationContext(), "INGRESE MINIMO 2 VALORES", Toast.LENGTH_SHORT); toast1.show(); }else { double cadena2 = Double.parseDouble(cadena); if (cadena != "") { lista.add(cadena2); mostrarCadena.setText(lista.toString()); etNumeros.setText(""); } } } public void media (View view){ if (lista.size()==0){ Toast toast1 = Toast.makeText(getApplicationContext(), "no hay numeros", Toast.LENGTH_SHORT); toast1.show(); }else{ media2(); } } public void mediana(View view) { if (lista.size()==0){ Toast toast1 = Toast.makeText(getApplicationContext(), "no hay numeros", Toast.LENGTH_SHORT); toast1.show(); } else { Collections.sort(lista); mostrarCadena.setText(lista.toString()); int mediana = lista.size() / 2; mostrarCadena.setText(lista.toString()); etNumeros.setText(""); String cadenaMediana; if (lista.size() % 2 == 0) { Double mediana3 = (lista.get(mediana) + lista.get(mediana - 1)) / 2; cadenaMediana = Double.toString(mediana3); tv4.setText(cadenaMediana); } else { Double mediana3 = lista.get(mediana); cadenaMediana = Double.toString(mediana3); tv4.setText(cadenaMediana); } } } public void varianza(View view){ if (lista.size()==0){ Toast toast1 = Toast.makeText(getApplicationContext(), "no hay numeros", Toast.LENGTH_SHORT); toast1.show(); }else { varianza2(); } } public void desviacion_estandar(View view){ if (lista.size()==0){ Toast toast1 = Toast.makeText(getApplicationContext(), "no hay numeros", Toast.LENGTH_SHORT); toast1.show(); }else { varianza2(); Double desEstandar; desEstandar = Math.sqrt(varVarianza); String imprime = Double.toString(desEstandar); tv4.setText(imprime); } } public void moda(View view){ if (lista.size()==0){ Toast toast1 = Toast.makeText(getApplicationContext(), "no hay numeros", Toast.LENGTH_SHORT); toast1.show(); }else { int maximaVecesQueSeRepite = 0; double moda = 0; for (int i = 0; i < lista.size(); i++) { int vecesQueSeRepite = 0; for (int j = 0; j < lista.size(); j++) { if (lista.get(i).equals(lista.get(j))) { vecesQueSeRepite++; } } if (vecesQueSeRepite > maximaVecesQueSeRepite) { moda = lista.get(i); maximaVecesQueSeRepite = vecesQueSeRepite; } } String imprime = Double.toString(moda); tv4.setText(imprime); } } public void limpiarArray(View view){ lista.clear(); mostrarCadena.setText(lista.toString()); tv4.setText("Resultado"); } private void varianza2(){ media2(); double varianza=0; double pre=0; Iterator it = lista.iterator(); while ( it.hasNext() ) { double objeto= (double) it.next(); pre=objeto-media; varianza=varianza+(pre*pre); } varianza=varianza/lista.size(); varVarianza=varianza; String imprime = Double.toString(varianza); tv4.setText(imprime); } private void media2() { double suma2=0.0; Iterator it = lista.iterator(); while ( it.hasNext() ) { double objeto= (double) it.next(); suma2=suma2+objeto; } suma2=suma2/lista.size(); media=suma2; String total2 = Double.toString(suma2); tv4.setText(total2); } public void salir(View view){ finish(); } }
package com.nuuedscore.refdata; /** * Gender enum * Constants that classify a Persons gender * * @author PATavares * @since Feb 2021 * */ public enum RefGender { FEMALE("Female"), MALE("Male"), NEUTRAL("Neutral"); private String gender; RefGender(String gender) { this.gender = gender; } public String gender() { return gender; } }
package wurstball; import java.util.Observable; import wurstball.data.PictureElement; import wurstball.data.WurstballData; /** * A runnable class to load a picture from the internet in a thread * * @author Sydrimon */ public class ImageLoader extends Observable implements Runnable { public static final int THREAD_POOL_SIZE = 8; @Override public void run() { addObserver(ThreadController.getInstance()); while (true) { try { String url = WurstballData.getInstance().getPicUrl(); if (url != null) { WurstballData.getInstance().addPicToBuffer( new PictureElement(url)); } else { //todo notify ThreadController that thread is dead notifyObservers(); return; } } catch (InterruptedException ex) { //todo notify ThreadController that thread is dead notifyObservers(); return; } } } }
package com.appliedrec.verid.kiosk; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class RegisteredUserAdapter extends RecyclerView.Adapter<RegisteredUserAdapter.RegisteredUserViewHolder> { public interface RegisteredUserButtonsListener { void onDeleteUser(String userId); void onAuthenticateUser(String userId); } private final LayoutInflater layoutInflater; private String[] users = new String[0]; private final RegisteredUserButtonsListener registeredUserButtonsListener; public RegisteredUserAdapter(Context context, RegisteredUserButtonsListener registeredUserButtonsListener) { this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.registeredUserButtonsListener = registeredUserButtonsListener; } @Override @NonNull public RegisteredUserViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = layoutInflater.inflate(R.layout.list_item_registered_user, parent, false); return new RegisteredUserViewHolder(view, registeredUserButtonsListener); } @Override public void onBindViewHolder(RegisteredUserViewHolder holder, int position) { holder.bind(users[position]); } @Override public int getItemCount() { return users.length; } private void setUsers(String[] users) { UserDiffCallback userDiffCallback = new UserDiffCallback(this.users, users); DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(userDiffCallback); this.users = users; diffResult.dispatchUpdatesTo(this); } public void setUsers(List<String> users) { String[] userArray = new String[users.size()]; users.toArray(userArray); setUsers(userArray); } static class RegisteredUserViewHolder extends RecyclerView.ViewHolder { private final TextView nameTextView; private final Button deleteButton; private final Button authenticateButton; private final RegisteredUserButtonsListener registeredUserButtonsListener; RegisteredUserViewHolder(View itemView, RegisteredUserButtonsListener registeredUserButtonsListener) { super(itemView); nameTextView = itemView.findViewById(R.id.nameTextView); deleteButton = itemView.findViewById(R.id.deleteButton); authenticateButton = itemView.findViewById(R.id.authenticateButton); this.registeredUserButtonsListener = registeredUserButtonsListener; } void bind(final String user) { nameTextView.setText(user); deleteButton.setOnClickListener(v -> { if (registeredUserButtonsListener != null) { registeredUserButtonsListener.onDeleteUser(user); } }); authenticateButton.setOnClickListener(v -> { if (registeredUserButtonsListener != null) { registeredUserButtonsListener.onAuthenticateUser(user); } }); } } static class UserDiffCallback extends DiffUtil.Callback { private final String[] oldUsers; private final String[] newUsers; UserDiffCallback(String[] oldUsers, String[] newUsers) { this.oldUsers = oldUsers; this.newUsers = newUsers; } @Override public int getOldListSize() { return oldUsers.length; } @Override public int getNewListSize() { return newUsers.length; } @Override public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { return oldUsers[oldItemPosition].equals(newUsers[newItemPosition]); } @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return oldUsers[oldItemPosition].equals(newUsers[newItemPosition]); } } }
package univ.m2acdi.apprentissageborel.activity; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.speech.RecognitionListener; import android.speech.SpeechRecognizer; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import univ.m2acdi.apprentissageborel.R; import univ.m2acdi.apprentissageborel.fragment.ListenSpeakOutFragment; import univ.m2acdi.apprentissageborel.util.SpeechRecognizeManager; import univ.m2acdi.apprentissageborel.util.TextSpeaker; import univ.m2acdi.apprentissageborel.util.Util; import static java.util.concurrent.TimeUnit.SECONDS; public class TextToSpeechActivity extends Activity { private final int SHORT_DURATION = 1000; private static int repeatcount; private ImageView speechBtnPrompt; private ImageView repeatButton; private ImageView stepSuccessButton; private TextSpeaker textSpeaker; private TTSpeechAsyncTask textSpeechTask; private SpeechRecognizeManager speechRecognizeManager; private ListenSpeakOutFragment lspFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_text_to_speech); lspFragment = new ListenSpeakOutFragment(); setFragment(lspFragment); repeatcount = 0; textSpeaker = (TextSpeaker) getIntent().getSerializableExtra("speaker"); //textSpeaker.setPitchRate(0.7f); speechBtnPrompt = findViewById(R.id.speech_prompt_btn); speechBtnPrompt.setOnClickListener(onSpeechPromptBtnClickListener); speechBtnPrompt.setVisibility(View.INVISIBLE); stepSuccessButton = findViewById(R.id.step_success_btn); stepSuccessButton.setVisibility(View.INVISIBLE); repeatButton = findViewById(R.id.speech_text_repeat_btn); repeatButton.setOnClickListener(onRepeatSpeechBtnClickListener); speechRecognizeManager = new SpeechRecognizeManager(this); speechRecognizeManager.initVoiceRecognizer(recognitionListener); } @Override protected void onStart() { super.onStart(); } @Override public void onBackPressed() { textSpeaker.destroy(); speechRecognizeManager.destroy(); Intent intent = new Intent(this,MainActivity.class); intent.putExtra("back_to_main",true); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); TextToSpeechActivity.this.finish(); startActivity(intent); } // ************************* LISTENERS DE BUTTONS ********************************* View.OnClickListener onSpeechPromptBtnClickListener = new View.OnClickListener() { @Override public void onClick(View view) { speechBtnPrompt.setImageDrawable(Util.getImageViewByName(getApplicationContext(), "icon_micro_on")); speechBtnPrompt.setVisibility(View.VISIBLE); speechRecognizeManager.startListeningSpeech(); } }; View.OnClickListener onRepeatSpeechBtnClickListener = new View.OnClickListener() { @Override public void onClick(View view) { stepSuccessButton.setVisibility(View.INVISIBLE); textSpeechTask = new TTSpeechAsyncTask(); textSpeechTask.execute(); } }; /** * Gère les transitions de fragment * @param fragment */ void setFragment(Fragment fragment) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.lspFragmentContainer, fragment, null); ft.commit(); } /** * */ public void speakOutViewText() { TextView textView = findViewById(R.id.word_text_view); String text = textView.getText().toString(); try { SECONDS.sleep(1); speakOut(text); SECONDS.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } } /** * Prononce le text passé en paramètre * @param text */ protected void speakOut(String text) { if (!textSpeaker.isSpeaking()) { textSpeaker.speakText(text); textSpeaker.pause(SHORT_DURATION); } } /** * Met à jour la visibilité (dépuis le fragment) */ public void setStepSuccessButtonVisibility(){ stepSuccessButton.setVisibility(View.INVISIBLE); } public void createNewSpeechTask(){ textSpeechTask = new TTSpeechAsyncTask(); textSpeechTask.execute(); } protected RecognitionListener recognitionListener = new RecognitionListener() { @Override public void onReadyForSpeech(Bundle params) { } @Override public void onBeginningOfSpeech() { } @Override public void onRmsChanged(float rmsdB) { } @Override public void onBufferReceived(byte[] buffer) { } @Override public void onEndOfSpeech() { speechBtnPrompt.setImageDrawable(Util.getImageViewByName(getApplicationContext(), "icon_micro_off")); if(repeatcount == 2){ TextView textView = findViewById(R.id.text_ref_view); String text = textView.getText().toString(); try { SECONDS.sleep(1); speakOut(text); } catch (InterruptedException e) { e.printStackTrace(); } repeatcount = 0; } repeatcount++; } @Override public void onError(int error) { } @Override public void onResults(Bundle results) { TextView textView = findViewById(R.id.word_text_view); String son = textView.getText().toString(); ArrayList<String> data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION); if(data != null && data.size() > 0){ for (int i = 0; i < data.size(); i++){ if(data.get(i).toLowerCase().contains(son.toLowerCase())){ speechBtnPrompt.setVisibility(View.INVISIBLE); stepSuccessButton.setVisibility(View.VISIBLE); repeatcount = 0 ; break; } } } } @Override public void onPartialResults(Bundle partialResults) { } @Override public void onEvent(int eventType, Bundle params) { } }; /** * Classe de gestion asynchrone de la synthèse vocale */ private class TTSpeechAsyncTask extends AsyncTask<Void, Boolean, Void> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected void onProgressUpdate(Boolean... values) { super.onProgressUpdate(values); } @Override protected Void doInBackground(Void... arg0) { speakOutViewText(); return null; } @Override protected void onPostExecute(Void result) { speechBtnPrompt.setImageDrawable(Util.getImageViewByName(getApplicationContext(), "icon_micro_on")); speechBtnPrompt.setVisibility(View.VISIBLE); speechRecognizeManager.startListeningSpeech(); } } }
package csci152.adt_tests; import csci152.adt.Set; import csci152.impl.BSTSet; public class Main { public static void main(String[] args) { Set<Integer> test = new BSTSet<>(); test.add(2); test.add(4); test.add(3); test.add(5); test.add(0); test.add(1); test.add(-1); print("Size: " + test.getSize()); print(test); try { test.removeAny(); } catch (Exception ex) { print(ex.getMessage()); } print("Size: " + test.getSize()); print(test); } public static void print(Object o) { System.out.println(o); } }
/** * */ package com.openkm.test; import javax.jcr.AccessDeniedException; import javax.jcr.ItemNotFoundException; import javax.jcr.NoSuchWorkspaceException; import javax.jcr.Node; import javax.jcr.Property; import javax.jcr.PropertyIterator; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.security.auth.Subject; import org.apache.jackrabbit.core.HierarchyManager; import org.apache.jackrabbit.core.ItemId; import org.apache.jackrabbit.core.NodeId; import org.apache.jackrabbit.core.PropertyId; import org.apache.jackrabbit.core.SessionImpl; import org.apache.jackrabbit.core.security.AMContext; import org.apache.jackrabbit.core.security.AccessManager; import org.apache.jackrabbit.core.security.UserPrincipal; import org.apache.jackrabbit.core.security.authorization.AccessControlProvider; import org.apache.jackrabbit.core.security.authorization.WorkspaceAccessManager; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Paco Avila */ public class MyAccessManagerLockAccessDenied implements AccessManager { private static Logger log = LoggerFactory.getLogger(MyAccessManagerLockAccessDenied.class); private Subject subject = null; private HierarchyManager hierMgr = null; private static final int READ = 1; private static final int WRITE = 2; private static final int REMOVE = 4; public static boolean CAN_WRITE = true; @Override public void init(AMContext context) throws AccessDeniedException, Exception { log.debug("init(" + context + ")"); subject = context.getSubject(); log.debug("##### " + subject.getPrincipals()); hierMgr = context.getHierarchyManager(); log.debug("init: void"); } @Override public void close() throws Exception { log.debug("close()"); } @Override public void checkPermission(ItemId id, int permissions) throws AccessDeniedException, ItemNotFoundException, RepositoryException { log.debug("checkPermission()"); } @Override public boolean isGranted(ItemId id, int permissions) throws ItemNotFoundException, RepositoryException { log.debug("isGranted(" + subject.getPrincipals() + ", " + id + ", " + (permissions == READ ? "READ" : (permissions == WRITE ? "WRITE" : (permissions == REMOVE ? "REMOVE" : "NONE"))) + ")"); boolean access = false; Session systemSession = DummyLockAccessDenied.getSystemSession(); if (subject.getPrincipals().contains(new UserPrincipal(systemSession.getUserID()))) { // Si es del tipo SYSTEM dar permisos totales // Es necesario para que no caiga en un bucle infinito access = true; } else { NodeId nodeId = null; log.debug(subject.getPrincipals() + " Item Id: " + id); // Workaround because of transiente node visibility try { log.debug(subject.getPrincipals() + " Item Path: " + hierMgr.getPath(id)); } catch (ItemNotFoundException e) { log.warn(subject.getPrincipals() + " hierMgr.getPath() > ItemNotFoundException: " + e.getMessage()); } if (id instanceof NodeId) { nodeId = (NodeId) id; log.debug(subject.getPrincipals() + " This is a NODE"); } else { PropertyId propertyId = (PropertyId) id; nodeId = propertyId.getParentId(); log.debug(subject.getPrincipals() + " This is a PROPERTY"); } if (hierMgr.getPath(nodeId).denotesRoot()) { // Root node has full access access = true; } else { Node node = null; // Workaround because of transiente node visibility try { node = ((SessionImpl) systemSession).getNodeById(nodeId); } catch (ItemNotFoundException e1) { log.warn(subject.getPrincipals() + " systemSession.getNodeById() > ItemNotFoundException: " + e1.getMessage()); } if (node == null) { access = true; } else { log.debug(subject.getPrincipals() + " Node Name: " + node.getPath()); log.debug(subject.getPrincipals() + " Node Type: " + node.getPrimaryNodeType().getName()); if (permissions == READ) { for (PropertyIterator pi = node.getProperties(); pi.hasNext();) { Property property = (Property) pi.nextProperty(); log.debug("Property: " + property.getName()); } access = true; } else if (permissions == WRITE || permissions == REMOVE) { for (PropertyIterator pi = node.getProperties(); pi.hasNext();) { Property property = (Property) pi.nextProperty(); log.debug("Property: " + property.getName()); } if (CAN_WRITE) { access = true; } } } } } // Workaround because of transiente node visibility try { log.debug(subject.getPrincipals() + " Path: " + hierMgr.getPath(id)); } catch (ItemNotFoundException e) { log.warn(subject.getPrincipals() + " hierMgr.getPath() > ItemNotFoundException: " + e.getMessage()); } log.debug(subject.getPrincipals() + " isGranted " + (permissions == READ ? "READ" : (permissions == WRITE ? "WRITE" : (permissions == REMOVE ? "REMOVE" : "NONE"))) + ": " + access); log.debug("-------------------------------------"); return access; } @Override public boolean canAccess(String workspaceName) throws NoSuchWorkspaceException, RepositoryException { boolean access = true; log.debug("canAccess(" + workspaceName + ")"); log.debug("canAccess: " + access); return access; } @Override public boolean canRead(Path arg0) throws RepositoryException { return false; } @Override public void init(AMContext arg0, AccessControlProvider arg1, WorkspaceAccessManager arg2) throws AccessDeniedException, Exception { } @Override public boolean isGranted(Path arg0, int arg1) throws RepositoryException { return false; } @Override public boolean isGranted(Path arg0, Name arg1, int arg2) throws RepositoryException { return false; } // @Override // TODO Enable when using jackrabbit 1.6 public void checkPermission(Path arg0, int arg1) throws AccessDeniedException, RepositoryException { } }
package by.epam.gomel.trening; /* Вычислить значение выражения по формуле (все переменные принимают действительные значения): 𝑏+√𝑏2+4𝑎𝑐2𝑎−𝑎3𝑐+𝑏−2 */ import static java.lang.Math.*; public class Linear2 { public static void main(String[] args) { double a = 1; double b = 1; double c = 1; System.out.println((b + sqrt(pow(b, 2) + 4 * a * c)) / (2 * a) - pow(a, 3) * c + pow(b, -2)); } }
/* * 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 Views; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JOptionPane; /** * * @author 1GDAW04 */ public class vMainAdmin extends javax.swing.JFrame { /** * Creates new form vMainAdmin */ public vMainAdmin() { initComponents(); setExtendedState(JFrame.MAXIMIZED_BOTH); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { tabGeneral = new org.edisoncor.gui.tabbedPane.TabbedPaneHeader(); panelPerfiles = new javax.swing.JPanel(); bAnadirUsuario = new org.edisoncor.gui.button.ButtonTask(); bEliminarUsuario = new org.edisoncor.gui.button.ButtonTask(); bEditarUsuario = new org.edisoncor.gui.button.ButtonTask(); bVerListaUsuarios = new org.edisoncor.gui.button.ButtonTask(); panelEscuderia = new javax.swing.JPanel(); tabEscuderia = new org.edisoncor.gui.tabbedPane.TabbedPaneHeader(); panelGestionEquipos = new javax.swing.JPanel(); bAnadirEquipo = new org.edisoncor.gui.button.ButtonTask(); bEliminarEquipo = new org.edisoncor.gui.button.ButtonTask(); bEditarEquipo = new org.edisoncor.gui.button.ButtonTask(); bVerDatosEquipo = new org.edisoncor.gui.button.ButtonTask(); bMostrarTrabajadores = new org.edisoncor.gui.button.ButtonTask(); panelGestionJugadores = new javax.swing.JPanel(); bAnadirJugador = new org.edisoncor.gui.button.ButtonTask(); bEliminarJugador = new org.edisoncor.gui.button.ButtonTask(); bEditarJugador = new org.edisoncor.gui.button.ButtonTask(); bVerJugador = new org.edisoncor.gui.button.ButtonTask(); panelGestionJefes = new javax.swing.JPanel(); bAnadirJefe = new org.edisoncor.gui.button.ButtonTask(); bEliminarJefe = new org.edisoncor.gui.button.ButtonTask(); bEditarJefe = new org.edisoncor.gui.button.ButtonTask(); bVerJefes = new org.edisoncor.gui.button.ButtonTask(); panelTorneos = new javax.swing.JPanel(); bIniciarTorneo = new org.edisoncor.gui.button.ButtonTask(); bEliminarTorneo = new org.edisoncor.gui.button.ButtonTask(); bAdministrarTorneo = new org.edisoncor.gui.button.ButtonTask(); bVerTorneos = new org.edisoncor.gui.button.ButtonTask(); panelGeneral = new javax.swing.JPanel(); bImprimirJornadas = new org.edisoncor.gui.button.ButtonAction(); bImprimirClasificacion = new org.edisoncor.gui.button.ButtonAction(); bInsertarResultados = new org.edisoncor.gui.button.ButtonAction(); bJornadasRandom = new org.edisoncor.gui.button.ButtonAction(); bTorneoRandom = new org.edisoncor.gui.button.ButtonAction(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); panelPerfiles.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 50, 50)); bAnadirUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoAñadir.png"))); // NOI18N bAnadirUsuario.setText("Añadir Usuario"); bAnadirUsuario.setDescription(" "); bAnadirUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bAnadirUsuarioActionPerformed(evt); } }); panelPerfiles.add(bAnadirUsuario); bEliminarUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEliminar.png"))); // NOI18N bEliminarUsuario.setText("Eliminar Usuario"); bEliminarUsuario.setDefaultCapable(false); bEliminarUsuario.setDescription(" "); bEliminarUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEliminarUsuarioActionPerformed(evt); } }); panelPerfiles.add(bEliminarUsuario); bEditarUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEditar.png"))); // NOI18N bEditarUsuario.setText("Editar Usuario"); bEditarUsuario.setDescription(" "); bEditarUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEditarUsuarioActionPerformed(evt); } }); panelPerfiles.add(bEditarUsuario); bVerListaUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoBuscar.png"))); // NOI18N bVerListaUsuarios.setText("Ver Lista Usarios"); bVerListaUsuarios.setDescription(" "); bVerListaUsuarios.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bVerListaUsuariosActionPerformed(evt); } }); panelPerfiles.add(bVerListaUsuarios); tabGeneral.addTab(" PERFILES ", panelPerfiles); tabEscuderia.setBackground(new java.awt.Color(102, 153, 255)); panelGestionEquipos.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 30, 30)); bAnadirEquipo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoAñadir.png"))); // NOI18N bAnadirEquipo.setText("Añadir Equipo"); bAnadirEquipo.setDescription(" "); bAnadirEquipo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bAnadirEquipoActionPerformed(evt); } }); panelGestionEquipos.add(bAnadirEquipo); bEliminarEquipo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEliminar.png"))); // NOI18N bEliminarEquipo.setText("Eliminar Equipo"); bEliminarEquipo.setAlignmentX(0.5F); bEliminarEquipo.setDefaultCapable(false); bEliminarEquipo.setDescription(" "); bEliminarEquipo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); bEliminarEquipo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); bEliminarEquipo.setMargin(new java.awt.Insets(30, 50, 2, 14)); bEliminarEquipo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEliminarEquipoActionPerformed(evt); } }); panelGestionEquipos.add(bEliminarEquipo); bEditarEquipo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEditar.png"))); // NOI18N bEditarEquipo.setText("Editar Equipo"); bEditarEquipo.setDescription(" "); bEditarEquipo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEditarEquipoActionPerformed(evt); } }); panelGestionEquipos.add(bEditarEquipo); bVerDatosEquipo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoBuscar.png"))); // NOI18N bVerDatosEquipo.setText("Ver Datos Equipo"); bVerDatosEquipo.setDescription(" "); bVerDatosEquipo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bVerDatosEquipoActionPerformed(evt); } }); panelGestionEquipos.add(bVerDatosEquipo); bMostrarTrabajadores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEquipo.png"))); // NOI18N bMostrarTrabajadores.setText("Ver Trabajadores "); bMostrarTrabajadores.setDescription("Trabajadores de un equipo"); bMostrarTrabajadores.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bMostrarTrabajadoresActionPerformed(evt); } }); panelGestionEquipos.add(bMostrarTrabajadores); tabEscuderia.addTab("Gestion Equipos ", panelGestionEquipos); panelGestionJugadores.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 30, 30)); bAnadirJugador.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoAñadir.png"))); // NOI18N bAnadirJugador.setText("Añadir Jugador"); bAnadirJugador.setDescription(" "); bAnadirJugador.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bAnadirJugadorActionPerformed(evt); } }); panelGestionJugadores.add(bAnadirJugador); bEliminarJugador.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEliminar.png"))); // NOI18N bEliminarJugador.setText("Eliminar Jugador"); bEliminarJugador.setDefaultCapable(false); bEliminarJugador.setDescription(" "); bEliminarJugador.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEliminarJugadorActionPerformed(evt); } }); panelGestionJugadores.add(bEliminarJugador); bEditarJugador.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEditar.png"))); // NOI18N bEditarJugador.setText("Editar Jugador"); bEditarJugador.setDescription(" "); bEditarJugador.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEditarJugadorActionPerformed(evt); } }); panelGestionJugadores.add(bEditarJugador); bVerJugador.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoBuscar.png"))); // NOI18N bVerJugador.setText("Ver Jugador"); bVerJugador.setDescription(" "); bVerJugador.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bVerJugadorActionPerformed(evt); } }); panelGestionJugadores.add(bVerJugador); tabEscuderia.addTab(" Gestion Jugadores ", panelGestionJugadores); panelGestionJefes.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 30, 30)); bAnadirJefe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoAñadir.png"))); // NOI18N bAnadirJefe.setText("Añadir Jefe"); bAnadirJefe.setDescription(" "); bAnadirJefe.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bAnadirJefeActionPerformed(evt); } }); panelGestionJefes.add(bAnadirJefe); bEliminarJefe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEliminar.png"))); // NOI18N bEliminarJefe.setText("Eliminar Jefe"); bEliminarJefe.setDefaultCapable(false); bEliminarJefe.setDescription(" "); bEliminarJefe.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEliminarJefeActionPerformed(evt); } }); panelGestionJefes.add(bEliminarJefe); bEditarJefe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEditar.png"))); // NOI18N bEditarJefe.setText("Editar Jefe"); bEditarJefe.setDescription(" "); bEditarJefe.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEditarJefeActionPerformed(evt); } }); panelGestionJefes.add(bEditarJefe); bVerJefes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoBuscar.png"))); // NOI18N bVerJefes.setText("Ver Jefes"); bVerJefes.setDescription(" "); bVerJefes.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bVerJefesActionPerformed(evt); } }); panelGestionJefes.add(bVerJefes); tabEscuderia.addTab("Gestion Jefes ", panelGestionJefes); javax.swing.GroupLayout panelEscuderiaLayout = new javax.swing.GroupLayout(panelEscuderia); panelEscuderia.setLayout(panelEscuderiaLayout); panelEscuderiaLayout.setHorizontalGroup( panelEscuderiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabEscuderia, javax.swing.GroupLayout.DEFAULT_SIZE, 1181, Short.MAX_VALUE) ); panelEscuderiaLayout.setVerticalGroup( panelEscuderiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelEscuderiaLayout.createSequentialGroup() .addComponent(tabEscuderia, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); tabGeneral.addTab(" ESCUDERIA ", panelEscuderia); panelTorneos.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 30, 30)); bIniciarTorneo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoInicio.png"))); // NOI18N bIniciarTorneo.setText("Iniciar Torneo"); bIniciarTorneo.setDescription(" "); panelTorneos.add(bIniciarTorneo); bEliminarTorneo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEliminar.png"))); // NOI18N bEliminarTorneo.setText("Eliminar Torneo"); bEliminarTorneo.setDefaultCapable(false); bEliminarTorneo.setDescription(" "); bEliminarTorneo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bEliminarTorneoActionPerformed(evt); } }); panelTorneos.add(bEliminarTorneo); bAdministrarTorneo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoEditar.png"))); // NOI18N bAdministrarTorneo.setText("Administrar Torneo"); bAdministrarTorneo.setDescription(" "); bAdministrarTorneo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bAdministrarTorneoActionPerformed(evt); } }); panelTorneos.add(bAdministrarTorneo); bVerTorneos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/Imagenes/iconoBuscar.png"))); // NOI18N bVerTorneos.setText("Ver Torneos"); bVerTorneos.setDescription(" "); bVerTorneos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bVerTorneosActionPerformed(evt); } }); panelTorneos.add(bVerTorneos); tabGeneral.addTab(" TORNEOS ", panelTorneos); panelGeneral.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Acciones Generales", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Candara", 1, 14))); // NOI18N panelGeneral.setForeground(new java.awt.Color(0, 0, 51)); panelGeneral.setLayout(new java.awt.GridLayout(3, 2, 40, 50)); bImprimirJornadas.setText("ACTUALIZAR TODAS LAS JORNADAS"); bImprimirJornadas.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bImprimirJornadasActionPerformed(evt); } }); panelGeneral.add(bImprimirJornadas); bImprimirClasificacion.setText("IMPRIMIR CLASIFICACION GENERAL"); bImprimirClasificacion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bImprimirClasificacionActionPerformed(evt); } }); panelGeneral.add(bImprimirClasificacion); bInsertarResultados.setText("INSERTAR RESULTADOS JORNADA"); bInsertarResultados.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bInsertarResultadosActionPerformed(evt); } }); panelGeneral.add(bInsertarResultados); bJornadasRandom.setText("JORNADAS RANDOM"); bJornadasRandom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bJornadasRandomActionPerformed(evt); } }); panelGeneral.add(bJornadasRandom); bTorneoRandom.setText("FINALIZAR TORNEO RANDOM"); bTorneoRandom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bTorneoRandomActionPerformed(evt); } }); panelGeneral.add(bTorneoRandom); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabGeneral, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(panelGeneral, javax.swing.GroupLayout.DEFAULT_SIZE, 1181, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(tabGeneral, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(panelGeneral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void bMostrarTrabajadoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bMostrarTrabajadoresActionPerformed try { torneoes.TorneoES.abrirVAllTrabajadoresEquipo(); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bMostrarTrabajadoresActionPerformed private void bEditarEquipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEditarEquipoActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Selleciona equipo a modificar", "Equipo: ", "modequipo"); }//GEN-LAST:event_bEditarEquipoActionPerformed private void bAnadirJefeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAnadirJefeActionPerformed torneoes.TorneoES.abrirVentanaCrearJefe(); }//GEN-LAST:event_bAnadirJefeActionPerformed private void bEditarJefeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEditarJefeActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Selecciona jefe a modificar", "Jefe", "modjefe"); }//GEN-LAST:event_bEditarJefeActionPerformed private void bEditarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEditarUsuarioActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Selleccione perfil a editar", "Perfil:", "modperfil"); }//GEN-LAST:event_bEditarUsuarioActionPerformed private void bEliminarJefeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEliminarJefeActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Seleccione jefe a eliminar", "Jefe:", "borrarjefe"); }//GEN-LAST:event_bEliminarJefeActionPerformed private void bVerJefesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bVerJefesActionPerformed torneoes.TorneoES.abrirVentanaAllJefe(); }//GEN-LAST:event_bVerJefesActionPerformed private void bVerTorneosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bVerTorneosActionPerformed torneoes.TorneoES.abrirVentanaAllTorneo(); }//GEN-LAST:event_bVerTorneosActionPerformed private void bAdministrarTorneoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAdministrarTorneoActionPerformed torneoes.TorneoES.abrirVentanaModTorneo(); }//GEN-LAST:event_bAdministrarTorneoActionPerformed private void bEliminarTorneoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEliminarTorneoActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Seleccione torneo a eliminar", "Torneo:", "borrartorneo"); }//GEN-LAST:event_bEliminarTorneoActionPerformed private void bAnadirUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAnadirUsuarioActionPerformed torneoes.TorneoES.abrirVCrearPerfil(); }//GEN-LAST:event_bAnadirUsuarioActionPerformed private void bEliminarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEliminarUsuarioActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Sellecione usuario a eliminar", "Usuario:", "borrarperfil"); }//GEN-LAST:event_bEliminarUsuarioActionPerformed private void bVerListaUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bVerListaUsuariosActionPerformed try { torneoes.TorneoES.abrirVAllPerfil(); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bVerListaUsuariosActionPerformed private void bAnadirEquipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAnadirEquipoActionPerformed torneoes.TorneoES.abrirVCrearEquipo(); }//GEN-LAST:event_bAnadirEquipoActionPerformed private void bEliminarEquipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEliminarEquipoActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Selecciona equipo a eliminar", "Equipo: ", "borrarequipo"); }//GEN-LAST:event_bEliminarEquipoActionPerformed private void bVerDatosEquipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bVerDatosEquipoActionPerformed try { torneoes.TorneoES.abrirVAllEquipo(); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bVerDatosEquipoActionPerformed private void bAnadirJugadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAnadirJugadorActionPerformed try { torneoes.TorneoES.abrirVCrearJugador(); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bAnadirJugadorActionPerformed private void bEliminarJugadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEliminarJugadorActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Seleccione jugador a eliminar", "Jugador: ", "borrarjugador"); }//GEN-LAST:event_bEliminarJugadorActionPerformed private void bEditarJugadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEditarJugadorActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Seleccione jugador a modificar", "Jugador: ", "modjugador"); }//GEN-LAST:event_bEditarJugadorActionPerformed private void bVerJugadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bVerJugadorActionPerformed try { torneoes.TorneoES.abrirVAllJugador(); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bVerJugadorActionPerformed private void bInsertarResultadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bInsertarResultadosActionPerformed try { torneoes.TorneoES.abrirVInsertarResultados(); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bInsertarResultadosActionPerformed private void bImprimirJornadasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bImprimirJornadasActionPerformed try { BD.procesosXML.actualizarTodasJornadas(); JOptionPane.showMessageDialog(this, "Se han actualizado las jornadas en la base de datos."); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bImprimirJornadasActionPerformed private void bTorneoRandomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bTorneoRandomActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Selecciona torneo", "Torneo:", "torneorandom"); }//GEN-LAST:event_bTorneoRandomActionPerformed private void bImprimirClasificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bImprimirClasificacionActionPerformed try { BD.procesosXML.actualizarClasificacionGeneral(); JOptionPane.showMessageDialog(this, "Se han actualizado los partidos en la base de datos."); } catch (Exception ex) { Logger.getLogger(vMainAdmin.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_bImprimirClasificacionActionPerformed private void bJornadasRandomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bJornadasRandomActionPerformed torneoes.TorneoES.abrirVentanaSeleccion("Seleccione jornada", "Jornada:", "jornadarandom"); }//GEN-LAST:event_bJornadasRandomActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private org.edisoncor.gui.button.ButtonTask bAdministrarTorneo; private org.edisoncor.gui.button.ButtonTask bAnadirEquipo; private org.edisoncor.gui.button.ButtonTask bAnadirJefe; private org.edisoncor.gui.button.ButtonTask bAnadirJugador; private org.edisoncor.gui.button.ButtonTask bAnadirUsuario; private org.edisoncor.gui.button.ButtonTask bEditarEquipo; private org.edisoncor.gui.button.ButtonTask bEditarJefe; private org.edisoncor.gui.button.ButtonTask bEditarJugador; private org.edisoncor.gui.button.ButtonTask bEditarUsuario; private org.edisoncor.gui.button.ButtonTask bEliminarEquipo; private org.edisoncor.gui.button.ButtonTask bEliminarJefe; private org.edisoncor.gui.button.ButtonTask bEliminarJugador; private org.edisoncor.gui.button.ButtonTask bEliminarTorneo; private org.edisoncor.gui.button.ButtonTask bEliminarUsuario; private org.edisoncor.gui.button.ButtonAction bImprimirClasificacion; private org.edisoncor.gui.button.ButtonAction bImprimirJornadas; private org.edisoncor.gui.button.ButtonTask bIniciarTorneo; private org.edisoncor.gui.button.ButtonAction bInsertarResultados; private org.edisoncor.gui.button.ButtonAction bJornadasRandom; private org.edisoncor.gui.button.ButtonTask bMostrarTrabajadores; private org.edisoncor.gui.button.ButtonAction bTorneoRandom; private org.edisoncor.gui.button.ButtonTask bVerDatosEquipo; private org.edisoncor.gui.button.ButtonTask bVerJefes; private org.edisoncor.gui.button.ButtonTask bVerJugador; private org.edisoncor.gui.button.ButtonTask bVerListaUsuarios; private org.edisoncor.gui.button.ButtonTask bVerTorneos; private javax.swing.JPanel panelEscuderia; private javax.swing.JPanel panelGeneral; private javax.swing.JPanel panelGestionEquipos; private javax.swing.JPanel panelGestionJefes; private javax.swing.JPanel panelGestionJugadores; private javax.swing.JPanel panelPerfiles; private javax.swing.JPanel panelTorneos; private org.edisoncor.gui.tabbedPane.TabbedPaneHeader tabEscuderia; private org.edisoncor.gui.tabbedPane.TabbedPaneHeader tabGeneral; // End of variables declaration//GEN-END:variables }
package com.spring.shopping.product; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Component; import com.spring.shopping.JDBCUtil.JDBCUtil; import com.spring.shopping.review.ReviewVO; import com.spring.shopping.qna.QNAVO; @Component public class ProductDAO { private Connection conn = null; private PreparedStatement stmt = null; private ResultSet rs = null; private final String PRODUCT_GETLIST = "select * from (select rownum r, num, name, brief, " + "category, price, point, capacity, desc_image, desc_text, detail, total_pref, " + "reviewcnt, image, mfd, numoflike from product where category = ?) " + "where r >= ? and r <= ? "; private final String PRODUCT_GETALLLIST = "select * from product where num >= ? and num <= ? order by num"; private final String PRODUCT_GETCNT = "select count(*) from product where category=?"; private final String PRODUCT_GETSEARCHCNT = "select count(*) from product where name like ? or brief like ?"; private final String PRODUCT_GETPROD = "select * from product where num = ?"; private final String PRODUCT_GETREVIEW = "select * from review where num=? order by reviewnum"; private final String PRODUCT_GETQNA = "select * from qna where num=? order by qnanum"; private final String PRODUCT_ADDPRODUCT = "insert into product values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; private final String PRODUCT_DELPRODUCT = "delete from product where num = ?"; private final String PRODUCT_LIKE = "update product set numoflike = numoflike + 1 where num = ?"; private final String cols = "rownum r, num, name, brief, category, price, point, capacity, desc_image, " + "desc_text, detail, total_pref, reviewcnt, image, mfd, numoflike"; private final String PRODUCT_SEARCH = "select * from (select "+cols+" from product where name like ? or brief like ?) where r >= ? and r <= ?"; private final String PRODUCT_SEARCH1 = "select * from (select "+cols+" from (select "+cols+" from product where name like ? or brief like ? order by price desc)) where r >= ? and r <= ?"; private final String PRODUCT_SEARCH2 = "select * from (select "+cols+" from (select "+cols+" from product where name like ? or brief like ? order by price asc)) where r >= ? and r <= ?"; private final String PRODUCT_SEARCH3 = "select * from (select "+cols+" from (select "+cols+" from product where name like ? or brief like ? order by numoflike desc)) where r >= ? and r <= ?"; private final String PRODUCT_SEARCH4 = "select * from (select "+cols+" from (select "+cols+" from product where name like ? or brief like ? order by reviewcnt desc)) where r >= ? and r <= ?"; private final String PRODUCT_SEARCH5 = "select * from (select "+cols+" from (select "+cols+" from product where name like ? or brief like ? order by decode(reviewcnt, 0, 0, total_pref/reviewcnt) desc)) where r >= ? and r <= ?"; private final String PRODUCT_GETBEST = "select e.* from (select * from product order by numoflike desc )e where rownum <= 12"; public void addProduct(ProductVO vo){ String desc_image = vo.getDesc_image(); desc_image = desc_image.substring(0, desc_image.length()-1); System.out.println("ProductDAO addProduct : " + vo.getName().length()); System.out.println("ProductDAO addProduct : " + vo.getMfd()); System.out.println("ProductDAO addProduct : " + vo.getMfd().length()); try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_ADDPRODUCT); stmt.setInt(1, vo.getNum()); stmt.setString(2, vo.getName()); stmt.setString(3, vo.getBrief()); stmt.setInt(4, vo.getCategory()); stmt.setInt(5, vo.getPrice()); stmt.setInt(6, vo.getPoint()); stmt.setString(7, vo.getCapacity()); if(desc_image.equals("null")){ stmt.setString(8, "none"); }else{ stmt.setString(8, desc_image); } stmt.setString(9, vo.getDesc_text()); stmt.setString(10, vo.getDetail()); stmt.setInt(11, vo.getTotal_pref()); stmt.setInt(12, vo.getReviewCnt()); stmt.setString(13, vo.getImage()); stmt.setString(14, vo.getMfd()); stmt.setInt(15, vo.getNumoflike()); stmt.executeUpdate(); }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } } public void delProduct(int num){ try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_DELPRODUCT); stmt.setInt(1, num); stmt.executeUpdate(); }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(stmt, conn); }catch(Exception e){} } } public List<ProductVO> getProductList(int category, int page){ List<ProductVO> productList = new ArrayList<ProductVO>(); ProductVO vo = null; int amount = 8; int start = page * amount - (amount - 1); int end = page * amount ; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETLIST); stmt.setInt(1, category); stmt.setInt(2, start); stmt.setInt(3, end); rs = stmt.executeQuery(); while(rs.next()){ vo = new ProductVO(); vo.setNum(rs.getInt("num")); vo.setName(rs.getString("name")); vo.setBrief(rs.getString("brief")); vo.setPrice(rs.getInt("price")); vo.setCapacity(rs.getString("capacity")); vo.setDesc_image(rs.getString("desc_image")); vo.setDesc_text(rs.getString("desc_text")); vo.setDetail(rs.getString("detail")); vo.setTotal_pref(rs.getInt("total_pref")); vo.setImage(rs.getString("image")); vo.setMfd(rs.getString("mfd")); vo.setNumoflike(rs.getInt("numoflike")); productList.add(vo); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return productList; } public List<ProductVO> getAllProductList(int page){ List<ProductVO> allProductList = new ArrayList<ProductVO>(); ProductVO vo = null; int amount = 7; int start = page * amount - (amount - 1); int end = page * amount ; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETALLLIST); stmt.setInt(1, start); stmt.setInt(2, end); rs = stmt.executeQuery(); while(rs.next()){ vo = new ProductVO(); vo.setNum(rs.getInt("num")); vo.setName(rs.getString("name")); vo.setBrief(rs.getString("brief")); vo.setPrice(rs.getInt("price")); vo.setCapacity(rs.getString("capacity")); vo.setDesc_image(rs.getString("desc_image")); vo.setDesc_text(rs.getString("desc_text")); vo.setDetail(rs.getString("detail")); vo.setTotal_pref(rs.getInt("total_pref")); vo.setImage(rs.getString("image")); vo.setMfd(rs.getString("mfd")); vo.setNumoflike(rs.getInt("numoflike")); allProductList.add(vo); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return allProductList; } public int getCount(int category){ int count = 0; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETCNT); stmt.setInt(1, category); rs = stmt.executeQuery(); rs.next(); count = rs.getInt("count(*)"); }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return count; } public int getSearchCount(String word){ int count = 0; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETSEARCHCNT); stmt.setString(1, "%"+word+"%"); stmt.setString(2, "%"+word+"%"); rs = stmt.executeQuery(); rs.next(); count = rs.getInt("count(*)"); }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return count; } public ProductVO getProduct(int num){ ProductVO vo = null; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETPROD); stmt.setInt(1, num); rs = stmt.executeQuery(); rs.next(); vo = new ProductVO(); vo.setNum(rs.getInt("num")); vo.setName(rs.getString("name")); vo.setBrief(rs.getString("brief")); vo.setPrice(rs.getInt("price")); vo.setPoint(rs.getInt("point")); vo.setCapacity(rs.getString("capacity")); if(rs.getString("desc_image") != null){ vo.setDesc_image(rs.getString("desc_image")); }else{ vo.setDesc_image(null); } if(rs.getString("desc_text") != null){ vo.setDesc_text(rs.getString("desc_text")); }else{ vo.setDesc_text(null); } vo.setDetail(rs.getString("detail")); vo.setTotal_pref(rs.getInt("total_pref")); vo.setReviewCnt(rs.getInt("reviewCnt")); vo.setImage(rs.getString("image")); vo.setMfd(rs.getString("mfd")); vo.setNumoflike(rs.getInt("numoflike")); }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return vo; } public List<ReviewVO> getReview(int num){ List<ReviewVO> reviewList = new ArrayList<ReviewVO>(); ReviewVO vo = null; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETREVIEW); stmt.setInt(1, num); rs = stmt.executeQuery(); while(rs.next()){ vo = new ReviewVO(); vo.setNum(rs.getInt("num")); vo.setReviewNum(rs.getInt("reviewNum")); vo.setPref(rs.getInt("pref")); vo.setContent(rs.getString("content")); vo.setName(rs.getString("name")); reviewList.add(vo); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return reviewList; } public List<QNAVO> getQNA(int num){ List<QNAVO> qnaList = new ArrayList<QNAVO>(); QNAVO vo = null; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETQNA); stmt.setInt(1, num); rs = stmt.executeQuery(); while(rs.next()){ vo = new QNAVO(); vo.setNum(rs.getInt("num")); vo.setQNAnum(rs.getInt("QNAnum")); vo.setType(rs.getString("type")); vo.setTitle(rs.getString("title")); vo.setContent(rs.getString("content")); vo.setQnaRe(rs.getString("qnaRe")); vo.setState(rs.getString("state")); vo.setName(rs.getString("name")); vo.setRegdate(rs.getString("regdate")); qnaList.add(vo); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return qnaList; } public void productLike(int num){ try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_LIKE); stmt.setInt(1, num); stmt.executeUpdate(); }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } } public List<ProductVO> searchProduct(String word, int order, int page){ List<ProductVO> searchProductList = new ArrayList<ProductVO>(); ProductVO vo = null; int amount = 6; int start = page * amount - 5; int end = page * amount ; System.out.println("start : " + start); System.out.println("end : " + end); try{ conn = JDBCUtil.getConnection(); if(order == 0){ stmt = conn.prepareStatement(PRODUCT_SEARCH); // 그냥 정렬 }else if(order == 1){ stmt = conn.prepareStatement(PRODUCT_SEARCH1); // 높은 가격순 }else if(order == 2){ stmt = conn.prepareStatement(PRODUCT_SEARCH2); // 낮은 가격순 }else if(order == 3){ stmt = conn.prepareStatement(PRODUCT_SEARCH3); // 좋아요 순 }else if(order == 4){ stmt = conn.prepareStatement(PRODUCT_SEARCH4); // 리뷰 많은 순 }else if(order == 5){ stmt = conn.prepareStatement(PRODUCT_SEARCH5); // 선호도 순 } stmt.setString(1, "%"+word+"%"); stmt.setString(2, "%"+word+"%"); stmt.setInt(3, start); stmt.setInt(4, end); rs = stmt.executeQuery(); while(rs.next()){ vo = new ProductVO(); vo.setNum(rs.getInt("num")); vo.setName(rs.getString("name")); vo.setBrief(rs.getString("brief")); vo.setCategory(rs.getInt("category")); vo.setPrice(rs.getInt("price")); vo.setPoint(rs.getInt("point")); vo.setCapacity(rs.getString("capacity")); vo.setDesc_image(rs.getString("desc_image")); vo.setDesc_text(rs.getString("desc_text")); vo.setDetail(rs.getString("detail")); vo.setTotal_pref(rs.getInt("total_pref")); vo.setReviewCnt(rs.getInt("reviewCnt")); vo.setImage(rs.getString("image")); vo.setMfd(rs.getString("mfd")); vo.setNumoflike(rs.getInt("numoflike")); searchProductList.add(vo); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return searchProductList; } public ArrayList<String> searchProductName(String word){ String sql = "select name from product where name like ?"; ArrayList<String> wordList= new ArrayList<String>(); System.out.println("word in DAO : "+word); try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(sql); stmt.setString(1, "%"+word+"%"); rs = stmt.executeQuery(); while(rs.next()){ wordList.add(rs.getString("name")); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return wordList; } public ArrayList<ProductVO> getBestList(){ ArrayList<ProductVO> bestList = new ArrayList<ProductVO>(); ProductVO vo = null; try{ conn = JDBCUtil.getConnection(); stmt = conn.prepareStatement(PRODUCT_GETBEST); rs = stmt.executeQuery(); while(rs.next()){ vo = new ProductVO(); vo.setNum(rs.getInt("num")); vo.setImage(rs.getString("image")); vo.setName(rs.getString("name")); vo.setPrice(rs.getInt("price")); bestList.add(vo); } }catch(Exception e){ e.printStackTrace(); }finally{ try{ JDBCUtil.closeResource(rs, stmt, conn); }catch(Exception e){} } return bestList; } }
package WebComponent; import java.util.ArrayList; import java.util.List; public abstract class WebComponentSelect extends WebComponent { protected List<Option> options = new ArrayList<Option>(); protected int selected; public WebComponentSelect() { super(); } public WebComponentSelect(WebComponentSelect wcs){ options = new ArrayList<Option>(wcs.options); } public void addOption(Option elem){ if(options==null){ options = new ArrayList<Option>(); } options.add(elem); } public List<Option> getOptions(){ return options; } public void select(int n){ selected = n; } }
package com.tencent.mm.modelstat; import com.tencent.mm.ab.b; import com.tencent.mm.ab.l; import com.tencent.mm.ab.v.a; import com.tencent.mm.protocal.c.bfj; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; class o$3 implements a { final /* synthetic */ long ekP; final /* synthetic */ bfj ekQ; o$3(long j, bfj bfj) { this.ekP = j; this.ekQ = bfj; } public final int a(int i, int i2, String str, b bVar, l lVar) { x.d("MicroMsg.NetTypeReporter", "onGYNetEnd errType:%d errCode:%d msg:%s %d val:%s ", Integer.valueOf(i), Integer.valueOf(i2), str, Long.valueOf(bi.bH(this.ekP)), this.ekQ.mEl); return 0; } }
package com.mastercom.ps.connector.examples; import java.io.FileInputStream; import java.io.InputStream; import java.util.Map; import com.mastercard.api.core.ApiConfig; import com.mastercard.api.core.exception.ApiException; import com.mastercard.api.core.model.Environment; import com.mastercard.api.core.model.RequestMap; import com.mastercard.api.core.model.map.SmartMap; import com.mastercard.api.core.security.oauth.OAuthAuthentication; import com.mastercard.api.mastercom.Retrievals; class RetrievalsAcquierFulfillARequestBKP { public static void main(String[] args) throws Exception { final String P12 = "C:\\Users\\sabatinija\\Desktop\\Devspace\\PeopleSoft\\Mastercards\\MCD_Sandbox_MasterCom_API_TEST_API_Keys\\MasterCom_API_TEST-sandbox.p12"; String consumerKey = "4zoJ6bSBi2I10kY2__njjwSB4YMaQIa7Xj0_OW2G7243f6b5!a6b6fa1d5324471b9bebb0e96f7ad0a00000000000000000"; // You // should // UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa String keyAlias = "keyalias"; // For production: change this to the key alias you chose when you created your // production key String keyPassword = "keystorepassword"; // For production: change this to the key alias you chose when you // created your production key InputStream is = new FileInputStream(P12); // e.g. // /Users/yourname/project/sandbox.p12 // | // C:\Users\yourname\project\sandbox.p12 ApiConfig.setAuthentication(new OAuthAuthentication(consumerKey, is, keyAlias, keyPassword)); // You only need // to set this // once ApiConfig.setDebug(true); // Enable http wire logging // This is needed to change the environment to run the sample code. For // production: use ApiConfig.setSandbox(false); ApiConfig.setEnvironment(Environment.parse("sandbox")); try { RequestMap map = new RequestMap(); map.set("claim-id", "200002020654"); map.set("request-id", "2000020"); map.set("acquirerResponseCd", "D"); map.set("docTypeIndicator", "2"); map.set("memo", "This is an example of what a memo could contain"); map.set("fileAttachment.filename", "testimage111111.tif"); map.set("fileAttachment.file", "1234567890"); map.set("fileAttachment.filename", "testimage222222.tif"); map.set("fileAttachment.file", "0987654321"); Retrievals response = Retrievals.acquirerFulfillARequest(map); out(response, "requestId"); // -->300002296235 } catch (ApiException e) { err("HttpStatus: " + e.getHttpStatus()); err("Message: " + e.getMessage()); err("ReasonCode: " + e.getReasonCode()); err("Source: " + e.getSource()); } } public static void out(SmartMap response, String key) { System.out.println(key + "-->" + response.get(key)); } public static void out(Map<String, Object> map, String key) { System.out.println(key + "--->" + map.get(key)); } public static void err(String message) { System.err.println(message); } }
package com.scottehboeh.glc.utils; import java.io.File; /** * Created by 1503257 on 08/12/2017. * <p> * File Utils * <p> * This class contains various useful methods for managing and handling * file-based objects. */ public class FileUtils { /** * List Files for Folder - Print out a list of Files within a Directory * * @param folder - Given File (Directory) to list files of */ public void listFilesForFolder(final File folder) { for (final File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) { listFilesForFolder(fileEntry); } else { System.out.println(fileEntry.getName()); } } } }
// Kufas.ru 6.1.1.12 package hw.gorovtsov.mathtesting.tasks; import java.util.Scanner; public class Twelve { public static void main(String[] args) { double x; Scanner sc = new Scanner(System.in); System.out.println("Enter x: "); while (!sc.hasNextInt()) { sc.next(); System.out.println("Enter x: "); } x = sc.nextInt(); sc.close(); double rez; rez = (Math.pow(x, 2) - 7 * x + 10) / (Math.pow(x, 2) - 8 * x + 12); System.out.println("Result: " + rez); } }
package com.qa.demo.cuke; import static org.junit.Assert.assertTrue; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.RemoteWebDriver; import cucumber.api.java.After; import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class StepDefinition { private RemoteWebDriver driver; @Before public void init() { ChromeOptions opts = new ChromeOptions(); opts.setHeadless(true); this.driver = new ChromeDriver(opts); } @Given("^I have an account with \"([^\"]*)\" and \"([^\"]*)\"$") public void i_have_an_account_with_and(String user, String pass) throws Throwable { this.driver.get("http://thedemosite.co.uk/addauser.php"); WebElement username = this.driver.findElementByXPath( "/html/body/table/tbody/tr/td[1]/form/div/center/table/tbody/tr/td[1]/div/center/table/tbody/tr[1]/td[2]/p/input"); username.sendKeys(user); WebElement password = this.driver.findElementByXPath( "/html/body/table/tbody/tr/td[1]/form/div/center/table/tbody/tr/td[1]/div/center/table/tbody/tr[2]/td[2]/p/input"); password.sendKeys(pass); WebElement submit = this.driver.findElementByXPath( "/html/body/table/tbody/tr/td[1]/form/div/center/table/tbody/tr/td[1]/div/center/table/tbody/tr[3]/td[2]/p/input"); submit.click(); } @Given("^I am on the login page$") public void i_am_on_the_login_page() throws Throwable { this.driver.get("http://thedemosite.co.uk/login.php"); } @When("^I login with that \"([^\"]*)\" and \"([^\"]*)\"$") public void i_login_with_that_and(String user, String pass) throws Throwable { WebElement username = this.driver.findElementByXPath( "/html/body/table/tbody/tr/td[1]/form/div/center/table/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/p/input"); username.sendKeys(user); WebElement password = this.driver.findElementByXPath( "/html/body/table/tbody/tr/td[1]/form/div/center/table/tbody/tr/td[1]/table/tbody/tr[2]/td[2]/p/input"); password.sendKeys(pass); WebElement submit = this.driver.findElementByXPath( "/html/body/table/tbody/tr/td[1]/form/div/center/table/tbody/tr/td[1]/table/tbody/tr[3]/td[2]/p/input"); submit.click(); } @Then("^I verify i have the correct \"([^\"]*)\"$") public void i_verify_i_have_the_correct(String status) throws Throwable { String loginStatus = driver .findElementByXPath("/html/body/table/tbody/tr/td[1]/big/blockquote/blockquote/font/center/b") .getText(); assertTrue(loginStatus.toLowerCase().contains(status.toLowerCase())); } @After public void tearDown() { this.driver.quit(); } }
package thsst.calvis.simulatorvisualizer.model; /** * Created by Ivan on 7/10/2016. */ public class RotateModel{ private String result; private String carryFlag; public RotateModel(String result, String carryFlag){ this.result = result; this.carryFlag = carryFlag; } public String getResult(){ return result; } public String getFlag(){ return carryFlag; } }
package com.tencent.mm.plugin.websearch.api; import android.content.res.AssetManager; import com.tencent.mm.ab.e; import com.tencent.mm.kernel.g; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.w; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.aa.a; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; public final class r { private static e dKj = new 1(); private static HashMap<String, a> pLD = new HashMap(); private static Map<String, JSONObject> pLE = new HashMap(); private static l pLF; private static HashMap<String, Long> pLG; private static String pLH = ""; static { pLD.put("zh_CN", a.sWu); pLD.put("zh_HK", a.sWw); pLD.put("zh_TW", a.sWv); pLD.put("en", a.sWx); pLD.put("ar", a.sWy); pLD.put("de", a.sWz); pLD.put("de_DE", a.sWA); pLD.put("es", a.sWB); pLD.put("fr", a.sWC); pLD.put("he", a.sWD); pLD.put("hi", a.sWE); pLD.put("id", a.sWF); pLD.put("in", a.sWG); pLD.put("it", a.sWH); pLD.put("iw", a.sWI); pLD.put("ja", a.sWJ); pLD.put("ko", a.sWK); pLD.put("lo", a.sWL); pLD.put("ms", a.sWM); pLD.put("my", a.sWN); pLD.put("pl", a.sWO); pLD.put("pt", a.sWP); pLD.put("ru", a.sWQ); pLD.put("th", a.sWR); pLD.put("tr", a.sWS); pLD.put("vi", a.sWT); } public static boolean zZ(int i) { if (pLG == null) { pLG = new HashMap(); } String fD = w.fD(ad.getContext()); if (pLH == null || pLH.equalsIgnoreCase(fD)) { Long l = (Long) pLG.get(fD); if (l == null) { l = Long.valueOf(0); } if (System.currentTimeMillis() - l.longValue() < 600000) { return false; } JSONObject PV; int i2; pLG.put(fD, Long.valueOf(System.currentTimeMillis())); x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "startToRequestConfig %s %d %d", new Object[]{fD, Integer.valueOf(i), Long.valueOf(0)}); String str = (String) g.Ei().DT().get(PW(fD), null); try { if (!bi.oW(str)) { PV = PV(str); i2 = PV != null ? a.pLK : PV.optLong("updateTime") + (PV.optLong("timevalSec") * 1000) < System.currentTimeMillis() ? a.pLJ : a.pLI; if (i2 == a.pLI) { return false; } } } catch (Exception e) { } PV = null; if (PV != null) { } if (i2 == a.pLI) { return false; } } pLH = fD; if (pLF != null) { g.DF().c(pLF); pLF = null; } pLF = new l(i); g.DF().a(1948, dKj); g.DF().a(pLF, 0); return true; } private static JSONObject PV(String str) { if (pLE.containsKey(str) && pLE.get(str) != null) { return (JSONObject) pLE.get(str); } try { JSONObject jSONObject = new JSONObject(str); pLE.put(str, jSONObject); return jSONObject; } catch (Throwable e) { x.printErrStackTrace("MicroMsg.WebSearch.WebSearchConfigLogic", e, "", new Object[0]); return null; } } private static a PW(String str) { a aVar = (a) pLD.get(str); if (aVar == null) { return a.sWx; } return aVar; } private static int fh(String str, String str2) { try { JSONObject jSONObject = new JSONObject(str2); jSONObject.put("updateTime", System.currentTimeMillis()); String jSONObject2 = jSONObject.toString(); g.Ei().DT().a(PW(str), jSONObject2); try { pLE.put(jSONObject2, new JSONObject(jSONObject2)); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.WebSearch.WebSearchConfigLogic", e, "", new Object[0]); } return a.pLI; } catch (JSONException e2) { return a.pLK; } } public static JSONObject PX(String str) { String str2; JSONObject optJSONObject; Object obj; String obj2; JSONObject jSONObject; JSONObject jSONObject2 = null; String str3 = ""; try { str2 = (String) g.Ei().DT().get(PW(w.fD(ad.getContext())), null); if (!bi.oW(str2)) { jSONObject2 = PV(str2).optJSONObject("data").optJSONObject(str); str2 = "Config Storage"; if (jSONObject2 == null) { try { str3 = bSW(); if (str3 != null) { optJSONObject = new JSONObject(str3).optJSONObject("data").optJSONObject(str); try { str2 = "Asset"; obj2 = str2; } catch (Exception e) { jSONObject2 = optJSONObject; obj2 = str2; optJSONObject = jSONObject2; if (optJSONObject == null) { jSONObject = new JSONObject(); } else { jSONObject = optJSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } if (optJSONObject == null) { jSONObject = new JSONObject(); } else { jSONObject = optJSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } } catch (Exception e2) { obj2 = str2; optJSONObject = jSONObject2; if (optJSONObject == null) { jSONObject = optJSONObject; } else { jSONObject = new JSONObject(); } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } } optJSONObject = jSONObject2; obj2 = str2; if (optJSONObject == null) { jSONObject = optJSONObject; } else { jSONObject = new JSONObject(); } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } } catch (Exception e3) { } str2 = str3; if (jSONObject2 == null) { try { str3 = bSW(); if (str3 != null) { optJSONObject = new JSONObject(str3).optJSONObject("data").optJSONObject(str); try { str2 = "Asset"; obj2 = str2; } catch (Exception e4) { jSONObject2 = optJSONObject; obj2 = str2; optJSONObject = jSONObject2; if (optJSONObject == null) { jSONObject = new JSONObject(); } else { jSONObject = optJSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } if (optJSONObject == null) { jSONObject = new JSONObject(); } else { jSONObject = optJSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } } catch (Exception e22) { obj2 = str2; optJSONObject = jSONObject2; if (optJSONObject == null) { jSONObject = optJSONObject; } else { jSONObject = new JSONObject(); } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } } optJSONObject = jSONObject2; obj2 = str2; if (optJSONObject == null) { jSONObject = new JSONObject(); } else { jSONObject = optJSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigKeyObj %s %s %s", new Object[]{r4, str, obj2}); return jSONObject; } public static String PY(String str) { String str2; JSONObject jSONObject; Object obj; JSONObject jSONObject2; Object opt; JSONObject jSONObject3 = null; String str3 = ""; try { str2 = (String) g.Ei().DT().get(PW(w.fD(ad.getContext())), null); if (!bi.oW(str2)) { jSONObject3 = PV(str2); str2 = "Config Storage"; if (jSONObject3 == null) { String bSW; try { bSW = bSW(); if (bSW != null) { jSONObject = new JSONObject(bSW); try { str2 = "Asset"; obj = str2; } catch (Exception e) { jSONObject3 = jSONObject; bSW = str2; jSONObject = jSONObject3; if (jSONObject == null) { jSONObject2 = jSONObject; } else { jSONObject2 = new JSONObject(); } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); return opt == null ? opt.toString() : ""; } if (jSONObject == null) { jSONObject2 = new JSONObject(); } else { jSONObject2 = jSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); if (opt == null) { } } } catch (Exception e2) { bSW = str2; jSONObject = jSONObject3; if (jSONObject == null) { jSONObject2 = new JSONObject(); } else { jSONObject2 = jSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); if (opt == null) { } } } jSONObject = jSONObject3; obj = str2; if (jSONObject == null) { jSONObject2 = jSONObject; } else { jSONObject2 = new JSONObject(); } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); if (opt == null) { } } } catch (Exception e3) { } str2 = str3; if (jSONObject3 == null) { String bSW2; try { bSW2 = bSW(); if (bSW2 != null) { jSONObject = new JSONObject(bSW2); try { str2 = "Asset"; obj = str2; } catch (Exception e4) { jSONObject3 = jSONObject; bSW2 = str2; jSONObject = jSONObject3; if (jSONObject == null) { jSONObject2 = jSONObject; } else { jSONObject2 = new JSONObject(); } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); return opt == null ? opt.toString() : ""; } if (jSONObject == null) { jSONObject2 = new JSONObject(); } else { jSONObject2 = jSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); if (opt == null) { } } } catch (Exception e22) { bSW2 = str2; jSONObject = jSONObject3; if (jSONObject == null) { jSONObject2 = new JSONObject(); } else { jSONObject2 = jSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); if (opt == null) { } } } jSONObject = jSONObject3; obj = str2; if (jSONObject == null) { jSONObject2 = new JSONObject(); } else { jSONObject2 = jSONObject; } x.i("MicroMsg.WebSearch.WebSearchConfigLogic", "getWebSearchConfigMetaKeyObj %s %s %s", new Object[]{r4, str, obj}); opt = jSONObject2.opt(str); if (opt == null) { } } private static String bSW() { Throwable e; InputStream inputStream = null; AssetManager assets = ad.getContext().getAssets(); InputStream open; try { open = assets.open("webconfig/default." + w.fD(ad.getContext())); try { String str = new String(com.tencent.mm.a.e.g(open)); com.tencent.mm.a.e.f(open); return str; } catch (Exception e2) { e = e2; try { x.printErrStackTrace("MicroMsg.WebSearch.WebSearchConfigLogic", e, e.getMessage(), new Object[0]); com.tencent.mm.a.e.f(open); return null; } catch (Throwable th) { e = th; inputStream = open; com.tencent.mm.a.e.f(inputStream); throw e; } } } catch (Exception e3) { e = e3; open = null; } catch (Throwable th2) { e = th2; com.tencent.mm.a.e.f(inputStream); throw e; } } }
package dmoj; import java.util.Scanner; public class RGPC_17_P1_CircleClicking { public static void main(String[] args){ Scanner in = new Scanner(System.in); int N = in.nextInt();//total number of circles in sequence int D = in.nextInt();//greatest jump distance int x1=in.nextInt(); int y1=in.nextInt(); int longestCombo =1; int[] longestComboA = new int[N]; longestComboA[0] = longestCombo; for (int i =0; i<N-1;i++) { int x2 = in.nextInt(); int y2 = in.nextInt(); double distance = Math.sqrt(Math.pow((x2-x1),2) + Math.pow((y2-y1),2)); if (D>= distance) { longestCombo++; longestComboA[i+1] = longestCombo; } else { longestCombo = 0; longestComboA[i+1] = longestCombo; } x1 = x2; y1 = y2; } int maxCombo = longestComboA[0]; for (int i=1;i<longestComboA.length;i++) { if (longestComboA[i]>maxCombo) maxCombo = longestComboA[i]; } System.out.println(maxCombo); } }
package com.example.railway.controller.rest; import com.example.railway.model.Root; import com.example.railway.model.Train; import com.example.railway.service.Root.RootServiceImpl; import com.example.railway.service.Train.TrainServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("api/trains") public class TrainRestController { @Autowired TrainServiceImpl service; @GetMapping("/delete/{id}") public Train deleteById(@PathVariable("id") String id){ return service.delete(id); } @PostMapping("/create/") public Train create(@RequestBody Train train){ return service.create(train); } @GetMapping("/get/all") public List<Train> getAll(){ return service.getAll() ; } @GetMapping("/get/root/{root}") public Object getAll(@PathVariable("root") String root){ return service.getTrainsOnRoot( root) ; } @GetMapping("/get/amountOnRoot/{root}") public Object getAmountOfTrainsOnRoot(@PathVariable("root") String root){ return service.getAmountOfTrainsOnRoot(root) ; } @GetMapping("/get/{id}") public Train getById(@PathVariable("id") String id){ return service.getById(id); } @PostMapping ("/update/") public Train update(@RequestBody Train train){ return service.update(train); } }
package ru.job4j.chess; import org.junit.Test; import ru.job4j.chess.firuges.Cell; import static org.junit.Assert.*; public class LogicTest { @Test public void whenFigureIsWay() { Logic logic = new Logic(); boolean result = logic.move(Cell.C1, Cell.G5); assertFalse(result); } @Test public void whenFigureRemained() { Logic logic = new Logic(); boolean result = logic.move(Cell.C1, Cell.C1); assertFalse(result); } @Test public void whenFigureIsWay1() { Logic logic = new Logic(); boolean result = logic.move(Cell.C1, Cell.B1); assertFalse(result); } }
package com.lin.utils; import org.junit.Test; public class PropertiesUtilTest { @Test public void readTest(){ System.out.println(PropertiesUtil.getConfig("savePicUrl").trim()); } }
public class Nokia extends Phone { //this inherits the abstract class called phone public void showConfiguration() { //so it uses the method in the abstract class but not creating its own method System.out.println("Nokia X\nVersion 4.2"); } }
package com.tiandi.logistics.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.tiandi.logistics.entity.front.LineInfoFront; import com.tiandi.logistics.entity.pojo.LineInfo; import org.apache.ibatis.annotations.Mapper; import java.util.List; /** * @author kotori * @version 1.0 * @date 2020/12/2 09:48 * @description */ public interface LineInfoMapper extends BaseMapper<LineInfo> { List<LineInfoFront> getRoadMap(); }
package com.artland.controller.vo; import java.io.Serializable; /** * @author WaylanPunch * @email waylanpunch@gmail.com * @link https://github.com/WaylanPunch * @date 2017-10-31 */ public class SimpleBlogListVO implements Serializable { private Long blogId; private String blogTitle; public Long getBlogId() { return blogId; } public void setBlogId(Long blogId) { this.blogId = blogId; } public String getBlogTitle() { return blogTitle; } public void setBlogTitle(String blogTitle) { this.blogTitle = blogTitle; } }
package com.example.proyectofinalmaster.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "skilled") public class Skilled { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column (name = "name") private String name; private LocalDate created_at; private LocalDate updated_at; @Column (name = "motive_state") private String motive_state; //Null @Column (name = "availability") private String availability; @Column (name = "modality") private String modality; //Null private Boolean autonomous; //Null @Column (name = "contact_phone") private String contact_phone; @Column (name = "contact_email") private String contact_email; @Column (name = "contact_country") private String contact_country; private String contact_linkedln; private String conditions_percentage; private String conditions_price_hour; @Column (name = "score") private String score; private String nif; private String email_credentials; private String email_password_credentials; private String zoom_credentials; private String zoom_password_credentials; private String photo_file; //Null private String cv_file; //Null @Column (name = "observations") private String observations; //Null private String origin; //Null @Column (name = "state") private String state; @ManyToMany (fetch = FetchType.EAGER, cascade = CascadeType.PERSIST) @JoinTable( name = "skilled_tags", joinColumns = {@JoinColumn(name = "skilled_id", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "tag_id", referencedColumnName = "id")} ) @JsonIgnoreProperties("skilleds") private List<Tags> tags = new ArrayList<>(); //CONSTRUCTOR public Skilled() { } public Skilled(String name, LocalDate created_at, LocalDate updated_at, String motive_state, String availability, String modality, Boolean autonomous, String contact_phone, String contact_email, String contact_country, String contact_linkedln, String conditions_percentage, String conditions_price_hour, String score, String nif, String email_credentials, String email_password_credentials, String zoom_credentials, String zoom_password_credentials, String photo_file, String cv_file, String observations, String origin, String state) { this.name = name; this.created_at = created_at; this.updated_at = updated_at; this.motive_state = motive_state; this.availability = availability; this.modality = modality; this.autonomous = autonomous; this.contact_phone = contact_phone; this.contact_email = contact_email; this.contact_country = contact_country; this.contact_linkedln = contact_linkedln; this.conditions_percentage = conditions_percentage; this.conditions_price_hour = conditions_price_hour; this.score = score; this.nif = nif; this.email_credentials = email_credentials; this.email_password_credentials = email_password_credentials; this.zoom_credentials = zoom_credentials; this.zoom_password_credentials = zoom_password_credentials; this.photo_file = photo_file; this.cv_file = cv_file; this.observations = observations; this.origin = origin; this.state = state; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public LocalDate getCreated_at() { return created_at; } public void setCreated_at(LocalDate created_at) { this.created_at = created_at; } public LocalDate getUpdated_at() { return updated_at; } public void setUpdated_at(LocalDate updated_at) { this.updated_at = updated_at; } public String getMotive_state() { return motive_state; } public void setMotive_state(String motive_state) { this.motive_state = motive_state; } public String getAvailability() { return availability; } public void setAvailability(String availability) { this.availability = availability; } public String getModality() { return modality; } public void setModality(String modality) { this.modality = modality; } public Boolean getAutonomous() { return autonomous; } public void setAutonomous(Boolean autonomous) { this.autonomous = autonomous; } public String getContact_phone() { return contact_phone; } public void setContact_phone(String contact_phone) { this.contact_phone = contact_phone; } public String getContact_email() { return contact_email; } public void setContact_email(String contact_email) { this.contact_email = contact_email; } public String getContact_country() { return contact_country; } public void setContact_country(String contact_country) { this.contact_country = contact_country; } public String getContact_linkedln() { return contact_linkedln; } public void setContact_linkedln(String contact_linkedln) { this.contact_linkedln = contact_linkedln; } public String getConditions_percentage() { return conditions_percentage; } public void setConditions_percentage(String conditions_percentage) { this.conditions_percentage = conditions_percentage; } public String getConditions_price_hour() { return conditions_price_hour; } public void setConditions_price_hour(String conditions_price_hour) { this.conditions_price_hour = conditions_price_hour; } public String getScore() { return score; } public void setScore(String score) { this.score = score; } public String getNif() { return nif; } public void setNif(String nif) { this.nif = nif; } public String getEmail_credentials() { return email_credentials; } public void setEmail_credentials(String email_credentials) { this.email_credentials = email_credentials; } public String getEmail_password_credentials() { return email_password_credentials; } public void setEmail_password_credentials(String email_password_credentials) { this.email_password_credentials = email_password_credentials; } public String getZoom_credentials() { return zoom_credentials; } public void setZoom_credentials(String zoom_credentials) { this.zoom_credentials = zoom_credentials; } public String getZoom_password_credentials() { return zoom_password_credentials; } public void setZoom_password_credentials(String zoom_password_credentials) { this.zoom_password_credentials = zoom_password_credentials; } public String getPhoto_file() { return photo_file; } public void setPhoto_file(String photo_file) { this.photo_file = photo_file; } public String getCv_file() { return cv_file; } public void setCv_file(String cv_file) { this.cv_file = cv_file; } public String getObservations() { return observations; } public void setObservations(String observations) { this.observations = observations; } public String getOrigin() { return origin; } public void setOrigin(String origin) { this.origin = origin; } public String getState() { return state; } public void setState(String state) { this.state = state; } public List<Tags> getTags() { return tags; } public void setTags(List<Tags> tags) { this.tags = tags; } @Override public String toString() { return "Skilled{" + "id=" + id + ", name='" + name + '\'' + ", created_at=" + created_at + ", updated_at=" + updated_at + ", motive_state='" + motive_state + '\'' + ", availability='" + availability + '\'' + ", modality='" + modality + '\'' + ", autonomous=" + autonomous + ", contact_phone='" + contact_phone + '\'' + ", contact_email='" + contact_email + '\'' + ", contact_country='" + contact_country + '\'' + ", contact_linkedln='" + contact_linkedln + '\'' + ", conditions_percentage='" + conditions_percentage + '\'' + ", conditions_price_hour='" + conditions_price_hour + '\'' + ", score='" + score + '\'' + ", nif='" + nif + '\'' + ", email_credentials='" + email_credentials + '\'' + ", email_password_credentials='" + email_password_credentials + '\'' + ", zoom_credentials='" + zoom_credentials + '\'' + ", zoom_password_credentials='" + zoom_password_credentials + '\'' + ", photo_file='" + photo_file + '\'' + ", cv_file='" + cv_file + '\'' + ", observations='" + observations + '\'' + ", origin='" + origin + '\'' + ", state='" + state + '\'' + ", tags=" + tags + '}'; } }
/* * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.niubimq.thread; import java.util.List; import java.util.Map; import java.util.concurrent.LinkedBlockingQueue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import com.niubimq.listener.LifeCycle; import com.niubimq.pojo.Message; import com.niubimq.queue.QueueFactory; import com.niubimq.util.PropertiesReader; /** * @Description: Thread4 -- 读取时间燃尽的定时消息,放入到即时消息队列中 * Step1: 锁定消息 * Step2: 从DB读取相关数据 * Step3: 进入即时消费队列 * Step4: 从DB中删除 * @author junjin4838 * @version 1.0 */ @Service public class TimmingMsgConsumeService extends BaseService{ private static final Logger log = LoggerFactory.getLogger(TimmingMsgConsumeService.class); /** * 即时消息队列的引用 */ private LinkedBlockingQueue<Message> immediatelyMessageQueue; /** * 休眠时间 */ private int sleepTime = 2000; /** * 锁字段 */ private String dataLock; /** * 配置文件读取类 */ private PropertiesReader reader = PropertiesReader.getInstance(); public void run() { while(this.state == LifeCycle.RUNNING || this.state == LifeCycle.STARTING){ //锁定消息数据 msgPushService.lockTimmingMsg(dataLock); List<Message> timmingMsgList = msgPushService.getTimmingMsg(dataLock); // 放入即时消息队列,等待消费 immediatelyMessageQueue.addAll(timmingMsgList); // 从DB中删除 msgPushService.delTimmingMsg(dataLock); try { Thread.sleep(sleepTime); } catch (InterruptedException e) { e.printStackTrace(); } } } /** * 初始化 */ @SuppressWarnings("unchecked") @Override public void initInternal() { //队列的初始化 QueueFactory queryFactory = QueueFactory.getInstance(); immediatelyMessageQueue = (LinkedBlockingQueue<Message>) queryFactory.getQueue(QueueFactory.IMMEDIATE_QUEUE); Integer spt = Integer.parseInt((String)reader.get("thread.TimmingMsgConsumeService.sleeptime")); this.sleepTime = spt; Map<String,String> map = System.getenv(); dataLock = map.get("COMPUTERNAME") + "/" + map.get("USERDOMAIN") + "/" + map.get("USERNAME"); log.info("-------TimmingMsgConsumeService LockFile-----" + dataLock); log.info("-------TimmingMsgConsumeService初始化完毕-----"); } @Override public void startInternal() { Thread t = new Thread(this); t.setDaemon(true); t.setName("Timming-Msg-Consume-Service-Thread"); t.start(); log.info("-------TimmingMsgConsumeService启动完毕-----"); } @Override public void destroyInternal() { log.info("-------TimmingMsgConsumeService销毁完毕-----"); } }
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) package com.pybeta.daymatter.ui; import android.content.Context; import com.pybeta.daymatter.DayMatter; import com.pybeta.daymatter.WorldTimeZone; import com.pybeta.daymatter.db.DatabaseManager; import com.pybeta.util.AsyncLoader; import java.util.List; public class WorldTimeListLoader extends AsyncLoader<List<WorldTimeZone>> { public WorldTimeListLoader(Context context, int i) { super(context); mCategory = 0; mCategory = i; mContext = context; } public List<WorldTimeZone> loadInBackground() { return DatabaseManager.getInstance(getContext()).queryAllWorldTime(mCategory); } private int mCategory; private Context mContext; }
package br.com.edu.fafic.release1.domain; import lombok.*; import javax.persistence.Embeddable; @Embeddable @AllArgsConstructor @NoArgsConstructor @Data @Builder @ToString public class Contato { private String email; private String telefone; }
package ru.besttuts.stockwidget; /** * Created by romanchekashov on 30.10.16. */ public class PrivateConstants { public static final String BANNER_AD_UNIT_ID = ""; public static final String INTERSTITIAL_AD_UNIT_ID = ""; public static final String HASHED_DEVICE_ID = ""; }