blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
aaa328af270e63f903ba29d9dc3af08def9fbbec
101b23eb3cebb8fae7671de89cb04f6bda9fe0ac
/recyclerview_divider/src/main/java/basisproject/lym/org/recyclerview_divider/extension/ViewExtensions.java
28c10f233b3e8a99aa30ecc236b72fdd07bea992
[]
no_license
XWC95/BasisProject
52adf31d18a9be207b33752c0ab6f7665373622e
521d7c298b2f07ebdd545051a6bff1bfad06b05d
refs/heads/master
2023-08-06T17:08:45.240396
2019-09-08T15:15:11
2019-09-08T15:15:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,124
java
package basisproject.lym.org.recyclerview_divider.extension; import android.support.v4.view.ViewCompat; import android.view.View; /** * Copyright (c) 2017 Fondesa * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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. * * @author ym.li * @since 2019年3月31日10:48:54 */ public class ViewExtensions { /** * Check the layout orientation of this [View]. * * @param view recyclerView child item view * @return true if the layout is right-to-left, false otherwise. */ public static boolean isRTL(View view) { return ViewCompat.getLayoutDirection(view) == 1; } }
ab803467de0b378f0f612ad49e04ec042d88d323
30998a3486f3fad0b336cd7aa8e5ab20fa91181e
/src/main/java/com/liuqi/business/controller/admin/AdminServiceChargeController.java
085bb8099842f027753a6be6b21c781a97e649d5
[]
no_license
radar9494/Radar-Star-admin
cbf8c9a0b5b782d2bcc281dfd5ee78ce5b31f086
9e4622d3932c2cd2219152814fc91858030cc196
refs/heads/main
2023-02-24T00:07:03.150304
2021-01-26T02:51:38
2021-01-26T02:51:38
332,949,996
3
0
null
null
null
null
UTF-8
Java
false
false
3,654
java
package com.liuqi.business.controller.admin; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateTime; import com.liuqi.base.BaseAdminController; import com.liuqi.base.BaseService; import com.liuqi.business.model.CurrencyModelDto; import com.liuqi.business.model.ServiceChargeModel; import com.liuqi.business.model.ServiceChargeModelDto; import com.liuqi.business.service.CurrencyService; import com.liuqi.business.service.ServiceChargeService; import com.liuqi.response.ReturnResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.List; @Controller @RequestMapping("/admin/serviceCharge") public class AdminServiceChargeController extends BaseAdminController<ServiceChargeModel, ServiceChargeModelDto> { @Autowired private ServiceChargeService serviceChargeService; //jsp基础路径 private final static String JSP_BASE_PTH = "admin"; //模块 private final static String BASE_MODUEL = "serviceCharge"; //默认为""表示可以使用add和update。 重写add或update时,原有方法禁止使用 NOT_OPERATE="add,update" private final static String NOT_OPERATE = "add,update"; @Override public BaseService getBaseService() { return this.serviceChargeService; } @Override public String getJspBasePath() { return JSP_BASE_PTH; } @Override public String getBaseModuel() { return BASE_MODUEL; } @Override public String getNotOperate() { return NOT_OPERATE; } @Override public String getDefaultExportName() { return DEFAULT_EXPORTNAME; } /*******待修改 排序 导出**********************************************************************************************************/ //默认导出名称 private final static String DEFAULT_EXPORTNAME = "手续费"; @Override public String[] getDefaultExportHeaders() { String[] headers = {"主键", "创建时间", "更新时间", "备注", "版本号", "统计日期", "币种id", "手续费"}; return headers; } @Override public String[] getDefaultExportColumns() { String[] columns = {"id", "createTime", "updateTime", "remark", "version", "calcDate", "currencyName", "charge"}; return columns; } /*******自己代码**********************************************************************************************************/ @Autowired private CurrencyService currencyService; @Override protected void toListHandle(ModelMap modelMap, HttpServletRequest request, HttpServletResponse response) { List<CurrencyModelDto> list = currencyService.getAll(); modelMap.put("list", list); } /** * 手动汇总 * * @param remark * @param request * @return */ @RequestMapping(value = "/totalRecharge") @ResponseBody public ReturnResponse totalRecharge(String remark, HttpServletRequest request) { try { Date date = DateTime.now().offset(DateField.DAY_OF_YEAR, -1); serviceChargeService.totalCharge(date); return ReturnResponse.backSuccess(); } catch (Exception e) { e.printStackTrace(); return ReturnResponse.backFail(e.getMessage()); } } }
abd4b69a089028ad4ee7bab50f0d950bddc5d217
07a8e67e1c4c7f3ffc7ee01c5d6468f601c07659
/week05/Normal Exam/src/main/java/main.java
45df535cd08445802773d08604886a0eb009558a
[]
no_license
green-fox-academy/matuspasko
c68b6311a6b56ee6f76dd69751e7117b8f8dfeed
08ebb8d2cead533c8d9de4118e7cbfe4d8afc0fa
refs/heads/master
2020-05-04T17:39:21.640855
2019-09-06T15:18:36
2019-09-06T15:18:36
179,320,746
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
import java.io.File; import java.io.FileInputStream; public class main { public static void main(String args[]) throws Exception{ int count =0; File file = new File("/Users/matuspasko/Desktop/matuspasko/week05/Normal Exam/src/main/java/rainydays.txt"); FileInputStream fis = new FileInputStream(file); byte[] bytesArray = new byte[(int)file.length()]; fis.read(bytesArray); String s = new String(bytesArray); String [] data = s.split(" "); for (int i=0; i<data.length; i++) { count++; } System.out.println("Number of characters in the given file are " +count); } }
c2da190c77287264be44244332e872d5f467d509
a6ea34f7a8eb77ba60f9c99007d112c211056c6a
/Parent/src/main/java/com/example/demo/response/Response.java
7578c5fe828aa91b76e494115dcbea77b9abd14e
[]
no_license
ntsh6/Project--G
5a1b530f1dcb63a322fd731d8e87546c624cba07
c16885e3cb9cdd1b88db5c34115f5acb59e1204c
refs/heads/master
2020-06-01T10:13:58.904147
2019-02-18T09:46:58
2019-02-18T09:46:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package com.example.demo.response; public class Response { private String status; private String message; private Object data; private Object errors; private boolean isApiTimeout; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public Object getErrors() { return errors; } public void setErrors(Object errors) { this.errors = errors; } public boolean isApiTimeout() { return isApiTimeout; } public void setApiTimeout(boolean isApiTimeout) { this.isApiTimeout = isApiTimeout; } }
75586fb90898e3d6c38760017c9d77aab8ccff55
7b494df6e39d59194f4d83cbd4982b6a287ee8d9
/StratioWars/src/main/java/com/stratiowars/core/StratioWarsApplication.java
71d3f791cba60d83d5787f49f545e6cbf129a88a
[]
no_license
CarlosCarrilloMart/StratioCode
1b72fa1753771fc147a25eef45bba05044ef4078
f9eaefa30355cedc12f2ccd9624f0cbabe55272c
refs/heads/master
2022-12-09T21:04:22.047514
2020-09-13T13:16:04
2020-09-13T13:16:04
295,122,308
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.stratiowars.core; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StratioWarsApplication { public static void main(String[] args) { SpringApplication.run(StratioWarsApplication.class, args); } }
6833f31871f27c5ba6ec331a907a39f9369b835a
9acf661e62815cdd96bfe227610f1f8fe7443651
/src/main/java/com/learncamel/bean/ItemSvc.java
ef936a123532c116d7bd33a7efe4e86a80df48ad
[]
no_license
sawancse/learncamel-spring-boot-aggregation-lab3
8b3481573c40dbec2d271ab825f3825b0c3c773e
3f8567c9c87fe5390105082169dfa120bdc60320
refs/heads/main
2023-08-22T07:44:06.113064
2021-10-27T02:28:55
2021-10-27T02:28:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
599
java
package com.learncamel.bean; public class ItemSvc { public Item processBook(Item item) throws InterruptedException { System.out.println("handle book Item:" +item); item.setPrice(30); System.out.println("book Item processed"); return item; } public Item processPhone(Item item) throws InterruptedException { System.out.println("handle phone Item:" +item); item.setPrice(500); System.out.println("phone Item processed"); return item; } }
396689d034479f3ba86c65ec1540a88be93cd302
efc9faec5d261455430cb7a549d02ad68c928b01
/src/spaceinvaders/model/Model.java
f3d28b20563bfbb57b5c75bd8275c9441013188c
[]
no_license
przestaw/SpaceInvadersFX
14eaf86307b47814cff2e55f88c05c37a74f6255
6be3709838426bf93e378a571a080be8d85cdb1f
refs/heads/master
2020-04-04T11:32:44.972808
2019-12-05T12:54:47
2019-12-05T12:54:47
155,894,907
0
0
null
null
null
null
UTF-8
Java
false
false
86
java
package spaceinvaders.model; public class Model { public Model() { } }
ed60d4059b40bc6352bd36f7d226538d1a436688
70cbaeb10970c6996b80a3e908258f240cbf1b99
/WiFi万能钥匙dex1-dex2jar.jar.src/com/linksure/apservice/a/c/x.java
f45a0af8d2af75d25420fad5ceef5c78575569ec
[]
no_license
nwpu043814/wifimaster4.2.02
eabd02f529a259ca3b5b63fe68c081974393e3dd
ef4ce18574fd7b1e4dafa59318df9d8748c87d37
refs/heads/master
2021-08-28T11:11:12.320794
2017-12-12T03:01:54
2017-12-12T03:01:54
113,553,417
2
1
null
null
null
null
UTF-8
Java
false
false
657
java
package com.linksure.apservice.a.c; import com.linksure.apservice.a.a.f; import com.linksure.apservice.a.d.a.b; import com.linksure.apservice.a.f.b.a; import com.linksure.apservice.a.j; final class x extends b.a { x(v paramv, String paramString, j paramj) {} public final void a() { long l = v.a(this.c).b(this.a); this.b.a(Long.valueOf(l)); } public final void a(Exception paramException) { this.b.a(new b(paramException)); } } /* Location: /Users/hanlian/Downloads/WiFi万能钥匙dex1-dex2jar.jar!/com/linksure/apservice/a/c/x.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
ed8b7478b5069b521fb8f08c898707e458b23bc1
c2a975880da044b41c2ce07753dcac06c9dcb119
/app/src/main/java/com/shangame/hxjsq/storage/db/DaoMaster.java
1bce3a5f8ed83f91a15926acc4f709b6a1be1a38
[]
no_license
daixu/Hxjsq
0e150d01a8c378076d7ef349799af96d07c2d1a1
89762abcd7daf493fc9333c5b7e877845c2897da
refs/heads/master
2021-05-17T07:28:37.106582
2020-04-08T01:23:12
2020-04-08T01:23:12
250,697,454
0
0
null
null
null
null
UTF-8
Java
false
false
3,429
java
package com.shangame.hxjsq.storage.db; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.util.Log; import org.greenrobot.greendao.AbstractDaoMaster; import org.greenrobot.greendao.database.StandardDatabase; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseOpenHelper; import org.greenrobot.greendao.identityscope.IdentityScopeType; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * Master of DAO (schema version 2): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 2; /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { ResultEntityDao.createTable(db, ifNotExists); ScoreRecordEntityDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { ResultEntityDao.dropTable(db, ifExists); ScoreRecordEntityDao.dropTable(db, ifExists); } /** * WARNING: Drops all table on Upgrade! Use only during development. * Convenience method using a {@link DevOpenHelper}. */ public static DaoSession newDevSession(Context context, String name) { Database db = new DevOpenHelper(context, name).getWritableDb(); DaoMaster daoMaster = new DaoMaster(db); return daoMaster.newSession(); } public DaoMaster(SQLiteDatabase db) { this(new StandardDatabase(db)); } public DaoMaster(Database db) { super(db, SCHEMA_VERSION); registerDaoClass(ResultEntityDao.class); registerDaoClass(ScoreRecordEntityDao.class); } public DaoSession newSession() { return new DaoSession(db, IdentityScopeType.Session, daoConfigMap); } public DaoSession newSession(IdentityScopeType type) { return new DaoSession(db, type, daoConfigMap); } /** * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} - */ public static abstract class OpenHelper extends DatabaseOpenHelper { public OpenHelper(Context context, String name) { super(context, name, SCHEMA_VERSION); } public OpenHelper(Context context, String name, CursorFactory factory) { super(context, name, factory, SCHEMA_VERSION); } @Override public void onCreate(Database db) { Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION); createAllTables(db, false); } } /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); } public DevOpenHelper(Context context, String name, CursorFactory factory) { super(context, name, factory); } @Override public void onUpgrade(Database db, int oldVersion, int newVersion) { Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables"); dropAllTables(db, true); onCreate(db); } } }
378732ee21d852657c53bf317d5f0fcda77d6ee7
9812c34eb82734a1d0970afa3f121a036875b5ae
/Level 2/JavaOnline-02-04-01/src/by/epam/jo_02_04_01/bean/Program.java
04fe3c0e048bcea0d89df16e5b3364ef3cfbeb65
[]
no_license
AnzhelaKhamitskaya/Introduction-to-Java-Online-EPAM
5ebc5bcd2ff975d5d0e9afb06cee17d6a718c421
3af345a6e6d40c96d1f04a8af165b37bbdd4c37b
refs/heads/main
2023-02-27T20:08:18.707517
2021-01-28T20:30:44
2021-01-28T20:30:44
333,511,763
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
709
java
/* * Написать метод(методы) для нахождения наибольшего общего делителя и наименьшего общего кратного двух * натуральных чисел */ package by.epam.jo_02_04_01.bean; public class Program { public static void main(String[] args) { int nok = nok(100, 10); int nod = nod(100, 10); System.out.println("НОД = " + nod); System.out.println("НОК = " + nok); } private static int nod(int x, int y) { while (x != 0 && y != 0) { if (x > y) { x %= y; } else { y %= x; } } return x + y; } private static int nok(int x, int y) { return (x * y) / nod(x, y); } }
b21ec4f168c989f35094340a4f2a7b9621757a75
fb1909a53291a0af5fef3add9b4e986dbc3645d2
/PAIR/src/java/cafeverde/CafeVerdeActionForm.java
2b87ad7ee5f338fd7dea009a3b8b098fab067c5a
[]
no_license
BackupTheBerlios/art23esiea
88d11585a45ffe1a32de8aa11bf7c8650eb686f7
f54da83604e80ebed43bf8718a3fc7d846281330
refs/heads/master
2016-09-06T18:45:51.657256
2007-04-07T10:04:47
2007-04-07T10:04:47
40,043,955
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,515
java
/* * CafeVerdeActionForm.java * * Created on 21 février 2007, 12:26 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package cafeverde; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.*; public class CafeVerdeActionForm extends ActionForm { private String humidity = null; public String getHumidity() {return(humidity);} public void setHumidity(String var) {humidity=var;} private String color = null; public String getColor() {return(color);} public void setColor(String var) {color=var;} private String smell = null; public String getSmell() {return(smell);} public void setSmell(String var) {smell=var;} private String denseness = null; public String getDenseness() {return(denseness);} public void setDenseness(String var) {denseness=var;} private String uniformity = null; public String getUniformity() {return(uniformity);} public void setUniformity(String var) {uniformity=var;} public void reset(ActionMapping mapping, HttpServletRequest request){ humidity=null; color=null; smell=null; denseness=null; uniformity=null;} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if((humidity == null) || (humidity.length() == 0)) errors.add("humidity", new ActionMessage("erreur.humidity")); return errors; } }
[ "bastien" ]
bastien
91d0dcd973b29c24d36976fe16a7fc49f6bfb44c
51035c1e4b130e27dbc57aebf58b6e3e5937d65d
/SimpleTodayWeather/app/src/main/java/com/example/viveksharma/weather/MainActivity.java
fcc3948b87a7dd70324c2082a7522d8b4edc541d
[]
no_license
VivekSharma-Git/Android
7a605fbb1bde210ce717b4562ca699a94d3c8ff5
6f5aa0560b24d29595c06e7511e9f473a1533b97
refs/heads/master
2020-03-24T01:46:10.806075
2018-07-25T20:34:07
2018-07-25T20:34:07
142,349,315
0
0
null
null
null
null
UTF-8
Java
false
false
15,400
java
package com.example.viveksharma.weather; import android.Manifest; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.location.Address; import android.location.Geocoder; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.annotation.NonNull; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Editable; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Locale; public class MainActivity extends AppCompatActivity { String units="metric"; String cityName=""; boolean flag =false; private static final String TAG = "MainActivity"; SharedPreferences sharedPref; SharedPreferences.Editor editor; private Locator locator; boolean connected; SwipeRefreshLayout mSwipeRefreshLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get shared preference getSharedPreference(); // check connectivity before doing async load checkconnectivity(); if (connected == true) { doAsyncLoad(); } // hide the display items else { noInternetDisplay(); } // set swipe refresher mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresher); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // get shared preference getSharedPreference(); // check connectivity before doing async load checkconnectivity(); if (connected == true) { doAsyncLoad(); RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup); rg.setVisibility(View.VISIBLE); } // hide the display items else { noInternetDisplay(); } mSwipeRefreshLayout.setRefreshing(false); } }); } public void noInternetDisplay(){ TextView city = (TextView) findViewById(R.id.city); city.setText(""); RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup); rg.setVisibility(View.GONE); TextView temp = (TextView) findViewById(R.id.temp); temp.setText("No Internet Connection"); TextView condition = (TextView) findViewById(R.id.condition); condition.setText(""); TextView description = (TextView) findViewById(R.id.desc); description.setText(""); TextView date = (TextView) findViewById(R.id.date); date.setText(""); TextView wind = (TextView) findViewById(R.id.wind); wind.setText(""); TextView direction = (TextView) findViewById(R.id.direction); direction.setText(""); TextView rain = (TextView) findViewById(R.id.rain); rain.setText(""); TextView snow = (TextView) findViewById(R.id.snow); snow.setText(""); TextView cloudiness = (TextView) findViewById(R.id.cloudiness); cloudiness.setText(""); TextView humidity = (TextView) findViewById(R.id.humidity); humidity.setText(""); ImageView wimage = (ImageView) findViewById(R.id.imageView); wimage.setImageDrawable(null); TextView pressure = (TextView) findViewById(R.id.pressure); pressure.setText(""); TextView sunrise = (TextView) findViewById(R.id.sunrise); sunrise.setText(""); TextView sunset = (TextView) findViewById(R.id.sunset); sunset.setText(""); TextView visibility = (TextView) findViewById(R.id.visibility); visibility.setText(""); } public void getSharedPreference(){ // shared preference sharedPref = getSharedPreferences("mypref", Context.MODE_PRIVATE); // get shared preference data that is committed if (sharedPref.contains("city")) { cityName = sharedPref.getString("city", ""); Log.d(TAG, "onCreate: cc" + cityName); flag = true; } if (sharedPref.contains("units")) { units = sharedPref.getString("units", ""); Log.d(TAG, "onCreate: ccin" + units); // set radio button according to shared preference RadioButton rbc = (RadioButton) findViewById(R.id.celsius); RadioButton rbf = (RadioButton) findViewById(R.id.fahrenheit); if (units.equals("metric")) { rbc.setChecked(true); } else { rbf.setChecked(true); } } } public void checkconnectivity(){ ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) { //we are connected to a network connected = true; } else connected = false; } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mymenu,menu); return true; } private void doAsyncLoad() { TextView tv = (TextView) findViewById(R.id.city); if(flag==false) { //cityName = tv.getText().toString().trim().replaceAll(", ", ","); cityName = "delhi"; } AsyncTask at = new AsyncTask(this); at.execute(cityName, units,""); } private void doAsyncLoadLocation() { TextView tv = (TextView) findViewById(R.id.city); if(flag==false) { //cityName = tv.getText().toString().trim().replaceAll(", ", ","); cityName = "delhi"; } AsyncTask at = new AsyncTask(this); at.execute(cityName, units,"location"); } public void unitSet(View v){ switch (v.getId()){ case R.id.fahrenheit: units="imperial"; break; case R.id.celsius: units="metric"; break; } doAsyncLoad(); } // menu options @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.selectcity: showCityDialog(); return true; case R.id.location: // start locator locator = new Locator(this); return true; case R.id.about: Intent intent = new Intent(MainActivity.this, About.class); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } } public void showCityDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); final EditText edittext = new EditText(MainActivity.this); alert.setMessage(""); alert.setTitle("Enter City Name"); alert.setView(edittext); alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { cityName = edittext.getText().toString().replaceAll(", ", ",");; flag = true; doAsyncLoad(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // } }); alert.show(); } public void displayWeatherData(HashMap<String, String> weatherData, Bitmap bitmap) { if (weatherData.isEmpty()) { Toast.makeText(this, "Invalid City Name", Toast.LENGTH_SHORT).show(); return; } TextView cityName = (TextView) findViewById(R.id.city); cityName.setText(weatherData.get("city") + ", " + weatherData.get("country")); TextView temperature = (TextView) findViewById(R.id.temp); if(units.equals("imperial")) { temperature.setText(weatherData.get("temperature")+" °F"); } else{ temperature.setText(weatherData.get("temperature")+" °C"); } TextView condition = (TextView) findViewById(R.id.condition); condition.setText(weatherData.get("condition")); TextView description = (TextView) findViewById(R.id.desc); description.setText("(" + weatherData.get("description") + ")"); TextView date = (TextView) findViewById(R.id.date); date.setText(weatherData.get("date")); TextView wind = (TextView) findViewById(R.id.wind); if(units.equals("imperial")) { wind.setText(weatherData.get("windspeed")+" mph"); } else { wind.setText(weatherData.get("windspeed") + " mps"); } TextView direction = (TextView) findViewById(R.id.direction); direction.setText(weatherData.get("winddirection")+" degrees"); TextView rain = (TextView) findViewById(R.id.rain); rain.setText(weatherData.get("rain")+" mm"); TextView snow = (TextView) findViewById(R.id.snow); snow.setText(weatherData.get("snow")+" mm"); TextView cloudiness = (TextView) findViewById(R.id.cloudiness); cloudiness.setText(weatherData.get("cloudiness")+"%"); TextView humidity = (TextView) findViewById(R.id.humidity); humidity.setText(weatherData.get("humidity")+"%"); ImageView wimage = (ImageView) findViewById(R.id.imageView); wimage.setImageBitmap(bitmap); TextView pressure = (TextView) findViewById(R.id.pressure); pressure.setText(weatherData.get("pressure")+"hPa"); TextView sunrise = (TextView) findViewById(R.id.sunrise); sunrise.setText(weatherData.get("sunrise") +" GMT"); TextView sunset = (TextView) findViewById(R.id.sunset); sunset.setText(weatherData.get("sunset") +" GMT"); TextView visibility = (TextView) findViewById(R.id.visibility); visibility.setText(weatherData.get("visibility")+" meter"); } // commit the shared preference @Override protected void onStop() { editor= sharedPref.edit(); editor.putString("city",cityName); editor.putString("units",units); Log.d(TAG, "onStop: instop"+cityName); editor.commit(); // stop locator //locator.shutdown(); super.onStop(); } // for location public void setData(double lat, double lon) { Log.d(TAG, "setData: Lat: " + lat + ", Lon: " + lon); String address = doAddress(lat, lon); cityName =address; Log.d(TAG, "setData: "+cityName); flag=true; doAsyncLoadLocation(); } private String doAddress(double latitude, double longitude) { Log.d(TAG, "doAddress: Lat: " + latitude + ", Lon: " + longitude); List<Address> addresses = null; for (int times = 0; times < 3; times++) { Geocoder geocoder = new Geocoder(this, Locale.getDefault()); try { Log.d(TAG, "doAddress: Getting address now"); addresses = geocoder.getFromLocation(latitude, longitude, 1); //Log.d(TAG, "doAddress: myadd"+addresses); Log.d(TAG, "doAddress: Num addresses: " + addresses.size()); StringBuilder sb = new StringBuilder(); if (addresses.size() > 0) { Log.d(TAG, "doAddress: "+addresses.get(0).getPostalCode()); sb.append(addresses.get(0).getPostalCode()); sb.append(","); sb.append(addresses.get(0).getCountryCode()); } /*for (Address ad : addresses) { Log.d(TAG, "doLocation: " + ad); sb.append("\nAddress\n\n"); Log.d(TAG, "doAddress: " + ad.getMaxAddressLineIndex()); for (int i = 0; i <= ad.getMaxAddressLineIndex(); i++) sb.append("\t" + ad.getAddressLine(i) + "\n"); sb.append("\t" + ad.getCountryName() + " (" + ad.getCountryCode() + ")\n"); }*/ return sb.toString(); } catch (IOException e) { Log.d(TAG, "doAddress: " + e.getMessage()); } Toast.makeText(this, "GeoCoder service is slow - please wait", Toast.LENGTH_SHORT).show(); } Toast.makeText(this, "GeoCoder service timed out - please try again", Toast.LENGTH_LONG).show(); return null; } public void noLocationAvailable() { Toast.makeText(this, "No location providers were available", Toast.LENGTH_LONG).show(); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); Log.d(TAG, "onRequestPermissionsResult: CALL: " + permissions.length); Log.d(TAG, "onRequestPermissionsResult: PERM RESULT RECEIVED"); if (requestCode == 5) { Log.d(TAG, "onRequestPermissionsResult: permissions.length: " + permissions.length); for (int i = 0; i < permissions.length; i++) { if (permissions[i].equals(Manifest.permission.ACCESS_FINE_LOCATION)) { if (grantResults[i] == PackageManager.PERMISSION_GRANTED) { Log.d(TAG, "onRequestPermissionsResult: HAS PERM"); locator.setUpLocationManager(); locator.determineLocation(); } else { Toast.makeText(this, "Location permission was denied - cannot determine address", Toast.LENGTH_LONG).show(); Log.d(TAG, "onRequestPermissionsResult: NO PERM"); } } } } Log.d(TAG, "onRequestPermissionsResult: Exiting onRequestPermissionsResult"); } @Override protected void onDestroy() { // remove shred preference data //editor.clear(); // editor.commit(); if(locator!=null) { locator.shutdown(); } super.onDestroy(); } }
a6c40a9ee8813f66ada3d79374cbd8370247805d
5598faaaaa6b3d1d8502cbdaca903f9037d99600
/code_changes/Apache_projects/HDFS-101/221b3a8722f84f8e9ad0a98eea38a12cc4ad2f24/TestBlockManagerSafeMode.java
ac544ab7a0a9c6e4ab650d53a8a273b65d74df9f
[]
no_license
SPEAR-SE/LogInBugReportsEmpirical_Data
94d1178346b4624ebe90cf515702fac86f8e2672
ab9603c66899b48b0b86bdf63ae7f7a604212b29
refs/heads/master
2022-12-18T02:07:18.084659
2020-09-09T16:49:34
2020-09-09T16:49:34
286,338,252
0
2
null
null
null
null
UTF-8
Java
false
false
19,315
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hdfs.server.blockmanagement; import com.google.common.base.Supplier; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.BlockListAsLongs.BlockReportReplica; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerSafeMode.BMSafeModeStatus; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.test.GenericTestUtils; import org.junit.Before; import org.junit.Test; import org.mockito.internal.util.reflection.Whitebox; import java.io.IOException; import java.io.InterruptedIOException; import java.util.concurrent.TimeoutException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; /** * This test is for testing {@link BlockManagerSafeMode} package local APIs. * * They use heavily mocked objects, treating the {@link BlockManagerSafeMode} * as white-box. Tests are light-weight thus no multi-thread scenario or real * mini-cluster is tested. * * @see org.apache.hadoop.hdfs.TestSafeMode * @see org.apache.hadoop.hdfs.server.namenode.ha.TestHASafeMode * @see org.apache.hadoop.hdfs.TestSafeModeWithStripedFile */ public class TestBlockManagerSafeMode { private static final int DATANODE_NUM = 3; private static final long BLOCK_TOTAL = 10; private static final double THRESHOLD = 0.99; private static final long BLOCK_THRESHOLD = (long)(BLOCK_TOTAL * THRESHOLD); private static final int EXTENSION = 1000; // 1 second private FSNamesystem fsn; private BlockManager bm; private DatanodeManager dn; private BlockManagerSafeMode bmSafeMode; /** * Set up the mock context. * * - extension is always needed (default period is {@link #EXTENSION} ms * - datanode threshold is always reached via mock * - safe block is 0 and it needs {@link #BLOCK_THRESHOLD} to reach threshold * - write/read lock is always held by current thread * * @throws IOException */ @Before public void setupMockCluster() throws IOException { Configuration conf = new HdfsConfiguration(); conf.setDouble(DFSConfigKeys.DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY, THRESHOLD); conf.setInt(DFSConfigKeys.DFS_NAMENODE_SAFEMODE_EXTENSION_KEY, EXTENSION); conf.setInt(DFSConfigKeys.DFS_NAMENODE_SAFEMODE_MIN_DATANODES_KEY, DATANODE_NUM); fsn = mock(FSNamesystem.class); doReturn(true).when(fsn).hasWriteLock(); doReturn(true).when(fsn).hasReadLock(); doReturn(true).when(fsn).isRunning(); NameNode.initMetrics(conf, NamenodeRole.NAMENODE); bm = spy(new BlockManager(fsn, false, conf)); doReturn(true).when(bm).isGenStampInFuture(any(Block.class)); dn = spy(bm.getDatanodeManager()); Whitebox.setInternalState(bm, "datanodeManager", dn); // the datanode threshold is always met when(dn.getNumLiveDataNodes()).thenReturn(DATANODE_NUM); bmSafeMode = new BlockManagerSafeMode(bm, fsn, false, conf); } /** * Test set block total. * * The block total is set which will call checkSafeMode for the first time * and bmSafeMode transfers from OFF to PENDING_THRESHOLD status */ @Test(timeout = 30000) public void testInitialize() { assertFalse("Block manager should not be in safe mode at beginning.", bmSafeMode.isInSafeMode()); bmSafeMode.activate(BLOCK_TOTAL); assertEquals(BMSafeModeStatus.PENDING_THRESHOLD, getSafeModeStatus()); assertTrue(bmSafeMode.isInSafeMode()); } /** * Test the state machine transition. */ @Test(timeout = 30000) public void testCheckSafeMode() { bmSafeMode.activate(BLOCK_TOTAL); // stays in PENDING_THRESHOLD: pending block threshold setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD); for (long i = 0; i < BLOCK_THRESHOLD; i++) { setBlockSafe(i); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.PENDING_THRESHOLD, getSafeModeStatus()); } // PENDING_THRESHOLD -> EXTENSION Whitebox.setInternalState(bmSafeMode, "extension", Integer.MAX_VALUE); setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD); setBlockSafe(BLOCK_THRESHOLD); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); // PENDING_THRESHOLD -> OFF Whitebox.setInternalState(bmSafeMode, "extension", 0); setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD); setBlockSafe(BLOCK_THRESHOLD); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.OFF, getSafeModeStatus()); // stays in EXTENSION setBlockSafe(0); setSafeModeStatus(BMSafeModeStatus.EXTENSION); Whitebox.setInternalState(bmSafeMode, "extension", 0); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); // stays in EXTENSION: pending extension period Whitebox.setInternalState(bmSafeMode, "extension", Integer.MAX_VALUE); setSafeModeStatus(BMSafeModeStatus.EXTENSION); setBlockSafe(BLOCK_THRESHOLD); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); // should stay in PENDING_THRESHOLD during transitionToActive doReturn(true).when(fsn).inTransitionToActive(); Whitebox.setInternalState(bmSafeMode, "extension", 0); setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD); setBlockSafe(BLOCK_THRESHOLD); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.PENDING_THRESHOLD, getSafeModeStatus()); doReturn(false).when(fsn).inTransitionToActive(); bmSafeMode.checkSafeMode(); assertEquals(BMSafeModeStatus.OFF, getSafeModeStatus()); } /** * Test that the block safe increases up to block threshold. * * Once the block threshold is reached, the block manger leaves safe mode and * increment will be a no-op. * The safe mode status lifecycle: OFF -> PENDING_THRESHOLD -> OFF */ @Test(timeout = 30000) public void testIncrementSafeBlockCount() { bmSafeMode.activate(BLOCK_TOTAL); Whitebox.setInternalState(bmSafeMode, "extension", 0); for (long i = 1; i <= BLOCK_TOTAL; i++) { BlockInfo blockInfo = mock(BlockInfo.class); doReturn(false).when(blockInfo).isStriped(); bmSafeMode.incrementSafeBlockCount(1, blockInfo); if (i < BLOCK_THRESHOLD) { assertEquals(i, getblockSafe()); assertTrue(bmSafeMode.isInSafeMode()); } else { // block manager leaves safe mode if block threshold is met assertFalse(bmSafeMode.isInSafeMode()); // the increment will be a no-op if safe mode is OFF assertEquals(BLOCK_THRESHOLD, getblockSafe()); } } } /** * Test that the block safe increases up to block threshold. * * Once the block threshold is reached, the block manger leaves safe mode and * increment will be a no-op. * The safe mode status lifecycle: OFF -> PENDING_THRESHOLD -> EXTENSION-> OFF */ @Test(timeout = 30000) public void testIncrementSafeBlockCountWithExtension() throws Exception { bmSafeMode.activate(BLOCK_TOTAL); for (long i = 1; i <= BLOCK_TOTAL; i++) { BlockInfo blockInfo = mock(BlockInfo.class); doReturn(false).when(blockInfo).isStriped(); bmSafeMode.incrementSafeBlockCount(1, blockInfo); if (i < BLOCK_THRESHOLD) { assertTrue(bmSafeMode.isInSafeMode()); } } waitForExtensionPeriod(); assertFalse(bmSafeMode.isInSafeMode()); } /** * Test that the block safe decreases the block safe. * * The block manager stays in safe mode. * The safe mode status lifecycle: OFF -> PENDING_THRESHOLD */ @Test(timeout = 30000) public void testDecrementSafeBlockCount() { bmSafeMode.activate(BLOCK_TOTAL); Whitebox.setInternalState(bmSafeMode, "extension", 0); mockBlockManagerForBlockSafeDecrement(); setBlockSafe(BLOCK_THRESHOLD); for (long i = BLOCK_THRESHOLD; i > 0; i--) { BlockInfo blockInfo = mock(BlockInfo.class); bmSafeMode.decrementSafeBlockCount(blockInfo); assertEquals(i - 1, getblockSafe()); assertTrue(bmSafeMode.isInSafeMode()); } } /** * Test when the block safe increment and decrement interleave. * * Both the increment and decrement will be a no-op if the safe mode is OFF. * The safe mode status lifecycle: OFF -> PENDING_THRESHOLD -> OFF */ @Test(timeout = 30000) public void testIncrementAndDecrementSafeBlockCount() { bmSafeMode.activate(BLOCK_TOTAL); Whitebox.setInternalState(bmSafeMode, "extension", 0); mockBlockManagerForBlockSafeDecrement(); for (long i = 1; i <= BLOCK_TOTAL; i++) { BlockInfo blockInfo = mock(BlockInfo.class); doReturn(false).when(blockInfo).isStriped(); bmSafeMode.incrementSafeBlockCount(1, blockInfo); bmSafeMode.decrementSafeBlockCount(blockInfo); bmSafeMode.incrementSafeBlockCount(1, blockInfo); if (i < BLOCK_THRESHOLD) { assertEquals(i, getblockSafe()); assertTrue(bmSafeMode.isInSafeMode()); } else { // block manager leaves safe mode if block threshold is met assertEquals(BLOCK_THRESHOLD, getblockSafe()); assertFalse(bmSafeMode.isInSafeMode()); } } } /** * Test the safe mode monitor. * * The monitor will make block manager leave the safe mode after extension * period. */ @Test(timeout = 30000) public void testSafeModeMonitor() throws Exception { bmSafeMode.activate(BLOCK_TOTAL); setBlockSafe(BLOCK_THRESHOLD); // PENDING_THRESHOLD -> EXTENSION bmSafeMode.checkSafeMode(); assertTrue(bmSafeMode.isInSafeMode()); waitForExtensionPeriod(); assertFalse(bmSafeMode.isInSafeMode()); } /** * Test block manager won't leave safe mode if datanode threshold is not met. */ @Test(timeout = 30000) public void testDatanodeThreshodShouldBeMet() throws Exception { bmSafeMode.activate(BLOCK_TOTAL); // All datanode have not registered yet. when(dn.getNumLiveDataNodes()).thenReturn(1); setBlockSafe(BLOCK_THRESHOLD); bmSafeMode.checkSafeMode(); assertTrue(bmSafeMode.isInSafeMode()); // The datanode number reaches threshold after all data nodes register when(dn.getNumLiveDataNodes()).thenReturn(DATANODE_NUM); bmSafeMode.checkSafeMode(); waitForExtensionPeriod(); assertFalse(bmSafeMode.isInSafeMode()); } /** * Test block manager won't leave safe mode if there are blocks with * generation stamp (GS) in future. */ @Test(timeout = 30000) public void testStayInSafeModeWhenBytesInFuture() throws Exception { bmSafeMode.activate(BLOCK_TOTAL); // Inject blocks with future GS injectBlocksWithFugureGS(100L); assertEquals(100L, bmSafeMode.getBytesInFuture()); // safe blocks are enough setBlockSafe(BLOCK_THRESHOLD); // PENDING_THRESHOLD -> EXTENSION bmSafeMode.checkSafeMode(); assertFalse("Shouldn't leave safe mode in case of blocks with future GS! ", bmSafeMode.leaveSafeMode(false)); assertTrue("Leaving safe mode forcefully should succeed regardless of " + "blocks with future GS.", bmSafeMode.leaveSafeMode(true)); assertEquals("Number of blocks with future GS should have been cleared " + "after leaving safe mode", 0L, bmSafeMode.getBytesInFuture()); assertTrue("Leaving safe mode should succeed after blocks with future GS " + "are cleared.", bmSafeMode.leaveSafeMode(false)); } /** * Test get safe mode tip. */ @Test(timeout = 30000) public void testGetSafeModeTip() throws Exception { bmSafeMode.activate(BLOCK_TOTAL); String tip = bmSafeMode.getSafeModeTip(); assertTrue(tip.contains( String.format( "The reported blocks %d needs additional %d blocks to reach the " + "threshold %.4f of total blocks %d.%n", 0, BLOCK_THRESHOLD, THRESHOLD, BLOCK_TOTAL))); assertTrue(tip.contains( String.format("The number of live datanodes %d has reached the " + "minimum number %d. ", dn.getNumLiveDataNodes(), DATANODE_NUM))); assertTrue(tip.contains("Safe mode will be turned off automatically once " + "the thresholds have been reached.")); // safe blocks are enough setBlockSafe(BLOCK_THRESHOLD); bmSafeMode.checkSafeMode(); tip = bmSafeMode.getSafeModeTip(); assertTrue(tip.contains( String.format("The reported blocks %d has reached the threshold" + " %.4f of total blocks %d. ", getblockSafe(), THRESHOLD, BLOCK_TOTAL))); assertTrue(tip.contains( String.format("The number of live datanodes %d has reached the " + "minimum number %d. ", dn.getNumLiveDataNodes(), DATANODE_NUM))); assertTrue(tip.contains("In safe mode extension. Safe mode will be turned" + " off automatically in")); waitForExtensionPeriod(); tip = bmSafeMode.getSafeModeTip(); assertTrue(tip.contains( String.format("The reported blocks %d has reached the threshold" + " %.4f of total blocks %d. ", getblockSafe(), THRESHOLD, BLOCK_TOTAL))); assertTrue(tip.contains( String.format("The number of live datanodes %d has reached the " + "minimum number %d. ", dn.getNumLiveDataNodes(), DATANODE_NUM))); assertTrue(tip.contains("Safe mode will be turned off automatically soon")); } /** * Test get safe mode tip in case of blocks with future GS. */ @Test(timeout = 30000) public void testGetSafeModeTipForBlocksWithFutureGS() throws Exception { bmSafeMode.activate(BLOCK_TOTAL); injectBlocksWithFugureGS(40L); String tip = bmSafeMode.getSafeModeTip(); assertTrue(tip.contains( String.format( "The reported blocks %d needs additional %d blocks to reach the " + "threshold %.4f of total blocks %d.%n", 0, BLOCK_THRESHOLD, THRESHOLD, BLOCK_TOTAL))); assertTrue(tip.contains( "Name node detected blocks with generation stamps " + "in future. This means that Name node metadata is inconsistent. " + "This can happen if Name node metadata files have been manually " + "replaced. Exiting safe mode will cause loss of " + 40 + " byte(s). Please restart name node with " + "right metadata or use \"hdfs dfsadmin -safemode forceExit\" " + "if you are certain that the NameNode was started with the " + "correct FsImage and edit logs. If you encountered this during " + "a rollback, it is safe to exit with -safemode forceExit." )); assertFalse(tip.contains("Safe mode will be turned off")); // blocks with future GS were already injected before. setBlockSafe(BLOCK_THRESHOLD); tip = bmSafeMode.getSafeModeTip(); assertTrue(tip.contains( String.format("The reported blocks %d has reached the threshold" + " %.4f of total blocks %d. ", getblockSafe(), THRESHOLD, BLOCK_TOTAL))); assertTrue(tip.contains( "Name node detected blocks with generation stamps " + "in future. This means that Name node metadata is inconsistent. " + "This can happen if Name node metadata files have been manually " + "replaced. Exiting safe mode will cause loss of " + 40 + " byte(s). Please restart name node with " + "right metadata or use \"hdfs dfsadmin -safemode forceExit\" " + "if you are certain that the NameNode was started with the " + "correct FsImage and edit logs. If you encountered this during " + "a rollback, it is safe to exit with -safemode forceExit." )); assertFalse(tip.contains("Safe mode will be turned off")); } /** * Mock block manager internal state for decrement safe block. */ private void mockBlockManagerForBlockSafeDecrement() { BlockInfo storedBlock = mock(BlockInfo.class); when(storedBlock.isComplete()).thenReturn(true); doReturn(storedBlock).when(bm).getStoredBlock(any(Block.class)); NumberReplicas numberReplicas = mock(NumberReplicas.class); when(numberReplicas.liveReplicas()).thenReturn(0); doReturn(numberReplicas).when(bm).countNodes(any(BlockInfo.class)); } /** * Wait the bmSafeMode monitor for the extension period. * @throws InterruptedIOException * @throws TimeoutException */ private void waitForExtensionPeriod() throws Exception{ assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); GenericTestUtils.waitFor(new Supplier<Boolean>() { @Override public Boolean get() { return getSafeModeStatus() != BMSafeModeStatus.EXTENSION; } }, EXTENSION / 10, EXTENSION * 2); } private void injectBlocksWithFugureGS(long numBytesInFuture) { BlockReportReplica brr = mock(BlockReportReplica.class); when(brr.getBytesOnDisk()).thenReturn(numBytesInFuture); bmSafeMode.checkBlocksWithFutureGS(brr); } private void setSafeModeStatus(BMSafeModeStatus status) { Whitebox.setInternalState(bmSafeMode, "status", status); } private BMSafeModeStatus getSafeModeStatus() { return (BMSafeModeStatus)Whitebox.getInternalState(bmSafeMode, "status"); } private void setBlockSafe(long blockSafe) { Whitebox.setInternalState(bmSafeMode, "blockSafe", blockSafe); } private long getblockSafe() { return (long)Whitebox.getInternalState(bmSafeMode, "blockSafe"); } }
1c21c3e9bd65cdb2f913a21df310da1719c98ca0
c1ffc1154127b360eebd49e773edbac239aca3eb
/TestWeb/src/test/java/com/wang/decrypt/TestAES.java
4abbffb143588e11fad9a23ac965b52898992959
[ "MIT" ]
permissive
dolyw/ProjectStudy
76053e1142148767d5bd3dbf6bb9a4e5947224b0
0d6991a1cbdc57b779ad125809540bce581d3943
refs/heads/master
2023-06-25T22:30:52.087332
2023-06-13T07:45:32
2023-06-13T07:45:32
199,820,313
63
55
MIT
2022-06-17T03:17:48
2019-07-31T09:06:20
Java
UTF-8
Java
false
false
802
java
package com.wang.decrypt; import com.wang.util.AesCipherUtil; import org.junit.jupiter.api.Test; /** * AES测试 * * @author Wang926454 * @date 2018/8/31 9:51 */ public class TestAES { /** * 以帐号加密码的方式加密,可以减少加密后重复 * * @param * @return void * @author Wang926454 * @date 2018/8/31 17:40 */ @Test public void Test01() throws Exception { System.out.println((AesCipherUtil.enCrypto("wang" + "wang926454"))); } /** * 解密 * * @param * @return void * @author Wang926454 * @date 2018/8/31 17:40 */ @Test public void Test02() throws Exception { System.out.println(AesCipherUtil.deCrypto("MkI1NDJENEI5NEQ0MjFGQUQ5N0RBMEE3ODM1NUNBQTQ=")); } }
e8039f9f71a7f644258cbc3fa5643d936873445b
4fbd6cc4e67c92e7d9255adb20458b7cb7e88bd6
/src/main/java/com/ray/servlet/CoreServlet.java
54fbc4075345d3812ba0838a96d019ac51c1f90d
[]
no_license
630334494/qywx
8c779e33f94e75d486ddf8203655a470a086bc19
c828ac095a79bdd305fd448e67e55005f92247af
refs/heads/master
2020-04-12T17:52:03.068268
2018-12-21T03:23:46
2018-12-21T03:23:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,258
java
package com.ray.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.qq.weixin.mp.aes.AesException; import com.qq.weixin.mp.aes.WXBizMsgCrypt; import com.ray.service.MessageService; import com.ray.util.WeiXinParamesUtil; /** * 核心请求处理类 * @author shirayner * */ public class CoreServlet extends HttpServlet { private static final long serialVersionUID = 4440739483644821986L; /** * 确认请求来自微信服务器 */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 微信加密签名 String msg_signature = request.getParameter("msg_signature"); // 时间戳 String timestamp = request.getParameter("timestamp"); // 随机数 String nonce = request.getParameter("nonce"); // 随机字符串 String echostr = request.getParameter("echostr"); System.out.println("request=" + request.getRequestURL()); System.out.println("显示参数"); System.out.println("msg_signature"+msg_signature); System.out.println("timestamp"+timestamp); System.out.println("nonce"+nonce); System.out.println("echostr"+echostr); PrintWriter out = response.getWriter(); // 通过检验msg_signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败 String result = null; try { WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(WeiXinParamesUtil.token, WeiXinParamesUtil.encodingAESKey, WeiXinParamesUtil.corpId); result = wxcpt.VerifyURL(msg_signature, timestamp, nonce, echostr); } catch (AesException e) { e.printStackTrace(); } if (result == null) { result = WeiXinParamesUtil.token; } out.print(result); out.close(); out = null; } /** * 处理微信服务器发来的消息 */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //1.将请求、响应的编码均设置为UTF-8(防止中文乱码) request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); //2.调用消息业务类接收消息、处理消息 MessageService msgsv=new MessageService(); String respMessage = msgsv.getEncryptRespMessage(request); //处理表情 // String respMessage = CoreService.processRequest_emoj(request); //处理图文消息 //String respMessage = Test_NewsService.processRequest(request); //3.响应消息 PrintWriter out = response.getWriter(); out.print(respMessage); out.close(); } }
9adc2e221434a63fd1bf40b7fc1b06abba866889
fe9af1d7a8133d68c5bba414d9356ec8719baafa
/app/src/main/java/it/uniroma2/adidiego/apikeytestapp/adapter/ApiKeyAdapter.java
dc7259e57809b35400f02d2bdaa515cef18d676e
[]
no_license
alessandrodd/ApiKeyTestApp
be330f268f8c4dd60db1a98724e6e4fef7f749db
fcc2479e0ec8df8d1d92b01e13294d0936e2e2e6
refs/heads/master
2021-07-06T05:17:22.628562
2017-09-27T14:35:21
2017-09-27T14:35:21
93,970,843
0
0
null
null
null
null
UTF-8
Java
false
false
1,487
java
package it.uniroma2.adidiego.apikeytestapp.adapter; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; import java.util.Locale; import it.uniroma2.adidiego.apikeytestapp.R; import it.uniroma2.adidiego.apikeytestapp.model.ApiKey; public class ApiKeyAdapter extends RecyclerView.Adapter<ApiKeyAdapter.MyViewHolder> { private List<ApiKey> apiKeys; public class MyViewHolder extends RecyclerView.ViewHolder { public TextView index, apiKey; public MyViewHolder(View view) { super(view); index = (TextView) view.findViewById(R.id.index); apiKey = (TextView) view.findViewById(R.id.key); } } public ApiKeyAdapter(List<ApiKey> apiKeys) { this.apiKeys = apiKeys; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.apy_key_row, parent, false); return new MyViewHolder(itemView); } @Override public void onBindViewHolder(MyViewHolder holder, int position) { ApiKey apiKey = apiKeys.get(position); holder.index.setText(apiKey.getSource()); holder.apiKey.setText(apiKey.getKey()); } @Override public int getItemCount() { return apiKeys.size(); } }
837c87b71a2679d75cf0a7bae14e670006a14849
15b8e9c74fdf0c2362e9e1bf92ae56384302a11a
/app/src/main/java/com/pavel/chernyshov/myquiz/model/Question.java
3f56fb8af3924ca0cb19d75de7bdebe1aab6badd
[]
no_license
pasha9797/MyQuiz
49875ae09e53446deba5e8a70a82e1d3f7c7bf77
71b222ae06e8f1d298f929360d1f5c26c8afd36b
refs/heads/master
2020-03-07T15:42:16.434493
2018-03-04T13:36:12
2018-03-04T13:36:12
123,791,774
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
package com.pavel.chernyshov.myquiz.model; import java.util.List; /** * Created by pasha on 04.03.2018. */ public class Question { private String text; private List<Answer> answers; public String getText() { return text; } public List<Answer> getAnswers() { return answers; } public Question(String text, List<Answer> answers) { this.text = text; this.answers = answers; } }
d5c060c5376539a52fa473d489be51061d6fd868
7b4ef8ea8009734e764efcef354fb99531d41506
/src/it/uniroma2/pulsesensor/secure/SHA256.java
823eb71940585aad6b2409da2089ca0d4d2235ed
[]
no_license
PuRoTeam/PuRoPulseSensorAndroid
061d584d1934f8508667123efaba78f06f41de17
606873f20fb0be5c59d1b7c5c6de177441f86e86
refs/heads/master
2021-01-19T18:07:46.415287
2015-02-19T20:20:57
2015-02-19T20:20:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
package it.uniroma2.pulsesensor.secure; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.apache.commons.codec.binary.Hex; public class SHA256 { public static String getMsgDigest(String msg) { byte byteDigest[] = getByteMsgDigest(msg); String msgDigest = new String(Hex.encodeHex(byteDigest)); return msgDigest; } public static byte[] getByteMsgDigest(String msg) { MessageDigest md; byte byteDigest[] = null; try { md = MessageDigest.getInstance("SHA-256"); md.update(stringToBytes(msg)); byteDigest = md.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return byteDigest; } public static byte[] stringToBytes(String s) { byte[] a = new byte[s.length()]; for(int i = 0; i < s.length(); i++) a[i] = (byte)s.charAt(i); return a; } }
f80943b78ad946a1788e20384cca94a13e3f9ba6
28f3bd07ebc272ceb695a54a4fefad0a2e99c2f8
/src/WormInvader/StartPanel.java
b843d44c096706256b46ba5b5c0f33c958048401
[]
no_license
Mo23/Prog3_Space
5abb96feba14062ec91183867b1c81c356d9cac5
7659cf0cc027f33496cc48c3c57ec6983961284b
refs/heads/master
2021-01-17T17:36:12.168829
2016-12-15T14:03:36
2016-12-15T14:03:36
70,462,935
0
0
null
null
null
null
UTF-8
Java
false
false
2,958
java
package WormInvader; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JPanel; /** * @author maurice * */ @SuppressWarnings("serial") public class StartPanel extends JPanel { final private JButton ButtonStartGame = new JButton("Spiel starten"); final private JButton ButtonAnleitung = new JButton("Anleitung"); final private JButton ButtonEinstellung = new JButton("Einstellung"); final private JButton ButtonZurueck = new JButton("Zurück"); final private ImageIcon img = new ImageIcon(this.getClass().getClassLoader().getResource("images/background.png")); /** * Konstruktor des Startpanels. */ public StartPanel() { this.setLayout(null); this.setFocusable(true); this.setVisible(true); ButtonStartGame.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Startscreen.startpanel.setVisible(false); Startscreen.startscreen.setVisible(false); GameFrame.spielstart(); } }); ButtonAnleitung.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Startscreen.startpanel.setVisible(false); Startscreen.anleitungpanel.setVisible(true); } }); ButtonEinstellung.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Startscreen.startpanel.setVisible(false); Startscreen.einstellungspanel.setVisible(true); } }); ButtonZurueck.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Startscreen.startpanel.setVisible(false); } }); this.add(ButtonEinstellung); this.add(ButtonStartGame); this.add(ButtonAnleitung); this.add(ButtonZurueck); ButtonStartGame.setBorderPainted(false); ButtonZurueck.setBorderPainted(false); ButtonAnleitung.setBorderPainted(false); ButtonEinstellung.setBorderPainted(false); ButtonZurueck.setFont(Startscreen.font); ButtonAnleitung.setFont(Startscreen.font); ButtonStartGame.setFont(Startscreen.font); ButtonEinstellung.setFont(Startscreen.font); ButtonZurueck.setBackground(Startscreen.color); ButtonAnleitung.setBackground(Startscreen.color); ButtonStartGame.setBackground(Startscreen.color); ButtonEinstellung.setBackground(Startscreen.color); ButtonStartGame.setBounds(460, 140, 300, 60); ButtonAnleitung.setBounds(460, 220, 300, 60); ButtonEinstellung.setBounds(460, 300, 300, 60); ButtonZurueck.setBounds(460, 380, 300, 60); ButtonAnleitung.setVisible(true); ButtonStartGame.setVisible(true); ButtonEinstellung.setVisible(true); ButtonZurueck.setVisible(true); } /* * (non-Javadoc) Methode zum zeichnen des Hintergrunds im Menü. */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img.getImage(), 0, 0, this); } }
dcc8c6c6db7ac4033f6e4f41f72baa03df48503f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_99dbb80c3aff3ba7f6a238864fd8b9a4337ae7a9/ClockworkModBillingClient/8_99dbb80c3aff3ba7f6a238864fd8b9a4337ae7a9_ClockworkModBillingClient_s.java
f5a703bb8314a2dad0ba9e5841b50f9f3fc3ded8
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
65,621
java
package com.clockworkmod.billing; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.net.NetworkInterface; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; import java.security.KeyFactory; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.Signature; import java.security.spec.X509EncodedKeySpec; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.http.Header; import org.apache.http.HttpMessage; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.params.HttpClientParams; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpParams; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.accounts.Account; import android.accounts.AccountManager; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.SystemProperties; import android.telephony.TelephonyManager; import android.util.Log; import android.widget.EditText; import com.android.vending.billing.IMarketBillingService; import com.paypal.android.MEP.PayPal; import com.paypal.android.MEP.PayPalInvoiceData; import com.paypal.android.MEP.PayPalInvoiceItem; import com.paypal.android.MEP.PayPalPayment; public class ClockworkModBillingClient { static final String BASE_URL = "https://clockworkbilling.appspot.com"; static final String API_URL = BASE_URL + "/api/v1"; static final String ORDER_URL = API_URL + "/order/%s/%s?buyer_id=%s&custom_payload=%s&sandbox=%s"; static final String TRIAL_URL = API_URL + "/trial/%s/%s?buyer_id=%s&sandbox=%s&trial_increment=%d&trial_daily_increment=%d"; static final String INAPP_NOTIFY_URL = API_URL + "/notify/inapp/%s"; static final String AMAZON_NOTIFY_URL = API_URL + "/notify/amazon/%s"; static final String REDEEM_NOTIFY_URL = API_URL + "/notify/redeem/%s"; static final String PURCHASE_URL = API_URL + "/purchase/%s/%s?nonce=%s&sandbox=%s"; static final String TRANSFER_URL = API_URL + "/transfer/%s/%s?payer_email=%s&buyer_id=%s&sandbox=%s"; static ClockworkModBillingClient mInstance; Context mContext; String mSellerId; String mClockworkPublicKey; String mMarketPublicKey; Boolean mIsAmazonSandbox = null; private ClockworkModBillingClient(Context context, final String sellerId, String clockworkPublicKey, String marketPublicKey, boolean sandbox) { mContext = context.getApplicationContext(); mSandbox = sandbox; mSellerId = sellerId; mClockworkPublicKey = clockworkPublicKey; mMarketPublicKey = marketPublicKey; } static private void showAlertDialog(Context context, String s) { AlertDialog.Builder builder = new Builder(context); builder.setMessage(s); builder.setPositiveButton(android.R.string.ok, null); builder.create().show(); } private static Object mPayPalLock = new Object(); private void invokeCallback(PurchaseCallback callback, PurchaseResult result) { if (result == PurchaseResult.SUCCEEDED) clearCachedPurchases(); if (callback != null) callback.onFinished(result); } static private void invokeCallback(Context context, PurchaseCallback callback, PurchaseResult result) { if (result == PurchaseResult.SUCCEEDED) clearCachedPurchases(context); if (callback != null) callback.onFinished(result); } private void startPayPalPurchase(final Context context, final PurchaseCallback callback, final JSONObject payload) throws JSONException { final String sellerId = payload.getString("seller_id"); final String sandboxEmail = payload.getString("paypal_sandbox_email"); final double price = payload.getDouble("product_price"); final String description = payload.getString("product_description"); final String sellerName = payload.getString("seller_name"); final String purchaseRequestId = payload.getString("purchase_request_id"); final String name = payload.getString("product_name"); final String paypalLiveAppId = payload.getString("paypal_live_app_id"); final String paypalSandboxAppId = payload.getString("paypal_sandbox_app_id"); final String paypalIPNUrl = payload.getString("paypal_ipn_url"); final ProgressDialog dlg = new ProgressDialog(context); dlg.setMessage("Preparing PayPal order..."); dlg.show(); ThreadingRunnable.background(new ThreadingRunnable() { @Override public void run() { synchronized (mPayPalLock) { try { PayPal pp = PayPal.getInstance(); if (pp == null) { String appId; int environment; if (mSandbox) { environment = PayPal.ENV_SANDBOX; appId = paypalSandboxAppId; } else { environment = PayPal.ENV_LIVE; appId = paypalLiveAppId; } PayPal.initWithAppID(context, appId, environment); pp = PayPal.getInstance(); pp.setLanguage("en_US"); // Sets the language for the library. pp.setShippingEnabled(false); pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); pp.setDynamicAmountCalculationEnabled(false); } foreground(new Runnable() { @Override public void run() { dlg.dismiss(); PayPalPayment newPayment = new PayPalPayment(); newPayment.setIpnUrl(paypalIPNUrl); newPayment.setCurrencyType("USD"); newPayment.setSubtotal(new BigDecimal(price)); newPayment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS); if (mSandbox) { newPayment.setRecipient(sandboxEmail); } else { newPayment.setRecipient(sellerId); } PayPalInvoiceData invoice = new PayPalInvoiceData(); invoice.setTax(new BigDecimal("0")); invoice.setShipping(new BigDecimal("0")); PayPalInvoiceItem item1 = new PayPalInvoiceItem(); item1.setName(name); item1.setID(purchaseRequestId); item1.setTotalPrice(new BigDecimal(price)); item1.setUnitPrice(new BigDecimal(price)); item1.setQuantity(1); invoice.getInvoiceItems().add(item1); newPayment.setInvoiceData(invoice); newPayment.setMerchantName(sellerName); newPayment.setDescription(description); newPayment.setCustomID(purchaseRequestId); newPayment.setMemo(purchaseRequestId); PayPal pp = PayPal.getInstance(); Intent checkoutIntent = pp.checkout(newPayment, context, new ResultDelegate()); BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { try { context.unregisterReceiver(this); } catch (Exception ex) { } PurchaseResult result; if (ResultDelegate.CANCELLED.equals(intent.getAction())) { result = PurchaseResult.CANCELLED; } else if (ResultDelegate.SUCCEEDED.equals(intent.getAction())) { result = PurchaseResult.SUCCEEDED; } else { result = PurchaseResult.FAILED; } invokeCallback(callback, result); } }; IntentFilter filter = new IntentFilter(); filter.addAction(ResultDelegate.SUCCEEDED); filter.addAction(ResultDelegate.FAILED); filter.addAction(ResultDelegate.CANCELLED); context.registerReceiver(receiver, filter); context.startActivity(checkoutIntent); } }); } catch (Exception ex) { ex.printStackTrace(); foreground(new Runnable() { @Override public void run() { dlg.dismiss(); showAlertDialog(context, "There was an error processing your request. Please try again later!"); } }); } } } }); } public static void startUnmanagedInAppPurchase(final Context context, String productId, final PurchaseCallback callback) { startUnmanagedInAppPurchase(context, productId, null, callback); } public static void startUnmanagedInAppPurchase(final Context context, String productId, String developerPayload, final PurchaseCallback callback) { startInAppPurchaseInternal(context, productId, developerPayload, null, null, callback); } private static void startInAppPurchaseInternal(final Context context, final String productId, final String developerPayload, final String buyerId, final String purchaseRequestId, final PurchaseCallback callback) { new Runnable() { String mProductId = productId; @Override public void run() { final Runnable purchaseFlow = new Runnable() { @Override public void run() { context.bindService(new Intent("com.android.vending.billing.MarketBillingService.BIND"), new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { } @Override public void onServiceConnected(ComponentName name, IBinder service) { Bundle request = BillingReceiver.makeRequestBundle(context, Consts.METHOD_CHECK_BILLING_SUPPORTED); final IMarketBillingService s = IMarketBillingService.Stub.asInterface(service); try { Bundle result = s.sendBillingRequest(request); if (Consts.ResponseCode.valueOf(result.getInt(Consts.BILLING_RESPONSE_RESPONSE_CODE)) != Consts.ResponseCode.RESULT_OK) throw new Exception("billing response not ok"); request = BillingReceiver.makeRequestBundle(context, Consts.METHOD_REQUEST_PURCHASE); request.putString(Consts.BILLING_REQUEST_ITEM_ID, mProductId); if (developerPayload != null) request.putString(Consts.BILLING_REQUEST_DEVELOPER_PAYLOAD, developerPayload); Bundle response = s.sendBillingRequest(request); if (Consts.ResponseCode.valueOf(response.getInt(Consts.BILLING_RESPONSE_RESPONSE_CODE)) != Consts.ResponseCode.RESULT_OK) throw new Exception("billing response not ok"); PendingIntent pi = response.getParcelable(Consts.BILLING_RESPONSE_PURCHASE_INTENT); context.startIntentSender(pi.getIntentSender(), null, 0, 0, 0); context.unbindService(this); BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { try { context.unregisterReceiver(this); } catch (Exception ex) { } PurchaseResult result; if (BillingReceiver.CANCELLED.equals(intent.getAction())) { result = PurchaseResult.CANCELLED; } else if (BillingReceiver.SUCCEEDED.equals(intent.getAction())) { result = PurchaseResult.SUCCEEDED; } else { result = PurchaseResult.FAILED; } invokeCallback(context, callback, result); } }; IntentFilter filter = new IntentFilter(); filter.addAction(BillingReceiver.SUCCEEDED); filter.addAction(BillingReceiver.CANCELLED); filter.addAction(BillingReceiver.FAILED); context.registerReceiver(receiver, filter); } catch (Exception e) { e.printStackTrace(); showAlertDialog(context, "There was an error processing your request. Please try again later!"); } } }, Context.BIND_AUTO_CREATE); } }; ClockworkModBillingClient client = ClockworkModBillingClient.getInstance(); if (client == null || !client.mSandbox) { BillingService.mSandboxPurchaseRequestId = null; BillingService.mSandboxProductId = null; BillingService.mSandboxBuyerId = null; purchaseFlow.run(); return; } AlertDialog.Builder builder = new Builder(context); builder.setTitle("Sandbox Purchase"); final String[] results = new String[] { "android.test.purchased", "android.test.canceled", "android.test.refunded", "android.test.item_unavailable" }; builder.setItems(results, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { BillingService.mSandboxPurchaseRequestId = purchaseRequestId; BillingService.mSandboxProductId = productId; BillingService.mSandboxBuyerId = buyerId; mProductId = results[which]; purchaseFlow.run(); } }); builder.create().show(); } }.run(); } private void startAndroidPurchase(final Context context, final String buyerId, final PurchaseCallback callback, final JSONObject payload) throws NoSuchAlgorithmException, JSONException { final String purchaseRequestId = payload.getString("purchase_request_id"); final String productId = payload.optString("product_id", null); startInAppPurchaseInternal(context, productId, purchaseRequestId, buyerId, purchaseRequestId, callback); } private void startRedeemCode(final Context context, final String buyerId, final PurchaseCallback callback, final JSONObject payload) throws NoSuchAlgorithmException, JSONException { final String purchaseRequestId = payload.getString("purchase_request_id"); final String sellerId = payload.getString("seller_id"); final EditText edit = new EditText(context); final String productId = payload.optString("product_id", null); edit.setHint("1234abcd"); AlertDialog.Builder builder = new Builder(context); builder.setMessage("Enter Redeem Code"); builder.setView(edit); builder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { invokeCallback(callback, PurchaseResult.CANCELLED); } }); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ProgressDialog dlg = new ProgressDialog(context); dlg.setMessage("Redeeming..."); final String code = edit.getText().toString(); ThreadingRunnable.background(new ThreadingRunnable() { @Override public void run() { try { HttpPost post = new HttpPost(String.format(REDEEM_NOTIFY_URL, sellerId)); ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>(); params.add(new BasicNameValuePair("product_id", productId)); params.add(new BasicNameValuePair("purchase_request_id", purchaseRequestId)); params.add(new BasicNameValuePair("code", code)); params.add(new BasicNameValuePair("sandbox", String.valueOf(mSandbox))); post.setEntity(new UrlEncodedFormEntity(params)); final JSONObject redeemResult = StreamUtility.downloadUriAsJSONObject(post); if (redeemResult.optBoolean("success", false)) { foreground(new Runnable() { @Override public void run() { invokeCallback(callback, PurchaseResult.SUCCEEDED); } }); return; } if (!redeemResult.optBoolean("is_redeemed", false)) { throw new Exception("already redeemed"); } foreground(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new Builder(context); builder.setMessage("This code has already been redeemed."); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { invokeCallback(callback, PurchaseResult.FAILED); } }); builder.create().show(); builder.setCancelable(false); } }); } catch (Exception ex) { ex.printStackTrace(); foreground(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new Builder(context); builder.setMessage("Invalid redeem code."); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { invokeCallback(callback, PurchaseResult.FAILED); } }); builder.create().show(); builder.setCancelable(false); } }); } } }); } }); builder.create().show(); } boolean mSandbox = true; public static ClockworkModBillingClient init(Context context, String sellerId, String clockworkPublicKey, String marketPublicKey, boolean sandbox) { if (mInstance != null) { //if (sandbox != mInstance.mSandbox) // throw new Exception("ClockworkModBillingClient has already been initialized for a different environment."); return mInstance; } mInstance = new ClockworkModBillingClient(context, sellerId, clockworkPublicKey, marketPublicKey, sandbox); return mInstance; } public static ClockworkModBillingClient getInstance() { return mInstance; } SharedPreferences getCachedSettings() { return mContext.getApplicationContext().getSharedPreferences("billing-settings", Context.MODE_PRIVATE); } static SharedPreferences getOrderData(Context context) { return context.getSharedPreferences("order-data", Context.MODE_PRIVATE); } SharedPreferences getOrderData() { return getOrderData(mContext); } public void clearCachedPurchases() { clearCachedPurchases(mContext); } public static void clearCachedPurchases(Context context) { SharedPreferences orderData = getOrderData(context); Editor editor = orderData.edit(); editor.clear(); editor.commit(); } static boolean checkSignature(String key, String responseData, String signature) { try { Signature sig = Signature.getInstance("SHA1withRSA"); byte[] decodedKey = Base64.decode(key, 0); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PublicKey pk = keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey)); sig.initVerify(pk); sig.update(responseData.getBytes()); return sig.verify(Base64.decode(signature, 0)); } catch (Exception ex) { return false; } } static long generateNonce(Context context) { long nonceDate = System.currentTimeMillis() / 1000L; String deviceId = getSafeDeviceId(context); byte[] bytes = deviceId.getBytes(); BigInteger bigint = new BigInteger(bytes); long nonce = ((bigint.longValue() & 0xFFFFFFFF00000000L)) | nonceDate; return nonce; } @SuppressLint("NewApi") public static String getSafeDeviceId(Context context) { TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); String deviceId = tm.getDeviceId(); if (deviceId == null) { String wifiInterface = SystemProperties.get("wifi.interface"); try { if (Build.VERSION.SDK_INT < 9) throw new Exception(); String wifiMac = new BigInteger(NetworkInterface.getByName(wifiInterface).getHardwareAddress()).toString(16); deviceId = wifiMac; } catch (Exception e) { deviceId = "000000000000"; } } String ret = digest(deviceId + context.getPackageName()); return ret; } private static String digest(String input) { try { MessageDigest md = MessageDigest.getInstance("MD5"); return new BigInteger(1, md.digest(input.getBytes())).toString(16).toUpperCase(); } catch (Exception e) { return null; } } private static boolean checkNonce(Context context, long nonce, long cacheDuration) { String deviceId = getSafeDeviceId(context); byte[] bytes = deviceId.getBytes(); BigInteger bigint = new BigInteger(bytes); long deviceNonce = bigint.longValue() & 0xFFFFFFFF00000000L; long maskedNonce = nonce & 0xFFFFFFFF00000000L; long dateNonce = nonce & 0x00000000FFFFFFFFL; dateNonce *= 1000L; if (cacheDuration != CACHE_DURATION_FOREVER && dateNonce + cacheDuration < System.currentTimeMillis()) return false; return maskedNonce == deviceNonce; } static long getTimestampFromNonce(long nonce) { long dateNonce = nonce & 0x00000000FFFFFFFFL; dateNonce *= 1000L; return dateNonce; } public static final long CACHE_DURATION_FOREVER = Long.MAX_VALUE; public List<ClockworkOrder> getCachedClockworkPurchases(String buyerId) { ArrayList<ClockworkOrder> ret = new ArrayList<ClockworkOrder>(); SharedPreferences orderData = getOrderData(); try { String proofString = orderData.getString("server-purchases", null); if (proofString == null) throw new Exception("no proof string"); JSONObject proof = new JSONObject(proofString); Log.i(LOGTAG, proof.toString(4)); String signedData = proof.getString("signed_data"); String signature = proof.getString("signature"); if (!checkSignature(mClockworkPublicKey, signedData, signature)) throw new Exception("signature mismatch"); proof = new JSONObject(signedData); if (proof.optBoolean("sandbox", true) != mSandbox) throw new Exception("sandbox mismatch"); long timestamp = proof.getLong("timestamp"); String sellerId = proof.optString("seller_id", null); if (!mSellerId.equals(sellerId)) throw new Exception("seller_id mismatch"); if (!buyerId.equals(proof.getString("buyer_id"))) throw new Exception("buyer_id mismatch"); JSONArray orders = proof.getJSONArray("orders"); for (int i = 0; i < orders.length(); i++) { JSONObject order = orders.getJSONObject(i); ret.add(new ClockworkOrder(order, timestamp)); } } catch (Exception ex) { ex.printStackTrace(); } return ret; } public List<InAppOrder> getCachedInAppPurchases() { ArrayList<InAppOrder> ret = new ArrayList<InAppOrder>(); SharedPreferences orderData = getOrderData(); HashMap<String, InAppOrder> orderMap = new HashMap<String, InAppOrder>(); for (String orderId : orderData.getAll().keySet()) { try { if (orderMap.containsKey(orderId)) continue; String proofString = orderData.getString(orderId, null); if (proofString == null) continue; JSONObject proof = new JSONObject(proofString); String signedData = proof.getString("signedData"); String signature = proof.getString("signature"); proof = new JSONObject(signedData); if (!checkSignature(mMarketPublicKey, signedData, signature)) throw new Exception("signature mismatch"); // the nonce check also checks against the device id. long nonce = proof.getLong("nonce"); if (!checkNonce(mContext, nonce, CACHE_DURATION_FOREVER)) throw new Exception("nonce failure"); proof = new JSONObject(signedData); long timestamp = getTimestampFromNonce(nonce); JSONArray orders = proof.getJSONArray("orders"); for (int i = 0; i < orders.length(); i++) { JSONObject order = orders.getJSONObject(i); orderMap.put(orderId, new InAppOrder(order, timestamp)); } } catch (Exception ex) { } } return ret; } private CheckPurchaseResult[] checkCachedPurchases(Context context, String productId, String buyerId, long marketCacheDuration, long billingCacheDuration, SharedPreferences orderData) { Editor edit = orderData.edit(); CheckPurchaseResult[] result = new CheckPurchaseResult[3]; // check the in app billing cache if (0 != marketCacheDuration) { if (!mSandbox) { // don't check the in app cache for sandbox, as that is always production data. // find the matching in app order. boolean found = false; boolean stale = true; for (String orderId: orderData.getAll().keySet()) { if ("server-purchases".equals(orderId)) continue; try { String proofString = orderData.getString(orderId, null); if (proofString == null) continue; JSONObject proof = new JSONObject(proofString); String signedData = proof.getString("signedData"); String signature = proof.getString("signature"); proof = new JSONObject(signedData); JSONArray orders = proof.getJSONArray("orders"); for (int i = 0; i < orders.length(); i++) { JSONObject order = orders.getJSONObject(i); if (productId.equals(order.getString("productId")) && context.getPackageName().equals(order.optString("packageName", null))) { stale = false; found = true; if (!checkSignature(mMarketPublicKey, signedData, signature)) throw new Exception("signature mismatch"); // the nonce check also checks against the device id. long nonce = proof.getLong("nonce"); if (!checkNonce(context, nonce, marketCacheDuration)) throw new Exception("nonce failure"); long timestamp = getTimestampFromNonce(nonce); Log.i(LOGTAG, "Cached in app billing success"); result[0] = result[1] = CheckPurchaseResult.purchased(new InAppOrder(order, timestamp)); return result; } } } catch (Exception ex) { ex.printStackTrace(); result[1] = CheckPurchaseResult.stale(); edit.remove(orderId); edit.commit(); } } if (stale) { result[1] = CheckPurchaseResult.stale(); } else if (!found) { result[1] = CheckPurchaseResult.notPurchased(); } } } else { result[1] = CheckPurchaseResult.stale(); } if (0 != billingCacheDuration) { try { String proofString = orderData.getString("server-purchases", null); if (proofString == null) throw new Exception("no proof string"); JSONObject proof = new JSONObject(proofString); Log.i(LOGTAG, proof.toString(4)); String signedData = proof.getString("signed_data"); String signature = proof.getString("signature"); if (!checkSignature(mClockworkPublicKey, signedData, signature)) throw new Exception("signature mismatch"); proof = new JSONObject(signedData); if (proof.optBoolean("sandbox", true) != mSandbox) throw new Exception("sandbox mismatch"); String sellerId = proof.optString("seller_id", null); if (!mSellerId.equals(sellerId)) throw new Exception("seller_id mismatch"); long timestamp = proof.getLong("timestamp"); // no need to check the nonce as done above, // checking the returned timestamp and buyer_id is good enough if (billingCacheDuration != CACHE_DURATION_FOREVER && timestamp < System.currentTimeMillis() - billingCacheDuration) throw new Exception("cache expired"); if (!buyerId.equals(proof.getString("buyer_id"))) throw new Exception("buyer_id mismatch"); JSONArray orders = proof.getJSONArray("orders"); for (int i = 0; i < orders.length(); i++) { JSONObject order = orders.getJSONObject(i); if (productId.equals(order.getString("product_id"))) { Log.i(LOGTAG, "Cached server billing success"); result[0] = result[2] = CheckPurchaseResult.purchased(new ClockworkOrder(order, timestamp)); return result; } } result[2] = CheckPurchaseResult.notPurchased(); } catch (Exception ex) { ex.printStackTrace(); result[2] = CheckPurchaseResult.stale(); edit.remove("server-purchases"); edit.commit(); } } else { result[2] = CheckPurchaseResult.stale(); } if (result[1] == CheckPurchaseResult.notPurchased() && result[2] == CheckPurchaseResult.notPurchased()) result[0] = CheckPurchaseResult.notPurchased(); else result[0] = CheckPurchaseResult.stale(); return result; } private class CheckPurchaseState { public boolean restoredMarket = false; public boolean refreshedServer = false; public CheckPurchaseResult serverResult = CheckPurchaseResult.error(); public CheckPurchaseResult marketResult = CheckPurchaseResult.error(); public boolean reportedPurchase = false; } private static final String LOGTAG = "ClockworkModBilling"; public void updateTrial(final Context context, final String productId, String _buyerId, final int trialIncrement, final int trialDailyIncrement, final UpdateTrialCallback callback) { final String buyerId = _buyerId == null ? getSafeDeviceId(context) : _buyerId; final String url = String.format(TRIAL_URL, mSellerId, productId, buyerId, mSandbox, trialIncrement, trialDailyIncrement); ThreadingRunnable.background(new ThreadingRunnable() { @Override public void run() { try { final JSONObject result = StreamUtility.downloadUriAsJSONObject(url); if (!result.getBoolean("success")) throw new Exception(); final JSONObject trial = result.getJSONObject("trial"); foreground(new Runnable() { @Override public void run() { callback.onFinished(true, trial.optLong("trial_date", System.currentTimeMillis()), trial.optLong("trial_increment", 0), trial.optLong("trial_daily_increment", 0), trial.optLong("trial_daily_window", System.currentTimeMillis())); } }); } catch (Exception ex) { ex.printStackTrace(); foreground(new Runnable() { @Override public void run() { callback.onFinished(false, 0, 0, 0, 0); } }); } } }); } public CheckPurchaseResult checkPurchase(final Context context, final String productId, final String buyerId, final long cacheDuration, final CheckPurchaseCallback callback) { return checkPurchase(context, productId, buyerId, cacheDuration, cacheDuration, callback); } public CheckPurchaseResult checkPurchase(final Context context, final String productId, String _buyerId, final long marketCacheDuration, final long billingCacheDuration, final CheckPurchaseCallback callback) { final String buyerId = _buyerId == null ? getSafeDeviceId(context) : _buyerId; final CheckPurchaseState state = new CheckPurchaseState(); final Handler handler = new Handler(); final Runnable reportPurchase = new Runnable() { @Override public void run() { // report if both system of records have reported back, or one indicates success if ((state.refreshedServer && state.restoredMarket) || state.marketResult.isPurchased() || state.serverResult.isPurchased()) { // prevent double reporting if (!state.reportedPurchase) { state.reportedPurchase = true; if (callback == null) return; if (state.marketResult.isPurchased()) callback.onFinished(state.marketResult); else if (state.serverResult.isPurchased()) callback.onFinished(state.serverResult); else if (state.marketResult.isError()) callback.onFinished(state.marketResult); else if (state.serverResult.isError()) callback.onFinished(state.serverResult); else callback.onFinished(CheckPurchaseResult.notPurchased()); } } } }; final SharedPreferences orderData = getOrderData(); // first check the cache CheckPurchaseResult[] cachedResults = checkCachedPurchases(context, productId, buyerId, marketCacheDuration, billingCacheDuration, orderData); CheckPurchaseResult cachedResult = cachedResults[0]; CheckPurchaseResult _syncResult = null; if (cachedResult.isPurchased()) _syncResult = cachedResult; final CheckPurchaseResult syncResult = _syncResult; if (syncResult != null) { // only refresh the cache if it is stale handler.post(new Runnable() { @Override public void run() { if (callback != null) { callback.onFinished(syncResult); } } }); Log.i(LOGTAG, "CheckPurchase result: " + syncResult.toString()); state.reportedPurchase = true; long til = syncResult.getOrder().getTimestamp() - System.currentTimeMillis(); if (syncResult.getOrder() instanceof ClockworkOrder) { til += billingCacheDuration; if (billingCacheDuration / 3 < til || billingCacheDuration == CACHE_DURATION_FOREVER) return syncResult; } else { til += marketCacheDuration; if (marketCacheDuration / 3 < til || marketCacheDuration == CACHE_DURATION_FOREVER) return syncResult; } } final BroadcastReceiver receiver; // don't do a market payment refresh for the sandbox, as that only returns production data. if (!mSandbox && cachedResults[1].isStale()) { receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { try { context.unregisterReceiver(this); } catch (Exception ex) { } state.restoredMarket = true; if (BillingReceiver.CANCELLED.equals(intent.getAction())) { state.marketResult = CheckPurchaseResult.notPurchased(); } else if (BillingReceiver.SUCCEEDED.equals(intent.getAction())) { CheckPurchaseResult[] cachedResults = checkCachedPurchases(context, productId, buyerId, CACHE_DURATION_FOREVER, 0, orderData); CheckPurchaseResult cachedResult = cachedResults[0]; if (cachedResult.isPurchased()) state.marketResult = cachedResult; else state.marketResult = CheckPurchaseResult.notPurchased(); } else { state.marketResult = CheckPurchaseResult.notPurchased(); } Log.i(LOGTAG, "In app billing result: " + state.marketResult.mState); reportPurchase.run(); } }; IntentFilter filter = new IntentFilter(); filter.addAction(BillingReceiver.SUCCEEDED); filter.addAction(BillingReceiver.CANCELLED); filter.addAction(BillingReceiver.FAILED); context.registerReceiver(receiver, filter); refreshMarketPurchases(); } else { receiver = null; state.restoredMarket = true; state.marketResult = CheckPurchaseResult.notPurchased(); } if (cachedResults[2].isStale()) { SharedPreferences settings = getCachedSettings(); final String authToken = settings.getString("authToken", null); // refresh the server purchases ThreadingRunnable.background(new ThreadingRunnable() { @Override public void run() { try { String purchaseUrl = String.format(PURCHASE_URL, mSellerId, buyerId, generateNonce(context), mSandbox); HttpGet get = new HttpGet(purchaseUrl); if (authToken != null) { try { String cookie = getCookie(authToken); addAuthentication(get, cookie); } catch (Exception ex) { } } JSONObject purchases = StreamUtility.downloadUriAsJSONObject(get); Editor editor = orderData.edit(); editor.putString("server-purchases", purchases.toString()); editor.commit(); CheckPurchaseResult[] cachedResults = checkCachedPurchases(context, productId, buyerId, 0, CACHE_DURATION_FOREVER, orderData); CheckPurchaseResult cachedResult = cachedResults[0]; if (cachedResult.isPurchased()) state.serverResult = cachedResult; else state.serverResult = CheckPurchaseResult.notPurchased(); Log.i(LOGTAG, "Server billing result: " + state.serverResult.mState); } catch (Exception ex) { state.serverResult = CheckPurchaseResult.error(); } finally { state.refreshedServer = true; foreground(new Runnable() { @Override public void run() { reportPurchase.run(); } }); } } }); } else { state.refreshedServer = true; state.serverResult = CheckPurchaseResult.notPurchased(); } if (syncResult != null) return syncResult; if (state.refreshedServer && state.restoredMarket) { handler.post(new Runnable() { @Override public void run() { reportPurchase.run(); } }); return CheckPurchaseResult.notPurchased(); } // force a timeout, and report an error ThreadingRunnable.background(new ThreadingRunnable() { @Override public void run() { try { Thread.sleep(10000); foreground(new Runnable() { @Override public void run() { try { if (receiver != null) context.unregisterReceiver(receiver); } catch (Exception ex) { } state.restoredMarket = true; state.refreshedServer = true; reportPurchase.run(); } }); } catch (Exception ex) { } } }); return CheckPurchaseResult.pending(); } public Intent getRecoverPurchasesActivityIntent(Context context, String productId, String buyerId) { Intent intent = new Intent(context, BillingActivity.class); intent.putExtra("action", "recover"); intent.putExtra("productId", productId); buyerId = buyerId == null ? getSafeDeviceId(context) : buyerId; intent.putExtra("buyerId", buyerId); return intent; } public void refreshMarketPurchases() { Log.i(LOGTAG, "Refreshing Market purchases..."); Intent i = new Intent(BillingService.REFRESH_MARKET); i.setClass(mContext, BillingService.class); mContext.startService(i); } public void startPurchase(final Context context, final String productId, LinkPurchase linkOption, boolean allowCachedEmail, final PurchaseCallback callback) { if (linkOption == null) throw new NullPointerException("linkOption"); startPurchase(context, productId, null, linkOption, allowCachedEmail, null, "", PurchaseType.ANY, callback); } // default super easy to use implementation that prompts for nothing besides the payment method public void startPurchase(final Context context, final String productId, final PurchaseCallback callback) { startPurchase(context, productId, null, LinkPurchase.NO_PROMPT, false, null, "", PurchaseType.ANY, callback); } public void startPurchase(final Context context, final String productId, String customPayload, final PurchaseCallback callback) { if (customPayload == null) throw new NullPointerException("customPayload"); startPurchase(context, productId, null, LinkPurchase.NO_PROMPT, false, null, customPayload, PurchaseType.ANY, callback); } public void startPurchase(final Context context, final String productId, String customPayload, PurchaseType type, final PurchaseCallback callback) { if (customPayload == null) throw new NullPointerException("customPayload"); startPurchase(context, productId, null, LinkPurchase.NO_PROMPT, false, null, customPayload, type, callback); } public void startPurchase(final Context context, final String productId, String buyerId, String customPayload, PurchaseType type, final PurchaseCallback callback) { if (customPayload == null) throw new NullPointerException("customPayload"); if (buyerId == null) throw new NullPointerException("buyerId"); startPurchase(context, productId, buyerId, LinkPurchase.NO_PROMPT, false, null, customPayload, type, callback); } public void startPurchase(final Context context, final String productId, LinkPurchase linkOption, boolean allowCachedEmail, final String customPayload, final PurchaseType type, final PurchaseCallback callback) { if (linkOption == null) throw new NullPointerException("linkOption"); startPurchase(context, productId, null, linkOption, allowCachedEmail, null, customPayload, type, callback); } public void startPurchase(final Context context, final String productId, String buyerId, LinkPurchase linkOption, boolean allowCachedEmail, final String customPayload, final PurchaseType type, final PurchaseCallback callback) { if (linkOption == null) throw new NullPointerException("linkOption"); if (buyerId == null) throw new NullPointerException("buyerId"); startPurchase(context, productId, buyerId, linkOption, allowCachedEmail, null, customPayload, type, callback); } public void startPurchase(final Context context, final String productId, String buyerId, final String buyerEmail, final String customPayload, final PurchaseType type, final PurchaseCallback callback) { if (buyerEmail == null) throw new NullPointerException("buyerEmail"); // buyer email may be invalid and will not be validated, just trust the consumer of the API to not mess this up startPurchase(context, productId, buyerId, LinkPurchase.NO_PROMPT, false, buyerEmail, customPayload, type, callback); } // should we move this into an activity? private void startPurchaseInternal(final Context context, final String productId, String _buyerId, final String buyerEmail, final String customPayload, final PurchaseType type, final PurchaseCallback callback) { final String buyerId = _buyerId == null ? getSafeDeviceId(context) : _buyerId; // everything is ready to go, initiate the purchase final ProgressDialog dlg = new ProgressDialog(context); dlg.setMessage("Preparing order..."); dlg.show(); String _url = String.format(ORDER_URL, mSellerId, productId, Uri.encode(buyerId), Uri.encode(customPayload), mSandbox); if (buyerEmail != null) _url = _url + "&buyer_email=" + Uri.encode(buyerEmail); final String url = _url; ThreadingRunnable.background(new ThreadingRunnable() { @Override public void run() { try { final JSONObject payload = StreamUtility.downloadUriAsJSONObject(url); foreground(new Runnable() { @Override public void run() { dlg.dismiss(); if (payload.optBoolean("purchased", false)) { if (!mSandbox || type != PurchaseType.MARKET_INAPP) { AlertDialog.Builder builder = new Builder(context); builder.setMessage("This product has already been purchased."); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // even though the purchase failed, it has already been purchased // so let's consider it a success. invokeCallback(callback, PurchaseResult.SUCCEEDED); } }); builder.create().show(); builder.setCancelable(false); return; } } try { if (type == PurchaseType.PAYPAL) { startPayPalPurchase(context, callback, payload); } else if (type == PurchaseType.MARKET_INAPP) { startAndroidPurchase(context, buyerId, callback, payload); } else if (type == PurchaseType.REDEEM) { startRedeemCode(context, buyerId, callback, payload); } else { // dead code? throw new Exception("No purchase type provided?"); } } catch (Exception ex) { ex.printStackTrace(); showAlertDialog(context, "There was an error processing your request. Please try again later!"); } } }); } catch (Exception ex) { ex.printStackTrace(); foreground(new Runnable() { @Override public void run() { dlg.dismiss(); // TODO: Localize... showAlertDialog(context, "There was an error processing your request. Please try again later!"); } }); } } }); } // should we move this into an activity? public void startPurchase(final Context context, final String productId, String _buyerId, final LinkPurchase linkOption, final boolean allowCachedEmail, final String buyerEmail, final String customPayload, final PurchaseType type, final PurchaseCallback callback) { if (type == null) throw new NullPointerException("type"); if (_buyerId == null) _buyerId = getSafeDeviceId(context); final String buyerId = _buyerId; if (type == PurchaseType.ANY) { AlertDialog.Builder builder = new Builder(context); builder.setItems(new String[] { "PayPal", "Android Market", "Redeem Code" }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { if (which == 0) { startPurchase(context, productId, buyerId, linkOption, allowCachedEmail, buyerEmail, customPayload, PurchaseType.PAYPAL, callback); } else if (which == 1) { startPurchase(context, productId, buyerId, linkOption, allowCachedEmail, buyerEmail, customPayload, PurchaseType.MARKET_INAPP, callback); } else if (which == 2) { startPurchase(context, productId, buyerId, linkOption, allowCachedEmail, buyerEmail, customPayload, PurchaseType.REDEEM, callback); } } catch (Exception ex) { ex.printStackTrace(); showAlertDialog(context, "There was an error processing your request. Please try again later!"); } } }); builder.create().show(); return; } // at this point, we definitely have a purchase type in mind if (buyerEmail != null) { // live with whatever buyer email we have startPurchaseInternal(context, productId, buyerId, buyerEmail, customPayload, type, callback); return; } if (allowCachedEmail) { // see if we have a cached version SharedPreferences cachedSettings = getCachedSettings(); String cachedBuyerEmail = cachedSettings.getString("buyerEmail", null); if (cachedBuyerEmail != null) { startPurchaseInternal(context, productId, buyerId, cachedBuyerEmail, customPayload, type, callback); return; } } // at this point we MUST prompt to get the email, see if our flags allow this if (linkOption == LinkPurchase.NO_PROMPT) { // not prompting startPurchaseInternal(context, productId, buyerId, null, customPayload, type, callback); return; } if (type == PurchaseType.MARKET_INAPP && linkOption == LinkPurchase.PROMPT_EMAIL) { // not prompting for market purchases, as it is already linked to a google account. // there is a specific option, PROMPT_EMAIL_INCLUDING_MARKET, for that. startPurchaseInternal(context, productId, buyerId, null, customPayload, type, callback); return; } // let's prompt for a buyer email AccountManager amgr = AccountManager.get(context); final Account[] accounts = amgr.getAccountsByType("com.google"); if (accounts.length == 0) { startPurchaseInternal(context, productId, buyerId, null, customPayload, type, callback); return; } String[] accountOptions; if (linkOption != LinkPurchase.REQUIRE_EMAIL) { accountOptions = new String[accounts.length + 1]; accountOptions[accounts.length] = "Do Not Link"; } else { accountOptions = new String[accounts.length]; } for (int i = 0; i < accounts.length; i++) { Account account = accounts[i]; accountOptions[i] = account.name; } AlertDialog.Builder builder = new Builder(context); builder.setItems(accountOptions, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == accounts.length) { startPurchaseInternal(context, productId, buyerId, null, customPayload, type, callback); return; } // don't actually need an auth token or anything, just let them select their email... startPurchaseInternal(context, productId, buyerId, accounts[which].name, customPayload, type, callback); } }); builder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { invokeCallback(callback, PurchaseResult.CANCELLED); } }); builder.setTitle("Link To Account"); //builder.setMessage("Link your purchase to a Google account to use it on multiple phones."); builder.create().show(); } static void addAuthentication(HttpMessage message, String ascidCookie) { message.setHeader("Cookie", ascidCookie); message.setHeader("X-Same-Domain", "1"); // XSRF } static String getCookie(final String authToken) throws ClientProtocolException, IOException, URISyntaxException { if (authToken == null) return null; Log.i(LOGTAG, authToken); Log.i(LOGTAG, "getting cookie"); // Get ACSID cookie DefaultHttpClient client = new DefaultHttpClient(); URI uri = new URI("https://clockworkbilling.appspot.com/_ah/login?continue=" + URLEncoder.encode("http://localhost", "UTF-8") + "&auth=" + authToken); HttpGet method = new HttpGet(uri); final HttpParams getParams = new BasicHttpParams(); HttpClientParams.setRedirecting(getParams, false); // continue is not // used method.setParams(getParams); HttpResponse res = client.execute(method); Header[] headers = res.getHeaders("Set-Cookie"); if (res.getStatusLine().getStatusCode() != 302 || headers.length == 0) { //throw new Exception("failure getting cookie: " + res.getStatusLine().getStatusCode() + " " + res.getStatusLine().getReasonPhrase()); return null; } String ascidCookie = null; for (Header header : headers) { if (header.getValue().indexOf("ACSID=") >= 0) { // let's parse it String value = header.getValue(); String[] pairs = value.split(";"); ascidCookie = pairs[0]; } } return ascidCookie; } }
85ee83de79825ded7243c86ee71fbebcf60eed85
0f683708a217e6f2b24b4d7d16e8bde20c7e8538
/robo-arm/src/meArmApp.java
d8885374a827907e4fd5ed5219749974367c9238
[]
no_license
KaddouraAJ/Robo-Claw-Controller
cbe0ff0791e37338c22bc0ff21173ebd108ff42d
295617f3c8c2ccb9202cbc4826f8960e0e250736
refs/heads/master
2021-08-24T08:57:53.643090
2017-12-08T23:13:40
2017-12-08T23:13:40
113,511,202
0
1
null
null
null
null
UTF-8
Java
false
false
4,926
java
package pin.beyond.nanny.kaddouraaj.mearm; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.net.*; public class MainActivity extends AppCompatActivity { //Buttons on app used to Control Arm private Button base_right, base_left, shoulder_up, shoulder_down, elbow_up, elbow_down, gripper_open, gripper_close, stop_movement; private EditText ip_text; //Text box for user to input ip to send it private DatagramSocket socket; private DatagramPacket packet; int port = 1001; //Port the app uses to send data @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //sets the view of the app //Initializing Buttons and textboxes base_right = (Button) findViewById(R.id.BR); base_left = (Button) findViewById(R.id.BL); shoulder_up = (Button) findViewById(R.id.SU); shoulder_down = (Button) findViewById(R.id.SD); elbow_up = (Button) findViewById(R.id.EU); elbow_down = (Button) findViewById(R.id.ED); gripper_open = (Button) findViewById(R.id.GO); gripper_close = (Button) findViewById(R.id.GC); stop_movement = (Button) findViewById(R.id.button); ip_text = (EditText)findViewById(R.id.editText); //Button on click listeners which call the sendSignal Method with a proper signal as an argument. //The String argument is the signal which is sent to the arm and thus moves. base_right.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Base_Right"); } }); base_left.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Base_Left"); } }); shoulder_up.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Shoulder_Up"); } }); shoulder_down.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Shoulder_Down"); } }); elbow_up.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Elbow_Up"); } }); elbow_down.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Elbow_Down"); } }); gripper_open.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Gripper_Open"); } }); gripper_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Gripper_Close"); } }); stop_movement.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendSignal("Stop_Movement"); } }); } private void sendSignal(String msg) { socket = null; //set socket as null for efficiency try { InetAddress host = InetAddress.getByName(ip_text.getText().toString()); //gets the ip, which user inputs, from the text box. socket = new DatagramSocket(); //Initialize a socket to send signals through byte[] data = msg.getBytes(); //Convert the msg signal into bytes to be sent through the socket to the server packet = new DatagramPacket(data, data.length, host, port); //Initialize a packet of the signal informaation to be sent //UDP communication on java can not run on the main thread of the app. //Java has to use a separate thread to send the signal packet through the socket to the server. Thread thread = new Thread(new Runnable() { @Override public void run() { //Initialize a new thread try { socket.send(packet); //Send the Signal packet through the socket } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); //start the thread above } catch (Exception e) { e.printStackTrace(); } } }
47cb220809d0cfc566977906865193dd97790a32
1010e02d17881b712d2772beaf1dbb02c9144c04
/app/build/generated/source/r/release/io/dcloud/HBuilder/H52E3F8A3/R.java
75bcd84f536951cf23d179d25f614410f3f81c31
[]
no_license
jiafengfeng12345/HBuilder-Hello1
86b195f1abee7cfddaf9b0f187d973e64346babf
8257b9d173f51831bbc798ac5539492c28b1ebfb
refs/heads/master
2021-04-12T04:29:06.249517
2018-03-20T07:22:52
2018-03-20T07:22:52
125,951,400
0
0
null
null
null
null
UTF-8
Java
false
false
35,750
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package io.dcloud.HBuilder.H52E3F8A3; public final class R { public static final class anim { public static final int dcloud_slide_in_from_top=0x7f040000; public static final int dcloud_slide_out_to_top=0x7f040001; } public static final class attr { /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int actionSheetBackground=0x7f010000; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). */ public static final int actionSheetPadding=0x7f01000b; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionSheetStyle=0x7f01000f; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). */ public static final int actionSheetTextSize=0x7f01000e; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int cancelButtonBackground=0x7f010001; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). */ public static final int cancelButtonMarginTop=0x7f01000d; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int cancelButtonTextColor=0x7f010007; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int destructiveButtonTextColor=0x7f010009; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int otherButtonBottomBackground=0x7f010005; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int otherButtonMiddleBackground=0x7f010004; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int otherButtonSingleBackground=0x7f010006; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). */ public static final int otherButtonSpacing=0x7f01000c; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int otherButtonTextColor=0x7f010008; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int otherButtonTitleBackground=0x7f010003; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int otherButtonTopBackground=0x7f010002; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int titleButtonTextColor=0x7f01000a; } public static final class color { public static final int dadada=0x7f070000; public static final int e4e4e4=0x7f070001; public static final int ffffff=0x7f070002; public static final int image_pick_title_btn_normal=0x7f070003; public static final int image_pick_title_btn_pressed=0x7f070004; public static final int ime_background=0x7f070005; } public static final class drawable { public static final int actionsheet_bottom_normal=0x7f020000; public static final int actionsheet_bottom_pressed=0x7f020001; public static final int actionsheet_middle_normal=0x7f020002; public static final int actionsheet_middle_pressed=0x7f020003; public static final int actionsheet_single_normal=0x7f020004; public static final int actionsheet_single_pressed=0x7f020005; public static final int actionsheet_top_normal=0x7f020006; public static final int actionsheet_top_pressed=0x7f020007; public static final int as_bg_ios6=0x7f020008; public static final int as_cancel_bt_bg=0x7f020009; public static final int as_other_bt_bg=0x7f02000a; public static final int dcloud_actionsheet_bottom_normal=0x7f02000b; public static final int dcloud_actionsheet_bottom_pressed=0x7f02000c; public static final int dcloud_actionsheet_middle_normal=0x7f02000d; public static final int dcloud_actionsheet_middle_pressed=0x7f02000e; public static final int dcloud_actionsheet_single_normal=0x7f02000f; public static final int dcloud_actionsheet_single_pressed=0x7f020010; public static final int dcloud_actionsheet_top_normal=0x7f020011; public static final int dcloud_actionsheet_top_pressed=0x7f020012; public static final int dcloud_as_bg_ios6=0x7f020013; public static final int dcloud_as_cancel_bt_bg=0x7f020014; public static final int dcloud_as_other_bt_bg=0x7f020015; public static final int dcloud_dialog_shape=0x7f020016; public static final int dcloud_dialog_shape_bg=0x7f020017; public static final int dcloud_image_pick_mask=0x7f020018; public static final int dcloud_image_pick_no_media=0x7f020019; public static final int dcloud_image_pick_title_sel=0x7f02001a; public static final int dcloud_longding_bg=0x7f02001b; public static final int dcloud_shadow_left=0x7f02001c; public static final int dcloud_slt_as_ios7_cancel_bt=0x7f02001d; public static final int dcloud_slt_as_ios7_other_bt_bottom=0x7f02001e; public static final int dcloud_slt_as_ios7_other_bt_middle=0x7f02001f; public static final int dcloud_slt_as_ios7_other_bt_single=0x7f020020; public static final int dcloud_slt_as_ios7_other_bt_title=0x7f020021; public static final int dcloud_slt_as_ios7_other_bt_top=0x7f020022; public static final int dcloud_snow_black=0x7f020023; public static final int dcloud_snow_black_progress=0x7f020024; public static final int dcloud_snow_white=0x7f020025; public static final int dcloud_snow_white_progress=0x7f020026; public static final int icon=0x7f020027; public static final int image_pick_mask=0x7f020028; public static final int image_pick_no_media=0x7f020029; public static final int push=0x7f02002a; public static final int splash=0x7f02002b; } public static final class id { public static final int back=0x7f090001; public static final int dcloud_dialog_btn1=0x7f090010; public static final int dcloud_dialog_btn2=0x7f090011; public static final int dcloud_dialog_icon=0x7f09000d; public static final int dcloud_dialog_msg=0x7f09000f; public static final int dcloud_dialog_rootview=0x7f09000c; public static final int dcloud_dialog_title=0x7f09000e; public static final int dcloud_iv_loading=0x7f09001a; public static final int dcloud_pb_loading=0x7f090019; public static final int dcloud_pd_root=0x7f090018; public static final int dcloud_tv_loading=0x7f09001c; public static final int dcloud_view_seaparator=0x7f09001b; public static final int delete=0x7f090020; public static final int getui_big_bigtext_defaultView=0x7f090047; public static final int getui_big_bigview_defaultView=0x7f090046; public static final int getui_big_defaultView=0x7f09003e; public static final int getui_big_default_Content=0x7f09003d; public static final int getui_big_imageView_headsup=0x7f09003b; public static final int getui_big_imageView_headsup2=0x7f090036; public static final int getui_big_notification=0x7f090042; public static final int getui_big_notification_content=0x7f090045; public static final int getui_big_notification_date=0x7f090040; public static final int getui_big_notification_icon=0x7f09003f; public static final int getui_big_notification_icon2=0x7f090041; public static final int getui_big_notification_title=0x7f090043; public static final int getui_big_notification_title_center=0x7f090044; public static final int getui_big_text_headsup=0x7f09003c; public static final int getui_bigview_banner=0x7f090033; public static final int getui_bigview_expanded=0x7f090032; public static final int getui_headsup_banner=0x7f090035; public static final int getui_icon_headsup=0x7f090037; public static final int getui_message_headsup=0x7f09003a; public static final int getui_notification_L=0x7f090050; public static final int getui_notification_L_context=0x7f090055; public static final int getui_notification_L_icon=0x7f090049; public static final int getui_notification_L_line1=0x7f09004d; public static final int getui_notification_L_line2=0x7f090051; public static final int getui_notification_L_line3=0x7f090054; public static final int getui_notification_L_right_icon=0x7f090056; public static final int getui_notification_L_time=0x7f090053; public static final int getui_notification__style2_title=0x7f09002c; public static final int getui_notification_bg=0x7f090024; public static final int getui_notification_date=0x7f090026; public static final int getui_notification_download_L=0x7f09004a; public static final int getui_notification_download_content=0x7f090030; public static final int getui_notification_download_content_L=0x7f09004e; public static final int getui_notification_download_info_L=0x7f09004f; public static final int getui_notification_download_progressBar_L=0x7f09004c; public static final int getui_notification_download_progressbar=0x7f090031; public static final int getui_notification_download_title_L=0x7f09004b; public static final int getui_notification_headsup=0x7f090034; public static final int getui_notification_icon=0x7f090025; public static final int getui_notification_icon2=0x7f090027; public static final int getui_notification_l_layout=0x7f090048; public static final int getui_notification_style1=0x7f090028; public static final int getui_notification_style1_content=0x7f09002a; public static final int getui_notification_style1_title=0x7f090029; public static final int getui_notification_style2=0x7f09002b; public static final int getui_notification_style3=0x7f09002d; public static final int getui_notification_style3_content=0x7f09002e; public static final int getui_notification_style4=0x7f09002f; public static final int getui_notification_title_L=0x7f090052; public static final int getui_root_view=0x7f090023; public static final int getui_time_headsup=0x7f090039; public static final int getui_title_headsup=0x7f090038; public static final int gridGallery=0x7f090014; public static final int image=0x7f090008; public static final int imgNoMedia=0x7f090015; public static final int imgQueue=0x7f090016; public static final int imgQueueMask=0x7f090017; public static final int ll_title_bar=0x7f090009; public static final int logs=0x7f090021; public static final int pager=0x7f090002; public static final int progressBar=0x7f090022; public static final int query_page=0x7f09001f; public static final int rl_notification=0x7f090007; public static final int set_priority=0x7f09001e; public static final int start_manage=0x7f09001d; public static final int tab0=0x7f090003; public static final int tab1=0x7f090004; public static final int tab2=0x7f090005; public static final int tab3=0x7f090006; public static final int text=0x7f09000b; public static final int time=0x7f09000a; public static final int title=0x7f090000; public static final int titleBtn=0x7f090013; public static final int tvTitleText=0x7f090012; } public static final class layout { public static final int dcloud_activity_main_market=0x7f030000; public static final int dcloud_custom_notification=0x7f030001; public static final int dcloud_dialog=0x7f030002; public static final int dcloud_image_pick_gallery=0x7f030003; public static final int dcloud_image_pick_gallery_item=0x7f030004; public static final int dcloud_loadingview=0x7f030005; public static final int dcloud_main_test_activity=0x7f030006; public static final int dcloud_market_fragment_base=0x7f030007; public static final int dcloud_snow_black_progress=0x7f030008; public static final int dcloud_snow_white_progress=0x7f030009; public static final int getui_notification=0x7f03000a; } public static final class raw { public static final int keep=0x7f050000; } public static final class string { public static final int app_name=0x7f060001; public static final int dcloud_gallery_app_name=0x7f060000; } public static final class style { public static final int ActionSheetStyleIOS6=0x7f080000; public static final int ActionSheetStyleIOS7=0x7f080001; /** <item name="android:windowIsTranslucent">true</item> */ public static final int DCloudTheme=0x7f080002; public static final int DeviceDefault=0x7f080003; public static final int DeviceDefault_Light=0x7f080004; public static final int NotificationText=0x7f080005; public static final int NotificationTitle=0x7f080006; public static final int OpenStreamAppTransferActivityTheme=0x7f080007; public static final int TranslucentTheme=0x7f080008; public static final int dcloud_anim_dialog_window_in_out=0x7f080009; public static final int dcloud_defalut_dialog=0x7f08000a; public static final int featureLossDialog=0x7f08000b; public static final int streamDelete19Dialog=0x7f08000c; } public static final class styleable { /** Attributes that can be used with a ActionSheet. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionSheet_actionSheetBackground io.dcloud.HBuilder.H52E3F8A3:actionSheetBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_actionSheetPadding io.dcloud.HBuilder.H52E3F8A3:actionSheetPadding}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_actionSheetTextSize io.dcloud.HBuilder.H52E3F8A3:actionSheetTextSize}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_cancelButtonBackground io.dcloud.HBuilder.H52E3F8A3:cancelButtonBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_cancelButtonMarginTop io.dcloud.HBuilder.H52E3F8A3:cancelButtonMarginTop}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_cancelButtonTextColor io.dcloud.HBuilder.H52E3F8A3:cancelButtonTextColor}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_destructiveButtonTextColor io.dcloud.HBuilder.H52E3F8A3:destructiveButtonTextColor}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonBottomBackground io.dcloud.HBuilder.H52E3F8A3:otherButtonBottomBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonMiddleBackground io.dcloud.HBuilder.H52E3F8A3:otherButtonMiddleBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonSingleBackground io.dcloud.HBuilder.H52E3F8A3:otherButtonSingleBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonSpacing io.dcloud.HBuilder.H52E3F8A3:otherButtonSpacing}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonTextColor io.dcloud.HBuilder.H52E3F8A3:otherButtonTextColor}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonTitleBackground io.dcloud.HBuilder.H52E3F8A3:otherButtonTitleBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_otherButtonTopBackground io.dcloud.HBuilder.H52E3F8A3:otherButtonTopBackground}</code></td><td></td></tr> <tr><td><code>{@link #ActionSheet_titleButtonTextColor io.dcloud.HBuilder.H52E3F8A3:titleButtonTextColor}</code></td><td></td></tr> </table> @see #ActionSheet_actionSheetBackground @see #ActionSheet_actionSheetPadding @see #ActionSheet_actionSheetTextSize @see #ActionSheet_cancelButtonBackground @see #ActionSheet_cancelButtonMarginTop @see #ActionSheet_cancelButtonTextColor @see #ActionSheet_destructiveButtonTextColor @see #ActionSheet_otherButtonBottomBackground @see #ActionSheet_otherButtonMiddleBackground @see #ActionSheet_otherButtonSingleBackground @see #ActionSheet_otherButtonSpacing @see #ActionSheet_otherButtonTextColor @see #ActionSheet_otherButtonTitleBackground @see #ActionSheet_otherButtonTopBackground @see #ActionSheet_titleButtonTextColor */ public static final int[] ActionSheet = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e }; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#actionSheetBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:actionSheetBackground */ public static final int ActionSheet_actionSheetBackground = 0; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#actionSheetPadding} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). @attr name io.dcloud.HBuilder.H52E3F8A3:actionSheetPadding */ public static final int ActionSheet_actionSheetPadding = 11; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#actionSheetTextSize} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). @attr name io.dcloud.HBuilder.H52E3F8A3:actionSheetTextSize */ public static final int ActionSheet_actionSheetTextSize = 14; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#cancelButtonBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:cancelButtonBackground */ public static final int ActionSheet_cancelButtonBackground = 1; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#cancelButtonMarginTop} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). @attr name io.dcloud.HBuilder.H52E3F8A3:cancelButtonMarginTop */ public static final int ActionSheet_cancelButtonMarginTop = 13; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#cancelButtonTextColor} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:cancelButtonTextColor */ public static final int ActionSheet_cancelButtonTextColor = 7; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#destructiveButtonTextColor} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:destructiveButtonTextColor */ public static final int ActionSheet_destructiveButtonTextColor = 9; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonBottomBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonBottomBackground */ public static final int ActionSheet_otherButtonBottomBackground = 5; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonMiddleBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonMiddleBackground */ public static final int ActionSheet_otherButtonMiddleBackground = 4; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonSingleBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonSingleBackground */ public static final int ActionSheet_otherButtonSingleBackground = 6; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonSpacing} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonSpacing */ public static final int ActionSheet_otherButtonSpacing = 12; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonTextColor} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonTextColor */ public static final int ActionSheet_otherButtonTextColor = 8; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonTitleBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonTitleBackground */ public static final int ActionSheet_otherButtonTitleBackground = 3; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#otherButtonTopBackground} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:otherButtonTopBackground */ public static final int ActionSheet_otherButtonTopBackground = 2; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#titleButtonTextColor} attribute's value can be found in the {@link #ActionSheet} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:titleButtonTextColor */ public static final int ActionSheet_titleButtonTextColor = 10; /** Attributes that can be used with a ActionSheets. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionSheets_actionSheetStyle io.dcloud.HBuilder.H52E3F8A3:actionSheetStyle}</code></td><td></td></tr> </table> @see #ActionSheets_actionSheetStyle */ public static final int[] ActionSheets = { 0x7f01000f }; /** <p>This symbol is the offset where the {@link io.dcloud.HBuilder.H52E3F8A3.R.attr#actionSheetStyle} attribute's value can be found in the {@link #ActionSheets} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name io.dcloud.HBuilder.H52E3F8A3:actionSheetStyle */ public static final int ActionSheets_actionSheetStyle = 0; }; }
bf4adc3a7c67dcf62297ca7cfbacf3d92916baf3
9765f1024cbb7b90d1e3896515f47865ccb5e475
/src/main/java/com/github/thisisforever/keeper/cryptox/Entry.java
c4a42371f1f41c1ca3e3756560944f458002ee33
[]
no_license
this-is-forever/Keeper
da343459b0ad7a7ed2462bae100583828cab10ca
1a870797107ef09ba7b63821a794eab4370c6427
refs/heads/master
2022-11-30T23:24:07.843609
2020-08-11T22:46:39
2020-08-11T22:46:39
283,402,350
0
0
null
null
null
null
UTF-8
Java
false
false
3,439
java
package com.github.thisisforever.keeper.cryptox; import com.github.thisisforever.crypto.CryptographicFailureException; /** * Defines a password entry, with website, username and password information */ public class Entry implements Comparable<Entry> { // References the entry's website and username private String website, username; // References the entry's encrypted password data private byte[] passwordData; /** * Constructs a new {@link Entry} object with given website, username and encrypted password data * @param website The entry's website * @param username The entry's username * @param passwordData Encrypted password data for this entry */ public Entry(String website, String username, byte[] passwordData) { this.website = website; this.username = username; this.passwordData = passwordData; } /** * Changes the entry's website * @param website The new website */ public void setWebsite(String website) { this.website = website; } /** * Gets this entry's website information * @return a {@link String} with the entry's website */ public String getWebsite() { return website; } /** * Changes the entry's username * @param username The new username */ public void setUsername(String username) { this.username = username; } /** * Gets this entry's username * @return a {@link String} with the entry's username */ public String getUsername() { return username; } /** * Changes the entry's password to a new one, encrypting the new password in the process * @param manager A {@link PasswordArchiveManager} which will be used to encrypt the password * @param password the char[] containing the new password */ public void setPassword(PasswordArchiveManager manager, char[] password) { if(password.length == 0) { passwordData = null; } else { passwordData = manager.encryptPassword(password); } } /** * Retrieves this entry's encrypted password data * @return a byte[] with the encrypted password data */ public byte[] getPasswordData() { return passwordData; } /** * Decrypts this entry's password and returns a reference * @param manager A {@link PasswordArchiveManager} to be used for decryption * @return a {@link String} object containing the decrypted password, or an empty {@link String} if this * entry does not have any password data */ public String getPassword(PasswordArchiveManager manager) throws CryptographicFailureException { if(passwordData == null) { return ""; } return manager.decryptPassword(passwordData); } /** * Compares one {@link Entry} object to another, first by their website and then their username * @param e The object to compare to * @return an integer value that can be used to determine whether this {@link Entry} object comes before, * after or is equal to another */ @Override public int compareTo(Entry e) { int comp = website.toLowerCase().compareTo(e.getWebsite().toLowerCase()); if(comp == 0) { comp = username.toLowerCase().compareTo(e.getUsername().toLowerCase()); } return comp; } }
70ca00a05e17254a37410d46fb00d42e3c6e0bf6
30077453fa7d1070e0dc1784ead3c7cdc2e5373c
/app/build/tmp/kapt3/stubs/debug/org/blayboy/newpipe/local/subscription/decoration/FeedGroupCarouselDecoration.java
fde7e236ff3d3ad7d6c1fe1dcc50327d5d6ff07e
[ "MIT" ]
permissive
JayeshDankhara/BlayTube
fc2d24df04672e58921534a6f71ff0a37b57a2cb
2a7c4ac6ed7992a36312057fbf567bb4a7447daf
refs/heads/master
2023-06-05T09:53:00.768546
2021-06-26T03:08:57
2021-06-26T03:08:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,234
java
package org.blayboy.newpipe.local.subscription.decoration; import java.lang.System; @kotlin.Metadata(mv = {1, 4, 0}, bv = {1, 0, 3}, k = 1, d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004J(\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0006X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0013"}, d2 = {"Lorg/blayboy/newpipe/local/subscription/decoration/FeedGroupCarouselDecoration;", "Landroidx/recyclerview/widget/RecyclerView$ItemDecoration;", "context", "Landroid/content/Context;", "(Landroid/content/Context;)V", "marginBetweenItems", "", "marginStartEnd", "marginTopBottom", "getItemOffsets", "", "outRect", "Landroid/graphics/Rect;", "child", "Landroid/view/View;", "parent", "Landroidx/recyclerview/widget/RecyclerView;", "state", "Landroidx/recyclerview/widget/RecyclerView$State;", "app_debug"}) public final class FeedGroupCarouselDecoration extends androidx.recyclerview.widget.RecyclerView.ItemDecoration { private final int marginStartEnd = 0; private final int marginTopBottom = 0; private final int marginBetweenItems = 0; @java.lang.Override() public void getItemOffsets(@org.jetbrains.annotations.NotNull() android.graphics.Rect outRect, @org.jetbrains.annotations.NotNull() android.view.View child, @org.jetbrains.annotations.NotNull() androidx.recyclerview.widget.RecyclerView parent, @org.jetbrains.annotations.NotNull() androidx.recyclerview.widget.RecyclerView.State state) { } public FeedGroupCarouselDecoration(@org.jetbrains.annotations.NotNull() android.content.Context context) { super(); } }
ba3623b5519f65c0089ca38c7d0b470094021247
be4a078e5e429af9a30c0dc6656cd0c6c48595a6
/common/spring_security/src/main/java/com/lsy/security/security/TokenManager.java
c5c0c1cc0be7cedad52265c916cbcf6d03988a76
[]
no_license
mygia8/spring-security
118a549550b177403f667f507c40ceb93d5b4c9f
577982467e113d1f154e9ccc71d455ed4dbcff69
refs/heads/master
2023-05-02T05:17:28.430716
2021-04-30T05:20:29
2021-04-30T05:20:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,327
java
package com.lsy.security.security; import io.jsonwebtoken.CompressionCodecs; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.stereotype.Component; import java.util.Date; @Component public class TokenManager { //token有效时长, private long tokenEcpiration = 24*60*60*1000; //编码秘钥,在实际的项目中是要生成的,这里进行写死。 private String tokenSignKey = "123456"; //1 使用jwt根据用户名生成token public String createToken(String username) { //传入的是用户名 String token = Jwts.builder().setSubject(username) .setExpiration(new Date(System.currentTimeMillis()+tokenEcpiration)) .signWith(SignatureAlgorithm.HS512, tokenSignKey).compressWith(CompressionCodecs.GZIP).compact(); //加密过程的固定写法 return token; } //2 根据token字符串得到用户信息 public String getUserInfoFromToken(String token) { String userinfo = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token).getBody().getSubject(); return userinfo; } //3 删除token public void removeToken(String token) { //可以不写删除Token的方法,因为可以在客户端上不携带Token。 } }
de75432089f4e59aaa7ba7d6dc5dffad9c29d6eb
1ef50e3e8385accfb41d0bff8acec8fa428e2646
/SocketClient/src/main/java/NioClient.java
4c5945b488682a7bc9475a94e631aa358ad23da0
[]
no_license
LMY-start/network-io
e6cd0c35619d84aa2848f1c4f4b544b4a3b3d15b
416f0522984bda48e9c1b84698f08a9e2b6667b5
refs/heads/master
2022-08-03T02:03:27.764662
2020-05-26T07:38:00
2020-05-26T07:38:00
266,974,924
0
0
null
null
null
null
UTF-8
Java
false
false
3,941
java
import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.nio.charset.StandardCharsets; import java.util.Iterator; import java.util.Set; import static java.lang.Thread.sleep; public class NioClient { private String host; private int port; SocketChannel channel = null; Selector selector = null; public NioClient(String host, int port) { this.host = host; this.port = port; } public void connect() { try { selector = Selector.open(); channel = SocketChannel.open(); channel.configureBlocking(false); channel.register(selector, SelectionKey.OP_CONNECT); if (channel.connect(new InetSocketAddress(host, port))) { channel.register(selector, SelectionKey.OP_READ); write(channel); } else { } while (true) { selector.select(1000); Set<SelectionKey> selectionKeys = selector.selectedKeys(); Iterator<SelectionKey> iterator = selectionKeys.iterator(); SelectionKey key = null; while (iterator.hasNext()) { try { key = iterator.next(); handle(key, selector); } catch (Exception e) { e.printStackTrace(); if (null != key) { key.cancel(); if (null != key.channel()) { key.channel().close(); } } return; } } } } catch (Exception e) { System.out.println("will exit"); e.printStackTrace(); } finally { try { if (null != channel) { channel.close(); } if (null != selector) { selector.close(); } } catch (Exception e) { throw new RuntimeException(e); } } } private void write(SocketChannel channel) throws IOException, InterruptedException { sleep(2000); String message = "message" + System.currentTimeMillis(); byte[] bytes = message.getBytes(); ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length); byteBuffer.put(bytes); byteBuffer.flip(); channel.write(byteBuffer); System.out.println("send: " + message); } private void handle(SelectionKey key, Selector selector) throws IOException, InterruptedException { if (key.isValid()) { SocketChannel channel = (SocketChannel) key.channel(); if (key.isConnectable() && !(((SocketChannel) key.channel()).isConnected())) { channel.finishConnect(); channel.register(selector, SelectionKey.OP_READ); System.out.println("connect to server"); write(channel); } if (key.isReadable()) { ByteBuffer byteBuffer = ByteBuffer.allocate(1024); int readBytes = channel.read(byteBuffer); if (readBytes > 0) { byteBuffer.flip(); byte[] bytes = new byte[byteBuffer.remaining()]; byteBuffer.get(bytes); String message = new String(bytes, StandardCharsets.UTF_8); System.out.println("received: " + message); write(channel); } } } } public static void main(String[] args) { new NioClient("127.0.0.1", 6789).connect(); } }
8c08b16d9fe6fe5dab2abb69957591648f0cebd2
aeadddddf06654b1655195c37d2994da0f265797
/src/main/java/br/com/ecommerce/api/domain/PagamentoComBoleto.java
49b30ef9f659c76e19783145b5051226e926f593
[]
no_license
fernandoguide/api-e-commerce
4f8ac19a76ae28c09452c2edce387d6b735eb2f5
6f8dcc02932abda40b5fda62b57db48299e7e754
refs/heads/master
2023-03-24T11:54:34.619135
2020-09-15T01:30:34
2020-09-15T01:30:34
295,402,833
0
0
null
null
null
null
UTF-8
Java
false
false
1,150
java
package br.com.ecommerce.api.domain; import br.com.ecommerce.api.domain.enums.EstadoPagamento; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonTypeName; import javax.persistence.Entity; import java.util.Date; @Entity @JsonTypeName("pagamentoComBoleto") public class PagamentoComBoleto extends Pagamento{ private static final long serialVersionUID = 1L; @JsonFormat(pattern = "dd/MM/yyyy") private Date dataVencimento; @JsonFormat(pattern = "dd/MM/yyyy") private Date dataPagamento; public PagamentoComBoleto() { } public PagamentoComBoleto(Integer id, EstadoPagamento estado, Pedido pedido, Date dataVencimento , Date dataPagamento) { super(id, estado, pedido); this.dataPagamento = dataPagamento; this.dataVencimento = dataVencimento; } public Date getDataVencimento() { return dataVencimento; } public Date getDataPagamento() { return dataPagamento; } public void setDataVencimento(Date dataVencimento) { this.dataVencimento = dataVencimento; } public void setDataPagamento(Date dataPagamento) { this.dataPagamento = dataPagamento; } }
b94fa0c33a36cae653d17c3b6aa83fb7573090a9
2ee3f22de621861b8899a2d069b6a40fdbe6802c
/server/src/main/java/com/sparta/provider/GetProvider.java
47375a47e31e24d4c4c67d936c87d1cb68d9c068
[]
no_license
geeksusma/feed-consumer
c38ff5486d10fa011e365b49698bf945d2a5b9f8
d1ed78164d392bfbb92f22811c44f6764753a536
refs/heads/master
2023-08-10T01:02:47.094264
2020-05-18T09:04:16
2020-05-18T09:04:16
264,881,295
0
0
null
2023-07-23T17:19:47
2020-05-18T08:48:04
Java
UTF-8
Java
false
false
175
java
package com.sparta.provider; import com.sparta.provider.load.Provider; import java.util.Optional; public interface GetProvider { Optional<Provider> byId(String id); }
457a94267998d34dda1696b7684bfe537c1ed74b
c1dd036663bf8511b749b4b87f43d11a2e6ffd01
/WEB-INF/src/com/tried/system/service/SystemSerialMaxService.java
a54303964322c83e87eebb0ce46897fee9b23272
[]
no_license
baoxiny666/zjsys
70e108d9e5557b33e29e651af2d66d5dafce216d
0797a43bb5819f6b98bd7cd2f82b62a68cc7a2c7
refs/heads/master
2023-01-23T14:52:21.951540
2020-11-25T07:33:09
2020-11-25T07:33:09
305,927,617
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.tried.system.service; import com.tried.base.service.BaseService; import com.tried.system.model.SystemSerialMax; /** * @Description - 服务接口 * @author liuxd * @date 2019-03-01 10:59:02 * @version V1.0 */ public interface SystemSerialMaxService extends BaseService<SystemSerialMax> { }
231abda516ec0f7382f9519e89c9d81702d9bb2d
89915cfdd2d9cda1e95048ed8f047d0da4bd9a13
/src/main/java/ua/kpi/dzidzoiev/booking/controller/RedirectServler.java
428f113a958f57d9f4351dfc396cf6c0a1123b47
[]
no_license
schaffe/KpiLabs2-2
dff54b242919def6fc8129a0080c9a2a5574a462
6cc4bb0572b1d0df81a7796095a11218d3f3e1d8
refs/heads/master
2016-08-04T17:11:45.240172
2015-05-25T11:50:27
2015-05-25T11:50:27
33,404,578
0
0
null
null
null
null
UTF-8
Java
false
false
645
java
package ua.kpi.dzidzoiev.booking.controller; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by midnight coder on 24-May-15. */ public class RedirectServler extends HttpServlet { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { super.service(req, res); ((HttpServletResponse)res).sendRedirect("/index.xhtml"); } }
651faae9e67383dda046febc7b5a9fdf8def87fc
9640134296cea3cb9011aac322807a2b3abb4204
/src/main/java/com/simmi1969/my1stjhipsterapp1/web/rest/errors/BadRequestAlertException.java
a9d88ed954c2ac4d709b6bb05e9be14200cb176b
[]
no_license
simmi1969/jhipster-sample-application1
12859220ad81df7c67b717b8c8ea82951adb7810
836885f75cdf78e58307e8bcf141707245aa4f36
refs/heads/main
2023-02-21T22:59:36.596701
2021-01-23T07:54:44
2021-01-23T07:54:44
332,157,029
0
0
null
null
null
null
UTF-8
Java
false
false
1,332
java
package com.simmi1969.my1stjhipsterapp1.web.rest.errors; import java.net.URI; import java.util.HashMap; import java.util.Map; import org.zalando.problem.AbstractThrowableProblem; import org.zalando.problem.Status; public class BadRequestAlertException extends AbstractThrowableProblem { private static final long serialVersionUID = 1L; private final String entityName; private final String errorKey; public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); } public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); this.entityName = entityName; this.errorKey = errorKey; } public String getEntityName() { return entityName; } public String getErrorKey() { return errorKey; } private static Map<String, Object> getAlertParameters(String entityName, String errorKey) { Map<String, Object> parameters = new HashMap<>(); parameters.put("message", "error." + errorKey); parameters.put("params", entityName); return parameters; } }
6af50d5b670af25a1d3727f33aec51838df2db8e
0c87d2bee549976a26f7d1f0ceca191086facba4
/Midtest2_B/app/src/main/java/com/example/midtest2_b/MainActivity.java
59a839cb3bbf912449c4cf731858f8e2be8db434
[]
no_license
caramelsyrup/Android_academy
682b7685f87b09340d013966ad705df63c9f760a
f9da5a02ef39cb8f7163e727938618a6bd3e4b74
refs/heads/master
2022-12-30T00:39:37.123566
2020-10-19T07:30:33
2020-10-19T07:30:33
298,482,805
0
0
null
null
null
null
UTF-8
Java
false
false
9,178
java
package com.example.midtest2_b; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Gallery; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TableRow; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { // 활동 시간들 저장 변수 선언 int time2,time3,time4,time5; // 스피너 선택값 저장을 위한 변수 선언 String resultIdol = null; // 대화 상자 뷰를 위한 변수 선언 View dlgView; // 그림을 출력하기 위해서 arraylist 선언 ArrayList<Integer> ImgArr = new ArrayList<Integer>(4); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 요소들 바인딩 final EditText sleepTime = (EditText) findViewById(R.id.sleepTime); // 수면시간 final EditText codeTime = (EditText) findViewById(R.id.codeTime); // 코딩시간 final EditText readTime = (EditText) findViewById(R.id.readTime); // 독서시간 final EditText engTime = (EditText) findViewById(R.id.engTime); // 영어시간 final EditText exerTime = (EditText) findViewById(R.id.exerTime); // 운동시간 final CheckBox cbCode = (CheckBox) findViewById(R.id.cbCode); // 코딩 체크박스 final CheckBox cbRead = (CheckBox) findViewById(R.id.cbRead); // 독서 체크박스 final CheckBox cbEng = (CheckBox) findViewById(R.id.cbEng); // 영어 체크박스 final CheckBox cbExer = (CheckBox) findViewById(R.id.cbExer); // 운동 체크박스 Spinner spinner = (Spinner) findViewById(R.id.spinner); // 이상형 스피너 Button btnResult = (Button) findViewById(R.id.btnResult); // 결과 버튼 final TextView txt1 = (TextView) findViewById(R.id.txt1); // 결과 1 final TextView txt2 = (TextView) findViewById(R.id.txt2); // 결과 2 final TextView txt3 = (TextView) findViewById(R.id.txt3); // 결과 3 final LinearLayout image = (LinearLayout) findViewById(R.id.image); // 이상형 스피너를 위해 배열 만들기 final String[] idol = {"Appearance(외모)","Ability(능력)","Personality(성격)","Lineage(가문)","Faith(신앙)"}; // 배열 어뎁터 객체 생성 ArrayAdapter<String>adapter = new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,idol); // 스피너에 어뎁터 꽂기 spinner.setAdapter(adapter); // 스피너에서 해당 항목 클릭시 spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // 해당 항목을 변수에 저장. resultIdol=idol[position]; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); // 버튼 눌렸을때, 이벤트 btnResult.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 그림 영역 초기화 image.removeAllViews(); // 수면 시간 값 저장. String str1 = sleepTime.getText().toString(); // 코딩,독서,영어,운동 값 저장. String str2 = codeTime.getText().toString().trim(); // 코딩 String str3 = readTime.getText().toString().trim(); // 독서 String str4 = engTime.getText().toString().trim(); // 영어 String str5 = exerTime.getText().toString().trim(); // 운동 // 수면시간 값이 없다면, if(str1.trim().isEmpty()){ // inflate해서 뷰에 넣는다. dlgView = (View) View.inflate(MainActivity.this, R.layout.dlg, null); // 대화상자 객체 생성 Dialog dlg = new Dialog(MainActivity.this); // 뷰를 객체에 꽂기 dlg.setContentView(dlgView); // 대화상자 보이기 dlg.show(); }else{ // 수면 시간 출력 txt1.setText("1. 나는 "+str1+"시간 잠을 잡니다!"); // 활동시간 초기화 int total = 0; // 그림 띄우기 ImgArr.clear(); // 초기화 // 체크박스 눌렀을때,(코딩) if(cbCode.isChecked()==true){ // 시간 영역이 비어 있다면, if(str2.trim().isEmpty()){ // 토스트 띄우기 Toast.makeText(getApplicationContext(),"시간을 입력 하세요!",Toast.LENGTH_SHORT).show(); }else{ // 값을 저장. time2 = Integer.parseInt(str2); // 해당 체크박스의 그림을 배열에 추가. ImgArr.add(R.drawable.programming); } }else{ // 체크가 풀리면 0으로 저장 time2 =0; } // 체크박스 눌렀을때,(독서) if(cbRead.isChecked()==true){ // 시간이 입력 되었는지 판단 if(str3.trim().isEmpty()){ // 토스트 띄우기 Toast.makeText(getApplicationContext(),"시간을 입력 하세요!",Toast.LENGTH_SHORT).show(); }else { // 시간 값 저장. time3 = Integer.parseInt(str3); // 해당 체크박스의 그림을 배열에 추가. ImgArr.add(R.drawable.book_reading); } }else{ time3 =0; } // 체크박스 눌렀을때,(영어) if(cbEng.isChecked()==true){ if(str4.trim().isEmpty()){ // 토스트 띄우기 Toast.makeText(getApplicationContext(),"시간을 입력 하세요!",Toast.LENGTH_SHORT).show(); }else{ time4 = Integer.parseInt(str4); // 해당 체크박스의 그림을 배열에 추가. ImgArr.add(R.drawable.engligh_study); } }else{ time4 =0; } // 체크박스 눌렀을때,(운동) if(cbExer.isChecked()==true){ if(str5.trim().isEmpty()){ // 토스트 띄우기 Toast.makeText(getApplicationContext(),"시간을 입력 하세요!",Toast.LENGTH_SHORT).show(); }else { time5 = Integer.parseInt(str5); // 해당 체크박스의 그림을 배열에 추가. ImgArr.add(R.drawable.work_out); } }else{ time5 =0; } // 위의 시간들 총합 total = time2+time3+time4+time5; // 각 활동시간들 총합 출력. txt2.setText("2. 나는 꿈을 위해"+total+"시간 투자합니다!"); // 스피너 결과 출력. txt3.setText("3. 나의 이상형은 "+resultIdol+"입니다!"); // 이미지 띄우기 for(int i=0; i<ImgArr.size();i++){ // 이미지뷰 객체 생성 ImageView imageView = new ImageView(MainActivity.this); // 이미지 소스 설정 imageView.setBackgroundResource(ImgArr.get(i)); // 테이블 행에 이미지 뷰 추가 image.addView(imageView,150,150); } } } }); } }
7aa2d3d4d11d0315ee7707bcef7d52e2b1f26f7b
0bac01c81903b8476521cf93f1513f3c95f23d44
/ChargeX/src/chargex/Principal.java
6e935195d714f4ce2e46c788df3c9889aea26023
[]
no_license
luis-furtado/ChargeX-Java
9653b31dcdd536a9f7e4ba292f166e199b3c4639
dfc21bd903e2ec887653d24d955201811cb5e02e
refs/heads/master
2020-06-11T22:20:32.300198
2019-06-27T13:59:21
2019-06-27T13:59:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
16,574
java
package chargex; import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import javax.swing.JOptionPane; public final class Principal extends javax.swing.JFrame { Lucro paginaLucro; Frota alterarFrota; NovaEntrega entrega; Historico historico; private double lucro; private int quantidadeMotos; private int quantidadeCarros; private int quantidadeVans; private int quantidadeCarretas; public int getQuantidadeMotos() { return this.quantidadeMotos; } private void setQuantidadeMotos(int quantidadeMotos) { this.quantidadeMotos = quantidadeMotos; } public Principal() { //ler lucro armazenado na ultima execução do programa lerLucroAnterior(); initComponents(); criarClasses(); aplicarEstilizacao(); setSize(900, 470); setResizable(false); this.setLocationRelativeTo(null); tratarDadosNoFechamento(); } public void criarClasses() { paginaLucro = new Lucro(lucro); alterarFrota = new Frota(); entrega = new NovaEntrega(); historico = new Historico(); } public void lerLucroAnterior() { Path arquivo = Paths.get("lucro.txt"); try { byte[] texto = Files.readAllBytes(arquivo); String leitura = new String(texto); this.lucro = Double.parseDouble(leitura); System.out.println(lucro); System.out.println("Lucro armazenado com sucesso!"); } catch(Exception erro) { System.out.println("Arquivo não encontrado!"); } } public void aplicarEstilizacao() { getContentPane().setBackground(new Color(69,77,93)); btnNovaEntrega.setSize(64,64); btnHistorico.setSize(64,64); btnAlterarFrota.setSize(64,64); btnAlterarMargemLucro.setSize(64,64); btnNovaEntrega.setToolTipText("Nova Viagem"); btnHistorico.setToolTipText("Histórico de Viagens"); btnAlterarFrota.setToolTipText("Alterar Frota"); btnAlterarMargemLucro.setToolTipText("Alterar Margem de Lucro"); } public void tratarDadosNoFechamento() { addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { //quando o programa for fechado, sobrescrever o arquivo de lucro com a porcentagem de lucro atual do programa lucro = paginaLucro.getLucro(); String dados = String.valueOf(lucro); byte[] dadosByte = dados.getBytes(); Path arquivo = Paths.get("lucro.txt"); try { Files.write(arquivo, dadosByte); System.out.println("Escrevi lucro antes de fechar o programa"); quantidadeMotos = 0; quantidadeCarros = 0; quantidadeVans = 0; quantidadeCarretas = 0; //Tratando agora os veiculos que estao em viagem (devem ser retornados a frota) arquivo = Paths.get("viagem-andamento.txt"); byte[] dadosBytes = Files.readAllBytes(arquivo); dados = new String(dadosBytes); String[] arquivoSeparado = dados.split("#"); quantidadeMotos = Integer.parseInt(arquivoSeparado[0]); quantidadeCarros = Integer.parseInt(arquivoSeparado[1]); quantidadeVans = Integer.parseInt(arquivoSeparado[2]); quantidadeCarretas = Integer.parseInt(arquivoSeparado[3]); //Se houver viagens sendo executadas, exibiremos o botao de alerta para o usuario escolher se realmente vai fechar o programa if(quantidadeMotos>0||quantidadeCarros>0||quantidadeVans>0||quantidadeCarretas>0) { Alerta alerta = new Alerta(); //1 thread para apresentar a nova janela e continuar rodando o programa e a outra para pausar o sistema enquanto a escolha acontece new Thread() { @Override public void run() { alerta.setVisible(true); } }.start(); //2 thread decidir se o programa ira fechar ou nao e fazer os respectivos tratamentos new Thread() { @Override public void run() { while(alerta.getEscolha()==-1) { try { Thread.sleep(10); } catch (InterruptedException ex) { System.out.println("Deu erro ao pausar o programa"); } } //Se escolhido 0, o programa fecha e nao precisa alterar nada if(alerta.getEscolha()==0) { alerta.dispose(); alerta.setEscolha(-1); System.out.println("O programa nao ira fazer nada"); } //Depois de escolhido, o programa deve devolver os veiculos a frota e depois deve ser finalizado if(alerta.getEscolha()==1){ System.out.println("Entrou aquii!"); Path arquivo = Paths.get("frota.txt"); try { byte[] dadosBytes = Files.readAllBytes(arquivo); String dados = new String(dadosBytes); String[] arquivoSeparado = dados.split("#"); quantidadeMotos += Integer.parseInt(arquivoSeparado[0]); quantidadeCarros += Integer.parseInt(arquivoSeparado[1]); quantidadeVans += Integer.parseInt(arquivoSeparado[2]); quantidadeCarretas += Integer.parseInt(arquivoSeparado[3]); String frotaAtualizada = quantidadeMotos+"#"+quantidadeCarros+"#"+quantidadeVans+"#"+quantidadeCarretas; //Reescrevendo arquivo frota devolvendo veiculos dadosBytes = frotaAtualizada.getBytes(); Files.write(arquivo, dadosBytes); //Reescrevendo arquivo viagem-andamento zerando veiculos que estao em viagem arquivo = Paths.get("viagem-andamento.txt"); String zerandoVeiculos = 0+"#"+0+"#"+0+"#"+0; dadosBytes = zerandoVeiculos.getBytes(); Files.write(arquivo, dadosBytes); System.out.println("Veiculos que estavam em viagem sao devolvidos a frota!"); //Fechando programa System.exit(1); } catch(Exception erro) { System.out.println("Deu ruim!"); } } } }.start(); } else { //Fechando programa caso nao tenha nenhuma viagem em andamento System.exit(1); } } catch(Exception erro) { System.out.println("Arquivo não encontrado!"); } } }); } public double getLucro() { return lucro; } public void setLucro(double lucro) { this.lucro = lucro; } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btnNovaEntrega = new javax.swing.JButton(); btnHistorico = new javax.swing.JButton(); btnAlterarFrota = new javax.swing.JButton(); btnAlterarMargemLucro = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); getContentPane().setLayout(null); btnNovaEntrega.setIcon(new javax.swing.ImageIcon(getClass().getResource("/chargex/adicionar.png"))); // NOI18N btnNovaEntrega.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/chargex/adicionar.png"))); // NOI18N btnNovaEntrega.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNovaEntregaActionPerformed(evt); } }); getContentPane().add(btnNovaEntrega); btnNovaEntrega.setBounds(30, 40, 90, 40); btnHistorico.setIcon(new javax.swing.ImageIcon(getClass().getResource("/chargex/historico.png"))); // NOI18N btnHistorico.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnHistoricoActionPerformed(evt); } }); getContentPane().add(btnHistorico); btnHistorico.setBounds(30, 130, 90, 40); btnAlterarFrota.setIcon(new javax.swing.ImageIcon(getClass().getResource("/chargex/atualizar.png"))); // NOI18N btnAlterarFrota.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAlterarFrotaActionPerformed(evt); } }); getContentPane().add(btnAlterarFrota); btnAlterarFrota.setBounds(30, 230, 90, 40); btnAlterarMargemLucro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/chargex/editar.png"))); // NOI18N btnAlterarMargemLucro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAlterarMargemLucroActionPerformed(evt); } }); getContentPane().add(btnAlterarMargemLucro); btnAlterarMargemLucro.setBounds(30, 330, 90, 40); jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/chargex/transportadora.png"))); // NOI18N getContentPane().add(jLabel3); jLabel3.setBounds(-30, -3, 980, 470); jButton1.setText("jButton1"); getContentPane().add(jButton1); jButton1.setBounds(270, 120, 97, 29); pack(); }// </editor-fold>//GEN-END:initComponents private void btnHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHistoricoActionPerformed historico.lerArquivo(); historico.alterarTexto(); historico.atualizarLucroTotal(); historico.setVisible(true); JOptionPane.showMessageDialog(null, "\nA viagem só é armazenada no histórico após acabar o tempo da viagem.\n\nPara visualizar os veículos que estão em viagem nesse momento, clique no botão Viagens em andamento\n"); }//GEN-LAST:event_btnHistoricoActionPerformed private void btnAlterarMargemLucroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarMargemLucroActionPerformed paginaLucro.setVisible(true); this.lucro = paginaLucro.getLucro(); System.out.println(this.lucro); }//GEN-LAST:event_btnAlterarMargemLucroActionPerformed private void btnAlterarFrotaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarFrotaActionPerformed alterarFrota.setVisible(true); JOptionPane.showMessageDialog(null, "Clique no botão de atualizar após modificar sua frota para visualizar sua frota Atualizada!"); Path caminho = Paths.get("frota.txt"); try { byte[] texto = Files.readAllBytes(caminho); String leitura = new String(texto); alterarFrota.receberFrota(leitura); alterarFrota.separarArquivo(); alterarFrota.atualizarVeiculos(); } catch(Exception erro) { System.out.println("Arquivo não encontrado!"); } }//GEN-LAST:event_btnAlterarFrotaActionPerformed private void btnNovaEntregaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNovaEntregaActionPerformed entrega.setVisible(true); //Atualizando quantidade de veiculos antes de receber dados Nova Entrega Path caminho = Paths.get("frota.txt"); try { byte[] texto = Files.readAllBytes(caminho); String leitura = new String(texto); alterarFrota.receberFrota(leitura); alterarFrota.separarArquivo(); alterarFrota.atualizarVeiculos(); } catch(Exception erro) { System.out.println("Arquivo não encontrado!"); } entrega.MandarFrota(alterarFrota); this.lucro = paginaLucro.getLucro(); entrega.receberLucro(lucro); }//GEN-LAST:event_btnNovaEntregaActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Principal().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnAlterarFrota; private javax.swing.JButton btnAlterarMargemLucro; private javax.swing.JButton btnHistorico; private javax.swing.JButton btnNovaEntrega; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel3; // End of variables declaration//GEN-END:variables void setIconeImage(String iconepng) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
640dcdfa9cd0a5f767ad16b192c2bd27321f6d5d
59ee3eb060ec16266b0c35a1d04d3f41248f778b
/app/src/main/java/com/example/jean/proyectoandroid/Modulo/ListaTarea.java
53a679084d04473fe4bd6333b6041ab52db934f0
[]
no_license
jeanValverde/proyectoAndroid
4f522acd630d1068e3c7fefa8c81cc2ac0c69cff
e2fc2a49dd20282972756ffbe3751f73ae087815
refs/heads/master
2020-06-17T10:49:10.258672
2019-07-08T23:58:38
2019-07-08T23:58:38
195,901,227
0
0
null
null
null
null
UTF-8
Java
false
false
1,048
java
package com.example.jean.proyectoandroid.Modulo; public class ListaTarea { private int idLita; private String descripcion; private String estado; private String idTarea; public ListaTarea() { } public ListaTarea(int idLita, String descripcion, String estado, String idTarea) { this.idLita = idLita; this.descripcion = descripcion; this.estado = estado; this.idTarea = idTarea; } public int getIdLita() { return idLita; } public void setIdLita(int idLita) { this.idLita = idLita; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } public String getIdTarea() { return idTarea; } public void setIdTarea(String idTarea) { this.idTarea = idTarea; } }
5650796f2e8e989c31785d0da379cd2fd4d19517
7f07b3038e6e32552ea697cbc16d8f3d5020eb93
/app/src/main/java/com/example/sports/IndexActivity.java
e467f0f659becd1e613fbb87dd2a7918680ae146
[]
no_license
Yaozu-Xu/Android
24b693fd2f9dbcdebd55c53c3fa463d6bedf746c
fee1e7a157c54d1a47e4322a58b287cac3d8f5b4
refs/heads/master
2022-02-09T00:29:51.256518
2019-06-13T07:58:50
2019-06-13T07:58:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,245
java
package com.example.sports; import android.content.Intent; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import org.litepal.LitePal; import db.Record; public class IndexActivity extends AppCompatActivity { Button home; Button recordBtn; Button analysis; Button createBtn; TextView userText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.index_layout); Intent received = getIntent(); String userName = received.getStringExtra("userName"); home = findViewById(R.id.home); recordBtn = findViewById(R.id.record); analysis = findViewById(R.id.analysis); userText = findViewById(R.id.name_text); createBtn = findViewById(R.id.record_create_btn); // 设置当前标签 home.setTextColor(this.getResources().getColor(R.color.colorOrange)); // 设置用户名 userText.setText(userName); // 导航栏按钮 recordBtn.setOnClickListener(e->{ Intent intent = new Intent(IndexActivity.this, RecordActivity.class); startActivity(intent); }); analysis.setOnClickListener(e->{ Intent intent = new Intent(IndexActivity.this, AnalysisActivity.class); startActivity(intent); }); // 创建记录 createBtn.setOnClickListener(e->{ // 弹出框 AlertDialog.Builder builder = new AlertDialog.Builder(IndexActivity.this); View alertView = LayoutInflater.from(IndexActivity.this).inflate(R.layout.alert_layout, null); AlertDialog dialog = builder.setTitle("New Record").setView(alertView).show(); // 找到元素 EditText duration_text = alertView.findViewById(R.id.duration_text); EditText distance_text = alertView.findViewById(R.id.distance_text); Spinner sp = alertView.findViewById(R.id.sports_spinner); Button submitBtn = alertView.findViewById(R.id.record_submit_btn); // 绑定事件 submitBtn.setOnClickListener(e1->{ // 取值 String duration = String.valueOf(duration_text.getText()); String distance = String.valueOf(distance_text.getText()); String sport = sp.getSelectedItem().toString(); // 数据库操作 LitePal.getDatabase(); Record record = new Record(); record.setRecordTime(Record.getCurrentTime()); record.setDuration(duration); record.setSport(sport); record.setDistance(distance); record.setName(userName); record.save(); dialog.dismiss(); Toast.makeText(getApplicationContext(), "Create new record", Toast.LENGTH_LONG).show(); }); }); } }
2d9ec3068801d1f8d9a2f10cd9d04ef1833ad7c5
b44018861005dff02b9174a13144b12059e5865d
/src/main/java/jetbrick/io/resource/AbstractResource.java
88f1ffed18127d45a3f7795f742d293265be128e
[ "Apache-2.0" ]
permissive
gyk001/jetbrick-commons
40fe94802e51c03f1e1de136b2acd76a31aa710b
751bf934f01b93ad341be7ada99550350f4b8cd9
refs/heads/master
2020-04-05T23:18:54.682711
2015-05-24T05:10:49
2015-05-24T05:10:49
36,156,711
0
0
null
2015-05-24T04:57:15
2015-05-24T04:57:15
null
UTF-8
Java
false
false
3,188
java
/** * Copyright 2013-2014 Guoqiang Chen, Shanghai, China. All rights reserved. * * Author: Guoqiang Chen * Email: [email protected] * WebURL: https://github.com/subchen * * 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 jetbrick.io.resource; import java.io.File; import java.net.URI; import java.net.URL; import java.nio.charset.Charset; import jetbrick.io.IoUtils; import jetbrick.util.PathUtils; public abstract class AbstractResource implements Resource { protected String relativePathName; @Override public void setRelativePathName(String relativePathName) { this.relativePathName = relativePathName; } @Override public String getRelativePathName() { return relativePathName; } /** * @deprecated replaced by {@link #setRelativePathName(String)} */ @Deprecated public void setPath(String path) { this.relativePathName = path; } /** * @deprecated replaced by {@link #getRelativePathName()} */ @Deprecated @Override public String getPath() { return relativePathName; } @Override public byte[] toByteArray() throws ResourceNotFoundException { return IoUtils.toByteArray(openStream()); } @Override public char[] toCharArray(Charset charset) throws ResourceNotFoundException { return IoUtils.toCharArray(openStream(), charset); } @Override public String toString(Charset charset) throws ResourceNotFoundException { return IoUtils.toString(openStream(), charset); } @Override public File getFile() throws UnsupportedOperationException { return PathUtils.urlAsFile(getURL()); } @Override public URI getURI() throws UnsupportedOperationException { try { return getURL().toURI(); } catch (java.net.URISyntaxException e) { throw new IllegalStateException(e); } } @Override public URL getURL() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } @Override public String getFileName() { int slash = relativePathName.lastIndexOf('/'); if (slash >= 0) { return relativePathName.substring(slash + 1); } return relativePathName; } @Override public boolean exist() { return false; } @Override public boolean isDirectory() { return false; } @Override public boolean isFile() { return false; } @Override public long length() { return -1; } @Override public long lastModified() { return 0; } }
235df906d781993c099c7882ccf0d3122df5a03c
e727905fda5d16d13c3f2b871adb6c353ca22e0f
/src/main/java/com/jizhela/helloworld/controller/IndexController.java
2030757312215f0573cf51c0f9e39d2fa4a9b728
[]
no_license
malcolmlu1985/helloworld
977c672c41c819242ace349d4120cbb53f7a8dd3
3c267a67f0129ddf69fac24e7c8aaa6c1402eb40
refs/heads/master
2021-01-11T21:16:39.950166
2017-02-02T05:39:57
2017-02-02T05:39:57
78,754,764
0
0
null
null
null
null
UTF-8
Java
false
false
3,125
java
package com.jizhela.helloworld.controller; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import com.jizhela.helloworld.bean.User; //restcontroller是返回实体,controller是视图路径 @Controller @RequestMapping ( "/index" ) public class IndexController { private static final Logger logger = LoggerFactory.getLogger(IndexController.class); //使用指定类初始化日志对象,在日志输出的时候,可以打印出日志信息所在类 //如:Logger logger = LoggerFactory.getLogger(Actions.class); // logger.debug("日志信息"); //将会打印出: Actions : 日志信息 @Value(value = "${malcolm.secret}") private String secret; @RequestMapping public String index() { return "hello world~"; } @RequestMapping ( "/get" ) public Map<String, String> get( @RequestParam String name) { Map<String, String> map = new HashMap<String, String>(); map.put("name", name); map.put("value", "hello world~"); map.put("secret", secret); return map; } @RequestMapping ( "/find/{id}/{name}" ) public User get( @PathVariable int id, @PathVariable String name) { User user = new User(); user.setId(id); user.setName(name); user.setDate(new Date()); return user; } //web+freemarker @RequestMapping ( "/getFreeMarker/{id}/{name}" ) public String getFreeMarker( @PathVariable int id, @PathVariable String name, ModelMap model) { User user = new User(); user.setId(id); user.setName(name); user.setDate(new Date()); model.put("user", user); return "web"; //返回的内容就是templetes下面文件的名称 } @RequestMapping ( "/hello/{id}/{name}" ) public String hello( @PathVariable int id, @PathVariable String name,ModelMap model){ logger.info("这里是IndexController"); model.put("title", "Hello World Title"); model.put("name", name); model.put("id",id);//gender:性别,1:男;0:女; model.put("date",new Date());//gender:性别,1:男;0:女; List<Map<String,Object>> friends =new ArrayList<Map<String,Object>>(); Map<String,Object> friend = new HashMap<String,Object>(); friend.put("name", "张三"); friend.put("id", 20); friend.put("date", new Date()); friends.add(friend); friend = new HashMap<String,Object>(); friend.put("name", "李四"); friend.put("id", 20); friend.put("date", new Date()); friends.add(friend); model.put("friends", friends); return "hello"; } }
2aa82b2775c42a40298f7eb12598dea567045ac4
96652d81a751109e496940e7a0af93b79e0c2144
/ManhCuong/gui/Frame.java
b045323768b2e070869af89a732552a5d0c2ab6e
[]
no_license
manhcuongcvp/Bomber_man
5de59f96a533bfd7ddf85bd7bd1e2f5b17f688dd
e90b0dbb0673edfefc5a582eb6ae6df94b500f02
refs/heads/master
2023-01-24T08:04:09.075390
2020-11-28T00:56:40
2020-11-28T00:56:40
316,629,734
0
0
null
null
null
null
UTF-8
Java
false
false
1,885
java
package ManhCuong.gui; import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JPanel; import ManhCuong.Game; import ManhCuong.gui.menu.Menu; import ManhCuong.audio.Audio; public class Frame extends JFrame { public GamePanel _gamepane; private JPanel _containerpane; private InfoPanel _infopanel; private final Audio _audio = new Audio(); private Game _game; public Frame() { setJMenuBar(new Menu(this)); _containerpane = new JPanel(new BorderLayout()); _gamepane = new GamePanel(this); _infopanel = new InfoPanel(_gamepane.getGame()); _containerpane.add(_infopanel, BorderLayout.PAGE_START); _containerpane.add(_gamepane, BorderLayout.PAGE_END); _game = _gamepane.getGame(); add(_containerpane); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); _audio.playSound("res/sounds/audiopb.wav",100); _game.start(); } /* |-------------------------------------------------------------------------- | Game Related |-------------------------------------------------------------------------- */ public void newGame() { _game.getBoard().newGame(); } public void changeLevel(int i) { _game.getBoard().changeLevel(i); } public void pauseGame() { _game.getBoard().gamePause(); } public void resumeGame() { _game.getBoard().gameResume(); } public boolean isRunning() { return _game.isRunning(); } public void setTime(int time) { _infopanel.setTime(time); } public void setLives(int lives) { _infopanel.setLives(lives); } public void setPoints(int points) { _infopanel.setPoints(points); } public boolean validCode(String str) { return _game.getBoard().getLevel().validCode(str) != -1; } public void changeLevelByCode(String str) { _game.getBoard().changeLevelByCode(str); } }
efbc15a59fe8da31332d2f9056d15494f56a8ee8
62b8482e2eeff1b09091196d85a98425de3ba91a
/src/com/lcqjoyce/service/PermissionsService.java
e6e05494f3ae3547d05d3b8954ecf88d36e59569
[]
no_license
Garibel-Lee/NJWB_OA
69df76307cb15798e18383869c89305273ddf8a0
c34bba7d3bf0cd6d696d7e906c803c25bcfd80e9
refs/heads/master
2022-04-12T19:49:52.495827
2020-03-16T04:54:07
2020-03-16T04:54:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package com.lcqjoyce.service; import com.lcqjoyce.entity.Menu; import java.util.List; import java.util.Map; public interface PermissionsService { public Map<Menu, List<Menu>> listAll(Integer roleId); }
1c22ddf849975479fb2f189b1d1352452fd379de
fbe41b3e52f943a60267598ee5ad5f62c5c8fecd
/InversionCount.java
fb4760dcae7502e7b198bcfb1f8894766549f1ee
[]
no_license
ahujasherry/JAVA
17b07879b5b47162298bbf803f0ef0732db466aa
7501bec1a91a0c4eda9b8f90c1496c9095304c04
refs/heads/master
2023-04-05T18:16:07.871676
2021-04-14T10:53:58
2021-04-14T10:53:58
303,380,163
1
0
null
null
null
null
UTF-8
Java
false
false
1,222
java
//find inversion pairs in array. We using enhanced merge sort private static int mergeAndCount(int[] arr, int l, int m, int r) { // Left subarray int[] left = Arrays.copyOfRange(arr, l, m + 1); // Right subarray int[] right = Arrays.copyOfRange(arr, m + 1, r + 1); int i = 0, j = 0, k = l, inv= 0; while (i < left.length && j < right.length) { if (left[i] <= right[j]) arr[k++] = left[i++]; else { arr[k++] = right[j++]; inv+= m-i; } } return inv; } // Merge sort function private static int mergeSortAndCount(int[] arr, int l, int r) { int count = 0; if (l < r) { int m = (l + r) / 2; // Left subarray count count += mergeSortAndCount(arr, l, m); // Right subarray count count += mergeSortAndCount(arr, m + 1, r); // Merge count count += mergeAndCount(arr, l, m, r); } return count; }
9d4fabdece4667af2440b753349139aa2e594a52
584ea826de6fc9e073b936f16d716eda5bce3614
/app/src/main/java/com/example/w10/loginregister2/RecyclerAdapter.java
130f44703e457b3d9f45f5d0102a602fe23a0730
[]
no_license
gaurav138/ConnectingIndiaDigitally
5b0024ebdf55ca61b06f46913ba04bc70cff049f
3e0069f857d2787dee22d9e30432c6a3df5145bb
refs/heads/master
2020-03-10T23:54:19.396167
2018-04-15T21:04:08
2018-04-15T21:04:08
129,650,541
0
0
null
null
null
null
UTF-8
Java
false
false
4,360
java
package com.example.w10.loginregister2; /** * Created by W10 on 13-Mar-17. */ import android.app.AlertDialog; import android.content.DialogInterface; import android.support.v7.widget.RecyclerView; import android.text.Layout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import static java.security.AccessController.getContext; /** * Created by W10 on 04-Mar-17. */ public class RecyclerAdapter extends RecyclerView.Adapter <RecyclerAdapter.RecyclerViewHolder> { private static final int TYPE_HEAD=0; private static final int TYPE_LIST=1; ArrayList<Fruit> arrayList= new ArrayList<>(); public RecyclerAdapter(ArrayList<Fruit> arrayList) { this.arrayList=arrayList; } @Override public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if(viewType==TYPE_HEAD) { View view=LayoutInflater.from(parent.getContext()).inflate(R.layout.header_layout,parent,false); RecyclerViewHolder recyclerViewHolder=new RecyclerViewHolder(view,viewType); return recyclerViewHolder; } else if(viewType==TYPE_LIST) { View view=LayoutInflater.from(parent.getContext()).inflate(R.layout.row_layout,parent,false); RecyclerViewHolder recyclerViewHolder=new RecyclerViewHolder(view,viewType); return recyclerViewHolder; } return null; } @Override public void onBindViewHolder(RecyclerViewHolder holder, int position) { if(holder.viewType==TYPE_LIST) { Fruit fruit=arrayList.get(position-1); holder.No.setText(Integer.toString(fruit.getNo())); holder.Exam_name.setText(fruit.getExam_name()); holder.Date.setText(fruit.getDate()); holder.Info.setText(fruit.getInfo()); } } @Override public int getItemCount() { return arrayList.size()+1 ; } public static class RecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView Exam_name,Date,Info,No; int viewType; public RecyclerViewHolder(View view,int viewType) { super(view); if(viewType==TYPE_LIST) { No= (TextView) view.findViewById(R.id.no); Exam_name= (TextView) view.findViewById(R.id.exam_name); Date= (TextView) view.findViewById(R.id.date); Info= (TextView) view.findViewById(R.id.info); this.viewType=TYPE_LIST; view.setOnClickListener(this); } else if(viewType==TYPE_HEAD) { this.viewType=TYPE_HEAD; } } @Override public void onClick(View v) { /*AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext()); builder.setMessage("Please enter a valid email") .setNegativeButton("Retry", null) .create() .show();*/ /* AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext()); builder.setIcon(android.R.drawable.sym_def_app_icon); builder.setCancelable(false); builder.setTitle("Do you want to get notification ?"); builder.setMessage("you will receive a notification about an event on that day for every event... "); builder.setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.setNegativeButton("NO", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alertDialog=builder.create(); alertDialog.show(); */ } } @Override public int getItemViewType(int position) { if(position==0) return TYPE_HEAD; return TYPE_LIST; } }
cd3650f4ff11ad3b936c0153066069d666a6981f
1f268ea50698d7b48c6ea2fe35a6e2a56d5dd6f5
/pml_api/lib/Jena-2.5.6/src/com/hp/hpl/jena/db/test/TestReifier.java
3eab4b02b158a0b7a858b8a091f46be859b3ce4f
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
paulopinheiro1234/inference-web
ece8dcb2aa383120f0557655c403c6216fb086c3
6b1fe6c500e4904ece40dcd01b704f0a9ac0c672
refs/heads/master
2020-04-15T20:45:00.864333
2019-01-10T07:19:43
2019-01-10T07:19:43
165,006,572
0
0
null
null
null
null
UTF-8
Java
false
false
3,654
java
/* (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP [See end of file] $Id: TestReifier.java,v 1.22 2008/01/02 12:08:14 andy_seaborne Exp $ */ package com.hp.hpl.jena.db.test; import com.hp.hpl.jena.db.*; import com.hp.hpl.jena.graph.*; import com.hp.hpl.jena.graph.test.*; import com.hp.hpl.jena.shared.*; import junit.framework.*; /** Derived from the original reifier tests, and then folded back in by using an abstract test base class. @author kers, csayers. */ public class TestReifier extends AbstractTestReifier { private int count; private Graph properties; private IDBConnection con; public TestReifier( String name ) { super(name); } /** Initialiser required for MetaTestGraph interface. */ public TestReifier( Class graphClass, String name, ReificationStyle style ) { super( name ); } public static TestSuite suite() { return MetaTestGraph.suite( TestReifier.class, LocalGraphRDB.class ); } /** LocalGraphRDB - an extension of GraphRDB that fixes the connection to TestReifier's connection, passes in the appropriate reification style, uses the default properties of the connection, and gives each graph a new name exploiting the count. @author kers */ public class LocalGraphRDB extends GraphRDB { public LocalGraphRDB( ReificationStyle style ) { super( con, "testGraph-" + count ++, properties, styleRDB( style ), true ); } } public void setUp() { con = TestConnection.makeAndCleanTestConnection(); properties = con.getDefaultModelProperties().getGraph(); } public void tearDown() throws Exception { con.close(); } public Graph getGraph( ReificationStyle style ) { return new LocalGraphRDB( style ); } public Graph getGraph() { return getGraph( ReificationStyle.Minimal ); } } /* (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
6cdc44cc0158870adb1f8669d9445444a9dcd551
5a030186954a48919d200541d02df4b8ad60d907
/oa-performance/src/main/java/com/wantai/oa/performance/common/impl/BasicServiceImpl.java
ebe210cd315b29f9c729d1f133d8a487b17ff57d
[]
no_license
msphell/oa
a1db120e567eba87250a92f6e4a36fd152abe75b
f35dbd51f95a7198cba8f73aef6d2daa14d30c7a
refs/heads/master
2021-01-17T18:10:44.183245
2016-01-19T01:53:20
2016-01-19T01:53:20
49,960,115
1
0
null
2016-01-19T15:01:28
2016-01-19T15:01:28
null
UTF-8
Java
false
false
11,592
java
/** * Wantai.com Inc. * Copyright (c) 2004-2012 All Rights Reserved. */ package com.wantai.oa.performance.common.impl; import com.wantai.oa.auth.core.UserHolder; import com.wantai.oa.biz.shared.service.BaseService; import com.wantai.oa.biz.shared.vo.BasicConfigVO; import com.wantai.oa.biz.shared.vo.RevenueVO; import com.wantai.oa.common.dal.mappings.dos.performance.ConfigDo; import com.wantai.oa.common.dal.mappings.dos.performance.RevenueDo; import com.wantai.oa.common.dal.mappings.dos.performance.SubConfigDo; import com.wantai.oa.common.lang.constants.Constants; import com.wantai.oa.common.lang.enums.CustomerTypeEnum; import com.wantai.oa.common.util.ObjectUtils; import com.wantai.oa.performance.common.BasicService; import com.wantai.oa.performance.common.ConfigService; import com.wantai.oa.performance.common.request.BasicRequest; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 配置服务 * * @author maping.mp * @version $Id: BasicServiceImpl.java, v 0.1 2015-1-04 下午10:55:39 maping.mp Exp $ */ @Service public class BasicServiceImpl extends BaseService implements BasicService { /** 配置服务*/ @Autowired private ConfigService configService; @Override public void addBasicConfig(BasicRequest request) { execute(() -> { String customerId = request.getCustomerId(); //更新工龄工资设置 updateWorkSalary(customerId, request.getWorkYearSalary(), request.getMaxSalaryPerMonth()); //更新社保设置 updateSocialConfig(customerId, request.getSocailBasic(), request.getSocailPercent()); //更新公积金设置 updateGjjConfig(customerId, request.getGjjBasic(), request.getGjjPercent()); //更新个税设置 updateTaxConfig(request); }); } @Override public BasicConfigVO queryBasicConfig(String companyCode, String companyId) { BasicConfigVO configVO = new BasicConfigVO(); //查询工龄工资设置 SubConfigDo salary = configService.querySingleSubConfig(companyCode, companyId, Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_GLGZ_EVENT, Constants.WORKYEAR_SALARY, null); configVO.setWorkYearSalary(salary.getValue()); configVO.setMaxSalaryPerMonth(salary.getToValue()); //查询个税起征点数据 queryRevenueStart(configVO); //查询个税数据 queryRevenueList(configVO); //查询社保设置 querySocialConfig(companyCode, companyId, configVO); //查询公积金设置 queryGjjConfig(companyCode, companyId, configVO); return configVO; } /** * 查询公积金设置 * @param companyCode 公司编号 * @param companyId 公司id * @param configVO 公共配置VO对象 */ private void queryGjjConfig(String companyCode, String companyId, BasicConfigVO configVO) { SubConfigDo wjjBasic = configService.querySingleSubConfig(companyCode, companyId, Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_GJJ_EVENT, Constants.GJJ_BASIC, null); configVO.setGjjBasic(wjjBasic.getValue()); SubConfigDo wjjRatio = configService.querySingleSubConfig(companyCode, companyId, Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_GJJ_EVENT, Constants.GJJ_RATIO, null); configVO.setGjjPercent(wjjRatio.getValue()); } /** * 查询社保设置 * @param companyCode 公司编号 * @param companyId 公司id * @param configVO 公共配置VO对象 */ private void querySocialConfig(String companyCode, String companyId, BasicConfigVO configVO) { SubConfigDo socialBasic = configService.querySingleSubConfig(companyCode, companyId, Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_SOCIAL_EVENT, Constants.SOCIAL_BASIC, null); configVO.setSocailBasic(socialBasic.getValue()); SubConfigDo socialRatio = configService.querySingleSubConfig(companyCode, companyId, Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_SOCIAL_EVENT, Constants.SOCIAL_RATIO, null); configVO.setSocailPercent(socialRatio.getValue()); } /** * 查询个税数据列表 * @param configVO 当前公共配置VO */ private void queryRevenueList(BasicConfigVO configVO) { Map<String, Object> paramter = new HashMap(); paramter.put("key", Constants.REVENUE_START); paramter.put("companyCode", UserHolder.getUser().getCompanyCode()); paramter.put("companyId", UserHolder.getUser().getCompanyId()); List<RevenueDo> revenueDoList = (List<RevenueDo>) commonDAO.findAll("Revenue.queryRevenue", paramter); if (CollectionUtils.isNotEmpty(revenueDoList)) { List<RevenueVO> voList = new ArrayList<>(); revenueDoList.forEach(revenueDo -> { RevenueVO vo = new RevenueVO(); vo.setFromValue(revenueDo.getFromValue()); vo.setToValue(revenueDo.getToValue()); vo.setRatio(revenueDo.getRatio()); vo.setDeducts(revenueDo.getDeducts()); voList.add(vo); }); configVO.setRevenueVOList(voList); } else { configVO.setRevenueVOList(new ArrayList<>()); } } /** * 设置个税起征点 * @param configVO 当前公共配置VO */ private void queryRevenueStart(BasicConfigVO configVO) { Map<String, Object> paramter = new HashMap(); paramter.put("key", Constants.REVENUE_START); paramter.put("companyCode", UserHolder.getUser().getCompanyCode()); paramter.put("companyId", UserHolder.getUser().getCompanyId()); String start = (String) commonDAO.selectOne("SystemConfig.query", paramter); configVO.setStart(start); } /** * 更新个税设置 * @param request 请求对象 */ private void updateTaxConfig(BasicRequest request) { //更新个税起征点 Map<String, Object> paramter = new HashMap(); paramter.put("key", Constants.REVENUE_START); paramter.put("value", request.getStart()); paramter.put("companyCode", UserHolder.getUser().getCompanyCode()); paramter.put("companyId", UserHolder.getUser().getCompanyId()); commonDAO.update("SystemConfig.update", paramter); //更新个税配置表(先删除,在新增) commonDAO.delete("Revenue.delete", paramter); if (CollectionUtils.isNotEmpty(request.getRevenueVOList())) { request.getRevenueVOList().forEach(taxVO -> { Map<String, Object> data = new HashMap(); ObjectUtils.populate(taxVO, data); data.put("companyCode", UserHolder.getUser().getCompanyCode()); data.put("companyId", UserHolder.getUser().getCompanyId()); data.put("operator", UserHolder.getUser().getLoginName()); data.put("lastModifiedOperator", UserHolder.getUser().getLoginName()); commonDAO.insert("Revenue.add", data); }); } } /** * * 创建参数 * * @param customerId 客户编号 * @param businessConfigId 配置编号 * @param subEventCode 子事件编码 * @param value 事件值 * @return 返回paramter参数 */ private Map<String, Object> createParameter(String customerId, String businessConfigId, String subEventCode, String value) { Map<String, Object> paramter = new HashMap(); String target = CustomerTypeEnum.COMPANY.getCode(); if (StringUtils.isNotBlank(customerId)) { target = CustomerTypeEnum.CUSTOMER.getCode(); } paramter.put("businessConfigId", businessConfigId); paramter.put("subEventCode", subEventCode); paramter.put("target", target); paramter.put("customerId", customerId); paramter.put("value", value); return paramter; } @Override public void updateSubConfig(String customerId, String businessConfigId, String subEventCode, String value) { Map<String, Object> paramter = createParameter(customerId, businessConfigId, subEventCode, value); commonDAO.update("SubConfig.updateSubConfig", paramter); } @Override public void updateSubConfig(String customerId, String businessConfigId, String subEventCode, String value, String toValue) { Map<String, Object> paramter = createParameter(customerId, businessConfigId, subEventCode, value); paramter.put("toValue", toValue); commonDAO.update("SubConfig.updateSubConfig", paramter); } /** * 更新社保配置 * @param customerId 客户编号 * @param socialBasic 社保基数 * @param socialRatio 社保缴存比例 */ private void updateSocialConfig(String customerId, String socialBasic, String socialRatio) { ConfigDo configDo = configService.queryConfig(UserHolder.getUser().getCompanyCode(), UserHolder.getUser().getCompanyId() + "", Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_SOCIAL_EVENT); Assert.notNull(configDo, "社保配置对象不能为空"); updateSubConfig(customerId, configDo.getId() + "", Constants.SOCIAL_BASIC, socialBasic); updateSubConfig(customerId, configDo.getId() + "", Constants.SOCIAL_RATIO, socialRatio); } /** * 更新公积金配置 * @param customerId 客户编号 * @param gjjBasic 公积金基数 * @param gjjRatio 公积金缴存比例 */ private void updateGjjConfig(String customerId, String gjjBasic, String gjjRatio) { ConfigDo configDo = configService.queryConfig(UserHolder.getUser().getCompanyCode(), UserHolder.getUser().getCompanyId() + "", Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_GJJ_EVENT); Assert.notNull(configDo, "公积金配置对象不能为空"); updateSubConfig(customerId, configDo.getId() + "", Constants.GJJ_BASIC, gjjBasic); updateSubConfig(customerId, configDo.getId() + "", Constants.GJJ_RATIO, gjjRatio); } /** * 更新工龄工资 * @param customerId 客户编号 * @param salaryPerMonth 每月工龄工资 * @param maxSalaryPerMonth 每月最大工龄工资 */ private void updateWorkSalary(String customerId, String salaryPerMonth, String maxSalaryPerMonth) { ConfigDo configDo = configService.queryConfig(UserHolder.getUser().getCompanyCode(), UserHolder.getUser().getCompanyId() + "", Constants.JCSZ_BIZ_ITEM, Constants.JCSZ_GLGZ_EVENT); Assert.notNull(configDo, "工龄工资配置对象不能为空"); updateSubConfig(customerId, configDo.getId() + "", Constants.WORKYEAR_SALARY, salaryPerMonth, maxSalaryPerMonth); } }
e0f8b93f46624278edfbc0a1b9f8ebba6e322f78
31b46afa16861b259f8780867a5d40ef79041c20
/ClimbingTrainer/app/src/main/java/me/climbingti/climbingtrainer/mainview/hanbgoarding/HangboardFragment.java
4de81d6dc4cf663c53de93fc241be7a4221f0968
[]
no_license
pekka-m/ClimbingApp
f06e3b7f29192516eaa70f858d820340ab284d47
051cea2d48653d9cb53167e7a831c4d1969689d3
refs/heads/master
2021-01-10T05:32:48.283425
2016-02-13T17:44:43
2016-02-13T17:44:43
51,657,357
0
0
null
null
null
null
UTF-8
Java
false
false
2,185
java
package me.climbingti.climbingtrainer.mainview.hanbgoarding; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ExpandableListView; import android.support.v4.util.ArrayMap; import java.util.Date; import me.climbingti.climbingtrainer.common.Injection; import me.climbingti.climbingtrainer.R; import me.climbingti.climbingtrainer.common.Collection; /** * Created by Aleksi on 14.10.2015. */ public class HangboardFragment extends Fragment implements MainViewHangboardContract.View { private static final String ARG_SECTION_NUMBER = "section number"; private MainViewHangboardContract.Presenter presenter; private ExpandableListView listView; public static HangboardFragment newInstance(int sectionNumber) { HangboardFragment fragment = new HangboardFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.main_activity_fragment_list, container, false); listView = (ExpandableListView) rootView.findViewById(R.id.mainActivityFragment_expandableListView); return rootView; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); presenter = new MainviewHangboardPresenter(Injection.createStatisticsInteractor(getContext()), this); presenter.loadHangboardReps(); } @Override public void showHangboardReps(ArrayMap<Date, Collection> hangboardReps) { HangboardDataAdapter adapter = new HangboardDataAdapter(getContext(), hangboardReps); listView.setAdapter(adapter); //expand groups by default for (int i = 0; i < adapter.getGroupCount(); i++) { listView.expandGroup(i); } } }
b3a47edaff74fb6a338e63e4371f8c8b146e9943
22435eee1e46d62f28bac22c6b0672dd38aac1f7
/open-event/src/main/java/org/com/deshao/open/event/ITimerTask.java
d6f3bd66ce425a9da300b02b4c40183f2ef45188
[ "Apache-2.0" ]
permissive
pbting/open-cource
13180894fb3f7b15409fb7076b4b3d7c47182dfd
30dc41030b91ba0a8571dc3e614a4d04e7ee6e56
refs/heads/master
2021-01-21T12:30:49.463286
2018-11-14T12:46:05
2018-11-14T12:46:05
91,796,137
1
0
null
null
null
null
UTF-8
Java
false
false
138
java
package org.com.deshao.open.event; /** * 定时任务 * @author pbting * */ public interface ITimerTask { public void trriger(); }
8c03fa50b98b8fe891899d9465eb77f8170ae221
ea3b9ab73e44e84e42b7d756e660f8076f783dfd
/com.siteview.kernel.core/src/COM/dragonflow/Utils/ParameterParser.java
16915ffcdc7d61419521daff134fc80fe65d3021
[]
no_license
SiteView/NEWECC9.2
b34cf894f9e6fc7136af7d539ebd99bae48ba116
86e95c40fc481c4aad5a2480ac6a08fe64df1cb1
refs/heads/master
2016-09-05T23:05:16.432869
2013-01-17T02:37:46
2013-01-17T02:37:46
5,685,712
0
1
null
null
null
null
UTF-8
Java
false
false
4,302
java
/* * Created on 2005-2-9 3:06:20 * * .java * * History: * */ package COM.dragonflow.Utils; /** * Comment for <code></code> * * @author * @version 0.0 * * */ import java.util.LinkedList; import java.util.StringTokenizer; // Referenced classes of package COM.dragonflow.Utils: // TextUtils public class ParameterParser { private String _paramString; private java.util.List _paramsList; private java.util.List _holdList; private int _shellToEmulate; private boolean _insideQuotedString; private static final String BACKSLASH_LITERAL_MARKER = "SITEVIEW_BACKSLASH_LITERAL"; private static final String QUOTE_LITERAL_MARKER = "SITEVIEW_QUOTE_LITERAL"; static final String UNTERMINATED_STRING_ERROR = "ERROR: UNTERMINATED QUOTED STRING"; public static final int BASH_SHELL = 0; public static final int WINDOWS_SHELL = 1; public ParameterParser(String s) { _paramString = s; _shellToEmulate = 0; } public ParameterParser(String s, int i) throws java.lang.IllegalArgumentException { _paramString = s; if(i < 0 || i > 1) { throw new IllegalArgumentException("Unknown shell"); } else { _shellToEmulate = i; return; } } public java.util.List doParse() { preProcessEscapedCharacters(); java.util.StringTokenizer stringtokenizer = new StringTokenizer(_paramString, " \\\"", true); _paramsList = new LinkedList(); _holdList = new LinkedList(); _insideQuotedString = false; while(stringtokenizer.hasMoreTokens()) { String s = stringtokenizer.nextToken(); if(s.equals("\"")) { if(_insideQuotedString) { addHoldListToParamsList(); } _insideQuotedString = !_insideQuotedString; } else { processToken(s); } } if(_insideQuotedString) { _paramsList.add("ERROR: UNTERMINATED QUOTED STRING"); } return _paramsList; } private void preProcessEscapedCharacters() { _paramString = COM.dragonflow.Utils.TextUtils.replaceString(_paramString, "\\\\", "SITEVIEW_BACKSLASH_LITERALSITEVIEW_BACKSLASH_LITERAL"); _paramString = COM.dragonflow.Utils.TextUtils.replaceString(_paramString, "\\\"", "SITEVIEW_BACKSLASH_LITERALSITEVIEW_QUOTE_LITERAL"); if(_shellToEmulate == 1) { _paramString = COM.dragonflow.Utils.TextUtils.replaceString(_paramString, "\\", "SITEVIEW_BACKSLASH_LITERAL"); } else { _paramString = COM.dragonflow.Utils.TextUtils.replaceString(_paramString, "\\", ""); } } private void processToken(String s) { s = COM.dragonflow.Utils.TextUtils.replaceString(s, "SITEVIEW_BACKSLASH_LITERAL", "\\"); s = COM.dragonflow.Utils.TextUtils.replaceString(s, "SITEVIEW_QUOTE_LITERAL", "\""); if(_insideQuotedString) { _holdList.add(s); } else if(!s.equals(" ")) { _paramsList.add(s); } } private void addHoldListToParamsList() { String s = ""; for(int i = 0; i < _holdList.size(); i++) { s = s + (String)_holdList.get(i); } _paramsList.add(s); _holdList.clear(); } public static String arrayCmdToStringCmd(String as[]) { StringBuffer stringbuffer = new StringBuffer(); for(int i = 0; i < as.length; i++) { if(stringbuffer.length() > 0) { stringbuffer.append(" "); } boolean flag = !as[i].startsWith("\""); if(flag) { stringbuffer.append("\""); } stringbuffer.append(as[i]); if(flag) { stringbuffer.append("\""); } } return stringbuffer.toString(); } }
3b6388bf4108a1ba4930fd060090ff8c61f972a4
7a719cbf4d404efbae62d8734956b198fcb76730
/Algorithms/Implementation/SockMerchant.java
89d39ce5aa43fd0cfb1de9f416da201233d5daa2
[ "MIT" ]
permissive
sridharpanigrahy/Hackerrank
d9a86579a019922386adf0f8bf8c3645b74c0d85
d258ee3a1a3b95c1143ebd376e41b4a8f3d3ade1
refs/heads/master
2023-08-15T06:55:12.746245
2020-09-12T14:35:35
2020-09-12T14:35:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
710
java
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int c[] = new int[n]; for(int c_i=0; c_i < n; c_i++){ c[c_i] = in.nextInt(); } Arrays.sort(c); int a=c[0],pairs=0; boolean flag=true; for(int i=1;i<n;i++) { if(flag&&c[i]==a) { pairs++; flag=false; } else{ a=c[i]; flag=true; } } System.out.println(pairs); } }
c73bccf9f97537e6b11a152be9d7e2440af3d15f
26cf9aaedb7812ff69a156110eef51cbd66ef6a9
/src/model/Listaprecio.java
f62d4bc48471641ce18ada7c8a3fcb308498efc9
[]
no_license
pspfpalacio/ijmComunicaciones
a1b0b8732d949063f9b6a0ae342b1380edbc7ed2
95448703cd178caa9c6a3ad8876a3c4df35a86be
refs/heads/master
2021-06-04T08:58:20.466359
2017-09-04T12:45:37
2017-09-04T12:45:37
101,402,346
0
0
null
2017-09-04T12:45:38
2017-08-25T12:37:21
Java
UTF-8
Java
false
false
4,009
java
package model; import java.io.Serializable; import javax.persistence.*; import DAO.listaPrecio.DAOListaPrecio; import java.util.Date; import java.util.List; /** * The persistent class for the listaprecios database table. * */ @Entity @Table(name="listaprecios") @NamedQuery(name="Listaprecio.findAll", query="SELECT l FROM Listaprecio l") public class Listaprecio implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private Boolean enabled; @Temporal(TemporalType.DATE) private Date fechaAlta; @Temporal(TemporalType.DATE) private Date fechaBaja; @Temporal(TemporalType.DATE) private Date fechaModificacion; private String nombre; //bi-directional many-to-one association to Cliente @OneToMany(mappedBy="listaprecio") private List<Cliente> clientes; //bi-directional many-to-one association to Usuario @ManyToOne @JoinColumn(name="idUsuarioAlta") private Usuario usuario1; //bi-directional many-to-one association to Usuario @ManyToOne @JoinColumn(name="idUsuarioBaja") private Usuario usuario2; //bi-directional many-to-one association to Usuario @ManyToOne @JoinColumn(name="idUsuarioModificacion") private Usuario usuario3; //bi-directional many-to-one association to ListapreciosProducto @OneToMany(mappedBy="listaprecio") private List<ListapreciosProducto> listapreciosProductos; public Listaprecio() { } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public Boolean getEnabled() { return this.enabled; } public void setEnabled(Boolean enabled) { this.enabled = enabled; } public Date getFechaAlta() { return this.fechaAlta; } public void setFechaAlta(Date fechaAlta) { this.fechaAlta = fechaAlta; } public Date getFechaBaja() { return this.fechaBaja; } public void setFechaBaja(Date fechaBaja) { this.fechaBaja = fechaBaja; } public Date getFechaModificacion() { return this.fechaModificacion; } public void setFechaModificacion(Date fechaModificacion) { this.fechaModificacion = fechaModificacion; } public String getNombre() { return this.nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public List<Cliente> getClientes() { return this.clientes; } public void setClientes(List<Cliente> clientes) { this.clientes = clientes; } public Cliente addCliente(Cliente cliente) { getClientes().add(cliente); cliente.setListaprecio(this); return cliente; } public Cliente removeCliente(Cliente cliente) { getClientes().remove(cliente); cliente.setListaprecio(null); return cliente; } public Usuario getUsuario1() { return this.usuario1; } public void setUsuario1(Usuario usuario1) { this.usuario1 = usuario1; } public Usuario getUsuario2() { return this.usuario2; } public void setUsuario2(Usuario usuario2) { this.usuario2 = usuario2; } public Usuario getUsuario3() { return this.usuario3; } public void setUsuario3(Usuario usuario3) { this.usuario3 = usuario3; } public List<ListapreciosProducto> getListapreciosProductos() { return this.listapreciosProductos; } public void setListapreciosProductos(List<ListapreciosProducto> listapreciosProductos) { this.listapreciosProductos = listapreciosProductos; } public ListapreciosProducto addListapreciosProducto(ListapreciosProducto listapreciosProducto) { getListapreciosProductos().add(listapreciosProducto); listapreciosProducto.setListaprecio(this); return listapreciosProducto; } public ListapreciosProducto removeListapreciosProducto(ListapreciosProducto listapreciosProducto) { getListapreciosProductos().remove(listapreciosProducto); listapreciosProducto.setListaprecio(null); return listapreciosProducto; } public List<Cliente> getListadoClientes(){ DAOListaPrecio DAOlistaprecio = new DAOListaPrecio(); List<Cliente> lista = DAOlistaprecio.getListadoClientesLPP(id); return lista; } }
68f231ee03c2cabe33c3007eaa0f1509fdc46b02
3297e47a5561e2fd6473e461f74fd96e0187c29c
/src/fr/mathieubour/minesweeper/packets/PlayerLoginPacket.java
7ec5adcafcb7aee7f34e121528ea6c9153d7d781
[]
no_license
mathieu-bour/3a-minesweeper
d33576a6c9d9b31b47668576fa76b3a011f57db5
7ed1131b525b7b2e80b81696e98f512e514e0d4a
refs/heads/master
2020-07-18T01:15:27.534421
2019-10-14T15:33:30
2019-10-14T15:33:30
206,141,415
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package fr.mathieubour.minesweeper.packets; import fr.mathieubour.minesweeper.game.Player; public class PlayerLoginPacket extends PlayerPacket { public PlayerLoginPacket(Player player) { super(player); } }
3c6b2bdee8e4728012f6813940cedd031d10aa01
04b2e8f00de863e933087eda54b48ed89ce6861a
/java/me/yochran/yocore/ranks/Rank.java
14e47c11634607797fb23402068e0697039d48bb
[]
no_license
AndyReckt/yoCore
0834140a922e4d8c8538a87025568a5ca51cdfb8
2cce4a48a3c24a269c825663d7a9d41b4eba8860
refs/heads/main
2023-08-25T02:22:01.038315
2021-10-12T23:54:38
2021-10-12T23:54:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,628
java
package me.yochran.yocore.ranks; import me.yochran.yocore.grants.Grant; import me.yochran.yocore.management.PermissionManagement; import me.yochran.yocore.permissions.Permissions; import me.yochran.yocore.player.yoPlayer; import me.yochran.yocore.utils.Utils; import me.yochran.yocore.yoCore; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.permissions.Permission; import org.bukkit.scoreboard.Team; import java.util.*; public class Rank { private final yoCore plugin = yoCore.getInstance(); private final PermissionManagement permissionManagement = new PermissionManagement(); private String ID; private String prefix; private String color; private String display; private String tabIndex; private ItemStack grantItem; private boolean isDefault; private static final Map<String, Rank> ranks; static { ranks = new LinkedHashMap<>(); } public Rank(String ID, String prefix, String color, String display, String tabIndex, ItemStack grantItem, boolean isDefault) { this.ID = ID; this.prefix = prefix; this.color = color; this.display = display; this.tabIndex = tabIndex; this.grantItem = grantItem; this.isDefault = isDefault; } public static Map<String, Rank> getRanks() { return ranks; } public static Rank getRank(String name) { return getRanks().get(name.toUpperCase()); } public String getID() { return ID; } public String getPrefix() { return prefix; } public String getColor() { return color; } public String getDisplay() { return display; } public String getTabIndex() { return tabIndex; } public ItemStack getGrantItem() { return grantItem; } public boolean isDefault() { return isDefault; } public String getGrantPermission() { return "yocore.grant." + getID().toLowerCase(); } public void setPrefix(String prefix) { this.prefix = prefix; plugin.getConfig().set("Ranks." + getID() + ".Prefix", getPrefix()); plugin.saveConfig(); } public void setColor(String color) { this.color = color; plugin.getConfig().set("Ranks." + getID() + ".Color", getColor()); plugin.saveConfig(); } public void setDisplay(String display) { this.display = display; plugin.getConfig().set("Ranks." + getID() + ".Display", getDisplay()); plugin.saveConfig(); } public void setTabIndex(String tabIndex) { this.tabIndex = tabIndex; plugin.getConfig().set("Ranks." + getID() + ".TabIndex", getTabIndex()); plugin.saveConfig(); } public void setGrantItem(ItemStack grantItem) { this.grantItem = grantItem; plugin.getConfig().set("Ranks." + getID() + ".GrantItem", Utils.getColoredItemData(getGrantItem(), getGrantItem().getType().toString())); plugin.saveConfig(); } public void setIsDefault(boolean isDefault) { this.isDefault = isDefault; plugin.getConfig().set("Ranks." + getID() + ".Default", isDefault()); plugin.saveConfig(); } public void create() { plugin.getConfig().set("Ranks." + getID() + ".ID", getID()); plugin.getConfig().set("Ranks." + getID() + ".Prefix", getPrefix()); plugin.getConfig().set("Ranks." + getID() + ".Color", getColor()); plugin.getConfig().set("Ranks." + getID() + ".Display", getDisplay()); plugin.getConfig().set("Ranks." + getID() + ".TabIndex", getTabIndex()); plugin.getConfig().set("Ranks." + getID() + ".GrantItem", Utils.getColoredItemData(getGrantItem(), getGrantItem().getType().toString())); plugin.getConfig().set("Ranks." + getID() + ".Default", isDefault()); plugin.saveConfig(); Permission permission = new Permission("yocore.grant." + getID().toLowerCase()); permission.setDescription("Permission"); if (!Permissions.getAllServerPermissions().contains(permission)) plugin.getServer().getPluginManager().addPermission(permission); plugin.permissionsData.config.set("Ranks." + getID() + ".Permissions", new ArrayList<>()); plugin.permissionsData.saveData(); for (Player players : Bukkit.getOnlinePlayers()) { for (Team team : players.getScoreboard().getTeams()) players.getScoreboard().getTeam(team.getName()).unregister(); } getRanks().put(getID(), this); } public void delete() { Rank lowestRank = Rank.getRank("default"); for (Map.Entry<String, Rank> entry : Rank.getRanks().entrySet()) { if (entry.getValue().isDefault()) lowestRank = entry.getValue(); } for (String player : plugin.playerData.config.getKeys(false)) { yoPlayer yoPlayer = new yoPlayer(UUID.fromString(player)); if (yoPlayer.getRank() == this) Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "setrank " + yoPlayer.getPlayer().getName() + " " + lowestRank.getID()); } for (String player : plugin.grantData.config.getKeys(false)) { if (plugin.grantData.config.contains(player + ".Grants")) { yoPlayer yoPlayer = new yoPlayer(UUID.fromString(player)); for (Map.Entry<Integer, Grant> entry : Grant.getGrants(yoPlayer).entrySet()) { if (entry.getValue().getGrant().equalsIgnoreCase(getID())) { plugin.grantData.config.set(player + ".Grants." + entry.getValue().getID() + ".Status", "Expired"); plugin.grantData.config.set(player + ".Grants." + entry.getValue().getID() + ".Grant", "(Removed Rank)"); } } } } plugin.getConfig().set("Ranks." + getID(), null); plugin.saveConfig(); plugin.getServer().getPluginManager().removePermission("yocore.grants." + getID().toLowerCase()); plugin.permissionsData.config.set("Ranks." + getID(), null); plugin.permissionsData.saveData(); for (Player player : Bukkit.getOnlinePlayers()) { for (Team team : player.getScoreboard().getTeams()) player.getScoreboard().getTeam(team.getName()).unregister(); } getRanks().remove(getID()); } public Permissions permissions() { return new Permissions(this); } }
e81ca65afa57f8b4fd183cfa9af6a2038ead864a
4cb30cd27ae9083fdcf072143ab3f008bdfd9a7a
/com/planet_ink/coffee_mud/Abilities/Prayers/Prayer_AnimateSkeleton.java
0c04597f46a0b5d3211b331f96acb3ca496259ff
[ "Apache-2.0" ]
permissive
Banbury/CoffeeMud
f786f075017b3e0b32ba81afa55ff6a88e13fd30
a35c14498bf550673bab30e885806ddacc047256
refs/heads/master
2021-01-18T05:27:54.995262
2015-01-20T08:10:35
2015-01-20T08:10:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,608
java
package com.planet_ink.coffee_mud.Abilities.Prayers; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2003-2015 Bo Zimmerman 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. */ @SuppressWarnings("rawtypes") public class Prayer_AnimateSkeleton extends Prayer { @Override public String ID() { return "Prayer_AnimateSkeleton"; } private final static String localizedName = CMLib.lang().L("Animate Skeleton"); @Override public String name() { return localizedName; } @Override public int classificationCode(){return Ability.ACODE_PRAYER|Ability.DOMAIN_DEATHLORE;} @Override public int abstractQuality(){ return Ability.QUALITY_INDIFFERENT;} @Override public int enchantQuality(){return Ability.QUALITY_INDIFFERENT;} @Override public long flags(){return Ability.FLAG_UNHOLY;} @Override protected int canTargetCode(){return CAN_ITEMS;} public void makeSkeletonFrom(Room R, DeadBody body, MOB mob, int level) { String race="a"; if((body.charStats()!=null)&&(body.charStats().getMyRace()!=null)) race=CMLib.english().startWithAorAn(body.charStats().getMyRace().name()).toLowerCase(); String description=body.geteMobDescription(); if(description.trim().length()==0) description="It looks dead."; else description+="\n\rIt also looks dead."; final MOB newMOB=CMClass.getMOB("GenUndead"); newMOB.setName(L("@x1 skeleton",race)); newMOB.setDescription(description); newMOB.setDisplayText(L("@x1 skeleton is here",race)); newMOB.basePhyStats().setLevel(level+(super.getX1Level(mob)*2)+super.getXLEVELLevel(mob)); newMOB.baseCharStats().setStat(CharStats.STAT_GENDER,body.charStats().getStat(CharStats.STAT_GENDER)); newMOB.baseCharStats().setMyRace(CMClass.getRace("Skeleton")); newMOB.baseCharStats().setBodyPartsFromStringAfterRace(body.charStats().getBodyPartsAsString()); final Ability P=CMClass.getAbility("Prop_StatTrainer"); if(P!=null) { P.setMiscText("NOTEACH STR=16 INT=10 WIS=10 CON=10 DEX=15 CHA=2"); newMOB.addNonUninvokableEffect(P); } newMOB.recoverCharStats(); newMOB.basePhyStats().setAttackAdjustment(CMLib.leveler().getLevelAttack(newMOB)); newMOB.basePhyStats().setDamage(CMLib.leveler().getLevelMOBDamage(newMOB)); CMLib.factions().setAlignment(newMOB,Faction.Align.EVIL); newMOB.baseState().setHitPoints(15*newMOB.basePhyStats().level()); newMOB.baseState().setMovement(CMLib.leveler().getLevelMove(newMOB)); newMOB.basePhyStats().setArmor(CMLib.leveler().getLevelMOBArmor(newMOB)); newMOB.addNonUninvokableEffect(CMClass.getAbility("Prop_ModExperience")); newMOB.baseState().setMana(0); final Behavior B=CMClass.getBehavior("Aggressive"); if((B!=null)&&(mob!=null)){ B.setParms("+NAMES \"-"+mob.Name()+"\""); } if(B!=null) newMOB.addBehavior(B); newMOB.recoverCharStats(); newMOB.recoverPhyStats(); newMOB.recoverMaxState(); newMOB.resetToMaxState(); newMOB.text(); newMOB.bringToLife(R,true); CMLib.beanCounter().clearZeroMoney(newMOB,null); R.showOthers(newMOB,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> appears!")); int it=0; while(it<R.numItems()) { final Item item=R.getItem(it); if((item!=null)&&(item.container()==body)) { final CMMsg msg2=CMClass.getMsg(newMOB,body,item,CMMsg.MSG_GET,null); newMOB.location().send(newMOB,msg2); final CMMsg msg4=CMClass.getMsg(newMOB,item,null,CMMsg.MSG_GET,null); newMOB.location().send(newMOB,msg4); final CMMsg msg3=CMClass.getMsg(newMOB,item,null,CMMsg.MSG_WEAR,null); newMOB.location().send(newMOB,msg3); if(!newMOB.isMine(item)) it++; else it=0; } else it++; } body.destroy(); newMOB.setStartRoom(null); R.show(newMOB,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> begin(s) to rise!")); R.recoverRoomStats(); } @Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_UNWORNONLY); if(target==null) return false; if(target==mob) { mob.tell(L("@x1 doesn't look dead yet.",target.name(mob))); return false; } if(!(target instanceof DeadBody)) { mob.tell(L("You can't animate that.")); return false; } final DeadBody body=(DeadBody)target; if(body.isPlayerCorpse()||(body.getMobName().length()==0) ||((body.charStats()!=null)&&(body.charStats().getMyRace()!=null)&&(body.charStats().getMyRace().racialCategory().equalsIgnoreCase("Undead")))) { mob.tell(L("You can't animate that.")); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?"":L("^S<S-NAME> @x1 to animate <T-NAMESELF> as a skeleton.^?",prayForWord(mob))); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); makeSkeletonFrom(mob.location(),body,mob,1); } } else return beneficialWordsFizzle(mob,target,L("<S-NAME> @x1 to animate <T-NAMESELF>, but fail(s) miserably.",prayForWord(mob))); // return whether it worked return success; } }
ca86f253169977cc1a80abd613c8af83d9030336
a83bc77d55b5b29d3035f2adfdfbbfca30c39b90
/Esercizi/Final/Es_1_x/Esercizio_1.1/NoTreZeri.java
007ab7ea22906034d0e17b3665ffb72c017c6337
[]
no_license
OscarNaretto/LFT
610fa06c6d099481b6dc1fdca36f696eebc16940
6f2af566586c725c2337850a0f883e98c3abfa6a
refs/heads/master
2023-05-09T23:04:33.933961
2021-05-25T16:06:54
2021-05-25T16:06:54
306,587,225
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
/*L'automa è definito sull’alfabeto {0,1} e riconosce le stringhe in cui non compaiano 3 zeri consecutivi*/ public class NoTreZeri{ public static boolean scan(String s){ int state = 0; int i = 0; while(state >= 0 && i < s.length()){ final char ch = s.charAt(i++); switch(state){ case 0: if(ch == '0') state = 1; else if(ch == '1') state = 0; else state = -1; break; case 1: if(ch == '0') state = 2; else if(ch == '1') state = 0; else state = -1; break; case 2: if(ch == '0') state = 3; else if(ch == '1') state = 0; else state = -1; break; case 3: if(ch == '0' || ch == '1') state = 3; else state = -1; break; } } return state != 3; } public static void main(String[] args){ System.out.println(scan(args[0]) ? "OK" : "NOPE"); } }
fac8d5068309d0c1d8e5becad67ad04404694008
75ec75648e4d35d979a63578bc45be595369d97c
/src/main/java/me/ziim/chatchannel/events/onLeaveEvent.java
2440acdf5fdc6535b52a1b8d10bbf41eedd2fb55
[ "MIT" ]
permissive
ZiiMs/ChatChannel
9d251f65aab2c3feed0070d2af1d533be4a0401c
d02f8853e9a4301265e52b6a92b63644178ca170
refs/heads/master
2023-01-02T06:20:01.365438
2020-10-16T14:32:36
2020-10-16T14:32:36
298,849,148
2
0
null
null
null
null
UTF-8
Java
false
false
835
java
package me.ziim.chatchannel.events; import me.ziim.chatchannel.ChatChannel; import me.ziim.chatchannel.util.ChannelHelper; import me.ziim.chatchannel.util.sqlUtil; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; public class onLeaveEvent implements Listener { @EventHandler public void onLeave(PlayerQuitEvent e) { Player player = e.getPlayer(); sqlUtil sqlHelper = new sqlUtil(); String[] channels = sqlHelper.getChannels(player.getUniqueId().toString()); if (channels.length == 0) return; ChannelHelper cHelper = ChatChannel.cHelper; for (String channel : channels) { cHelper.removePlayer(player, cHelper.getChannelTitle(channel).prefix); } } }
4630982bed7a48ae91b57af8cbfa2378b1bd31e6
0e8c3864dc4f535c0c70ebde369571babff6f3b1
/src/main/java/quasar/rest/Exceptions/NotFoundException.java
7a79763f57a4f8c89efa5863d8dfc1545ef85474
[]
no_license
maximiliano-fantino/quasar-copy
04e2b32f177e1216e3f45e43c6068a5594d35f58
43afdbecdbe4c15bdba7093094f9a217a33f6f39
refs/heads/master
2023-01-28T12:38:04.544119
2020-11-27T16:32:48
2020-11-27T16:32:48
317,316,596
0
0
null
null
null
null
UTF-8
Java
false
false
269
java
package quasar.rest.Exceptions; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "Not found") public class NotFoundException extends RuntimeException { }
142cbba816cafd897dcdb7a6e3c9c629d5309902
eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3
/tags/2008-10-29/seasar2-2.4.31/seasar-benchmark/src/main/java/benchmark/many/b03/NullBean03595.java
80537c72e5faae6d67cfd1acd6593826676cb65b
[]
no_license
svn2github/s2container
54ca27cf0c1200a93e1cb88884eb8226a9be677d
625adc6c4e1396654a7297d00ec206c077a78696
refs/heads/master
2020-06-04T17:15:02.140847
2013-08-09T09:38:15
2013-08-09T09:38:15
10,850,644
0
1
null
null
null
null
UTF-8
Java
false
false
62
java
package benchmark.many.b03; public class NullBean03595 { }
[ "koichik@319488c0-e101-0410-93bc-b5e51f62721a" ]
koichik@319488c0-e101-0410-93bc-b5e51f62721a
9df6f6d361cbed8329e45d40e460b77eadb5e710
6ff8db5c930ea13afc7f3fdb417081a9ada17748
/opt4j/src/main/java/org/jamesframework/opt4j/CoreEvaluator.java
fccbcf71c0f9efd8df5170ec66ec11ef36e130ed
[]
no_license
hdbeukel/james-paper-code
171a82f33f4a46d1b5c1dd3be17cfe8e3d3376b9
bd9a010084b293aa3748be01d94871fffa148047
refs/heads/master
2021-01-17T14:50:53.061349
2016-07-20T13:48:59
2016-07-20T13:48:59
51,754,000
1
1
null
null
null
null
UTF-8
Java
false
false
777
java
package org.jamesframework.opt4j; import org.opt4j.core.Objective.Sign; import org.opt4j.core.Objectives; import org.opt4j.core.problem.Evaluator; public class CoreEvaluator implements Evaluator<CoreSolution> { public static double[][] dist; @Override public Objectives evaluate(CoreSolution core) { int n = core.size(); int numDist = n * (n - 1) / 2; double sumDist = 0.0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { sumDist += dist[core.get(i)][core.get(j)]; } } double avgDist = sumDist / numDist; Objectives obj = new Objectives(); obj.add("distance", Sign.MAX, avgDist); return obj; } }
563436b1ceaf4fc38e039b7d28de8645ad0ed287
3735f252ff93383b04fa61cc0e8342e84911a9ae
/itau/src/main/java/br/com/itau/dao/UsuarioDAO.java
2f4bdd090cf0138289c344c0845f90f056e7f706
[]
no_license
fugimur/wsmonica
aeb559d4c32ce08fb2dc1fff240fe2dda17d8f20
aa2ba600b3e1950eacb3404fd1e160b3a8765d5a
refs/heads/main
2023-04-21T21:23:17.062641
2021-05-19T19:56:21
2021-05-19T19:56:21
364,365,905
0
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package br.com.itau.dao; import org.springframework.data.repository.CrudRepository; import br.com.itau.modelo.Usuario; /* * DAO => é um pattern que sugestiona onde devem ficar os comandos SQL DML * Dentro das classes DAO´s: * Deve montar o CRUD (Creaate - Read - Update - Delete) * */ public interface UsuarioDAO extends CrudRepository<Usuario, Integer>{ //Nesse caso o SpringBoot já entende que cada palavra iniciada por palavra maiuscula é o atributo que ele vai usar public Usuario findByEmailAndSenha(String email, String senha); /* * CrudRepository será a classe pai do UsuarioDAO e está informando ao SpringBoot * que esta classe armazenará o CRUD para usuario. O Integer é para especificar * que o tipo de dado da chave primária é Integer. * Sintaxe: modelo, tipo do dado */ /* * Métodos herdados do CrudRepository: * - save (objeto): grava/altera uma linha no banco de dados * - findById(int): pesquisa um usuario pelo codigo * - findAll(): retorna todos os usuarios * - deleteById(int): apaga um usuário pelo codigo * - deleteAll(): apaga tudo * - count(): retorna qtos usuarios existem */ }
c789eeaf158636d9d1cb2ea71a5ed180a675dfcc
d6920bff5730bf8823315e15b0858c68a91db544
/android/ftsafe_0.7.04_source_from_jdcore/kawa/lib/bytevectors.java
e124178c73974dfe674ae255ab166df4d47daecc
[]
no_license
AppWerft/Ti.FeitianSmartcardReader
f862f9a2a01e1d2f71e09794aa8ff5e28264e458
48657e262044be3ae8b395065d814e169bd8ad7d
refs/heads/master
2020-05-09T10:54:56.278195
2020-03-17T08:04:07
2020-03-17T08:04:07
181,058,540
2
0
null
null
null
null
UTF-8
Java
false
false
58,501
java
package kawa.lib; import gnu.lists.U8Vector; public class bytevectors extends gnu.expr.ModuleBody { private static void $runBody$() { ; gnu.lists.Consumer $result = getInstanceconsumer; } public static final gnu.expr.ModuleMethod bytevector$Qu; public static final gnu.expr.ModuleMethod make$Mnbytevector; public static boolean isBytevector(Object x) { return x instanceof U8Vector; } public static U8Vector makeBytevector(int n, int init) { return new U8Vector(n, (byte)init); } public static int bytevectorLength(U8Vector v) { return v.size(); } public static int bytevectorU8Ref(U8Vector v, int i) { return v.getInt(i); } public static void bytevectorU8Set$Ex(U8Vector v, int i, int x) { v.setByte(i, (byte)x); } public static U8Vector bytevectorCopy(U8Vector paramU8Vector, int paramInt) { return bytevectorCopy(paramU8Vector, paramInt, paramU8Vector.size()); } public static U8Vector bytevectorCopy(U8Vector v, int start, int end) { U8Vector result = new U8Vector(end - start); result.copyFrom(0, v, start, end); return result; } public static final gnu.expr.ModuleMethod bytevector$Mnlength; public static final gnu.expr.ModuleMethod bytevector$Mnu8$Mnref; public static final gnu.expr.ModuleMethod bytevector$Mnu8$Mnset$Ex; public static final gnu.expr.ModuleMethod bytevector$Mncopy; public static final gnu.expr.ModuleMethod bytevector$Mncopy$Ex; public static final gnu.expr.ModuleMethod bytevector$Mnappend; public static final gnu.expr.ModuleMethod utf8$Mn$Grstring; public static final gnu.expr.ModuleMethod string$Mn$Grutf8; public int matchN(gnu.expr.ModuleMethod paramModuleMethod, Object[] paramArrayOfObject, gnu.mapping.CallContext paramCallContext) { switch (selector) {case 13: values = paramArrayOfObject;proc = paramModuleMethod;pc = 5;return 0; case 10: values = paramArrayOfObject;proc = paramModuleMethod;pc = 5;return 0; } return super.matchN(paramModuleMethod, paramArrayOfObject, paramCallContext); } public static void bytevectorCopy$Ex(U8Vector paramU8Vector1, int paramInt1, U8Vector paramU8Vector2, int paramInt2) { bytevectorCopy$Ex(paramU8Vector1, paramInt1, paramU8Vector2, paramInt2, paramU8Vector2.size()); } public static void bytevectorCopy$Ex(U8Vector to, int at, U8Vector from, int start, int end) { to.copyFrom(at, from, start, end); } public static Object bytevectorAppend(U8Vector... bvs) { int nbvs = bvs.length; int i = 0; int sz; for (int i = 0; i < nbvs; i++) { sz += bvs[i].size(); } int size = sz; U8Vector result = new U8Vector(size); int j = 0; int off; for (int i = 0; i < nbvs; i++) { U8Vector bv = bvs[i]; int bvlength = bv.size(); result.copyFrom(off, bv, 0, bvlength); off += bvlength; } return result; } public static bytevectors $instance; static final gnu.mapping.SimpleSymbol Lit0; static final gnu.mapping.SimpleSymbol Lit1; static final gnu.mapping.SimpleSymbol Lit2; static final gnu.mapping.SimpleSymbol Lit3; public static CharSequence utf8$To$String(U8Vector paramU8Vector, int paramInt) { return utf8$To$String(paramU8Vector, paramInt, paramU8Vector.size()); } public static CharSequence utf8$To$String(U8Vector v, int start, int end) { return v.toUtf8(start, end - start); } static final gnu.mapping.SimpleSymbol Lit4; static final gnu.mapping.SimpleSymbol Lit5; static final gnu.mapping.SimpleSymbol Lit6; static final gnu.mapping.SimpleSymbol Lit7; static final gnu.mapping.SimpleSymbol Lit8; static final gnu.mapping.SimpleSymbol Lit9 = gnu.mapping.Symbol.valueOf("string->utf8"); public Object apply1(gnu.expr.ModuleMethod paramModuleMethod, Object paramObject) { switch (selector) {case 1: return isBytevector(paramObject) ? Boolean.TRUE : Boolean.FALSE; } try { return makeBytevector(((Number)gnu.mapping.Promise.force(paramObject)).intValue()); } catch (ClassCastException localClassCastException1) { throw new gnu.mapping.WrongType( localClassCastException1, "make-bytevector", 1, paramObject); } try { return Integer.valueOf(bytevectorLength(gnu.kawa.lispexpr.LangObjType.coerceToU8Vector(gnu.mapping.Promise.force(paramObject, U8Vector.class)))); } catch (ClassCastException localClassCastException2) { throw new gnu.mapping.WrongType(localClassCastException2, "bytevector-length", 1, paramObject); } try { return bytevectorCopy(gnu.kawa.lispexpr.LangObjType.coerceToU8Vector(gnu.mapping.Promise.force(paramObject, U8Vector.class))); } catch (ClassCastException localClassCastException3) { throw new gnu.mapping.WrongType(localClassCastException3, "bytevector-copy", 1, paramObject); } try { return utf8$To$String(gnu.kawa.lispexpr.LangObjType.coerceToU8Vector(gnu.mapping.Promise.force(paramObject, U8Vector.class))); } catch (ClassCastException localClassCastException4) { throw new gnu.mapping.WrongType(localClassCastException4, "utf8->string", 1, paramObject); } try { return string$To$Utf8((CharSequence)gnu.mapping.Promise.force(paramObject, CharSequence.class)); } catch (ClassCastException localClassCastException5) { throw new gnu.mapping.WrongType(localClassCastException5, "string->utf8", 1, paramObject); } return super.apply1(paramModuleMethod, paramObject); } public static U8Vector string$To$Utf8(CharSequence paramCharSequence, int paramInt) { return string$To$Utf8(paramCharSequence, paramInt, paramCharSequence.length()); } public static U8Vector string$To$Utf8(CharSequence v, int start, int end) { return new U8Vector(v.toString().substring(start, end).getBytes("UTF-8")); } public static U8Vector makeBytevector(int paramInt) { return makeBytevector(paramInt, 0); } public static U8Vector bytevectorCopy(U8Vector paramU8Vector) { return bytevectorCopy(paramU8Vector, 0); } public static void bytevectorCopy$Ex(U8Vector paramU8Vector1, int paramInt, U8Vector paramU8Vector2) { bytevectorCopy$Ex(paramU8Vector1, paramInt, paramU8Vector2, 0); } public static CharSequence utf8$To$String(U8Vector paramU8Vector) { return utf8$To$String(paramU8Vector, 0); } public static U8Vector string$To$Utf8(CharSequence paramCharSequence) { return string$To$Utf8(paramCharSequence, 0); } static { Lit8 = gnu.mapping.Symbol.valueOf("utf8->string"); Lit7 = gnu.mapping.Symbol.valueOf("bytevector-append"); Lit6 = gnu.mapping.Symbol.valueOf("bytevector-copy!"); Lit5 = gnu.mapping.Symbol.valueOf("bytevector-copy"); Lit4 = gnu.mapping.Symbol.valueOf("bytevector-u8-set!"); Lit3 = gnu.mapping.Symbol.valueOf("bytevector-u8-ref"); Lit2 = gnu.mapping.Symbol.valueOf("bytevector-length"); Lit1 = gnu.mapping.Symbol.valueOf("make-bytevector"); Lit0 = gnu.mapping.Symbol.valueOf("bytevector?"); $instance = new bytevectors(); bytevectors localBytevectors = $instance; bytevector$Qu = new gnu.expr.ModuleMethod(localBytevectors, 1, Lit0, 4097); make$Mnbytevector = new gnu.expr.ModuleMethod(localBytevectors, 2, Lit1, 8193); bytevector$Mnlength = new gnu.expr.ModuleMethod(localBytevectors, 4, Lit2, 4097); bytevector$Mnu8$Mnref = new gnu.expr.ModuleMethod(localBytevectors, 5, Lit3, 8194); bytevector$Mnu8$Mnset$Ex = new gnu.expr.ModuleMethod(localBytevectors, 6, Lit4, 12291); bytevector$Mncopy = new gnu.expr.ModuleMethod(localBytevectors, 7, Lit5, 12289); bytevector$Mncopy$Ex = new gnu.expr.ModuleMethod(localBytevectors, 10, Lit6, 20483); bytevector$Mnappend = new gnu.expr.ModuleMethod(localBytevectors, 13, Lit7, 61440); utf8$Mn$Grstring = new gnu.expr.ModuleMethod(localBytevectors, 14, Lit8, 12289); string$Mn$Grutf8 = new gnu.expr.ModuleMethod(localBytevectors, 17, Lit9, 12289); $runBody$(); } public bytevectors() { gnu.expr.ModuleInfo.register(this); } /* Error */ public int match1(gnu.expr.ModuleMethod arg1, Object arg2, gnu.mapping.CallContext arg3) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: lookupswitch default:+237->241, 1:+220->224, 2:+200->204, 4:+165->169, 7:+130->134, 14:+95->99, 17:+60->64 // 64: aload_3 // 65: aload_2 // 66: ldc 71 // 68: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 71: dup // 72: instanceof 71 // 75: ifeq +6 -> 81 // 78: goto +6 -> 84 // 81: ldc -64 // 83: ireturn // 84: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 87: aload_3 // 88: aload_1 // 89: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 92: aload_3 // 93: iconst_1 // 94: putfield 203 gnu/mapping/CallContext:pc I // 97: iconst_0 // 98: ireturn // 99: aload_3 // 100: aload_2 // 101: ldc 12 // 103: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 106: dup // 107: instanceof 12 // 110: ifeq +6 -> 116 // 113: goto +6 -> 119 // 116: ldc -64 // 118: ireturn // 119: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 122: aload_3 // 123: aload_1 // 124: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 127: aload_3 // 128: iconst_1 // 129: putfield 203 gnu/mapping/CallContext:pc I // 132: iconst_0 // 133: ireturn // 134: aload_3 // 135: aload_2 // 136: ldc 12 // 138: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 141: dup // 142: instanceof 12 // 145: ifeq +6 -> 151 // 148: goto +6 -> 154 // 151: ldc -64 // 153: ireturn // 154: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 157: aload_3 // 158: aload_1 // 159: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 162: aload_3 // 163: iconst_1 // 164: putfield 203 gnu/mapping/CallContext:pc I // 167: iconst_0 // 168: ireturn // 169: aload_3 // 170: aload_2 // 171: ldc 12 // 173: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 176: dup // 177: instanceof 12 // 180: ifeq +6 -> 186 // 183: goto +6 -> 189 // 186: ldc -64 // 188: ireturn // 189: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 192: aload_3 // 193: aload_1 // 194: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 197: aload_3 // 198: iconst_1 // 199: putfield 203 gnu/mapping/CallContext:pc I // 202: iconst_0 // 203: ireturn // 204: aload_3 // 205: aload_2 // 206: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 209: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 212: aload_3 // 213: aload_1 // 214: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 217: aload_3 // 218: iconst_1 // 219: putfield 203 gnu/mapping/CallContext:pc I // 222: iconst_0 // 223: ireturn // 224: aload_3 // 225: aload_2 // 226: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 229: aload_3 // 230: aload_1 // 231: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 234: aload_3 // 235: iconst_1 // 236: putfield 203 gnu/mapping/CallContext:pc I // 239: iconst_0 // 240: ireturn // 241: aload_0 // 242: aload_1 // 243: aload_2 // 244: aload_3 // 245: invokespecial 210 gnu/expr/ModuleBody:match1 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Lgnu/mapping/CallContext;)I // 248: ireturn // Line number table: // Java source line #58 -> byte code offset #64 // Java source line #51 -> byte code offset #99 // Java source line #20 -> byte code offset #134 // Java source line #11 -> byte code offset #169 // Java source line #8 -> byte code offset #204 // Java source line #5 -> byte code offset #224 } /* Error */ public int match2(gnu.expr.ModuleMethod arg1, Object arg2, Object arg3, gnu.mapping.CallContext arg4) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: lookupswitch default:+272->276, 2:+240->244, 5:+193->197, 7:+146->150, 14:+99->103, 17:+52->56 // 56: aload 4 // 58: aload_2 // 59: ldc 71 // 61: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 64: dup // 65: instanceof 71 // 68: ifeq +6 -> 74 // 71: goto +6 -> 77 // 74: ldc -64 // 76: ireturn // 77: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 80: aload 4 // 82: aload_3 // 83: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 86: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 89: aload 4 // 91: aload_1 // 92: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 95: aload 4 // 97: iconst_2 // 98: putfield 203 gnu/mapping/CallContext:pc I // 101: iconst_0 // 102: ireturn // 103: aload 4 // 105: aload_2 // 106: ldc 12 // 108: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 111: dup // 112: instanceof 12 // 115: ifeq +6 -> 121 // 118: goto +6 -> 124 // 121: ldc -64 // 123: ireturn // 124: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 127: aload 4 // 129: aload_3 // 130: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 133: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 136: aload 4 // 138: aload_1 // 139: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 142: aload 4 // 144: iconst_2 // 145: putfield 203 gnu/mapping/CallContext:pc I // 148: iconst_0 // 149: ireturn // 150: aload 4 // 152: aload_2 // 153: ldc 12 // 155: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 158: dup // 159: instanceof 12 // 162: ifeq +6 -> 168 // 165: goto +6 -> 171 // 168: ldc -64 // 170: ireturn // 171: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 174: aload 4 // 176: aload_3 // 177: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 180: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 183: aload 4 // 185: aload_1 // 186: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 189: aload 4 // 191: iconst_2 // 192: putfield 203 gnu/mapping/CallContext:pc I // 195: iconst_0 // 196: ireturn // 197: aload 4 // 199: aload_2 // 200: ldc 12 // 202: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 205: dup // 206: instanceof 12 // 209: ifeq +6 -> 215 // 212: goto +6 -> 218 // 215: ldc -64 // 217: ireturn // 218: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 221: aload 4 // 223: aload_3 // 224: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 227: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 230: aload 4 // 232: aload_1 // 233: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 236: aload 4 // 238: iconst_2 // 239: putfield 203 gnu/mapping/CallContext:pc I // 242: iconst_0 // 243: ireturn // 244: aload 4 // 246: aload_2 // 247: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 250: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 253: aload 4 // 255: aload_3 // 256: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 259: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 262: aload 4 // 264: aload_1 // 265: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 268: aload 4 // 270: iconst_2 // 271: putfield 203 gnu/mapping/CallContext:pc I // 274: iconst_0 // 275: ireturn // 276: aload_0 // 277: aload_1 // 278: aload_2 // 279: aload_3 // 280: aload 4 // 282: invokespecial 217 gnu/expr/ModuleBody:match2 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Ljava/lang/Object;Lgnu/mapping/CallContext;)I // 285: ireturn // Line number table: // Java source line #58 -> byte code offset #56 // Java source line #51 -> byte code offset #103 // Java source line #20 -> byte code offset #150 // Java source line #14 -> byte code offset #197 // Java source line #8 -> byte code offset #244 } /* Error */ public int match3(gnu.expr.ModuleMethod arg1, Object arg2, Object arg3, Object arg4, gnu.mapping.CallContext arg5) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: lookupswitch default:+352->356, 6:+295->299, 7:+238->242, 10:+166->170, 14:+109->113, 17:+52->56 // 56: aload 5 // 58: aload_2 // 59: ldc 71 // 61: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 64: dup // 65: instanceof 71 // 68: ifeq +6 -> 74 // 71: goto +6 -> 77 // 74: ldc -64 // 76: ireturn // 77: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 80: aload 5 // 82: aload_3 // 83: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 86: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 89: aload 5 // 91: aload 4 // 93: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 96: putfield 220 gnu/mapping/CallContext:value3 Ljava/lang/Object; // 99: aload 5 // 101: aload_1 // 102: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 105: aload 5 // 107: iconst_3 // 108: putfield 203 gnu/mapping/CallContext:pc I // 111: iconst_0 // 112: ireturn // 113: aload 5 // 115: aload_2 // 116: ldc 12 // 118: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 121: dup // 122: instanceof 12 // 125: ifeq +6 -> 131 // 128: goto +6 -> 134 // 131: ldc -64 // 133: ireturn // 134: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 137: aload 5 // 139: aload_3 // 140: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 143: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 146: aload 5 // 148: aload 4 // 150: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 153: putfield 220 gnu/mapping/CallContext:value3 Ljava/lang/Object; // 156: aload 5 // 158: aload_1 // 159: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 162: aload 5 // 164: iconst_3 // 165: putfield 203 gnu/mapping/CallContext:pc I // 168: iconst_0 // 169: ireturn // 170: aload 5 // 172: aload_2 // 173: ldc 12 // 175: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 178: dup // 179: instanceof 12 // 182: ifeq +6 -> 188 // 185: goto +6 -> 191 // 188: ldc -64 // 190: ireturn // 191: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 194: aload 5 // 196: aload_3 // 197: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 200: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 203: aload 5 // 205: aload 4 // 207: ldc 12 // 209: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 212: dup // 213: instanceof 12 // 216: ifeq +6 -> 222 // 219: goto +6 -> 225 // 222: ldc -35 // 224: ireturn // 225: putfield 220 gnu/mapping/CallContext:value3 Ljava/lang/Object; // 228: aload 5 // 230: aload_1 // 231: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 234: aload 5 // 236: iconst_3 // 237: putfield 203 gnu/mapping/CallContext:pc I // 240: iconst_0 // 241: ireturn // 242: aload 5 // 244: aload_2 // 245: ldc 12 // 247: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 250: dup // 251: instanceof 12 // 254: ifeq +6 -> 260 // 257: goto +6 -> 263 // 260: ldc -64 // 262: ireturn // 263: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 266: aload 5 // 268: aload_3 // 269: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 272: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 275: aload 5 // 277: aload 4 // 279: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 282: putfield 220 gnu/mapping/CallContext:value3 Ljava/lang/Object; // 285: aload 5 // 287: aload_1 // 288: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 291: aload 5 // 293: iconst_3 // 294: putfield 203 gnu/mapping/CallContext:pc I // 297: iconst_0 // 298: ireturn // 299: aload 5 // 301: aload_2 // 302: ldc 12 // 304: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 307: dup // 308: instanceof 12 // 311: ifeq +6 -> 317 // 314: goto +6 -> 320 // 317: ldc -64 // 319: ireturn // 320: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 323: aload 5 // 325: aload_3 // 326: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 329: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 332: aload 5 // 334: aload 4 // 336: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 339: putfield 220 gnu/mapping/CallContext:value3 Ljava/lang/Object; // 342: aload 5 // 344: aload_1 // 345: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 348: aload 5 // 350: iconst_3 // 351: putfield 203 gnu/mapping/CallContext:pc I // 354: iconst_0 // 355: ireturn // 356: aload_0 // 357: aload_1 // 358: aload_2 // 359: aload_3 // 360: aload 4 // 362: aload 5 // 364: invokespecial 225 gnu/expr/ModuleBody:match3 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lgnu/mapping/CallContext;)I // 367: ireturn // Line number table: // Java source line #58 -> byte code offset #56 // Java source line #51 -> byte code offset #113 // Java source line #27 -> byte code offset #170 // Java source line #20 -> byte code offset #242 // Java source line #17 -> byte code offset #299 } /* Error */ public int match4(gnu.expr.ModuleMethod arg1, Object arg2, Object arg3, Object arg4, Object arg5, gnu.mapping.CallContext arg6) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: bipush 10 // 6: if_icmpne +88 -> 94 // 9: goto +3 -> 12 // 12: aload 6 // 14: aload_2 // 15: ldc 12 // 17: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 20: dup // 21: instanceof 12 // 24: ifeq +6 -> 30 // 27: goto +6 -> 33 // 30: ldc -64 // 32: ireturn // 33: putfield 196 gnu/mapping/CallContext:value1 Ljava/lang/Object; // 36: aload 6 // 38: aload_3 // 39: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 42: putfield 213 gnu/mapping/CallContext:value2 Ljava/lang/Object; // 45: aload 6 // 47: aload 4 // 49: ldc 12 // 51: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 54: dup // 55: instanceof 12 // 58: ifeq +6 -> 64 // 61: goto +6 -> 67 // 64: ldc -35 // 66: ireturn // 67: putfield 220 gnu/mapping/CallContext:value3 Ljava/lang/Object; // 70: aload 6 // 72: aload 5 // 74: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 77: putfield 228 gnu/mapping/CallContext:value4 Ljava/lang/Object; // 80: aload 6 // 82: aload_1 // 83: putfield 200 gnu/mapping/CallContext:proc Lgnu/mapping/Procedure; // 86: aload 6 // 88: iconst_4 // 89: putfield 203 gnu/mapping/CallContext:pc I // 92: iconst_0 // 93: ireturn // 94: aload_0 // 95: aload_1 // 96: aload_2 // 97: aload_3 // 98: aload 4 // 100: aload 5 // 102: aload 6 // 104: invokespecial 232 gnu/expr/ModuleBody:match4 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lgnu/mapping/CallContext;)I // 107: ireturn // Line number table: // Java source line #27 -> byte code offset #12 } public void apply(gnu.mapping.CallContext paramCallContext) { gnu.expr.ModuleMethod.applyError(); } /* Error */ public Object apply2(gnu.expr.ModuleMethod paramModuleMethod, Object paramObject1, Object paramObject2) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: lookupswitch default:+171->175, 2:+52->56, 5:+76->80, 7:+102->106, 14:+125->129, 17:+148->152 // 56: aload_2 // 57: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 60: checkcast 258 java/lang/Number // 63: invokevirtual 261 java/lang/Number:intValue ()I // 66: aload_3 // 67: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 70: checkcast 258 java/lang/Number // 73: invokevirtual 261 java/lang/Number:intValue ()I // 76: invokestatic 18 kawa/lib/bytevectors:makeBytevector (II)Lgnu/lists/U8Vector; // 79: areturn // 80: aload_2 // 81: ldc 12 // 83: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 86: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 89: aload_3 // 90: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 93: checkcast 258 java/lang/Number // 96: invokevirtual 261 java/lang/Number:intValue ()I // 99: invokestatic 316 kawa/lib/bytevectors:bytevectorU8Ref (Lgnu/lists/U8Vector;I)I // 102: invokestatic 291 java/lang/Integer:valueOf (I)Ljava/lang/Integer; // 105: areturn // 106: aload_2 // 107: ldc 12 // 109: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 112: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 115: aload_3 // 116: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 119: checkcast 258 java/lang/Number // 122: invokevirtual 261 java/lang/Number:intValue ()I // 125: invokestatic 37 kawa/lib/bytevectors:bytevectorCopy (Lgnu/lists/U8Vector;I)Lgnu/lists/U8Vector; // 128: areturn // 129: aload_2 // 130: ldc 12 // 132: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 135: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 138: aload_3 // 139: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 142: checkcast 258 java/lang/Number // 145: invokevirtual 261 java/lang/Number:intValue ()I // 148: invokestatic 58 kawa/lib/bytevectors:utf8$To$String (Lgnu/lists/U8Vector;I)Ljava/lang/CharSequence; // 151: areturn // 152: aload_2 // 153: ldc 71 // 155: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 158: checkcast 71 java/lang/CharSequence // 161: aload_3 // 162: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 165: checkcast 258 java/lang/Number // 168: invokevirtual 261 java/lang/Number:intValue ()I // 171: invokestatic 69 kawa/lib/bytevectors:string$To$Utf8 (Ljava/lang/CharSequence;I)Lgnu/lists/U8Vector; // 174: areturn // 175: aload_0 // 176: aload_1 // 177: aload_2 // 178: aload_3 // 179: invokespecial 320 gnu/expr/ModuleBody:apply2 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 182: areturn // 183: new 265 gnu/mapping/WrongType // 186: dup_x1 // 187: swap // 188: ldc_w 267 // 191: iconst_1 // 192: aload_2 // 193: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 196: athrow // 197: new 265 gnu/mapping/WrongType // 200: dup_x1 // 201: swap // 202: ldc_w 267 // 205: iconst_2 // 206: aload_3 // 207: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 210: athrow // 211: new 265 gnu/mapping/WrongType // 214: dup_x1 // 215: swap // 216: ldc_w 312 // 219: iconst_1 // 220: aload_2 // 221: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 224: athrow // 225: new 265 gnu/mapping/WrongType // 228: dup_x1 // 229: swap // 230: ldc_w 312 // 233: iconst_2 // 234: aload_3 // 235: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 238: athrow // 239: new 265 gnu/mapping/WrongType // 242: dup_x1 // 243: swap // 244: ldc_w 293 // 247: iconst_1 // 248: aload_2 // 249: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 252: athrow // 253: new 265 gnu/mapping/WrongType // 256: dup_x1 // 257: swap // 258: ldc_w 293 // 261: iconst_2 // 262: aload_3 // 263: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 266: athrow // 267: new 265 gnu/mapping/WrongType // 270: dup_x1 // 271: swap // 272: ldc_w 298 // 275: iconst_1 // 276: aload_2 // 277: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 280: athrow // 281: new 265 gnu/mapping/WrongType // 284: dup_x1 // 285: swap // 286: ldc_w 298 // 289: iconst_2 // 290: aload_3 // 291: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 294: athrow // 295: new 265 gnu/mapping/WrongType // 298: dup_x1 // 299: swap // 300: ldc_w 303 // 303: iconst_1 // 304: aload_2 // 305: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 308: athrow // 309: new 265 gnu/mapping/WrongType // 312: dup_x1 // 313: swap // 314: ldc_w 303 // 317: iconst_2 // 318: aload_3 // 319: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 322: athrow // Line number table: // Java source line #8 -> byte code offset #56 // Java source line #14 -> byte code offset #80 // Java source line #20 -> byte code offset #106 // Java source line #51 -> byte code offset #129 // Java source line #58 -> byte code offset #152 // Java source line #8 -> byte code offset #183 // Java source line #14 -> byte code offset #211 // Java source line #20 -> byte code offset #239 // Java source line #21 -> byte code offset #253 // Java source line #51 -> byte code offset #267 // Java source line #53 -> byte code offset #281 // Java source line #59 -> byte code offset #295 // Java source line #61 -> byte code offset #309 // Local variable table: // start length slot name signature // 0 323 0 this bytevectors // 0 323 1 paramModuleMethod gnu.expr.ModuleMethod // 0 323 2 paramObject1 Object // 0 323 3 paramObject2 Object // 183 1 4 localClassCastException1 ClassCastException // 197 1 5 localClassCastException2 ClassCastException // 211 1 6 localClassCastException3 ClassCastException // 225 1 7 localClassCastException4 ClassCastException // 239 1 8 localClassCastException5 ClassCastException // 253 1 9 localClassCastException6 ClassCastException // 267 1 10 localClassCastException7 ClassCastException // 281 1 11 localClassCastException8 ClassCastException // 295 1 12 localClassCastException9 ClassCastException // 309 1 13 localClassCastException10 ClassCastException // Exception table: // from to target type // 60 66 183 java/lang/ClassCastException // 70 76 197 java/lang/ClassCastException // 86 89 211 java/lang/ClassCastException // 93 99 225 java/lang/ClassCastException // 112 115 239 java/lang/ClassCastException // 119 125 253 java/lang/ClassCastException // 135 138 267 java/lang/ClassCastException // 142 148 281 java/lang/ClassCastException // 158 161 295 java/lang/ClassCastException // 165 171 309 java/lang/ClassCastException } /* Error */ public Object apply3(gnu.expr.ModuleMethod paramModuleMethod, Object paramObject1, Object paramObject2, Object paramObject3) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: lookupswitch default:+227->231, 6:+52->56, 7:+89->93, 10:+123->127, 14:+159->163, 17:+193->197 // 56: aload_2 // 57: ldc 12 // 59: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 62: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 65: aload_3 // 66: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 69: checkcast 258 java/lang/Number // 72: invokevirtual 261 java/lang/Number:intValue ()I // 75: aload 4 // 77: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 80: checkcast 258 java/lang/Number // 83: invokevirtual 261 java/lang/Number:intValue ()I // 86: invokestatic 326 kawa/lib/bytevectors:bytevectorU8Set$Ex (Lgnu/lists/U8Vector;II)V // 89: getstatic 332 gnu/mapping/Values:empty Lgnu/mapping/Values; // 92: areturn // 93: aload_2 // 94: ldc 12 // 96: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 99: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 102: aload_3 // 103: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 106: checkcast 258 java/lang/Number // 109: invokevirtual 261 java/lang/Number:intValue ()I // 112: aload 4 // 114: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 117: checkcast 258 java/lang/Number // 120: invokevirtual 261 java/lang/Number:intValue ()I // 123: invokestatic 40 kawa/lib/bytevectors:bytevectorCopy (Lgnu/lists/U8Vector;II)Lgnu/lists/U8Vector; // 126: areturn // 127: aload_2 // 128: ldc 12 // 130: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 133: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 136: aload_3 // 137: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 140: checkcast 258 java/lang/Number // 143: invokevirtual 261 java/lang/Number:intValue ()I // 146: aload 4 // 148: ldc 12 // 150: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 153: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 156: invokestatic 337 kawa/lib/bytevectors:bytevectorCopy$Ex (Lgnu/lists/U8Vector;ILgnu/lists/U8Vector;)V // 159: getstatic 332 gnu/mapping/Values:empty Lgnu/mapping/Values; // 162: areturn // 163: aload_2 // 164: ldc 12 // 166: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 169: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 172: aload_3 // 173: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 176: checkcast 258 java/lang/Number // 179: invokevirtual 261 java/lang/Number:intValue ()I // 182: aload 4 // 184: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 187: checkcast 258 java/lang/Number // 190: invokevirtual 261 java/lang/Number:intValue ()I // 193: invokestatic 61 kawa/lib/bytevectors:utf8$To$String (Lgnu/lists/U8Vector;II)Ljava/lang/CharSequence; // 196: areturn // 197: aload_2 // 198: ldc 71 // 200: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 203: checkcast 71 java/lang/CharSequence // 206: aload_3 // 207: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 210: checkcast 258 java/lang/Number // 213: invokevirtual 261 java/lang/Number:intValue ()I // 216: aload 4 // 218: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 221: checkcast 258 java/lang/Number // 224: invokevirtual 261 java/lang/Number:intValue ()I // 227: invokestatic 77 kawa/lib/bytevectors:string$To$Utf8 (Ljava/lang/CharSequence;II)Lgnu/lists/U8Vector; // 230: areturn // 231: aload_0 // 232: aload_1 // 233: aload_2 // 234: aload_3 // 235: aload 4 // 237: invokespecial 341 gnu/expr/ModuleBody:apply3 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 240: areturn // 241: new 265 gnu/mapping/WrongType // 244: dup_x1 // 245: swap // 246: ldc_w 322 // 249: iconst_1 // 250: aload_2 // 251: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 254: athrow // 255: new 265 gnu/mapping/WrongType // 258: dup_x1 // 259: swap // 260: ldc_w 322 // 263: iconst_2 // 264: aload_3 // 265: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 268: athrow // 269: new 265 gnu/mapping/WrongType // 272: dup_x1 // 273: swap // 274: ldc_w 322 // 277: iconst_3 // 278: aload 4 // 280: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 283: athrow // 284: new 265 gnu/mapping/WrongType // 287: dup_x1 // 288: swap // 289: ldc_w 293 // 292: iconst_1 // 293: aload_2 // 294: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 297: athrow // 298: new 265 gnu/mapping/WrongType // 301: dup_x1 // 302: swap // 303: ldc_w 293 // 306: iconst_2 // 307: aload_3 // 308: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 311: athrow // 312: new 265 gnu/mapping/WrongType // 315: dup_x1 // 316: swap // 317: ldc_w 293 // 320: iconst_3 // 321: aload 4 // 323: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 326: athrow // 327: new 265 gnu/mapping/WrongType // 330: dup_x1 // 331: swap // 332: ldc_w 334 // 335: iconst_1 // 336: aload_2 // 337: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 340: athrow // 341: new 265 gnu/mapping/WrongType // 344: dup_x1 // 345: swap // 346: ldc_w 334 // 349: iconst_2 // 350: aload_3 // 351: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 354: athrow // 355: new 265 gnu/mapping/WrongType // 358: dup_x1 // 359: swap // 360: ldc_w 334 // 363: iconst_3 // 364: aload 4 // 366: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 369: athrow // 370: new 265 gnu/mapping/WrongType // 373: dup_x1 // 374: swap // 375: ldc_w 298 // 378: iconst_1 // 379: aload_2 // 380: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 383: athrow // 384: new 265 gnu/mapping/WrongType // 387: dup_x1 // 388: swap // 389: ldc_w 298 // 392: iconst_2 // 393: aload_3 // 394: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 397: athrow // 398: new 265 gnu/mapping/WrongType // 401: dup_x1 // 402: swap // 403: ldc_w 298 // 406: iconst_3 // 407: aload 4 // 409: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 412: athrow // 413: new 265 gnu/mapping/WrongType // 416: dup_x1 // 417: swap // 418: ldc_w 303 // 421: iconst_1 // 422: aload_2 // 423: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 426: athrow // 427: new 265 gnu/mapping/WrongType // 430: dup_x1 // 431: swap // 432: ldc_w 303 // 435: iconst_2 // 436: aload_3 // 437: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 440: athrow // 441: new 265 gnu/mapping/WrongType // 444: dup_x1 // 445: swap // 446: ldc_w 303 // 449: iconst_3 // 450: aload 4 // 452: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 455: athrow // Line number table: // Java source line #17 -> byte code offset #56 // Java source line #20 -> byte code offset #93 // Java source line #27 -> byte code offset #127 // Java source line #51 -> byte code offset #163 // Java source line #58 -> byte code offset #197 // Java source line #17 -> byte code offset #241 // Java source line #20 -> byte code offset #284 // Java source line #21 -> byte code offset #298 // Java source line #27 -> byte code offset #327 // Java source line #28 -> byte code offset #341 // Java source line #29 -> byte code offset #355 // Java source line #51 -> byte code offset #370 // Java source line #53 -> byte code offset #384 // Java source line #54 -> byte code offset #398 // Java source line #59 -> byte code offset #413 // Java source line #61 -> byte code offset #427 // Java source line #62 -> byte code offset #441 // Local variable table: // start length slot name signature // 0 456 0 this bytevectors // 0 456 1 paramModuleMethod gnu.expr.ModuleMethod // 0 456 2 paramObject1 Object // 0 456 3 paramObject2 Object // 0 456 4 paramObject3 Object // 241 1 5 localClassCastException1 ClassCastException // 255 1 6 localClassCastException2 ClassCastException // 269 1 7 localClassCastException3 ClassCastException // 284 1 8 localClassCastException4 ClassCastException // 298 1 9 localClassCastException5 ClassCastException // 312 1 10 localClassCastException6 ClassCastException // 327 1 11 localClassCastException7 ClassCastException // 341 1 12 localClassCastException8 ClassCastException // 355 1 13 localClassCastException9 ClassCastException // 370 1 14 localClassCastException10 ClassCastException // 384 1 15 localClassCastException11 ClassCastException // 398 1 16 localClassCastException12 ClassCastException // 413 1 17 localClassCastException13 ClassCastException // 427 1 18 localClassCastException14 ClassCastException // 441 1 19 localClassCastException15 ClassCastException // Exception table: // from to target type // 62 65 241 java/lang/ClassCastException // 69 75 255 java/lang/ClassCastException // 80 86 269 java/lang/ClassCastException // 99 102 284 java/lang/ClassCastException // 106 112 298 java/lang/ClassCastException // 117 123 312 java/lang/ClassCastException // 133 136 327 java/lang/ClassCastException // 140 146 341 java/lang/ClassCastException // 153 156 355 java/lang/ClassCastException // 169 172 370 java/lang/ClassCastException // 176 182 384 java/lang/ClassCastException // 187 193 398 java/lang/ClassCastException // 203 206 413 java/lang/ClassCastException // 210 216 427 java/lang/ClassCastException // 221 227 441 java/lang/ClassCastException } /* Error */ public Object apply4(gnu.expr.ModuleMethod paramModuleMethod, Object paramObject1, Object paramObject2, Object paramObject3, Object paramObject4) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: bipush 10 // 6: if_icmpne +53 -> 59 // 9: goto +3 -> 12 // 12: aload_2 // 13: ldc 12 // 15: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 18: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 21: aload_3 // 22: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 25: checkcast 258 java/lang/Number // 28: invokevirtual 261 java/lang/Number:intValue ()I // 31: aload 4 // 33: ldc 12 // 35: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 38: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 41: aload 5 // 43: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 46: checkcast 258 java/lang/Number // 49: invokevirtual 261 java/lang/Number:intValue ()I // 52: invokestatic 51 kawa/lib/bytevectors:bytevectorCopy$Ex (Lgnu/lists/U8Vector;ILgnu/lists/U8Vector;I)V // 55: getstatic 332 gnu/mapping/Values:empty Lgnu/mapping/Values; // 58: areturn // 59: aload_0 // 60: aload_1 // 61: aload_2 // 62: aload_3 // 63: aload 4 // 65: aload 5 // 67: invokespecial 345 gnu/expr/ModuleBody:apply4 (Lgnu/expr/ModuleMethod;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 70: areturn // 71: new 265 gnu/mapping/WrongType // 74: dup_x1 // 75: swap // 76: ldc_w 334 // 79: iconst_1 // 80: aload_2 // 81: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 84: athrow // 85: new 265 gnu/mapping/WrongType // 88: dup_x1 // 89: swap // 90: ldc_w 334 // 93: iconst_2 // 94: aload_3 // 95: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 98: athrow // 99: new 265 gnu/mapping/WrongType // 102: dup_x1 // 103: swap // 104: ldc_w 334 // 107: iconst_3 // 108: aload 4 // 110: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 113: athrow // 114: new 265 gnu/mapping/WrongType // 117: dup_x1 // 118: swap // 119: ldc_w 334 // 122: iconst_4 // 123: aload 5 // 125: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 128: athrow // Line number table: // Java source line #27 -> byte code offset #12 // Java source line #28 -> byte code offset #85 // Java source line #29 -> byte code offset #99 // Java source line #31 -> byte code offset #114 // Local variable table: // start length slot name signature // 0 129 0 this bytevectors // 0 129 1 paramModuleMethod gnu.expr.ModuleMethod // 0 129 2 paramObject1 Object // 0 129 3 paramObject2 Object // 0 129 4 paramObject3 Object // 0 129 5 paramObject4 Object // 71 1 6 localClassCastException1 ClassCastException // 85 1 7 localClassCastException2 ClassCastException // 99 1 8 localClassCastException3 ClassCastException // 114 1 9 localClassCastException4 ClassCastException // Exception table: // from to target type // 18 21 71 java/lang/ClassCastException // 25 31 85 java/lang/ClassCastException // 38 41 99 java/lang/ClassCastException // 46 52 114 java/lang/ClassCastException } /* Error */ public Object applyN(gnu.expr.ModuleMethod arg1, Object[] arg2) { // Byte code: // 0: aload_1 // 1: getfield 185 gnu/expr/ModuleMethod:selector I // 4: tableswitch default:+181->185, 10:+32->36, 11:+181->185, 12:+181->185, 13:+143->147 // 36: aload_2 // 37: arraylength // 38: iconst_3 // 39: isub // 40: istore_3 // 41: aload_2 // 42: iconst_0 // 43: aaload // 44: ldc 12 // 46: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 49: dup // 50: astore 4 // 52: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 55: aload_2 // 56: iconst_1 // 57: aaload // 58: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 61: dup // 62: astore 4 // 64: checkcast 258 java/lang/Number // 67: invokevirtual 261 java/lang/Number:intValue ()I // 70: aload_2 // 71: iconst_2 // 72: aaload // 73: ldc 12 // 75: invokestatic 191 gnu/mapping/Promise:force (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; // 78: dup // 79: astore 4 // 81: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 84: iload_3 // 85: ifgt +9 -> 94 // 88: invokestatic 337 kawa/lib/bytevectors:bytevectorCopy$Ex (Lgnu/lists/U8Vector;ILgnu/lists/U8Vector;)V // 91: goto +52 -> 143 // 94: iinc 3 -1 // 97: aload_2 // 98: iconst_3 // 99: aaload // 100: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 103: dup // 104: astore 4 // 106: checkcast 258 java/lang/Number // 109: invokevirtual 261 java/lang/Number:intValue ()I // 112: iload_3 // 113: ifgt +9 -> 122 // 116: invokestatic 51 kawa/lib/bytevectors:bytevectorCopy$Ex (Lgnu/lists/U8Vector;ILgnu/lists/U8Vector;I)V // 119: goto +24 -> 143 // 122: iinc 3 -1 // 125: aload_2 // 126: iconst_4 // 127: aaload // 128: invokestatic 206 gnu/mapping/Promise:force (Ljava/lang/Object;)Ljava/lang/Object; // 131: dup // 132: astore 4 // 134: checkcast 258 java/lang/Number // 137: invokevirtual 261 java/lang/Number:intValue ()I // 140: invokestatic 54 kawa/lib/bytevectors:bytevectorCopy$Ex (Lgnu/lists/U8Vector;ILgnu/lists/U8Vector;II)V // 143: getstatic 332 gnu/mapping/Values:empty Lgnu/mapping/Values; // 146: areturn // 147: aload_2 // 148: arraylength // 149: istore 4 // 151: iload 4 // 153: anewarray 12 gnu/lists/U8Vector // 156: goto +17 -> 173 // 159: dup // 160: iload 4 // 162: aload_2 // 163: iload 4 // 165: aaload // 166: dup // 167: astore 5 // 169: invokestatic 279 gnu/kawa/lispexpr/LangObjType:coerceToU8Vector (Ljava/lang/Object;)Lgnu/lists/U8Vector; // 172: aastore // 173: iinc 4 -1 // 176: iload 4 // 178: ifge -19 -> 159 // 181: invokestatic 351 kawa/lib/bytevectors:bytevectorAppend ([Lgnu/lists/U8Vector;)Ljava/lang/Object; // 184: areturn // 185: aload_0 // 186: aload_1 // 187: aload_2 // 188: invokespecial 355 gnu/expr/ModuleBody:applyN (Lgnu/expr/ModuleMethod;[Ljava/lang/Object;)Ljava/lang/Object; // 191: areturn // 192: new 265 gnu/mapping/WrongType // 195: dup_x1 // 196: swap // 197: ldc_w 334 // 200: iconst_1 // 201: aload 4 // 203: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 206: athrow // 207: new 265 gnu/mapping/WrongType // 210: dup_x1 // 211: swap // 212: ldc_w 334 // 215: iconst_2 // 216: aload 4 // 218: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 221: athrow // 222: new 265 gnu/mapping/WrongType // 225: dup_x1 // 226: swap // 227: ldc_w 334 // 230: iconst_3 // 231: aload 4 // 233: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 236: athrow // 237: new 265 gnu/mapping/WrongType // 240: dup_x1 // 241: swap // 242: ldc_w 334 // 245: iconst_4 // 246: aload 4 // 248: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 251: athrow // 252: new 265 gnu/mapping/WrongType // 255: dup_x1 // 256: swap // 257: ldc_w 334 // 260: iconst_5 // 261: aload 4 // 263: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 266: athrow // 267: new 265 gnu/mapping/WrongType // 270: dup_x1 // 271: swap // 272: ldc_w 347 // 275: iconst_0 // 276: aload 5 // 278: invokespecial 270 gnu/mapping/WrongType:<init> (Ljava/lang/ClassCastException;Ljava/lang/String;ILjava/lang/Object;)V // 281: athrow // Line number table: // Java source line #27 -> byte code offset #36 // Java source line #35 -> byte code offset #147 // Java source line #27 -> byte code offset #192 // Java source line #28 -> byte code offset #207 // Java source line #29 -> byte code offset #222 // Java source line #31 -> byte code offset #237 // Java source line #32 -> byte code offset #252 // Java source line #35 -> byte code offset #267 // Exception table: // from to target type // 52 55 192 java/lang/ClassCastException // 64 70 207 java/lang/ClassCastException // 81 84 222 java/lang/ClassCastException // 106 112 237 java/lang/ClassCastException // 134 140 252 java/lang/ClassCastException // 169 172 267 java/lang/ClassCastException } }
[ "“[email protected]“" ]
341d3c1cb7abbeb45045e529a1f0df90f74c9cf4
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Jsoup-87/org.jsoup.parser.HtmlTreeBuilderState/BBC-F0-opt-60/tests/8/org/jsoup/parser/HtmlTreeBuilderState_ESTest_scaffolding.java
26d3141d0e8c9c5161bf91343017317c8c2f06fa
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
5,005
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Oct 14 00:10:35 GMT 2021 */ package org.jsoup.parser; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class HtmlTreeBuilderState_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.jsoup.parser.HtmlTreeBuilderState"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { /*No java.lang.System property to set*/ } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(HtmlTreeBuilderState_ESTest_scaffolding.class.getClassLoader() , "org.jsoup.parser.HtmlTreeBuilderState$18", "org.jsoup.parser.HtmlTreeBuilderState$19", "org.jsoup.parser.HtmlTreeBuilderState$16", "org.jsoup.parser.HtmlTreeBuilderState$17", "org.jsoup.parser.HtmlTreeBuilderState$14", "org.jsoup.parser.TreeBuilder", "org.jsoup.parser.Token$StartTag", "org.jsoup.parser.HtmlTreeBuilderState$15", "org.jsoup.nodes.DocumentType", "org.jsoup.nodes.LeafNode", "org.jsoup.nodes.Element", "org.jsoup.parser.HtmlTreeBuilderState$12", "org.jsoup.parser.HtmlTreeBuilderState$13", "org.jsoup.parser.HtmlTreeBuilderState$10", "org.jsoup.parser.HtmlTreeBuilderState$Constants", "org.jsoup.parser.HtmlTreeBuilderState$11", "org.jsoup.parser.Token", "org.jsoup.parser.Token$Tag", "org.jsoup.parser.Token$Character", "org.jsoup.parser.HtmlTreeBuilderState$2", "org.jsoup.parser.HtmlTreeBuilderState$1", "org.jsoup.nodes.Node", "org.jsoup.parser.HtmlTreeBuilderState$4", "org.jsoup.parser.HtmlTreeBuilderState$3", "org.jsoup.parser.Token$EndTag", "org.jsoup.parser.HtmlTreeBuilderState", "org.jsoup.parser.HtmlTreeBuilderState$23", "org.jsoup.parser.HtmlTreeBuilderState$9", "org.jsoup.parser.HtmlTreeBuilderState$24", "org.jsoup.parser.HtmlTreeBuilderState$21", "org.jsoup.parser.HtmlTreeBuilderState$22", "org.jsoup.parser.HtmlTreeBuilderState$6", "org.jsoup.parser.HtmlTreeBuilderState$5", "org.jsoup.parser.HtmlTreeBuilderState$20", "org.jsoup.parser.HtmlTreeBuilderState$8", "org.jsoup.parser.HtmlTreeBuilder", "org.jsoup.parser.HtmlTreeBuilderState$7", "org.jsoup.nodes.FormElement" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(HtmlTreeBuilderState_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.jsoup.parser.HtmlTreeBuilderState", "org.jsoup.parser.HtmlTreeBuilderState$Constants", "org.jsoup.parser.TokeniserState" ); } }
685ff22eeb7fcea4c5dc10148ec13fa9794087ba
8c10a916396a7f6315eaf7c481a84dc814540d32
/source/level/tile/voidTile.java
f3e5b51841d6f10bae2f090cb3b8ddbf19ef6485
[]
no_license
NoobsDeSroobs/TwinStickShoooterFun
576fe17d38ad360ae88809378723c02c429857b6
c9ccca6f5eb5ea143d5ec3f28605e4236787201f
refs/heads/master
2020-12-24T09:30:19.970371
2016-11-09T14:22:06
2016-11-09T14:22:06
73,290,141
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package level.tile; import system.Screen; import graphics.Sprite; public class voidTile extends Tile { public voidTile(Sprite sprite) { super(sprite); } public void render(int x, int y, Screen screen){ screen.renderTile(x << 6, y << 6, this.sprite); } public boolean solid(){ return true; } }
2254ccc8fd6eb2f7042a6b14c3ca83c8ed5a2333
123467174737c4d33a7fd54fb61d93f9f1e710d2
/src/com/robo/store/view/CustomDurationScroller.java
305e03ae735c7eb01b24c61eff119908f1cb4db5
[]
no_license
meixililu/robostore
3a789ae42708090ea5fc7df88aa7c53ad6a30277
f72171080230d58dfc6ef460912640575dbd04e2
refs/heads/master
2021-01-21T12:07:01.793952
2016-05-19T15:28:16
2016-05-19T15:28:16
37,256,964
0
0
null
null
null
null
UTF-8
Java
false
false
1,247
java
package com.robo.store.view; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; /** * CustomDurationScroller * * @author <a href="http://www.trinea.cn" target="_blank">Trinea</a> 2014-3-2 */ public class CustomDurationScroller extends Scroller { private double scrollFactor = 1; public CustomDurationScroller(Context context) { super(context); } public CustomDurationScroller(Context context, Interpolator interpolator) { super(context, interpolator); } /** * not exist in android 2.3 * * @param context * @param interpolator * @param flywheel */ // @SuppressLint("NewApi") // public CustomDurationScroller(Context context, Interpolator interpolator, boolean flywheel){ // super(context, interpolator, flywheel); // } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { this.scrollFactor = scrollFactor; } @Override public void startScroll(int startX, int startY, int dx, int dy, int duration) { super.startScroll(startX, startY, dx, dy, (int)(duration * scrollFactor)); } }
1c4b72b147b1960e4eb2f8a63606d047dfc3fa4e
c07c000a3da09108109283cdb3f64acd2d8ca604
/app/src/test/java/ru/andrroider/apps/tinkoffnews/ExampleUnitTest.java
46460b0c5960728f6049542f455d0bd01a84d16f
[]
no_license
Jacks0N23/TinkoffNews
d9c4fab4c0054ad0fe72a1e81d69483efa952975
733febc6cf7d83c7701fae104e5e28d3a4b7bf91
refs/heads/master
2021-08-26T09:26:34.605377
2017-11-22T23:01:52
2017-11-22T23:01:52
111,738,872
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package ru.andrroider.apps.tinkoffnews; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
5c7ee6de20875c72f6978162386dc7922fd8e4b0
f890b49d15c6cc2cf3f0f36fec12b8af9ffdc1a1
/src/com/hyy/jingweibo/support/asyncdrawable/MultiPicturesChildImageView.java
d6b5be2a30db6065c091e9a28f20f47f5b711ebe
[]
no_license
hyy12345678/Jingweibo
0bb7740bb52c05c1361a9c382c962e08276b9903
db2f55805aa3fb5dda414dd982719b51684ad787
refs/heads/master
2020-04-28T23:16:10.219972
2015-11-15T13:29:18
2015-11-15T13:29:18
38,883,843
0
0
null
null
null
null
UTF-8
Java
false
false
2,810
java
package com.hyy.jingweibo.support.asyncdrawable; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.ImageView; import android.widget.ProgressBar; import com.hyy.jingweibo.R; import com.hyy.jingweibo.generator.JWBUser; import com.hyy.jingweibo.support.lib.PerformanceImageView; public class MultiPicturesChildImageView extends PerformanceImageView implements IJingweiboDrawable { private Paint paint = new Paint(); private boolean pressed = false; private boolean showGif = false; private Bitmap gif; public MultiPicturesChildImageView(Context context) { this(context, null); } public MultiPicturesChildImageView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public MultiPicturesChildImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(context); } private void init(Context context) { gif = BitmapFactory.decodeResource(getResources(), R.drawable.ic_play_gif_small); paint.setAntiAlias(true); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (showGif) { int bitmapHeight = gif.getHeight(); int bitmapWidth = gif.getWidth(); int x = (getWidth() - bitmapWidth) / 2; int y = (getHeight() - bitmapHeight) / 2; canvas.drawBitmap(gif, x, y, paint); } if (pressed) { canvas.drawColor(getResources().getColor(R.color.transparent_cover)); } } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: pressed = true; invalidate(); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: pressed = false; invalidate(); break; } return super.onTouchEvent(event); } @Override public ImageView getImageView() { return this; } @Override public void setProgress(int value, int max) { } @Override public ProgressBar getProgressBar() { return null; } @Override public void setGifFlag(boolean value) { if (showGif != value) { showGif = value; invalidate(); } } @Override public void setPressesStateVisibility(boolean value) { } @Override public void checkVerified(JWBUser user) { // TODO Auto-generated method stub } }
0b422dd0164d4665615bbd7b49aa34cb1d2d4fda
2daea090c54d11688b7e2f40fbeeda22fe3d01f6
/storage/src/main/java/org/zstack/storage/volume/VolumeManagerImpl.java
1af4b4951df3ffd27cecdb1d14017d6d9935314f
[ "Apache-2.0" ]
permissive
jxg01713/zstack
1f0e474daa6ca4647d0481c7e44d86a860ac209c
182fb094e9a6ef89cf010583d457a9bf4f033f33
refs/heads/1.0.x
2021-06-20T12:36:16.609798
2016-03-17T08:03:29
2016-03-17T08:03:29
197,339,567
0
0
Apache-2.0
2021-03-19T20:23:19
2019-07-17T07:36:39
Java
UTF-8
Java
false
false
28,793
java
package org.zstack.storage.volume; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.zstack.core.Platform; import org.zstack.core.cloudbus.CloudBus; import org.zstack.core.cloudbus.CloudBusCallBack; import org.zstack.core.cloudbus.MessageSafe; import org.zstack.core.cloudbus.ResourceDestinationMaker; import org.zstack.core.config.GlobalConfig; import org.zstack.core.config.GlobalConfigUpdateExtensionPoint; import org.zstack.core.db.DatabaseFacade; import org.zstack.core.db.DbEntityLister; import org.zstack.core.db.SimpleQuery; import org.zstack.core.db.SimpleQuery.Op; import org.zstack.core.errorcode.ErrorFacade; import org.zstack.core.thread.CancelablePeriodicTask; import org.zstack.core.thread.ThreadFacade; import org.zstack.core.workflow.FlowChainBuilder; import org.zstack.core.workflow.ShareFlow; import org.zstack.header.AbstractService; import org.zstack.header.configuration.DiskOfferingVO; import org.zstack.header.core.workflow.*; import org.zstack.header.errorcode.ErrorCode; import org.zstack.header.errorcode.OperationFailureException; import org.zstack.header.image.*; import org.zstack.header.managementnode.ManagementNodeReadyExtensionPoint; import org.zstack.header.message.APIMessage; import org.zstack.header.message.Message; import org.zstack.header.message.MessageReply; import org.zstack.header.search.SearchOp; import org.zstack.header.storage.backup.BackupStorageState; import org.zstack.header.storage.backup.BackupStorageStatus; import org.zstack.header.storage.primary.*; import org.zstack.header.storage.snapshot.*; import org.zstack.header.volume.*; import org.zstack.header.volume.APIGetVolumeFormatReply.VolumeFormatReplyStruct; import org.zstack.header.volume.VolumeDeletionPolicyManager.VolumeDeletionPolicy; import org.zstack.identity.AccountManager; import org.zstack.search.SearchQuery; import org.zstack.tag.TagManager; import org.zstack.utils.CollectionUtils; import org.zstack.utils.Utils; import org.zstack.utils.function.Function; import org.zstack.utils.gson.JSONObjectUtil; import org.zstack.utils.logging.CLogger; import org.zstack.utils.path.PathUtil; import javax.persistence.Tuple; import javax.persistence.TypedQuery; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; public class VolumeManagerImpl extends AbstractService implements VolumeManager, ManagementNodeReadyExtensionPoint { private static final CLogger logger = Utils.getLogger(VolumeManagerImpl.class); @Autowired private CloudBus bus; @Autowired private DatabaseFacade dbf; @Autowired private DbEntityLister dl; @Autowired private AccountManager acntMgr; @Autowired private ErrorFacade errf; @Autowired private TagManager tagMgr; @Autowired private ThreadFacade thdf; @Autowired private ResourceDestinationMaker destMaker; @Autowired private VolumeDeletionPolicyManager deletionPolicyMgr; private Future<Void> volumeExpungeTask; private void passThrough(VolumeMessage vmsg) { Message msg = (Message)vmsg; VolumeVO vo = dbf.findByUuid(vmsg.getVolumeUuid(), VolumeVO.class); if (vo == null) { bus.replyErrorByMessageType(msg, String.format("Cannot find volume[uuid:%s], it may have been deleted", vmsg.getVolumeUuid())); return; } VolumeBase volume = new VolumeBase(vo); volume.handleMessage(msg); } @Override @MessageSafe public void handleMessage(Message msg) { if (msg instanceof VolumeMessage) { passThrough((VolumeMessage)msg); } else if (msg instanceof APIMessage) { handleApiMessage((APIMessage)msg); } else { handleLocalMessage(msg); } } private void handleLocalMessage(Message msg) { if (msg instanceof CreateVolumeMsg) { handle((CreateVolumeMsg) msg); } else if (msg instanceof VolumeReportPrimaryStorageCapacityUsageMsg) { handle((VolumeReportPrimaryStorageCapacityUsageMsg) msg); } else { bus.dealWithUnknownMessage(msg); } } @Transactional(readOnly = true) private void handle(VolumeReportPrimaryStorageCapacityUsageMsg msg) { String sql = "select sum(vol.size) from VolumeVO vol where vol.primaryStorageUuid = :prUuid and vol.status = :status"; TypedQuery<Long> q = dbf.getEntityManager().createQuery(sql, Long.class); q.setParameter("prUuid", msg.getPrimaryStorageUuid()); q.setParameter("status", VolumeStatus.Ready); Long size = q.getSingleResult(); VolumeReportPrimaryStorageCapacityUsageReply reply = new VolumeReportPrimaryStorageCapacityUsageReply(); reply.setUsedCapacity(size == null ? 0 : size); bus.reply(msg, reply); } private VolumeInventory createVolume(CreateVolumeMsg msg) { VolumeVO vo = new VolumeVO(); vo.setUuid(Platform.getUuid()); vo.setRootImageUuid(msg.getRootImageUuid()); vo.setDescription(msg.getDescription()); vo.setName(msg.getName()); vo.setPrimaryStorageUuid(msg.getPrimaryStorageUuid()); vo.setSize(msg.getSize()); vo.setVmInstanceUuid(msg.getVmInstanceUuid()); vo.setFormat(msg.getFormat()); vo.setStatus(VolumeStatus.NotInstantiated); vo.setType(VolumeType.valueOf(msg.getVolumeType())); vo.setDiskOfferingUuid(msg.getDiskOfferingUuid()); if (vo.getType() == VolumeType.Root) { vo.setDeviceId(0); } acntMgr.createAccountResourceRef(msg.getAccountUuid(), vo.getUuid(), VolumeVO.class); vo = dbf.persistAndRefresh(vo); VolumeInventory inv = VolumeInventory.valueOf(vo); logger.debug(String.format("successfully created volume[uuid:%s, name:%s, type:%s, vm uuid:%s", inv.getUuid(), inv.getName(), inv.getType(), inv.getVmInstanceUuid())); return inv; } private void handle(CreateVolumeMsg msg) { VolumeInventory inv = createVolume(msg); CreateVolumeReply reply = new CreateVolumeReply(); reply.setInventory(inv); bus.reply(msg, reply); } private void handle(APICreateDataVolumeFromVolumeSnapshotMsg msg) { final APICreateDataVolumeFromVolumeSnapshotEvent evt = new APICreateDataVolumeFromVolumeSnapshotEvent(msg.getId()); final VolumeVO vo = new VolumeVO(); if (msg.getResourceUuid() != null) { vo.setUuid(msg.getResourceUuid()); } else { vo.setUuid(Platform.getUuid()); } vo.setName(msg.getName()); vo.setDescription(msg.getDescription()); vo.setState(VolumeState.Enabled); vo.setStatus(VolumeStatus.Creating); vo.setType(VolumeType.Data); vo.setSize(0); dbf.persist(vo); acntMgr.createAccountResourceRef(msg.getSession().getAccountUuid(), vo.getUuid(), VolumeVO.class); tagMgr.createTagsFromAPICreateMessage(msg, vo.getUuid(), VolumeVO.class.getSimpleName()); SimpleQuery<VolumeSnapshotVO> sq = dbf.createQuery(VolumeSnapshotVO.class); sq.select(VolumeSnapshotVO_.volumeUuid, VolumeSnapshotVO_.treeUuid); sq.add(VolumeSnapshotVO_.uuid, Op.EQ, msg.getVolumeSnapshotUuid()); Tuple t = sq.findTuple(); String volumeUuid = t.get(0, String.class); String treeUuid = t.get(1, String.class); CreateDataVolumeFromVolumeSnapshotMsg cmsg = new CreateDataVolumeFromVolumeSnapshotMsg(); cmsg.setVolumeUuid(volumeUuid); cmsg.setTreeUuid(treeUuid); cmsg.setUuid(msg.getVolumeSnapshotUuid()); cmsg.setVolume(VolumeInventory.valueOf(vo)); cmsg.setPrimaryStorageUuid(msg.getPrimaryStorageUuid()); String resourceUuid = volumeUuid != null ? volumeUuid : treeUuid; bus.makeTargetServiceIdByResourceUuid(cmsg, VolumeSnapshotConstant.SERVICE_ID, resourceUuid); bus.send(cmsg, new CloudBusCallBack(msg) { @Override public void run(MessageReply reply) { if (reply.isSuccess()) { CreateDataVolumeFromVolumeSnapshotReply cr = reply.castReply(); VolumeInventory inv = cr.getInventory(); vo.setSize(inv.getSize()); vo.setInstallPath(inv.getInstallPath()); vo.setStatus(VolumeStatus.Ready); vo.setPrimaryStorageUuid(inv.getPrimaryStorageUuid()); vo.setFormat(inv.getFormat()); VolumeVO vvo = dbf.updateAndRefresh(vo); evt.setInventory(VolumeInventory.valueOf(vvo)); } else { evt.setErrorCode(reply.getError()); } bus.publish(evt); } }); } private void handleApiMessage(APIMessage msg) { if (msg instanceof APICreateDataVolumeMsg) { handle((APICreateDataVolumeMsg) msg); } else if (msg instanceof APIListVolumeMsg) { handle((APIListVolumeMsg)msg); } else if (msg instanceof APISearchVolumeMsg) { handle((APISearchVolumeMsg) msg); } else if (msg instanceof APIGetVolumeMsg) { handle((APIGetVolumeMsg) msg); } else if (msg instanceof APICreateDataVolumeFromVolumeSnapshotMsg) { handle((APICreateDataVolumeFromVolumeSnapshotMsg) msg); } else if (msg instanceof APICreateDataVolumeFromVolumeTemplateMsg) { handle((APICreateDataVolumeFromVolumeTemplateMsg) msg); } else if (msg instanceof APIGetVolumeFormatMsg) { handle((APIGetVolumeFormatMsg) msg); } else { bus.dealWithUnknownMessage(msg); } } private void handle(APIGetVolumeFormatMsg msg) { List<VolumeFormatReplyStruct> structs = new ArrayList<VolumeFormatReplyStruct>(); for (VolumeFormat format : VolumeFormat.getAllFormats()) { structs.add(new VolumeFormatReplyStruct(format)); } APIGetVolumeFormatReply reply = new APIGetVolumeFormatReply(); reply.setFormats(structs); bus.reply(msg, reply); } private void handle(final APICreateDataVolumeFromVolumeTemplateMsg msg) { final APICreateDataVolumeFromVolumeTemplateEvent evt = new APICreateDataVolumeFromVolumeTemplateEvent(msg.getId()); final ImageVO template = dbf.findByUuid(msg.getImageUuid(), ImageVO.class); final VolumeVO vol = new VolumeVO(); vol.setUuid(msg.getResourceUuid() == null ? Platform.getUuid() : msg.getResourceUuid()); vol.setName(msg.getName()); vol.setDescription(msg.getDescription()); vol.setFormat(template.getFormat()); vol.setSize(template.getSize()); vol.setRootImageUuid(template.getUuid()); vol.setStatus(VolumeStatus.Creating); vol.setState(VolumeState.Enabled); vol.setType(VolumeType.Data); vol.setPrimaryStorageUuid(msg.getPrimaryStorageUuid()); dbf.persist(vol); acntMgr.createAccountResourceRef(msg.getSession().getAccountUuid(), vol.getUuid(), VolumeVO.class); tagMgr.createTagsFromAPICreateMessage(msg, vol.getUuid(), VolumeVO.class.getSimpleName()); FlowChain chain = FlowChainBuilder.newShareFlowChain(); chain.setName(String.format("create-data-volume-from-template-%s", template.getUuid())); chain.then(new ShareFlow() { ImageBackupStorageRefVO targetBackupStorageRef; PrimaryStorageInventory targetPrimaryStorage; String primaryStorageInstallPath; String volumeFormat; @Override public void setup() { flow(new NoRollbackFlow() { String __name__ = "select-backup-storage"; @Override @Transactional(readOnly = true) public void run(FlowTrigger trigger, Map data) { List<String> bsUuids = CollectionUtils.transformToList(template.getBackupStorageRefs(), new Function<String, ImageBackupStorageRefVO>() { @Override public String call(ImageBackupStorageRefVO arg) { return ImageStatus.Deleted.equals(arg.getStatus()) ? null : arg.getBackupStorageUuid(); } }); if (bsUuids.isEmpty()) { throw new OperationFailureException(errf.stringToOperationError( String.format("the image[uuid:%s, name:%s] has been deleted on all backup storage", template.getUuid(), template.getName()) )); } String sql = "select bs.uuid from BackupStorageVO bs, BackupStorageZoneRefVO zref, PrimaryStorageVO ps where zref.zoneUuid = ps.zoneUuid and bs.status = :bsStatus and bs.state = :bsState and ps.uuid = :psUuid and zref.backupStorageUuid = bs.uuid and bs.uuid in (:bsUuids)"; TypedQuery<String> q = dbf.getEntityManager().createQuery(sql, String.class); q.setParameter("psUuid", msg.getPrimaryStorageUuid()); q.setParameter("bsStatus", BackupStorageStatus.Connected); q.setParameter("bsState", BackupStorageState.Enabled); q.setParameter("bsUuids", bsUuids); bsUuids = q.getResultList(); if (bsUuids.isEmpty()) { trigger.fail(errf.stringToOperationError( String.format("cannot find a backup storage on which the image[uuid:%s] is that satisfies all conditions of: 1. has state Enabled 2. has status Connected. 3 has attached to zone in which primary storage[uuid:%s] is", template.getUuid(), msg.getPrimaryStorageUuid()) )); return; } final String bsUuid = bsUuids.get(0); targetBackupStorageRef = CollectionUtils.find(template.getBackupStorageRefs(), new Function<ImageBackupStorageRefVO, ImageBackupStorageRefVO>() { @Override public ImageBackupStorageRefVO call(ImageBackupStorageRefVO arg) { return arg.getBackupStorageUuid().equals(bsUuid) ? arg : null; } }); trigger.next(); } }); flow(new Flow() { String __name__ = "allocate-primary-storage"; @Override public void run(final FlowTrigger trigger, Map data) { AllocatePrimaryStorageMsg amsg = new AllocatePrimaryStorageMsg(); amsg.setSize(template.getSize()); amsg.setPurpose(PrimaryStorageAllocationPurpose.DownloadImage.toString()); amsg.setRequiredPrimaryStorageUuid(msg.getPrimaryStorageUuid()); amsg.setRequiredHostUuid(msg.getHostUuid()); bus.makeLocalServiceId(amsg, PrimaryStorageConstant.SERVICE_ID); bus.send(amsg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { trigger.fail(reply.getError()); } else { targetPrimaryStorage = ((AllocatePrimaryStorageReply)reply).getPrimaryStorageInventory(); trigger.next(); } } }); } @Override public void rollback(FlowRollback trigger, Map data) { if (targetPrimaryStorage != null) { ReturnPrimaryStorageCapacityMsg rmsg = new ReturnPrimaryStorageCapacityMsg(); rmsg.setDiskSize(template.getSize()); rmsg.setPrimaryStorageUuid(targetPrimaryStorage.getUuid()); bus.makeTargetServiceIdByResourceUuid(rmsg, PrimaryStorageConstant.SERVICE_ID, targetPrimaryStorage.getUuid());; bus.send(rmsg); } trigger.rollback(); } }); flow(new Flow() { String __name__ = "download-data-volume-template-to-primary-storage"; @Override public void run(final FlowTrigger trigger, Map data) { DownloadDataVolumeToPrimaryStorageMsg dmsg = new DownloadDataVolumeToPrimaryStorageMsg(); dmsg.setPrimaryStorageUuid(targetPrimaryStorage.getUuid()); dmsg.setVolumeUuid(vol.getUuid()); dmsg.setBackupStorageRef(ImageBackupStorageRefInventory.valueOf(targetBackupStorageRef)); dmsg.setImage(ImageInventory.valueOf(template)); dmsg.setHostUuid(msg.getHostUuid()); bus.makeTargetServiceIdByResourceUuid(dmsg, PrimaryStorageConstant.SERVICE_ID, targetPrimaryStorage.getUuid()); bus.send(dmsg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { trigger.fail(reply.getError()); } else { DownloadDataVolumeToPrimaryStorageReply r = reply.castReply(); primaryStorageInstallPath = r.getInstallPath(); volumeFormat = r.getFormat(); trigger.next(); } } }); } @Override public void rollback(FlowRollback trigger, Map data) { if (primaryStorageInstallPath != null) { DeleteBitsOnPrimaryStorageMsg delMsg = new DeleteBitsOnPrimaryStorageMsg(); delMsg.setInstallPath(PathUtil.parentFolder(primaryStorageInstallPath)); delMsg.setBitsUuid(vol.getUuid()); delMsg.setBitsType(VolumeVO.class.getSimpleName()); delMsg.setFolder(true); delMsg.setPrimaryStorageUuid(targetPrimaryStorage.getUuid()); delMsg.setHypervisorType(VolumeFormat.getMasterHypervisorTypeByVolumeFormat(vol.getFormat()).toString()); bus.makeTargetServiceIdByResourceUuid(delMsg, PrimaryStorageConstant.SERVICE_ID, targetPrimaryStorage.getUuid()); bus.send(delMsg); } trigger.rollback(); } }); done(new FlowDoneHandler(msg) { @Override public void handle(Map data) { vol.setInstallPath(primaryStorageInstallPath); vol.setStatus(VolumeStatus.Ready); if (volumeFormat != null) { vol.setFormat(volumeFormat); } VolumeVO vo = dbf.updateAndRefresh(vol); evt.setInventory(VolumeInventory.valueOf(vo)); bus.publish(evt); } }); error(new FlowErrorHandler(msg) { @Override public void handle(ErrorCode errCode, Map data) { evt.setErrorCode(errCode); bus.publish(evt); } }); } }).start(); } private void handle(APIGetVolumeMsg msg) { SearchQuery<VolumeInventory> q = new SearchQuery(VolumeInventory.class); q.addAccountAsAnd(msg); q.add("uuid", SearchOp.AND_EQ, msg.getUuid()); List<VolumeInventory> invs = q.list(); APIGetVolumeReply reply = new APIGetVolumeReply(); if (!invs.isEmpty()) { reply.setInventory(JSONObjectUtil.toJsonString(invs.get(0))); } bus.reply(msg, reply); } private void handle(APISearchVolumeMsg msg) { SearchQuery<VolumeInventory> q = SearchQuery.create(msg, VolumeInventory.class); q.addAccountAsAnd(msg); String res = q.listAsString(); APISearchVolumeReply reply = new APISearchVolumeReply(); reply.setContent(res); bus.reply(msg, reply); } private void handle(APIListVolumeMsg msg) { List<VolumeVO> vos = dl.listByApiMessage(msg, VolumeVO.class); List<VolumeInventory> invs = VolumeInventory.valueOf(vos); APIListVolumeReply reply = new APIListVolumeReply(); reply.setInventories(invs); bus.reply(msg, reply); } private void handle(APICreateDataVolumeMsg msg) { APICreateDataVolumeEvent evt = new APICreateDataVolumeEvent(msg.getId()); DiskOfferingVO dvo = dbf.findByUuid(msg.getDiskOfferingUuid(), DiskOfferingVO.class); VolumeVO vo = new VolumeVO(); if (msg.getResourceUuid() != null) { vo.setUuid(msg.getResourceUuid()); } else { vo.setUuid(Platform.getUuid()); } vo.setDiskOfferingUuid(dvo.getUuid()); vo.setDescription(msg.getDescription()); vo.setName(msg.getName()); vo.setSize(dvo.getDiskSize()); vo.setType(VolumeType.Data); vo.setStatus(VolumeStatus.NotInstantiated); acntMgr.createAccountResourceRef(msg.getSession().getAccountUuid(), vo.getUuid(), VolumeVO.class); tagMgr.createTagsFromAPICreateMessage(msg, vo.getUuid(), VolumeVO.class.getSimpleName()); vo = dbf.persistAndRefresh(vo); VolumeInventory inv = VolumeInventory.valueOf(vo); evt.setInventory(inv); logger.debug(String.format("Successfully created data volume[name:%s, uuid:%s, size:%s]", inv.getName(), inv.getUuid(), inv.getSize())); bus.publish(evt); } @Override public String getId() { return bus.makeLocalServiceId(VolumeConstant.SERVICE_ID); } @Override public boolean start() { VolumeGlobalConfig.VOLUME_EXPUNGE_INTERVAL.installUpdateExtension(new GlobalConfigUpdateExtensionPoint() { @Override public void updateGlobalConfig(GlobalConfig oldConfig, GlobalConfig newConfig) { startExpungeTask(); } }); VolumeGlobalConfig.VOLUME_EXPUNGE_PERIOD.installUpdateExtension(new GlobalConfigUpdateExtensionPoint() { @Override public void updateGlobalConfig(GlobalConfig oldConfig, GlobalConfig newConfig) { startExpungeTask(); } }); VolumeGlobalConfig.VOLUME_DELETION_POLICY.installUpdateExtension(new GlobalConfigUpdateExtensionPoint() { @Override public void updateGlobalConfig(GlobalConfig oldConfig, GlobalConfig newConfig) { startExpungeTask(); } }); return true; } @Override public boolean stop() { return true; } private synchronized void startExpungeTask() { if (volumeExpungeTask != null) { volumeExpungeTask.cancel(true); } volumeExpungeTask = thdf.submitCancelablePeriodicTask(new CancelablePeriodicTask() { private List<Tuple> getDeletedVolumeManagedByUs() { int qun = 1000; SimpleQuery q = dbf.createQuery(VolumeVO.class); q.add(VolumeVO_.status, Op.EQ, VolumeStatus.Deleted); q.add(VolumeVO_.type, Op.EQ, VolumeType.Data); long amount = q.count(); int times = (int)(amount / qun) + (amount % qun != 0 ? 1 : 0); int start = 0; List<Tuple> ret = new ArrayList<Tuple>(); for (int i=0; i<times; i++) { q = dbf.createQuery(VolumeVO.class); q.select(VolumeVO_.uuid, VolumeVO_.lastOpDate); q.add(VolumeVO_.status, Op.EQ, VolumeStatus.Deleted); q.add(VolumeVO_.type, Op.EQ, VolumeType.Data); q.setLimit(qun); q.setStart(start); List<Tuple> lst = q.listTuple(); start += qun; for (Tuple t : lst) { String uuid = t.get(0, String.class); if (!destMaker.isManagedByUs(uuid)) { continue; } ret.add(t); } } return ret; } @Override public boolean run() { List<Tuple> vols = getDeletedVolumeManagedByUs(); if (vols.isEmpty()) { logger.debug("[Volume Expunging Task]: no volume to expunge"); return false; } Timestamp current = dbf.getCurrentSqlTime(); for (final Tuple v : vols) { final String uuid = v.get(0, String.class); Timestamp date = v.get(1, Timestamp.class); long end = date.getTime() + TimeUnit.SECONDS.toMillis(VolumeGlobalConfig.VOLUME_EXPUNGE_PERIOD.value(Long.class)); if (current.getTime() >= end) { VolumeDeletionPolicy deletionPolicy = deletionPolicyMgr.getDeletionPolicy(uuid); if (deletionPolicy == VolumeDeletionPolicy.Never) { logger.debug(String.format("the deletion policy of the volume[uuid:%s] is Never, don't expunge it", uuid)); continue; } ExpungeVolumeMsg msg = new ExpungeVolumeMsg(); msg.setVolumeUuid(uuid); bus.makeTargetServiceIdByResourceUuid(msg, VolumeConstant.SERVICE_ID, uuid); bus.send(msg, new CloudBusCallBack() { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { logger.warn(String.format("failed to expunge the volume[uuid:%s], %s", uuid, reply.getError())); } else { logger.debug(String.format("successfully expunged the volume [uuid:%s]", uuid)); } } }); } } return false; } @Override public TimeUnit getTimeUnit() { return TimeUnit.SECONDS; } @Override public long getInterval() { return VolumeGlobalConfig.VOLUME_EXPUNGE_INTERVAL.value(Long.class); } @Override public String getName() { return "expunging-volume-task"; } }); logger.debug(String.format("volume expunging task starts [period: %s seconds, interval: %s seconds]", VolumeGlobalConfig.VOLUME_EXPUNGE_PERIOD.value(Long.class), VolumeGlobalConfig.VOLUME_EXPUNGE_INTERVAL.value(Long.class))); } @Override public void managementNodeReady() { startExpungeTask(); } }
e34cf096323a490910eefc10b3a47bf603a7f214
6b0dcff85194eddf0706e867162526b972b441eb
/kernel/api/fabric3-spi/src/main/java/org/fabric3/spi/federation/TopologyListener.java
4bb6c7fe65fb7e00a1cdad7f5f9755686c2c63f3
[]
no_license
jbaeck/fabric3-core
802ae3889169d7cc5c2f3e2704cfe3338931ec76
55aaa7b2228c9bf2c2630cc196938d48a71274ff
refs/heads/master
2021-01-18T15:27:25.959653
2012-11-04T00:36:36
2012-11-04T00:36:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,283
java
/* * Fabric3 * Copyright (c) 2009-2012 Metaform Systems * * Fabric3 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version, with the * following exception: * * Linking this software statically or dynamically with other * modules is making a combined work based on this software. * Thus, the terms and conditions of the GNU General Public * License cover the whole combination. * * As a special exception, the copyright holders of this software * give you permission to link this software with independent * modules to produce an executable, regardless of the license * terms of these independent modules, and to copy and distribute * the resulting executable under terms of your choice, provided * that you also meet, for each linked independent module, the * terms and conditions of the license of that module. An * independent module is a module which is not derived from or * based on this software. If you modify this software, you may * extend this exception to your version of the software, but * you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * * Fabric3 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the * GNU General Public License along with Fabric3. * If not, see <http://www.gnu.org/licenses/>. */ package org.fabric3.spi.federation; /** * Receives callbacks when a domain topology changes. */ public interface TopologyListener { /** * Callback when a runtime joins a domain. * * @param name the runtime name */ void onJoin(String name); /** * Callback when a runtime leaves a domain. * * @param name the runtime name */ void onLeave(String name); /** * Callback when a runtime is elected leader in a domain. * * @param name the runtime name */ void onLeaderElected(String name); }
2c95d8b675f5fc30f90023b868a17e88403f5f4b
dcb0d84a8e7014fec5ef1179406a140216bba77e
/firebase-common/src/test/java/com/google/firebase/heartbeatinfo/TestOnCompleteListener.java
1f6d9078621e6308835075939cee4affd3fef5a0
[ "Apache-2.0" ]
permissive
xcogitation/firebase-android-sdk
b8df4a0bce51f3bf0316a964739c4e5abfcc65a1
884e53770ef0fb224b9401ade32a4f8fc4bc4e35
refs/heads/master
2023-03-19T23:23:54.322975
2022-07-29T21:30:43
2022-07-29T21:30:43
233,048,513
0
0
Apache-2.0
2023-03-06T17:05:44
2020-01-10T13:04:48
Java
UTF-8
Java
false
false
2,443
java
// Copyright 2020 Google LLC // // 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.google.firebase.heartbeatinfo; import androidx.annotation.NonNull; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import java.io.IOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; /** * Helper listener that works around a limitation of the Tasks API where await() cannot be called on * the main thread. This listener works around it by running itself on a different thread, thus * allowing the main thread to be woken up when the Tasks complete. */ public class TestOnCompleteListener<TResult> implements OnCompleteListener<TResult> { private static final long TIMEOUT_MS = 5000; private final CountDownLatch latch = new CountDownLatch(1); private Task<TResult> task; private volatile TResult result; private volatile Exception exception; private volatile boolean successful; @Override public void onComplete(@NonNull Task<TResult> task) { this.task = task; successful = task.isSuccessful(); if (successful) { result = task.getResult(); } else { exception = task.getException(); } latch.countDown(); } /** Blocks until the {@link #onComplete} is called. */ public TResult await() throws InterruptedException, ExecutionException { if (!latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) { throw new InterruptedException("timed out waiting for result"); } if (successful) { return result; } else { if (exception instanceof InterruptedException) { throw (InterruptedException) exception; } if (exception instanceof IOException) { throw new ExecutionException(exception); } throw new IllegalStateException("got an unexpected exception type", exception); } } }
57b6a7bdf8e1188249ac76c0bf01dd1e68a9cd0e
647caba1dfc9d144ebb3d42d5028d8c21fdf5e52
/src/scienceWork/Workers/PictureWorker.java
8fcea4f22fa6eed94925fc829758150c3087be72
[ "Apache-2.0" ]
permissive
fev0ks/MyProject
47cc77781b084fd5c1ca812229a5a8b16e5c63b2
8d4d3ddee06eff9666f23053e6bfce0025073853
refs/heads/master
2021-01-17T08:25:29.671452
2018-06-14T14:20:05
2018-06-14T14:20:05
83,908,203
0
0
null
null
null
null
UTF-8
Java
false
false
3,360
java
package scienceWork.Workers; import javafx.scene.image.Image; import org.opencv.core.*; import org.opencv.features2d.Features2d; import org.opencv.imgcodecs.Imgcodecs; import scienceWork.objects.Picture; import java.io.ByteArrayInputStream; public class PictureWorker { public static Image getImage(Picture picture, boolean grayScale, boolean printKeyPoint) throws Exception{ Mat outputImage = FileWorker.getInstance().getMatFromFileOfImage(picture.getPicFile(), grayScale, true); if(printKeyPoint) { Scalar color = new Scalar(0, 255, 255); int flags = Features2d.NOT_DRAW_SINGLE_POINTS; Features2d.drawKeypoints(outputImage, picture.getDescriptorProperty().getMatOfKeyPoint(), outputImage, color, flags); } return convertMatToFXImage(outputImage); } private static Image convertMatToFXImage(Mat mat) { MatOfByte byteMat = new MatOfByte(); Imgcodecs.imencode(".bmp", mat, byteMat); return new Image(new ByteArrayInputStream(byteMat.toArray())); } //перевод изображения в формат OpenCV - Mat // public static Mat getMatFromImage(BufferedImage image) throws Exception { // System.loadLibrary(Core.NATIVE_LIBRARY_NAME); //// System.out.println(image.getHeight()); // Mat imageMat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC3); // byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); // imageMat.put(0, 0, data); // return imageMat; // } // public static Image printClusters(Picture picture, Mat clusters) { //// ClusterTools clusterTools = new ClusterTools(); // BufferedImage bufferedImage = FileWorker.getInstance().loadBufferedImage(picture.getPicFile()); // // Map<Integer, Integer> colorKP = new HashMap(); // for (int i = 0; i < picture.getDescriptorProperty().getCountOfDescr(); i++) { //// double minDistance = Double.MAX_VALUE; //// double distance; //// int numberCluster = -1; //// Mat clusterOfOwnPicture = picture.getDescriptorProperty().getMatOfDescription().row(i); //// for (int j = 0; j < clusters.height(); j++) { //// distance = clusterTools.findDistanceForMats(clusterOfOwnPicture, clusters.row(j)); //// if (distance < minDistance) { //// minDistance = distance; //// numberCluster = j; //// } //// } // colorKP.put(i, -i * (1000000 / 5)); // } // int cluster = 0; // for (KeyPoint keyPoints : picture.getDescriptorProperty().getMatOfKeyPoint().toArray()) { //// System.out.println(cluster+" "+colorKP.get(cluster)); // printCircle(bufferedImage, (int) keyPoints.pt.x, (int) keyPoints.pt.y, colorKP.get(cluster++)); // cluster++; // } // return SwingFXUtils.toFXImage(bufferedImage, null); // // } // private static void printCircle(BufferedImage bufferedImage, int x, int y, int color) { // bufferedImage.setRGB(x, y, color); // bufferedImage.setRGB(x + 1, y, color); // bufferedImage.setRGB(x, y + 1, color); // bufferedImage.setRGB(x, y - 1, color); // bufferedImage.setRGB(x - 1, y, color); // } }
daedbbdd9f222400ec1a6cf16da01872dc96e5db
e3659e39d4d5e2a322e6e2f3a707fcc8d04a0b42
/GCD of 2 numbers/Main.java
2ebc7bc0d02b7623eea5382a206d08bd88876ecd
[]
no_license
gowthamsss/Playground
5f10c38e8337ea11a81e53e76bd9552fc4dac095
f470c143ac444f137e78395d0c416b3f63d97139
refs/heads/master
2020-06-09T16:21:21.702036
2019-07-16T10:04:19
2019-07-16T10:04:19
193,467,080
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
#include <stdio.h> // Main function int main() { // Enter your code here int n1,n2; scanf("%d%d",&n1,&n2); while(n1!=n2) { if(n1>n2) n1=n1-n2; else n2=n2-n1; } printf("%d",n1); return 0; }
614d4e6be857c4f15db1ad65f72bc1e02400d592
cd4802766531a9ccf0fb54ca4b8ea4ddc15e31b5
/java/com/l2jmobius/gameserver/model/events/impl/character/npc/OnAttackableHate.java
a51372b2518406d19eb320c83bd645c51a5bda02
[]
no_license
singto53/underground
8933179b0d72418f4b9dc483a8f8998ef5268e3e
94264f5168165f0b17cc040955d4afd0ba436557
refs/heads/master
2021-01-13T10:30:20.094599
2016-12-11T20:32:47
2016-12-11T20:32:47
76,455,182
0
1
null
null
null
null
UTF-8
Java
false
false
1,634
java
/* * This file is part of the L2J Mobius project. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.l2jmobius.gameserver.model.events.impl.character.npc; import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.impl.IBaseEvent; /** * @author UnAfraid */ public class OnAttackableHate implements IBaseEvent { private final L2Attackable _npc; private final L2PcInstance _activeChar; private final boolean _isSummon; public OnAttackableHate(L2Attackable npc, L2PcInstance activeChar, boolean isSummon) { _npc = npc; _activeChar = activeChar; _isSummon = isSummon; } public final L2Attackable getNpc() { return _npc; } public final L2PcInstance getActiveChar() { return _activeChar; } public boolean isSummon() { return _isSummon; } @Override public EventType getType() { return EventType.ON_NPC_HATE; } }
[ "MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b" ]
MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b
69a3ed2111139091a2bf15eadfd1bac115ca7266
0687bfb68c2b6ebd6951ea1ab2a9154e88193b24
/backend/rmncha-collection-service/src/main/java/org/sdrc/rmncha/util/AreaMapObject.java
3d998e06fab815c29e1e33fd248e1286f8800c65
[]
no_license
SDRC-India/ADARSSH
c689ae9c93cbbc1d44ae875f80182caae29ca42b
e5563449292bfc9e02744d9a70f2db5546d89fd9
refs/heads/main
2023-03-30T02:26:51.648770
2021-04-01T07:42:06
2021-04-01T07:42:06
353,615,854
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package org.sdrc.rmncha.util; import java.util.List; import java.util.Map; import lombok.Data; @Data public class AreaMapObject { private List<Integer> areaList; private Map<Integer, Integer> areaMap; }
8f6d8fe2a8b0b58619e4be410d10483cd51316f6
97d386fde6f039f9c320270da9e6f9eec9dc5dd2
/src/test/java/com/marklogic/clientutil/modulesloader/impl/DefaultModulesFinderTest.java
61919511eb5dc92496d348f2010e29fb2abb41aa
[ "Apache-2.0" ]
permissive
lewisap/ml-javaclient-util
9cf4961911c1c955dfe9626a8e58e1941ce49f91
e7f9394dd07b0c7ee869a522197197479812bdce
refs/heads/master
2021-01-18T03:02:59.721427
2015-02-23T16:13:41
2015-02-23T16:13:41
30,873,860
0
0
null
2015-02-16T15:18:39
2015-02-16T15:18:38
null
UTF-8
Java
false
false
2,711
java
package com.marklogic.clientutil.modulesloader.impl; import java.io.File; import java.io.IOException; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.springframework.core.io.ClassPathResource; import com.marklogic.clientutil.modulesloader.Asset; import com.marklogic.clientutil.modulesloader.Modules; import com.marklogic.clientutil.modulesloader.ModulesFinder; import com.marklogic.clientutil.modulesloader.impl.DefaultModulesFinder; public class DefaultModulesFinderTest extends Assert { private ModulesFinder sut = new DefaultModulesFinder(); @Test public void baseDirWithExtensionsOfEachKind() throws IOException { Modules files = sut.findModules(getBaseDir("sample-base-dir")); assertEquals(1, files.getOptions().size()); assertEquals("Only recognized XQuery files should be included; the XML file should be ignored", 2, files .getServices().size()); assertEquals("Only recognized XSL files should be included; the XML file should be ignored", 4, files .getTransforms().size()); List<Asset> assets = files.getAssets(); assertEquals(2, assets.size()); assertEquals("/lib/module2.xqy", assets.get(0).getPath()); assertEquals("/module1.xqy", assets.get(1).getPath()); assertEquals( "Namespace files don't have to fit any filename format; the body of the file should be the namespace URI", 1, files.getNamespaces().size()); } @Test public void emptyBaseDir() throws IOException { Modules files = sut.findModules(getBaseDir("empty-base-dir")); assertEquals(0, files.getAssets().size()); assertEquals(0, files.getOptions().size()); assertEquals(0, files.getServices().size()); assertEquals(0, files.getTransforms().size()); } @Test public void versionControlFilesInAssetsDirectory() { Modules files = sut.findModules(getBaseDir("base-dir-with-version-control-files")); List<Asset> assets = files.getAssets(); assertEquals( "The directory and file starting with . should have been ignored, as those are considered to be version control files", 1, assets.size()); assertEquals("Confirming that the only asset found was the xquery module", "sample.xqy", assets.get(0) .getFile().getName()); } private File getBaseDir(String path) { try { return new ClassPathResource(path).getFile(); } catch (IOException e) { throw new RuntimeException(path); } } }
8bc05eebf4ff2ea7f4deac4b36d873a966e0accd
dfc7d23a8b0f77631ff3fbcc19d65e661ee4fdec
/SGenerale/src/main/java/com/SGenerale/repository/EmployeeRepository.java
147100ab732a65c1cb19a190b11c1e7b781161d3
[]
no_license
lvhkrishna/SocieteGenerale-ps
2821982275b2ccd2e54fe2203343d800dc0030b2
f5f937ba423ffa1cc6db79c7d9db5b2b795a9f99
refs/heads/master
2023-01-10T17:48:08.737729
2019-11-24T17:55:58
2019-11-24T17:55:58
223,719,790
0
0
null
2023-01-07T12:06:23
2019-11-24T09:24:15
HTML
UTF-8
Java
false
false
289
java
package com.SGenerale.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.SGenerale.entity.Employee; @Repository public interface EmployeeRepository extends JpaRepository<Employee, Long> { }
[ "lvhkr@LVHK" ]
lvhkr@LVHK
ac23a3deff4c4e77eb9879be7b53a11c2103e996
1c94dc584b0076c8a87774317c44cf1fd7d351ff
/net-proxy-core/src/main/java/tech/pcloud/proxy/core/model/NodeType.java
bb049766e62fe0b435804ff9c31607072b843705
[ "Apache-2.0" ]
permissive
pandong2015/net-proxy
17f90f0c0c1fd3751c0c3776bc3231e66c740daf
f13bd0ee5f32a2f0e65ee2b174dd3f347881e147
refs/heads/master
2020-04-05T20:05:25.494097
2018-11-13T01:49:35
2018-11-13T01:49:36
157,163,590
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package tech.pcloud.proxy.core.model; public enum NodeType { SERVER(0), CLIENT(1); int type; NodeType(int type) { this.type = type; } public int getType() { return type; } }
44a13343efc493450b651c1c4ac7dba15b096ae8
005553bcc8991ccf055f15dcbee3c80926613b7f
/generated/typekey/InitialTreatment.java
76c08bd1c04ae4b15a1938e05391aedd2858be6e
[]
no_license
azanaera/toggle-isbtf
5f14209cd87b98c123fad9af060efbbee1640043
faf991ec3db2fd1d126bc9b6be1422b819f6cdc8
refs/heads/master
2023-01-06T22:20:03.493096
2020-11-16T07:04:56
2020-11-16T07:04:56
313,212,938
0
0
null
2020-11-16T08:48:41
2020-11-16T06:42:23
null
UTF-8
Java
false
false
8,925
java
package typekey; @javax.annotation.processing.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "InitialTreatment.tti;InitialTreatment.tix;InitialTreatment.ttx") @java.lang.SuppressWarnings(value = {"deprecation", "unchecked"}) @gw.internal.gosu.parser.ExtendedType public class InitialTreatment implements gw.entity.TypeKey { /** * No medical treatment * No medical treatment */ public static final typekey.InitialTreatment TC_0 = new typekey.InitialTreatment("0"); /** * Minor on-site remedies by employer medical staff * Minor on-site remedies by employer medical staff */ public static final typekey.InitialTreatment TC_1 = new typekey.InitialTreatment("1"); /** * Minor clinic/hospital medical remedies and diagnostic testing * Minor clinic/hospital medical remedies and diagnostic testing */ public static final typekey.InitialTreatment TC_2 = new typekey.InitialTreatment("2"); /** * Emergency evaluation, diagnostic testing, and medical procedures * Emergency evaluation, diagnostic testing, and medical procedures */ public static final typekey.InitialTreatment TC_3 = new typekey.InitialTreatment("3"); /** * Hospitalization greater than 24 hours * Hospitalization greater than 24 hours */ public static final typekey.InitialTreatment TC_4 = new typekey.InitialTreatment("4"); /** * Future major medical/Lost time anticipated (i.e. hernia case) * Future major medical/Lost time anticipated (i.e. hernia case) */ public static final typekey.InitialTreatment TC_5 = new typekey.InitialTreatment("5"); public static final gw.pl.persistence.type.TypeListTypeReference<typekey.InitialTreatment> TYPE = new com.guidewire.commons.metadata.types.TypeListIntrinsicTypeCache<typekey.InitialTreatment>("InitialTreatment"); private final com.guidewire.commons.typelist.TypeKeyImplManager _typeKeyImplManager; private InitialTreatment(java.lang.String code) { _typeKeyImplManager = com.guidewire.commons.typelist.TypeKeyImplManager.newInstance(this, code); } public int compareTo(gw.entity.TypeKey arg0) { return _typeKeyImplManager.getTypeKeyImpl().compareTo(arg0); } /** * * @deprecated Use this object instead. */ @java.lang.Deprecated public typekey.InitialTreatment get() { return this; } public static typekey.InitialTreatment get(java.lang.String code) { return TYPE.get().getTypeKey(code); } public static java.util.List<typekey.InitialTreatment> getAllTypeKeys() { return TYPE.get().getTypeKeys(true); } /** * Returns the list of categories that this key belongs to * @return the categories that this key belongs to */ public gw.entity.TypeKey[] getCategories() { return _typeKeyImplManager.getTypeKeyImpl().getCategories(); } public java.lang.String getCode() { return _typeKeyImplManager.getCode(); } /** * Returns the description for this typekey for the current locale. * @return the description for this typekey */ public java.lang.String getDescription() { return _typeKeyImplManager.getTypeKeyImpl().getDescription(); } /** * Returns the description of this typekey for the given locale. * @param locale the locale to use to get the description * @return a description for this typekey for the given locale */ public java.lang.String getDescription(gw.i18n.ILocale locale) { return _typeKeyImplManager.getTypeKeyImpl().getDescription(locale); } public java.lang.String getDisplayName() { return _typeKeyImplManager.getTypeKeyImpl().getDisplayName(); } /** * Returns the name of this typekey for the given locale. * @param locale */ public java.lang.String getDisplayName(gw.i18n.ILocale locale) { return _typeKeyImplManager.getTypeKeyImpl().getDisplayName(locale); } /** * Gets the entity type associated with this typekey, if any. Returns null if this is not a subtype typekey. */ public gw.entity.IEntityType getEntityType() { return _typeKeyImplManager.getTypeKeyImpl().getEntityType(); } /** * Returns the owning type for this key. * @return */ public gw.entity.ITypeList getIntrinsicType() { return _typeKeyImplManager.getTypeKeyImpl().getIntrinsicType(); } /** * A string containing the typelist name. */ public java.lang.String getListName() { return _typeKeyImplManager.getTypeKeyImpl().getListName(); } /** * Returns the value of the "name" attribute for this typekey. * @return the name of this typekey * @deprecated Use {@link #getDisplayName()} or {@link #getUnlocalizedName()} instead, as appropriate. */ @java.lang.Deprecated public java.lang.String getName() { return _typeKeyImplManager.getTypeKeyImpl().getName(); } public int getOrdinal() { return _typeKeyImplManager.getTypeKeyImpl().getOrdinal(); } /** * Returns the priority for this type key * @return the priority for this type key */ public int getPriority() { return _typeKeyImplManager.getTypeKeyImpl().getPriority(); } /** * Returns the sort order for this type key in the specified language. * @param locale * @return the sort order for this type key */ public int getSortOrder(gw.i18n.ILocale locale) { return _typeKeyImplManager.getTypeKeyImpl().getSortOrder(locale); } public static typekey.InitialTreatment getTypeKey(java.lang.String code) { return TYPE.get().getTypeKey(code); } /** * All of the typekeys in this list, including retired typekeys. * @deprecated Use getTypeKeys(boolean) */ @java.lang.Deprecated public static typekey.InitialTreatment[] getTypeKeys() { return TYPE.get().getTypeKeys(true).toArray(new typekey.InitialTreatment[]{}); } public static java.util.List<typekey.InitialTreatment> getTypeKeys(boolean includeRetired) { return TYPE.get().getTypeKeys(includeRetired); } /** * Returns the (non-localized) description of this typekey. Generally should not be used by application code. To get a * displayable string, use {@link #getDescription()} instead. * @return the non-localized description of this typekey */ public java.lang.String getUnlocalizedDescription() { return _typeKeyImplManager.getTypeKeyImpl().getUnlocalizedDescription(); } /** * Returns the (non-localized) name of this typekey. Generally should not be used by application code. To get a * displayable string, use {@link #getDisplayName()} instead. To get a unique string identifier for this typekey, * use {@link #getCode()} instead. * @return the non-localized name of this typekey */ public java.lang.String getUnlocalizedName() { return _typeKeyImplManager.getTypeKeyImpl().getUnlocalizedName(); } public typekey.InitialTreatment getValue() { return this; } /** * Checks to see if this typekey has a category corresponding to the given * typekey. For a match to be found, this typekey has to have a category * with the same typelist and code as the given typekey. * @param categoryToCheck * @return */ public boolean hasCategory(gw.entity.TypeKey categoryToCheck) { return _typeKeyImplManager.getTypeKeyImpl().hasCategory(categoryToCheck); } /** * A boolean that indicates a type code is for internal use by Guidewire software. Internal type codes cannot be * removed or modified. */ public boolean isInternal() { return _typeKeyImplManager.getTypeKeyImpl().isInternal(); } /** * Returns true if this type key is retired. Retired type keys will not show up in the UI. * @return true if this type key is retired false if not. */ public boolean isRetired() { return _typeKeyImplManager.getTypeKeyImpl().isRetired(); } private java.lang.Object readObject(java.io.ObjectInputStream in) throws java.io.InvalidObjectException { throw new java.io.InvalidObjectException("Proxy required"); } public java.lang.String toString() { return getDisplayName(); } private java.lang.Object writeReplace() { return new com.guidewire.commons.typelist.TypeKeySerializationProxy(this); } static { com.guidewire._generated.typekey.InitialTreatmentInternalAccess.FRIEND_ACCESSOR.init(new com.guidewire.pl.persistence.code.TypeKeyFriendAccess<typekey.InitialTreatment>() { public void clearCache(typekey.InitialTreatment typeKey) { typeKey._typeKeyImplManager.resetTypeKeyImpl(); } public com.guidewire.commons.entity.type2.TypeKeyInternal getInternalInterface(typekey.InitialTreatment typeKey) { return typeKey._typeKeyImplManager.getTypeKeyImpl(); } public typekey.InitialTreatment newInstance(java.lang.String code) { return new typekey.InitialTreatment(code); } }); } }
20ce1798e08f1c740b566b282dacc14ae46f10b0
186fd61b9abcba02d0080f4ec3b703d1ed25bad5
/app/src/main/java/net/albertogarrido/moviecovers/util/Config.java
a438262c2b5c613b4e4b2014d9dcc3d073171fd7
[]
no_license
albertogarrido/Movie-Covers-Gallery
a40fac970db9acf5b0e57b0d325df88c43910bd7
1441da374eb0e40219edc4cd0dab8360391341b4
refs/heads/master
2021-01-09T20:15:13.490403
2016-06-30T13:02:53
2016-06-30T13:02:53
62,174,768
2
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
package net.albertogarrido.moviecovers.util; /** * Created by AlbertoGarrido on 28/6/16. */ public class Config { public static final String API_KEY = "683a17e30ba7af16811ed34994d4b695"; public static final String ENDPOINT_API_URL = "http://api.themoviedb.org/"; public static final String VERSION = "3/"; public static final String TOP_RATED_MOVIES = "movie/top_rated"; public static final String SEARCH_BY_TITLE = "search/movie"; public static final String IMAGE_BASE_URL = "http://image.tmdb.org/t/p/"; public static final String POSTER_SIZE_W92 = "w92"; public static final String POSTER_SIZE_W154 = "w154"; public static final String POSTER_SIZE_W185 = "w185"; public static final String POSTER_SIZE_W342 = "w342"; public static final String POSTER_SIZE_W500 = "w500"; public static final String POSTER_SIZE_W780 = "w780"; public static final String POSTER_SIZE_ORIGINAL = "original"; public static final String ADAPTER_TYPE_GRID = "grid"; public static final String ADAPTER_TYPE_LIST = "list"; }
0afa63e9c1a98f0e9c1368155f0a5d5907d449ac
0d384c8706787dd69ac2824451660936fac376fd
/src/main/java/ru/tsystems/reha/config/SecurityWebApplicationInitializer.java
056adb92d60da7475b7c1853123fb7a70ca4670f
[]
no_license
Kudesnik99/Reha2
6c0c24d7e7c276a8034f27387bf070c68ee6cbfc
d8ea470516e89516e09370a77bfbb4a0000f86ed
refs/heads/master
2022-12-28T16:07:03.167091
2019-11-26T17:21:05
2019-11-26T17:21:05
216,775,775
0
0
null
2022-12-15T23:25:11
2019-10-22T09:34:08
JavaScript
UTF-8
Java
false
false
227
java
package ru.tsystems.reha.config; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer { }
[ "Pferd3Pferd3" ]
Pferd3Pferd3
818af356f7684b4b82c4e50a57e5c394bb09d3b1
943e409df7d8390c0ba798eb78eeb88f7b2f59e4
/Lecture6/01.Lab/src/P03_CountUppercaseWords/Main.java
54ad394b3507c2f074bc32cd74ae7f5ad844217c
[ "MIT" ]
permissive
doXi70/Java-Fundamentals-May-2018
527135efda4c3a344127f1d74d3ae99907a226b7
83c99cd9a6ab7639bdc10f466e8ca1f4cb98327d
refs/heads/master
2020-03-17T10:17:40.360336
2018-06-10T12:47:06
2018-06-10T12:47:06
133,507,234
1
0
null
null
null
null
UTF-8
Java
false
false
108
java
package P03_CountUppercaseWords; public class Main { public static void main(String[] args) { } }
775f5d8cdbc031a299df963e6c911e03d26203f7
a17dd1e9f5db1c06e960099c13a5b70474d90683
/core/src/main/java/jp/co/sint/webshop/service/catalog/RelatedSearchQueryGift.java
b60f808eb758bfd26cd4b1e9d3c34f7a7f23217a
[]
no_license
giagiigi/ec_ps
4e404afc0fc149c9614d0abf63ec2ed31d10bebb
6eb19f4d14b6f3a08bfc2c68c33392015f344cdd
refs/heads/master
2020-12-14T07:20:24.784195
2015-02-09T10:00:44
2015-02-09T10:00:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,317
java
package jp.co.sint.webshop.service.catalog; import java.util.ArrayList; import java.util.List; import jp.co.sint.webshop.data.AbstractQuery; import jp.co.sint.webshop.data.DatabaseUtil; import jp.co.sint.webshop.data.dto.Gift; import jp.co.sint.webshop.data.dto.GiftCommodity; import jp.co.sint.webshop.utility.SqlDialect; import jp.co.sint.webshop.utility.StringUtil; public class RelatedSearchQueryGift extends AbstractQuery <RelatedGift> { /** * */ private static final long serialVersionUID = 1L; /** * */ public RelatedSearchQueryGift() { } /** * 該当の商品コードに関連付いているギフトの一覧を取得する */ public RelatedSearchQueryGift createRelatedGiftSearchQuery(RelatedSearchConditionBaseCommodity condition) { StringBuilder builder = new StringBuilder(); List<Object> params = new ArrayList<Object>(); builder.append(" SELECT A.SHOP_CODE, " + " A.GIFT_CODE, " + " A.GIFT_NAME, " + " A.GIFT_PRICE, " + " A.GIFT_DESCRIPTION, " + " A.GIFT_TAX_TYPE, " + " B.COMMODITY_CODE " + " FROM (" + DatabaseUtil.getSelectAllQuery(Gift.class) + " WHERE SHOP_CODE = ?) A " + " LEFT OUTER JOIN (" + DatabaseUtil.getSelectAllQuery(GiftCommodity.class) + " WHERE SHOP_CODE = ? AND " + " COMMODITY_CODE = ?) B " + " ON A.SHOP_CODE = B.SHOP_CODE AND " + " A.GIFT_CODE = B.GIFT_CODE "); params.add(condition.getShopCode()); params.add(condition.getShopCode()); params.add(condition.getCommodityCode()); builder.append(" WHERE 1 = 1 "); if (StringUtil.hasValue(condition.getSearchEffectualCodeStart()) && StringUtil.hasValue(condition.getSearchEffectualCodeEnd())) { builder.append(" AND A.GIFT_CODE BETWEEN ? AND ?"); params.add(condition.getSearchEffectualCodeStart()); params.add(condition.getSearchEffectualCodeEnd()); } else if (StringUtil.hasValue(condition.getSearchEffectualCodeStart())) { builder.append(" AND A.GIFT_CODE >= ?"); params.add(condition.getSearchEffectualCodeStart()); } else if (StringUtil.hasValue(condition.getSearchEffectualCodeEnd())) { builder.append(" AND A.GIFT_CODE <= ?"); params.add(condition.getSearchEffectualCodeEnd()); } if (StringUtil.hasValue(condition.getSearchEffectualName())) { builder.append(" AND "); builder.append(SqlDialect.getDefault().getLikeClausePattern("A.GIFT_NAME")); String commodityName = SqlDialect.getDefault().escape(condition.getSearchEffectualName()); commodityName = "%" + commodityName + "%"; params.add(commodityName); } builder.append(" ORDER BY A.GIFT_CODE"); setSqlString(builder.toString()); setParameters(params.toArray()); setPageNumber(condition.getCurrentPage()); setPageSize(condition.getPageSize()); return this; } /** * */ public Class <RelatedGift> getRowType() { return RelatedGift.class; } }
f4fb34b45a1d90d79236fc7f0decb14135872588
c52137e70f5433e8e11f80f881c7d4f8a682ca10
/SpringApp/src/main/java/com/apal/spring/di/services/MessageService.java
26f34257b25cd28be5975b4729519353b1e30b9b
[]
no_license
abhijeetpal09/spring
52fa1050e99d69d79639ff61618ed9b9e980f103
3164aad8ec5d91e06041c2b384de54a37e0aeec5
refs/heads/master
2020-03-20T03:51:44.340883
2018-06-13T04:27:15
2018-06-13T04:27:15
137,162,236
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package com.apal.spring.di.services; public interface MessageService { boolean sendMessage(String msg, String rec); }
745b59fe855cbfa0906c2051466dbea7c890e323
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_cec88aceddfd7887ee9490a85b8d571d14540db7/CardListFragment/9_cec88aceddfd7887ee9490a85b8d571d14540db7_CardListFragment_s.java
34f89015bea49766513c2f6fc17268f1a20cc5bb
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
7,699
java
package edu.mit.mobile.android.livingpostcards; import java.io.IOException; import android.content.ContentUris; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.TextView; import android.widget.Toast; import com.stackoverflow.ArrayUtils; import edu.mit.mobile.android.imagecache.ImageCache; import edu.mit.mobile.android.imagecache.ImageLoaderAdapter; import edu.mit.mobile.android.imagecache.SimpleThumbnailCursorAdapter; import edu.mit.mobile.android.livingpostcards.auth.Authenticator; import edu.mit.mobile.android.livingpostcards.data.Card; import edu.mit.mobile.android.locast.data.PrivatelyAuthorable; import edu.mit.mobile.android.locast.sync.LocastSyncService; public class CardListFragment extends ListFragment implements LoaderCallbacks<Cursor>, OnItemClickListener { private static final String[] FROM = { Card.COL_TITLE, Card.COL_AUTHOR, Card.COL_COVER_PHOTO, Card.COL_THUMBNAIL }; private static final int[] TO = { R.id.title, R.id.author, R.id.card_media_thumbnail, R.id.card_media_thumbnail }; private static final String[] PROJECTION = ArrayUtils.concat(new String[] { Card._ID, Card.COL_PRIVACY, Card.COL_AUTHOR_URI, Card.COL_WEB_URL }, FROM); private SimpleThumbnailCursorAdapter mAdapter; ImageCache mImageCache; public static final String ARG_CARD_DIR_URI = "uri"; private Uri mCards = Card.ALL_BUT_DELETED; private float mDensity; private static final String TAG = CardListFragment.class.getSimpleName(); private static final int[] IMAGE_IDS = new int[] { R.id.card_media_thumbnail }; public CardListFragment() { super(); } public static CardListFragment instantiate(Uri cardDir) { final Bundle b = new Bundle(); b.putParcelable(ARG_CARD_DIR_URI, cardDir); final CardListFragment f = new CardListFragment(); f.setArguments(b); return f; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); if (args != null) { final Uri newUri = args.getParcelable(ARG_CARD_DIR_URI); mCards = newUri != null ? newUri : mCards; } } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mImageCache = ImageCache.getInstance(getActivity()); mAdapter = new SimpleThumbnailCursorAdapter(getActivity(), R.layout.card_list_item, null, FROM, TO, IMAGE_IDS, 0) { @Override public void bindView(View v, Context context, Cursor c) { super.bindView(v, context, c); ((TextView) v.findViewById(R.id.title)).setText(Card.getTitle(context, c)); } }; setListAdapter(new ImageLoaderAdapter(getActivity(), mAdapter, mImageCache, IMAGE_IDS, 133, 100, ImageLoaderAdapter.UNIT_DIP)); getListView().setOnItemClickListener(this); getLoaderManager().initLoader(0, null, this); LocastSyncService.startExpeditedAutomaticSync(getActivity(), mCards); registerForContextMenu(getListView()); mDensity = getActivity().getResources().getDisplayMetrics().density; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.card_list_fragment, container, false); } @Override public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) { return new CursorLoader(getActivity(), mCards, PROJECTION, null, null, null); } @Override public void onLoadFinished(Loader<Cursor> arg0, Cursor c) { mAdapter.swapCursor(c); } @Override public void onLoaderReset(Loader<Cursor> arg0) { mAdapter.swapCursor(null); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final Uri item = ContentUris.withAppendedId(mCards, id); startActivity(new Intent(Intent.ACTION_VIEW, item)); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { getActivity().getMenuInflater().inflate(R.menu.activity_card_view, menu); final Cursor c = mAdapter.getCursor(); if (c == null) { return; } final String myUserUri = Authenticator.getUserUri(getActivity()); final boolean isEditable = PrivatelyAuthorable.canEdit(myUserUri, c); menu.findItem(R.id.delete).setVisible(isEditable); menu.findItem(R.id.edit).setVisible(isEditable); menu.setHeaderTitle(Card.getTitle(getActivity(), c)); Drawable icon; try { icon = mImageCache.loadImage(0, Uri.parse(c.getString(c.getColumnIndexOrThrow(Card.COL_COVER_PHOTO))), (int) (133 * mDensity), (int) (100 * mDensity)); if (icon != null) { menu.setHeaderIcon(new InsetDrawable(icon, (int) (5 * mDensity))); } } catch (final IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void send(Cursor c) { final String mWebUrl = c.getString(c.getColumnIndexOrThrow(Card.COL_WEB_URL)); if (mWebUrl == null) { Toast.makeText(getActivity(), R.string.err_share_intent_no_web_url_editable, Toast.LENGTH_LONG).show(); return; } startActivity(Card.createShareIntent(getActivity(), mWebUrl, Card.getTitle(getActivity(), c))); } @Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); } catch (final ClassCastException e) { Log.e(TAG, "bad menuInfo", e); return false; } final Uri card = ContentUris.withAppendedId(mCards, info.id); switch (item.getItemId()) { case R.id.share: send(mAdapter.getCursor()); return true; case R.id.edit: startActivity(new Intent(Intent.ACTION_EDIT, card)); return true; case R.id.delete: startActivity(new Intent(Intent.ACTION_DELETE, card)); return true; default: return super.onContextItemSelected(item); } } }
c56448928d1154998800c75a91637ea6228d3673
9e1ad5e186a1107e796794553a9bf4976d1f3964
/src/main/java/com/crazyBird/controller/user/model/kongModel.java
d0674ded442a77b480d6b6985e0a45c3a4a9197c
[]
no_license
LaoDai666/CrazyBird
b8495b913c6295d50658f59c9c990577086aa162
8ef7a006214fc3e52278efa66b7d66dbfb94e1ba
refs/heads/master
2022-12-23T23:24:29.651361
2019-08-31T09:26:25
2019-08-31T09:26:25
205,523,195
0
0
null
2022-12-16T03:31:59
2019-08-31T09:21:30
Java
UTF-8
Java
false
false
563
java
package com.crazyBird.controller.user.model; import com.crazyBird.controller.base.AbstractFlagModel; public class kongModel extends AbstractFlagModel{ private String aname; private String apass; private String aemail; public String getAname() { return aname; } public void setAname(String aname) { this.aname = aname; } public String getApass() { return apass; } public void setApass(String apass) { this.apass = apass; } public String getAemail() { return aemail; } public void setAemail(String aemail) { this.aemail = aemail; } }
e6bbbd422808baca110aa39ae31948307fba091e
515485c65cc271b5287c41b5a7910a02391581f7
/src/main/java/com/ugleh/autocraftchest/nms/v1_12_R1/NMS.java
b74668118caf6cf1fe3954e93a987e1e41bea826
[]
no_license
Ugleh/AutoCraftChest
bb2a28a9dbdfa68ca21b43174317737446502538
11e177d1129eee74e35d491c0d1a3ba1b291b12e
refs/heads/master
2023-02-12T17:56:02.079754
2021-01-02T03:18:38
2021-01-02T03:18:38
257,712,347
1
0
null
null
null
null
UTF-8
Java
false
false
4,531
java
package com.ugleh.autocraftchest.nms.v1_12_R1; import com.ugleh.autocraftchest.nms.CraftingUtil; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Iterator; public class NMS implements CraftingUtil { private Object iinventoryObject; private Constructor<?> inventorCraftingConstructor; private final Class craftInventoryPlayerClass = getBukkitClass("inventory.CraftInventoryPlayer"); private final Method getHandlePlayerInventory = craftInventoryPlayerClass.getMethod("getInventory"); private final Class craftWorldClass = getBukkitClass("CraftWorld"); private final Class playerInventoryClass = getNMSClass("PlayerInventory"); private final Class blockPositionClass = getNMSClass("BlockPosition"); private final Class<?> worldClass = getNMSClass("World"); private final Class<?> craftItemStackClass = getBukkitClass("inventory.CraftItemStack"); private final Class<?> inventoryCraftingClass = getNMSClass("InventoryCrafting"); private final Class<?> itemStackClass = getNMSClass("ItemStack"); private final Method getHandleWorldServer = craftWorldClass.getMethod("getHandle"); private final Method asNMSCopyMethod = craftItemStackClass.getMethod("asNMSCopy", ItemStack.class); private final Method asBukkitCopyMethod = craftItemStackClass.getMethod("asBukkitCopy", itemStackClass); private final Method setItemMethod = inventoryCraftingClass.getMethod("setItem", int.class, itemStackClass); private Method craftMethod; public NMS()throws InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IllegalAccessException { final Class<?> containerClass = getNMSClass("Container"); final Class<?> inventoryCraftingClass = getNMSClass("InventoryCrafting"); inventorCraftingConstructor = inventoryCraftingClass.getConstructor(containerClass, int.class, int.class); setItemMethod.setAccessible(true); craftMethod = getNMSClass("CraftingManager").getMethod("craft", this.inventoryCraftingClass, worldClass); } @Override public void setContainer(Player player) throws IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, NoSuchMethodException { Object craftInventoryPlayer = craftInventoryPlayerClass.cast(player.getInventory()); Object playerInventory = getHandlePlayerInventory.invoke(craftInventoryPlayer); Object craftWorld = craftWorldClass.cast(player.getWorld()); Object worldServer = getHandleWorldServer.invoke(craftWorld); Constructor containerWorkbench = getNMSClass("ContainerWorkbench").getConstructor(playerInventoryClass, worldClass, blockPositionClass); Object container = containerWorkbench.newInstance(playerInventoryClass.cast(playerInventory), worldServer, null); iinventoryObject = inventorCraftingConstructor.newInstance(container, 3, 3); } @Override public ItemStack getResult(org.bukkit.inventory.ItemStack[] contents) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, ClassNotFoundException { for (int i = 0; i < contents.length; i++) { setItemMethod.invoke(iinventoryObject, i, asNMSCopyMethod.invoke(null, contents[i])); } return tryCraft(iinventoryObject); } protected ItemStack tryCraft(Object inventoryCrafting) throws InvocationTargetException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { Object nmsItemStack = craftMethod.invoke(null, inventoryCrafting, null); return (ItemStack) asBukkitCopyMethod.invoke(null, nmsItemStack); } protected Class<?> getNMSClass(String nmsClassString) throws ClassNotFoundException { String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3] + "."; String name = "net.minecraft.server." + version + nmsClassString; return Class.forName(name); } protected Class<?> getBukkitClass(String bukkitClassString) throws ClassNotFoundException { String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3] + "."; String name = "org.bukkit.craftbukkit." + version + bukkitClassString; return Class.forName(name); } }
68921b271f5a98e879e58295bfe60a3d60b1dc8b
4a78ba1e7460ce501084dbb1dc8b5f6d60d11262
/week3/opdracht33/QuickSort.java
d38a2960b48e3c0e00d059b7adcb6602e320c676
[]
no_license
kcirson/DSAL
b03fc515e4077a0c4d34a8572ac065373c4f40a8
711737a2ea109fd25f009441896abd54feda1810
refs/heads/master
2020-04-18T00:41:12.324496
2013-10-08T21:44:33
2013-10-08T21:44:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package week3.opdracht33; public class QuickSort<T extends Comparable<T>> implements Comparable<T> { public void quickSort(T[] a) { if (a.length <= 1) { return; } quickSort(a, 0, a.length - 1); } private void quickSort(T[] a, int low, int high) { int ip = (low + high) / 2; if (low < high) { swap(a, low, ip); int m = low; for (int j = low + 1; j <= high; j++) { if (a[j].compareTo(a[low]) < 0) { m++; swap(a, m, j); } } swap(a, low, m); quickSort(a, low, m - 1); quickSort(a, m + 1, high); } } private void swap(T[] a, int i, int j) { T temp = a[i]; a[i] = a[j]; a[j] = temp; } @Override public int compareTo(T o) { return this.compareTo(o); } public static void main(String[] args) { QuickSort<Integer> qs = new QuickSort<Integer>(); Integer[] ia = new Integer[]{45, 65, 34, 4, 30, 22, 82}; System.out.println("START:"); for (Integer i : ia) System.out.print(i + " "); qs.quickSort(ia); System.out.println("\n" + "END:"); for (Integer i : ia) System.out.print(i + " "); } }
1534b17a37af13f95be2ac7f4cc9bdce5ed5259f
5a506f38d0105d486c9c64dd3a0e8b96febceb4b
/fwmf-module-order/fwmf-module-order-service/src/main/java/cn/faury/fwmf/module/service/order/generate/mapper/AlipayCallbackRecordsGenerateMapper.java
187d86b59585c23ac7059ff0d20b83d89cab89a8
[ "Apache-2.0" ]
permissive
fzyycp/fwmf-module
6bd98a6823bb36fc9a5aae3966a0e7b291d323a1
36d39a312ad73b0f9a77e96acd614b0ff8cebe4f
refs/heads/master
2022-12-24T10:12:18.058060
2019-12-04T01:49:33
2019-12-04T01:49:33
136,558,712
0
0
Apache-2.0
2022-12-10T05:14:26
2018-06-08T02:59:06
Java
UTF-8
Java
false
false
5,221
java
/** * This file was generator by Fwmf Generated * !!!Do not modify this file!! * * @fwmf.generated 2018-12-08 15:12:42 */ package cn.faury.fwmf.module.service.order.generate.mapper; import cn.faury.fwmf.module.api.order.bean.AlipayCallbackRecordsBean; import cn.faury.fwmf.module.api.order.generate.bean.AlipayCallbackRecordsGenerateBean; import cn.faury.fwmf.module.service.order.generate.sqlProvider.AlipayCallbackRecordsGenerateSqlProvider; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.InsertProvider; import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.ResultType; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.UpdateProvider; import org.apache.ibatis.type.JdbcType; public interface AlipayCallbackRecordsGenerateMapper { /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @Delete({ "delete from payment_t_alipay_callback_records", "where ID = #{id,jdbcType=BIGINT}" }) int deleteByPrimaryKey(Long id); /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @Insert({ "insert into payment_t_alipay_callback_records (ID, OUT_TRADE_NO, ", "ALIPAY_TRADE_NO, TRADE_STATUS, ", "PARAMETER_LIST, CALLBACK_TIME)", "values (#{id,jdbcType=BIGINT}, #{outTradeNo,jdbcType=CHAR}, ", "#{alipayTradeNo,jdbcType=VARCHAR}, #{tradeStatus,jdbcType=VARCHAR}, ", "#{parameterList,jdbcType=VARCHAR}, #{callbackTime,jdbcType=TIMESTAMP})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(AlipayCallbackRecordsGenerateBean record); /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @InsertProvider(type=AlipayCallbackRecordsGenerateSqlProvider.class, method="insertSelective") @Options(useGeneratedKeys=true,keyProperty="id") int insertSelective(AlipayCallbackRecordsGenerateBean record); /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @SelectProvider(type=AlipayCallbackRecordsGenerateSqlProvider.class, method="search") @ResultType(AlipayCallbackRecordsBean.class) List<AlipayCallbackRecordsBean> search(Map<String, Object> params); /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @Select({ "select", "ID, OUT_TRADE_NO, ALIPAY_TRADE_NO, TRADE_STATUS, PARAMETER_LIST, CALLBACK_TIME", "from payment_t_alipay_callback_records", "where ID = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="OUT_TRADE_NO", property="outTradeNo", jdbcType=JdbcType.CHAR), @Result(column="ALIPAY_TRADE_NO", property="alipayTradeNo", jdbcType=JdbcType.VARCHAR), @Result(column="TRADE_STATUS", property="tradeStatus", jdbcType=JdbcType.VARCHAR), @Result(column="PARAMETER_LIST", property="parameterList", jdbcType=JdbcType.VARCHAR), @Result(column="CALLBACK_TIME", property="callbackTime", jdbcType=JdbcType.TIMESTAMP) }) AlipayCallbackRecordsBean selectByPrimaryKey(Long id); /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @UpdateProvider(type=AlipayCallbackRecordsGenerateSqlProvider.class, method="updateByPrimaryKeySelective") int updateByPrimaryKeySelective(AlipayCallbackRecordsGenerateBean record); /** * This method was generated by Fwmf Generated. * This method corresponds to the database table payment_t_alipay_callback_records * * @fwmf.generated 2018-12-08 15:12:42 */ @Update({ "update payment_t_alipay_callback_records", "set OUT_TRADE_NO = #{outTradeNo,jdbcType=CHAR},", "ALIPAY_TRADE_NO = #{alipayTradeNo,jdbcType=VARCHAR},", "TRADE_STATUS = #{tradeStatus,jdbcType=VARCHAR},", "PARAMETER_LIST = #{parameterList,jdbcType=VARCHAR},", "CALLBACK_TIME = #{callbackTime,jdbcType=TIMESTAMP}", "where ID = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(AlipayCallbackRecordsGenerateBean record); }
26526130f42e9906bdd772489b80750cc2b2be64
8982d51306727e9eb325720828ec83c81a1675d5
/src/main/java/com/nelioalves/cursomc/dto/ClienteNewDTO.java
1a4e73b00c0cfadd231695a97fa5d7ae33b2961e
[]
no_license
rogerio137/cursomc
d4e3797d148db1f040e3077d4b1201f589f6538e
838cdc28321e462457b2836763801bc72ab4a622
refs/heads/master
2020-03-18T00:14:57.279998
2018-07-18T15:19:21
2018-07-18T15:19:21
134,084,916
0
0
null
null
null
null
UTF-8
Java
false
false
3,099
java
package com.nelioalves.cursomc.dto; import java.io.Serializable; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.NotEmpty; import com.nelioalves.cursomc.services.validation.ClienteInsert; @ClienteInsert public class ClienteNewDTO implements Serializable { private static final long serialVersionUID = 1L; @NotEmpty(message = "Preenchimento obrigatório") @Length(min = 5, max = 120, message = "O tamanho deve ser entre 5 e 120 caracteres") private String nome; @NotEmpty(message = "Preenchimento obrigatório") @Email(message = "Email inválido") private String email; @NotEmpty(message = "Preenchimento obrigatório") private String cpfOuCnpj; private Integer tipo; @NotEmpty(message = "Preenchimento obrigatório") private String senha; @NotEmpty(message = "Preenchimento obrigatório") private String logradouro; @NotEmpty(message = "Preenchimento obrigatório") private String numero; private String complemento; private String bairro; @NotEmpty(message = "Preenchimento obrigatório") private String cep; @NotEmpty(message = "Preenchimento obrigatório") private String telefone1; private String telefone2; private String telefone3; private Integer cidadeId; public ClienteNewDTO() { } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCpfOuCnpj() { return cpfOuCnpj; } public void setCpfOuCnpj(String cpfOuCnpj) { this.cpfOuCnpj = cpfOuCnpj; } public Integer getTipo() { return tipo; } public void setTipo(Integer tipo) { this.tipo = tipo; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } public String getLogradouro() { return logradouro; } public void setLogradouro(String logradouro) { this.logradouro = logradouro; } public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public String getComplemento() { return complemento; } public void setComplemento(String complemento) { this.complemento = complemento; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } public String getCep() { return cep; } public void setCep(String cep) { this.cep = cep; } public String getTelefone1() { return telefone1; } public void setTelefone1(String telefone1) { this.telefone1 = telefone1; } public String getTelefone2() { return telefone2; } public void setTelefone2(String telefone2) { this.telefone2 = telefone2; } public String getTelefone3() { return telefone3; } public void setTelefone3(String telefone3) { this.telefone3 = telefone3; } public Integer getCidadeId() { return cidadeId; } public void setCidadeId(Integer cidadeId) { this.cidadeId = cidadeId; } }
7ffed982449a9bff581bb5631b6c1bf2da984c81
419054da560d0a50083674b1d88bc7b4f0cb4f19
/msb-client-api/src/test/java/de/fhg/ipa/vfk/msb/client/api/AllTypes.java
819af7c3bc4e61c9ec0870905349401b7f907d68
[ "Apache-2.0" ]
permissive
fossabot/msb-client-websocket-java
b4127cfee7ea7b2fbb8afdda649fca13d19d0ead
8a09f29c8abcca51a927c3f3c430336bb1687408
refs/heads/master
2020-06-17T16:38:05.937317
2019-07-09T09:40:10
2019-07-09T09:40:10
195,979,279
0
0
Apache-2.0
2019-07-09T09:40:06
2019-07-09T09:40:05
null
UTF-8
Java
false
false
2,112
java
/* * Copyright (c) 2019 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA). * Authors: Daniel Schel * * 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 de.fhg.ipa.vfk.msb.client.api; import java.util.Date; public class AllTypes { private String string_type; private int int_type; private Date date_type; private double double_type; private float float_type; private boolean bool_type; public String getString_type() { return string_type; } public void setString_type(String string_type1) { this.string_type = string_type1; } public int getCount_type() { return int_type; } public void setCount_type(int count_type1) { this.int_type = count_type1; } public Date getDate_type() { return date_type; } public void setDate_type(Date date_type1) { this.date_type = date_type1; } public double getDouble_type() { return double_type; } public void setDouble_type(double double_type1) { this.double_type = double_type1; } public float getFloat_type() { return float_type; } public void setFloat_type(float float_type1) { this.float_type = float_type1; } public boolean isBool_type() { return bool_type; } public void setBool_type(boolean bool_type1) { this.bool_type = bool_type1; } public static AllTypes getTestEntity(){ AllTypes AT = new AllTypes(); AT.setBool_type(false); AT.setCount_type(222); AT.setDate_type(new Date()); AT.setDouble_type(45.15415d); AT.setFloat_type(12.325f); AT.setString_type("26000"); return AT; } }
7c27973d302e3a010ca223b15d669aead8c06736
924aa38cdf7b1df9419545b1a657dc3e9852c29f
/myeong_da_yeon/week1/섬연결하기.java
b69986cdda5f0ae46852c0be27b35118df486e80
[]
no_license
meme2367/2021_1H_study
8f9690e293dade63f2f89a5e6aad35e4c5f45331
2ccf490f5bacb7e81555c4365437f868379104da
refs/heads/main
2023-03-24T20:19:41.563855
2021-03-21T10:32:03
2021-03-21T10:32:03
333,745,125
2
1
null
2021-03-21T10:35:31
2021-01-28T11:59:25
Java
UTF-8
Java
false
false
1,337
java
import java.util.*; class Solution { static int[] unf; public int solution(int n, int[][] costs) { int answer = 0; ArrayList<Point> p = new ArrayList<>(); unf = new int[n]; for (int i = 0 ; i< costs.length;i++) { p.add(new Point(costs[i][0], costs[i][1], costs[i][2])); } for(int i = 0;i<n;i++) { unf[i] = i; } p.sort((p1,p2) -> p1.c - p2.c); for(int i = 0 ;i<p.size();i++) { int x = find(p.get(i).x); int y = find(p.get(i).y); int c = p.get(i).c; if (x != y) { union(x,y); answer += c; } } return answer; } static int find(int v) { if(v == unf[v]) { return v; } return unf[v] = find(unf[v]); } static void union(int s,int e) { int x = find(s); int y = find(e); if(x != y) { unf[x] = y; } } } class Point { int x; int y; int c; public Point(int x,int y,int c) { this.x = x; this.y = y; this.c = c; } }
03552928281ee1fa6a74cbad0e9e632b00da0efa
dd52aba98c2addf317ed4eace1058ed5fb00fe20
/Coding/Java/Library/MyBatis/generator/mybatis-generator/power_cloud/com/neu/cse/powercloud/pojo/sysmanage/SysDataAuthorityExample.java
e53587c705118cab00c7f33ca456e83e432ad8c8
[]
no_license
bovenson/notes
9ab16bc1d282ae9e268042b7bb9e8b1ac79df584
387074588c50973b6fb8645f859ae9ca29b4df4c
refs/heads/master
2023-01-19T08:21:34.968411
2020-11-18T15:16:42
2020-11-18T15:16:42
88,229,770
8
2
null
2023-01-11T00:56:03
2017-04-14T03:33:49
Java
UTF-8
Java
false
false
12,087
java
package com.neu.cse.powercloud.pojo.sysmanage; import java.util.ArrayList; import java.util.List; public class SysDataAuthorityExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public SysDataAuthorityExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andDataauthorityvalueIsNull() { addCriterion("dataAuthorityValue is null"); return (Criteria) this; } public Criteria andDataauthorityvalueIsNotNull() { addCriterion("dataAuthorityValue is not null"); return (Criteria) this; } public Criteria andDataauthorityvalueEqualTo(String value) { addCriterion("dataAuthorityValue =", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueNotEqualTo(String value) { addCriterion("dataAuthorityValue <>", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueGreaterThan(String value) { addCriterion("dataAuthorityValue >", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueGreaterThanOrEqualTo(String value) { addCriterion("dataAuthorityValue >=", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueLessThan(String value) { addCriterion("dataAuthorityValue <", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueLessThanOrEqualTo(String value) { addCriterion("dataAuthorityValue <=", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueLike(String value) { addCriterion("dataAuthorityValue like", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueNotLike(String value) { addCriterion("dataAuthorityValue not like", value, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueIn(List<String> values) { addCriterion("dataAuthorityValue in", values, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueNotIn(List<String> values) { addCriterion("dataAuthorityValue not in", values, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueBetween(String value1, String value2) { addCriterion("dataAuthorityValue between", value1, value2, "dataauthorityvalue"); return (Criteria) this; } public Criteria andDataauthorityvalueNotBetween(String value1, String value2) { addCriterion("dataAuthorityValue not between", value1, value2, "dataauthorityvalue"); return (Criteria) this; } public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; } public Criteria andStatusIsNotNull() { addCriterion("status is not null"); return (Criteria) this; } public Criteria andStatusEqualTo(String value) { addCriterion("status =", value, "status"); return (Criteria) this; } public Criteria andStatusNotEqualTo(String value) { addCriterion("status <>", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThan(String value) { addCriterion("status >", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThanOrEqualTo(String value) { addCriterion("status >=", value, "status"); return (Criteria) this; } public Criteria andStatusLessThan(String value) { addCriterion("status <", value, "status"); return (Criteria) this; } public Criteria andStatusLessThanOrEqualTo(String value) { addCriterion("status <=", value, "status"); return (Criteria) this; } public Criteria andStatusLike(String value) { addCriterion("status like", value, "status"); return (Criteria) this; } public Criteria andStatusNotLike(String value) { addCriterion("status not like", value, "status"); return (Criteria) this; } public Criteria andStatusIn(List<String> values) { addCriterion("status in", values, "status"); return (Criteria) this; } public Criteria andStatusNotIn(List<String> values) { addCriterion("status not in", values, "status"); return (Criteria) this; } public Criteria andStatusBetween(String value1, String value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } public Criteria andStatusNotBetween(String value1, String value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
c924f0305fd29f5f458284777fd84c68148c2e6a
4589a738e0fe2f6da7182db9a8b7476f05f9563c
/src/main/java/com/springboot/moviemoon/controllers/MovieController.java
5bc1f06036f5117b80d808730b4d3c0a7f251a91
[]
no_license
SandovalElias/Moviemoon-Backend
f8370eba3a02b2c27b8c0c5499b7c1cb72cd160f
63e15ab0ce9598b689d52a1196c5949b3382bf3c
refs/heads/main
2023-03-20T04:58:47.337421
2021-03-21T20:16:05
2021-03-21T20:16:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package com.springboot.moviemoon.controllers; import java.util.List; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import com.springboot.moviemoon.model.Movie; import com.springboot.moviemoon.services.MovieService; @RestController public class MovieController { private MovieService movieService=new MovieService(); @GetMapping("/movies") public List<Movie> getMovies(){ return this.movieService.getMovies(); } }
fb74ca57330b9639d9738b8d1776a1844b612091
b1e20775fe0d47cab82c83fe47b9efc7e002e82b
/Binary Tree Level Order Traversal/Solution2.java
503ea0cb1a1cfec21d7f63e65d99aca919f0a4ab
[]
no_license
dotaxiaohao001/LeetCode
3902457528d48992fa182d47b1654f4ea0c2f238
85cbdb316be5d1a1391d5d9f26cdb93b7aef8644
refs/heads/master
2021-01-18T01:42:28.300979
2015-01-26T23:42:34
2015-01-26T23:42:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,497
java
/** *思路: level traversal 就是queue的应用 一般用linkedlist实现, 主要这里的问题是结果存放是一层层的 所以需要2个queue,这里 *做的类似dp 利用nextLevel不断更新curLevel, 和上次做的有差别(remove q1就add q2) (remove q2 就add q1。 不过大体一样 *错误: 感觉method 的return type, List<List<Integer>> 需要讲 generic type E(List<Integr>)变成ArrayList<Integer> */ /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public List<ArrayList<Integer>> levelOrder(TreeNode root) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); if(root == null) { return result; } Queue<TreeNode> curLevel = new LinkedList<TreeNode>(); curLevel.add(root); while(!curLevel.isEmpty()) { ArrayList<Integer> level = new ArrayList<Integer>(); Queue<TreeNode> nextLevel = new LinkedList<TreeNode>(); while(!curLevel.isEmpty()) { TreeNode cur = curLevel.remove(); level.add(cur.val); if(cur.left != null) { nextLevel.add(cur.left); } if(cur.right != null) { nextLevel.add(cur.right); } } result.add(level); curLevel = nextLevel; } return result; } }
cc5d38ff2f574e0a6b25d5bc46608d06e6ca101f
0fd4f55b08bf6cee6a505f2346926a1e4c9bde24
/Design Patterns Geeks for Geeks/IteratorPattern/NameRespository.java
1188d100e3399bb76d3cde9bfe12354d19df5045
[]
no_license
david2999999/Advanced-Java
1d7089a050fa1b8e1b574aa4855b10363b1ad383
78f17038c75be8c5d3456d92ac81841fb502bf56
refs/heads/master
2021-07-19T19:03:06.061598
2020-04-08T19:37:40
2020-04-08T19:37:40
128,837,674
1
0
null
null
null
null
UTF-8
Java
false
false
689
java
package IteratorPattern; public class NameRespository implements Container { public String name[] = {"Robert", "John", "Julie", "Lora"}; @Override public Iterator getIterator() { return new NameIterator(); } private class NameIterator implements Iterator { int index; @Override public boolean hasNext() { if (index < name.length) { return true; } return false; } @Override public Object next() { if (hasNext()) { return name[index++]; } return null; } } }
cd789a18d926545a8571a2fd763f213ce0bd5b95
1af4cac703a7c38bd27662a793ad9ada79bc4895
/src/main/java/edu/pucmm/sparkjavademo/controladores/TransformacionesControlador.java
2ac553110d9ec4df63215daa78dcda315ad56b44
[]
no_license
vacax/sparkjava_demo
a28d9409c6d6103ea263df2e4462a59457714077
a16db1fcfd3d4756ab73f2b39c7e254dc5c09050
refs/heads/master
2023-01-31T11:08:39.876224
2021-05-10T14:47:47
2021-05-10T14:47:47
187,281,019
0
0
null
2023-01-12T05:23:42
2019-05-17T21:01:07
JavaScript
UTF-8
Java
false
false
1,230
java
package edu.pucmm.sparkjavademo.controladores; import com.google.gson.Gson; import edu.pucmm.sparkjavademo.encapsulacion.Estudiante; import edu.pucmm.sparkjavademo.utilidades.JsonTransformer; import static spark.Spark.*; /** * */ public class TransformacionesControlador { public void ejemploTransformaciones(){ /** * Trama sin convertir: * http://localhost:4567/estudianteJsonSimple/ * */ get("/estudianteJsonSimple/", (request, response) -> { return new Estudiante(20011136, "Carlos Camacho", "ISC"); }); /** * Trama sin convertir: * http://localhost:4567/estudianteJson/ * */ get("/estudianteJson/", (request, response) -> { return new Estudiante(20011136, "Carlos Camacho", "ISC"); }, new JsonTransformer()); get("/estudianteJsonAceptado/", "application/json", (request, response) -> { return new Estudiante(20011136, "Carlos Camacho", "ISC"); }, new JsonTransformer()); Gson gson = new Gson(); get("/estudianteJsonDirecto", (request, response) -> new Estudiante(20011136, "Carlos Camacho", "ISC"), gson::toJson); } }
629b04bbe7e05d54da0687f99cd7540dc84fc05c
c3bb807d1c1087254726c4cd249e05b8ed595aaa
/src/oc/whfb/units/im/IMErzlektordesSigmar.java
709cae448f74572d08f2575d64495011c7aa8f2e
[]
no_license
spacecooky/OnlineCodex30k
f550ddabcbe6beec18f02b3e53415ed5c774d92f
db6b38329b2046199f6bbe0f83a74ad72367bd8d
refs/heads/master
2020-12-31T07:19:49.457242
2014-05-04T14:23:19
2014-05-04T14:23:19
55,958,944
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,941
java
package oc.whfb.units.im; import oc.BuildaHQ; import oc.BuildaMenu; import oc.Eintrag; import oc.OptionsEinzelUpgrade; import oc.RuestkammerStarter; public class IMErzlektordesSigmar extends Eintrag { OptionsEinzelUpgrade oe; RuestkammerStarter rkEquipment; RuestkammerStarter rkMount; RuestkammerStarter rkBanner; RuestkammerStarter rkMagic; boolean altar = false; boolean set = false; boolean genSelected = false; OptionsEinzelUpgrade oGen; public IMErzlektordesSigmar() { name = BuildaHQ.translate("Erzlektor des Sigmar"); grundkosten = 125; seperator(12); add(oGen = new OptionsEinzelUpgrade(ID, randAbstand, cnt, "", BuildaHQ.translate("General"), 0, false)); seperator(); rkEquipment = new RuestkammerStarter(ID, randAbstand, cnt, "IMEquipment", ""); rkEquipment.initKammer(true, false, false, false, false); rkEquipment.setButtonText(BuildaHQ.translate("Ausrüstung")); add(rkEquipment); seperator(); rkMount = new RuestkammerStarter(ID, randAbstand, cnt, "IMMount", ""); rkMount.initKammer(true, false, false, false, false, false, false, false); rkMount.setButtonText(BuildaHQ.translate("Reittier")); add(rkMount); seperator(); rkMagic = new RuestkammerStarter(ID, randAbstand, cnt, "IMMagicItems", ""); rkMagic.initKammer(false, true, true, true, false, true, false); rkMagic.setButtonText(BuildaHQ.translate("Magische Gegenstände")); add(rkMagic); complete(); } @Override public void refreshen() { int sigmar = BuildaHQ.getCountFromInformationVector("IM_SIGMAR"); sigmar++; if(!set){ BuildaHQ.setInformationVectorValue("IM_SIGMAR", sigmar); } set = true; BuildaHQ.getChooserGruppe(3).addSpezialAuswahl(BuildaHQ.translate("Kern Flagellanten")); BuildaHQ.refreshEntries(3); boolean genGlobal = ( BuildaHQ.getCountFromInformationVector("Gen") > 0 ? true : false ); if(genGlobal && !genSelected) oGen.setAktiv(false); else oGen.setAktiv(true); if(oGen.isSelected()) { genSelected = true; BuildaHQ.setInformationVectorValue("Gen", 1); } else { if(genSelected) { genSelected = false; BuildaHQ.setInformationVectorValue("Gen", 0); BuildaHQ.refreshEntries(2); } } /*if (ico != null ) panel.remove(ico); if ( BuildaMenu.bilderAneigen.isSelected() ) { ico = BuildaHQ.createPictureJLabel(BuildaHQ.IMAGEPFAD + reflectionKennung.toLowerCase() + "/" + getClass().getSimpleName() + JPG); ico.setLocation((290 - (ico.getSize().width - 100) / 2), 30); panel.add(ico); }*/ } @Override public void deleteYourself() { super.deleteYourself(); int sigmar = BuildaHQ.getCountFromInformationVector("IM_SIGMAR"); sigmar--; BuildaHQ.setInformationVectorValue("IM_SIGMAR", sigmar); if(sigmar == 0){ BuildaHQ.getChooserGruppe(3).removeSpezialAuswahl("Kern Flagellanten"); BuildaHQ.refreshEntries(3); } if(genSelected) { BuildaHQ.setInformationVectorValue("Gen", 0); } } }
[ "spacecooky@b551ab73-3a01-0010-9fae-47f737f7a8aa" ]
spacecooky@b551ab73-3a01-0010-9fae-47f737f7a8aa
0372f40960a217e921637d62323eb1c2283dcb2b
b203bbf64ac3bde4827fa484c5d96a50d8874a90
/src/com/neeraj/design_patterns/behavioural/chain_of_responsibility/Logger.java
f282ffed5c5435aa940db7f62a84e5c9d99db69b
[]
no_license
neerajjain92/DesignPatterns
e4921bea47f3bd3013b4f9bf4a8487d92b5d3e6e
48af00b0c9f46ff5f1ec1c8fb2629453a427c836
refs/heads/master
2022-11-24T00:18:59.265574
2020-07-30T19:17:39
2020-07-30T19:17:39
283,839,611
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
package com.neeraj.design_patterns.behavioural.chain_of_responsibility; /** * @author neeraj on 13/07/20 * Copyright (c) 2019, DesignPatterns. * All rights reserved. */ public class Logger extends Handler { public Logger(Handler next) { super(next); } @Override public boolean doHandle(HttpRequest httpRequest) { System.out.println("Logging the request..." + httpRequest); return false; } }
ccc4de347865419a1e97684c2dae34eb101b6246
ec39007eaae46b6c83fb62c7d567bfa5bc2e0519
/src/sef/module6/activity/Point2DImpl.java
844e530e81e7a3cb8df67da339674de4e1b60f1e
[]
no_license
Ferret56/participant
31fb2d87af5ad46827f16bf7576fa5b3bbc455d6
85d09ef3deee376fe2c36fcb225daa6a5f912de4
refs/heads/master
2020-06-01T11:17:57.434379
2019-06-07T14:48:23
2019-06-07T14:48:23
190,756,732
0
0
null
null
null
null
UTF-8
Java
false
false
2,119
java
package sef.module6.activity; public class Point2DImpl implements Point2D { private double x; private double y; /** * Creates a Point2D object at a default location (0,0) */ public Point2DImpl(){ this.x = 0; this.y = 0; } /** * Create a Point2D object that represents a 2D coordinate specified * by the constructor parameters * * @param x coordinate of the point along the x-axis * @param y coordinate of the point along the y-axis */ public Point2DImpl(double x, double y){ this.x = x; this.y = y; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#move(double, double) */ public final void move(double x, double y){ this.x = x; this.y = y; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#setX(double) */ public void setX(double x){ this.x = x; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#setY(double) */ public void setY(double y){ this.y = y; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#getX() */ public double getX(){ return x; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#getY() */ public double getY(){ return y; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#translate(double, double) */ public final void translate(double dx, double dy){ x += dx; y += dy; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object p){ return x == ((Point2DImpl)p).getX() && y ==((Point2DImpl)p).getY(); } /* (non-Javadoc) * @see sef.module5.activity.Point2D#equals(double, double) */ public boolean equals(double x2, double y2){ return x == x2 && y == y2; } /* (non-Javadoc) * @see sef.module5.activity.Point2D#getDistance(double, double) */ public final double getDistance(double x2, double y2){ return Math.sqrt( Math.pow((x2 - x),2) + Math.pow((y2 - y),2)); } /* (non-Javadoc) * @see sef.module5.activity.Point2D#getDistance(sef.module5.activity.Point2D) */ public final double getDistance(Point2D p){ return getDistance(p.getX(), p.getY()); } }
f3d92e87e3a1d172b0c469ad74453030afd174c8
fedd56c881c90cf006a7a5f93359641aa7566cd6
/src/main/java/com/meidian/cms/controller/company/CompanyController.java
5fe8ccec54e47d961fac634a0cbc3a43236202b6
[]
no_license
326zhangying/cms
f145e4763316f08b8899d2928d6178eec491e9be
1ec7cd4ae12bf656d1e8bd7361b3e7caba6b94d0
refs/heads/master
2021-05-09T17:06:01.220823
2018-01-26T07:55:16
2018-01-26T07:55:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,394
java
package com.meidian.cms.controller.company; import com.meidian.cms.common.Enum.ErrorCode; import com.meidian.cms.common.Result; import com.meidian.cms.common.ServiceResult; import com.meidian.cms.common.Strings; import com.meidian.cms.common.exception.BusinessException; import com.meidian.cms.common.utils.ResultUtils; import com.meidian.cms.common.utils.TimeUtil; import com.meidian.cms.controller.basic.BasicController; import com.meidian.cms.controller.customer.CustomerController; import com.meidian.cms.serviceClient.company.Company; import com.meidian.cms.serviceClient.company.service.CompanyService; import com.meidian.cms.serviceClient.user.User; import com.meidian.cms.vo.TestVo; import com.meidian.cms.vo.company.CompanyVo; import org.apache.catalina.servlet4preview.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; @Controller @RequestMapping("/company") public class CompanyController extends BasicController{ private static final Logger logger = LoggerFactory.getLogger(CompanyController.class); @Autowired private CompanyService companyService; @RequestMapping("/index") public ModelAndView index(){ ModelAndView mv = new ModelAndView(); mv.setViewName("company/index"); return mv; } @ResponseBody @RequestMapping("/getData") public Result<List<Company>> getData(HttpServletRequest request, Company company) throws BusinessException { User user = getUser(request); company.setOwner(user.getId()); company.ifCompanyNameBlankToNull(); ServiceResult<List<Company>> companyResult = companyService.findAll(company); if (!companyResult.getSuccess()){ throw new BusinessException("获取公司报错!", ErrorCode.BUSINESS_DEFAULT_ERROR.getCode()); } List<CompanyVo> companyVoList = this.makeVo(companyResult.getBody(),user); return ResultUtils.returnTrue(companyVoList); } private List<CompanyVo> makeVo(List<Company> body,User user) { List<CompanyVo> result = new ArrayList<>(); if (CollectionUtils.isEmpty(body)){ return result; } body.stream().forEach(obj -> { CompanyVo companyVo = new CompanyVo(); BeanUtils.copyProperties(obj,companyVo); companyVo.setuTString(TimeUtil.getFormatDate(companyVo.getuT(),new SimpleDateFormat("yyyy-MM-dd"))); companyVo.setOwnerName(user.getName()); result.add(companyVo); }); return result; } @ResponseBody @RequestMapping("/update") public Result<Boolean> updateData(HttpServletRequest request, Company company) throws BusinessException { User user = getUser(request); company.setuU(user.getId()); company.setuUName(user.getName()); company.setuT(TimeUtil.getNowTimeStamp()); company.setCrew(Strings.defaultIfNull(company.getCrew(),"")); ServiceResult<Boolean> companyResult = companyService.updateCompanyById(company); if (!companyResult.getSuccess()){ throw new BusinessException(companyResult.getMessage(), ErrorCode.BUSINESS_DEFAULT_ERROR.getCode()); } return ResultUtils.returnTrue(companyResult.getMessage()); } @ResponseBody @RequestMapping("/delete") public Result<Boolean> deleteData(HttpServletRequest request, Company company) throws BusinessException { User user = getUser(request); company.setuU(user.getId()); company.setuUName(user.getName()); company.setuT(TimeUtil.getNowTimeStamp()); ServiceResult<Boolean> companyResult = companyService.deleteCompanyById(company); if (!companyResult.getSuccess()){ throw new BusinessException(companyResult.getMessage(), ErrorCode.BUSINESS_DEFAULT_ERROR.getCode()); } return ResultUtils.returnTrue(companyResult.getMessage()); } @ResponseBody @RequestMapping("/add") public Result<Boolean> addData(HttpServletRequest request, Company company) throws BusinessException { User user = getUser(request); this.makeData(company,user); ServiceResult<Boolean> companyResult = companyService.save(company); if (!companyResult.getSuccess()){ throw new BusinessException(companyResult.getMessage(), ErrorCode.BUSINESS_DEFAULT_ERROR.getCode()); } return ResultUtils.returnTrue(companyResult.getMessage()); } private void makeData(Company company, User user) { company.setuU(user.getId()); company.setuUName(user.getName()); company.setuT(TimeUtil.getNowTimeStamp()); company.setcT(TimeUtil.getNowTimeStamp()); company.setcU(user.getId()); company.setcUName(user.getName()); company.setOwner(user.getId()); if (null == company.getCrew()){ company.setCrew(""); } } }
58e7d98639d17cb48cedca8a8944e201edba33ba
63c20a5cdd55cebb14a5ba348b0bff4879e0fb25
/changgou-parent/changgou-service/changgou-service-user/src/main/java/com/anone/user/dao/AddressMapper.java
ad4b6e9b050e7c0a990e5d978e0a8c4abc7fadfc
[]
no_license
Anone-Yo/mycg
aa5140977a699de2b44be48374bf2d37d21876f9
543327bebdc82af285def8f5c4d4b7f9b4ae0c1a
refs/heads/master
2022-06-23T09:27:50.447045
2019-11-02T14:19:05
2019-11-02T14:19:05
219,162,936
0
0
null
2022-06-21T02:09:45
2019-11-02T14:10:15
JavaScript
UTF-8
Java
false
false
227
java
package com.anone.user.dao; import com.anone.user.domain.Address; import tk.mybatis.mapper.common.Mapper; /**** * @Author:anone * @Description:Address的Dao *****/ public interface AddressMapper extends Mapper<Address> { }
1b7aabaf92029502ef29fb97e1951c8368eade02
884fb41514deafb2cc5c7e924c34a9ab5c834e59
/InterfazAbstract/src/Dispositivo.java
86932d8284189c8881f5e2b6099d0ea23ef4d283
[]
no_license
anthonyprz/Dispositivo_AbstractInterfaz
5955e8a1c2be6af81d5ce3b4d225dde8693ffd65
d9f280d36e6c15c91e693596ddce6a79ac1610c7
refs/heads/master
2020-04-08T08:44:49.191637
2015-01-27T07:32:48
2015-01-27T07:32:48
29,902,717
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
public abstract class Dispositivo { int id; String modelo, marca; abstract void comunicarse(); abstract void hacerFotos(); abstract void hacerVideos(); void entretener(){ System.out.println("entretiene mediante juegos y aplicaciones"); } }
66b3414b589f77dc6304fd862a93cde169024005
100a23346724d8d4d4f5102b3370a6cb7f5522e9
/src/main/java/com/user/userapp/service/UserService.java
8acfab88860e7566fbf1d0ac7a741c58ad2975db
[]
no_license
dipensoni2510/userapp
b67945477b78fe3a46a8da780dc5184ad53eb335
c6e3f778b6655c90cb661dcd1f3ec05e9b66f2ec
refs/heads/master
2023-01-19T19:05:35.155847
2020-11-26T11:34:03
2020-11-26T11:34:03
316,205,785
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package com.user.userapp.service; import java.util.List; import com.user.userapp.entity.User; public interface UserService { List<User> getAllUser(); User getUserById(int id); String saveUser(User user); String updateUser(int id); String deleteUser(int id); }
c13b198244f6bcea4efbe8c6e335cedd4e0d9eae
df9be9e3f0848d9068676901dfec1f489a3be2f4
/src/main/java/MyThread.java
874600d7275511df98a2042619b99fb5d8075c70
[]
no_license
Mujinzhao/leetcodeTop100
a58f76b32b91f2d86414ce326265e11176341280
1b2a14c52cab771fcd915a4d20e711a9d19f09c4
refs/heads/master
2022-11-18T20:09:26.406868
2020-10-15T06:28:59
2020-10-15T06:28:59
201,157,317
0
0
null
2022-11-16T06:24:06
2019-08-08T01:51:26
Java
UTF-8
Java
false
false
523
java
/** * @ClassName MyThread * @Description TODO * @Author zhangxinkun * @Date 2019/7/1 10:25 AM * @Version 1.0 */ public class MyThread implements Runnable { private Integer people = 1000; private final Object lock = new Object(); public MyThread(int people) { } @Override public void run(){ synchronized (people){ while (people > 0){ System.out.println("threadName:"+Thread.currentThread().getName() + " :" + people--); } } } }