blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ca15bf1dbef76faa1fe0f270b0604f97c5ae7a51 | 231e014fda02c84e1dd71c0ab382e023c8aa7f6d | /src/test/java/lightsearch/server/entity/ClientCommandResultLoginTestNG.java | 45efc1cd02d9ff5f829142199ef5512969d9d90b | [
"Apache-2.0"
] | permissive | ViiSE/LightSearch-Server | 61cedf4087a1da8a21ea12b6ad4ba1dea74fde74 | 58d70fee49e9dfdcba2b8f2632ac5472807a710d | refs/heads/master | 2022-01-29T02:19:04.606522 | 2020-10-23T07:15:29 | 2020-10-23T07:15:38 | 244,263,772 | 0 | 0 | Apache-2.0 | 2022-01-21T23:38:48 | 2020-03-02T02:38:17 | Java | UTF-8 | Java | false | false | 2,116 | java | /*
* Copyright 2020 ViiSE.
*
* 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 lightsearch.server.entity;
import lightsearch.server.data.ClientCommandResultDTO;
import lightsearch.server.data.ClientLoginCommandResultDTO;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import test.TestUtils;
import java.io.IOException;
import java.util.ArrayList;
import static test.message.TestMessage.*;
public class ClientCommandResultLoginTestNG {
private ClientCommandResult commandResult;
@BeforeClass
public void setUpClass() {
ClientCommandResultDTO resDTO = new ClientCommandResultDTO();
resDTO.setIsDone(String.valueOf(true));
resDTO.setMessage("Login");
resDTO.setSkladList(new ArrayList<>());
resDTO.setTKList(new ArrayList<>());
resDTO.setToken("token");
resDTO.setUserIdentifier("ident");
commandResult = new ClientCommandResultLoginImpl(
new ClientCommandResultFromDatabaseImpl(resDTO),
"Some hash IMEI");
testBegin(ClientCommandResultLoginImpl.class);
}
@Test
public void formForSend() throws IOException {
testMethod("formForSend()");
ClientLoginCommandResultDTO cmdResDTO = (ClientLoginCommandResultDTO) commandResult.formForSend();
System.out.println(TestUtils.objectMapperWithJavaTimeModule().writeValueAsString(cmdResDTO));
}
@AfterClass
public void teardownClass() {
testEnd(ClientCommandResultLoginImpl.class);
}
}
| [
"viise@outlook.com"
] | viise@outlook.com |
d4994c4b116498b51d6660f11e3cf0ca00725c4e | 7ecbb3719565a487154f2d048ef2f8ef11ff7f0d | /metatools/src/main/java/com/metaui/tools/socket/transport/ITransportEvent.java | 58f2a285b719c61abc40811e170911c7e3d73a8a | [
"Apache-2.0"
] | permissive | weijiancai/metaui | 5bbe91f2e4c176b6ae48bc598d8531d076ef086d | b3daecf2b6ef5599c1e8fa92632d40bfee0936e0 | refs/heads/master | 2022-09-15T08:47:13.977905 | 2020-09-26T03:29:08 | 2020-09-26T03:29:08 | 30,705,651 | 0 | 2 | Apache-2.0 | 2022-09-01T22:41:37 | 2015-02-12T14:18:25 | JavaScript | UTF-8 | Java | false | false | 173 | java | package com.metaui.tools.socket.transport;
/**
* @author wei_jc
* @since 1.0.0
*/
public interface ITransportEvent {
void onTransport(ISocketTransport transport);
}
| [
"weijiancai@126.com"
] | weijiancai@126.com |
2d0409b3612b77dfd6bd79ba52ee10a8e58cfd68 | 32caf193318063db2e21ab7fa8fab1eb3fccd6eb | /usbSerialExamples/src/main/java/com/hoho/android/usbserial/examples/SerialConsoleActivity.java | 4a07cb911362703ef43cbb0d3d5211cf1229f65e | [] | no_license | willis-hu/UsbSerialExamples | 88352e55366089eb05177cee8bc149123579887c | f8b2242da83e96e438358c27f349f237c43cc8ba | refs/heads/master | 2021-07-24T09:19:48.335017 | 2017-11-03T02:35:19 | 2017-11-03T02:35:20 | 109,235,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,250 | java | /* Copyright 2011 Google Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* Project home page: http://code.google.com/p/usb-serial-for-android/
*/
package com.hoho.android.usbserial.examples;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ScrollView;
import android.widget.TextView;
import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.util.HexDump;
import com.hoho.android.usbserial.util.SerialInputOutputManager;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Monitors a single {@link UsbSerialDriver} instance, showing all data
* received.
*
* @author mike wakerly (opensource@hoho.com)
*/
public class SerialConsoleActivity extends Activity {
private final String TAG = SerialConsoleActivity.class.getSimpleName();
/**
* Driver instance, passed in statically via
* {@link #show(Context, UsbSerialDriver)}.
*
* <p/>
* This is a devious hack; it'd be cleaner to re-create the driver using
* arguments passed in with the {@link #startActivity(Intent)} intent. We
* can get away with it because both activities will run in the same
* process, and this is a simple demo.
*/
private static UsbSerialDriver sDriver = null;
private TextView mTitleTextView;
private TextView mDumpTextView;
private ScrollView mScrollView;
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private SerialInputOutputManager mSerialIoManager;
private final SerialInputOutputManager.Listener mListener =
new SerialInputOutputManager.Listener() {
@Override
public void onRunError(Exception e) {
Log.d(TAG, "Runner stopped.");
}
@Override
public void onNewData(final byte[] data) {
SerialConsoleActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
SerialConsoleActivity.this.updateReceivedData(data);
}
});
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.serial_console);
mTitleTextView = (TextView) findViewById(R.id.demoTitle);
mDumpTextView = (TextView) findViewById(R.id.consoleText);
mScrollView = (ScrollView) findViewById(R.id.demoScroller);
}
@Override
protected void onPause() {
super.onPause();
stopIoManager();
if (sDriver != null) {
try {
sDriver.close();
} catch (IOException e) {
// Ignore.
}
sDriver = null;
}
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
stopIoManager();
if (sDriver != null) {
try {
sDriver.close();
} catch (IOException e) {
// Ignore.
}
sDriver = null;
}
finish();
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "Resumed, sDriver=" + sDriver);
if (sDriver == null) {
mTitleTextView.setText("No serial device.");
} else {
try {
sDriver.open();
// 原本为115200,现在改成9600
sDriver.setParameters(9600, 8, UsbSerialDriver.STOPBITS_1, UsbSerialDriver.PARITY_NONE);
} catch (IOException e) {
Log.e(TAG, "Error setting up device: " + e.getMessage(), e);
mTitleTextView.setText("Error opening device: " + e.getMessage());
try {
sDriver.close();
} catch (IOException e2) {
// Ignore.
}
sDriver = null;
return;
}
mTitleTextView.setText("Serial device: " + sDriver.getClass().getSimpleName());
}
onDeviceStateChange();
}
private void stopIoManager() {
if (mSerialIoManager != null) {
Log.i(TAG, "Stopping io manager ..");
mSerialIoManager.stop();
mSerialIoManager = null;
}
}
private void startIoManager() {
if (sDriver != null) {
Log.i(TAG, "Starting io manager ..");
mSerialIoManager = new SerialInputOutputManager(sDriver, mListener);
mExecutor.submit(mSerialIoManager);
}
}
private void onDeviceStateChange() {
stopIoManager();
startIoManager();
}
private void updateReceivedData(byte[] data) {
final String message = "Read " + data.length + " bytes: \n"
+ HexDump.dumpHexString(data) + "\n\n";
mDumpTextView.append(message);
mScrollView.smoothScrollTo(0, mDumpTextView.getBottom());
}
/**
* Starts the activity, using the supplied driver instance.
*
* @param context
* @param driver
*/
static void show(Context context, UsbSerialDriver driver) {
sDriver = driver;
final Intent intent = new Intent(context, SerialConsoleActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY);
context.startActivity(intent);
}
}
| [
"qigenhu_jun@163.com"
] | qigenhu_jun@163.com |
ce48557057441754259485d824bde9877a49c97a | 2602fee0bca1a29914afb84945509b299b53d045 | /app/src/main/java/com/yhxl/microsoft/myapplication/SearchDocumentActivity.java | b872ce79524339866d608702464feb981c4664a7 | [] | no_license | njusoftwarear/openCV-HwSDK | fe95c84af5bdc46c175c0083eaba687db6b939ee | 48f1fc9d769c4d81937748754838b11150a40dfd | refs/heads/master | 2020-04-25T22:18:55.979951 | 2019-02-28T12:30:16 | 2019-02-28T12:30:16 | 173,107,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 701 | java | package com.yhxl.microsoft.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
//查找说明书页面:
//上方有一个搜索框、有一个“扫一扫”图标
//下面是一个按字母顺序的说明书列表
//搜索框是搜下方的说明书的
//扫一扫是扫物体上的二维码
//说明书对应着服务器上的物体点云数据等,找到目标说明书后,跳转到DisplayDocumentActivity
public class SearchDocumentActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_document);
}
}
| [
"171250015@smail.nju.edu.cn"
] | 171250015@smail.nju.edu.cn |
0936ea56a485747cdac36dfddbf85c8721bb07cc | baf6924bca2bd4626f43eedb1bd53738f6228404 | /kausthub/src/main/java/com/example/kausthub/myapplication/ForecastFragment.java | 3f12b7809879805205778b6f4a66cad8138b4ab4 | [] | no_license | kausthub/sunshine_app | 459d017cc15e55d42f361b6dd53b893cacd2d84b | 0d5535c3c68e9b279fd6083bb840c85dfa02b532 | refs/heads/master | 2020-06-03T20:10:49.625647 | 2015-02-03T15:51:04 | 2015-02-03T15:51:04 | 30,250,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,476 | java | package com.example.kausthub.myapplication;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
/**
* Created by kausthub on 12/1/15.
*/
public class ForecastFragment extends Fragment {
private ArrayAdapter<String> mForecastAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
public ForecastFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
ArrayList<String> data = new ArrayList<String>();
mForecastAdapter = new ArrayAdapter<String>(getActivity(), R.layout.listview_main, R.id.list_item_forecast_textview, data);
ListView list = (ListView) rootView.findViewById(R.id.listview_forecast);
list.setAdapter(mForecastAdapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long l) {
String forecast = mForecastAdapter.getItem(position);
Intent intent = new Intent(getActivity(),DetailedActivity.class).putExtra(Intent.EXTRA_TEXT,forecast);
startActivity(intent);
}
});
return rootView;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Inflate the menu; this adds items to the action bar if it is present.
inflater.inflate(R.menu.forecastfragment, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
int id = item.getItemId();
if(id == R.id.action_refresh) {
updateweather();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onStart() {
super.onStart();
updateweather();
}
private void updateweather() {
FetchWeatherTask weatherTask = new FetchWeatherTask();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
String location = prefs.getString(getString(R.string.pref_location_key),getString(R.string.pref_location_default));
weatherTask.execute(location);
}
private static final String TAG = "myApp";
public class FetchWeatherTask extends AsyncTask<String, Void, String[]> {
private final String LOG_TAG= FetchWeatherTask.class.getSimpleName();
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
/* The date/time conversion code is going to be moved outside the asynctask later,
* so for convenience we're breaking it out into its own method now.
*/
private String getReadableDateString(long time){
// Because the API returns a unix timestamp (measured in seconds),
// it must be converted to milliseconds in order to be converted to valid date.
Date date = new Date(time * 1000);
SimpleDateFormat format = new SimpleDateFormat("E, MMM d");
return format.format(date).toString();
}
/**
* Prepare the weather high/lows for presentation.
*/
private String formatHighLows(double high, double low) {
// For presentation, assume the user doesn't care about tenths of a degree.
SharedPreferences sharedpref = PreferenceManager.getDefaultSharedPreferences(getActivity());
String units = sharedpref.getString(getString(R.string.pref_units_key),getString(R.string.pref_units_metric));
if(units.equals(getString(R.string.pref_units_imperial)))
{
high = (high*1.8) + 32;
low = ( low *1.8) + 32 ;
}
else if(! units.equals(getString(R.string.pref_units_metric)))
{
Log.d(LOG_TAG,"unit not defined" + units);
}
long roundedHigh = Math.round(high);
long roundedLow = Math.round(low);
String highLowStr = roundedHigh + "/" + roundedLow;
return highLowStr;
}
/**
* Take the String representing the complete forecast in JSON Format and
* pull out the data we need to construct the Strings needed for the wireframes.
*
* Fortunately parsing is easy: constructor takes the JSON string and converts it
* into an Object hierarchy for us.
*/
private String[] getWeatherDataFromJson(String forecastJsonStr, int numDays)
throws JSONException {
// These are the names of the JSON objects that need to be extracted.
final String OWM_LIST = "list";
final String OWM_WEATHER = "weather";
final String OWM_TEMPERATURE = "temp";
final String OWM_MAX = "max";
final String OWM_MIN = "min";
final String OWM_DATETIME = "dt";
final String OWM_DESCRIPTION = "main";
JSONObject forecastJson = new JSONObject(forecastJsonStr);
JSONArray weatherArray = forecastJson.getJSONArray(OWM_LIST);
String[] resultStrs = new String[numDays];
for(int i = 0; i < weatherArray.length(); i++) {
// For now, using the format "Day, description, hi/low"
String day;
String description;
String highAndLow;
// Get the JSON object representing the day
JSONObject dayForecast = weatherArray.getJSONObject(i);
// The date/time is returned as a long. We need to convert that
// into something human-readable, since most people won't read "1400356800" as
// "this saturday".
long dateTime = dayForecast.getLong(OWM_DATETIME);
day = getReadableDateString(dateTime);
// description is in a child array called "weather", which is 1 element long.
JSONObject weatherObject = dayForecast.getJSONArray(OWM_WEATHER).getJSONObject(0);
description = weatherObject.getString(OWM_DESCRIPTION);
// Temperatures are in a child object called "temp". Try not to name variables
// "temp" when working with temperature. It confuses everybody.
JSONObject temperatureObject = dayForecast.getJSONObject(OWM_TEMPERATURE);
double high = temperatureObject.getDouble(OWM_MAX);
double low = temperatureObject.getDouble(OWM_MIN);
highAndLow = formatHighLows(high, low);
resultStrs[i] = day + " - " + description + " - " + highAndLow;
}
return resultStrs;
}
public FetchWeatherTask() {
super();
}
@Override
protected String[] doInBackground(String... params){
if(params.length==0)
{
return null;
}
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
String format="json";
String units="metric";
int numDays=7;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
// Possible parameters are available at OWM's forecast API page, at
// http://openweathermap.org/API#forecast
final String forcast_base_url =("http://api.openweathermap.org/data/2.5/forecast/daily?");
final String query_param="q";
final String format_param="mode";
final String units_param="units";
final String days_param="cnt";
Uri builturi = Uri.parse(forcast_base_url).buildUpon().appendQueryParameter(query_param,params[0]).appendQueryParameter(format_param,format).appendQueryParameter(units_param,units).appendQueryParameter(days_param,Integer.toString(numDays)).build();
URL url = new URL(builturi.toString());
Log.v(LOG_TAG,builturi.toString());
// Create the request to OpenWeatherMap, and open the connection
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
// Read the input stream into a String
InputStream inputStream = urlConnection.getInputStream();
StringBuffer buffer = new StringBuffer();
if (inputStream == null) {
// Nothing to do.
forecastJsonStr = null;
}
reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
// Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
// But it does make debugging a *lot* easier if you print out the completed
// buffer for debugging.
buffer.append(line + "\n");
}
if (buffer.length() == 0) {
// Stream was empty. No point in parsing.
forecastJsonStr = null;
}
forecastJsonStr = buffer.toString();
} catch (
IOException e
)
{
Log.e("PlaceholderFragment", "Error ", e);
// If the code didn't successfully get the weather data, there's no point in attempting
// to parse it.
forecastJsonStr = null;
} finally
{
if (urlConnection != null) {
urlConnection.disconnect();
}
if (reader != null) {
try {
reader.close();
} catch (final IOException e) {
Log.e("PlaceholderFragment", "Error closing stream", e);
}
}
}
try
{ String[] a = new String[15];
return getWeatherDataFromJson(forecastJsonStr,numDays);
} catch (JSONException e) {
Log.e(LOG_TAG,e.getMessage(),e);
}
return null;
}
@Override
protected void onPostExecute(String[] strings) {
super.onPostExecute(strings);
mForecastAdapter.clear();
for (String dayForecastStr : strings) {
mForecastAdapter.addAll(dayForecastStr);
}
}
}
} | [
"kausthubnaarayan@gmail.com"
] | kausthubnaarayan@gmail.com |
19264c7ad02b14a6e42f22de3c0ab16137543760 | 85f8e97141b38490361a23d29891171331dcce6d | /src/main/java/com/wwflgames/fury/gamestate/battle/MobLocationAction.java | 4f19d332a4c5e630d7c3f5a08586ed7c5843ec68 | [] | no_license | davidaayers/fury-roguelike | 3e9e7f37304a0d569ded2a7f382713e4244b3cc3 | eeced04fba2462a51c1fed134e80dacbd38ce853 | refs/heads/master | 2022-12-17T20:00:51.476336 | 2021-02-09T16:40:44 | 2021-02-09T16:40:44 | 32,492,279 | 0 | 0 | null | 2022-12-05T23:24:16 | 2015-03-19T00:39:15 | Java | UTF-8 | Java | false | false | 1,506 | java | package com.wwflgames.fury.gamestate.battle;
import com.wwflgames.fury.map.Tile;
import com.wwflgames.fury.mob.Mob;
import com.wwflgames.slick.entity.Action;
import org.newdawn.slick.geom.Vector2f;
import static com.wwflgames.fury.Fury.*;
public class MobLocationAction extends Action {
private Mob mob;
private int mapOffsetX;
private int mapOffsetY;
private int screenOffsetX;
private int screenOffsetY;
public MobLocationAction(String id) {
super(id);
}
public MobLocationAction setMob(Mob mob) {
this.mob = mob;
return this;
}
public MobLocationAction setMapOffset(int mapOffsetX, int mapOffsetY) {
this.mapOffsetX = mapOffsetX;
this.mapOffsetY = mapOffsetY;
return this;
}
public MobLocationAction setScreenOffset(int screenOffsetX, int screenOffsetY) {
this.screenOffsetX = screenOffsetX;
this.screenOffsetY = screenOffsetY;
return this;
}
@Override
public void update(int delta) {
// based on the mob's location, set the owning entity's position
Tile mobTile = mob.getCurrentMapTile();
int drawX = mobTile.getX() - mapOffsetX;
int drawY = mobTile.getY() - mapOffsetY;
float screenX = screenOffsetX + (drawX * TILE_WIDTH * owner.getScale()) + (4 * owner.getScale());
float screenY = screenOffsetY + (drawY * TILE_HEIGHT * owner.getScale());
owner.setPosition(new Vector2f(screenX, screenY));
}
}
| [
"davidaayers@97dceabf-fe26-07c5-5aee-662261703212"
] | davidaayers@97dceabf-fe26-07c5-5aee-662261703212 |
0d2d926562c7452bfab3e6ba7d369fdf3cc29a01 | 45e5b8e4d43925525e60fe3bc93dc43a04962c4a | /nodding/libs/GlassVoice/com/google/glass/util/IntentSender.java | 6d79f1ed21d29d83d60e8aa4ea0c1916290b1e0d | [
"BSD-3-Clause"
] | permissive | ramonwirsch/glass_snippets | 1818ba22b4c11cdb8a91714e00921028751dd405 | 2495edec63efc051e3a10bf5ed8089811200e9ad | refs/heads/master | 2020-04-08T09:37:22.980415 | 2014-06-24T12:07:53 | 2014-06-24T12:07:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,087 | java | package com.google.glass.util;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import com.google.glass.build.BuildHelper;
import com.google.glass.predicates.Assert;
public abstract class IntentSender
{
private static IntentSender instance = null;
public static IntentSender getInstance()
{
if (instance == null)
instance = new DefaultIntentSender();
return instance;
}
public static void setInstance(IntentSender paramIntentSender)
{
Assert.isTest();
Assert.assertNotNull(paramIntentSender);
instance = paramIntentSender;
}
public abstract void sendOrderedBroadcast(Context paramContext, Intent paramIntent, String paramString1, BroadcastReceiver paramBroadcastReceiver, Handler paramHandler, int paramInt, String paramString2, Bundle paramBundle);
public abstract void sendOrderedBroadcastAsUser(Context paramContext, Intent paramIntent, UserHandle paramUserHandle, String paramString1, BroadcastReceiver paramBroadcastReceiver, Handler paramHandler, int paramInt, String paramString2, Bundle paramBundle);
public abstract void startActivity(Context paramContext, Intent paramIntent);
public abstract ComponentName startService(Context paramContext, Intent paramIntent);
public abstract boolean stopService(Context paramContext, Intent paramIntent);
public static class DefaultIntentSender extends IntentSender
{
public void sendOrderedBroadcast(Context paramContext, Intent paramIntent, String paramString1, BroadcastReceiver paramBroadcastReceiver, Handler paramHandler, int paramInt, String paramString2, Bundle paramBundle)
{
paramContext.sendOrderedBroadcast(paramIntent, paramString1, paramBroadcastReceiver, paramHandler, paramInt, paramString2, paramBundle);
}
@SuppressLint({"NewApi"})
public void sendOrderedBroadcastAsUser(Context paramContext, Intent paramIntent, UserHandle paramUserHandle, String paramString1, BroadcastReceiver paramBroadcastReceiver, Handler paramHandler, int paramInt, String paramString2, Bundle paramBundle)
{
Assert.assertTrue(BuildHelper.isJellyBean());
paramContext.sendOrderedBroadcastAsUser(paramIntent, paramUserHandle, paramString1, paramBroadcastReceiver, paramHandler, paramInt, paramString2, paramBundle);
}
public void startActivity(Context paramContext, Intent paramIntent)
{
paramContext.startActivity(paramIntent);
}
public ComponentName startService(Context paramContext, Intent paramIntent)
{
return paramContext.startService(paramIntent);
}
public boolean stopService(Context paramContext, Intent paramIntent)
{
return paramContext.stopService(paramIntent);
}
}
}
/* Location: /home/phil/workspace/glass_hello_world/libs/GlassVoice-dex2jar.jar
* Qualified Name: com.google.glass.util.IntentSender
* JD-Core Version: 0.6.2
*/ | [
"scholl@ess.tu-darmstadt.de"
] | scholl@ess.tu-darmstadt.de |
fbe3d439ee9ae708fe10d6c8c60a297347a2618c | 5f03a28417af718405c1cae4b2301a21eb9cad24 | /algorithms/greedy/mark-and-toys/Solution.java | 4a15372a4dfa04d5113f6927c6bd63a17004df86 | [] | no_license | chrisdmc/hackerrank-java | fda7d16b5ecaa80150e9879dcc7617176fb5d91e | 3a067037083c008c0e2f2d6c5e4a3967d8fdc6df | refs/heads/master | 2021-05-11T20:59:06.751348 | 2018-01-29T02:58:28 | 2018-01-29T02:58:28 | 117,454,229 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,249 | java | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
static int maximumToys(int[] prices, int k) {
int totalSpend = 0, numToys = 0;
int[] spent = new int[prices.length];
for (int price: prices) {
if (price <= k) {
if (k - totalSpend >= price) {
spent[spent.length - numToys - 1] = price;
numToys++;
totalSpend += price;
Arrays.sort(spent);
} else if (spent[spent.length-1] > price) {
totalSpend -= spent[spent.length-1] - price;
spent[spent.length-1] = price;
Arrays.sort(spent);
}
}
}
return numToys;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] prices = new int[n];
for(int prices_i = 0; prices_i < n; prices_i++){
prices[prices_i] = in.nextInt();
}
int result = maximumToys(prices, k);
System.out.println(result);
in.close();
}
}
| [
"cmcknigh@uwaterloo.ca"
] | cmcknigh@uwaterloo.ca |
d5c4b0ee77a99f453e3d807e634a372c045e8a4c | d4d3cf3f135b2915d822702744fc6726e2245cec | /src/cards/ShadowCardView.java | 213cf4ff9ffaa18b3c8388737259c4a26fad3f76 | [] | no_license | VijayEluri/Fractions-Card-Game | 8f012ca96cfb31c12215253208e29f3c50b7faf8 | 46d49bad9ad2d3dc93837e0ecc5ec8a80b84e4ea | refs/heads/master | 2020-05-20T11:11:04.761365 | 2017-03-28T19:57:26 | 2017-03-28T19:57:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,205 | java | package cards;
/*
* File:LayeredCardView.java
* ------------------
* This is my first attempt to try to decompose or break down the images so that we can display images one
* on top of the other.
* Thus each card we hope will have three sections, a background,
* a midground which is broken up into two parts
* and then a foreground.
* These will follow our early attempts at creating something where the components are separated.
*/
import javax.imageio.ImageIO;
import javax.swing.*;
import basic.Constants;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class ShadowCardView extends CardView{
private BufferedImage backGround;
public static final int SHADOW_DEN_X = 5;
public static final int SHADOW_DEN_Y = 3; //was 10
public static final int SHADOW_NUM_Y = 2; //was 7
public ShadowCardView(Card c){
this(c, true);
}
public ShadowCardView(Card c, int width, int height, boolean isShowin) {
super(c, width, height, isShowin);
setSize(new Dimension(width, height));
}
public ShadowCardView(Card c, boolean visible) {
this(c, Constants.MAX_CARD_WIDTH, Constants.MAX_CARD_HEIGHT, visible);
}
public ShadowCardView(Card c, int width, int height) {
this(c, width, height, true);
}
public void drawCard(Graphics g) {
drawCard(g, getX(), getY(), true);
}
public void drawCard(Graphics g, int x, int y, boolean useScaledImage) {
if(visible) {
if(useScaledImage) {
drawCardComponents(g, xScale, yScale, x, y, true);
drawCardText(g, Constants.FONT_SMALL, x, y, SHADOW_DEN_X, SHADOW_DEN_Y, SHADOW_NUM_Y, getWidth(), getHeight());
if(highlighted) {
//drawThickRectangle(Math.abs(getWidth()/2-scaledImg.getWidth(null)/2), Math.abs(getHeight()/2-.getHeight(null)/2), Math.min(b.getWidth(null)-1, getWidth()-1), Math.min(b.getHeight(null)-1, getHeight()-1), 4, g);
drawThickRectangle(x, y, (int) getSize().getWidth(), (int) getSize().getHeight(), 4, Color.red, g);
}
}else{
drawCardComponents(g, 0, 0, x, y, false);
drawCardText(g, Constants.FONT_REG, x, y, SHADOW_DEN_X+1, SHADOW_DEN_Y, SHADOW_NUM_Y, Constants.ORIG_CARD_WIDTH, Constants.ORIG_CARD_HEIGHT);
}
if(Constants.DEBUG_MODE) {
g.drawString(""+index, getX() + (int) getSize().getWidth()/2, getY() + (int) getSize().getHeight()/2);
}
}
}
public void drawBigCard(Graphics g, int panelWidth, int panelHeight) {
int xCoord = panelWidth-Constants.HUGE_CARD_WIDTH;
int yCoord = panelHeight-Constants.HUGE_CARD_HEIGHT;
g.drawImage(backGround, xCoord, yCoord, Constants.HUGE_CARD_WIDTH, Constants.HUGE_CARD_HEIGHT, null);
drawCardComponents(g, Constants.HUGE_CARD_WIDTH, Constants.HUGE_CARD_HEIGHT, xCoord, yCoord, true);
drawCardText(g, Constants.FONT_LARGE, xCoord, yCoord, SHADOW_DEN_X+1, SHADOW_DEN_Y, SHADOW_NUM_Y, Constants.HUGE_CARD_WIDTH, Constants.HUGE_CARD_HEIGHT);
}
private void drawCardComponents(Graphics g, int width, int height, int xCoord, int yCoord, boolean scaleImg) {
if(!scaleImg) {
width = getWidth();
height = getHeight();
}
drawImages(g, xCoord, yCoord, width, height);
}
private void drawCardText(Graphics g, Font f, int xCoord, int yCoord, int denX, int denY, int numY, int width, int height) {
String s = extractShadowText();
Font origFont = g.getFont();
FontMetrics fm;
double sWidth;
while(true) {
g.setFont(f);
fm = g.getFontMetrics();
sWidth = fm.stringWidth(s);
if(sWidth < (width * .75)) {
break;
}
f = f.deriveFont(f.getSize2D()-1);
}
//g.drawString(s, (int) (xCoord + (double) (width/denX)), (int) (yCoord + ((double) height/denY)*numY));
g.drawString(s, (int) (xCoord + (width/2-sWidth/2)), (int) (yCoord + ((double) height/denY)*numY));
g.setFont(origFont);
}
private String extractShadowText() {
String question = card.getDescription();
int qIndex = question.indexOf("?");
int sIndex = indexOfFirstNumber(question);
return question.substring(sIndex, qIndex);
}
private int indexOfFirstNumber(String s) {
for(int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if(Character.isDigit(ch)) {
return i;
}
}
return -1;
}
}
| [
"ojimenez@stanford.edu"
] | ojimenez@stanford.edu |
1a4afbff1905a0a49676df1ecc707d544a369ceb | 9f262284abcd2f31d8987f3137cd023b28be5de6 | /app/src/main/java/ua/r4mstein/moviedbdemo/modules/lists/rated_movies/RatedMoviesFragment.java | 6a1a6587d5066988798990b04f171edc3a884250 | [] | no_license | r4mstein/MovieDBDemo | 4531f571d96e40e24195bdd52c83f3c7f553e917 | f15e84f745d381078cd1be3a17cb6bd6d983bb63 | refs/heads/master | 2020-04-05T14:02:49.644089 | 2017-07-04T11:22:36 | 2017-07-04T11:22:36 | 94,750,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,204 | java | package ua.r4mstein.moviedbdemo.modules.lists.rated_movies;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import java.util.List;
import ua.r4mstein.moviedbdemo.R;
import ua.r4mstein.moviedbdemo.data.models.response.Movie;
import ua.r4mstein.moviedbdemo.modules.base.BaseFragment;
import ua.r4mstein.moviedbdemo.modules.films.by_genre.MoviesByGenreAdapter;
import ua.r4mstein.moviedbdemo.modules.films.by_genre.MoviesClickListener;
import ua.r4mstein.moviedbdemo.utills.EndlessScrollListener;
import static ua.r4mstein.moviedbdemo.modules.films.by_genre.MoviesByGenreFragment.DELETE_RATING;
import static ua.r4mstein.moviedbdemo.modules.films.by_genre.MoviesByGenreFragment.FAVORITE_WATCHLIST;
import static ua.r4mstein.moviedbdemo.modules.films.by_genre.MoviesByGenreFragment.SET_RATING;
public class RatedMoviesFragment extends BaseFragment<RatedMoviesPresenter>
implements RatedMoviesPresenter.RatedMoviesView {
private RecyclerView mRecyclerView;
private MoviesByGenreAdapter adapter;
@Override
protected int getTitle() {
return R.string.title_rated_movies;
}
@Override
protected int getLayoutResource() {
return R.layout.fragment_rated_movies;
}
@Override
protected RatedMoviesPresenter initPresenter() {
return new RatedMoviesPresenter();
}
@Override
protected void findUI(View rootView) {
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.rv_FRM);
}
@Override
protected void setupUI() {
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(layoutManager);
adapter = new MoviesByGenreAdapter(getViewContext());
adapter.setMoviesClickListener(getMoviesClickListener());
mRecyclerView.setAdapter(adapter);
mRecyclerView.addOnScrollListener(new EndlessScrollListener(layoutManager,
() -> {
getPresenter().getNextPage();
return true;
}));
}
@NonNull
private MoviesClickListener getMoviesClickListener() {
return new MoviesClickListener() {
@Override
public void moviesItemClicked(long movieId) {
getPresenter().goToDetailScreen(movieId);
}
@Override
public void moviesItemLongClicked(long movieId, int position) {
getPresenter().getMovieAccountState(movieId, FAVORITE_WATCHLIST);
}
@Override
public void ratingViewClicked(long movieId, float oldRating) {
getPresenter().getMovieAccountState(movieId, SET_RATING);
}
@Override
public void ratingViewLongClicked(long movieId) {
getPresenter().getMovieAccountState(movieId, DELETE_RATING);
}
};
}
@Override
public void setList(List<Movie> list) {
adapter.setData(list);
}
@Override
public void addList(List<Movie> list) {
adapter.addData(list);
}
}
| [
"r4mstein@ukr.net"
] | r4mstein@ukr.net |
eb86b7d91f801246c2807164afee678111804a1d | 4ddf0ffa5bd088f2971c5dbf82a6f9ac9765bf8e | /201909_leetcode/src/intersection_of_two_linked_lists/Demo.java | c1339e69c925bce61cc6a464c5ef7fa73eada280 | [] | no_license | YuanlingGl/leetcode | ac59df07bf47f784f73dc45878c38878bb68751a | c902fa8cb44ec66144923dee6f0fa0514fce59cb | refs/heads/master | 2021-06-26T17:01:02.706904 | 2021-02-05T09:57:24 | 2021-02-05T09:57:24 | 209,990,551 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package intersection_of_two_linked_lists;
import java.util.Map;
/**
* @program: 201909_leetcode
* @description:
* @author: dd
* @created: 2019/09/28 21:27
*/
public class Demo {
}
class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
}
class Solution {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
ListNode ha = headA, hb = headB;
while (ha != hb) {
ha = ha != null ? ha.next : headB;
hb = hb != null ? hb.next : headA;
}
return ha;
}
}
| [
"32081227+YuanlingGl@users.noreply.github.com"
] | 32081227+YuanlingGl@users.noreply.github.com |
ad0003a4bd2e50e7249fb3a454d525911f8bddcc | c8bf1a6add4887dc35dd683149b7ac2284cf0955 | /week-04/day-2/The Garden Application/src/Flower.java | 3fe1425a9fd49ab94ffb24975bfc001abdffc894 | [] | no_license | green-fox-academy/csipan | e74065681da37aa22128704b9e7f90373627fae3 | babffd8ddf9d4dfaa18c9dbf817c79b240f4be9c | refs/heads/master | 2020-03-25T02:19:54.420074 | 2018-10-11T13:16:46 | 2018-10-11T13:16:46 | 143,284,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | public class Flower extends Plant {
public Flower(String color) {
super(color);
absorb = 7.5;
waterNeed = 5;
}
}
| [
"csipan_mihalyalbert@yahoo.com"
] | csipan_mihalyalbert@yahoo.com |
6ff1b385ae66729e2621ae627ff6e0317c41d8a7 | 26da0aea2ab0a2266bbee962d94a96d98a770e5f | /nam/nam-data/src/main/java/nam/bean/WorkspaceManager.java | e0dda4226e3915830d20bd8a239e2ff166dbb934 | [
"Apache-2.0"
] | permissive | tfisher1226/ARIES | 1de2bc076cf83488703cf18f7e3f6e3c5ef1b40b | 814e3a4b4b48396bcd6d082e78f6519679ccaa01 | refs/heads/master | 2021-01-10T02:28:07.807313 | 2015-12-10T20:30:00 | 2015-12-10T20:30:00 | 44,076,313 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | package nam.bean;
import java.util.List;
import nam.model.Workspace;
public interface WorkspaceManager {
public void initialize();
public void clearContext();
public List<Workspace> getAllWorkspaceRecords();
public Workspace getWorkspaceRecordById(Long id);
public Workspace getWorkspaceRecordByName(String name);
public List<Workspace> getWorkspaceRecordsByUser(String user);
public List<Workspace> getWorkspaceRecordsByPage(int pageIndex, int pageSize);
public Long addWorkspaceRecord(Workspace workspace);
public void saveWorkspaceRecord(Workspace workspace);
public void removeAllWorkspaceRecords();
public void removeWorkspaceRecord(Workspace workspace);
public void removeWorkspaceRecord(Long id);
public void importWorkspaceRecords();
}
| [
"tfisher@kattare.com"
] | tfisher@kattare.com |
4775d4b2d37b18a000ce9669946dcac217c1c43d | c7740b3a4d037325bd6587dbaeddc3acb2be3e53 | /SCCMS/src/main/java/com/changh/sccms/action/release/YoueclassAction.java | aca06f4fa37103cee173879172fe3e24f1b98e6d | [] | no_license | jeasonyoung/wangxiao | 4d3bd9db6be05163471377a93011c1c578bbb78b | 0dde04d3edc263ad096fc6c01cfd0bd29b4ebf2c | refs/heads/master | 2021-01-23T22:30:45.585438 | 2015-03-26T01:22:21 | 2015-03-26T01:22:21 | 32,705,895 | 0 | 0 | null | 2015-03-24T03:25:23 | 2015-03-23T02:02:54 | Java | UTF-8 | Java | false | false | 3,625 | java | package com.changh.sccms.action.release;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.changh.sccms.action.BaseAction;
import com.changh.sccms.entity.ExamCategory;
import com.changh.sccms.entity.News;
import com.changh.sccms.service.ExamCategoryService;
import com.changh.sccms.service.NewsService;
import com.changh.sccms.until.FreeMarkerUtil;
import com.changh.sccms.until.PropertiesUtil;
public class YoueclassAction extends BaseAction{
private boolean ok =false;
private String rootPath = "";
public String getRootPath() {
return PropertiesUtil.getOptValue("rootPath");
}
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
private NewsService newsService;
private ExamCategoryService examCategoryService;
public void setExamCategoryService(ExamCategoryService examCategoryService) {
this.examCategoryService = examCategoryService;
}
public String doRelease() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
//教务公告
root.put("news", getNewsByCategory(1067,10));
//报考指南
root.put("baok", getNewsByCategory(1068,9));
//建筑工程
root.put("jzgc", newsService.findAll(1001,0, 1, 8, "addTime", "desc"));
//其他建筑工程子类
List<ExamCategory> children = examCategoryService.findByPro("examPid", 1001);
for(ExamCategory child:children){
System.out.println(child.getExamEname());
root.put(child.getExamEname(), newsService.findAll(child.getExamId(),0, 1, 8, "addTime", "desc"));
}
root.put("examList", examCategoryService.findByPro("examPid", 0));
boolean flag = FreeMarkerUtil.getInstance().genHtmlFile(httpRequest,this.getRootPath(),"/youeclass/index.ftl", root, "", "index.html");
ok=flag;
return "success";
}
public List<News> getNewsByCategory(int categoryId,int pagesize){
List<News> list = new ArrayList<News>();
HashMap<String,Object> map =new HashMap<String,Object>();
map.put("newclass.id", categoryId);
list = newsService.findListNews(1,pagesize,"addTime","desc",map);
return list;
}
public void setNewsService(NewsService newsService) {
this.newsService = newsService;
}
public String releaseClass(){
List<ExamCategory> list = examCategoryService.findByPro("examPid", 0);
for(ExamCategory ec:list){
Map<String, Object> root = new HashMap<String, Object>();
List<ExamCategory> children = examCategoryService.findByPro("examPid", ec.getExamId());
root.put("examList",children);
root.put("exam", ec);
FreeMarkerUtil.getInstance().genHtmlFile(httpRequest,this.getRootPath(),"/youeclass/category.ftl", root, ec.getExamEname(), "index.html");
for(ExamCategory child:children){
Map<String, Object> root1 = new HashMap<String, Object>();
root1.put("exam", child);
List<ExamCategory> subList = examCategoryService.findByPro("examPid", child.getExamId());
root1.put("examList", subList);
FreeMarkerUtil.getInstance().genHtmlFile(httpRequest,this.getRootPath(),"/youeclass/category-small.ftl", root1,ec.getExamEname()+"/"+child.getExamEname(), "index.html");
}
}
return "success";
}
//发布资讯,按考试类别 暂时前台不分省份
public String releaseNews(int examId) throws Exception{
ExamCategory exam = examCategoryService.examLoad(examId);
//如果该考试类别下面包含子类
if(exam.getExamChildrenNum()!=0){
List<ExamCategory> children = exam.getChildren();
}else{
}
return "success";
}
public boolean isOk() {
return ok;
}
public void setOk(boolean ok) {
this.ok = ok;
}
}
| [
"fw121fw4@163.com"
] | fw121fw4@163.com |
ef74c17498d7de63a643c6839c564d166a83674b | 228df8bef953c2658330650512fa3a60f71310f0 | /rpc/rpc/HelloWorldServiceImpl.java | 186edb50947312c27bd6ffe6ecf3937ac61fa7f3 | [] | no_license | yanzehao19/testwork | feaf093d3642a95d05c055836d0d47116bbac903 | 3d23f513d4f2d9f64d44da68259dab364748c4cd | refs/heads/master | 2021-01-12T07:09:09.180222 | 2018-08-18T03:09:50 | 2018-08-18T03:09:50 | 76,917,900 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package rpc;
public class HelloWorldServiceImpl implements HelloWorldService {
@Override
public String sayHello(String msg) {
String result = "hello world" + msg;
System.out.println(result);
return result;
}
}
| [
"zhyan5726@fiberhome.com"
] | zhyan5726@fiberhome.com |
d558e06a9a8492ddb2244cf43c4eda7aa6a8959b | 64f8af10dcbed271f2afeb29ce35f4b354eec70b | /src/commands/Variable.java | 1488a7f344b73a4b81d67999982785b6bcb2ce57 | [] | no_license | michalhisim/AssemblerInterpreter | 0fbdb3c03e57e03a0fe3011d358af60b93e0707b | 39f32425ad0775beea62664db5064ee6b72c76a9 | refs/heads/master | 2016-09-02T16:52:39.278576 | 2013-05-16T02:12:22 | 2013-05-16T02:12:22 | 10,008,795 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,446 | java | package commands;
/**
*
* @author Michal Šimon
*/
public class Variable {
final String INTEGER = "I";
final String FLOAT = "F";
final String STRING = "S";
final String BOOLEAN = "B";
protected Object value = null;
protected String type = null;
Variable(String value, String type) {
this(type + value);
}
Variable(String variable) {
String type = variable.substring(0, 1);
String value = variable.replace(type, ""); // odstraní z celého řádku část s typem
if ("".equals(value)) {
value = null;
}
switch (type) {
case "I": {
this.value = new Integer(value);
this.type = INTEGER;
break;
}
case "F": {
this.value = new Float(value);
this.type = INTEGER;
break;
}
case "S": {
this.value = value;
this.type = STRING;
break;
}
case "B": {
this.value = new Boolean(value);
this.type = BOOLEAN;
break;
}
default: {
this.value = variable;
this.type = STRING;
}
}
//System.out.println(this.value.toString());
}
public Object get() {
return this.value;
}
public String getType() {
return this.type;
}
@Override
public String toString() {
return this.value.toString();
}
public Variable add(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Integer((Integer) this.value + (Integer) var.get()).toString(), INTEGER);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Float((Float) this.value + (Float) var.get()).toString(), FLOAT);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Float((Float) this.value + (Integer) var.get()).toString(), FLOAT);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Float((Integer) this.value + (Float) var.get()).toString(), FLOAT);
} else if (this.type == STRING && var.getType() == STRING) {
return new Variable((String) ((String) this.value + (String) var.get()), STRING);
}
return null;
}
public Variable sub(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Integer((Integer) this.value - (Integer) var.get()).toString(), INTEGER);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Float((Float) this.value - (Float) var.get()).toString(), FLOAT);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Float((Float) this.value - (Integer) var.get()).toString(), FLOAT);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Float((Integer) this.value - (Float) var.get()).toString(), FLOAT);
}
return null;
}
public Variable mul(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Integer((Integer) this.value * (Integer) var.get()).toString(), INTEGER);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Float((Float) this.value * (Float) var.get()).toString(), FLOAT);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Float((Float) this.value * (Integer) var.get()).toString(), FLOAT);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Float((Integer) this.value * (Float) var.get()).toString(), FLOAT);
}
return null;
}
public Variable div(Variable var) {
if ((var.getType() == INTEGER || var.getType() == FLOAT) && var.get() == 0) {
return null;
}
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Integer((Integer) this.value / (Integer) var.get()).toString(), INTEGER);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Float((Float) this.value / (Float) var.get()).toString(), FLOAT);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Float((Float) this.value / (Integer) var.get()).toString(), FLOAT);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Float((Integer) this.value / (Float) var.get()).toString(), FLOAT);
}
return null;
}
public Variable mod(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Integer((int) this.value % (int) var.get()).toString(), INTEGER);
}
//Modulo exists only for Ints
/* else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Float((Float) this.value % (Float) var.get()).toString(), FLOAT);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Float((Float) this.value % (Integer) var.get()).toString(), FLOAT);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Float((Integer) this.value % (Float) var.get()).toString(), FLOAT);
}*/
return null;
}
public Variable uminus() {
if (this.type == INTEGER) {
return new Variable(new Integer(((Integer) this.value) * (-1)).toString(), INTEGER);
} else if (this.type == FLOAT) {
return new Variable(new Float(((Float) this.value) * (-1)).toString(), FLOAT);
}
return null;
}
public Variable and(Variable var) {
if (this.type == BOOLEAN && var.getType() == BOOLEAN) {
return new Variable(new Boolean((boolean) this.value && (boolean) var.get()).toString(), BOOLEAN);
}
return null;
}
public Variable or(Variable var) {
if (this.type == BOOLEAN && var.getType() == BOOLEAN) {
return new Variable(new Boolean((boolean) this.value || (boolean) var.get()).toString(), BOOLEAN);
}
return null;
}
public Variable gt(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Boolean((int) this.value > (int) var.get()).toString(), BOOLEAN);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Boolean((Float) this.value > (Float) var.get()).toString(), BOOLEAN);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Boolean((Float) this.value > (Integer) var.get()).toString(), BOOLEAN);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Boolean((Integer) this.value > (Float) var.get()).toString(), BOOLEAN);
}
return null;
}
public Variable lt(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Boolean((int) this.value < (int) var.get()).toString(), BOOLEAN);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Boolean((Float) this.value < (Float) var.get()).toString(), BOOLEAN);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Boolean((Float) this.value < (Integer) var.get()).toString(), BOOLEAN);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Boolean((Integer) this.value < (Float) var.get()).toString(), BOOLEAN);
}
return null;
}
public Variable eq(Variable var) {
if (this.type == INTEGER && var.getType() == INTEGER) {
return new Variable(new Boolean((int) this.value == (int) var.get()).toString(), BOOLEAN);
} else if (this.type == FLOAT && var.getType() == FLOAT) {
return new Variable(new Boolean((Float) this.value == (Float) var.get()).toString(), BOOLEAN);
} else if (this.type == FLOAT && var.getType() == INTEGER) {
return new Variable(new Boolean((float) this.value == (int) var.get()).toString(), BOOLEAN);
} else if (this.type == INTEGER && var.getType() == FLOAT) {
return new Variable(new Boolean((int) this.value == (float) var.get()).toString(), BOOLEAN);
} else if (this.type == STRING && var.getType() == STRING) {
return new Variable(new Boolean((String) this.value == (String) var.get()).toString(), BOOLEAN);
}
return null;
}
public Variable not() {
if (this.type == BOOLEAN) {
Boolean v = (boolean) this.value;
if (v) {
return new Variable("false", BOOLEAN);
} else {
return new Variable("true", BOOLEAN);
}
}
return null;
}
}
| [
"michal.simon@centrum.cz"
] | michal.simon@centrum.cz |
a9e64186f500432edbc5da1c886b9219da4906b7 | d999d63da02377aef92beb4253f882b51c87b762 | /rms-api/src/main/java/com/mksoft/shop/exception/handle/MKExceptionHandle.java | dadc4a5e37749f20fd59102c1de32cb991755d56 | [] | no_license | crane2017/system-manage-template | da4f0c3c9eed9b0cfc1654933388849f345fbd59 | d3fd3f40afdef360c77ec047de5f17dc8b528492 | refs/heads/master | 2020-09-17T07:13:41.154429 | 2018-05-27T10:37:08 | 2018-05-27T10:37:08 | 94,492,247 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | package com.mksoft.shop.exception.handle;
import com.mksoft.shop.ErrorCode;
import com.mksoft.shop.exception.BaseException;
import com.mksoft.shop.exception.SysException;
import com.mksoft.shop.service.bo.ResultBo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* Created by chawenming on 2017/5/12.
*/
@ControllerAdvice
@ResponseBody
public class MKExceptionHandle {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
protected HttpServletResponse response;
@ExceptionHandler(BaseException.class)
protected ResultBo processError(BaseException ex) {
logger.error("MKExceptionHandle→BaseException:" + ex.getMessage());
return setError(ex.getHttpStatus(), ex.getErrorCode(), ex.getMessage());
}
@ExceptionHandler(SysException.class)
protected ResultBo processError(SysException ex) {
logger.error("MKExceptionHandle→SysException:" + ex.getMessage());
ex.printStackTrace();
return setError(ex.getHttpStatus(), ex.getErrorCode(), ex.getMessage());
}
@ExceptionHandler
protected ResultBo processError(Exception ex) {
logger.error("MKExceptionHandle→Exception:" + ex.getMessage());
ex.printStackTrace();
return setError(ex);
}
private ResultBo setError(HttpStatus httpStatus, ErrorCode errorCode, String msg) {
ResultBo model = new ResultBo();
model.setMsgCode(errorCode.value());
if(StringUtils.isNotEmpty(msg)){
model.setMsg(msg);
} else {
model.setMsg(errorCode.getMessage());
}
response.setStatus(httpStatus.value());
return model;
}
private ResultBo setError(Exception ex) {
ResultBo model = new ResultBo();
model.setMsgCode(ErrorCode.DEFAULT_ERROR.value());
model.setMsg(ex.getMessage());
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return model;
}
}
| [
"jh_2070@163.com"
] | jh_2070@163.com |
c041f26ef12a68936b639eff64a9edef785daef6 | eacca2ac4db995a3d3e7d203dacc36ae2dc9cf52 | /src/main/java/com/intercorp/interview/dto/ClientKpi.java | a8294e61bb7cfb7c7fe58ea00214a77022420730 | [] | no_license | karenhaag/intercorp-interview | b2bc39962f30c549048383e4261baf7412bfbf2e | 46abe781000a529f74a26ac837fc722acf6008f8 | refs/heads/master | 2023-04-05T14:21:05.821307 | 2021-04-07T00:42:07 | 2021-04-07T00:42:07 | 355,349,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package com.intercorp.interview.dto;
import io.swagger.annotations.ApiModelProperty;
public class ClientKpi {
@ApiModelProperty(name = "averageAge", dataType = "Double", example = "42.3")
private Double averageAge;
@ApiModelProperty(name = "standardDeviation", dataType = "Double", example = "5.5")
private Double standardDeviation;
public ClientKpi(){}
public ClientKpi(Double averageAge, Double standardDeviation){
this.averageAge = averageAge;
this.standardDeviation = standardDeviation;
}
public Double getAverageAge() {
return averageAge;
}
public void setAverageAge(Double averageAge) {
this.averageAge = averageAge;
}
public Double getStandardDeviation() {
return standardDeviation;
}
public void setStandardDeviation(Double standardDeviation) {
this.standardDeviation = standardDeviation;
}
}
| [
"karen.haag@bitlogic.io"
] | karen.haag@bitlogic.io |
14dbafd1e8c69024aa0dedcbde97fcd5d274be64 | f2e3c935c1cab565306f8bb656ef0d6bbb19ea94 | /A2_MT17065/app/src/androidTest/java/com/zuccessful/a2/MainActivityTest.java | 8121c96d0fe49e33bd4586c937e05e4308911f41 | [] | no_license | vaibhavvarshney0/mobile-computing | 5252cf9333d5f792d9cd244eabe0322133c7284a | d5f2f8a3f67fbd916c8f76e43abd1d8b941e75d5 | refs/heads/master | 2020-03-08T06:50:07.287855 | 2018-05-04T16:39:59 | 2018-05-04T16:39:59 | 127,980,509 | 0 | 1 | null | 2018-10-25T17:51:49 | 2018-04-03T23:31:15 | Java | UTF-8 | Java | false | false | 1,090 | java | package com.zuccessful.a2;
import android.support.test.espresso.ViewInteractionModule_ProvideViewFinderFactory;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.*;
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> testMain = new ActivityTestRule<MainActivity>(MainActivity.class);
private MainActivity mainActivity;
@Before
public void setUp() throws Exception {
mainActivity = testMain.getActivity();
}
@After
public void tearDown() throws Exception {
}
@Test
public void checkActivity() {
View view = mainActivity.findViewById(R.id.fragment_list);
assertNotNull(view);
}
public void testTabletFrag()
{
if(MainActivity.test == true)
{
View view = mainActivity.findViewById(R.id.fragment_detail);
assertNotNull(view);
}
}
@Test
public void intentCall() {
}
} | [
"vaibhav@iiitd.ac.in"
] | vaibhav@iiitd.ac.in |
9f266ce4bfc5df76fd236fa8ca68e86bcb23f9c3 | 44615e01c4a1782d4674b456f50876689684097c | /src/main/java/com/rabbitmq/foo/c/workqueue2/StartProcess.java | fb7859d5742203d2fd2a0c8762facebddd1f8b11 | [] | no_license | dcaramelo/rabbitMQ-exemple | a02971019440f5eb3ee9e604f2a808cb6a42aba1 | b7cd66fe58dc01de7d7cc4b3032499425247fd5c | refs/heads/master | 2021-01-20T02:19:01.835553 | 2014-02-21T15:34:38 | 2014-02-21T15:34:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 372 | java | package com.rabbitmq.foo.c.workqueue2;
public class StartProcess {
private static final String TASK_QUEUE_NAME = "task_queue";
public static void main(String[] argv) throws java.io.IOException {
SenderTask st = new SenderTask(TASK_QUEUE_NAME);
st.sendMsg("msg 1");
st.sendMsg("msg 2.");
st.sendMsg("msg 3");
st.sendMsg("msg 4...");
st.close();
}
}
| [
"david.caramelo83@gmail.com"
] | david.caramelo83@gmail.com |
ad9def20f7b6f0349141b7af11ea3100b630b5f4 | 57ab9fa2bef0a3fe5390005801a4bad0d9b50078 | /DP_Refactor_Search_Space/src/dataprovider/dbsManager/PostgresConnector.java | 0ec3d53f4356e199df4c9605bd423b66c8ed13d5 | [] | no_license | hascicm/DP_Refactor_Search_Space | a00f2ddf73654a492f872c47f2e9b8d5f3492c36 | 6d7a5b91dcdcb1ad59ef474fdc61902c38d432a8 | refs/heads/master | 2020-04-10T21:44:30.353501 | 2017-11-26T21:30:17 | 2017-11-26T21:30:17 | 124,295,941 | 0 | 0 | null | 2018-03-07T21:20:53 | 2018-03-07T21:20:53 | null | UTF-8 | Java | false | false | 713 | java | package dataprovider.dbsManager;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class PostgresConnector {
private Connection connection;
private Statement statement;
public PostgresConnector() throws SQLException, ClassNotFoundException {
createConnection();
}
private void createConnection() throws SQLException, ClassNotFoundException {
Class.forName("org.postgresql.Driver");
connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/refactor", "postgres", "admin");
statement = connection.createStatement();
}
public Statement getStatement() {
return statement;
}
}
| [
"hasci@Hascic"
] | hasci@Hascic |
5319393f2023592700f3921b79227bf2c3720572 | 0a122aa3be3e97bd5c157411b00b2686b60fec61 | /AppRadeV2/src/com/apprade/activity/App_GPSMapa_Activity.java | 69f3308d1f3a6faae4df5ae1d9377bf8158374fa | [] | no_license | ozzner/jr-soluciones | 5009184dd1c9e6a876d8432de08ed9b8135ebc64 | cb72983724356027667547e6753454e40b38fdf4 | refs/heads/master | 2021-01-10T05:22:08.710221 | 2015-02-06T18:09:07 | 2015-02-06T18:09:07 | 46,999,478 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 27,366 | java | package com.apprade.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.apprade.R;
import com.apprade.adapter.Adapter_InfoWindow;
import com.apprade.adapter.Adapter_SpinnerItem;
import com.apprade.adapter.Adapter_SpinnerNavActionBar;
import com.apprade.dao.DAO_Calificacion;
import com.apprade.dao.DAO_Establecimiento;
import com.apprade.entity.Entity_Coordenadas;
import com.apprade.entity.Entity_Establecimiento;
import com.apprade.helper.Helper_GPS_Tracker;
import com.apprade.helper.Helper_JSONStatus;
import com.apprade.helper.Helper_SharedPreferences;
import com.apprade.helper.Helper_SubRoutines;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.internal.IGoogleMapDelegate;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.plus.Plus;
public class App_GPSMapa_Activity extends FragmentActivity implements
OnMarkerClickListener, OnInfoWindowClickListener,
ActionBar.OnNavigationListener, OnMapClickListener {
private static final String TAG_NO_HAY_COLA = "No hay cola";
private static final String TAG_POCA_COLA = "Poca cola";
private static final String TAG_COLA_MODERADA = "Cola moderada";
private static final String TAG_ALTA_COLA = "Alta cola";
private static GoogleMap map;
private static MarkerOptions markerOptions = new MarkerOptions();
private MenuItem refreshMenuItem;
Helper_GPS_Tracker gps;
private ArrayList<Adapter_SpinnerItem> arrAdpSpinner;
private Adapter_SpinnerNavActionBar oAdpSpinner;
private double latitude;
private double longitude;
private int usuarioID;
private ActionBar actionBar;
private AdView adView;
private DAO_Establecimiento dao;
public Entity_Establecimiento ettEst;
private Helper_JSONStatus status;
private Fragment_Calificar mFragment;
private DAO_Calificacion oCalificar;
private Helper_SubRoutines routine;
private Helper_SharedPreferences oPrefe;
private Adapter_InfoWindow oInfoWindow;
private Helper_SubRoutines oRoutine;
private String arrValue[];
private static String mensaje;
private static final String TAG_UPDATE = "update";
private static final String AD_UNIT_ID = "ca-app-pub-0771856019955508/3441120220";
private static final String TEST_DEVICE_ID = "B58F8443FD40945F763B77E7BC6B2A2F";
private final String TAG = App_GPSMapa_Activity.class.getSimpleName();
private static Marker myMarker = null;
private static Map<Integer, String> map2_IdEs_Cola = new HashMap<Integer,String>();
String arrParams[] = new String[4];
String arrCategory[] = new String[2];
String arrKeys[] = new String[10];
String arrValues[] = new String[10];
String[] arrNomEst = null;
String[] arrDirEst = null;
private int[] arrIdEstt;
int arraymapas[] = new int[1000];
String titulo;
private LinearLayout lay_rates;
private final double DISTANCE_MIN_TO_RATE = 10000;
/* SET GET */
/**
* @return the arrValue
*/
public String[] getArrValue() {
return arrValue;
}
/**
* @param sValue
* the arrValue to set
*/
public void setArrValue(String[] sValue) {
this.arrValue = sValue;
}
/**
* @return the mensaje
*/
public String getMensaje() {
return mensaje;
}
/**
* @param mensaje
* the mensaje to set
*/
public void setMensaje(String mensaje) {
App_GPSMapa_Activity.mensaje = mensaje;
}
/**
* @return the myMarker
*/
public Marker getMyMarker() {
return myMarker;
}
/**
* @param myMarker
* the myMarker to set
*/
public void setMyMarker(Marker myMarker) {
App_GPSMapa_Activity.myMarker = myMarker;
}
/**
* BOB El constructor
*/
public App_GPSMapa_Activity() {
super();
dao = new DAO_Establecimiento();
ettEst = new Entity_Establecimiento();
status = new Helper_JSONStatus();
oCalificar = new DAO_Calificacion();
oRoutine = new Helper_SubRoutines();
oPrefe = new Helper_SharedPreferences();
oInfoWindow = new Adapter_InfoWindow();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gps_mapa_v2);
ImageView ivNoHayCola = (ImageView) findViewById(R.id.iv_no_hay_cola);
ImageView ivPocaCola = (ImageView) findViewById(R.id.iv_poca_cola);
ImageView ivColaModerada = (ImageView) findViewById(R.id.iv_cola_moderada);
ImageView ivAltaCola = (ImageView) findViewById(R.id.iv_alta_cola);
actionBar = getActionBar();
hideRates();
loadSpinnerNav();
if (oRoutine.isOnline(getApplicationContext()))
// loadAdView();
ivNoHayCola.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
arrParams[0] = String.valueOf(oInfoWindow.getIdEst());
arrParams[1] = TAG_NO_HAY_COLA;
if (isDistanceOk() > 0) {
if (!enviarCalificacion())
chkTimeCalificacion();
else {
hideRates();
exeAsyncTask(arrParams);
}
}
}
});
ivPocaCola.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
arrParams[0] = String.valueOf(oInfoWindow.getIdEst());
arrParams[1] = TAG_POCA_COLA;
if (isDistanceOk() > 0) {
if (!enviarCalificacion())
chkTimeCalificacion();
else {
hideRates();
exeAsyncTask(arrParams);
}
}
}
});
ivColaModerada.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
arrParams[0] = String.valueOf(oInfoWindow.getIdEst());
arrParams[1] = TAG_COLA_MODERADA;
if (isDistanceOk() > 0) {
if (!enviarCalificacion())
chkTimeCalificacion();
else {
hideRates();
exeAsyncTask(arrParams);
}
}
}
});
ivAltaCola.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
arrParams[0] = String.valueOf(oInfoWindow.getIdEst());
arrParams[1] = TAG_ALTA_COLA;
if (isDistanceOk() > 0) {
if (!enviarCalificacion())
chkTimeCalificacion();
else {
hideRates();
exeAsyncTask(arrParams);
}
}
}
});
try {
Bundle oBundle = getIntent().getExtras();
usuarioID = oBundle.getInt("user_id");
String user = oBundle.getString("user");
actionBar.setTitle(user);
} catch (Exception e) {
ArrayList<String> datos = new ArrayList<String>();
Helper_SharedPreferences oShared = new Helper_SharedPreferences();
datos = oShared.getAllLoginDataStored(getApplicationContext());
usuarioID = Integer.parseInt(datos.get(2));
String sName = datos.get(0).toString();
actionBar.setTitle(sName);
}
setUpMapIfNeeded();
} // End onCreate
@Override
public void onResume() {
super.onResume();
if (adView != null) {
adView.resume();
}
}
@Override
public void onPause() {
if (adView != null) {
adView.pause();
}
super.onPause();
}
/** Called before the activity is destroyed. */
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
private void loadAdView() {
adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(AD_UNIT_ID);
adView.setBackgroundColor(Color.parseColor("#000000"));
RelativeLayout layout = (RelativeLayout) findViewById(R.id.lay_mapa);
layout.addView(adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice(TEST_DEVICE_ID)
.build();
adView.loadAd(adRequest);
}
protected boolean enviarCalificacion() {
boolean bMsj = false;
String currentTime = oRoutine
.getCurrentTime(Helper_SubRoutines.TAG_FORMAT_SHORT);
/* KEYS - VALUES */
arrKeys[0] = "currentTime";
arrValues[0] = currentTime;
arrKeys[1] = "establishmentID";
arrValues[1] = String.valueOf(arrParams[0]);
arrKeys[2] = "userID";
arrValues[2] = String.valueOf(usuarioID);
Log.e("CALIFICACION", "Cal:" + arrValues[1] + ":" + usuarioID + ":"
+ arrKeys[0]);
/* Valida si existe la preferencia almacenada (False) */
if (!oPrefe.checkMyCustomPreference("Cal" + arrValues[1] + usuarioID,
getApplicationContext(), arrKeys[0])) {
/* Inserto mi preferencia personalizada */
oPrefe.storeMyCustomPreferences(arrKeys, arrValues, "Cal"
+ arrValues[1] + usuarioID, getApplicationContext());
bMsj = true;
} else {
/* Si esta almacenada, obtengo los datos */
String sValue[] = new String[arrKeys.length];
for (int i = 0; i < arrKeys.length; i++) {
sValue[i] = oPrefe.getAnyValueToMyCustomPreferences(
getApplicationContext(), "Cal" + arrValues[1]
+ usuarioID, arrKeys[i]);
Log.e("for_get_any_sha", sValue[i]);
}
setArrValue(sValue);
}
return bMsj;
}
private void chkTimeCalificacion() {
String sMySharedPref = "Cal" + arrValues[1] + usuarioID;
String sCurrentTime = oRoutine
.getCurrentTime(Helper_SubRoutines.TAG_FORMAT_SHORT);
String sValue[] = new String[arrKeys.length];
String sMsj = "";
sValue = getArrValue();
/* Valido que los datos sean del mismo establecimiento y usuario */
if (sValue[1].equals(arrValues[1]) && sValue[2].equals(arrValues[2])) {
Log.e("VAL_EST_USU", "OK");
/*
* Obtengo la diferencia en minutos (tiempo_alamcenado -
* tiempo_actual)
*/
int min_dif = oRoutine.dateDiferent(sValue[0], sCurrentTime,
"minutos");
Log.e("VAL_MIN", "OK-" + min_dif);
/* Evaluo cuanto tiempo ha pasado */
if (min_dif < 5) {
sMsj = "En " + (5 - min_dif)
+ " min podrá volver a calificar este establecimiento.";
oRoutine.showToast(getApplicationContext(), sMsj);
} else {
oPrefe.updateMyCurretTime(sMySharedPref,
getApplicationContext(), sCurrentTime);
getMyMarker().hideInfoWindow();
exeAsyncTask(arrParams);
}
} else {
/* Actualizo mi preferencia personalizada con otro establecimiento */
oPrefe.storeMyCustomPreferences(arrKeys, arrValues, "Cal"
+ arrValues[1] + usuarioID, getApplicationContext());
Log.e("STORE NEW", "Cal" + arrValues[1] + usuarioID);
}
}
public void showMyToast(String message){
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
};
private int isDistanceOk(){
int iReport = -1;
if (myMarker != null) {
if (gps.canGetLocation()) {
double latGPS = gps.getLatitude();
double lonGPS = gps.getLongitude();
LatLng position = myMarker.getPosition();
double latEst = position.latitude;
double lonEst = position.longitude;
double dDistance = oRoutine.distanceBetweenPositions(latGPS, lonGPS, latEst, lonEst);
if (dDistance < DISTANCE_MIN_TO_RATE ) {
iReport = 1;
Log.e(TAG,"Distance " + dDistance);
}else{
showMyToast("Puede calificar si está a "
+ DISTANCE_MIN_TO_RATE + " m. del establecimiento");
iReport = -2;
Log.e(TAG,"Distance " + dDistance);
}
}else{
iReport = 0;
showMyToast("Debe habilitar GPS/wifi");
}
}
return iReport;
}
private void showRates() {
lay_rates = (LinearLayout)findViewById(R.id.lay_rates);
lay_rates.setVisibility(View.GONE);
lay_rates.setVisibility(View.VISIBLE);
//
// mFragment = (Fragment_Calificar) (getSupportFragmentManager()
// .findFragmentById(R.id.fragment_calificar));
// FragmentManager fm = getSupportFragmentManager();
// fm.beginTransaction().show(mFragment).commit();
//
// setMyMarker(marker);
}
private void hideRates() {
lay_rates = (LinearLayout)findViewById(R.id.lay_rates);
lay_rates.setVisibility(View.INVISIBLE);
// mFragment = (Fragment_Calificar) (getSupportFragmentManager()
// .findFragmentById(R.id.fragment_calificar));
// FragmentManager fm = getSupportFragmentManager();
// fm.beginTransaction().hide(mFragment).commit();
}
private void setUpMapIfNeeded() {
try {
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
map.getUiSettings().setZoomControlsEnabled(false);
map.setMyLocationEnabled(true);
map.setOnMarkerClickListener(this);
map.setOnInfoWindowClickListener(this);
map.setOnMapClickListener(this);
gps = new Helper_GPS_Tracker(App_GPSMapa_Activity.this);
if (gps.canGetLocation()) {
latitude = gps.getLatitude();
longitude = gps.getLongitude();
CameraUpdate camera1 = CameraUpdateFactory.newLatLngZoom(
new LatLng(latitude, longitude), 12f);
map.animateCamera(camera1);
} else {
gps.showSettingsAlert();
}
} catch (Exception e) {
}
}
public void setUpMap(final float lat, final float lon, final String nom,
final String dir, final int idEst) {
new Thread(new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
map.addMarker(markerOptions
.position(new LatLng(lat, lon))
.title(nom)
.snippet(dir + idEst)
.flat(true)
.alpha(0.8f)
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_map)));
}
});
}
}).start();
}
public void runAsyncGetLasRate(final int establishmentID) {
new Thread(new Runnable() {
String sCola = "", sFecha = "Nada";
@Override
public void run() {
boolean bResult = false;
bResult = oCalificar.obtenerUltimaCalificacionPorEstabID(String
.valueOf(establishmentID));
if (bResult) {
sCola = oCalificar.oCali.getCola();
sFecha = oCalificar.oCali.getFecha();
int iMin = oRoutine.dateDiferent(
oRoutine.getCurrentTime(Helper_SubRoutines.TAG_FORMAT_SHORT),
sFecha, Helper_SubRoutines.TAG_MINUTOS);
/* Evaluo cuanto tiempo ha pasado */
if (iMin > 15) {
switch (sCola) {
case "No hay cola":
// TODO no hace nada
break;
default:
updateRating("No hay cola", establishmentID);
break;
}
} else if (iMin >= 10 && iMin <= 15) {
switch (sCola) {
case "Alta cola":
updateRating("Poca cola", establishmentID);
break;
case "Cola moderada":
updateRating("No hay cola", establishmentID);
break;
default:
updateRating("No hay cola", establishmentID);
break;
}
} else if (iMin >= 5 && iMin < 10) {
switch (sCola) {
case "Alta cola":
updateRating("Cola moderada", establishmentID);
break;
case "Cola moderada":
updateRating("Poca cola", establishmentID);
break;
case "Poca cola":
updateRating("No hay cola", establishmentID);
break;
default:
Log.e(TAG_UPDATE, "Entre 5 y 10");
break;
}
} else {
Log.e(TAG_UPDATE, "Menor de 5 min" + iMin);
// TODO
}
} else {
Log.e(TAG_UPDATE, "NO HAY CALIFICACIONES");
sCola = oCalificar.oJsonStatus.getInfo();
}
}
}).start();
}
public void updateRating(final String cola, final int establishmentID) {
new Thread(new Runnable() {
@Override
public void run() {
boolean bResult = oCalificar.registrarCalificacion(
String.valueOf(usuarioID),
String.valueOf(establishmentID), cola);
if (bResult)
map2_IdEs_Cola.put(oInfoWindow.getIdEst(), cola);
runOnUiThread(new Runnable() {
@Override
public void run() {
//TODO
}
});
}
}).start();
}
public void exeAsyncTask(String... args) {
CalificarAsync task = new CalificarAsync();
task.execute(args);
getMyMarker().hideInfoWindow();
hideRates();
}
class CalificarAsync extends AsyncTask<String, Void, Boolean> {
boolean bOk = false;
@Override
protected Boolean doInBackground(String... params) {
if (oCalificar.registrarCalificacion(usuarioID + "", params[0],
params[1]))
bOk = true;
return bOk;
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (result) {
map2_IdEs_Cola.put(oInfoWindow.getIdEst(), arrParams[1]);
oRoutine.showToast(getApplicationContext(),
oCalificar.oJsonStatus.getMessage());
hideRates();
} else {
actionBar.setSubtitle("¡Error!");
}
}
}
/**
* AsynTask class listar establecimiento
*/
class EstablecimientoAsync extends AsyncTask<String, Void, Boolean> {
List<Entity_Establecimiento> lista_establecimiento = new ArrayList<Entity_Establecimiento>();
@Override
protected void onPreExecute() {
lista_establecimiento.clear();
App_GPSMapa_Activity oApp = new App_GPSMapa_Activity();
String sMensaje = oApp.getMensaje();
try {
if (sMensaje.equals("update")) {
refreshMenuItem
.setActionView(R.layout.action_progressbar_refresh);
refreshMenuItem.expandActionView();
}
} catch (Exception e) {
}
}
@Override
protected Boolean doInBackground(String... params) {
boolean bRequest = false;
float lat = 0, lon = 0;
try {
lista_establecimiento = dao
.listarEstablecimientoPorCategoriaID(params[0]);
bRequest = status.getError_status();
if (!bRequest) {
List<Entity_Coordenadas> lista_coordenadas = new ArrayList<Entity_Coordenadas>();
arrNomEst = new String[lista_establecimiento.size()];
arrDirEst = new String[lista_establecimiento.size()];
arrIdEstt = new int[lista_establecimiento.size()];
map2_IdEs_Cola = DAO_Establecimiento.getMap_IdEs_Cola();
int a = 0;
for (Entity_Establecimiento esta : lista_establecimiento) {
lista_coordenadas = esta.getCoordenadas();
arrNomEst[a] = esta.getNombre();
arrDirEst[a] = esta.getDireccion();
arrIdEstt[a] = esta.getEstablecimientoID();
a++;
}
int c = 0;
for (Entity_Coordenadas coor : lista_coordenadas) {
lat = coor.getLatitud();
lon = coor.getLongitud();
setUpMap(lat, lon, arrNomEst[c], arrDirEst[c] , arrIdEstt[c]);
c++;
}
}
} catch (Exception e) {
bRequest = true; // Hubo error
}
return bRequest;
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
try {
} catch (Exception e) {
Log.e("TAG-PROGGRESS", "No se pudo cerrar el dialogo");
}
if (!result) {
try {
refreshMenuItem.collapseActionView();
refreshMenuItem.setActionView(null);
} catch (Exception e) {
}
actionBar.setSubtitle("Ok!");
} else {
try {
refreshMenuItem.collapseActionView();
refreshMenuItem.setActionView(null);
} catch (Exception e) {
}
actionBar.setSubtitle("Error!");
}
}
} // End Async
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mapa_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
actionBar = getActionBar();
switch (item.getItemId()) {
case R.id.cargar_establ_acc:
if (!oRoutine.isOnline(getApplicationContext()))
Toast.makeText(getApplicationContext(),
"Necesita tener conexión a Internet.",
Toast.LENGTH_SHORT).show();
else {
setMensaje(TAG_UPDATE);
try {
refreshMenuItem = item;
hideRates();
myMarker.hideInfoWindow();
map.clear();
new EstablecimientoAsync().execute(arrCategory);
} catch (Exception e) {
map.clear();
new EstablecimientoAsync().execute(arrCategory);
}
}
break;
case R.id.about_acc:
LoadInfo();
break;
case R.id.logout_acc:
logout();
break;
default:
break;
}
return true;
}
private void LoadInfo() {
final View v;
AlertDialog.Builder adInfo = new AlertDialog.Builder(
App_GPSMapa_Activity.this);
LayoutInflater layInfo = this.getLayoutInflater();
v = layInfo.inflate(R.layout.dialog_custom_info, null);
adInfo.setView(v);
adInfo.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
adInfo.show();
}
@Override
public void onInfoWindowClick(final Marker marker) {
map.setInfoWindowAdapter(new Adapter_InfoWindow(getLayoutInflater()));
Intent intent = new Intent(getApplicationContext(),
Usuario_Comentar_Activity.class);
intent.putExtra("establecimientoID", oInfoWindow.getIdEst());
intent.putExtra("nomEstablecimiento", oInfoWindow.getNombre());
intent.putExtra("direccion", oInfoWindow.getDireccion());
intent.putExtra("usuarioID", usuarioID);
intent.putExtra("cola", oInfoWindow.getCola());
startActivity(intent);
}
@Override
public final boolean onMarkerClick(final Marker arg0) {
map.setInfoWindowAdapter(new Adapter_InfoWindow(getLayoutInflater()));
String sAll = arg0.getSnippet();
String sIdEst = sAll.substring(sAll.length() - 4);
String sDirec = sAll.substring(0, sAll.length() - 4);
oInfoWindow.setDireccion(sDirec);
oInfoWindow.setNombre(arg0.getTitle());
oInfoWindow.setCola(map2_IdEs_Cola.get(Integer.parseInt(sIdEst)));
runAsyncGetLasRate(Integer.parseInt(sIdEst));
setMyMarker(arg0);
showRates();
return false;
}
private void loadSpinnerNav() {
actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
arrAdpSpinner = new ArrayList<Adapter_SpinnerItem>();
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.ic_action_place,
"-- Seleccione --"));
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.fast_foods,
"Fast foods"));
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.cines, "Cines"));
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.cafes, "Cafes"));
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.restaurantes,
"Restaurantes"));
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.banco, "Bancos"));
arrAdpSpinner.add(new Adapter_SpinnerItem(R.drawable.organismos,
"Organizaciones"));
oAdpSpinner = new Adapter_SpinnerNavActionBar(getApplicationContext(),
arrAdpSpinner);
actionBar.setListNavigationCallbacks(oAdpSpinner, this);
}
public void logout() {
final View v;
AlertDialog.Builder alertDialog = new AlertDialog.Builder(
App_GPSMapa_Activity.this);
LayoutInflater layInflater = this.getLayoutInflater();
v = layInflater.inflate(R.layout.dialog_custom_logout, null);
alertDialog.setView(v);
/* When positive (yes/ok) is clicked */
alertDialog.setPositiveButton("No",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
/* When negative (No/cancel) button is clicked */
alertDialog.setNegativeButton("Si",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
actionBar.setSubtitle("Chau");
Helper_SharedPreferences oShared = new Helper_SharedPreferences();
oShared.storeStatus(0, getApplicationContext());// 0 =>
// Inicia
// desde
Intent i = new Intent(getApplicationContext(),
Usuario_Login_Activity.class);
startActivity(i);
finish();
}
});
alertDialog.show();
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
String sCatagoria = new String();
sCatagoria = arrAdpSpinner.get(itemPosition).getCategory();
if (!sCatagoria.equals("-- Seleccione --")) {
map.clear();
setMensaje(TAG_UPDATE);
}
if (!oRoutine.isOnline(getApplicationContext()))
Toast.makeText(getApplicationContext(),
"Necesita tener conexión a Internet.", Toast.LENGTH_SHORT)
.show();
else {
switch (sCatagoria) {
case "Fast foods":
arrCategory[0] = String.valueOf(1);
new EstablecimientoAsync().execute(arrCategory);
break;
case "Cines":
arrCategory[0] = String.valueOf(2);
new EstablecimientoAsync().execute(arrCategory);
break;
case "Cafes":
arrCategory[0] = String.valueOf(3);
new EstablecimientoAsync().execute(arrCategory);
break;
case "Restaurantes":
arrCategory[0] = String.valueOf(4);
new EstablecimientoAsync().execute(arrCategory);
break;
case "Bancos":
arrCategory[0] = String.valueOf(5);
new EstablecimientoAsync().execute(arrCategory);
break;
case "Organizaciones":
arrCategory[0] = String.valueOf(6);
new EstablecimientoAsync().execute(arrCategory);
break;
default:
break;
}
}
return false;
}
@Override
public void onMapClick(LatLng arg0) {
hideRates();
// Toast.makeText(getApplicationContext(),"Click Map!", Toast.LENGTH_LONG).show();
}
}
| [
"rsantillanc@gmail.com"
] | rsantillanc@gmail.com |
9ea0adc1a00441cc4c8928f0b69a3d79bd69b2b0 | f17b354e344c411cea19d3c76c044ae6a2cf0de3 | /Code/SchedulerApp/src/com/schedulerapp/httprequests/HttpRequests.java | 4a183607bf0bbb9e2a805a667c1102eb3c74cb03 | [] | no_license | banjarashalin/Scheduler | 16000b97c8377eec08fcab67a5c89800c34d4800 | 8d8b56d225d076d9da62b8c2399f53c9c1d325a8 | refs/heads/master | 2021-05-28T16:15:42.438597 | 2014-08-21T20:23:08 | 2014-08-21T20:23:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | java | package com.schedulerapp.httprequests;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.net.ParseException;
import android.net.http.AndroidHttpClient;
import android.util.Log;
public class HttpRequests {
private static String URL = "http://10.0.2.2:8080/Scheduler/user/api/save";
InputStream is = null;
JSONObject jObj = null;
String json = "";
public String postJsonData(String data)
{
JSONObject jsonObjSend = new JSONObject();
try {
jsonObjSend.put("email", "sonnykr@gmail.com");
jsonObjSend.put("firstname", "Sonny");
jsonObjSend.put("lastname", "Raju");
jsonObjSend.put("id", 1L);
String jsonObjRecv = HttpClient.SendHttpPost(URL, jsonObjSend);
return jsonObjRecv;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
public JSONObject getJSONFromUrl(String url) {
org.apache.http.client.HttpClient client= AndroidHttpClient.newInstance("Android");
// Perform a GET request for a JSON list
HttpUriRequest request = new HttpGet(url);
// Get the response that sends back
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
HttpEntity entity = response.getEntity();
try {
json = EntityUtils.toString(entity);
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// return JSON String
return jObj;
}
}
| [
"shalinbanjara.ca@gmail.com"
] | shalinbanjara.ca@gmail.com |
63e218eba668654dbedf6f32b1eed81726028b04 | e11a54bc56226165446568694528fbb415e406d5 | /JPA2.1/jpa1_14_OneToMany_Bidirectional_Annotation_JoinTable_Cascade/src/main/java/com/manh/entity/Customer.java | 138cfe038b587dc69ecfe26c5a8d04b8b91f9380 | [] | no_license | siddhantaws/Maven-Projects | 5f09d4060ddebaf4734f8401c3809b2c4313b4df | 80c087aed838dcdf791f58e14a44f2337368590f | refs/heads/master | 2022-12-20T23:21:21.597144 | 2019-06-28T04:00:24 | 2019-06-28T04:00:24 | 51,756,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 829 | java | package com.manh.entity;
import java.io.Serializable;
import javax.persistence.*;
import static javax.persistence.CascadeType.*;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Customer implements Serializable {
@Id
//@GeneratedValue
private int id;
private String name;
@OneToMany(cascade=ALL,mappedBy="customer")
private List<Order> orders = new ArrayList<Order>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Order> getOrders() {
return orders;
}
public void setOrders(List<Order> newValue) {
this.orders = newValue;
}
}
| [
"siddhantaws@gmail.com"
] | siddhantaws@gmail.com |
48e32e15b2f02705380bd204b33dab1f0081a055 | 971fd5106123c73e53e3e264ead2340dfa7ebaa5 | /src/accepted/Q301_Q400/Q301_Q310/Q308.java | 019dfddbb651fe271b214644f0d4b1d601acf0a2 | [] | no_license | ttyrueiwoqp/LeetCode | 038ab33087e7974461caac9a514b5e24048046f5 | b03d1b914adf1af9b38c7668415726095cf6e343 | refs/heads/master | 2021-04-19T00:14:11.003754 | 2018-03-01T05:31:42 | 2018-03-01T05:31:42 | 28,955,063 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,797 | java | package accepted.Q301_Q400.Q301_Q310;
/**
* Created by lvfan on 3/27/2016.
* <p>
* Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).
* <p>
* Range Sum Query 2D
* The above rectangle (with the red border) is defined by (row1, col1) = (2, 1) and (row2, col2) = (4, 3), which contains sum = 8.
* <p>
* Example:
* Given matrix = [
* [3, 0, 1, 4, 2],
* [5, 6, 3, 2, 1],
* [1, 2, 0, 1, 5],
* [4, 1, 0, 1, 7],
* [1, 0, 3, 0, 5]
* ]
* <p>
* sumRegion(2, 1, 4, 3) -> 8
* update(3, 2, 2)
* sumRegion(2, 1, 4, 3) -> 10
* Note:
* The matrix is only modifiable by the update function.
* You may assume the number of calls to update and sumRegion function is distributed evenly.
* You may assume that row1 ≤ row2 and col1 ≤ col2.
*/
public class Q308 {
private int[][] colSums;
private int[][] matrix;
public Q308(int[][] matrix) {
if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {
return;
}
this.matrix = matrix;
int m = matrix.length;
int n = matrix[0].length;
colSums = new int[m + 1][n];
for (int i = 1; i <= m; i++) {
for (int j = 0; j < n; j++) {
colSums[i][j] = colSums[i - 1][j] + matrix[i - 1][j];
}
}
}
public void update(int row, int col, int val) {
int diff = val - matrix[row][col];
matrix[row][col] = val;
int m = matrix.length;
for (int i = row; i < m; i++) {
colSums[i + 1][col] += diff;
}
}
public int sumRegion(int row1, int col1, int row2, int col2) {
int res = 0;
for (int j = col1; j <= col2; j++) {
res += colSums[row2 + 1][j] - colSums[row1][j];
}
return res;
}
public static void main(String[] args) {
int[][] matrix = {
{3, 0, 1, 4, 2},
{5, 6, 3, 2, 1},
{1, 2, 0, 1, 5},
{4, 1, 0, 1, 7},
{1, 0, 3, 0, 5}
};
Q308 q = new Q308(matrix);
System.out.println(q.sumRegion(2, 1, 4, 3));
q.update(3,2,2);
System.out.println(q.sumRegion(2, 1, 4, 3));
}
}
// Your NumMatrix object will be instantiated and called as such:
// NumMatrix numMatrix = new NumMatrix(matrix);
// numMatrix.sumRegion(0, 1, 2, 3);
// numMatrix.update(1, 1, 10);
// numMatrix.sumRegion(1, 2, 3, 4);
class NumMatrix {
int[][] tree;
int[][] nums;
int m;
int n;
public NumMatrix(int[][] matrix) {
if (matrix.length == 0 || matrix[0].length == 0) return;
m = matrix.length;
n = matrix[0].length;
tree = new int[m + 1][n + 1];
nums = new int[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
update(i, j, matrix[i][j]);
}
}
}
public void update(int row, int col, int val) {
if (m == 0 || n == 0) return;
int delta = val - nums[row][col];
nums[row][col] = val;
for (int i = row + 1; i <= m; i += i & (-i)) {
for (int j = col + 1; j <= n; j += j & (-j)) {
tree[i][j] += delta;
}
}
}
public int sumRegion(int row1, int col1, int row2, int col2) {
if (m == 0 || n == 0) return 0;
return sum(row2 + 1, col2 + 1) + sum(row1, col1) - sum(row1, col2 + 1) - sum(row2 + 1, col1);
}
public int sum(int row, int col) {
int sum = 0;
for (int i = row; i > 0; i -= i & (-i)) {
for (int j = col; j > 0; j -= j & (-j)) {
sum += tree[i][j];
}
}
return sum;
}
} | [
"lufangjiannus@gmail.com"
] | lufangjiannus@gmail.com |
f0f8c9216bffcaaf0e2391fa05d7f12450f4d09e | fac492f044ccdb0f5513294a943391ab3d21d3c1 | /app/src/main/java/mx/unam/posgrado/inventory/hibernate/AlmacenDAO.java | 92c60b299d52834904fd0d259ae8b6cc161d174b | [
"MIT"
] | permissive | raulgonzalezcz/app-inventory | 4621851fd4ca42cf9a7fe485b1dc773e94e56a4d | 29ad5dc34e948f81ace55b8bc4bba6a50043d32f | refs/heads/master | 2020-04-07T15:07:23.283633 | 2019-03-01T17:29:38 | 2019-03-01T17:29:38 | 158,473,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | package mx.unam.posgrado.inventory.hibernate;
import org.apache.log4j.Logger;
import java.util.List;
/**
* Objeto DAO para manipular la información de objetos tipo {@link Almacen}
* @author Andric Valdez Valenzuela
* @version 1.0
* @since 24/11/2018
*
*/
@SuppressWarnings("unchecked")
public class AlmacenDAO extends BaseHibernateDAO{
private static final Logger logger = Logger.getLogger(AlmacenDAO.class);
/**
* Listado de todos las marcas almacenados en la tabla
* @return
*/
public List<Almacen> getAllAlmacenes(){
return (List<Almacen>)(List<?>)findAll(Almacen.class);
}
public void saveAlmacen(Almacen almacen) {
super.save(almacen);
}
public Almacen getAlmacenById(int id){
return (Almacen) findById(Almacen.class, id);
}
public void deleteAlmacenById(Almacen almacen) {
super.deleteById(almacen);
}
public void updateAlmacen(Almacen almacen) {
super.saveOrUpdate(almacen);
}
/**
* Query for the primary key
* @param id
* @return
*/
public Almacen findById(int id) {
return (Almacen) findById(Almacen.class, id);
}
} | [
"andric_valdez@hotmail.com"
] | andric_valdez@hotmail.com |
8028cfb0aa0125c9a6dbb91cb71cca95a28dc3bb | 862dbd329cb9c0fab970a3635e217f80f2022014 | /src/main/java/pl/edu/agh/repositories/implementations/UsersManagementRepository.java | 6e566bc61c26ffda67c4cdc29c30412b1c003648 | [] | no_license | krzysiuk12/TAIProject | f4e363ec5a6760868647f9d5cad6ceb27efe1aca | ef8385acbde43be2dc98b1f37c4f482173249008 | refs/heads/master | 2021-01-10T20:59:36.573318 | 2014-12-06T20:09:40 | 2014-12-06T20:09:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,659 | java | package pl.edu.agh.repositories.implementations;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import pl.edu.agh.domain.UserAccount;
import pl.edu.agh.domain.UserConnection;
import pl.edu.agh.repositories.interfaces.IUsersManagementRepository;
/**
* Created by Krzysztof Kicinger on 2014-11-24.
*/
@Repository
public class UsersManagementRepository extends BaseHibernateRepository implements IUsersManagementRepository {
@Autowired
public UsersManagementRepository(SessionFactory sessionFactory) {
super(sessionFactory);
}
@Override
public void saveOrUpdate(Object entity) {
getCurrentSession().saveOrUpdate(entity);
}
@Override
public UserAccount getById(Long id) {
return (UserAccount) getCurrentSession().get(UserAccount.class, id);
}
@Override
public UserAccount getUserAccountByUserId(String userId) {
return (UserAccount)getCurrentSession().createCriteria(UserAccount.class).add(Restrictions.eq("userId", userId)).list().get(0);
}
@Override
public UserConnection getUserConnectionById(Long id) {
return (UserConnection) getCurrentSession().get(UserConnection.class, id);
}
@Override
public UserConnection getUserConnectionByUserId(String userId) {
Criteria criteria = getCurrentSession().createCriteria(UserConnection.class);
criteria.add(Restrictions.eq("userId", userId));
return (UserConnection) criteria.list().get(0);
}
}
| [
"kkrzysiu@poczta.onet.pl"
] | kkrzysiu@poczta.onet.pl |
372826edbeac7c5bb245f0ee3e6119e81f17ec51 | c148cc8c215dc089bd346b0e4c8e21a2b8665d86 | /google-ads/src/main/java/com/google/ads/googleads/v0/services/stub/TopicConstantServiceStubSettings.java | 73eda31e85583f1e72a8b33cad932209ff47877e | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | duperran/google-ads-java | 39ae44927d64ceead633b2f3a47407f4e9ef0814 | da810ba8e1b5328a4b9b510eb582dc692a071408 | refs/heads/master | 2020-04-07T13:57:37.899838 | 2018-11-16T16:37:48 | 2018-11-16T16:37:48 | 158,428,852 | 0 | 0 | Apache-2.0 | 2018-11-20T17:42:50 | 2018-11-20T17:42:50 | null | UTF-8 | Java | false | false | 10,692 | java | /*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v0.services.stub;
import com.google.ads.googleads.v0.resources.TopicConstant;
import com.google.ads.googleads.v0.services.GetTopicConstantRequest;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.StatusCode;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;
import org.threeten.bp.Duration;
// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Settings class to configure an instance of {@link TopicConstantServiceStub}.
*
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (googleads.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object. For
* example, to set the total timeout of getTopicConstant to 30 seconds:
*
* <pre>
* <code>
* TopicConstantServiceStubSettings.Builder topicConstantServiceSettingsBuilder =
* TopicConstantServiceStubSettings.newBuilder();
* topicConstantServiceSettingsBuilder.getTopicConstantSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* TopicConstantServiceStubSettings topicConstantServiceSettings = topicConstantServiceSettingsBuilder.build();
* </code>
* </pre>
*/
@Generated("by gapic-generator")
@BetaApi
public class TopicConstantServiceStubSettings
extends StubSettings<TopicConstantServiceStubSettings> {
/** The default scopes of the service. */
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder().build();
private final UnaryCallSettings<GetTopicConstantRequest, TopicConstant> getTopicConstantSettings;
/** Returns the object with the settings used for calls to getTopicConstant. */
public UnaryCallSettings<GetTopicConstantRequest, TopicConstant> getTopicConstantSettings() {
return getTopicConstantSettings;
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public TopicConstantServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcTopicConstantServiceStub.create(this);
} else {
throw new UnsupportedOperationException(
"Transport not supported: " + getTransportChannelProvider().getTransportName());
}
}
/** Returns a builder for the default ExecutorProvider for this service. */
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
return InstantiatingExecutorProvider.newBuilder();
}
/** Returns the default service endpoint. */
public static String getDefaultEndpoint() {
return "googleads.googleapis.com:443";
}
/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
}
/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
}
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder();
}
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(TopicConstantServiceStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
/** Returns a new builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
}
/** Returns a builder containing all the values of this settings class. */
public Builder toBuilder() {
return new Builder(this);
}
protected TopicConstantServiceStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
getTopicConstantSettings = settingsBuilder.getTopicConstantSettings().build();
}
/** Builder for TopicConstantServiceStubSettings. */
public static class Builder
extends StubSettings.Builder<TopicConstantServiceStubSettings, Builder> {
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
private final UnaryCallSettings.Builder<GetTopicConstantRequest, TopicConstant>
getTopicConstantSettings;
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;
static {
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
ImmutableMap.builder();
definitions.put(
"idempotent",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
static {
ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(20000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(20000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.build();
definitions.put("default", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
this((ClientContext) null);
}
protected Builder(ClientContext clientContext) {
super(clientContext);
getTopicConstantSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(getTopicConstantSettings);
initDefaults(this);
}
private static Builder createDefault() {
Builder builder = new Builder((ClientContext) null);
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
builder
.getTopicConstantSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
return builder;
}
protected Builder(TopicConstantServiceStubSettings settings) {
super(settings);
getTopicConstantSettings = settings.getTopicConstantSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(getTopicConstantSettings);
}
// NEXT_MAJOR_VER: remove 'throws Exception'
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
return this;
}
public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
return unaryMethodSettingsBuilders;
}
/** Returns the builder for the settings used for calls to getTopicConstant. */
public UnaryCallSettings.Builder<GetTopicConstantRequest, TopicConstant>
getTopicConstantSettings() {
return getTopicConstantSettings;
}
@Override
public TopicConstantServiceStubSettings build() throws IOException {
return new TopicConstantServiceStubSettings(this);
}
}
}
| [
"nbirnie@google.com"
] | nbirnie@google.com |
2f1f0e3e778cc2ea0c30e45414361a730453f54f | b2c695570bf280de829daf355199b76ce63cab01 | /src/main/java/com/telappoint/apptadmin/model/HomePageResponse.java | 72293cafaf07bbe1bd4b65a8e55cafdcb934bfc8 | [] | no_license | ApptDesk-SpringJDBC/apptadmin | 54b0a4c0078a0d8e56a56830cd9fc9688b55d9b2 | eb773f5d894874794df0fd8eb664062b065afd1d | refs/heads/master | 2020-03-19T09:28:12.250835 | 2018-06-06T07:40:53 | 2018-06-06T07:40:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package com.telappoint.apptadmin.model;
import java.util.List;
import org.codehaus.jackson.map.annotate.JsonSerialize;
/**
* @author Murali G
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class HomePageResponse extends BaseResponse {
private List<Location> locationList;
private List<ServiceVO> serviceList;
private List<Resource> resourceList;
public List<Location> getLocationList() {
return locationList;
}
public void setLocationList(List<Location> locationList) {
this.locationList = locationList;
}
public List<ServiceVO> getServiceList() {
return serviceList;
}
public void setServiceList(List<ServiceVO> serviceList) {
this.serviceList = serviceList;
}
public List<Resource> getResourceList() {
return resourceList;
}
public void setResourceList(List<Resource> resourceList) {
this.resourceList = resourceList;
}
} | [
"nanba03@ca.com"
] | nanba03@ca.com |
e7398eaad1fa71c56addea93380d68fc92fe284a | 0602f1d2246ae66287df55e991d03854e7ca1461 | /app/src/main/java/com/nick/documents/activity/TransactionSafeActivity.java | 0db624ae417a21400d4f4c50814e7408361b3f59 | [
"Apache-2.0"
] | permissive | NickAndroid/Documents | 02777606c82a71349c724630d2c3c8d528e08983 | 1341a244c7cd6e75ed6a324bc14adf8df4610e07 | refs/heads/master | 2021-01-10T15:52:47.689251 | 2015-12-18T16:18:36 | 2015-12-18T16:18:36 | 48,243,337 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,290 | java | package com.nick.documents.activity;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
public class TransactionSafeActivity extends AppCompatActivity {
protected Fragment mShowingFragment;
/**
* Show fragment page by replace the given containerId, if you have data to set
* give a bundle.
*
* @param containerId The id to replace.
* @param fragment The fragment to show.
* @param bundle The data of the fragment if it has.
*/
protected boolean placeFragment(final int containerId,
android.support.v4.app.Fragment fragment, Bundle bundle) {
return placeFragment(containerId, fragment, bundle, true);
}
/**
* Show fragment page by replace the given containerId, if you have data to set
* give a bundle.
*
* @param containerId The id to replace.
* @param f The fragment to show.
* @param bundle The data of the fragment if it has.
* @param animate True if you want to animate the fragment.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
protected boolean placeFragment(final int containerId,
android.support.v4.app.Fragment f, Bundle bundle, boolean animate) {
if (isDestroyed() || f == null) {
return false;
}
if (bundle != null) {
f.setArguments(bundle);
}
if (!animate) {
getSupportFragmentManager().beginTransaction()
.replace(containerId, f).commit();
} else {
getSupportFragmentManager().beginTransaction()
.replace(containerId, f).commit();
}
mShowingFragment = f;
return true;
}
/**
* Remove a fragment that is attached, with animation.
*
* @param f The fragment to remove.
* @return True if successfully removed.
* @see #removeFragment(android.support.v4.app.Fragment, boolean)
*/
protected boolean removeFragment(final android.support.v4.app.Fragment f) {
return removeFragment(f, true);
}
/**
* Remove a fragment that is attached.
*
* @param f The fragment to remove.
* @param animate True if you want to animate the fragment.
* @return True if successfully removed.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
protected boolean removeFragment(final android.support.v4.app.Fragment f, boolean animate) {
if (!isDestroyed() || f == null) {
return false;
}
if (!animate) {
getSupportFragmentManager().beginTransaction().remove(f).commit();
} else {
getSupportFragmentManager().beginTransaction()
.remove(f)
.commit();//TODO Ignore the result?
}
mShowingFragment = null;
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) finish();
return super.onOptionsItemSelected(item);
}
}
| [
"nick.guo.dev@icloud.com"
] | nick.guo.dev@icloud.com |
d1c4034c30dd938160cc011d5d85b766ffa1684b | 0e3898dbcb55563c96d11f93c06e8e2a3b8b545f | /ModelTest/src/com/pq/tracs/model/services/view/PrmOpportunityTargetView2VO/PrmOpportunityTargetView2VOTest.java | ebfadbf9137d65a7a7adc325f6e6a1d163143d18 | [] | no_license | AALIYAR/PQ-TRACS | a811913cbcbe015d85c48a76447d1e01186b2f27 | 79a98fcb21007675d7fb083ebf21d074990f40ff | refs/heads/master | 2020-04-02T10:42:16.724392 | 2018-10-23T13:46:16 | 2018-10-23T13:46:16 | 154,350,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.pq.tracs.model.services.view.PrmOpportunityTargetView2VO;
import com.pq.tracs.model.services.applicationModule.TracsServiceAMFixture;
import com.pq.tracs.model.services.view.VOCreateTestBase;
import oracle.jbo.ViewObject;
import org.junit.*;
import static org.junit.Assert.*;
public class PrmOpportunityTargetView2VOTest extends VOCreateTestBase {
public PrmOpportunityTargetView2VOTest() {
myName = "PrmOpportunityTargetView2";
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
}
| [
"43814640+AALIYAR@users.noreply.github.com"
] | 43814640+AALIYAR@users.noreply.github.com |
b7e5890363db9f56c20f6960e6bb141596250968 | 0cf63633d74a900f564aba75b9fba94c21f7654a | /src/pta/selfTest/HourglassTest1.java | 5f0be381d4469729689779661e62d0d36fba83e6 | [] | no_license | KuanKeh/BeforeML | c0827c9b7f535ffac0264190f6034787c40b78ec | 4a388e2e7cc387944ee245e03b1ab924832ccf27 | refs/heads/master | 2021-06-06T17:32:54.050691 | 2020-12-29T07:24:23 | 2020-12-29T07:24:23 | 96,751,000 | 0 | 0 | null | 2017-07-10T08:34:22 | 2017-07-10T07:54:28 | Java | UTF-8 | Java | false | false | 1,195 | java | package pta.selfTest;
public class HourglassTest1 {
public HourglassTest1() {
}
/**
* 计算总层数
* @param a
* @return
*/
private int depth(int a) {
int i=0;
while(2*(Math.pow(i, 2))-1<a) {
i++;
}
System.out.println("depth="+i);
return 2*(i-1)-1;
}
/**
* 根据总层数画出图案
* @param i
*/
private void printHourglass(int i) {
int half = (i-1)/2;
for(int k = half; k > 0 ;k--) {
System.out.println(printSingleRow(2*k+1, (i-(2*k+1))/2));
}
for(int k = 0; k < half + 1; k++) {
System.out.println(printSingleRow(2*k+1, (i-(2*k+1))/2));
}
}
/**
* 画出单行a个*号
* @param a
* @param b
* @return
*/
private String printSingleRow(int a,int b) {
StringBuffer sb = new StringBuffer("");
for(int i = 0; i < b; i++) {
sb.append(" ");
}
for(int i = 0; i < a; i++) {
sb.append("*");
}
return sb.toString();
}
public static void main(String[] args) {
HourglassTest1 ht = new HourglassTest1();
int num = 19;
int depth = ht.depth(num);
ht.printHourglass(depth);
System.out.println(num - (2*Math.pow((depth+1)/2, 2)-1));
}
}
| [
"GGY@GGY-PC"
] | GGY@GGY-PC |
9aa31604af342cb05827a4fdc8355cd7053e5088 | ec7ba91d9cc961c10a3f670459ed2c10fb914f09 | /src/main/java/com/tyk/pojo/MedinfoExample.java | ce95f066401466e558a9e452703eabc0760973f5 | [] | no_license | sdljtyk/MedWork | 5cd091293f2861330f4510a898323a7b21e3cc7f | bb55659de8345848b9d5203801bd36197958da07 | refs/heads/master | 2020-03-13T03:55:33.428493 | 2018-11-28T09:13:09 | 2018-11-28T09:13:09 | 130,953,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,572 | java | package com.tyk.pojo;
import java.util.ArrayList;
import java.util.List;
public class MedinfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Integer offset;
public MedinfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andMednumberIsNull() {
addCriterion("MedNumber is null");
return (Criteria) this;
}
public Criteria andMednumberIsNotNull() {
addCriterion("MedNumber is not null");
return (Criteria) this;
}
public Criteria andMednumberEqualTo(String value) {
addCriterion("MedNumber =", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberNotEqualTo(String value) {
addCriterion("MedNumber <>", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberGreaterThan(String value) {
addCriterion("MedNumber >", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberGreaterThanOrEqualTo(String value) {
addCriterion("MedNumber >=", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberLessThan(String value) {
addCriterion("MedNumber <", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberLessThanOrEqualTo(String value) {
addCriterion("MedNumber <=", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberLike(String value) {
addCriterion("MedNumber like", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberNotLike(String value) {
addCriterion("MedNumber not like", value, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberIn(List<String> values) {
addCriterion("MedNumber in", values, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberNotIn(List<String> values) {
addCriterion("MedNumber not in", values, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberBetween(String value1, String value2) {
addCriterion("MedNumber between", value1, value2, "mednumber");
return (Criteria) this;
}
public Criteria andMednumberNotBetween(String value1, String value2) {
addCriterion("MedNumber not between", value1, value2, "mednumber");
return (Criteria) this;
}
public Criteria andMedmakeIsNull() {
addCriterion("MedMake is null");
return (Criteria) this;
}
public Criteria andMedmakeIsNotNull() {
addCriterion("MedMake is not null");
return (Criteria) this;
}
public Criteria andMedmakeEqualTo(String value) {
addCriterion("MedMake =", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeNotEqualTo(String value) {
addCriterion("MedMake <>", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeGreaterThan(String value) {
addCriterion("MedMake >", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeGreaterThanOrEqualTo(String value) {
addCriterion("MedMake >=", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeLessThan(String value) {
addCriterion("MedMake <", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeLessThanOrEqualTo(String value) {
addCriterion("MedMake <=", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeLike(String value) {
addCriterion("MedMake like", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeNotLike(String value) {
addCriterion("MedMake not like", value, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeIn(List<String> values) {
addCriterion("MedMake in", values, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeNotIn(List<String> values) {
addCriterion("MedMake not in", values, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeBetween(String value1, String value2) {
addCriterion("MedMake between", value1, value2, "medmake");
return (Criteria) this;
}
public Criteria andMedmakeNotBetween(String value1, String value2) {
addCriterion("MedMake not between", value1, value2, "medmake");
return (Criteria) this;
}
public Criteria andMednameIsNull() {
addCriterion("MedName is null");
return (Criteria) this;
}
public Criteria andMednameIsNotNull() {
addCriterion("MedName is not null");
return (Criteria) this;
}
public Criteria andMednameEqualTo(String value) {
addCriterion("MedName =", value, "medname");
return (Criteria) this;
}
public Criteria andMednameNotEqualTo(String value) {
addCriterion("MedName <>", value, "medname");
return (Criteria) this;
}
public Criteria andMednameGreaterThan(String value) {
addCriterion("MedName >", value, "medname");
return (Criteria) this;
}
public Criteria andMednameGreaterThanOrEqualTo(String value) {
addCriterion("MedName >=", value, "medname");
return (Criteria) this;
}
public Criteria andMednameLessThan(String value) {
addCriterion("MedName <", value, "medname");
return (Criteria) this;
}
public Criteria andMednameLessThanOrEqualTo(String value) {
addCriterion("MedName <=", value, "medname");
return (Criteria) this;
}
public Criteria andMednameLike(String value) {
addCriterion("MedName like", value, "medname");
return (Criteria) this;
}
public Criteria andMednameNotLike(String value) {
addCriterion("MedName not like", value, "medname");
return (Criteria) this;
}
public Criteria andMednameIn(List<String> values) {
addCriterion("MedName in", values, "medname");
return (Criteria) this;
}
public Criteria andMednameNotIn(List<String> values) {
addCriterion("MedName not in", values, "medname");
return (Criteria) this;
}
public Criteria andMednameBetween(String value1, String value2) {
addCriterion("MedName between", value1, value2, "medname");
return (Criteria) this;
}
public Criteria andMednameNotBetween(String value1, String value2) {
addCriterion("MedName not between", value1, value2, "medname");
return (Criteria) this;
}
public Criteria andMedpicIsNull() {
addCriterion("MedPic is null");
return (Criteria) this;
}
public Criteria andMedpicIsNotNull() {
addCriterion("MedPic is not null");
return (Criteria) this;
}
public Criteria andMedpicEqualTo(String value) {
addCriterion("MedPic =", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicNotEqualTo(String value) {
addCriterion("MedPic <>", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicGreaterThan(String value) {
addCriterion("MedPic >", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicGreaterThanOrEqualTo(String value) {
addCriterion("MedPic >=", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicLessThan(String value) {
addCriterion("MedPic <", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicLessThanOrEqualTo(String value) {
addCriterion("MedPic <=", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicLike(String value) {
addCriterion("MedPic like", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicNotLike(String value) {
addCriterion("MedPic not like", value, "medpic");
return (Criteria) this;
}
public Criteria andMedpicIn(List<String> values) {
addCriterion("MedPic in", values, "medpic");
return (Criteria) this;
}
public Criteria andMedpicNotIn(List<String> values) {
addCriterion("MedPic not in", values, "medpic");
return (Criteria) this;
}
public Criteria andMedpicBetween(String value1, String value2) {
addCriterion("MedPic between", value1, value2, "medpic");
return (Criteria) this;
}
public Criteria andMedpicNotBetween(String value1, String value2) {
addCriterion("MedPic not between", value1, value2, "medpic");
return (Criteria) this;
}
public Criteria andMedpzIsNull() {
addCriterion("MedPz is null");
return (Criteria) this;
}
public Criteria andMedpzIsNotNull() {
addCriterion("MedPz is not null");
return (Criteria) this;
}
public Criteria andMedpzEqualTo(String value) {
addCriterion("MedPz =", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzNotEqualTo(String value) {
addCriterion("MedPz <>", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzGreaterThan(String value) {
addCriterion("MedPz >", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzGreaterThanOrEqualTo(String value) {
addCriterion("MedPz >=", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzLessThan(String value) {
addCriterion("MedPz <", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzLessThanOrEqualTo(String value) {
addCriterion("MedPz <=", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzLike(String value) {
addCriterion("MedPz like", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzNotLike(String value) {
addCriterion("MedPz not like", value, "medpz");
return (Criteria) this;
}
public Criteria andMedpzIn(List<String> values) {
addCriterion("MedPz in", values, "medpz");
return (Criteria) this;
}
public Criteria andMedpzNotIn(List<String> values) {
addCriterion("MedPz not in", values, "medpz");
return (Criteria) this;
}
public Criteria andMedpzBetween(String value1, String value2) {
addCriterion("MedPz between", value1, value2, "medpz");
return (Criteria) this;
}
public Criteria andMedpzNotBetween(String value1, String value2) {
addCriterion("MedPz not between", value1, value2, "medpz");
return (Criteria) this;
}
public Criteria andMedjkIsNull() {
addCriterion("MedJk is null");
return (Criteria) this;
}
public Criteria andMedjkIsNotNull() {
addCriterion("MedJk is not null");
return (Criteria) this;
}
public Criteria andMedjkEqualTo(Integer value) {
addCriterion("MedJk =", value, "medjk");
return (Criteria) this;
}
public Criteria andMedjkNotEqualTo(Integer value) {
addCriterion("MedJk <>", value, "medjk");
return (Criteria) this;
}
public Criteria andMedjkGreaterThan(Integer value) {
addCriterion("MedJk >", value, "medjk");
return (Criteria) this;
}
public Criteria andMedjkGreaterThanOrEqualTo(Integer value) {
addCriterion("MedJk >=", value, "medjk");
return (Criteria) this;
}
public Criteria andMedjkLessThan(Integer value) {
addCriterion("MedJk <", value, "medjk");
return (Criteria) this;
}
public Criteria andMedjkLessThanOrEqualTo(Integer value) {
addCriterion("MedJk <=", value, "medjk");
return (Criteria) this;
}
public Criteria andMedjkIn(List<Integer> values) {
addCriterion("MedJk in", values, "medjk");
return (Criteria) this;
}
public Criteria andMedjkNotIn(List<Integer> values) {
addCriterion("MedJk not in", values, "medjk");
return (Criteria) this;
}
public Criteria andMedjkBetween(Integer value1, Integer value2) {
addCriterion("MedJk between", value1, value2, "medjk");
return (Criteria) this;
}
public Criteria andMedjkNotBetween(Integer value1, Integer value2) {
addCriterion("MedJk not between", value1, value2, "medjk");
return (Criteria) this;
}
public Criteria andMedzlIsNull() {
addCriterion("MedZl is null");
return (Criteria) this;
}
public Criteria andMedzlIsNotNull() {
addCriterion("MedZl is not null");
return (Criteria) this;
}
public Criteria andMedzlEqualTo(String value) {
addCriterion("MedZl =", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlNotEqualTo(String value) {
addCriterion("MedZl <>", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlGreaterThan(String value) {
addCriterion("MedZl >", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlGreaterThanOrEqualTo(String value) {
addCriterion("MedZl >=", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlLessThan(String value) {
addCriterion("MedZl <", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlLessThanOrEqualTo(String value) {
addCriterion("MedZl <=", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlLike(String value) {
addCriterion("MedZl like", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlNotLike(String value) {
addCriterion("MedZl not like", value, "medzl");
return (Criteria) this;
}
public Criteria andMedzlIn(List<String> values) {
addCriterion("MedZl in", values, "medzl");
return (Criteria) this;
}
public Criteria andMedzlNotIn(List<String> values) {
addCriterion("MedZl not in", values, "medzl");
return (Criteria) this;
}
public Criteria andMedzlBetween(String value1, String value2) {
addCriterion("MedZl between", value1, value2, "medzl");
return (Criteria) this;
}
public Criteria andMedzlNotBetween(String value1, String value2) {
addCriterion("MedZl not between", value1, value2, "medzl");
return (Criteria) this;
}
public Criteria andMedaboutIsNull() {
addCriterion("MedAbout is null");
return (Criteria) this;
}
public Criteria andMedaboutIsNotNull() {
addCriterion("MedAbout is not null");
return (Criteria) this;
}
public Criteria andMedaboutEqualTo(String value) {
addCriterion("MedAbout =", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutNotEqualTo(String value) {
addCriterion("MedAbout <>", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutGreaterThan(String value) {
addCriterion("MedAbout >", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutGreaterThanOrEqualTo(String value) {
addCriterion("MedAbout >=", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutLessThan(String value) {
addCriterion("MedAbout <", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutLessThanOrEqualTo(String value) {
addCriterion("MedAbout <=", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutLike(String value) {
addCriterion("MedAbout like", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutNotLike(String value) {
addCriterion("MedAbout not like", value, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutIn(List<String> values) {
addCriterion("MedAbout in", values, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutNotIn(List<String> values) {
addCriterion("MedAbout not in", values, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutBetween(String value1, String value2) {
addCriterion("MedAbout between", value1, value2, "medabout");
return (Criteria) this;
}
public Criteria andMedaboutNotBetween(String value1, String value2) {
addCriterion("MedAbout not between", value1, value2, "medabout");
return (Criteria) this;
}
public Criteria andMedstateIsNull() {
addCriterion("MedState is null");
return (Criteria) this;
}
public Criteria andMedstateIsNotNull() {
addCriterion("MedState is not null");
return (Criteria) this;
}
public Criteria andMedstateEqualTo(Integer value) {
addCriterion("MedState =", value, "medstate");
return (Criteria) this;
}
public Criteria andMedstateNotEqualTo(Integer value) {
addCriterion("MedState <>", value, "medstate");
return (Criteria) this;
}
public Criteria andMedstateGreaterThan(Integer value) {
addCriterion("MedState >", value, "medstate");
return (Criteria) this;
}
public Criteria andMedstateGreaterThanOrEqualTo(Integer value) {
addCriterion("MedState >=", value, "medstate");
return (Criteria) this;
}
public Criteria andMedstateLessThan(Integer value) {
addCriterion("MedState <", value, "medstate");
return (Criteria) this;
}
public Criteria andMedstateLessThanOrEqualTo(Integer value) {
addCriterion("MedState <=", value, "medstate");
return (Criteria) this;
}
public Criteria andMedstateIn(List<Integer> values) {
addCriterion("MedState in", values, "medstate");
return (Criteria) this;
}
public Criteria andMedstateNotIn(List<Integer> values) {
addCriterion("MedState not in", values, "medstate");
return (Criteria) this;
}
public Criteria andMedstateBetween(Integer value1, Integer value2) {
addCriterion("MedState between", value1, value2, "medstate");
return (Criteria) this;
}
public Criteria andMedstateNotBetween(Integer value1, Integer value2) {
addCriterion("MedState not between", value1, value2, "medstate");
return (Criteria) this;
}
public Criteria andMeddwIsNull() {
addCriterion("MedDw is null");
return (Criteria) this;
}
public Criteria andMeddwIsNotNull() {
addCriterion("MedDw is not null");
return (Criteria) this;
}
public Criteria andMeddwEqualTo(String value) {
addCriterion("MedDw =", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwNotEqualTo(String value) {
addCriterion("MedDw <>", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwGreaterThan(String value) {
addCriterion("MedDw >", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwGreaterThanOrEqualTo(String value) {
addCriterion("MedDw >=", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwLessThan(String value) {
addCriterion("MedDw <", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwLessThanOrEqualTo(String value) {
addCriterion("MedDw <=", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwLike(String value) {
addCriterion("MedDw like", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwNotLike(String value) {
addCriterion("MedDw not like", value, "meddw");
return (Criteria) this;
}
public Criteria andMeddwIn(List<String> values) {
addCriterion("MedDw in", values, "meddw");
return (Criteria) this;
}
public Criteria andMeddwNotIn(List<String> values) {
addCriterion("MedDw not in", values, "meddw");
return (Criteria) this;
}
public Criteria andMeddwBetween(String value1, String value2) {
addCriterion("MedDw between", value1, value2, "meddw");
return (Criteria) this;
}
public Criteria andMeddwNotBetween(String value1, String value2) {
addCriterion("MedDw not between", value1, value2, "meddw");
return (Criteria) this;
}
public Criteria andMedggIsNull() {
addCriterion("MedGg is null");
return (Criteria) this;
}
public Criteria andMedggIsNotNull() {
addCriterion("MedGg is not null");
return (Criteria) this;
}
public Criteria andMedggEqualTo(String value) {
addCriterion("MedGg =", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggNotEqualTo(String value) {
addCriterion("MedGg <>", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggGreaterThan(String value) {
addCriterion("MedGg >", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggGreaterThanOrEqualTo(String value) {
addCriterion("MedGg >=", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggLessThan(String value) {
addCriterion("MedGg <", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggLessThanOrEqualTo(String value) {
addCriterion("MedGg <=", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggLike(String value) {
addCriterion("MedGg like", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggNotLike(String value) {
addCriterion("MedGg not like", value, "medgg");
return (Criteria) this;
}
public Criteria andMedggIn(List<String> values) {
addCriterion("MedGg in", values, "medgg");
return (Criteria) this;
}
public Criteria andMedggNotIn(List<String> values) {
addCriterion("MedGg not in", values, "medgg");
return (Criteria) this;
}
public Criteria andMedggBetween(String value1, String value2) {
addCriterion("MedGg between", value1, value2, "medgg");
return (Criteria) this;
}
public Criteria andMedggNotBetween(String value1, String value2) {
addCriterion("MedGg not between", value1, value2, "medgg");
return (Criteria) this;
}
public Criteria andMedjxIsNull() {
addCriterion("MedJx is null");
return (Criteria) this;
}
public Criteria andMedjxIsNotNull() {
addCriterion("MedJx is not null");
return (Criteria) this;
}
public Criteria andMedjxEqualTo(String value) {
addCriterion("MedJx =", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxNotEqualTo(String value) {
addCriterion("MedJx <>", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxGreaterThan(String value) {
addCriterion("MedJx >", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxGreaterThanOrEqualTo(String value) {
addCriterion("MedJx >=", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxLessThan(String value) {
addCriterion("MedJx <", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxLessThanOrEqualTo(String value) {
addCriterion("MedJx <=", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxLike(String value) {
addCriterion("MedJx like", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxNotLike(String value) {
addCriterion("MedJx not like", value, "medjx");
return (Criteria) this;
}
public Criteria andMedjxIn(List<String> values) {
addCriterion("MedJx in", values, "medjx");
return (Criteria) this;
}
public Criteria andMedjxNotIn(List<String> values) {
addCriterion("MedJx not in", values, "medjx");
return (Criteria) this;
}
public Criteria andMedjxBetween(String value1, String value2) {
addCriterion("MedJx between", value1, value2, "medjx");
return (Criteria) this;
}
public Criteria andMedjxNotBetween(String value1, String value2) {
addCriterion("MedJx not between", value1, value2, "medjx");
return (Criteria) this;
}
public Criteria andMedclassIsNull() {
addCriterion("MedClass is null");
return (Criteria) this;
}
public Criteria andMedclassIsNotNull() {
addCriterion("MedClass is not null");
return (Criteria) this;
}
public Criteria andMedclassEqualTo(Integer value) {
addCriterion("MedClass =", value, "medclass");
return (Criteria) this;
}
public Criteria andMedclassNotEqualTo(Integer value) {
addCriterion("MedClass <>", value, "medclass");
return (Criteria) this;
}
public Criteria andMedclassGreaterThan(Integer value) {
addCriterion("MedClass >", value, "medclass");
return (Criteria) this;
}
public Criteria andMedclassGreaterThanOrEqualTo(Integer value) {
addCriterion("MedClass >=", value, "medclass");
return (Criteria) this;
}
public Criteria andMedclassLessThan(Integer value) {
addCriterion("MedClass <", value, "medclass");
return (Criteria) this;
}
public Criteria andMedclassLessThanOrEqualTo(Integer value) {
addCriterion("MedClass <=", value, "medclass");
return (Criteria) this;
}
public Criteria andMedclassIn(List<Integer> values) {
addCriterion("MedClass in", values, "medclass");
return (Criteria) this;
}
public Criteria andMedclassNotIn(List<Integer> values) {
addCriterion("MedClass not in", values, "medclass");
return (Criteria) this;
}
public Criteria andMedclassBetween(Integer value1, Integer value2) {
addCriterion("MedClass between", value1, value2, "medclass");
return (Criteria) this;
}
public Criteria andMedclassNotBetween(Integer value1, Integer value2) {
addCriterion("MedClass not between", value1, value2, "medclass");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"sdljtyk@outlook.com"
] | sdljtyk@outlook.com |
688f30a9c0cf71e2e5bf151611e47ae79b3631ed | 44f85a77fcd1d46266b89fbf6e092d8b90629ee0 | /app/src/main/java/com/example/r6strategies/villa/easyvillastrat1.java | e74d739a70d9328241cd18cfe61ce88e26c212dc | [] | no_license | Peppone248/r6strategies | a77bc7660a5c49dd504a0716825eb876d6ccddd2 | 69b981427eab006d693e3c81c8e9fca7487cdee5 | refs/heads/master | 2023-03-28T13:36:27.342589 | 2021-03-23T14:14:36 | 2021-03-23T14:14:36 | 340,423,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | package com.example.r6strategies.villa;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.r6strategies.OperatorRecyclerViewDataAdapter;
import com.example.r6strategies.OperatorRecyclerViewItem;
import com.example.r6strategies.R;
import java.util.ArrayList;
import java.util.List;
public class easyvillastrat1 extends Fragment {
public easyvillastrat1() {
// Required empty public constructor
}
private List<OperatorRecyclerViewItem> carItemList = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_easystrat, container, false);
initializeCarItemList();
RecyclerView carRecyclerView = (RecyclerView) view.findViewById(R.id.card_view_recycler_list);
// Create the grid layout manager with 2 columns.
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2);
// Set layout manager.
carRecyclerView.setLayoutManager(gridLayoutManager);
// Create car recycler view data adapter with car item list.
OperatorRecyclerViewDataAdapter carDataAdapter = new OperatorRecyclerViewDataAdapter(carItemList);
// Set data adapter.
carRecyclerView.setAdapter(carDataAdapter);
return view;
}
/* Initialise car items in list. */
private void initializeCarItemList()
{
if(carItemList == null)
{
carItemList = new ArrayList<OperatorRecyclerViewItem>();
carItemList.add(new OperatorRecyclerViewItem("CAVEIRA", R.drawable.caveira,"8-1-1"));
carItemList.add(new OperatorRecyclerViewItem("JAGER", R.drawable.jager,"8-1-1"));
carItemList.add(new OperatorRecyclerViewItem("ELA", R.drawable.ela,"8-1-1"));
carItemList.add(new OperatorRecyclerViewItem("BANDIT", R.drawable.bandit,"8-1-1"));
carItemList.add(new OperatorRecyclerViewItem("KAPKAN", R.drawable.doc,"8-1-1"));
carItemList.add(new OperatorRecyclerViewItem("WALLS", R.drawable.rfwalls,"8-1-1"));
//carItemList.add(new CarRecyclerViewItem("Future", R.drawable.kaid));
}
}
} | [
"giovannitempestainfo@gmail.com"
] | giovannitempestainfo@gmail.com |
998a6f35a5e43f1b0710f880a9cd00e5f761d032 | dedd8b238961dbb6889a864884e011ce152d1d5c | /src/com/google/common/reflect/TypeToken$TypeFilter$2.java | 2fd00cb97430159fba6b806efe0c4fb999de2804 | [] | no_license | reverseengineeringer/gov.cityofboston.commonwealthconnect | d553a8a7a4fcd7b846eebadb6c1e3e9294919eb7 | 1a829995d5527f4d5798fa578ca1b0fe499839e1 | refs/heads/master | 2021-01-10T05:08:31.188375 | 2016-03-19T20:37:17 | 2016-03-19T20:37:17 | 54,285,966 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.google.common.reflect;
enum TypeToken$TypeFilter$2
{
TypeToken$TypeFilter$2()
{
super(paramString, paramInt, null);
}
public boolean apply(TypeToken<?> paramTypeToken)
{
return paramTypeToken.getRawType().isInterface();
}
}
/* Location:
* Qualified Name: com.google.common.reflect.TypeToken.TypeFilter.2
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
572cfe9e57ac1c771745a9fc1fda0173b3250ac3 | 37e169bd46694419dc8c0c043a0db293fbf24ee8 | /src/main/java/com/bootcamp/msPayment/models/dto/CreditDTO.java | cf6c4643b8e767eb78cabbbc5858c5680108ee4f | [] | no_license | josue12lch98everis/ms-Payment-bank | 93f4295057ed77cc0bc852868b55ad5a81e1fa5f | acd344f0482ba3d91d07bf090e0f31d51bd99f04 | refs/heads/master | 2023-08-02T09:05:04.031958 | 2021-08-23T07:25:39 | 2021-08-23T07:25:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package com.bootcamp.msPayment.models.dto;
import lombok.*;
/**
* The type Credit dto.
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CreditDTO {
private String contractNumber;
private double amount;
private String customerIdentityNumber;
}
| [
"34173505+rosasjose96@users.noreply.github.com"
] | 34173505+rosasjose96@users.noreply.github.com |
d227ebb5142ada414084212c53fda3f76372410a | 5b6269673007ca62e47ce933c13f5251cf324875 | /build/tmp/recompileMc/sources/net/minecraft/world/chunk/storage/AnvilChunkLoader.java | dd064607f14b57f7eb142b49a555fcfa8d2367e2 | [] | no_license | Alpyg/RPGSeed | 0babfc2b7504aa53b61cc50ded34ba03e14b6b3b | 2748bb4b7d306987fa247c72ff71f4c162e9cdae | refs/heads/master | 2021-06-27T03:09:16.131607 | 2019-05-23T23:47:22 | 2019-05-23T23:47:22 | 173,173,470 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,588 | java | package net.minecraft.world.chunk.storage;
import com.google.common.collect.Maps;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.datafix.FixTypes;
import net.minecraft.util.datafix.IDataFixer;
import net.minecraft.util.datafix.IDataWalker;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.NextTickListEntry;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.storage.IThreadedFileIO;
import net.minecraft.world.storage.ThreadedFileIOBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO
{
private static final Logger LOGGER = LogManager.getLogger();
/**
* A map containing chunks to be written to disk (but not those that are currently in the process of being written).
* Key is the chunk position, value is the NBT to write.
*/
private final Map<ChunkPos, NBTTagCompound> chunksToSave = Maps.<ChunkPos, NBTTagCompound>newConcurrentMap();
/** A set containing the chunk that is currently in the process of being written to disk. */
private final Set<ChunkPos> chunksBeingSaved = Collections.<ChunkPos>newSetFromMap(Maps.newConcurrentMap());
/** Save directory for chunks using the Anvil format */
private final File chunkSaveLocation;
private final DataFixer fixer;
private boolean flushing;
public AnvilChunkLoader(File chunkSaveLocationIn, DataFixer dataFixerIn)
{
this.chunkSaveLocation = chunkSaveLocationIn;
this.fixer = dataFixerIn;
}
/**
* Loads the specified(XZ) chunk into the specified world.
*/
@Nullable
public Chunk loadChunk(World worldIn, int x, int z) throws IOException
{
ChunkPos chunkpos = new ChunkPos(x, z);
NBTTagCompound nbttagcompound = this.chunksToSave.get(chunkpos);
if (nbttagcompound == null)
{
DataInputStream datainputstream = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, x, z);
if (datainputstream == null)
{
return null;
}
nbttagcompound = this.fixer.process(FixTypes.CHUNK, CompressedStreamTools.read(datainputstream));
}
return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound);
}
public boolean isChunkGeneratedAt(int x, int z)
{
ChunkPos chunkpos = new ChunkPos(x, z);
NBTTagCompound nbttagcompound = this.chunksToSave.get(chunkpos);
return nbttagcompound != null ? true : RegionFileCache.chunkExists(this.chunkSaveLocation, x, z);
}
/**
* Wraps readChunkFromNBT. Checks the coordinates and several NBT tags.
*/
@Nullable
protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound compound)
{
if (!compound.hasKey("Level", 10))
{
LOGGER.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(x), Integer.valueOf(z));
return null;
}
else
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("Level");
if (!nbttagcompound.hasKey("Sections", 9))
{
LOGGER.error("Chunk file at {},{} is missing block data, skipping", Integer.valueOf(x), Integer.valueOf(z));
return null;
}
else
{
Chunk chunk = this.readChunkFromNBT(worldIn, nbttagcompound);
if (!chunk.isAtLocation(x, z))
{
LOGGER.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", Integer.valueOf(x), Integer.valueOf(z), Integer.valueOf(x), Integer.valueOf(z), Integer.valueOf(chunk.x), Integer.valueOf(chunk.z));
nbttagcompound.setInteger("xPos", x);
nbttagcompound.setInteger("zPos", z);
chunk = this.readChunkFromNBT(worldIn, nbttagcompound);
}
return chunk;
}
}
}
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
worldIn.checkSessionLock();
try
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound.setTag("Level", nbttagcompound1);
nbttagcompound.setInteger("DataVersion", 1343);
this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
this.addChunkToPending(chunkIn.getPos(), nbttagcompound);
}
catch (Exception exception)
{
LOGGER.error("Failed to save chunk", (Throwable)exception);
}
}
protected void addChunkToPending(ChunkPos pos, NBTTagCompound compound)
{
if (!this.chunksBeingSaved.contains(pos))
{
this.chunksToSave.put(pos, compound);
}
ThreadedFileIOBase.getThreadedIOInstance().queueIO(this);
}
/**
* Writes one queued IO action.
*
* @return true if there are more IO actions to perform afterwards, or false if there are none (and this instance of
* IThreadedFileIO should be removed from the queued list)
*/
public boolean writeNextIO()
{
if (this.chunksToSave.isEmpty())
{
if (this.flushing)
{
LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", (Object)this.chunkSaveLocation.getName());
}
return false;
}
else
{
ChunkPos chunkpos = this.chunksToSave.keySet().iterator().next();
boolean lvt_3_1_;
try
{
this.chunksBeingSaved.add(chunkpos);
NBTTagCompound nbttagcompound = this.chunksToSave.remove(chunkpos);
if (nbttagcompound != null)
{
try
{
this.writeChunkData(chunkpos, nbttagcompound);
}
catch (Exception exception)
{
LOGGER.error("Failed to save chunk", (Throwable)exception);
}
}
lvt_3_1_ = true;
}
finally
{
this.chunksBeingSaved.remove(chunkpos);
}
return lvt_3_1_;
}
}
private void writeChunkData(ChunkPos pos, NBTTagCompound compound) throws IOException
{
DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, pos.x, pos.z);
CompressedStreamTools.write(compound, dataoutputstream);
dataoutputstream.close();
}
/**
* Save extra data associated with this Chunk not normally saved during autosave, only during chunk unload.
* Currently unused.
*/
public void saveExtraChunkData(World worldIn, Chunk chunkIn) throws IOException
{
}
/**
* Called every World.tick()
*/
public void chunkTick()
{
}
/**
* Flushes all pending chunks fully back to disk
*/
public void flush()
{
try
{
this.flushing = true;
while (this.writeNextIO());
}
finally
{
this.flushing = false;
}
}
public static void registerFixes(DataFixer fixer)
{
fixer.registerWalker(FixTypes.CHUNK, new IDataWalker()
{
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
if (compound.hasKey("Level", 10))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("Level");
if (nbttagcompound.hasKey("Entities", 9))
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Entities", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
nbttaglist.set(i, fixer.process(FixTypes.ENTITY, (NBTTagCompound)nbttaglist.get(i), versionIn));
}
}
if (nbttagcompound.hasKey("TileEntities", 9))
{
NBTTagList nbttaglist1 = nbttagcompound.getTagList("TileEntities", 10);
for (int j = 0; j < nbttaglist1.tagCount(); ++j)
{
nbttaglist1.set(j, fixer.process(FixTypes.BLOCK_ENTITY, (NBTTagCompound)nbttaglist1.get(j), versionIn));
}
}
}
return compound;
}
});
}
/**
* Writes the Chunk passed as an argument to the NBTTagCompound also passed, using the World argument to retrieve
* the Chunk's last update time.
*/
private void writeChunkToNBT(Chunk chunkIn, World worldIn, NBTTagCompound compound)
{
compound.setInteger("xPos", chunkIn.x);
compound.setInteger("zPos", chunkIn.z);
compound.setLong("LastUpdate", worldIn.getTotalWorldTime());
compound.setIntArray("HeightMap", chunkIn.getHeightMap());
compound.setBoolean("TerrainPopulated", chunkIn.isTerrainPopulated());
compound.setBoolean("LightPopulated", chunkIn.isLightPopulated());
compound.setLong("InhabitedTime", chunkIn.getInhabitedTime());
ExtendedBlockStorage[] aextendedblockstorage = chunkIn.getBlockStorageArray();
NBTTagList nbttaglist = new NBTTagList();
boolean flag = worldIn.provider.hasSkyLight();
for (ExtendedBlockStorage extendedblockstorage : aextendedblockstorage)
{
if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Y", (byte)(extendedblockstorage.getYLocation() >> 4 & 255));
byte[] abyte = new byte[4096];
NibbleArray nibblearray = new NibbleArray();
NibbleArray nibblearray1 = extendedblockstorage.getData().getDataForNBT(abyte, nibblearray);
nbttagcompound.setByteArray("Blocks", abyte);
nbttagcompound.setByteArray("Data", nibblearray.getData());
if (nibblearray1 != null)
{
nbttagcompound.setByteArray("Add", nibblearray1.getData());
}
nbttagcompound.setByteArray("BlockLight", extendedblockstorage.getBlockLight().getData());
if (flag)
{
nbttagcompound.setByteArray("SkyLight", extendedblockstorage.getSkyLight().getData());
}
else
{
nbttagcompound.setByteArray("SkyLight", new byte[extendedblockstorage.getBlockLight().getData().length]);
}
nbttaglist.appendTag(nbttagcompound);
}
}
compound.setTag("Sections", nbttaglist);
compound.setByteArray("Biomes", chunkIn.getBiomeArray());
chunkIn.setHasEntities(false);
NBTTagList nbttaglist1 = new NBTTagList();
for (int i = 0; i < chunkIn.getEntityLists().length; ++i)
{
for (Entity entity : chunkIn.getEntityLists()[i])
{
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
if (entity.writeToNBTOptional(nbttagcompound2))
{
chunkIn.setHasEntities(true);
nbttaglist1.appendTag(nbttagcompound2);
}
}
}
compound.setTag("Entities", nbttaglist1);
NBTTagList nbttaglist2 = new NBTTagList();
for (TileEntity tileentity : chunkIn.getTileEntityMap().values())
{
NBTTagCompound nbttagcompound3 = tileentity.writeToNBT(new NBTTagCompound());
nbttaglist2.appendTag(nbttagcompound3);
}
compound.setTag("TileEntities", nbttaglist2);
List<NextTickListEntry> list = worldIn.getPendingBlockUpdates(chunkIn, false);
if (list != null)
{
long j = worldIn.getTotalWorldTime();
NBTTagList nbttaglist3 = new NBTTagList();
for (NextTickListEntry nextticklistentry : list)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
ResourceLocation resourcelocation = Block.REGISTRY.getNameForObject(nextticklistentry.getBlock());
nbttagcompound1.setString("i", resourcelocation == null ? "" : resourcelocation.toString());
nbttagcompound1.setInteger("x", nextticklistentry.position.getX());
nbttagcompound1.setInteger("y", nextticklistentry.position.getY());
nbttagcompound1.setInteger("z", nextticklistentry.position.getZ());
nbttagcompound1.setInteger("t", (int)(nextticklistentry.scheduledTime - j));
nbttagcompound1.setInteger("p", nextticklistentry.priority);
nbttaglist3.appendTag(nbttagcompound1);
}
compound.setTag("TileTicks", nbttaglist3);
}
}
/**
* Reads the data stored in the passed NBTTagCompound and creates a Chunk with that data in the passed World.
* Returns the created Chunk.
*/
private Chunk readChunkFromNBT(World worldIn, NBTTagCompound compound)
{
int i = compound.getInteger("xPos");
int j = compound.getInteger("zPos");
Chunk chunk = new Chunk(worldIn, i, j);
chunk.setHeightMap(compound.getIntArray("HeightMap"));
chunk.setTerrainPopulated(compound.getBoolean("TerrainPopulated"));
chunk.setLightPopulated(compound.getBoolean("LightPopulated"));
chunk.setInhabitedTime(compound.getLong("InhabitedTime"));
NBTTagList nbttaglist = compound.getTagList("Sections", 10);
int k = 16;
ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[16];
boolean flag = worldIn.provider.hasSkyLight();
for (int l = 0; l < nbttaglist.tagCount(); ++l)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(l);
int i1 = nbttagcompound.getByte("Y");
ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(i1 << 4, flag);
byte[] abyte = nbttagcompound.getByteArray("Blocks");
NibbleArray nibblearray = new NibbleArray(nbttagcompound.getByteArray("Data"));
NibbleArray nibblearray1 = nbttagcompound.hasKey("Add", 7) ? new NibbleArray(nbttagcompound.getByteArray("Add")) : null;
extendedblockstorage.getData().setDataFromNBT(abyte, nibblearray, nibblearray1);
extendedblockstorage.setBlockLight(new NibbleArray(nbttagcompound.getByteArray("BlockLight")));
if (flag)
{
extendedblockstorage.setSkyLight(new NibbleArray(nbttagcompound.getByteArray("SkyLight")));
}
extendedblockstorage.recalculateRefCounts();
aextendedblockstorage[i1] = extendedblockstorage;
}
chunk.setStorageArrays(aextendedblockstorage);
if (compound.hasKey("Biomes", 7))
{
chunk.setBiomeArray(compound.getByteArray("Biomes"));
}
NBTTagList nbttaglist1 = compound.getTagList("Entities", 10);
for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1)
{
NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j1);
readChunkEntity(nbttagcompound1, worldIn, chunk);
chunk.setHasEntities(true);
}
NBTTagList nbttaglist2 = compound.getTagList("TileEntities", 10);
for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1)
{
NBTTagCompound nbttagcompound2 = nbttaglist2.getCompoundTagAt(k1);
TileEntity tileentity = TileEntity.create(worldIn, nbttagcompound2);
if (tileentity != null)
{
chunk.addTileEntity(tileentity);
}
}
if (compound.hasKey("TileTicks", 9))
{
NBTTagList nbttaglist3 = compound.getTagList("TileTicks", 10);
for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1)
{
NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(l1);
Block block;
if (nbttagcompound3.hasKey("i", 8))
{
block = Block.getBlockFromName(nbttagcompound3.getString("i"));
}
else
{
block = Block.getBlockById(nbttagcompound3.getInteger("i"));
}
worldIn.scheduleBlockUpdate(new BlockPos(nbttagcompound3.getInteger("x"), nbttagcompound3.getInteger("y"), nbttagcompound3.getInteger("z")), block, nbttagcompound3.getInteger("t"), nbttagcompound3.getInteger("p"));
}
}
return chunk;
}
@Nullable
public static Entity readChunkEntity(NBTTagCompound compound, World worldIn, Chunk chunkIn)
{
Entity entity = createEntityFromNBT(compound, worldIn);
if (entity == null)
{
return null;
}
else
{
chunkIn.addEntity(entity);
if (compound.hasKey("Passengers", 9))
{
NBTTagList nbttaglist = compound.getTagList("Passengers", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
Entity entity1 = readChunkEntity(nbttaglist.getCompoundTagAt(i), worldIn, chunkIn);
if (entity1 != null)
{
entity1.startRiding(entity, true);
}
}
}
return entity;
}
}
@Nullable
public static Entity readWorldEntityPos(NBTTagCompound compound, World worldIn, double x, double y, double z, boolean attemptSpawn)
{
Entity entity = createEntityFromNBT(compound, worldIn);
if (entity == null)
{
return null;
}
else
{
entity.setLocationAndAngles(x, y, z, entity.rotationYaw, entity.rotationPitch);
if (attemptSpawn && !worldIn.spawnEntity(entity))
{
return null;
}
else
{
if (compound.hasKey("Passengers", 9))
{
NBTTagList nbttaglist = compound.getTagList("Passengers", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
Entity entity1 = readWorldEntityPos(nbttaglist.getCompoundTagAt(i), worldIn, x, y, z, attemptSpawn);
if (entity1 != null)
{
entity1.startRiding(entity, true);
}
}
}
return entity;
}
}
}
@Nullable
protected static Entity createEntityFromNBT(NBTTagCompound compound, World worldIn)
{
try
{
return EntityList.createEntityFromNBT(compound, worldIn);
}
catch (RuntimeException var3)
{
return null;
}
}
public static void spawnEntity(Entity entityIn, World worldIn)
{
if (worldIn.spawnEntity(entityIn) && entityIn.isBeingRidden())
{
for (Entity entity : entityIn.getPassengers())
{
spawnEntity(entity, worldIn);
}
}
}
@Nullable
public static Entity readWorldEntity(NBTTagCompound compound, World worldIn, boolean p_186051_2_)
{
Entity entity = createEntityFromNBT(compound, worldIn);
if (entity == null)
{
return null;
}
else if (p_186051_2_ && !worldIn.spawnEntity(entity))
{
return null;
}
else
{
if (compound.hasKey("Passengers", 9))
{
NBTTagList nbttaglist = compound.getTagList("Passengers", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
Entity entity1 = readWorldEntity(nbttaglist.getCompoundTagAt(i), worldIn, p_186051_2_);
if (entity1 != null)
{
entity1.startRiding(entity, true);
}
}
}
return entity;
}
}
} | [
"abderrahimlaribi@gmail.com"
] | abderrahimlaribi@gmail.com |
7437a4288668ae0810d2cf6bac8f6bce74bf40f4 | a0032242b56f811f57f1c94f4347b395170522f7 | /02.project/yc_medicine/src/com/kh/hsfs/dao/MeddetailCsaDao.java | b4297fbee3e4ab2b343fe2e3502f78acec068f67 | [] | no_license | shaoyangli/yc_medicine | 466e8d3890714c06ed3db57d08b9b63212ae91bf | 9b0d2bc831a906b6615cebb75807965662ff4023 | refs/heads/master | 2021-01-10T04:19:22.494643 | 2015-10-31T08:04:39 | 2015-10-31T08:04:39 | 44,322,670 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.kh.hsfs.dao;
import com.kh.hsfs.model.MeddetailCsa;
import com.kh.hsfs.model.MedicineCsa;
import com.kh.util.PageUtil;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: Administrator
* Date: 15-8-25
* Time:
* To change this template use File | Settings | File Templates.
*/
public interface MeddetailCsaDao {
public int saveCsa(MeddetailCsa t);
public List getByJdbcSQL(String sql);
// public PageUtil findBySqlPage(int currPage, int rows, String sql);
public int removeById(int id);
public MeddetailCsa findCsaById(int id);
// public void updateCsa(MeddetailCsa t);
}
| [
"shaoyang.work@gmail.com"
] | shaoyang.work@gmail.com |
b65887b218bd7139dd0fa0e2269b78ab225b6f71 | 46332651e992c330cbb7fa0efec5382a29ce6a08 | /src/GetInteger.java | 8c208a104e086f0311856e77ff18f5f68c7cbaeb | [] | no_license | dbemisderfer/codeup-java-exercises | 54b1892ee7c7ca96d106dba0539bd6fe969a3818 | 9605004e96f3f5102d4e9a04cf5f80d044a84b38 | refs/heads/master | 2020-04-30T01:53:56.367399 | 2019-06-17T03:21:44 | 2019-06-17T03:21:44 | 176,542,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 693 | java | import java.util.Scanner;
public class GetInteger {
public static void main(String[] args) {
getInteger(1, 10);
}
// Exercise 2
public static int getInteger(int min, int max) {
int output;
Scanner sc = new Scanner(System.in);
while(!sc.hasNextInt()){
System.out.printf("Invalid input. Enter a valid integer between %d and %d: %n", min, max);
sc.next();
}
output = sc.nextInt();
if(output < min || output > max) {
System.out.printf("Invalid range. Enter a valid integer between %d and %d: ", min, max);
return getInteger(min, max);
}
return output;
}
}
| [
"dwight.bemisderfer@gmail.com"
] | dwight.bemisderfer@gmail.com |
d0bee05f91f7301aafb4b13436a0672d70c1edff | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/LibriVox_app.librivox.android/javafiles/com/google/android/gms/internal/ads/mq.java | 3d1bdb22f324ce30ae520abab882621b5fbc660e | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.gms.internal.ads;
// Referenced classes of package com.google.android.gms.internal.ads:
// mi, ml
final class mq
{
mq(ml ml, mi mi)
{
a = mi;
// 0 0:aload_0
// 1 1:aload_2
// 2 2:putfield #10 <Field mi a>
super();
// 3 5:aload_0
// 4 6:invokespecial #13 <Method void Object()>
// 5 9:return
}
private final mi a;
}
| [
"silenta237@gmail.com"
] | silenta237@gmail.com |
5e3a3301bb20356b36c14337b1746f70cd10e84f | f0e304d92d6ff62c3aa4d2ea9be60080230255d6 | /bysj/src/main/java/com/sjtu/constant/Constant.java | 9f06c3043ca289d0b3381b45c7480c2c759f6998 | [] | no_license | scottdu/general_o2o | 00cdec2129a430c2ba9c066260fd1aad9756efc2 | 1a5eda62fc716fdf71ae2d80b895f758a3bf2a72 | refs/heads/master | 2021-01-10T04:55:18.242487 | 2015-09-27T12:30:41 | 2015-09-27T12:30:41 | 43,245,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package com.sjtu.constant;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.joran.spi.JoranException;
public class Constant
{
public static void GetParameters()
{
loadLogBackConfig();
}
public static void loadLogBackConfig()
{
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
try
{
configurator.doConfigure(Constant.class.getClassLoader().getResource("logback.xml"));
}
catch (JoranException e)
{
}
}
}
| [
"duzhengxing625@163.com"
] | duzhengxing625@163.com |
7288fdadac53698866b42d57382828a4f82c269f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_465140de86d7dbc4e3675858c3fdd32379d1bfc4/Container/11_465140de86d7dbc4e3675858c3fdd32379d1bfc4_Container_t.java | 3f71e89533912b1690af6cfa32decf5571819bb0 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,501 | java | /*
* Container.java
* ePub3
*
* Created by Pedro Reis Colaco (txtr) on 2013-05-29.
* Copyright (c) 2012-2013 The Readium Foundation and contributors.
*
* The Readium SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.readium.sdk.android;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import android.util.Log;
/**
* The Container class provides an interface for interacting with an EPUB container,
* i.e. a `.epub` file.
* <p/>
* Each Container instance owns all its sub-items. All Packages from a single container,
* for instance, are kept around as pointers which will be deleted when the container
* is destroyed.
*
* @remarks The Container class holds owning references to the Archive instance used
* to read from the zip file, the XML document for the OCF file at META-INF/container.xml,
* all Packages within the container, and all EncryptionInfo instances from
* META-INF/encryption.xml.
*/
public class Container {
/**
* Log tag
*/
private static final String TAG = Container.class.getName();
/**
* Native Container Pointer.
* DO NOT USE FROM JAVA SIDE!
*/
private final long __nativePtr;
/**
* The container path.
*/
private final String mPath;
/**
* List of Packages that belong to this container.
*/
private final List<Package> mPackages;
/**
* Know when we were closed already.
*/
private boolean mClosed = false;
/**
* Container version
*/
private String mVersion;
/**
* Constructor. Private to avoid instantiation on the Java side.
* @param nativePtr Native Container pointer.
* @param path Path string.
*/
private Container(long nativePtr, String path) {
// Log creation
Log.i(TAG, "Creating container [ptr:" + String.format("%X", nativePtr) + ", path:" + path + "]");
// Setup fields
__nativePtr = nativePtr;
mPath = path;
mPackages = new ArrayList<Package>();
}
@Override
protected void finalize() {
// If we are not closed yet?
if(!mClosed) {
close();
}
}
/*
* Methods to be used from native code
*/
/**
* Container creator method. Just to be used by ePub3 native code. To create
* a Container, the user should use EPub3.openBook(...)
* @param nativeContainerPtr Native Container pointer.
* @param path Path string.
* @return Created Container object.
*/
@SuppressWarnings("unused")
private static Container createContainer(long nativePtr, String path) {
Container container = new Container(nativePtr, path);
return container;
}
@SuppressWarnings("unused")
private static void addPackageToContainer(Container container, Package pack) {
container.addPackage(pack);
}
/*
* Public methods
*/
public static Container openContainer(String path) {
// TODO: Implement this
return null;
}
/**
* Closes this container and releases any data of it.
*/
public void close() {
if(!mClosed) {
// Log closing
Log.i(TAG, "Closing container [ptr:" + String.format("%X", __nativePtr) + ", path:" + mPath + "]");
// Release the native container
// We do this first to avoid warnings coming from the native pointer
// pool, due to releasing the native packages pointers while there was
// still a native pointer in the container pointing to each package.
// This way the native container is disposed completely and then the
// packages can be safely disposed without any warning.
EPub3.releaseNativePointer(__nativePtr);
// Close packages of this container
for( Package p : mPackages) {
p.close();
}
// Set closed
mClosed = true;
} else {
// Log error
Log.e(TAG, "Closing already closed container [ptr:" + String.format("%X", __nativePtr) + ", path:" + mPath + "]");
}
}
/**
* Returns the native Container pointer.
* DO NOT USE FROM JAVA SIDE UNLESS TO PASS TO NATIVE CODE!
* @return Native Container Pointer
*/
public long getNativePtr() {
return __nativePtr;
}
/**
* Adds a Package to this container.
* @param pack Package to be added.
*/
public void addPackage(Package pack) {
pack.setContainer(this);
mPackages.add(pack);
}
public Package getDefaultPackage() {
return mPackages.isEmpty() ? null : mPackages.get(0);
}
public List<Package> getPackages() {
return mPackages;
}
public String getVersion() {
return mVersion;
}
public String getPath() {
return mPath;
}
public String getName() {
return new File(mPath).getName();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e35ad33060916d17f1269943f62caff378b6f794 | ce32f785b20852da8065af4f943b821522d59fd3 | /QPMovil_V1/app/src/main/java/com/qpmovil/lec_barras.java | fbeb9318f89ca9a188a14a9c16c0f77f6526ef78 | [] | no_license | maxi2323/QPMovil | 81f1b9969f6ea25e262e0544cbbed4a18eb5044f | a4f9285d11df845ef462e052b44d5fad84196c34 | refs/heads/master | 2022-11-29T04:00:59.465412 | 2020-07-23T18:35:57 | 2020-07-23T18:35:57 | 260,313,475 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.qpmovil;
import android.app.Activity;
import androidx.fragment.app.Fragment;
import com.google.zxing.integration.android.IntentIntegrator;
public class lec_barras
{
public lec_barras(Activity actividad, Fragment Fragmento)
{
IntentIntegrator intent = new IntentIntegrator(actividad);
intent.forSupportFragment(Fragmento).setCameraId(0).setBeepEnabled(true).initiateScan();
}
}
| [
"guascomaxi@gmail.com"
] | guascomaxi@gmail.com |
943ae9315b0d7b69d7596ee2f03c839f37a4c445 | 20007b4766cac5290f50adc00956ba657754aa50 | /app/src/main/java/com/pingfly/faceclock/alarmclock/receiver/AlarmReceiver.java | fa17f95c9de7f49d209a81fd55f1ef1fb0560aaf | [] | no_license | CH3233546/faceclock | 9cb866ea86ebb27f84660e0d118d0c6918d034e9 | 1a454b0efa1e742c8a8b3ea1e13dd3f6ff0b87ea | refs/heads/master | 2023-03-18T17:35:35.581499 | 2020-08-30T15:42:24 | 2020-08-30T15:42:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,311 | java | package com.pingfly.faceclock.alarmclock.receiver;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.KeyguardManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.PowerManager;
import android.support.v7.app.AlertDialog;
import android.text.InputType;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.Toast;
import com.pingfly.faceclock.R;
import com.pingfly.faceclock.alarmclock.domain.AlarmClock;
import com.pingfly.faceclock.alarmclock.domain.AlarmInfo;
import com.pingfly.faceclock.alarmclock.service.AlarmRingService;
import com.pingfly.faceclock.alarmclock.util.PrefUtils;
import com.pingfly.faceclock.ui.activity.WakeUpActivity;
import com.pingfly.faceclock.util.LogUtils;
import java.lang.reflect.Field;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
import java.util.Random;
public class AlarmReceiver extends BroadcastReceiver {
private int lazylevel;
private String tag;
private Context context;
private int A;
private int B;
private int id;
private AlarmManager alarmManager;
private String getid;
private String resid;
private int[] dayOfWeek;
@Override
public void onReceive(Context context, Intent intent) {
this.context = context;
LogUtils.d("alarm", "收到广播");
getid = intent.getStringExtra("getid");
// 在两个Activity之间传递数据,最终都是通过Intent传递,但设置数据和保存数据方式有两种(使用Intent 和 Bundle)
//Bundle bundle = intent.getExtras();
Bundle bundle = intent.getBundleExtra("bundle");
// key-value形式
if (bundle != null) {
AlarmInfo currentAlarm = (AlarmInfo) Objects.requireNonNull(bundle).getSerializable("alarminfo");
lazylevel = Objects.requireNonNull(currentAlarm).getLazyLevel();
tag = currentAlarm.getTag();
dayOfWeek = currentAlarm.getDayOfWeek();
resid = currentAlarm.getRingResId();
}
id = intent.getIntExtra("alarmid", 0);
//先进行判断今天该闹钟是否该响
//需要的数据是 赖床级数 标签 铃声
LogUtils.d("alarm", dayOfWeek[0] + "dayofweek0");
LogUtils.d("alarm", "cancel" + intent.getBooleanExtra("cancel", false));
if (intent.getBooleanExtra("cancel", false)) {
cancelAlarm(intent);
return;
}
if (dayOfWeek[0] == 0) {
wakePhoneAndUnlock();
ringAlarm();
PrefUtils.putBoolean(context, getid, false);
} else {
LogUtils.d("alarm", "执行else" + dayOfWeek.length);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
int currentDay = calendar.get(Calendar.DAY_OF_WEEK) - 1;
for (int i = 0; i < dayOfWeek.length; i++) {
LogUtils.d("alarm", dayOfWeek[i] + ";" + currentDay);
if (dayOfWeek[i] == 7) {
dayOfWeek[i] = 0;
}
if (currentDay == dayOfWeek[i]) {
LogUtils.d("alarm", dayOfWeek[i] + ";" + currentDay);
wakePhoneAndUnlock();
ringAlarm();
}
}
runAlarmAgain(intent, getid);
}
}
private void cancelAlarm(Intent intent) {
LogUtils.d("alarm", "取消闹钟");
alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
PendingIntent pi = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.cancel(pi);
}
private void runAlarmAgain(Intent intent, String id) {
//未完成
LogUtils.d("alarm", "再次启动闹钟");
AlarmClock alarmClock = new AlarmClock(context);
alarmClock.turnAlarm(null, getid, true);
/*alarmManager= (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
PendingIntent pi=PendingIntent.getBroadcast(context,id,intent,0);
Calendar c=Calendar.getInstance();
if(hour!=-1&&minute!=-1){
c.set(Calendar.HOUR_OF_DAY,hour);
c.set(Calendar.MINUTE,minute);
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND, 0);
}else{
c.setTimeInMillis(System.currentTimeMillis());
}
if(c.getTimeInMillis()<System.currentTimeMillis()){
if(Build.VERSION.SDK_INT>=19)
{
alarmManager.setExact(AlarmManager.RTC_WAKEUP, c.getTimeInMillis() + 24 * 60 * 60 * 1000, pi);
}else{
alarmManager.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis() + 24 * 60 * 60 * 1000, pi);
}
}else {
if (Build.VERSION.SDK_INT >= 19) {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi);
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi);
}
}*/
}
//点亮屏幕并解锁
private void wakePhoneAndUnlock() {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
@SuppressLint("InvalidWakeLockTag")
PowerManager.WakeLock mWakelock = Objects.requireNonNull(pm).newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK, "WakeLock");
mWakelock.acquire(10 * 60 * 1000L /*10 minutes*/);//唤醒屏幕
//......
KeyguardManager mManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
KeyguardManager.KeyguardLock mKeyguardLock = Objects.requireNonNull(mManager).newKeyguardLock("Lock");
//让键盘锁失效
mKeyguardLock.disableKeyguard();
mWakelock.release();//释放
}
private void ringAlarm() {
//if(PrefUtils.getBoolean(context, ConsUtils.SHOULD_WETHER_CLOSE,false)){
//如果用户关闭了天气 不再弹出Activity;
//}else{
//打开天气提示
Intent intent = new Intent(context, WakeUpActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
//}
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
Date date = calendar.getTime();
LogUtils.d("alarm", "收到广播的时间" + date.toString());
showAlarmDialog();
LogUtils.d("alarm", "赖床指数" + lazylevel + "," + tag + ",");
}
/**
* 展示闹钟对话框
*/
private void showAlarmDialog() {
//启动并绑定AlarmRingService
final Intent service = new Intent(context, AlarmRingService.class);
service.putExtra("resid", resid);
context.startService(service);
LogUtils.d("alarm", "初始化dialog");
View edit = View.inflate(context, R.layout.dialog_tag, null);
final EditText Input = (EditText) edit.findViewById(R.id.et_tag);
Input.setInputType(InputType.TYPE_CLASS_NUMBER);
// 对话框构造器
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(tag);
String message = "美好的一天开始啦";
//当赖床指数高于0时
int rightAnswer = 0;
if (lazylevel > 0) {
rightAnswer = youCantSleep();
builder.setView(edit);
message = "还睡?!来做题:" + A + "×" + B + "=?";
}
builder.setMessage(message);
builder.setCancelable(false);
final int finalRightAnswer = rightAnswer;
builder.setPositiveButton("确定", (dialog, which) -> {
Field field = null;
try {
field = dialog.getClass()
.getSuperclass().getDeclaredField(
"mShowing");
field.setAccessible(true);
// 将mShowing变量设为false,表示对话框已关闭
field.set(dialog, false);
dialog.dismiss();
} catch (Exception e) {
// TODO Auto-generated catch block
}
if (lazylevel == 0) {
try {
Objects.requireNonNull(field).set(dialog, true);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
dialog.dismiss();
// context.unbindService(conn);
context.stopService(service);
} else {
if (Input.getText().toString().equals("") || Input.getText().toString() == null) {
Toast.makeText(context, "想交白卷?~", Toast.LENGTH_SHORT).show();
} else {
int result = Integer.parseInt(Input.getText().toString());
if (result == finalRightAnswer) {
try {
Objects.requireNonNull(field).set(dialog, true);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
//正确
dialog.dismiss();
// context.unbindService(conn);
context.stopService(service);
Toast.makeText(context, "Morning~", Toast.LENGTH_SHORT).show();
} else {
Input.setText("");
Toast.makeText(context, "再清醒一点要死吗?", Toast.LENGTH_SHORT).show();
}
}
}
});
AlertDialog dialog = builder.create();
WindowManager.LayoutParams params = Objects.requireNonNull(dialog.getWindow())
.getAttributes();
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
dialog.getWindow().setAttributes(params);
dialog.getWindow().getAttributes().gravity = Gravity.CENTER;
LogUtils.d("alarm", "dialogshow");
dialog.show();
}
private int youCantSleep() {
Random a = new Random();
if (lazylevel == 1) {
A = a.nextInt(20) + 5;
B = a.nextInt(20) + 5;
} else if (lazylevel == 2) {
A = a.nextInt(99) + 1;
B = a.nextInt(99) + 1;
while (B < 50) B = B + 10;
} else if (lazylevel == 3) {
A = a.nextInt(200) + 1;
B = a.nextInt(200) + 1;
while (B < 80) {
B = B + 10;
}
while (A < 80) {
A = A + 10;
}
} else if (lazylevel == 4) {
A = a.nextInt(500) + 1;
B = a.nextInt(500) + 1;
while (B < 80) {
B = B + 10;
}
while (A < 200) {
A = A + 30;
}
}
return A * B;
}
}
| [
"1010845659@qq.com"
] | 1010845659@qq.com |
c5b93ff5938334c0243b710f0ef91b7da374ab17 | 241f0a322f17988fa2a08fca7b1f0d66c59f46c7 | /core/src/com/mantropova/gamex/objects/Mole.java | c65fc859ed2ff6d17b98229bafec945d0c9ac056 | [] | no_license | marina2209/FunnyBeavers | f97675770b7ea58a9fad54254f85afb71b580cf8 | 7b95c92df5f28bbe84e33a8095cd239ffcc9611d | refs/heads/master | 2022-01-24T20:43:33.752379 | 2019-05-26T20:15:23 | 2019-05-26T20:15:23 | 179,814,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,510 | java | package com.mantropova.gamex.objects;
/**
* Created by Antropova Marina on 22.04.2019.
*/
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.mantropova.gamex.helpers.AssetsLoader;
import java.util.*;
public class Mole extends Actor {
private Sprite img;
private Sprite imgAlive;
private Sprite imgDead;
public Timer timer = new Timer();
private int currentHealth;
public boolean isDead = true;
private Sound sound1;
private Player player;
private int damage;
private int health;
public Mole(float ourX, float ourY, final Player player, int health, int damage,
final boolean isMusicOn) {
this.player = player;
this.damage = damage;
this.health = health;
currentHealth = health;
AssetsLoader assets = AssetsLoader.getInstance();
if (assets.moleDead == null)
throw new NullPointerException("moleDead texture");
Texture imgDead_texture = assets.moleDead;
imgDead = new Sprite(imgDead_texture);
imgDead.setSize((float) Gdx.graphics.getHeight() * 15 / 100,
(float) Gdx.graphics.getHeight() * 15 / 100);
if (assets.moleAlive == null)
throw new NullPointerException("moleAlive texture");
Texture imgAlive_texture = assets.moleAlive;
imgAlive = new Sprite(imgAlive_texture);
imgAlive.setSize((float) Gdx.graphics.getHeight() * 15 / 100,
(float) Gdx.graphics.getHeight() * 15 / 100);
img = imgDead;
sound1 = assets.sound1;
addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
currentHealth -= player.attack();
if (isMusicOn && (sound1 != null)) {
sound1.play();
sound1.setVolume(1, 1f);
}
return true;
}
});
setTouchable(Touchable.disabled);
}
@Override
public void setBounds(float x, float y, float width, float height) {
super.setBounds(x, y, width, height);
this.imgAlive.setPosition(x, y);
this.imgDead.setPosition(x, y);
}
void escaping() {
isDead = true;
player.getHurted(damage);
}
@Override
public void draw(Batch batch, float alpha) {
if (isDead)
this.imgDead.draw(batch);
else
this.imgAlive.draw(batch);
}
public void update(float delta) {
if (currentHealth < 1) {
currentHealth = health;
isDead = true;
player.moleKilled++;
setTouchable(Touchable.disabled);
timer.cancel();
img = imgDead;
}
}
public void resurrect() {
isDead = false;
setTouchable(Touchable.enabled);
timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
escaping();
}
}, 2500);
}
public Sprite getImg() {
return this.imgAlive;
}
} | [
"a-marry@mail.ru"
] | a-marry@mail.ru |
3da9fbd8b7c96a52899d5ecf87cc763c57443f84 | c766b9dec8b7e6bc5a0138ffecb23e408c4c403d | /TelekomSportUnofficial/src/main/java/de/berdsen/telekomsport_unofficial/ui/presenter/DefaultCardPresenter.java | bbd5c2e40edfadd0f3c8f10c23066e8767a17a69 | [
"MIT"
] | permissive | OllO18/telekom-sport-android-tv-unofficial | 375e098ee774e34707c2430995b86a3b494b78b0 | ef274e32345cbf5d84bb5f6d2b54f4aed5577334 | refs/heads/master | 2020-08-03T17:28:53.384134 | 2019-09-24T18:35:39 | 2019-09-24T18:35:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,010 | java | package de.berdsen.telekomsport_unofficial.ui.presenter;
import android.graphics.Color;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
import de.berdsen.telekomsport_unofficial.services.PicassoCache;
/**
* Created by Berdsen on 09.10.2017.
*/
public class DefaultCardPresenter extends Presenter {
private PicassoCache picassoCache;
private final int WIDTH = 320;
private final int HEIGHT = 240;
private final int PADDING = 5;
public DefaultCardPresenter(PicassoCache picassoCache) {
this.picassoCache = picassoCache;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
ImageCardView cardView = new ImageCardView( parent.getContext() );
cardView.setFocusable( true );
return new DefaultCardPresenterViewHolder(cardView, picassoCache);
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, Object item) {
DefaultCardItem cardItem = (DefaultCardItem) item;
DefaultCardPresenterViewHolder holder = (DefaultCardPresenterViewHolder) viewHolder;
ImageCardView cardView = holder.getCardView();
cardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
cardView.setBackgroundColor(Color.TRANSPARENT);
cardView.setTitleText(cardItem.getTitle());
cardView.setContentDescription(cardItem.getDescription());
cardView.setMainImageDimensions( WIDTH, HEIGHT);
if (cardItem.getImageResourceId() != 0) {
holder.updateCardViewImage( cardItem.getImageResourceId() );
} else if (!TextUtils.isEmpty(cardItem.getImageUrl())){
holder.updateCardViewImage( cardItem.getImageUrl() );
}
}
@Override
public void onUnbindViewHolder(ViewHolder viewHolder) {
DefaultCardPresenterViewHolder holder = (DefaultCardPresenterViewHolder) viewHolder;
ImageCardView cardView = holder.getCardView();
// TODO: release resources
}
private class DefaultCardPresenterViewHolder extends AbstractBaseCardViewHolder {
private Picasso picasso;
public DefaultCardPresenterViewHolder(ImageCardView cardView, PicassoCache picassoCache) {
super(cardView);
picasso = picassoCache.getPicassoCacheInstance();
}
public void updateCardViewImage(String link ) {
picasso.load(link)
.resize(WIDTH - PADDING, HEIGHT - PADDING)
.centerInside()
.into(mCardView.getMainImageView());
}
public void updateCardViewImage(int imageId ) {
picasso.load(imageId)
.resize(WIDTH - PADDING, HEIGHT - PADDING)
.centerInside()
.into(mCardView.getMainImageView());
}
}
}
| [
"berdsen.home@gmail.com"
] | berdsen.home@gmail.com |
72528950ccc40c6f52f145f6e707490750e49d68 | 4f3920fb49b66c1e974ea1e88b972fcc5baf1069 | /app/src/main/java/com/fun/hearthstonekillcalculatorv20/fishmen/MoreSevenActivity.java | 2547d41d81c356caa5a7b186b209a0c9cfd8550b | [] | no_license | hfrommane/HearthStoneKillCalculator-Android | 5c6502fee1f78052450b88fb0a06a2f9a39d7b3d | aba486a0fdc9dbfff944704f8e0da9d3c99bd520 | refs/heads/master | 2016-09-12T13:16:35.630070 | 2016-04-30T10:00:39 | 2016-04-30T10:00:39 | 57,349,446 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,284 | java | package com.fun.hearthstonekillcalculatorv20.fishmen;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.TextView;
import com.fun.hearthstonekillcalculatorv20.R;
import com.fun.hearthstonekillcalculatorv20.model.FishMen;
import com.fun.hearthstonekillcalculatorv20.utils.Combination;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by HZF on 2016/4/26.
*/
public class MoreSevenActivity extends AppCompatActivity {
private static final String TAG = MoreSevenActivity.class.getSimpleName();
private int numOfFishMen;
private int numOfBluegillWarrior;
private int numOfMurlocWarleader;
private int numOfOldMurkEye;
private List<Integer> kill;
private int minimum;
private double count;
private double percentage;
private List<FishMen> fishMen;
@Bind(R.id.tv_numOfFishMen)
TextView tvNumOfFishMen;
@Bind(R.id.tv_numOfBluegillWarrior)
TextView tvNumOfBluegillWarrior;
@Bind(R.id.tv_numOfMurlocWarleader)
TextView tvNumOfMurlocWarleader;
@Bind(R.id.tv_numOfOldMurkEye)
TextView tvNumOfOldMurkEye;
@Bind(R.id.tv_kill)
TextView tvKill;
@Bind(R.id.tv_probability)
TextView tvProbability;
@Bind(R.id.bt_detail)
Button btDetail;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fish_more);
ButterKnife.bind(this);
Intent intent = getIntent();
numOfFishMen = intent.getIntExtra("numOfFishMen", 0);
numOfBluegillWarrior = intent.getIntExtra("numOfBluegillWarrior", 0);
numOfMurlocWarleader = intent.getIntExtra("numOfMurlocWarleader", 0);
numOfOldMurkEye = intent.getIntExtra("numOfOldMurkEye", 0);
caculateKill();
initView();
}
private void caculateKill() {
int[] num = new int[numOfFishMen];
int m = 7;
for (int i = 0; i < numOfBluegillWarrior; i++) {
num[i] = i;
}
for (int i = 0; i < numOfMurlocWarleader; i++) {
num[numOfBluegillWarrior + i] = i + 4;
}
for (int i = 0; i < numOfOldMurkEye; i++) {
num[numOfBluegillWarrior + numOfMurlocWarleader + i] = i + 8;
}
List<List<String>> listOfFishmen = new ArrayList<>();
List list = Combination.combine(num, m);
for (int i = 0; i < list.size(); i++) {
int[] a = (int[]) list.get(i);
List<String> fishmen = new ArrayList<>();
for (int j = 0; j < a.length; j++) {
//System.out.print(a[j] + "\t");
if (a[j] == 0 || a[j] == 1 || a[j] == 2 || a[j] == 3) {
fishmen.add("b");
}
if (a[j] == 4 || a[j] == 5 || a[j] == 6 || a[j] == 7) {
fishmen.add("l");
}
if (a[j] == 8 || a[j] == 9) {
fishmen.add("o");
}
}
listOfFishmen.add(fishmen);
}
kill = new ArrayList();
fishMen = new ArrayList<>();
for (int i = 0; i < listOfFishmen.size(); i++) {
caculateKillForEach(listOfFishmen.get(i));
}
int[] killArray = new int[kill.size()];
for (int i = 0; i < killArray.length; i++) {
killArray[i] = kill.get(i);
}
Arrays.sort(killArray);
minimum = killArray[0];
for (int i = 0; i < killArray.length; i++) {
if (minimum == killArray[i]) {
count++;
}
}
double killArrayLength = killArray.length;
percentage = Math.round(count / killArrayLength * 100);
}
private void caculateKillForEach(List<String> listOfOneFishmen) {
int reBirthBluegillWarrior = 0;
int reBirthMurlocWarleader = 0;
int reBirthOldMurkEye = 0;
for (int i = 0; i < listOfOneFishmen.size(); i++) {
String fishName = listOfOneFishmen.get(i);
if ("b".equals(fishName)) {
reBirthBluegillWarrior++;
} else if ("l".equals(fishName)) {
reBirthMurlocWarleader++;
} else if ("o".equals(fishName)) {
reBirthOldMurkEye++;
}
}
int total;
int eachBluegillWarrior;
int kiiOfBluegillWarrior;
int eachOldMurkEye;
int killOfOldMurkEye;
eachBluegillWarrior = reBirthBluegillWarrior == 0 ? 0 : 2 + reBirthMurlocWarleader * 2;
kiiOfBluegillWarrior = eachBluegillWarrior * reBirthBluegillWarrior;
eachOldMurkEye = reBirthOldMurkEye == 0 ? 0 : 2 + reBirthMurlocWarleader * 2 + 7 - 1;
killOfOldMurkEye = (eachOldMurkEye) * reBirthOldMurkEye;
total = kiiOfBluegillWarrior + killOfOldMurkEye;
kill.add(total);
FishMen fish = new FishMen();
fish.setReBirthBluegillWarrior(reBirthBluegillWarrior);
fish.setReBirthMurlocWarleader(reBirthMurlocWarleader);
fish.setReBirthOldMurkEye(reBirthOldMurkEye);
fish.setEachBluegillWarrior(eachBluegillWarrior);
fish.setEachOldMurkEye(eachOldMurkEye);
fish.setTotal(total);
fishMen.add(fish);
}
private void initView() {
tvNumOfFishMen.setText(String.valueOf(numOfFishMen));
tvNumOfBluegillWarrior.setText(String.valueOf(numOfBluegillWarrior));
tvNumOfMurlocWarleader.setText(String.valueOf(numOfMurlocWarleader));
tvNumOfOldMurkEye.setText(String.valueOf(numOfOldMurkEye));
tvKill.setText(String.valueOf(minimum));
tvProbability.setText(percentage + "%");
}
@OnClick(R.id.bt_detail)
public void onClick() {
Intent intent = new Intent(MoreSevenActivity.this, DetailActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("fishMen", (Serializable) fishMen);
intent.putExtras(bundle);
startActivity(intent);
}
}
| [
"chenjiao@ydtfmail.yn.csg.cn"
] | chenjiao@ydtfmail.yn.csg.cn |
28c48776be8e1e449de97ddcb4b5c57cda261d6e | 62e334192393326476756dfa89dce9f0f08570d4 | /tk_code/one-service/one-server/src/main/java/com/huatu/one/biz/vo/DataAchievementV1Response.java | 5382211a16e1734ca53e1fccfd2bde663f38448a | [] | no_license | JellyB/code_back | 4796d5816ba6ff6f3925fded9d75254536a5ddcf | f5cecf3a9efd6851724a1315813337a0741bd89d | refs/heads/master | 2022-07-16T14:19:39.770569 | 2019-11-22T09:22:12 | 2019-11-22T09:22:12 | 223,366,837 | 1 | 2 | null | 2022-06-30T20:21:38 | 2019-11-22T09:15:50 | Java | UTF-8 | Java | false | false | 730 | java | package com.huatu.one.biz.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 大数据报表
*
* @author geek-s
* @date 2019-09-12
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DataAchievementV1Response {
/**
* 业绩类型
*/
private String name;
/**
* 数据
*/
private List<ReportData> rows;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class ReportData {
/**
* 本周数据
*/
private String week;
/**
* 本月数据
*/
private String month;
}
}
| [
"jelly_b@126.com"
] | jelly_b@126.com |
ee90d23baa8cfe7e92bbe3a902f35b91fd59782b | 0a01f38995577d54067e18e39c9b97bd773afabb | /McgProject Maven Webapp/src/main/java/com/insure/ReportTest.java | 82b0823bbad5f7f59b304736900cd5cfff2bf23b | [] | no_license | mcg11/McgProject | 8c4833f165ee9af06c638f02f2806503db008f03 | 08cd4100722094552eb59fb7d3ee2a50182e6929 | refs/heads/master | 2022-07-15T09:59:19.831073 | 2020-10-23T06:40:49 | 2020-10-23T06:40:49 | 69,450,598 | 0 | 0 | null | 2022-06-28T15:29:20 | 2016-09-28T09:59:58 | Java | UTF-8 | Java | false | false | 4,020 | java | package com.insure;
import com.account.APITest.EncryptionUtil;
import com.alibaba.fastjson.JSON;
import com.util.HttpRequestClient;
import com.ziroom.common.util.NetUtil;
import net.sf.json.JSONObject;
import org.junit.Test;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
/**
* Created by macg11 on 2019/11/4.
*/
public class ReportTest {
// 获取流水号
String tradeNo = "";
@Test
public void testReoprt()throws Exception{
// json数据
Map<String,Object> map = new HashMap<String, Object>();
map.put("zrReportNo", "ZR20190220001107");
map.put("accidentTime", "2019-10-12 10:22:22");
map.put("accidentReason", "洗衣机泡水");
map.put("houseNo", "BJW15911806");
map.put("oneCode", "42");
map.put("twoCode", "43");
map.put("operName", "管家1");
map.put("operCode", "20282202");
map.put("operPhone", "15899999999");
map.put("parentReportNo", "no");
map.put("isInjured", "0");
List<AttReq> attReqs=new ArrayList<AttReq>();
AttReq vo=new AttReq();
// vo.setAttType(1);
vo.setAttUrl("http://10.16.34.42:8080/group3/M00/0C/72/ChAiKlrJeb-ADieIAAJujZIXTI0887.png");
vo.setStuffType("200");
attReqs.add(vo);
vo=new AttReq();
// vo.setAttType(1);
vo.setAttUrl("http://10.16.34.42:8080/group3/M00/0C/76/ChAiKlrMkHqAS2AXAAPpTv-WneE267.png");
vo.setStuffType("210");
attReqs.add(vo);
map.put("attList", JSON.toJSONString(attReqs));
// vo.setAttType(1);
vo.setAttUrl("http://10.16.34.42:8080/group3/M00/0C/76/ChAiKlrMkHqAS2AXAAPpTv-WneE267.png");
vo.setStuffType("220");
attReqs.add(vo);
map.put("attList", JSON.toJSONString(attReqs));
ContractPeopleVo contractPeopleVo=new ContractPeopleVo();
List<ContractPeopleVo> vos=new ArrayList<ContractPeopleVo>();
contractPeopleVo.setContactAmount("33");
contractPeopleVo.setContactPeopleName("小米");
contractPeopleVo.setContactPhone("15822223333");
vos.add(contractPeopleVo);
map.put("contactPeopleList", JSON.toJSONString(vos));
List<TInjuredPerson> injuredPeopleList=new ArrayList<TInjuredPerson>();
TInjuredPerson person=new TInjuredPerson();
person.setInjuredAge("23");
person.setInjuredAmount(new BigDecimal(33));
person.setInjuredCardNo("330781198509070175");
person.setInjuredCardType("01");
person.setInjuredName("胡梅3");
person.setInjuredSex(1);
injuredPeopleList.add(person);
map.put("injuredPersonList",JSON.toJSONString(injuredPeopleList));
// 加密
// String refundUrl = "http://insure.t.ziroom.com:8081/api/report/addReport";//本地
String refundUrl = "http://insure.t.ziroom.com/api/report/addReport";
String resultContent = HttpRequestClient.postRequest(refundUrl, map);
System.out.println(resultContent);
}
@Test
public void buchong()throws Exception{
// json数据
Map<String,Object> map = new HashMap<String, Object>();
map.put("jsonAttment", "[{\"addTime\":1573027367679,\"caseType\":1,\"id\":769,\"stuffType\":\"200\",\"url\":\"http://10.16.34.42:8080/group3/M00/0C/72/ChAiKlrJeb-ADieIAAJujZIXTI0887.png\",\"zrReportNo\":\"ZR20190220002858\"},{\"addTime\":1573027367679,\"caseType\":1,\"id\":770,\"stuffType\":\"210\",\"url\":\"http://10.16.34.42:8080/group3/M00/0C/76/ChAiKlrMkHqAS2AXAAPpTv-WneE267.png\",\"zrReportNo\":\"ZR20190220002858\"}]");
map.put("jtReportNo", "AJ20191106160248236186199");
// 加密
// String refundUrl = "http://insure.t.ziroom.com:8081/api/report/addReport";//本地
String refundUrl = "http://insure.t.ziroom.com/api/report/uploadBuJob";
String resultContent = HttpRequestClient.postRequest(refundUrl, map);
System.out.println(resultContent);
}
}
| [
"macg11@ziroom.com"
] | macg11@ziroom.com |
72ca9fc04f79003b83c5fc591837bf30896d9db5 | fe82064ac15594357cec6af872101c3d3c325e84 | /src/main/java/com/dxy/blog/service/VoteService.java | e7cba86985d231532d67c53d2facdad2aefa02a2 | [] | no_license | duanxingyu/blog | f884e58fdc520392f4ea743d666c7bd3284e4f81 | d4efd4b93899e7fd260307183b108d1a0128139a | refs/heads/master | 2021-04-09T17:01:04.688677 | 2018-04-16T10:18:08 | 2018-04-16T10:18:08 | 125,708,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.dxy.blog.service;
import com.dxy.blog.entity.Vote;
/**
* Vote 服务接口.
*
* @since 1.0.0 2017年4月9日
* @author <a href="https://waylau.com">Way Lau</a>
*/
public interface VoteService {
/**
* 根据id获取 Vote
* @param id
* @return
*/
Vote getVoteById(Long id);
/**
* 删除Vote
* @param id
* @return
*/
void removeVote(Long id);
}
| [
"349148323@qq.com"
] | 349148323@qq.com |
da344928d6cf66fbbdb7fec0057cc4494d9668a5 | fa5d1e3906ad7d0b4081f4c3ffe4e9a1a7477a98 | /src/com/acidmanic/pactdoc/dcoumentstructure/propertymappers/EndpointFromServicePropertyMapper.java | fe10db7b59245a6df9e0a577241f1ee95b8c6cab | [
"MIT"
] | permissive | Acidmanic/PactDoc | 565518742b8cb1bb92c897f6fd7b654b62861fff | 8f94960f443ce41f59c1f65d25366dce71effbcf | refs/heads/master | 2023-04-06T12:30:31.125849 | 2022-10-23T21:50:43 | 2022-10-23T21:50:43 | 173,136,406 | 0 | 1 | MIT | 2023-03-27T22:18:37 | 2019-02-28T15:24:31 | Java | UTF-8 | Java | false | false | 1,739 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.acidmanic.pactdoc.dcoumentstructure.propertymappers;
import com.acidmanic.document.structure.propertymapped.PropertyMapper;
import com.acidmanic.pact.models.Service;
import com.acidmanic.pactdoc.dcoumentstructure.namextractors.EndpointNameExtractor;
import com.acidmanic.pactdoc.utility.LinQ;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author diego
*/
public class EndpointFromServicePropertyMapper implements PropertyMapper {
@Override
public List<String> keySegmentValues(Object parent) {
if (parent instanceof Service) {
Service service = (Service) parent;
if (service.getEndpoints() != null) {
EndpointNameExtractor extractor = new EndpointNameExtractor();
return LinQ.select(service.getEndpoints(), ep -> extractor.extract(ep));
}
}
return new ArrayList<>();
}
@Override
public String keySegmentName() {
return "Service";
}
@Override
public Class parentType() {
return Service.class;
}
@Override
public Object propertyValue(Object parent, String keySegmentValue) {
if (parent instanceof Service) {
Service service = (Service) parent;
if (service.getEndpoints() != null) {
EndpointNameExtractor extractor = new EndpointNameExtractor();
return LinQ.first(service.getEndpoints(), ep -> keySegmentValue.equals(extractor.extract(ep)));
}
}
return null;
}
}
| [
"acidmanic.moayedi@gmail.com"
] | acidmanic.moayedi@gmail.com |
322515a1af2bdd97bca4bebf8437308c1ec7a9d0 | 4c196133155ad9c9c202599d569a8b1c4b322247 | /src/main/java/com/irevest/common/utils/ImageUtils.java | ad8abcfb77491931c907e45129560ef263dae6c1 | [] | no_license | huhaichao/irevest | a40359872d72ec0eac51fbc982a862b24fefe6e8 | c232008713a506bba2541935cbbce7b90f8c9e30 | refs/heads/master | 2020-04-11T18:38:32.248591 | 2018-12-16T14:44:15 | 2018-12-16T14:44:25 | 162,006,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,387 | java | package com.irevest.common.utils;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
/**
* @author gaoyuzhe
* @date 2017/12/18.
*/
public class ImageUtils {
/***
* 剪裁图片
* @param file 图片
* @param x 起点横坐标
* @param y 纵坐标
* @param w 长
* @param h 高
* @throws IOException
* @date
*/
public static BufferedImage cutImage(MultipartFile file, int x, int y, int w, int h,String prefix) {
Iterator iterator = ImageIO.getImageReadersByFormatName(prefix);
try {
ImageReader reader = (ImageReader)iterator.next();
//转换成输入流
InputStream in = file.getInputStream();
ImageInputStream iis = ImageIO.createImageInputStream(in);
reader.setInput(iis, true);
ImageReadParam param = reader.getDefaultReadParam();
Rectangle rect = new Rectangle(x, y, w,h);
param.setSourceRegion(rect);
BufferedImage bi = reader.read(0,param);
return bi;
} catch (Exception ignored) {
}
return null;
}
/***
* 图片旋转指定角度
* @param bufferedimage 图像
* @param degree 角度
* @return
* @date
*/
public static BufferedImage rotateImage(BufferedImage bufferedimage, int degree) {
int w = bufferedimage.getWidth();
int h = bufferedimage.getHeight();
int type = bufferedimage.getColorModel().getTransparency();
BufferedImage img;
Graphics2D graphics2d;
(graphics2d = (img = new BufferedImage(w, h, type))
.createGraphics()).setRenderingHint(
RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2d.setPaint(Color.WHITE);
graphics2d.fillRect(0, 0, w, h);
graphics2d.rotate(Math.toRadians(degree), w / 2, h / 2);
graphics2d.drawImage(bufferedimage, 0, 0,Color.WHITE, null);
graphics2d.dispose();
return img;
}
}
| [
"chao.hu@okcoin.com"
] | chao.hu@okcoin.com |
3366b0504d574e0725f8a547ffa9a40541f0f5ca | 5bd989faa9cd02b1facdbc3887b36e6c6509d4a4 | /meta-descriptor-base/src/main/java/com/taoswork/tallycheck/descriptor/metadata/processor/handler/fields/basics/_StringFieldHandler.java | 7d238c5f9e94e3d74742c65d9419e3620ebb1776 | [
"Apache-2.0"
] | permissive | tallycheck/data-support | f41d427376e8a5b50c5fc39a868f8bccb0794d49 | c135f8dd5fde6cead8396b8a856352c0581e9f65 | refs/heads/master | 2021-01-18T22:41:10.071556 | 2017-03-20T17:04:53 | 2017-03-20T17:04:53 | 61,171,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | package com.taoswork.tallycheck.descriptor.metadata.processor.handler.fields.basics;
import com.taoswork.tallycheck.descriptor.metadata.fieldmetadata.BasicFieldMetaObject;
import com.taoswork.tallycheck.descriptor.metadata.fieldmetadata.FieldMetaMediate;
import com.taoswork.tallycheck.descriptor.metadata.fieldmetadata.basic.StringFieldMeta;
import com.taoswork.tallycheck.descriptor.metadata.processor.ProcessResult;
import com.taoswork.tallycheck.descriptor.metadata.processor.handler.basic.BaseFieldHandler;
import java.lang.reflect.Field;
/**
* Created by Gao Yuan on 2015/5/25.
*/
class _StringFieldHandler extends BaseFieldHandler {
@Override
protected boolean canProcess(Field field, FieldMetaMediate metaMediate) {
if (String.class.equals(field.getType())) {
if (metaMediate.noSeed()) {
return true;
}
}
return false;
}
@Override
protected ProcessResult doProcess(Field field, FieldMetaMediate metaMediate) {
BasicFieldMetaObject bfmo = metaMediate.getBasicFieldMetaObject();
StringFieldMeta.Seed seed = new StringFieldMeta.Seed();
seed.setLength(bfmo.getLength());
metaMediate.setMetaSeed(seed);
return ProcessResult.HANDLED;
}
}
| [
"andy.gao.y@gmail.com"
] | andy.gao.y@gmail.com |
4ccad6faec438db889f796435fef4ca93c1da992 | 908eaf81e6b248c545689a3a25646c5319e30c33 | /pb55.java | 448d64b39fae3c249a970830ca65ee4ba9cfc7bc | [] | no_license | CodePrac/CoderCarrerProblems | e576c33dfd4f20736829dd1f6d910125f97c57e6 | 367c3c504ad10152a8791f82aa5debe4acf952e3 | refs/heads/master | 2016-09-10T20:13:17.518361 | 2015-08-23T16:32:04 | 2015-08-23T16:32:04 | 41,257,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | /*
Given a number, please translate it to a string, following the rules:
1 is translated to 'a', 2 to 'b', …, 12 to 'l', …, 26 to 'z'.
For example, the number 12258 can be translated to "abbeh", "aveh", "abyh", "lbeh" and "lyh",
so there are 5 different ways to translate 12258. How to write a function/method to count
the different ways to translate a number?
*/
public class pb56 {
public static void main( String[] args ) {
int num = 12258;
int res = getNumTrans( num);
}
public static int getNumTrans( int num) {
if ( num <= 0 ) {
return 0;
}
// convert number to chararray
char[] n = Integer.toString(num).toCharArray();
}
public static int getCombinations( char[] n , int start ) {
if ( start == ( n.length - 1 ) ) {
//combos = combos ++;
return combos++;
}
for ( int i = start; i< n.length; i++ ) {
for ( int j = 1 ; j <= 2; j++ ) {
if ( isValidCombo( n, start, j )) {
combos = getCombinations( n, start+j )
}
else {
return combos;
}
}
}
}
private static Boolean isValidCombo( char[] n , int start, int length) {
if (length == 1 ) {
return True;
}
if ( length == 2 && ( start+1 < n.length ) ) {
String nu = n[start]+n[start+1];
if ( Integer.valueOf(nu) <= 26 ) {
return True;
}
}
else {
return False;
}
}
} | [
"sborar@ebay.com"
] | sborar@ebay.com |
e7608345a00a10c26abccb5fb53cba5e63db9a68 | 3a2d6b22f8541545ab933d4cd609be925d6e303b | /HW4_Command/facadehometheater/Amplifier.java | 951670e9cc55026ac5daeeb7fe3f5ee2fea95bf9 | [] | no_license | 132/DP | fdc2d26d2da4d07211c9ee46b1b85cf9489caf38 | abcfa134c6385ebc842e9b6de9e6438b62da30f7 | refs/heads/master | 2021-08-14T06:34:49.451391 | 2017-11-14T21:40:46 | 2017-11-14T21:40:46 | 107,048,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,275 | java | package facadehometheater;
public class Amplifier
{
String description;
Tuner tuner;
DvdPlayer dvd;
CdPlayer cd;
public Amplifier(String description)
{
this.description = description;
}
public void on()
{
System.out.println(description + " on");
}
public void off()
{
System.out.println(description + " off");
}
public void setStereoSound()
{
System.out.println(description + " stereo mode on");
}
public void setSurroundSound()
{
System.out.println(description + " surround sound on (5 speakers, 1 subwoofer)");
}
public void setVolume(int level)
{
System.out.println(description + " setting volume to " + level);
}
public void setTuner(Tuner tuner)
{
System.out.println(description + " setting tuner to " + dvd);
this.tuner = tuner;
}
public void setDvd(DvdPlayer dvd)
{
System.out.println(description + " setting DVD player to " + dvd);
this.dvd = dvd;
}
public void setCd(CdPlayer cd)
{
System.out.println(description + " setting CD player to " + cd);
this.cd = cd;
}
public String toString()
{
return description;
}
}
| [
"noreply@github.com"
] | 132.noreply@github.com |
1f5d15c9c94f655f34ca903deb59b1e44487e77c | 305246d155592b28b88ac772501bb67d4b15159c | /app/src/main/java/net/hunme/kidsworld_iptv/util/JPushUtilHelp.java | bfacff5b74997a55d71a8459e7929a51ea990089 | [] | no_license | picknicewh/IPTV | d18468a0a777accb21ed34459f37487199eb3672 | 5be886e5c758b2ef29ca6d613f7ed92ba2ef41ed | refs/heads/master | 2021-01-21T10:19:24.562887 | 2017-01-23T01:55:58 | 2017-01-23T01:55:58 | 83,405,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,182 | java | package net.hunme.kidsworld_iptv.util;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cn.jpush.android.api.JPushInterface;
/**
* 作者: wh
* 时间: 2016-6-27
* 名称: 极光推送工具类
* 版本说明:
* 附加注释:
* 主要接口:无
*
*
*/
public class JPushUtilHelp {
public static final String APP_KEY ="JPUSH_APPKEY";
/**
*获取申请极光推送的key
*/
public static String getAppKey(Context context){
Bundle metaData = null;
String appKey = null;
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
if (applicationInfo!=null)
metaData = applicationInfo.metaData;
if (metaData!=null){
appKey = metaData.getString(APP_KEY);
if (appKey==null&&appKey.length()!=24){
return null;
}
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return appKey;
}
/**
*集成了 JPush SDK 的应用程序在第一次成功注册到 JPush 服务器时,
* JPush 服务器会给客户端返回一个唯一的该设备的标识 - RegistrationID
* 获取RegistrationID
*/
public static String getRegid(Context context){
String regId = JPushInterface.getRegistrationID(context);
return regId;
}
public static boolean isEmpty(String s) {
if (null == s)
return true;
if (s.length() == 0)
return true;
if (s.trim().length() == 0)
return true;
return false;
}
// 校验Tag Alias 只能是数字,英文字母和中文
public static boolean isValidTagAndAlias(String s) {
Pattern p = Pattern.compile("^[\\u4E00-\\u9FA50-9a-zA-Z_@!#$&*+=.|¥¥]+$");
Matcher m = p.matcher(s);
return m.matches();
}
}
| [
"zll@hunme.net"
] | zll@hunme.net |
43c81fb98e7189b98d9a1712b0025f4ae4285a3e | 5aee9137c99074de091e8c95c2c0dc19f068af6c | /src/test/java/com/OrangeHRM/OrangeHRM_Login_XPath_CSS_Example.java | 5c0bc48c5c1674220f2f1a8b3b1d21f215b544c8 | [] | no_license | Jenkins622/JD_OrangeHRM_Maven | d77536d692fefa1d15a7a5b13deec521d9a2cff2 | 5e461e0ee9e47defcc3c51871e0e82927f824773 | refs/heads/master | 2023-03-16T23:51:48.301818 | 2021-03-03T05:38:24 | 2021-03-03T05:38:24 | 344,013,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package com.OrangeHRM;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
import junit.framework.Assert;
public class OrangeHRM_Login_XPath_CSS_Example {
ChromeDriver driver;
@Test
public void Login() {
// driver.findElement(By.name("txtUsername")).sendKeys("Admin");
driver.findElement(By.xpath("//input[@name='txtUsername']")).sendKeys("Admin");
// driver.findElement(By.name("txtPassword")).sendKeys("admin123");
driver.findElement(By.cssSelector("input[name='txtPassword']")).sendKeys("admin123");
driver.findElement(By.id("btnLogin")).click();
driver.findElement(By.linkText("Dashboard")).isDisplayed();
}
@Test(priority=1)
public void Logout() throws InterruptedException {
driver.findElement(By.partialLinkText("welcome")).click();
Thread.sleep(60000);
driver.findElement(By.linkText("Logout")).click();
}
@BeforeTest
public void beforeTest() throws InterruptedException {
//Launch the Chrome Browser
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver(); //- Ctrl+Shift+O to download driver
driver.manage().window().maximize();
driver.navigate().to("https://opensource-demo.orangehrmlive.com/index.php/login");
Thread.sleep(6000);
}
@AfterTest
public void afterTest() {
//driver.close(); // Close the current browser
driver.quit(); // Close all the browser opened by Selenium
}
}
| [
"aparna.mahajan2005@gmail.com"
] | aparna.mahajan2005@gmail.com |
4caf4f22f8e11c1dd73f3637af5afda638be683f | ebdc09904f7989e589cae00ac9735253fa419c90 | /src/com/aspectj/tree/Proba.java | 453ef9380b073269c231536340ccfe0461409447 | [] | no_license | lililqth/aspectjPlugin | 25865ee06c6a9c54d56ede1820b99ad4a1f48de1 | 28fc8c1eda6371fefcf9e5158f7f1f02d8f0c1f5 | refs/heads/master | 2021-01-21T22:26:48.969075 | 2014-05-22T15:37:52 | 2014-05-22T15:37:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,226 | java | package com.aspectj.tree;
import java.io.File;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;
public class Proba
{
DrawTree drawTree;
GraphViz gv = null;
public static void main(String[] args)
{
Proba p = new Proba();
p.start();
// p.start2();
}
private void start()
{
gv = new GraphViz();
//this.traverse(drawTree.rootRoot);
gv.addln(gv.start_graph());
gv.addln("main -> helloworld;");
gv.addln("main -> getX;");
gv.addln("helloworld -> functioz4n;");
gv.addln("helloworld -> setX;");
gv.addln("helloworld -> setValue;");
gv.addln("getX -> getalue;");
gv.addln(gv.end_graph());
System.out.println(gv.getDotSource());
String type = "gif";
// String type = "dot";
// String type = "fig"; // open with xfig
// String type = "pdf";
// String type = "ps";
// String type = "svg"; // open with inkscape
// String type = "png";
// String type = "plain";
//File out = new File("/tmp/out." + type); // Linux
File out = new File("c:/Temp/out." + type); // Windows
gv.writeGraphToFile( gv.getGraph( gv.getDotSource(), type ), out );
}
/**
* Read the DOT source from a file,
* convert to image and store the image in the file system.
*/
private void start2()
{
String dir = "/home/jabba/eclipse2/laszlo.sajat/graphviz-java-api"; // Linux
String input = dir + "/sample/simple.dot";
// String input = "c:/eclipse.ws/graphviz-java-api/sample/simple.dot"; // Windows
GraphViz gv = new GraphViz();
gv.readSource(input);
System.out.println(gv.getDotSource());
String type = "gif";
// String type = "dot";
// String type = "fig"; // open with xfig
// String type = "pdf";
// String type = "ps";
// String type = "svg"; // open with inkscape
// String type = "png";
// String type = "plain";
File out = new File("/tmp/simple." + type); // Linux
// File out = new File("c:/eclipse.ws/graphviz-java-api/tmp/simple." + type); // Windows
gv.writeGraphToFile( gv.getGraph( gv.getDotSource(), type ), out );
}
}
| [
"lililqth@gmail.com"
] | lililqth@gmail.com |
76c46a81dab6f21d6d56deacaf1390af7e8a15c3 | 313cac74fe44fa4a08c50b2f251e4167f637c049 | /retail-fas-1.1.2/retail-fas/retail-fas-web/src/main/java/cn/wonhigh/retail/fas/web/controller/InitCacheController.java | 88f0da763f64778a3806849f7feff1ad67f35d35 | [] | no_license | gavin2lee/spring-projects | a1d6d495f4a027b5896e39f0de2765aaadc8a9de | 6e4a035ae3c9045e880a98e373dd67c8c81bfd36 | refs/heads/master | 2020-04-17T04:52:41.492652 | 2016-09-29T16:07:40 | 2016-09-29T16:07:40 | 66,710,003 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 6,990 | java | package cn.wonhigh.retail.fas.web.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.wonhigh.retail.backend.security.Authorization;
import cn.wonhigh.retail.fas.common.model.Lookup;
import cn.wonhigh.retail.fas.common.model.LookupEntry;
import cn.wonhigh.retail.fas.common.utils.CommonUtil;
import cn.wonhigh.retail.fas.common.vo.LookupDtl;
import cn.wonhigh.retail.fas.manager.LookupEntryManager;
import cn.wonhigh.retail.fas.manager.LookupManager;
import com.yougou.logistics.base.common.exception.ManagerException;
import com.yougou.logistics.base.common.model.SystemUser;
/**
* 1.tomcat容器初始化后加载些数据,如字典加载到缓存 2. 处理些公用的链接
* @author wei.hj weihaijin
* @date 2013-07-20cc
* @copyRight yougou.com
*/
@Controller
@RequestMapping("/initCache")
public class InitCacheController implements InitializingBean {
private static final String QUERY_CONDITION = "queryCondition";
protected static final XLogger LOG = XLoggerFactory.getXLogger(InitCacheController.class);
@Value("${db.schema}")
private String schema;
public static Map<String, List<LookupDtl>> lookupdMap = new LinkedHashMap<String, List<LookupDtl>>();
@Resource
private LookupManager lookupManager;
@Resource
private LookupEntryManager lookupEntryManager;
/**
* 初始化
*/
public void init() {
LOG.info("★★★★★★★★★★★★★★★★初始化开始★★★★★★★★★★★★★★★★");
LOG.info("★★★★★★★★★★★★★★★★初始化完成★★★★★★★★★★★★★★★★");
}
//页面获得字典
@RequestMapping(value = "/getLookupDtlsList")
@ResponseBody
public List<LookupDtl> getLookupDtlsList(@RequestParam("lookupcode") String lookupcode, HttpServletRequest request)
throws ManagerException {
List<LookupDtl> listObj = new ArrayList<LookupDtl>();
if (CommonUtil.hasValue(lookupcode)) {
listObj = lookupdMap.get(lookupcode);
if (CollectionUtils.isEmpty(listObj)) {
Map<String, Object> param = new HashMap<String, Object>();
param.put("lookupCode", lookupcode);
List<Lookup> lookups = lookupManager.findByBiz(null, param);
if (!CollectionUtils.isEmpty(lookups)) {
param.clear();
param.put("lookupId", lookups.get(0).getId());
List<LookupEntry> lookupEntries = lookupEntryManager.findByBiz(null, param);
listObj = new ArrayList<LookupDtl>();
LookupDtl dtl = null;
for (LookupEntry lookupEntry : lookupEntries) {
dtl = new LookupDtl();
dtl.setLookupcode(lookupcode);
dtl.setItemname(lookupEntry.getName());
dtl.setItemvalue(lookupEntry.getCode());
dtl.setOrganTypeNo(lookupEntry.getOrganTypeNo());
listObj.add(dtl);
}
lookupdMap.put(lookupcode, listObj);
}
}
//是否添加全部的标志
String addAllFlag = request.getParameter("addAllFlag");
if ("true".equalsIgnoreCase(addAllFlag)) {
List<LookupDtl> newlstObj = new ArrayList<LookupDtl>();
LookupDtl dtl = new LookupDtl();
dtl.setLookupcode("ALL");
dtl.setItemname("全部");
dtl.setItemvalue("ALL");
newlstObj.add(dtl);
newlstObj.addAll(listObj);
return reload(newlstObj);
}
String currentYear = request.getParameter("currentYear");
if (StringUtils.isNotEmpty(currentYear)) {
int year = Integer.parseInt(currentYear);
String beforeCurrentYear = String.valueOf(year - 1);
String afterCurrentYear = String.valueOf(year + 1);
List<LookupDtl> list = new ArrayList<LookupDtl>();
for (LookupDtl dtl : listObj) {
if (currentYear.equals(dtl.getItemname()) || beforeCurrentYear.equals(dtl.getItemname())
|| afterCurrentYear.equals(dtl.getItemname())) {
list.add(dtl);
}
}
listObj = list;
}
}
return reload(listObj);
}
private List<LookupDtl> reload(List<LookupDtl> lst){
SystemUser user = Authorization.getUser();
if( user == null || StringUtils.isEmpty(user.getOrganTypeNo())){
return lst;
}
List<LookupDtl> result = new ArrayList<>();
for (LookupDtl item : lst) {
if( StringUtils.isEmpty(item.getOrganTypeNo())
|| user.getOrganTypeNo().equalsIgnoreCase(item.getOrganTypeNo())){
result.add(item);
}
}
return result;
}
/**
* 构建参数
* @param req 请求对象
* @param model 保存对象
* @return 返回构建的数组信息
* @throws ManagerException
*/
@SuppressWarnings({ "unchecked", "unused" })
private Map<String, Object> builderParams(HttpServletRequest req, Model model) throws ManagerException {
Map<String, String[]> params = req.getParameterMap();
Map<String, Object> result = new HashMap<String, Object>(params.size());
if (null != params && params.size() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Entry<String, String[]> p : params.entrySet()) {
if (null == p.getValue() || StringUtils.isEmpty(p.getValue().toString())) {
continue;
}
// 只转换一个参数,多个参数不转换
String[] values = p.getValue();
String match = "^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-8]))|(((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-)) (20|21|22|23|[0-1]?\\d):[0-5]?\\d:[0-5]?\\d$";
if (values[0].matches(match)) {
try {
result.put(p.getKey(), sdf.parse(values[0]));
} catch (ParseException e) {
LOG.error(e.getMessage(), e);
throw new ManagerException(e.getMessage(), e);
}
} else if (QUERY_CONDITION.equals(p.getKey()) && model.asMap().containsKey(QUERY_CONDITION)) {
result.put(p.getKey(), model.asMap().get(QUERY_CONDITION));
} else {
result.put(p.getKey(), values[0]);
}
}
}
return result;
}
/**
* @return 数据库schema
*/
public String getSchema() {
return schema;
}
/**
* @param schema 数据库schema
*/
public void setSchema(String schema) {
this.schema = schema;
}
@Override
public void afterPropertiesSet() throws Exception {
}
}
| [
"gavin2lee@163.com"
] | gavin2lee@163.com |
7c74d25d3172a16bdd78916b9d94f81042fb4647 | ff8e9549994a9880bd0f82ac2b1ca309ba4c2ade | /blog-api/src/main/java/cn/isbut/controller/IndexController.java | 3423e15804c983aa23f31eef52fd82d28bf7539f | [] | no_license | zzp1202/Spring-Blog | e21d095d3236a06ac915ad38f743b34395cd66fc | 189ce0b201f8be2432c646277e7c56474c4f75f5 | refs/heads/main | 2023-07-18T05:41:32.795323 | 2021-09-01T15:10:05 | 2021-09-01T15:10:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,024 | java | package cn.isbut.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.isbut.entity.Category;
import cn.isbut.entity.Tag;
import cn.isbut.model.vo.NewBlog;
import cn.isbut.model.vo.RandomBlog;
import cn.isbut.model.vo.Result;
import cn.isbut.service.BlogService;
import cn.isbut.service.CategoryService;
import cn.isbut.service.SiteSettingService;
import cn.isbut.service.TagService;
import java.util.List;
import java.util.Map;
/**
* @author Ryan
* @Description: 站点相关
*/
@RestController
public class IndexController {
SiteSettingService siteSettingService;
BlogService blogService;
CategoryService categoryService;
TagService tagService;
/**
* 获取站点配置信息、最新推荐博客、分类列表、标签云、随机博客
*
* @return result
*/
@GetMapping("/site")
public Result site() {
Map<String, Object> map = siteSettingService.getSiteInfo();
List<NewBlog> newBlogList = blogService.getNewBlogListByIsPublished();
List<Category> categoryList = categoryService.getCategoryNameList();
List<Tag> tagList = tagService.getTagListNotId();
List<RandomBlog> randomBlogList = blogService.getRandomBlogListByLimitNumAndIsPublishedAndIsRecommend();
map.put("newBlogList", newBlogList);
map.put("categoryList", categoryList);
map.put("tagList", tagList);
map.put("randomBlogList", randomBlogList);
return Result.ok("请求成功", map);
}
@Autowired
public void setSiteSettingService(SiteSettingService siteSettingService) {
this.siteSettingService = siteSettingService;
}
@Autowired
public void setBlogService(BlogService blogService) {
this.blogService = blogService;
}
@Autowired
public void setCategoryService(CategoryService categoryService) {
this.categoryService = categoryService;
}
@Autowired
public void setTagService(TagService tagService) {
this.tagService = tagService;
}
}
| [
"1173779946@qq.com"
] | 1173779946@qq.com |
1978780521bfba7056d112abad7fb34f3ab82bd6 | ad8e8db8e655d93ee132712634e02d86d04a8c9c | /src/ui/EnrollStudent.java | 123bebec0f03911d53f3cc702d8818387c6bbcd1 | [] | no_license | Ten5/ScheduleManagementSystem | f1248dd43bc812202815d01fbfb06a69953e711d | f5c7cd5c7dba56d6448a856ed2b7b2c6c63d3201 | refs/heads/master | 2020-06-16T05:40:27.209438 | 2015-04-27T09:04:08 | 2015-04-27T09:04:08 | 75,240,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | package ui;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
public class EnrollStudent {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
EnrollStudent window = new EnrollStudent();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public EnrollStudent() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 418);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
}
}
| [
"subhasree10.7.94@gmail.com"
] | subhasree10.7.94@gmail.com |
b285accad08d1ce00572d3b073536552124c5131 | 217d2b4d0a9d468f75728794867b27f7456734d3 | /VendaAtacado/src/VendaAtacado.java | 5625179487f2686155d1c2a4d4be19b76e780a20 | [] | no_license | Montanheiro/IFGoiano | e86018ef17d6481073cba261ac582ceb9f912314 | f39e2f682826e27a67ee349748a2788ef1568ca1 | refs/heads/master | 2020-04-15T13:36:44.820221 | 2016-09-16T04:50:19 | 2016-09-16T04:50:19 | 60,221,303 | 1 | 1 | null | 2016-07-05T04:54:32 | 2016-06-02T00:59:51 | SuperCollider | UTF-8 | Java | false | false | 456 | java | public class VendaAtacado {
int codigoItem;
String DescricaoItem;
double valorCusto, valorAtacado, valorVarejo;
public void ReceberDados(int codigoItem, String DescricaoItem, double valorCusto){
this.codigoItem = codigoItem;
this.DescricaoItem = DescricaoItem;
this.valorCusto = valorCusto;
}
public void CalcularNoAtacado(){
valorAtacado = valorCusto * 1.3;
}
public void CalcularVendaUnitario(){
valorVarejo = valorCusto * 1.6;
}
}
| [
"lucasmontanheiro10@gmail.com"
] | lucasmontanheiro10@gmail.com |
e77da5779bce180e1bcf510557ae2d8cadae1130 | ef7b94ed950ab840b7fe4d725fbda9d5781d6507 | /java/ss/ageofcrafters/blocks/BlockAoCBricks.java | 3212e507415bba5e33528c146626d2ee50c71e86 | [] | no_license | Dizzlepop12/AoC | 7b0fb8b2228fcd5c9a9268fb94476ad43e6a14bc | 951cbf741ff522d2de20a19cf4b03c81dd49c159 | refs/heads/master | 2016-09-05T15:09:49.521471 | 2015-07-16T06:38:03 | 2015-07-16T06:38:03 | 39,165,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | package ss.ageofcrafters.blocks;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import ss.ageofcrafters.main.AgeOfCrafters;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAoCBricks extends Block{
public BlockAoCBricks(Material material) {
super(material);
// TODO Auto-generated constructor stub
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg){
this.blockIcon = reg.registerIcon(AgeOfCrafters.modid + ":" + this.getUnlocalizedName().substring(5));
}
}
| [
"foolishnessisnecessary@gmail.com"
] | foolishnessisnecessary@gmail.com |
d3caa57737431375310f210bca55ab11cc3bf66a | 7a5b98b7ed58fdf9b6c479bb5c5afe08de5b4d62 | /src/pacs/bean/Category.java | 01ad892108d51a2d1e63acad25eeb10a39ad36c8 | [] | no_license | Number-33/how2j | dc661cca4ab52357d2c4841af73de7949174d5b8 | a0d716e0c958c94b419d19d898834051739c6386 | refs/heads/master | 2020-09-24T20:36:15.634727 | 2019-12-04T10:38:29 | 2019-12-04T10:38:29 | 225,837,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package pacs.bean;
import java.util.List;
/**
* @program: PACS
* @Date: 2019/11/22 15:23
* @Author: Mr.Liu
* @Description:
*/
public class Category {
private int id;
private String name;
List<Doctor> doctors;
List<List<Doctor>> doctorsByRow;
public List<Doctor> getDoctors() {
return doctors;
}
public void setDoctors(List<Doctor> doctors) {
this.doctors = doctors;
}
public List<List<Doctor>> getDoctorsByRow() {
return doctorsByRow;
}
public void setDoctorsByRow(List<List<Doctor>> doctorsByRow) {
this.doctorsByRow = doctorsByRow;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Category [name=" + name +"]";
}
}
| [
"lioubiao123@foxmail.com"
] | lioubiao123@foxmail.com |
fe2550b7b8087541edaef84114e0d66c9401eb88 | cab32195375664d0be5090fa401ac84ce2615d13 | /SilaSDK/src/test/java/com/silamoney/client/tests/DeleteRegistrationTests.java | 692d2fead8b22a90f83a283cca664e341166f69d | [] | no_license | Sila-Money/sila-sdk-java | f099995a7f45879ba77e42a922711f12c5caba8d | fec7838bff9d19ab8dafa6abef3ca391a521a83b | refs/heads/master | 2023-09-01T17:56:56.549762 | 2023-08-21T10:15:00 | 2023-08-21T10:15:00 | 218,826,086 | 3 | 4 | null | 2023-09-08T12:58:24 | 2019-10-31T17:50:37 | Java | UTF-8 | Java | false | false | 1,678 | java | package com.silamoney.client.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.silamoney.client.api.ApiResponse;
import com.silamoney.client.api.SilaApi;
import com.silamoney.client.domain.BaseResponse;
import com.silamoney.client.domain.DeleteRegistrationMessage;
import com.silamoney.client.domain.GetEntityResponse;
import com.silamoney.client.domain.RegistrationDataEnum;
import com.silamoney.client.testsutils.DefaultConfigurations;
import org.junit.Test;
public class DeleteRegistrationTests {
SilaApi api = new SilaApi(DefaultConfigurations.host, DefaultConfigurations.appHandle,
DefaultConfigurations.privateKey);
@Test
public void Response200Success() throws Exception {
ApiResponse response = api.getEntity(DefaultConfigurations.getUserHandle(),
DefaultConfigurations.getUserPrivateKey());
assertEquals(200, response.getStatusCode());
GetEntityResponse entityResponse = (GetEntityResponse) response.getData();
DeleteRegistrationMessage message = DeleteRegistrationMessage.builder()
.userHandle(DefaultConfigurations.getUserHandle())
.userPrivateKey(DefaultConfigurations.getUserPrivateKey())
.uuid(entityResponse.getIdentities().get(0).getUuid()).build();
response = api.deleteRegistrationData(RegistrationDataEnum.IDENTITY, message);
assertEquals(200, response.getStatusCode());
BaseResponse parsedResponse = (BaseResponse) response.getData();
assertTrue(parsedResponse.getSuccess());
assertEquals("SUCCESS", parsedResponse.getStatus());
}
}
| [
"jlmruiz@outlook.com"
] | jlmruiz@outlook.com |
3cb4cc49842908ba965372829852e226e1e44552 | 56b7509beecf676f9e5a522e2433061c2d96ed11 | /src/main/java/alan/OnlineDiary/bus/UserService.java | f153e06b0fa344a40d8b3dcd3494bd5971767f71 | [
"MIT"
] | permissive | Jonezzyboy/OnlineDiary | 3dee95a2139e6f7c0cd678e2edd228c53056a746 | 4ce058630ecc1f5c46db7fe6b468618429afc45a | refs/heads/master | 2020-04-28T12:51:27.338863 | 2019-05-03T12:37:15 | 2019-05-03T12:37:15 | 175,289,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,123 | 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 alan.OnlineDiary.bus;
import alan.OnlineDiary.ents.User;
import alan.OnlineDiary.pers.UserFacade;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
/**
*
* @author Alan
*/
@Stateless
public class UserService {
@EJB
private UserFacade uf;
/**
* Create user
*
* @param u The user to add
* @param confirm The confirm password string
*
* @return Whether the user was created or not
*/
public Boolean createNewUser(User u, String confirm) {
Boolean passwordsMatch = checkPasswords(u, confirm);
Boolean userExists = checkDuplicates(u);
if (userExists == false && passwordsMatch == true) {
uf.create(u);
return true;
} else {
return false;
}
}
/**
* Check for duplicate users
*
* @param u The user being compared
*
* @return Whether the user exists already or not
*/
public Boolean checkDuplicates(User u) {
FacesContext context = FacesContext.getCurrentInstance();
Boolean userExists = true;
if (uf.findUsersByUsername(u.getUsername()) == null && uf.findUsersByEmail(u.getEmail()) == null) {
userExists = false;
}
if (uf.findUsersByUsername(u.getUsername()) != null) {
context.addMessage("createID:username", new FacesMessage("Username already exists"));
}
if (uf.findUsersByEmail(u.getEmail()) != null) {
context.addMessage("createID:email", new FacesMessage("Email already exists"));
}
return userExists;
}
/**
* Compare password strings
*
* @param u The user being compared
* @param confirm The confirm password string
*
* @return Whether the password and confirm passwords match
*/
public Boolean checkPasswords(User u, String confirm) {
FacesContext context = FacesContext.getCurrentInstance();
Boolean passwordsMatch = false;
if (u.getPassword().equals(confirm)) {
passwordsMatch = true;
} else {
context.addMessage("createID:confirm", new FacesMessage("Passwords do not match"));
}
return passwordsMatch;
}
/**
* Validate a user's log in attempt
*
* @param username The username string
* @param password The password string
*
* @return Whether the password and confirm passwords match
*/
public User validateLogin(String username, String password) {
User user = uf.findUserByCredentials(username, password);
if (user == null) {
return user;
}
return user;
}
/**
* Get all users
*
* @return List of all user objects
*/
public List<User> findAllUsers() {
return uf.findAll();
}
}
| [
"jonezzyboy@gmail.com"
] | jonezzyboy@gmail.com |
26c6ef23e913c66e3580cfb1edb935d90f857a12 | fd31a427aca5ed253687efb6693e432efed98b29 | /ToDoList/app/src/main/java/com/example/resource/todolist/Task.java | 778b3b9cc3c97c010754e15d688127c6c1cfa71a | [] | no_license | bazsant/android-training | 5f9878c510f245b35d817266b733d8fa54029605 | 4293bea54f9ba1788193e1b722125eadf78be808 | refs/heads/master | 2020-03-13T01:33:55.981707 | 2018-04-28T14:13:01 | 2018-04-28T14:13:01 | 130,906,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package com.example.resource.todolist;
public class Task {
private String description;
private int status;
public Task (String description, int status){
this.description = description;
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| [
"jhones.santos@resourceit.com"
] | jhones.santos@resourceit.com |
40befb838c35ce11431c3ba8c0d0f84f70ba1b4c | df834503a603460ae4323dd373dc4efc85e48cfa | /java/resistor-color/src/main/java/ResistorColor.java | 57760e8e5d084ce7e6e68986d91dcab1cae811af | [] | no_license | 23phy/exercism | d30720f9dbacc8415857e2f142e692c64e5e0787 | ea32685840a79f8ab34a19dfa0908e26b95b1663 | refs/heads/master | 2020-06-04T02:54:41.525107 | 2019-08-31T16:28:13 | 2019-08-31T16:28:13 | 191,843,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | import java.util.LinkedHashMap;
import java.util.Set;
class ResistorColor {
private LinkedHashMap<String, Integer> colors;
ResistorColor() {
this.colors = new LinkedHashMap<String, Integer>();
this.colors.put("black", 0);
this.colors.put("brown", 1);
this.colors.put("red", 2);
this.colors.put("orange", 3);
this.colors.put("yellow", 4);
this.colors.put("green", 5);
this.colors.put("blue", 6);
this.colors.put("violet", 7);
this.colors.put("grey", 8);
this.colors.put("white", 9);
}
int colorCode(String color) {
return this.colors.get(color);
}
String[] colors() {
Set<String> colorsKeys = this.colors.keySet();
return colorsKeys.toArray(new String[colorsKeys.size()]);
}
} | [
"oliver.plamada@gmail.com"
] | oliver.plamada@gmail.com |
45a53694570f3d1b0d6372b69f38e215547b3d4f | 37d467f334c12ce3ceca384d1b706762bf9d0ee8 | /client/src/main/java/rs/darkscape/client/class65.java | 28f240cbb4e9238ec798f9ef1294274324fed004 | [] | no_license | communityus-branch/darkscape | 7642571b68cd9b9d2b329a489d7291fd30e28a0c | d615cfb871d7804a2de81716ed0ea603fae2b262 | refs/heads/master | 2021-03-04T06:12:48.268804 | 2018-10-07T10:36:42 | 2018-10-07T10:36:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,531 | java | package rs.darkscape.client;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import rs.darkscape.client.sign.SignLink;
@ObfuscatedName("bb")
public class class65 {
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "[Lbb;"
)
static class65[] field949;
@ObfuscatedName("q")
@ObfuscatedGetter(
intValue = -484083453
)
static int field945 = 0;
@ObfuscatedName("k")
@ObfuscatedGetter(
intValue = -2045294689
)
static int field944 = 0;
@ObfuscatedName("i")
static int[] field939 = new int[]{1, 1, 1, 1};
@ObfuscatedName("x")
static int[] field946 = new int[]{0, 1, 2, 3};
@ObfuscatedName("p")
@ObfuscatedGetter(
intValue = -1592935297
)
int field947;
@ObfuscatedName("b")
@ObfuscatedGetter(
intValue = -1045794303
)
int field948;
@ObfuscatedName("n")
@ObfuscatedGetter(
intValue = 405776969
)
int field955;
@ObfuscatedName("f")
String field950;
@ObfuscatedName("g")
String field951;
@ObfuscatedName("m")
@ObfuscatedGetter(
intValue = -2021362795
)
int field952;
@ObfuscatedName("r")
@ObfuscatedGetter(
intValue = 777704071
)
int field943;
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;IS)Ljava/io/File;",
garbageValue = "-8731"
)
static File method1583(String string_0, String string_1, int i_2) {
String str_3 = i_2 == 0 ? "" : "" + i_2;
class155.field1964 = new File(class18.field143,
"jagex_cl_" + string_0 + "_" + string_1 + str_3 + ".dat");
String string_4 = null;
String string_5 = null;
boolean bool_6 = false;
Buffer class182_8;
File file_23;
if (class155.field1964.exists()) {
try {
SeekableFile class110_7 = new SeekableFile(class155.field1964, "rw", 10000L);
int i_9;
for (class182_8 = new Buffer((int) class110_7.length());
class182_8.offset < class182_8.bytes.length; class182_8.offset += i_9) {
i_9 = class110_7.read(class182_8.bytes, class182_8.offset,
class182_8.bytes.length - class182_8.offset);
if (i_9 == -1) {
throw new IOException();
}
}
class182_8.offset = 0;
i_9 = class182_8.getUInt8();
if (i_9 < 1 || i_9 > 3) {
throw new IOException("" + i_9);
}
int i_10 = 0;
if (i_9 > 1) {
i_10 = class182_8.getUInt8();
}
if (i_9 <= 2) {
string_4 = class182_8.method3558();
if (i_10 == 1) {
string_5 = class182_8.method3558();
}
} else {
string_4 = class182_8.method3559();
if (i_10 == 1) {
string_5 = class182_8.method3559();
}
}
class110_7.close();
} catch (IOException ioexception_21) {
ioexception_21.printStackTrace();
}
if (string_4 != null) {
file_23 = new File(string_4);
if (!file_23.exists()) {
string_4 = null;
}
}
if (string_4 != null) {
file_23 = new File(string_4, "test.dat");
if (!class70.method1766(file_23, true)) {
string_4 = null;
}
}
}
if (string_4 == null && i_2 == 0) {
label137:
for (int i_15 = 0; i_15 < class8.filestoreLocation.length; i_15++) {
for (int i_16 = 0; i_16 < class155.cacheLocation.length; i_16++) {
File file_17 = new File(
class155.cacheLocation[i_16] + class8.filestoreLocation[i_15] + File.separatorChar
+ string_0 + File.separatorChar);
if (file_17.exists() && class70.method1766(new File(file_17, "test.dat"), true)) {
string_4 = file_17.toString();
bool_6 = true;
break label137;
}
}
}
}
if (string_4 == null) {
string_4 = class18.field143 + File.separatorChar + "jagexcache" + str_3 + File.separatorChar
+ string_0 + File.separatorChar + string_1 + File.separatorChar;
bool_6 = true;
}
File file_22;
if (string_5 != null) {
file_22 = new File(string_5);
file_23 = new File(string_4);
try {
File[] arr_24 = file_22.listFiles();
File[] arr_18 = arr_24;
for (int i_11 = 0; i_11 < arr_18.length; i_11++) {
File file_12 = arr_18[i_11];
File file_13 = new File(file_23, file_12.getName());
boolean bool_14 = file_12.renameTo(file_13);
if (!bool_14) {
throw new IOException();
}
}
} catch (Exception exception_20) {
exception_20.printStackTrace();
}
bool_6 = true;
}
if (bool_6) {
file_22 = new File(string_4);
class182_8 = null;
try {
SeekableFile class110_25 = new SeekableFile(class155.field1964, "rw", 10000L);
Buffer class182_26 = new Buffer(500);
class182_26.putInt8(3);
class182_26.putInt8(class182_8 != null ? 1 : 0);
class182_26.method3541(file_22.getPath());
if (class182_8 != null) {
class182_26.method3541("");
}
class110_25.write(class182_26.bytes, 0, class182_26.offset);
class110_25.close();
} catch (IOException ioexception_19) {
ioexception_19.printStackTrace();
}
}
return new File(string_4);
}
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "(Lgk;IIIIIIS)V",
garbageValue = "-9209"
)
static final void method1603(Buffer class182_0, int i_1, int i_2, int i_3, int i_4, int i_5,
int i_6) {
int i_7;
if (i_2 >= 0 && i_2 < 104 && i_3 >= 0 && i_3 < 104) {
class50.field443[i_1][i_2][i_3] = 0;
while (true) {
i_7 = class182_0.getUInt8();
if (i_7 == 0) {
if (i_1 == 0) {
int[] ints_8 = class50.field459[0][i_2];
int i_11 = i_2 + i_4 + 932731;
int i_12 = i_3 + i_5 + 556238;
int i_13 = class32.method549(45365 + i_11, i_12 + 91923, 4) - 128 + (
class32.method549(10294 + i_11, 37821 + i_12, 2) - 128 >> 1) + (
class32.method549(i_11, i_12, 1) - 128 >> 2);
i_13 = (int) ((double) i_13 * 0.3D) + 35;
if (i_13 < 10) {
i_13 = 10;
} else if (i_13 > 60) {
i_13 = 60;
}
ints_8[i_3] = -i_13 * 8;
} else {
class50.field459[i_1][i_2][i_3] = class50.field459[i_1 - 1][i_2][i_3] - 240;
}
break;
}
if (i_7 == 1) {
int i_14 = class182_0.getUInt8();
if (i_14 == 1) {
i_14 = 0;
}
if (i_1 == 0) {
class50.field459[0][i_2][i_3] = -i_14 * 8;
} else {
class50.field459[i_1][i_2][i_3] = class50.field459[i_1 - 1][i_2][i_3] - i_14 * 8;
}
break;
}
if (i_7 <= 49) {
class165.field2033[i_1][i_2][i_3] = class182_0.getInt8();
class50.field446[i_1][i_2][i_3] = (byte) ((i_7 - 2) / 4);
class19.field159[i_1][i_2][i_3] = (byte) (i_7 - 2 + i_6 & 0x3);
} else if (i_7 <= 81) {
class50.field443[i_1][i_2][i_3] = (byte) (i_7 - 49);
} else {
class50.field445[i_1][i_2][i_3] = (byte) (i_7 - 81);
}
}
} else {
while (true) {
i_7 = class182_0.getUInt8();
if (i_7 == 0) {
break;
}
if (i_7 == 1) {
class182_0.getUInt8();
break;
}
if (i_7 <= 49) {
class182_0.getUInt8();
}
}
}
}
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "(ILir;IIIZB)V",
garbageValue = "38"
)
public static void method1602(int i_0, AbstractPack class247_1, int i_2, int i_3, int i_4,
boolean bool_5) {
class217.field2460 = 1;
class138.field1871 = class247_1;
class217.field2461 = i_2;
class217.field2462 = i_3;
class309.field3740 = i_4;
class217.field2463 = bool_5;
class6.field37 = i_0;
}
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "(ILce;ZI)I",
garbageValue = "168369"
)
static int method1605(int i_0, class84 class84_1, boolean bool_2) {
class230 class230_3 = bool_2 ? class276.field3561 : class260.field3301;
if (i_0 == 1500) {
class69.field999[++class69.field1003 - 1] = class230_3.field2618;
return 1;
} else if (i_0 == 1501) {
class69.field999[++class69.field1003 - 1] = class230_3.field2619;
return 1;
} else if (i_0 == 1502) {
class69.field999[++class69.field1003 - 1] = class230_3.field2675;
return 1;
} else if (i_0 == 1503) {
class69.field999[++class69.field1003 - 1] = class230_3.field2621;
return 1;
} else if (i_0 == 1504) {
class69.field999[++class69.field1003 - 1] = class230_3.field2625 ? 1 : 0;
return 1;
} else if (i_0 == 1505) {
class69.field999[++class69.field1003 - 1] = class230_3.field2605;
return 1;
} else {
return 2;
}
}
@ObfuscatedName("af")
@ObfuscatedSignature(
signature = "(Lev;III)Lcx;",
garbageValue = "30833833"
)
public static final class95 method1582(SignLink class154_0, int i_1, int i_2) {
if (class95.field1300 == 0) {
throw new IllegalStateException();
} else if (i_1 >= 0 && i_1 < 2) {
if (i_2 < 256) {
i_2 = 256;
}
try {
class95 class95_3 = class95.field1297.vmethod2052();
class95_3.field1299 = new int[(class95.field1295 ? 2 : 1) * 256];
class95_3.field1303 = i_2;
class95_3.vmethod2176();
class95_3.field1302 = (i_2 & ~0x3ff) + 1024;
if (class95_3.field1302 > 16384) {
class95_3.field1302 = 16384;
}
class95_3.vmethod2163(class95_3.field1302);
if (class27.field230 > 0 && class69.field1010 == null) {
class69.field1010 = new class97();
class135.field1855 = Executors.newScheduledThreadPool(1);
class135.field1855.scheduleAtFixedRate(class69.field1010, 0L, 10L, TimeUnit.MILLISECONDS);
}
if (class69.field1010 != null) {
if (class69.field1010.field1327[i_1] != null) {
throw new IllegalArgumentException();
}
class69.field1010.field1327[i_1] = class95_3;
}
return class95_3;
} catch (Throwable throwable_4) {
return new class95();
}
} else {
throw new IllegalArgumentException();
}
}
@ObfuscatedName("gg")
@ObfuscatedSignature(
signature = "(I)V",
garbageValue = "1540740873"
)
static void method1604() {
OutboundPacket class172_0 = OutboundPacket
.createOutboundPacket(OutboundPacketDescriptor.field2215, client.field626.field1218);
PacketBuffer class189_1 = class172_0.buffer;
int i_2 = client.field792 ? 2 : 1;
class189_1.putInt8(i_2);
class172_0.buffer.method3755(class82.field1179);
class172_0.buffer.method3755(class243.field3138);
client.field626.method1980(class172_0);
}
@ObfuscatedName("x")
@ObfuscatedSignature(
signature = "(B)Z",
garbageValue = "66"
)
boolean method1589() {
return (0x1 & this.field948) != 0;
}
@ObfuscatedName("e")
@ObfuscatedSignature(
signature = "(I)Z",
garbageValue = "-2036146048"
)
boolean method1567() {
return (0x2 & this.field948) != 0;
}
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "(B)Z",
garbageValue = "83"
)
boolean method1568() {
return (0x4 & this.field948) != 0;
}
@ObfuscatedName("b")
@ObfuscatedSignature(
signature = "(I)Z",
garbageValue = "-648432612"
)
boolean method1569() {
return (0x8 & this.field948) != 0;
}
@ObfuscatedName("n")
@ObfuscatedSignature(
signature = "(I)Z",
garbageValue = "185165272"
)
boolean method1570() {
return (0x20000000 & this.field948) != 0;
}
@ObfuscatedName("f")
@ObfuscatedSignature(
signature = "(I)Z",
garbageValue = "753404361"
)
boolean method1577() {
return (0x2000000 & this.field948) != 0;
}
}
| [
"hadyn.richard@gmail.com"
] | hadyn.richard@gmail.com |
e0e2f1818896e784e5835b48c529ef11dac5cb4f | 2621ecdf9c799b316244d802382bc44843a6f7ce | /open-iam-facade/src/main/java/com/rnkrsoft/opensource/iam/gateway/channel/domains/GetChannelDetailRequest.java | 9eab80a69ba535e8293f84435ad4ad4a3724c4bf | [] | no_license | artoruis/OpenIAM | cf0b879c06b0056893c31fa07fa38d03c278b6c4 | efbbfe323af42a48f83c263ec408c5018ab4cf4e | refs/heads/master | 2023-04-09T21:28:19.574902 | 2019-08-29T17:44:50 | 2019-08-29T17:44:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package com.rnkrsoft.opensource.iam.gateway.channel.domains;
import java.io.Serializable;
/**
* Created by woate on 2019/7/14.
*/
public class GetChannelDetailRequest implements Serializable{
}
| [
"master@qq.com"
] | master@qq.com |
0059f2f30a447a2513eb01bfd8329eca803b0eab | 132d03f101b21a7ba341d2889942ca4df9b8960e | /gateway/src/test/java/security/gateway/GatewayApplicationTests.java | 1c389932148b0dffbffff531e85e66f42e662068 | [] | no_license | TranXuanHoang/security | e94b1e7712785f1b31b0f5cd40831c32e1ac4e41 | 5a3b5ab68f44f76fd5896a1e6e146afe0d864901 | refs/heads/master | 2023-01-28T18:01:42.426112 | 2020-03-24T04:36:24 | 2020-03-24T04:36:24 | 237,711,146 | 0 | 0 | null | 2023-01-07T16:18:07 | 2020-02-02T03:10:37 | JavaScript | UTF-8 | Java | false | false | 209 | java | package security.gateway;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class GatewayApplicationTests {
@Test
void contextLoads() {
}
}
| [
"hoangtx.ict@gmail.com"
] | hoangtx.ict@gmail.com |
a7720400a274e077f9f634edea3b38b6b69af6f4 | a13e7993275058dceae188f2101ad0750501b704 | /5-Problem-A-Day/34. Find First and Last Position of Element in Sorted Array.java | 3d3617af7fa8343bf388d77410d3dab07b691d37 | [] | no_license | yangjufo/LeetCode | f8cf8d76e5f1e78cbc053707af8bf4df7a5d1940 | 15a4ab7ce0b92b0a774ddae0841a57974450eb79 | refs/heads/master | 2023-09-01T01:52:49.036101 | 2023-08-31T00:23:19 | 2023-08-31T00:23:19 | 126,698,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | class Solution {
public int[] searchRange(int[] nums, int target) {
int[] ans = {-1, -1};
int left = 0, right = nums.length;
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[mid] < target)
left = mid + 1;
else
right = mid;
}
if (left == nums.length || nums[left] != target)
return ans;
ans[0] = left;
left = 0;
right = nums.length;
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[mid] > target)
right = mid;
else
left = mid + 1;
}
ans[1] = left - 1;
return ans;
}
}
| [
"yangjufo@gmail.com"
] | yangjufo@gmail.com |
b4125f9426286530a44a1f4a17f94c1ea1c21216 | 8517becfea1912d96ff8cae722f262dc8cfa32fb | /state/src/statealarma/Alarma.java | 7985ee37b00965c2795cb4a9ad2d3a994f0adee8 | [] | no_license | andricks/aptron-state | 98f845c4480fd3089cbb23e31e010533eff037e6 | 796a19bec434e14926cb1fae49785cf5c8276a86 | refs/heads/master | 2023-08-30T02:18:32.130563 | 2021-10-09T21:26:29 | 2021-10-09T21:26:29 | 415,424,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package statealarma;
public class Alarma {
private estado miestado;
public void setestado(estado e) {
this.miestado=e;
}
public void ejecutar() {
miestado.ejecutarAccion();
}
}
| [
"82111501+andricks@users.noreply.github.com"
] | 82111501+andricks@users.noreply.github.com |
bab96dfe8570f5284ba917992d71be5fafc19670 | a03d0dd8505b4372582e7d70db9a6e9a497f5d2d | /project1/src/Cards/Cheese.java | a25ae74ad7588826a7c9314cf5595e994e44f737 | [] | no_license | anamariadinca/project1 | 2b0deca6475d52861169fe5e4b80e6eb0367460e | abfbc8f86dcd55ccbbabbd3f8be7c1ec8085d8de | refs/heads/master | 2022-11-23T23:42:29.574053 | 2020-07-26T18:58:51 | 2020-07-26T18:58:51 | 282,713,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package Cards;
public class Cheese extends LegalGood {
public Cheese(){
id = 1;
name = "Cheese";
profit = 3;
penalty = 2;
}
}
| [
"noreply@github.com"
] | anamariadinca.noreply@github.com |
b98aa11c0fb14375f340932d2224ec84ab9bd86d | c8c1398acef8eb7975144d93441f5d4bc2e71637 | /JOrocos/src/RTT/corba/CServiceRequesterHelper.java | d6d1de2f83be78dcccae822cdeb0ca902fd5a78f | [] | no_license | Robotics-UniBG/JOrocos | 71e1769a7abf44752a73de9e9bbe5ed2b60df9a7 | 8a7a3cdd300e3ef1f366a88806255cedf9f33632 | refs/heads/master | 2021-01-01T05:31:45.148957 | 2012-07-16T09:43:40 | 2012-07-16T09:43:40 | 4,970,641 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,660 | java | package RTT.corba;
/**
* RTT/corba/CServiceRequesterHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ServiceRequester.idl
* Wednesday, July 11, 2012 5:27:05 PM CEST
*/
/**
* An Orocos Required Service.
* Exposes that this component requires certain services.
* @ingroup CompIDL
*/
abstract public class CServiceRequesterHelper
{
private static String _id = "IDL:RTT/corba/CServiceRequester:1.0";
public static void insert (org.omg.CORBA.Any a, RTT.corba.CServiceRequester that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static RTT.corba.CServiceRequester extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (RTT.corba.CServiceRequesterHelper.id (), "CServiceRequester");
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static RTT.corba.CServiceRequester read (org.omg.CORBA.portable.InputStream istream)
{
return narrow (istream.read_Object (_CServiceRequesterStub.class));
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, RTT.corba.CServiceRequester value)
{
ostream.write_Object ((org.omg.CORBA.Object) value);
}
public static RTT.corba.CServiceRequester narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof RTT.corba.CServiceRequester)
return (RTT.corba.CServiceRequester)obj;
else if (!obj._is_a (id ()))
throw new org.omg.CORBA.BAD_PARAM ();
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
RTT.corba._CServiceRequesterStub stub = new RTT.corba._CServiceRequesterStub ();
stub._set_delegate(delegate);
return stub;
}
}
public static RTT.corba.CServiceRequester unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof RTT.corba.CServiceRequester)
return (RTT.corba.CServiceRequester)obj;
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
RTT.corba._CServiceRequesterStub stub = new RTT.corba._CServiceRequesterStub ();
stub._set_delegate(delegate);
return stub;
}
}
}
| [
"lucaghera8@gmail.com"
] | lucaghera8@gmail.com |
b1986821e512276e25d111e44686404c23d70887 | df7809e9a92c6dcd9e228c825744df7ae40fb345 | /src/main/java/webpage/controller/SongsJsonController.java | cd78aaf3b50b46f63cb1ed0aa143bb8e8274bbd3 | [] | no_license | mamup11/Telematica-1 | 74c7297fe8ac7b244ba1a6f8d4aaa99c47bdf714 | 2a65ccc199510da96b2081b372a0952b15035702 | refs/heads/master | 2021-01-02T09:39:20.147021 | 2017-09-11T01:07:21 | 2017-09-11T01:07:21 | 99,266,220 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,758 | java | package webpage.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import webpage.model.SongsRepository;
import webpage.model.UserRepository;
import webpage.views.entities.Song;
@Controller
public class SongsJsonController {
@Autowired
SongsRepository songRepo;
@Autowired
UserRepository userRepo;
@RequestMapping(value = "/findAllSong", method = RequestMethod.GET)
public ResponseEntity<?> findAll() {
return new ResponseEntity<>(songRepo.findAll(), HttpStatus.OK);
}
@RequestMapping(value = "/findAllUser", method = RequestMethod.GET)
public ResponseEntity<?> findAlluser() {
return new ResponseEntity<>(userRepo.findAll(), HttpStatus.OK);
}
@RequestMapping(value = "/songstest", method = RequestMethod.POST)
public ResponseEntity<?> saveSong(@RequestBody List<Song> songs) {
songRepo.save(songs);
return new ResponseEntity<>(HttpStatus.OK);
}
//
// @RequestMapping(value = "/song/{cod}", method = RequestMethod.DELETE)
// public ResponseEntity<?> deleteSong(@PathVariable("cod") long cod) {
// songRepo.delete(cod);
// return new ResponseEntity<>(HttpStatus.OK);
// }
//
// @RequestMapping(value = "/song/title", method = RequestMethod.GET)
// public ResponseEntity<?> findByName(@RequestParam("title") String title)
// {
// return new
// ResponseEntity<>(songRepo.findByTitleIgnoreCaseContaining(title),
// HttpStatus.OK);
// }
//
}
| [
"mamup111@hotmail.com"
] | mamup111@hotmail.com |
5ff615b96c9eef18c64ce18be769aa8a615eced7 | 03512884f92b919a9204b0d28b326fcd141e4369 | /src/test/java/com/cs/coding/shopping/offer/ThreeForPriceOfTwoOfferTest.java | 0db03501f5558798604fff53087b3da966c6ac2c | [] | no_license | kalirajannatarajan/ShoppingCart | b89191c54cf3779f11dc3f016e93cb7ff96eef71 | c47fecd2a58126f2a09c074b7c143a1d730ab4a2 | refs/heads/master | 2021-08-26T05:31:56.015301 | 2017-11-21T18:39:38 | 2017-11-21T18:39:38 | 111,586,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,609 | java | package com.cs.coding.shopping.offer;
import org.junit.Before;
import org.junit.Test;
import java.math.BigDecimal;
import static org.junit.Assert.assertEquals;
public class ThreeForPriceOfTwoOfferTest {
private Offer offerUnderTest;
@Before
public void setup() {
offerUnderTest = new ThreeForPriceOfTwoOffer();
}
@Test
public void eligible_offertotal_of_one() {
BigDecimal discountedPrice = offerUnderTest.discountPrice(3, BigDecimal.valueOf(0.5));
assertEquals(BigDecimal.valueOf(0.5).negate(), discountedPrice);
}
@Test
public void eligible_offertotal_more_than_one() {
BigDecimal discountedPrice = offerUnderTest.discountPrice(30, BigDecimal.valueOf(0.5));
assertEquals(BigDecimal.valueOf(5.0).negate(), discountedPrice);
}
@Test
public void ineligible_quantities() {
BigDecimal discountedPrice = offerUnderTest.discountPrice(2, BigDecimal.valueOf(0.5));
assertEquals(BigDecimal.ZERO, discountedPrice);
BigDecimal discountedPrice2 = offerUnderTest.discountPrice(0, BigDecimal.valueOf(0.5));
assertEquals(BigDecimal.ZERO, discountedPrice2);
BigDecimal discountedPrice3 = offerUnderTest.discountPrice(-1, BigDecimal.valueOf(0.5));
assertEquals(BigDecimal.ZERO, discountedPrice3);
}
@Test
public void input_quantities_not_exactly_divisible_by_eligible_quantities() {
BigDecimal discountedPrice = offerUnderTest.discountPrice(5, BigDecimal.valueOf(0.5));
assertEquals(BigDecimal.valueOf(0.5).negate(), discountedPrice);
}
}
| [
"kalirajan.natarajan@gmail.com"
] | kalirajan.natarajan@gmail.com |
6ea61b992cf5226703ef3d7ba84d99904b5bcb59 | c208db4eb260d6ac4f1cc2b8dc949fc2e550d874 | /test12/src/test12_3/Test.java | 15e0f03f24ef22ee3c91a3b044f3c49536f4cd1b | [] | no_license | XiaoFangHappy/eclipseWorkSpace | 96004eb8eaa75951525d4357f62c32ef8f4f2539 | 6d1d4b8a6adac48e76b9c643a569f7537b4fa8f3 | refs/heads/master | 2021-01-15T22:01:56.922862 | 2017-08-10T05:03:18 | 2017-08-10T05:03:18 | 99,883,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | package test12_3;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
/**
* 3、电脑类中有一个字符串类型的属性为电脑的牌子,构造方法初始化该牌子,
* 还有一个打印电脑牌子的方法。利用反射机制来实现给电脑牌子赋值并打印牌子
* @author lenovo
*
*/
public class Test {
public static void main(String[] args) {
try {
Class c = Computer.class;
Method ms = c.getDeclaredMethod("print",null);
Constructor con = c.getConstructor(String.class);
Object brand = con.newInstance("联想");
Object obj = ms.invoke(brand, null);
}catch(Exception e) {
e.printStackTrace();
}
}
}
| [
"30469531+XiaoFangHappy@users.noreply.github.com"
] | 30469531+XiaoFangHappy@users.noreply.github.com |
6914333ce78112290944612d03e6113d5fff6e32 | e7999c9f8f09581e57024b3c2ecafda55c5929e4 | /src/main/java/staticList/StaticList.java | 602126697b98e541996e0b7e6e79f874f315652f | [] | no_license | NeTissues/ImplementingDataStructures | e8162deb6b7cf4ece1cc341eb256b3bbe66bf834 | 832f2ae3d6d8a3216b7106e486930abcb74c40cf | refs/heads/master | 2023-05-26T10:01:21.376050 | 2021-06-09T21:24:08 | 2021-06-09T21:24:08 | 373,358,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,028 | java | package staticList;
import common.IOInterface;
/**
* @author NeTissues
* @see staticList.StaticInterface
*/
public class StaticList implements StaticInterface<Double>{
public int cursor;
public Double[] data;
public int arraySize;
public StaticList() {}
//void-returning methods
@Override
public void create(int arraySize){
this.data = new Double[arraySize];
this.arraySize = arraySize;
this.cursor = -1;
IOInterface.show("Created");
}
/**
* Makes the <code>data</code> value into <code>null</code> and calls onto the Garbage Collector to free the space
*/
@Override
public void destroy(){
this.data = null;
System.gc();
}
@Override
public void update(int index, Double data) {
this.data[index] = data;
}
@Override
public void insert(int index, Double data){
if (this.cursor == this.arraySize - 1)
IOInterface.show("Structure is full");
else if (index < 0) {
IOInterface.show("Index lower than 0");
}else if (index > this.arraySize - 1) {
IOInterface.show("Index greater than array size");
}else {
for (int i = this.cursor; i >= index; i--){//Search System.arraycopy() //IDK why, but I feel like this is bad
this.data[i+1] = this.data[i];
}
this.data[index] = data;
this.cursor++;
}
}
@Override
public void insertFirst(Double data){
insert(0, data);
}
@Override
public void insertLast(Double data){
insert(this.cursor + 1, data);
}
@Override
public void readList(){
try {
for (int i = 0; i <= this.cursor; i++) {
IOInterface.show("Data" + "[" + i + "] = " + this.data[i]);
}
}catch (NullPointerException e){IOInterface.show("Null Pointer Exception has been thrown");}
}
//boolean-returning methods
@Override
public boolean isEmpty(){
return this.cursor == -1;
}
@Override
public boolean isFull(){
return ((this.arraySize - 1) == this.cursor);
}
//type-returning methods
@Override
public Double[] removeFromRange(int start, int end) {
int size = (end - start) + 1, count = 0;
Double[] removedItems = new Double[size];
for (int i = start; i <= end; i++){
removedItems[count] = this.remove(i);
count++;
}
return removedItems;
}
@Override
public Double remove(int index){
Double result = this.data[index];
this.data[index] = null;
for (int i = index; i < cursor; i++){
this.data[i+1] = this.data[i];
}
this.cursor--;
return result;
}
@Override
public Double get(int index){
return this.data[index];
}
//integer-returning size
@Override
public int size(){
return arraySize;
}
}
| [
"thiago.morango.personal@gmail.com"
] | thiago.morango.personal@gmail.com |
07da74bf02ba9bc3ba67a76077da78fc28160ae9 | 14ef0b784a89931a3cc9e28d42916d8f1af50b48 | /framework/lty-framework-common/src/main/java/com/lty/framework/common/util/EnumUtil.java | 9e92ab98b24fcdc6d4bd49181fc0ea8e4e70ceb0 | [] | no_license | jxcpu2008/lty-framework | 1c388774f216becf17826014d46e62c4ee7a856b | cfc01352473bd4edcc2a65cf2fe0e7b76b48fe8d | refs/heads/master | 2021-05-16T08:07:33.470392 | 2017-09-27T10:55:41 | 2017-09-27T10:57:59 | 104,008,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,325 | java | package com.lty.framework.common.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.reflect.MethodUtils;
import com.lty.framework.common.enumeration.EnumDisplay;
public class EnumUtil {
/**
*
* 获取指定枚举类型所有常量的字段值列表
* 使用枚举类型的values方法
* 需要实现指定的接口
*
* @param ref
* @return
*/
public static List<Map<String, Object>> convertToList(Class<? extends EnumDisplay> ref) {
if (ref == null) {
return null;
}
if (ref.isEnum()) {
List<Map<String, Object>> enums = new ArrayList<Map<String, Object>>();
try {
Method method = ref.getMethod("values");
EnumDisplay[] values = (EnumDisplay[]) method.invoke(ref);
if (values != null) {
for (EnumDisplay type : values) {
Map<String, Object> item = new HashMap<String, Object>();
item.put("value", type.value());
item.put("desc", type.desc());
enums.add(item);
}
return enums;
}
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
return null;
}
/**
*
* 获取指定枚举类型所有常量的字段值列表
* 使用枚举类型的getEnumConstants方法
*
* @param ref
* @return java.util.List
*/
public static <T> List<Map<String, Object>> getValueList(Class<T> ref) {
if (ref == null) {
return null;
}
if (ref.isEnum()) {
List<Map<String, Object>> enums = new ArrayList<Map<String, Object>>();
T[] ts = ref.getEnumConstants();
for (T t : ts) {
Map<String, Object> item = new HashMap<String, Object>();
Enum<?> tempEnum = (Enum<?>) t;
Integer value = (Integer) getInvokeValue(t, "value");
if (value == null) {
value = Integer.valueOf(tempEnum.ordinal());
}
item.put("value", value);
String desc = (String) getInvokeValue(t, "desc");
if (desc == null) {
desc = (String) tempEnum.name();
}
item.put("desc", desc);
enums.add(item);
}
return enums;
}
return null;
}
static <T> Object getInvokeValue(T t, String methodName) {
try {
Method method = MethodUtils.getAccessibleMethod(t.getClass() , methodName);
return method.invoke(t);
} catch (Exception e) {
return null;
}
}
}
| [
"jxcpu2008@163.com"
] | jxcpu2008@163.com |
730cd8f43874954c988f625d29e1edc5d222e26c | 4a94065888e39f76344319505c3866b562296846 | /blackjack5/blackjack5/src/blackjack5/PlayerDeck.java | ce1c6e10fbd91c49c3df8c55510749bed85cead8 | [] | no_license | s19013/my_program_java | f21cc1c85bddd23fdd39c2fa8792ee43258bdea9 | 89f12f987765d3519a1105bbce5d98f07dd4d567 | refs/heads/master | 2020-08-23T00:16:09.860992 | 2020-07-07T08:40:25 | 2020-07-07T08:40:25 | 216,504,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package blackjack5;
import java.util.Scanner;
public class PlayerDeck extends Deck {
private boolean Checker = true;
Scanner scan = new Scanner(System.in);
public boolean Choice(){
while (Checker) {
String str1 = scan.next("HIT or STAND:");
str1.toUpperCase();
if (str1.equals("H") || str1.equals("HIT") ||str1.equals("S") || str1.equals("STAND")) {
Checker=false;
}
else {
System.out.println("入力し直してください");
}
}
return str1.equals("H");
}
}
| [
"s19013@std.it-college.ac.jp"
] | s19013@std.it-college.ac.jp |
d2ee25bbc7fa86d073517aa12b74862728c4d65c | c093b6b2759bbe9e64d74263303071c3e70e5b2f | /5.2 RMI CbR Example/src/server/entity/Sendung.java | 547b828054ac8136560a6357413959c043703c75 | [] | no_license | TomSnus/DistributedSystems | fc398cf47d8736218ebfc981cdaaf7827fcc9376 | ae0d8586d460d90808c77a7bf9143753182b2768 | refs/heads/master | 2021-01-19T17:55:26.732469 | 2017-10-23T14:36:33 | 2017-10-23T14:36:33 | 88,348,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package server.entity;
import java.io.Serializable;
import java.util.Date;
public class Sendung implements Serializable {
private String titel;
private String beschreibung;
private Date start = new Date(), ende = new Date();
public Sendung(String titel, String beschreibung) {
this.titel = titel;
this.beschreibung = beschreibung;
}
public Sendung() {
}
public String getTitel() {
return titel;
}
public void setTitel(String titel) {
this.titel = titel;
}
public String getBeschreibung() {
return beschreibung;
}
public void setBeschreibung(String beschreibung) {
this.beschreibung = beschreibung;
}
public Date getStart() {
return start;
}
public void setStart(Date start) {
this.start = start;
}
public Date getEnde() {
return ende;
}
public void setEnde(Date ende) {
this.ende = ende;
}
@Override
public String toString() {
return "Sendung{" + "titel=" + titel + ", beschreibung=" + beschreibung + '}';
}
}
| [
"senteswins@gmail.com"
] | senteswins@gmail.com |
3e16ed053ed1ff62e25bd1f523e8fb0cdc2584f7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_f7043cbcc253b48b3df14c11f00c55c6216c8245/GoogleCloudMessagingService/4_f7043cbcc253b48b3df14c11f00c55c6216c8245_GoogleCloudMessagingService_s.java | e69e45b4926a2e4bf8e7dbcc0d6d235972083006 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 13,766 | java | /*
* Copyright (c) 2012 Pockets United GmbH
*
* 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.pocketsunited.gcm.service;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pocketsunited.gcm.data.Request;
import com.pocketsunited.gcm.data.Response;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.*;
/**
*
*
* @author Michael Duergner <michael@pocketsunited.com>
*/
public class GoogleCloudMessagingService implements IGoogleCloudMessagingService {
private Logger logger = LoggerFactory.getLogger(getClass());
private static final String HEADER_NAME_AUTHORIZATION = "Authorization";
private static final String HEADER_NAME_CONTENT_TYPE = "Content-Type";
private static final String HEADER_NAME_RETRY_AFTER = "Retry-After";
private static final String CONTENT_TYPE_JSON = "application/json";
private static final String DEFAULT_SEND_URL = "https://android.googleapis.com/gcm/send";
private static final short DEFAULT_MAX_RETRY_COUNT = 5;
private static final short DEFAULT_INITIAL_BACKOFF_TIME_SECONDS = 2;
private HttpClient httpClient;
private ObjectMapper objectMapper;
private String authorizationHeaderValue;
private String gcmSendUrl;
private short maxRetryCount = DEFAULT_MAX_RETRY_COUNT;
private short initialBackoffTimeSeconds = DEFAULT_INITIAL_BACKOFF_TIME_SECONDS;
private ScheduledExecutorService executorService;
public void setHttpClient(HttpClient httpClient) {
this.httpClient = httpClient;
}
public void setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
public void setGcmSendUrl(String gcmSendUrl) {
this.gcmSendUrl = gcmSendUrl;
}
public void setMaxRetryCount(short maxRetryCount) {
this.maxRetryCount = maxRetryCount;
}
public void setInitialBackoffTimeSeconds(short initialBackoffTimeSeconds) {
this.initialBackoffTimeSeconds = initialBackoffTimeSeconds;
}
public void setApiKey(String apiKey) {
this.authorizationHeaderValue = "key ="+apiKey;
}
public void setExecutorService(ScheduledExecutorService executorService) {
this.executorService = executorService;
}
@PostConstruct
public void postConstruct() {
if (null == authorizationHeaderValue || authorizationHeaderValue.isEmpty()) {
throw new RuntimeException("'apiKey' must be set!");
}
if(null == httpClient) {
httpClient = new DefaultHttpClient(new PoolingClientConnectionManager());
}
if (null == objectMapper) {
objectMapper = new ObjectMapper();
}
if (null == gcmSendUrl) {
gcmSendUrl = DEFAULT_SEND_URL;
}
}
@Override
public void send(Request requestBody, IGoogleCloudMessageCallback callback) {
executorService.execute(new SendJob(requestBody,callback));
}
/**
*
*
* @author Michael Duergner <michael@pocketsunited.com>
*/
private class SendJob implements Runnable {
private Request requestBody;
private IGoogleCloudMessagingService.IGoogleCloudMessageCallback callback;
private short retryCount = 0;
private short nextRetryTime = initialBackoffTimeSeconds;
public SendJob(Request requestBody, IGoogleCloudMessagingService.IGoogleCloudMessageCallback callback) {
this.requestBody = requestBody;
this.callback = callback;
}
@Override
public void run() {
HttpPost request = null;
try {
request = new HttpPost(gcmSendUrl);
request.setHeader(HEADER_NAME_AUTHORIZATION,authorizationHeaderValue);
request.addHeader(HEADER_NAME_CONTENT_TYPE, CONTENT_TYPE_JSON);
request.setEntity(new StringEntity(objectMapper.writeValueAsString(requestBody)));
HttpResponse response = httpClient.execute(request);
if (200 == response.getStatusLine().getStatusCode()) {
Response data = objectMapper.readValue(response.getEntity().getContent(), Response.class);
if (0 == data.getFailure() && 0 == data.getCanonicalIds()) {
logger.debug("Push successful");
callback.successful();
}
else {
logger.info("Push with failures and/or canonical ids; handling result now");
int index = 0;
Map<String,Response.Result.ErrorCode> invalidIds = new HashMap<String, Response.Result.ErrorCode>();
Map<String,String> canonicalIds = new HashMap<String, String>();
for (Response.Result result : data.getResults()) {
if (result.isSuccess()) {
logger.info("request {} resulted in message id {}",index,result.getMessageId());
}
else if (result.isFailure()) {
switch (result.getError()) {
case MissingRegistration:
logger.error("Missing registration!");
break;
case InvalidRegistration:
String registrationId = requestBody.getRegistrationId(index);
logger.debug("Invalid registration for registration id {}",registrationId);
invalidIds.put(registrationId, Response.Result.ErrorCode.InvalidRegistration);
break;
case MismatchSenderId:
logger.error("Mismatch Sender Id!");
break;
case NotRegistered:
registrationId = requestBody.getRegistrationId(index);
logger.debug("Not registered for registration id {}",registrationId);
invalidIds.put(registrationId, Response.Result.ErrorCode.NotRegistered);
break;
case MessageTooBig:
logger.error("Message too big!");
break;
case InvalidDataKey:
logger.error("Invalid data key!");
break;
case InvalidTtl:
logger.error("Invalid time to live!");
break;
case Unavailable:
case InternalServerError:
logger.error("Unavailable / Internal Server Error - setting retry and reading retry-after header!");
checkAndDoBackOff(true, calculateRetryDelay(response));
break;
}
logger.info("Got failure result with error {} for request {}",result.getError(),index);
}
else if (result.isCanonicalId()) {
String canonicalId = result.getRegistrationId();
String registrationId = requestBody.getRegistrationId(index);
logger.info("Got canonical result with canonical id {} for registration id {}",canonicalId,registrationId);
canonicalIds.put(registrationId, canonicalId);
}
index++;
}
if (0 < invalidIds.size() && 0 < canonicalIds.size()) {
callback.failuresAndCanonicals(invalidIds,canonicalIds);
}
else if (0 < invalidIds.size()) {
callback.failures(invalidIds);
}
else {
callback.canonicals(canonicalIds);
}
}
}
else if (400 == response.getStatusLine().getStatusCode()) {
logger.error("Got '400' response code with status message '{}'",response.getStatusLine().getReasonPhrase());
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.BAD_REQUEST);
}
else if (401 == response.getStatusLine().getStatusCode()) {
logger.error("Got '401' response code with status message '{}'",response.getStatusLine().getReasonPhrase());
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.UNAUTHORIZED);
}
else if (500 <= response.getStatusLine().getStatusCode() && 600 > response.getStatusLine().getStatusCode()) {
logger.error("Got '500' response code with status message '{}'",response.getStatusLine().getReasonPhrase());
checkAndDoBackOff(true,calculateRetryDelay(response));
}
else {
logger.error("Got unknown status code {} with status message {}",response.getStatusLine().getStatusCode(),response.getStatusLine().getReasonPhrase());
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.UNKNOWN_ERROR);
}
}
catch (JsonMappingException e) {
logger.error(e.getMessage(),e);
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.INTERNAL_ERROR.withCause(e));
}
catch (JsonGenerationException e) {
logger.error(e.getMessage(),e);
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.INTERNAL_ERROR.withCause(e));
}
catch (UnsupportedEncodingException e) {
logger.error(e.getMessage(),e);
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.INTERNAL_ERROR.withCause(e));
}
catch (IOException e) {
logger.error(e.getMessage(),e);
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.INTERNAL_ERROR.withCause(e));
}
catch (Throwable t) {
logger.error(t.getMessage(),t);
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.UNKNOWN_ERROR.withCause(t));
}
finally {
if (null != request && !request.isAborted()) {
request.abort();
}
}
}
private short calculateRetryDelay(HttpResponse response) {
Header header = response.getFirstHeader(HEADER_NAME_RETRY_AFTER);
short delay = nextRetryTime;
if (null != header) {
try {
short retryAfter = Short.valueOf(header.getValue());
if (nextRetryTime < retryAfter) {
delay = retryAfter;
}
}
catch (NumberFormatException e) {
logger.warn(e.getMessage(),e);
}
}
return delay;
}
private void checkAndDoBackOff(boolean retry, short delay) {
if (retry && retryCount < maxRetryCount) {
retryCount++;
nextRetryTime = Double.valueOf(Math.pow(nextRetryTime,2)).shortValue();
logger.debug("Backing off for {} seconds", delay);
executorService.schedule(this, delay, TimeUnit.SECONDS);
}
else if (retryCount >= maxRetryCount) {
logger.debug("Maximum retry count reached. Failing!");
callback.failure(IGoogleCloudMessagingService.IGoogleCloudMessageCallback.FailureCode.SERVICE_UNAVAILABLE);
}
}
}}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
51c2c447e639828c503a6d863843a260ddbe4109 | 896bdeeb69f9c151458f286166a8cd4a4add768d | /qualityInspectorHelper/src/main/java/com/newideasoft/qualityinspectorhelper/ActivityCollector.java | b84e821a90095bbaf6df7a8af70f36e797a254ee | [] | no_license | NewIdeaSoft/InspectorHelper | 77de9a6238a324a26dfe13baa461c2257efd42dc | 0516d43a29e87afd5f0007c7d558ce7d9e087784 | refs/heads/master | 2021-01-10T15:52:48.745584 | 2016-03-30T11:16:38 | 2016-03-30T11:16:38 | 55,056,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package com.newideasoft.qualityinspectorhelper;
import java.util.ArrayList;
import android.app.Activity;
public class ActivityCollector {
public static ArrayList<Activity> activitiesList = new ArrayList<Activity>();
public static void addActivity(Activity activity){
activitiesList.add(activity);
}
public static void removeActivity(Activity activity){
activitiesList.remove(activity);
}
public static void finishiAll(){
for(Activity activity:activitiesList){
if(!activity.isFinishing()){
activity.finish();
}
}
}
}
| [
"杨涛"
] | 杨涛 |
85430a14781369436126971c13a53e47242fff8f | b359be1e35f8e3511ebff548ef787c5468f08ead | /app/build/generated/source/r/debug/com/google/android/gms/R.java | d5c3fdf45f03b3f3409f397564de333d9a292596 | [
"MIT"
] | permissive | cumaliaba/cp1-1 | 9484ec094aa4aa836c5cfcdc0df940da03e8f95c | 2950246ffe8cc8bf0006476075cb6dfbac9a2f40 | refs/heads/master | 2021-05-14T17:02:51.704341 | 2018-01-02T16:46:17 | 2018-01-02T16:46:17 | 116,036,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,660 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms;
public final class R {
public static final class attr {
public static final int buttonSize = 0x7f030047;
public static final int circleCrop = 0x7f030054;
public static final int colorScheme = 0x7f030065;
public static final int imageAspectRatio = 0x7f0300b5;
public static final int imageAspectRatioAdjust = 0x7f0300b6;
public static final int scopeUris = 0x7f030100;
}
public static final class color {
public static final int common_google_signin_btn_text_dark = 0x7f05002d;
public static final int common_google_signin_btn_text_dark_default = 0x7f05002e;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f05002f;
public static final int common_google_signin_btn_text_dark_focused = 0x7f050030;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f050031;
public static final int common_google_signin_btn_text_light = 0x7f050032;
public static final int common_google_signin_btn_text_light_default = 0x7f050033;
public static final int common_google_signin_btn_text_light_disabled = 0x7f050034;
public static final int common_google_signin_btn_text_light_focused = 0x7f050035;
public static final int common_google_signin_btn_text_light_pressed = 0x7f050036;
public static final int common_google_signin_btn_tint = 0x7f050037;
}
public static final class drawable {
public static final int common_full_open_on_phone = 0x7f07005b;
public static final int common_google_signin_btn_icon_dark = 0x7f07005c;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f07005d;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f07005e;
public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f07005f;
public static final int common_google_signin_btn_icon_disabled = 0x7f070060;
public static final int common_google_signin_btn_icon_light = 0x7f070061;
public static final int common_google_signin_btn_icon_light_focused = 0x7f070062;
public static final int common_google_signin_btn_icon_light_normal = 0x7f070063;
public static final int common_google_signin_btn_icon_light_normal_background = 0x7f070064;
public static final int common_google_signin_btn_text_dark = 0x7f070065;
public static final int common_google_signin_btn_text_dark_focused = 0x7f070066;
public static final int common_google_signin_btn_text_dark_normal = 0x7f070067;
public static final int common_google_signin_btn_text_dark_normal_background = 0x7f070068;
public static final int common_google_signin_btn_text_disabled = 0x7f070069;
public static final int common_google_signin_btn_text_light = 0x7f07006a;
public static final int common_google_signin_btn_text_light_focused = 0x7f07006b;
public static final int common_google_signin_btn_text_light_normal = 0x7f07006c;
public static final int common_google_signin_btn_text_light_normal_background = 0x7f07006d;
public static final int googleg_disabled_color_18 = 0x7f070075;
public static final int googleg_standard_color_18 = 0x7f070076;
}
public static final class id {
public static final int adjust_height = 0x7f08001c;
public static final int adjust_width = 0x7f08001d;
public static final int auto = 0x7f080022;
public static final int center = 0x7f080029;
public static final int dark = 0x7f080036;
public static final int email = 0x7f080040;
public static final int icon_only = 0x7f080056;
public static final int light = 0x7f08005e;
public static final int none = 0x7f080071;
public static final int normal = 0x7f080072;
public static final int radio = 0x7f08007d;
public static final int standard = 0x7f0800a2;
public static final int text = 0x7f0800a9;
public static final int text2 = 0x7f0800aa;
public static final int wide = 0x7f0800c2;
public static final int wrap_content = 0x7f0800c4;
}
public static final class integer {
public static final int google_play_services_version = 0x7f090007;
}
public static final class string {
public static final int common_google_play_services_enable_button = 0x7f0c0026;
public static final int common_google_play_services_enable_text = 0x7f0c0027;
public static final int common_google_play_services_enable_title = 0x7f0c0028;
public static final int common_google_play_services_install_button = 0x7f0c0029;
public static final int common_google_play_services_install_text = 0x7f0c002a;
public static final int common_google_play_services_install_title = 0x7f0c002b;
public static final int common_google_play_services_notification_ticker = 0x7f0c002c;
public static final int common_google_play_services_unknown_issue = 0x7f0c002d;
public static final int common_google_play_services_unsupported_text = 0x7f0c002e;
public static final int common_google_play_services_update_button = 0x7f0c002f;
public static final int common_google_play_services_update_text = 0x7f0c0030;
public static final int common_google_play_services_update_title = 0x7f0c0031;
public static final int common_google_play_services_updating_text = 0x7f0c0032;
public static final int common_google_play_services_wear_update_text = 0x7f0c0033;
public static final int common_open_on_phone = 0x7f0c0034;
public static final int common_signin_button_text = 0x7f0c0035;
public static final int common_signin_button_text_long = 0x7f0c0036;
}
public static final class styleable {
public static final int[] LoadingImageView = { 0x7f030054, 0x7f0300b5, 0x7f0300b6 };
public static final int LoadingImageView_circleCrop = 0;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 2;
public static final int[] SignInButton = { 0x7f030047, 0x7f030065, 0x7f030100 };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
}
}
| [
"abalik@itu.edu.tr"
] | abalik@itu.edu.tr |
56d90c7c6cf5a04ad751d36e2b0e486bd58e3e6d | 977fd6f5cac109e99cebe9dca4d488a91de37d42 | /13_Collection/src/com/kh/chap03_map/part01_hashMap/model/vo/Snack.java | c8d40bc1dd766c7948e1015bb2e2f9cffba9ff70 | [] | no_license | hyeye1/kh_javaworkspace | 2d72794aa2596d232aa493e697616a368553b244 | 5c44da8248060297d2b0a0f8eeb7256d901de005 | refs/heads/master | 2023-04-04T09:16:49.835578 | 2021-03-18T04:33:53 | 2021-04-14T15:36:35 | 325,440,748 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package com.kh.chap03_map.part01_hashMap.model.vo;
public class Snack {
private String flavor;
private int calories;
public Snack() {}
public Snack(String flavor, int calories) {
super();
this.flavor = flavor;
this.calories = calories;
}
public String getFlavor() {
return flavor;
}
public void setFlavor(String flavor) {
this.flavor = flavor;
}
public int getCalories() {
return calories;
}
public void setCalories(int calories) {
this.calories = calories;
}
@Override
public String toString() {
return "Snack [flavor=" + flavor + ", calories=" + calories + "]";
}
}
| [
"hye.93@hotmail.com"
] | hye.93@hotmail.com |
d92c51616d9507808f2e718798c9492330b3b976 | 0fae43cf81d580877710c091377323c72d1fde5a | /HW4/cs5200_fall2019_tang_xinyu_jpa/src/main/java/edu/northeastern/cs5200/Cs5200Fall2019TangXinyuJpaApplication.java | 68b86f36b803ab14b000a04bbe001da891f3fdc5 | [] | no_license | tang0614/CS5200_XinyuTang | 23d06d29ee1f004c32ea766dd3eecb660e3f335c | 7d79d490487b011b8b39e485b30e573bfac977fd | refs/heads/master | 2020-08-09T05:58:04.357265 | 2019-11-21T04:14:16 | 2019-11-21T04:14:16 | 214,014,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package edu.northeastern.cs5200;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Cs5200Fall2019TangXinyuJpaApplication {
public static void main(String[] args) {
SpringApplication.run(Cs5200Fall2019TangXinyuJpaApplication.class, args);
}
}
| [
"xinyu.tang0614@gmail.com"
] | xinyu.tang0614@gmail.com |
706ed0986f4dabab218b205747399f6745c8cb44 | 8af6283426be9bb1deccb782eaa84479bfdade75 | /rest-service/src/test/java/org/example/controllers/DepartmentsRestControllerTest.java | 2286aa75c36ca7a38cde715c43965e3b4fc0b1be | [] | no_license | Denis-Milashuk/department-app | 0d32da14e825282888e7b332864575bbd5db6916 | 228fe22a21e62d9b4287a664250bce58c38d1f45 | refs/heads/master | 2023-03-03T00:07:12.430927 | 2021-01-24T20:23:54 | 2021-01-24T20:29:59 | 311,725,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,396 | java | package org.example.controllers;
import org.example.dao.JdbcDepartmentDAO;
import org.example.models.Department;
import org.example.models.Employee;
import org.example.models.PairCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.sql.Date;
import java.util.*;
@DisplayName("Start of DepartmentRestController testing")
public class DepartmentsRestControllerTest {
private static final Department DEPARTMENT = new Department();
private static final Employee EMPLOYEE = new Employee();
private static final ResponseEntity<List<Employee>> RESPONSE_ENTITY_OK = new ResponseEntity<>(HttpStatus.OK);
private static final ResponseEntity<List<Employee>> RESPONSE_ENTITY_CREATED = new ResponseEntity<>(HttpStatus.CREATED);
private static final ResponseEntity<List<Employee>> RESPONSE_ENTITY_NOT_FOUND = new ResponseEntity<>(HttpStatus.NOT_FOUND);
private static final ResponseEntity<List<Employee>> RESPONSE_ENTITY_NOT_MODIFIED = new ResponseEntity<>(HttpStatus.NOT_MODIFIED);
private static final JdbcDepartmentDAO DEPARTMENT_DAO = Mockito.mock(JdbcDepartmentDAO.class);
private static final DepartmentsRestController CONTROLLER = new DepartmentsRestController(DEPARTMENT_DAO);
@Test
@DisplayName("The getDepartmentsWithAverageSalaries method should return a correct ResponseEntity object")
public void getDepartmentsWithAverageSalaries(){
List<PairCase> responseList = new ArrayList<>();
Department department1 = new Department();
department1.setId(1);
department1.setTittle("First department");
Department department2 = new Department();
department2.setId(2);
department2.setTittle("Second department");
responseList.add(new PairCase(department1,3000d));
responseList.add(new PairCase(department2,5000d));
ResponseEntity<List<PairCase>> responseEntity = new ResponseEntity<>(responseList, HttpStatus.OK);
Mockito.when(DEPARTMENT_DAO.findAllAverageSalariesByDepartment()).thenReturn(responseList);
Assertions.assertEquals(responseEntity,CONTROLLER.getDepartmentsWithAverageSalaries());
Mockito.when(DEPARTMENT_DAO.findAllAverageSalariesByDepartment()).thenReturn(null);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getDepartmentsWithAverageSalaries());
Mockito.when(DEPARTMENT_DAO.findAllAverageSalariesByDepartment()).thenReturn(new ArrayList<>());
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getDepartmentsWithAverageSalaries());
}
@Test
@DisplayName("The getAllEmployeesByDepartmentId() method should return a correct ResponseEntity object")
public void getAllEmployeesByDepartmentId(){
List<Employee> responseList1 = new ArrayList<>();
List<Employee> responseList2 = new ArrayList<>();
List<Employee> responseList3 = new ArrayList<>();
Employee employee1 = new Employee();
employee1.setId(1);
employee1.setFirstName("Denis");;
Employee employee2 = new Employee();
employee1.setId(2);
employee1.setFirstName("Anna");
Employee employee3 = new Employee();
employee1.setId(3);
employee1.setFirstName("Barbara");
responseList1.add(employee1);
responseList1.add(employee2);
responseList1.add(employee3);
responseList2.add(employee1);
responseList2.add(employee2);
responseList3.add(employee3);
ResponseEntity<List<Employee>> responseEntity1 = new ResponseEntity<>(responseList1,HttpStatus.OK);
ResponseEntity<List<Employee>> responseEntity2 = new ResponseEntity<>(responseList2,HttpStatus.OK);
ResponseEntity<List<Employee>> responseEntity3 = new ResponseEntity<>(responseList3,HttpStatus.OK);
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1)).thenReturn(responseList1);
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1,new Date(123456))).thenReturn(responseList2);
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1,new Date(123),new Date(123456))).thenReturn(responseList3);
Assertions.assertEquals(responseEntity1,CONTROLLER.getAllEmployeesByDepartmentId(1,null,null));
Assertions.assertEquals(responseEntity2,CONTROLLER.getAllEmployeesByDepartmentId(1, new Date(123456),null));
Assertions.assertEquals(responseEntity3,CONTROLLER.getAllEmployeesByDepartmentId(1,new Date(123),new Date(123456)));
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1)).thenReturn(null);
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1,new Date(123456))).thenReturn(null);
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1,new Date(123),new Date(123456))).thenReturn(null);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getAllEmployeesByDepartmentId(1,null,null));
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getAllEmployeesByDepartmentId(1, new Date(123456),null));
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getAllEmployeesByDepartmentId(1,new Date(123),new Date(123456)));
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1)).thenReturn(new ArrayList<>());
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1,new Date(123456))).thenReturn(new ArrayList<>());
Mockito.when(DEPARTMENT_DAO.findEmployeesByDepartmentId(1,new Date(123),new Date(123456))).thenReturn(new ArrayList<>());
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getAllEmployeesByDepartmentId(1,null,null));
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getAllEmployeesByDepartmentId(1, new Date(123456),null));
Assertions.assertEquals(RESPONSE_ENTITY_NOT_FOUND,CONTROLLER.getAllEmployeesByDepartmentId(1,new Date(123),new Date(123456)));
}
@Test
@DisplayName("The createDepartment() method should return a correct ResponseEntity object")
public void createDepartment(){
Mockito.when(DEPARTMENT_DAO.addDepartment(DEPARTMENT)).thenReturn(true);
Assertions.assertEquals(RESPONSE_ENTITY_CREATED,CONTROLLER.createDepartment(DEPARTMENT));
Mockito.when(DEPARTMENT_DAO.addDepartment(DEPARTMENT)).thenReturn(false);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_MODIFIED,CONTROLLER.createDepartment(DEPARTMENT));
}
@Test
@DisplayName("The findDepartmentById() method should return a correct ResponseEntity object")
public void findDepartmentById(){
Mockito.when(DEPARTMENT_DAO.findDepartment(1)).thenReturn(DEPARTMENT);
ResponseEntity<Department> responseEntity = new ResponseEntity<>(DEPARTMENT,HttpStatus.OK);
Assertions.assertEquals(responseEntity,CONTROLLER.findDepartmentById(1));
Mockito.when(DEPARTMENT_DAO.findDepartment(1)).thenReturn(null);
Assertions.assertEquals(new ResponseEntity<Department>(HttpStatus.NOT_FOUND),CONTROLLER.findDepartmentById(1));
}
@Test
@DisplayName("The deleteDepartmentById() method should return a correct ResponseEntity object")
public void deleteDepartmentById(){
Mockito.when(DEPARTMENT_DAO.removeDepartment(1)).thenReturn(true);
Assertions.assertEquals(RESPONSE_ENTITY_OK,CONTROLLER.deleteDepartmentById(1));
Mockito.when(DEPARTMENT_DAO.removeDepartment(0)).thenReturn(false);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_MODIFIED,CONTROLLER.deleteDepartmentById(0));
}
@Test
@DisplayName("The updateDepartmentById() method should return a correct ResponseEntity object")
public void updateDepartmentById(){
Mockito.when(DEPARTMENT_DAO.updateDepartment(1, DEPARTMENT)).thenReturn(true);
Assertions.assertEquals(RESPONSE_ENTITY_OK,CONTROLLER.updateDepartmentById(1, DEPARTMENT));
Mockito.when(DEPARTMENT_DAO.updateDepartment(2, DEPARTMENT)).thenReturn(false);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_MODIFIED,CONTROLLER.updateDepartmentById(2, DEPARTMENT));
}
@Test
@DisplayName("The createEmployeeByDepartmentId() method should return a correct ResponseEntity object")
public void createEmployeeByDepartmentId(){
Mockito.when(DEPARTMENT_DAO.addEmployee(1, EMPLOYEE)).thenReturn(true);
Assertions.assertEquals(RESPONSE_ENTITY_CREATED,CONTROLLER.createEmployeeByDepartmentId(1, EMPLOYEE));
Mockito.when(DEPARTMENT_DAO.addEmployee(2, EMPLOYEE)).thenReturn(false);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_MODIFIED,CONTROLLER.createEmployeeByDepartmentId(2, EMPLOYEE));
}
@Test
@DisplayName("The findEmployeeById() method should return a correct ResponseEntity object")
public void findEmployeeById(){
Mockito.when(DEPARTMENT_DAO.findEmployeeById(1)).thenReturn(EMPLOYEE);
ResponseEntity<Employee> responseEntity = new ResponseEntity<>(EMPLOYEE,HttpStatus.OK);
Assertions.assertEquals(responseEntity,CONTROLLER.findEmployeeById(1,1));
Mockito.when(DEPARTMENT_DAO.findEmployeeById(2)).thenReturn(null);
Assertions.assertEquals(new ResponseEntity<>(HttpStatus.NOT_FOUND),CONTROLLER.findEmployeeById(1,2));
}
@Test
@DisplayName("The deleteEmployeeById() method should return a correct ResponseEntity object")
public void deleteEmployeeById(){
Mockito.when(DEPARTMENT_DAO.removeEmployee(1)).thenReturn(true);
Assertions.assertEquals(RESPONSE_ENTITY_OK,CONTROLLER.deleteEmployeeById(1,1));
Mockito.when(DEPARTMENT_DAO.removeEmployee(2)).thenReturn(false);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_MODIFIED,CONTROLLER.deleteEmployeeById(1,2));
}
@Test
@DisplayName("The updateEmployeeById() method should return a correct ResponseEntity object")
public void updateEmployeeById(){
Mockito.when(DEPARTMENT_DAO.updateEmployee(1,EMPLOYEE)).thenReturn(true);
Assertions.assertEquals(RESPONSE_ENTITY_OK,CONTROLLER.updateEmployeeById(1,1,EMPLOYEE));
Mockito.when(DEPARTMENT_DAO.updateEmployee(2,EMPLOYEE)).thenReturn(false);
Assertions.assertEquals(RESPONSE_ENTITY_NOT_MODIFIED,CONTROLLER.updateEmployeeById(1,2,EMPLOYEE));
}
}
| [
"ilovehardrock@mail.ru"
] | ilovehardrock@mail.ru |
bbb6d829a2248ebd24d678f0c588adfb41b7c06a | 0193343039a84d586702cddcdc02075b8a0b48af | /src/main/java/com/springmvclearn/mapper/UserMapper.java | d5e04879b1e8341a30cd1be6a2f7354fa8d2b967 | [] | no_license | burstlink/FruitSalesPlatform | 22970f47e5b909ee3ccc4d5243c698d676945688 | 1ff74bf865e92a8ecebf6ade2a86c96e289ffa77 | refs/heads/master | 2023-01-21T14:40:52.309447 | 2020-11-20T10:37:59 | 2020-11-20T10:37:59 | 297,308,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64 | java | package com.springmvclearn.mapper;
public class UserMapper {
}
| [
"liyy.fnst@fujitsu.com"
] | liyy.fnst@fujitsu.com |
be3e3daaa55ba945d47a8119c79a29c57c7a9cdd | 4c0348c5c02254f38133e660017e8f1892660ba1 | /src/main/java/com/github/supermoonie/type/page/DownLoadBehaviorType.java | cbf582aee0e15606ad17cb564bdf63510fe339d1 | [] | no_license | supermoonie/AutoChrome | 1a8d726e63224f05b53bd2f32676d8840001b3c2 | 27a5f72e78f3cf88a6c72f0001ffa0cd354589af | refs/heads/master | 2022-07-02T07:56:53.786185 | 2021-09-26T06:11:06 | 2021-09-26T06:11:06 | 145,181,090 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package com.github.supermoonie.type.page;
import com.alibaba.fastjson.annotation.JSONField;
/**
* @author supermoonie
* @since 2018/11/28
*/
public enum DownLoadBehaviorType {
/**
* deny
*/
deny("deny"),
/**
* allow
*/
allow("allow"),
/**
* default
*/
@JSONField(name = "default")
Default("default")
;
private final String value;
DownLoadBehaviorType(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
}
| [
"wangchao_moonie@163.com"
] | wangchao_moonie@163.com |
3d7abe7062c8aa0303610d60a51238b8d70d98fc | a9d882e3aa37482dae7ce3ee1dd08aa02a9d6e6d | /src/events/org/hpin/events/entity/ErpConference.java | 6cea2562e579f12d36a2d92c58ec56acd7a2a761 | [] | no_license | dym3093/hlSys | df5b0158fe4a4b4f3fb3dd81a757f5c800ca6bf7 | 40892bf0b0f8b4cce1ac1b81776bd1a65151e01e | refs/heads/master | 2021-01-20T04:25:52.590206 | 2017-04-30T15:42:04 | 2017-04-30T15:42:04 | 89,689,302 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,136 | java | /**
*
*/
package org.hpin.events.entity;
import java.math.BigDecimal;
import java.util.Date;
import org.hpin.common.core.orm.BaseEntity;
/**
* 公司名称: 远盟康健(北京)科技有限公司
*
* author: dengqin
* createDate: 2016-3-29 上午11:53:42
*/
/**
* @author dengqin
*
*/
public class ErpConference extends BaseEntity{
private String id;
private String conferenceType;//会议类型
private String conferenceNo;//会议号
private Date conferenceDate;//会议日期
private String address;//会议地址
private String branchCompany;//支公司
private String branchCompanyId;//支公司ID
private String ownedCompany;//所属公司
private String ownedCompanyId;//所属公司ID
private Integer headcount;//预计人数
private Integer nowHeadcount;//现有人数
private Integer isDeleted;//是否删除 0正常1删除2取消
private Integer isExpress;//是否寄快递
private String createUserName;//创建者
private Date createTime;//创建时间
private String updateUserName;//更新用户名
private Date updateTime;//更新时间
private String ename; //快递姓名
private String etrackingNumber;//快递单号
private Date edate;//快递时间
private String hour;//时间
private String provice; //省份
private String city;//城市
private Integer settNumbers; //结算的人数
private Double produceCost; //产生的费用
private String proUser; //项目负责人
private String proCode; //项目编码
private String proBelong; //项目名称
private String customerRelationShipProId; //HL_CUSTOMER_RELATIONSHIP_PRO的ID create by henry.xu 20160919;
private String cancelReason; //取消原因 create by sirius.ma 20161122;
public String getCancelReason() {
return cancelReason;
}
public void setCancelReason(String cancelReason) {
this.cancelReason = cancelReason;
}
public String getCustomerRelationShipProId() {
return customerRelationShipProId;
}
public void setCustomerRelationShipProId(String customerRelationShipProId) {
this.customerRelationShipProId = customerRelationShipProId;
}
public String getProUser() {
return proUser;
}
public void setProUser(String proUser) {
this.proUser = proUser;
}
public String getProCode() {
return proCode;
}
public void setProCode(String proCode) {
this.proCode = proCode;
}
public String getProBelong() {
return proBelong;
}
public void setProBelong(String proBelong) {
this.proBelong = proBelong;
}
/**
* @return the ownedCompanyId
*/
public String getOwnedCompanyId() {
return ownedCompanyId;
}
/**
* @param ownedCompanyId the ownedCompanyId to set
*/
public void setOwnedCompanyId(String ownedCompanyId) {
this.ownedCompanyId = ownedCompanyId;
}
/**
* @return the branchCompanyId
*/
public String getBranchCompanyId() {
return branchCompanyId;
}
/**
* @param branchCompanyId the branchCompanyId to set
*/
public void setBranchCompanyId(String branchCompanyId) {
this.branchCompanyId = branchCompanyId;
}
/**
* @return the conferenceType
*/
public String getConferenceType() {
return conferenceType;
}
/**
* @param conferenceType the conferenceType to set
*/
public void setConferenceType(String conferenceType) {
this.conferenceType = conferenceType;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the conferenceNo
*/
public String getConferenceNo() {
return conferenceNo;
}
/**
* @param conferenceNo the conferenceNo to set
*/
public void setConferenceNo(String conferenceNo) {
this.conferenceNo = conferenceNo;
}
/**
* @return the conferenceDate
*/
public Date getConferenceDate() {
return conferenceDate;
}
/**
* @param conferenceDate the conferenceDate to set
*/
public void setConferenceDate(Date conferenceDate) {
this.conferenceDate = conferenceDate;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the branchCompany
*/
public String getBranchCompany() {
return branchCompany;
}
/**
* @param branchCompany the branchCompany to set
*/
public void setBranchCompany(String branchCompany) {
this.branchCompany = branchCompany;
}
/**
* @return the ownedCompany
*/
public String getOwnedCompany() {
return ownedCompany;
}
/**
* @param ownedCompany the ownedCompany to set
*/
public void setOwnedCompany(String ownedCompany) {
this.ownedCompany = ownedCompany;
}
/**
* @return the headcount
*/
public Integer getHeadcount() {
return headcount;
}
/**
* @param headcount the headcount to set
*/
public void setHeadcount(Integer headcount) {
this.headcount = headcount;
}
/**
* @return the nowHeadcount
*/
public Integer getNowHeadcount() {
return nowHeadcount;
}
/**
* @param nowHeadcount the nowHeadcount to set
*/
public void setNowHeadcount(Integer nowHeadcount) {
this.nowHeadcount = nowHeadcount;
}
/**
* @return the isDeleted
*/
public Integer getIsDeleted() {
return isDeleted;
}
/**
* @param isDeleted the isDeleted to set
*/
public void setIsDeleted(Integer isDeleted) {
this.isDeleted = isDeleted;
}
/**
* @return the isExpress
*/
public Integer getIsExpress() {
return isExpress;
}
/**
* @param isExpress the isExpress to set
*/
public void setIsExpress(Integer isExpress) {
this.isExpress = isExpress;
}
/**
* @return the createUserName
*/
public String getCreateUserName() {
return createUserName;
}
/**
* @param createUserName the createUserName to set
*/
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
/**
* @return the createTime
*/
public Date getCreateTime() {
return createTime;
}
/**
* @param createTime the createTime to set
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* @return the updateUserName
*/
public String getUpdateUserName() {
return updateUserName;
}
/**
* @param updateUserName the updateUserName to set
*/
public void setUpdateUserName(String updateUserName) {
this.updateUserName = updateUserName;
}
/**
* @return the updateTime
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* @param updateTime the updateTime to set
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* @return the ename
*/
public String getEname() {
return ename;
}
/**
* @param ename the ename to set
*/
public void setEname(String ename) {
this.ename = ename;
}
/**
* @return the etrackingNumber
*/
public String getEtrackingNumber() {
return etrackingNumber;
}
/**
* @param etrackingNumber the etrackingNumber to set
*/
public void setEtrackingNumber(String etrackingNumber) {
this.etrackingNumber = etrackingNumber;
}
/**
* @return the edate
*/
public Date getEdate() {
return edate;
}
/**
* @param edate the edate to set
*/
public void setEdate(Date edate) {
this.edate = edate;
}
/**
* @return the hour
*/
public String getHour() {
return hour;
}
/**
* @param hour the hour to set
*/
public void setHour(String hour) {
this.hour = hour;
}
/**
* @return the provice
*/
public String getProvice() {
return provice;
}
/**
* @param provice the provice to set
*/
public void setProvice(String provice) {
this.provice = provice;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
public Integer getSettNumbers() {
return settNumbers;
}
public void setSettNumbers(Integer settNumbers) {
this.settNumbers = settNumbers;
}
public Double getProduceCost() {
return produceCost;
}
public void setProduceCost(Double produceCost) {
this.produceCost = produceCost;
}
}
| [
"youming3093@163.com"
] | youming3093@163.com |
6a19ce5da083e45633bf614ab40feb0a1aa702fc | 0eada92fc9b3a986906aa73c927c356e2c0184c2 | /gmall-publisher/src/main/java/com/me/gmallpublisher/bean/Options.java | 01e6b090e8adea767bec732e440b641873fdff35 | [
"MIT"
] | permissive | zzzzzzzs/SparkStreamingRealTimeProjectAnalysis | 743fc4cd7963aeebe892b22f3a8f3e3a9ad4b5d1 | de4a6c1e9b0d13bd93f07d5ce606d4a71941651b | refs/heads/main | 2023-09-01T14:16:21.362132 | 2021-11-05T14:18:37 | 2021-11-05T14:18:37 | 358,891,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package com.me.gmallpublisher.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Options {
private String name;
private Double value;
}
| [
"1443539042@qq.com"
] | 1443539042@qq.com |
a675537a57821ba36220fed4de2d2f95e33d66a5 | 56c6713ebe1e6a00fe228ca6092a6b1b271e8908 | /Spring/sample/src/main/java/com/bitcamp/cobsp/crawlingController.java | 2986c74c2e3d65e7045daf9ef3617ea400b64be6 | [] | no_license | parksangmyeong1/JavaWorkspace | 442458fcfbcda8054afd2238725caf413516ff8e | 9c73c07ea5d24348ef363a0b563a112e61d51d4b | refs/heads/main | 2023-08-18T02:19:06.779231 | 2021-10-03T13:59:22 | 2021-10-03T13:59:22 | 386,251,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java | package com.bitcamp.cobsp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class crawlingController {
@Autowired
private NaverBlogService service;
@RequestMapping(value="craw/crawling_ajax", produces = "application/text; charset=UTF-8")
@ResponseBody
public String selectBlog(Model model,
@RequestParam("keyword")String keyword){
if(keyword != null) {
model.addAttribute("list", service.searchBlog(keyword));
}
return service.searchBlog(keyword);
}
}
| [
"psm950324@naver.com"
] | psm950324@naver.com |
32e4bb802a6117a5336cca3e3974c6df884c10dc | 439a98c4b7ba96a692a2309afb1d7e40a972d80b | /src/dp/LongestCommonSubstring.java | 1c9592dee60b9ee5db3fd72400e2b874e30fb49e | [] | no_license | jeetmpatel1/competitive_programming | a6f9cc42599154238f00809fb9145f965df03745 | 73f8054fda1f7e30d91d46aa1aaaafadbfc81828 | refs/heads/master | 2020-09-26T06:05:34.918524 | 2019-12-07T21:57:57 | 2019-12-07T21:57:57 | 226,183,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,369 | java | package dp;
public class LongestCommonSubstring {
public static String printLongestCommonSubstring(String first,String second){
int firstLen = first.length();
int secondLen = second.length();
int[][] ans = new int [firstLen+1][secondLen+1];
for(int i=0;i<=firstLen;i++){
ans[i][0] = 0;
}
for(int j=0;j<=secondLen;j++){
ans[0][j] = 0;
}
int rowOfFinalMatch=0,colOfFinalMatch=0,lengthOfCommonSubstring=0;
int maxTillNow = Integer.MIN_VALUE;
for (int i = 1; i <= firstLen; i++) {
for (int j = 1; j <= secondLen; j++) {
if(first.charAt(i-1) == second.charAt(j-1)){
ans[i][j] = 1 + ans[i-1][j-1] ;
if(ans[i][j]>maxTillNow){
maxTillNow = ans[i][j];
lengthOfCommonSubstring = maxTillNow;
rowOfFinalMatch = i;
colOfFinalMatch = j;
}
}else{
ans[i][j] = 0;
}
}
}
String commonSubstring = "";
while (lengthOfCommonSubstring != 0) {
commonSubstring = first.charAt(rowOfFinalMatch-1) + commonSubstring;
lengthOfCommonSubstring--;
rowOfFinalMatch--;
}
return commonSubstring;
}
public static void main(String[] args) {
/*//Test case 1
String first = "bdb";
String second = "abdeb";*/
String first = "zxabcdezy";
String second = "yzabcdezx";
String finalAns = printLongestCommonSubstring(first,second);
System.out.println(finalAns);
}
}
| [
"jeet.mpatel1@gmail.com"
] | jeet.mpatel1@gmail.com |
d01609afa77370c5cb92b9efc544e702e6cbb06c | 314e8a93a7ad4bc950710f91c3dd42f3e2c3932c | /cat-api/src/main/java/com/eeyoo/cat/api/mapper/SysLogMapper.java | 30abbc80c65623c5f3983515afc7fec8d27216fd | [
"MIT"
] | permissive | allenwoode/cat | 074bb1cb792e03eac3bd0a6093ca45f127c90325 | 657245549b9d4770f556957e013117a7672ab345 | refs/heads/master | 2023-05-26T08:17:07.470165 | 2021-06-17T23:25:28 | 2021-06-17T23:25:28 | 374,412,534 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | /**
* Copyright (c), 2015-2021, io.eye
* FileName: SysLogMapper
* Author: feilin
* Date: 2021/6/18 上午12:40
* Description:
*/
package com.eeyoo.cat.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eeyoo.cat.api.domain.model.SysLog;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysLogMapper extends BaseMapper<SysLog> {
}
| [
"gfw.crack.out@gmail.com"
] | gfw.crack.out@gmail.com |
1fefec1e4df8693999d8efb6a9104f7081e52db3 | 413209c6556a77141da9617e03b28f887632da22 | /src/gen/java/com/opendatapolicing/enus/agency/SiteAgencyGenPageGen.java | 7b6dba9724f88dc44eb22ffd0e3962d5e3229835 | [] | no_license | mynamo/opendatapolicing | 39f04b28eb2db7e37d04404f15423f6a0edade27 | e3e5b7d7832ed5628b445359f452e2136139f435 | refs/heads/master | 2023-02-13T03:43:10.678172 | 2021-01-05T06:38:39 | 2021-01-05T06:38:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,553 | java | package com.opendatapolicing.enus.agency;
import java.util.Arrays;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
import java.text.NumberFormat;
import io.vertx.core.logging.LoggerFactory;
import com.opendatapolicing.enus.search.SearchList;
import java.util.ArrayList;
import org.apache.commons.collections.CollectionUtils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.vertx.core.logging.Logger;
import java.math.RoundingMode;
import com.opendatapolicing.enus.wrap.Wrap;
import java.math.MathContext;
import com.opendatapolicing.enus.writer.AllWriter;
import org.apache.commons.text.StringEscapeUtils;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.opendatapolicing.enus.request.api.ApiRequest;
import java.util.Objects;
import io.vertx.core.json.JsonArray;
import com.opendatapolicing.enus.page.PageLayout;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.Optional;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.opendatapolicing.enus.cluster.Cluster;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.opendatapolicing.enus.agency.SiteAgency;
import com.opendatapolicing.enus.request.SiteRequestEnUS;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
/**
* <br/><a href="http://localhost:8983/solr/computate/select?q=*:*&fq=partEstClasse_indexed_boolean:true&fq=classeNomCanonique_enUS_indexed_string:com.opendatapolicing.enus.agency.SiteAgencyGenPage&fq=classeEtendGen_indexed_boolean:true">Find the class in Solr. </a>
* <br/>
**/
public abstract class SiteAgencyGenPageGen<DEV> extends PageLayout {
protected static final Logger LOGGER = LoggerFactory.getLogger(SiteAgencyGenPage.class);
////////////////////
// listSiteAgency //
////////////////////
/** The entity listSiteAgency
* is defined as null before being initialized.
*/
@JsonInclude(Include.NON_NULL)
protected SearchList<SiteAgency> listSiteAgency;
@JsonIgnore
public Wrap<SearchList<SiteAgency>> listSiteAgencyWrap = new Wrap<SearchList<SiteAgency>>().p(this).c(SearchList.class).var("listSiteAgency").o(listSiteAgency);
/** <br/> The entity listSiteAgency
* is defined as null before being initialized.
* <br/><a href="http://localhost:8983/solr/computate/select?q=*:*&fq=partEstEntite_indexed_boolean:true&fq=classeNomCanonique_enUS_indexed_string:com.opendatapolicing.enus.agency.SiteAgencyGenPage&fq=classeEtendGen_indexed_boolean:true&fq=entiteVar_enUS_indexed_string:listSiteAgency">Find the entity listSiteAgency in Solr</a>
* <br/>
* @param c is for wrapping a value to assign to this entity during initialization.
**/
protected abstract void _listSiteAgency(Wrap<SearchList<SiteAgency>> c);
public SearchList<SiteAgency> getListSiteAgency() {
return listSiteAgency;
}
public void setListSiteAgency(SearchList<SiteAgency> listSiteAgency) {
this.listSiteAgency = listSiteAgency;
this.listSiteAgencyWrap.alreadyInitialized = true;
}
public static SearchList<SiteAgency> staticSetListSiteAgency(SiteRequestEnUS siteRequest_, String o) {
return null;
}
protected SiteAgencyGenPage listSiteAgencyInit() {
if(!listSiteAgencyWrap.alreadyInitialized) {
_listSiteAgency(listSiteAgencyWrap);
if(listSiteAgency == null)
setListSiteAgency(listSiteAgencyWrap.o);
}
if(listSiteAgency != null)
listSiteAgency.initDeepForClass(siteRequest_);
listSiteAgencyWrap.alreadyInitialized(true);
return (SiteAgencyGenPage)this;
}
/////////////////
// siteAgency_ //
/////////////////
/** The entity siteAgency_
* is defined as null before being initialized.
*/
@JsonInclude(Include.NON_NULL)
protected SiteAgency siteAgency_;
@JsonIgnore
public Wrap<SiteAgency> siteAgency_Wrap = new Wrap<SiteAgency>().p(this).c(SiteAgency.class).var("siteAgency_").o(siteAgency_);
/** <br/> The entity siteAgency_
* is defined as null before being initialized.
* <br/><a href="http://localhost:8983/solr/computate/select?q=*:*&fq=partEstEntite_indexed_boolean:true&fq=classeNomCanonique_enUS_indexed_string:com.opendatapolicing.enus.agency.SiteAgencyGenPage&fq=classeEtendGen_indexed_boolean:true&fq=entiteVar_enUS_indexed_string:siteAgency_">Find the entity siteAgency_ in Solr</a>
* <br/>
* @param c is for wrapping a value to assign to this entity during initialization.
**/
protected abstract void _siteAgency_(Wrap<SiteAgency> c);
public SiteAgency getSiteAgency_() {
return siteAgency_;
}
public void setSiteAgency_(SiteAgency siteAgency_) {
this.siteAgency_ = siteAgency_;
this.siteAgency_Wrap.alreadyInitialized = true;
}
public static SiteAgency staticSetSiteAgency_(SiteRequestEnUS siteRequest_, String o) {
return null;
}
protected SiteAgencyGenPage siteAgency_Init() {
if(!siteAgency_Wrap.alreadyInitialized) {
_siteAgency_(siteAgency_Wrap);
if(siteAgency_ == null)
setSiteAgency_(siteAgency_Wrap.o);
}
siteAgency_Wrap.alreadyInitialized(true);
return (SiteAgencyGenPage)this;
}
//////////////
// initDeep //
//////////////
protected boolean alreadyInitializedSiteAgencyGenPage = false;
public SiteAgencyGenPage initDeepSiteAgencyGenPage(SiteRequestEnUS siteRequest_) {
setSiteRequest_(siteRequest_);
if(!alreadyInitializedSiteAgencyGenPage) {
alreadyInitializedSiteAgencyGenPage = true;
initDeepSiteAgencyGenPage();
}
return (SiteAgencyGenPage)this;
}
public void initDeepSiteAgencyGenPage() {
initSiteAgencyGenPage();
super.initDeepPageLayout(siteRequest_);
}
public void initSiteAgencyGenPage() {
listSiteAgencyInit();
siteAgency_Init();
}
@Override public void initDeepForClass(SiteRequestEnUS siteRequest_) {
initDeepSiteAgencyGenPage(siteRequest_);
}
/////////////////
// siteRequest //
/////////////////
public void siteRequestSiteAgencyGenPage(SiteRequestEnUS siteRequest_) {
super.siteRequestPageLayout(siteRequest_);
if(listSiteAgency != null)
listSiteAgency.setSiteRequest_(siteRequest_);
}
public void siteRequestForClass(SiteRequestEnUS siteRequest_) {
siteRequestSiteAgencyGenPage(siteRequest_);
}
/////////////
// obtain //
/////////////
@Override public Object obtainForClass(String var) {
String[] vars = StringUtils.split(var, ".");
Object o = null;
for(String v : vars) {
if(o == null)
o = obtainSiteAgencyGenPage(v);
else if(o instanceof Cluster) {
Cluster cluster = (Cluster)o;
o = cluster.obtainForClass(v);
}
}
return o;
}
public Object obtainSiteAgencyGenPage(String var) {
SiteAgencyGenPage oSiteAgencyGenPage = (SiteAgencyGenPage)this;
switch(var) {
case "listSiteAgency":
return oSiteAgencyGenPage.listSiteAgency;
case "siteAgency_":
return oSiteAgencyGenPage.siteAgency_;
default:
return super.obtainPageLayout(var);
}
}
///////////////
// attribute //
///////////////
@Override public boolean attributeForClass(String var, Object val) {
String[] vars = StringUtils.split(var, ".");
Object o = null;
for(String v : vars) {
if(o == null)
o = attributeSiteAgencyGenPage(v, val);
else if(o instanceof Cluster) {
Cluster cluster = (Cluster)o;
o = cluster.attributeForClass(v, val);
}
}
return o != null;
}
public Object attributeSiteAgencyGenPage(String var, Object val) {
SiteAgencyGenPage oSiteAgencyGenPage = (SiteAgencyGenPage)this;
switch(var) {
default:
return super.attributePageLayout(var, val);
}
}
///////////////
// staticSet //
///////////////
public static Object staticSetForClass(String entityVar, SiteRequestEnUS siteRequest_, String o) {
return staticSetSiteAgencyGenPage(entityVar, siteRequest_, o);
}
public static Object staticSetSiteAgencyGenPage(String entityVar, SiteRequestEnUS siteRequest_, String o) {
switch(entityVar) {
default:
return PageLayout.staticSetPageLayout(entityVar, siteRequest_, o);
}
}
////////////////
// staticSolr //
////////////////
public static Object staticSolrForClass(String entityVar, SiteRequestEnUS siteRequest_, Object o) {
return staticSolrSiteAgencyGenPage(entityVar, siteRequest_, o);
}
public static Object staticSolrSiteAgencyGenPage(String entityVar, SiteRequestEnUS siteRequest_, Object o) {
switch(entityVar) {
default:
return PageLayout.staticSolrPageLayout(entityVar, siteRequest_, o);
}
}
///////////////////
// staticSolrStr //
///////////////////
public static String staticSolrStrForClass(String entityVar, SiteRequestEnUS siteRequest_, Object o) {
return staticSolrStrSiteAgencyGenPage(entityVar, siteRequest_, o);
}
public static String staticSolrStrSiteAgencyGenPage(String entityVar, SiteRequestEnUS siteRequest_, Object o) {
switch(entityVar) {
default:
return PageLayout.staticSolrStrPageLayout(entityVar, siteRequest_, o);
}
}
//////////////////
// staticSolrFq //
//////////////////
public static String staticSolrFqForClass(String entityVar, SiteRequestEnUS siteRequest_, String o) {
return staticSolrFqSiteAgencyGenPage(entityVar, siteRequest_, o);
}
public static String staticSolrFqSiteAgencyGenPage(String entityVar, SiteRequestEnUS siteRequest_, String o) {
switch(entityVar) {
default:
return PageLayout.staticSolrFqPageLayout(entityVar, siteRequest_, o);
}
}
/////////////
// define //
/////////////
@Override public boolean defineForClass(String var, String val) {
String[] vars = StringUtils.split(var, ".");
Object o = null;
if(val != null) {
for(String v : vars) {
if(o == null)
o = defineSiteAgencyGenPage(v, val);
else if(o instanceof Cluster) {
Cluster cluster = (Cluster)o;
o = cluster.defineForClass(v, val);
}
}
}
return o != null;
}
public Object defineSiteAgencyGenPage(String var, String val) {
switch(var) {
default:
return super.definePageLayout(var, val);
}
}
/////////////////
// htmlScripts //
/////////////////
@Override public void htmlScripts() {
htmlScriptsSiteAgencyGenPage();
super.htmlScripts();
}
public void htmlScriptsSiteAgencyGenPage() {
}
////////////////
// htmlScript //
////////////////
@Override public void htmlScript() {
htmlScriptSiteAgencyGenPage();
super.htmlScript();
}
public void htmlScriptSiteAgencyGenPage() {
}
//////////////
// htmlBody //
//////////////
@Override public void htmlBody() {
htmlBodySiteAgencyGenPage();
super.htmlBody();
}
public void htmlBodySiteAgencyGenPage() {
}
//////////
// html //
//////////
@Override public void html() {
htmlSiteAgencyGenPage();
super.html();
}
public void htmlSiteAgencyGenPage() {
}
//////////////
// htmlMeta //
//////////////
@Override public void htmlMeta() {
htmlMetaSiteAgencyGenPage();
super.htmlMeta();
}
public void htmlMetaSiteAgencyGenPage() {
}
////////////////
// htmlStyles //
////////////////
@Override public void htmlStyles() {
htmlStylesSiteAgencyGenPage();
super.htmlStyles();
}
public void htmlStylesSiteAgencyGenPage() {
}
///////////////
// htmlStyle //
///////////////
@Override public void htmlStyle() {
htmlStyleSiteAgencyGenPage();
super.htmlStyle();
}
public void htmlStyleSiteAgencyGenPage() {
}
//////////////////
// apiRequest //
//////////////////
public void apiRequestSiteAgencyGenPage() {
ApiRequest apiRequest = Optional.ofNullable(siteRequest_).map(SiteRequestEnUS::getApiRequest_).orElse(null);
Object o = Optional.ofNullable(apiRequest).map(ApiRequest::getOriginal).orElse(null);
if(o != null && o instanceof SiteAgencyGenPage) {
SiteAgencyGenPage original = (SiteAgencyGenPage)o;
super.apiRequestPageLayout();
}
}
//////////////
// hashCode //
//////////////
@Override public int hashCode() {
return Objects.hash(super.hashCode());
}
////////////
// equals //
////////////
@Override public boolean equals(Object o) {
if(this == o)
return true;
if(!(o instanceof SiteAgencyGenPage))
return false;
SiteAgencyGenPage that = (SiteAgencyGenPage)o;
return super.equals(o);
}
//////////////
// toString //
//////////////
@Override public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString() + "\n");
sb.append("SiteAgencyGenPage { ");
sb.append(" }");
return sb.toString();
}
}
| [
"computate@computate.org"
] | computate@computate.org |
131b2dd9f6be98101017b059d1a8e532430ea510 | 5dfc124046167f46e6f67bfde9bc1bdb717e536b | /stellarj-herder/src/main/java/com/consumimurigni/stellarj/ledger/xdr/LedgerHeaderHistoryEntry.java | 438fc52785acb3e123436051317fdda3ee5fb037 | [
"Apache-2.0"
] | permissive | michelegonella/stellarj | f8a6aad0c114ec4745deed8f2d68ad97e7cbeb0d | 24c12dc2dd1b2b3152e5e7dc1cc16b8c7886388a | refs/heads/master | 2021-01-19T17:39:08.595699 | 2017-11-02T13:37:08 | 2017-11-02T13:37:08 | 101,081,047 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,203 | java | // Automatically generated by xdrgen
// DO NOT EDIT or your changes may be overwritten
package com.consumimurigni.stellarj.ledger.xdr;
import java.io.IOException;
import com.consuminurigni.stellarj.xdr.Hash;
import com.consuminurigni.stellarj.xdr.XdrDataInputStream;
import com.consuminurigni.stellarj.xdr.XdrDataOutputStream;
// === xdr source ============================================================
// struct LedgerHeaderHistoryEntry
// {
// Hash hash;
// LedgerHeader header;
//
// // reserved for future use
// union switch (int v)
// {
// case 0:
// void;
// }
// ext;
// };
// ===========================================================================
public class LedgerHeaderHistoryEntry {
public LedgerHeaderHistoryEntry () {}
private Hash hash;
public Hash getHash() {
return this.hash;
}
public void setHash(Hash value) {
this.hash = value;
}
private LedgerHeader header;
public LedgerHeader getHeader() {
return this.header;
}
public void setHeader(LedgerHeader value) {
this.header = value;
}
private LedgerHeaderHistoryEntryExt ext;
public LedgerHeaderHistoryEntryExt getExt() {
return this.ext;
}
public void setExt(LedgerHeaderHistoryEntryExt value) {
this.ext = value;
}
public static void encode(XdrDataOutputStream stream, LedgerHeaderHistoryEntry encodedLedgerHeaderHistoryEntry) throws IOException{
Hash.encode(stream, encodedLedgerHeaderHistoryEntry.hash);
LedgerHeader.encode(stream, encodedLedgerHeaderHistoryEntry.header);
LedgerHeaderHistoryEntryExt.encode(stream, encodedLedgerHeaderHistoryEntry.ext);
}
public static LedgerHeaderHistoryEntry decode(XdrDataInputStream stream) throws IOException {
LedgerHeaderHistoryEntry decodedLedgerHeaderHistoryEntry = new LedgerHeaderHistoryEntry();
decodedLedgerHeaderHistoryEntry.hash = Hash.decode(stream);
decodedLedgerHeaderHistoryEntry.header = LedgerHeader.decode(stream);
decodedLedgerHeaderHistoryEntry.ext = LedgerHeaderHistoryEntryExt.decode(stream);
return decodedLedgerHeaderHistoryEntry;
}
public static class LedgerHeaderHistoryEntryExt {
public LedgerHeaderHistoryEntryExt () {}
Integer v;
public Integer getDiscriminant() {
return this.v;
}
public void setDiscriminant(Integer value) {
this.v = value;
}
public static void encode(XdrDataOutputStream stream, LedgerHeaderHistoryEntryExt encodedLedgerHeaderHistoryEntryExt) throws IOException {
stream.writeInt(encodedLedgerHeaderHistoryEntryExt.getDiscriminant().intValue());
switch (encodedLedgerHeaderHistoryEntryExt.getDiscriminant()) {
case 0:
break;
}
}
public static LedgerHeaderHistoryEntryExt decode(XdrDataInputStream stream) throws IOException {
LedgerHeaderHistoryEntryExt decodedLedgerHeaderHistoryEntryExt = new LedgerHeaderHistoryEntryExt();
Integer discriminant = stream.readInt();
decodedLedgerHeaderHistoryEntryExt.setDiscriminant(discriminant);
switch (decodedLedgerHeaderHistoryEntryExt.getDiscriminant()) {
case 0:
break;
}
return decodedLedgerHeaderHistoryEntryExt;
}
}
}
| [
"michele@leonidas"
] | michele@leonidas |
6e29d81aba36cab1cc2f76d9a8573532bf74ff51 | e3c25ddfd0048e4f7b16629d58fe8c7ab2732cf1 | /chapter4/MinutesToYearsDaysCalculator/src/academy/learnprogramming/MinutesToYearsDaysCalculator.java | 162c29900ead306c2472e840d3d380ee492c81d4 | [] | no_license | voicihojun/JavaProgramming | 63891177e2d373e91f619081b25a00863a9fb696 | 7a0929648f06aa8bbcc9226fd60e494b328c446e | refs/heads/master | 2020-07-20T14:18:45.954543 | 2019-11-15T02:39:02 | 2019-11-15T02:39:02 | 206,657,285 | 0 | 0 | null | 2019-11-15T02:39:04 | 2019-09-05T21:05:17 | Java | UTF-8 | Java | false | false | 504 | java | package academy.learnprogramming;
public class MinutesToYearsDaysCalculator {
public static void printYearsAndDays(long minutes) {
if(minutes < 0) {
System.out.println("Invalid Value");
} else {
long days = minutes / 60 / 24;
long years = days / 365;
long remainingDays = days % 365;
String result = minutes + " min = " + years + " y and " + remainingDays + " d";
System.out.println(result);
}
}
}
| [
"voicihojun@gmail.com"
] | voicihojun@gmail.com |
c69b362565d3ee0245ee4acb27637187c1d4ed86 | 990c7e6a9e74840efef5de6d38ac0f76b7c31932 | /algorithm_questions/LC*PascalTriangleII/PascalTriangleII.java | a5c8a65144ef6ad5a7137d8d49de74387055ada3 | [] | no_license | huilaner/huilaner.github.io | b61981fbbd4e744c3cb85f2dbcf977bb7344ab94 | f8b0e7f3ffba435e3bf821afccc1b3a324126f8b | refs/heads/master | 2021-01-14T08:22:38.088994 | 2017-05-15T11:53:01 | 2017-05-15T11:53:01 | 48,963,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | /**
* difficulty: easy
* url: https://leetcode.com/problems/pascals-triangle-ii/
* tag: array
* time complexity: O(n^2), space: O(n)
*/
public class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> result = new LinkedList<Integer>();
if(rowIndex < 0) return result;
int prev = 1;
result.add(1);
for(int i = 1; i < rowIndex+2; i++){
for(int j = 0; j < i; j++){
if(j == 0) result.set(j, 1);
else if(j == i-1) result.add(j, 1);
else{
int tmp = result.get(j);
result.set(j, prev+tmp);
//System.out.println("tmp:"+tmp+" prev:"+prev);
prev = tmp;
}
}
}
return result;
}
}
| [
"huibiology@gmail.com"
] | huibiology@gmail.com |
99e3cbf855ee75d95874080ad3cbe4900634e82e | 1453bbadb4fb61a32c962c21c6ca19f8243bda98 | /src/app/src/main/java/com/dongdongju/nowait/ViewMapActivity.java | eab936f81812932d19e0e1cec704cd6f19ccdd04 | [] | no_license | DongDongJu/NoWait | c6ff848db14b2b6b1982a4fb335095ebd28bb963 | 29d6809763c4b8a786a50a653a58bba10a7ff184 | refs/heads/master | 2016-08-13T00:29:17.311414 | 2016-03-25T16:15:29 | 2016-03-25T16:15:29 | 54,196,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,189 | java | package com.dongdongju.nowait;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import net.daum.mf.map.api.MapLayout;
import net.daum.mf.map.api.MapPoint;
import net.daum.mf.map.api.MapView;
public class ViewMapActivity extends FragmentActivity
implements /*MapView.OpenAPIKeyAuthenticationResultListener,*/ MapView.MapViewEventListener {
private static final int MENU_MAP_TYPE = Menu.FIRST + 1;
private static final int MENU_MAP_MOVE = Menu.FIRST + 2;
private static final String LOG_TAG = "MapViewDemoActivity";
private MapView mMapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapview);
MapLayout mapLayout = new MapLayout(this);
mMapView = mapLayout.getMapView();
mMapView.setDaumMapApiKey("685b83987f8a8067f3dbe829efe96785");
// mMapView.setOpenAPIKeyAuthenticationResultListener(this);
mMapView.setMapViewEventListener(this);
mMapView.setMapType(MapView.MapType.Standard);
ViewGroup mapViewContainer = (ViewGroup) findViewById(R.id.map_view);
mapViewContainer.addView(mapLayout);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, MENU_MAP_TYPE, Menu.NONE, "MapType");
menu.add(0, MENU_MAP_MOVE, Menu.NONE, "Move");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final int itemId = item.getItemId();
switch (itemId) {
case MENU_MAP_TYPE: {
String hdMapTile = mMapView.isHDMapTileEnabled()? "HD Map Tile Off" : "HD Map Tile On";
String[] mapTypeMenuItems = { "Standard", "Satellite", "Hybrid", hdMapTile, "Clear Map Tile Cache"};
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle("MapType");
dialog.setItems(mapTypeMenuItems, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
controlMapTile(which);
}
});
dialog.show();
return true;
}
case MENU_MAP_MOVE: {
String rotateMapMenu = mMapView.getMapRotationAngle() == 0.0f? "Rotate Map 60" : "Unrotate Map";
String[] mapMoveMenuItems = { "Move to", "Zoom to", "Move and Zoom to", "Zoom In", "Zoom Out", rotateMapMenu};
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle("Move");
dialog.setItems(mapMoveMenuItems, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
controlMapMove(which);
}
});
dialog.show();
return true;
}
}
return super.onOptionsItemSelected(item);
}
private void controlMapMove(int which) {
switch (which) {
case 0: // Move to
{
mMapView.setMapCenterPoint(MapPoint.mapPointWithGeoCoord(37.53737528, 127.00557633), true);
}
break;
case 1: // Zoom to
{
mMapView.setZoomLevel(7, true);
}
break;
case 2: // Move and Zoom to
{
mMapView.setMapCenterPointAndZoomLevel(MapPoint.mapPointWithGeoCoord(33.41, 126.52), 9, true);
}
break;
case 3: // Zoom In
{
mMapView.zoomIn(true);
}
break;
case 4: // Zoom Out
{
mMapView.zoomOut(true);
}
break;
case 5: // Rotate Map 60, Unrotate Map
{
if (mMapView.getMapRotationAngle() == 0.0f) {
mMapView.setMapRotationAngle(60.0f, true);
} else {
mMapView.setMapRotationAngle(0.0f, true);
}
}
break;
}
}
/**
* 지도 타일 컨트롤.
*/
private void controlMapTile(int which) {
switch (which) {
case 0: // Standard
{
mMapView.setMapType(MapView.MapType.Standard);
}
break;
case 1: // Satellite
{
mMapView.setMapType(MapView.MapType.Satellite);
}
break;
case 2: // Hybrid
{
mMapView.setMapType(MapView.MapType.Hybrid);
}
break;
case 3: // HD Map Tile On/Off
{
if (mMapView.isHDMapTileEnabled()) {
mMapView.setHDMapTileEnabled(false);
} else {
mMapView.setHDMapTileEnabled(true);
}
}
break;
case 4: // Clear Map Tile Cache
{
MapView.clearMapTilePersistentCache();
}
break;
}
}
// /////////////////////////////////////////////////////////////////////////////////////////////////
// // net.daum.mf.map.api.MapView.OpenAPIKeyAuthenticationResultListener
//
// @Override
// public void onDaumMapOpenAPIKeyAuthenticationResult(MapView mapView, int resultCode, String resultMessage) {
// Log.i(LOG_TAG, String.format("Open API Key Authentication Result : code=%d, message=%s", resultCode, resultMessage));
// }
//
// /////////////////////////////////////////////////////////////////////////////////////////////////
// // net.daum.mf.map.api.MapView.MapViewEventListener
public void onMapViewInitialized(MapView mapView) {
Log.i(LOG_TAG, "MapView had loaded. Now, MapView APIs could be called safely");
//mMapView.setCurrentLocationTrackingMode(MapView.CurrentLocationTrackingMode.TrackingModeOnWithoutHeading);
mapView.setMapCenterPointAndZoomLevel(MapPoint.mapPointWithGeoCoord(37.537229,127.005515), 2, true);
}
@Override
public void onMapViewCenterPointMoved(MapView mapView, MapPoint mapCenterPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapCenterPoint.getMapPointGeoCoord();
Log.i(LOG_TAG, String.format("MapView onMapViewCenterPointMoved (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
}
@Override
public void onMapViewDoubleTapped(MapView mapView, MapPoint mapPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapPoint.getMapPointGeoCoord();
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
alertDialog.setTitle("DaumMapLibrarySample");
alertDialog.setMessage(String.format("Double-Tap on (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
alertDialog.setPositiveButton("OK", null);
alertDialog.show();
}
@Override
public void onMapViewLongPressed(MapView mapView, MapPoint mapPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapPoint.getMapPointGeoCoord();
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
alertDialog.setTitle("DaumMapLibrarySample");
alertDialog.setMessage(String.format("Long-Press on (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
alertDialog.setPositiveButton("OK", null);
alertDialog.show();
}
@Override
public void onMapViewSingleTapped(MapView mapView, MapPoint mapPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapPoint.getMapPointGeoCoord();
Log.i(LOG_TAG, String.format("MapView onMapViewSingleTapped (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
}
@Override
public void onMapViewDragStarted(MapView mapView, MapPoint mapPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapPoint.getMapPointGeoCoord();
Log.i(LOG_TAG, String.format("MapView onMapViewDragStarted (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
}
@Override
public void onMapViewDragEnded(MapView mapView, MapPoint mapPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapPoint.getMapPointGeoCoord();
Log.i(LOG_TAG, String.format("MapView onMapViewDragEnded (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
}
@Override
public void onMapViewMoveFinished(MapView mapView, MapPoint mapPoint) {
MapPoint.GeoCoordinate mapPointGeo = mapPoint.getMapPointGeoCoord();
Log.i(LOG_TAG, String.format("MapView onMapViewMoveFinished (%f,%f)", mapPointGeo.latitude, mapPointGeo.longitude));
}
@Override
public void onMapViewZoomLevelChanged(MapView mapView, int zoomLevel) {
Log.i(LOG_TAG, String.format("MapView onMapViewZoomLevelChanged (%d)", zoomLevel));
}
} | [
"commisori28@gmail.com"
] | commisori28@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.