blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
bf4d09a794841552de3de3d67e768dfb9f1870e0
5790f12c3b0a09336acb4a4eb7b78c688d0878be
/src/hwlesson13/Type.java
55fd4550de7701c41f0fec467ce028e902c2447f
[]
no_license
VasilJermakou/freeIT
2aafb1c0d22add8ad0a86aae92166995e774afad
4dc82b9e7dd30a010ba3a7db95d980e29fd27cd6
refs/heads/master
2023-04-20T08:41:13.454951
2021-04-25T18:53:09
2021-04-25T18:53:09
349,797,035
0
0
null
2021-05-14T05:08:12
2021-03-20T17:50:53
Java
UTF-8
Java
false
false
176
java
package hwlesson13; public enum Type { INTERNAL_USE(0), EXTERNAL_USE(1); private int number; private Type(int number){ this.number = number; } }
3316ea91482387042af8ef366f4b1a3cfe82275c
f8765965d9c0381e5da04c759fb8db9cf87ff8df
/app/src/main/java/com/romaka/fivepointapp/MainActivity.java
5a2afafcb13d2be71c3dbe5f34a5fa05df6de985
[]
no_license
toofat2serve/FivePointApp
894b4be15561956d1f8c324fbf4cfeec89358cdc
ef239bc2c4c6fe50af6e942236fc5819db45ca3e
refs/heads/master
2021-09-04T19:14:28.087716
2018-01-21T14:52:45
2018-01-21T14:52:45
115,880,091
1
0
null
null
null
null
UTF-8
Java
false
false
17,777
java
package com.romaka.fivepointapp; //DONE: ADD device browser / import //DONE: ADD database storage //DONE: FIX main layout: reduce reliance on layered layouts //AIDE: ================================= //TODO: ADD comment/notes feature //TODO: ADD content to help activity //TODO: ADD dev column flip to absolute dev (abs(read/expected*100)) //TODO: FIX contact email should have an auto filled subject line //ANST:================================= //TODO: ADD text field auto-complete from db history //TODO: FIX save data function. work on at home. //TODO: FIX assess public objects for privitization //UNKN: ================================= //TODO: ADD other formats (CSV, HTML, PDF, ...) import android.arch.persistence.room.Room; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.preference.PreferenceManager; import android.support.constraint.ConstraintLayout; import android.support.v7.app.AppCompatActivity; import android.text.Html; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Spinner; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; public class MainActivity extends AppCompatActivity implements WarningDialogFragment.OnFragmentInteractionListener { private static final String DFLT_DEVICE = "dd"; private static FivePointDB db; private EditText e_id; private EditText e_serial; private EditText e_make; private EditText e_model; private EditText e_dlrv; private EditText e_durv; private EditText e_clrv; private EditText e_curv; private EditText e_steps; public EditText e_notes; private RadioGroup rg_linsq; private RadioButton rb_lin; private RadioButton rb_squ; private Button btn_cal; private Button btn_reset; private Button btn_clr; private Spinner spin_dunit; private Spinner spin_cunit; private LinearLayout ll; private ArrayList<String> units_values; private ArrayList<EditText> mandos; private Instrument device; private SharedPreferences dsp; private Map<String, ?> dspMap; private Boolean CLEAR_TEXT_ON_TOUCH; private Integer DATA_RESOLUTION; private Boolean DONE_FLAG; private Boolean FIRST_RUN; private ConstraintLayout cl; @Override protected void onCreate(Bundle savedInstanceState) { //Log.i("ME", "Initializing..."); super.onCreate(savedInstanceState); setContentView(R.layout.main); e_id = findViewById(R.id.e_id); e_serial = findViewById(R.id.e_serial); e_make = findViewById(R.id.e_make); e_model = findViewById(R.id.e_model); e_dlrv = findViewById(R.id.e_dlrv); e_durv = findViewById(R.id.e_durv); e_clrv = findViewById(R.id.e_clrv); e_curv = findViewById(R.id.e_curv); e_steps = findViewById(R.id.e_steps); //e_notes = (EditText) findViewById(R.id.e_notes); btn_cal = findViewById(R.id.btn_cal); btn_reset = findViewById(R.id.btn_reset); btn_clr = findViewById(R.id.btn_clr); spin_dunit = findViewById(R.id.spin_dunit); spin_cunit = findViewById(R.id.spin_cunit); rb_lin = findViewById(R.id.rb_lin); rb_squ = findViewById(R.id.rb_squ); cl = findViewById(R.id.mainconstraint); mandos = new ArrayList<>(); mandos.add(e_dlrv); mandos.add(e_durv); mandos.add(e_clrv); mandos.add(e_curv); mandos.add(e_steps); DONE_FLAG = false; FIRST_RUN = true; db = Room.databaseBuilder(getApplicationContext(), FivePointDB.class, "FivePointDB") .allowMainThreadQueries() .build(); device = new Instrument(); refreshSP(); checkSharedPreferences(); ////Log.i("ME", "...Initialized."); GsonBuilder builder = new GsonBuilder(); builder.registerTypeAdapter(CalRecord.class, new CalRecordAdapter().nullSafe()); Gson gson = builder.create(); cl.setFocusableInTouchMode(true); cl.requestFocus(); loadDefaultDevice(); spin_dunit.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { spinLongClick(view); return true; } }); e_id.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { if (db.fpdao().getEquipIDs().isEmpty()) { showDialog(getString(R.string.no_devices)); } else { idLongClick(view); } return true; } }); btn_cal.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { CollectForm(); db.fpdao().insertDevice(device); showDialog(getString(R.string.saved_pt1) + device.EquipID + getString(R.string.saved_pt2)); return true; } }); btn_reset.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { CollectForm(); updateDefaultDevice(device); return true; } }); } public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mainmenu, menu); return true; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: clickSettings(); return true; case R.id.share: clickShare(); return true; case R.id.help: clickHelp(); return true; case R.id.contact: clickContact(); return true; default: return super.onOptionsItemSelected(item); } } private void showDialog(String str) { WarningDialogFragment dialog = new WarningDialogFragment(); WarningDialogFragment.newInstance("OK", str).show(this.getSupportFragmentManager(), "WarningDialog"); } private void spinLongClick(View view) { Intent intent = new Intent(); intent.setClassName(getApplicationContext(), "com.romaka.fivepointapp.UnitEditActivity"); intent.putExtra("units", units_values.toArray(new String[units_values.size()])); // Log.i("ME",units_values.toString()); startActivity(intent); } private void idLongClick(View view) { Intent intent = new Intent(); intent.setClassName(getApplicationContext(), "com.romaka.fivepointapp.DeviceGridActivity"); startActivityForResult(intent, 1); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((requestCode == resultCode) && (requestCode == 1)) { String eid = data.getStringExtra("equipid"); device = db.fpdao().getDevice(eid); FillForm(device); } } @Override protected void onPause() { checkSharedPreferences(); super.onPause(); } @Override protected void onStart() { checkSharedPreferences(); super.onStart(); } @Override protected void onResume() { checkSharedPreferences(); super.onResume(); } private void refreshSP() { dsp = PreferenceManager.getDefaultSharedPreferences(this); dspMap = dsp.getAll(); } private void updateDefaultDevice(Instrument inst) { SharedPreferences sp = getPreferences(0); SharedPreferences.Editor spe = sp.edit(); spe.putString(DFLT_DEVICE, toGson(device)); spe.commit(); showDialog(getString(R.string.new_default) + inst.toString()); } private void firstTimeOnly(SharedPreferences sp) { String[] strArr = getResources().getStringArray(R.array.unit_values); units_values = new ArrayList<String>(strArr.length); Collections.addAll(units_values, strArr); SharedPreferences.Editor spe = sp.edit(); Set<String> uvset = new HashSet<String>(units_values); spe.putStringSet("units", uvset); spe.putBoolean("first_time", false); spe.commit(); FIRST_RUN = false; } private void loadDefaultDevice() { if (dspMap.containsKey("pref_preload")) { Boolean loadDefaultDevice = (Boolean) dspMap.get("pref_preload"); if (loadDefaultDevice) { resetForm(); } } } private void checkSharedPreferences() { refreshSP(); if (!dspMap.containsKey("first_time")) { firstTimeOnly(dsp); } else { Set<String> uvset = (Set<String>) dspMap.get("units"); units_values = new ArrayList<>(uvset.size()); Collections.addAll(units_values, uvset.toArray(new String[uvset.size()])); } refreshSP(); CLEAR_TEXT_ON_TOUCH = (Boolean) dspMap.get("pref_clear_read"); DATA_RESOLUTION = dspMap.get("pref_resolution") == null ? 3 : Integer.parseInt((String) dspMap.get("pref_resolution")); spin_dunit.setAdapter(new ArrayAdapter<>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item, units_values)); spin_cunit.setAdapter(new ArrayAdapter<>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item, units_values)); setSpinners(); } public String str(Double d) { return String.format("%." + DATA_RESOLUTION.toString() + "f", d); } public String str(int i) { return String.valueOf(i); } private void clickSettings() { Intent intent = new Intent(); intent.setClassName(this, "com.romaka.fivepointapp.SettingsActivity"); startActivity(intent); checkSharedPreferences(); } private void composeEmail() { Log.i("ME", "Started Composition Method"); SharedPreferences dsp = PreferenceManager.getDefaultSharedPreferences(this); Map<String, ?> dspMap = dsp.getAll(); String defaultEmail = (String) dspMap.get("pref_email"); String strSubject = "Calibration Results for " + device.EquipID; //+ " on " + cr.date.toString(); String strHTML = MyUtilities.htmlWrapper(device.hTable()); String strJSON = device.toJSON(); String strDevice = device.toString(); String fileName = "cal.html"; FileOutputStream outputStream; File file = new File(getFilesDir(), fileName); Log.i("ME", file.toString()); try { outputStream = openFileOutput(fileName, 0); outputStream.write(strHTML.getBytes()); outputStream.close(); } catch (Exception e) { e.printStackTrace(); } Log.i("ME", String.valueOf(file.exists())); /* Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/html"); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, new String[]{defaultEmail}); intent.putExtra(Intent.EXTRA_SUBJECT, strSubject); intent.putExtra(Intent.EXTRA_TEXT, strDevice); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(Intent.createChooser(intent, "Email:")); }*/ } private void clickShare() { composeEmail(); } private void clickHelp() { Intent intent = new Intent(); intent.setClassName(this, "com.romaka.fivepointapp.HelpActivity"); startActivity(intent); } private void clickContact() { Intent intent = new Intent(); intent.setClassName(this, "com.romaka.fivepointapp.Contact" + ""); startActivity(intent); } private void resetForm() { ////Log.i("ME", "Starting reset..."); ClearForm((ViewGroup) findViewById(R.id.mainconstraint)); Instrument backupDevice = new Instrument(); Gson gson = new Gson(); SharedPreferences sp = getPreferences(0); String strJSON = sp.getString(DFLT_DEVICE, gson.toJson(backupDevice)); ////Log.i("ME", strJSON); Instrument inst = gson.fromJson(strJSON, Instrument.class); FillForm(inst); ////Log.i("ME", cr.Device.toString() + "\n...Reset Complete."); } public void clickReset(View view) { resetForm(); } public void clickClear(View view) { //Log.i("ME", "Clearing..."); ClearForm((ViewGroup) findViewById(R.id.mainconstraint)); //Log.i("ME", "...Cleared."); } public void clickCal(View view) { if (FormFilledRight(mandos)) { CollectForm(); Intent intent = new Intent(); intent.setClassName(this, "com.romaka.fivepointapp.CalActivity"); intent.putExtra("device", toGson(device)); intent.putExtra("resolution", DATA_RESOLUTION); intent.putExtra("clear", CLEAR_TEXT_ON_TOUCH); startActivity(intent); } } private String toGson(Object o) { Gson gson = new Gson(); return gson.toJson(o); } public void ClearEditText(View view) { if (view instanceof EditText) { EditText et = (EditText) view; et.setText(""); et.setBackgroundColor(Color.RED); et.requestFocus(); et.selectAll(); } } private void setSpinners() { int dindex = units_values.indexOf(device.DUnits); int cindex = units_values.indexOf(device.CUnits); spin_dunit.setSelection(dindex); spin_cunit.setSelection(cindex); } private void FillForm(Instrument inst) { try { e_id.setText(inst.EquipID); e_serial.setText(inst.Serial); e_make.setText(inst.Make); e_model.setText(inst.Model); e_dlrv.setText(inst.DLRV.toString()); e_durv.setText(inst.DURV.toString()); e_clrv.setText(inst.CLRV.toString()); e_curv.setText(inst.CURV.toString()); e_steps.setText(inst.Steps.toString()); rb_lin.setChecked(true); setSpinners(); } catch (Exception e) { e.printStackTrace(); ClearForm((ViewGroup) findViewById(R.id.mainconstraint)); } } private Boolean FormFilledRight(ArrayList<EditText> mfs) { ////Log.i("ME", "Starting Form Validation..."); Boolean gonogo = true; Iterator it = mfs.iterator(); while (it.hasNext()) { EditText e = (EditText) it.next(); if (e.getText().length() == 0) { e.setBackgroundColor(Color.RED); } else { e.setBackground(getDrawable(R.drawable.bg6)); } gonogo = (e.getText().length() == 0) ? false : gonogo; } ////Log.i("ME", "...Form Validation Complete."); return gonogo; } private void CollectForm() { ////Log.i("ME", "Starting Collection..."); String id = e_id.getText().toString(); String se = e_serial.getText().toString(); String ma = e_make.getText().toString(); String mo = e_model.getText().toString(); Double dl = Double.parseDouble(e_dlrv.getText().toString()); Double du = Double.parseDouble(e_durv.getText().toString()); String dun = spin_dunit.getSelectedItem().toString(); String cun = spin_cunit.getSelectedItem().toString(); Double cl = Double.parseDouble(e_clrv.getText().toString()); Double cu = Double.parseDouble(e_curv.getText().toString()); Integer st = Integer.parseInt(e_steps.getText().toString()); Boolean il = rb_lin.isChecked(); //String no = e_notes.getText().toString(); device = new Instrument(id, se, ma, mo, dl, du, dun, cl, cu, cun, st, il); // cr.Notes = no; } // Got this procedure from // https://stackoverflow.com/questions/5740708/android-clearing-all-edittext-fields-with-clear-button private void ClearForm(ViewGroup group) { for (int i = 0, count = group.getChildCount(); i < count; ++i) { View view = group.getChildAt(i); if (view instanceof EditText) { ((EditText) view).setText(""); view.setBackground(getDrawable(R.drawable.bg6)); } if (view instanceof ViewGroup && (((ViewGroup) view).getChildCount() > 0)) { ClearForm((ViewGroup) view); } } } @Override public void onFragmentInteraction(Uri uri) { } }
9d0983e72cc9050431ec6ed676856cacb00e0d84
e26e4e9f70adf69de754e1462b3b3e831180b29f
/src/main/java/com/link8/tw/controller/request/task/TaskAssignRequest.java
e2c7466b6a16e815ed5a581f31dd543bb4e58e2d
[]
no_license
leo0961325/Task_backend
c6155998c1827a1b936ce8e517d392e31927c454
1dab48f3aa0c31b72f557a85390191863a6be8bd
refs/heads/main
2023-03-03T06:50:02.375067
2021-02-09T18:46:24
2021-02-09T18:46:24
337,502,491
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package com.link8.tw.controller.request.task; import java.util.List; public class TaskAssignRequest { private List<Integer> id; private String assign; private boolean follow; public TaskAssignRequest(List<Integer> id, String assign, boolean follow) { this.id = id; this.assign = assign; this.follow = follow; } public void setId(List<Integer> id) { this.id = id; } public List<Integer> getId() { return id; } public String getAssign() { return assign; } public void setAssign(String assign) { this.assign = assign; } public boolean isFollow() { return follow; } public void setFollow(boolean follow) { this.follow = follow; } }
3b3a08085a7027d6f1bdc2902e24cb1f41a26241
400ae0816bbf90fdb9a2dc1fc5d2e602b31a93b2
/app/src/main/java/com/dengzi/moduletest/activity/ImageActivity.java
dda2a7d6f6b3c29d9b30e8e669a108c229dd3c0a
[]
no_license
xiaodengzi0812/ModuleTest
ea2562fcd52ab6d20381f3f50a49e2e10892c39c
9499aa725ba1d9084824522151ff78c399dab5c6
refs/heads/master
2021-01-20T04:22:50.664023
2018-01-17T15:06:53
2018-01-17T15:06:53
101,388,824
0
0
null
null
null
null
UTF-8
Java
false
false
3,380
java
package com.dengzi.moduletest.activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import com.dengzi.moduletest.R; import com.dengzi.moduletest.base.BaseBackActivity; import com.dengzi.lib.util.ImageUtils; import com.dengzi.lib.util.SizeUtils; /** * @Title:Image工具类Demo * @Author: djk * @Time: 2017/8/2 * @Version:1.0.0 */ public class ImageActivity extends BaseBackActivity { public static void start(Context context) { Intent starter = new Intent(context, ImageActivity.class); context.startActivity(starter); } private ImageView ivSrc; private ImageView ivView2Bitmap; @Override public void initData(Bundle bundle) { } @Override public int bindLayout() { return R.layout.activity_image; } @Override public void initView(Bundle savedInstanceState, View view) { getToolBar().setTitle(getString(R.string.demo_image)); ivSrc = (ImageView) findViewById(R.id.iv_src); ivView2Bitmap = (ImageView) findViewById(R.id.iv_view2Bitmap); ImageView ivRound = (ImageView) findViewById(R.id.iv_round); ImageView ivRoundCorner = (ImageView) findViewById(R.id.iv_round_corner); ImageView ivFastBlur = (ImageView) findViewById(R.id.iv_fast_blur); ImageView ivRenderScriptBlur = (ImageView) findViewById(R.id.iv_render_script_blur); ImageView ivStackBlur = (ImageView) findViewById(R.id.iv_stack_blur); ImageView ivAddFrame = (ImageView) findViewById(R.id.iv_add_frame); ImageView ivAddReflection = (ImageView) findViewById(R.id.iv_add_reflection); ImageView ivAddTextWatermark = (ImageView) findViewById(R.id.iv_add_text_watermark); ImageView ivAddImageWatermark = (ImageView) findViewById(R.id.iv_add_image_watermark); ImageView ivGray = (ImageView) findViewById(R.id.iv_gray); Bitmap src = ImageUtils.getBitmap(R.drawable.lena); Bitmap watermark = ImageUtils.getBitmap(R.mipmap.ic_launcher); SizeUtils.onForceGetViewSize(ivSrc, new SizeUtils.onGetSizeListener() { @Override public void onGetSize(View view) { ivView2Bitmap.setImageBitmap(ImageUtils.view2Bitmap(ivSrc)); } }); ivRound.setImageBitmap(ImageUtils.toRound(src)); ivRoundCorner.setImageBitmap(ImageUtils.toRoundCorner(src, 60)); ivFastBlur.setImageBitmap(ImageUtils.fastBlur(src, 0.1f, 5)); ivRenderScriptBlur.setImageBitmap(ImageUtils.renderScriptBlur(src, 10)); src = ImageUtils.getBitmap(R.drawable.lena); ivStackBlur.setImageBitmap(ImageUtils.stackBlur(src, 10, false)); ivAddFrame.setImageBitmap(ImageUtils.addFrame(src, 16, Color.GREEN)); ivAddReflection.setImageBitmap(ImageUtils.addReflection(src, 80)); ivAddTextWatermark.setImageBitmap(ImageUtils.addTextWatermark(src, "blankj", 40, 0x8800ff00, 0, 0)); ivAddImageWatermark.setImageBitmap(ImageUtils.addImageWatermark(src, watermark, 0, 0, 0x88)); ivGray.setImageBitmap(ImageUtils.toGray(src)); } @Override public void doBusiness(Context context) { } @Override public void onWidgetClick(View view) { } }
b0760099bcba851ae0c8009c015577d2e0c02d1a
4742cee994fec5e90c9144a1582dcf522913c93d
/src/main/JAVA/com/mmall/pojo/User.java
a46d45bb6ca2e3846fa004e13b5acad7abbd650f
[]
no_license
kenan2016/mmall_learninng
2361edc4bb8da9fc88a38349285aee61e18670c2
88a004c2bc061ff40bbe0f47a734cea467055504
refs/heads/master
2021-07-25T22:52:52.402555
2018-11-27T14:06:08
2018-11-27T14:06:08
147,097,199
0
0
null
null
null
null
UTF-8
Java
false
false
2,340
java
package com.mmall.pojo; import java.util.Date; public class User { private Integer id; private String username; private String password; private String email; private String phone; private String question; private String answer; private Integer role; private Date createTime; private Date updateTime; public User(Integer id, String username, String password, String email, String phone, String question, String answer, Integer role, Date createTime, Date updateTime) { this.id = id; this.username = username; this.password = password; this.email = email; this.phone = phone; this.question = question; this.answer = answer; this.role = role; this.createTime = createTime; this.updateTime = updateTime; } public User() { super(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public String getAnswer() { return answer; } public void setAnswer(String answer) { this.answer = answer; } public Integer getRole() { return role; } public void setRole(Integer role) { this.role = role; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }
c723fc80a5d29a87fd78586ffd3a5ac7ed3027e5
e8daec44c585ab348f47b71e70d311182ba40566
/Rest-JAXExercise2-Person/src/java/rest/ApplicationConfig.java
fdc1ef9352834c79934e8e40e34f1962438ca408
[]
no_license
JonasRafn/Block2-Week40
96489ade5454064df9ac1320a178f8414398e6b4
a74507809a48d34cafd5e345e7c9d8563b8e5b59
refs/heads/master
2016-08-12T20:07:18.558559
2015-10-02T10:07:51
2015-10-02T10:07:51
43,545,374
0
0
null
null
null
null
UTF-8
Java
false
false
705
java
package rest; import java.util.Set; import javax.ws.rs.core.Application; @javax.ws.rs.ApplicationPath("api") public class ApplicationConfig extends Application { @Override public Set<Class<?>> getClasses() { Set<Class<?>> resources = new java.util.HashSet<>(); addRestResourceClasses(resources); return resources; } /** * Do not modify addRestResourceClasses() method. * It is automatically populated with * all resources defined in the project. * If required, comment out calling this method in getClasses(). */ private void addRestResourceClasses(Set<Class<?>> resources) { resources.add(rest.RestService.class); } }
bbb68bcb175cb87716715331a2c76327a0bd8914
43e0eb5261a5de4b928c7663b556789ca6d6734c
/simple-sso-server/src/main/java/com/simple/sso/server/controller/LoginController.java
b512d1aafab30f792681a8b5cafca592aaa13b14
[]
no_license
Chinaxiang/simple-sso
a3a7b5933888da686cfe2b1b0f197d9eec67655f
09dff6eb39d30885d9ce18864e3ed2ed301b9324
refs/heads/master
2020-04-22T19:41:17.490153
2019-02-14T02:53:13
2019-02-14T02:53:13
170,487,053
0
0
null
null
null
null
UTF-8
Java
false
false
2,987
java
package com.simple.sso.server.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.simple.sso.client.constant.AuthConst; import com.simple.sso.client.storage.SessionStorage; import com.simple.sso.client.util.HTTPUtil; import com.simple.sso.server.storage.ClientStorage; /** * 登录和注销控制器 * @author yanxiang.huang 2019-02-14 10:12:01 */ @Controller public class LoginController { /** * 登录 * * @param request * @param model * @return */ @RequestMapping("/login") public String login(HttpServletRequest request, Model model) { // 验证用户 if (!"sso".equals(request.getParameter("username"))) { model.addAttribute("error", "user not exist."); return "redirect:/"; } // 授权 String token = UUID.randomUUID().toString(); request.getSession().setAttribute(AuthConst.IS_LOGIN, true); request.getSession().setAttribute(AuthConst.TOKEN, token); // 存储,用于注销 SessionStorage.INSTANCE.set(token, request.getSession()); // 子系统跳转过来的登录请求,授权、存储后,跳转回去 String clientUrl = request.getParameter(AuthConst.CLIENT_URL); if (clientUrl != null && !"".equals(clientUrl)) { // 存储,用于注销 ClientStorage.INSTANCE.set(token, clientUrl); return "redirect:" + clientUrl + "?" + AuthConst.TOKEN + "=" + token; } return "redirect:/"; } /** * 注销 * * @param request * @return */ @RequestMapping("/logout") public String logout(HttpServletRequest request) { HttpSession session = request.getSession(); String token = request.getParameter(AuthConst.LOGOUT_REQUEST); // token存在于请求中,表示从客户端发起的注销;token存在于会话中,表示从认证中心发起的注销 if (token != null && !"".equals(token)) { session = SessionStorage.INSTANCE.get(token); } else { token = (String) session.getAttribute(AuthConst.TOKEN); } if (session != null) { session.invalidate(); } // 注销子系统 List<String> list = ClientStorage.INSTANCE.get(token); if (list != null && list.size() > 0) { System.out.println("注销子系统"); Map<String, String> params = new HashMap<String, String>(); params.put(AuthConst.LOGOUT_REQUEST, token); for (String url : list) { HTTPUtil.post(url, params); } } return "redirect:/"; } }
954be9b42dcc247627681cab6a0e56f6c2824ec6
a0994b7b8dcc7e2c4b4d7ca2ade22642c43224e3
/src/main/java/jobportal/dao/OfferLanguageRepository.java
4ea8c01bf346ad7893df1ad2b8353152be0a2789
[]
no_license
jezura/jobportal
d68a92fb45dc0ca3e63131b809749b77d1442404
4afe3d1e2b0884bfdf05630ea24aff5296ba6cc0
refs/heads/master
2021-06-30T04:46:07.074949
2021-05-02T13:47:15
2021-05-02T13:47:15
241,059,942
0
0
null
2021-06-15T16:07:14
2020-02-17T08:51:00
Java
UTF-8
Java
false
false
292
java
package jobportal.dao; import jobportal.models.offer_data_models.codebooks.OfferLanguage; import org.springframework.data.repository.CrudRepository; public interface OfferLanguageRepository extends CrudRepository <OfferLanguage, Integer> { OfferLanguage findOfferLanguageById(int id); }
75f3dba87f8a897a99ff5d2b67030b2cc4bf39ed
ba3bf48f5055fabcf066f3597d8a0325d89f86a6
/dameng/hazelcast-persistence/.svn/pristine/75/75f3dba87f8a897a99ff5d2b67030b2cc4bf39ed.svn-base
907e483ab6cbb547465b93c9a99d260f254c6b1c
[]
no_license
rzs840707/EasyCache-TpcW
b04cb6f9846e78f8e597ab17cbfbe7a838e2cdc2
f390fa7a9f09bac52fdfcfd20feed924584dab46
refs/heads/master
2021-01-11T00:22:25.018813
2016-10-08T11:56:58
2016-10-08T11:56:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,521
/* * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. * * 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.hazelcast.spi; import com.hazelcast.nio.ObjectDataInput; import com.hazelcast.nio.ObjectDataOutput; import java.io.IOException; /** * @mdogan 2/12/13 */ public final class DefaultObjectNamespace implements ObjectNamespace { private String service; private Object objectId; public DefaultObjectNamespace() { } public DefaultObjectNamespace(String serviceName, Object objectId) { this.service = serviceName; this.objectId = objectId; } public String getServiceName() { return service; } public Object getObjectId() { return objectId; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DefaultObjectNamespace that = (DefaultObjectNamespace) o; if (objectId != null ? !objectId.equals(that.objectId) : that.objectId != null) return false; if (service != null ? !service.equals(that.service) : that.service != null) return false; return true; } @Override public int hashCode() { int result = service != null ? service.hashCode() : 0; result = 31 * result + (objectId != null ? objectId.hashCode() : 0); return result; } public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(service); out.writeObject(objectId); } public void readData(ObjectDataInput in) throws IOException { service = in.readUTF(); objectId = in.readObject(); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("DefaultObjectNamespace"); sb.append("{service='").append(service).append('\''); sb.append(", objectId=").append(objectId); sb.append('}'); return sb.toString(); } }
d7df14a4ed9be41364491fac3bf72ed6702a2650
cde29efcc9bf8a2af0f2b92156fee85d5f948e6c
/android/src/main/kotlin/com/juanito21/simpleshare/src/FileHelper.java
82b2fb939ebefdb6c8075b6c22ed34b1a04d1db1
[ "MIT" ]
permissive
alexanderkorus/simple_share
f9bd91ea1ea75babec4971924ecbfbbd6b8b87df
40c46492038f7f9ad5b5cbbcae37ac90f2b9998d
refs/heads/master
2020-04-29T02:53:46.563470
2019-03-15T09:33:44
2019-03-15T09:33:44
175,787,431
0
0
MIT
2019-03-15T09:17:19
2019-03-15T09:17:17
Java
UTF-8
Java
false
false
4,634
java
package com.juanito21.simpleshare.src; import io.flutter.plugin.common.PluginRegistry.Registrar; import android.content.CursorLoader; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; import android.support.v4.content.FileProvider; import android.util.Base64; import android.webkit.MimeTypeMap; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class FileHelper { private static final String SHARED_PROVIDER_AUTHORITY = ".adv_provider"; private static final String SHARED_FOLDER= "shared"; private final Registrar registrar; private final String authorities; private String url; private Uri uri; private String type; FileHelper(Registrar registrar, String url) { this.registrar = registrar; this.authorities = registrar.context().getPackageName() + SHARED_PROVIDER_AUTHORITY; this.url = url; this.uri = Uri.parse(this.url); } FileHelper(Registrar registrar, String url, String type) { this.registrar = registrar; this.authorities = registrar.context().getPackageName() + SHARED_PROVIDER_AUTHORITY; this.url = url; this.uri = Uri.parse(url); this.type = type; } private String getMimeType(String url) { String type = null; String extension = MimeTypeMap.getFileExtensionFromUrl(url); if (extension != null) { type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); } return type; } public boolean isFile() { return isBase64File() || isLocalFile(); } private boolean isBase64File() { String scheme = uri.getScheme(); if (scheme != null && uri.getScheme().equals("data")) { type = uri.getSchemeSpecificPart().substring(0, uri.getSchemeSpecificPart().indexOf(";")); return true; } return false; } private boolean isLocalFile() { String scheme = uri.getScheme(); if (scheme != null && (uri.getScheme().equals("content") || uri.getScheme().equals("file"))) { if (type != null) { return true; } type = getMimeType(uri.toString()); if (type == null) { String realPath = getRealPath(uri); if (realPath == null) { return false; } else { type = getMimeType(realPath); } if (type == null) { type = "*/*"; } } return true; } return false; } String getType() { if (type == null) { return "*/*"; } return type; } private String getRealPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; CursorLoader loader = new CursorLoader(registrar.context(), uri, projection, null, null, null); Cursor cursor = loader.loadInBackground(); String result = null; if (cursor != null && cursor.moveToFirst()) { int col_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); result = cursor.getString(col_index); cursor.close(); } return result; } Uri getUri() { final MimeTypeMap mime = MimeTypeMap.getSingleton(); String extension = mime.getExtensionFromMimeType(getType()); if (isBase64File()) { final String prefix = "" + System.currentTimeMillis() / 1000; String encodedFile = uri.getSchemeSpecificPart() .substring(uri.getSchemeSpecificPart().indexOf(";base64,") + 8); try { final File sharedFolder = new File(registrar.context().getFilesDir(), SHARED_FOLDER); sharedFolder.mkdirs(); final File sharedFile = File.createTempFile(prefix, "." + extension, sharedFolder); final FileOutputStream stream = new FileOutputStream(sharedFile); stream.write(Base64.decode(encodedFile, Base64.DEFAULT)); stream.flush(); stream.close(); return FileProvider.getUriForFile(registrar.context(), this.authorities, sharedFile); } catch (IOException e) { e.printStackTrace(); } } else if (isLocalFile()) { Uri uri = Uri.parse(this.url); return FileProvider.getUriForFile(registrar.context(), authorities, new File(uri.getPath())); } return null; } }
ee17f6c7ced9d80f5b4495a9c7d99696ea229bb7
061058960acea693fe6c0940b3159d3582d2870c
/5.09/src/Opinion.java
987c2dd5f5768eeec5c3a3fb67152d689bfbc0d2
[]
no_license
jasonchang12/java-example
98d31ce132413ad1c4db538bbb68e8964746a75b
639a5f5a6eab3610c7a41a4de7e233446d683729
refs/heads/master
2020-06-05T09:33:59.783318
2015-05-02T16:03:01
2015-05-02T16:03:01
34,803,020
0
0
null
null
null
null
GB18030
Java
false
false
571
java
public class Opinion { // 创建类 public static void main(String args[]) { // 主方法 String s1 = new String("abc"); // 创建字符串对象s1 String s2 = new String("ABC"); // 创建字符串对象s2 //String s3 = new String("abc"); // 创建字符串对象s3 boolean b = s1.equals(s2); // 使用equals()方法比较s1与s2 // 使用equalsIgnoreCase()方法比较s1与s2 boolean b2 = s1.equalsIgnoreCase(s2); System.out.println(s1 + " equals " + s2 + " :" + b); // 输出信息 System.out.println(s1 + " equalsIgnoreCase " + s2 + " :" + b2); } }
a30147201882c429b4ffa9b5245aa43ced57a873
6bbc7bf3f1de41bbc0be136319d7b7ea9b4e4482
/src/main/java/com/example/drg/dao/GenFileDao.java
f2d071f5705c7e993921ab1eb29d5f6eb8de938a
[]
no_license
frenchLineCigar/drg2021
09d51b5a939148ad0fa22465f573d06c48665d27
38079cae3958defb900331c4ad405524754d9ee7
refs/heads/master
2023-06-18T07:09:24.206387
2021-07-18T23:09:21
2021-07-18T23:09:21
366,430,724
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.example.drg.dao; import com.example.drg.dto.GenFile; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @Mapper public interface GenFileDao { void saveMeta(GenFile file); GenFile findGenFileById(@Param("id") int id); GenFile findGenFile(@Param("relTypeCode") String relTypeCode, @Param("relId") int relId, @Param("typeCode") String typeCode, @Param("type2Code") String type2Code, @Param("fileNo") int fileNo); GenFile findGenFileByFileExtTypeCodeAndWidthAndHeight(String relTypeCode, int relId, String fileExtTypeCode, int width, int height); GenFile findGenFileByFileExtTypeCodeAndMaxWidth(String relTypeCode, int relId, String fileExtTypeCode, int maxWidth); }
298779695956339a00e493606cedd2bc23a066ca
2202e53e151f3a26db8c0ab950a5f90503bfc473
/src/main/java/com/cgj/pattern/factory/simplefactory/SimpleFactoryTest.java
e7825a53855d122131524e50c19f84cb2ce7ffce
[]
no_license
javagjChen/pattern
ae63eeb6356df5a19cb61b827ebe56c86bb281d4
4b4a6d684cd84f814a79b1dc2dd7028876fba279
refs/heads/master
2020-04-28T02:43:02.280335
2019-04-03T02:31:41
2019-04-03T02:31:41
174,909,117
1
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.cgj.pattern.factory.simplefactory; import com.cgj.pattern.factory.DongguanHotLine; import com.cgj.pattern.factory.ZhuhaiHotLine; public class SimpleFactoryTest { public static void main(String[] args) { HotLineFactory factory = new HotLineFactory(); try { factory.createHotLine(DongguanHotLine.class).callFunc(); factory.createHotLine(ZhuhaiHotLine.class).callFunc(); } catch (Exception e) { e.printStackTrace(); } } }
197efe1b4ac39655d15b766060bf3304628c94cc
a175064ca5506ed2fa51a64ed89c6d8e4de71f48
/backstage/src/main/java/com/line/backstage/utils/IpUtil.java
d7a873c9e68c5ca14f359d64d23e80c8d96d5abc
[]
no_license
jiagecode/k_line
f060922714a04d5009aae42f181d161f6ed8009c
4d8215b5c209f1d5e934aa5c33c53af96da9cd77
refs/heads/master
2023-09-06T03:50:02.419068
2021-07-26T06:03:29
2021-07-26T06:03:29
379,450,063
2
0
null
null
null
null
UTF-8
Java
false
false
1,927
java
package com.line.backstage.utils; import javax.servlet.http.HttpServletRequest; import java.net.InetAddress; import java.net.UnknownHostException; /** * IP * @author pc */ public class IpUtil { private static final String UNKNOWN = "unknown"; private static final String LOCALHOST = "127.0.0.1"; private static final String SEPARATOR = ","; public static String getIpAddr(HttpServletRequest request) { String ipAddress; try { ipAddress = request.getHeader("x-forwarded-for"); if (ipAddress == null || ipAddress.length() == 0 || UNKNOWN.equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("Proxy-Client-IP"); } if (ipAddress == null || ipAddress.length() == 0 || UNKNOWN.equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("WL-Proxy-Client-IP"); } if (ipAddress == null || ipAddress.length() == 0 || UNKNOWN.equalsIgnoreCase(ipAddress)) { ipAddress = request.getRemoteAddr(); if (LOCALHOST.equals(ipAddress)) { InetAddress inet = null; try { inet = InetAddress.getLocalHost(); } catch (UnknownHostException e) { e.printStackTrace(); } ipAddress = inet.getHostAddress(); } } // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 // "***.***.***.***".length() if (ipAddress != null && ipAddress.length() > 15) { if (ipAddress.indexOf(SEPARATOR) > 0) { ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); } } } catch (Exception e) { ipAddress = ""; } return ipAddress; } }
58cff11c6a1acd340a966834fb93725dfc8088f5
ea4f512dc7f7ff4619bba86b19b6aa27446acfe3
/designpatterns/module-patterns/src/test/java/com/sirma/itt/javacourse/designpattern/iterator/NumContainerTest.java
fddb39201d27bdd7856e7ca485c65555a8fdf3f5
[]
no_license
radko26/Sirma_ITT_JAVACOURSE_DesignPatterns
87021e85c251fbeb76c7945c25f8abf8c9ac13b2
b34dbf13c25ad9bdc82d1aec702bb7cce65d904d
refs/heads/master
2021-01-23T07:08:40.874430
2014-07-15T11:51:14
2014-07-15T11:51:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
620
java
package com.sirma.itt.javacourse.designpattern.iterator; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * Test class for {@link NumContainer}. * * @author radoslav */ public class NumContainerTest { /** * Inserts data into the {@link NumContainer} and via the iterator traverse * its content. */ @Test public void testNext() { NumContainer container = new NumContainer(1, 2, 3, 4, 5); int[] testArray = new int[] { 1, 2, 3, 4, 5 }; Iterator iter = container.getIterator(); for (int i = 0; iter.hasNext(); i++) { assertTrue((int) iter.next() == testArray[i]); } } }
4145701e859f3a023b6bd9e2d596337e8464ffe1
8c3da15dfa99b308b28d831280095ac0ff9660c7
/src/main/java/controller/MachineLearningAgentConfigurationController.java
5bcff4aebe2da7288d2a9d2e4d9a02741c80a0e4
[ "Apache-2.0" ]
permissive
loretoparisi/IEMLS
97de448eff862605bfa499cf6efaac9b627592bf
cc2451165940dbc4b1e23afe85f6529426d3bd8c
refs/heads/master
2021-01-20T09:19:49.060831
2017-05-03T22:41:14
2017-05-03T22:41:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,178
java
package controller; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.ChoiceBox; import javafx.scene.control.TitledPane; import model.algorithms.Algorithm; import model.object.agent.NeuralAgent; import model.species.Specie; import java.net.URL; import java.util.ResourceBundle; public class MachineLearningAgentConfigurationController implements Initializable { @FXML public ChoiceBox choiceMachineLearningAlgorithm; @FXML public ChoiceBox choiceSpecie; @FXML public TitledPane titledPane1; @Override public void initialize(URL url, ResourceBundle resourceBundle) { choiceMachineLearningAlgorithm.setItems(FXCollections.observableArrayList(Algorithm.getMachineLearningAlgorithms())); choiceMachineLearningAlgorithm.getSelectionModel().selectFirst(); choiceSpecie.setItems(FXCollections.observableArrayList(Specie.getSpecies())); choiceSpecie.getSelectionModel().selectFirst(); } public Algorithm getAlgorithm() { return (Algorithm) choiceMachineLearningAlgorithm.getSelectionModel().getSelectedItem(); } }
05cc821f3d64f1eabd34729e8f629ac4c8925b28
285276317b96bfa6d397087718e13f771143d0e7
/Cloud-Storage/CloudClient/src/main/java/ru/cloudstorage/server/controllers/PanelController.java
14014cbdd6752b070ed47b82ee116cae0f36935e
[]
no_license
1t0XX/CloudStorage
1071a1a014938a1d454fc10beb1541f5aa0cde4d
e3ac9ab07a5347ddc98b0a1a5e4db5d156ddb223
refs/heads/master
2022-11-30T23:45:01.895966
2020-08-12T19:11:23
2020-08-12T19:11:23
287,095,504
0
0
null
null
null
null
UTF-8
Java
false
false
4,011
java
package ru.cloudstorage.server.controllers; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.*; import ru.cloudstorage.clientserver.FileInfo; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.time.format.DateTimeFormatter; public abstract class PanelController { @FXML TableView<FileInfo> filesTable; @FXML ComboBox<String> disksBox; @FXML TextField pathField; public void create() { TableColumn<FileInfo, String> fileTypeColumn = new TableColumn<>(); fileTypeColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getType().getName())); fileTypeColumn.setPrefWidth(24); TableColumn<FileInfo, String> filenameColumn = new TableColumn<>("Имя"); filenameColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getFilename())); filenameColumn.setPrefWidth(240); TableColumn<FileInfo, Long> fileSizeColumn = new TableColumn<>("Размер"); fileSizeColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getSize())); fileSizeColumn.setCellFactory(column -> new TableCell<FileInfo, Long>() { @Override protected void updateItem(Long item, boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setText(null); setStyle(""); } else { String text = String.format("%,d bytes", item); if (item == -1L) { text = "[DIR]"; } setText(text); } } }); fileSizeColumn.setPrefWidth(120); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); TableColumn<FileInfo, String> fileDateColumn = new TableColumn<>("Дата изменения"); fileDateColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getLastModified().format(dtf))); fileDateColumn.setPrefWidth(120); filesTable.getColumns().addAll(fileTypeColumn, filenameColumn, fileSizeColumn, fileDateColumn); filesTable.getSortOrder().add(fileTypeColumn); if (this instanceof LeftPanelController) { disksBox.getItems().clear(); for (Path p : FileSystems.getDefault().getRootDirectories()) { disksBox.getItems().add(p.toString()); } disksBox.getSelectionModel().select(0); } filesTable.setOnMouseClicked(event -> { if (event.getClickCount() == 2) { Path path = Paths.get(pathField.getText()).resolve(filesTable.getSelectionModel().getSelectedItem().getFilename()); if (Files.isDirectory(path)) { updateList(path); } } }); globalUpdateList(); } public abstract void updateList(Path path); public void globalUpdateList() { updateList(Paths.get(".")); } public void btnPathUpAction(ActionEvent actionEvent) { Path upperPath = Paths.get(pathField.getText()).getParent(); if (upperPath != null) { updateList(upperPath); } } public void selectDiskAction(ActionEvent actionEvent) { ComboBox<String> element = (ComboBox<String>) actionEvent.getSource(); updateList(Paths.get(element.getSelectionModel().getSelectedItem())); } public String getSelectedFilename() { if (!filesTable.isFocused()) { return null; } return filesTable.getSelectionModel().getSelectedItem().getFilename(); } public String getCurrentPath() { return pathField.getText(); } }
9ed78635f93c804cc0edf41fca8574ff483c5002
ec49ecc1539f44efd770a622e4da8912e185d6ed
/src/main/java/dennis/dkaraoke/controller/MessageController.java
4fdc9c3aca63687340669570ac5fac60234f0236
[]
no_license
ddn488/dkaraoke
58b738caf14d8fa084b9f6bcc3b2bf4e57f32c8e
9c8d005297ab3c4987fc82cece0bc077dc1b8e55
refs/heads/master
2021-01-22T10:01:51.098779
2015-09-09T18:15:50
2015-09-09T18:15:50
42,195,812
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
package dennis.dkaraoke.controller; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import dennis.dkaraoke.model.SongAction; /* * Create a message-handling controller */ @Controller public class MessageController { private Set<String> songQueue = new LinkedHashSet<String>();// to keep the // elements in // the inserting // order. @MessageMapping("/song") @SendTo("/topic/song") public Object[] songActionHandle(SongAction songAction) throws InterruptedException { if (songAction.getAction().equals(SongAction.ADD)) { songQueue.add(songAction.getSongIndex()); } else if (songAction.getAction().equals(SongAction.REMOVE) && songQueue.contains(songAction.getSongIndex())) { songQueue.remove(songAction.getSongIndex()); } // list of string song indexes is sent to the topic queue where all subscribers will receive return songQueue.toArray(); } @RequestMapping(value = "/getHostAddress", method = RequestMethod.GET) @ResponseBody public String getHostAddress() throws UnknownHostException { InetAddress ip = InetAddress.getLocalHost(); // return ip.getHostName(); return ip.getHostAddress(); } }
2818b521de2ac7fb9ad66bccdc5cf600c4d1e450
5bbab282175e0d84b78991a6eab5fabc1c8c17f7
/WEB-INF/src/screens/InspectionServlet.java
ef7c5ba166d3dd2e98469aae6f8e79bf57aa370c
[]
no_license
bryhinton/homeinspection
7fbc7a43638c08cd4bcb69e3259fe0c67ab83309
139c8b7432c1d18d8e29b7cacd5786606cebd5e6
refs/heads/master
2021-01-23T22:52:52.493426
2017-06-10T02:38:03
2017-06-10T02:38:03
24,000,914
0
1
null
null
null
null
UTF-8
Java
false
false
12,414
java
package screens; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import com.sun.deploy.net.HttpRequest; import com.sun.jmx.snmp.tasks.TaskServer; import email.Email; import pdf.GeneratePDF; import sqlrow.*; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Type; import java.sql.Timestamp; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created with IntelliJ IDEA. * User: Bryan * Date: 12/4/12 * Time: 6:16 PM */ public class InspectionServlet extends HttpServlet { @Override public void doPost(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException { PrintWriter writer = Utils.getWriter(rsp); int requestID = (int) (Math.random() * 1000); long startTime = System.currentTimeMillis(); System.out.println("Starting request: " + requestID); writer.println("<?xml version='1.0' encoding='UTF-8'?>"); writer.println("<result>"); int companyID = Utils.parseInt(req.getParameter("inspection[company]"), 0); String techID = req.getParameter("inspection[tech]"); String lastName = req.getParameter("inspection[lastname]"); String key = Login.checkKey(companyID, Utils.parseInt(techID, 0), req.getParameter("key")); String request = req.getParameter("request"); if(Utils.notEmpty(key) && Utils.isEmpty(request)) { try { if(companyID > 0 && Utils.parseInt(techID, 0) > 0 && Utils.notEmpty(lastName)) { Inspection inspection = new Inspection(); // Required Fields inspection.setCompany(companyID); inspection.setTechID(Utils.parseInt(techID, 0)); inspection.setLastName(lastName); // Optional Fields inspection.setFirstName(req.getParameter("inspection[firstname]")); inspection.setAddress(req.getParameter("inspection[address]")); inspection.setCity(req.getParameter("inspection[city]")); inspection.setState(req.getParameter("inspection[state]")); inspection.setZIP(req.getParameter("inspection[zip]")); inspection.setPhone(req.getParameter("inspection[phone]")); inspection.setEmail(req.getParameter("inspection[email]")); inspection.setDate(new Timestamp(Utils.parseLong(req.getParameter("inspection[date]"), System.currentTimeMillis()))); inspection.setSendQuote("true".equals(req.getParameter("inspection[sendquote]"))); inspection.setSignature(req.getParameter("inspection[signature]")); inspection.insert(); // Inspection Areas int areaCount = Utils.parseInt(req.getParameter("inspection[inspectionareas][count]"), 0); Map<String, Integer> idMap = new HashMap<String, Integer>(); for(int i = 0; i < areaCount; i++) { InspectionArea inspectionArea = new InspectionArea(); inspectionArea.setAreaID(Utils.parseInt(req.getParameter("inspection[inspectionareas][list][" + i + "][area]"), 0)); inspectionArea.setName(req.getParameter("inspection[inspectionareas][list][" + i + "][name]")); inspectionArea.setInspection(inspection.getID()); inspectionArea.insert(); idMap.put(req.getParameter("inspection[inspectionareas][list][" + i + "][id]"), inspectionArea.getID()); } // Inspection Area Line Items int lineItemCount = Utils.parseInt(req.getParameter("inspection[inspectionarealineitems][count]"), 0); for(int i = 0; i < lineItemCount; i++) { String result = req.getParameter("inspection[inspectionarealineitems][list][" + i + "][result]"); if(Utils.notEmpty(result)) { InspectionAreaLineItem lineItem = new InspectionAreaLineItem(); lineItem.setInspectionArea(idMap.get(req.getParameter("inspection[inspectionarealineitems][list][" + i + "][inspectionarea]"))); lineItem.setLineItemID(Utils.parseInt(req.getParameter("inspection[inspectionarealineitems][list][" + i + "][lineitem]"), 0)); lineItem.setResult(result); String comment = req.getParameter("inspection[inspectionarealineitems][list][" + i + "][comment]"); if(Utils.notEmpty(comment) && !"null".equals(comment)) { lineItem.setComment(comment); } lineItem.insert(); idMap.put(req.getParameter("inspection[inspectionarealineitems][list][" + i + "][id]"), lineItem.getID()); } } // Custom Line Items int customItemCount = Utils.parseInt(req.getParameter("inspection[customlineitems][count]"), 0); for(int i = 0; i < customItemCount; i++) { CustomLineItem customLineItem = new CustomLineItem(); customLineItem.setInspectionArea(idMap.get(req.getParameter("inspection[customlineitems][list][" + i + "][inspectionarea]"))); customLineItem.setName(req.getParameter("inspection[customlineitems][list][" + i + "][name]")); customLineItem.setResult(req.getParameter("inspection[customlineitems][list][" + i + "][result]")); customLineItem.setComment(req.getParameter("inspection[customlineitems][list][" + i + "][comment]")); customLineItem.setParent(Utils.parseInt(req.getParameter("inspection[customlineitems][list][" + i + "][parent]"), 0)); customLineItem.insert(); idMap.put(req.getParameter("inspection[customlineitems][list][" + i + "][id]"), customLineItem.getID()); } // Quote Items int quoteItemCount = Utils.parseInt(req.getParameter("inspection[quoteitems][count]"), 0); for(int i = 0; i < quoteItemCount; i++) { Task task = Tasks.getByNumber(req.getParameter("inspection[quoteitems][list][" + i + "][task]"), companyID); if(task != null) { QuoteItem quoteItem = new QuoteItem(); quoteItem.setTaskID(task.getID()); quoteItem.setInspectionAreaLineItemID(idMap.get(req.getParameter("inspection[quoteitems][list][" + i + "][inspectionarealineitem]"))); quoteItem.setActive("true".equals(req.getParameter("inspection[quoteitems][list][" + i + "][active]"))); quoteItem.setAddOn("true".equals(req.getParameter("inspection[quoteitems][list][" + i + "][addon]"))); quoteItem.insert(); } } sendEmail(req.getRequestURL().toString(), inspection, true); } writer.println("<success>true</success>"); writer.println("<key>" + key + "</key>"); } catch(Exception e) { e.printStackTrace(); writer.println("<success>false</success>"); } } else if("delete".equals(request)) { int tech = Utils.parseInt(techID, 0); if(tech < 1) { tech = Utils.parseInt(Utils.getCookieValue(req, "techid"), -1); } Technician technician = Technicians.getTechnician(tech); if(technician != null && technician.isAdmin()) { Inspection inspection = Inspections.getInspection(Utils.parseInt(req.getParameter("inspectionid"), 0)); if(inspection != null) { inspection.delete(); writer.println("<success>true</success>"); } else { writer.println("<success>false</success>"); writer.println("<message>That inspection does not exist.</message>"); } } else { writer.println("<success>false</success>"); } } else if("contact".equals(request)) { int tech = Utils.parseInt(techID, 0); if(tech < 1) { tech = Utils.parseInt(Utils.getCookieValue(req, "techid"), -1); } Technician technician = Technicians.getTechnician(tech); if(technician != null && technician.isAdmin()) { Inspection inspection = Inspections.getInspection(Utils.parseInt(req.getParameter("inspectionid"), 0)); if(inspection != null) { boolean contacted = "true".equals(req.getParameter("contacted")); inspection.setContacted(contacted); inspection.update(); writer.println("<success>true</success"); } else { writer.println("<success>false</success"); writer.println("<message>That inspection does not exist.</message>"); } } } else { writer.println("<success>false</success>"); } writer.println("</result>"); System.out.println("Request " + requestID + " took " + (System.currentTimeMillis() - startTime) + "ms"); } @Override public void doGet(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException { String request = req.getParameter("request"); if("email".equals(request)) { Inspection inspection = Inspections.getInspection(Utils.parseInt(req.getParameter("inspectionid"), 0)); if(inspection != null) { sendEmail(req.getRequestURL().toString(), inspection, true); } } } public static void sendEmail(String reqURL, Inspection inspection, boolean sendCompanyNotification) { final String requestURL = reqURL; final int inspectionID = inspection.getID(); final int companyID = inspection.getCompany(); final int techID = inspection.getTechID(); final String emailAddress = inspection.getEmail(); final Timestamp date = inspection.getDate(); Thread thread = new Thread() { public void run() { Company company = Companies.getCompany(companyID); Technician technician = Technicians.getTechnician(techID); SimpleDateFormat dateFormat = new SimpleDateFormat("MMM_dd_YYYY"); String fileName = "Inspection_" + dateFormat.format(date) + "__" + inspectionID; String fullFilePath = "C:/PDF/inspections/" + company.getID() + "/" + fileName + ".pdf"; File file = new File(fullFilePath); if(file.exists()) { file.delete(); } String fullURL = requestURL; fullURL = fullURL.substring(0, fullURL.lastIndexOf("/")); GeneratePDF generatePDF = new GeneratePDF(); generatePDF.genrateCmd("http://localhost/pdf-generator/index.html?inspectionID=" + inspectionID, "inspections", String.valueOf(company.getID()), fileName); try{ Thread.sleep(3000); //Give the PDF Generator a little time to wrap up. } catch(Exception e) { e.printStackTrace(); System.out.println("COULD NOT SLEEP THREAD"); } if(Utils.notEmpty(emailAddress)) { Email email = new Email(); email.setTo(emailAddress); email.setFrom("[email protected]"); email.setSubject(company.getName() + " Home Inspection Results"); email.setContent("For questions about your inspection results, or to schedule service for failed items please call " + company.getPhone() + ". Your technician was " + technician.getFirstName() + "."); email.setFileName(fullFilePath); try { System.out.println("Sending email to " + email.getTo()); email.send(); } catch(Exception e) { // Sometimes the file hasn't finished being written yet, so let's wait a bit a try again try { System.out.println("PDF generator may not have finished yet. Waiting 20 seconds to try again..."); e.printStackTrace(); Thread.sleep(20000); email.send(); } catch (Exception ex) { System.out.println("Could not send inspection email to customer. Inspection: " + inspectionID + "; Company: " + company.getName()); ex.printStackTrace(); } } } Email companyNotification = new Email(); companyNotification.setFrom("[email protected]"); companyNotification.setTo(company.getEmail()); companyNotification.setSubject("New Inspection"); companyNotification.setContent("A new inspection has been completed by " + technician.getFirstName() + " " + technician.getLastName() + ". Go to your <a href='http://67.186.221.39:8080/HomeInspection/company-login.jsp'>Control Panel</a> to see the results."); companyNotification.setFileName(fullFilePath); try { companyNotification.send(); } catch(Exception e) { try { System.out.println("PDF generator may not have finished yet. Waiting 20 seconds to try again..."); e.printStackTrace(); Thread.sleep(20000); companyNotification.send(); } catch (Exception ex) { System.out.println("Could not send company notification. Inspection: " + inspectionID + "; Company: " + company.getName()); ex.printStackTrace(); } } } }; thread.start(); } }
837e266842d401b28657fec34fefae179c17637e
fdcc5af059fe90df3c50560dd616c87d63a0dd3c
/SAT_RPNI_FIXED/rational_safety/src/edu/illinois/automaticsafetygames/games/examples/Cindy3Game.java
b87040df2fe9f535e90b5b3ea31795098fe28bf2
[]
no_license
OliverMa1/DT-synth
ac87b5b8172a2a1576bc8885b373c9bfce45f8d4
fa07dda27dbe6740e200bf5b9f67e5b5e4e44311
refs/heads/master
2021-08-22T18:56:35.833286
2021-07-10T15:01:56
2021-07-10T15:01:56
157,887,915
6
2
null
2019-06-07T17:51:35
2018-11-16T15:43:53
C++
UTF-8
Java
false
false
10,549
java
package edu.illinois.automaticsafetygames.games.examples; import edu.illinois.automaticsafetygames.tools.Tools; import dk.brics.automaton.Automaton; import dk.brics.automaton.RegExp; import edu.illinois.automaticsafetygames.games.IGame; import edu.illinois.automaticsafetygames.finitelybranching.teacher.*; /** * <p> * A finitely branching version of the <em>program repair game</em> described by * Beyene et al. [1]. * </p> * * <p> * Configuration of the program are triples <code>(pc, lock, got_lock)</code> * consisting of a program counter <code>pc</code> (integer value between 0 and * 4), a boolean variable <code>lock</code> representing a lock, and a * non-negative integer variable <code>got_lock</code>. * </p> * * <p> * A configurations is encoded as word in the following way: * <ol> * <li>the program counter is encoded by a symbol in the set * <em>{0, ..., 4}</em>;</li> * <li>the is encoded in binary by either the symbol 0 or 1; and</li> * <li>the value of the variable <code>got_lock</code> is encoded in unary as a * finite (potentially empty) sequence of 1s.</li> * </ol> * </p> * * <p> * In the game as formulated by Beyene et al., the variable * <code>got_lock</code> can be nondeterministically be set to an arbitrary * value, which results in an infinitely-branching. We turn the game into a * finitely-branching version by only allowing to change this value by at most * <code>max</code>, which can be specified when instantiating the game. * </p> * * <ul> * <li>[1] Tewodros A. Beyene, Swarat Chaudhuri, Corneliu Popeea, and Andrey * Rybalchenko. A Constraint-Based Approach to Solving Games on Infinite Graphs.</li> * </ul> * * @author Daniel Neider * */ public class Cindy3Game implements IGame { /** * Default value for parameter <code>max</code>. */ public static final int MAX_CAP = 15; public static final int MAX_ADD = 5; /** * Maximal number that the program variable <em>got_lock</em> can be * increase or decreased. */ private int max_cap; private int max_add; /** * Creates a new instance of the repair game. */ public Cindy3Game() { max_cap = MAX_CAP; max_add = MAX_ADD; } /** * Creates a new instance of the repair game. * * @param max * maximal number that the program variable <em>got_lock</em> can * be increase or decreased */ public Cindy3Game(int max1, int max2) { this.max_cap = max1; this.max_add = max2; } @Override public int getAlphabetSize() { return 4; } /** * Computes the convoluted 2-component symbol, given symbols for the first * and second component. * * @param first * Symbol for the first component * * @param second * Symbol for the second component * * @return Return the convoluted symbol. */ private char conv(int first, int second) { int a = ((getAlphabetSize() + 1) * second + first); return (char) ((getAlphabetSize() + 1) * second + first); } @Override public Automaton getPlayer0Vertices() { Automaton[] p = new Automaton[6]; p[0] = Automaton.minimize(Automaton.makeChar('\u0000') .concatenate((Automaton.makeCharSet("\u0000\u0002").repeat(max_cap,max_cap)) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); p[1] = Automaton.minimize(Automaton.makeChar('\u0000') .concatenate((Automaton.makeChar('\u0000').repeat()) .concatenate(Automaton.makeChar('\u0002').repeat()) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); p[2] = Automaton.makeChar('\u0003'); Automaton union = p[2].union(Automaton.minimize(p[0].intersection(p[1]))); // System.out.println(Tools.automatonToDot(union)); //System.out.println(" P 1 \n " + Tools.automatonToDot(union)); return Automaton.minimize(union); } @Override public Automaton getPlayer1Vertices() { Automaton[] p = new Automaton[6]; p[0] = Automaton.minimize(Automaton.makeChar('\u0001') .concatenate((Automaton.makeCharSet("\u0000\u0002").repeat(max_cap,max_cap)) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); p[1] = Automaton.minimize(Automaton.makeChar('\u0001') .concatenate((Automaton.makeChar('\u0000').repeat()) .concatenate(Automaton.makeChar('\u0002').repeat()) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); Automaton union = Automaton.minimize(p[0].intersection(p[1])); // System.out.println(Tools.automatonToDot(union)); //System.out.println(" P 1 \n " + Tools.automatonToDot(union)); return union; } @Override public Automaton getInitialVertices() { System.out.println("Testing..."); Automaton t1 = new RegExp("\u0000\u0000\u0000\u0000\u0001\u0000\u0002\u0002\u0001\u0000\u0002\u0002\u0001\u0000\u0002\u0002\u0001\u0000\u0002\u0002\u0001").toAutomaton(); Automaton t2 = AutomatonTeacher.computeImage(getTransitions(),t1,4); System.out.println(Tools.automatonToDot(t1)); System.out.println("T2 : " + Tools.automatonToDot(t2)); return Automaton.minimize(Automaton.makeCharRange('\u0000', '\u0001') .concatenate((Automaton.makeChar('\u0002').repeat(max_cap,max_cap)) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); } @Override public Automaton getSafeVertices() { Automaton[] p = new Automaton[2]; p[0] = Automaton.minimize(Automaton.makeCharRange('\u0000','\u0001') .concatenate((Automaton.makeCharSet("\u0000\u0002").repeat(max_cap,max_cap)) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); p[1] = Automaton.minimize(Automaton.makeCharRange('\u0000','\u0001') .concatenate((Automaton.makeChar('\u0000').repeat()) .concatenate(Automaton.makeChar('\u0002').repeat()) .concatenate(Automaton.makeChar('\u0001')).repeat(5,5))); Automaton union = Automaton.minimize(p[0].intersection(p[1])); //System.out.println(Tools.automatonToDot(union)); return union; } @Override public Automaton getTransitions() { Automaton[] r = new Automaton[5]; // cind String z_2_star = "(" + conv(0,0) + "|" + "\\"+conv(2,2) + ")*"; r[0] = new RegExp( conv(0, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1)).toAutomaton(); r[1] = new RegExp( conv(0, 1) + z_2_star + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1)).toAutomaton(); r[2] = new RegExp( conv(0, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + z_2_star + conv(1, 1)).toAutomaton(); r[3] = new RegExp( conv(0, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1)).toAutomaton(); r[4] = new RegExp( conv(0, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1) + z_2_star + conv(1, 1) + "(\\" +conv(2, 2) + "|" + conv(0,2) + ")*" + conv(1, 1)).toAutomaton(); //stepmother String stay = "(" + "\\"+conv(2,2) + "|" + conv (0,0) + ")*" + conv(1, 1); Automaton[] s = new Automaton[5]; s[0] = new RegExp( conv(0, 0) + "*" + "\\"+conv(2, 0) + "\\"+conv(2, 2) + "*" + conv(1, 1) + stay + stay + stay + stay).toAutomaton(); s[1] = new RegExp( stay + conv(0, 0) + "*" + "\\"+conv(2, 0) + "\\"+conv(2, 2) + "*" + conv(1, 1) + stay + stay + stay).toAutomaton(); s[2] = new RegExp( stay + stay + conv(0, 0) + "*" + "\\"+conv(2, 0) + "\\"+conv(2, 2) + "*" + conv(1, 1) + stay + stay).toAutomaton(); s[3] = new RegExp( stay + stay + stay + conv(0, 0) + "*" + "\\"+conv(2, 0) + "\\"+conv(2, 2) + "*" + conv(1, 1) + stay).toAutomaton(); s[4] = new RegExp( stay + stay + stay + stay + conv(0, 0) + "*" + "\\"+conv(2, 0) + "\\"+conv(2, 2) + "*" + conv(1, 1)).toAutomaton(); // overflow Automaton[] o = new Automaton[6]; String no_o = "(" + "\\" +conv(0,4) + "|" + "\\" +conv(2,4) + ")*" + "\\" +conv(1,4); o[0] = new RegExp( "\\" + conv(1,3) + no_o + "\\" +conv(0,4) + "*" + "\\" +conv(1,4) + no_o + no_o + no_o).toAutomaton(); o[1] = new RegExp( "\\" + conv(1,3) + no_o + no_o + "\\" +conv(0,4) + "*" + "\\" +conv(1,4) + no_o + no_o).toAutomaton(); o[2] = new RegExp( "\\" + conv(1,3) + no_o + no_o + no_o + "\\" +conv(0,4) + "*" + "\\" +conv(1,4) + no_o).toAutomaton(); o[3] = new RegExp( "\\" + conv(1,3) + no_o + no_o + no_o + no_o + "\\" +conv(0,4) + "*" + "\\" +conv(1,4)).toAutomaton(); o[4] = new RegExp( "\\" + conv(1,3) + "\\" +conv(0,4) + "*" + "\\" +conv(1,4) + no_o + no_o + no_o + no_o).toAutomaton(); o[5] = new RegExp("" + conv(3,3)).toAutomaton(); // Union Automaton unionC = Automaton.makeEmpty(); for (int i = 0; i < r.length; i++) { unionC = unionC.union(r[i]); } Automaton unionS = Automaton.makeEmpty(); for (int i = 0; i < s.length; i++) { unionS = unionS.union(s[i]); } unionS = unionS.repeat(max_add,max_add); unionS = new RegExp(""+conv(1, 0)).toAutomaton().concatenate(unionS); Automaton unionO = Automaton.makeEmpty(); for (int i = 0; i < o.length; i++) { unionO = unionO.union(o[i]); } //System.out.println(Tools.automatonToDot(unionC)); Automaton union = unionO.union(unionS.union(unionC)); //System.out.println(" Union O \n " + Tools.automatonToDot(unionO)); //union.determinize(); return Automaton.minimize(unionC); } }
838f2d179bf7170b1168f57da54b546304416767
212958795d62fb049e0d92a43473688fc3d77cf2
/src/main/URLDemo.java
d5ee14cd70a95c931b3835d97098315e9d983829
[]
no_license
Deeksha-kashyap/PracticeTest
46a062a383a624801e1d8fd08bf6a7685c2543d5
575ef86c1d465509b9273265ce4c5f75003e24ea
refs/heads/master
2020-06-12T00:15:48.459567
2019-07-14T07:43:00
2019-07-14T07:43:00
194,132,735
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package main; import java.net.URL; public class URLDemo { public static void main(String[] args) { try { URL url=new URL("https://github.com/Deeksha-kashyap/C-sharp-Programs"); System.out.println("Protocol:"+url.getProtocol()); System.out.println("Host Name:"+url.getHost()); System.out.println("Port Number:"+url.getPort()); System.out.println("File Name:"+url.getFile()); } catch(Exception e) { System.out.println(e); } } }
[ "Deeksha Kashyap@DESKTOP-KR9UPQB" ]
Deeksha Kashyap@DESKTOP-KR9UPQB
8aa44bb2dab33e2b39d97e1fd23266aabac1ded9
dd38e37fda2e834bee98f6e8554db9b1669a403c
/day02_eesy_01mybaisCRUD/src/test/java/MyBatisTest.java
b167d23f2d94bd393f08097627969735a5ab2720
[]
no_license
muoushi/repo3
45f1a1b869ea45f4de1be18ff98166ed83789eaf
477fcf6e399658fbb73e13e773f64859a9aa2314
refs/heads/master
2022-07-05T09:06:11.812651
2020-03-25T01:49:17
2020-03-25T01:49:17
249,859,453
0
0
null
2022-06-21T03:03:31
2020-03-25T01:34:36
Java
UTF-8
Java
false
false
3,307
java
import com.itheima.dao.IUserDao; import com.itheima.domain.QueryVo; import com.itheima.domain.User; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.InputStream; import java.util.Date; import java.util.List; /** * @author :X H * @version : * @date :Created in 2020/3/5 13:39 * @description: * @modified By: */ public class MyBatisTest { private InputStream in; private SqlSession sqlSession; private IUserDao userDao; @Before //用于在测试方法完成之前 public void init() throws Exception{ //1.读取配置文件 in = Resources.getResourceAsStream("SqlMapConfig.xml"); //2.获取SqlSessionFactory对象 SqlSessionFactory factory=new SqlSessionFactoryBuilder().build(in); //3.获取SqlSession对象 sqlSession = factory.openSession(); //4.创建dao代理对象 userDao=sqlSession.getMapper(IUserDao.class); } @After //用于在测试方法完成之后 public void destroy() throws Exception{ //提交事务 sqlSession.commit(); //6.释放资源 sqlSession.close(); in.close(); } @Test public void testFindAll() { //5.使用代理对象进行操作 List<User> users=userDao.findAll(); for(User i:users) { System.out.println(i); } } //测试保存操作 @Test public void testSave() { User user=new User(); user.setUserId(100); user.setUserAddress("浙江台州"); user.setUserSex('男'); user.setUserName("lxh"); user.setUserBirthday(new Date()); //使用dao对象调用方法 userDao.saveUser(user); } //用于更新用户操作 @Test public void testUpdate(){ User user=new User(); user.setUserId(100); user.setUserAddress("浙江杭州"); user.setUserSex('男'); user.setUserName("lrw"); user.setUserBirthday(new Date()); //使用dao对象调用方法 userDao.updateUser(user); } //根据id删除用户操作 @Test public void testDelete(){ //使用dao对象调用方法 userDao.deleteUser(26); } //根据用户id查找用户操作 @Test public void findById(){ //使用dao对象调用方法 User user = userDao.findById(25); System.out.println(user.toString()); } //根据用户名称查找用户操作 @Test public void findByUserName(){ //使用dao对象调用方法 List<User> users = userDao.findByUserName("%小明%"); for(User user:users) { System.out.println(user); } } //根据QueryVo的条件查询用户 @Test public void findByQueryVo(){ User u1 = new User(); u1.setUserName("%三丰%"); QueryVo vo = new QueryVo(); vo.setUser(u1); //使用dao对象调用方法 User user = userDao.findByQueryVo(vo); System.out.println(user); } }
aff2add3f866911059f4be2dde273e271997edca
e66dfd2f3250e0e271dcdac4883227873e914429
/zml-appweb/src/main/java/weixin/guanjia/message/controller/UppicController.java
d0ffe41ea726dd10584998f4a58d00b757b67679
[]
no_license
tianshency/zhuminle
d13b45a8a528f0da2142aab0fd999775fe476e0c
c864d0ab074dadf447504f54a82b2fc5b149b97e
refs/heads/master
2020-03-18T00:54:16.153820
2018-05-20T05:20:08
2018-05-20T05:20:08
134,118,245
0
1
null
null
null
null
UTF-8
Java
false
false
3,278
java
package weixin.guanjia.message.controller; import java.io.File; import java.util.Map; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import com.jce.framework.core.common.controller.BaseController; import com.jce.framework.core.util.ExceptionUtil; import com.jce.framework.core.util.LogUtil; import com.jce.framework.web.system.service.SystemService; import weixin.util.DateUtils; @Controller @RequestMapping("/uppic") public class UppicController extends BaseController { private static final Logger logger = Logger .getLogger(CkeUploadController.class); @Autowired private SystemService systemService; // private String sep = System.getProperty("file.separator"); /** * 上传文件信息 * @param request * @param response * @return */ @RequestMapping(params = "doUpload") public ModelAndView doUpload(HttpServletRequest request, HttpServletResponse response) { // 设置字符编码为UTF-8, 这样支持汉字显示 response.setCharacterEncoding("UTF-8"); // MultipartHttpServletRequest mRequest = (MultipartHttpServletRequest) request; // String day = DateUtils.date2SStr(); // String path = mRequest.getSession().getServletContext() .getRealPath("/"); String base_save_path = "upload" + sep + day + sep; // String url_base_path = "upload/" + day + "/"; // String save_path = path + base_save_path; File save_folder = new File(save_path); if (!save_folder.exists()) { save_folder.mkdirs(); } // UUID uuid = UUID.randomUUID(); String callback = request.getParameter("CKEditorFuncNum"); String save_script = "<script type=\"text/javascript\">"; // Map<String, MultipartFile> fileMap = mRequest.getFileMap(); for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { MultipartFile mf = entity.getValue();// 获取上传文件对象 // try { // 取原文件名 String file_name = mf.getOriginalFilename().trim(); // file_name = file_name.toLowerCase(); String save_file_name = uuid.toString().replaceAll("-", "") + file_name.substring(file_name.lastIndexOf(".")); // String savePath = save_path + save_file_name; // save_script += "window.parent.setPicName('" + url_base_path + save_file_name + "');"; // File savefile = new File(savePath); // FileCopyUtils.copy(mf.getBytes(), savefile); // savefile = null; } catch (Exception e) { logger.error(ExceptionUtil.getExceptionMessage(e)); } } save_script += "</script>"; // request.setAttribute("list", save_script); LogUtil.info("pic:" + save_script); // return new ModelAndView("weixin/guanjia/newstemplate/upload"); } }
8ab938d5d9ed7b856dbf9adb77aae5cb66e90068
ef9750f898245d894e7aa6bd539cf20c1b043196
/src/main/Main.java
191f0ba13a624981d0a2cc9221da5ab9342d9875
[]
no_license
LongKelvin/Lib_managerment_JAVASWING
15285f5ed8165b45b4dff88b75d7ea23304cd2d6
af24b25c343c4016b7a0fcdfe29fb876233b6ef7
refs/heads/main
2023-02-23T07:24:53.496040
2021-01-20T09:33:39
2021-01-20T09:33:39
330,674,575
0
1
null
2021-01-20T09:33:40
2021-01-18T13:27:27
Java
UTF-8
Java
false
false
1,309
java
package main; import java.sql.SQLException; import javax.swing.*; import dataaccess.DAConnection; import de.javasoft.plaf.synthetica.SyntheticaAluOxideLookAndFeel; import presentations.FrameManager; import presentations.LoginFrame; import presentations.TroubleshootFrame; public class Main { public static void main(String[] args) throws SQLException, ClassNotFoundException { // try { // //UIManager.setLookAndFeel(new SyntheticaAluOxideLookAndFeel()); // //UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel"); // // } catch (Exception e) { // e.printStackTrace(); // } try { DAConnection.getConnection(); FrameManager frame = new FrameManager(); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); LoginFrame dialog = new LoginFrame(frame); dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); dialog.setVisible(true); dialog.setLocationRelativeTo(frame); } catch (ClassNotFoundException | SQLException e) { // TroubleshootFrame frame = new TroubleshootFrame(); // frame.setLocationRelativeTo(null); // frame.setTitle("Cài đặt kết nối tới cơ sở dữ liệu"); // frame.pack(); // frame.setVisible(true); System.err.println("Hệ Thống Chưa Có Kết Nối CSDL"); } } }
86c58a33fe200568c39de094f3faf7903726ee6f
d9867d5ce94248519b3ef5d05647d10870d6acac
/generators/src/test/java/com/pholser/junit/quickcheck/generator/java/util/TimeZoneGeneratorTest.java
30be78485a2f977edd6de86de791e0bd2a190721
[ "MIT" ]
permissive
framiere/junit-quickcheck
5fcb97f4fe3623994df82c56b891717c38608a3b
9f86970ab0f3b0d0d82f62f723cd5a66ed826fbf
refs/heads/master
2021-01-21T21:32:18.797017
2014-03-29T14:04:55
2014-03-29T14:04:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,240
java
/* The MIT License Copyright (c) 2010-2013 Paul R. Holser, Jr. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pholser.junit.quickcheck.generator.java.util; import java.lang.reflect.Type; import java.util.List; import java.util.Locale; import java.util.TimeZone; import com.pholser.junit.quickcheck.generator.BasicGeneratorTheoryParameterTest; import static java.util.Arrays.*; import static org.mockito.Mockito.*; public class TimeZoneGeneratorTest extends BasicGeneratorTheoryParameterTest { private static final String[] ZONES = TimeZone.getAvailableIDs(); @Override protected void primeSourceOfRandomness() { when(randomForParameterGenerator.nextInt(0, ZONES.length - 1)).thenReturn(1).thenReturn(0).thenReturn(2); } @Override protected Type parameterType() { return TimeZone.class; } @Override protected int sampleSize() { return 3; } @Override protected List<?> randomValues() { return asList(TimeZone.getTimeZone(ZONES[1]), TimeZone.getTimeZone(ZONES[0]), TimeZone.getTimeZone(ZONES[2])); } @Override public void verifyInteractionWithRandomness() { verify(randomForParameterGenerator, times(3)).nextInt(0, ZONES.length - 1); } }
c1e679bcfbcf1a164a2c5d18b0094289267a39f7
78d8bc70e72378b576a3b8bfc05c3ac0110bea48
/android-utilities/src/main/java/com/fengdai/android/json/JsonConverter.java
e6386a508e1a67398891f3a32609a5f6640501ed
[ "Apache-2.0" ]
permissive
fengdai/android-utilities
75d184e3af94d26eb955c20e730d0b43f95be632
57d53b6b2b1093c8d9d9cd41148fb9ff68ca5595
refs/heads/master
2021-01-23T11:55:22.105380
2015-07-18T06:04:31
2015-07-18T06:04:31
13,060,986
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
package com.fengdai.android.json; import java.lang.reflect.Type; /** * Json Converter. * * @author daifeng */ public interface JsonConverter { /** * Convert Object to Json string. */ String toJson(Object object); /** * Convert Json string to Object. */ <T> T fromJson(String jsonString, Type type); }
1ca002e650e1fe6e54b19bd5179b34389bdda9b3
39d45ad192fc154f198d1cdcea16660454e9e3e0
/pillowdata/src/main/java/com/mateuyabar/android/pillow/data/sync/DeletedEntries.java
9ad5f7be9f1162b6eba8dbf5c40cb4265100330b
[]
no_license
mateuy-dev/androidPillow
782e896ed4ff0259e811d30857f145b121833fb9
168e4cbcb238bb721e257bc853994a46a42f5e64
refs/heads/master
2022-12-02T20:12:26.257544
2015-12-01T10:44:02
2015-12-01T10:44:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,773
java
/* * Copyright (c) Mateu Yabar Valles (http://mateuyabar.com) * * 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 2 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/gpl-3.0.html>. */ package com.mateuyabar.android.pillow.data.sync; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.mateuyabar.android.pillow.data.models.IdentificableModel; import com.mateuyabar.android.pillow.data.db.DBUtil; import com.mateuyabar.android.util.CursorUtil; import com.mateuyabar.util.exceptions.BreakFastException; import java.util.ArrayList; import java.util.List; /** * Keeps track of entries deleted on the database but no yet in the server. * Only use on synchronized items * */ public class DeletedEntries<T extends IdentificableModel> { //TODO this class may be reorganized!! public static final String TABLE = "deleted_instances"; public static final String ID_COLUMN = "id"; public static final String CLASS_COLUMN = "class"; public static final String CREATE_TABLE = "CREATE TABLE " + TABLE + " (" + ID_COLUMN + DBUtil.STRING_TYPE+ DBUtil.COMMA_SEP + CLASS_COLUMN + DBUtil.STRING_TYPE + ");"; SQLiteOpenHelper dbHelper; Class<T> modelClass; public static final String WHERE_ID_SELECTION = ID_COLUMN + " == ?"; public DeletedEntries(Class<T> modelClass, SQLiteOpenHelper dbHelper) { this.dbHelper = dbHelper; this.modelClass = modelClass; } public <T extends IdentificableModel> void setToDelete(SQLiteDatabase db, T model) { ContentValues values = new ContentValues(); values.put(ID_COLUMN, model.getId()); values.put(CLASS_COLUMN, model.getClass().getName()); db.insert(TABLE, null, values); } public void setAsDeleted(String id) { SQLiteDatabase db = dbHelper.getWritableDatabase(); setAsDeleted(db, id); db.close(); } public void setAsDeleted(SQLiteDatabase db, String id) { String[] selectionArgs = { id }; db.delete(TABLE, WHERE_ID_SELECTION, selectionArgs); } public List<T> getDeletedModelsIds(){ List<T> result = new ArrayList<>(); Cursor cursor = getCursor(); while(cursor.moveToNext()){ try { String id = CursorUtil.getString(cursor, ID_COLUMN); Class<T> clazz = getModelClass(); T model = clazz.newInstance(); model.setId(id); result.add(model); } catch (Exception e) { throw new BreakFastException(e); } } return result; } private Cursor getCursor(){ //TODO order may be important!!! SQLiteDatabase db = dbHelper.getReadableDatabase(); String[] projection = {ID_COLUMN, CLASS_COLUMN}; String selection = CLASS_COLUMN +" == ?"; String[] values = {getModelClass().getName()}; Cursor cursor = db.query(TABLE, projection, selection, values, null, null, null); return cursor; } public Class<T> getModelClass(){ return modelClass; } public boolean isDeleted(String id) { SQLiteDatabase db = dbHelper.getReadableDatabase(); String[] projection = {ID_COLUMN, CLASS_COLUMN}; String[] selectionArgs = { id }; Cursor cursor = db.query(TABLE, projection, WHERE_ID_SELECTION, selectionArgs, null, null, null); return cursor.moveToNext(); } }
bc006f0e218e6943f5ecdb052207fdf83d07dfe8
307706a5eddf823e18a0b779ed9123d02ddb0004
/src/main/java/com/josetesan/farmatify/web/rest/errors/ErrorConstants.java
cebfa15127300cf797051440e8d6475dc9c7fc8a
[]
no_license
josetesan/farmatify-server
0a5609b2415349876cfcf26d32d59660743389c1
022dff78283571671e3b556486efddad345e8041
refs/heads/master
2021-07-06T00:51:06.784116
2019-04-21T19:00:35
2019-04-21T19:04:04
182,568,244
0
1
null
2020-09-18T09:02:30
2019-04-21T18:25:12
Java
UTF-8
Java
false
false
1,224
java
package com.josetesan.farmatify.web.rest.errors; import java.net.URI; public final class ErrorConstants { public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; public static final String ERR_VALIDATION = "error.validation"; public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized"); public static final URI ENTITY_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/entity-not-found"); public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found"); private ErrorConstants() { } }
bd890be920e86d2258617ed689216ce69790b5b2
9c6f62362a86f333ccc04f1c74dae770703f4e96
/cloudstorage/src/main/java/com/udacity/jwdnd/course1/cloudstorage/model/User.java
055ec5180f857a6e64a49436997690d59930fee0
[]
no_license
junks89/Spring_Thymeleaf
40eb8765aa63d33a997b022a6b1a9627a7354863
727d9e64db1b0dee200a00ecaacd47e8ef26a2de
refs/heads/main
2023-05-23T09:27:24.068856
2021-06-02T05:49:48
2021-06-02T05:49:48
373,052,792
0
0
null
null
null
null
UTF-8
Java
false
false
1,529
java
package com.udacity.jwdnd.course1.cloudstorage.model; public class User { private Integer userId; private String username; private String salt; private String password; private String firstName; private String lastName; public User(Integer userId, String username, String salt, String password, String firstName, String lastName) { this.userId = userId; this.username = username; this.salt = salt; this.password = password; this.firstName = firstName; this.lastName = lastName; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getSalt() { return salt; } public void setSalt(String salt) { this.salt = salt; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } }
db4a022e46780e6314198a6218c558ed3d4e93d3
0680e79e7f4a88ebafee9230e16a9422ac5e51fa
/data_structures/src/com/knife/stack/Stack.java
4a53c268b3e6bb424cf622b6dc5a2a8d30d74699
[]
no_license
shenyachen89/repos
d257a19079f95df5b0d5612b7d9524e904f0be59
77af35117e71e5554a5249550d6ae39b07c41177
refs/heads/master
2020-06-03T09:53:21.546209
2019-06-14T07:42:14
2019-06-14T07:42:14
191,527,783
3
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.knife.stack; public interface Stack<E> { int getSize(); boolean isEmpty(); void push(E e); E pop(); E peek(); }
759d8f76e271e80524a3c780d5ac6544aef9e207
075d9d4325b959790057a2a40a03fdd951516ea3
/jd-net-rpc/src/main/java/com/jd/netty/pipeline/handler/ClientIntHandler.java
48b95e8e814f43a4fe87838acf02ac2de6122400
[]
no_license
wangyingjie/jd-netty
d8e1c40b591811d1ed7877bf9eae41b6aa69f61a
cc04407204ecbf76915acfa3d0086378857b957c
refs/heads/master
2021-11-20T10:33:01.670756
2021-07-29T15:00:00
2021-07-29T15:00:00
207,061,275
0
0
null
2020-10-13T15:53:35
2019-09-08T04:26:12
Java
UTF-8
Java
false
false
1,192
java
package com.jd.netty.pipeline.handler; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; public class ClientIntHandler extends ChannelInboundHandlerAdapter { @Override // 读取服务端的信息 public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { System.out.println("ClientIntHandler.channelRead"); ByteBuf result = (ByteBuf) msg; byte[] result1 = new byte[result.readableBytes()]; result.readBytes(result1); result.release(); ctx.close(); System.out.println("Server said:" + new String(result1)); } @Override // 当连接建立的时候向服务端发送消息 ,channelActive 事件当连接建立的时候会触发 public void channelActive(ChannelHandlerContext ctx) throws Exception { System.out.println("ClientIntHandler.channelActive"); String msg = "Are you ok?"; ByteBuf encoded = ctx.alloc().buffer(4 * msg.length()); encoded.writeBytes(msg.getBytes()); ctx.write(encoded); ctx.flush(); } }
4155f5e72df365c14b9271bda27d5f5d5db0910d
e5bbb9fb5110eaf6a8c7d01575b471f14e31b102
/src/com/kairon/JComPz/Item.java
bcb1cd1569963e6f5ff3089466ba7d0d6107cef7
[]
no_license
KaironXu/LibraryManager
57770c5ad19fe894f6511a86d30037508f863717
5e76a51713d6dc9aa92e2bb12e541f532bab34a9
refs/heads/master
2016-09-11T02:01:55.885957
2014-10-25T05:24:21
2014-10-25T05:24:21
25,718,507
3
2
null
null
null
null
GB18030
Java
false
false
444
java
package com.kairon.JComPz; /** * 图书类别选项 * @author Kairon * */ public class Item { private String id; private String name; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { // TODO Auto-generated method stub return this.name; } }
5104d68e930edf640ff98b47c2d06a578a9961de
19f7091d324c010bee94cb72678f6520e6b2fdc5
/B2908_2.java
f6155db1835ed8388157a07e76fa557f20fc83fc
[]
no_license
jeonghuncho/baekjoon
eaa10e1fcf37a5b8491960dcc2911aa1485c278e
89d7540d33f9a331fa6d93d9fa2410066e4c13f5
refs/heads/master
2020-12-21T03:55:25.880482
2020-01-26T10:43:08
2020-01-26T10:43:08
236,298,179
0
0
null
null
null
null
UTF-8
Java
false
false
836
java
package baekjoon; /* * Author : Jeonghun Cho * Date : December 5, 2019 * https://www.acmicpc.net/problem/2908 */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B2908_2 { public static void main(String[] args) throws IOException{ // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); String a = st.nextToken(); String b = st.nextToken(); int first = Integer.parseInt(new StringBuffer(a).reverse().toString()); int second = Integer.parseInt(new StringBuffer(b).reverse().toString()); if(first > second) { System.out.println(first); }else { System.out.println(second); } br.close(); } }
6c113686c3b556b229dd4ebbf3d9c35d45dce2a5
1d86537d7562df49ca7986a782ae0712d6975497
/src/priv/hailong/service/OrderService.java
0f2aab28f447a45bfe9ec129c0c030ba0143aa7a
[]
no_license
hailong29/tmall_ssm
93cadd1bc22fb12950a3f59e49c1e91a4fee8bc9
9850c3896e5d672c0eed638cf9778a334ceca05f
refs/heads/master
2020-03-30T17:20:18.510811
2018-10-03T17:00:57
2018-10-03T17:01:00
151,451,217
3
1
null
null
null
null
GB18030
Java
false
false
1,172
java
package priv.hailong.service; import priv.hailong.pojo.Order; import priv.hailong.pojo.OrderItem; import java.util.List; public interface OrderService { String waitPay = "waitPay"; String waitDelivery = "waitDelivery"; String waitConfirm = "waitConfirm"; String waitReview = "waitReview"; String finish = "finish"; String delete = "delete"; /** * 根据ID返回对应的Order * * @param id * @return */ Order get(int id); /** * 返回所有的订单 * * @return */ List<Order> listAll(); /** * 按照用户、订单状态来查询 * * @param user_id * @param excludedStatus * @return */ List<Order> list(Integer user_id, String excludedStatus); /** * 返回user_id下的所有订单 * * @param user_id * @return */ List<Order> listByUserId(Integer user_id); /** * 更新订单 * * @param order */ void update(Order order); /** * 增加订单 * * @param order */ void add(Order order); /** * 增加订单,返回一个float类型的数值用来表示该订单的总价 * * @param order * @param orderItems * @return */ float add(Order order, List<OrderItem> orderItems); }
a6431bcbae7092207e19fbfe29da9a28aad52a75
dc9db9922bbad15b19c5e90384739b7a25687684
/src/com/overloading/Test.java
41114b917ed0147f98a28e8beecb93632f0d4764
[]
no_license
developersarm/JavaTraining
3745f8e2c98399df17fa464fe8abc948fa152f1d
5a83efa4d36ea9b23bce8c9cbcebfb49f55b0527
refs/heads/master
2020-03-23T12:51:43.806346
2018-08-17T14:15:20
2018-08-17T14:15:20
141,586,662
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package com.overloading; class Upper { void show (int a, Integer b) { System.out.println("show of upper with int"); } void show (Integer a, int b) { System.out.println("show of upper with Integer"); } } class Lower extends Upper { void show (Integer a, Integer b) { System.out.println("show of lower with int"); } } public class Test { public static void main (String args[]) throws Exception{ // Lower a = new Lower(); // Upper c = new Upper(); // c.show(1,2); // Integer b = 5; // a.show(1,b); System.out.println(Test.class == new Test().getClass()); } }
e6603fd1c665ab59eb3115fd3d851f49d20da42a
9215f3a1d31109256be01c6701a1d24f27f55a91
/android/src/main/java/com/RNOpenpay/RNOpenpayPackage.java
a8bbb7b2ccf3be56653151fd01cf74eff736c31a
[]
no_license
CORBmx/react-native-openpay
8191ad13a25212a9c72b89ba4e5fb9cdb01643e2
27b29750a8378b1621cd8d8e25326c38fda760a9
refs/heads/master
2020-08-30T13:20:07.662156
2020-05-28T14:54:22
2020-05-28T14:54:22
67,621,006
5
6
null
2020-05-28T14:53:30
2016-09-07T15:43:42
Java
UTF-8
Java
false
false
810
java
package com.RNOpenpay; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; public class RNOpenpayPackage implements ReactPackage { @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { List<NativeModule> modules = new ArrayList<>(); modules.add(new RNOpenpayManager(reactContext)); return modules; } }
f3501ae2bd5fb3de4ab38ad01009a535ff70c94c
c8252a718dd4d3db393a6c8461b91614d68f8c56
/src/main/java/gof/creational/builder/builder/HumanBuilder.java
7963455fced42b9fe882740831a0ae6d4dd0d643
[ "MIT" ]
permissive
keidrun/design-patterns-example
0080b4195d6941304b84a673ef1e103dd2b264c4
ad05e3b7dd6b173822a17f03faa77c81585ad3aa
refs/heads/master
2020-12-30T17:10:45.734620
2017-07-22T11:14:04
2017-07-22T11:50:54
91,059,354
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
/** * Copyright 2017 Keid */ package gof.creational.builder.builder; /** * HumanBuilder :Builder * * @author Keid */ public interface HumanBuilder { public void buildName(String name); public void buildType(); public void buildWeapon(); public void buildVehicle(); }
31cd94ea9ac86abdf457b7a1ca35fb8857945cfb
72d19fec898ee568bdd6aa2ab0b68b9e7bc5ce23
/bitcamp-java-project/src/main/java/bitcamp/java106/pms/servlet/task/TaskAddServlet.java
ab3927311f0616ce3808678875d44f147ad85769
[]
no_license
kimakuh/bitcamp2
4e3b65565334d5fa4a44ce7cd55bbc3b2f46aa2a
b2de068647a0c895a02fd3c9da243a5de9719315
refs/heads/master
2020-03-22T09:00:10.268698
2018-05-17T00:15:08
2018-05-17T00:15:08
123,054,436
0
0
null
null
null
null
UTF-8
Java
false
false
3,937
java
// Controller 규칙에 따라 메서드 작성 package bitcamp.java106.pms.servlet.task; import java.io.IOException; import java.io.PrintWriter; import java.sql.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Component; import bitcamp.java106.pms.controller.Controller; import bitcamp.java106.pms.dao.MemberDao; import bitcamp.java106.pms.dao.TaskDao; import bitcamp.java106.pms.dao.TeamDao; import bitcamp.java106.pms.dao.TeamMemberDao; import bitcamp.java106.pms.domain.Member; import bitcamp.java106.pms.domain.Task; import bitcamp.java106.pms.domain.Team; import bitcamp.java106.pms.server.ServerRequest; import bitcamp.java106.pms.server.ServerResponse; import bitcamp.java106.pms.servlet.InitServlet; @WebServlet("/task/add") public class TaskAddServlet extends HttpServlet { private static final long serialVersionUID = 1L; TeamDao teamDao; TaskDao taskDao; MemberDao memberDao; TeamMemberDao teamMemberDao; @Override public void init() throws ServletException { teamDao = InitServlet.getApplicationContext().getBean(TeamDao.class); taskDao = InitServlet.getApplicationContext().getBean(TaskDao.class); teamMemberDao = InitServlet.getApplicationContext().getBean(TeamMemberDao.class); memberDao = InitServlet.getApplicationContext().getBean(MemberDao.class); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); Task task = new Task(); task.setTitle(request.getParameter("title")); task.setStartDate(Date.valueOf(request.getParameter("startDate"))); task.setEndDate(Date.valueOf(request.getParameter("endDate"))); task.setTeam(new Team().setName(request.getParameter("teamName"))); task.setWorker(new Member().setId(request.getParameter("memberId"))); out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<meta charset='UTF-8'>"); out.println("<meta http-equiv='Refresh' content='1;url=list'>"); out.println("<title>작업 등록</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>작업 등록 결과</h1>"); try { Team team = teamDao.selectOne(task.getTeam().getName()); if (team == null) { out.printf("<p>'%s' 팀은 존재하지 않습니다.</p>\n", task.getTeam().getName()); return; } Member member = memberDao.selectOne(task.getWorker().getId()); if (member == null) { out.printf("<p>'%s' 회원은 존재하지 않습니다.</p>\n", task.getWorker().getId()); return; } taskDao.insert(task); out.println("<p>등록 성공!</p>"); } catch (Exception e) { out.println("<p>등록 실패!</p>"); e.printStackTrace(out); } out.println("</body>"); out.println("</html>"); } } // ver 31 - JDBC API가 적용된 DAO 사용 // ver 28 - 네트워크 버전으로 변경 // ver 26 - TaskController에서 add() 메서드를 추출하여 클래스로 정의. // ver 23 - @Component 애노테이션을 붙인다. // ver 22 - TaskDao 변경 사항에 맞춰 이 클래스를 변경한다. // ver 18 - ArrayList가 적용된 TaskDao를 사용한다. // ver 17 - 클래스 생성
fae53a9dd99ac3a67ea31216928da49999110dba
d8a442fac00755f9e2b9e111ecbd253a21714189
/app/src/main/java/com/example/guilherme/rangoamigo/activities/LocalEventoActivity.java
b714b9180aa612c286f90be0f14cc927b6e64cf7
[]
no_license
gsposantos/RangoAmigoAndroid
8518e2e23e196776d0a5bba12925a1ccba64d513
a6c0241b9d1726f166b31a0ae85b81cdc89a80cb
refs/heads/master
2021-09-07T14:01:42.329194
2018-02-23T23:26:37
2018-02-23T23:26:37
120,673,213
0
0
null
null
null
null
UTF-8
Java
false
false
7,307
java
package com.example.guilherme.rangoamigo.activities; import android.content.Context; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.animation.AlphaAnimation; import android.widget.Button; import com.example.guilherme.rangoamigo.R; import com.example.guilherme.rangoamigo.utils.connections.JSONParser; import com.example.guilherme.rangoamigo.utils.connections.NetworkState; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.apache.http.NameValuePair; import org.apache.http.entity.StringEntity; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; public class LocalEventoActivity extends MasterActivity { private Button btnLocal; private Button btnRota; private String sLocalConsulta; private double latitude; private double longitude; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_local_evento); Intent it = getIntent(); String sEnderecoEvento = it.getStringExtra("EnderecoEvento"); String sLocalEvento = it.getStringExtra("LocalEvento"); if (!sEnderecoEvento.isEmpty() && !sLocalEvento.isEmpty()) { sLocalConsulta = sEnderecoEvento + " - " + sLocalEvento; } else if (!sEnderecoEvento.isEmpty()) { sLocalConsulta = sEnderecoEvento; } else if (!sLocalEvento.isEmpty()) { sLocalConsulta = sLocalEvento; } this.consultaLocalizado(sLocalConsulta); this.btnLocal = (Button) findViewById(R.id.btnLocal); this.btnLocal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Uri gmmIntentUri = Uri.parse("google.streetview:cbll=" + String.valueOf(latitude) + "," + String.valueOf(longitude)); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); if (null != mapIntent.resolveActivity(getPackageManager())) { startActivity(mapIntent); } } }); this.btnRota = (Button) findViewById(R.id.btnRota); this.btnRota.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //desvia para mapas /*TODO: Consultar Localizacao lat e long*/ //Uri gmmIntentUri = Uri.parse("google.navigation:?q=" + sLocalConsulta); Uri gmmIntentUri = Uri.parse("google.navigation:?q=" + String.valueOf(latitude) + "," + String.valueOf(longitude)); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); if (null != mapIntent.resolveActivity(getPackageManager())) { startActivity(mapIntent); } } }); } public void consultaLocalizado(String sLocalEvento) { GeoLocalAsyncTask task = new GeoLocalAsyncTask(); try { Geocoder selected_place_geocoder = new Geocoder(this); List<Address> address; address = selected_place_geocoder.getFromLocationName(sLocalEvento, 5); if (address != null && address.size()>0) { Address location = address.get(0); latitude = location.getLatitude(); longitude = location.getLongitude(); } else { // Executa task para consulta if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } } catch (Exception e) { // Executa task para consulta if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } } /* -------------- Asynktask ----------------------- */ class GeoLocalAsyncTask extends AsyncTask<Void, Void, JSONObject> { private String url = ""; private JSONParser jsonParser = new JSONParser(); public GeoLocalAsyncTask() { url = "http://maps.googleapis.com/maps/api/geocode/json"; } @Override protected void onPreExecute() { if (!NetworkState.isNetworkAvaible(getSystemService(Context.CONNECTIVITY_SERVICE))) { showAlert("Erro de Conexão!", "É necessário conexão com internet para executar essa operação."); } // inAnimation = new AlphaAnimation(0f, 1f); // inAnimation.setDuration(200); // progBarHolder.setAnimation(inAnimation); // progBarHolder.setVisibility(View.VISIBLE); } @Override protected JSONObject doInBackground(Void... voids) { try { Gson gson = new Gson(); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("address", sLocalConsulta)); params.add(new BasicNameValuePair("sensor", "false")); JSONObject json = jsonParser.makeHttpRequest(url, "GET", params); return json; } catch (Exception e) { showAlert("Erro de consulta!", "Ocorreu um erro tentando consultar os dados"); } return null; } @Override protected void onPostExecute(JSONObject jsonObject) { JSONArray jsonArray; // outAnimation = new AlphaAnimation(1f, 0f); // outAnimation.setDuration(200); // progBarHolder.setAnimation(outAnimation); // progBarHolder.setVisibility(View.GONE); if (jsonObject != null) { try { longitude = ((JSONArray) jsonObject.get("results")).getJSONObject(0) .getJSONObject("geometry").getJSONObject("location") .getDouble("lng"); latitude = ((JSONArray) jsonObject.get("results")).getJSONObject(0) .getJSONObject("geometry").getJSONObject("location") .getDouble("lat"); } catch (JSONException e) { e.printStackTrace(); } /*DEBUG: Log.d ERROR: Log.e INFO: Log.i VERBOSE: Log.v WARN: Log.w*/ Log.i("ObjetoJson - >", jsonObject.toString()); } } } }
ca1701842a81b965c8b2e95c6e55a98aa3a158ce
e389171c7e38a5dfa3116413dc2647da040b83c8
/AdministrationServer/src/objects/CompanyParser.java
0044070b7905dbaca3ec7f43fd209eb8196c9c03
[]
no_license
shahar2112/Generic-IOT-infrastructure
1d6cb3a0ecfe951cdc54d95ac4eccf4a59d7131f
d9e27cc32407a344ad54c6619f63d68744bf9a39
refs/heads/main
2023-01-25T00:14:46.892567
2020-11-17T09:33:38
2020-11-17T09:33:38
306,931,144
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package objects; import java.io.BufferedReader; import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import com.google.gson.Gson; public class CompanyParser implements Serializable { private static final long serialVersionUID = 1L; public String name; public String email; public String password; public int company_id; public static CompanyParser parse(BufferedReader json) { Gson gson = new Gson(); return gson.fromJson(json, CompanyParser.class); } /* this method returns a new company object with arguments from * the resultSet she receives from the sql query */ public static CompanyParser parse(ResultSet rSet) { CompanyParser objToReturn = null; try { while(rSet.next()) { objToReturn = new CompanyParser(); objToReturn.name = rSet.getString("name"); objToReturn.email = rSet.getString("email"); objToReturn.company_id = rSet.getInt("company_id"); } } catch (SQLException e) { e.printStackTrace(); } return objToReturn; } }
0e7aa8534d4fc97c143ecd3e5ca7ab2744934d23
21d58594ec60dfb3d15dbaaf04b2787a6ce9d9d7
/src/main/java/sample/model/Face4.java
c344eca3c9c0d29ff07b6b32c31a1338f249c199
[]
no_license
jason1105/modal2json
6d0f72b3897a21ff0b3bc440e3a723ffc4553951
dd50519b42c4707283172cf457471b51369fd06f
refs/heads/master
2021-09-10T13:37:07.206081
2018-03-27T03:21:32
2018-03-27T03:21:32
125,814,771
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package sample.model; /** * Created by lv-wei on 2018-03-19. */ public class Face4 { int mode = 131; // Three.js format int a, b, c, d; // index of vertices int m; // index of material int ac, bc, cc, dc; // index of colors public Face4(int mode, int a, int b, int c, int d, int m, int ac, int bc, int cc, int dc) { this.mode = mode; this.a = a; this.b = b; this.c = c; this.d = d; this.m = m; this.ac = ac; this.bc = bc; this.cc = cc; this.dc = dc; } }
d7df5463048db0b1568964623297414619298ebe
a5d01febfd8d45a61f815b6f5ed447e25fad4959
/Source Code/5.5.1/sources/com/google/android/gms/internal/zzfha.java
e6542c84a6606c44d4f34a4a57fa2dd4674280c7
[]
no_license
kkagill/Decompiler-IQ-Option
7fe5911f90ed2490687f5d216cb2940f07b57194
c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6
refs/heads/master
2020-09-14T20:44:49.115289
2019-11-04T06:58:55
2019-11-04T06:58:55
223,236,327
1
0
null
2019-11-21T18:17:17
2019-11-21T18:17:16
null
UTF-8
Java
false
false
340
java
package com.google.android.gms.internal; final class zzfha implements zzfgw { private zzfha() { } /* synthetic */ zzfha(zzfgt zzfgt) { this(); } public final byte[] zzg(byte[] bArr, int i, int i2) { Object obj = new byte[i2]; System.arraycopy(bArr, i, obj, 0, i2); return obj; } }
e5ec95cb4cb28e030aff7dbe464befc700100e1b
478106dd8b16402cc17cc39b8d65f6cd4e445042
/l2junity-gameserver/src/main/java/org/l2junity/gameserver/data/xml/impl/ClanRewardData.java
f841cbca2382be2a3066ec7e812c15d3828b1754
[]
no_license
czekay22/L2JUnderGround
9f014cf87ddc10d7db97a2810cc5e49d74e26cdf
1597b28eab6ec4babbf333c11f6abbc1518b6393
refs/heads/master
2020-12-30T16:58:50.979574
2018-09-28T13:38:02
2018-09-28T13:38:02
91,043,466
1
0
null
null
null
null
UTF-8
Java
false
false
5,070
java
/* * Copyright (C) 2004-2015 L2J Unity * * This file is part of L2J Unity. * * L2J Unity 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. * * L2J Unity is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.l2junity.gameserver.data.xml.impl; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.l2junity.commons.util.IXmlReader; import org.l2junity.gameserver.data.xml.IGameXmlReader; import org.l2junity.gameserver.enums.ClanRewardType; import org.l2junity.gameserver.model.holders.ItemHolder; import org.l2junity.gameserver.model.holders.SkillHolder; import org.l2junity.gameserver.model.pledge.ClanRewardBonus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * @author UnAfraid */ public class ClanRewardData implements IGameXmlReader { private static final Logger LOGGER = LoggerFactory.getLogger(ClanRewardData.class); private final Map<ClanRewardType, List<ClanRewardBonus>> _clanRewards = new ConcurrentHashMap<>(); protected ClanRewardData() { load(); } @Override public void load() { parseDatapackFile("config/ClanReward.xml"); for (ClanRewardType type : ClanRewardType.values()) { LOGGER.info("Loaded: {} rewards for {}", _clanRewards.containsKey(type) ? _clanRewards.get(type).size() : 0, type); } } @Override public void parseDocument(Document doc, File f) { forEach(doc.getFirstChild(), IXmlReader::isNode, listNode -> { switch (listNode.getNodeName()) { case "membersOnline": { parseMembersOnline(listNode); break; } case "huntingBonus": { parseHuntingBonus(listNode); break; } } }); } private void parseMembersOnline(Node node) { forEach(node, IXmlReader::isNode, memberNode -> { if ("players".equalsIgnoreCase(memberNode.getNodeName())) { final NamedNodeMap attrs = memberNode.getAttributes(); int requiredAmount = parseInteger(attrs, "size"); int level = parseInteger(attrs, "level"); final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.MEMBERS_ONLINE, level, requiredAmount); forEach(memberNode, IXmlReader::isNode, skillNode -> { if ("skill".equalsIgnoreCase(skillNode.getNodeName())) { final NamedNodeMap skillAttr = skillNode.getAttributes(); final int skillId = parseInteger(skillAttr, "id"); final int skillLevel = parseInteger(skillAttr, "level"); bonus.setSkillReward(new SkillHolder(skillId, skillLevel)); } }); _clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus); } }); } private void parseHuntingBonus(Node node) { forEach(node, IXmlReader::isNode, memberNode -> { if ("hunting".equalsIgnoreCase(memberNode.getNodeName())) { final NamedNodeMap attrs = memberNode.getAttributes(); int requiredAmount = parseInteger(attrs, "points"); int level = parseInteger(attrs, "level"); final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.HUNTING_MONSTERS, level, requiredAmount); forEach(memberNode, IXmlReader::isNode, itemsNode -> { if ("item".equalsIgnoreCase(itemsNode.getNodeName())) { final NamedNodeMap itemsAttr = itemsNode.getAttributes(); final int id = parseInteger(itemsAttr, "id"); final int count = parseInteger(itemsAttr, "count"); bonus.setItemReward(new ItemHolder(id, count)); } }); _clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus); } }); } public List<ClanRewardBonus> getClanRewardBonuses(ClanRewardType type) { return _clanRewards.get(type); } public ClanRewardBonus getHighestReward(ClanRewardType type) { ClanRewardBonus selectedBonus = null; for (ClanRewardBonus currentBonus : _clanRewards.get(type)) { if ((selectedBonus == null) || (selectedBonus.getLevel() < currentBonus.getLevel())) { selectedBonus = currentBonus; } } return selectedBonus; } public Collection<List<ClanRewardBonus>> getClanRewardBonuses() { return _clanRewards.values(); } /** * Gets the single instance of ClanRewardData. * @return single instance of ClanRewardData */ public static ClanRewardData getInstance() { return SingletonHolder.INSTANCE; } private static class SingletonHolder { protected static final ClanRewardData INSTANCE = new ClanRewardData(); } }
6b8a6fe49a7de532dac6ddf108dc14b20e55b95b
e13d0b61a812904f263f352626078050bcf2cebb
/CampChallenge_java/013.クラス/javaclassblackjackkadai/src/java/blackjack1/Game.java
df3a9ec4e27d9eaaa68576fa697e420ecc791f77
[]
no_license
sermontk/GEEGJOB-sermon1129
7b7b9eea46e7c5468dc5c5bbd11b11bacb824b64
e4ccd6f37dc6aa3249017225c94b692f86c2eed2
refs/heads/master
2021-07-08T02:57:11.032792
2017-10-04T02:34:47
2017-10-04T02:34:47
100,337,761
0
0
null
null
null
null
UTF-8
Java
false
false
5,488
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package blackjack1; 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 java.util.ArrayList; /** * * @author t.k */ public class Game extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { //DealerとUserのインスタンスを生成。 Dealer dealer = new Dealer(); User player = new User(); //ディーラーとプレイヤーの手札に山札をセットする。 dealer.setCard(dealer.deal()); player.setCard(dealer.deal()); //実際にブラックジャックを進行していく。 out.println("それではブラックジャックスタートです!!" + "<br>"); out.println("" + "<br>"); out.println("全体のカードを表示します。" + "<br>"); //52枚の山札を表示。 out.println(dealer.cards + "<br>"); out.println("" + "<br>"); //プレイヤーがカードを選択する。 out.println("この中からカードを二枚選択してください。" + "<br>"); //プレイヤーが引いたカードを公開。 out.println(player.mycard.get(0)); out.println(player.mycard.get(1) + "<br>"); //このiはHitした数字の表示に使用。 int i = 2; //カードの合計が20未満の場合はHitさせる。 while (player.checkSum()) { out.println("HIT!!もう一枚カードを引いてください。" + "<br>"); player.setCard(dealer.hit()); //Hitしたカードはその都度公開。 out.println(player.mycard.get(i) + "<br>"); i++; } out.println("" + "<br>"); //ディーラーとプレイヤーの合計を確認する。 out.print("あなたのカードは..." + "<br>"); out.print(player.mycard + "です。" + "<br>"); out.print("点数の合計は" + player.open() + "点!!" + "<br>"); out.println("" + "<br>"); out.print("ディーラーのカードは..." + "<br>"); out.print(dealer.mycard + "です。" + "<br>"); out.print("点数の合計は" + dealer.open() + "点!!" + "<br>"); out.println("" + "<br>"); if (player.open() > 21) { out.println("bust!!あなたの負けです..." + "<br>");//プレイヤーがバーストの場合。 } else if (player.open() == dealer.open()) {//プレイヤーとディーラーの合計点が同じ場合。 out.println("点数が同じの為今回は引き分けです!!" + "<br>"); } else if (player.open() < dealer.open()) { out.println("You Lose!!あなたの負けです..." + "<br>");//プレイヤーがディーラーの合計点より低い場合。 } else if (player.open() > dealer.open()) { out.println("You Win!!あなたの勝利です!!" + "<br>");//プレイヤーがディーラーの合計点より高い場合。 } out.print("" + "<br>"); out.print("また次回の参加お待ちしております♪"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
d40706e2ac1de522ea6f7c3965f5b7b241fb3e40
912d6bc8e300ff88ed9614c59d481a01e18bfb45
/watchlist-service/src/test/java/be/ordina/microservicesweekend/watchlistservice/WatchlistServiceApplicationTests.java
0294f982c3b2e808ee84fb6344836d7dd170901d
[]
no_license
Turbots/microservices-weekend
ec3610470b097ca0a51b415b98ea9eee80b27eaa
428b8dd6bbf681f35d7fe8e90309a5b0d60d42f8
refs/heads/master
2020-05-18T05:52:56.376423
2019-02-25T15:17:13
2019-02-25T15:17:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package be.ordina.microservicesweekend.watchlistservice; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class WatchlistServiceApplicationTests { @Test public void contextLoads() { } }
1573da44a6e6fa0be55de04820163137ec9ab476
22539e05b5eb1cbce86d4767015be6f600eb8cc9
/additional-spring-cloud-consul/microservice-provider-user-consul/src/main/java/com/itmuch/cloud/study/ProviderUserApplication.java
8358315b3e76e8fe6e606feb83b29411337513aa
[ "Apache-2.0" ]
permissive
chenliyang2411/spring-cloud-docker-microservice-book-code
820d753e598d339ed94ce793b464c8a02520fe1f
3a7d52510b1a2e9801dffeb053cb4e328f31fa4f
refs/heads/master
2023-01-11T03:04:05.500977
2019-03-28T12:25:46
2019-03-28T12:25:46
295,581,389
0
0
Apache-2.0
2020-09-15T01:29:38
2020-09-15T01:29:37
null
UTF-8
Java
false
false
1,463
java
package com.itmuch.cloud.study; import com.itmuch.cloud.study.entity.User; import com.itmuch.cloud.study.repository.UserRepository; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.context.annotation.Bean; import java.math.BigDecimal; import java.util.stream.Stream; @EnableDiscoveryClient @SpringBootApplication public class ProviderUserApplication { public static void main(String[] args) { SpringApplication.run(ProviderUserApplication.class, args); } /** * 初始化用户信息 * 注:Spring Boot2不能像1.x一样,用spring.datasource.schema/data指定初始化SQL脚本,否则与actuator不能共存 * 原因:https://github.com/spring-projects/spring-boot/issues/13042 * https://github.com/spring-projects/spring-boot/issues/13539 * * @param repository repo * @return runner */ @Bean ApplicationRunner init(UserRepository repository) { return args -> { User user1 = new User(1L, "account1", "张三", 20, new BigDecimal(100.00)); User user2 = new User(2L, "account2", "李四", 28, new BigDecimal(180.00)); User user3 = new User(3L, "account3", "王五", 32, new BigDecimal(280.00)); Stream.of(user1, user2, user3).forEach(repository::save); }; } }
4fa0967748280c85f125840062cc2459b40c7bd2
ded643e47cdf066ad58b6152f6c0def527da7d1d
/app/src/main/java/com/example/ramin/driver/Model/DirectionModel/Leg.java
9ca6ad6fdb3033af289a0c5e4145faf91a6cb2f6
[]
no_license
raminabbasiiii/Taxi-Driver
a298e5bd095508d09ffff9f1ffc05d7f1838e81f
a2c0ec1731b92e9cc727497c193d8621cc44455a
refs/heads/master
2022-11-11T13:40:57.704953
2020-06-18T06:09:12
2020-06-18T06:09:12
273,155,897
1
0
null
null
null
null
UTF-8
Java
false
false
861
java
package com.example.ramin.driver.Model.DirectionModel; import java.util.List; public class Leg { private String summary; private LegsDistance distance; private LegsDuration duration; private List<Step> steps = null; public String getSummary() { return summary; } public LegsDistance getDistance() { return distance; } public LegsDuration getDuration() { return duration; } public List<Step> getSteps() { return steps; } public void setSummary(String summary) { this.summary = summary; } public void setDistance(LegsDistance distance) { this.distance = distance; } public void setDuration(LegsDuration duration) { this.duration = duration; } public void setSteps(List<Step> steps) { this.steps = steps; } }
85c911975b7eb19cf78170c62cf36cbd6b6d36c9
485db7d68f2f8e22c52774cba939a615ed331d22
/app/src/androidTest/java/com/xiaolijuan/bitmapdome/ApplicationTest.java
0d12f6e97eee0910aa8ba76949243ba8e095842b
[]
no_license
Cayyoo/Android_ImageView_Bitmap
301fa8e652b263acd93f7d0febbdf082e667d143
5a9f8f65eaca013f7b61a9550d538cc716e7423a
refs/heads/master
2023-04-02T22:40:20.128509
2017-03-08T06:33:45
2017-03-08T06:33:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.xiaolijuan.bitmapdome; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
a099a4bbd01dfdf05c12265413652821e667ee57
035624dc16f8168943d1be1c02b7782b5706ee21
/src/main/java/com/utp/integrador/inventory/inventorymodule/model/entity/ProductEntity.java
11c6afba70e82ee9649c30ccf2ea7bf28a37ae7c
[]
no_license
luisosis/Inventory
54e5d96fc8ffd4a9193fdf4d0e261cfa4bc21ec8
83d1e2239fac2f224bc35363dc9ec2c8aaa241e6
refs/heads/master
2022-10-09T10:56:55.911970
2020-06-08T06:28:30
2020-06-08T06:28:30
268,954,787
1
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.utp.integrador.inventory.inventorymodule.model.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.bson.types.ObjectId; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @AllArgsConstructor @NoArgsConstructor @Data @Builder @Document(value = "Producto") public class ProductEntity { @Id private ObjectId _id; private String codigo; private String nombre; private String categoria; private int stock; private Double precio; }
8a6af8d1a4a55a4fc72332b5e17e2fbd12077e92
1b105dde312926e19b5f07e5308e97015a320504
/src/main/java/de/intarsys/tools/serialize/StandardSerializationOutlet.java
e111dec87127e2f3b4cc3a72b047886b956de1a3
[ "BSD-3-Clause" ]
permissive
RWTH-i5-IDSG/runtime
28444fe741247c91deeb2612b4a7424320711a26
eafbf169b7b848bb299b4e235c2941ac9f5d2fa0
refs/heads/master
2021-01-16T20:49:29.421226
2016-06-01T12:12:46
2016-06-01T12:15:30
60,166,551
0
0
null
2016-06-01T10:08:25
2016-06-01T10:08:24
null
UTF-8
Java
false
false
2,461
java
/* * Copyright (c) 2007, intarsys consulting GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - 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. * * - Neither the name of intarsys nor the names of its contributors may be used * to endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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. */ package de.intarsys.tools.serialize; import java.util.HashMap; import java.util.Map; /** * A standard implementation for {@link ISerializationOutlet}. */ public class StandardSerializationOutlet implements ISerializationOutlet { private Map<Class, ISerializationFactory> factories = new HashMap<Class, ISerializationFactory>(); public ISerializationFactory[] getSerializationFactories() { return factories.values().toArray( new ISerializationFactory[factories.size()]); } @Override public ISerializationFactory lookupSerializationFactory(Class clazz, SerializationContext context) { return factories.get(clazz); } public void registerSerializationFactory(ISerializationFactory factory) { factories.put(factory.getSerializationType(), factory); } public void unregisterSerializationFactory(ISerializationFactory factory) { factories.remove(factory.getSerializationType()); } }
4bafc656360e9e9ff6004cd57dea2a94193da0e5
a2621d5166c93e046cc78a337d9c2fd3a0032f35
/src/UnidaysDiscountChallenge.java
2084b779c7dc5c7bfee0a5b8123a33f2b187c33c
[]
no_license
ebkr/UnidaysTechPlacement
4f183f8b348cfe5b484929feef0646cef3c8e323
9addd5ada8d1f95b013f2874bafa22cc164cb5f0
refs/heads/master
2020-04-07T18:53:22.916815
2018-11-22T02:49:28
2018-11-22T02:49:28
158,628,112
0
0
null
null
null
null
UTF-8
Java
false
false
2,663
java
import java.util.ArrayList; import java.util.HashMap; public class UnidaysDiscountChallenge { private HashMap<String, PricingRule> pricingRules; private ArrayList<String> basketTracker; /** * Initialise Basket * @param pricingRules List of discount rules. */ public UnidaysDiscountChallenge(HashMap<String, PricingRule> pricingRules) { this.pricingRules = pricingRules; basketTracker = new ArrayList<>(); } /** * Adds an item to the basket * @param item String associated to discount rule key. */ public void addToBasket(String item) { if (pricingRules.containsKey(item)) { basketTracker.add(item); } else { throw(new RuntimeException("Item does not exist")); } } /** * Generates the total cost * @return BasketResult to contain total and delivery charge. */ public BasketResult calculateTotalPrice() { double total = 0; int unique = 0; String[] calculatedItems = new String[basketTracker.size()]; // Loop through basket. If item is the first found of its type, determine total of that item, and send through the pricing rule. for (String item : basketTracker) { // Check if unique. if (!isInArray(item, calculatedItems)) { calculatedItems[unique] = item; unique += 1; total += generateItemCost(getItemCount(item), pricingRules.get(item)); } } return new BasketResult(total); } // Check if item exists in the given array. private boolean isInArray(String toFind, String[] search) { for (String s : search) { if (toFind.equals(s)) { return true; } } return false; } // Loop through basket and find count of item. private int getItemCount(String item) { int count = 0; for (String s : basketTracker) { if (item.equals(s)) { count += 1; } } return count; } /** * Determine discount of total items. * @param amount * @param rule * @return */ private int generateItemCost(int amount, PricingRule rule) { int cost = 0; // Find amount of items that qualify for the discount. int full = amount/rule.getQuantity(); // Find amount of items that don't qualify. int remain = amount % rule.getQuantity(); // Calculate total cost. cost += (rule.getDiscount() * full) + (remain * rule.getPrice()); return cost; } }
3dc8b3aaf1ae012a5b641731927d28cf993c93d7
d25fc4abf08a3343598b653658694a5dee285176
/app/src/main/java/com/example/h8951/android_http_request_test/OnSwipeTouchListener.java
d1ad2750922afe3616c69606ce8d044b6d995646
[]
no_license
PudgeWorks/DionysAndroidApp
7835d96303d6e03915c4d63468042f44dd51aa4a
3158ae74e586ec18869b2a3f1fb191e5d17c470d
refs/heads/master
2020-12-24T06:24:29.158455
2016-12-04T22:00:12
2016-12-04T22:00:12
73,488,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,599
java
package com.example.h8951.android_http_request_test; import android.content.Context; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; /** * Created by H8951 on 3.12.2016. */ public class OnSwipeTouchListener implements View.OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeTouchListener(Context context) { gestureDetector = new GestureDetector(context, new GestureListener()); } public void onSwipeLeft() { } public void onSwipeRight() { } public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } private final class GestureListener extends GestureDetector.SimpleOnGestureListener { private static final int SWIPE_DISTANCE_THRESHOLD = 100; private static final int SWIPE_VELOCITY_THRESHOLD = 100; @Override public boolean onDown(MotionEvent e) { return true; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { float distanceX = e2.getX() - e1.getX(); float distanceY = e2.getY() - e1.getY(); if (Math.abs(distanceX) > Math.abs(distanceY) && Math.abs(distanceX) > SWIPE_DISTANCE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { if (distanceX > 0) onSwipeRight(); else onSwipeLeft(); return true; } return false; } } }
91aff0fbc94922053ff582e5ab2afcacf6b1fc0c
0689f3b456ddce965659abcd4d2de68903de59a1
/src/main/java/com/example/jooq/demo_jooq/introduction/db/pg_catalog/routines/Notlike1.java
5b8bee656c7be03e20c20cd31b6f828063eae59f
[]
no_license
vic0692/demo_spring_jooq
c92d2d188bbbb4aa851adab5cc301d1051c2f209
a5c1fd1cb915f313f40e6f4404fdc894fffc8e70
refs/heads/master
2022-09-18T09:38:30.362573
2020-01-23T17:09:40
2020-01-23T17:09:40
220,638,715
0
0
null
2022-09-08T01:04:47
2019-11-09T12:25:46
Java
UTF-8
Java
false
true
2,365
java
/* * This file is generated by jOOQ. */ package com.example.jooq.demo_jooq.introduction.db.pg_catalog.routines; import com.example.jooq.demo_jooq.introduction.db.pg_catalog.PgCatalog; import javax.annotation.Generated; import org.jooq.Field; import org.jooq.Parameter; import org.jooq.impl.AbstractRoutine; import org.jooq.impl.Internal; /** * This class is generated by jOOQ. */ @Generated( value = { "http://www.jooq.org", "jOOQ version:3.12.3" }, comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Notlike1 extends AbstractRoutine<Boolean> { private static final long serialVersionUID = 1923430821; /** * The parameter <code>pg_catalog.notlike.RETURN_VALUE</code>. */ public static final Parameter<Boolean> RETURN_VALUE = Internal.createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BOOLEAN, false, false); /** * The parameter <code>pg_catalog.notlike._1</code>. */ public static final Parameter<String> _1 = Internal.createParameter("_1", org.jooq.impl.SQLDataType.CLOB, false, true); /** * The parameter <code>pg_catalog.notlike._2</code>. */ public static final Parameter<String> _2 = Internal.createParameter("_2", org.jooq.impl.SQLDataType.CLOB, false, true); /** * Create a new routine call instance */ public Notlike1() { super("notlike", PgCatalog.PG_CATALOG, org.jooq.impl.SQLDataType.BOOLEAN); setReturnParameter(RETURN_VALUE); addInParameter(_1); addInParameter(_2); setOverloaded(true); } /** * Set the <code>_1</code> parameter IN value to the routine */ public void set__1(String value) { setValue(_1, value); } /** * Set the <code>_1</code> parameter to the function to be used with a {@link org.jooq.Select} statement */ public void set__1(Field<String> field) { setField(_1, field); } /** * Set the <code>_2</code> parameter IN value to the routine */ public void set__2(String value) { setValue(_2, value); } /** * Set the <code>_2</code> parameter to the function to be used with a {@link org.jooq.Select} statement */ public void set__2(Field<String> field) { setField(_2, field); } }
f935c6a18b0c05aeae2f77fee00620d36f929da2
e63445045e45fe60962362405f4423facd47fcaa
/pp1domacifinal/MJCompiler/src/rs/ac/bg/etf/pp1/ast/FormalParamDecls.java
6dfbb348d0656269898670c2bd65c07413ddc5d1
[]
no_license
milke994/PP1
47a02ea6cc4a20c86bbfdb0937e5fb21e34df68f
7ad180df6bc4db862f0f8e331dda504d443493b4
refs/heads/master
2020-07-13T19:56:12.179873
2019-08-29T10:59:18
2019-08-29T10:59:18
205,143,488
0
0
null
null
null
null
UTF-8
Java
false
false
2,397
java
// generated with ast extension for cup // version 0.8 // 13/0/2019 19:40:31 package rs.ac.bg.etf.pp1.ast; public class FormalParamDecls extends FormalParamList { private FormalParamList FormalParamList; private FormalParamDecl FormalParamDecl; public FormalParamDecls (FormalParamList FormalParamList, FormalParamDecl FormalParamDecl) { this.FormalParamList=FormalParamList; if(FormalParamList!=null) FormalParamList.setParent(this); this.FormalParamDecl=FormalParamDecl; if(FormalParamDecl!=null) FormalParamDecl.setParent(this); } public FormalParamList getFormalParamList() { return FormalParamList; } public void setFormalParamList(FormalParamList FormalParamList) { this.FormalParamList=FormalParamList; } public FormalParamDecl getFormalParamDecl() { return FormalParamDecl; } public void setFormalParamDecl(FormalParamDecl FormalParamDecl) { this.FormalParamDecl=FormalParamDecl; } public void accept(Visitor visitor) { visitor.visit(this); } public void childrenAccept(Visitor visitor) { if(FormalParamList!=null) FormalParamList.accept(visitor); if(FormalParamDecl!=null) FormalParamDecl.accept(visitor); } public void traverseTopDown(Visitor visitor) { accept(visitor); if(FormalParamList!=null) FormalParamList.traverseTopDown(visitor); if(FormalParamDecl!=null) FormalParamDecl.traverseTopDown(visitor); } public void traverseBottomUp(Visitor visitor) { if(FormalParamList!=null) FormalParamList.traverseBottomUp(visitor); if(FormalParamDecl!=null) FormalParamDecl.traverseBottomUp(visitor); accept(visitor); } public String toString(String tab) { StringBuffer buffer=new StringBuffer(); buffer.append(tab); buffer.append("FormalParamDecls(\n"); if(FormalParamList!=null) buffer.append(FormalParamList.toString(" "+tab)); else buffer.append(tab+" null"); buffer.append("\n"); if(FormalParamDecl!=null) buffer.append(FormalParamDecl.toString(" "+tab)); else buffer.append(tab+" null"); buffer.append("\n"); buffer.append(tab); buffer.append(") [FormalParamDecls]"); return buffer.toString(); } }
32db4e12b6f846b1a75a0d19bd82a58d2e6d831f
f0e805b075310b22ddd3e4158a28750aa24e0ca8
/src/adventure/types/ActorStat.java
21f99d56c9ad6b8e3c0fd16927269fc3b1788d6e
[]
no_license
totallymorten/java-adventure-game
1a43410a440c2e9c8f56b2ce93a30d935a50e8b8
2a371ed167a3ce9e6c11666051f0486c436f0eef
refs/heads/master
2021-01-10T01:58:53.755223
2019-10-01T21:40:36
2019-10-01T21:40:36
51,693,789
5
3
null
2017-04-28T11:48:06
2016-02-14T12:29:58
Java
UTF-8
Java
false
false
168
java
package adventure.types; public enum ActorStat { STAMINA, MAX_STAMINA, HEALTH, MAX_HEALTH, SPEED, MAX_SPEED, LEVEL, EXP_PROG, EXP_TOTAL, EXP_REQ_NEXT }
1f5e677d066319f5588a369d8823d31fcd8bd9a5
a594a9c9508ec550a7f1c0cde2c7845f4d5d0e5b
/lesson8/src/main/java/ru/itmo/wp/controller/Page.java
b9106fff82e6bc0fa5f81855aa2eb39345a23cc9
[]
no_license
salavay/web-homeworks-ITMO
bab5a2d7f49cbf4fb909ffb204a57dc5ae0c80de
95e98747cd3a02b8e120567d210d03754e57ce7d
refs/heads/master
2023-04-01T10:16:45.685639
2021-04-03T15:20:31
2021-04-03T15:20:31
354,319,865
0
0
null
null
null
null
UTF-8
Java
false
false
1,841
java
package ru.itmo.wp.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.ModelAttribute; import ru.itmo.wp.domain.Notice; import ru.itmo.wp.domain.User; import ru.itmo.wp.service.NoticeService; import ru.itmo.wp.service.UserService; import javax.servlet.http.HttpSession; import java.util.List; public class Page { private static final String USER_ID_SESSION_KEY = "userId"; private static final String MESSAGE_SESSION_KEY = "message"; @Autowired private UserService userService; @Autowired private NoticeService noticeService; @ModelAttribute("user") public User getUser(HttpSession httpSession) { User user = userService.findById((Long) httpSession.getAttribute(USER_ID_SESSION_KEY)); if (user != null && !user.isDisabled()) { return user; } httpSession.removeAttribute(USER_ID_SESSION_KEY); return null; } @ModelAttribute("notices") public List<Notice> getNotices(HttpSession httpSession) { return noticeService.findAll(); } @ModelAttribute("message") public String getMessage(HttpSession httpSession) { String message = (String) httpSession.getAttribute(MESSAGE_SESSION_KEY); httpSession.removeAttribute(MESSAGE_SESSION_KEY); return message; } void setUser(HttpSession httpSession, User user) { if (user != null) { httpSession.setAttribute(USER_ID_SESSION_KEY, user.getId()); } else { unsetUser(httpSession); } } void unsetUser(HttpSession httpSession) { httpSession.removeAttribute(USER_ID_SESSION_KEY); } void putMessage(HttpSession httpSession, String message) { httpSession.setAttribute(MESSAGE_SESSION_KEY, message); } }
aeb686a89c4ec0047860cac62e74c21ee595d740
cbd8127e764303fdd71ab5c86d9216533c36e040
/src/main/java/synchronize/ForwardingSet.java
0cc4311aea10e0abaae2e0c975bb015defe58a24
[]
no_license
mnonm/effective-java
40b1da1e45bd0bdd6d7a2dab2eb71576631b12a4
7b4171383c2ea579a3b878eb800ce4bd24e97ec9
refs/heads/master
2020-07-11T05:46:16.180269
2019-08-13T15:37:08
2019-08-13T15:37:08
204,459,511
0
0
null
null
null
null
UTF-8
Java
false
false
1,615
java
package synchronize; import java.util.Collection; import java.util.Iterator; import java.util.Set; public class ForwardingSet<E> implements Set<E> { private final Set<E> s; public ForwardingSet(Set<E> s) { this.s = s; } @Override public int size() { return s.size(); } @Override public boolean isEmpty() { return s.isEmpty(); } @Override public boolean contains(Object o) { return s.contains(o); } @Override public Iterator<E> iterator() { return s.iterator(); } @Override public Object[] toArray() { return new Object[0]; } @Override public <T> T[] toArray(T[] a) { return null; } @Override public boolean add(E e) { return s.add(e); } @Override public boolean remove(Object o) { return s.remove(o); } @Override public boolean containsAll(Collection<?> c) { return s.containsAll(c); } @Override public boolean addAll(Collection<? extends E> c) { return s.addAll(c); } @Override public boolean retainAll(Collection<?> c) { return s.retainAll(c); } @Override public boolean removeAll(Collection<?> c) { return s.removeAll(c); } @Override public void clear() { s.clear(); } @Override public boolean equals(Object o) { return s.equals(o); } @Override public int hashCode() { return s.hashCode(); } @Override public String toString() { return s.toString(); } }
49d84f47ac79228759941074009d6b65ba4e0376
d8baa0ef640b9f82919191e32ef1998c43270b25
/项目毕设/网上零食系统/Snacks/src/com/dao/impl/TypeDaoImpl.java
4a4c56128526d22f68a3d33844dff76218dd328c
[]
no_license
sonya1/fe_coding
fd9b43dd26b5d361c276f1a2c54f56f6c97d637a
be867820597f8144f3147984ed82af521750f7e8
refs/heads/master
2021-01-22T06:58:23.406851
2018-03-15T15:03:38
2018-03-15T15:07:09
102,302,261
0
0
null
null
null
null
UTF-8
Java
false
false
3,160
java
package com.dao.impl; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.dao.TypeDao; import com.models.Type; import com.untils.Constants; import com.untils.JDBCUtil; public class TypeDaoImpl implements TypeDao{ public boolean addType(Type type) { Connection conn = JDBCUtil.getConnection(); String sql = "insert into type(name)values(?)"; int n = JDBCUtil.executeUpdate(conn, sql,new Object[]{type.getName()}); JDBCUtil.free(null, null, conn); if(n>0){ return true; } return false; } public List<Type> listType(int pageNum) { Connection conn=JDBCUtil.getConnection(); String sql="select * from type limit ?,?"; ResultSet rs=JDBCUtil.executeSelect(conn, sql, new Object[]{pageNum*Constants.PAGESIZE,Constants.PAGESIZE}); List<Type> list=new ArrayList<Type>(); try{ while(rs.next()){ Type type=new Type(); type.setId(rs.getInt(1)); type.setName(rs.getString(2)); list.add(type); } }catch(SQLException e){ e.printStackTrace(); }finally{ JDBCUtil.free(rs, null, conn); } return list; } public int calculateAllNum() { Connection conn=JDBCUtil.getConnection(); String sql="select * from type"; ResultSet rs=JDBCUtil.executeSelect(conn, sql, new Object[]{}); int allPageNum=0; try{ while(rs.next()){ allPageNum++; } }catch(SQLException e){ e.printStackTrace(); }finally{ JDBCUtil.free(rs, null, conn); } if(allPageNum%Constants.PAGESIZE==0){ return allPageNum/Constants.PAGESIZE-1; }else{ return allPageNum/Constants.PAGESIZE; } } public boolean modifyOneType(Type type) { Connection conn = JDBCUtil.getConnection(); String sql = "update Type set name=? where id=?"; int n = JDBCUtil.executeUpdate(conn, sql, new Object[]{type.getName(),type.getId()}); JDBCUtil.free(null, null, conn); if(n>0){ return true; } return false; } public boolean deteleOneType(int id) { Connection conn=JDBCUtil.getConnection(); String sql="delete from type where id=?"; int n=JDBCUtil.executeUpdate(conn, sql, new Object[]{id}); JDBCUtil.free(null, null, conn); if(n>0){ return true; } return false; } public Type selectOneType(int id) { Connection conn=JDBCUtil.getConnection(); String sql="select * from type where id=?"; ResultSet rs=JDBCUtil.executeSelect(conn, sql, new Object[]{id}); Type type = new Type(); try{ if(rs.next()){ type.setId(rs.getInt(1)); type.setName(rs.getString(2)); } }catch(SQLException e){ e.printStackTrace(); }finally{ JDBCUtil.free(rs, null, conn); } return type; } public List<Type> selectAll() { Connection conn=JDBCUtil.getConnection(); String sql="select * from type"; ResultSet rs=JDBCUtil.executeSelect(conn, sql, new Object[]{}); List<Type> list = new ArrayList<Type>(); try{ while(rs.next()){ Type type=new Type(); type.setId(rs.getInt(1)); type.setName(rs.getString(2)); list.add(type); } }catch(SQLException e){ e.printStackTrace(); }finally{ JDBCUtil.free(rs, null, conn); } return list; } }
5bfb1daf3b220ebf338824d356edfab4b59130e5
71fa186a7f9f11817d53dad98bf416e6530c0fb4
/notes/doodads/SML.java
785b9db81a011da2089e655ca892bf512d0def33
[]
no_license
codebkp/gamedev
7553c1b14cd3303e3327913e7786a8776aa28d0d
4f0225d94ce160ddfaa7a38dfff3e8d7e338a1df
refs/heads/master
2021-01-25T06:30:31.161178
2013-09-17T14:51:15
2013-09-17T14:51:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
42,390
java
package fogus.patagonia.doodads; /* * Super Mario Land 4K * Copyright (C) 2011 meatfighter.com * * This file is part of Super Mario Land 4K. * * Super Mario Land 4K is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Super Mario Land 4K 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * http://java4k.com/index.php?action=games&method=view&gid=331#source * */ import java.applet.Applet; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Random; public class SML extends Applet implements Runnable { // keys private boolean[] a = new boolean[32768]; @Override public void start() { enableEvents(8); new Thread(this).start(); } public void run() { final int VK_LEFT = 0x25; final int VK_RIGHT = 0x27; final int VK_JUMP = 0x44; final float GRAVITY = 0.18f; final float MARIO_ACCELERATION = 0.2f; final float MARIO_MAX_SPEED = 1.5f; final float MARIO_JUMP_SPEED = -2f; final float MARIO_BOUNCE_SPEED = -2f; final int MARIO_JUMP_EXTENSION_SLOW = 15; final int MARIO_JUMP_EXTENSION_FAST = 20; final float DYING_MARIO_GRAVITY = 0.06f; final float DYING_MARIO_JUMP_SPEED = -2f; final float CHIBIBO_SPEED = 0.3f; final float NOKOBON_SPEED = 0.3f; final int FADE_SPEED = 8; final int OBJ_X = 0; final int OBJ_Y = 1; final int OBJ_SPRITE = 2; final int OBJ_FLIPPED = 3; final int OBJ_SPRITE_INDEX = 4; final int OBJ_SPRITE_COUNTER = 5; final int OBJ_X1 = 6; final int OBJ_X2 = 7; final int OBJ_Y1 = 8; final int OBJ_Y2 = 9; final int OBJ_TYPE = 10; final int OBJ_VX = 11; final int OBJ_VY = 12; final int OBJ_SUPPORTED = 13; final int OBJ_OBSTRUCTED = 14; final int OBJ_DIRECTION = 15; final int OBJ_SQUASHED = 16; final int OBJ_MIRRORED = 17; final int OBJ_WEIGHTLESS = 18; final int OBJ_NOT_SQUASHABLE = 19; final int OBJ_BEHIND_TILES = 20; final int OBJ_COUNTER = 21; final int SPRITE_COUNT = 34; final int SPRITE_COIN = 0; final int SPRITE_DOOR_TOP = 1; final int SPRITE_DOOR_BOTTOM = 2; final int SPRITE_PIPE_TOP_LEFT = 3; final int SPRITE_PIPE_MIDDLE_LEFT = 4; final int SPRITE_PIPE_TOP_RIGHT = 5; final int SPRITE_PIPE_MIDDLE_RIGHT = 6; final int SPRITE_PLATFORM = 7; final int SPRITE_WALL = 8; final int SPRITE_MARIO_0 = 9; final int SPRITE_MARIO_1 = 10; final int SPRITE_MARIO_2 = 11; final int SPRITE_MARIO_3 = 12; final int SPRITE_MARIO_4 = 13; // converted into SPRITE_MARIO_2 final int SPRITE_MARIO_HEAD = 13; final int SPRITE_NOKOBON_0 = 14; final int SPRITE_NOKOBON_1 = 15; final int SPRITE_CHIBIBO = 16; final int SPRITE_SQUASHED_CHIBIBO = 17; final int SPRITE_MARIO_DEAD = 18; final int SPRITE_BOMB_0 = 19; final int SPRITE_BOMB_1 = 20; final int SPRITE_EXPLOSION_0 = 21; final int SPRITE_EXPLOSION_1 = 22; final int SPRITE_PAKKUN_FLOWER_0 = 23; final int SPRITE_PAKKUN_FLOWER_1 = 24; final int SPRITE_GIRA_0 = 25; final int SPRITE_GIRA_1 = 26; final int SPRITE_TREE = 27; final int SPRITE_FIGHTER_FLY_0 = 28; final int SPRITE_FIGHTER_FLY_1 = 29; final int SPRITE_BUNBUN_0 = 30; final int SPRITE_BUNBUN_1 = 31; final int SPRITE_SPEAR = 32; final int SPRITE_DAISY = 33; final int SPRITE_PYRAMID = 34; final int TYPE_MARIO = 0; final int TYPE_CHIBIBO = 1; final int TYPE_NOKOBON = 2; final int TYPE_EXPLOSION = 3; final int TYPE_PAKKUN_FLOWER = 4; final int TYPE_GIRA = 5; final int TYPE_FIGHTER_FLY = 6; final int TYPE_BUNBUN = 7; final int TYPE_SPEAR = 8; final int ORIENTATION_ORIGINAL = 0; final int ORIENTATION_FLIPPED = 1; final int ORIENTATION_MIRRORED = 2; final int MAP_EMPTY = 0; final int MAP_COIN = 1; final int MAP_DOOR_TOP = 2; final int MAP_DOOR_BOTTOM = 3; final int MAP_PIPE_TOP_LEFT = 4; final int MAP_PIPE_MIDDLE_LEFT = 5; final int MAP_PIPE_TOP_RIGHT = 6; final int MAP_PIPE_MIDDLE_RIGHT = 7; final int MAP_PLATFORM = 8; final int MAP_WALL = 9; final int MAP_FLIPPED_EMPTY = 16; final int MAP_FLIPPED_COIN = 17; final int MAP_FLIPPED_DOOR_TOP = 18; final int MAP_FLIPPED_DOOR_BOTTOM = 19; final int MAP_FLIPPED_PIPE_TOP_LEFT = 20; final int MAP_FLIPPED_PIPE_MIDDLE_LEFT = 21; final int MAP_FLIPPED_PIPE_TOP_RIGHT = 22; final int MAP_FLIPPED_PIPE_MIDDLE_RIGHT = 23; final int MAP_FLIPPED_PLATFORM = 24; final int MAP_FLIPPED_WALL = 25; final int MAP_MASK = 15; final int MAP_EMPTIES = 3; final int PAKKUN_FLOWER_SLEEPING = 64; final int PAKKUN_FLOWER_RISING = 80; final int PAKKUN_FLOWER_CHOMPING = 176; final int PAKKUN_FLOWER_SINKING = 191; final int PAKKUN_FLOWER_DISTANCE = 20; final String S = "\u0808\ufc0f\uf2a3\ucae8\uc8f8\uc8f8\uca28\uf2a3\ufc0f\u0808\u0000\uffc0\uaaf0\u56bc\u01ac\u006c\u006c\u006c\u0808\u006c\u006c\u006c\u006c\u006c\u006c\u006c\uaaac\u0808\u0000\uaaa8\uaaa8\uaaa8\uaaa8\u0000\uaaa3\uaaa3\u0808\uaaa3\uaaa3\uaaa3\uaaa3\u000f\uaaa3\uaaa3\uaaa3\u0808\u0000\u015a\u015a\u015a\u015a\u0000\uc16a\uc16a\u0808\uc16a\uc16a\uc16a\uc16a\uf000\uc16a\uc16a\uc16a\u0808\uc003\u0aa8\u0808\u0a88\u0a88\u02a8\u0000\uc003\u0808\u0000\ufffc\uaaac\ua8ec\ua82c\uaaac\u0000\u0000\u1006\ufff4\u10ff\uff04\u103f\ufe0d\u72bf\ufe95\u56bf\uffc3\uc3ff\uff03\uc0ff\u1007\ufff1\u00ff\ufa81\u00af\ufa07\u03af\ufcf5\u55ff\ufc15\u553f\ufc17\uf43f\uffff\uc0ff\u1007\ufffc\u40ff\ufff0\u403f\uffdd\ue83f\uffd5\u597f\ufff0\u55ff\uffc0\u03ff\ufffc\u03ff\u1006\ufeb1\u00ff\ufea0\u00bf\uffd5\u55af\ufff5\u553f\ufffc\u350f\ufff0\u3fcf\u1006\uffff\uf03f\ufffc\u000f\uffff\u8a03\ufffe\ua820\ufffe\u0aa0\uffff\uaaaf\u080b\uffc3\uff3c\uff30\uff30\uff3c\ufec0\uc083\u308f\u00bf\u82bf\u280f\u080c\uffc3\uff3c\uff30\uff30\uff3c\ufec0\uc08f\u308f\u0083\u82bf\uea3f\u030f\u0808\uf00f\uc003\u0c30\u0c30\u0000\ufaaf\uca83\uc30f\u0805\uf00f\uc003\u0c30\ufaaf\u0ff0\u080b\u0fff\u03bf\u88af\ua02f\u083f\ua8ff\u90ff\u15cf\u740f\u540f\u57ff\u0806\uf00f\uc0c3\uc033\uc033\uc003\uf00f\u0806\ufaaf\ueaeb\ueabb\ueabb\ueaab\ufaaf\u0808\uc3ff\ufcff\ua3cf\uf8cf\u2e3f\ufbbc\u3cb3\u0f8f\u0806\ucfff\uffff\u3f3f\ub3ff\u2fff\uc8cf\u0810\ufc3f\uf28f\uca23\ucaa3\u2aa0\u22a8\u2aa8\u0a88\u2aa8\u0aa0\uc283\uf00f\u3c3c\u0c30\uc003\uf00f\u0810\u3ffc\u3ffc\u0ff0\u0ff0\u23c8\u23c8\u23c8\u23c8\u2008\u2828\ucaa3\uf00f\u3c3c\u0c30\uc003\uf00f\u1006\ufffc\uc00f\ufc3f\u7cf3\uf00c\u40cc\ufc3c\u4000\ufffc\u4003\ufffc\uc00f\u1006\uf0fc\uc00f\ucf3f\u7cf3\u3cfc\u40cc\ucf3c\u4000\uf0fc\u4003\ufffc\uc00f\u1006\uff03\uf03f\ufcfc\ucfcf\uf3f0\u00f3\uf3cf\u0cf3\uff3f\u3f3f\uff3f\u3f3f\u080e\uff0f\ufcf3\uf3f3\u33a3\u8383\u3c0f\u8cff\u00f0\uccc0\ucc0f\u03ff\u8fff\u800f\u3f03\u080b\u3fc3\u833c\u3cfc\u8ce8\u0003\uccff\ucc0f\u0303\u8fff\u00ff\uf03f\u1010\uf03f\uffff\uc3cf\uffff\ucff3\uc00f\ucbf3\u23f3\ucabc\u63c8\uc2ac\u63c8\uf00c\u6828\uffc3\u1aa0\uf000\u02a8\uc1df\u0c03\ucdd7\u0fff\ucdf4\u33cf\uf000\ufcc3\u0000\u003c\uf3fc\ufcc3\uffff\uffcf\u100f\uffff\uc00f\uffff\u23f3\ufffc\u63c8\uc00c\u63c8\u3ff0\u6828\u3fff\u1a80\u0ea0\u023f\uf00f\u0003\ucdd7\u0fff\ucdf4\u33ff\uf000\ufccf\ucff3\ufcc3\u0000\u003c\ucff3\ufcc3\uffff\uffcf\u080f\ufc0f\ufc8f\ufc8f\ufc8f\ufc8f\ufc8f\ufc8f\ufc8f\ufc8f\ufc8f\uc000\ucffc\uf3f3\ufccf\uff3f\u1010\uffc0\u0fff\uff00\u03ff\ufc00\u80ff\ufc0a\ua8ff\uf008\u88ff\uf00a\ua8ff\uc00a\u2bff\uc000\u8fff\uc036\ua7ef\uf0d5\u56af\uffe9\u5aff\uff6a\uafff\ufd55\u5fff\uf555\u57ff\ud555\u57ff\u5555\u57ff"; int i; int j; int k; int x; int y; int z; int level = 0; int cameraX = 0; int enemiesX = 0; int jumpCounter = 0; boolean marioDied = false; boolean jumpReleased = true; int giraCountdown = 1; int bunbunCountdown = 1; int fadeDelta = FADE_SPEED; int fadeIntensity = 255; int[][] map = null; int[][] enemies = null; Graphics2D g2 = null; Random random = null; float[] mario = null; int[] pixels = new int[64]; ArrayList<float[]> queue = new ArrayList<float[]>(); ArrayList<float[]>[] backgroundPlanes = new ArrayList[4]; BufferedImage[][] sprites = new BufferedImage[3][64]; BufferedImage image = new BufferedImage(160, 144, 1); Graphics2D g = (Graphics2D)image.getGraphics(); Color BLACK = new Color(0x000000); Color LIGHT_GRAY = new Color(0xA8A8A8); Color WHITE = new Color(0xF8F8F8); // decompress the sprites for(i = 0, k = 0; i < SPRITE_COUNT; i++) { j = S.charAt(k++); int width = j >> 8; int height = j & 0xFF; int height2 = width == 8 && height < 9 ? 8 : 16; sprites[0][i] = new BufferedImage(width, height2, 2); for(y = 0; y < height; y++) { long value = S.charAt(k++); if (width == 16) { value <<= 16; value |= S.charAt(k++); } for(x = 0; x < width; x++) { z = ((int)value) & 3; pixels[x] = z == 0 ? 0xFF000000 : z == 1 ? 0xFF606060 : z == 2 ? 0xFFA8A8A8 : 0; value >>= 2; } sprites[0][i].setRGB( 0, y + height2 - height, width, 1, pixels, 0, width); } } // attach Mario\'s head g2 = (Graphics2D)sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_0] .getGraphics(); g2.drawImage(sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_HEAD], 3, -6, null); g2 = (Graphics2D)sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_1] .getGraphics(); g2.drawImage(sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_HEAD], 4, -7, null); g2 = (Graphics2D)sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_2] .getGraphics(); g2.drawImage(sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_HEAD], 3, -7, null); g2 = (Graphics2D)sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_3] .getGraphics(); g2.drawImage(sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_HEAD], 3, -6, null); // create flipped and mirrored versions of the sprites for(i = 0; i < SPRITE_COUNT; i++) { x = sprites[ORIENTATION_ORIGINAL][i].getWidth(); y = sprites[ORIENTATION_ORIGINAL][i].getHeight(); sprites[ORIENTATION_FLIPPED][i] = new BufferedImage(x, y, 2); sprites[ORIENTATION_MIRRORED][i] = new BufferedImage(x << 1, y, 2); g2 = (Graphics2D)sprites[ORIENTATION_FLIPPED][i].getGraphics(); g2.drawImage(sprites[ORIENTATION_ORIGINAL][i], 0, 0, x, y, x, 0, 0, y, null); g2 = (Graphics2D)sprites[ORIENTATION_MIRRORED][i].getGraphics(); g2.drawImage(sprites[ORIENTATION_ORIGINAL][i], 0, 0, null); g2.drawImage(sprites[ORIENTATION_ORIGINAL][i], x, 0, x << 1, y, x, 0, 0, y, null); } // create pyramid sprite sprites[0][SPRITE_PYRAMID] = new BufferedImage(144, 72, 2); g2 = (Graphics2D)sprites[0][SPRITE_PYRAMID].getGraphics(); g2.setColor(BLACK); g2.drawLine(0, 71, 71, 0); g2.drawLine(72, 0, 143, 71); g2.setColor(WHITE); for(i = 0; i < 71; i++) { g2.drawLine(71 - i, i + 1, 72 + i, i + 1); } g2 = null; long nextFrameStartTime = System.nanoTime(); while(true) { do { nextFrameStartTime += 16666667; // -- update starts ---------------------------------------------------- // update fade transition if (fadeDelta != 0) { fadeIntensity += fadeDelta; if (fadeDelta < 0) { if (fadeIntensity <= 0) { fadeIntensity = 0; fadeDelta = 0; } } else { if (fadeIntensity >= 255) { fadeIntensity = 255; fadeDelta = -fadeDelta; // visible map Y is between 16 and 31 (inclusive) // Y: 0--15 is the sky // Y: 32--47 is underground map = new int[48][512]; enemies = new int[48][512]; queue.clear(); // -- create level start ----------------------------------------- random = new Random(4 + (level == 4 ? 16 : level)); // initialize background planes for(i = 0; i < 4; i++) { backgroundPlanes[i] = new ArrayList<float[]>(); k = random.nextInt(80); for(j = 0; j < 4; j++) { float[] object = new float[32]; backgroundPlanes[i].add(object); object[OBJ_X] = k; object[OBJ_Y] = 72 + (random.nextInt(4) << 3); k += ((i == 3) ? 32 : 160) + random.nextInt(80); } } for(x = 0; x < 340; x++) { if (x < 170 - 22 * level || x >= 170 + 22 * level) { map[30][x] = map[31][x] = MAP_PLATFORM; } } for(x = 0; x < 48; x++) { map[x][318] = MAP_WALL; map[x][319] = MAP_FLIPPED_WALL; } map[28][318] = MAP_DOOR_TOP; map[28][319] = MAP_FLIPPED_DOOR_TOP; map[29][318] = MAP_DOOR_BOTTOM; map[29][319] = MAP_FLIPPED_DOOR_BOTTOM; i = 30; j = 2; x = 32; outter: while(x < 300) { boolean addCoins = random.nextInt(5) == 0; for(k = 0; k < j; k++) { map[i][x + k] = MAP_PLATFORM; if (addCoins) { if (map[i - 2][x + k] == MAP_EMPTY) { map[i - 1 - (k & 1)][x + k] = MAP_COIN; } } } if (x > 40 && x < 300 && random.nextInt(3) == 1) { k = random.nextInt(level == 0 ? 2 : 3); if (k == 0) { enemies[i - 1][x + j - 5] = TYPE_CHIBIBO; } else if (k == 1) { enemies[i - 2][x + j - 5] = TYPE_NOKOBON; } else { enemies[i - 2][x + j - 5] = TYPE_FIGHTER_FLY; } } int pipeX = 0; if (random.nextInt(3) == 0 && i > 21) { k = i - 2 - random.nextInt(3); z = x + 1 + ((j > 2) ? random.nextInt(j - 2) : 0); pipeX = z + 3; map[k][z] = MAP_PIPE_TOP_LEFT; map[k][z + 1] = MAP_PIPE_TOP_RIGHT; for(y = k + 1; y < i; y++) { map[y][z] = MAP_PIPE_MIDDLE_LEFT; map[y][z + 1] = MAP_PIPE_MIDDLE_RIGHT; } if (level > 0) { enemies[k][z] = TYPE_PAKKUN_FLOWER; } } if (random.nextInt(5) == 0) { x += j + random.nextInt(8); } else { x += 2 + random.nextInt(j); } if (x < pipeX) { x = pipeX; } j = 3 + random.nextInt(8); do { if (random.nextBoolean()) { z = i - (3 + random.nextInt(2)); } else { z = i + 2 + random.nextInt(8); } } while(z < 20 || z > 30); i = z; } // remove enemies that ended up inside of solid blocks for(x = 0; x < 340; x++) { for(y = 16; y < 32; y++) { if (enemies[y][x] != 0 && enemies[y][x] != TYPE_PAKKUN_FLOWER) { for(i = 0; i < 5; i++) { if (map[y][i + x] != MAP_EMPTY) { enemies[y][x] = 0; } } } } } // create Mario mario = new float[32]; queue.add(mario); mario[OBJ_X] = 176; mario[OBJ_Y] = 224; mario[OBJ_SPRITE] = SPRITE_MARIO_0; mario[OBJ_X1] = 4; mario[OBJ_Y1] = 4; mario[OBJ_X2] = 11; mario[OBJ_Y2] = 15; mario[OBJ_SUPPORTED] = 1; marioDied = false; cameraX = 160; enemiesX = 0; // -- create level end ------------------------------------------- // since level creation takes a while, reset the game timer nextFrameStartTime = System.nanoTime(); } } continue; } // update dying Mario if (marioDied) { mario[OBJ_VY] += DYING_MARIO_GRAVITY; mario[OBJ_Y] += mario[OBJ_VY]; if (mario[OBJ_Y] > 320) { // reset level fadeDelta = FADE_SPEED; } continue; } // update Mario boolean marioWalking = false; if (a[VK_LEFT]) { if (mario[OBJ_VX] > -MARIO_MAX_SPEED) { mario[OBJ_VX] -= MARIO_ACCELERATION; } mario[OBJ_FLIPPED] = 1; marioWalking = true; } else if (a[VK_RIGHT]) { if (mario[OBJ_VX] < MARIO_MAX_SPEED) { mario[OBJ_VX] += MARIO_ACCELERATION; } mario[OBJ_FLIPPED] = 0; marioWalking = true; } if (marioWalking) { // Mario walks mario[OBJ_SPRITE] = SPRITE_MARIO_1 + mario[OBJ_SPRITE_INDEX]; if (mario[OBJ_SPRITE] == SPRITE_MARIO_4) { mario[OBJ_SPRITE] = SPRITE_MARIO_2; } if (++mario[OBJ_SPRITE_COUNTER] == 4) { mario[OBJ_SPRITE_COUNTER] = 0; if (++mario[OBJ_SPRITE_INDEX] == 4) { mario[OBJ_SPRITE_INDEX] = 0; } } } else { // Mario stands there mario[OBJ_SPRITE] = SPRITE_MARIO_0; mario[OBJ_SPRITE_INDEX] = 0; mario[OBJ_SPRITE_COUNTER] = 0; // Mario slows down if (mario[OBJ_VX] < -MARIO_ACCELERATION) { mario[OBJ_VX] += MARIO_ACCELERATION; } else if (mario[OBJ_VX] > MARIO_ACCELERATION) { mario[OBJ_VX] -= MARIO_ACCELERATION; } else { mario[OBJ_VX] = 0; } } if (!a[VK_JUMP]) { jumpCounter = 0; } if (mario[OBJ_SUPPORTED] == 1) { if (jumpReleased) { if (a[VK_JUMP]) { mario[OBJ_VY] = MARIO_JUMP_SPEED; jumpReleased = false; jumpCounter = (mario[OBJ_VX] < 0 ? -mario[OBJ_VX] : mario[OBJ_VX]) >= MARIO_MAX_SPEED ? MARIO_JUMP_EXTENSION_FAST : MARIO_JUMP_EXTENSION_SLOW; } } else { if (!a[VK_JUMP]) { jumpReleased = true; } } } else { // Mario poses as he flies through the air mario[OBJ_SPRITE] = SPRITE_MARIO_1; if (--jumpCounter > 0 && a[VK_JUMP]) { mario[OBJ_VY] = MARIO_JUMP_SPEED; } } // scan for coins if (map[((int)(mario[OBJ_Y] + mario[OBJ_Y1])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X1])) >> 3] == MAP_COIN) { map[((int)(mario[OBJ_Y] + mario[OBJ_Y1])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X1])) >> 3] = MAP_EMPTY; } if (map[((int)(mario[OBJ_Y] + mario[OBJ_Y2])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X1])) >> 3] == MAP_COIN) { map[((int)(mario[OBJ_Y] + mario[OBJ_Y2])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X1])) >> 3] = MAP_EMPTY; } if (map[((int)(mario[OBJ_Y] + mario[OBJ_Y1])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X2])) >> 3] == MAP_COIN) { map[((int)(mario[OBJ_Y] + mario[OBJ_Y1])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X2])) >> 3] = MAP_EMPTY; } if (map[((int)(mario[OBJ_Y] + mario[OBJ_Y2])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X2])) >> 3] == MAP_COIN) { map[((int)(mario[OBJ_Y] + mario[OBJ_Y2])) >> 3] [((int)(mario[OBJ_X] + mario[OBJ_X2])) >> 3] = MAP_EMPTY; } // update queue for(i = queue.size() - 1; i >= 0; i--) { float[] object = queue.get(i); if (object[OBJ_SQUASHED] == 0) { // apply gravity if (object[OBJ_WEIGHTLESS] == 0) { object[OBJ_VY] += GRAVITY; object[OBJ_SUPPORTED] = 0; if (object[OBJ_VY] > 0) { // blocks only affect objects in downwards direction // scan all points in range established by VY for(y = (int)object[OBJ_Y]; y <= (int)(object[OBJ_Y] + object[OBJ_VY]); y++) { x = (y + (int)object[OBJ_Y2]) >> 3; z = (y + (int)object[OBJ_Y2] + 1) >> 3; if (((map[z][((int)object[OBJ_X] + (int)object[OBJ_X1]) >> 3] & MAP_MASK) > MAP_EMPTIES && ((map[x][((int)object[OBJ_X] + (int)object[OBJ_X1]) >> 3]) & MAP_MASK) <= MAP_EMPTIES) || ((map[z][((int)object[OBJ_X] + (int)object[OBJ_X2]) >> 3] & MAP_MASK) > MAP_EMPTIES && (map[x][((int)object[OBJ_X] + (int)object[OBJ_X2]) >> 3] & MAP_MASK) <= MAP_EMPTIES)) { // object is supported object[OBJ_Y] = y; object[OBJ_VY] = 0; object[OBJ_SUPPORTED] = 1; break; } } } object[OBJ_Y] += object[OBJ_VY]; } // move in X direction outter: { object[OBJ_OBSTRUCTED] = 0; for(x = (int)object[OBJ_X]; x != (int)(object[OBJ_X] + object[OBJ_VX]); x += (object[OBJ_VX] < 0) ? -1 : 1) { // test for wall collision z = ((object[OBJ_VX] < 0) ? (x + (int)object[OBJ_X1]) - 1 : (x + (int)object[OBJ_X2]) + 1) >> 3; k = ((object[OBJ_VX] < 0) ? (x + (int)object[OBJ_X1]) : (x + (int)object[OBJ_X2])) >> 3; for(j = 0; j < 3; j++) { y = ((int)object[OBJ_Y] + (int)object[OBJ_Y1] + ((j * ((int)object[OBJ_Y2] - (int)object[OBJ_Y1])) >> 1)) >> 3; if (((map[y][z] & MAP_MASK) > MAP_EMPTIES && (map[y][k] & MAP_MASK) <= MAP_EMPTIES)) { // object obstructed by bricks in X direction object[OBJ_X] = x; object[OBJ_VX] = 0; object[OBJ_OBSTRUCTED] = 1; break outter; } } // test for enemy-enemy collision if (object != mario) { k = (object[OBJ_VX] < 0) ? x - 1 : x + 1; for(j = queue.size() - 1; j >= 0; j--) { if (j != i) { float[] obj = queue.get(j); if (obj != mario && obj[OBJ_SQUASHED] == 0 && obj[OBJ_X] + obj[OBJ_X1] <= k + object[OBJ_X2] && obj[OBJ_X] + obj[OBJ_X2] >= k + object[OBJ_X1] && obj[OBJ_Y] + obj[OBJ_Y1] <= object[OBJ_Y] + object[OBJ_Y2] && obj[OBJ_Y] + obj[OBJ_Y2] >= object[OBJ_Y] + object[OBJ_Y1]) { // object obstructed by enemy in X direction object[OBJ_X] = x; object[OBJ_VX] = 0; object[OBJ_OBSTRUCTED] = 1; break outter; } } } } } object[OBJ_X] += object[OBJ_VX]; // test for enemy-Mario collision if (mario != object && mario[OBJ_X] + mario[OBJ_X1] <= object[OBJ_X] + object[OBJ_X2] && mario[OBJ_X] + mario[OBJ_X2] >= object[OBJ_X] + object[OBJ_X1] && mario[OBJ_Y] + mario[OBJ_Y1] <= object[OBJ_Y] + object[OBJ_Y2] && mario[OBJ_Y] + mario[OBJ_Y2] >= object[OBJ_Y] + object[OBJ_Y1]) { if (mario[OBJ_VY] == 0 || object[OBJ_NOT_SQUASHABLE] == 1 || ((object[OBJ_TYPE] == TYPE_GIRA || object[OBJ_TYPE] == TYPE_BUNBUN) && mario[OBJ_VY] <= 0)) { // Enemy killed Mario marioDied = true; mario[OBJ_MIRRORED] = 1; mario[OBJ_VY] = DYING_MARIO_JUMP_SPEED; mario[OBJ_SPRITE] = SPRITE_MARIO_DEAD; } else if (mario[OBJ_VY] > 0) { // Mario squashed enemy mario[OBJ_VY] = MARIO_BOUNCE_SPEED; object[OBJ_SQUASHED] = 1; object[OBJ_SPRITE_COUNTER] = 0; object[OBJ_VX] = 0; } } } } // update enemies if (object[OBJ_TYPE] == TYPE_CHIBIBO) { // update chibibo if (object[OBJ_SQUASHED] == 1) { object[OBJ_SPRITE] = SPRITE_SQUASHED_CHIBIBO; if (++object[OBJ_SPRITE_COUNTER] == 40) { queue.remove(i); continue; } } else { if (++object[OBJ_SPRITE_COUNTER] == 8) { object[OBJ_SPRITE_COUNTER] = 0; object[OBJ_FLIPPED] = (int)object[OBJ_FLIPPED] ^ 1; } if (object[OBJ_OBSTRUCTED] == 1) { object[OBJ_DIRECTION] = (int)object[OBJ_DIRECTION] ^ 1; object[OBJ_VX] = (object[OBJ_DIRECTION] == 1) ? CHIBIBO_SPEED : -CHIBIBO_SPEED; } } } else if (object[OBJ_TYPE] == TYPE_NOKOBON) { // update nokobon if (object[OBJ_SQUASHED] == 1) { // update bomb if (object[OBJ_SPRITE_COUNTER] == 0) { object[OBJ_Y] += 8; object[OBJ_WEIGHTLESS] = 1; } object[OBJ_SPRITE] = SPRITE_BOMB_0 + ((object[OBJ_SPRITE_COUNTER] < 15) ? 0 : ((((int)object[OBJ_SPRITE_COUNTER]) >> 2) & 1)); if (++object[OBJ_SPRITE_COUNTER] > 50) { // bomb explodes object[OBJ_TYPE] = TYPE_EXPLOSION; object[OBJ_MIRRORED] = 1; object[OBJ_X] -= 4; object[OBJ_X1] = 0; object[OBJ_Y1] = 0; object[OBJ_X2] = 15; object[OBJ_Y2] = 7; object[OBJ_SQUASHED] = 0; object[OBJ_NOT_SQUASHABLE] = 1; } } else { if (++object[OBJ_SPRITE_COUNTER] == 8) { object[OBJ_SPRITE_COUNTER] = 0; object[OBJ_SPRITE] = object[OBJ_SPRITE] == SPRITE_NOKOBON_0 ? SPRITE_NOKOBON_1 : SPRITE_NOKOBON_0; } if (object[OBJ_OBSTRUCTED] == 1 || (object[OBJ_SUPPORTED] == 1 && (map[(16 + (int)object[OBJ_Y]) >> 3] [((int)(object[OBJ_X] + (object[OBJ_VX] < 0 ? -1 : 8))) >> 3] & MAP_MASK) <= MAP_EMPTIES)) { object[OBJ_DIRECTION] = (int)object[OBJ_DIRECTION] ^ 1; object[OBJ_FLIPPED] = object[OBJ_DIRECTION]; if (object[OBJ_DIRECTION] == 1) { object[OBJ_VX] = NOKOBON_SPEED; } else { object[OBJ_VX] = -NOKOBON_SPEED; } } } } else if (object[OBJ_TYPE] == TYPE_EXPLOSION) { // update explosion object[OBJ_SPRITE] = SPRITE_EXPLOSION_0 + ((((int)object[OBJ_SPRITE_COUNTER]) >> 2) & 1); if (++object[OBJ_SPRITE_COUNTER] > 100) { queue.remove(i); continue; } } else if (object[OBJ_TYPE] == TYPE_PAKKUN_FLOWER) { // update pakkun flower if (++object[OBJ_SPRITE_COUNTER] <= PAKKUN_FLOWER_SLEEPING) { if (object[OBJ_SPRITE_COUNTER] == PAKKUN_FLOWER_SLEEPING) { k = (int)mario[OBJ_X] - (int)object[OBJ_X] + 4; if (k < 0) { k = -k; } if (k < PAKKUN_FLOWER_DISTANCE) { object[OBJ_SPRITE_COUNTER] = 0; } } } else if (object[OBJ_SPRITE_COUNTER] < PAKKUN_FLOWER_RISING) { object[OBJ_Y]--; } else if (object[OBJ_SPRITE_COUNTER] < PAKKUN_FLOWER_CHOMPING) { object[OBJ_SPRITE] = SPRITE_PAKKUN_FLOWER_0 + ((((int)object[OBJ_SPRITE_COUNTER]) >> 4) & 1); } else if (object[OBJ_SPRITE_COUNTER] < PAKKUN_FLOWER_SINKING) { object[OBJ_Y]++; } else { object[OBJ_SPRITE_COUNTER] = 0; } } else if (object[OBJ_TYPE] == TYPE_GIRA) { // update gira if (object[OBJ_SQUASHED] == 1) { object[OBJ_VY] += DYING_MARIO_GRAVITY; object[OBJ_Y] += object[OBJ_VY]; } else { object[OBJ_X]--; } if (++object[OBJ_SPRITE_COUNTER] == 8) { object[OBJ_SPRITE_COUNTER] = 0; object[OBJ_SPRITE] = object[OBJ_SPRITE] != SPRITE_GIRA_0 ? SPRITE_GIRA_0 : SPRITE_GIRA_1; } } else if (object[OBJ_TYPE] == TYPE_FIGHTER_FLY) { // update fighter fly if (object[OBJ_SQUASHED] == 1) { object[OBJ_VY] += DYING_MARIO_GRAVITY; object[OBJ_Y] += object[OBJ_VY]; object[OBJ_WEIGHTLESS] = 1; } else { if (object[OBJ_SUPPORTED] == 1 && ++object[OBJ_COUNTER] == 60) { object[OBJ_VY] = -2.5f; object[OBJ_COUNTER] = 0; } object[OBJ_VX] = object[OBJ_VY] == 0 ? 0 : (object[OBJ_X] > mario[OBJ_X]) ? -1 : 1; if (++object[OBJ_SPRITE_COUNTER] == 16) { object[OBJ_SPRITE_COUNTER] = 0; object[OBJ_SPRITE] = object[OBJ_SPRITE] != SPRITE_FIGHTER_FLY_0 ? SPRITE_FIGHTER_FLY_0 : SPRITE_FIGHTER_FLY_1; } } } else if (object[OBJ_TYPE] == TYPE_BUNBUN) { // update bunbun if (object[OBJ_SQUASHED] == 1) { object[OBJ_VY] += DYING_MARIO_GRAVITY; object[OBJ_Y] += object[OBJ_VY]; } else { if (++object[OBJ_COUNTER] < 40) { object[OBJ_X]--; } if (object[OBJ_COUNTER] == 40) { float[] spear = new float[32]; queue.add(spear); spear[OBJ_X] = object[OBJ_X] + 4; spear[OBJ_Y] = object[OBJ_Y]; spear[OBJ_X1] = 2; spear[OBJ_Y1] = 1; spear[OBJ_X2] = 4; spear[OBJ_Y2] = 15; spear[OBJ_SPRITE] = SPRITE_SPEAR; spear[OBJ_WEIGHTLESS] = 1; spear[OBJ_NOT_SQUASHABLE] = 1; spear[OBJ_TYPE] = TYPE_SPEAR; } else if (object[OBJ_COUNTER] == 60) { object[OBJ_COUNTER] = 0; } if (++object[OBJ_SPRITE_COUNTER] == 8) { object[OBJ_SPRITE_COUNTER] = 0; object[OBJ_SPRITE] = object[OBJ_SPRITE] != SPRITE_BUNBUN_0 ? SPRITE_BUNBUN_0 : SPRITE_BUNBUN_1; } } } else if (object[OBJ_TYPE] == TYPE_SPEAR) { // update spear object[OBJ_Y]++; } // remove out of bounds enemies if (object[OBJ_X] < cameraX - 80 || object[OBJ_Y] > 320) { queue.remove(i); if (object == mario) { // reset level fadeDelta = FADE_SPEED; } } } // left side of the screen acts as a wall if (mario[OBJ_X] < cameraX - 3) { mario[OBJ_X] = cameraX - 3; } // update camera i = (int)mario[OBJ_X] - 72; if (i > cameraX) { cameraX = i; } if (cameraX > 2400) { cameraX = 2400; } // generate enemies i = (cameraX + 160) >> 3; while(enemiesX <= i) { for(y = 16; y < 32; y++) { if (enemies[y][enemiesX] == TYPE_CHIBIBO) { for(j = random.nextInt(2) + 1; j >= 0; j--) { // create chibibo float[] chibibo = new float[32]; queue.add(chibibo); chibibo[OBJ_X] = (enemiesX << 3) + j * 12; chibibo[OBJ_Y] = y << 3; chibibo[OBJ_VX] = -CHIBIBO_SPEED; chibibo[OBJ_X1] = 1; chibibo[OBJ_X2] = 6; chibibo[OBJ_Y2] = 7; chibibo[OBJ_SPRITE] = SPRITE_CHIBIBO; chibibo[OBJ_TYPE] = TYPE_CHIBIBO; } } else if (enemies[y][enemiesX] == TYPE_NOKOBON) { for(j = random.nextInt(2) + 1; j >= 0; j--) { // create nokobon float[] nokobon = new float[32]; queue.add(nokobon); nokobon[OBJ_X] = (enemiesX << 3) + j * 12; nokobon[OBJ_Y] = y << 3; nokobon[OBJ_VX] = -NOKOBON_SPEED; nokobon[OBJ_Y1] = 10; nokobon[OBJ_X2] = 8; nokobon[OBJ_Y2] = 15; nokobon[OBJ_SPRITE] = SPRITE_NOKOBON_0; nokobon[OBJ_TYPE] = TYPE_NOKOBON; } } else if (enemies[y][enemiesX] == TYPE_PAKKUN_FLOWER) { // create pakkun flower float[] pakkunFlower = new float[32]; queue.add(pakkunFlower); pakkunFlower[OBJ_X] = (enemiesX << 3) + 4; pakkunFlower[OBJ_Y] = y << 3; pakkunFlower[OBJ_X2] = 7; pakkunFlower[OBJ_Y2] = 15; pakkunFlower[OBJ_SPRITE] = SPRITE_PAKKUN_FLOWER_0; pakkunFlower[OBJ_WEIGHTLESS] = 1; pakkunFlower[OBJ_NOT_SQUASHABLE] = 1; pakkunFlower[OBJ_BEHIND_TILES] = 1; pakkunFlower[OBJ_TYPE] = TYPE_PAKKUN_FLOWER; } else if (enemies[y][enemiesX] == TYPE_FIGHTER_FLY) { // create fighter fly float[] fighterFly = new float[32]; queue.add(fighterFly); fighterFly[OBJ_X] = enemiesX << 3; fighterFly[OBJ_Y] = y << 3; fighterFly[OBJ_Y1] = 5; fighterFly[OBJ_X2] = 15; fighterFly[OBJ_Y2] = 15; fighterFly[OBJ_SPRITE] = SPRITE_FIGHTER_FLY_0; fighterFly[OBJ_MIRRORED] = 1; fighterFly[OBJ_TYPE] = TYPE_FIGHTER_FLY; } } enemiesX++; } if ((level == 2 || level == 4) && cameraX < 2320) { if (--giraCountdown == 0) { // create gira giraCountdown = 180; float[] gira = new float[32]; queue.add(gira); gira[OBJ_X] = cameraX + 160; gira[OBJ_Y] = ((15 + random.nextInt(14)) << 3) - 1; gira[OBJ_X2] = 8; gira[OBJ_Y1] = 10; gira[OBJ_Y2] = 15; gira[OBJ_SPRITE] = SPRITE_GIRA_0; gira[OBJ_WEIGHTLESS] = 1; gira[OBJ_TYPE] = TYPE_GIRA; } } if (level > 2 && cameraX < 2320) { if (--bunbunCountdown == 0) { // create bunbun bunbunCountdown = 360 + random.nextInt(360); float[] bunbun = new float[32]; queue.add(bunbun); bunbun[OBJ_X] = cameraX + 160; bunbun[OBJ_Y] = mario[OBJ_Y] - ((2 + random.nextInt(5)) << 3); bunbun[OBJ_X2] = 15; bunbun[OBJ_Y2] = 15; bunbun[OBJ_SPRITE] = SPRITE_BUNBUN_0; bunbun[OBJ_WEIGHTLESS] = 1; bunbun[OBJ_TYPE] = TYPE_BUNBUN; if (bunbun[OBJ_Y] < 144) { bunbun[OBJ_Y] = 144; } } } // check if mario reached end of level if (mario[OBJ_X] >= 2544) { // advance level level++; fadeDelta = FADE_SPEED; } // -- update ends ------------------------------------------------------ } while(nextFrameStartTime < System.nanoTime()); // -- render starts ------------------------------------------------------ // clear frame g.setColor(WHITE); g.fillRect(0, 0, 160, 144); if (level == 5) { // draw ending g.drawImage(sprites[ORIENTATION_ORIGINAL][SPRITE_MARIO_0], 67, 64, null); g.drawImage(sprites[ORIENTATION_ORIGINAL][SPRITE_DAISY], 78, 64, null); } else { // draw sky g.setColor(LIGHT_GRAY); g.fillRect(0, 16, 160, 9); g.drawLine(0, 30, 160, 30); g.drawLine(0, 28, 160, 28); g.drawLine(0, 26, 160, 26); // draw background planes g.setColor(BLACK); for(i = 0; i < 4; i++) { for(j = 0; j < 4; j++) { float[] object = backgroundPlanes[i].get(j); k = ((int)object[OBJ_X]) - (cameraX >> (4 - i)); g.drawImage(sprites[0][i == 3 ? SPRITE_TREE : SPRITE_PYRAMID], k, (int)object[OBJ_Y], null); if (i == 3) { g.drawLine(k + 7, 16 + (int)object[OBJ_Y], k + 7, 143); } if (k + ((i == 3) ? 16 : 144) < 0) { object[OBJ_X] += ((160 + random.nextInt(40)) << (4 - i)); object[OBJ_Y] = 72 + (random.nextInt(4) << 3); } } } // draw sprites behind of tiles for(i = queue.size() - 1; i >= 0; i--) { float[] object = queue.get(i); if (object[OBJ_BEHIND_TILES] == 1) { g.drawImage(sprites[object[OBJ_MIRRORED] == 0 ? (int)object[OBJ_FLIPPED] : ORIENTATION_MIRRORED][(int)object[OBJ_SPRITE]], ((int)object[OBJ_X]) - cameraX, ((int)object[OBJ_Y]) - 112, null); } } // draw blocks int mapOffset = cameraX >> 3; int drawOffset = cameraX & 7; for(y = 0; y < 16; y++) { for(x = 0; x < 21; x++) { i = map[y + 16][x + mapOffset]; j = i & MAP_MASK; if (j > MAP_EMPTY) { g.drawImage(sprites[i >> 4][j - 1], (x << 3) - drawOffset, 16 + (y << 3), null); } } } // draw sprites in front of tiles for(i = queue.size() - 1; i >= 0; i--) { float[] object = queue.get(i); if (object[OBJ_BEHIND_TILES] == 0) { g.drawImage(sprites[object[OBJ_MIRRORED] == 0 ? (int)object[OBJ_FLIPPED] : ORIENTATION_MIRRORED][(int)object[OBJ_SPRITE]], ((int)object[OBJ_X]) - cameraX, ((int)object[OBJ_Y]) - 112, null); } } // darken image during fading if (fadeDelta != 0) { g.setColor(new Color(fadeIntensity << 24, true)); g.fillRect(0, 0, 160, 144); } } // -- render ends -------------------------------------------------------- // show the hidden buffer if (g2 != null) { g2.drawImage(image, 0, 0, 640, 576, null); } else { g2 = (Graphics2D)getGraphics(); requestFocus(); } // burn off extra cycles while(nextFrameStartTime - System.nanoTime() > 0) { Thread.yield(); } } } @Override public void processKeyEvent(KeyEvent keyEvent) { final int VK_LEFT = 0x25; final int VK_RIGHT = 0x27; final int VK_DOWN = 0x28; final int VK_JUMP = 0x44; final int VK_A = 0x41; final int VK_D = 0x44; final int VK_S = 0x53; int k = keyEvent.getKeyCode(); if (k > 0) { if (k == VK_A) { k = VK_LEFT; } else if (k == VK_D) { k = VK_RIGHT; } a[(k == VK_LEFT || k == VK_RIGHT || k == VK_DOWN || k == VK_S) ? k : VK_JUMP] = keyEvent.getID() != 402; } } // to run in window, uncomment below /*public static void main(String[] args) throws Throwable { javax.swing.JFrame frame = new javax.swing.JFrame("Super Mario Land 4K"); frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); a applet = new a(); applet.setPreferredSize(new java.awt.Dimension(640, 576)); frame.add(applet, java.awt.BorderLayout.CENTER); frame.setResizable(false); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); Thread.sleep(250); applet.start(); }*/ }
d53017c10b7180bc2d5e887e57284aa49349bd0c
258aecfc4dde1014f8cbc901d8f51094d03b5ec5
/src/main/java/com/hellofresh/template/Booking.java
a7e934f06a79e71181d9c6ce4cad3182495646de
[]
no_license
yogeshdawkhar/helloFreshAPITest
f4d0b8b8819f71e64af30533fb84fb346118f142
14ef6774ff1c8885c32dff70933195f7cb2275ca
refs/heads/master
2023-01-16T05:03:52.066953
2022-12-21T10:17:36
2022-12-21T10:17:36
221,317,089
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.hellofresh.template; import com.google.gson.Gson; public class Booking { BookingDate bookingdates; Boolean depositepaid; String email; String firstname; String lastname; String phone; int roomid; static Booking booking = new Booking(); public static String getBookingBodyJSON(String checkinDate, String checkoutDate, String email, String fristName, String lastName, String phoneNumber, int roomId) { booking.bookingdates = BookingDate.getBookingDatesJSON(checkinDate, checkoutDate); booking.email = email; booking.firstname = fristName; booking.lastname = lastName; booking.phone = phoneNumber; booking.roomid = roomId; return new Gson().toJson(booking); } }
90ef453abffe51fa486a587d3488f99e9c357ca6
62e334192393326476756dfa89dce9f0f08570d4
/tk_code/push/push-server/src/main/java/com/huatu/tiku/push/quartz/factory/MockJobFactory.java
401bdab08e65d584419294b14984e28ea02a38ca
[]
no_license
JellyB/code_back
4796d5816ba6ff6f3925fded9d75254536a5ddcf
f5cecf3a9efd6851724a1315813337a0741bd89d
refs/heads/master
2022-07-16T14:19:39.770569
2019-11-22T09:22:12
2019-11-22T09:22:12
223,366,837
1
2
null
2022-06-30T20:21:38
2019-11-22T09:15:50
Java
UTF-8
Java
false
false
160
java
package com.huatu.tiku.push.quartz.factory; /** * 描述: * * @author biguodong * Create time 2018-11-08 下午9:43 **/ public class MockJobFactory { }
8d822a1b3b74968cee363064e325d3be9fc7fe7d
cda4e465cc8b3c9a4fac2325665aec78725dbbcc
/src/Recursion/Natural_Num_Sum.java
ec079d31660034b0dcf77604fb0c411755445c43
[]
no_license
anuj12chhonkar/Interview-Programs
e4ba25a7e2f8b4117be209ce3175f7a0c7ae4cc3
f622568650d551616cb4b4f40bd13125af589793
refs/heads/main
2023-08-02T21:57:20.013463
2021-09-23T21:58:51
2021-09-23T21:58:51
370,229,311
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package Recursion; public class Natural_Num_Sum { public static void main(String[] args) { System.out.println(sum(5)); } static int sum(int n) { if(n==1) return 1; return n+sum(n-1); } }
7870aa951a54bb3ab0ab40f36af2ed981a6e5174
c61b403ce587bce582946dd970aeb2e85c70171d
/model/Fox.java
15956a55ba673e34408ae01f13ab3e48a2878d3a
[]
no_license
Wekker/Vossen-en-Konijnen
344ed5eac2e8d44e461ee10d3b3c39c679634e5d
484fdbd1e920fd7f2e02372d17ef3393bdd7ed45
refs/heads/master
2021-01-17T22:48:27.206528
2012-02-07T08:50:45
2012-02-07T08:50:45
3,283,551
0
0
null
null
null
null
UTF-8
Java
false
false
7,407
java
package model; import java.util.HashMap; import java.util.List; import java.util.Iterator; import logic.Counter; import logic.Field; import logic.Location; import main.MainProgram; /** * A simple model of a fox. * Foxes age, move, eat rabbits, and die. * * @author Ieme, Jermo, Yisong * @version 2012.01.29 */ public class Fox extends Animal { // Characteristics shared by all foxes (class variables). // The age at which a fox can start to breed. private static int breeding_age = 3; // The age to which a fox can live. private static int max_age = 150; // The likelihood of a fox breeding. private static double breeding_probability = 0.075; // The maximum number of births. private static int max_litter_size = 8; // The food value of a single rabbit. In effect, this is the // number of steps a fox can go before it has to eat again. /** * Create a fox. A fox can be created as a new born (age zero * and not hungry) or with a random age and food level. * * @param randomAge If true, the fox will have random age and hunger level. * @param field The field currently occupied. * @param location The location within the field. */ public Fox(boolean randomAge, Field field, Location location) { super(field, location); if(randomAge) { setAge(getRandom().nextInt(max_age)); setFoodLevel(getRandom().nextInt(RABBIT_FOOD_VALUE)); } else { setAge(0); setFoodLevel(RABBIT_FOOD_VALUE); } } /** * This is what the fox does most of the time: it hunts for * rabbits. In the process, it might breed, die of hunger, * or die of old age. * @param field The field currently occupied. * @param newFoxes A list to return newly born foxes. */ public void act(List<Actor> newFoxes) { incrementAge(); incrementHunger(); if(isAlive()) { giveBirth(newFoxes); // Move towards a source of food if found. Location newLocation = findFood(); if(newLocation == null) { // No food found - try to move to a free location. newLocation = getField().freeAdjacentLocation(getLocation()); } // See if it was possible to move. if(newLocation != null) { setLocation(newLocation); } else { // Overcrowding. setDead(); } } } /** * Zorgt er voor dat er geen nakomeling worden geboren als er te weinig voesel zijn. * @return true als genoeg voedsel zijn * @return false als niet genoeg voedsel zijn */ @SuppressWarnings("rawtypes") public boolean survivalInstinct() { int foxCount = 0; int rabbitCount = 0; HashMap<Class, Counter> classStats = MainProgram.getSimulator().getSimulatorView().getStats().getPopulation(); for (Class c : classStats.keySet()) { Counter info = classStats.get(c); if (info.getName().equals("model.Fox")) { foxCount = info.getCount(); } if (info.getName().equals("model.Rabbit")) { rabbitCount = info.getCount(); } } if (1.5 *(foxCount + (foxCount * getBreedingProbability() * getMaxLitterSize())) >= rabbitCount) { //foxCount >= rabbitCount * getBreedingProbability() * getMaxLitterSize() ) { return false; } return true; } /** * returns the maximum age of a fox can live * @return int maximum age of a fox can live */ protected int getMaxAge() { return max_age; } /** * Make this fox more hungry. This could result in the fox's death. */ private void incrementHunger() { setFoodLevel(getFoodLevel() - 1); if(getFoodLevel() <= 0) { setDead(); } } /** * Look for rabbits adjacent to the current location. * Only the first live rabbit is eaten. * @return Where food was found, or null if it wasn't. */ private Location findFood() { Field field = getField(); List<Location> adjacent = field.adjacentLocations(getLocation()); Iterator<Location> it = adjacent.iterator(); while(it.hasNext()) { Location where = it.next(); Object animal = field.getObjectAt(where); if(animal instanceof Rabbit) { Rabbit rabbit = (Rabbit) animal; if(rabbit.isAlive()) { rabbit.setDead(); setFoodLevel(RABBIT_FOOD_VALUE); return where; } } } return null; } /** * Check whether or not this fox is to give birth at this step. * New births will be made into free adjacent locations. * @param newFoxes A list to return newly born foxes. */ private void giveBirth(List<Actor> newFoxes) { // New foxes are born into adjacent locations. // Get a list of adjacent free locations. Field field = getField(); List<Location> free = field.getFreeAdjacentLocations(getLocation()); int births = breed(); for(int b = 0; b < births && free.size() > 0; b++) { Location loc = free.remove(0); Fox young = new Fox(false, field, loc); newFoxes.add(young); } } /** * A fox can breed if it has reached the breeding age. */ protected boolean canBreed() { return getAge() >= getBreedingAge(); } /** * setter voor breeding_age * @param breeding_age */ public static void setBreedingAge(int breeding_age) { if (breeding_age >= 0) Fox.breeding_age = breeding_age; } /** * setter voor max_age * @param max_age */ public static void setMaxAge(int max_age) { if (max_age >= 1) Fox.max_age = max_age; } /** * setter voor breeding_probability * @param breeding_probability */ public static void setBreedingProbability(double breeding_probability) { if (breeding_probability >= 0) Fox.breeding_probability = breeding_probability; } /** * setter voor max_litter_size * @param max_litter_size */ public static void setMaxLitterSize(int max_litter_size) { if (max_litter_size >= 1) Fox.max_litter_size = max_litter_size; } /** * default settings */ public static void setDefault() { breeding_age = 3; max_age = 150; breeding_probability = 0.075; max_litter_size = 8; } /** * Getter om breeding_age op te halen * @return breeding_age breeding leeftijd */ protected int getBreedingAge() { return breeding_age; } /** * Getter om max_litter_size op te halen * @return max_litter_size maximum litter */ protected int getMaxLitterSize() { return max_litter_size; } /** * Getter om breeding_probability op te halen * @return breeding_probability breeding kansen */ protected double getBreedingProbability() { return breeding_probability; } }
5731719813bfe5af73d7118488d7b276832f8211
6cdd71dd93b8cfeac635a30884676c8aee18b4e4
/src/librarian/DelLibrarianAction.java
11a866b01040df683062abebd17d6214164cf2c5
[]
no_license
wellplayed03/Bibiosoft
de1418cd443cddbd56e997bf538a25dbfc8f6de5
7c33a50cf04d26a82db25066edd1ae9b914b85fb
refs/heads/master
2020-03-31T13:43:14.992878
2018-10-09T15:03:37
2018-10-09T15:03:37
152,266,877
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package librarian; public class DelLibrarianAction { }
[ "97974@DESKTOP-WCLY700" ]
97974@DESKTOP-WCLY700
610db8f23a4f9434576c1ad1df16ef7dbd18bd59
ca678f11db97ea6d30ca3d0eb40699b5ac74cc57
/app/src/main/java/com/example/recycler/State.java
f518c309c039d51ea136c3173ac916e78fc7c4d4
[]
no_license
dangnam197/Recycler
4797d39f25a9b976b254c444c49ae649e7c2ecd7
6b5fb2b0ddc93154547b0a331ad66b5108b754a5
refs/heads/master
2020-04-28T00:49:04.125797
2019-04-04T08:01:49
2019-04-04T08:01:49
174,830,197
0
1
null
null
null
null
UTF-8
Java
false
false
727
java
package com.example.recycler; public class State { public static final int STATE_IMAGE = 2; public static final int STATE_IMAGE_TEXT= 8; public static final int STATE_TEXT_DETAIL = 1; public static final int STATE_HORIZONTAL = 3; public static final int STATE_VERTICAL = 4; public static final int STATE_TEXT_DESCRIPTION = 5; public static final int STATE_TEXT_TITLE= 6; public static final int STATE_TEXT_TIME= 7; public static final int STATE_HISTORY= 8; public static final int STATE_DOWNLOAD= 9; public static final int STATE_INTERNET=10; public static final int STATE_OFFLINE=11; public static final int STATE_HOME = 12; public static final int STATE_PAGING =13; }
44653599e0912e529979326d39461f43ea06254d
873d2b1bf98ab97d5c50acb1d20eb89cecb33f78
/YeolsimComms/src/com/yeolsim/service/product/ProductService.java
fa16cdf1ec109daccdf2baec13ae2d88c35c313c
[]
no_license
JaeWoos/Responsive-Web-ver1.0-
bcff16c6eb66648d4567c6edaf511079d82babae
64180300b39a27c465cf3c9b887bf30a6a8a5010
refs/heads/master
2021-01-13T09:58:12.120451
2016-04-11T06:51:33
2016-04-11T06:51:33
55,109,904
0
0
null
null
null
null
UTF-8
Java
false
false
516
java
package com.yeolsim.service.product; import java.util.Map; import com.yeolsim.common.Search; import com.yeolsim.service.domain.Product; public interface ProductService { public void addProduct(Product product) throws Exception; public Product getProduct(int prodNo) throws Exception; public void updateProduct(Product productVO) throws Exception; public Map<String,Object> getProductList(int memberNo) throws Exception; Map<String, Object> getAllProductList() throws Exception; }
[ "Administrator@CHOIJAEWOO-PC" ]
Administrator@CHOIJAEWOO-PC
deb2516f781f68e1862ae6f1735c92f30e8522be
ae07c68bc26546efac278dbd2010840641e83bb7
/src/main/java/io/cucumber/guardiasDaQualidade/ProvaAccenture.java
ae0fd7520f663240590a5526aac3309ebc459052
[]
no_license
jessikagomes/GuardiasDaQualidade
026594360e5df9cd5aed85bd2ddc357dda8405d3
7583eba4966ee84ba3c7884951030c84dd079507
refs/heads/main
2023-03-30T06:29:22.739307
2021-04-01T00:19:25
2021-04-01T00:19:25
352,056,188
0
0
null
null
null
null
UTF-8
Java
false
false
115
java
package io.cucumber.guardiasDaQualidade; public class ProvaAccenture { public void validar(String teste) {} }
8f8a9e830bbdd3a1e478bc4524a0edfd2dfd6b88
06b798c456dc1e709eb5eb0214754a7fad27fb11
/app/src/main/java/com/example/weatherapplication/weather/WeatherAdapter.java
5efb2a49f4f3d8b6cd2f642682abcd1458d76b83
[]
no_license
srikrishnavignesh/WeatherApplication
2e098631ef7a01b7b8458a56a6b841eb886301d9
5a359b677d3204b0362107c5d42794a6ec7378cb
refs/heads/master
2022-11-21T19:55:52.195161
2020-07-23T06:01:30
2020-07-23T06:01:30
281,865,116
0
0
null
null
null
null
UTF-8
Java
false
false
2,820
java
package com.example.weatherapplication.weather; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.weatherapplication.DataModel.Weather; import com.example.weatherapplication.R; import java.util.ArrayList; import java.util.Calendar; import java.util.List; //we make a horizontal recycler view to display seven days weather data //seven days from current day weather data has min,max,avg and weather description public class WeatherAdapter extends RecyclerView.Adapter<WeatherAdapter.WeatherHolder> { List<Weather> list; String days[]; public WeatherAdapter(List<Weather> list) { days=new String[]{"dummy","SUN","MON","TUE","WED","THU","FRI","SAT"}; this.list=list; } @NonNull @Override public WeatherHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater inflater=LayoutInflater.from(parent.getContext()); View view=inflater.inflate(R.layout.weather_list,parent,false); return new WeatherHolder(view); } @Override public void onBindViewHolder(@NonNull WeatherHolder holder, int position) { Calendar cl=Calendar.getInstance(); cl.add(Calendar.DATE,position); holder.day.setText(days[cl.get(Calendar.DAY_OF_WEEK)]); holder.min.setText("min :"+list.get(position).getTempMin()+"°c"); holder.max.setText("max :"+list.get(position).getTempMax()+"°c"); holder.temp.setText("avg:"+list.get(position).getTemp()+"°c"); holder.desc.setText(list.get(position).getDes()); int res=holder.itemView.getContext().getResources().getIdentifier(list.get(position).getIcon(),"drawable",holder.itemView.getContext().getPackageName()); holder.img.setImageResource(res); } @Override public int getItemCount() { if(list==null) return 0; return list.size(); } class WeatherHolder extends RecyclerView.ViewHolder { TextView min; TextView max; TextView temp; TextView desc; TextView day; ImageView img; public WeatherHolder(@NonNull View itemView) { super(itemView); itemView.findViewById(R.id.min); min=(TextView)itemView.findViewById(R.id.min); max=(TextView)itemView.findViewById(R.id.max); desc=(TextView)itemView.findViewById(R.id.des); temp=(TextView)itemView.findViewById(R.id.temp); day=(TextView)itemView.findViewById(R.id.day); img=(ImageView)itemView.findViewById(R.id.img); } } }
0b73ce14d1d7153a5f27c1376f130843d9f57141
6c986b31636574dc9a7c4f5a1e23b1e09f209211
/Struts2Log4j/src/main/java/actions/HomeAction.java
fb0962d04792cbc4f2007addec660623695330ed
[]
no_license
kidaak/Examples
62f27c0e09e44fd5177b4168e2b4cdafb1fbe4a8
d782b337ef5da415a61f31031268308926a7a3ab
refs/heads/master
2021-01-17T19:55:00.456881
2015-12-22T22:50:29
2015-12-22T22:50:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package actions; import org.apache.log4j.Logger; import com.opensymphony.xwork2.Action; import org.apache.struts2.convention.annotation.*; /** * @author Oleg Romanenchuk */ public class HomeAction implements Action { private static final Logger logger = Logger.getLogger(HomeAction.class); public String execute(){ logger.info("inside HomeAction execute method"); return SUCCESS; } }
bbaece0531465badf46b7ef604a6d47309ae0272
e5fa11a89ccfa42545e19b9fc17bccfcbb23bf8e
/src/Paskaita_3_uzduotys/Uzdav_3_3_4.java
b5b973b0ecf159de9f834c1537fb88a67a8238eb
[]
no_license
Arimantas/JavaPagrindai
91883299cffb4823513eac1560a0abf711cfee2b
c8e955fb29262201e3f29e48b66a53f79b450732
refs/heads/master
2021-01-19T06:29:41.469259
2017-04-09T17:39:28
2017-04-09T17:39:28
87,464,739
0
0
null
null
null
null
UTF-8
Java
false
false
1,206
java
package Paskaita_3_uzduotys; import java.util.InputMismatchException; import java.util.Scanner; /** * Created by Arimantas on 2017.04.07. */ public class Uzdav_3_3_4 { public static void main(String[] args) { // 3. Parašyti programą, kuri paprašytų vesti skaičius tol, kol bus įvestas skaičius 0. // Pabaigoje turi būti atvaizduojama įvestų skaičių suma. // 4. Papildykite programą kuri neleistu įvesti ne skaičius, // jei vartotojas įveda ne skaičių programa prašo pakartoti tol kol bus įvestas skaičius. Scanner sc = new Scanner(System.in); System.out.println("Iveskite betkokius skaicius ir gaukite ju suma"); System.out.println("Kad gautumete pries tai ivestu skaiciu suma irasykite 0"); int suma = 0; int i = 1; while (i != 0) { try { i = sc.nextInt(); suma = suma + i; } catch (InputMismatchException e) { // kodel e? System.out.println("Raidziu as neskaiciuoju, ivesk skaiciu!"); sc.nextLine(); } } System.out.println("Ivestu skaiciu suma: " + suma); } }
d0489242bfc4fa5ebb5fed575caf1d0f960dcb63
d61b4871ed778b5a7df932ea47a493eff886c18c
/8. ++String to Integer.java
9d017a9389d4fbfb93ce8c8f18beaef16c67a0bf
[]
no_license
Laura1112/YanGu
065d53b490650ce36f6cd2378cf6589e0c852742
cfb2c3888f11d9041538f04a445053906749de4f
refs/heads/master
2021-01-21T10:05:02.894322
2017-03-31T08:24:10
2017-03-31T08:24:10
83,374,879
0
0
null
null
null
null
GB18030
Java
false
false
2,676
java
import java.util.Scanner; /** * mplement atoi to convert a string to an integer. * @author Laura * */ public class Solution { public int atoi(String str) { int max = 2147483647; int min = -2147483648; int result = 0; int len = str.length(); int start = -1; boolean neg = false; for (int i = 0; i < len; i++) { char ch = str.charAt(i); if (ch == '+' || ch == '-' || (ch >= '0' && ch <= '9')) { start = i; break; //break直接跳出for循环体!!!!! } else if (ch == ' ') { } else { break; } } if (start == -1) return 0; if (str.charAt(start) == '-' || str.charAt(start) == '+') { if (str.charAt(start) == '-') neg = true; start++; } for (int i = start; i < len; i++) { char ch = str.charAt(i); char next = 0; if (i + 1 < len) next = str.charAt(i + 1); if (ch < '0' || ch > '9') break; result = 10 * result + (ch - '0'); if (next >= '0' && next <= '9') { if (result > max / 10) { if (neg) return min; else return max; } if (result == max / 10) { if (neg) { if (next - '0' >= 8) return min; else return -1 * (10 * result + (next - '0')); } else { if (next - '0' >= 7) return max; else return 10 * result + (next - '0'); } } } } if (neg) result = -result; return result; } public static void main(String[] args) { System.out.println(new Solution().atoi(" -1010023630")); System.out.println(new Solution().atoi(" -1010023630o4")); System.out.println(new Solution().atoi(" 10522545459")); System.out.println(new Solution().atoi(" 123")); System.out.println(new Solution().atoi(" -123")); System.out.println(new Solution().atoi(" +123")); System.out.println(new Solution().atoi(" -1234bbsf3")); System.out.println(new Solution().atoi(" 2147483646")); System.out.println(new Solution().atoi(" 2147483647")); System.out.println(new Solution().atoi(" 2147483648")); System.out.println(new Solution().atoi(" 2147483649")); System.out.println(new Solution() .atoi(" 11111111111111111111111111111111111111111111111111")); System.out.println(new Solution().atoi(" -2147483647")); System.out.println(new Solution().atoi(" -2147483648")); System.out.println(new Solution().atoi(" -2147483649")); System.out.println(new Solution() .atoi(" -11111111111111111111111111111111111111111111111111")); System.out.println(new Solution().atoi("0")); System.out.println(new Solution().atoi("abc")); } }
6b8d2e87c4674dcb61883556898a1f41dc6951cb
bb7154ebde63eee7585503e9e253be3ac9c87024
/src/main/java/com/dili/ia/domain/dto/LeaseRefundOrderDto.java
2d9a99725a10653467c93058da7c28e3b47e9ba9
[]
no_license
sengeiou/intelligent-assets
848be5076986e63f57888cdc0b344e17a0f13aab
824149c6283762f5d2bc4adeee22ecd9f2bc6e57
refs/heads/master
2023-05-06T07:11:53.667225
2021-03-03T07:58:31
2021-03-03T07:58:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,502
java
package com.dili.ia.domain.dto; import com.dili.ia.domain.RefundFeeItem; import com.dili.ia.domain.RefundOrder; import com.dili.ss.domain.annotation.Like; import com.dili.ss.domain.annotation.Operator; import javax.persistence.Column; import javax.persistence.Transient; import java.time.LocalDateTime; import java.util.List; public class LeaseRefundOrderDto extends RefundOrder { @Column(name = "`create_time`") @Operator(Operator.GREAT_EQUAL_THAN) private LocalDateTime createdStart; @Column(name = "`create_time`") @Operator(Operator.LITTLE_EQUAL_THAN) private LocalDateTime createdEnd; @Operator(Operator.IN) @Column(name = "code") private List<String> codes; /** * 昵称模糊查询 * @return */ @Column(name = "customer_name") @Like private String likeCustomerName; @Operator(Operator.IN) @Column(name = "id") private List<Long> ids; //业务退款项 private List<RefundFeeItem> refundFeeItems; @Transient private LocalDateTime exitTime; @Transient private String logContent; public LocalDateTime getCreatedStart() { return createdStart; } public void setCreatedStart(LocalDateTime createdStart) { this.createdStart = createdStart; } public LocalDateTime getCreatedEnd() { return createdEnd; } public void setCreatedEnd(LocalDateTime createdEnd) { this.createdEnd = createdEnd; } public List<String> getCodes() { return codes; } public void setCodes(List<String> codes) { this.codes = codes; } public String getLikeCustomerName() { return likeCustomerName; } public void setLikeCustomerName(String likeCustomerName) { this.likeCustomerName = likeCustomerName; } public List<Long> getIds() { return ids; } public void setIds(List<Long> ids) { this.ids = ids; } public List<RefundFeeItem> getRefundFeeItems() { return refundFeeItems; } public void setRefundFeeItems(List<RefundFeeItem> refundFeeItems) { this.refundFeeItems = refundFeeItems; } public LocalDateTime getExitTime() { return exitTime; } public void setExitTime(LocalDateTime exitTime) { this.exitTime = exitTime; } public String getLogContent() { return logContent; } public void setLogContent(String logContent) { this.logContent = logContent; } }
876399e70f2183e3f911cda1d734dbcd76528e49
5d61b91a863974b27374dca8456ad6d47454a4f1
/src/main/java/com/grandpasbrewing/beerxml/version1/enums/MiscType.java
f49c5cd4c8e6c8246d94af74f202749f2e89dff0
[]
no_license
AgilitySolutions/GrandpasBrewing
3ed000f5d4520814fcea81571924f65054769545
0fad4c9b481c0e22ba69d8ef61634c191112c430
refs/heads/master
2020-12-24T06:04:10.857690
2016-07-22T19:38:00
2016-07-22T19:38:00
32,343,077
0
0
null
2016-03-18T17:53:08
2015-03-16T17:58:45
Groovy
UTF-8
Java
false
false
673
java
package com.grandpasbrewing.beerxml.version1.enums; public enum MiscType { Spice("Spice"), Fining("Fining"), WaterAgent("Water Agent"), Herb("Herb"), Flavor("Flavor"), Other("Other"); MiscType(String description) { _description = description; } private final String _description; public String getDescription() { return _description; } public static MiscType fromDescription(String description) { for (MiscType miscType : MiscType.values()) { if (miscType.getDescription().equals(description)) { return miscType; } } return null; } }
c8cc43c27dcd2d150173534332d1e9b80289e378
bbb02f56afecb905ae4a04d4303c76d2e1c59430
/SGXEngine/src/com/socialgx/GaphEngine/VKApi/CustomVK/LikesInfoGX.java
a620f2df1bc9b899777ccf9adfb79c0a36dabc3b
[]
no_license
zaurkadiev/SGX
503347aaecc0e3f2a7124b683c922885ee825619
1ebbd8976804693a182bfb52593c582ca8975fba
refs/heads/master
2022-12-31T02:46:28.270232
2019-07-11T11:39:54
2019-07-11T11:39:54
160,588,203
0
0
null
2022-12-13T20:48:25
2018-12-05T22:46:46
Java
UTF-8
Java
false
false
2,119
java
package com.socialgx.GaphEngine.VKApi.CustomVK; import com.google.gson.annotations.SerializedName; import java.util.Objects; /** * Created by zaurmac on 2/1/17. */ public class LikesInfoGX { @SerializedName("count") private Integer count; @SerializedName("user_likes") private Integer userLikes; @SerializedName("can_like") private Integer canLike; @SerializedName("can_publish") private Integer canPublish; public LikesInfoGX() { } public Integer getCount() { return this.count; } public Integer getUserLikes() { return this.userLikes; } public Integer getCanLike() { return this.canLike; } public Integer getCanPublish() { return this.canPublish; } public int hashCode() { return Objects.hash(new Object[]{this.canLike, this.count, this.canPublish, this.userLikes}); } public boolean equals(Object o) { if(this == o) { return true; } else if(o != null && this.getClass() == o.getClass()) { LikesInfoGX likesInfo = (LikesInfoGX)o; return Objects.equals(this.count, likesInfo.count) && Objects.equals(this.userLikes, likesInfo.userLikes) && Objects.equals(this.canLike, likesInfo.canLike) && Objects.equals(this.canPublish, likesInfo.canPublish); } else { return false; } } public String toString() { StringBuilder sb = new StringBuilder("LikesInfo{"); sb.append("count=").append(this.count); sb.append(", userLikes=").append(this.userLikes); sb.append(", canLike=").append(this.canLike); sb.append(", canPublish=").append(this.canPublish); sb.append('}'); return sb.toString(); } public void setCanLike(Integer canLike) { this.canLike = canLike; } public void setCanPublish(Integer canPublish) { this.canPublish = canPublish; } public void setCount(Integer count) { this.count = count; } public void setUserLikes(Integer userLikes) { this.userLikes = userLikes; } }
84062b5de3e676d4b3d51eb687b1349bfea5340e
cf7c2c404a96366c30ace077433fc239ddcd4451
/certificate6600/src/main/java/softwork/service/Impl/CertificateImpl.java
37e8265073e55e410976180bf2ac7bf6adf1dfef
[]
no_license
Dong351/softwork
d86ffc7d91239c905d2b32d9071a2f501f35a4bf
caac399808ea3aeb89f1f4122ffea5374babf2d7
refs/heads/master
2023-01-24T10:39:50.588210
2020-12-07T12:21:12
2020-12-07T12:21:12
306,874,492
1
0
null
null
null
null
UTF-8
Java
false
false
2,988
java
package softwork.service.Impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.SearchQuery; import org.springframework.stereotype.Service; import softwork.mapper.CertificateMapper; import softwork.mapper.CertificateRepository; import softwork.pojo.dto.PageDTO; import softwork.pojo.entities.Certificate; import softwork.service.CertificateService; import java.util.List; import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery; @Service public class CertificateImpl implements CertificateService { @Autowired CertificateMapper certificateMapper; @Autowired CertificateRepository certificateRepository; @Override public PageInfo getBaseInfo(PageDTO dto) { dto.setOrderBy(camelToUnderline(dto.getOrderBy())+ " " +dto.getOrderRule()); dto.setPageNum(dto.getPageNum()); PageHelper.startPage(dto); List<Certificate> list= certificateMapper.baseInfo(); PageInfo pageInfo = new PageInfo(list); return pageInfo; } private String camelToUnderline(String param) { if (param == null || "".equals(param.trim())) { return ""; } int len = param.length(); StringBuilder sb = new StringBuilder(len); for (int i = 0; i < len; i++) { char c = param.charAt(i); if (Character.isUpperCase(c)) { sb.append("_"); sb.append(Character.toLowerCase(c)); } else { sb.append(c); } } return sb.toString(); } @Override public Certificate getInfoByID(String id) { certificateMapper.addWatched(id); return certificateMapper.selectByPrimaryKey(id); } @Override public Page<Certificate> searchByKeyWord(String keyword, PageDTO dto) { Sort sort = Sort.by(Sort.Order.desc(camelToUnderline(dto.getOrderBy()))); if(dto.getOrderRule().toLowerCase().equals("asc")){ sort = Sort.by(Sort.Order.asc(dto.getOrderBy())); } PageRequest page = PageRequest.of(dto.getPageNum()-1,dto.getPageSize(),sort); //query设置 NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder() .withQuery(queryStringQuery("\""+keyword+"\"")) .withFields("id","name","office_web","enroll_start","enroll_end","contest_start","contest_end") .withPageable(page); SearchQuery searchQuery = queryBuilder.build(); Page<Certificate> certificatePage = certificateRepository.search(searchQuery); return certificatePage; } }
141f22fdf3cb880d4bf91cd704dbfbae9aaf8a44
75371302050fca003d81331bd43f93cc5d820c90
/tzsc2/src/main/java/com/yc/tzsc/service/UserService.java
87943975eca00e27a64cd2237b80b709f5073cf4
[]
no_license
zhangmengyao158/tzsc
6d63b0ef89634f8753da358b65ec5102cdf69b29
7afb4a96aa7d4045169a7f30d55056f3014ed42a
refs/heads/master
2021-01-23T10:57:55.861817
2017-06-02T01:28:16
2017-06-02T01:28:16
93,113,317
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.yc.tzsc.service; import com.yc.tzsc.entity.User; public interface UserService { User login(User user); boolean register(User user); User detal(User str); boolean modifyUser(User user); boolean modifyPassword(User user); }
04c6ad45d73a4e1ffa6181b168eaaf2293f1b7af
74391d194ae4eef5e7c79b13f0c71135405e7412
/hr-worker/src/main/java/com/robertocarneiro/hrworker/resources/WorkerResource.java
9443fcd40b910f97ee5a0ffce6573e94862c11fd
[]
no_license
robertocarneiro7/ms-course
2b3f5834fae9606b9fe829a9d1453062346fc0c9
c6cf98158f464f0fcf99821ff0a0ac4f84f0c727
refs/heads/master
2023-03-31T00:50:31.795174
2021-04-05T13:35:35
2021-04-05T13:35:35
350,817,812
0
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package com.robertocarneiro.hrworker.resources; import com.robertocarneiro.hrworker.entities.Worker; import com.robertocarneiro.hrworker.services.WorkerService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/workers") @RequiredArgsConstructor @Slf4j public class WorkerResource { private final WorkerService service; private final Environment env; @GetMapping public List<Worker> findAll() { return service.findAll(); } @GetMapping("/{id}") public Worker findById(@PathVariable Long id) { log.info("PORT = " + env.getProperty("local.server.port")); return service.findById(id); } }
da843856507dbed5442acf47167ffcb3618c29e2
5e34c548f8bbf67f0eb1325b6c41d0f96dd02003
/dataset/smallest_6aaeaf2f_001/mutations/33/smallest_6aaeaf2f_001.java
fdf668d23f31adc7c81e581ab814ac22f2177d77
[]
no_license
mou23/ComFix
380cd09d9d7e8ec9b15fd826709bfd0e78f02abc
ba9de0b6d5ea816eae070a9549912798031b137f
refs/heads/master
2021-07-09T15:13:06.224031
2020-03-10T18:22:56
2020-03-10T18:22:56
196,382,660
1
1
null
2020-10-13T20:15:55
2019-07-11T11:37:17
Java
UTF-8
Java
false
false
2,023
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class smallest_6aaeaf2f_001 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { smallest_6aaeaf2f_001 mainClass = new smallest_6aaeaf2f_001 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj int1 = new IntObj (), int2 = new IntObj (), int3 = new IntObj (), int4 = new IntObj (), tmp = new IntObj (); output += (String.format ("Please enter 4 numbers separated by spaces > ")); int1.value = scanner.nextInt (); int2.value = scanner.nextInt (); int3.value = scanner.nextInt (); int4.value = scanner.nextInt (); tmp.value = int1.value; if (int1.value > int2.value) { tmp.value = int2.value; } else if (tmp.value > int3.value) { tmp.value = int3.value; } else if (tmp.value > int4.value) { tmp.value = int4.value; } output += (String.format ("%d is the smallest\n", int3.value)); if (true) return;; } }
ec04b4bc162a5e0c2f529106427c69478534f020
b14b3937b70efbf97b1e9bde57e2f5d642a8e76e
/src/main/java/com/vm/app/util/AwsS3Api.java
ef69be1e92f78f7f2bc509f9661c3744c618a21c
[]
no_license
mmzh/s3-video-uploader
91bb7926fba55223e79b8b80aeaebab6bc5e844d
c12c57d0b77ae1671c0d51812dc6b420ab77eb4a
refs/heads/master
2021-07-22T13:36:34.365512
2017-10-31T01:23:17
2017-10-31T01:23:17
107,928,816
0
0
null
null
null
null
UTF-8
Java
false
false
4,898
java
package com.vm.app.util; import java.io.File; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.FilenameUtils; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.ListObjectsV2Request; import com.amazonaws.services.s3.model.ListObjectsV2Result; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.S3ObjectSummary; import com.vm.app.service.AWSS3Service; import com.vm.app.model.Video; import com.vm.app.util.typeConverter; /** * <h1>AwsS3Api class for upload and list files on s3 bucket</h1> * * @author Ming M Zheng * @version 1.0 * @since 2017-10-21 */ public class AwsS3Api { private String awsKey; private String awsSecret; private String awsRegion; private String awsBucket; private String awsBaseurl; private String awsLocalpath; public AmazonS3 s3client; public AwsS3Api(HashMap<String, String> aws) { this.awsKey = aws.get("awsKey"); this.awsSecret = aws.get("awsSecret"); this.awsRegion = aws.get("awsRegion"); this.awsBucket = aws.get("awsBucket"); this.awsBaseurl = aws.get("awsBaseurl"); this.awsLocalpath = aws.get("awsLocalpath"); s3client = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(this.awsKey, this.awsSecret))) .withRegion(this.awsRegion).build(); } /** * This method is used to transfer local file into s3 bucket. * * @param file * This is first parameter which represents local file name in String * format * @param vinfo * This is second parameter, a serialized data that contains basic * video information * @param orinName * This is third parameter, * @return String, a url link to s3 file location. * @see IOException */ public String putfile(String file, String vinfo, String orinName) throws IOException { AWSS3Service awsService = new AWSS3Service(s3client); // uploading object ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.addUserMetadata("orin-name", orinName); objectMetadata.addUserMetadata("detail", vinfo); awsService.putObject(awsBucket, file, new File(awsLocalpath + file), objectMetadata); String url = awsBaseurl + file; return url; } /** * This method is used to list file on s3 bucket * * @return ArrayList, a list contains video objects * @see ParseException */ public ArrayList<Video> listObjects() throws ParseException { final ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(awsBucket).withMaxKeys(12); ListObjectsV2Result result; ArrayList<Video> videos = new ArrayList<Video>(); do { result = s3client.listObjectsV2(req); for (S3ObjectSummary objectSummary : result.getObjectSummaries()) { Map<String, String> vinfo = getObjectInfo(objectSummary.getKey()); Video v = new Video(); v.setName(FilenameUtils.removeExtension(vinfo.get("orin-name"))); v.setS3url(awsBaseurl + objectSummary.getKey()); v.setSize(typeConverter.getReadableSize(objectSummary.getSize() + "")); v.setDate(typeConverter.shiftTimeZone(objectSummary.getLastModified())); v.setHlsurl(getHlsFormat(objectSummary.getKey())); if (vinfo.get("detail") != null) v.setDetail(vinfo.get("detail").replace("||", "; ").replace("_", " ").replace("=", ": ")); videos.add(v); } req.setContinuationToken(result.getNextContinuationToken()); } while (result.isTruncated() == true); return videos; } /** * This method is used to retrieve file's meta information from s3 * * @param key * This is first parameter, represent file name in s3 bucket * @return Map, return key and value pairs of file meta information */ public Map<String, String> getObjectInfo(String key) { ObjectMetadata objectMetadata = s3client.getObjectMetadata(awsBucket, key); Map<String, String> userMetadataMap = objectMetadata.getUserMetadata(); return userMetadataMap; } /** * * @param key * file name on s3 * @return boolean */ public String getHlsFormat(String key) { String fname = "hls/" + FilenameUtils.removeExtension(key) + ".ts"; if (s3client.doesObjectExist("plpm", fname)) return (getHlsBaseUrl() + fname); else return "#"; } /** * no parameter * * @return String link to hls video format folder */ public String getHlsBaseUrl() { return "https://s3.amazonaws.com/plpm/"; } public String getHlsUrl(String key) { String fname = "hls/" + FilenameUtils.removeExtension(key) + ".ts"; return "https://s3.amazonaws.com/plpm/" + fname; } }
5a41cc655dd93e6d2b9e20814ef6b5f019de7bf8
7a2c91813117a8d949571521510895ee53daad49
/src/main/java/com/alipay/api/domain/AntMerchantExpandIndirectActivityCreateModel.java
1829fb32c0fbae923bb89e07bf1d9bf6441c3e94
[ "Apache-2.0" ]
permissive
dut3062796s/alipay-sdk-java-all
eb5afb5b570fb0deb40d8c960b85a01d13506568
559180f4c370f7fcfef67a1c559768d11475c745
refs/heads/master
2020-07-03T21:00:06.124387
2019-06-23T01:13:43
2019-06-23T01:13:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,859
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 间联商户运营活动报名接口 * * @author auto create * @since 1.0, 2018-12-29 11:01:33 */ public class AntMerchantExpandIndirectActivityCreateModel extends AlipayObject { private static final long serialVersionUID = 1613566542484329175L; /** * 活动类型,间连商户报名的支付宝活动类型。 蓝海行动:BLUE_SEA 特殊行业优惠费率:INDUSTRY_SPECIAL */ @ApiField("activity_type") private String activityType; /** * 商户简称,门头照的名称或者大众点评、美团、饿了么、口碑、百度外卖入驻平台名称。需和进件时别名保持一致。 */ @ApiField("alias_name") private String aliasName; /** * 银行卡信息。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("bank_account") private BankCardInfo bankAccount; /** * 营业执照,要求营业执照文本信息清晰可见。 请上传照片OSSKey(参见应用场景说明)。 蓝海行动必传。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("business_license_pic") private String businessLicensePic; /** * 证明文件图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("certificate_file") private String certificateFile; /** * 收费样本。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("charge_sample") private String chargeSample; /** * 收银台照片 请上传照片OSSKey(参见应用场景说明)。 蓝海活动必须包含:①主扫:扫码支付场景需要展示具有支付宝logo和“推荐使用支付宝 或 支付就用支付宝”露出的二维码物料或立牌;②被 扫:展示具有支付宝logo和推荐使用支付宝 或 支付就用支付宝”的扫码机具(盒子 ) 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("checkstand_pic") private String checkstandPic; /** * 照会。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("diplomatic_note") private String diplomaticNote; /** * 店内环境照,要求照片清晰可见。 请上传照片OSSKey(参见应用场景说明)。 蓝海活动必传。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("indoor_pic") private String indoorPic; /** * 事业单位法人证书图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("institutional_organization_pic") private String institutionalOrganizationPic; /** * 法人身份证图片。需上传包含正反面的法人身份证图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("legal_person_pic") private String legalPersonPic; /** * 法人登记证书图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("legal_person_registration_pic") private String legalPersonRegistrationPic; /** * 医疗执业许可证图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("medical_instrument_practice_license_pic") private String medicalInstrumentPracticeLicensePic; /** * 商户名称,营业执照上的名称,需和进件名称保持一致。 */ @ApiField("name") private String name; /** * 组织机构代码证图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("org_cert_pic") private String orgCertPic; /** * 民办非企业单位登记证书图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("private_nonenterprise_units") private String privateNonenterpriseUnits; /** * 办学资质图片。 请上传照片OSSKey(参见应用场景说明)。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("run_school_license_pic") private String runSchoolLicensePic; /** * 主流餐饮平台入驻证明(任选一个即可):大众点评、美团、饿了么、口碑、百度外卖餐饮平台商户展示页面。 请上传照片OSSKey(参见应用场景说明)。 蓝海活动必传。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("settled_pic") private String settledPic; /** * 门头照。 请上传照片OSSKey(参见应用场景说明)。 蓝海行动必传。 特殊行业,请参见<a href="https://docs.open.alipay.com/10933">间连特殊行业上传资质</a> */ @ApiField("shop_entrance_pic") private String shopEntrancePic; /** * 商户在支付宝入驻成功后,生成的支付宝内全局唯一的商户编号 */ @ApiField("sub_merchant_id") private String subMerchantId; public String getActivityType() { return this.activityType; } public void setActivityType(String activityType) { this.activityType = activityType; } public String getAliasName() { return this.aliasName; } public void setAliasName(String aliasName) { this.aliasName = aliasName; } public BankCardInfo getBankAccount() { return this.bankAccount; } public void setBankAccount(BankCardInfo bankAccount) { this.bankAccount = bankAccount; } public String getBusinessLicensePic() { return this.businessLicensePic; } public void setBusinessLicensePic(String businessLicensePic) { this.businessLicensePic = businessLicensePic; } public String getCertificateFile() { return this.certificateFile; } public void setCertificateFile(String certificateFile) { this.certificateFile = certificateFile; } public String getChargeSample() { return this.chargeSample; } public void setChargeSample(String chargeSample) { this.chargeSample = chargeSample; } public String getCheckstandPic() { return this.checkstandPic; } public void setCheckstandPic(String checkstandPic) { this.checkstandPic = checkstandPic; } public String getDiplomaticNote() { return this.diplomaticNote; } public void setDiplomaticNote(String diplomaticNote) { this.diplomaticNote = diplomaticNote; } public String getIndoorPic() { return this.indoorPic; } public void setIndoorPic(String indoorPic) { this.indoorPic = indoorPic; } public String getInstitutionalOrganizationPic() { return this.institutionalOrganizationPic; } public void setInstitutionalOrganizationPic(String institutionalOrganizationPic) { this.institutionalOrganizationPic = institutionalOrganizationPic; } public String getLegalPersonPic() { return this.legalPersonPic; } public void setLegalPersonPic(String legalPersonPic) { this.legalPersonPic = legalPersonPic; } public String getLegalPersonRegistrationPic() { return this.legalPersonRegistrationPic; } public void setLegalPersonRegistrationPic(String legalPersonRegistrationPic) { this.legalPersonRegistrationPic = legalPersonRegistrationPic; } public String getMedicalInstrumentPracticeLicensePic() { return this.medicalInstrumentPracticeLicensePic; } public void setMedicalInstrumentPracticeLicensePic(String medicalInstrumentPracticeLicensePic) { this.medicalInstrumentPracticeLicensePic = medicalInstrumentPracticeLicensePic; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getOrgCertPic() { return this.orgCertPic; } public void setOrgCertPic(String orgCertPic) { this.orgCertPic = orgCertPic; } public String getPrivateNonenterpriseUnits() { return this.privateNonenterpriseUnits; } public void setPrivateNonenterpriseUnits(String privateNonenterpriseUnits) { this.privateNonenterpriseUnits = privateNonenterpriseUnits; } public String getRunSchoolLicensePic() { return this.runSchoolLicensePic; } public void setRunSchoolLicensePic(String runSchoolLicensePic) { this.runSchoolLicensePic = runSchoolLicensePic; } public String getSettledPic() { return this.settledPic; } public void setSettledPic(String settledPic) { this.settledPic = settledPic; } public String getShopEntrancePic() { return this.shopEntrancePic; } public void setShopEntrancePic(String shopEntrancePic) { this.shopEntrancePic = shopEntrancePic; } public String getSubMerchantId() { return this.subMerchantId; } public void setSubMerchantId(String subMerchantId) { this.subMerchantId = subMerchantId; } }
79ac6651700eb87ebba54010721c46c519a9f0aa
cd0e7961250d1c7fbd11a40b7289b6f11c6bbddd
/src/meteocal-ejb/src/main/java/com/meteocal/business/exceptions/NotFoundException.java
52785aeee879a6438533ac99d61870f29484f2b7
[]
no_license
sengeiou/meteocal-bignoli-cella
b9bfae0efff22d1d58e4773b2c0fc9e50efc048d
49fc1591ddb902a0b2b69c8a83d26d2a6881bd41
refs/heads/master
2022-12-24T17:03:42.576302
2017-06-17T15:02:06
2017-06-17T15:02:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,085
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.meteocal.business.exceptions; /** * * @author Andrea Bignoli */ public class NotFoundException extends BusinessException { public static final String EVENT_NOT_FOUND = "[DATABASE QUERY] The requested event doesn't exist in the database"; public static final String USER_NOT_FOUND = "[DATABASE QUERY] The requested user doesn't exist in the database"; public static final String GENERIC_NOT_FOUND = "[DATABASE QUERY] The requested entity doesn't exist in the database"; /** * Creates a new instance of <code>NotFound</code> without detail message. */ public NotFoundException() { } /** * Constructs an instance of <code>NotFound</code> with the specified detail * message. * * @param msg the detail message. */ public NotFoundException(String msg) { super(msg); } }
416839fe69fc756670e2c154fde064f78dba05b4
2c26ebd51d37b86bbf18aa2098be1a6781dffb87
/src/main/java/info/masterfrog/pixelcat/engine/exception/TransientGameException.java
edbbbf11092065ac9201460d3e8ce9b2b897a4a9
[]
no_license
rpmurray/pixelcat-engine
c10288d799b5dd17d0cd66d766ac7e40081da9d9
b24aa57bb20f8b1aab7197c68243def6ae95f3d0
refs/heads/master
2020-05-30T03:46:35.618540
2016-11-19T21:18:34
2016-11-19T21:18:34
27,014,241
0
0
null
2016-10-07T21:33:32
2014-11-22T22:11:58
Java
UTF-8
Java
false
false
1,351
java
package info.masterfrog.pixelcat.engine.exception; public class TransientGameException extends GameException { public TransientGameException(GameErrorCode errorCode, String details, Object data, Throwable cause) { super(errorCode, details, data, cause); } public TransientGameException(GameErrorCode errorCode, Object data, Throwable cause) { super(errorCode, null, data, cause); } public TransientGameException(GameErrorCode errorCode, String details, Throwable cause) { super(errorCode, details, null, cause); } public TransientGameException(GameErrorCode errorCode, String details, Object data) { super(errorCode, details, data, null); } public TransientGameException(GameErrorCode errorCode, Throwable cause) { super(errorCode, null, null, cause); } public TransientGameException(GameErrorCode errorCode, Object data) { super(errorCode, null, data, null); } public TransientGameException(GameErrorCode errorCode, String details) { super(errorCode, details, null, null); } public TransientGameException(GameErrorCode errorCode) { super(errorCode, null, null, null); } @Override public String toString() { return "TransientGameException{" + toStringBase() + '}'; } }
67f9b5c46d962e9fbaf200b613fb420a6186a882
b48f7fee57c532dd6e02f58d1fb4f3232662d2b0
/winter-framework/src/main/java/de/uni_mannheim/informatik/dws/winter/matrices/matcher/BestChoiceMatching.java
94363ad4987f998175173ca65e781c3e8e5b65e0
[ "Apache-2.0" ]
permissive
olehmberg/winter
9fd0bccdec57b04bef1e3271748e1add4ee08456
9715392e6b9069a484eb3a99813538c7584277ee
refs/heads/master
2022-05-27T12:39:43.778646
2021-12-17T11:21:54
2021-12-17T11:21:54
88,765,628
113
38
Apache-2.0
2022-05-20T20:48:08
2017-04-19T16:16:31
Java
UTF-8
Java
false
false
3,388
java
/* * Copyright (c) 2017 Data and Web Science Group, University of Mannheim, Germany (http://dws.informatik.uni-mannheim.de/) * * 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.uni_mannheim.informatik.dws.winter.matrices.matcher; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Set; import de.uni_mannheim.informatik.dws.winter.matrices.SimilarityMatrix; /** * Greedy approach that selects the best stable match for each instance of the first dimension * @author Oliver * */ public class BestChoiceMatching extends MatrixMatcher { private boolean forceOneToOneMapping = true; public boolean isForceOneToOneMapping() { return forceOneToOneMapping; } public void setForceOneToOneMapping(boolean forceOneToOneMapping) { this.forceOneToOneMapping = forceOneToOneMapping; } public <T extends Comparable<? super T>> SimilarityMatrix<T> match(SimilarityMatrix<T> input) { SimilarityMatrix<T> sim = getSimilarityMatrixFactory().createSimilarityMatrix(input.getFirstDimension().size(), input.getSecondDimension().size()); Set<T> alreadyMatched = new HashSet<T>(); // order all items so that we get consistent results in cases where the score is equal ArrayList<T> dimension = new ArrayList<>(input.getFirstDimension()); Collections.sort(dimension); for(T instance : dimension) { double max = 0.0; T best = null; ArrayList<T> matches = new ArrayList<>(input.getMatches(instance)); Collections.sort(matches); // determine best match for(T candidate : matches) { if(!alreadyMatched.contains(candidate) && input.get(instance, candidate)>max) { max = input.get(instance, candidate); best = candidate; } } // make sure instance is also the best match for candidate (i.e. is this a stable pair) for(T instance2 : input.getFirstDimension()) { if(instance2!=instance && !alreadyMatched.contains(instance2) && input.get(instance2, best)!=null && input.get(instance2, best)>max) { best = null; break; } } // if we found a stable pair if(best!=null) { sim.set(instance, best, max); if(isForceOneToOneMapping()) { alreadyMatched.add(instance); alreadyMatched.add(best); } } } return sim; } }
49f30445a3ee9eb69cf9dd8ef70ed6eaa57563e9
22e9aae293443a93d04192f9510bb6585c1f77c3
/express2/express-client/src/main/java/express/Client/Client.java
91bf13bbaa57605dc27f072aee6189f8d728bb60
[]
no_license
Goldenbullet/presentationCODE
212ff5abe50ac5eb1b3406f4d4f542ce50e6483c
e5f172e1e95d8a3e646a02a9c50527285d959f93
refs/heads/master
2021-01-10T16:42:45.447261
2015-12-08T16:56:17
2015-12-08T16:56:17
46,796,185
0
0
null
null
null
null
UTF-8
Java
false
false
5,567
java
//package express.Client; // // //import java.awt.CardLayout; //import java.awt.Color; //import java.awt.Frame; //import java.awt.event.ActionEvent; //import java.awt.event.ActionListener; //import java.awt.event.MouseEvent; //import java.awt.event.MouseListener; // //import javax.swing.JButton; //import javax.swing.JFrame; //import javax.swing.JLabel; //import javax.swing.JPanel; // //import express.presentation.mainUI.MainUI; //import express.presentation.mainUI.MainUIService; //import express.presentation.managerUI.managerLogUI; //import express.presentation.managerUI.managerMenuUI; //import express.presentation.userUI.SignInUI; // //public class Client extends JFrame{ // private SignInUI signin; // private CardLayout card; // private JPanel container; // private MainUIService main; // // public Client(){ // // this.setLayout(null); // container = new JPanel(); // container.setBounds(0,0,400,400); //// this.setContentPane(container); // card= new CardLayout(); // container.setLayout(card); // // main = new MainUI(card,container); // signin = new SignInUI(main); // this.add(container); // container.add("signin", signin); // card.show(container, "signin"); // // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // this.setSize(400, 400); // this.setVisible(true); // } // // public static void main(String[] args) { // // TODO Auto-generated method stub // // new Client(); // // } // //} /* AdminBLService adminservice = new AdminBLService_stub("卢海龙","1001001",UserRole.DeliverMan,"123456"); AdminBLService_Driver admindriver = new AdminBLService_Driver(); admindriver.drive(adminservice); ExamDocumentBLService examdocumentservice = new ExamdocumentBL_stub(new DocumentListVO()); ExamDocumentBLService_Driver examdriver = new ExamDocumentBLService_Driver(); examdriver.drive(examdocumentservice); ArrayList<LogVO> log = new ArrayList<LogVO>(); SyslogBLService sysloservice = new SyslogBLService_stub(log); SyslogBLService_Driver syslodriver = new SyslogBLService_Driver(); syslodriver.drive(sysloservice); // AdjustRepoBLService adjustRepoBLService=new AdjustRepoBLService_stub(); AdjustRepoBLService_Driver adjustRepo=new AdjustRepoBLService_Driver(); adjustRepo.drive(adjustRepoBLService); BankAccountBLService bankAccountBLService=new BankAccountBLService_stub(null); BankAccountBLService_Driver bankAccount=new BankAccountBLService_Driver(); bankAccount.drive(bankAccountBLService); InventoryRepoBLService inventoryRepoBLService=new InventoryRepoBLService_stub(null); InventoryRepoBLService_Driver inventory=new InventoryRepoBLService_Driver(); inventory.drive(inventoryRepoBLService); PaymentBLService paymentBLService=new PaymentBLService_stub(null); PaymentBLService_Driver payment=new PaymentBLService_Driver(); payment.drive(paymentBLService); ScanRepoBLService scanRepoBLService=new ScanRepoBLService_stub(null); ScanRepoBLService_Driver scanRepo=new ScanRepoBLService_Driver(); scanRepo.drive(scanRepoBLService); StatisticFinancialBLService statisticFinancialBLservice=new StatisticFinancialBLservice_stub(null, null, null, null); StatisticFinancialBLService_Driver statisticFinancial=new StatisticFinancialBLService_Driver(); statisticFinancial.drive(statisticFinancialBLservice); StatisticManagerBLService statisticManagerBLService=new StatisticManagerBLService_stub(null,null,null,null); StatisticManagerBLService_Driver statisticManager=new StatisticManagerBLService_Driver(); statisticManager.drive(statisticManagerBLService); InnerAccountBLService innerAccountBLService=new InnerAccountBLService_stub(); InnerAccountBLService_Driver innerAccountBL=new InnerAccountBLService_Driver(); innerAccountBL.drive(innerAccountBLService); //Lu Hailong BusinessSaleArrivalDocumentblService arrivalDocservice=new BusinessSaleArrivalDocumentblService_stub("","","","",null); BusinessSaleArrivalDocumentblService_Driver arrivalDocdriver=new BusinessSaleArrivalDocumentblService_Driver(); arrivalDocdriver.drive(arrivalDocservice); BusinessSaleDeliverDocumentblService deliverDocservice=new BusinessSaleDeliverDocumentblService_stub(null, null, null); BusinessSaleDeliverDocumentblService_Driver deliverDocdriver=new BusinessSaleDeliverDocumentblService_Driver(); deliverDocdriver.drive(deliverDocservice); BusinessSaleReceiveDocumentblService receiveDocservice=new BusinessSaleReceiveDocumentblService_stub(null, 0, null, null); BusinessSaleReceiveDocumentblService_Driver receiveDocdriver=new BusinessSaleReceiveDocumentblService_Driver(); receiveDocdriver.drive(receiveDocservice); BusinessSaleShipmentDocumentblService shipmentDocservice=new BusinessSaleShipmentDocumentblService_stub(null, null, null, null, null, null, null, null, 0); BusinessSaleShipmentDocumentblService_Driver shipmentDocdriver =new BusinessSaleShipmentDocumentblService_Driver(); shipmentDocdriver.drive(shipmentDocservice); DriverBusinessSaleblService driverservice=new DriverBusinessSaleblService_stub(null, null, null); DriverBusinessSaleblService_Driver driverdriver=new DriverBusinessSaleblService_Driver(); driverdriver.drive(driverservice); VehicleBusinessSaleblService vehicleservice =new VehicleBusinessSaleblService_stub(null, null); VehicleBusinessSaleblService_Driver vehicledriver=new VehicleBusinessSaleblService_Driver(); vehicledriver.drive(vehicleservice); } }*/
87b1c4b3d2409007dc0d63044544f79d307f2bbb
54abefe33e96812e482ea75efaf2b035d3036f8f
/src/main/java/mb/amazul/siscad/utils/RacaCor.java
64bfd068b2e70917a60badd1081df523c7c406f3
[]
no_license
hamiltonvalerio/siscad
034a061c77b7f4b18eb23d7eab0497112f487669
a81d5be15f0db56da2e0d25b3b382acacc87ced4
refs/heads/master
2022-11-28T05:04:40.867787
2020-08-11T14:06:00
2020-08-11T14:06:00
286,755,541
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package mb.amazul.siscad.utils; public enum RacaCor { BRANCA(1,"Branca"), PRETA(2,"Preta"), AMARELA(3,"Amarela"), PARDA(4,"Parda"), INDIGENA(5,"Indígena"); private final int codigoracacor; private final String nome; private RacaCor(int codigoracacor, String nome) { this.codigoracacor = codigoracacor; this.nome = nome; } public String getCodigo() { return Integer.toString(codigoracacor); } public int getCodigoracacor() { return codigoracacor; } public String getNome() { return nome; } }
2cecce1d01ec4381bf9af01ac09bced2b4a7883a
3bbd6dd3db7be180a24eaffe29f011546ae1d361
/modules/dcc-commons/src/test/java/org/metaeffekt/dcc/commons/ant/PropertyEncodingTest.java
3919e0ceea54de2578407ff1e470ef5e42c5fe09
[ "Apache-2.0", "MIT" ]
permissive
org-metaeffekt/metaeffekt-dcc
bc2ba5c70f8ed17cac259db1f7081bdc874d2ce2
18c5fb053bf1d9814e73c5cea5e9155905e573de
refs/heads/master
2023-06-01T10:30:52.962780
2021-02-28T17:59:13
2021-02-28T17:59:13
70,954,885
0
0
Apache-2.0
2023-04-14T19:30:39
2016-10-14T23:51:04
Java
UTF-8
Java
false
false
3,240
java
/** * Copyright 2009-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.metaeffekt.dcc.commons.ant; import java.io.File; import java.io.IOException; import java.util.Properties; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.optional.PropertyFile; import org.apache.tools.ant.taskdefs.optional.PropertyFile.Entry; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.metaeffekt.core.common.kernel.ant.task.LoadPropertiesTask; public class PropertyEncodingTest { private Project project; @Before public void setUp() throws IOException { project = new Project(); project.setBaseDir(new File(".")); } @Test public void execute() throws IOException { final File originalFile = new File("src/test/resources/encoding/test.properties"); final File antTargetFile = new File("target/test/encoding/test-ant.properties"); final File javaTargetFile = new File("target/test/encoding/test-java.properties"); String testString = loadPropertyFile(originalFile); Assert.assertTrue(testString.endsWith("ÿ\u0152\u0153")); // write the file // the ant way PropertyFile propertyFile = new PropertyFile(); propertyFile.setProject(project); final Entry entry = propertyFile.createEntry(); entry.setKey("key"); entry.setValue(testString); final File targetFile = antTargetFile; targetFile.getParentFile().mkdirs(); propertyFile.setFile(targetFile); propertyFile.execute(); // load the file and compare String testStringAfterAntWrite = loadPropertyFile(antTargetFile); Assert.assertEquals(testString, testStringAfterAntWrite); // the conventional java ways Properties p = new Properties(); p.setProperty("key", testString); PropertyUtils.writeToFile(p, javaTargetFile, "test"); // load the java-generated file and compare String testStringAfterJavaWrite = loadPropertyFile(javaTargetFile); Assert.assertEquals(testString, testStringAfterJavaWrite); } public String loadPropertyFile(final File propertyFile) { project.setProperty("key", null); LoadPropertiesTask loadPropertiesTask = new LoadPropertiesTask(); loadPropertiesTask.setProject(project); loadPropertiesTask.setRootPropertyFile(propertyFile); loadPropertiesTask.execute(); String testString = project.getProperty("key"); System.out.println(testString); return testString; } }
eb96727d3c326029bc4d0a0d96f778c744f009ea
1f98eb3bf83f2dd0290368a61b53930ecabc7cc6
/Arquitectura-ejb/src/java/co/edu/uniminuto/arqSw/estampate/session/TemaFacade.java
b58ca469ff4e91ae6508712450aba1e57c259b2b
[]
no_license
jonathanfelipevargas/Arquitecturacorte2
d05800709a9c7586d443777bdd3a933a22810a32
c83a5550318057b024e956ee854878d138ea3412
refs/heads/master
2020-03-14T00:04:17.763287
2018-04-27T22:17:06
2018-04-27T22:17:06
131,348,827
0
0
null
null
null
null
UTF-8
Java
false
false
745
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package co.edu.uniminuto.arqSw.estampate.session; import co.edu.uniminuto.arqSw.estampate.entities.Tema; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author Jonathan */ @Stateless public class TemaFacade extends AbstractFacade<Tema> { @PersistenceContext(unitName = "Arquitectura-ejbPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public TemaFacade() { super(Tema.class); } }
79bf8086afb216cbc105dee387a6818c80317938
9158a13243bfee1a38113c9cf54824fc0c88e522
/app/src/main/java/com/utils/javenruan/tilerecyclerview/model/TestItem.java
e2c4c7a68706bac360440c3ce49d4678a660bf71
[]
no_license
FlareMars/TileRecyclerView
afffbe8e6b6ef6bd35530d53b0a0aaae0634552a
a3e0caf73a4f05e5f3108f1b6a48b509268d0fab
refs/heads/master
2021-01-20T18:23:38.264271
2016-08-15T03:56:17
2016-08-15T03:56:17
65,534,468
1
0
null
null
null
null
UTF-8
Java
false
false
1,811
java
package com.utils.javenruan.tilerecyclerview.model; import com.utils.javenruan.tilerecyclerview.library.AbstractDataItem; /** * Created by javenruan on 2016/8/11 */ public class TestItem implements AbstractDataItem { private int rowSpan; private int colSpan; private int level; private int index; private String name; private String avatarUrl; public TestItem(String name, String avatarUrl, int level, int index) { this.name = name; this.avatarUrl = avatarUrl; this.level = level; this.index = index; calculateSpan(); } private void calculateSpan() { switch (level) { case 0: rowSpan = 1; colSpan = 1; break; case 1: rowSpan = 2; colSpan = 2; break; case 2: rowSpan = 2; colSpan = 3; break; default: rowSpan = 1; colSpan = 1; break; } } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; calculateSpan(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAvatarUrl() { return avatarUrl; } public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } @Override public int getColumnSpan() { return colSpan; } @Override public int getRowSpan() { return rowSpan; } }
49ad24ccf8be0dd753fa513539dace4dd5d7e4db
81e941866052c898768c23da985e9642bf6cd185
/sport/src/main/java/network/StephenRequestMyCallback.java
6c4a72b29224fc5f7556c56a50632da6913d521f
[]
no_license
duboAndroid/PayAlibabaAndWeiXin
0093e8f2fbbaf7eaa995f20ab9d1bbd0d6905b37
6c92c5826b5d3909cc7aad1d019463824ea0dbfb
refs/heads/master
2020-03-22T11:20:48.219074
2018-07-09T07:01:39
2018-07-09T07:01:39
139,965,097
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package network; public abstract class StephenRequestMyCallback implements StephenRequestAsyncTask.RequestCallback { @Override public void onRequestPrepare() {} @Override public void onChangeProgress(int progress, int successFlag) {} @Override public void onCompleted(String returnMsg) {} @Override public boolean onCancel() { return false; } }
0a0e842662bcc93ce2dc1a0261ce12875b1f3ac6
1c5e8605c1a4821bc2a759da670add762d0a94a2
/src/dahua/fdc/basedata/app/AbstractContractTypeF7UIHandler.java
1d41606f8f6f7346f424df618c687b3b6b10567a
[]
no_license
shxr/NJG
8195cfebfbda1e000c30081399c5fbafc61bb7be
1b60a4a7458da48991de4c2d04407c26ccf2f277
refs/heads/master
2020-12-24T06:51:18.392426
2016-04-25T03:09:27
2016-04-25T03:09:27
19,804,797
0
3
null
null
null
null
UTF-8
Java
false
false
403
java
/** * output package name */ package com.kingdee.eas.fdc.basedata.app; import com.kingdee.bos.Context; import com.kingdee.eas.framework.batchHandler.RequestContext; import com.kingdee.eas.framework.batchHandler.ResponseContext; /** * output class name */ public abstract class AbstractContractTypeF7UIHandler extends com.kingdee.eas.fdc.basedata.app.ContractTypeListUIHandler { }
6723f19eb9f227c98ea6ff81c8e5f27acddaae6e
b6934e218440f28511ebe3d4440e458dec880e83
/target/generated-sources/annotations/com/bin/jmc/samples/stringcontract/generated/StringDemo_stringBuildAdd_jmhTest.java
e1690d128aa55ef757a3498258aef504b779462d
[ "Apache-2.0" ]
permissive
liojian198/jmh-jctools
1a2a289a5eac863873bf6ca1fc2c7d509a757c29
0521601954b91f69a17e083d7c16d24ada014c4d
refs/heads/master
2022-11-21T00:53:55.765572
2020-07-16T15:10:12
2020-07-16T15:10:12
280,183,936
0
0
null
null
null
null
UTF-8
Java
false
false
16,642
java
package com.bin.jmc.samples.stringcontract.generated; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.Collection; import java.util.ArrayList; import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.CompilerControl; import org.openjdk.jmh.runner.InfraControl; import org.openjdk.jmh.infra.ThreadParams; import org.openjdk.jmh.results.BenchmarkTaskResult; import org.openjdk.jmh.results.Result; import org.openjdk.jmh.results.ThroughputResult; import org.openjdk.jmh.results.AverageTimeResult; import org.openjdk.jmh.results.SampleTimeResult; import org.openjdk.jmh.results.SingleShotResult; import org.openjdk.jmh.util.SampleBuffer; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.results.RawResults; import org.openjdk.jmh.results.ResultRole; import java.lang.reflect.Field; import org.openjdk.jmh.infra.BenchmarkParams; import org.openjdk.jmh.infra.IterationParams; import org.openjdk.jmh.infra.Blackhole; import org.openjdk.jmh.infra.Control; import org.openjdk.jmh.results.ScalarResult; import org.openjdk.jmh.results.AggregationPolicy; import org.openjdk.jmh.runner.FailureAssistException; import com.bin.jmc.samples.stringcontract.generated.StringDemo_jmhType; public final class StringDemo_stringBuildAdd_jmhTest { boolean p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015; boolean p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031; boolean p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047; boolean p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063; boolean p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079; boolean p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095; boolean p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111; boolean p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127; boolean p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143; boolean p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159; boolean p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175; boolean p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191; boolean p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207; boolean p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223; boolean p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239; boolean p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255; int startRndMask; BenchmarkParams benchmarkParams; IterationParams iterationParams; ThreadParams threadParams; Blackhole blackhole; Control notifyControl; public BenchmarkTaskResult stringBuildAdd_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { RawResults res = new RawResults(); StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control); control.preSetup(); control.announceWarmupReady(); while (control.warmupShouldWait) { l_stringdemo0_0.stringBuildAdd(); res.allOps++; } notifyControl.startMeasurement = true; stringBuildAdd_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_stringdemo0_0); notifyControl.stopMeasurement = true; control.announceWarmdownReady(); try { while (control.warmdownShouldWait) { l_stringdemo0_0.stringBuildAdd(); res.allOps++; } control.preTearDown(); } catch (InterruptedException ie) { control.preTearDownForce(); } if (control.isLastIteration()) { f_stringdemo0_0 = null; } res.allOps += res.measuredOps; int batchSize = iterationParams.getBatchSize(); int opsPerInv = benchmarkParams.getOpsPerInvocation(); res.allOps *= opsPerInv; res.allOps /= batchSize; res.measuredOps *= opsPerInv; res.measuredOps /= batchSize; BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps); results.add(new ThroughputResult(ResultRole.PRIMARY, "stringBuildAdd", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void stringBuildAdd_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, StringDemo_jmhType l_stringdemo0_0) throws Throwable { long operations = 0; long realTime = 0; result.startTime = System.nanoTime(); do { l_stringdemo0_0.stringBuildAdd(); operations++; } while(!control.isDone); result.stopTime = System.nanoTime(); result.realTime = realTime; result.measuredOps = operations; } public BenchmarkTaskResult stringBuildAdd_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { RawResults res = new RawResults(); StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control); control.preSetup(); control.announceWarmupReady(); while (control.warmupShouldWait) { l_stringdemo0_0.stringBuildAdd(); res.allOps++; } notifyControl.startMeasurement = true; stringBuildAdd_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_stringdemo0_0); notifyControl.stopMeasurement = true; control.announceWarmdownReady(); try { while (control.warmdownShouldWait) { l_stringdemo0_0.stringBuildAdd(); res.allOps++; } control.preTearDown(); } catch (InterruptedException ie) { control.preTearDownForce(); } if (control.isLastIteration()) { f_stringdemo0_0 = null; } res.allOps += res.measuredOps; int batchSize = iterationParams.getBatchSize(); int opsPerInv = benchmarkParams.getOpsPerInvocation(); res.allOps *= opsPerInv; res.allOps /= batchSize; res.measuredOps *= opsPerInv; res.measuredOps /= batchSize; BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps); results.add(new AverageTimeResult(ResultRole.PRIMARY, "stringBuildAdd", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void stringBuildAdd_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, StringDemo_jmhType l_stringdemo0_0) throws Throwable { long operations = 0; long realTime = 0; result.startTime = System.nanoTime(); do { l_stringdemo0_0.stringBuildAdd(); operations++; } while(!control.isDone); result.stopTime = System.nanoTime(); result.realTime = realTime; result.measuredOps = operations; } public BenchmarkTaskResult stringBuildAdd_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { RawResults res = new RawResults(); StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control); control.preSetup(); control.announceWarmupReady(); while (control.warmupShouldWait) { l_stringdemo0_0.stringBuildAdd(); res.allOps++; } notifyControl.startMeasurement = true; int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond int batchSize = iterationParams.getBatchSize(); int opsPerInv = benchmarkParams.getOpsPerInvocation(); SampleBuffer buffer = new SampleBuffer(); stringBuildAdd_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_stringdemo0_0); notifyControl.stopMeasurement = true; control.announceWarmdownReady(); try { while (control.warmdownShouldWait) { l_stringdemo0_0.stringBuildAdd(); res.allOps++; } control.preTearDown(); } catch (InterruptedException ie) { control.preTearDownForce(); } if (control.isLastIteration()) { f_stringdemo0_0 = null; } res.allOps += res.measuredOps * batchSize; res.allOps *= opsPerInv; res.allOps /= batchSize; res.measuredOps *= opsPerInv; BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps); results.add(new SampleTimeResult(ResultRole.PRIMARY, "stringBuildAdd", buffer, benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void stringBuildAdd_sample_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SampleBuffer buffer, int targetSamples, long opsPerInv, int batchSize, StringDemo_jmhType l_stringdemo0_0) throws Throwable { long realTime = 0; long operations = 0; int rnd = (int)System.nanoTime(); int rndMask = startRndMask; long time = 0; int currentStride = 0; do { rnd = (rnd * 1664525 + 1013904223); boolean sample = (rnd & rndMask) == 0; if (sample) { time = System.nanoTime(); } for (int b = 0; b < batchSize; b++) { if (control.volatileSpoiler) return; l_stringdemo0_0.stringBuildAdd(); } if (sample) { buffer.add((System.nanoTime() - time) / opsPerInv); if (currentStride++ > targetSamples) { buffer.half(); currentStride = 0; rndMask = (rndMask << 1) + 1; } } operations++; } while(!control.isDone); startRndMask = Math.max(startRndMask, rndMask); result.realTime = realTime; result.measuredOps = operations; } public BenchmarkTaskResult stringBuildAdd_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control); control.preSetup(); notifyControl.startMeasurement = true; RawResults res = new RawResults(); int batchSize = iterationParams.getBatchSize(); stringBuildAdd_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_stringdemo0_0); control.preTearDown(); if (control.isLastIteration()) { f_stringdemo0_0 = null; } int opsPerInv = control.benchmarkParams.getOpsPerInvocation(); long totalOps = opsPerInv; BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps); results.add(new SingleShotResult(ResultRole.PRIMARY, "stringBuildAdd", res.getTime(), benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void stringBuildAdd_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, StringDemo_jmhType l_stringdemo0_0) throws Throwable { long realTime = 0; result.startTime = System.nanoTime(); for (int b = 0; b < batchSize; b++) { if (control.volatileSpoiler) return; l_stringdemo0_0.stringBuildAdd(); } result.stopTime = System.nanoTime(); result.realTime = realTime; } StringDemo_jmhType f_stringdemo0_0; StringDemo_jmhType _jmh_tryInit_f_stringdemo0_0(InfraControl control) throws Throwable { if (control.isFailing) throw new FailureAssistException(); StringDemo_jmhType val = f_stringdemo0_0; if (val == null) { val = new StringDemo_jmhType(); f_stringdemo0_0 = val; } return val; } }
43c820c9215295d9a6653ebc81540f1e6e658284
a2b7c75bfd0569248247bd8c326823a43fe271e8
/src/test/java/personal/xml/jaxb/bindingframework/annotation/xmlanyelement/example/from/internet/Demo.java
2425b7230314ae556f530d83e3e646e836802407
[]
no_license
explorer1680/xml-hello-world
e82d3fa71c0ebabeb76bf536e3bf3ddfc62aa47e
eb1cb39adabc092fd54ef1d91aa3a5f54d5b76ec
refs/heads/master
2022-12-02T04:03:48.997646
2022-11-21T16:38:24
2022-11-21T16:38:24
93,083,082
0
0
null
2022-10-05T19:11:34
2017-06-01T17:34:29
XSLT
UTF-8
Java
false
false
967
java
package personal.xml.jaxb.bindingframework.annotation.xmlanyelement.example.from.internet; import org.springframework.core.io.ClassPathResource; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Customer.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); Customer customer = (Customer) unmarshaller.unmarshal(new ClassPathResource("personal/xml/jaxb/bindingframework/annotation/xmlanyelement/example/from/internet/input.xml").getInputStream()); System.out.println("Name: " + customer.getName()); System.out.println("Bio: " + customer.getBio()); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(customer, System.out); } }
d187fff54085aa372242edc389c900dc4d92bad8
4c601761cf843fb8136d08909cb307b9e0c17628
/app/src/main/java/com/example/administrator/httpdemo/CustomView/WordView.java
064b934912b52d158e78f8c8b94c1c3a4a75d0c4
[]
no_license
zsx8888/EnjoyMusic
534d138cda9dfdb4e873818d9b1e97b9abcf907a
56ce8f8b88b93577abb9bf78f9a11ba31e613984
refs/heads/master
2020-08-08T15:40:00.838796
2018-04-06T03:02:26
2018-04-06T03:02:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,136
java
package com.example.administrator.httpdemo.CustomView; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.DashPathEffect; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PathEffect; import android.graphics.Rect; import android.graphics.Typeface; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; /** * Created by Administrator on 2017/8/11. */ public class WordView extends View { Typeface typeFace =Typeface.createFromAsset(getContext().getAssets(),"fonts/girl.ttf"); Paint paint = new Paint(); Paint pathPaint = new Paint(); Path path = new Path(); String text = "我是分割线"; String leftText = "<"; String rightText = ">"; PathEffect pathEffect = new DashPathEffect(new float[]{10, 5}, 0); Rect bounds1 = new Rect(); Rect bounds2 = new Rect(); Rect bounds3 = new Rect(); public WordView(Context context) { this(context, null); } public WordView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int centerX = getWidth()/2; int centerY = getHeight()/2; paint.reset(); paint.getTextBounds(text, 0, text.length(), bounds1); paint.getTextBounds(leftText, 0, leftText.length(), bounds2); paint.getTextBounds(rightText, 0, rightText.length(), bounds3); paint.setAntiAlias(true); paint.setTextSize(50); paint.setTextSkewX(-0.33f); paint.setTypeface(typeFace); paint.setColor(Color.RED); paint.setLetterSpacing(0.1f); float h1 = bounds1.bottom - bounds1.top; float h2 = bounds1.bottom - bounds1.top; float h3 = bounds1.bottom - bounds1.top; float w1 = paint.measureText(text); float w2 = paint.measureText(leftText); float w3 = paint.measureText(rightText); float startX = centerX - w1/2; float startY = centerY + h1/2; canvas.drawText(text, startX, startY, paint); float sX2 = getLeft(); float sY2 = centerY + h2/2; canvas.drawText(leftText, sX2, sY2, paint); float sX3 = getRight() - w3 - getPaddingEnd() - w3; float sY3 = centerY + h3/2; canvas.drawText(rightText, sX3, sY3, paint); pathPaint.reset(); pathPaint.setStrokeWidth(5); pathPaint.setAntiAlias(true); pathPaint.setPathEffect(pathEffect); pathPaint.setStyle(Paint.Style.STROKE); pathPaint.setColor(Color.RED); path.reset(); path.moveTo(getLeft()+w2, sY3-h3); path.lineTo(startX, sY3-h3); canvas.drawPath(path, pathPaint); // canvas.drawLine(getLeft()+w2, sY3-h3/3, startX, sY3-h3/3, paint); path.reset(); path.moveTo(startX+w1, sY3-h3); path.lineTo(sX3, sY3-h3); // canvas.drawLine(startX+w1, sY3-h3/3, sX3, sY3-h3/3, paint); canvas.drawPath(path, pathPaint); } }
f39bc123de3387284d8b201b8d1cd19cc8605bf8
f2222b29e35af3da3d08d5fb335ee98fab289f25
/spring_mvc/src/kr/co/sist/controller/webparam/ExceptionController.java
892f68710ca7ce14559ef962fe41491f4ed9f669
[]
no_license
jeongmipark94/JavaStudy_src
2fe7eefe05581d7d30e7b53610dc89e6f26ddb9a
bbf55e62f738049c9990c25e0ae3cdf91693962c
refs/heads/master
2020-04-08T19:26:37.468884
2019-05-15T07:02:46
2019-05-15T07:02:46
159,655,640
0
0
null
null
null
null
UHC
Java
false
false
2,176
java
package kr.co.sist.controller.webparam; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import static org.springframework.web.bind.annotation.RequestMethod.GET; import java.util.Calendar; import java.util.Random; @Controller public class ExceptionController { @RequestMapping(value="/exception/exception.do",method=GET) public String exceptionForm() { return "exception/exception_form"; }//exceptionForm @RequestMapping(value="/exception/number_format.do",method=GET) public String numberFormat(int age, Model model) { model.addAttribute("birth", Calendar.getInstance().get(Calendar.YEAR)-age+1); return "exception/view_age"; }//numberFormat @RequestMapping(value="/exception/class_not_found.do",method=GET) public String classNotFound() throws ClassNotFoundException { if(new Random().nextBoolean() ) { throw new ClassNotFoundException("클래스 없는 상황"); }//end if return "exception/view_class"; }//numberFormat //현재 Controller 내의 method들중 NumberFormatException이 발생하면 // method가 달라도 아래의 예외처리 method가 호출된다. @ExceptionHandler(NumberFormatException.class) //이 폼들의 어떤 메서드라도 numberformatexception이라면 여기로온다 public ModelAndView numberFormatProcess(NumberFormatException nfe) { ModelAndView mav=new ModelAndView(); mav.setViewName("exception/error"); mav.addObject("msg",nfe.getMessage()); //간단한 에러 메세지 mav.addObject("exception",nfe.toString()); //예외처리 객체와 간단한 에러 메세지 return mav; }//numberFormatProcess @ExceptionHandler(ClassNotFoundException.class) public ModelAndView classNotFoundProcess(ClassNotFoundException cnfe) { ModelAndView mav= new ModelAndView(); mav.setViewName("exception/error"); mav.addObject("msg", cnfe.getMessage() ); mav.addObject("exception", cnfe.toString() ); return mav; }//classNotFoundProcess }//class
22ce9f0c1c91d375bc99305b4a138d908040b4af
47bd92b0ec19cef05398478e93f141e985cc0e05
/comparer/comparer.synchro/comparer.synchro.reader/comparer.synchro.reader.processbookmaker/src/main/java/com/comparadorad/bet/comparer/synchro/reader/processbookmaker/exception/BetInactiveException.java
ce2aa338ecdca761748bc0319de1aa7b3cd585cb
[]
no_license
chuguet/my-comparer
f43c0c3dbf7f635864bbf346c0c11c455f3cb831
471e7d83d1c5c5400f90d901faa4f24f8e755490
refs/heads/master
2021-01-15T21:03:21.584668
2014-08-07T08:57:20
2014-08-07T08:57:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
/** * * Copyright (C) FACTORIA ETSIA S.L. * All Rights Reserved. * www.factoriaetsia.com * */ package com.comparadorad.bet.comparer.synchro.reader.processbookmaker.exception; /** * The Class SportNotFoundException. */ @SuppressWarnings("serial") public class BetInactiveException extends InactiveElementException { /** * Instantiates a new sport not found exception. * * @param message * the message */ public BetInactiveException(String message) { super(message); } }
[ "[email protected]@7daf7316-15a6-36d4-e5e8-a3ca7c335dfd" ]
[email protected]@7daf7316-15a6-36d4-e5e8-a3ca7c335dfd
096bc6af2835429481bc51184db544b61178a2ab
66ec326363bd09ce2fe7f2109ccec95ebce7e68c
/src/main/java/com/example/api/mapper/UserDetailsMapper.java
970a5b4fe14cfeda742984681a781ff93f228138
[]
no_license
Desire456/spring-course-3
015c062ecb9607d0bc20fcc24c425b93f9a48868
dbe3e48a983c25323d60939d2ccafa442b1a372e
refs/heads/master
2023-06-28T15:48:52.921730
2021-07-31T14:23:56
2021-07-31T14:23:56
390,477,822
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.example.api.mapper; import com.example.api.domain.UserInfo; import com.example.api.dto.UserInfoResponseDto; import com.example.api.entity.UserEntity; import org.mapstruct.Mapper; @Mapper public interface UserDetailsMapper { UserInfo fromEntity(UserEntity entity); UserInfoResponseDto fromDomain(UserInfo info); }
9bc5a0795a2aeb1a0f0ffad353ada7ec742036e4
05851be9bbaec34aac8a773408c1bdd425c6b76e
/presto-main/src/main/java/com/facebook/presto/execution/RevokeRolesTask.java
fbcb462986ad5a56aad41547433b1cfdb3f112e9
[ "Apache-2.0" ]
permissive
troels/nz-presto
fdc4a53e568694cae08ac4deef04ab817ad5839a
f0e27a676f9c2457cb98eeaee76d1a2aaabe230f
refs/heads/master
2021-01-16T19:46:54.174765
2018-05-01T09:09:25
2018-05-01T09:09:25
100,186,730
2
3
null
null
null
null
UTF-8
Java
false
false
3,621
java
/* * 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.facebook.presto.execution; import com.facebook.presto.Session; import com.facebook.presto.metadata.Metadata; import com.facebook.presto.metadata.MetadataUtil; import com.facebook.presto.security.AccessControl; import com.facebook.presto.spi.security.PrestoPrincipal; import com.facebook.presto.sql.analyzer.SemanticException; import com.facebook.presto.sql.tree.Expression; import com.facebook.presto.sql.tree.RevokeRoles; import com.facebook.presto.transaction.TransactionManager; import com.google.common.util.concurrent.ListenableFuture; import java.util.LinkedHashSet; import java.util.List; import java.util.Optional; import java.util.Set; import static com.facebook.presto.metadata.MetadataUtil.createCatalogName; import static com.facebook.presto.metadata.MetadataUtil.createPrincipal; import static com.facebook.presto.spi.security.PrincipalType.ROLE; import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_ROLE; import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.util.concurrent.Futures.immediateFuture; public class RevokeRolesTask implements DataDefinitionTask<RevokeRoles> { @Override public String getName() { return "GRANT ROLE"; } @Override public ListenableFuture<?> execute(RevokeRoles statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); Set<String> roles = statement.getRoles(); Set<PrestoPrincipal> grantees = statement.getGrantees().stream() .map(MetadataUtil::createPrincipal) .collect(toImmutableSet()); boolean adminOptionFor = statement.isAdminOptionFor(); Optional<PrestoPrincipal> grantor = statement.getGrantor().map(specification -> createPrincipal(session, specification)); String catalog = createCatalogName(session, statement, statement.getCatalog()); Set<String> availableRoles = metadata.listRoles(session, catalog); Set<String> specifiedRoles = new LinkedHashSet<>(); specifiedRoles.addAll(roles); grantees.stream() .filter(principal -> principal.getType() == ROLE) .map(PrestoPrincipal::getName) .forEach(specifiedRoles::add); if (grantor.isPresent() && grantor.get().getType() == ROLE) { specifiedRoles.add(grantor.get().getName()); } for (String role : specifiedRoles) { if (!availableRoles.contains(role)) { throw new SemanticException(MISSING_ROLE, statement, "Role '%s' does not exist", role); } } accessControl.checkCanRevokeRoles(session.getRequiredTransactionId(), session.getIdentity(), roles, grantees, adminOptionFor, grantor, catalog); metadata.revokeRoles(session, roles, grantees, adminOptionFor, grantor, catalog); return immediateFuture(null); } }
fecc56ba987121370b0025d1d39c6412869cc60b
1a5f5f1a31dedeb40e706ea4d271c21419b7c842
/services/common/src/main/java/com/epam/dlab/rest/mappers/AuthenticationExceptionMapper.java
8ba1f2f67a1b596b39265ee7a85e7158989b7467
[ "Apache-2.0", "Python-2.0", "MIT" ]
permissive
stenpiren/DLab
39ab8ea65a253b5c73d786baaa1c3aa9c33cceac
99da3c9c585b2db3c32a3a4c6f079a9894d442d8
refs/heads/master
2020-03-22T03:15:36.735966
2018-05-25T14:53:50
2018-05-25T14:53:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
527
java
package com.epam.dlab.rest.mappers; import com.epam.dlab.exceptions.DlabAuthenticationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; public class AuthenticationExceptionMapper implements ExceptionMapper<DlabAuthenticationException> { @Override public Response toResponse(DlabAuthenticationException exception) { return Response.status(Response.Status.UNAUTHORIZED).entity(exception.getMessage()).type(MediaType .TEXT_PLAIN_TYPE).build(); } }
d1c97d474f694a5c1edbbd1c887f31e883b917d9
fe49198469b938a320692bd4be82134541e5e8eb
/scenarios/web/large/gradle/ClassLib013/src/main/java/ClassLib013/Class062.java
da2e6e2f129c472a0f5d7da4f02fd81824a8d381
[]
no_license
mikeharder/dotnet-cli-perf
6207594ded2d860fe699fd7ef2ca2ae2ac822d55
2c0468cb4de9a5124ef958b315eade7e8d533410
refs/heads/master
2022-12-10T17:35:02.223404
2018-09-18T01:00:26
2018-09-18T01:00:26
105,824,840
2
6
null
2022-12-07T19:28:44
2017-10-04T22:21:19
C#
UTF-8
Java
false
false
122
java
package ClassLib013; public class Class062 { public static String property() { return "ClassLib013"; } }
6b96edf8a08641ab93d82c7b125a8a1bd93fcd4c
6c7c1614087af4375b13f9ff4fd62ae1f847af20
/JAICore/jaicore-ml/src/jaicore/ml/evaluation/evaluators/weka/MonteCarloCrossValidationEvaluator.java
7077e7387eebb66f776bcd755383da958746b073
[]
no_license
alexanderwerning/AILibs
2fc24335397c23cb9a121306b9ff7953c2cd0249
47835caf4964cd31ec2aba3ed94b0875a46edf3f
refs/heads/master
2020-04-27T08:43:39.498853
2019-03-07T09:41:42
2019-03-07T09:41:42
162,276,055
0
0
null
2018-12-18T11:12:17
2018-12-18T11:12:16
null
UTF-8
Java
false
false
2,903
java
package jaicore.ml.evaluation.evaluators.weka; import java.util.List; import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import jaicore.basic.algorithm.exceptions.ObjectEvaluationFailedException; import jaicore.ml.WekaUtil; import weka.classifiers.Classifier; import weka.core.Instances; /** * A classifier evaluator that can perform a (monte-carlo)cross-validation on * the given dataset. Thereby, it uses the * {@link AbstractEvaluatorMeasureBridge} to evaluate the classifier on a random * split of the dataset. * * @author joshua * */ public class MonteCarloCrossValidationEvaluator implements IClassifierEvaluator { static final Logger logger = LoggerFactory.getLogger(MonteCarloCrossValidationEvaluator.class); private boolean canceled = false; private final int repeats; private final Instances data; private final double trainingPortion; private final long seed; /* Can either compute the loss or cache it */ private final AbstractEvaluatorMeasureBridge<Double, Double> bridge; private final DescriptiveStatistics stats = new DescriptiveStatistics(); public MonteCarloCrossValidationEvaluator(AbstractEvaluatorMeasureBridge<Double, Double> bridge, final int repeats, final Instances data, final double trainingPortion, final long seed) { super(); this.repeats = repeats; this.bridge = bridge; this.data = data; this.trainingPortion = trainingPortion; this.seed = seed; } public void cancel() { logger.info("Received cancel"); this.canceled = true; } @Override public Double evaluate(final Classifier pl) throws ObjectEvaluationFailedException, InterruptedException { if (pl == null) { throw new IllegalArgumentException("Cannot compute score for null pipeline!"); } /* perform random stratified split */ logger.info("Starting evaluation of {}", pl); for (int i = 0; i < this.repeats && !this.canceled && !Thread.currentThread().isInterrupted(); i++) { logger.debug("Obtaining predictions of {} for split #{}/{}", pl, i + 1, this.repeats); List<Instances> split = WekaUtil.getStratifiedSplit(data, seed + i, trainingPortion); try { double score = bridge.evaluateSplit(pl, split.get(0), split.get(1)); logger.info("Score for evaluation of {} with split #{}/{}: {}", pl, i + 1, this.repeats, score); stats.addValue(score); } catch (Exception e) { throw new ObjectEvaluationFailedException(e, "Could not evaluate classifier!"); } } if (Thread.currentThread().isInterrupted()) throw new InterruptedException("MCCV has been interrupted"); Double score = stats.getMean(); logger.info("Obtained score of {} for classifier {}.", score, pl); return score; } public DescriptiveStatistics getStats() { return stats; } public AbstractEvaluatorMeasureBridge<Double, Double> getBridge() { return bridge; } }