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
e1ba83bbab24dfbf84c5a9844690f4597c934b14
18c2c56640b3125dc6f18975fecf83eb5888fec0
/src/test/java/com/example/TestArithmetic/collection/skipList/SkipListNode.java
19616b6f373234946a8a7bcabc4c095d0596fca5
[]
no_license
zhuxiaoqing-com/AQS
8111b0c4d29282a5b4c030210410d37fa9869101
ad8715c83a863ca615d26c6d52a3243477fd6e18
refs/heads/develop
2022-10-30T10:05:46.009213
2021-03-16T13:02:52
2021-03-16T13:02:52
148,271,523
2
1
null
2022-10-04T23:55:35
2018-09-11T06:34:32
Java
UTF-8
Java
false
false
1,658
java
package com.example.TestArithmetic.collection.skipList; public class SkipListNode<T> { public int key; public T value; public SkipListNode<T> down, right;// 上下左右四个指针 public SkipListNode(int key, SkipListNode<T> down) { this.key = key; this.down = down; } public SkipListNode(int key, SkipListNode<T> right, SkipListNode<T> down) { this.key = key; this.right = right; this.down = down; } public SkipListNode(int key, T value, SkipListNode<T> right, SkipListNode<T> down) { this.key = key; this.value = value; this.down = down; this.right = right; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public T getValue() { return value; } public void setValue(T value) { this.value = value; } public SkipListNode<T> getDown() { return down; } public void setDown(SkipListNode<T> down) { this.down = down; } public SkipListNode<T> getRight() { return right; } public void setRight(SkipListNode<T> right) { this.right = right; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (!(o instanceof SkipListNode<?>)) { return false; } SkipListNode<T> ent = (SkipListNode<T>) o; return (ent.getKey() == key) && (ent.getValue() == value); } @Override public String toString() { return "key-value:" + key + "-" + value; } }
3f5b8dd0e46d76e55f1678896cb710870b826877
ff9928e127574b4b764b64f99fc9b09013c9e2c0
/ibator-core/src/main/java/org/apache/ibatis/ibator/generator/ibatis2/model/BaseRecordGenerator.java
438ea8c035fe8737c2837222bd6386f7338c7782
[ "Apache-2.0" ]
permissive
ivaneye/IntellijWeb
be6c2558bf8a76d42b60dd86f8b74a8b8af738c2
40c1c7a24dc9fa6a6db5f51a3edb5015a0086221
refs/heads/master
2020-04-09T11:55:07.316234
2012-06-19T14:50:21
2012-06-19T14:50:21
4,605,677
1
1
null
null
null
null
UTF-8
Java
false
false
5,517
java
/* * Copyright 2008 The Apache Software Foundation * * 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.apache.ibatis.ibator.generator.ibatis2.model; import java.util.ArrayList; import java.util.List; import org.apache.ibatis.ibator.api.CommentGenerator; import org.apache.ibatis.ibator.api.FullyQualifiedTable; import org.apache.ibatis.ibator.api.IbatorPlugin; import org.apache.ibatis.ibator.api.IntrospectedColumn; import org.apache.ibatis.ibator.api.dom.java.CompilationUnit; import org.apache.ibatis.ibator.api.dom.java.Field; import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType; import org.apache.ibatis.ibator.api.dom.java.JavaVisibility; import org.apache.ibatis.ibator.api.dom.java.Method; import org.apache.ibatis.ibator.api.dom.java.TopLevelClass; import org.apache.ibatis.ibator.generator.AbstractJavaGenerator; import org.apache.ibatis.ibator.generator.RootClassInfo; import org.apache.ibatis.ibator.internal.util.messages.Messages; /** * * @author Jeff Butler * */ public class BaseRecordGenerator extends AbstractJavaGenerator { public BaseRecordGenerator() { super(); } @Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask( Messages.getString("Progress.8", table.toString())); //$NON-NLS-1$ IbatorPlugin plugins = ibatorContext.getPlugins(); CommentGenerator commentGenerator = ibatorContext.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable.getBaseRecordType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } List<IntrospectedColumn> introspectedColumns; if (includePrimaryKeyColumns()) { if (includeBLOBColumns()) { introspectedColumns = introspectedTable.getAllColumns(); } else { introspectedColumns = introspectedTable.getNonBLOBColumns(); } } else { if (includeBLOBColumns()) { introspectedColumns = introspectedTable.getNonPrimaryKeyColumns(); } else { introspectedColumns = introspectedTable.getBaseColumns(); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings).containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, IbatorPlugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, IbatorPlugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, IbatorPlugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (ibatorContext.getPlugins().modelBaseRecordClassGenerated(topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; } private FullyQualifiedJavaType getSuperClass() { FullyQualifiedJavaType superClass; if (introspectedTable.getRules().generatePrimaryKeyClass()) { superClass = new FullyQualifiedJavaType(introspectedTable.getPrimaryKeyType()); } else { String rootClass = getRootClass(); if (rootClass != null) { superClass = new FullyQualifiedJavaType(rootClass); } else { superClass = null; } } return superClass; } private boolean includePrimaryKeyColumns() { return !introspectedTable.getRules().generatePrimaryKeyClass() && introspectedTable.hasPrimaryKeyColumns(); } private boolean includeBLOBColumns() { return !introspectedTable.getRules().generateRecordWithBLOBsClass() && introspectedTable.hasBLOBColumns(); } }
05b07546c26f2c371497c7fbc5d41f7ab0c4a073
3d27e626a440f4aac439a28ac3e0c9790427822e
/src/main/java/br/com/udelblue/spring/boot/data/embedded/mongodb/domain/Thumbdrive.java
318e50d447b18e9d181315d3dffc72f42293728e
[]
no_license
udelblue/embedded_mongodb
f679dc5e1972df3e6a6a76a4fb69f3878f8b1d80
048378c983247d5b6820d692a785f7e1c2be65ef
refs/heads/master
2021-07-11T17:33:45.582845
2017-10-03T23:31:05
2017-10-03T23:31:05
105,713,805
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package br.com.udelblue.spring.boot.data.embedded.mongodb.domain; public class Thumbdrive extends Product { Integer gigabytes; public Thumbdrive(Integer id, String company, String name, Integer gigabytes) { super(id, company, name, Type.THUMBDRIVE); this.gigabytes = gigabytes; } public Integer getGigabytes() { return gigabytes; } }
c62a486855264843f647afce3ae5d40643fdf6a0
d092c182f763daf53fb5f5fb973e4fcaaf2fb3cc
/ble-common/src/main/java/no/nordicsemi/android/ble/common/profile/bp/BloodPressureMeasurementCallback.java
e810731f4cfa59e76434e68d9906dd98267173e1
[ "BSD-3-Clause" ]
permissive
NethunterJack/Android-BLE-Common-Library
7a6c487ca63a6eff1f03bb5d3eb28c56f8a42f09
68804b065c23d8d04155a80267d3146d1a70bfd8
refs/heads/master
2020-04-11T01:42:28.557487
2018-11-08T11:33:11
2018-11-08T11:33:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,398
java
/* * Copyright (c) 2018, Nordic Semiconductor * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder 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 * HOLDER 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 no.nordicsemi.android.ble.common.profile.bp; import android.bluetooth.BluetoothDevice; import android.support.annotation.FloatRange; import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import java.util.Calendar; @SuppressWarnings("unused") public interface BloodPressureMeasurementCallback extends BloodPressureTypes { /** * Callback called when Blood Pressure Measurement packet has been received. * Use {@link #toKPa(float, int)} or {@link #toMmHg(float, int)} to convert pressure units. * * @param device the target device. * @param systolic the systolic compound of blood pressure measurement. * @param diastolic the diastolic compound of blood pressure measurement. * @param meanArterialPressure the mean arterial pressure compound of blood pressure measurement. * @param unit the measurement unit, one of {@link #UNIT_mmHg} or {@link #UNIT_kPa}. * @param pulseRate an optional pulse rate in beats per minute. * @param userID an optional user ID. Value 255 means 'unknown user'. * @param status an optional measurement status. * @param calendar an optional measurement timestamp. */ void onBloodPressureMeasurementReceived(@NonNull final BluetoothDevice device, @FloatRange(from = 0) final float systolic, @FloatRange(from = 0) final float diastolic, @FloatRange(from = 0) final float meanArterialPressure, @BloodPressureUnit final int unit, @Nullable @FloatRange(from = 0) final Float pulseRate, @Nullable @IntRange(from = 0, to = 255) final Integer userID, @Nullable final BPMStatus status, @Nullable final Calendar calendar); }
3455ca4f0259c9a9585d4b7acce945b050831596
8d1d8b98cb9a819e31b1cf01b3cf6b95561c867f
/androidclient/src/org/uab/android/eventreporter/lists/FGCExpandableList.java
0c4950837c43af217c235c8c853cf793f66c863f
[ "MIT" ]
permissive
cristiantanas/Incidencies-2.0
a7187015f722ba770f72e673fe9db99045830470
20ceea4ff1cd94bfc2d593d17c5d5d0c4f059a8d
refs/heads/master
2021-08-07T19:56:13.542212
2017-11-08T21:49:23
2017-11-08T21:49:23
110,027,074
2
0
null
null
null
null
UTF-8
Java
false
false
4,049
java
package org.uab.android.eventreporter.lists; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.uab.android.eventreporter.R; import org.uab.android.eventreporter.ReportSendActivity; import org.uab.android.eventreporter.utils.Utils; import android.app.AlertDialog; import android.app.Dialog; import android.app.ExpandableListActivity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; import android.widget.SimpleExpandableListAdapter; import android.widget.TextView; public class FGCExpandableList extends ExpandableListActivity { private static final int FGC_ID = 1; private static final String GROUP_ID = "group"; private static final String CHILDREN_ID = "children"; private String username = ""; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); username = getIntent().getStringExtra("username"); setListAdapter(new SimpleExpandableListAdapter(this, getGroups(), android.R.layout.simple_expandable_list_item_1, new String[] {GROUP_ID}, new int[] {android.R.id.text1}, getChildren(), android.R.layout.simple_list_item_single_choice, new String[] {CHILDREN_ID}, new int[] {android.R.id.text1})); getExpandableListView().setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { int uniqueLineId = FGC_ID * 10 + groupPosition; String stationName = ((TextView) v).getText().toString(); startActivity(new Intent(getApplicationContext(), ReportSendActivity.class) .putExtra("username", username) .putExtra("service", Utils.FGC_INCIDENTS) .putExtra("line", uniqueLineId) .putExtra("station", stationName) .putExtra("stationHash", Utils.md5(stationName))); return true; } }); } private List<Map<String,String>> getGroups() { String[] groups = getResources().getStringArray(R.array.fgc_lines); List<Map<String,String>> list = new ArrayList<Map<String,String>>(); Map<String,String> map; for (String item : groups) { map = new HashMap<String,String>(); map.put(GROUP_ID, item); list.add(map); } return list; } private List<List<Map<String,String>>> getChildren() { String[][] childrens = new String[][] { getResources().getStringArray(R.array.fgc_l6_line), getResources().getStringArray(R.array.fgc_s1_line), getResources().getStringArray(R.array.fgc_s55_line), getResources().getStringArray(R.array.fgc_s5_line), getResources().getStringArray(R.array.fgc_s2_line), getResources().getStringArray(R.array.fgc_l7_line) }; List<List<Map<String,String>>> list = new ArrayList<List<Map<String,String>>>(); List<Map<String,String>> sublist; Map<String,String> map; for (String[] items : childrens) { sublist = new ArrayList<Map<String,String>>(); for (String item : items) { map = new HashMap<String,String>(); map.put(CHILDREN_ID, item); sublist.add(map); } list.add(sublist); } return list; } @Override protected Dialog onCreateDialog(int id) { Dialog dialog = null; if (id == 0) { dialog = new ProgressDialog(this); ((ProgressDialog) dialog).setMessage("Obtenint informació..."); dialog.show(); } else if (id == 1) { dialog = new AlertDialog.Builder(this) .setMessage("No s'ha pogut obtenir la informació en aquest moment! " + "Per favor, torni a intentar-ho més tard.") .setNeutralButton(Utils.DISCARD, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .create(); } return dialog; } }
b93c685e63d6e229b533fbb6980530ee15b7bb22
c66257e39e77c2354167e5b99f57c414c1727bf5
/src/task2/LocalitySortReducer.java
ac76081a8e2c81538426ee108c8becbe123b955d
[]
no_license
jiaxililearn/MapReduce_Movies
eb02c42a18b973493dbfc5585f56b0643702b318
3d31fa5f1a58a06b5a6c0925ab74a10e4fa64fb7
refs/heads/master
2021-06-09T04:16:05.015011
2017-01-04T00:01:11
2017-01-04T00:01:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package join; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.Reducer.Context; import org.apache.hadoop.io.IntWritable; public class LocalitySortReducer extends Reducer<IntWritable, Text, Text, Text> { private Text keyOut = new Text(), valOut = new Text(); private int counter = 0; public void reduce(IntWritable key, Iterable<Text> values, Context context) throws IOException, InterruptedException { for (Text val : values) { if (counter < 10){ keyOut.set(val.toString()); valOut.set(key.toString()); context.write(keyOut, valOut); counter++; } } } }
57383fa8eaec2b99fe78c902071e17c93d621e06
e8a90e8ea77b132c53875f2034e25ac617adbbe6
/passenger-trip/backend/src/main/java/edu/mum/ea/passenger/backend/entity/PassengerEntity.java
18de9fbf55d507d517d2f7545f4f4701c2b64f9c
[]
no_license
lferasu/Carpool
98447b0dacffb56429c16597880b08fa0a903d27
dabb4406048b0cafc97d8cc5935cc28a60fc006e
refs/heads/master
2023-01-20T11:48:04.437461
2019-11-22T02:46:31
2019-11-22T02:46:31
221,825,711
0
1
null
2023-01-07T11:57:03
2019-11-15T02:17:00
Java
UTF-8
Java
false
false
208
java
package edu.mum.ea.passenger.backend.entity; import lombok.Data; import lombok.NoArgsConstructor; @Data@NoArgsConstructor public class PassengerEntity { private String id; private String name; }
54aba4f79dcbff4cada9d3d3b99922c0dc14277d
e1355210f2c3882a85c8a01ede651d4a5bc2bac8
/assignments/week-7-assignment-6/iRemember/src/edu/vuum/mocca/ui/CreateStoryActivity.java
cd0f0a1deacb9817a453e49af9fc75646cb133f5
[]
no_license
kittiekorn/MoCCA-POSA
75b98344823612cd7fd887ab15d2df6bf2756869
262ff7236be6b836c11cc9ddaeb1677372964754
refs/heads/master
2021-01-16T17:47:25.944075
2015-07-28T19:04:22
2015-07-28T19:04:22
28,104,022
3
2
null
null
null
null
UTF-8
Java
false
false
14,782
java
/* The iRemember source code (henceforth referred to as "iRemember") is copyrighted by Mike Walker, Adam Porter, Doug Schmidt, and Jules White at Vanderbilt University and the University of Maryland, Copyright (c) 2014, all rights reserved. Since iRemember is open-source, freely available software, you are free to use, modify, copy, and distribute--perpetually and irrevocably--the source code and object code produced from the source, as well as copy and distribute modified versions of this software. You must, however, include this copyright statement along with any code built using iRemember that you release. No copyright statement needs to be provided if you just ship binary executables of your software products. You can use iRemember software in commercial and/or binary software releases and are under no obligation to redistribute any of your source code that is built using the software. Note, however, that you may not misappropriate the iRemember code, such as copyrighting it yourself or claiming authorship of the iRemember software code, in a way that will prevent the software from being distributed freely using an open-source development model. You needn't inform anyone that you're using iRemember software in your software, though we encourage you to let us know so we can promote your project in our success stories. iRemember is provided as is with no warranties of any kind, including the warranties of design, merchantability, and fitness for a particular purpose, noninfringement, or arising from a course of dealing, usage or trade practice. Vanderbilt University and University of Maryland, their employees, and students shall have no liability with respect to the infringement of copyrights, trade secrets or any patents by DOC software or any part thereof. Moreover, in no event will Vanderbilt University, University of Maryland, their employees, or students be liable for any lost revenue or profits or other special, indirect and consequential damages. iRemember is provided with no support and without any obligation on the part of Vanderbilt University and University of Maryland, their employees, or students to assist in its use, correction, modification, or enhancement. The names Vanderbilt University and University of Maryland may not be used to endorse or promote products or services derived from this source without express written permission from Vanderbilt University or University of Maryland. This license grants no permission to call products or services derived from the iRemember source, nor does it grant permission for the name Vanderbilt University or University of Maryland to appear in their names. */ package edu.vuum.mocca.ui; import java.util.Calendar; import java.util.Locale; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.text.Editable; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import edu.vuum.mocca.R; import edu.vuum.mocca.storage.MoocResolver; import edu.vuum.mocca.storage.StorageUtilities; import edu.vuum.mocca.storage.StoryCreator; import edu.vuum.mocca.storage.StoryData; /** * The activity that allows a user to create and save a story. */ public class CreateStoryActivity extends StoryActivityBase { // Tag used for debugging with Logcat private final static String LOG_TAG = CreateStoryActivity.class .getCanonicalName(); // Used as the request codes in startActivityForResult(). static final int CAMERA_PIC_REQUEST = 1; static final int MIC_SOUND_REQUEST = 3; // The various UI elements we use TextView loginIdTV; EditText storyIdET; EditText titleET; EditText bodyET; Button audioCaptureButton; Button videoCaptureButton; EditText imageNameET; Button imageCaptureButton; EditText tagsET; EditText creationTimeET; EditText storyTimeET; Button locationButton; TextView imageLocation; TextView videoLocation; TextView audioLocation; Button buttonCreate; Button buttonClear; Button buttonCancel; TextView latitudeValue; TextView longitudeValue; DatePicker storyDate; static Uri imagePath; // Making this static keeps it from getting GC'd when we take pictures Uri fileUri; String audioPath; Location loc; MoocResolver resolver; Uri imagePathFinal = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Setup the UI setContentView(R.layout.create_story_activity); // Start a resolver to help us store/retrieve data from a database resolver = new MoocResolver(this); // Get references to all the UI elements loginIdTV = (TextView) findViewById(R.id.story_create_value_login_id); storyIdET = (EditText) findViewById(R.id.story_create_value_story_id); titleET = (EditText) findViewById(R.id.story_create_value_title); bodyET = (EditText) findViewById(R.id.story_create_value_body); audioCaptureButton = (Button) findViewById(R.id.story_create_value_audio_link); videoCaptureButton = (Button) findViewById(R.id.story_create_value_video_button); imageNameET = (EditText) findViewById(R.id.story_create_value_image_name); imageCaptureButton = (Button) findViewById(R.id.story_create_value_image_button); tagsET = (EditText) findViewById(R.id.story_create_value_tags); creationTimeET = (EditText) findViewById(R.id.story_create_value_creation_time); locationButton = (Button) findViewById(R.id.story_create_value_location_button); imageLocation = (TextView) findViewById(R.id.story_create_value_image_location); videoLocation = (TextView) findViewById(R.id.story_create_value_video_location); audioLocation = (TextView) findViewById(R.id.story_create_value_audio_location); latitudeValue = (TextView) findViewById(R.id.story_create_value_latitude); longitudeValue = (TextView) findViewById(R.id.story_create_value_longitude); buttonClear = (Button) findViewById(R.id.story_create_button_reset); buttonCancel = (Button) findViewById(R.id.story_create_button_cancel); buttonCreate = (Button) findViewById(R.id.story_create_button_save); storyDate = (DatePicker) findViewById(R.id.story_create_value_story_time_date_picker); //Set the login ID, if it's been set loginIdTV.setText(String.valueOf(LoginActivity.getLoginId(this))); } // Reset all the fields to their default values public void buttonClearClicked (View v) { storyIdET.setText("" + 0); titleET.setText("" + ""); bodyET.setText("" + ""); imageNameET.setText("" + ""); tagsET.setText("" + ""); creationTimeET.setText("" + 0); } // Close this activity if the cancel button is clicked public void buttonCancelClicked (View v) { finish(); // same as hitting 'back' button } // Create a StoryData object from the input data and store it using the resolver public void buttonCreateClicked (View v) { Log.d(LOG_TAG, "create button pressed, creation time=" + creationTimeET.getText()); // local Editables Editable titleCreateable = titleET.getText(); Editable bodyCreateable = bodyET.getText(); Editable imageNameCreateable = imageNameET.getText(); Editable tagsCreateable = tagsET.getText(); Editable creationTimeCreateable = creationTimeET.getText(); Calendar cal = Calendar.getInstance(); cal.getTimeInMillis(); long loginId = 0; long storyId = 0; String title = ""; String body = ""; String audioLink = ""; String videoLink = ""; String imageName = ""; String imageData = ""; String tags = ""; long creationTime = 0; long storyTime = 0; double latitude = 0; double longitude = 0; // pull values from Editables loginId = LoginActivity.getLoginId(this); storyId = 1; // TODO Pull this from somewhere. title = String.valueOf(titleCreateable.toString()); body = String.valueOf(bodyCreateable.toString()); if (audioPath != null) { audioLink = audioPath; } if (fileUri != null) { videoLink = fileUri.toString(); } imageName = String.valueOf(imageNameCreateable.toString()); if (imagePathFinal != null) { imageData = imagePathFinal.toString(); } tags = String.valueOf(tagsCreateable.toString()); if (loc != null) { latitude = loc.getLatitude(); longitude = loc.getLongitude(); } Log.d(LOG_TAG, "creation time object:" + creationTimeCreateable); Log.d(LOG_TAG, "creation time as string" + creationTimeCreateable.toString()); Calendar cal2 = Calendar.getInstance(Locale.ENGLISH); creationTime = cal2.getTimeInMillis(); storyTime = StoryCreator.componentTimeToTimestamp(storyDate.getYear(), storyDate.getMonth(), storyDate.getDayOfMonth(), 0, 0); // new StoryData object with above info StoryData newData = new StoryData( -1, // -1 row index, because there is no way to know which // row it will go into loginId, storyId, title, body, audioLink, videoLink, imageName, imageData, tags, creationTime, storyTime, latitude, longitude); Log.d(LOG_TAG, "imageName" + imageNameET.getText()); Log.d(LOG_TAG, "newStoryData:" + newData); // insert it through Resolver to be put into the database try { resolver.insert(newData); } catch (RemoteException e) { Log.e(LOG_TAG, "Caught RemoteException => " + e.getMessage()); e.printStackTrace(); } finish(); // same as hitting 'back' button } /** * Method to be called when Audio Clicked button is pressed. */ public void addAudioClicked(View aView) { Log.v(LOG_TAG, "addAudioClicked(View) called."); //Create an intent to start the SoundRecordActivity Intent soundIntent = new Intent(this, SoundRecordActivity.class); // Line 275 // Tell the sound activity where to store the recorded audio. String fileName = StorageUtilities.getOutputMediaFile(this, // Line 278 StorageUtilities.MEDIA_TYPE_AUDIO, StorageUtilities.SECURITY_PUBLIC, null).getAbsolutePath(); if (fileName == null) return; soundIntent.putExtra("FILENAME", fileName); // Start the SoundRecordActivity startActivityForResult(soundIntent, MIC_SOUND_REQUEST); } /** * Method to be called when the Add Photo button is pressed. */ public void addPhotoClicked(View aView) { Log.v(LOG_TAG, "addPhotoClicked(View) called."); // Line 297 // Create an intent that asks for an image to be captured Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); // Tell the capturing activity where to store the image Uri uriPath = StorageUtilities.getOutputMediaFileUri(this, // Line 304 StorageUtilities.MEDIA_TYPE_IMAGE, StorageUtilities.SECURITY_PUBLIC, null); if (uriPath == null) return; imagePath = uriPath; cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imagePath); // Start the activity startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); // Line 317 } /** * Method to be called when the user clicks the "Get Location" button * @param aView */ public void getLocationClicked(View aView) { // Acquire a reference to the system Location Manager final LocationManager locationManager = (LocationManager) this .getSystemService(Context.LOCATION_SERVICE); // Define a listener that responds to location updates LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { // Called when a new location is found by the network location // provider. Toast.makeText(getApplicationContext(), "New Location obtained.", Toast.LENGTH_LONG).show(); // Line 337 setLocation(location); locationManager.removeUpdates(this); } // We must define these to implement the interface, but we don't do anything when they're triggered. public void onStatusChanged(String provider, int status, Bundle extras) { } public void onProviderEnabled(String provider) { } public void onProviderDisabled(String provider) { } }; // Register the listener with the Location Manager to receive location // updates if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Log.d(LOG_TAG, "locationManager.isProviderEnabled = true/gps"); locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, locationListener); Location location = locationManager .getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { setLocation(location); } else { Toast.makeText(getApplicationContext(), "GPS has yet to calculate location.", Toast.LENGTH_LONG) .show(); } } else { Toast.makeText(getApplicationContext(), "GPS is not enabled.", Toast.LENGTH_LONG).show(); } } /** * Update the UI with a new location. * @param location */ public void setLocation(Location location) { Log.d(LOG_TAG, "setLocation =" + location); // Line 382 loc = location; double latitude = loc.getLatitude(); double longitude = loc.getLongitude(); latitudeValue.setText("" + latitude); longitudeValue.setText("" + longitude); } /** * This is called when an activity that we've started returns a result. * * In our case, we're looking for the results returned from the SoundRecordActivity * or the Camera Activity */ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(LOG_TAG, "CreateFragment onActivtyResult called. requestCode: " + requestCode + " resultCode:" + resultCode + "data:" + data); if (requestCode == CreateStoryActivity.CAMERA_PIC_REQUEST) { if (resultCode == CreateStoryActivity.RESULT_OK) { // Image captured and saved to fileUri specified in the Intent imagePathFinal = imagePath; imageLocation.setText(imagePathFinal.toString()); } else if (resultCode == CreateStoryActivity.RESULT_CANCELED) { // User cancelled the image capture } else { // Image capture failed, advise user Toast.makeText(getApplicationContext(), "Image capture failed.", Toast.LENGTH_LONG) .show(); } } else if (requestCode == CreateStoryActivity.MIC_SOUND_REQUEST) { // If we successfully recorded sound, grab the results. if (resultCode == SoundRecordActivity.RESULT_OK) { audioPath = (String) data.getExtras().get("data"); // Line 421 audioLocation.setText(audioPath.toString()); } // If not, let the user know. else { Toast.makeText(this, "Sound capture failed.", Toast.LENGTH_LONG).show(); } } } }
356623afc4d46b2d718476ff2f6004cbda6521fa
7faeb3ef9662fcd965d0cfcbd1b7d384a58d1eff
/messenger/src/main/java/com/felixlaura/messenger/resources/ProfileResource.java
a43438ddc783e1f5c0f064cc64dbe910adfc981a
[]
no_license
felixala/messenger
51a9a1aa86f8c243d4dd76ab2bbe570b0ae17c98
b6156b2812bebc435c684d387a05e43808459042
refs/heads/master
2021-01-10T11:28:48.882891
2015-11-30T06:26:15
2015-11-30T06:26:15
46,945,978
0
0
null
null
null
null
UTF-8
Java
false
false
1,587
java
package com.felixlaura.messenger.resources; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import com.felixlaura.messenger.model.Profile; import com.felixlaura.messenger.service.ProfileService; @Path("/profiles") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class ProfileResource { ProfileService profileService = new ProfileService(); /* @GET public List<Profile> getProfiles() { return profileService.getAllProfile(); }*/ @GET public List<Profile> getProfiles(@QueryParam("lastName") String lastName) { if(lastName != null){ return profileService.getAllProfileByLastName(lastName); } return profileService.getAllProfile(); } @GET @Path("/{profileName}") public Profile getProfile(@PathParam("profileName") String profilename) { return profileService.getProfile(profilename); } @POST public Profile addProfile(Profile profile) { return profileService.addProfile(profile); } @PUT @Path("/{profileName}") public Profile updateProfile(@PathParam("profileName") String profileName, Profile profile) { profile.setProfileName(profileName); return profileService.updateProfile(profile); } @DELETE @Path("/{profileName}") public void deleteProfile(@PathParam("profileName") String profileName) { profileService.removeProfile(profileName); } }
317ea09da25e60a7a82b7095b2bf208361ab5857
fb41c04a4ead3b79625d0eb30ca85f0fd1c2d4c9
/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/SelectOverheadParameters.java
55f1b57f927177d4f896b69b90c455879a2f6800
[ "Apache-2.0", "LicenseRef-scancode-takuya-ooura" ]
permissive
thhart/BoofCV
899dcf1b4302bb9464520c36a9e54c6fe35969c7
43f25488673dc27590544330323c676f61c1a17a
refs/heads/SNAPSHOT
2023-08-18T10:19:50.269999
2023-07-15T23:13:25
2023-07-15T23:13:25
90,468,259
0
0
Apache-2.0
2018-10-26T08:47:44
2017-05-06T14:24:01
Java
UTF-8
Java
false
false
5,071
java
/* * Copyright (c) 2021, Peter Abeles. All Rights Reserved. * * This file is part of BoofCV (http://boofcv.org). * * 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 boofcv.alg.sfm.overhead; import boofcv.struct.calib.CameraPinholeBrown; import boofcv.struct.image.ImageBase; import boofcv.struct.image.ImageType; import georegression.struct.point.Point2D_F64; import georegression.struct.se.Se3_F64; /** * Give a camera's intrinsic and extrinsic parameters, selects a reasonable overhead view to render the image onto. It * attempts to maximize viewing area. The user can crop the height of the overhead view to reduce the amount of * unusable image space in the map. This is particularly useful for cameras at an acute angle relative to the * ground plane. Overhead cameras pointed downward should set it to 1.0 * * @author Peter Abeles */ public class SelectOverheadParameters { // used to project pixels onto the plane CameraPlaneProjection proj = new CameraPlaneProjection(); // the selected overhead map values int overheadWidth; int overheadHeight; double centerX; double centerY; // --- User specified parameters // size of cells on the plane double cellSize; // determines the minimum resolution double maxCellsPerPixel; // used to crop the views's height. Specifies the fraction of the "optimal" height which is actually used. double viewHeightFraction; // local variables Point2D_F64 plane0 = new Point2D_F64(); Point2D_F64 plane1 = new Point2D_F64(); /** * Configure algorithm. * * @param cellSize Size of cells in plane in world units * @param maxCellsPerPixel Specifies minimum resolution of a region in overhead image. A pixel in the camera * can't overlap more than this number of cells. Higher values allow lower * resolution regions. Try 4. * @param viewHeightFraction Reduce the view height by this fraction to avoid excessive unusable image space. Set to * 1.0 to maximize the viewing area and any value less than one to crop it. */ public SelectOverheadParameters( double cellSize, double maxCellsPerPixel, double viewHeightFraction ) { this.cellSize = cellSize; this.maxCellsPerPixel = maxCellsPerPixel; this.viewHeightFraction = viewHeightFraction; } /** * Computes the view's characteristics * * @param intrinsic Intrinsic camera parameters * @param planeToCamera Extrinsic camera parameters which specify the plane * @return true if successful or false if it failed */ public boolean process( CameraPinholeBrown intrinsic, Se3_F64 planeToCamera ) { proj.setPlaneToCamera(planeToCamera, true); proj.setIntrinsic(intrinsic); // find a bounding rectangle on the ground which is visible to the camera and at a high enough resolution double x0 = Double.MAX_VALUE; double y0 = Double.MAX_VALUE; double x1 = -Double.MAX_VALUE; double y1 = -Double.MAX_VALUE; for (int y = 0; y < intrinsic.height; y++) { for (int x = 0; x < intrinsic.width; x++) { if (!checkValidPixel(x, y)) continue; if (plane0.x < x0) x0 = plane0.x; if (plane0.x > x1) x1 = plane0.x; if (plane0.y < y0) y0 = plane0.y; if (plane0.y > y1) y1 = plane0.y; } } if (x0 == Double.MAX_VALUE) return false; // compute parameters with the intent of maximizing viewing area double mapWidth = x1 - x0; double mapHeight = y1 - y0; overheadWidth = (int)Math.floor(mapWidth/cellSize); overheadHeight = (int)Math.floor(mapHeight*viewHeightFraction/cellSize); centerX = -x0; centerY = -(y0 + mapHeight*(1 - viewHeightFraction)/2.0); return true; } /** * Creates a new instance of the overhead view */ public <T extends ImageBase<T>> OverheadView createOverhead( ImageType<T> imageType ) { OverheadView ret = new OverheadView(); ret.image = imageType.createImage(overheadWidth, overheadHeight); ret.cellSize = cellSize; ret.centerX = centerX; ret.centerY = centerY; return ret; } private boolean checkValidPixel( int x, int y ) { if (!proj.pixelToPlane(x, y, plane0)) return false; if (!proj.pixelToPlane(x + 1, y + 1, plane1)) return false; double width = Math.abs(plane0.x - plane1.x); double height = Math.abs(plane0.y - plane1.y); if (width > maxCellsPerPixel*cellSize) return false; return !(height > maxCellsPerPixel*cellSize); } public int getOverheadWidth() { return overheadWidth; } public int getOverheadHeight() { return overheadHeight; } public double getCenterX() { return centerX; } public double getCenterY() { return centerY; } }
1acbf2425d9639da5756954b9d2c16db026a40d5
ed519a9c80723b446cb3918574dcf0a24e5afb10
/src/topic/Inheritance/square.java
8146c9890308965183001e16ef78b247493c2cd7
[]
no_license
nddhieu/JavaDemo
6e905f632d4bd963cba552ba1a10ae62b9551924
c627e1cd71fe4050e4835dc04bb0c74e7caff08c
refs/heads/master
2020-04-09T16:19:11.277410
2018-12-21T08:50:27
2018-12-21T08:50:27
160,450,467
0
0
null
2018-12-21T05:58:09
2018-12-05T02:46:58
Java
UTF-8
Java
false
false
201
java
package topic.Inheritance; public class square extends shape{ void draw(){ System.out.println("draw square"); } void erase(){ System.out.println(("erase square")); } }
9b8f08de2d4b83aa69820ac3d7fd99cc9ba14e5a
75962c018572404bba808afba3ff56a748436d4c
/Programming/Java/sem4/Lab6_1/src/bsu/fpmi/artsiushkevich/Main.java
d954213b74df4c91907ed3e9a9a93ad2cb6d50a6
[]
no_license
thekirjava/BSU
0f313df3ff9dda3df37efeeee813fbfd466a977e
33d56c9adc9b6873f2bb360c0d7089dc458eb451
refs/heads/master
2021-11-20T14:07:55.287509
2021-10-17T19:37:07
2021-10-17T19:37:07
220,980,538
0
1
null
null
null
null
UTF-8
Java
false
false
211
java
package bsu.fpmi.artsiushkevich; import javax.swing.*; public class Main { public static void main(String[] args) { MainWindow window = new MainWindow(); window.setVisible(true); } }
67d66d6ac105bf3b2923b157ded1f537ee8e33c5
3e01d3a01b61a0b0c80d71964abf546a92be10eb
/src/main/java/com/atos/coderank/services/ProjectMetricsService.java
cdedf70469c3f62bb1db359233f93c97fd04b4c5
[]
no_license
0fprod/coderank
5c61a3ef0dbaf10ffc071ff86d6f694580ba71e5
1fc2dca60206aaef254d8c384f6d94b8d4db712c
refs/heads/master
2023-06-07T15:45:11.560280
2018-04-23T15:17:35
2018-04-23T15:17:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,505
java
package com.atos.coderank.services; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.atos.coderank.components.SonarUtils; import com.atos.coderank.entities.ProjectEntity; import com.atos.coderank.entities.ProjectMetricsEntity; import com.atos.coderank.repositories.ProjectMetricsRepository; @Service("projectMetricsService") public class ProjectMetricsService { @Autowired @Qualifier("sonarUtils") private SonarUtils su; @Autowired @Qualifier("projectService") private ProjectService ps; @Autowired @Qualifier("projectMetricsRepository") private ProjectMetricsRepository pmr; public ProjectMetricsEntity calcSonarQubeMetrics(ProjectEntity project) { ProjectMetricsEntity pme = this.su.scanOneProject(project.getKey()); project.setProjectId(pme.getProject().getProjectId()); pme.setProject(project); return pme; } public List<ProjectMetricsEntity> findAllMostRecent() { return this.pmr.findMostRecents(); } public ProjectMetricsEntity findMostRecentByProjectId(String projectId) { return this.pmr.findMostRecentByProjectId(projectId); } public void deleteMetricsByProjectId(ProjectEntity project) { List<ProjectMetricsEntity> list = project.getMetrics(); for (ProjectMetricsEntity entity : list) this.pmr.deleteById(entity.getMetricsId()); } }
a3eed9e126ae85b56ad7772d244931b00b3379ae
3a2878d17af4fbd8e3c1304e1e20a3101833fc18
/src/org/nova/game/player/content/dungeoneering/DungeonPartyManager.java
224ae61d1f99dc86afceac1098bd42eaa45fcca7
[]
no_license
karimshan/nova-server
452f2cdc1bd87c560d3e1ff7422e211cd12f976c
861f9daa812372d74cfe7f45fceb8cab2853b4ca
refs/heads/master
2021-05-14T17:40:34.624397
2018-01-02T21:06:29
2018-01-02T21:06:29
116,051,463
0
0
null
null
null
null
UTF-8
Java
false
false
1,697
java
package org.nova.game.player.content.dungeoneering; import java.util.concurrent.CopyOnWriteArrayList; import org.nova.game.player.Player; import org.nova.game.player.Skills; public final class DungeonPartyManager { private String leader; private int floor; private int complexity; private CopyOnWriteArrayList<DungeonPartyPlayer> team; private DungeonManager dungeon; public DungeonPartyManager(Player player) { setLeader(player.getUsername()); team = new CopyOnWriteArrayList<DungeonPartyPlayer>(); team.add(new DungeonPartyPlayer(player)); setDefaults(); start(DungeonConstants.SMALL_DUNGEON); // temporary } public void setDefaults() { floor = 1; complexity = 1; } public void start(int size) { if (dungeon != null) return; dungeon = new DungeonManager(this, size); } public int getComplexity() { return complexity; } public int getFloor() { return floor; } public int getFloorType() { return DungeonUtils.getFloorType(floor); } public int getDungeoneeringLevel() { int level = 120; for (DungeonPartyPlayer player : team) { int playerLevel = player.getPlayer().getSkills() .getLevelFromXP(Skills.DUNGEONEERING); if (playerLevel < level) level = playerLevel; } return level; } public DungeonPartyPlayer getDPlayer(Player player) { for (DungeonPartyPlayer p : team) if (p.getPlayer() == player) return p; return null; } public CopyOnWriteArrayList<DungeonPartyPlayer> getTeam() { return team; } public String getLeader() { return leader; } public void setLeader(String leader) { this.leader = leader; } }
de9be81d5667a8f4ac8c3dd5d48d381927662124
1b17119f1ae56824623296f2bf5ed2c48f7fcf1c
/NonVeggies/src/main/java/com/nonveggies/entity/NvHookModuleExceptions.java
df6170691c33b40ea2c7d5a0364123791395b65f
[]
no_license
gauravsaxena1611/Non-Veggies
b03eed2d7ad535fb29c361075b0985231bee95d2
efc480fa581fcad0707e2f7f3a8047a41dbf4a9d
refs/heads/master
2020-03-18T17:30:59.909485
2018-05-27T09:55:38
2018-05-27T09:55:38
135,033,099
0
0
null
null
null
null
UTF-8
Java
false
false
2,055
java
package com.nonveggies.entity; // Generated Jan 2, 2016 7:30:29 AM by Hibernate Tools 3.4.0.CR1 import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.Table; /** * NvHookModuleExceptions generated by hbm2java */ @Entity @Table(name = "nv_hook_module_exceptions", catalog = "NVPrestashop") public class NvHookModuleExceptions implements java.io.Serializable { private Integer idHookModuleExceptions; private int idShop; private int idModule; private int idHook; private String fileName; public NvHookModuleExceptions() { } public NvHookModuleExceptions(int idShop, int idModule, int idHook) { this.idShop = idShop; this.idModule = idModule; this.idHook = idHook; } public NvHookModuleExceptions(int idShop, int idModule, int idHook, String fileName) { this.idShop = idShop; this.idModule = idModule; this.idHook = idHook; this.fileName = fileName; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id_hook_module_exceptions", unique = true, nullable = false) public Integer getIdHookModuleExceptions() { return this.idHookModuleExceptions; } public void setIdHookModuleExceptions(Integer idHookModuleExceptions) { this.idHookModuleExceptions = idHookModuleExceptions; } @Column(name = "id_shop", nullable = false) public int getIdShop() { return this.idShop; } public void setIdShop(int idShop) { this.idShop = idShop; } @Column(name = "id_module", nullable = false) public int getIdModule() { return this.idModule; } public void setIdModule(int idModule) { this.idModule = idModule; } @Column(name = "id_hook", nullable = false) public int getIdHook() { return this.idHook; } public void setIdHook(int idHook) { this.idHook = idHook; } @Column(name = "file_name") public String getFileName() { return this.fileName; } public void setFileName(String fileName) { this.fileName = fileName; } }
7b7a9937268d6b1400916996256fa1011286a77b
56cd9bd526dff65d16e0b7bb0904f072b854c901
/GameArena/src/main/java/me/dnorris/data/Method.java
79d94db9ba9ba287307103100b15c89a8b589a09
[]
no_license
danorris709/JavaPool
04484211cd7a76a3f7fae8f4be8fb8cb4aa6f5e5
e2adcf5f707d149aee5734dc77c89d84a3fc1622
refs/heads/master
2022-06-23T05:54:05.498791
2020-05-14T16:28:42
2020-05-14T16:28:42
257,666,852
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package me.dnorris.data; /** * * Interface used for representation a function that takes one parameter but * doesn't return anything. * * @param <T> The type of the parameter for the function * @author https://github.com/danorris709 */ public interface Method<T> { /** * * Similar naming to {@link Runnable}. As can be represented by a lambda and thus there's no * name that represents the function better. * * @param t The only parameter of type {@link T} */ void run(T t); }
7b766326e1e52df10acdd0d96e5224d469822e7b
3bf6bab0051bebdfef770af7c9f845335a83c97b
/src/main/java/com/fuber/entities/Location.java
0fae04c00b4811d82e7d7ee9c927098983f1b704
[]
no_license
Jaskaranjit/fuber-app
df8094ca21232164873346f946297003ee3164d8
301c74d190f9b554062a09dc3580b8d4183dce66
refs/heads/master
2021-05-06T21:12:59.757713
2017-12-01T09:52:38
2017-12-01T09:52:38
112,571,070
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
package com.fuber.entities; /** * POJO class for location parameters * Created by Jaskaranjit on 11/30/17. */ public class Location { private double latitude; private double longitude; /** * default constructor */ public Location() { // do nothing } /** * Initialise the {@link Location} * @param latitude latitude * @param longitude longitude */ public Location( double latitude, double longitude ) { this.latitude = latitude; this.longitude = longitude; } public double getLatitude() { return latitude; } public double getLongitude() { return longitude; } public void setLatitude( double latitude ) { this.latitude = latitude; } public void setLongitude( double longitude ) { this.longitude = longitude; } @Override public String toString() { return "Location{" + "latitude=" + latitude + ", longitude=" + longitude + '}'; } }
8dbd8535c17a43c8f4df7cce68150d70c7dee009
6ad6736333a92933f84971e336555811653ab1b4
/src/main/java/cn/com/deepdata/elasticsearch/core/inter/ElasticsearchOperations.java
52348be653d2a799290d0385101113b1e5213ac0
[]
no_license
344399160/es-client
6728b1bd7bda02ccac921efb61ff944ba6cdae46
3fcaca0959227b3298136353ecd9ffa85de2cd05
refs/heads/master
2021-01-21T00:16:18.363074
2018-09-28T10:03:12
2018-09-28T10:03:12
101,865,036
5
3
null
null
null
null
UTF-8
Java
false
false
4,256
java
package cn.com.deepdata.elasticsearch.core.inter; import cn.com.deepdata.elasticsearch.core.mapping.ElasticsearchPersistentEntity; import cn.com.deepdata.elasticsearch.core.query.QueryConstructor; import cn.com.deepdata.elasticsearch.model.Page; import org.elasticsearch.client.Client; import org.elasticsearch.search.aggregations.AggregationBuilder; import java.util.List; import java.util.Map; /** * @Author: qiaobin * @Description: ES服务接口 * @Date: Created in 11:48 2017/7/31 */ public interface ElasticsearchOperations{ /** * @return elasticsearch client */ Client getClient(); /** * Create an index for a class * * @param indexName */ boolean createIndex(String indexName); /** * Create an index for a class * * @param clazz */ <T> boolean createIndex(Class<T> clazz); /** * delete an index for a class * * @param clazz */ <T> boolean deleteIndex(Class<T> clazz); /** * Create mapping for a class * * @param clazz * @param <T> */ <T> boolean putMapping(Class<T> clazz); <T> T save(T entity); /** * Create an index for a indexName and Settings * * @param indexName * @param alias * @param shards * @param replicas * @param refreshInterval * @param indexStoreType */ void createIndex(String indexName, String alias, int shards, int replicas, String refreshInterval, String indexStoreType); /** * If index exists * * @param indexName */ boolean indexExist(String indexName); /** * find class by id * @param id * @param clazz * @param <T> */ <T> T findById(String id, Class<T> clazz); /** * get @Document annotation contributions from a class * @param clazz */ ElasticsearchPersistentEntity getPersistentEntityFor(Class clazz); /** * delete a class * @param entity * @param <T> */ <T> void delete(T entity); /** * delete a class * @param id * @param clazz * @param <T> */ <T> void delete(String id, Class<T> clazz); /** * update a class * @param <T> * @param entity */ <T> T update(T entity); /** * update a class * @param <T> * @param _id * @param entity */ <T> T update(String _id, T entity); /** * save entities * @param entities * @param <T> */ <T> void save(List<T> entities); /** * refresh index * @param indexName */ void refresh(String indexName); /** * count index total documents * @param clazz * @param <T> */ <T> long count(Class<T> clazz); /** * count col total documents * @param clazz * @param <T> */ <T> long count(QueryConstructor constructor, String countBy, Class<T> clazz); /** * search from index * @param constructor * @param clazz * @param <T> */ <T> Iterable<T> search(QueryConstructor constructor, Class<T> clazz); /** * search from index * @param sql * @param clazz * @param <T> */ <T> Iterable<T> sqlQuery(String sql, Class<T> clazz); /** * search from index * @param sql * @param clazz * @param <T> */ <T> Page<T> sqlPageQuery(String sql, Class<T> clazz); /** * search from index * @param constructor * @param includes * @param excludes * @param clazz * @param <T> * @return */ <T> List<Map<String, Object>> search(QueryConstructor constructor, String[] includes, String[] excludes, Class<T> clazz); /** * stat index column by search constructor * @param constructor * @param statBy * @param clazz * @param <T> * @return */ <T> Map<String, Object> statSearch(QueryConstructor constructor, String statBy, Class<T> clazz); /** * stat index column by search constructor * @param constructor * @param agg * @param clazz * @param <T> * @return */ <T> Map<String, Object> statSearch(QueryConstructor constructor, AggregationBuilder agg, Class<T> clazz); }
88b2bb849a62582cbbb6241c8c9e4b5d6c1c7bb1
cc277e2e4117b3205d063e0e8501f557dc5f3d18
/src/main/java/com/things/phydev/transport/DataLinkLayer.java
ae8bb0658432d0aa16101392ad8d77c378b0c3d9
[]
no_license
iqnev/SmartDevices
b10bf46870660baceb273a4a8f09280827de44cf
01de3d5382b36b0a9679223f88b9102b861f2d9b
refs/heads/master
2020-12-25T16:47:54.249288
2017-05-05T20:28:20
2017-05-05T20:28:20
67,435,056
7
0
null
null
null
null
UTF-8
Java
false
false
1,428
java
/** * Copyright (c) 2016 Ivelin Yanev <[email protected]>. * 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. * <p> * 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. * <p> * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA */ package com.things.phydev.transport; import com.things.phydev.communication.Packet; import java.net.Socket; public interface DataLinkLayer { /** * Performs serialization of the <code>Message</code> object in the * appropriate data format. * * @param prMessage the <code>Message</code> object {@link Packet}. * @return the data in appropriate format. */ public byte[] parsePacket(Packet prMessage); /** * Returns <code>Packet</code> object by input stream. * * @param connectionß * @return the <code>Packet</code> object. */ public Packet getRequestPackage(Socket connection); }
47077de7b424bb4d7973226620fd28f432b9a7a0
4cb2506c2bc2009392dfc2cabd98f2da6c2923b0
/cutRod/src/cutrod/CutRod.java
d6288d4090a1efa902a7791aeb8113d56ff8204f
[]
no_license
Meryemgezici/java
8e2ca2d64ca800a535431428f9042b00671dee84
cbe09146d87cb6c5da3c40bcb72500c17128e824
refs/heads/main
2023-05-29T00:39:25.109288
2021-06-14T23:12:08
2021-06-14T23:12:08
376,977,912
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
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 cutrod; /** * * @author HP Omen */ public class CutRod { static int cutRodp(int price[], int n) { if (n <= 0) return 0; int max_val = Integer.MIN_VALUE; // Recursively cut the rod in different pieces and // compare different configurations for (int i = 0; i<n; i++){ max_val = Math.max(max_val,price[i] + cutRodp(price, n-i-1)); System.out.println("\nMaximum Obtainable Value is:%d \n "+max_val+"i:"+i); } return max_val; } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int arr[] = new int[] {1, 5, 8, 9, 10, 17, 17, 20}; int size = arr.length; System.out.println("Maximum Obtainable Value is "+ cutRodp(arr, size)); } }
7032bdeb10fee19926edc38e37d5884e77ba21f4
c4635ee657174085d815d22c5b05dcc2dad1b07f
/app/src/test/java/com/example/bor/pizzeria/ExampleUnitTest.java
840b67f66bcf3db9bf419089f7c69447d8efbc87
[]
no_license
bor91k/Pizzeria
89842ae52161d1027aa00c5cf9d08606913cc7d8
aebe66f14b8bf3bf17cda038003d1685886d358c
refs/heads/master
2020-03-30T14:24:53.220181
2018-10-02T20:30:05
2018-10-02T20:30:05
151,316,980
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.example.bor.pizzeria; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
f107d271243ab704ceaf2f9849bb5fab35a33167
3dbbe6d13223610f81e989aae3509910cc3fb7b4
/src/test/java/com/zerobank/utilities/Driver.java
090b02101e83d903416010253fb35d12d51b1f6a
[]
no_license
sofochka87/Zero-Bank
7479868cdaa4339b1980d190151cc228ff71163a
e78f55687885b0d728021d21cadeca408f3437c3
refs/heads/master
2020-03-24T01:46:40.439499
2018-08-17T02:06:55
2018-08-17T02:06:55
142,351,100
0
0
null
null
null
null
UTF-8
Java
false
false
1,448
java
package com.zerobank.utilities; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import io.github.bonigarcia.wdm.WebDriverManager; public class Driver { private Driver() {} private static WebDriver driver; public static WebDriver getDriver() { if (driver == null) { switch (ConfigurationReader.getProperty("browser")) { case "firefox": WebDriverManager.firefoxdriver().setup(); //driver = new FirefoxDriver(); DesiredCapabilities caps2 = DesiredCapabilities.firefox(); caps2.setPlatform(Platform.ANY); try { driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),caps2); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } break; case "chrome": WebDriverManager.chromedriver().setup(); driver = new ChromeDriver(); break; case "ie": WebDriverManager.iedriver().setup(); driver = new InternetExplorerDriver(); break; } } return driver; } public static void closeDriver() { if (driver != null) { driver.quit(); driver = null; } } }
b24cad3b12aeb83cdecc7ed8865d30f4d8f066aa
1939fc7fc495dcd78d465698e5221ac85cbff0f8
/api-common/src/main/java/com/bike/user/oauth/xiaomi/XiaomiOauthClient.java
09684fbe4edfd8d8ee64d9ce56c97bc94f258fff
[]
no_license
maohaitao/hivier_demo
eda3e2fa41b9bbb308cbb5dfa93b69e1e296c339
eed73138102166b3582b37768a0fb4dc3e8597cc
refs/heads/master
2020-05-27T21:15:30.671972
2017-03-16T10:55:01
2017-03-16T10:55:01
83,643,067
0
0
null
null
null
null
UTF-8
Java
false
false
2,685
java
package com.bike.user.oauth.xiaomi; import com.bike.user.model.OauthUser; import com.bike.user.model.TAccount; import com.bike.user.oauth.IOauthClient; import com.g3.common.http.HttpClientUtil; import com.google.gson.JsonObject; import com.sf.common.exception.AppException; import com.sf.common.reflection.property.PropertiesUtil; import com.sf.common.util.CommonUtil; import com.sf.common.util.JsonUtil; /** * Created by a700 on 16/10/28. */ public class XiaomiOauthClient implements IOauthClient { private static final XiaomiConfig xiaomiConfig = PropertiesUtil.getConfig("xiaomiconfig.properties", XiaomiConfig.class); public static void main(String[] args) { XiaomiOauthClient xiaomiOauthClient = new XiaomiOauthClient(); try { xiaomiOauthClient.getNickName("2882303761517458686", "V2_om3_-l6WFDYHfcaFCzTM1h7UmtQAxHwxjRYigiNytEbIJsPKV2yw-50A_Apx17UWHtULDqmpVGzcHb5WEbwn5pwYQdxLOdhFIPleS0GmRs6kKHeRbQzpreoUxLrKmPYY"); } catch (Exception e) { e.printStackTrace(); } } public String authorize(String state) { StringBuilder sb = new StringBuilder(); return sb.toString(); } @Override public String getAccessToken(String code) throws Exception { return null; } @Override public OauthUser getOauthUser(String code) throws Exception { return null; } @Override public TAccount getNickName(String clientId, String accessToken) throws Exception { if (CommonUtil.isNull(accessToken)) { throw new AppException(-6, "小米 accessToken 没有获取到响应参数,可能是用户取消了授权。 "); } String url = xiaomiConfig.getBaseURL() + "?clientId=" + xiaomiConfig.getClient_ID() + "&token=" + accessToken; String responseText = HttpClientUtil.get(url).getStringData(); JsonObject json = JsonUtil.parse(responseText); System.out.println("json=="+json); if ("ok".equals(JsonUtil.getValue(json, "result"))) { JsonObject data = json.getAsJsonObject("data"); System.out.println("data=="+data); if (data != null) { String nickname = JsonUtil.getValue(data, "miliaoNick"); TAccount account = new TAccount(); account.setNickName(nickname); String userFace = JsonUtil.getValue(data, "miliaoIcon_90"); account.setUserFace(userFace); account.setOpenId(JsonUtil.getValue(data, "userId")); return account; } else { return null; } } else { return null; } } }
d86baad96d4286bcd0f03461de8c2926db63c7c5
37ea413d226011b0950a836a0d5466f019633d59
/JavaSEPro/src/chap04/sec03/Demo1.java
52fc69c1b68c70de379ca9adf120c4b414c51bc5
[]
no_license
magicmai/learn-java
58931e1a2c379b376d3f6a7356147eb65fba303a
a83fb3cc80d4033acb64cea50b660d14ade2aed1
refs/heads/master
2020-03-16T13:13:47.493146
2018-05-10T05:53:38
2018-05-10T05:53:38
132,684,225
0
0
null
null
null
null
GB18030
Java
false
false
488
java
package chap04.sec03; public class Demo1 { /** * 把异常向外面抛 * @throws NumberFormatException */ public static void testThrows() throws NumberFormatException { String s = "123a"; int a = Integer.parseInt(s); System.out.println(a); } public static void main(String[] args) { try { testThrows(); System.out.println("OK"); } catch (Exception e) { System.out.println("处理异常"); e.printStackTrace(); } System.out.println("mark"); } }
2de9fb70a0a97607b7a541c6ecafdf89bd025b7b
79571f6a11c9ef757ec0aa19362c2c6f39fbc7a2
/pfms/src/main/java/org/tom/pfms/service/impl/NbContactServiceImpl.java
f1f9ac91f50f914d60e82e3a50aa39e57184240d
[]
no_license
hanpoyang/pfms
4f2081240c25f0586eaa6aa1082fa00d44b8bfd1
0c69b738806b3ad6dc9120a993d17809ae0ce31e
refs/heads/master
2023-03-06T22:45:36.375632
2023-03-02T13:25:22
2023-03-02T13:25:22
80,273,219
0
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
package org.tom.pfms.service.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.tom.pfms.common.dto.NbContactDTO; import org.tom.pfms.common.dto.PaginatedDTO; import org.tom.pfms.common.dto.RequestParam; import org.tom.pfms.common.exception.DaoException; import org.tom.pfms.common.exception.ServiceException; import org.tom.pfms.dao.NbContactDao; import org.tom.pfms.service.BaseService; import org.tom.pfms.service.NbContactService; @Service public class NbContactServiceImpl extends BaseService implements NbContactService { @Resource NbContactDao nbContactDao; @Override public PaginatedDTO<NbContactDTO> queryNbContact(RequestParam rp) throws ServiceException { try{ return nbContactDao.queryNbContact(rp); }catch(DaoException ex) { log.error("queryNbContact", ex); throw new ServiceException(ex); } } @Override public void insertNbContact(RequestParam rp) throws ServiceException { try{ nbContactDao.insertNbContact(rp); }catch(DaoException ex) { log.error("insertNbContact", ex); throw new ServiceException(ex); } } @Override public void updateNbContact(RequestParam rp) throws ServiceException { try{ nbContactDao.updateNbContact(rp); }catch(DaoException ex) { log.error("updateNbContact", ex); throw new ServiceException(ex); } } @Override public void deleteNbContact(RequestParam rp) throws ServiceException { try{ nbContactDao.deleteNbContact(rp); }catch(DaoException ex) { log.error("deleteNbContact", ex); throw new ServiceException(ex); } } @Override public void invalidNbContact(RequestParam rp) throws ServiceException { try{ nbContactDao.invalidNbContact(rp); }catch(DaoException ex) { log.error("invalidNbContact", ex); throw new ServiceException(ex); } } }
6b272a5aa04df2bd69b5d7dd675d15cfd91042c6
e09bbe5565439e90d6261a0d0b0a12bf6134ee0d
/src/cn/wpeace/zktest/ConcurrentTest.java
ef10a9b6866b7ae507f488c0bf36d9514e346958
[]
no_license
whatislife/zkDemo
c502efb6082af29c6ec410507feaffc06013a4ec
589bdd624caadd3e3db75518122a5db0f1de1bea
refs/heads/master
2021-08-22T11:13:54.036041
2017-11-30T03:04:11
2017-11-30T03:04:11
112,554,107
0
0
null
null
null
null
UTF-8
Java
false
false
2,991
java
package cn.wpeace.zktest; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; public class ConcurrentTest { private CountDownLatch startSignal = new CountDownLatch(1);//开始阀门 private CountDownLatch doneSignal = null;//结束阀门 private CopyOnWriteArrayList<Long> list = new CopyOnWriteArrayList<Long>(); private AtomicInteger err = new AtomicInteger();//原子递增 private ConcurrentTask[] task = null; public ConcurrentTest(ConcurrentTask... task){ this.task = task; if(task == null){ System.out.println("task can not null"); System.exit(1); } doneSignal = new CountDownLatch(task.length); start(); } /** * @param args * @throws ClassNotFoundException */ private void start(){ //创建线程,并将所有线程等待在阀门处 createThread(); //打开阀门 startSignal.countDown();//递减锁存器的计数,如果计数到达零,则释放所有等待的线程 try { doneSignal.await();//等待所有线程都执行完毕 } catch (InterruptedException e) { e.printStackTrace(); } //计算执行时间 getExeTime(); } /** * 初始化所有线程,并在阀门处等待 */ private void createThread() { long len = doneSignal.getCount(); for (int i = 0; i < len; i++) { final int j = i; new Thread(new Runnable(){ public void run() { try { startSignal.await();//使当前线程在锁存器倒计数至零之前一直等待 long start = System.currentTimeMillis(); task[j].run(); long end = (System.currentTimeMillis() - start); list.add(end); } catch (Exception e) { err.getAndIncrement();//相当于err++ } doneSignal.countDown(); } }).start(); } } /** * 计算平均响应时间 */ private void getExeTime() { int size = list.size(); List<Long> _list = new ArrayList<Long>(size); _list.addAll(list); Collections.sort(_list); long min = _list.get(0); long max = _list.get(size-1); long sum = 0L; for (Long t : _list) { sum += t; } long avg = sum/size; System.out.println("min: " + min); System.out.println("max: " + max); System.out.println("avg: " + avg); System.out.println("err: " + err.get()); } //接口 public interface ConcurrentTask { void run(); } }
b0a4466f875313f19e27daf2b56dd96fd812b5b5
cfd103d3556346e59f2fdb6017b4ce0bafbf686a
/src/test/java/PetsAmok/VirtualShelterPetTest.java
44d20757589879cee914b1857965346bb1586950
[]
no_license
kfiddle/ken-virtual-pets-amok
d367ff6bf1bdac10a4addcd74122b1d26009d7c3
54176c70914edac1798e3ab27b1c6c0b38b3f6bc
refs/heads/master
2022-12-23T13:51:51.602663
2020-09-25T16:07:58
2020-09-25T16:07:58
296,653,204
0
0
null
null
null
null
UTF-8
Java
false
false
4,012
java
package PetsAmok; import org.junit.jupiter.api.Test; import java.util.ArrayList; import static org.junit.jupiter.api.Assertions.assertEquals; public class VirtualShelterPetTest { VirtualPetShelter testShelter = new VirtualPetShelter(); RoboticDog roboDogTest = new RoboticDog("Samuel", 7, 16, 12); RoboticCat roboCatTest = new RoboticCat("robocat", 9, 13, 70); OrganicDog realDogTest = new OrganicDog("realdog", 2, 1, 35, 12); OrganicCat realCatTest = new OrganicCat("realCat", 5, 8, 37, 11); @Test public void testCleaningLitterBox() { testShelter.emptyLitterBox(); assertEquals(testShelter.getLitterBoxLevel(), 5); } @Test public void testIfDifferentPetsAreInShelter() { testShelter.addPet(roboDogTest); testShelter.addPet(roboCatTest); testShelter.addPet(realDogTest); testShelter.addPet(realCatTest); assertEquals(testShelter.pets.size(), 4); assertEquals(testShelter.pets.get("Samuel"), roboDogTest); } @Test public void testOurOilMethod() { testShelter.addPet(roboDogTest); testShelter.addPet(roboCatTest); testShelter.addPet(realDogTest); testShelter.oilAllRobots(14); assertEquals(roboDogTest.getHealthLevel(), 0); assertEquals(roboCatTest.getHealthLevel(), 40); assertEquals(realDogTest.getHealthLevel(), 12); } @Test public void testCleaningDogCages() { testShelter.cleanAllCages(); assertEquals(realDogTest.getCageMess(), 4); } @Test public void testTickMethod() { testShelter.tick(); assertEquals(realCatTest.hunger, 11); assertEquals(realDogTest.getCageMess(), 4); } @Test public void testTotalHealthCalculation() { testShelter.addPet(roboDogTest); testShelter.addPet(roboCatTest); testShelter.addPet(realDogTest); testShelter.addPet(realCatTest); int health = testShelter.totalHealthOfPets(); assertEquals(health, 66); } @Test public void testFeedingAllPets() { testShelter.addPet(realDogTest); testShelter.addPet(realCatTest); testShelter.feedAllPets(10); assertEquals(realDogTest.hunger, 2); } @Test public void testFeedingCatsOrDogs() { testShelter.addPet(realDogTest); testShelter.addPet(realCatTest); testShelter.feedDogs(10); testShelter.feedCats(10); assertEquals(realDogTest.hunger, 2); assertEquals(realCatTest.hunger, -9); } @Test public void testWateringPets() { testShelter.addPet(realDogTest); testShelter.addPet(realCatTest); testShelter.waterCats(5); testShelter.waterDogs(5); assertEquals(realCatTest.thirst, -3); assertEquals(realDogTest.thirst, -3); } @Test public void testDogWalking() { testShelter.addPet(realDogTest); testShelter.addPet(roboDogTest); testShelter.walkDogs("RobotDog"); assertEquals(roboDogTest.getHappinessLevel(), 17); testShelter.walkDogs("OrganicDog"); assertEquals(realDogTest.getHappinessLevel(), 43); } @Test public void testPlayingCatch() { testShelter.addPet(realDogTest); testShelter.playCatch("OrganicDog"); assertEquals(realDogTest.happinessLevel, 45); } @Test public void testChasingDogs() { testShelter.addPet(realCatTest); testShelter.chaseDogs("OrganicCat"); testShelter.dogsChased(); assertEquals(realCatTest.happinessLevel, 47); assertEquals(realDogTest.happinessLevel, 35); } @Test public void testHuntingMice() { testShelter.addPet(realCatTest); testShelter.addPet(roboCatTest); testShelter.huntMice("OrganicCat"); testShelter.huntMice("RobotCat"); assertEquals(realCatTest.happinessLevel, 57); assertEquals(roboCatTest.happinessLevel, 78); } }
6cc6e326af1e53113ea13d9086c0199f02cf85eb
46b51ee1c9655b50e7f53f759c8fe347a35f811a
/src/main/java/org/isp/web/controllers/payments_controllers/PaymentsAdminController.java
c391c2c9a5ae1fd75912b2540465e6290e89cd7c
[]
no_license
shsimeonova/Internship-Platform
7221c61979c8b948af073483ac13b1cb9a5679c6
a0b2de5e63a97912434df35618bc7e30e2ac2193
refs/heads/master
2020-03-08T04:05:36.465498
2018-12-24T10:10:36
2018-12-24T10:10:36
127,911,213
1
0
null
null
null
null
UTF-8
Java
false
false
1,514
java
package org.isp.web.controllers.payments_controllers; import org.isp.domain.Payment; import org.isp.services.payment_services.PaymentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import java.util.List; @Controller @RequestMapping("/admin/payments") public class PaymentsAdminController { private PaymentService paymentService; @Autowired public PaymentsAdminController(PaymentService paymentService) { this.paymentService = paymentService; } @RequestMapping(value = "/activate/{taskId}", method = RequestMethod.GET) private String makePaymentActive(@PathVariable(value = "taskId") String taskId, Model model){ try { this.paymentService.makeActivePayment(taskId); model.addAttribute("info"); } catch (IllegalArgumentException iae) { model.addAttribute("error", iae.getMessage()); } return "admin/admin-base"; } @RequestMapping(value = "/all", method = RequestMethod.GET) private String allPaymentsPanel(Model model){ List<Payment> allPayments = this.paymentService.getAll(); model.addAttribute("payments", allPayments); return "admin/payments/all-payments-partial"; } }
76bae25e369785b2ec5acea90819e32c366409fe
c61a85ba787f4e74a7154a05c07e0aa4af9b67e7
/week15_hw1/src/IconWindow.java
03f8452559e5336084668af45d03e544bda8e2e7
[]
no_license
yuan3675/SED2017FALL
bdaa5489f158a84b8e67be250f04cfc7e6d3eebc
bf703cbc7ad71ddd726220d6cae4b868556fc395
refs/heads/master
2021-09-03T17:13:02.322205
2018-01-10T16:29:30
2018-01-10T16:29:30
108,546,725
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
public class IconWindow extends Window { public IconWindow(WindowImpl impl) { this.impl = impl; } public void drawBorder() { drawText(); drawRect(); } }
552f19dea6c842fac56a75b8e18054c7cc9d0ba6
8b59d114418ce899754da07356b771983e7a860a
/src/Test_0/Number.java
1473862d517b5780045f0042ad74eaa8935339f4
[]
no_license
ivan-andreichuk/Test0_Java_Mentor
e62e4f0ea69f2eb86725b30c1ff3071cb469e3c9
17147aac230a121b82eea380b43e64c132084734
refs/heads/master
2023-02-11T02:57:46.656027
2021-01-02T02:40:44
2021-01-02T02:40:44
326,143,831
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package Test_0; public class Number { public int value; public boolean geographyNumber;//True-Arabic, false-Roman }
41247562304198580439a95dcd58cd2258632154
b59540e988b52d1bb0d2be6dbe50c3d77b6bbc43
/Assignment2/src/project/conventer_from_p1.java
4939afa6fd7ade031f4860ba223d12c82387b780
[]
no_license
Chener-Zhang/Network-and-Secutiry-Project
3b7d929511e189571f96d89fd0fb17fc3a2b4ae7
c43ad6902d928fa0dc6fb6ee392105db64c04fd1
refs/heads/master
2022-04-17T13:11:57.702960
2020-04-15T02:32:07
2020-04-15T02:32:07
236,056,414
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package project; import java.util.StringTokenizer; public class conventer_from_p1 { String string; byte[] Final; public conventer_from_p1(String st) { this.string = st; } public byte[] breaker() { StringTokenizer symbal_breaker = new StringTokenizer(string, "[]"); String dele_begin_end = symbal_breaker.nextToken(); StringTokenizer multiTokenizer = new StringTokenizer(dele_begin_end, ", "); int counter = 0; while (multiTokenizer.hasMoreTokens()) { String assgn = multiTokenizer.nextToken(); int i = Integer.parseInt(assgn); byte b1 = (byte) i; counter++; } //-----------------------------------------> Final = new byte[counter]; StringTokenizer symbal_breaker2 = new StringTokenizer(string, "[]"); String dele_begin_end2 = symbal_breaker2.nextToken(); StringTokenizer multiTokenizer2 = new StringTokenizer(dele_begin_end2, ", "); int counter2 = 0; while (multiTokenizer2.hasMoreTokens()) { String assgn = multiTokenizer2.nextToken(); int i = Integer.parseInt(assgn); byte b1 = (byte) i; Final[counter2] = b1; counter2++; } return Final; } }
36007ee460e54d251abb92a4ddaa5ca75fd89b1c
d0e2ec5174ba0faeaad081a9586e2c763e016894
/src/main/java/com/example/Policeman.java
764b1ae428747f4b249624e68ff5d0d58c826f48
[]
no_license
luckytiger1/spring-builder
af1236e3176f5ba65793bd6547e1afb19804bec2
0b027ed86337a6b90cc1cfe2634092072ed5c8fa
refs/heads/main
2023-04-03T23:48:38.286152
2021-04-15T17:54:28
2021-04-15T17:54:28
358,347,008
1
0
null
null
null
null
UTF-8
Java
false
false
85
java
package com.example; public interface Policeman { void makePeopleLeaveRoom(); }
d5f8bdf1d2de19ac5f75017f420b11d9c33865e6
2811d7a3ed750ccce0fb698b7d9c3a90c3e0efcd
/test/ups/bdconexion/BDConexionTest.java
2d0a8e3d66c4aef202def6e1f4c89e268f808cbe
[]
no_license
DavidIsraelLeon/CitasMedicas
e5e8bfb0a577d695b82132f9274175ce79df4fa6
ebdb394b16a3a4a53c947cbb676d5bf9cd03e537
refs/heads/master
2022-11-02T11:15:01.194797
2020-06-19T17:20:18
2020-06-19T17:20:18
273,416,246
0
0
null
null
null
null
UTF-8
Java
false
false
1,508
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 ups.bdconexion; import java.sql.Connection; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author Esteban */ public class BDConexionTest { public BDConexionTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of conectar method, of class BDConexion. */ @Test public void testConectar() { System.out.println("conectar"); Connection expResult = null; Connection result = BDConexion.conectar(); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } /** * Test of close method, of class BDConexion. */ @Test public void testClose() { System.out.println("close"); Connection con = null; BDConexion.close(con); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } }
1ccd3bf9675ec10e06c34fc1ad0c95e002d59d46
0a687de2d61470cbe8a6e0984c85bf4aa958b563
/src/pack1/AccessModifier.java
316691dd37a4521897470e51ac45b27d50b02355
[]
no_license
brahmaqa1/MyRepo1
a983a922895197e36206c9852bd345bb0de40faa
1d8fb0019329153036d9e5620bf94362d55066aa
refs/heads/master
2020-06-21T11:46:05.195463
2019-07-17T18:22:45
2019-07-17T18:22:45
197,440,448
0
0
null
null
null
null
UTF-8
Java
false
false
1,109
java
package pack1; import login.loginclass; public class AccessModifier { public static void main(String[] args) { //get login pack.loginclass var //loginclass l=loginclass();//Care ::: errro no new opeartie loginclass l=new loginclass();// public class , we cna use in other package // note:: if loginclass is non public , we cant create use in other package System.out.println("l.publicvar="+l.publicvar); l.publicvar="publ var val chnaged"; System.out.println("l.publicvar="+l.publicvar); //System.out.println("l.privateva="+l.privatevar);//not visible //l.privatevar="Prv chnage";// cant acees priavte var in other class of other pack //priavtevar cannot be resolved or is not a field //System.out.println("l.privateva="+l.privatevar); //System.out.println("l.defStrvar="+l.defStrvar);//not visible //l.defStrvar="def changed";// error def var of other pack can't be accessed in other package //System.out.println("l.defStrvar="+l.defStrvar); //l.protectvar="protchnage";// error not visible //System.out.println("l.protectvarr="+l.protectvar); } }
f758ec63f8e62667141c706a88c3f4ccb77e98e7
930099631713d6253a7ff05f05bf6522cbba04d9
/app/src/main/java/com/phoenixfeatherapp/intouch/FocusListener.java
380f7adb98a5151a72618bf9e3a0fec4bbe5492b
[]
no_license
phoenixfeatherapps/InTouch
37cbcfb3dd3b80123eb07f2eccff648ee44f3102
ee1b26a327f69641a42d9ee0d1379aced2ddc6a4
refs/heads/main
2022-12-30T00:20:16.182388
2020-10-17T07:51:58
2020-10-17T07:51:58
302,840,385
0
0
null
null
null
null
UTF-8
Java
false
false
1,938
java
package com.phoenixfeatherapp.intouch; import android.content.res.Resources; import android.util.Log; import android.view.View; import android.widget.EditText; import android.content.Context; import android.view.View; import static com.phoenixfeatherapp.intouch.Utility.validateIPAddress; public class FocusListener implements View.OnFocusChangeListener { private static final String TAG = "MainActivity"; private Context appContext = null; public FocusListener() { } public FocusListener(Context context) { this.appContext = context; } @Override public void onFocusChange(View v, boolean hasFocus) { Log.i(TAG,"onFocusChange() - Entered - id == " + v.getId()); if(v.getId() == R.id.enterPartnerDeviceId) { EditText editTextField = (EditText) v; if (!hasFocus) { Log.i(TAG, "onFocusChange() - does not have focus! - str == " + editTextField.getText().toString()); if ((editTextField.getText().toString().isEmpty())) { Log.i(TAG, "onFocusChange() - field is empty!"); editTextField.setTextColor(0xAFAFAFAF); editTextField.setText(R.string.input_ip_address); } Utility.hideSoftKeyboard(v); } else { Log.i(TAG, "onFocusChange() - has focus! - str == " + editTextField.getText().toString()); if(editTextField.getText().toString().equals(appContext.getResources().getString(R.string.input_ip_address))) { Log.i(TAG, "onFocusChange() - clearing field!"); editTextField.setText(""); editTextField.setTextColor(0xFF000000); // Utility.showSoftKeyboard(v); } } } } public void setFocusChangeListener(View v) { v.setOnFocusChangeListener(this); } }
7761ad239c6761fabe202fe66edd94fd509c7fe4
d74fbdd8d6bfe1ab8fae4363b1034e70beee4d81
/app/src/test/java/kr/hs/e_mirim/teenspolitics_master/ExampleUnitTest.java
0c27697bf48cef787bf56696c6740e9423698eb3
[]
no_license
shimeunji/Teenspolitics-master
8dc2d3baa2c3efd91971ef61dec17619036965e1
a6a282ba81f9683f4011b4f19898bc8b58eda69f
refs/heads/master
2021-01-25T01:03:24.003621
2017-06-18T23:18:20
2017-06-18T23:18:20
94,716,125
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package kr.hs.e_mirim.teenspolitics_master; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
61ae2db59461f8d7ea8f7c585986ca16bbb479a0
4118f7d8f74e6c0773517fd6b308df83c7cf3518
/src/CoreJava/MainEntryPoint/TestRunner.java
e7c9ef44dfa2d1c441e17c1d5dc8c1f5e08262ad
[]
no_license
resv/PERSCHOLAS-JD-ASSIGNMENTS
1fb0b2a7e7e4787276d77716a11b95a95fff4699
a3051ca9c6d5c8f250ce54c6b658b3b4bedef1e7
refs/heads/master
2020-03-28T04:21:38.457643
2018-09-06T17:56:40
2018-09-06T17:56:40
147,709,833
0
0
null
null
null
null
UTF-8
Java
false
false
453
java
package CoreJava.MainEntryPoint; public class TestRunner { public static void main(String[] args) { // Many things to consider working on this in the future and things I've learned. // You can create an array string on the fly // equality comparison with emails or another string should use .equals due to "@"char // concurrent exception errors are and should be used with an irirator or boolean out // } }
3bb8afb13426575ad521e64c716c8d7bd146fde6
599262c06e227882cdd74a132623f4eddbda5c72
/src/main/java/com/db/quoters/TerminatorQuoter.java
b9232a3202630f60fde2e5ac1c083770a090531f
[]
no_license
Jeka1978/springdemo_forDB
21f593a707647ded79641739032340c275304d59
440bea6f1ad1a5c2698c5776291af902bdc6e63a
refs/heads/master
2021-01-21T02:19:46.567281
2017-09-01T15:32:26
2017-09-01T15:32:26
101,887,660
1
1
null
null
null
null
UTF-8
Java
false
false
1,117
java
package com.db.quoters; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import javax.annotation.PreDestroy; import java.util.Arrays; import java.util.List; /** * Created by Evegeny on 30/08/2017. */ @Component public class TerminatorQuoter implements Quoter { private List<String> messages; @Value("${terminator}") private void setMessages(String[] messages, @Value("${JAVA_HOME}") String javaHome) { System.out.println("javaHome = " + javaHome); this.messages = Arrays.asList(messages); } @Override public void sayQuote() { messages.forEach(System.out::println); throw new DBRuntimeException("я встретил сам себя"); } public void killAll() { System.out.println("your are terminated...."); } }
[ "papakita2009" ]
papakita2009
f5f169b754dd146c48e736bdd3d993020807e82f
3726265f8005bbacd826f32b6c434c2540b6599e
/uml/java/Model/personnes/Abonné.java
6d4c681784f0d51965206747330300bfc35b2dbb
[]
no_license
didier-tp/poe-pega2
11bd93bd93c9b9d9dfd10a107f1e6fd5c7db0ef2
1f1cdc9ae4d466c40f6a2193c6e17cb56e04daee
refs/heads/main
2023-07-11T02:24:09.617289
2021-08-20T15:21:18
2021-08-20T15:21:18
394,204,364
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package personnes; import java.util.*; /** * */ public class Abonné extends Personne { /** * Default constructor */ public Abonné() { } /** * */ private Integer numero; /** * */ private Date dateAbonnement; /** * */ public void sePresenter() { // TODO implement here } }
74249ebb7e92eda4d9264d71b1871ce0c0a04738
c083d7f00c8ec192332872b6421f05a73a64ef8f
/src/com/company/emcare/model/ActionHist.java
7a43819b480bbedb1d021a73fedb439a713011bb
[]
no_license
zhanhyii/EmCare
074dd4eb064c2992754efdf2a6cd812f6c46341c
7d7aafb34317d37b4d87fe30394fa22b785b4aa9
refs/heads/master
2016-09-05T08:57:05.707605
2013-01-25T06:42:57
2013-01-25T06:42:57
7,813,536
0
1
null
2013-01-25T06:42:57
2013-01-25T04:23:54
JavaScript
UTF-8
Java
false
false
3,249
java
package com.company.emcare.model; import java.sql.Timestamp; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; @Entity(name="action_hist") public class ActionHist { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne @JoinColumn(name="keyPerosnId") private Person keyPerson; @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="minorPersonId") private Person minorPerson; @Column private int actionType; @ManyToOne @JoinColumn(name="voiceId") private Voice voice; private Timestamp updateTime; @Column @Lob private String comments; public final static int NEW = 0x1; public final static int ASSIGN= 0x2; public final static int RESOLVE = 0x3; public final static int CLOSE = 0x4; public final static int REJECT =0x5; public final static int REOPEN = 0x6; public final static int INPROGRESS=0x7; public static ActionHist constructActionHist(Voice voice,Person primaryPerson,Person secondaryPerson, int actionType,String comment){ ActionHist ah = new ActionHist(); ah.setKeyPerson(primaryPerson); ah.setMinorPerson(secondaryPerson); ah.setActionType(actionType); ah.setUpdateTime(new Timestamp(System.currentTimeMillis())); ah.setVoice(voice); ah.setComments(comment); return ah; } public static ActionHist constructActionHist(Voice voice,Person primaryPerson, int actionType,String comment){ return constructActionHist(voice,primaryPerson,null,actionType,comment); } public static ActionHist constructActionHist(Voice voice, Person primaryPerson, int actionType){ return constructActionHist(voice, primaryPerson, null, actionType,null); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Person getKeyPerson() { return keyPerson; } public void setKeyPerson(Person keyPerson) { this.keyPerson = keyPerson; } public Person getMinorPerson() { return minorPerson; } public void setMinorPerson(Person minorPerson) { this.minorPerson = minorPerson; } public int getActionType() { return actionType; } public void setActionType(int actionType) { this.actionType = actionType; } public Voice getVoice() { return voice; } public void setVoice(Voice voice) { this.voice = voice; } public Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(Timestamp updateTime) { this.updateTime = updateTime; } public String getComments() { return comments; } public void setComments(String comments) { this.comments = comments; } /* * get action description */ public String getActionDesc(){ switch(actionType){ case NEW: return "Submit"; case ASSIGN: return "Assigned to " + minorPerson.getRealname(); case RESOLVE: return "Resolved"; case CLOSE: return "Closed"; case REJECT: return "Rejected"; case REOPEN: return "Reopened"; case INPROGRESS: return "start processing"; default: return "Submit"; } } }
6bc02f4f404d0c363d7e457fe9ee7268504acc3f
9720eebcbc60d7a5ed7fe9748f3827b5888b167a
/src/main/java/ItemCatalogManager.java
9e241b0b40f514d672c281c31b1fe0254d29ec2f
[]
no_license
jc-johnson/Logistics-Application
05c3ec0defb23a6e3644105f2e683810b6c0b5d0
83e1fb91857d8543fb25a724a3928f0ff5352984
refs/heads/master
2021-01-19T06:47:56.290947
2017-06-01T23:23:36
2017-06-01T23:23:36
87,500,077
0
0
null
null
null
null
UTF-8
Java
false
false
3,997
java
package src.main.java; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import src.main.java.exceptions.DataValidationException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.text.NumberFormat; import java.text.ParseException; import java.util.HashMap; import java.util.Locale; /** * Created by Jordan on 5/9/2017. */ public final class ItemCatalogManager { private HashMap<String, Integer> catalog = new HashMap<>(); private static ItemCatalogManager instance; public static ItemCatalogManager getInstance() { if (instance == null) { instance = new ItemCatalogManager(); } return instance; } private ItemCatalogManager() {} public Integer getItemPrice(String itemID) { return catalog.get(itemID); } public boolean isRealItem(String itemID) throws DataValidationException { if (itemID.equals("") || itemID.isEmpty()) { throw new DataValidationException("Empty string parameter"); } if (catalog.containsKey(itemID)) return true; return false; } public void parseItemsInventoryXML(String path) throws DataValidationException, ParseException { if (path.equals("") || path.isEmpty()) { throw new DataValidationException("Empty string parameter"); } try { // Open file path to xml File xmlFile = new File(path); // File Path C:\Logistics-Program\LogisticsApplication\src\main\resources\ItemCatalog.xml if (xmlFile == null) { throw new FileNotFoundException(); } // System.out.println("File found..."); // Build parser and parse DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(xmlFile); // Optional but recommended document.getDocumentElement().normalize(); // System.out.println("Root element : " + document.getDocumentElement().getNodeName()); NodeList nodeList = document.getElementsByTagName("Item"); // Print elements and add to hashmap for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); // System.out.println("\nCurrent Element : " + node.getNodeName()); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; String itemId = element.getAttribute("Id"); String itemPriceString = element.getElementsByTagName("price").item(0).getTextContent(); Integer price = Integer.parseInt(itemPriceString.replaceAll(",", "")); // System.out.println("Item ID : " + itemId); // System.out.println("Price : " + itemPrice); catalog.put(itemId, price); } } printItemsCatalog(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void printItemsCatalog() { System.out.println("Item Catalog: "); System.out.println(""); for (HashMap.Entry entry : catalog.entrySet()) { System.out.println(entry.getKey() + "\t:\t$ " + entry.getValue()); } System.out.println(""); } }
6913df98b90bbf91396ffb7979ce62bd5dc0efff
a5918497b9483b6a328ebaceef17342e57a001ea
/src/test/java/com/wout/dolp/web/rest/ProgramResourceIntTest.java
067364d3458e82f32464080a4ac4237017d71e44
[]
no_license
dolps/wout
28f328d40c2eab838e79f3143c6a722616ee14c9
3febf8b3814779b4054e8bc764ee135b784a1c94
refs/heads/master
2021-04-27T20:33:42.626315
2018-02-22T19:57:56
2018-02-22T19:57:56
122,381,266
0
0
null
2018-02-22T19:57:57
2018-02-21T19:15:07
Java
UTF-8
Java
false
false
10,187
java
package com.wout.dolp.web.rest; import com.wout.dolp.WoutApp; import com.wout.dolp.domain.Program; import com.wout.dolp.repository.ProgramRepository; import com.wout.dolp.service.ProgramService; import com.wout.dolp.service.dto.ProgramDTO; import com.wout.dolp.service.mapper.ProgramMapper; import com.wout.dolp.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.util.List; import static com.wout.dolp.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the ProgramResource REST controller. * * @see ProgramResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = WoutApp.class) public class ProgramResourceIntTest { private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String UPDATED_NAME = "BBBBBBBBBB"; @Autowired private ProgramRepository programRepository; @Autowired private ProgramMapper programMapper; @Autowired private ProgramService programService; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restProgramMockMvc; private Program program; @Before public void setup() { MockitoAnnotations.initMocks(this); final ProgramResource programResource = new ProgramResource(programService); this.restProgramMockMvc = MockMvcBuilders.standaloneSetup(programResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Program createEntity(EntityManager em) { Program program = new Program() .name(DEFAULT_NAME); return program; } @Before public void initTest() { program = createEntity(em); } @Test @Transactional public void createProgram() throws Exception { int databaseSizeBeforeCreate = programRepository.findAll().size(); // Create the Program ProgramDTO programDTO = programMapper.toDto(program); restProgramMockMvc.perform(post("/api/programs") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(programDTO))) .andExpect(status().isCreated()); // Validate the Program in the database List<Program> programList = programRepository.findAll(); assertThat(programList).hasSize(databaseSizeBeforeCreate + 1); Program testProgram = programList.get(programList.size() - 1); assertThat(testProgram.getName()).isEqualTo(DEFAULT_NAME); } @Test @Transactional public void createProgramWithExistingId() throws Exception { int databaseSizeBeforeCreate = programRepository.findAll().size(); // Create the Program with an existing ID program.setId(1L); ProgramDTO programDTO = programMapper.toDto(program); // An entity with an existing ID cannot be created, so this API call must fail restProgramMockMvc.perform(post("/api/programs") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(programDTO))) .andExpect(status().isBadRequest()); // Validate the Program in the database List<Program> programList = programRepository.findAll(); assertThat(programList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllPrograms() throws Exception { // Initialize the database programRepository.saveAndFlush(program); // Get all the programList restProgramMockMvc.perform(get("/api/programs?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(program.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString()))); } @Test @Transactional public void getProgram() throws Exception { // Initialize the database programRepository.saveAndFlush(program); // Get the program restProgramMockMvc.perform(get("/api/programs/{id}", program.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(program.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())); } @Test @Transactional public void getNonExistingProgram() throws Exception { // Get the program restProgramMockMvc.perform(get("/api/programs/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateProgram() throws Exception { // Initialize the database programRepository.saveAndFlush(program); int databaseSizeBeforeUpdate = programRepository.findAll().size(); // Update the program Program updatedProgram = programRepository.findOne(program.getId()); // Disconnect from session so that the updates on updatedProgram are not directly saved in db em.detach(updatedProgram); updatedProgram .name(UPDATED_NAME); ProgramDTO programDTO = programMapper.toDto(updatedProgram); restProgramMockMvc.perform(put("/api/programs") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(programDTO))) .andExpect(status().isOk()); // Validate the Program in the database List<Program> programList = programRepository.findAll(); assertThat(programList).hasSize(databaseSizeBeforeUpdate); Program testProgram = programList.get(programList.size() - 1); assertThat(testProgram.getName()).isEqualTo(UPDATED_NAME); } @Test @Transactional public void updateNonExistingProgram() throws Exception { int databaseSizeBeforeUpdate = programRepository.findAll().size(); // Create the Program ProgramDTO programDTO = programMapper.toDto(program); // If the entity doesn't have an ID, it will be created instead of just being updated restProgramMockMvc.perform(put("/api/programs") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(programDTO))) .andExpect(status().isCreated()); // Validate the Program in the database List<Program> programList = programRepository.findAll(); assertThat(programList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteProgram() throws Exception { // Initialize the database programRepository.saveAndFlush(program); int databaseSizeBeforeDelete = programRepository.findAll().size(); // Get the program restProgramMockMvc.perform(delete("/api/programs/{id}", program.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Program> programList = programRepository.findAll(); assertThat(programList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(Program.class); Program program1 = new Program(); program1.setId(1L); Program program2 = new Program(); program2.setId(program1.getId()); assertThat(program1).isEqualTo(program2); program2.setId(2L); assertThat(program1).isNotEqualTo(program2); program1.setId(null); assertThat(program1).isNotEqualTo(program2); } @Test @Transactional public void dtoEqualsVerifier() throws Exception { TestUtil.equalsVerifier(ProgramDTO.class); ProgramDTO programDTO1 = new ProgramDTO(); programDTO1.setId(1L); ProgramDTO programDTO2 = new ProgramDTO(); assertThat(programDTO1).isNotEqualTo(programDTO2); programDTO2.setId(programDTO1.getId()); assertThat(programDTO1).isEqualTo(programDTO2); programDTO2.setId(2L); assertThat(programDTO1).isNotEqualTo(programDTO2); programDTO1.setId(null); assertThat(programDTO1).isNotEqualTo(programDTO2); } @Test @Transactional public void testEntityFromId() { assertThat(programMapper.fromId(42L).getId()).isEqualTo(42); assertThat(programMapper.fromId(null)).isNull(); } }
[ "broCode123" ]
broCode123
e01b138745a5ed6836b2f127020b047f6329ef62
b20ef95e527fa6a4641d2fb95668f6b77b0082e6
/src/base/DI/KnightTest.java
d5f933cafafe46444c33758e7e75a7293835b44c
[]
no_license
icecsl/springPro
ad62c9db33c899e4d8cc56d349d231e1bf77a8d0
e3646818a7db5690a92e13e5ce324544e8d9f04a
refs/heads/master
2021-01-21T10:45:32.027026
2018-05-30T07:46:09
2018-05-30T07:46:09
101,984,316
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package base.DI; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Created by huangbingjing on 18/5/24. */ public class KnightTest { public static void main(String[] args) { //读取xml装载bean 获取knight - 构造器依赖注入 ApplicationContext context = new ClassPathXmlApplicationContext("xml/base/knight.xml"); Knight knight = (Knight) context.getBean("knight"); knight.embarkOnQuest(); } }
bf3586caecf2c031d47a8bfdb53e35c0db30bbeb
89a09e9daa8c5c817d129404d381f1c5fec61c08
/eHour-wicketweb/src/main/java/net/rrm/ehour/ui/report/page/GlobalReportPage.java
aa23616e2326ee8f4c5e2d9ccbeb47f1e1c6a56c
[]
no_license
nolith/ehour
6a57c5661c6dcef595722053ae656e265d680a4c
dbb1b9c128383aff0aed4454866d7aee90492415
refs/heads/master
2021-01-15T22:52:37.986322
2012-05-09T23:11:42
2012-05-09T23:11:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,905
java
/* * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package net.rrm.ehour.ui.report.page; import java.util.ArrayList; import java.util.List; import net.rrm.ehour.report.criteria.ReportCriteria; import net.rrm.ehour.ui.common.event.AjaxEvent; import net.rrm.ehour.ui.common.model.KeyResourceModel; import net.rrm.ehour.ui.report.page.command.DefaultGlobalReportPageAggregateCommand; import net.rrm.ehour.ui.report.page.command.DefaultGlobalReportPageDetailedCommand; import net.rrm.ehour.ui.report.page.command.GlobalReportPageAggregateCommand; import net.rrm.ehour.ui.report.page.command.GlobalReportPageDetailedCommand; import net.rrm.ehour.ui.report.panel.criteria.ReportCriteriaAjaxEventType; import net.rrm.ehour.ui.report.panel.criteria.ReportCriteriaBackingBean; import net.rrm.ehour.ui.report.panel.criteria.ReportCriteriaPanel; import net.rrm.ehour.ui.report.panel.criteria.ReportTabbedPanel; import net.rrm.ehour.ui.report.panel.criteria.type.ReportType; import org.apache.wicket.authorization.strategies.role.annotations.AuthorizeInstantiation; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.extensions.markup.html.tabs.ITab; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.ResourceModel; /** * Reporting **/ @AuthorizeInstantiation("ROLE_CONSULTANT") public class GlobalReportPage extends AbstractReportPage<ReportCriteriaBackingBean> { private static final long serialVersionUID = 6614404841734599622L; private ReportTabbedPanel tabPanel; private GlobalReportPageAggregateCommand aggregateCommand; private GlobalReportPageDetailedCommand detailedCommand; public GlobalReportPage() { this(new DefaultGlobalReportPageAggregateCommand(), new DefaultGlobalReportPageDetailedCommand()); } public GlobalReportPage(GlobalReportPageAggregateCommand aggregateCommand, GlobalReportPageDetailedCommand detailedCommand) { super(new ResourceModel("report.global.title")); this.aggregateCommand = aggregateCommand; this.detailedCommand = detailedCommand; final ReportCriteria reportCriteria = getReportCriteria(); final IModel<ReportCriteriaBackingBean> model = new CompoundPropertyModel<ReportCriteriaBackingBean>(new ReportCriteriaBackingBean(reportCriteria)); setDefaultModel(model); List<ITab> tabList = new ArrayList<ITab>(); tabList.add(new AbstractTab(new KeyResourceModel("report.criteria.title")) { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override public Panel getPanel(String panelId) { return new ReportCriteriaPanel(panelId, model); } }); tabPanel = new ReportTabbedPanel("reportContainer", tabList); add(tabPanel); } @Override public boolean ajaxEventReceived(AjaxEvent ajaxEvent) { if (ajaxEvent.getEventType() == ReportCriteriaAjaxEventType.CRITERIA_UPDATED) { ReportCriteriaBackingBean backingBean = (ReportCriteriaBackingBean)getDefaultModelObject(); clearTabs(); if (backingBean.getReportType().equals(ReportType.AGGREGATE)) { addAggregateReportPanelTabs (backingBean); } else { addDetailedReportPanelTabs(backingBean); } ajaxEvent.getTarget().addComponent(tabPanel); } return false; } /** * Clear tabs except for the first one */ private void clearTabs() { List<ITab> tabs = tabPanel.getTabs(); while (tabs.size() > 1) { tabs.remove(1); } } private void addAggregateReportPanelTabs(ReportCriteriaBackingBean backingBean) { List<ITab> tabs = aggregateCommand.createAggregateReportTabs(backingBean); addTabs(tabs); tabPanel.setSelectedTab(1); } private void addTabs(List<ITab> tabs) { for (ITab iTab : tabs) { tabPanel.addTab(iTab); } } private void addDetailedReportPanelTabs(ReportCriteriaBackingBean backingBean) { List<ITab> tabs = detailedCommand.createDetailedReportTabs(backingBean); addTabs(tabs); tabPanel.setSelectedTab(1); } }
0e271ffce8e355d54d7b0eb9fcb155205891babd
4163b0e3c8ef502fad496a72043fa699bf0b9c52
/sixeco-xmall/freeter-admin/src/main/java/com/freeter/modules/pc/entity/view/CategoryView.java
e093ddcb987315c7fef8a4205da9af332747ed4e
[]
no_license
Onoderaharu/sixeco
25fd03bead84c2bc84cee85abdb69adf8e4d3458
9536093e904feb44e9e12963b5b0276c0f14000f
refs/heads/master
2020-03-24T23:11:53.779054
2018-08-01T08:10:10
2018-08-01T08:10:10
143,122,864
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
package com.freeter.modules.pc.entity.view; import com.freeter.modules.pc.entity.CategoryEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import com.baomidou.mybatisplus.annotations.TableName; import org.apache.commons.beanutils.BeanUtils; import java.lang.reflect.InvocationTargetException; import java.io.Serializable; /** * 分类表 * 后端返回视图实体辅助类 * (通常后端关联的表或者自定义的字段需要返回使用) * @author xuchen * @email [email protected] * @date 2018-07-28 16:51:05 */ @TableName("cn_category") @ApiModel(value = "Category") public class CategoryView extends CategoryEntity implements Serializable { private static final long serialVersionUID = 1L; public CategoryView(){ } public CategoryView(CategoryEntity categoryEntity){ try { BeanUtils.copyProperties(this, categoryEntity); } catch (IllegalAccessException | InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
6e4ecb353c3fd8ce5332d2adf1c831f8bdb74dba
36b2a202cdca6915f0c8ad8a03c92064fe0e7345
/app/src/main/java/com/ckkj/enjoy/ui/music/MusicRankingListDetailActivity.java
037328e28ae53c0a43b10bb5eb013aba1ccb4d24
[]
no_license
zct1115/EnJoy
92dd395ec00bea8de00c8b7d549206bac0e0bdf0
f28b9f4f6cb1c3b36e7be2242487ac5bf67139f0
refs/heads/master
2021-07-15T08:16:28.098450
2017-10-23T14:20:45
2017-10-23T14:20:45
104,848,283
1
1
null
null
null
null
UTF-8
Java
false
false
8,465
java
package com.ckkj.enjoy.ui.music; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.support.design.widget.AppBarLayout; import android.support.design.widget.CollapsingToolbarLayout; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.aspsine.irecyclerview.IRecyclerView; import com.ckkj.enjoy.R; import com.ckkj.enjoy.adapter.MusicRankingListDetailAdapter; import com.ckkj.enjoy.anims.LandingAnimator; import com.ckkj.enjoy.anims.ScaleInAnimationAdapter; import com.ckkj.enjoy.api.MusicApi; import com.ckkj.enjoy.app.AppContent; import com.ckkj.enjoy.base.BaseActivityWithoutStatus; import com.ckkj.enjoy.bean.RankingListDetail; import com.ckkj.enjoy.bean.SongDetailInfo; import com.ckkj.enjoy.service.MediaPlayService; import com.ckkj.enjoy.ui.music.presenter.RankinglistDetilsPresenter; import com.ckkj.enjoy.ui.music.view.MusicRankingListDetailView; import com.ckkj.enjoy.utils.ImageLoaderUtils; import com.ckkj.enjoy.utils.StatusBarSetting; import com.ckkj.enjoy.widget.LoadingDialog; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by zct11 on 2017/9/27. */ public class MusicRankingListDetailActivity extends BaseActivityWithoutStatus implements MusicRankingListDetailView , MusicRankingListDetailAdapter.onItemClickListener, MusicRankingListDetailAdapter.onPlayAllClickListener{ @BindView(R.id.iv_album_art) ImageView ivAlbumArt; @BindView(R.id.tv_name) TextView tvName; @BindView(R.id.rl_toobar) RelativeLayout rlToobar; @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.toolbar_layout) CollapsingToolbarLayout toolbarLayout; @BindView(R.id.app_bar) AppBarLayout appBar; @BindView(R.id.irv_song_detail) IRecyclerView irvSongDetail; @BindView(R.id.bottom_container) FrameLayout bottomContainer; private int mType; private List<RankingListDetail.SongListBean> mList = new ArrayList<>(); private RankinglistDetilsPresenter presenter; private MusicRankingListDetailAdapter mDetailAdapter; private Context context; private String mFields; //请求返回的SongDetailInfo先存放在数组中,对应下标索引是其在集合中所处位置 private SongDetailInfo[] mInfos; //song_id 对应的在集合中的位置 private HashMap<String, Integer> positionMap = new HashMap<>(); private static MediaPlayService.MediaBinder mMediaBinder; private MediaPlayService mService; private MediaServiceConnection mConnection; //指示现在加入musicList集合中的元素下标应该是多少 private AtomicInteger index = new AtomicInteger(0); private Intent mIntent; private boolean isPlayAll = false; private boolean isLocal; @Override public int getLayoutId() { return R.layout.activity_rankinglist_detail; } @Override public void initPresenter() { presenter = new RankinglistDetilsPresenter(this); } @Override public void initView() { //用图片做背景 StatusBarSetting.setTranslucent(this); context = this; Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { mType = (int) extras.get("type"); } //设置标题栏 setSupportActionBar(toolbar); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); mFields = new MusicApi().encode("song_id,title,author,album_title,pic_big,pic_small,havehigh,all_rate,charge,has_mv_mobile,learn,song_source,korean_bb_song"); setRecyclerView(); //初始化服务连接 mConnection = new MediaServiceConnection(); if (mIntent == null) { mIntent = new Intent(this, MediaPlayService.class); startService(mIntent); bindService(mIntent, mConnection, BIND_AUTO_CREATE); } } private void setRecyclerView() { mDetailAdapter = new MusicRankingListDetailAdapter(mContext, mList); mDetailAdapter.setOnItemClickListener(this); mDetailAdapter.setOnPlayAllClickListener(this); irvSongDetail.setLayoutManager(new LinearLayoutManager(mContext)); irvSongDetail.setItemAnimator(new LandingAnimator()); irvSongDetail.setIAdapter(new ScaleInAnimationAdapter(mDetailAdapter)); irvSongDetail.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL)); LoadingDialog.showDialogForLoading(this).show(); presenter.requestRankListDetail(AppContent.MUSIC_URL_FORMAT, AppContent.MUSIC_URL_FROM, AppContent.MUSIC_URL_METHOD_RANKING_DETAIL, mType, 0, 100, mFields); } @Override public void returnRankingListDetail(RankingListDetail detail) { List<RankingListDetail.SongListBean> list = detail.getSong_list(); setUI(detail.getBillboard()); mList.addAll(list); //初始化数组集合 mInfos = new SongDetailInfo[mList.size()]; mDetailAdapter.notifyDataSetChanged(); initMusicList(); } @Override public void returnSongDetail(SongDetailInfo info) { System.out.println("回调次数:" + index); if (mMediaBinder != null) { if (mService == null) { mService = mMediaBinder.getMediaPlayService(); } if (info.getSonginfo() == null) { // TODO: 2017/10/10 为空 不能播放 后续需要处理 } else { Log.d("MusicRankingListDetailA", "info.getSonginfo():" + info.getSonginfo()); String song_id = info.getSonginfo().getSong_id(); Integer position = positionMap.get(song_id); mInfos[position] = info; } int currentNumber = index.addAndGet(1); if (currentNumber == mInfos.length) { for (int i = 0; i < mInfos.length; i++) { if (i == 0) { //先清除之前的播放集合 mService.clearMusicList(); } mService.addMusicList(mInfos[i]); } } } LoadingDialog.cancelDialogForLoading(); } private void initMusicList() { for (int i = 0; i < mList.size(); i++) { RankingListDetail.SongListBean songDetail = mList.get(i); String song_id = songDetail.getSong_id(); positionMap.put(song_id, i); presenter.requestSongDetail(AppContent.MUSIC_URL_FROM_2, AppContent.MUSIC_URL_VERSION, AppContent.MUSIC_URL_FORMAT, AppContent.MUSIC_URL_METHOD_SONG_DETAIL , song_id); } } private void setUI(RankingListDetail.BillboardBean billboard) { tvName.setText(billboard.getName()); ImageLoaderUtils.display(this, ivAlbumArt, billboard.getPic_s260()); } @Override public void onItemClick(int position) { //播放单个 isPlayAll = false; if (mService != null) { mService.setPlayAll(false); mService.playSong(position, isLocal); } } private static class MediaServiceConnection implements ServiceConnection { @Override public void onServiceConnected(ComponentName name, IBinder service) { mMediaBinder = (MediaPlayService.MediaBinder) service; } @Override public void onServiceDisconnected(ComponentName name) { } } @Override public void onItemClick() { //播放全部 isPlayAll = true; if (mService != null) { mService.playAll(isLocal); } } @Override protected void onDestroy() { super.onDestroy(); unbindService(mConnection); } }
abc6f080c90d9d8603ef5459b32fd73ac5204c24
3c21c815269243067aafb0b798912aba2b3af191
/app/src/androidTest/java/ca/cours5b5/vladimirchrisphonte/ExampleInstrumentedTest.java
d33cd5364cbcd8af88d90aed9f69186f81ad95ac
[]
no_license
emvlad/1523208
582ad6594ff492adb72e8611f8fba0971669aba7
32172c68d84d5b545386e346a4e3521e8ede2bb5
refs/heads/master
2020-03-27T03:54:32.015158
2018-11-01T19:46:40
2018-11-01T19:46:40
145,897,979
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package ca.cours5b5.vladimirchrisphonte; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("ca.cours5b5.vladimirchrisphonte", appContext.getPackageName()); } }
344f0435d69f0967376a4dc679d1ee09281e51a3
97d95ad49efb83a2e5be5df98534dc777a955154
/applications/plugins/org.csstudio.swt.widgets/src/org/csstudio/swt/widgets/datadefinition/IntArrayWrapper.java
da629e5644e9c0acd342b54e4df5950afb154073
[]
no_license
bekumar123/cs-studio
61aa64d30bce53b22627a3d98237d40531cf7789
bc24a7e2d248522af6b2983588be3b72d250505f
refs/heads/master
2021-01-21T16:39:14.712040
2014-01-27T15:30:23
2014-01-27T15:30:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
418
java
package org.csstudio.swt.widgets.datadefinition; /**A wrapper for int[]. * @author Xihui Chen * */ public class IntArrayWrapper implements IPrimaryArrayWrapper { private int[] data; public IntArrayWrapper(int[] data) { this.data = data; } public void setData(int[] data) { this.data = data; } public double get(int i) { return data[i]; } public int getSize() { return data.length; } }
0dfc7421b5e2de7a78bc1f8e7b27605656415a0a
8aafdacfb0f594208e7b1364d293bed07790bfe9
/springboot-sxgdhz/sxgdhz/sxgdhz-common/src/main/java/com/ruoyi/common/openoffice/ProcessPoolOfficeManager.java
a3442925366bd2cd378f0e140f22ce26828f5db2
[]
no_license
sxgdhz226/sxgdhz-admin
722221b989610314aa28bbf2f90c73cb2beaa08f
eb9b4c2288b5d523b9d1819eab631a06c65076ca
refs/heads/master
2020-04-02T12:47:23.557097
2018-11-12T02:37:34
2018-11-12T02:37:34
154,451,851
0
1
null
null
null
null
UTF-8
Java
false
false
4,069
java
// // JODConverter - Java OpenDocument Converter // Copyright 2004-2012 Mirko Nasato and contributors // // JODConverter is Open Source software, you can redistribute it and/or // modify it under either (at your option) of the following licenses // // 1. The GNU Lesser General Public License v3 (or later) // -> http://www.gnu.org/licenses/lgpl-3.0.txt // 2. The Apache License, Version 2.0 // -> http://www.apache.org/licenses/LICENSE-2.0.txt // package com.ruoyi.common.openoffice; import com.ruoyi.common.openoffice.process.ProcessManager; import java.io.File; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; class ProcessPoolOfficeManager implements OfficeManager { private final BlockingQueue<PooledOfficeManager> pool; private final PooledOfficeManager[] pooledManagers; private final long taskQueueTimeout; private volatile boolean running = false; private final Logger logger = Logger.getLogger(ProcessPoolOfficeManager.class.getName()); public ProcessPoolOfficeManager(File officeHome, UnoUrl[] unoUrls, String[] runAsArgs, File templateProfileDir, File workDir, long retryTimeout, long taskQueueTimeout, long taskExecutionTimeout, int maxTasksPerProcess, ProcessManager processManager) { this.taskQueueTimeout = taskQueueTimeout; pool = new ArrayBlockingQueue<PooledOfficeManager>(unoUrls.length); pooledManagers = new PooledOfficeManager[unoUrls.length]; for (int i = 0; i < unoUrls.length; i++) { PooledOfficeManagerSettings settings = new PooledOfficeManagerSettings(unoUrls[i]); settings.setRunAsArgs(runAsArgs); settings.setTemplateProfileDir(templateProfileDir); settings.setWorkDir(workDir); settings.setOfficeHome(officeHome); settings.setRetryTimeout(retryTimeout); settings.setTaskExecutionTimeout(taskExecutionTimeout); settings.setMaxTasksPerProcess(maxTasksPerProcess); settings.setProcessManager(processManager); pooledManagers[i] = new PooledOfficeManager(settings); } logger.info("ProcessManager implementation is " + processManager.getClass().getSimpleName()); } public synchronized void start() throws OfficeException { for (int i = 0; i < pooledManagers.length; i++) { pooledManagers[i].start(); releaseManager(pooledManagers[i]); } running = true; } public void execute(OfficeTask task) throws IllegalStateException, OfficeException { if (!running) { throw new IllegalStateException("this OfficeManager is currently stopped"); } PooledOfficeManager manager = null; try { manager = acquireManager(); if (manager == null) { throw new OfficeException("no office manager available"); } manager.execute(task); } finally { if (manager != null) { releaseManager(manager); } } } public synchronized void stop() throws OfficeException { running = false; logger.info("stopping"); pool.clear(); for (int i = 0; i < pooledManagers.length; i++) { pooledManagers[i].stop(); } logger.info("stopped"); } private PooledOfficeManager acquireManager() { try { return pool.poll(taskQueueTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException interruptedException) { throw new OfficeException("interrupted", interruptedException); } } private void releaseManager(PooledOfficeManager manager) { try { pool.put(manager); } catch (InterruptedException interruptedException) { throw new OfficeException("interrupted", interruptedException); } } public boolean isRunning() { return running; } }
99c36f13f91c4fb3537ee704340c57ea4160fe41
d648ff8df7a155cc3272b8d20f877ebabb92d3cd
/src/by/it/akulov/lesson06/TaskA2.java
8ac6091d11180cf464f7587d2a6da96865e26174
[]
no_license
th1nk-d1ff3r3nt/ComputerScience
b48a16aacd8055b6966cd073db3ac4987c83fbb6
c7fb8049fbd42164db8168985e2685edd0374893
refs/heads/master
2023-04-29T07:07:27.298512
2018-12-20T13:17:24
2018-12-20T13:17:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,436
java
package by.it.akulov.lesson06; /* toString() для класса Dog Доработайте class Dog из задания A1. Создайте в классе Dog метод public String toString(){ //метод должен вернуть строку экземляра класса в виде форматированной строки //Пример: Кличка: Шарик. Возраст: 5 } Требования: 1. Программа не должна считывать данные с клавиатуры. 2. Создайте внутри метода main (класса TaskA2) две разных собаки (т.е. два объекта типа Dog) 3. Заполните поля собак используя сеттеры. 4. Первая - Шарик, 5 лет. Вторая - Тузик, 3 года. 5. Напечатайте этих двух собак, выводите собак как объект без геттеров. Обратите внимание на точки и пробелы. Вывод: Кличка: Шарик. Возраст: 5 Кличка: Тузик. Возраст: 3 */ public class TaskA2 { public static void main(String[] args) { Dog dog1 = new Dog("Шарик",5); Dog dog2 = new Dog("Тузик",3); System.out.println(dog1); System.out.println(dog2); } }
83723b052c0ba3878f2799d8db9b43b7d374c7c9
866f5c2a8a7999fb877ce5bb4cf359e88589d161
/src/p1MainClasses/FilesGeneratorMain.java
607430901b6e52512d193181d923d9eed0c6035b
[]
no_license
PentiumFallen/Data-Project-1
80654d861d093e7b3fb533ef840cc793373b2c68
0471544e33e20b3aa9e9811394ed1b519a74a94a
refs/heads/master
2021-04-15T11:35:19.891950
2018-05-01T23:21:13
2018-05-01T23:21:13
126,051,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,693
java
package p1MainClasses; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import dataGenerator.DataGenerator; /** * Generates the files for Part1 * * Code belongs to professor */ public class FilesGeneratorMain { public static void main(String[] args) throws FileNotFoundException { if (args.length <= 3) { int n = 20; int m = 50; int size = 50000; if (args.length >= 1) n = Integer.parseInt(args[0]); if (args.length >= 2) m = Integer.parseInt(args[1]); if (args.length == 3) size = Integer.parseInt(args[2]); generateFiles(n, m, size); } else System.out.println("Invalid number of parameters. Must be <= 2."); } private static void generateFiles(int n, int m, int size) throws FileNotFoundException { String parentDirectory = "inputFiles"; // must exist in current directory DataGenerator dg = new DataGenerator(n, m, size); Object[][][] setsLists = dg.generateData(); PrintWriter paramsFile = new PrintWriter(new File(parentDirectory, "parameters.txt")); paramsFile.println(n); // save parameter n paramsFile.println(m); // save parameter m paramsFile.close(); // create all the files for testing and grading with random integer values as // content. Each such file represents a set, since there is no repetition of // values. Some might end being empty... for (int i=0; i<n; i++) for (int j=0; j<m; j++) { String fileName = "F_" + i + "_" + j + ".txt"; PrintWriter out = new PrintWriter(new File(parentDirectory, fileName)); for (int k=0; k<setsLists[i][j].length; k++) out.println(setsLists[i][j][k]); out.close(); } } }
73b405dd42fc95ed11fcbe97572b983a2b82a867
37f24afbf92e4760f5dfceedcb5289a3514179f7
/src/leetcode/easy/FactorialTrailingZeroes.java
081dd7cea35b210a78370b7510e470bf370b3c65
[]
no_license
GY15/arithmetic
9f51b8ff4c6c8e7a040783d65f146b3d3ed333c9
c49da30b52803e03630325df000125889ef33ab9
refs/heads/master
2022-02-23T09:40:31.510870
2019-10-02T04:02:09
2019-10-02T04:02:09
109,135,702
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package leetcode.easy; public class FactorialTrailingZeroes { public int trailingZeroes(int n) { int res = 0; for (int i = 5; i <= n; i+=5){ int temp = i; while(temp % 5 == 0 || temp % 10 ==0){ if (temp % 5 == 0){ res++; temp*=2; }else{ temp/=10; res++; } } } return res; } }
e596fe90c6b36cb4d91bbee511bce188f2e30e0a
69011b4a6233db48e56db40bc8a140f0dd721d62
/log/com/jshx/log/web/UserBehaviorLogAction.java
d0f6d9f0b755aed9f430934685706dc2a08009f7
[]
no_license
gechenrun/scysuper
bc5397e5220ee42dae5012a0efd23397c8c5cda0
e706d287700ff11d289c16f118ce7e47f7f9b154
refs/heads/master
2020-03-23T19:06:43.185061
2018-06-10T07:51:18
2018-06-10T07:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,088
java
package com.jshx.log.web; import java.util.Date; import java.util.HashMap; import java.util.Map; import net.sf.json.JsonConfig; import net.sf.json.util.PropertyFilter; import org.springframework.beans.factory.annotation.Autowired; import com.jshx.core.base.action.BaseAction; import com.jshx.core.base.vo.Pagination; import com.jshx.log.entity.UserBehaviorLog; import com.jshx.log.service.UserBehaviorLogService; public class UserBehaviorLogAction extends BaseAction { private static final long serialVersionUID = 3456585809753588018L; /** * 主键ID列表,用于接收页面提交的多条主键ID信息 */ private String ids; /** * 实体类 */ private UserBehaviorLog userBehaviorLog = new UserBehaviorLog(); /** * 业务类 */ @Autowired private UserBehaviorLogService userBehaviorLogService; /** * 修改新增标记,add为新增、mod为修改 */ private String flag; /** * 分页信息 */ private Pagination pagination; private Date queryLoggedDateStart; private Date queryLoggedDateEnd; /** * 执行查询的方法,返回json数据 * */ public void list() throws Exception{ Map<String, Object> paraMap = new HashMap<String, Object>(); if(pagination==null) pagination = new Pagination(this.getRequest()); if(null != userBehaviorLog){ paraMap.put("behaviorId", userBehaviorLog.getBehavior().getId()); } paraMap.put("queryLoggedDateStart", queryLoggedDateStart); paraMap.put("queryLoggedDateEnd", queryLoggedDateEnd); pagination = userBehaviorLogService.findByPage(pagination, paraMap); final String filter = "loggedDate|id|logContent|user|displayName|time|remoteIp|"; JsonConfig config = new JsonConfig(); config.setJsonPropertyFilter(new PropertyFilter(){ public boolean apply(Object source, String name, Object value) { if(filter.indexOf(name+"|")!=-1) return false; else return true; } }); try{ convObjectToJson(pagination,config); }catch(Exception e){ e.printStackTrace(); } } public String userBehaviorLogList(){ return SUCCESS; } /** * 查看详细信息 */ public String view() throws Exception{ if((null != userBehaviorLog)&&(null != userBehaviorLog.getId())) userBehaviorLog = userBehaviorLogService.getById(userBehaviorLog.getId()); return VIEW; } /** * 初始化修改信息 */ public String initEdit() throws Exception{ view(); return EDIT; } /** * 保存信息(包括新增和修改) */ public String save() throws Exception{ if ("add".equalsIgnoreCase(this.flag)){ userBehaviorLog.setDeptId(this.getLoginUserDepartmentId()); userBehaviorLog.setDelFlag(0); userBehaviorLogService.save(userBehaviorLog); }else{ userBehaviorLogService.update(userBehaviorLog); } return RELOAD; } /** * 删除信息 */ public String delete() throws Exception{ try{ userBehaviorLogService.deleteWithFlag(ids); this.getResponse().getWriter().println("{\"result\":\"true\"}"); }catch(Exception e){ this.getResponse().getWriter().println("{\"result\":\"false\"}"); } return null; } public String getIds(){ return ids; } public void setIds(String ids){ this.ids = ids; } public Pagination getPagination(){ return pagination; } public void setPagination(Pagination pagination){ this.pagination = pagination; } public UserBehaviorLog getUserBehaviorLog(){ return this.userBehaviorLog; } public void setUserBehaviorLog(UserBehaviorLog userBehaviorLog){ this.userBehaviorLog = userBehaviorLog; } public String getFlag(){ return flag; } public void setFlag(String flag){ this.flag = flag; } public Date getQueryLoggedDateStart(){ return this.queryLoggedDateStart; } public void setQueryLoggedDateStart(Date queryLoggedDateStart){ this.queryLoggedDateStart = queryLoggedDateStart; } public Date getQueryLoggedDateEnd(){ return this.queryLoggedDateEnd; } public void setQueryLoggedDateEnd(Date queryLoggedDateEnd){ this.queryLoggedDateEnd = queryLoggedDateEnd; } }
c269def799cd22523559114e056f4e32821a6656
fed81804c560636b18ef08389ecd6057d6081685
/src/main/java/com/lojalivros/models/dao/FuncionarioDAO.java
79ec7ae80b1cb118b274fac928f71a54950d2b0b
[]
no_license
arthurmatosbsb/Loja-livros
e8b968b148b4b3fcb4e398c40bb8dee4b5847daf
934218ac2af66d2ac429ba90186beaacda63653e
refs/heads/master
2022-11-25T09:08:46.029440
2020-08-05T21:31:41
2020-08-05T21:31:41
285,405,920
2
0
null
null
null
null
UTF-8
Java
false
false
886
java
package com.lojalivros.models.dao; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import com.lojalivros.models.Funcionario; public class FuncionarioDAO implements Serializable { /** * */ private static final long serialVersionUID = 1L; @PersistenceContext EntityManager em; private DAO<Funcionario> dao; @PostConstruct void init() { this.dao = new DAO<Funcionario>(this.em, Funcionario.class); } public void adiciona(Funcionario t) { dao.adiciona(t); } public void remove(Funcionario t) { dao.remove(t); } public void atualiza(Funcionario t) { dao.atualiza(t); } public List<Funcionario> listaTodos() { return dao.listaTodos(); } public Funcionario buscaPorId(Integer id) { return dao.buscaPorId(id); } }
719433ea6525172180e533b1ab19c1d0bf462212
d8223191462e3c4c1bfbfb37269d4aa617f5a0f5
/CRM/src/main/java/com/usinsa/crm/dao/OtherDAO.java
26aa80b22fcaceeba3acc264524c504ce070edd0
[]
no_license
ohk3726/CRM
a6d8cfc7839d2282c67d79bed9d768b112707cb7
7e17a415ec7a4c7db03795fdb3d6ac1147cf9571
refs/heads/master
2022-12-23T17:32:12.963263
2019-12-19T23:07:07
2019-12-19T23:07:07
227,682,395
0
0
null
2022-12-16T01:01:01
2019-12-12T19:36:45
Java
UTF-8
Java
false
false
1,093
java
package com.usinsa.crm.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.usinsa.crm.vo.CouponVO; import com.usinsa.crm.vo.LevelVO; import com.usinsa.crm.vo.MailVO; import com.usinsa.crm.vo.OtherVO; import com.usinsa.crm.vo.UserVO; public interface OtherDAO { List<OtherVO> other_coupon_list() throws Exception; List<OtherVO> other_coupon_category() throws Exception; List<OtherVO> other_select_coupon(OtherVO vo) throws Exception; List<OtherVO> coupon_max() throws Exception; int coupon_insert(OtherVO vo) throws Exception; int coupon_update(OtherVO vo) throws Exception; List<UserVO> other_user(UserVO vo) throws Exception; List<UserVO> user_job() throws Exception; List<LevelVO> level() throws Exception; String[] user_email(@Param("user_id") String[] user_id) throws Exception; String coupon_issued_id() throws Exception; int coupon_mail_insert(MailVO vo) throws Exception; int coupon_issued_insert(CouponVO vo) throws Exception; String[] coupon_name(@Param("coupon_id") String[] coupon_id) throws Exception; }
19823185b7b8d09190d4e178ffe4b514b6e54fa7
23773dfb710452d6864e2a6039e36c62a7427e7a
/order-service/src/main/java/com/example/MSA_web/jpa/OrderRepository.java
8fd32511fcc2be6ce5179719c5ef7c71b75956ea
[]
no_license
jje951122/Spring_Cloud-MSA_web
351a4bc0d05da8f4a4a996d06b4486cec531df31
f170f782a655252eb71cd23a8b822be7125334b0
refs/heads/main
2023-07-30T17:20:11.691683
2021-09-16T10:54:20
2021-09-16T10:54:20
407,122,060
0
1
null
null
null
null
UTF-8
Java
false
false
269
java
package com.example.MSA_web.jpa; import org.springframework.data.repository.CrudRepository; public interface OrderRepository extends CrudRepository<OrderEntity, Long> { OrderEntity findByOrderId(String orderId); Iterable<OrderEntity> findByUserId(String userId); }
[ "github.com/jje951122" ]
github.com/jje951122
510dbb687f8d809b3d8b911b7744403c3cc87943
721f4994496d58f6ca41b41cb56dbf3901e5c174
/app/src/main/java/com/example/mymovies/FavouriteActivity.java
e312aa312573439d5d9b007ef8bfb1102cabc553
[]
no_license
dimasokotnyuk/MyMovies
eb69ddfe307c099bbdd3629962ffee2a596106f7
8caaa3925ae33e739314a9b2847c32b48cae4d20
refs/heads/master
2020-07-14T13:31:09.726295
2019-08-24T13:54:45
2019-08-24T13:54:45
202,130,313
0
0
null
null
null
null
UTF-8
Java
false
false
3,268
java
package com.example.mymovies; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModel; import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.example.mymovies.adapters.MovieAdapter; import com.example.mymovies.data.FavouriteMovie; import com.example.mymovies.data.MainViewModel; import com.example.mymovies.data.Movie; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; public class FavouriteActivity extends AppCompatActivity { RecyclerView recyclerViewFavouriteMovies; private MovieAdapter adapter; private ViewModel viewModel; @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu,menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id ){ case R.id.itemMain: Intent intentToMain = new Intent(this,MainActivity.class); startActivity(intentToMain); break; case R.id.itemFavourite: Intent intentToFavourite = new Intent(this, FavouriteActivity.class); startActivity(intentToFavourite); break; } return super.onOptionsItemSelected(item); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_favourite); recyclerViewFavouriteMovies = findViewById(R.id.recyclerViewFavouriteMovies); recyclerViewFavouriteMovies.setLayoutManager(new GridLayoutManager(this, 4)); adapter = new MovieAdapter(); recyclerViewFavouriteMovies.setAdapter(adapter); viewModel = ViewModelProviders.of(this).get(MainViewModel.class); LiveData<List<FavouriteMovie>> favouriteMovies = ((MainViewModel) viewModel).getFavouriteMovies(); favouriteMovies.observe(this, new Observer<List<FavouriteMovie>>() { @Override public void onChanged(@Nullable List<FavouriteMovie> favouriteMovies) { List<Movie> movies = new ArrayList<>(); if (favouriteMovies != null) { movies.addAll(favouriteMovies); adapter.setMovies(movies); } } }); adapter.setOnPosterClickListener(new MovieAdapter.OnPosterClickListener() { @Override public void onPosterClick(int position) { Movie movie = adapter.getMovies().get(position); Intent intent = new Intent(FavouriteActivity.this,DetailActivity.class); intent.putExtra("id",movie.getId()); startActivity(intent); } }); } }
f4aa598b415f85c8b7361ecaea01550bc0b3872d
b1032f56672858150688a0c6952816d02940368d
/src/main/java/com/rua/redis/dao/IBaseDao.java
53cacbddc1f583a6b7148e6d10f268ea1a0d3bcf
[]
no_license
StrongRua/gmds
04deea2e3f71030ff31f05000af44f17c14dcc73
654ce75d6db8ccf17969f374d62bf377a31bac47
refs/heads/master
2020-06-15T09:32:24.134017
2016-12-03T11:29:05
2016-12-03T11:29:05
75,303,124
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package com.rua.redis.dao; import org.springframework.data.redis.core.RedisTemplate; /** * Created by Jacky on 2016/4/9. */ public interface IBaseDao<T> { /** * Spring * * @param redisTemplate */ // void setRedisTemplate(RedisTemplate<String, String> redisTemplate); /** * 保存对象 * * @param t * @return */ int save(T t); /** * 删除指定的对象 * * @param key * @return */ int delete(String key); /** * 修改对象 * * @param t */ int update(T t); /** * 查询指定的对象 * * @param key * @return */ T get(String key); /** * 查询数据条数 * * @return 总条数 */ long getCount(); }
d706e20c437bb53f3e311ba9805f83065cc3555f
1376cd07f9810fcc2de8a597cc039c6457c61a9c
/src/main/java/com/surveyor/service/impl/UserServiceImpl.java
67d44579388333a0b2a1046f254f589ac3c212be
[]
no_license
fairy825/SurveyorWX
a8645790e61b6a4f891bf7d8c28d6028c4be19be
52f0b040cc2570731d063a2ada1e0bfa9270e6ab
refs/heads/master
2022-06-23T17:45:15.001426
2019-11-20T09:01:30
2019-11-20T09:01:30
211,759,177
0
0
null
2022-06-21T01:58:09
2019-09-30T02:26:05
Java
UTF-8
Java
false
false
2,516
java
package com.surveyor.service.impl; import com.surveyor.service.UserService; import org.n3r.idworker.Sid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion.User; import com.surveyor.mapper.UsersMapper; import com.surveyor.pojo.Users; import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example.Criteria; @Service public class UserServiceImpl implements UserService { @Autowired private UsersMapper usersMapper; @Autowired private Sid sid; @Transactional(propagation= Propagation.REQUIRED) @Override public void addPoint(String userId,float point) { Users user = usersMapper.selectByPrimaryKey(userId); user.setPoint(user.getPoint()+point); usersMapper.updateByPrimaryKeySelective(user); } @Transactional(propagation= Propagation.SUPPORTS) @Override public boolean queryUsernameIsExist(String username) { Users user = new Users(); user.setUsername(username); Users result = usersMapper.selectOne(user); return result==null?false:true; } @Transactional(propagation= Propagation.REQUIRED) @Override public void saveUser(Users user) { String userId = sid.nextShort(); user.setId(userId); user.setPoint(20); usersMapper.insert(user); } @Transactional(propagation= Propagation.SUPPORTS) @Override public Users queryUserForLogin(String username,String password) { Example userExample = new Example(Users.class); Criteria criteria = userExample.createCriteria(); criteria.andEqualTo("username", username); criteria.andEqualTo("password", password); Users result = usersMapper.selectOneByExample(userExample); return result; } @Transactional(propagation= Propagation.REQUIRED) @Override public void updateUserInfo(Users user) { Example userExample = new Example(Users.class); Criteria criteria = userExample.createCriteria(); criteria.andEqualTo("id",user.getId()); usersMapper.updateByExampleSelective(user, userExample); } @Transactional(propagation= Propagation.SUPPORTS) @Override public Users queryUserInfo(String userId) { Example userExample = new Example(Users.class); Criteria criteria = userExample.createCriteria(); criteria.andEqualTo("id",userId); Users result = usersMapper.selectOneByExample(userExample); return result; } }
e32b1a11c5e8a14ee264ca41a665516579e8a4d4
ade0068f0b256f46d5ea1e501d903cb164674be1
/app/src/main/java/com/example/idpproject/CarparkSelection.java
0b0e89f74b29a31e78b8129dde195b08e49c1c53
[]
no_license
ms042087/idpProject
2bd6ba8416586c0dac55c2ca50ea81d5ac75353a
65992227407bcfcc7c8771af9770302f0c5058ab
refs/heads/master
2021-09-12T21:43:22.277273
2018-04-05T06:24:29
2018-04-05T06:24:29
126,035,831
0
0
null
null
null
null
UTF-8
Java
false
false
5,676
java
package com.example.idpproject; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Color; import android.support.v4.app.Fragment; import android.os.AsyncTask; import android.support.annotation.Nullable; import android.support.v4.app.FragmentManager; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; // Database import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; // ListView import android.widget.AdapterView; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by Law Kin Ping on 25/3/2018. * Load data successfully on 4/4/2018 * Load data into ListView on 5/4/2018 */ public class CarparkSelection extends Fragment { ProgressDialog progressDialog; ConnectionClass connectionClass; ListView listview; View root; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { root = inflater.inflate(R.layout.activity_carpark_selection,container,false); listview = (ListView) root.findViewById(R.id.listView); connectionClass = new ConnectionClass(); progressDialog=new ProgressDialog(getActivity()); return root; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); getActivity().setTitle("Carpark Selection"); // Extract Information from database after the view is settled DoExtractCarParkInfo doExtractCarParkInfo=new DoExtractCarParkInfo(); doExtractCarParkInfo.execute(); } private class DoExtractCarParkInfo extends AsyncTask<String,String,String> { boolean isSuccess=false; // 建立一個 2D arrayList 裝data ArrayList<ArrayList<String>> carParkInfo = new ArrayList<ArrayList<String>>(); // index for 有幾多行data int i = 0; @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... params) { String z=""; try { Connection con = connectionClass.CONN(); if (con == null) { z = "Please check your internet connection"; } else { String query="select * from carpark"; Statement stmt = con.createStatement(); ResultSet rs=stmt.executeQuery(query); carParkInfo.add(new ArrayList<String>()); // 逐行data拎,第1個 column 係id,唔需要,第2個係 Name,第3個係vacancy // array[0] 係 Name (data第2個),array[1]係 Distance,老作,array[2]係vacancy (data第3個) while (rs.next()) { carParkInfo.get(i).add(rs.getString(2)); carParkInfo.get(i).add("xkm"); carParkInfo.get(i).add(rs.getString(3)); i++; carParkInfo.add(new ArrayList<String>()); } isSuccess = true; } } catch (Exception ex) { z = "Exceptions"+ex; } return z; } // 做一個 list 既 mapping <Key, Data> // 呢度個Key 係 Name, Distance, Vacancy @Override protected void onPostExecute(String s) { List<Map<String, Object>> items = new ArrayList<Map<String,Object>>(); Map<String, Object> title = new HashMap<String, Object>(); // 第一行: 標題 title.put("Name", "Name"); title.put("Distance", "Distance"); title.put("Vacancy", "Vacancy"); items.add(title); // 第N行: data for (int i=0;i < carParkInfo.size()-1;i++){ Map<String, Object> item = new HashMap<String, Object>(); item.put("Name", carParkInfo.get(i).get(0)); item.put("Distance", carParkInfo.get(i).get(1)); item.put("Vacancy", carParkInfo.get(i).get(2)); items.add(item); } // Load data 入去listview SimpleAdapter adapter = new SimpleAdapter( getActivity(), items, R.layout.style_listview, new String[]{"Name", "Distance", "Vacancy"}, new int[]{R.id.tvName, R.id.tvDistance, R.id.tvVacancy} ){}; listview.setAdapter(adapter); // AdapterView.OnItemClickListener onClickListView = new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Fragment fragment = new ParkingSpaceSelection(); FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); fragmentManager.beginTransaction().replace(R.id.cotent_main,fragment).commit(); } }; listview.setOnItemClickListener(onClickListView); } } }
00a2cbdb8d9ea11915e64a8b856074e92216c4ef
025407ef8cf22091498b1e73dd0f25fbe70888f1
/A1-MiniS/src/java/lang/RecursiveDescentParser.java
fb60882e8b90db06d760bca5b365c3b5e2bae6ba
[]
no_license
TanJunHong/mysterious
85747d8d761482f80aa383abf9f95fdd01f3c6e8
8acc34181ea40a35ae670b0ed222d9d400a0f7c7
refs/heads/master
2023-03-24T01:53:47.862297
2016-10-13T10:46:47
2016-10-13T10:46:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,664
java
package lang; import lang.RDPTemplate; import lang.ast.LangScanner; import static lang.ast.LangParser.Terminals.*; public class RecursiveDescentParser extends RDPTemplate { /** * Entry hook to start parsing. * @throws RuntimeException if the program is not syntactically correct */ public void parseProgram() { statement(); } public void statement() { int token = peek(); switch(token) { case ID: assignStmt(); break; case IF: ifStmt(); break; case FOR: forStmt(); break; default: error("Unexpected token: " + NAMES[token]); break; } } public void forStmt() { accept(FOR); assignStmt(); accept(UNTIL); expression(); accept(DO); statement(); accept(OD); } public void ifStmt() { accept(IF); expression(); accept(THEN); statement(); accept(FI); } public void assignStmt() { accept(ID); accept(EQ); expression(); } public void expression() { int token = peek(); switch(token) { case ID: accept(ID); break; case NUMERAL: accept(NUMERAL); break; case NOT: accept(NOT); expression(); break; default: error("Unexpected token: " + token); break; } } }
c070883afe1037a85a92f6ed84c3c59b4b9fb003
8f8b5f8b802f83c614ad78af032fe9936e5ffb6e
/enterprise-web-services-camel/src/main/java/hmh/sap/rfc/ZvrelationType.java
4258c89f25657cfdbaf0f7589a80d3eb1db0e38c
[]
no_license
praveen4students/hmh_backup
1b8d54bfa241f5a6412ef2423f1547d6262a530c
45630529b61126976ee0663d9f78b60690a65df7
refs/heads/master
2022-01-05T12:09:18.641190
2019-05-01T18:30:30
2019-05-01T18:30:30
114,189,899
0
0
null
null
null
null
UTF-8
Java
false
false
4,458
java
package hmh.sap.rfc; public class ZvrelationType extends com.sap.aii.proxy.framework.core.AbstractType{ private static final com.sap.aii.proxy.framework.core.BaseTypeDescriptor staticDescriptor ; private static final com.sap.aii.proxy.framework.core.GenerationInfo staticGenerationInfo = new com.sap.aii.proxy.framework.core.GenerationInfo("2.0", 1329337766957L) ; private ZvrelationType.MetaData metadata = new MetaData(this) ; static { com.sap.aii.proxy.framework.core.BaseTypeDescriptor descriptor = createNewBaseTypeDescriptor(com.sap.aii.proxy.framework.core.XsdlConstants.XSDL_COMPLEX_TYPE, "urn:sap-com:document:sap:rfc:functions", "ZVRELATION", 1, 0, hmh.sap.rfc.ZvrelationType.class, com.sap.aii.proxy.framework.core.FactoryConstants.CONNECTION_TYPE_JCO, "ZVRELATION", 2, 4, -1, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<s0:type name=\"ZVRELATION\" xmlns:s0=\"urn:sap-com:document:sap:rfc:functions\"><ifr:container xmlns:ifr=\"urn:sap-com:ifr:v2:metamodel\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><ifr:descriptor><ifr:description language=\"en\">Structure for Relationships of customers</ifr:description></ifr:descriptor><ifr:properties><ifr:sourceSystem /><ifr:sourceClient>100</ifr:sourceClient><ifr:release>620 </ifr:release><ifr:category>structure</ifr:category><ifr:unicode1>true</ifr:unicode1><ifr:unicode2>true</ifr:unicode2><ifr:isFlatStructure>true</ifr:isFlatStructure></ifr:properties><ifr:definition><ifr:internalLength1>2</ifr:internalLength1><ifr:internalLength2>4</ifr:internalLength2></ifr:definition></ifr:container></s0:type>"); descriptorSetElementProperties(descriptor, 0, "PARVW", null, null, "unqualified", "http://www.w3.org/2001/XMLSchema:string", "urn:sap-com:document:sap:rfc:functions", false, 0, 1, false, null, "Parvw", java.lang.String.class, null, new java.lang.String[][]{{"maxLength", "2"}}, "PARVW", 0, 0, -1, 2, 4, -1, com.sap.mw.jco.JCO.TYPE_CHAR, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ifr:field name=\"PARVW\" category=\"simple\"><ifr:descriptor><ifr:description language=\"en\">Partner function</ifr:description></ifr:descriptor><ifr:properties><ifr:helpValuesSupported>false</ifr:helpValuesSupported><ifr:offset1>0</ifr:offset1><ifr:offset2>0</ifr:offset2></ifr:properties><ifr:definition><ifr:scalarType name=\"PARVW\"><ifr:properties><ifr:helpValuesSupported>false</ifr:helpValuesSupported><ifr:fixedValuesListDefined>false</ifr:fixedValuesListDefined><ifr:mixedCaseSupported>false</ifr:mixedCaseSupported><ifr:signedNumber>false</ifr:signedNumber></ifr:properties><ifr:definition><ifr:type>CHAR</ifr:type><ifr:abapType>C</ifr:abapType><ifr:length>2</ifr:length><ifr:internalLength1>2</ifr:internalLength1><ifr:internalLength2>4</ifr:internalLength2><ifr:decimals>0</ifr:decimals><ifr:outputLength>2</ifr:outputLength><ifr:conversionExit>PARVW</ifr:conversionExit></ifr:definition></ifr:scalarType></ifr:definition></ifr:field>"); staticDescriptor = descriptor; } protected ZvrelationType (com.sap.aii.proxy.framework.core.BaseTypeDescriptor descriptor, com.sap.aii.proxy.framework.core.GenerationInfo staticGenerationInfo, int connectionType) { super(descriptor, staticGenerationInfo, connectionType); } public ZvrelationType () { super(staticDescriptor, staticGenerationInfo, com.sap.aii.proxy.framework.core.FactoryConstants.CONNECTION_TYPE_JCO); } public void setParvw(java.lang.String Parvw) { baseTypeData().setElementValue(0, Parvw); } public java.lang.String getParvw() { return (java.lang.String)baseTypeData().getElementValueAsString(0); } public MetaData metadata() { return metadata; } public static class MetaData implements java.io.Serializable { private ZvrelationType parent ; private static final long serialVersionUID = -386313361L ; protected MetaData (ZvrelationType parent) { this.parent = parent; } public com.sap.aii.proxy.framework.core.TypeMetaData typeMetadata() { return (com.sap.aii.proxy.framework.core.TypeMetaData)parent.baseTypeMetaData(); } public com.sap.aii.proxy.framework.core.JcoMetaData getParvw() { return (com.sap.aii.proxy.framework.core.JcoMetaData)parent.baseTypeMetaData().getElement(0); } } }
056c17db7f3d077b706f1721c0fba1fba16933c5
1abfe17ced88681475e3ecb51d72533231cd14ab
/mifosng-provider/src/main/java/org/mifosng/platform/loanschedule/domain/DecliningBalanceMethodLoanScheduleGenerator.java
f1cf01dbf4725a39a84868a3fa8b84f28f98491d
[]
no_license
hugotechnologies/mifosx
46b28b75074140652538f0776067c3a9392cd1a5
b4faea9e5efd2f09b9919c6e45cee011c90a4fec
refs/heads/master
2020-12-30T18:58:28.937613
2012-07-28T06:56:49
2012-07-28T06:56:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,782
java
package org.mifosng.platform.loanschedule.domain; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import org.joda.time.Days; import org.joda.time.LocalDate; import org.mifosng.platform.api.data.CurrencyData; import org.mifosng.platform.api.data.LoanSchedule; import org.mifosng.platform.api.data.MoneyData; import org.mifosng.platform.api.data.ScheduledLoanInstallment; import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.loan.domain.AmortizationMethod; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; public class DecliningBalanceMethodLoanScheduleGenerator implements LoanScheduleGenerator { private final ScheduledDateGenerator scheduledDateGenerator = new DefaultScheduledDateGenerator(); private final PaymentPeriodsInOneYearCalculator paymentPeriodsInOneYearCalculator = new DefaultPaymentPeriodsInOneYearCalculator(); private final PeriodicInterestRateCalculator periodicInterestRateCalculator = new PeriodicInterestRateCalculator(); private final PmtCalculator pmtCalculator = new PmtCalculator(); @Override public LoanSchedule generate( final LoanProductRelatedDetail loanScheduleInfo, final LocalDate disbursementDate, final LocalDate firstRepaymentDate, final LocalDate interestCalculatedFrom, CurrencyData currencyData) { List<ScheduledLoanInstallment> scheduledLoanInstallments = new ArrayList<ScheduledLoanInstallment>(); // 1. generate valid set of 'due dates' based on some of the 'loan attributes' List<LocalDate> scheduledDates = this.scheduledDateGenerator.generate(loanScheduleInfo, disbursementDate, firstRepaymentDate); // 2. determine the 'periodic' interest rate based on the 'repayment periods' so we can use final BigDecimal periodInterestRateForRepaymentPeriod = this.periodicInterestRateCalculator.calculateFrom(loanScheduleInfo); // 3. determine 'total payment' for each repayment based on pmt function (and hence the total due overall) final MonetaryCurrency monetaryCurrency = loanScheduleInfo.getPrincipal().getCurrency(); final Money totalDuePerInstallment = this.pmtCalculator.calculatePaymentForOnePeriodFrom(loanScheduleInfo, periodInterestRateForRepaymentPeriod, monetaryCurrency); final Money totalDue = this.pmtCalculator.calculateTotalRepaymentFrom(loanScheduleInfo, periodInterestRateForRepaymentPeriod, monetaryCurrency); Money totalInterestDue = totalDue.minus(loanScheduleInfo.getPrincipal()); Money outstandingBalance = loanScheduleInfo.getPrincipal(); Money totalPrincipal = Money.zero(monetaryCurrency); Money totalInterest = Money.zero(monetaryCurrency); LocalDate idealDisbursementDateBasedOnFirstRepaymentDate = this.scheduledDateGenerator.idealDisbursementDateBasedOnFirstRepaymentDate(loanScheduleInfo, scheduledDates); double interestCalculationGraceOnRepaymentPeriodFraction = this.paymentPeriodsInOneYearCalculator.calculateRepaymentPeriodAsAFractionOfDays(loanScheduleInfo.getRepaymentPeriodFrequencyType(), loanScheduleInfo.getRepayEvery(), interestCalculatedFrom, scheduledDates, idealDisbursementDateBasedOnFirstRepaymentDate); LocalDate startDate = disbursementDate; int installmentNumber = 1; for (LocalDate scheduledDueDate : scheduledDates) { // number of days from startDate to this scheduledDate int daysInPeriod = Days.daysBetween(startDate.toDateMidnight().toDateTime(), scheduledDueDate.toDateMidnight().toDateTime()).getDays(); Money interestForInstallment = this.periodicInterestRateCalculator.calculateInterestOn(outstandingBalance, periodInterestRateForRepaymentPeriod, daysInPeriod, loanScheduleInfo); Money principalForInstallment = this.periodicInterestRateCalculator.calculatePrincipalOn(totalDuePerInstallment, interestForInstallment, loanScheduleInfo); if (interestCalculationGraceOnRepaymentPeriodFraction >= Integer.valueOf(1).doubleValue()) { Money graceOnInterestForRepaymentPeriod = interestForInstallment; interestForInstallment = interestForInstallment.minus(graceOnInterestForRepaymentPeriod); totalInterestDue = totalInterestDue.minus(graceOnInterestForRepaymentPeriod); interestCalculationGraceOnRepaymentPeriodFraction = interestCalculationGraceOnRepaymentPeriodFraction - Integer.valueOf(1).doubleValue(); } else if (interestCalculationGraceOnRepaymentPeriodFraction > Double.valueOf("0.25") && interestCalculationGraceOnRepaymentPeriodFraction < Integer.valueOf(1).doubleValue()) { Money graceOnInterestForRepaymentPeriod = interestForInstallment.multipliedBy(interestCalculationGraceOnRepaymentPeriodFraction); interestForInstallment = interestForInstallment.minus(graceOnInterestForRepaymentPeriod); totalInterestDue = totalInterestDue.minus(graceOnInterestForRepaymentPeriod); interestCalculationGraceOnRepaymentPeriodFraction = Double.valueOf("0"); } totalPrincipal = totalPrincipal.plus(principalForInstallment); totalInterest = totalInterest.plus(interestForInstallment); if (installmentNumber == loanScheduleInfo.getNumberOfRepayments()) { Money principalDifference = totalPrincipal.minus(loanScheduleInfo.getPrincipal()); if (principalDifference.isLessThanZero()) { principalForInstallment = principalForInstallment.plus(principalDifference.abs()); } else if (principalDifference.isGreaterThanZero()) { principalForInstallment = principalForInstallment.minus(principalDifference.abs()); } if (loanScheduleInfo.getAmortizationMethod().equals( AmortizationMethod.EQUAL_INSTALLMENTS)) { Money interestDifference = totalInterest.minus(totalInterestDue); if (interestDifference.isLessThanZero()) { interestForInstallment = interestForInstallment.plus(interestDifference.abs()); } else if (interestDifference.isGreaterThanZero()) { interestForInstallment = interestForInstallment.minus(interestDifference.abs()); } } } Money totalInstallmentDue = principalForInstallment.plus(interestForInstallment); outstandingBalance = outstandingBalance.minus(principalForInstallment); MoneyData principalPerInstallmentValue = MoneyData.of(currencyData, principalForInstallment.getAmount()); MoneyData interestPerInstallmentValue = MoneyData.of(currencyData, interestForInstallment.getAmount()); MoneyData totalInstallmentDueValue = MoneyData.of(currencyData, totalInstallmentDue.getAmount()); MoneyData outstandingBalanceValue = MoneyData.of(currencyData, outstandingBalance.getAmount()); ScheduledLoanInstallment installment = new ScheduledLoanInstallment( Integer.valueOf(installmentNumber), startDate, scheduledDueDate, principalPerInstallmentValue, interestPerInstallmentValue, totalInstallmentDueValue, outstandingBalanceValue); scheduledLoanInstallments.add(installment); startDate = scheduledDueDate; installmentNumber++; } return new LoanSchedule(scheduledLoanInstallments); } /** * Future value of an amount given the number of payments, rate, amount of * individual payment, present value and boolean value indicating whether * payments are due at the beginning of period (false => payments are due at * end of period) * * @param r * rate * @param n * num of periods * @param y * pmt per period * @param p * future value * @param t * type (true=pmt at end of period, false=pmt at begining of * period) */ public static double fv(double r, double n, double y, double p, boolean t) { double retval = 0; if (r == 0) { retval = -1 * (p + (n * y)); } else { double r1 = r + 1; retval = ((1 - Math.pow(r1, n)) * (t ? r1 : 1) * y) / r - p * Math.pow(r1, n); } return retval; } /** * Present value of an amount given the number of future payments, rate, * amount of individual payment, future value and boolean value indicating * whether payments are due at the beginning of period (false => payments * are due at end of period) * * @param r * @param n * @param y * @param f * @param t */ public static double pv(double r, double n, double y, double f, boolean t) { double retval = 0; if (r == 0) { retval = -1 * ((n * y) + f); } else { double r1 = r + 1; retval = (((1 - Math.pow(r1, n)) / r) * (t ? r1 : 1) * y - f) / Math.pow(r1, n); } return retval; } /** * calculates the Net Present Value of a principal amount given the discount * rate and a sequence of cash flows (supplied as an array). If the amounts * are income the value should be positive, else if they are payments and * not income, the value should be negative. * * @param r * @param cfs * cashflow amounts */ public static double npv(double r, double[] cfs) { double npv = 0; double r1 = r + 1; double trate = r1; for (int i = 0, iSize = cfs.length; i < iSize; i++) { npv += cfs[i] / trate; trate *= r1; } return npv; } /** * PMT calculates a fixed monthly payment to be paid by borrower every 'period' to ensure loan is paid off in full (with interest). * * This monthly payment c depends upon * the monthly interest rate r (expressed as a fraction, not a percentage, * i.e., divide the quoted yearly percentage rate by 100 and by 12 to obtain * the monthly interest rate), the number of monthly payments N called the * loan's term, and the amount borrowed P known as the loan's principal; c * is given by the formula: * * c = (r / (1 - (1 + r)^-N))P * * @param interestRateFraction * @param numberOfPayments * @param principal * @param futureValue * @param type */ public static double pmt(double interestRateFraction, double numberOfPayments, double principal, double futureValue, boolean type) { double payment = 0; if (interestRateFraction == 0) { payment = -1 * (futureValue + principal) / numberOfPayments; } else { double r1 = interestRateFraction + 1; payment = (futureValue + principal * Math.pow(r1, numberOfPayments)) * interestRateFraction / ((type ? r1 : 1) * (1 - Math.pow(r1, numberOfPayments))); } return payment; } /** * * @param r * @param y * @param p * @param f * @param t */ public static double nper(double r, double y, double p, double f, boolean t) { double retval = 0; if (r == 0) { retval = -1 * (f + p) / y; } else { double r1 = r + 1; double ryr = (t ? r1 : 1) * y / r; double a1 = ((ryr - f) < 0) ? Math.log(f - ryr) : Math.log(ryr - f); double a2 = ((ryr - f) < 0) ? Math.log(-p - ryr) : Math .log(p + ryr); double a3 = Math.log(r1); retval = (a1 - a2) / a3; } return retval; } }
b529f4de1c44dd1b9f49bab175721e92a8458df5
4509ce64829f7bf3f680f446c605eb60208ea992
/app/src/main/java/me/amplitudo/networkingapp/ui/ui/slideshow/SlideshowFragment.java
25f2b0123eb6f1b5de5277b8cf94af253fd1af3b
[]
no_license
stevyhacker/basic-networking-android
1812a8f597b8137822edb37ad9cd199d847fc6a0
1a5c032398aad8b8dadf1ef8b3d77c87bccd844b
refs/heads/master
2020-09-21T07:36:56.650654
2019-12-13T07:33:35
2019-12-13T07:33:35
224,728,304
0
0
null
null
null
null
UTF-8
Java
false
false
3,360
java
package me.amplitudo.networkingapp.ui.ui.slideshow; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import me.amplitudo.networkingapp.AnimeAdapter; import me.amplitudo.networkingapp.R; import me.amplitudo.networkingapp.models.Result; import me.amplitudo.networkingapp.models.SearchResultsResponse; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static me.amplitudo.networkingapp.ApiClient.apiService; public class SlideshowFragment extends Fragment { private SlideshowViewModel slideshowViewModel; private AnimeAdapter adapter; private ArrayList<Result> animeResults = new ArrayList<>(); public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { slideshowViewModel = ViewModelProviders.of(this).get(SlideshowViewModel.class); View root = inflater.inflate(R.layout.fragment_slideshow, container, false); final TextView textView = root.findViewById(R.id.text_slideshow); slideshowViewModel.getText().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String s) { textView.setText(s); } }); final SearchView searchView = root.findViewById(R.id.search_view); adapter = new AnimeAdapter(getContext(), animeResults); RecyclerView animeList = root.findViewById(R.id.results_recycler_view); animeList.setAdapter(adapter); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { fetchResults(query); return false; } @Override public boolean onQueryTextChange(String query) { return false; } }); return root; } private void fetchResults(String query) { apiService.getSearchResults(query).enqueue(new Callback<SearchResultsResponse>() { @Override public void onResponse(Call<SearchResultsResponse> call, Response<SearchResultsResponse> response) { if (response.isSuccessful()) { animeResults.clear(); animeResults.addAll(response.body().getResults()); adapter.notifyDataSetChanged(); // Toast.makeText( // MainActivity.this, // "Results: " + response.body().getResults().size(), // Toast.LENGTH_SHORT).show(); } else Toast.makeText(getContext(), "Server error", Toast.LENGTH_SHORT).show(); } @Override public void onFailure(Call<SearchResultsResponse> call, Throwable t) { } }); } }
2fea341d30087ba9b2a603020f1f15e2be199a57
4efa5d3c2a0e3c84854737bf4bad12fcd5e9eb19
/app/src/main/java/com/example/shuvendufirsttest/MainActivity.java
28b60c9cd3072e5c0dce8f9d52952e3ad1663a77
[]
no_license
shuvenduoffline/sampleApp
6ceb001d5f265b1769f1c17360e5d9e4e1bd3570
06620a7cd3568ab4c2b72944db211b56c7fe4bdf
refs/heads/master
2020-07-24T16:40:03.358823
2019-09-12T07:00:36
2019-09-12T07:00:36
207,985,749
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package com.example.shuvendufirsttest; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
ccaa4ea9bcc18e3722c60216147d0fe700c88b16
9f232e22cfc9d5366ea23689dac7fda97f72faf5
/lab3/src/main/java/com/room414/hospital/commands/duty/GetDutiesList.java
c0c9dba603b87fc5327407dffc0fc45233a810e5
[]
no_license
melalex/pi
911528014f9cec0c14ae8bd0294b7ca16df6afaa
cc33d2d33a01cf3b69efb9990e723a2d1f063194
refs/heads/master
2021-07-05T00:38:33.148905
2017-09-28T19:50:39
2017-09-28T19:50:39
103,520,180
0
0
null
null
null
null
UTF-8
Java
false
false
1,734
java
package com.room414.hospital.commands.duty; import com.room414.hospital.anotations.Route; import com.room414.hospital.commands.iternal.AbstractCommand; import com.room414.hospital.commands.iternal.ExecutionResult; import com.room414.hospital.commands.iternal.Routes; import com.room414.hospital.commands.iternal.Views; import com.room414.hospital.contexts.ApplicationContext; import com.room414.hospital.domain.Pageable; import com.room414.hospital.resolvers.provider.ArgumentResolverProvider; import com.room414.hospital.routing.internal.HttpMethod; import com.room414.hospital.services.DutyService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Route(method = HttpMethod.GET, path = Routes.DUTIES_LIST) public class GetDutiesList extends AbstractCommand { private static final String LAST_NAME_PARAM = "lastName"; private final DutyService dutyService = ApplicationContext.getInstance().getDutyService(); private final ArgumentResolverProvider argumentResolverProvider = ApplicationContext.getInstance().getArgumentResolverProvider(); @Override protected ExecutionResult doExecute(HttpServletRequest request) { Pageable pageable = argumentResolverProvider.provide(Pageable.class).resolve(request); String lastName = request.getParameter(LAST_NAME_PARAM); return ExecutionResult.builder() .path(Views.DUTIES_LIST) .model(dutyService.findByLastName(lastName, pageable)) .statusCode(HttpServletResponse.SC_OK) .type(ExecutionResult.Type.FORWARD) .build(); } @Override protected String rollbackView() { return Views.DUTIES_LIST; } }
bf4318163d1fb640e48ecfedffd331da1c16dade
c66de32d4b0f5167a9aea9d1a39819d9993be5c4
/MyHM/app/src/main/java/com/example/myhm/NewReport.java
894bb92187c035310515a9d5c56071a6191127cb
[]
no_license
simonettimartino/LAM
99abaad2346b8d8d10ac53026754b9dc55728463
60f14424a5383a1680112bda3f43cd0f71cb867d
refs/heads/master
2022-12-19T00:46:59.606792
2020-09-11T11:15:47
2020-09-11T11:15:47
262,596,455
0
0
null
null
null
null
UTF-8
Java
false
false
9,156
java
package com.example.myhm; import android.app.DatePickerDialog; import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.AsyncTask; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.content.SharedPreferences; import java.util.Calendar; import static android.content.Context.MODE_PRIVATE; public class NewReport extends Fragment implements AdapterView.OnItemSelectedListener { private static final String TAG = "MainActivity"; public static final String SHARED_PREFS = "sharedPrefs"; private Spinner spinnerPeso, spinnerTemperatura, spinnerGlicemia; private Button nuovoReport, aggiornaPriorita; private EditText peso, temperatura, glicemia, note; private int j, priorita, prioritaPeso, prioritaTemperatura, prioritaGlicemia; private TextView data; private String date; private DatePickerDialog.OnDateSetListener mDateSetListener; public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_newreport, container, false); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.priority, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); nuovoReport = view.findViewById(R.id.buttonInviaR); SharedPreferences sharedPreferences = getActivity().getSharedPreferences(SHARED_PREFS, MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); peso = view.findViewById(R.id.datoPeso); temperatura = view.findViewById(R.id.datoTemperatura); glicemia = view.findViewById(R.id.datoGlicemia); note = view.findViewById(R.id.datoNote); data = view.findViewById(R.id.datoData); spinnerPeso = view.findViewById(R.id.prioritaPeso); spinnerPeso.setAdapter(adapter); spinnerPeso.setOnItemSelectedListener(this); spinnerTemperatura = view.findViewById(R.id.prioritaTemperatura); spinnerTemperatura.setAdapter(adapter); spinnerTemperatura.setOnItemSelectedListener(this); spinnerGlicemia = view.findViewById(R.id.prioritaGlicemia); spinnerGlicemia.setAdapter(adapter); spinnerGlicemia.setOnItemSelectedListener(this); int kg = sharedPreferences.getInt("peso", 0); spinnerPeso.setSelection(kg - 1); int gc = sharedPreferences.getInt("temperatura", 0); spinnerTemperatura.setSelection(gc - 1); int gl = sharedPreferences.getInt("glicemia", 0); spinnerGlicemia.setSelection(gl - 1); data = (TextView) view.findViewById(R.id.datoData); data.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); DatePickerDialog dialog = new DatePickerDialog( getActivity(), android.R.style.Theme_Holo_Light_Dialog_MinWidth, mDateSetListener, year,month,day); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show(); } }); mDateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int year, int month, int day) { month = month + 1; Log.d(TAG, "onDateSet: mm/dd/yyy: " + month + "/" + day + "/" + year); date = month + "/" + day + "/" + year; data.setText(date); } }; aggiornaPriorita = view.findViewById(R.id.newPrio); aggiornaPriorita.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SharedPreferences sharedPreferences = getActivity().getSharedPreferences(SHARED_PREFS, MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt("peso", Integer.parseInt(spinnerPeso.getSelectedItem().toString())); editor.putInt("temperatura",Integer.parseInt(spinnerTemperatura.getSelectedItem().toString())); editor.putInt("glicemia",Integer.parseInt(spinnerGlicemia.getSelectedItem().toString())); editor.apply(); } }); nuovoReport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Reports rep = new Reports(); SharedPreferences sharedPreferences = getActivity().getSharedPreferences(SHARED_PREFS, MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); if (peso.getText().length() != 0 && temperatura.getText().length() != 0 && glicemia.getText().length() != 0 && data.getText().length() != 0) { rep.setPeso(new Tupla(Double.parseDouble(peso.getText().toString()),Integer.parseInt(spinnerPeso.getSelectedItem().toString()))); editor.putInt("peso", Integer.parseInt(spinnerPeso.getSelectedItem().toString())); rep.setTemperatura(new Tupla(Double.parseDouble(temperatura.getText().toString()),Integer.parseInt(spinnerTemperatura.getSelectedItem().toString()))); editor.putInt("temperatura",Integer.parseInt(spinnerTemperatura.getSelectedItem().toString())); rep.setGlicemia(new Tupla(Double.parseDouble(glicemia.getText().toString()),Integer.parseInt(spinnerGlicemia.getSelectedItem().toString()))); editor.putInt("glicemia",Integer.parseInt(spinnerGlicemia.getSelectedItem().toString())); editor.apply(); rep.setPriorita((Integer.parseInt(spinnerPeso.getSelectedItem().toString()) + Integer.parseInt(spinnerTemperatura.getSelectedItem().toString()) + Integer.parseInt(spinnerGlicemia.getSelectedItem().toString()))/3); if (note.getText().length() != 0){ rep.setNote(note.getText().toString()); } else { rep.setNote(""); } rep.setData(date); new AsyncTaskAggiungiReport().execute(rep); peso.setText(""); temperatura.setText(""); glicemia.setText(""); data.setText(""); note.setText(""); int kg = sharedPreferences.getInt("peso", 0); spinnerPeso.setSelection(kg - 1); int gc = sharedPreferences.getInt("temperatura", 0); spinnerTemperatura.setSelection(gc - 1); int gl = sharedPreferences.getInt("glicemia", 0); spinnerGlicemia.setSelection(gl - 1); // Toast.makeText(view.getContext(), "Report inserito!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(view.getContext(), "Inserici tutti i dati!", Toast.LENGTH_SHORT).show(); } } } ); return view; } public class AsyncTaskAggiungiReport extends AsyncTask<Reports, Void, Void> { @Override protected Void doInBackground(Reports... report) { MainActivity.appDatabase.dataAccessObject().aggiungiReport(report[0]); return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Toast.makeText(getActivity(), "Report aggiunto", Toast.LENGTH_LONG).show(); } } @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { String text = adapterView.getItemAtPosition(i).toString(); j = Integer.parseInt(text); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }
0f2b3857b02ea46a2a19889d9639e7b326180cfa
731f38f02c581aba08248228a695014220ce474e
/widgetalarm/app/src/main/java/com/daeseong/widgetalarm/AlarmWidget.java
8dd0681cfba7db9624174ebbb78f2c2f19c03f4a
[]
no_license
ImDaeseong/WidgetNService_test
5a4ec704baf5b8f55ec10ca1f3f4d746fd56692f
aa621626f96756f81635f1b82cfd40f032a8e3da
refs/heads/master
2022-10-11T03:45:14.049051
2022-09-21T22:16:07
2022-09-21T22:16:07
215,185,753
1
0
null
null
null
null
UTF-8
Java
false
false
2,555
java
package com.daeseong.widgetalarm; import android.app.AlarmManager; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.RemoteViews; import java.text.SimpleDateFormat; import java.util.Date; public class AlarmWidget extends AppWidgetProvider { private static final String TAG = AlarmWidget.class.getSimpleName(); private PendingIntent pendingIntent = null; private long lMin = 1000 * 60 * 1;// Millisec * Second * Minute static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { Log.i(TAG, "updateAppWidget"); try { RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.alarm_widget); remoteViews.setTextViewText(R.id.tv1, getTimeDate()); appWidgetManager.updateAppWidget(appWidgetId, remoteViews); }catch (Exception ex){ Log.i(TAG, ex.getMessage().toString()); } } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Log.i(TAG, "onUpdate"); try { for (int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId); } Intent intent = new Intent(context, AlarmReceiver.class); pendingIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), lMin, pendingIntent); }catch (Exception ex){ Log.i(TAG, ex.getMessage().toString()); } } @Override public void onEnabled(Context context) { Log.i(TAG, "onEnabled"); } @Override public void onDisabled(Context context) { Log.i(TAG, "onDisabled"); try { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.cancel(pendingIntent); }catch (Exception ex){ Log.i(TAG, ex.getMessage().toString()); } } private static String getTimeDate() { SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); return dateFormat.format(new Date()); } }
9ba1b8d16f2d0db89615e5114e4d2ed001d52526
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/commons-lang/learning/7940/MutableBoolean.java
3ab39214c7c643aa6ebcbd5ddcf41abbc7f580b4
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,155
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.lang3.mutable; import java.io.Serializable; import org.apache.commons.lang3.BooleanUtils; /** * A mutable <code>boolean</code> wrapper. * <p> * Note that as MutableBoolean does not extend Boolean, it is not treated by String.format as a Boolean parameter. * * @see Boolean * @since 2.2 */ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparable<MutableBoolean> { /** * Required for serialization support. * * @see java.io.Serializable */ private static final long serialVersionUID = -4830728138360036487L; /** The mutable value. */ private boolean value; /** * Constructs a new MutableBoolean with the default value of false. */ public MutableBoolean() { super(); } /** * Constructs a new MutableBoolean with the specified value. * * @param value the initial value to store */ public MutableBoolean(final boolean value) { super(); this.value = value; } /** * Constructs a new MutableBoolean with the specified value. * * @param value the initial value to store, not null * @throws NullPointerException if the object is null */ public MutableBoolean(final Boolean value) { super(); this.value = value.booleanValue(); } //----------------------------------------------------------------------- /** * Gets the value as a Boolean instance. * * @return the value as a Boolean, never null */ @Override public Boolean getValue() { return Boolean.valueOf(this.value); } /** * Sets the value. * * @param value the value to set */ public void setValue(final boolean value) { this.value = value; } /** * Sets the value to false. * * @since 3.3 */ public void setFalse() { this.value = false; } /** * Sets the value to true. * * @since 3.3 */ public void setTrue() { this.value = true; } /** * Sets the value from any Boolean instance. * * @param value the value to set, not null * @throws NullPointerException if the object is null */ @Override public void setValue(final Boolean value) { this.value = value.booleanValue(); } //----------------------------------------------------------------------- /** * Checks if the current value is <code>true</code>. * * @return <code>true</code> if the current value is <code>true</code> * @since 2.5 */ public boolean isTrue() { return value; } /** * Checks if the current value is <code>false</code>. * * @return <code>true</code> if the current value is <code>false</code> * @since 2.5 */ public boolean isFalse() { return !value; } //----------------------------------------------------------------------- /** * Returns the value of this MutableBoolean as a boolean. * * @return the boolean value represented by this object. */ public boolean booleanValue() { return value; } //----------------------------------------------------------------------- /** * Gets this mutable as an instance of Boolean. * * @return a Boolean instance containing the value from this mutable, never null * @since 2.5 */ public Boolean toBoolean() { return Boolean.valueOf(booleanValue()); } //----------------------------------------------------------------------- /** * Compares this object to the specified object. The result is <code>true</code> if and only if the argument is * not <code>null</code> and is an <code>MutableBoolean</code> object that contains the same * <code>boolean</code> value as this object. * * @param obj the object to compare with, null returns false * @return <code>true</code> if the objects are the same; <code>false</code> otherwise. */ @Override public boolean equals(final Object obj) { if (obj instanceof MutableBoolean) { return value == ((MutableBoolean) obj).booleanValue(); } return false; } /** * Returns a suitable hash code for this mutable. * * @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code> */ @Override public int hashCode() { return value ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode(); } //----------------------------------------------------------------------- /** * Compares this mutable to another in ascending order. * * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater * where false is less than true */ @Override public int compareTo(final MutableBoolean other) { return BooleanUtils.compare(this.value, other.value); } //----------------------------------------------------------------------- /** * Returns the String value of this mutable. * * @return the mutable value as a string */ @Override public String toString() { return String.valueOf(value); } }
962badc469cc03dd10069c088ccc887a3614418c
9b02cf3b984f4ae0742965622a3819169601ab02
/src/org/jiaowei/alarmRescue/controller/EntityIDFactory.java
e1248fb1c5eeb226d4de6bc7b0ba00f6a563b9c7
[]
no_license
wujie1314/JWWX
3576681cbda21b666e1107215ce3eff80ce6fa3b
f427e724d6586723b4e7f9cab4b7a73f0370abe9
refs/heads/master
2020-03-24T23:11:53.717943
2018-06-25T02:08:47
2018-06-25T02:08:47
143,122,859
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
package org.jiaowei.alarmRescue.controller; import java.text.SimpleDateFormat; import java.util.Calendar; public class EntityIDFactory { private static final SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); private static String preId = ""; public static synchronized String createId(){ String id = format.format(Calendar.getInstance().getTime()); while(id.equals(preId)){ id = format.format(Calendar.getInstance().getTime()); } preId = id; return id; } }
fe577ca9ceb9b3780eb6df2069287222ee0ea287
f36cd989c25c4437a5a8ebc00ad2473ee197f3de
/src/main/java/fr/norsys/fondation/services/RendezVousService.java
dd5437f03b60420a103250359bf6a9f73777dd7c
[]
no_license
akouzmohamed999/FONDATION_NORSYS
f0f0857f4f7533e911b800f036afcd79d19afd0f
aced6e59015303e25b68065f35e44e4ac3b792ee
refs/heads/master
2020-12-24T20:24:43.867094
2017-06-22T03:17:34
2017-06-22T03:17:34
86,247,233
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package fr.norsys.fondation.services; import java.util.List; import org.springframework.stereotype.Service; import fr.norsys.fondation.entities.RendezVous; @Service public interface RendezVousService { List<RendezVous> findAllRendezVous(); RendezVous addRendezVous(RendezVous rendezVous); RendezVous updateRendezVous(RendezVous rendezVous); void deleteRendezVous(RendezVous rendezVous); RendezVous findRendezVousById(int idRendezVous); }
d73574eb2cc04a2260de3242fa689d25c119f953
7d33dc35747cd5b703082e0551e17615c8e9f01e
/app/src/test/java/com/example/money_manager/ExampleUnitTest.java
ea13ceb9752e1bce1f8e918bef8a789f9a97da4f
[]
no_license
HaAnhHung/Money_Manager
7442f4d532609371da97b1e6079009c08e3921a9
82af8632ec964561bb9ca8b9d758df62f11433a1
refs/heads/master
2022-11-25T04:44:58.710978
2020-07-29T13:22:19
2020-07-29T13:22:19
282,345,866
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.example.money_manager; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
3c657464fbfe07ffab49875a459a193d613e8700
4bb83687710716d91b5da55054c04f430474ee52
/dsrc/sku.0/sys.server/compiled/game/script/structure/structure_rollup.java
c218ee1a0d17d8b6b25cee92d6cd9b83779ea354
[]
no_license
geralex/SWG-NGE
0846566a44f4460c32d38078e0a1eb115a9b08b0
fa8ae0017f996e400fccc5ba3763e5bb1c8cdd1c
refs/heads/master
2020-04-06T11:18:36.110302
2018-03-19T15:42:32
2018-03-19T15:42:32
157,411,938
1
0
null
2018-11-13T16:35:01
2018-11-13T16:35:01
null
UTF-8
Java
false
false
6,798
java
package script.structure; import script.*; import script.base_class.*; import script.combat_engine.*; import java.util.Arrays; import java.util.Hashtable; import java.util.Vector; import script.base_script; import script.library.utils; import script.library.player_structure; import script.library.city; import script.library.prose; import script.library.trace; import script.library.vendor_lib; public class structure_rollup extends script.base_script { public structure_rollup() { } public int OnDoStructureRollup(obj_id self, obj_id player, boolean warnOnly) throws InterruptedException { String structName = player_structure.getStructureName(self); if (structName.length() < 1) { structName = "Structure"; } location where = getLocation(self); if (warnOnly) { string_id subject = new string_id("player_structure", "structure_purge_warning_subject"); string_id body = new string_id("player_structure", "structure_purge_warning_body"); prose_package pp = new prose_package(); prose.setStringId(pp, body); prose.setTO(pp, getPlayerFullName(player)); String body_oob = chatMakePersistentMessageOutOfBandBody(null, pp); String subject_str = "@" + subject.toString(); body_oob = chatAppendPersistentMessageWaypointData(body_oob, where.area, where.x, where.z, null, structName); String[] admins = player_structure.getAdminListNames(self); for (int i = 0; i < admins.length; ++i) { chatSendPersistentMessage("Galactic Housing Authority", admins[i], subject_str, null, body_oob); } if (city.isInCity(self)) { int cityId = city.getStructureCityId(self); if (cityId != 0) { obj_id mayor = cityGetLeader(cityId); if (mayor != obj_id.NULL_ID) { chatSendPersistentMessage("Galactic Housing Authority", mayor, subject_str, null, body_oob); } } } obj_id nameTarget = self; if (player_structure.isBuilding(nameTarget)) { obj_id sign = getObjIdObjVar(nameTarget, player_structure.VAR_SIGN_ID); if (isIdValid(sign)) { nameTarget = sign; } } String abandoned = " \\#FF0000\\(Abandoned)"; setName(nameTarget, structName + abandoned); if (nameTarget != self) { setObjVar(self, player_structure.VAR_SIGN_NAME, structName + abandoned); } } else { if (player_structure.isBuilding(self)) { obj_id[] players = player_structure.getPlayersInBuilding(self); if (players != null) { for (int i = 0; i < players.length; i++) { expelFromBuilding(players[i]); } } String[] cells = getCellNames(self); if (cells != null) { for (int i = 0; i < cells.length; i++) { obj_id cellid = getCellId(self, cells[i]); obj_id contents[] = getContents(cellid); if (contents != null) { for (int j = 0; j < contents.length; j++) { if (hasCondition(contents[j], CONDITION_VENDOR)) { obj_id owner = getObjIdObjVar(contents[j], "vendor_owner"); if (!isIdValid(owner)) { owner = getOwner(contents[j]); } vendor_lib.finalizePackUp(owner, contents[j], player, player_structure.isAbandoned(self)); } } } } } } obj_id scd = createObject("object/intangible/house/generic_house_control_device.iff", where); setName(scd, structName); setOwner(scd, player); if (!persistObject(scd)) { LOG("LOG_CHANNEL", "structure_rollup.OnDoStructureRollup persist SCD failed!"); return SCRIPT_CONTINUE; } attachScript(scd, "structure.house_control_device"); if (hasObjVar(self, player_structure.VAR_WAYPOINT_STRUCTURE)) { obj_id waypoint = getObjIdObjVar(self, player_structure.VAR_WAYPOINT_STRUCTURE); if (isIdValid(waypoint)) { destroyWaypointInDatapad(waypoint, player); removeObjVar(self, player_structure.VAR_WAYPOINT_STRUCTURE); } } player_structure.destroyStructureSign(self); if (player_structure.isResidence(self, player)) { setHouseId(player, obj_id.NULL_ID); removeObjVar(self, player_structure.VAR_RESIDENCE_BUILDING); city.removeCitizen(player, self); } city.removeStructureFromCity(self); String template = getTemplateName(self); player_structure.setDeedTemplate(scd, template); if (isIdValid(player) && exists(player)) { obj_id lotOverlimitStructure = getObjIdObjVar(player, "lotOverlimit.structure_id"); if (isIdValid(lotOverlimitStructure) && (lotOverlimitStructure == self)) { setObjVar(player, "lotOverlimit.structure_location", "Datapad"); } } putIn(self, scd); if (hasObjVar(self, "purge_process.rollup_on_load")) { removeObjVar(self, "purge_process.rollup_on_load"); } final int maxDepth = player_structure.isFactory(self) ? 101 : 1; moveToOfflinePlayerDatapadAndUnload(scd, player, maxDepth + 1); fixLoadWith(self, player, maxDepth); trace.log("housepackup", getPlayerFullName(player) + "(" + player + ") had their house rolled up by the purge process (" + self + ", loc " + where.toString() + ") into structure control device " + scd, player, trace.TL_CS_LOG); } return SCRIPT_CONTINUE; } }
a4784bcc686722ecba9347074c0d125df70c3ea3
970361e96b0ea48a34557fa928b4df0d03441733
/app/src/main/java/com/tinytongtong/thinkinjavapractice/chapter21/part03/CriticalSection.java
089479ea2fce2559284cfbcbcfa1ece92d057fa4
[ "Apache-2.0" ]
permissive
tinyvampirepudge/ThinkInJavaPractice
a61a20c145e6967fec8615dea154f6d227146a3e
1b54ee85a22c927ae71773175639316abb5fe457
refs/heads/master
2020-04-16T17:56:04.554595
2019-01-24T06:31:22
2019-01-24T06:31:22
165,795,886
0
0
null
null
null
null
UTF-8
Java
false
false
6,220
java
package com.tinytongtong.thinkinjavapractice.chapter21.part03; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; /** * @Description: 同步代码块 * @Author [email protected] * @Date 2019/1/23 6:07 PM * @Version */ /** * 正如注释中注明的,Pair不是线程安全的,因为它的约束条件(虽然是任意的)需要 * 将两个变量维护成相同的值。 * 此外,自增加操作不是线程安全的,并且因为没有任何方法被标记为synchronized, * 所以不能保证一个Pair对象在多线程程序中不会被破坏。 * 你可以想象一下这种情况:某人交给你一个非线程安全的Pair类,而你需要在一个线程 * 环境中使用它。通过创建PairManager类就可以实现这一点,PairManager类持有一 * 个Pair对象并控制对它的一切访问。注意唯一的public方法就是getPair(),它是 * synchronized的。对于抽象方法increment(),对increment()的同步控制将在 * 实现的时候进行处理。 * * store()方法将一个Pair对象添加到了synchronized ArrayList中,所以这个操作 * 是线程安全的。因此,该方法不必进行防护,可以防止在PairManager2的synchronized * 语句块的外部。 * * PairManipulator被创建用来测试两种不同类型的PairManager,其方法时某个任务 * 中调用increment(),而PairChecker则在另一个任务中执行。为了跟踪可以运行测试 * 的频度,PairChecker在每次成功时都递增checkCounter。 * * 在main()中创建了两个PairManipulator对象,并允许他们运行一段时间,之后每个 * PairManipulator的结果都会得到展示。 * * 尽管每次运行的结果可能会非常不同,但一般来说,对于PairChecker的检查频率, * PairManager1.increment()不允许有PairManager2.increment()那样多。后者 * 采用同步控制块进行同步,所以对象不加锁的时间更长。这也是宁愿使用同步控制块而不是 * 对整个方法进行同步控制的典型原因:使得其他线程能更多地访问(在安全的情况下尽可能多)。 */ public class CriticalSection { // Test the two different approaches: public static void main(String[] args) { PairManager pman1 = new PairManager1(); PairManager pman2 = new PairManager2(); testApproaches(pman1, pman2); } static void testApproaches(PairManager pman1, PairManager pman2) { ExecutorService exec = Executors.newCachedThreadPool(); PairManipulator pm1 = new PairManipulator(pman1); PairManipulator pm2 = new PairManipulator(pman2); PairChecker pcheck1 = new PairChecker(pman1); PairChecker pcheck2 = new PairChecker(pman2); exec.execute(pm1); exec.execute(pm2); exec.execute(pcheck1); exec.execute(pcheck2); try { TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); System.out.println("Sleep interrupted"); } System.out.println("pm1: " + pm1 + "\npm2: " + pm2); System.exit(0); } } class Pair { // Not thread-safe private int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } public Pair() { this(0, 0); } public int getX() { return x; } public int getY() { return y; } public void incrementX() { x++; } public void incrementY() { y++; } @Override public String toString() { return "x: " + x + ", y: " + y; } public class PairValuesNotEqualException extends RuntimeException { public PairValuesNotEqualException() { super("Pair values not equal: " + Pair.this); } } // Arbitrary invariant -- both variables must be equal: public void checkState() { if (x != y) { throw new PairValuesNotEqualException(); } } } // Protect a Pair inside a thread-safe class: abstract class PairManager { AtomicInteger checkCounter = new AtomicInteger(0); protected Pair p = new Pair(); private List<Pair> storage = Collections.synchronizedList(new ArrayList<Pair>()); public synchronized Pair getPair() { // Make a copy to keep original safe: return new Pair(p.getX(), p.getY()); } // Assume this is a time consuming operation protected void store(Pair p) { storage.add(p); try { TimeUnit.MILLISECONDS.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } public abstract void increment(); } // Synchronize the entire method: class PairManager1 extends PairManager { @Override public synchronized void increment() { p.incrementX(); p.incrementY(); store(getPair()); } } // Use a critical section: class PairManager2 extends PairManager { @Override public void increment() { Pair temp; synchronized (this) { p.incrementX(); p.incrementY(); temp = getPair(); } store(temp);// 这个方法是线程安全的,不用放置在同步代码块中。这是因为list是 synchronized ArrayList。 } } class PairManipulator implements Runnable { private PairManager pm; public PairManipulator(PairManager pm) { this.pm = pm; } @Override public void run() { while (true) { pm.increment(); } } @Override public String toString() { return "Pair: " + pm.getPair() + " checkCounter= " + pm.checkCounter.get(); } } class PairChecker implements Runnable { private PairManager pm; public PairChecker(PairManager pm) { this.pm = pm; } @Override public void run() { while (true) { pm.checkCounter.incrementAndGet(); pm.getPair().checkState(); } } }
000916e10661ae5b4d209b53c255bf65598e7f96
4a805860aad51bd8312c7d2265ccd15a0045e58d
/app/src/main/java/com/example/textrecognition/MainActivity.java
e02505672dfba4b12ac91c64c9e5eb2b9addbd7f
[]
no_license
nishusingh71/TextRecognition
20941d5d66f5d500f06414172e241bf65190eed5
4b81017b13f73c92d7d91f987d86eb717931c784
refs/heads/master
2022-11-07T22:27:31.896344
2020-06-18T12:15:36
2020-06-18T12:15:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,049
java
package com.example.textrecognition; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import android.Manifest; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.PersistableBundle; import android.util.Log; import android.util.SparseArray; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.TextView; import com.google.android.gms.vision.CameraSource; import com.google.android.gms.vision.Detector; import com.google.android.gms.vision.text.TextBlock; import com.google.android.gms.vision.text.TextRecognizer; import com.google.android.gms.vision.text.TextRecognizer.Builder; import java.io.IOException; public class MainActivity extends AppCompatActivity { SurfaceView myCameraView; TextView textView; CameraSource cameraSource; final int ReqCameraPermissionID = 1001; @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode){ case ReqCameraPermissionID: { if (grantResults[0]==PackageManager.PERMISSION_DENIED) { if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { return; } try { cameraSource.start(myCameraView.getHolder()); } catch (IOException e) { e.printStackTrace(); } } } } } @Override public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myCameraView = findViewById(R.id.surface); textView = findViewById(R.id.text_msg); TextRecognizer textRecognizer = new TextRecognizer.Builder(getApplicationContext()).build(); if (!textRecognizer.isOperational()) { Log.w("MainActivity", "Detector dependencies are not yet available"); } else { Detector detector; cameraSource = new CameraSource.Builder(getApplicationContext(), textRecognizer). setFacing(CameraSource.CAMERA_FACING_BACK). setRequestedPreviewSize(1280, 1024).setRequestedFps(2.0f).setAutoFocusEnabled(true).build(); myCameraView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { try { if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.CAMERA},ReqCameraPermissionID); return; } cameraSource.start(myCameraView.getHolder()); } catch (Exception e){ } } @Override public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) { } @Override public void surfaceDestroyed(SurfaceHolder surfaceHolder) { cameraSource.stop(); } }); textRecognizer.setProcessor(new Detector.Processor<TextBlock>() { @Override public void release() { } @Override public void receiveDetections(Detector.Detections<TextBlock> detections) { final SparseArray<TextBlock> items=detections.getDetectedItems(); if (items.size()!=0){ textView.post(new Runnable() { @Override public void run() { StringBuilder stringBuilder=new StringBuilder(); for (int i=0;i<items.size();i++){ TextBlock item=items.valueAt(i); stringBuilder.append(item.getValue()); stringBuilder.append("\n"); } textView.setText(stringBuilder.toString()); } }); } } }); } } }
72d6536f185a44966f94d7f3d7051dcf6c444889
489dbf038dc81578ee3d1f3465e10d2148a7d3d5
/web-ide/src/name/martingeisse/webide/nodejs/AbstractNodejsServer.java
97b7ab981bb755c06b53220cf6096a2a4e8bb908
[ "MIT" ]
permissive
MartinGeisse/public
9b3360186be7953d2185608da883916622ec84e3
57b905485322222447187ae78a5a56bf3ce67900
refs/heads/master
2023-01-21T03:00:43.350628
2016-03-20T16:30:09
2016-03-20T16:30:09
4,472,103
1
0
NOASSERTION
2022-12-27T14:45:54
2012-05-28T15:56:16
Java
UTF-8
Java
false
false
3,056
java
/** * Copyright (c) 2010 Martin Geisse * * This file is distributed under the terms of the MIT license. */ package name.martingeisse.webide.nodejs; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.util.HashMap; import java.util.Map; import name.martingeisse.webide.application.Configuration; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; import org.apache.commons.exec.ExecuteResultHandler; import org.apache.commons.exec.ExecuteStreamHandler; import org.apache.commons.exec.Executor; import org.apache.commons.exec.PumpStreamHandler; import org.apache.commons.exec.ShutdownHookProcessDestroyer; /** * Base class for NodeJS server processes. Each subclass should * have an associated Javascript file (which is inherited and * can be overridden) that is passed to the NodeJS command-line * tool. The server is started by the start() method. */ public abstract class AbstractNodejsServer { /** * Constructor. */ public AbstractNodejsServer() { } /** * Starts this server. */ public void start() { // determine the path of the associated script URL url = getScriptUrl(); if (!url.getProtocol().equals("file")) { throw new RuntimeException("unsupported protocol for associated script URL: " + url); } File scriptFile = new File(url.getPath()); // build the command line CommandLine commandLine = new CommandLine(Configuration.getBashPath()); commandLine.addArgument("--login"); commandLine.addArgument("-c"); commandLine.addArgument("node " + scriptFile.getName(), false); // build I/O streams ByteArrayInputStream inputStream = null; OutputStream outputStream = System.err; OutputStream errorStream = System.err; ExecuteStreamHandler streamHandler = new PumpStreamHandler(outputStream, errorStream, inputStream); // build an environment map that contains the path to the node_modules Map<String, String> environment = new HashMap<String, String>(); environment.put("NODE_PATH", new File("lib/node_modules").getAbsolutePath()); // run Node.js Executor executor = new DefaultExecutor(); executor.setProcessDestroyer(new ShutdownHookProcessDestroyer()); executor.setStreamHandler(streamHandler); try { executor.setWorkingDirectory(scriptFile.getParentFile()); executor.execute(commandLine, environment, new ExecuteResultHandler() { @Override public void onProcessFailed(ExecuteException e) { } @Override public void onProcessComplete(int exitValue) { } }); } catch (IOException e) { throw new RuntimeException(e); } } protected URL getScriptUrl() { for (Class<?> c = getClass(); c != null; c = c.getSuperclass()) { URL url = c.getResource(c.getSimpleName() + ".js"); if (url != null) { return url; } } throw new RuntimeException("no associated script for NodeJS server could be found"); } }
11cb4ca6086ff268ec69b27e30438920da50ae2c
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/UserAssignedIdentityProperty.java
ed8151cb5eca8556ec698a9abe38ee64904f8731
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
1,506
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.signalr.models; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; /** Properties of user assigned identity. */ @Immutable public final class UserAssignedIdentityProperty { /* * Get the principal id for the user assigned identity */ @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private String principalId; /* * Get the client id for the user assigned identity */ @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) private String clientId; /** Creates an instance of UserAssignedIdentityProperty class. */ public UserAssignedIdentityProperty() { } /** * Get the principalId property: Get the principal id for the user assigned identity. * * @return the principalId value. */ public String principalId() { return this.principalId; } /** * Get the clientId property: Get the client id for the user assigned identity. * * @return the clientId value. */ public String clientId() { return this.clientId; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } }
03c9bc9b3b398528ca2011ce1bb304bf63633ceb
a2f8f077036e2f0481337ed883d1e580f0f168ef
/JSP/7-Servlet/src/Servlet2.java
e333c50c63af5d6e32e0fe9113668f94c37c09a1
[]
no_license
jake-jeon9/study
39ce0e9e9310b9abf10d625f5aeb9a46ee6a05e8
6cff8e8c0f6b739c346f4a352cb3e677068459d5
refs/heads/master
2023-07-25T21:25:52.898493
2021-09-11T09:28:00
2021-09-11T09:28:00
369,456,920
0
0
null
null
null
null
UTF-8
Java
false
false
1,193
java
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Servlet2 */ @WebServlet("/Servlet2") public class Servlet2 extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Servlet2() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
2d8b2260b497fcae2d4649dadfd4d1774cdbe538
d73226d4cfb0d1a4609422c0753678777bee5eeb
/src/com/aof/webapp/action/party/EditPartyAction.java
98b77403123df783fa62835ba30f6e553db1737e
[]
no_license
Novthirteen/PMS
842132b8fd5d60e4b1b66716e741b4156b318959
65c8fd709bf6d88f80ee03341b9a7d950ace740f
refs/heads/master
2021-01-16T18:28:03.582398
2014-04-04T03:27:37
2014-04-04T03:28:55
18,425,558
0
1
null
null
null
null
UTF-8
Java
false
false
7,044
java
/* ==================================================================== * * Copyright (c) Atos Origin INFORMATION TECHNOLOGY All rights reserved. * * ==================================================================== * */ package com.aof.webapp.action.party; import java.sql.SQLException; import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.hibernate.*; import org.apache.log4j.Logger; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.MessageResources; import com.aof.webapp.action.ActionErrorLog; import com.aof.webapp.action.BaseAction; import com.aof.component.domain.party.*; import com.aof.core.persistence.hibernate.*; /** * @author xxp * @version 2003-7-2 * */ public class EditPartyAction extends BaseAction{ protected ActionErrors errors = new ActionErrors(); protected ActionErrorLog actionDebug = new ActionErrorLog(); public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) { // Extract attributes we will need ActionErrors errors = this.getActionErrors(request.getSession()); Logger log = Logger.getLogger(EditPartyAction.class.getName()); Locale locale = getLocale(request); MessageResources messages = getResources(); String action = request.getParameter("action"); log.info("action="+action); try{ String PartyId = request.getParameter("PartyId"); String description = request.getParameter("description"); String address = request.getParameter("address"); String postcode = request.getParameter("postcode"); String note = request.getParameter("note"); String role = request.getParameter("role"); String isSalesTeam = request.getParameter("isSalesTeam"); String SLParentpartyId = request.getParameter("SLParentpartyId"); String OldSLParentPartyId = request.getParameter("OldSLParentpartyId"); String LocParentpartyId = request.getParameter("LocParentpartyId"); String OldLocParentPartyId = request.getParameter("OldLocParentpartyId"); String CustPartyTypeId = "PARTY_GROUP"; if (address == null) address = ""; if (postcode == null) postcode = ""; if (note == null) note = ""; if (role == null) role = ""; if (SLParentpartyId == null) SLParentpartyId = "None"; if (LocParentpartyId == null) LocParentpartyId = "None"; if (isSalesTeam == null) { isSalesTeam = "N"; } log.info("============>"+description); net.sf.hibernate.Session hs = Hibernate2Session.currentSession(); Transaction tx = null; if(action == null) action = "view"; if(action.equals("view")){ log.info(action); Party CustParty = null; if (!((PartyId == null) || (PartyId.length() < 1))) CustParty = (Party)hs.load(Party.class,PartyId); request.setAttribute("CustParty",CustParty); return (mapping.findForward("view")); } if(action.equals("create")){ if ((PartyId == null) || (PartyId.length() < 1)) actionDebug.addGlobalError(errors,"error.context.required"); if ((description == null) || (description.length() < 1)) actionDebug.addGlobalError(errors,"error.context.required"); log.info(PartyId+description); if (!errors.empty()) { saveErrors(request, errors); return (new ActionForward(mapping.getInput())); } try{ tx = hs.beginTransaction(); Party CustParty = new Party(); CustParty.setPartyId(PartyId); CustParty.setDescription(description); CustParty.setAddress(address); CustParty.setPostCode(postcode); CustParty.setNote(note); CustParty.setIsSales(isSalesTeam); PartyType CustPartyType = (PartyType)hs.load(PartyType.class,CustPartyTypeId); CustParty.setPartyType(CustPartyType); Set mset = CustParty.getPartyRoles(); if(mset==null){ mset = new HashSet(); } mset.add((RoleType)hs.load(RoleType.class,role)); CustParty.setPartyRoles(mset); hs.save(CustParty); tx.commit(); PartyServices ps = new PartyServices(); ps.updatePartyRelationshipByPartyId(hs, SLParentpartyId, PartyId,"GROUP_ROLLUP"); ps.updatePartyRelationshipByPartyId(hs, LocParentpartyId, PartyId,"LOCATION_ROLLUP"); request.setAttribute("CustParty",CustParty); log.info("go to >>>>>>>>>>>>>>>>. view forward"); }catch(Exception e){ e.printStackTrace(); } return (mapping.findForward("view")); } if(action.equals("update")){ if ((PartyId == null) || (PartyId.length() < 1)) actionDebug.addGlobalError(errors,"error.context.required"); if (!errors.empty()) { saveErrors(request, errors); return (new ActionForward(mapping.getInput())); } tx = hs.beginTransaction(); Party CustParty = (Party)hs.load(Party.class,PartyId); CustParty.setDescription(description); CustParty.setAddress(address); CustParty.setPostCode(postcode); CustParty.setNote(note); CustParty.setIsSales(isSalesTeam); hs.update(CustParty); tx.commit(); PartyServices ps = new PartyServices(); ps.updatePartyRelationshipByPartyId(hs, SLParentpartyId, PartyId,"GROUP_ROLLUP"); ps.updatePartyRelationshipByPartyId(hs, LocParentpartyId, PartyId,"LOCATION_ROLLUP"); request.setAttribute("CustParty",CustParty); return (mapping.findForward("view")); } if(action.equals("delete")){ if ((PartyId == null) || (PartyId.length() < 1)) actionDebug.addGlobalError(errors,"error.context.required"); if (!errors.empty()) { saveErrors(request, errors); return (new ActionForward(mapping.getInput())); } tx = hs.beginTransaction(); Party CustParty = (Party)hs.load(Party.class,PartyId); log.info("PartyId="+CustParty.getPartyId()); PartyServices ps = new PartyServices(); ps.updatePartyRelationshipByPartyId(hs, SLParentpartyId, PartyId,"GROUP_ROLLUP"); ps.updatePartyRelationshipByPartyId(hs, LocParentpartyId, PartyId,"LOCATION_ROLLUP"); hs.delete(CustParty); tx.commit(); return (mapping.findForward("list")); } if (!errors.empty()) { saveErrors(request, errors); return (new ActionForward(mapping.getInput())); } return (mapping.findForward("view")); }catch(Exception e){ e.printStackTrace(); log.error(e.getMessage()); return (mapping.findForward("view")); }finally{ try { Hibernate2Session.closeSession(); } catch (HibernateException e1) { log.error(e1.getMessage()); e1.printStackTrace(); } catch (SQLException e1) { log.error(e1.getMessage()); e1.printStackTrace(); } } } }
470261f8b9c91ba7669dbbba27aed650a2216212
bf4c5069b5973843884b7f69332b982a94191579
/src/Model/PointsCalculator.java
fa54a6d00b0aadf907d013c85309c3a2dde0f55d
[]
no_license
jamieeow/sushi-go
fdd755c455de49b0869b70a04856e89d60ad4576
b16d26e296eb7ee542fff6d29c932621adfb7720
refs/heads/master
2022-11-06T10:19:40.457079
2020-06-21T17:56:57
2020-06-21T17:56:57
273,953,630
0
0
null
null
null
null
UTF-8
Java
false
false
6,746
java
package Model; import java.awt.*; import java.util.*; import java.util.stream.Collectors; // /** * A CALCULATOR OF POINTS FOR ALL KINDS OF SUSHI */ public class PointsCalculator { private int tempuraCount; private int sashimiCount; private int dumplingsCount; private int tofuCount; private int rollPoints; private int greenTeaCount; private int totalPoints; private boolean playedWasabi; public PointsCalculator (){ this.tempuraCount = 0; this.sashimiCount = 0; this.dumplingsCount = 0; this.tofuCount = 0; this.rollPoints = 0; this.greenTeaCount = 0; } // METHODS // // /** * RETURNS THE TOTAL POINTS GARNERED OF THE PLAYER PARAMETER * @param players * @param player * @param round * @return */ public int calculateSushis(ArrayList<Player> players, Player player, RoundStatistics round){ // INITIATE VALUES this.tempuraCount = 0; this.sashimiCount = 0; this.dumplingsCount = 0; this.tofuCount = 0; this.rollPoints = 0; this.greenTeaCount = 0; this.totalPoints = 0; this.playedWasabi = false; ArrayList<Card> sushis = (ArrayList<Card>) player.getKeepPile(); // ADDS TO THE TOTAL POINT FOR EACH KIND OF CARD for (Card card: sushis) { if (card instanceof Nigiri) totalPoints += calculateNigiri((Nigiri) card); else if (card instanceof Tempura) tempuraCount++; else if (card instanceof Sashimi) sashimiCount++; else if (card instanceof Dumplings) dumplingsCount++; else if (card instanceof Tofu) tofuCount++; else if (card instanceof GreenTeaIceCream) greenTeaCount++; else if (card instanceof Wasabi) playedWasabi = true; else if (card instanceof Tea) totalPoints += calculateTea(players); else if (card instanceof Pudding) totalPoints += calculatePudding(player, round); else if (card instanceof Rolls) totalPoints += calculateMaki(player, round); else if (card instanceof MisoSoup) totalPoints += calculateMiso(player, players, (MisoSoup) card); } totalPoints += calculateTempura(); totalPoints += calculateSashimi(); totalPoints += calculateDumplings(); totalPoints += calculateTofu(); totalPoints += calculateGreenTea(); return totalPoints; } // /** * COMPUTATION FOR NIGIRI * @param nigiri * @return int */ public int calculateNigiri(Nigiri nigiri){ if (nigiri instanceof Egg) return 1; else if (nigiri instanceof Salmon) return 2; return 3; } // /** * COMPUTATION FOR TEMPURA * @return int */ public int calculateTempura(){ if (tempuraCount >= 2) return 5*(tempuraCount/2); return 0; } // /** * COMPUTATION FOR SASHIMI * @return int */ public int calculateSashimi(){ // TODO if (sashimiCount >= 3 ) return 10 * (sashimiCount/3); return 0; } // /** * COMPUTATION FOR DUMPLINGS * @return */ public int calculateDumplings(){ // TODO if (dumplingsCount >= 5) return 15; else if (dumplingsCount == 4) return 10; else if (dumplingsCount == 3) return 6; else if (dumplingsCount == 2) return 3; return dumplingsCount; } // /** * COMPUTATION FOR TOFU * @return */ public int calculateTofu(){ // TODO if (tofuCount==1) return 2; else if (tofuCount==2) return 6; return 0; } // /** * COMPUTATION FOR GREEN TEA ICE CREAM * @return int */ public int calculateGreenTea(){ if (greenTeaCount >= 4) return 12 * (greenTeaCount/4); return 0; } // /** * COMPUTATION FOR MAKI * @param player * @param roundStatistics * @return int */ public int calculateMaki(Player player, RoundStatistics roundStatistics){ if (player.equals(roundStatistics.getHighestMaki())) return 6; else if (player.equals(roundStatistics.getSecondMostMaki())) return 3; return 0; } // /** * COMPUTATION FOR MISO SOUP * @param player * @param players * @param misoSoup * @return int */ public int calculateMiso(Player player, ArrayList<Player> players, MisoSoup misoSoup){ // TODO boolean playedMiso = player.getPlayedMiso(); boolean othersPlayed = false; for (Player p: players) { if (p.getPlayedMiso()) { if(!player.equals(p)) othersPlayed = true; } } if (!othersPlayed && playedMiso) return 3; else { GameData.board.getMainDeck().getCards().add(misoSoup); return 0; } } // /** * COMPUTATION FOR TEA * @param players * @return int */ public int calculateTea(ArrayList<Player> players){ // TODO int highest=0; // GETTING LARGEST SET OF SAME BACKGROUND COLOR OF EACH PLAYER for (Player player: players) { Map<Color, Long> counting = player.getKeepPile().stream().collect( Collectors.groupingBy(Card::getColor, Collectors.counting())); Map.Entry<Color, Long> maxEntry = null; for (Map.Entry<Color, Long> entry: counting.entrySet()) { if (maxEntry == null || entry.getValue().compareTo(maxEntry.getValue()) > 0) maxEntry = entry; } String value = maxEntry.getValue().toString(); int intValue = Integer.parseInt(value); if (intValue < highest) highest = intValue; } return highest; } // /** * COMPUTATION FOR PUDDING * @param player * @param roundStatistics * @return int */ public int calculatePudding(Player player, RoundStatistics roundStatistics){ if (roundStatistics.getHighestPudding().equals(player)) return 6; if (GameData.is2Player) if (roundStatistics.getLeastPudding().equals(player)) return -6; return 0; } }
7105ee117daf2f60045c06b8dbfa38139e9d681a
eaec4795e768f4631df4fae050fd95276cd3e01b
/src/cmps252/HW4_2/UnitTesting/record_4312.java
413212301a9e13d3dae8fad778fd9830bd63592b
[ "MIT" ]
permissive
baraabilal/cmps252_hw4.2
debf5ae34ce6a7ff8d3bce21b0345874223093bc
c436f6ae764de35562cf103b049abd7fe8826b2b
refs/heads/main
2023-01-04T13:02:13.126271
2020-11-03T16:32:35
2020-11-03T16:32:35
307,839,669
1
0
MIT
2020-10-27T22:07:57
2020-10-27T22:07:56
null
UTF-8
Java
false
false
2,442
java
package cmps252.HW4_2.UnitTesting; import static org.junit.jupiter.api.Assertions.*; import java.io.FileNotFoundException; import java.util.List; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import cmps252.HW4_2.Customer; import cmps252.HW4_2.FileParser; @Tag("38") class Record_4312 { private static List<Customer> customers; @BeforeAll public static void init() throws FileNotFoundException { customers = FileParser.getCustomers(Configuration.CSV_File); } @Test @DisplayName("Record 4312: FirstName is Jake") void FirstNameOfRecord4312() { assertEquals("Jake", customers.get(4311).getFirstName()); } @Test @DisplayName("Record 4312: LastName is Fidel") void LastNameOfRecord4312() { assertEquals("Fidel", customers.get(4311).getLastName()); } @Test @DisplayName("Record 4312: Company is Dazor Manufacturing Corp") void CompanyOfRecord4312() { assertEquals("Dazor Manufacturing Corp", customers.get(4311).getCompany()); } @Test @DisplayName("Record 4312: Address is 499 Cooper Landing Rd") void AddressOfRecord4312() { assertEquals("499 Cooper Landing Rd", customers.get(4311).getAddress()); } @Test @DisplayName("Record 4312: City is Cherry Hill") void CityOfRecord4312() { assertEquals("Cherry Hill", customers.get(4311).getCity()); } @Test @DisplayName("Record 4312: County is Camden") void CountyOfRecord4312() { assertEquals("Camden", customers.get(4311).getCounty()); } @Test @DisplayName("Record 4312: State is NJ") void StateOfRecord4312() { assertEquals("NJ", customers.get(4311).getState()); } @Test @DisplayName("Record 4312: ZIP is 8002") void ZIPOfRecord4312() { assertEquals("8002", customers.get(4311).getZIP()); } @Test @DisplayName("Record 4312: Phone is 856-667-8903") void PhoneOfRecord4312() { assertEquals("856-667-8903", customers.get(4311).getPhone()); } @Test @DisplayName("Record 4312: Fax is 856-667-6617") void FaxOfRecord4312() { assertEquals("856-667-6617", customers.get(4311).getFax()); } @Test @DisplayName("Record 4312: Email is [email protected]") void EmailOfRecord4312() { assertEquals("[email protected]", customers.get(4311).getEmail()); } @Test @DisplayName("Record 4312: Web is http://www.jakefidel.com") void WebOfRecord4312() { assertEquals("http://www.jakefidel.com", customers.get(4311).getWeb()); } }
50c6bed8e0f04a9039325666047d6afa343caa0b
7a6d8138f553d6ae6f488d99da332264332a638d
/src/main/java/energyservice/ReservationRepository.java
e2cbb27b7fa9ec3c205844d69ae4f5e4492c566b
[]
no_license
Joon-se/reservation
23d46e485e400d2978ed64a81775577dae44cdc1
795b1ad2910ba4d6bea222a3c222576fb561936a
refs/heads/master
2022-11-03T02:46:46.923913
2020-06-19T00:51:56
2020-06-19T00:51:56
273,371,112
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package energyservice; import org.springframework.data.repository.PagingAndSortingRepository; public interface ReservationRepository extends PagingAndSortingRepository<Reservation, Long>{ }
b449ab3e2e498dbf806392f6fc88846c12ddd775
72cbd420d57f970a6bfbf9cf4dc62f662e6a0ebb
/plugin/core/src/com/perl5/lang/perl/idea/configuration/settings/sdk/wrappers/Perl5RealSdkWrapper.java
d90f435685bfaa7bad561509c9f80c9ab12793d1
[ "Apache-2.0" ]
permissive
xcodejoy/Perl5-IDEA
e36061de84cc1780ed76711190bb5ce4b05fa3f0
2179a9ab2e9006d4c5501a878f484293220046ac
refs/heads/master
2020-09-19T09:15:35.960543
2019-11-23T08:46:28
2019-11-23T08:46:28
224,215,081
1
0
NOASSERTION
2019-11-26T14:44:56
2019-11-26T14:44:55
null
UTF-8
Java
false
false
3,181
java
/* * Copyright 2015-2019 Alexandr Evstigneev * * 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.perl5.lang.perl.idea.configuration.settings.sdk.wrappers; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.ColoredListCellRenderer; import com.intellij.ui.SimpleTextAttributes; import com.perl5.lang.perl.idea.sdk.host.PerlHostData; import com.perl5.lang.perl.idea.sdk.versionManager.PerlVersionManagerData; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class Perl5RealSdkWrapper implements Perl5SdkWrapper { @NotNull private final Sdk mySdk; public Perl5RealSdkWrapper(@NotNull Sdk sdk) { mySdk = sdk; } @Override public void customizeRenderer(@NotNull ColoredListCellRenderer<Perl5SdkWrapper> renderer) { SdkType sdkType = (SdkType)mySdk.getSdkType(); renderer.setIcon(sdkType.getIcon()); appendSdkString(renderer, mySdk); } @NotNull public Sdk getSdk() { return mySdk; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Perl5RealSdkWrapper)) return false; Perl5RealSdkWrapper wrapper = (Perl5RealSdkWrapper)o; return getSdk().equals(wrapper.getSdk()); } @Override public int hashCode() { return getSdk().hashCode(); } @Override public String toString() { return "SDK: " + mySdk; } public static void appendSdkString(@NotNull ColoredListCellRenderer<Perl5SdkWrapper> renderer, @NotNull Sdk sdk) { PerlHostData hostData = PerlHostData.notNullFrom(sdk); renderPair(renderer, hostData.getPrimaryShortName(), hostData.getSecondaryShortName()); PerlVersionManagerData<?, ?> versionManagerData = PerlVersionManagerData.notNullFrom(sdk); renderPair(renderer, versionManagerData.getPrimaryShortName(), versionManagerData.getSecondaryShortName()); renderer.append(StringUtil.notNullize(sdk.getVersionString())); } private static void renderPair(@NotNull ColoredListCellRenderer<Perl5SdkWrapper> renderer, @NotNull String primary, @Nullable String secondary) { renderer.append(StringUtil.capitalize(primary)); if (secondary != null) { renderer.append(secondary, SimpleTextAttributes.GRAY_ATTRIBUTES); } renderer.append(", "); } @Contract("null->null;!null->!null") @Nullable public static Perl5RealSdkWrapper create(@Nullable Sdk sdk) { return sdk == null ? null : new Perl5RealSdkWrapper(sdk); } }
ddc5f5523dd6bebb8f0543d00b63137fc7175904
7c2ae7375b00e66838ea5c5ff1f1569cce47760a
/profiler-test/src/main/java/com/navercorp/pinpoint/test/classloader/TestClassLoader.java
741e9a96ebdd90f612ac4ea15fb2c9d97dcc4b9f
[ "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "DOC", "CC-BY-3.0", "GPL-1.0-or-later", "CC-PDDC", "MIT", "CC0-1.0", "GPL-2.0-only", "LicenseRef-scancode-public-domain" ]
permissive
tank1314/pinpoint
1bb74822a144d317ed58c434b222ed67468deaa4
ad8b4ffeb50e29969f6be806699fcd7e9ef5b07c
refs/heads/master
2020-03-26T22:54:12.392621
2018-08-21T07:40:38
2018-08-21T07:40:38
118,546,232
0
0
Apache-2.0
2018-05-12T03:08:35
2018-01-23T02:32:45
Java
UTF-8
Java
false
false
6,277
java
/* * Copyright 2016 NAVER Corp. * * 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.navercorp.pinpoint.test.classloader; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext; import com.navercorp.pinpoint.profiler.instrument.InstrumentEngine; import com.navercorp.pinpoint.profiler.instrument.ASMEngine; import com.navercorp.pinpoint.profiler.instrument.classloading.ClassInjector; import com.navercorp.pinpoint.profiler.instrument.classloading.DebugTransformerClassInjector; import com.navercorp.pinpoint.profiler.instrument.JavassistEngine; import com.navercorp.pinpoint.profiler.plugin.ClassFileTransformerLoader; import com.navercorp.pinpoint.profiler.plugin.MatchableClassFileTransformerGuardDelegate; import com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext; import com.navercorp.pinpoint.test.MockApplicationContext; import javassist.ClassPool; import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig; import com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher; import com.navercorp.pinpoint.bootstrap.instrument.matcher.Matchers; import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback; import com.navercorp.pinpoint.common.util.Asserts; /** * @author emeroad * @author hyungil.jeong */ public class TestClassLoader extends TransformClassLoader { private final Logger logger = Logger.getLogger(TestClassLoader.class.getName()); private final MockApplicationContext applicationContext; private Translator instrumentTranslator; private final List<String> delegateClass; private final ClassFileTransformerLoader classFileTransformerLoader; private final InstrumentContext instrumentContext; public TestClassLoader(MockApplicationContext applicationContext) { Asserts.notNull(applicationContext, "applicationContext"); this.applicationContext = applicationContext; this.classFileTransformerLoader = new ClassFileTransformerLoader(applicationContext.getProfilerConfig(), applicationContext.getDynamicTransformTrigger()); // ClassInjector classInjector = new LegacyProfilerPluginClassInjector(getClass().getClassLoader()); ClassInjector classInjector = new DebugTransformerClassInjector(); this.instrumentContext = new PluginInstrumentContext(applicationContext.getProfilerConfig(), applicationContext.getInstrumentEngine(), applicationContext.getDynamicTransformTrigger(), classInjector, classFileTransformerLoader); this.delegateClass = new ArrayList<String>(); } public void addDelegateClass(String className) { if (className == null) { throw new NullPointerException("className must not be null"); } this.delegateClass.add(className); } @Override protected Class<?> findClass(String name) throws ClassNotFoundException { if (logger.isLoggable(Level.FINE)) { logger.fine("findClass className:{}" + name); } return super.findClass(name); } public void initialize() { addDefaultDelegateLoadingOf(); addCustomDelegateLoadingOf(); addTranslator(); } private void addCustomDelegateLoadingOf() { for (String className : delegateClass) { this.delegateLoadingOf(className); } } public ProfilerConfig getProfilerConfig() { return applicationContext.getProfilerConfig(); } public void addTransformer(final String targetClassName, final TransformCallback transformer) { if (logger.isLoggable(Level.FINE)) { logger.fine("addTransformer targetClassName:{}" + targetClassName + " callback:{}" + transformer); } final Matcher matcher = Matchers.newClassNameMatcher(targetClassName); final MatchableClassFileTransformerGuardDelegate guard = new MatchableClassFileTransformerGuardDelegate(applicationContext.getProfilerConfig(), instrumentContext, matcher, transformer); this.instrumentTranslator.addTransformer(guard); } private void addDefaultDelegateLoadingOf() { TestClassList testClassList = new TestClassList(); for (String className : testClassList.getTestClassList()) { this.delegateLoadingOf(className); } } @Override protected Class<?> loadClassByDelegation(String name) throws ClassNotFoundException { if (logger.isLoggable(Level.FINE)) { logger.fine("loadClassByDelegation className:{}" + name); } return super.loadClassByDelegation(name); } public void addTranslator() { final InstrumentEngine instrumentEngine = applicationContext.getInstrumentEngine(); if (instrumentEngine instanceof JavassistEngine) { logger.info("JAVASSIST BCI engine"); ClassPool classPool = ((JavassistEngine) instrumentEngine).getClassPool(this); this.instrumentTranslator = new JavassistTranslator(this, classPool, applicationContext.getClassFileTransformerDispatcher()); this.addTranslator(instrumentTranslator); } else if (instrumentEngine instanceof ASMEngine) { logger.info("ASM BCI engine"); this.instrumentTranslator = new DefaultTranslator(this, applicationContext.getClassFileTransformerDispatcher()); this.addTranslator(instrumentTranslator); } else { logger.info("Unknown BCI engine"); this.instrumentTranslator = new DefaultTranslator(this, applicationContext.getClassFileTransformerDispatcher()); this.addTranslator(instrumentTranslator); } } }
cde8afeba61d8b99031dd8af1052d053106c5de4
88a26e9f8195a6f2685843011d708995a431d0e7
/app/src/test/java/com/example/restapiproject/MainActivityTest.java
a2510e83b7e323d828d960928be6ff8a268f9c8b
[]
no_license
ecluster/RestAPI-Project
b0cf027baa3e873347c1225f7c8e70304b7ca1b4
32353a8dea07ed672d58a4f9a40448663e038776
refs/heads/master
2023-07-18T06:41:03.206671
2021-09-04T04:16:44
2021-09-04T04:16:44
402,662,473
0
0
null
null
null
null
UTF-8
Java
false
false
3,119
java
package com.example.restapiproject; import org.junit.Test; import static org.junit.Assert.*; import android.content.Context; import java.util.ArrayList; import java.util.List; public class MainActivityTest { @Test public void emptyUserField() { String username = ""; assertEquals(true, MainActivity.isUsernameEmpty(username)); } @Test public void filledUserField() { String username = "edward"; assertEquals(false, MainActivity.isUsernameEmpty(username)); } @Test public void emptyPasswordField() { String password = ""; assertEquals(true, MainActivity.isPasswordEmpty(password)); } @Test public void filledPasswordField() { String password = "password"; assertEquals(false, MainActivity.isPasswordEmpty(password)); } @Test public void hasInput() { String username = "edward"; String password = "password"; assertEquals(true, MainActivity.hasInput(username, password)); } @Test public void hasNoInput() { String username = ""; String password = ""; assertEquals(false, MainActivity.hasInput(username, password)); } @Test public void missingUsernameInput() { String username = ""; String password = "password"; assertEquals(true, MainActivity.hasInput(username, password)); } @Test public void missingPasswordInput() { String username = "username"; String password = ""; assertEquals(true, MainActivity.hasInput(username, password)); } @Test public void matchingPassword() { String password = "password"; List<User> users = new ArrayList<>(); users.add(new User("edward", "password", "1")); assertEquals(true, MainActivity.matchPassword(password, users)); } @Test public void noMatchingPassword() { String password = "123"; List<User> users = new ArrayList<>(); users.add(new User("edward", "password", "1")); assertEquals(false, MainActivity.matchPassword(password, users)); } @Test public void userExists() { String user1 = "edward"; List<User> users = new ArrayList<>(); users.add(new User("edward", "password", "1")); assertEquals(true, MainActivity.userExist(user1, users)); } @Test public void userDoesNotExists() { String user1 = "edward"; List<User> users = new ArrayList<>(); users.add(new User("person", "password", "1")); assertEquals(false, MainActivity.userExist(user1, users)); } @Test public void getUser() { User u1 = new User("edward", "password", "1"); List<User> users = new ArrayList<>(); users.add(u1); assertEquals(u1, MainActivity.getUser("edward", users)); } @Test public void canGetUser() { User u1 = new User("person", "password", "1"); List<User> users = new ArrayList<>(); users.add(u1); assertEquals(null, MainActivity.getUser("edward", users)); } }
46504b014963dc8d323c7ec7a364d96463828d9d
292be53cc1aa136fb38e92dd8590a0b950edb465
/BOJ2293.java
c027bd7b988777ab864993487f33a9c022a3f489
[]
no_license
HYUNindaeyo/BOJ
032c84c2a2a2e1f4d29a42cdb19932350a2244a0
feff6130c3570f190b9c032364e6213893be403f
refs/heads/master
2023-05-02T11:33:28.856144
2021-05-11T18:08:05
2021-05-11T18:08:05
323,780,628
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package 백준공부; import java.util.*; public class BOJ2293 { static int dp[]; public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); int num[] = new int[n+1]; int coin; // 미리 받아서 어딘가에 저장하는 게 아니라 그 때 그때 더해준다 dp를 하면서... 좋은 아이디어 인듯 int result = 0; int[] dp = new int[k+1]; dp[0] = 1; for(int i = 0; i < n; i++) { coin = scan.nextInt(); for(int j = 1; j < k+1; j++) { if(j >= coin) dp[j] += dp[j - coin]; } } System.out.println(dp[k]); } } /* dp = new int[n+1][k+1]; for (int i=1;i<k;i++) { dp[0][i] = 0; } for (int i=1;i<k;i++) { dp[1][i] = k%num[1]; } for (int i = 1;i<=n;i++) { for (int j=1;j<=k;j++) { int tmp = 1; while (k-tmp * num[i]>0) { dp[n][k] = dp[n][k] + dp[n-tmp][k-tmp*num[i]]; System.out.printf("N K %d %d %d\n",n,k,dp[n][k]); tmp ++; } tmp = 1; } } System.out.println(dp[n][k]); */ //나 혼자 완전 복잡하게 생각하고 있었던 것... 훨씬 쉬운 dp 방법이 있어서 그 코드참고. //https://geehye.github.io/baekjoon-2293/# 여기 코드 참고 했음 // dp[i] += dp[i - 동전] 이 규칙을 따른다는 거만ㅇ 알면 됨
280d6ad4ca525a00af8b364bc47e76fc6da3423c
2aed8d637adf659ef354ce041437709453a99a84
/src/com/sme/service/PlgUserService.java
3f964d5c37dcf1d29e783ffe132259d9bf86af29
[]
no_license
yaop104/plugins
abd963058334b20d7a261f47e1cb137821eb3134
13f4fd3c0e524ec3ee9036c4be9df5300556b2ab
refs/heads/master
2020-05-21T13:30:45.790004
2016-10-10T21:02:06
2016-10-10T21:02:06
61,511,508
4
0
null
null
null
null
UTF-8
Java
false
false
284
java
package com.sme.service; import com.sme.core.service.InterfaceBaseService; import com.sme.entity.PlgUser; public interface PlgUserService extends InterfaceBaseService<PlgUser> { //================== begin ====================== //================== end ====================== }
366b27dcb41a179d7aff4b41f4c696a751f2229d
656e22d276f54b652202858f9fa1978c8993a17c
/src/api/AdminMenu.java
d18c8158a2a0ed49cb1f73784a991125097f5ba2
[]
no_license
Indomie-glitch/Hotel-Reservation
d46ac8ad177f987f7533c9977868137e0fffedcf
0c6ce1390c65ec2d2717d010b5938aa62d6232f5
refs/heads/master
2023-05-10T07:45:26.795371
2021-06-10T13:37:46
2021-06-10T13:37:46
367,333,150
0
0
null
null
null
null
UTF-8
Java
false
false
4,015
java
package api; import model.Customer; import model.IRoom; import model.Room; import model.RoomType; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Scanner; public class AdminMenu { public void start() { boolean keepRunning = true; Scanner scanner = new Scanner(System.in); while (keepRunning) { try { System.out.println("____________________________________"); System.out.println("Admin Menu"); System.out.println("1. See all Customers"); System.out.println("2. See all Rooms"); System.out.println("3. See all Reservations"); System.out.println("4. Add a Room"); System.out.println("5. Back to Main Menu"); System.out.println("____________________________________"); int selection = Integer.parseInt(scanner.nextLine()); switch (selection) { case 1 -> { //Do SOMETHING Collection<Customer> customers = AdminResource.getInstance().getAllCustomer(); for (Customer customer : customers) { System.out.print("First Name " + customer.getFirstName() + " "); System.out.print("Last Name " + customer.getLastName() + " "); System.out.print("The Email " + customer.getEmail() + " || \n"); } } case 2 -> { System.out.println("All the Rooms"); Collection<IRoom> rooms = AdminResource.getInstance().getAllRoom(); for (IRoom room : rooms) { System.out.print("The Room Number " + room.getRoomNumber() + " "); System.out.print("The Price of the Room " + room.getRoomPrice() + " "); System.out.print("Double or Single " + room.getRoomType() + " || \n"); } } case 3 -> //Do SOMETHING System.out.println("See All Reservations"); case 4 -> { Room room = new Room(); System.out.println("Enter the Room Number"); String roomNumber = (scanner.nextLine()); room.setRoomNumber(roomNumber); System.out.println("Enter the Price \n $"); Double roomPrice = Double.parseDouble(scanner.nextLine()); room.setPrice(roomPrice); System.out.println("Enter the type of the room| \n 1 for Single \n 2 for double"); int roomType = Integer.parseInt(scanner.nextLine()); if (roomType == 1) { System.out.println("Single"); room.setType(RoomType.SINGLE); } else if (roomType == 2) { System.out.println("Double"); room.setType(RoomType.DOUBLE); } List<IRoom> rooms = new ArrayList<IRoom>(); rooms.add(room); AdminResource.getInstance().addRoom(rooms); } case 5 -> { System.out.println("Traveling to Main Menu"); keepRunning = false; } } //Back to main menu } catch (Exception e) { System.out.println("THERE IS AN ERROR... \n CALCULATING............. \n MISTAKE FOUND, YOU MUST HAVE DONE SOMETHING, FIX IT FAST BEFORE YOUR PC EXPLODES THEN IMPLODES"); e.printStackTrace(); } } } }
83e5815e49f2c42c0a5c2218c22b813c8a7e6656
4f4cd12cb6ee8fc86e5e932a602ac73dd057b411
/pester-samples/src/test/java/fr/vergne/pester/samples/T02_JavaBean.java
f254e2635b9a42d4c1494926b42171d268583648
[ "CC0-1.0" ]
permissive
matthieu-vergne/pester
6da5ad8fda9c2b9dfa381b764dbc46d078974a1a
851a3b1cc06fa950ab8801a7a82f031df005368f
refs/heads/master
2021-03-02T04:06:10.310505
2020-04-13T23:59:03
2020-04-13T23:59:03
245,837,168
0
0
null
null
null
null
UTF-8
Java
false
false
882
java
package fr.vergne.pester.samples; import java.io.Serializable; import fr.vergne.pester.PesterTest; import fr.vergne.pester.definition.DefinitionFactory; import fr.vergne.pester.definition.PojoDefinition; import fr.vergne.pester.samples.T02_JavaBean.Pojo; class T02_JavaBean implements PesterTest<Pojo> { @Override public PojoDefinition<Pojo> createPojoDefinition() { return new DefinitionFactory().fromBeanClass(Pojo.class); } @SuppressWarnings("serial") public static class Pojo implements Serializable { public Pojo() { // Default constructor, can be implicit } private Integer property1; public Integer getProperty1() {return property1;} public void setProperty1(Integer value) {property1 = value;} private Integer property2; public Integer getProperty2() {return property2;} public void setProperty2(Integer value) {property2 = value;} } }
4b0e17b73b8751e965e2111bd8fe507884ee4e8c
23639b38b8d6b3eb19330281aacebd97bd376e6e
/src/main/java/com/ieee19/bc/interop/pf/proxy/bitcoin/interfaces/IBitcoinService.java
4357ec9988040aa7c56e7509b401cb98a87e2d15
[ "Apache-2.0" ]
permissive
pf92/blockchain-interop
ccbe8193f4cc1232a21a15341986c0291b622bee
708aea9ac4cab946422571fa28dd4177dc0cf425
refs/heads/master
2020-05-15T11:28:19.393523
2019-04-19T08:19:41
2019-04-19T08:19:41
182,229,142
2
0
null
null
null
null
UTF-8
Java
false
false
1,501
java
package com.ieee19.bc.interop.pf.proxy.bitcoin.interfaces; import com.ieee19.bc.interop.pf.core.model.Block; import com.ieee19.bc.interop.pf.core.exception.DataWritingFailedException; import com.ieee19.bc.interop.pf.proxy.bitcoin.dto.blockcypher.FeePerKbInfo; import com.ieee19.bc.interop.pf.proxy.bitcoin.exception.BitcoinException; import java.io.IOException; import java.time.ZonedDateTime; import java.util.List; public interface IBitcoinService { /** * @return the current block height (block number) */ long getCurrentBlockHeight() throws BitcoinException; /** * @param blockNumber the number of the block to fetch * @return the block with the given <i>blockNumber</i> * @throws IOException */ Block getBlockByBlockNumber(long blockNumber) throws BitcoinException; /** * @return transaction fee info per KB. */ FeePerKbInfo getFeePerKbInfo() throws BitcoinException; /** * Returns all data that have been mined during <i>from</i> and <i>to</i>. * @param from start date * @param to end date * @return the data */ List<String> getData(ZonedDateTime from, ZonedDateTime to) throws BitcoinException; /** * Writes data to the Bitcoin blockchain * @param dataString the data to write * @param txFeesInSatoshi transaction fees in satoshis * @throws DataWritingFailedException */ void storeData(String dataString, long txFeesInSatoshi) throws BitcoinException; }
fc72aadcdecde1e3c49e83f0edb17b22887a3e9c
82295c2d365176a00ec9dd4a7f67d5844b9a1296
/magma-datasource-health-canada/src/main/java/org/obiba/magma/datasource/healthcanada/HCDrugsValueTable.java
afeb11acd0cdc579f48206859d4b9d45a68ecfb2
[]
no_license
nuwimana/public-datasources
46941bb6f9214ad499deca619b49be3db8490d17
219e7700f3ba66ebee43c4f6e26534dd5cec39f6
refs/heads/master
2021-01-15T21:49:53.312890
2013-06-17T14:43:06
2013-06-17T14:43:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,344
java
package org.obiba.magma.datasource.healthcanada; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.nio.charset.Charset; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import javax.annotation.Nonnull; import org.obiba.magma.MagmaDate; import org.obiba.magma.MagmaRuntimeException; import org.obiba.magma.NoSuchValueSetException; import org.obiba.magma.Timestamps; import org.obiba.magma.Value; import org.obiba.magma.ValueSet; import org.obiba.magma.ValueTable; import org.obiba.magma.ValueType; import org.obiba.magma.Variable; import org.obiba.magma.VariableEntity; import org.obiba.magma.support.AbstractValueTable; import org.obiba.magma.support.VariableEntityBean; import org.obiba.magma.type.DateTimeType; import org.obiba.magma.type.DateType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Maps; import au.com.bytecode.opencsv.CSVReader; import de.schlichtherle.io.File; import de.schlichtherle.io.FileInputStream; public class HCDrugsValueTable extends AbstractValueTable { private static final Logger log = LoggerFactory.getLogger(HCDrugsValueTable.class); private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy"); static final String DRUG_ENTITY_TYPE = "Drug"; static final String ALL_FILES_ZIP_URL = "http://www.hc-sc.gc.ca/dhp-mps/alt_formats/zip/prodpharma/databasdon/allfiles.zip"; private static final Charset WESTERN_EUROPE = Charset.availableCharsets().get("ISO-8859-1"); private File zsource; // source file name / entity id / value set private Map<String, Map<String, String[]>> valueSets = Maps.newHashMap(); public HCDrugsValueTable(HCDatasource datasource) { super(datasource, "Drugs"); setVariableEntityProvider(new HCDrugsVariableEntityProvider(this)); addVariableValueSources(new HCDrugsVariableValueSourceFactory()); } @Override public ValueSet getValueSet(VariableEntity entity) throws NoSuchValueSetException { return new HCDrugsValueSet(entity); } @Override public Timestamps getTimestamps() { return new Timestamps() { private File drugEntry; @Nonnull @Override public Value getLastUpdate() { return DateTimeType.get().valueOf(new Date(getDrugEntry().lastModified())); } @Nonnull @Override public Value getCreated() { return DateTimeType.get().nullValue(); } private File getDrugEntry() { if(drugEntry == null) { drugEntry = getFileEntry("drug.txt"); } return drugEntry; } }; } private void downloadLatestAllFiles() throws IOException { log.info("Download from: {} ...", ALL_FILES_ZIP_URL); // Get a connection to the URL and start up a buffered reader. URL url = new URL(ALL_FILES_ZIP_URL); url.openConnection(); InputStream reader = url.openStream(); // Setup a buffered file writer to write out what we read from the website. java.io.File allfiles = java.io.File.createTempFile("healthcanada-drugs-", ".zip"); allfiles.deleteOnExit(); FileOutputStream writer = new FileOutputStream(allfiles); byte[] buffer = new byte[153600]; int bytesRead = 0; while((bytesRead = reader.read(buffer)) > 0) { writer.write(buffer, 0, bytesRead); buffer = new byte[153600]; } writer.close(); reader.close(); zsource = new File(allfiles); } public File getFileEntry(String name) { if(zsource == null) { try { downloadLatestAllFiles(); } catch(IOException e) { throw new MagmaRuntimeException("Unable to download Health Canada Drugs from: " + ALL_FILES_ZIP_URL, e); } } return new File(zsource, name); } CSVReader getEntryReader(String name) { try { return new CSVReader(new InputStreamReader(new FileInputStream(getFileEntry(name)), WESTERN_EUROPE)); } catch(FileNotFoundException e) { throw new MagmaRuntimeException("Unable to read Health Canada Drug file: " + name, e); } } String[] normalize(String[] line) { for(int i = 0; i < line.length; i++) { line[i] = normalize(line[i]); } return line; } private String normalize(String str) { return str.trim().replaceAll("\\s{2,}", " "); } class HCDrugsValueSet implements ValueSet { private final VariableEntity entity; private HCDrugsValueSet(VariableEntity entity) { this.entity = entity; } Value getValue(Variable variable) { String sourceFile = variable.getAttributeStringValue("file"); int column = Integer.parseInt(variable.getAttributeStringValue("column")); String[] valueSet = getValueSet(sourceFile); if(valueSet == null) { return variable.isRepeatable() ? variable.getValueType().nullSequence() : variable.getValueType().nullValue(); } return variable.isRepeatable() ? getValueSequence(variable.getValueType(), valueSet[column]) : getValue(variable.getValueType(), valueSet[column]); } /** * Load the data in memory if not already done. * * @param sourceFile * @return */ private String[] getValueSet(String sourceFile) { Map<String, String[]> sourceValueSets = valueSets.get(sourceFile); try { if(sourceValueSets == null) { sourceValueSets = Maps.newHashMap(); valueSets.put(sourceFile, sourceValueSets); CSVReader reader = getEntryReader(sourceFile); String[] nextLine; while((nextLine = reader.readNext()) != null) { nextLine = normalize(nextLine); VariableEntity nextEntity = new VariableEntityBean(DRUG_ENTITY_TYPE, nextLine[0]); if(getVariableEntityProvider().getVariableEntities().contains(nextEntity)) { if(sourceValueSets.containsKey(nextLine[0])) { // merge lines sourceValueSets.put(nextLine[0], merge(sourceValueSets.get(nextLine[0]), nextLine)); } else { sourceValueSets.put(nextLine[0], nextLine); } } } reader.close(); } } catch(IOException e) { throw new MagmaRuntimeException("Unable to read source file: " + sourceFile, e); } return sourceValueSets.get(entity.getIdentifier()); } /** * Handle date format and deparse lines that were abusively merged. * * @param type * @param value * @return */ private Value getValue(ValueType type, String value) { if(value == null || value.isEmpty()) return type.nullValue(); if(type.equals(DateType.get())) { try { return DateType.get().valueOf(dateFormat.parse(value)); } catch(ParseException e) { e.printStackTrace(); return DateType.get().nullValue(); } } else { // case of abusive merging of lines if(value.indexOf('|') != -1) { String[] values = value.split("\\|"); if(values.length > 0) { return getValue(type, values[0]); } else { return type.nullValue(); } } return type.valueOf(value); } } /** * Deparse multiple values resulting from the merge. * * @param type * @param value * @return */ private Value getValueSequence(ValueType type, String value) { List<Value> values = new ArrayList<Value>(); for(String val : value.split("\\|")) { values.add(getValue(type, val)); } return type.sequenceOf(values); } /** * When there are multiple values, it is on multiple lines (therefore some data are abusively repeated). * * @param previousLine * @param nextLine * @return */ private String[] merge(String[] previousLine, String[] nextLine) { for(int i = 0; i < nextLine.length; i++) { previousLine[i] = previousLine[i] + "|" + nextLine[i]; } return previousLine; } @Override public ValueTable getValueTable() { return HCDrugsValueTable.this; } @Override public VariableEntity getVariableEntity() { return entity; } @Override public Timestamps getTimestamps() { return new Timestamps() { @Nonnull @Override public Value getLastUpdate() { Value updated = getValue(getVariable("LAST_UPDATE_DATE")); if (updated.isNull()) return HCDrugsValueTable.this.getTimestamps().getLastUpdate(); return updated; } @Nonnull @Override public Value getCreated() { Value created = getLastUpdate(); Value history = getValue(getVariable("HISTORY_DATE")); if (history.isNull()) return created; for (Value val : history.asSequence().getValues()) { if (((MagmaDate)val.getValue()).asDate().before(((MagmaDate)created.getValue()).asDate())) { created = val; } } return created; } }; } } }
93fd906c26e4c17dde3853ac0b752ce74e01c13e
3d59c03c2688224293c75b3b182703947ecb03d2
/PhotoAlbum91/src/controller/UserController.java
ea97e8b03e96a2cd238249982c11c40a74c3ae8c
[]
no_license
omarkhalil06/Software-Methodology
9c709591258608bda824a4dc8ff9e81047ba7c3b
9e1542d1561b50cf2292e0057aa03cda6b1c6ff1
refs/heads/master
2021-01-18T12:33:30.662356
2016-09-21T04:11:07
2016-09-21T04:11:07
68,773,879
0
0
null
null
null
null
UTF-8
Java
false
false
9,137
java
package controller; import java.io.IOException; import java.util.List; import java.util.Optional; import app.PhotoAlbum; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.Label; import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.control.Alert.AlertType; import javafx.stage.Stage; import javafx.util.Callback; import model.Album; import model.BackEnd; import model.ResourceManager; import model.User; /** * The UserController class controls what a user wants to do with their albums and photos. * * @author Omar Khalil * @author Michelle Hwang */ public class UserController { @FXML private Button logoutBtn; @FXML private Button addBtn; @FXML private Button deleteBtn; @FXML private Button editBtn; @FXML private Button searchBtn; @FXML private Button openBtn; @FXML private Button saveBtn; @FXML protected ListView<Album> albumList; @FXML private Label albumName; @FXML private Label numPhotos; @FXML private Label oldestPhotoDate; @FXML private Label dateRange; @FXML private Label welcome; BackEnd backend; private PhotoAlbum photoAlbum; private User user; /** * Highlights album if clicked on. */ @FXML private void initialize() { albumList.setCellFactory(new Callback<ListView<Album>, ListCell<Album>>() { @Override public ListCell<Album> call(ListView<Album> param) { ListCell<Album> cell = new ListCell<Album>() { protected void updateItem(Album t, boolean bool) { super.updateItem(t, bool); if (t != null) { setText(t.getAlbumName()); } else { setText(""); } } }; return cell; } }); albumList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> showDetails(newValue)); } /** * Sets information for each corresponding label. * * @param album */ private void showDetails(Album album) { if (album != null) { if (album.getNumPhotos() == 0) { albumName.setText(album.getAlbumName()); numPhotos.setText(album.getNumPhotos() + ""); oldestPhotoDate.setText("-"); dateRange.setText(""); } else { albumName.setText(album.getAlbumName()); numPhotos.setText(album.getNumPhotos() + ""); oldestPhotoDate.setText(album.getOldest()); dateRange.setText(album.getOldest() + " to " + album.getNewest()); } } else { albumName.setText(""); numPhotos.setText(""); oldestPhotoDate.setText(""); dateRange.setText(""); } } /** * Saves the file. * * @throws IOException */ @FXML protected void save() throws IOException { try { ResourceManager.writeUsers(this.photoAlbum.getBackend(), "userfile"); } catch (Exception e) { //System.out.println("Could not save file: " + e.getMessage()); } } /** * Logouts the user and window changes to login screen. * * @param event * @throws IOException */ @FXML protected void logout(ActionEvent event) throws IOException { //System.out.println("In UserController: logout"); ((Node) event.getSource()).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/view/LoginScreen.fxml")); loader.load(); Parent p = loader.getRoot(); LoginScreenController controller = loader.getController(); controller.setPhotoAlbum(this.photoAlbum); Stage stage = new Stage(); stage.setScene(new Scene(p)); stage.setTitle("Photo App"); stage.show(); } /** * Deletes the selected album. */ @FXML protected void delete() { //System.out.println("In UserController: delete"); int item = albumList.getSelectionModel().getSelectedIndex(); if (item >= 0) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Confirmation"); alert.setContentText("Click OK to delete this album."); Optional<ButtonType> click = alert.showAndWait(); if ((click.isPresent()) && (click.get() == ButtonType.OK)) { user.deleteAlbum(user.getAlbums().get(item)); albumList.getItems().remove(item); } } else { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Error"); alert.setHeaderText("No item selected"); alert.setContentText("Please select an album from the list to be deleted"); alert.showAndWait(); } } /** * Opens add album window. * * @param event * @throws IOException */ @FXML protected void add(ActionEvent event) throws IOException { //System.out.println("In UserController: add"); ((Node) event.getSource()).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/view/AddNewAlbumScreen.fxml")); loader.load(); Parent p = loader.getRoot(); AddNewAlbumController controller = loader.getController(); controller.setPhotoAlbum(this.photoAlbum); controller.setUser(user); Stage stage = new Stage(); stage.setScene(new Scene(p)); stage.setTitle("Add New Album"); stage.show(); } /** * Opens edit album window to rename album. * * @param event * @throws IOException */ @FXML protected void edit(ActionEvent event) throws IOException { //System.out.println("In UserController: edit"); int item = albumList.getSelectionModel().getSelectedIndex(); if (item >= 0) { ((Node) event.getSource()).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/view/EditAlbumScreen.fxml")); loader.load(); Parent p = loader.getRoot(); EditAlbumController controller = loader.getController(); controller.setPhotoAlbum(this.photoAlbum); controller.setUser(user); controller.setAlbum(user.getAlbums().get(item)); controller.setAlbumText(); Stage stage = new Stage(); stage.setScene(new Scene(p)); stage.setTitle("Edit Album"); stage.show(); } else { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Error"); alert.setHeaderText("No item selected"); alert.setContentText("Please select an album from the list to be edited"); alert.showAndWait(); } } /** * Opens album to view photos. * * @param event * @throws IOException */ @FXML protected void open(ActionEvent event) throws IOException { //System.out.println("In UserController: open"); int item = albumList.getSelectionModel().getSelectedIndex(); if (item >= 0) { ((Node) event.getSource()).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/view/AlbumScreen.fxml")); loader.load(); Parent p = loader.getRoot(); AlbumController controller = loader.getController(); controller.setPhotoAlbum(this.photoAlbum); controller.setUser(user); controller.setAlbum(user.getAlbums().get(item)); Stage stage = new Stage(); stage.setScene(new Scene(p)); controller.setPhotoList(); stage.setTitle("Album: " + user.getAlbums().get(item).getAlbumName()); stage.show(); } else { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Error"); alert.setHeaderText("No item selected"); alert.setContentText("Please select an album from the list to be edited"); alert.showAndWait(); } } /** * Opens search window. * * @param event * @throws IOException */ @FXML protected void search(ActionEvent event) throws IOException { //System.out.println("In UserController: search"); ((Node) event.getSource()).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/view/SearchScreen.fxml")); loader.load(); Parent p = loader.getRoot(); SearchController controller = loader.getController(); controller.setPhotoAlbum(this.photoAlbum); controller.setUser(this.user); Stage stage = new Stage(); stage.setScene(new Scene(p)); stage.setTitle("Search"); stage.show(); } /** * Sets album list on listview for the user to see. * * @param user */ public void setAlbumList(User user) { //System.out.println("In UserController: setAlbumList()"); List<Album> albums = user.getAlbums(); ObservableList<Album> list = FXCollections.observableArrayList(); for (Album a : albums) { //System.out.println(a); list.add(a); } albumList.setItems(list); albumList.getSelectionModel().select(0); } /** * Sets instance of PhotoAlbum. * * @param photoAlbum */ public void setPhotoAlbum(PhotoAlbum photoAlbum) { this.photoAlbum = photoAlbum; } /** * Sets value of user. * * @param user */ public void setUser(User user) { this.user = user; } /** * Sets value of welcome label. * * @param users */ public void setWelcome(User user) { welcome.setText("Welcome " + user.getUsername()); } }
155f41a8adb47adf1fa621e42a1e28aa969f85cf
4125e8bcfa6a94d5c6e131e9cd7f9731155980a1
/java/Legacy/NewestSolver/hardware_connect.java
2bc0446f973e61b8ef8eacb30e971b4565aec0a9
[ "MIT", "Apache-2.0" ]
permissive
pseudodennis/connect4ever
c80897f18730b97b35369bcec060929efc4b0636
7b5fa5ebcdc83e955157e6d0fd492e42ed95a1b3
refs/heads/master
2021-04-15T18:42:58.733099
2018-05-07T05:43:57
2018-05-07T05:43:57
126,410,471
4
4
Apache-2.0
2018-05-06T18:26:24
2018-03-23T00:24:22
Java
UTF-8
Java
false
false
3,966
java
//package Legacy.hardware_connect; import com.fazecast.jSerialComm.SerialPort; import java.io.PrintWriter; import java.util.Scanner; /** * @author nospa * */ public class hardware_connect { static SerialPort portSel; static PrintWriter output; /** * */ static Scanner inputNum ; public static boolean Connect() //connects to and selects the serial port { Scanner keyboard = new Scanner(System.in); boolean isConnected = false; String comInput; boolean errorExit = false; do { System.out.println("Please select a communication port."); SerialPort[] portNames = SerialPort.getCommPorts(); for(int i = 0; i < portNames.length; i++) System.out.println(portNames[i].getSystemPortName()); // attempt to connect to the serial port comInput = keyboard.nextLine(); portSel = SerialPort.getCommPort(comInput); portSel.setComPortTimeouts(SerialPort.TIMEOUT_SCANNER, 0, 0); if(portSel.openPort()) { isConnected = true; inputNum = new Scanner(portSel.getInputStream()); // create a new thread for sending data to the arduino Thread thread = new Thread(){ @Override public void run() { // wait after connecting, so the bootloader can finish try {Thread.sleep(100); } catch(Exception e) {} } }; thread.start(); output = new PrintWriter(portSel.getOutputStream()); } else { // disconnect from the serial port portSel.closePort(); isConnected = false; } if(isConnected == false && !comInput.equals("exit")) { System.out.println("Error not connected\n\rtry again\n\r"); } else if (comInput.equals("exit")) { System.out.println("exiting"); errorExit = true; } else { System.out.println("connected"); } }while(isConnected == false && !comInput.equals("exit")); return (errorExit); } public static void starter (boolean humanStart) { int numStart = 33; if (humanStart == true) { numStart = 77; } output.println(); output.flush(); try {Thread.sleep(100); } catch(Exception e) {} try { Thread.sleep(5678); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } output.print(numStart); output.flush(); try {Thread.sleep(100); } catch(Exception e) {} System.out.println(numStart); } public static void sendNum (int num) // send number data to the serial port { // enter an infinite loop that sends text to the arduino output.print(num); output.flush(); try {Thread.sleep(100); } catch(Exception e) {} } public static int getNum () // get number data from the serial port { int num = 0; do { num = 0; try{num = Integer.parseInt(inputNum.nextLine());} catch(Exception e){} }while(num == 0); return (num); } public static void DisConnect() // disconnect from the serial port { output.print(50); output.flush(); try {Thread.sleep(100); } catch(Exception e) {} int exitNum = 0; do{ try {Thread.sleep(1); } catch(Exception e) {} try{exitNum = Integer.parseInt(inputNum.nextLine());} catch(Exception e){} }while(exitNum != 99); System.out.println("arduino stopped"); portSel.closePort(); System.out.println("disconnected"); } }
de5922467ec6ce5c7d0c58f0d24c1e7ef7b9a949
adf23b832fdb8729950240a722e6a58491fbdf36
/metaModell/src/model/ToString$Visitor.java
d689a631177e4ec03d5feb38bbd4313339559196
[]
no_license
TwoStone/hfp412-meta-model
267ed336ffd4a527cd1619ed72a26a679380f352
bdf7b4d24a99bc773358033f479b3b3692f0a3c6
refs/heads/master
2016-08-12T10:39:40.441134
2015-10-20T12:04:51
2015-10-20T12:04:51
44,603,541
1
0
null
null
null
null
ISO-8859-1
Java
false
false
19,468
java
package model; import java.util.Iterator; import model.visitor.MBooleanVisitor; import persistence.Anything; import persistence.PersistenceException; import persistence.PersistentAccount; import persistence.PersistentAccountManager; import persistence.PersistentAccountTypeManager; import persistence.PersistentActualParameter; import persistence.PersistentAddition; import persistence.PersistentAspectManager; import persistence.PersistentAssociation; import persistence.PersistentAssociationManager; import persistence.PersistentAvgStrategy; import persistence.PersistentCompUnit; import persistence.PersistentCompUnitType; import persistence.PersistentCompoundQuantity; import persistence.PersistentConversion; import persistence.PersistentDivision; import persistence.PersistentEnumValueManager; import persistence.PersistentEnumerationManager; import persistence.PersistentFormalParameter; import persistence.PersistentFractionManager; import persistence.PersistentFractionWrapper; import persistence.PersistentFunction; import persistence.PersistentFunctionManager; import persistence.PersistentHierarchy; import persistence.PersistentLessOrEqualComparison; import persistence.PersistentLink; import persistence.PersistentLinkManager; import persistence.PersistentMAccountType; import persistence.PersistentMAspect; import persistence.PersistentMAtomicType; import persistence.PersistentMEmptyTypeConjunction; import persistence.PersistentMEmptyTypeDisjunction; import persistence.PersistentMEnum; import persistence.PersistentMEnumValue; import persistence.PersistentMFalse; import persistence.PersistentMMeasurementType; import persistence.PersistentMMixedConjunction; import persistence.PersistentMMixedTypeDisjunction; import persistence.PersistentMNonEmptyAtomicTypeConjunction; import persistence.PersistentMNonEmptyDisjunctiveNormalForm; import persistence.PersistentMObject; import persistence.PersistentMObservation; import persistence.PersistentMObservationType; import persistence.PersistentMSingletonObject; import persistence.PersistentMTrue; import persistence.PersistentMaxStrategy; import persistence.PersistentMeasurement; import persistence.PersistentMeasurementTypeManager; import persistence.PersistentMessage; import persistence.PersistentMessageManager; import persistence.PersistentMinStrategy; import persistence.PersistentMultiplication; import persistence.PersistentName; import persistence.PersistentNameInstance; import persistence.PersistentNameScheme; import persistence.PersistentNameSchemeInstance; import persistence.PersistentNameSchemeManager; import persistence.PersistentObjectManager; import persistence.PersistentObsTypeManager; import persistence.PersistentObservationManager; import persistence.PersistentOperation; import persistence.PersistentOperationManager; import persistence.PersistentQuantity; import persistence.PersistentQuantityManager; import persistence.PersistentReference; import persistence.PersistentReferenceType; import persistence.PersistentServer; import persistence.PersistentSubtraction; import persistence.PersistentSumStrategy; import persistence.PersistentTypeManager; import persistence.PersistentUnit; import persistence.PersistentUnitType; import persistence.PersistentUnitTypeManager; import utils.Strings; import common.Fraction; import constants.TextConstants; public class ToString$Visitor extends model.visitor.ToString$Visitor { private static final boolean DEBUG_MODE_ON = true; private static final String DEBUG_PREFIX_NULL = "[null] "; private static final String APPENDIX_OF_PROXIES = "Proxi"; private String result; public ToString$Visitor() { } public synchronized String toString(final Anything anything) throws PersistenceException { result = null; anything.accept(this); if (result == null) { this.standardHandling(anything); } if (DEBUG_MODE_ON) { result = this.formatClassNameForDebug(anything) + result; } return result; } /** * Formatiert den Klassennamen des übergebenen Objekts für die Debug-Ausgabe. * * @param anything * Das zu formatierende Objekt * @return Für Debug-Ausgabe formatierter Klassenname */ private String formatClassNameForDebug(final Object anything) { if (anything == null) { return DEBUG_PREFIX_NULL; } String className = anything.getClass().getSimpleName(); if (className == null) { return DEBUG_PREFIX_NULL; } if (className.contains("Manager")) { return ""; } if (className.endsWith(APPENDIX_OF_PROXIES)) { className = className.substring(0, className.length() - APPENDIX_OF_PROXIES.length()); } return "[" + className + "] "; } @Override protected void standardHandling(final Anything anything) { result = anything.getClassId() + ";" + anything.getId(); } @Override public void handleMAtomicType(final PersistentMAtomicType mAtomicType) throws PersistenceException { result = mAtomicType.fetchName(); } @Override public void handleTypeManager(final PersistentTypeManager typeManager) throws PersistenceException { result = "Liste der Typen"; } @Override public void handleAspectManager(final PersistentAspectManager aspectManager) throws PersistenceException { result = "Liste der Aspekte"; } @Override public void handleMAspect(final PersistentMAspect mAspect) throws PersistenceException { result = mAspect.getName(); } @Override public void handleMFalse(final PersistentMFalse mFalse) throws PersistenceException { result = "false"; } @Override public void handleMTrue(final PersistentMTrue mTrue) throws PersistenceException { result = "true"; } @Override public void handleAssociationManager(final PersistentAssociationManager associationManager) throws PersistenceException { result = "Liste der Assoziationen"; } @Override public void handleHierarchy(final PersistentHierarchy hierarchy) throws PersistenceException { result = hierarchy.getName(); } @Override public void handleAssociation(final PersistentAssociation association) throws PersistenceException { result = association.getName() + " (" + association.getSource().fetchName() + ")"; } @Override public void handleQuantity(final PersistentQuantity quantity) throws PersistenceException { result = quantity.getAmount() + TextConstants.SPACE + quantity.getUnit().getName(); } @Override public void handleCompoundQuantity(final PersistentCompoundQuantity compoundQuantity) throws PersistenceException { String currentResult = TextConstants.CURLY_BRACKET_OPEN; final Iterator<PersistentQuantity> i = compoundQuantity.getParts().iterator(); while (i.hasNext()) { final PersistentQuantity q = i.next(); if (!i.hasNext()) { currentResult = currentResult + q.toString() + TextConstants.CURLY_BRACKET_CLOSED; } else { currentResult = currentResult + TextConstants.SPACE + q.toString() + TextConstants.SEMICOLON; } } result = currentResult; } @Override public void handleReferenceType(final PersistentReferenceType referenceType) throws PersistenceException { this.result = referenceType.getRef() + "^" + referenceType.getExponent(); } @Override public void handleQuantityManager(final PersistentQuantityManager quantityManager) throws PersistenceException { this.result = constants.TextConstants.LABEL_QUANTITY_MANAGER; } @Override public void handleUnitType(final PersistentUnitType unitType) throws PersistenceException { this.result = unitType.getName(); } @Override public void handleUnit(final PersistentUnit unit) throws PersistenceException { this.result = unit.getName() + " (" + unit.getType().getName() + ")"; } @Override public void handleServer(final PersistentServer server) throws PersistenceException { // TODO Auto-generated method stub } @Override public void handleReference(final PersistentReference reference) throws PersistenceException { this.result = reference.getRef() + "^" + reference.getExponent(); } @Override public void handleConversion(final PersistentConversion conversion) throws PersistenceException { final PersistentUnit defaultUnit = ((PersistentUnitType) conversion.getSource().getType()).getDefaultUnit(); if (defaultUnit == null) return; final Fraction m = conversion.getMyFunction().getFactor(); final Fraction b = conversion.getMyFunction().getConstant(); if (b.equals(Fraction.Null)) { this.result = "1 " + defaultUnit.getName() + " = " + m + " " + conversion.getSource().getName(); } else { this.result = "y " + defaultUnit.getName() + " = (" + m + "*x + " + b + ") " + conversion.getSource().getName(); } } @Override public void handleCompUnit(final PersistentCompUnit compUnit) throws PersistenceException { this.result = compUnit.getName() + " (" + compUnit.getType().getName() + ")"; } @Override public void handleCompUnitType(final PersistentCompUnitType compUnitType) throws PersistenceException { this.result = compUnitType.getName(); } @Override public void handleUnitTypeManager(final PersistentUnitTypeManager unitTypeManager) throws PersistenceException { this.result = constants.TextConstants.LABEL_UNIT_TYPE_MANAGER; } @Override public void handleFractionManager(final PersistentFractionManager fractionManager) throws PersistenceException { this.result = constants.TextConstants.LABEL_FRACTION_MANAGER; } @Override public void handleFunction(final PersistentFunction function) throws PersistenceException { this.result = "y = " + function.getFactor() + " * x + " + function.getConstant(); } @Override public void handleMAccountType(final PersistentMAccountType mAccountType) throws PersistenceException { this.result = mAccountType.getName(); } @Override public void handleMeasurement(final PersistentMeasurement measurement) throws PersistenceException { this.result = measurement.getQuantity().toString(); } @Override public void handleOperation(final PersistentOperation operation) throws PersistenceException { final StringBuilder parameterListe = new StringBuilder(); final Iterator<PersistentFormalParameter> iterator = operation.getParameters().iterator(); PersistentFormalParameter current = null; int count = 0; while (iterator.hasNext()) { if (count == 0) { parameterListe.append(", "); } current = iterator.next(); parameterListe.append(current.getName() + " : " + current.getOfType().toString()); count++; } result = operation.getName() + "(" + parameterListe.toString() + ") : " + operation.getTarget().toString(); } @Override public void handleAccount(final PersistentAccount account) throws PersistenceException { this.result = account.getName(); } @Override public void handleMMeasurementType(final PersistentMMeasurementType mMeasurementType) throws PersistenceException { this.result = mMeasurementType.getName(); } @Override public void handleFormalParameter(final PersistentFormalParameter formalParameter) throws PersistenceException { this.result = formalParameter.getName(); } @Override public void handleMessage(final PersistentMessage message) throws PersistenceException { final PersistentMessage internalMessage = message; message.getType().isStatic().accept(new MBooleanVisitor() { @Override public void handleMTrue(final PersistentMTrue mTrue) throws PersistenceException { result = ""; } @Override public void handleMFalse(final PersistentMFalse mFalse) throws PersistenceException { result = internalMessage.getSource().toString(); } }); result += "#" + message.getTarget().toString() + " " + message.getType().toString() + "("; final Iterator<PersistentActualParameter> it = message.getActualParameters().iterator(); // Sonderbehandlung fuer den Ersten if (it.hasNext()) { result += it.next(); } while (it.hasNext()) { result += ", " + it.next().toString(); } result += ")"; } @Override public void handleActualParameter(final PersistentActualParameter actualParameter) throws PersistenceException { this.result = actualParameter.getType().toString() + "=" + actualParameter.getValue().toString(); } @Override public void handleLink(final PersistentLink link) throws PersistenceException { this.result = link.getSource().toString() + "." + link.getType().getName() + ">>" + link.getTarget().toString(); } @Override public void handleMeasurementTypeManager(final PersistentMeasurementTypeManager measurementTypeManager) throws PersistenceException { this.result = constants.TextConstants.LABEL_MEASUREMENT_TYPE_MANAGER; } @Override public void handleAccountTypeManager(final PersistentAccountTypeManager accountTypeManager) throws PersistenceException { this.result = constants.TextConstants.LABEL_ACCOUNT_TYPE_MANAGER; } @Override public void handleAccountManager(final PersistentAccountManager accountManager) throws PersistenceException { this.result = constants.TextConstants.LABEL_ACCOUNT_MANAGER; } @Override public void handleMessageManager(final PersistentMessageManager messageManager) throws PersistenceException { this.result = "Liste der Nachrichten"; } @Override public void handleOperationManager(final PersistentOperationManager operationManager) throws PersistenceException { this.result = "Liste der Operationen"; } @Override public void handleLinkManager(final PersistentLinkManager linkManager) throws PersistenceException { this.result = "Liste der Links"; } @Override public void handleMObject(final PersistentMObject mObject) throws PersistenceException { result = String.valueOf(mObject.getId()); result += Strings.join(", ", mObject.getNames().iterator(), new Strings.ToStringStrategy<PersistentNameInstance>() { @Override public String getString(final PersistentNameInstance element) throws PersistenceException { return element.toString(true); } }); } @Override public void handleObjectManager(final PersistentObjectManager objectManager) throws PersistenceException { this.result = "Liste der Objekte"; } @Override public void handleNameSchemeInstance(final PersistentNameSchemeInstance nameSchemeInstance) throws PersistenceException { this.result = nameSchemeInstance.getName(); } @Override public void handleNameScheme(final PersistentNameScheme nameScheme) throws PersistenceException { this.result = nameScheme.getName(); } @Override public void handleNameInstance(final PersistentNameInstance nameInstance) throws PersistenceException { this.result = nameInstance.getNameScheme().getName() + "(" + nameInstance.getNameScheme().getType().getName() + ")"; } @Override public void handleNameSchemeManager(final PersistentNameSchemeManager nameSchemeManager) throws PersistenceException { this.result = "Liste der Namensschemata"; } @Override public void handleName(final PersistentName name) throws PersistenceException { this.result = name.getFromType().getName() + "->" + name.getNameScheme().getName(); } @Override public void handleFunctionManager(final PersistentFunctionManager functionManager) throws PersistenceException { // } @Override public void handleFractionWrapper(final PersistentFractionWrapper fractionWrapper) throws PersistenceException { this.result = fractionWrapper.getFraction().toString(); } @Override public void handleMSingletonObject(final PersistentMSingletonObject mSingletonObject) throws PersistenceException { this.result = " of " + mSingletonObject.getType().getName(); } @Override public void handleMinStrategy(final PersistentMinStrategy minStrategy) throws PersistenceException { this.result = "Minimum-Aggregations-Strategie"; } @Override public void handleAvgStrategy(final PersistentAvgStrategy avgStrategy) throws PersistenceException { this.result = "Arithmetisches-Mittel-Aggregations-Strategie"; } @Override public void handleSumStrategy(final PersistentSumStrategy sumStrategy) throws PersistenceException { this.result = "Summen-Aggregations-Strategie"; } @Override public void handleMaxStrategy(final PersistentMaxStrategy maxStrategy) throws PersistenceException { this.result = "Maximum-Aggregations-Strategie"; } @Override public void handleMEmptyTypeDisjunction(final PersistentMEmptyTypeDisjunction mEmptyTypeDisjunction) throws PersistenceException { result = mEmptyTypeDisjunction.fetchName(); } @Override public void handleMMixedConjunction(final PersistentMMixedConjunction mMixedConjunction) throws PersistenceException { result = mMixedConjunction.fetchName(); } @Override public void handleMEmptyTypeConjunction(final PersistentMEmptyTypeConjunction mEmptyTypeConjunction) throws PersistenceException { result = mEmptyTypeConjunction.fetchName(); } @Override public void handleMMixedTypeDisjunction(final PersistentMMixedTypeDisjunction mMixedTypeDisjunction) throws PersistenceException { result = mMixedTypeDisjunction.fetchName(); } @Override public void handleMNonEmptyAtomicTypeConjunction(final PersistentMNonEmptyAtomicTypeConjunction mNonEmptyAtomicTypeConjunction) throws PersistenceException { result = mNonEmptyAtomicTypeConjunction.fetchName(); } @Override public void handleMNonEmptyDisjunctiveNormalForm(final PersistentMNonEmptyDisjunctiveNormalForm mNonEmptyDisjunctiveNormalForm) throws PersistenceException { result = mNonEmptyDisjunctiveNormalForm.fetchName(); } @Override public void handleMultiplication(final PersistentMultiplication multiplication) throws PersistenceException { // TODO Auto-generated method stub } @Override public void handleSubtraction(final PersistentSubtraction subtraction) throws PersistenceException { // TODO Auto-generated method stub } @Override public void handleAddition(final PersistentAddition addition) throws PersistenceException { // TODO Auto-generated method stub } @Override public void handleDivision(final PersistentDivision division) throws PersistenceException { // TODO Auto-generated method stub } @Override public void handleMEnum(final PersistentMEnum mEnum) throws PersistenceException { result = mEnum.getName(); } @Override public void handleMObservationType(final PersistentMObservationType mObservationType) throws PersistenceException { result = mObservationType.getName(); } @Override public void handleMObservation(final PersistentMObservation mObservation) throws PersistenceException { result = mObservation.getName(); } @Override public void handleObservationManager(final PersistentObservationManager observationManager) throws PersistenceException { result = "Liste der Observationen"; } @Override public void handleMEnumValue(final PersistentMEnumValue mEnumValue) throws PersistenceException { result = mEnumValue.getName(); } @Override public void handleEnumerationManager(final PersistentEnumerationManager enumerationManager) throws PersistenceException { result = "Liste der Enumerationen"; } @Override public void handleEnumValueManager(final PersistentEnumValueManager enumValueManager) throws PersistenceException { result = "Liste der Enum-Werte"; } @Override public void handleObsTypeManager(final PersistentObsTypeManager obsTypeManager) throws PersistenceException { result = "Liste der Observationstypen"; } @Override public void handleLessOrEqualComparison(final PersistentLessOrEqualComparison lessOrEqualComparison) throws PersistenceException { // TODO Auto-generated method stub } }
4169d0014a06125526c45c38a15899b8c4ab1f80
d1587ff23f80b268719195cf094e69cf16707ad4
/hr-user/src/main/java/com/brazil/hruser/exceptions/BadRequestException.java
51e906c9e12ab59649d37ab9f58551c9d360bc8c
[]
no_license
eduardomingoranca/ms-human-resources-spring
6e09a26fba8e3ebb7bd846badfd62b1c3dee4dc4
b13dd2bf444584cce9ba1e9141032037b1b51f5d
refs/heads/main
2023-08-28T00:01:01.513303
2021-09-18T13:05:09
2021-09-18T13:05:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.brazil.hruser.exceptions; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.BAD_REQUEST) public class BadRequestException extends RuntimeException { public BadRequestException(String message) { super(message); } }
871d60ed2074fe208e933f51fea37e7ff61352c8
fe6ecbf29b0130662ae415d3b66af97af7094a70
/Code/Work/FF/Decomp/C_100472_akr.java
abc9b1393c1687fb7d97d9895742f17792dd2aa3
[]
no_license
joshuacoles/MineCraft-Patch-On-Launch-Client-old
272db752d5bc94b02bb14c012276c92047b0b0c4
28055c66ecf3d3236155521e988acc3b7f0b08e6
refs/heads/master
2016-09-05T21:03:36.361801
2012-11-17T07:42:26
2012-11-17T07:42:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,627
java
import java.util.Random; public class C_100472_akr extends C_100200_aiq { protected C_100472_akr(int var1) { super(var1, C_100664_afg.field_109027_q); this.field_106165_cl = 104; this.func_106008_a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); } public int func_106013_d() { return -1; } public boolean func_105994_c() { return false; } public boolean func_105977_b() { return false; } public void func_106007_a(C_100837_xo var1, int var2, int var3, int var4) { int var5 = var1.func_109357_g(var2, var3, var4) & 7; switch(var5) { case 1: default: this.func_106008_a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); break; case 2: this.func_106008_a(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F); break; case 3: this.func_106008_a(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F); break; case 4: this.func_106008_a(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F); break; case 5: this.func_106008_a(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F); } } public C_100412_amr func_106021_e(C_100873_xe var1, int var2, int var3, int var4) { this.func_106007_a(var1, var2, var3, var4); return super.func_106021_e(var1, var2, var3, var4); } public void func_106047_a(C_100873_xe var1, int var2, int var3, int var4, C_100595_ln var5) { int var6 = C_100650_jv.func_108910_c((double)(var5.field_103236_z * 4.0F / 360.0F) + 2.5D) & 3; var1.func_109488_c(var2, var3, var4, var6); } public C_100398_amm func_106326_a(C_100873_xe var1) { return new C_100415_amk(); } public int func_105979_a(C_100873_xe var1, int var2, int var3, int var4) { return C_100992_tt.field_110951_bQ.field_110891_cf; } public int func_106019_h(C_100873_xe var1, int var2, int var3, int var4) { C_100398_amm var5 = var1.func_109353_p(var2, var3, var4); return var5 != null && var5 instanceof C_100415_amk?((C_100415_amk)var5).func_102965_a():super.func_106019_h(var1, var2, var3, var4); } public int func_106004_b(int var1) { return var1; } public void func_105998_a(C_100873_xe var1, int var2, int var3, int var4, int var5, float var6, int var7) {} public void func_106060_a(C_100873_xe var1, int var2, int var3, int var4, int var5, C_101095_qg var6) { if(var6.field_103869_cf.field_111597_d) { var5 |= 8; var1.func_109488_c(var2, var3, var4, var5); } super.func_106060_a(var1, var2, var3, var4, var5, var6); } public void func_106041_a(C_100873_xe var1, int var2, int var3, int var4, int var5, int var6) { if(!var1.field_109557_J) { if((var6 & 8) == 0) { this.func_106042_a(var1, var2, var3, var4, new C_100994_tv(C_100992_tt.field_110951_bQ.field_110891_cf, 1, this.func_106019_h(var1, var2, var3, var4))); } super.func_106041_a(var1, var2, var3, var4, var5, var6); } } public int func_106043_a(int var1, Random var2, int var3) { return C_100992_tt.field_110951_bQ.field_110891_cf; } public void func_106348_a(C_100873_xe var1, int var2, int var3, int var4, C_100415_amk var5) { if(var5.func_102965_a() == 1 && var3 >= 2) { int var6 = C_100451_alf.field_106141_bf.field_106162_cm; int var7; C_100579_pa var8; int var9; for(var7 = -2; var7 <= 0; ++var7) { if(var1.func_109349_a(var2, var3 - 1, var4 + var7) == var6 && var1.func_109349_a(var2, var3 - 1, var4 + var7 + 1) == var6 && var1.func_109349_a(var2, var3 - 2, var4 + var7 + 1) == var6 && var1.func_109349_a(var2, var3 - 1, var4 + var7 + 2) == var6 && this.func_106349_d(var1, var2, var3, var4 + var7, 1) && this.func_106349_d(var1, var2, var3, var4 + var7 + 1, 1) && this.func_106349_d(var1, var2, var3, var4 + var7 + 2, 1)) { var1.func_109441_d(var2, var3, var4 + var7, 8); var1.func_109441_d(var2, var3, var4 + var7 + 1, 8); var1.func_109441_d(var2, var3, var4 + var7 + 2, 8); var1.func_109378_b(var2, var3, var4 + var7, 0); var1.func_109378_b(var2, var3, var4 + var7 + 1, 0); var1.func_109378_b(var2, var3, var4 + var7 + 2, 0); var1.func_109378_b(var2, var3 - 1, var4 + var7, 0); var1.func_109378_b(var2, var3 - 1, var4 + var7 + 1, 0); var1.func_109378_b(var2, var3 - 1, var4 + var7 + 2, 0); var1.func_109378_b(var2, var3 - 2, var4 + var7 + 1, 0); if(!var1.field_109557_J) { var8 = new C_100579_pa(var1); var8.func_103055_b((double)var2 + 0.5D, (double)var3 - 1.45D, (double)(var4 + var7) + 1.5D, 90.0F, 0.0F); var8.field_103469_aw = 90.0F; var8.func_103697_m(); var1.func_109513_d(var8); } for(var9 = 0; var9 < 120; ++var9) { var1.func_109428_a("snowballpoof", (double)var2 + var1.field_109577_u.nextDouble(), (double)(var3 - 2) + var1.field_109577_u.nextDouble() * 3.9D, (double)(var4 + var7 + 1) + var1.field_109577_u.nextDouble(), 0.0D, 0.0D, 0.0D); } var1.func_109409_f(var2, var3, var4 + var7, 0); var1.func_109409_f(var2, var3, var4 + var7 + 1, 0); var1.func_109409_f(var2, var3, var4 + var7 + 2, 0); var1.func_109409_f(var2, var3 - 1, var4 + var7, 0); var1.func_109409_f(var2, var3 - 1, var4 + var7 + 1, 0); var1.func_109409_f(var2, var3 - 1, var4 + var7 + 2, 0); var1.func_109409_f(var2, var3 - 2, var4 + var7 + 1, 0); return; } } for(var7 = -2; var7 <= 0; ++var7) { if(var1.func_109349_a(var2 + var7, var3 - 1, var4) == var6 && var1.func_109349_a(var2 + var7 + 1, var3 - 1, var4) == var6 && var1.func_109349_a(var2 + var7 + 1, var3 - 2, var4) == var6 && var1.func_109349_a(var2 + var7 + 2, var3 - 1, var4) == var6 && this.func_106349_d(var1, var2 + var7, var3, var4, 1) && this.func_106349_d(var1, var2 + var7 + 1, var3, var4, 1) && this.func_106349_d(var1, var2 + var7 + 2, var3, var4, 1)) { var1.func_109441_d(var2 + var7, var3, var4, 8); var1.func_109441_d(var2 + var7 + 1, var3, var4, 8); var1.func_109441_d(var2 + var7 + 2, var3, var4, 8); var1.func_109378_b(var2 + var7, var3, var4, 0); var1.func_109378_b(var2 + var7 + 1, var3, var4, 0); var1.func_109378_b(var2 + var7 + 2, var3, var4, 0); var1.func_109378_b(var2 + var7, var3 - 1, var4, 0); var1.func_109378_b(var2 + var7 + 1, var3 - 1, var4, 0); var1.func_109378_b(var2 + var7 + 2, var3 - 1, var4, 0); var1.func_109378_b(var2 + var7 + 1, var3 - 2, var4, 0); if(!var1.field_109557_J) { var8 = new C_100579_pa(var1); var8.func_103055_b((double)(var2 + var7) + 1.5D, (double)var3 - 1.45D, (double)var4 + 0.5D, 0.0F, 0.0F); var8.func_103697_m(); var1.func_109513_d(var8); } for(var9 = 0; var9 < 120; ++var9) { var1.func_109428_a("snowballpoof", (double)(var2 + var7 + 1) + var1.field_109577_u.nextDouble(), (double)(var3 - 2) + var1.field_109577_u.nextDouble() * 3.9D, (double)var4 + var1.field_109577_u.nextDouble(), 0.0D, 0.0D, 0.0D); } var1.func_109409_f(var2 + var7, var3, var4, 0); var1.func_109409_f(var2 + var7 + 1, var3, var4, 0); var1.func_109409_f(var2 + var7 + 2, var3, var4, 0); var1.func_109409_f(var2 + var7, var3 - 1, var4, 0); var1.func_109409_f(var2 + var7 + 1, var3 - 1, var4, 0); var1.func_109409_f(var2 + var7 + 2, var3 - 1, var4, 0); var1.func_109409_f(var2 + var7 + 1, var3 - 2, var4, 0); return; } } } } private boolean func_106349_d(C_100873_xe var1, int var2, int var3, int var4, int var5) { if(var1.func_109349_a(var2, var3, var4) != this.field_106162_cm) { return false; } else { C_100398_amm var6 = var1.func_109353_p(var2, var3, var4); return var6 != null && var6 instanceof C_100415_amk?((C_100415_amk)var6).func_102965_a() == var5:false; } } }
f2c69ea255914348c257f3fc464f2c7a4a7c9629
cc637e2f7ad19ceb7e23390c4fb2a04e2141aa5d
/acore/src/main/java/com/yl/core/utils/ImageManager.java
83ba51dd8933e97bfd9853ee76004e47f9ab32cb
[]
no_license
Redoteam/MVPEasyArms
a246890fc7e33d3868283c491e091029e1e8d723
89026d295ae1d486bf81800a43e79b185f6d87b6
refs/heads/master
2020-04-09T22:17:17.066717
2018-12-07T03:57:20
2018-12-07T03:57:20
160,624,426
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package com.yl.core.utils; import android.content.Context; import android.widget.ImageView; import com.yl.core.R; import com.yl.core.delegate.AppDelegate; import com.yl.core.factory.SingletonImageLoader; import com.yl.core.http.imageloader.ImageConfig; import com.yl.core.http.imageloader.ImageLoader; /** * Created by 寻水的鱼 on 2018/8/13. */ public class ImageManager { /** * 加载图片 * * @param context * @param config * @param <T> */ public static <T extends ImageConfig> void loadImage(Context context, T config) { ImageLoader imageLoader = SingletonImageLoader.getInstance().getImageLoader(); imageLoader.loadImage(context, config); } /** * 停止加载或清理缓存 * * @param context * @param config * @param <T> */ public static <T extends ImageConfig> void clear(Context context, T config) { ImageLoader imageLoader = SingletonImageLoader.getInstance().getImageLoader(); imageLoader.clear(context, config); } }
60e17a0bb464b2c0d3de252f16cc8752fe71ce26
5fb2edd24da3042e3def986666735412dabf6c40
/Android/SecChat/app/src/main/java/net/i2p/client/streaming/impl/SchedulerPreconnect.java
3f4855b96a20f696d3501a4af477cb12cbdb9398
[ "MIT" ]
permissive
RazuvaevDD/I2PSecChat
5b2796bd10f93d213bde90edf1c8d76d55881dbf
d26894c7849dadade8cc59c3ff390e20896f8dc5
refs/heads/release
2023-03-09T12:07:44.387095
2021-02-21T15:07:53
2021-02-21T15:07:53
315,027,754
1
6
MIT
2021-02-22T08:51:58
2020-11-22T12:04:56
Java
UTF-8
Java
false
false
1,646
java
package net.i2p.client.streaming.impl; import net.i2p.I2PAppContext; import net.i2p.util.Log; /** * <p>Scheduler used for locally created connections where we have not yet * sent the initial SYN packet.</p> * * <h2>Entry conditions:</h2><ul> * <li>Locally created</li> * <li>No packets sent or received</li> * </ul> * * <h2>Events:</h2><ul> * <li>Message flush (explicitly, through a full buffer, or stream closure)</li> * <li>Initial delay timeout (causing implicit flush of any data available)</li> * </ul> * * <h2>Next states:</h2> * <li>{@link SchedulerConnecting connecting} - after sending a packet</li> * </ul> */ class SchedulerPreconnect extends SchedulerImpl { public SchedulerPreconnect(I2PAppContext ctx) { super(ctx); } public boolean accept(Connection con) { return (con != null) && (con.getSendStreamId() <= 0) && (con.getLastSendId() < 0); } public void eventOccurred(Connection con) { if (con.getNextSendTime() < 0) con.setNextSendTime(_context.clock().now() + con.getOptions().getConnectDelay()); long timeTillSend = con.getNextSendTime() - _context.clock().now(); if (timeTillSend <= 0) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Send available for the SYN on " + con); con.sendAvailable(); con.setNextSendTime(-1); } else { if (_log.shouldLog(Log.DEBUG)) _log.debug("Wait " + timeTillSend + " before sending the SYN on " + con); reschedule(timeTillSend, con); } } }
78413e49964574f31ad4077dabbfd81297995b72
22f580c6ab811ce7d093a3668b4ff1b08dc72d04
/CucumberTest/src/test/java/CucumberTest/CucumberTest/Test1.java
5726a25995f4edc92732003c6b2367abf0df74ca
[]
no_license
snehasishdu/MyWork
34ed0558cd12c55b038f88df5ed373c7be9d6e13
5ffa5017146dae9fe9886a5979b12ff4c1bb968f
refs/heads/master
2021-01-19T15:55:43.072840
2018-01-16T04:56:57
2018-01-16T04:56:57
100,981,040
0
0
null
2018-01-18T05:27:11
2017-08-21T18:31:12
HTML
UTF-8
Java
false
false
294
java
package CucumberTest.CucumberTest; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.Test; public class Test1 { @Test public void method1() { System.out.println("Hello World !!"); } }
81bd256604cfdc0ca60f2d9b893e587145f2aae9
1328303f5adc79c093e97788b198faff347c8069
/springannotation/src/test/java/com/ntuzy/test/IOTest_Property.java
c047f7ce4fd502a0affa06e305c8d26f26e00116
[]
no_license
IamZY/Spring
850bebaf851b34fac5dc5e38039894aee0a9ec69
0254ae7361e997f6bf3deef281cd9c464b0cb073
refs/heads/master
2022-12-12T12:20:42.520179
2020-07-15T03:50:59
2020-07-15T03:50:59
241,874,223
1
0
null
2022-12-09T01:14:46
2020-02-20T12:06:48
Java
UTF-8
Java
false
false
721
java
package com.ntuzy.test; import com.ntuzy.bean.Car; import com.ntuzy.bean.Person; import com.ntuzy.config.MainConfigOfLifeCycle; import com.ntuzy.config.MainConfig_Pro; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; /** * @Author IamZY * @create 2020/2/20 20:43 */ public class IOTest_Property { @Test public void test() { AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(MainConfig_Pro.class); Person person = (Person) annotationConfigApplicationContext.getBean("person"); System.out.println(person); annotationConfigApplicationContext.close(); } }