blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c5918d436962825b2f8fd57035f806b2387988d7 | e795c3f924379bd09474286aecc6e97e028a291e | /app/src/main/java/com/network_receiver_parser/app/NetworkActivity.java | f3852d3285e791db0c2c22d2d5c2bd183fbb620e | [
"Apache-2.0"
] | permissive | joaquindev/android-network-receiver | a235c70312b7a96328ce464eb5973b0edb372329 | f754920ab0f29ff91333d6985f288caa36d3d365 | refs/heads/master | 2020-12-24T16:59:49.557448 | 2014-03-11T09:05:54 | 2014-03-11T09:05:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,058 | java | package com.network_receiver_parser.app;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.Toast;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.security.KeyStore;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.text.DateFormat;
import java.net.URL;
/**
* Main Activity for the application of XML parsing
*
* This activity does the following:
* 1) Presents a WebView screen to users. This Webview has a lists of HTML links to the
* latest questions tagged 'android' on Stackoverflow.com
* 2) Parses the stackoverflow XML feed using XMLPullParser
* 3) Uses AsyncTask to download and process the XML feed
* 4) Monitors preferences and the device's mainmenu connection to determine whether
* to refresh the webview content
*/
public class NetworkActivity extends ActionBarActivity {
public static final String WIFI = "Wi-Fi";
public static final String ANY = "Any";
private static final String URL = "http://stackoverflow.com/feeds/tag?tagnames=android&sort=newest";
private static boolean wifiConnected = false;
private static boolean mobileConnected = false;
public static boolean refreshDisplay = true;
public static String sPref = null;
private NetworkReceiver receiver = new NetworkReceiver();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Register BroadcastReceiver to track connection changes
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
receiver = new NetworkReceiver();
this.registerReceiver(receiver, filter);
}
/**
* Dispatch onStart() to all fragments. Ensure any created loaders are
* now started.
* Refreshes the display if the network connection and the pref settings allow it
*/
@Override
protected void onStart() {
super.onStart();
//Gets the user's network preference settings
SharedPreferences sharePrefs = PreferenceManager.getDefaultSharedPreferences(this);
//Retrieves a string value for the preferences. The second parameter is
//the default value to use if a preference value is not found
sPref = sharePrefs.getString("listPref", "Wi-Fi");
updateConnectedFlags();
//Only loads the page if refreshDisplay is true. Otherwise, keeps previous
//display. For example, if the user has set "Wifi Only" in prefs and the
//device loses its Wifi connection midway through the user using the app,
//you don't want to refresh the display -- this would force the display
//of an error page instead of stackoverflow content
if (refreshDisplay) loadPage();
}
/**
* Destroy all fragments and loaders.
*/
@Override
protected void onDestroy() {
super.onDestroy();
if (receiver != null) this.unregisterReceiver(receiver);
}
/**
* Checks network connection and sets the wifiConnected and mobileConnected flags accordingly
*/
private void updateConnectedFlags() {
ConnectivityManager connMgr =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeInfo = connMgr.getActiveNetworkInfo();
if (activeInfo != null && activeInfo.isConnected()) {
wifiConnected = activeInfo.getType() == ConnectivityManager.TYPE_WIFI;
mobileConnected = activeInfo.getType() == ConnectivityManager.TYPE_MOBILE;
} else {
wifiConnected = false;
mobileConnected = false;
}
}
/**
* Uses AsyncTask subclass to download the XML feed from stackoverflow.com
* This avoids UI lock up. To prevent network operations from causing a delay
* that results in a poor user experience, always perform network operations
* on a separate thread from the UI.
*/
private void loadPage() {
if (((sPref.equals(ANY)) && (wifiConnected || mobileConnected))
|| ((sPref.equals(WIFI)) && (wifiConnected))) {
new DownloadXmlTask().execute(URL);
} else {
showErrorPage();
}
}
private void showErrorPage() {
setContentView(R.layout.main);
//The specified network connection is not available. So we display an error message
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadData(getResources().getString(R.string.connection_error), "text/html", null);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mainmenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
Intent settingsActivity = new Intent(getBaseContext(), SettingsActivity.class);//TODO: Implement this Activity
startActivity(settingsActivity);
return true;
}
if (id == R.id.refresh) {
loadPage();
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* This BroadcastReceiver called Networkreceiver intercepts the
* android.net.ConnectivityManager.CONNECTIVITY_ACTION, which indicates a
* connnection change. It checks whether the type is TYPE_WIFI. If it is,
* it checks whether Wi-Fi is connected and sets the wifiConnected flag in the
* main activity accordingly.
*/
public class NetworkReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
ConnectivityManager connMgr =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
//Checks the user prefs and the mainmenu connection. Based on the result,
//it decides whether to refresh the display or keep the current display
//If the userpref is Wi-Fi only, checks to see if the device has a Wi-Fi connection
if (WIFI.equals(sPref) && networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
refreshDisplay = true; //If device has its Wi-Fi connection, sets refreshDisplay
//to true. This causes the display to be refreshed when the user returns to the app
Toast.makeText(context, "Wi-Fi reconnected", Toast.LENGTH_SHORT).show();
} else if (ANY.equals(sPref) && networkInfo != null) {
//If the setting is ANY mainmenu and there is a mainmenu connection, it is going to
//be MOBILE so it sets refreshDisplay to true as well
refreshDisplay = true;
Toast.makeText(context, "Using 3G connection", Toast.LENGTH_SHORT).show();
} else {
//Otherwise, the app can't download content - either because there is no mainmenu
//connection (MOBILE of Wi-Fi), or because the pref setting is WIFI, and there
//is no Wi-Fi connection. In this case sets the refreshDisplay to false
refreshDisplay = false;
Toast.makeText(context, "Lost connection", Toast.LENGTH_SHORT).show();
}
}
}
/**
* Implementation of AsyncTask used to download XML feed from stackoverflow.com
*/
private class DownloadXmlTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
try {
return loadXmlFromNetwork(urls[0]);
} catch (IOException e) {
return getResources().getString(R.string.connection_error);
} catch (XmlPullParserException e) {
return getResources().getString(R.string.xml_error);
}
}
@Override
protected void onPostExecute(String s) {
setContentView(R.layout.main);
//Display the HTML string in the UI via a WebView
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadData(result, "text/html", null);
}
}
/**
* Downloads XML from stackoverflow.com, parses it and combines it with
* HTML markup. Returns an HTML String page to be included in the webview
*
* @param urlString The URL where the XML is
* @return The HTML string
* @throws XmlPullParserException
* @throws IOException
*/
private String loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {
InputStream stream = null;
StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser();//TODO: create class
List<KeyStore.Entry> entries = null;//TODO> create Entry class
String title, url, summary = null;
Calendar rightNow = Calendar.getInstance();
DateFormat formatter = new SimpleDateFormat("MMM dd h:mmaa");
//Checks whether the user set the preference to include summary text
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean pref = sharedPrefs.getBoolean("summaryPref", false);
//We start building the HTML string to be included in the webview
StringBuilder htmlString = new StringBuilder();
htmlString.append("<h3" + getResources().getString(R.string.page_title) + "</h3>");
htmlString.append("<em>" + getResources().getString(R.string.updated) + " " +
formatter.format(rightNow.getTime() + "</em>"));
try {
stream = downloadUrl(urlString);
entries = stackOverflowXmlParser.parse(stream);
//Makes sure that the InputStream is closed after the app is finished using it
} finally {
if (stream != null) stream.close();
}
/**
* Given a string representation of a URL, sets up a connection and gets an input stream
*/
private InputStream downloadUrl(String urlString) throws IOException{
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
//starts th query
conn.connect();
InputStream stream = conn.getInputStream();
return stream;
}
/**
* StackOverflowXmlParser returns a List (called "entries") of Entry objects.
* Each Entry object represents a single post in the XML feed
* This section processes the entries list to combine each entry with HTML markup
* Each entry is displayed in the UI as a link that optionally includes a text summary
*/
for(Entry entry : entries){
htmlString.append("<p><a href='");
htmlString.append(entry.link);
htmlString.append("'>" + entry.title + "</a></p>");
//If the user set the preference to include summary text, adds it to the display
if(pref){
htmlString.append(entry.summary);
}
}
return htmlString.toString();
}
}
| [
"joaquin@isla.io"
] | joaquin@isla.io |
3e7a02da308856ff1a3fb338ff81158b123e5cd0 | 00cc6b017e907168d3f01fc89acff675dfb758f1 | /src/main/java/pl/net/divo/crm/CrmApplication.java | bbcd68ad1b9a6d86595a009b2e25bb4aafa07b29 | [] | no_license | arvelka/crm-dropwizard | 61c57ea05d78dbc7edb6fb3c09ebd5cdc569b197 | 345a326da9a0d67182691455a9b82aa2af252de6 | refs/heads/master | 2020-12-24T07:52:10.826004 | 2016-11-10T13:48:30 | 2016-11-10T13:48:30 | 73,362,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,724 | java | package pl.net.divo.crm;
import io.dropwizard.Application;
import io.dropwizard.auth.AuthDynamicFeature;
import io.dropwizard.auth.AuthValueFactoryProvider;
import io.dropwizard.auth.basic.BasicCredentialAuthFilter;
import io.dropwizard.jdbi.DBIFactory;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import java.util.LinkedList;
import java.util.List;
import org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature;
import org.skife.jdbi.v2.DBI;
import pl.net.divo.crm.dao.RoleDao;
import pl.net.divo.crm.dao.UserDao;
import pl.net.divo.crm.model.User;
import pl.net.divo.crm.resources.RoleResource;
import pl.net.divo.crm.resources.UserResource;
import pl.net.divo.crm.security.UserAuthenticator;
import pl.net.divo.crm.security.UserAuthorizer;
public class CrmApplication extends Application<CrmConfiguration> {
public static String APPLICATION_NAME = "test-crm";
public static String BASIC_REALM_NAME = "SECRET";
public static void main(String[] args) {
try {
new CrmApplication().run(args);
} catch (Exception e) {
System.out.format("Error was occured: %s\n", e.getMessage());
}
}
@Override
public String getName() {
return CrmApplication.APPLICATION_NAME;
}
@Override
public void initialize(Bootstrap<CrmConfiguration> bootstrap) {
}
@Override
public void run(CrmConfiguration config, Environment environment) throws Exception {
final DBIFactory factory = new DBIFactory();
final DBI jdbi = factory.build(environment, config.getDataSourceFactory(), "mysql");
final UserDao userDao = jdbi.onDemand(UserDao.class);
final RoleDao roleDao = jdbi.onDemand(RoleDao.class);
List<Object> allRegisters = new LinkedList<Object>();
allRegisters.add(new UserResource(userDao));
allRegisters.add(new RoleResource(roleDao));
allRegisters.add(getSecurityResource(environment, jdbi));
allRegisters.add(RolesAllowedDynamicFeature.class);
allRegisters.add(new AuthValueFactoryProvider.Binder<User>(User.class));
registerAll(environment, allRegisters);
}
private void registerAll(Environment environment, List<Object> registers) {
for (Object register : registers) {
final Object finalRegister = register;
environment.jersey().register(finalRegister);
}
}
private AuthDynamicFeature getSecurityResource(Environment environment, DBI jdbi) {
final UserDao userDao = jdbi.onDemand(UserDao.class);
final RoleDao roleDao = jdbi.onDemand(RoleDao.class);
return new AuthDynamicFeature(
new BasicCredentialAuthFilter.Builder<User>()
.setAuthenticator(new UserAuthenticator(userDao))
.setAuthorizer(new UserAuthorizer(roleDao))
.setRealm(CrmApplication.BASIC_REALM_NAME)
.buildAuthFilter());
}
}
| [
"divo@divo.net.pl"
] | divo@divo.net.pl |
fb171f95a1d01b55c6b36c1940c61d8ee546adf2 | b05f038c567f42d7e7f451f1fd8e9c9249d77efa | /src/main/java/com/nfcsb/demo/catalog/DataSourceConfig.java | c08d1b6038725b9c5d55ffcfe4014d0ba6ebfa4f | [] | no_license | zlatkoc/demo-catalog | 071c04458266154ea0869e882cf7babfe1acddb1 | 9671f3695c93ed18b28ddb12f90f30c0bfcc037e | refs/heads/master | 2021-01-18T03:17:49.562343 | 2017-06-14T11:27:24 | 2017-06-14T11:27:24 | 85,832,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,812 | java | package com.nfcsb.demo.catalog;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
/**
*
*/
@Configuration
@Component
public class DataSourceConfig {
/*spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.database.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/test
spring.datasource.username=drejc
spring.datasource.password=*/
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
DataSourceBuilder builder = DataSourceBuilder
.create()
.username("drejc")
.password("")
.url("jdbc:postgresql://localhost:5432/test");
//.driverClassName("org.postgresql.Driver");
return builder.build();
}
/*@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.postgresql.Driver");
dataSource.setUrl("jdbc:postgresql://localhost:5432/test");
dataSource.setUsername("drejc");
dataSource.setPassword("");
return dataSource;
}*/
// Transaction manager bean definition
@Bean
public DataSourceTransactionManager dataSourceTransactionManager() {
DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
dataSourceTransactionManager.setDataSource(dataSource());
return dataSourceTransactionManager;
}
}
| [
"andrej@zavrsnik.si"
] | andrej@zavrsnik.si |
ac04cb360f26fc168fbfed04e7a91dbc50910f6f | 9e45d2cf1faa659ffb82fc0393171f8574d66999 | /app/src/main/java/com/barebrains/where/Users.java | 78daaa6b03558e900acffd0b5a6ea17291c5c42a | [] | no_license | sanjeev00/Where | 6148aebae140a4008a6a3e3d7cf11757b057ac36 | 4cac400defe7f0844f42a06ce4769a6dc99b3280 | refs/heads/master | 2020-05-25T04:47:22.951580 | 2019-05-31T07:27:12 | 2019-05-31T07:27:12 | 187,635,013 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package com.barebrains.where;
public class Users {
private String Name;
private String Email;
private Friend Friends;
private Friend FrReq;
private String Location;
private String Avatar;
public Users()
{
}
public Users(String Name,String Email)
{
this.Email = Email;
this.Name = Name;
}
Users(String Name,String Email,String Avatar,String avatar,String location)
{
this.Email = Email;
this.Name = Name;
this.Location = location;
this.Avatar = avatar;
}
public String getLocation() {
return this.Location;
}
public void setLocation(String location) {
this.Location = location;
}
public String getAvatar() {
return this.Avatar;
}
public void setAvatar(String avatar) {
this.Avatar = avatar;
}
public String getName()
{
return this.Name;
}
public String getEmail() {
return this.Email;
}
public Friend getFriends() {
return this.Friends;
}
public Friend getFrReq()
{
return this.FrReq;
}
}
class Friend {
private String S;
public Friend()
{
}
public Friend(String s)
{
}
public String getS()
{
return this.S;
}
}
| [
"sanjeevkrishnab@gmail.com"
] | sanjeevkrishnab@gmail.com |
76857ec32a442723143529b22ff6d5583a8da80f | a81c08273d36d59a5f2e313d26fee16eb7b60fc4 | /src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/DeviceProximityEvent.java | 20ac5d288d04698395e788c3db0e0203722c1c6b | [
"Apache-2.0"
] | permissive | edouardswiac/htmlunit | 88cdc4bc2e7807627c5619be5ad721a17117dbe7 | cc9f8e4b341b980ec0bac9cb8b531f4ff958c534 | refs/heads/master | 2016-09-14T13:53:28.461222 | 2016-04-29T21:32:17 | 2016-04-29T21:32:17 | 57,413,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | /*
* Copyright (c) 2002-2016 Gargoyle Software Inc.
*
* 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.gargoylesoftware.htmlunit.javascript.host.event;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor;
import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser;
/**
* A JavaScript object for {@code DeviceProximityEvent}.
*
* @author Ahmed Ashour
*/
@JsxClass(browsers = @WebBrowser(FF))
public class DeviceProximityEvent extends Event {
/**
* Default constructor.
*/
@JsxConstructor
public DeviceProximityEvent() {
}
}
| [
"eswiac@twitter.com"
] | eswiac@twitter.com |
8e523ee3eda015eb53ecca3dc48f0dd01a80cf5f | 746572ba552f7d52e8b5a0e752a1d6eb899842b9 | /JDK8Source/src/main/java/org/w3c/dom/html/HTMLDivElement.java | a92c377c4194863068b6c50e5e8fc09658ea9da8 | [] | no_license | lobinary/Lobinary | fde035d3ce6780a20a5a808b5d4357604ed70054 | 8de466228bf893b72c7771e153607674b6024709 | refs/heads/master | 2022-02-27T05:02:04.208763 | 2022-01-20T07:01:28 | 2022-01-20T07:01:28 | 26,812,634 | 7 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,895 | java | /***** Lobxxx Translate Finished ******/
/*
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/*
*
*
*
*
*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. 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 W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
* <p>
* 版权所有(c)2000万维网联盟,(马萨诸塞理工学院,庆应义藩大学信息自动化研究所)。版权所有。该程序根据W3C的软件知识产权许可证分发。
* 这个程序是分发的,希望它将是有用的,但没有任何保证;甚至没有对适销性或适用于特定用途的隐含保证。有关详细信息,请参阅W3C许可证http://www.w3.org/Consortium/Legal/。
*
*/
package org.w3c.dom.html;
/**
* Generic block container. See the DIV element definition in HTML 4.0.
* <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
* <p>
* 通用块容器。请参阅HTML 4.0中的DIV元素定义。
* <p>另请参阅<a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>文档对象模型(DOM)2级规范</a>。
*
*/
public interface HTMLDivElement extends HTMLElement {
/**
* Horizontal text alignment. See the align attribute definition in HTML
* 4.0. This attribute is deprecated in HTML 4.0.
* <p>
*/
public String getAlign();
public void setAlign(String align);
}
| [
"919515134@qq.com"
] | 919515134@qq.com |
d95d7f84e08620f751cad1f95ae0683ad27a57b3 | 188a206aedc831035e07d4de4c00d0badab77bfb | /src/tonegod/gui/controls/buttons/RadioButtonGroup.java | e920c17dc65e3e7e9b92482adc99d79ef6e7e9d5 | [
"BSD-2-Clause-Views"
] | permissive | marianne-butaye/tonegodgui | 4e089f0179a4fa5eb79fb52dbc0512fceb0cf203 | c6efe7840cf7bcad5e23f3086db4ff92e6ece1cd | refs/heads/master | 2020-12-30T14:00:44.058399 | 2017-05-27T17:03:40 | 2017-05-27T17:03:40 | 91,276,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,966 | java | package tonegod.gui.controls.buttons;
import java.util.ArrayList;
import java.util.List;
import tonegod.gui.core.Element;
import tonegod.gui.core.ElementManager;
import tonegod.gui.core.utils.UIDUtil;
/**
*
* @author t0neg0d
*/
public abstract class RadioButtonGroup {
private ElementManager screen;
private String UID;
protected List<Button> radioButtons = new ArrayList<>();
protected int selectedIndex = -1;
private Button selected = null;
public RadioButtonGroup(ElementManager screen) {
this.screen = screen;
this.UID = UIDUtil.getUID();
}
public RadioButtonGroup(ElementManager screen, String UID) {
this.screen = screen;
this.UID = UID;
}
/**
* Returns the String unique ID of the RadioButtonGroup
*
* @return String
*/
public String getUID() {
return this.UID;
}
/**
* Adds any Button or extended class and enables the Button's Radio state
*
* @param button which Button to add
*/
public void addButton(Button button) {
button.setRadioButtonGroup(this);
radioButtons.add(button);
if (selectedIndex == 0) {
setSelected(0);
}
}
/**
* Alter which Radio Button is selected.
*
* @param index index of button to select
*/
public void setSelected(int index) {
if (this.selectedIndex != index) {
if (index >= 0 && index < radioButtons.size()) {
Button rb = radioButtons.get(index);
this.selected = rb;
this.selectedIndex = index;
for (Button rb2 : radioButtons) {
if (rb2 != this.selected) {
rb2.setIsToggled(false);
} else {
rb2.setIsToggled(true);
}
}
onSelect(selectedIndex, rb);
}
}
}
/**
* Alter which Radio Button is selected.
*
* @param button button instance to select
*/
public void setSelected(Button button) {
if (this.selected != button) {
this.selected = button;
this.selectedIndex = radioButtons.indexOf(button);
for (Button rb : radioButtons) {
if (rb != this.selected) {
if (rb.getIsToggled()) {
rb.setIsToggled(false);
}
} else {
rb.setIsToggled(true);
}
}
onSelect(selectedIndex, button);
}
}
public Button getSelected() {
return this.selected;
}
/**
* Abstract event method for change in selected Radio Button
*
* @param index The index of the selected button
* @param value The selected button instance
*/
public abstract void onSelect(int index, Button value);
/**
* An alternate way to add all Radio Buttons as children to the provided
* Element
*
* @param element The element to add Radio Button's to. null = Screen
*/
public void setDisplayElement(Element element) {
for (Button rb : radioButtons) {
if (screen.getElementById(rb.getUID()) == null) {
if (element != null) {
element.addChild(rb);
} else {
screen.addElement(rb);
}
}
}
}
/**
* Returns the number of buttons in the group.
*
* @return int
*/
public int getButtonCount() {
return radioButtons.size();
}
/**
* Clears the selection such that none of the buttons in the ButtonGroup are selected.
*/
public void clearSelection() {
for (Button rb : radioButtons) {
if (rb != this.selected) {
if (rb.getIsToggled()) {
rb.setIsToggled(false);
}
}
}
selectedIndex = -1;
selected = null;
}
/**
* Remove all buttons from the group.
*/
public void clear() {
clearSelection();
List<Button> listCopy = new ArrayList<>(radioButtons);
for (Button b : listCopy) {
removeButton(b);
}
}
/**
* Removes the button from the group.
* @param button The button to remove.
*/
public void removeButton(Button button) {
if (button == this.selected) {
if (button.getIsToggled()) {
button.setIsToggled(false);
selectedIndex = -1;
selected = null;
}
}
button.setRadioButtonGroup(null);
radioButtons.remove(button);
}
}
| [
"marianne.butaye@gmail.com"
] | marianne.butaye@gmail.com |
ea5967da01680e202fe2cefad45c74fa546be638 | a9ae26f05a496ee4288a288262dbf664bec0d669 | /src/exceptions/ZooKeeper.java | b36677dd745f1a088bb1996d0dddb139c949ccf5 | [] | no_license | ericanvoued/javaLearning | c24418c02b2336b782ba91c36d220fe4cb29614b | a95b58980bda7cc9eb0c6a53ba1ea79132cfc849 | refs/heads/master | 2020-07-17T20:58:52.579146 | 2019-09-08T09:25:13 | 2019-09-08T09:25:13 | 206,098,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package exceptions;
public class ZooKeeper {
public void feedAnimal(int foodMount) throws MyException {
switch(foodMount) {
case 100:
System.out.print("haha,good");
break;
case 200:
throw new MyException();
// break;
}
}
}
| [
"ericanvoued@gemail.com"
] | ericanvoued@gemail.com |
25bad585df2317e2a2f8e6e6d7e9ddd839a26771 | 876bd464017bdd39ace0a5f6ea90263d60cbc4ee | /app/src/androidTest/java/com/example/rsanjib/dropme/ExampleInstrumentedTest.java | d9492e8845ae415b7a13dba81ed27d208ca268f6 | [] | no_license | rajsanjib/DropMePartner | 144d3a5e322355376906165d8d93f02eec66d8dd | 0d9e0d040bdf042c33113f337b0b01021efad648 | refs/heads/master | 2021-05-01T13:41:44.720979 | 2017-01-21T20:22:16 | 2017-01-21T20:22:16 | 79,574,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.example.rsanjib.dropme;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.rsanjib.dropme", appContext.getPackageName());
}
}
| [
"sanjibraj169@gmail.com"
] | sanjibraj169@gmail.com |
d607c6426cd0cbe517c8c8290e9a719130de5511 | a0b9f2840632e3823451b16f1b89d79862bfcf72 | /Graphics/Assets.java | a8833aac0a9a4771cc68e0c7b8120593c7630122 | [] | no_license | TiganasStefan/java-game | 624547cd9317a207c6ef0265caba96cc748c2cde | 206452b7da9877a42230f5f7e456e557c97e0acb | refs/heads/master | 2022-12-23T19:52:03.576461 | 2020-10-02T06:02:24 | 2020-10-02T06:02:24 | 300,556,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,380 | java | package PAOO_GAME.Graphics;
import java.awt.image.BufferedImage;
import java.nio.Buffer;
public class Assets {
public static BufferedImage box;
public static BufferedImage boxLU;
public static BufferedImage boxLD;
public static BufferedImage boxRU;
public static BufferedImage boxRD;
public static BufferedImage pD;
public static BufferedImage pR;
public static BufferedImage pL;
public static BufferedImage pU;
public static BufferedImage cLU;
public static BufferedImage cLD;
public static BufferedImage cRU;
public static BufferedImage cRD;
public static BufferedImage fL;
public static BufferedImage fR;
public static BufferedImage fM;
public static BufferedImage[] heroIdle;
public static BufferedImage[] heroRun;
public static BufferedImage[] heroRunBack;
public static BufferedImage heroJumpBack;
public static BufferedImage heroJump;
public static BufferedImage heroFall;
public static BufferedImage heroFallBack;
public static BufferedImage start;
public static BufferedImage gameOver;
public static BufferedImage win;
public static BufferedImage finish;
public static BufferedImage life;
public static BufferedImage background;
public static BufferedImage[] strawberry;
public static BufferedImage[] strawberry2;
public static BufferedImage[] mushroom;
public static BufferedImage[] mushroomBack;
public static void Init()
{
SpriteSheet sheet=new SpriteSheet(ImageLoader.LoadImage("/tiles/Sprites/14-TileSets/Terrain (32x32).png"));
SpriteSheet sheet2=new SpriteSheet(ImageLoader.LoadImage("/Ninja Frog/Idle (32x32).png"));
SpriteSheet sheet3=new SpriteSheet(ImageLoader.LoadImage("/Ninja Frog/Run (32x32).png"));
SpriteSheet sheet4=new SpriteSheet(ImageLoader.LoadImage("/Ninja Frog/RunBack (32x32).png"));
SpriteSheet sheet5=new SpriteSheet(ImageLoader.LoadImage("/Strawberry/Strawberry2.png"));
SpriteSheet sheet6 = new SpriteSheet(ImageLoader.LoadImage("/Strawberry/Strawberry.png"));
SpriteSheet sheet7 = new SpriteSheet(ImageLoader.LoadImage("/Mushroom/Run (32x32).png"));
SpriteSheet sheet8= new SpriteSheet(ImageLoader.LoadImage("/Mushroom/RunBack (32x32).png"));
heroJump=ImageLoader.LoadImage("/Ninja Frog/Jump (32x32).png");
heroJumpBack=ImageLoader.LoadImage("/Ninja Frog/JumpBack (32x32).png");
heroFall=ImageLoader.LoadImage("/Ninja Frog/Fall (32x32).png");
heroFallBack=ImageLoader.LoadImage("/Ninja Frog/FallBack (32x32).png");
box = sheet.crop(5, 5);
boxLU = sheet.crop(16, 4);
boxLD = sheet.crop(16, 5);
boxRU = sheet.crop(17, 4);
boxRD = sheet.crop(17, 5);
pD = sheet.crop(2, 3);
pL = sheet.crop(1, 2);
pR = sheet.crop(3, 2);
pU = sheet.crop(2, 1);
cLU = sheet.crop(1, 1);
cLD = sheet.crop(1, 3);
cRU = sheet.crop(3, 1);
cRD = sheet.crop(3, 3);
fL=sheet.crop(1,5);
fR=sheet.crop(3,5);
fM=sheet.crop(2,5);
heroIdle=new BufferedImage[11];
for (int i=0;i<11;i++) {
heroIdle[i] = sheet2.crop(i, 0);
}
heroRun=new BufferedImage[12];
for (int i=0;i<12;i++)
heroRun[i]=sheet3.crop(i,0);
heroRunBack=new BufferedImage[12];
for (int i=0;i<12;i++)
heroRunBack[i]=sheet4.crop(i,0);
strawberry = new BufferedImage[17];
strawberry2=new BufferedImage[6];
mushroom = new BufferedImage[9];
mushroomBack=new BufferedImage[9];
for(int i=0;i<17;i++)
strawberry[i] = sheet6.crop(i,0);
for (int i=0;i<strawberry2.length;i++)
strawberry2[i]=sheet5.crop(i,0);
for(int i=0;i<mushroom.length;i++)
mushroom[i] = sheet7.crop(i,0);
for (int i=0;i<mushroomBack.length;i++)
mushroomBack[i]=sheet8.crop(i,0);
background=ImageLoader.LoadImage("/Yellow.jpeg");
start= ImageLoader.LoadImage("/obj/start.png");
finish=ImageLoader.LoadImage("/obj/finish.png");
life=ImageLoader.LoadImage("/Ninja Frog/Fall (32x32).png");
gameOver=ImageLoader.LoadImage("/endgame/GameOver.png");
win=ImageLoader.LoadImage("/endgame/win.jpeg");
}
}
| [
"stefy_gabriel@yahoo.com"
] | stefy_gabriel@yahoo.com |
69cec9f09de2fccc2bdb137549daf9426803b8ff | 25d103573c8b31c7a7b42645c8a50367af029819 | /src/test/java/svs/springframework/converters/IngredientCommandToIngredientTest.java | 88759e6b0b02935c2f079b53e101732b7066e33b | [] | no_license | motswanax/spring5-mysql-recipe-app | b1941cb585a49a144b3e80ccd817a13716ce5b3b | cf7a2d2ee41c958e2877b25c54efc17e71029eec | refs/heads/master | 2020-05-23T06:10:02.327792 | 2019-05-16T19:14:29 | 2019-05-16T19:14:29 | 186,662,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,675 | java | package svs.springframework.converters;
import org.junit.Before;
import org.junit.Test;
import svs.springframework.commands.IngredientCommand;
import svs.springframework.commands.UnitOfMeasureCommand;
import svs.springframework.domain.Ingredient;
import svs.springframework.domain.Recipe;
import java.math.BigDecimal;
import static org.junit.Assert.*;
/**
* @author baike
* 10/04/2019
*/
public class IngredientCommandToIngredientTest {
public static final Recipe RECIPE = new Recipe();
public static final BigDecimal AMOUNT = new BigDecimal("1");
public static final String DESCRIPTION = "Cheeseburger";
public static final Long ID_VALUE = 1L;
public static final Long UOM_ID = 2L;
IngredientCommandToIngredient converter;
@Before
public void setUp() throws Exception {
converter = new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure());
}
@Test
public void testNullObject() throws Exception {
assertNull(converter.convert(null));
}
@Test
public void testEmptyObject() throws Exception {
assertNotNull(converter.convert(new IngredientCommand()));
}
@Test
public void convert() throws Exception {
//given
IngredientCommand command = new IngredientCommand();
command.setId(ID_VALUE);
command.setAmount(AMOUNT);
command.setDescription(DESCRIPTION);
UnitOfMeasureCommand unitOfMeasureCommand = new UnitOfMeasureCommand();
unitOfMeasureCommand.setId(UOM_ID);
command.setUom(unitOfMeasureCommand);
//when
Ingredient ingredient = converter.convert(command);
//then
assertNotNull(ingredient);
assertNotNull(ingredient.getUom());
assertEquals(ID_VALUE, ingredient.getId());
assertEquals(AMOUNT, ingredient.getAmount());
assertEquals(DESCRIPTION, ingredient.getDescription());
assertEquals(UOM_ID, ingredient.getUom().getId());
}
@Test
public void convertWithNullUOM() throws Exception {
//given
IngredientCommand command = new IngredientCommand();
command.setId(ID_VALUE);
command.setAmount(AMOUNT);
command.setDescription(DESCRIPTION);
UnitOfMeasureCommand unitOfMeasureCommand = new UnitOfMeasureCommand();
//when
Ingredient ingredient = converter.convert(command);
//then
assertNotNull(ingredient);
assertNull(ingredient.getUom());
assertEquals(ID_VALUE, ingredient.getId());
assertEquals(AMOUNT, ingredient.getAmount());
assertEquals(DESCRIPTION, ingredient.getDescription());
}
} | [
"baiketlid@gmail.com"
] | baiketlid@gmail.com |
63479f198094bbc5f57daa39c45a4f94690c4461 | 7dfb1538fd074b79a0f6a62674d4979c7c55fd6d | /src/day25/StringToCharArray.java | b29b7c6cc6ba4bfa54bac7b6fb74f292c053ca09 | [] | no_license | kutluduman/Java-Programming | 424a4ad92e14f2d4cc700c8a9352ff7408aa993f | d55b8a61ab3a654f954e33db1cb244e36bbcc7da | refs/heads/master | 2022-04-18T03:54:50.219846 | 2020-04-18T05:45:45 | 2020-04-18T05:45:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,418 | java | package day25;
import java.util.Arrays;
public class StringToCharArray {
public static void main(String[] args) {
// pick up your own name and turn in into char array
// and use for each loop to loop over them
// optionally count how many a you have in your name
// turn this into charArray using toCharArray() method of String
// WHAT DOES IT DO ?
// toCharArray() is a method of String that turn string into char array
// DO I NEED TO PROVIDE EXTRA DATA WHILE CALLING THE METHOD ?
// NO
// WHAT DO I GET OUT OF IT ?
// char array object that has all the characters of the String object
String name = "Dilara";
char[] nameInChar = name.toCharArray();
System.out.println("Arrays.toString(nameInChar) = " + Arrays.toString(nameInChar));
System.out.println();
int count = 0;
for (char each : nameInChar ) {
System.out.println("each = " + each);
if (each=='a') {
++count;
}
}
System.out.println();
System.out.println("count = " + count);
// What if you want to sort all characters of your name
// in alphabetical order ?
System.out.println();
Arrays.sort(nameInChar);
System.out.println(Arrays.toString(nameInChar));
}
}
| [
"58450274+kutluduman@users.noreply.github.com"
] | 58450274+kutluduman@users.noreply.github.com |
fdeba488330b3733207f32b739ea189a3b1fd25f | 97abe314f90c47105d0a5a987c86c8a5eee8ace2 | /carbidev/com.nokia.tools.variant.editor_1.0.0.v20090225_01-11/src/com/nokia/tools/variant/editor/editors/SummaryViewerLabelProvider.java | 8e39eb418dac727eb9d1aadce2be325cbdc99944 | [] | no_license | SymbianSource/oss.FCL.sftools.depl.swconfigapps.configtools | f668c9cd73dafd83d11beb9f86252674d2776cd2 | dcab5fbd53cf585e079505ef618936fd8a322b47 | refs/heads/master | 2020-12-24T12:00:19.067971 | 2010-06-02T07:50:41 | 2010-06-02T07:50:41 | 73,007,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,373 | java | /*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - Initial contribution
*
* Contributors:
*
* Description: This file is part of com.nokia.tools.variant.editor component.
*/
package com.nokia.tools.variant.editor.editors;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import com.nokia.tools.variant.content.confml.LeafGroup;
import com.nokia.tools.variant.content.confml.ParentGroup;
import com.nokia.tools.variant.content.confml.Setting;
import com.nokia.tools.variant.content.confml.View;
import com.nokia.tools.variant.editor.model.summaryModel.History;
import com.nokia.tools.variant.editor.model.summaryModel.Note;
import com.nokia.tools.variant.editor.model.summaryModel.SUMMARYTYPE;
import com.nokia.tools.variant.editor.model.summaryModel.UIElement;
import com.nokia.tools.variant.editor.model.summaryModel.UISummaryGroup;
import com.nokia.tools.variant.resourcelibrary.model.ResourceModelRoot;
import com.nokia.tools.variant.viewer.viewer.ISettingsLabelProvider;
import com.nokia.tools.variant.viewer.viewer.Type;
import com.nokia.tools.variant.viewer.widgets.WidgetOption;
import com.nokia.tools.variant.viewer.widgets.WidgetOptions;
import com.nokia.tools.variant.views.errormodel.ErrorsRoot;
/**
* This provider is used to map the UISummaryModel into text strings displayable
* in the SettingsViewer widgets in the Summary page. The provider has method
* getText(Object element) that returns name of group or setting.
*
*/
public class SummaryViewerLabelProvider implements ISettingsLabelProvider {
public Image getImage(Object element) {
return null;
}
public String getText(Object element) {
if (element instanceof UISummaryGroup) {
String title = ((UISummaryGroup) element).getTitle();
return title;
}
if (element instanceof UIElement) {
UIElement ui = (UIElement) element;
return ui.getName();
}
return null;
}
public void addListener(ILabelProviderListener listener) {
}
public void dispose() {
}
public boolean isLabelProperty(Object element, String property) {
return false;
}
public void removeListener(ILabelProviderListener listener) {
}
public Type getType(Object element) {
if (element instanceof UIElement) {
UIElement uiElement = (UIElement) element;
switch (uiElement.getType()) {
case DESCRIPTION:
return Type.DESCRIPTION;
case CONTENTS:
return Type.CONTENTS;
case PRODUCTIMAGES:
return Type.PRODUCTIMAGES;
case GUIDELINE:
return Type.GUIDELINE;
case HISTORY:
return Type.HISTORY;
case CUSTOMER:
case AUTHOR:
case OWNER:
return Type.ELEMENT_EDITABLE;
case AVR:
return Type.AVR;
default:
return Type.ELEMENT_READONLY;
}
} else if (element instanceof UISummaryGroup) {
return Type.TITLE;
}
return Type.STRING;
}
public WidgetOptions getOptions(Object element) {
if (element instanceof UIElement) {
UIElement uiElement = (UIElement) element;
if (uiElement.getType().equals(SUMMARYTYPE.HISTORY)) {
CPFEditor editor;
IEditorPart activeEditor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
if (activeEditor instanceof CPFEditor) {
editor = (CPFEditor) activeEditor;
} else {
return null;
}
History history = editor.getViewEditorModel().getHistory();
EList<Note> notes = history.getNote();
Set<WidgetOption> widgetOptions = new LinkedHashSet<WidgetOption>();
for (Note note : notes) {
WidgetOption o = new WidgetOption(note.getDate(), note
.getContent(), null, null);
widgetOptions.add(o);
}
WidgetOptions options = new WidgetOptions(widgetOptions);
return options;
}
if (uiElement.getType().equals(SUMMARYTYPE.CONTENTS)) {
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if(activeEditor instanceof CPFEditor){
CPFEditor cpfEditor = (CPFEditor)activeEditor;
return createContentsOptions(cpfEditor);
}
}
}
return null;
}
private WidgetOptions createContentsOptions(CPFEditor cpfEditor){
ResourceModelRoot root = (ResourceModelRoot) cpfEditor.getAdapter(ResourceModelRoot.class);
View view = cpfEditor.getView();
Set<WidgetOption> widgetOptions = new LinkedHashSet<WidgetOption>();
WidgetOption errors = new WidgetOption(null, "<A>" + getNrOfErrors(cpfEditor)
+ " errors</A>", null, null);
widgetOptions.add(errors);
WidgetOption notes = new WidgetOption(null,"<A>"
+ cpfEditor.getNrOfNotes(view) +" notes</A>", null, null);
widgetOptions.add(notes);
WidgetOption changes = new WidgetOption(null,"<A>" +
cpfEditor.getNrOfChanges(view) +
" settings changed from default</A>", null, null);
widgetOptions.add(changes);
WidgetOption resources = new WidgetOption(null,
"<A>" +
root.getSize() +
" resources</A>", null, null);
widgetOptions.add(resources);
EList<Setting> sharedSettingInstances = view
.getSharedSettingInstances();
//the list of settings that aren't read-only
List<Setting> visibleSettings = new ArrayList<Setting>();
for(Setting setting:sharedSettingInstances){
if((setting.isVisible()))
visibleSettings.add(setting);
}
Set<String> featureRefSet = new HashSet<String>();
Set<String> parentGroupSet = new HashSet<String>();
for (Setting setting : visibleSettings) {
featureRefSet.add(setting.getFeatureRef());
EList<LeafGroup> leafGroups = setting.getLeafGroup();
for (LeafGroup leafGroup : leafGroups) {
parentGroupSet.add(((ParentGroup) leafGroup.eContainer())
.getName());
}
EList<ParentGroup> parentGroups = setting.getParentGroup();
for (ParentGroup parentGroup : parentGroups) {
parentGroupSet.add(parentGroup.getName());
}
}
int nrOfSetting = visibleSettings.size();
int nrOfFeature = featureRefSet.size();
int nrOfGroup = parentGroupSet.size();
WidgetOption groups = new WidgetOption(null,nrOfGroup+" Groups", null, null);
widgetOptions.add(groups);
WidgetOption features = new WidgetOption(null,nrOfFeature+" Features", null, null);
widgetOptions.add(features);
WidgetOption settings = new WidgetOption(null,nrOfSetting+" Settings", null, null);
widgetOptions.add(settings);
WidgetOptions options = new WidgetOptions(widgetOptions);
return options;
}
private int getNrOfErrors(CPFEditor editor) {
ErrorsRoot errorsRoot = (ErrorsRoot) editor
.getAdapter(ErrorsRoot.class);
return errorsRoot.getErrors().size();
}
}
| [
"none@none"
] | none@none |
10932d4771d10f9adbc74ed571a6eef85463ba10 | 405147bb24f736c3da62ace16bd9f7f924247feb | /leetcode/q560/Solution2.java | 7c4074fbbef67644188ba6ef0afd1004bfb3ed5c | [] | no_license | ruan4261/my-leetcode-demo | 921d3dbac5b9b88b3f5fd40e57d55289314dccd0 | 50cd85cd7cc6ead04e04ade49d6d4de300009a91 | refs/heads/master | 2023-07-15T01:25:41.700736 | 2021-08-14T19:46:32 | 2021-08-14T19:46:32 | 259,888,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | package demo.leetcode.q560;
import java.util.HashMap;
import java.util.Map;
public class Solution2 {
/**
* 使用dp计算出每个元素的前缀和并记录
* 如果减去某个前缀和等于k(减去k等于某个前缀和),则此前缀和所在位置到当前位置之间的和恰好为k
*
* @param nums
* @param k
* @return
*/
public int subarraySum(int[] nums, int k) {
int count = 0, pre = 0;
Map<Integer, Integer> mp = new HashMap<>();
mp.put(0, 1);
for (int num : nums) {
pre += num;
if (mp.containsKey(pre - k))
count += mp.get(pre - k);
mp.put(pre, mp.getOrDefault(pre, 0) + 1);
}
return count;
}
}
| [
"i@4261.ink"
] | i@4261.ink |
1d37d57863e262e0234f4747f5a94afd20008c56 | d836be275add00d1afcbf6f652ae1a378a0879bb | /app/src/main/java/org/stepic/droid/ui/fragments/FreeResponseStepFragment.java | 9bb2aad95960d22e698ba5bb411cf15abcbae9ff | [
"Apache-2.0"
] | permissive | AlexTsybin/stepik-android | 454996dcde50033d2e5f12a95d97229bc84305e8 | 9418c42535ef5c5ff472d9d21b78ec2a8a8cb602 | refs/heads/master | 2020-03-20T15:49:12.939443 | 2018-07-25T08:50:37 | 2018-07-25T08:50:37 | 137,522,659 | 0 | 0 | Apache-2.0 | 2018-07-25T10:01:00 | 2018-06-15T19:02:40 | Java | UTF-8 | Java | false | false | 2,562 | java | package org.stepic.droid.ui.fragments;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import org.stepic.droid.R;
import org.stepic.droid.model.Attachment;
import org.stepic.droid.model.Attempt;
import org.stepic.droid.model.Reply;
import java.util.ArrayList;
import butterknife.BindString;
public class FreeResponseStepFragment extends StepAttemptFragment {
@BindString(R.string.correct_free_response)
String correctString;
EditText answerField;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
answerField = (EditText) ((LayoutInflater) this.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_free_answer_attempt, attemptContainer, false);
attemptContainer.addView(answerField);
}
@Override
protected void showAttempt(Attempt attempt) {
//do nothing, because this attempt doesn't have any specific.
answerField.getText().clear();
}
@Override
protected Reply generateReply() {
String answer = answerField.getText().toString();
if (attempt != null && attempt.getDataset() != null && attempt.getDataset().getIs_html_enabled() != null && attempt.getDataset().getIs_html_enabled()) {
answer = getTextResolver().replaceWhitespaceToBr(answer);
}
return new Reply.Builder()
.setText(answer)
.setAttachments(new ArrayList<Attachment>())
.build();
}
@Override
protected void blockUIBeforeSubmit(boolean needBlock) {
answerField.setEnabled(!needBlock);
}
@Override
protected void onRestoreSubmission() {
Reply reply = submission.getReply();
if (reply == null) return;
String text = reply.getText();
if (attempt != null && attempt.getDataset() != null && attempt.getDataset().getIs_html_enabled() != null && attempt.getDataset().getIs_html_enabled()) {
//todo show as html in enhanced latexview
answerField.setText(getTextResolver().fromHtml(text));
} else {
answerField.setText(text);
}
}
@Override
protected String getCorrectString() {
return correctString;
}
@Override
public void onPause() {
super.onPause();
answerField.clearFocus();
}
}
| [
"kir-maka@yandex.ru"
] | kir-maka@yandex.ru |
072e793d6ddf423e5e2ab8be08bc15a7902f09eb | 679d98a6e3fded1c191d2c858f691bcaa723c820 | /app/src/main/java/ingeniumbd/com/kidspoem/EfifthPoem.java | f798a97499de6e8bf6153d5435c6f63d46c64e78 | [] | no_license | Oviraj/KidsPoem | f622d174d15cea7b766a2c6b13413c195929ec42 | 3df37602912e161c5cced69aff6a5deef2b43f0a | refs/heads/master | 2021-01-21T16:00:15.318105 | 2017-05-22T09:42:27 | 2017-05-22T09:42:27 | 91,868,415 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package ingeniumbd.com.kidspoem;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class EfifthPoem extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_efifth_poem);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
}
| [
"solaiman.diu@gmail.com"
] | solaiman.diu@gmail.com |
44d4ff285e6f2f085dda90b8a47a59333b657789 | 1f4b9f8e52856cf1e2750a5d7c541c2bea30a35c | /taotao-manager-service/src/main/java/com/taotao/service/ItemCatService.java | 77b0b94dae5ad2b34ec1ead4ae18a6a515d70304 | [] | no_license | pxq97/taotao-manager | 1c0d9fdd58be26e1806537291dcf20263cf8d17e | 77062ec6bdc1bfdbc910bd9a8d761a1353fb095c | refs/heads/master | 2020-04-25T17:07:56.704169 | 2019-02-27T15:06:58 | 2019-02-27T15:06:58 | 172,935,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.taotao.service;
import java.util.List;
import com.taotao.common.pojo.EUTreeNode;
public interface ItemCatService {
List<EUTreeNode> getCatList(long parentId);
}
| [
"Peng@DESKTOP-SOBQMNU"
] | Peng@DESKTOP-SOBQMNU |
662d35b7fff3066bd6f15b50b950ed16746021cf | 285ec6ddd3ecce10e6d1397d6f4668a388196dc0 | /netbeans-gradle-default-models/src/main/java/org/netbeans/gradle/model/java/WarFoldersModel.java | 2366bac91bece73b6e9a084a6c69ca56cbe27de1 | [] | no_license | kelemen/netbeans-gradle-project | a914b979afb51adda002194e838e3390b7e2471d | 7b009f1632740400faadf78dcb8a81fb71d3db34 | refs/heads/master | 2021-01-24T08:06:39.202878 | 2019-02-03T20:39:41 | 2019-02-03T20:39:41 | 5,291,703 | 137 | 69 | null | 2019-10-16T11:30:37 | 2012-08-03T23:41:43 | Java | UTF-8 | Java | false | false | 473 | java | package org.netbeans.gradle.model.java;
import java.io.File;
import java.io.Serializable;
public final class WarFoldersModel implements Serializable {
private static final long serialVersionUID = 1L;
private final File webAppDir;
public WarFoldersModel(File webAppDir) {
if (webAppDir == null) throw new NullPointerException("webAppDir");
this.webAppDir = webAppDir;
}
public File getWebAppDir() {
return webAppDir;
}
}
| [
"attila.kelemen85@gmail.com"
] | attila.kelemen85@gmail.com |
6490d844aef124ce30832427efcbedf7dd62ad29 | 4d9d0fa5e8e2d5081978e73ed457494db0125718 | /app/src/main/java/com/developerdj/fullcasa/vista/dialog/BuscarDialog.java | 344f8e7639a53ecb2f01e223c8c9fd81c4e5b917 | [] | no_license | DiegoAJS/fullcasas | 4851d603b3e262597506b210e7e7e37eac2e6057 | 0cf99ec479c53e113419095b9889ab565b91bddd | refs/heads/master | 2020-05-20T08:45:20.904014 | 2019-05-07T21:28:11 | 2019-05-07T21:28:11 | 185,480,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,286 | java | package com.developerdj.fullcasa.vista.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import com.developerdj.fullcasa.R;
import com.developerdj.fullcasa.data.TCiudad;
import com.developerdj.fullcasa.data.TDepartamento;
import com.developerdj.fullcasa.data.TInmueble;
import com.developerdj.fullcasa.data.TOferta;
import com.developerdj.fullcasa.modelo.Buscar;
import com.developerdj.fullcasa.modelo.Ciudad;
import com.developerdj.fullcasa.modelo.Departamento;
import com.developerdj.fullcasa.modelo.TipoInmueble;
import com.developerdj.fullcasa.modelo.TipoOferta;
import com.developerdj.fullcasa.vista.control.ItemControl;
import java.util.ArrayList;
import java.util.List;
/**
* Created by hp on 19/4/2017.
*/
public class BuscarDialog extends DialogFragment {
private static final String TAG = BuscarDialog.class.getSimpleName();
private String url="http://fullcasas.com/API/v1/propiedades?";
private Context context;
private EditText min,max;
private Spinner departamento,ciudad;
private Spinner cuartos,banios;
private Spinner oferta,inmueble;
private List<Departamento> departamentos = new ArrayList<Departamento>();
private List<Ciudad> ciudades = new ArrayList<Ciudad>();
private List<TipoOferta> ofertas = new ArrayList<TipoOferta>();
private List<TipoInmueble> inmuebles = new ArrayList<TipoInmueble>();
private ArrayAdapter<Ciudad> adapterCiudades;
private String[] numeros ;
private ImageView ok_buscar,close_cancelar;
private ItemControl itemControl;
private TextView.OnEditorActionListener onEditorActionListener = new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent event)
{
boolean action = false;
if (actionId == EditorInfo.IME_ACTION_SEARCH)
{
if(!min.getText().toString().isEmpty())
itemControl.buscar.setPmin(min.getText().toString());
if(!max.getText().toString().isEmpty())
itemControl.buscar.setPmax(max.getText().toString());
itemControl.clear();
action = true;
dismiss();
}
return action;
}
};
public BuscarDialog() {
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return createDialogo();
}
/**
* Crea un diálogo con personalizado para comportarse
* como formulario de login
*
* @return Diálogo
*/
public AlertDialog createDialogo() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
context=getActivity();
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_buscar, null);
max=(EditText)view.findViewById(R.id.et_maxp_buscar);
min=(EditText)view.findViewById(R.id.et_minp_buscar);
departamento=(Spinner)view.findViewById(R.id.sp_departamento_buscar);
ciudad=(Spinner)view.findViewById(R.id.sp_ciudad_buscar);
banios=(Spinner)view.findViewById(R.id.sp_banios_buscar);
cuartos=(Spinner)view.findViewById(R.id.sp_cuartos_buscar);
oferta=(Spinner)view.findViewById(R.id.sp_oferta_buscar);
inmueble=(Spinner)view.findViewById(R.id.sp_inmueble_buscar);
numeros=context.getResources().getStringArray(R.array.array_numeros);
ok_buscar=(ImageView) view.findViewById(R.id.iv_imagen_buscar);
close_cancelar=(ImageView) view.findViewById(R.id.iv_cancelar_buscar);
inicializar();
eventos();
builder.setView(view);
return builder.create();
}
private void inicializar(){
TDepartamento.getInstance(context).lista(departamentos);
departamentos.add(0,new Departamento(0,"Todos los departamentos"));
//TCiudad.getInstance(buscarDialog.getContext()).lista(ciudades);
TOferta.getInstance(context).lista(ofertas);
ofertas.add(0,new TipoOferta(0,"Todos"));
TInmueble.getInstance(context).lista(inmuebles);
inmuebles.add(0,new TipoInmueble(0,"Todos"));
ArrayAdapter<Departamento> adapterDepartemento =
new ArrayAdapter<Departamento>(context, android.R.layout.simple_spinner_item, departamentos);
adapterDepartemento.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
departamento.setAdapter(adapterDepartemento);
adapterCiudades =
new ArrayAdapter<Ciudad>(context, android.R.layout.simple_spinner_item, ciudades);
adapterCiudades.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
ciudad.setAdapter(adapterCiudades);
ArrayAdapter<TipoOferta> adapterOfertas =
new ArrayAdapter<TipoOferta>(context, android.R.layout.simple_spinner_item, ofertas);
adapterOfertas.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
oferta.setAdapter(adapterOfertas);
ArrayAdapter<TipoInmueble> adapterInmueble=
new ArrayAdapter<TipoInmueble>(context, android.R.layout.simple_spinner_item, inmuebles);
adapterInmueble.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
inmueble.setAdapter(adapterInmueble);
ArrayAdapter<String> adapterCuarto=
new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, numeros);
adapterCuarto.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
cuartos.setAdapter(adapterCuarto);
ArrayAdapter<String> adapterbanio=
new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, numeros);
adapterbanio.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
banios.setAdapter(adapterbanio);
}
private void eventos(){
oferta.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(ofertas.get(position).getId()>0)
itemControl.buscar.setTipos_ofertas(String.valueOf(ofertas.get(position).getId()));
else
itemControl.buscar.setTipos_ofertas(null);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
inmueble.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (inmuebles.get(position).getId()>0)
itemControl.buscar.setTipos_inmuebles(String.valueOf(inmuebles.get(position).getId()));
else
itemControl.buscar.setTipos_inmuebles(null);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
departamento.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (departamentos.get(position).getId()>0){
itemControl.buscar.setDepartamento(String.valueOf(departamentos.get(position).getId()));
}else {
itemControl.buscar.setDepartamento(null);
}
getCiudades(departamentos.get(position).getId());
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
ciudad.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (ciudades.get(position).getId()>0)
itemControl.buscar.setCiudad(String.valueOf(ciudades.get(position).getId()));
else
itemControl.buscar.setCiudad(null);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
min.setOnEditorActionListener(onEditorActionListener);
max.setOnEditorActionListener(onEditorActionListener);
ok_buscar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//itemControl.setUrl(url+getLinkBuscar());
if(!min.getText().toString().isEmpty())
itemControl.buscar.setPmin(min.getText().toString());
if(!max.getText().toString().isEmpty())
itemControl.buscar.setPmax(max.getText().toString());
itemControl.clear();
dismiss();
}
});
close_cancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
public void getCiudades(int id){
TCiudad.getInstance(context).lista(ciudades,id);
if(id==0)
ciudades.add(0,new Ciudad(0,"Todos",0));
else if (ciudades.size()>0)
ciudades.add(0,new Ciudad(0,"Todas las provincias",0));
else
ciudades.add(0,new Ciudad(0,"Sin registros",0));
adapterCiudades.notifyDataSetChanged();
}
public void setup(ItemControl itemControl){
this.itemControl=itemControl;
}
} | [
"diogo19.j@gmail.com"
] | diogo19.j@gmail.com |
617fabc84a4cea4d2d5a63dc872cfc596f86adeb | 4df8f217cc2d9c0bd6b9424f23f5f0ae492e7c47 | /src/main/java/com/unicommerce/wsdl/WsSequence.java | 5d5c08b07099d70ef4c20b73e98297f759472482 | [] | no_license | varungupta64/services-oms | 5435c7cd81794dc8e85f4595cc5c5c43963762ba | 0a60faedeb12fb1f5d74616c291c98ace2da64df | refs/heads/master | 2020-04-03T10:05:06.307963 | 2016-06-21T12:33:01 | 2016-06-21T12:33:01 | 61,610,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,509 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.11.06 at 02:05:50 PM IST
//
package com.unicommerce.wsdl;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for WsSequence complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="WsSequence">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Prefix" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="CurrentValue" type="{http://www.w3.org/2001/XMLSchema}integer" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WsSequence", propOrder = {
"prefix",
"currentValue"
})
public class WsSequence {
@XmlElement(name = "Prefix", required = true)
protected String prefix;
@XmlElement(name = "CurrentValue")
protected BigInteger currentValue;
/**
* Gets the value of the prefix property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPrefix() {
return prefix;
}
/**
* Sets the value of the prefix property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPrefix(String value) {
this.prefix = value;
}
/**
* Gets the value of the currentValue property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getCurrentValue() {
return currentValue;
}
/**
* Sets the value of the currentValue property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setCurrentValue(BigInteger value) {
this.currentValue = value;
}
}
| [
"varungupta01@varun4417.Nagarro.local"
] | varungupta01@varun4417.Nagarro.local |
a9dc8d43ac590c8eeedfc31b29651d70ce44b76d | a6aee0309cf8e5c617cfc1d7edf3999759d4e209 | /src/ArraygenerateMatrix59LeetCode.java | 2d4d66f370cc08c9b2f59a93beb1265f9701a85c | [] | no_license | LenmonLin/swordToOffer | 64a036cf4ec01f078dfc505ad16f1220b1cb5795 | c2d5479731b8f0f337fbfd257baec90f0b65022b | refs/heads/master | 2021-07-11T09:08:40.271644 | 2020-07-02T08:53:14 | 2020-07-02T08:53:14 | 150,380,646 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,339 | java | /**
* 给定一个正整数 n,生成一个包含 1 到 n 所有元素,且元素按顺时针顺序螺旋排列的
* 正方形矩阵。
* 示例:
* 输入: 3
* 输出:
* [
* [ 1, 2, 3 ],
* [ 8, 9, 4 ],
* [ 7, 6, 5 ]
* ]
* @author LemonLin
* @Description :ArraygenerateMatrix59LeetCode
* @date 20.2.9-22:06
* 思路:和LeetCode54类似
*/
public class ArraygenerateMatrix59LeetCode {
public int[][] generateMatrix(int n) {
if (n<=0)return new int[0][];
// int rows = 0;
// for (int i =1;i<=n;i++){
// if (i*i>=n){
// rows =i;
// break;
// }
// }
int rowsStart=0;
int rowsEnd=n-1;
int columnsStart =0;
int columnsEnd =n-1;
int [][] result = new int[n][n];
int digits=1;
while (rowsStart<=rowsEnd&&columnsStart<=columnsEnd){
if (rowsStart<=rowsEnd){
for (int j = columnsStart;j<=columnsEnd;j++){
result[rowsStart][j]=digits;
digits++;
}
rowsStart++;
}
if (columnsStart<=columnsEnd){
for (int i=rowsStart;i<=rowsEnd;i++){
result[i][columnsEnd]=digits;
digits++;
}
columnsEnd--;
}
if (rowsStart<=rowsEnd){
for (int j = columnsEnd;j>=columnsStart;j--){
result[rowsEnd][j]=digits;
digits++;
}
rowsEnd--;
}
if (columnsStart<=columnsEnd){
for (int i=rowsEnd;i>=rowsStart;i--){
result[i][columnsStart]=digits;
digits++;
}
columnsStart++;
}
}
return result;
}
public static void main(String[] args) {
int n=1;
int [][] matrix = new ArraygenerateMatrix59LeetCode().generateMatrix(n);
for (int i=0;i<matrix.length;i++){
for (int j=0;j<matrix[0].length;j++){
System.out.print(matrix[i][j]);
}
System.out.println();
}
// int [][] test = new int[2][2];
// test[0][0]=0;
// System.out.println(test[0][0]);
}
}
| [
"linfromearth@outlook.com"
] | linfromearth@outlook.com |
b8040440f905fd948a86e35a7d49d19f4ac63b33 | 2f32afe9b19a9934fd112a5c75bdb8098f27ceea | /ContohKurvaEliptikDiffieHellman.java | b17198015b30976bc175e02f0417893d6cd16e57 | [] | no_license | yudhadeux/Latihan-Program-Java-PBO | c9380d0a44da7ed3e1c5ce4715e8a1c9bc44cc09 | 6161461c49dfa5bd8d169ce9efd33f147d329b3d | refs/heads/main | 2023-01-21T22:47:58.635269 | 2020-11-23T16:10:23 | 2020-11-23T16:10:23 | 315,364,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,336 | java | package bab4;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.spec.ECFieldFp;
import java.security.spec.ECParameterSpec;
import java.security.spec.ECPoint;
import java.security.spec.EllipticCurve;
import javax.crypto.KeyAgreement;
public class ContohKurvaEliptikDiffieHellman
{
public static void main(String[] args) throws Exception
{
KeyPairGenerator bangkitKunci = KeyPairGenerator.getInstance("ECDH", "BC");
EllipticCurve kurva = new EllipticCurve(
new ECFieldFp(new BigInteger(
"fffffffffffffffffffffffffffffffeffffffffffffffff", 16)),
new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16));
ECParameterSpec kurvaEliptikSpek = new ECParameterSpec(
kurva,
new ECPoint(
new BigInteger("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 16),
new BigInteger("f8e6d46a003725879cefee1294db32298c06885ee186b7ee", 16)),
new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16),
1);
bangkitKunci.initialize(kurvaEliptikSpek, Utils.ciptakanAcakTetap());
//pengaturan
KeyAgreement aKunciPerjanjian = KeyAgreement.getInstance("ECDH", "BC");
KeyPair aSepasang = bangkitKunci.generateKeyPair();
KeyAgreement bKunciPerjanjian = KeyAgreement.getInstance("ECDH", "BC");
KeyPair bSepasang = bangkitKunci.generateKeyPair();
//perjanjian dua pihak
aKunciPerjanjian.init(aSepasang.getPrivate());
bKunciPerjanjian.init(bSepasang.getPrivate());
aKunciPerjanjian.doPhase(bSepasang.getPublic(), true);
bKunciPerjanjian.doPhase(aSepasang.getPublic(), true);
//menghasilkan byte-byte kunci
MessageDigest hash = MessageDigest.getInstance("SHA1", "BC");
byte[] aBersama = hash.digest(aKunciPerjanjian.generateSecret());
byte[] bBersama = hash.digest(bKunciPerjanjian.generateSecret());
System.out.println(Utils.toHex(aBersama));
System.out.println(Utils.toHex(bBersama));
}
} | [
"noreply@github.com"
] | noreply@github.com |
277cccf91b78f9462b3eb0e3ef49165fedff1dd7 | e941b928c3627ffb12122ec0f770ada13fdcb526 | /git/test/Downloads/eclipse/oop4/src/Conditionalstatementexercise/loop.java | 7631772cb178c7534ebfa8eb56703e4111138671 | [] | no_license | aminny09/Project007 | 56788b15315be2bfd81b59433b688c90f2960c4d | 93c5b2c95daf9ab752f7c3f4536b6778618f2117 | refs/heads/master | 2022-12-30T23:08:08.350074 | 2020-10-27T05:58:42 | 2020-10-27T05:58:42 | 296,665,497 | 0 | 0 | null | 2020-10-27T05:58:44 | 2020-09-18T15:51:33 | Java | UTF-8 | Java | false | false | 222 | java | package Conditionalstatementexercise;
public class loop {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=1;i<=8;i=i+1) {
System.out.println("amin");
}
}
}
| [
"aminny570@yahoo.com"
] | aminny570@yahoo.com |
50cfaeb1c87c61fd29d8ca7c5719c61b44c1811b | 2f0e97ec48590444b043e8c56c492f6a12511503 | /src/test/java/com/djd/fun/tachchapter/demo009fibonacci/RecursiveFiboTest.java | 92892ccf25231d40d3e82b4d97818ad29d197943 | [] | no_license | simongreene02/techchapter | c2ae89448f8c8483385c4cb8b5048dde5bdf7c14 | 16ba9a460d296f4a2c2198457bbc8d8c8798f602 | refs/heads/master | 2021-01-22T01:10:52.203861 | 2017-09-30T16:04:11 | 2017-09-30T16:04:11 | 102,204,284 | 0 | 0 | null | 2017-09-02T15:03:19 | 2017-09-02T15:03:19 | null | UTF-8 | Java | false | false | 1,851 | java | package com.djd.fun.tachchapter.demo009fibonacci;
import java.math.BigInteger;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static com.google.common.truth.Truth.assertThat;
/**
* @author JGD
* @since 10/4/16
*/
public class RecursiveFiboTest {
private Fibonacci fibonacci;
@Before
public void setUp() {
fibonacci = new RecursiveFibo();
}
@Test(expected = IllegalArgumentException.class)
public void findAt_negative() {
fibonacci.findAt(-1);
}
@Test
public void findAt_0_0() {
assertThat(fibonacci.findAt(0)).isEqualTo(0);
}
@Test
public void findAt_1_1() {
assertThat(fibonacci.findAt(1)).isEqualTo(1);
}
@Test
public void findAt_2_1() {
assertThat(fibonacci.findAt(2)).isEqualTo(1);
}
@Test
public void findAt_3_2() {
assertThat(fibonacci.findAt(3)).isEqualTo(2);
}
@Test
public void findAt_4_3() {
assertThat(fibonacci.findAt(4)).isEqualTo(3);
}
@Test
public void findAt_5_5() {
assertThat(fibonacci.findAt(5)).isEqualTo(5);
}
@Test
public void findAt_6_8() {
assertThat(fibonacci.findAt(6)).isEqualTo(8);
}
@Test
public void findAt_7_13() {
assertThat(fibonacci.findAt(7)).isEqualTo(13);
}
@Test
public void findAt_20_6765() {
assertThat(fibonacci.findAt(20)).isEqualTo(6765);
}
@Ignore("O(2^N) ... that is slow for N=46")
@Test
public void findAt_46_1836311903() {
assertThat(fibonacci.findAt(46)).isEqualTo(1836311903);
}
@Test
public void findBigAt_5_5() {
assertThat(fibonacci.findBigAt(BigInteger.valueOf(5))).isEqualTo(BigInteger.valueOf(5));
}
@Ignore("O(2^N) ... that is slow for N=46")
@Test
public void findBigAt_46_1836311903() {
assertThat(fibonacci.findBigAt(BigInteger.valueOf(46))).isEqualTo(BigInteger.valueOf(1836311903));
}
} | [
"ninja@renton.net"
] | ninja@renton.net |
b4aac11c6e1af4c287277e7ebd7e3d6db6391b86 | f658a7467ccddb115b55e6f2a153ae9357ad80ac | /app/src/main/java/com/frankz/ludycommobiletest/viewmodel/AppViewModel.java | b4fb17efc3aff9f52407171c6b44663b7257ada8 | [] | no_license | Franklinz98/LudycomMobileTest | e3c4e10bac1ae2f9dd805c07bd4bee8d1b2bde5f | 9323ebb02bb5e3d6c41599bf4f6c99a0095ba984 | refs/heads/master | 2023-04-16T08:18:22.767526 | 2021-04-30T01:18:49 | 2021-04-30T01:18:49 | 362,990,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,157 | java | package com.frankz.ludycommobiletest.viewmodel;
import android.app.Application;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.frankz.ludycommobiletest.apiservice.VolleyCallback;
import com.frankz.ludycommobiletest.apiservice.VolleyService;
import com.frankz.ludycommobiletest.model.Country;
import com.frankz.ludycommobiletest.utils.CountryUtils;
import org.json.JSONArray;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
public class AppViewModel extends AndroidViewModel implements VolleyCallback {
private final Application application;
private final MutableLiveData<List<Country>> asia, africa, americas, europe, oceania, polar;
private final MutableLiveData<String> searchQuery, title;
public AppViewModel(@NonNull Application application) {
super(application);
this.application = application;
this.asia = new MutableLiveData<>();
this.africa = new MutableLiveData<>();
this.americas = new MutableLiveData<>();
this.europe = new MutableLiveData<>();
this.oceania = new MutableLiveData<>();
this.polar = new MutableLiveData<>();
this.searchQuery = new MutableLiveData<>();
this.title = new MutableLiveData<>();
}
public LiveData<List<Country>> getAsia() {
return asia;
}
public LiveData<List<Country>> getAfrica() {
return africa;
}
public LiveData<List<Country>> getAmericas() {
return americas;
}
public LiveData<List<Country>> getEurope() {
return europe;
}
public LiveData<List<Country>> getOceania() {
return oceania;
}
public LiveData<List<Country>> getPolar() {
return polar;
}
public LiveData<String> getSearchQuery() {
return searchQuery;
}
public MutableLiveData<String> getTitle() {
return title;
}
public void updateSearchQuery(String query) {
this.searchQuery.setValue(query);
}
public void updateTitle(String title) {
this.title.setValue(title);
}
public void fetchCountries() {
if (this.asia.getValue() == null){
Log.d("Response", "fetchCountries: Make Request");
VolleyService.fetchCountries(application.getBaseContext(), this);
}
}
@Override
public void onRequestSuccess(JSONArray response) {
HashMap<String, List<Country>> countries = CountryUtils.sortCountries(response);
asia.setValue(countries.get("asia"));
africa.setValue(countries.get("africa"));
americas.setValue(countries.get("americas"));
europe.setValue(countries.get("europe"));
oceania.setValue(countries.get("oceania"));
polar.setValue(countries.get("polar"));
Log.d("Response", "onRequestSuccess: " + Objects.requireNonNull(polar.getValue()).toString());
}
@Override
public void onRequestError() {
americas.setValue(new ArrayList<>());
}
}
| [
"franklinz@uninorte.edu.co"
] | franklinz@uninorte.edu.co |
9a1c4e6d944515d7857d886702ef53a210ad9753 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i26696.java | dc49a49ac45685f3d870e840904c4acbbed9fc50 | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package number_of_direct_superinterfaces;
public interface i26696 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
891b949ba07744e1a26f603ef4570dda767e4333 | c4eab06c988972a3207584f97453e6b06da12184 | /workspace/src/org/ddd/section2/example2_17/Speakable.java | f374918319914d1a96fec75b2007655d7982601e | [] | no_license | dailiwen/HighJava | f1ef9034c1860d6a72aa1e741983459c661c6c81 | 28fc1204df613a1d218e1043a06b0133393a94e9 | refs/heads/master | 2020-03-21T01:59:57.206350 | 2018-06-20T03:11:31 | 2018-06-20T03:11:31 | 137,973,921 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package org.ddd.section2.example2_17;
public interface Speakable {
public void speak();
public void speak(String message);
}
| [
"450326779@qq.com"
] | 450326779@qq.com |
66e9cad8e6a1ff52a3955f4fb4dcd9d9cfaafc2d | f07e43433655dd2cb1f36905ec39bba39669a540 | /nineOldAndroids/src/main/java/com/blue/leaves/nineoldandroids/animation/AnimatorInflater.java | c2c35132ab5090875bc713c86e61b82b95e4bd58 | [] | no_license | langwan1314/Common | ec48d98aafddad16abe17422f6cc502845c2be9d | db11407fe1e69ed1b55e518bb7f4e603af4bd0e0 | refs/heads/master | 2021-01-10T08:06:50.858822 | 2015-11-14T12:56:39 | 2015-11-14T12:56:39 | 45,965,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,382 | java | /*
* Copyright (C) 2010 The Android Open Source Project
*
* 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.blue.leaves.nineoldandroids.animation;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.content.res.Resources.NotFoundException;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.util.Xml;
import android.view.animation.AnimationUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
/**
* This class is used to instantiate animator XML files into Animator objects.
* <p>
* For performance reasons, inflation relies heavily on pre-processing of
* XML files that is done at build time. Therefore, it is not currently possible
* to use this inflater with an XmlPullParser over a plain XML file at runtime;
* it only works with an XmlPullParser returned from a compiled resource (R.
* <em>something</em> file.)
*/
public class AnimatorInflater {
private static final int[] AnimatorSet = new int[] {
/* 0 */ android.R.attr.ordering,
};
private static final int AnimatorSet_ordering = 0;
private static final int[] PropertyAnimator = new int[] {
/* 0 */ android.R.attr.propertyName,
};
private static final int PropertyAnimator_propertyName = 0;
private static final int[] Animator = new int[] {
/* 0 */ android.R.attr.interpolator,
/* 1 */ android.R.attr.duration,
/* 2 */ android.R.attr.startOffset,
/* 3 */ android.R.attr.repeatCount,
/* 4 */ android.R.attr.repeatMode,
/* 5 */ android.R.attr.valueFrom,
/* 6 */ android.R.attr.valueTo,
/* 7 */ android.R.attr.valueType,
};
private static final int Animator_interpolator = 0;
private static final int Animator_duration = 1;
private static final int Animator_startOffset = 2;
private static final int Animator_repeatCount = 3;
private static final int Animator_repeatMode = 4;
private static final int Animator_valueFrom = 5;
private static final int Animator_valueTo = 6;
private static final int Animator_valueType = 7;
/**
* These flags are used when parsing AnimatorSet objects
*/
private static final int TOGETHER = 0;
//private static final int SEQUENTIALLY = 1;
/**
* Enum values used in XML attributes to indicate the value for mValueType
*/
private static final int VALUE_TYPE_FLOAT = 0;
//private static final int VALUE_TYPE_INT = 1;
//private static final int VALUE_TYPE_COLOR = 4;
//private static final int VALUE_TYPE_CUSTOM = 5;
/**
* Loads an {@link Animator} object from a resource
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
* @return The animator object reference by the specified id
* @throws NotFoundException when the animation cannot be loaded
*/
public static Animator loadAnimator(Context context, int id)
throws NotFoundException {
XmlResourceParser parser = null;
try {
parser = context.getResources().getAnimation(id);
return createAnimatorFromXml(context, parser);
} catch (XmlPullParserException ex) {
NotFoundException rnf =
new NotFoundException("Can't load animation resource ID #0x" +
Integer.toHexString(id));
rnf.initCause(ex);
throw rnf;
} catch (IOException ex) {
NotFoundException rnf =
new NotFoundException("Can't load animation resource ID #0x" +
Integer.toHexString(id));
rnf.initCause(ex);
throw rnf;
} finally {
if (parser != null) parser.close();
}
}
private static Animator createAnimatorFromXml(Context c, XmlPullParser parser)
throws XmlPullParserException, IOException {
return createAnimatorFromXml(c, parser, Xml.asAttributeSet(parser), null, 0);
}
private static Animator createAnimatorFromXml(Context c, XmlPullParser parser,
AttributeSet attrs, AnimatorSet parent, int sequenceOrdering)
throws XmlPullParserException, IOException {
Animator anim = null;
ArrayList<Animator> childAnims = null;
// Make sure we are on a start tag.
int type;
int depth = parser.getDepth();
while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
&& type != XmlPullParser.END_DOCUMENT) {
if (type != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if (name.equals("objectAnimator")) {
anim = loadObjectAnimator(c, attrs);
} else if (name.equals("animator")) {
anim = loadAnimator(c, attrs, null);
} else if (name.equals("set")) {
anim = new AnimatorSet();
TypedArray a = c.obtainStyledAttributes(attrs,
/*com.android.internal.R.styleable.*/AnimatorSet);
TypedValue orderingValue = new TypedValue();
a.getValue(/*com.android.internal.R.styleable.*/AnimatorSet_ordering, orderingValue);
int ordering = orderingValue.type == TypedValue.TYPE_INT_DEC ? orderingValue.data : TOGETHER;
createAnimatorFromXml(c, parser, attrs, (AnimatorSet) anim, ordering);
a.recycle();
} else {
throw new RuntimeException("Unknown animator name: " + parser.getName());
}
if (parent != null) {
if (childAnims == null) {
childAnims = new ArrayList<Animator>();
}
childAnims.add(anim);
}
}
if (parent != null && childAnims != null) {
Animator[] animsArray = new Animator[childAnims.size()];
int index = 0;
for (Animator a : childAnims) {
animsArray[index++] = a;
}
if (sequenceOrdering == TOGETHER) {
parent.playTogether(animsArray);
} else {
parent.playSequentially(animsArray);
}
}
return anim;
}
private static ObjectAnimator loadObjectAnimator(Context context, AttributeSet attrs)
throws NotFoundException {
ObjectAnimator anim = new ObjectAnimator();
loadAnimator(context, attrs, anim);
TypedArray a =
context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/PropertyAnimator);
String propertyName = a.getString(/*com.android.internal.R.styleable.*/PropertyAnimator_propertyName);
anim.setPropertyName(propertyName);
a.recycle();
return anim;
}
/**
* Creates a new animation whose parameters come from the specified context and
* attributes set.
*
* @param context the application environment
* @param attrs the set of attributes holding the animation parameters
*/
private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, ValueAnimator anim)
throws NotFoundException {
TypedArray a =
context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/Animator);
long duration = a.getInt(/*com.android.internal.R.styleable.*/Animator_duration, 0);
long startDelay = a.getInt(/*com.android.internal.R.styleable.*/Animator_startOffset, 0);
int valueType = a.getInt(/*com.android.internal.R.styleable.*/Animator_valueType,
VALUE_TYPE_FLOAT);
if (anim == null) {
anim = new ValueAnimator();
}
//TypeEvaluator evaluator = null;
int valueFromIndex = /*com.android.internal.R.styleable.*/Animator_valueFrom;
int valueToIndex = /*com.android.internal.R.styleable.*/Animator_valueTo;
boolean getFloats = (valueType == VALUE_TYPE_FLOAT);
TypedValue tvFrom = a.peekValue(valueFromIndex);
boolean hasFrom = (tvFrom != null);
int fromType = hasFrom ? tvFrom.type : 0;
TypedValue tvTo = a.peekValue(valueToIndex);
boolean hasTo = (tvTo != null);
int toType = hasTo ? tvTo.type : 0;
if ((hasFrom && (fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(fromType <= TypedValue.TYPE_LAST_COLOR_INT)) ||
(hasTo && (toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT))) {
// special case for colors: ignore valueType and get ints
getFloats = false;
anim.setEvaluator(new ArgbEvaluator());
}
if (getFloats) {
float valueFrom;
float valueTo;
if (hasFrom) {
if (fromType == TypedValue.TYPE_DIMENSION) {
valueFrom = a.getDimension(valueFromIndex, 0f);
} else {
valueFrom = a.getFloat(valueFromIndex, 0f);
}
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = a.getDimension(valueToIndex, 0f);
} else {
valueTo = a.getFloat(valueToIndex, 0f);
}
anim.setFloatValues(valueFrom, valueTo);
} else {
anim.setFloatValues(valueFrom);
}
} else {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = a.getDimension(valueToIndex, 0f);
} else {
valueTo = a.getFloat(valueToIndex, 0f);
}
anim.setFloatValues(valueTo);
}
} else {
int valueFrom;
int valueTo;
if (hasFrom) {
if (fromType == TypedValue.TYPE_DIMENSION) {
valueFrom = (int) a.getDimension(valueFromIndex, 0f);
} else if ((fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(fromType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueFrom = a.getColor(valueFromIndex, 0);
} else {
valueFrom = a.getInt(valueFromIndex, 0);
}
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = (int) a.getDimension(valueToIndex, 0f);
} else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueTo = a.getColor(valueToIndex, 0);
} else {
valueTo = a.getInt(valueToIndex, 0);
}
anim.setIntValues(valueFrom, valueTo);
} else {
anim.setIntValues(valueFrom);
}
} else {
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = (int) a.getDimension(valueToIndex, 0f);
} else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueTo = a.getColor(valueToIndex, 0);
} else {
valueTo = a.getInt(valueToIndex, 0);
}
anim.setIntValues(valueTo);
}
}
}
anim.setDuration(duration);
anim.setStartDelay(startDelay);
if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatCount)) {
anim.setRepeatCount(
a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatCount, 0));
}
if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatMode)) {
anim.setRepeatMode(
a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatMode,
ValueAnimator.RESTART));
}
//if (evaluator != null) {
// anim.setEvaluator(evaluator);
//}
final int resID =
a.getResourceId(/*com.android.internal.R.styleable.*/Animator_interpolator, 0);
if (resID > 0) {
anim.setInterpolator(AnimationUtils.loadInterpolator(context, resID));
}
a.recycle();
return anim;
}
} | [
"85121475@qq.com"
] | 85121475@qq.com |
962d627ffabf6dfca81cdce3d61be887063ff890 | 54dc4268c350a55f1d99896c96620c21789cce33 | /lox/TokenType.java | 50f7653a856326cd904dbf19563467caf7198b3a | [
"MIT"
] | permissive | MellowCobra/jlox | b8b88768d7425f18e942cf93489b513bb7a622b8 | b766973ef3893fd7d60ee44d7721a3b605927c92 | refs/heads/master | 2020-03-17T18:46:30.713214 | 2018-05-25T18:11:52 | 2018-05-25T18:11:52 | 133,832,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package com.craftinginterpreters.lox;
enum TokenType {
// Single-character tokens
LEFT_PAREN, RIGHT_PAREN, LEFT_BRACE, RIGHT_BRACE, COMMA, DOT, MINUS, PLUS, SEMICOLON, SLASH, STAR,
// One or two-character tokens
BANG, BANG_EQUAL, EQUAL, EQUAL_EQUAL, GREATER, GREATER_EQUAL, LESS, LESS_EQUAL,
// Literals
IDENTIFIER, STRING, NUMBER,
// Keywords
AND, CLASS, ELSE, FALSE, FUN, FOR, IF, NIL, OR, PRINT, RETURN, SUPER, THIS, TRUE, VAR, WHILE,
EOF
} | [
"Grayson.Dubois@hcahealthcare.com"
] | Grayson.Dubois@hcahealthcare.com |
c5023c57ad22e9a6713b17bb44c30d5577837d95 | c4dc38459ce5c6172f17a965435f1eea5c3f5cd6 | /app/src/main/java/com/kelly/effect/javapoet/test/ARouter$$Path$$order.java | 077250f35ed7a51922daa1473d7534692882ca6f | [] | no_license | zongkaili/AndroidAwesomeEffect | 5adbd905ac1cdc3b33d7adca55d440ff7ca350eb | d3d9f3a7501af325a920ddf8a198d18491cca776 | refs/heads/master | 2022-07-21T10:06:16.481700 | 2022-07-11T15:07:23 | 2022-07-11T15:07:23 | 213,299,103 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.kelly.effect.javapoet.test;
import com.kelly.modular.annotation.model.RouterBean;
import com.kelly.modular.api.core.ARouterLoadPath;
import com.kelly.modular.order.Order_MainActivity;
import java.util.HashMap;
import java.util.Map;
/**
* author: zongkaili
* data: 2019-12-22
* desc:
*/
public class ARouter$$Path$$order implements ARouterLoadPath {
@Override
public Map<String, RouterBean> loadPath() {
Map<String, RouterBean> pathMap = new HashMap<>();
pathMap.put("/order/Order_MainActivity", RouterBean.create(
RouterBean.Type.ACTIVITY,
Order_MainActivity.class,
"order",
"/order/Order_MainActivity"));
return pathMap;
}
}
| [
"zongkaili@idealsee.cn"
] | zongkaili@idealsee.cn |
13c197826ddc11a808d62ddd091fb21da886aeef | bee994d337b02c9885e40a50078e2026c42772dc | /ConfereneceMaster-portlet/docroot/WEB-INF/src/com/chola/service/conference/model/impl/roomCacheModel.java | e6fc849a4935f29c507cc0ec7972142803a64402 | [] | no_license | mmehral/Liferay_Applications | 3387fd7dd3fe348a8f78d927dedb408b949f92a3 | ac0d314771ac6dba5db8c0b07ca88ae4c2636332 | refs/heads/master | 2021-05-06T13:47:41.349798 | 2017-12-19T13:09:41 | 2017-12-19T13:09:41 | 113,277,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,031 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* 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.
*/
package com.chola.service.conference.model.impl;
import aQute.bnd.annotation.ProviderType;
import com.chola.service.conference.model.room;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.util.HashUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/**
* The cache model class for representing room in entity cache.
*
* @author adms.java1
* @see room
* @generated
*/
@ProviderType
public class roomCacheModel implements CacheModel<room>, Externalizable {
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof roomCacheModel)) {
return false;
}
roomCacheModel roomCacheModel = (roomCacheModel)obj;
if (room_id == roomCacheModel.room_id) {
return true;
}
return false;
}
@Override
public int hashCode() {
return HashUtil.hash(0, room_id);
}
@Override
public String toString() {
StringBundler sb = new StringBundler(17);
sb.append("{room_id=");
sb.append(room_id);
sb.append(", state_id=");
sb.append(state_id);
sb.append(", location_id=");
sb.append(location_id);
sb.append(", floor_id=");
sb.append(floor_id);
sb.append(", room_name=");
sb.append(room_name);
sb.append(", room_capacity=");
sb.append(room_capacity);
sb.append(", room_extension=");
sb.append(room_extension);
sb.append(", room_values=");
sb.append(room_values);
sb.append("}");
return sb.toString();
}
@Override
public room toEntityModel() {
roomImpl roomImpl = new roomImpl();
roomImpl.setRoom_id(room_id);
roomImpl.setState_id(state_id);
roomImpl.setLocation_id(location_id);
roomImpl.setFloor_id(floor_id);
if (room_name == null) {
roomImpl.setRoom_name(StringPool.BLANK);
}
else {
roomImpl.setRoom_name(room_name);
}
roomImpl.setRoom_capacity(room_capacity);
roomImpl.setRoom_extension(room_extension);
if (room_values == null) {
roomImpl.setRoom_values(StringPool.BLANK);
}
else {
roomImpl.setRoom_values(room_values);
}
roomImpl.resetOriginalValues();
return roomImpl;
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
room_id = objectInput.readLong();
state_id = objectInput.readLong();
location_id = objectInput.readLong();
floor_id = objectInput.readLong();
room_name = objectInput.readUTF();
room_capacity = objectInput.readLong();
room_extension = objectInput.readLong();
room_values = objectInput.readUTF();
}
@Override
public void writeExternal(ObjectOutput objectOutput)
throws IOException {
objectOutput.writeLong(room_id);
objectOutput.writeLong(state_id);
objectOutput.writeLong(location_id);
objectOutput.writeLong(floor_id);
if (room_name == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(room_name);
}
objectOutput.writeLong(room_capacity);
objectOutput.writeLong(room_extension);
if (room_values == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(room_values);
}
}
public long room_id;
public long state_id;
public long location_id;
public long floor_id;
public String room_name;
public long room_capacity;
public long room_extension;
public String room_values;
} | [
"mehral.mohit09@gmail.com"
] | mehral.mohit09@gmail.com |
1c27cf5049739b3696a7de09c95a0266120d2dd9 | a3a06ca27ecad4b4674694387561d97d4920da47 | /kie-wb-common-screens/kie-wb-common-datasource-mgmt/kie-wb-common-datasource-mgmt-backend/src/main/java/org/kie/workbench/common/screens/datasource/management/backend/core/DataSourceRuntimeManager.java | 26427a27d2f12f23edf1715d1c6da23a293bb6d2 | [
"Apache-2.0"
] | permissive | danielzhe/kie-wb-common | 71e777afc9c518c52f307f33230850bacfcb2013 | e12a7deeb73befb765939e7185f95b2409715b41 | refs/heads/main | 2022-08-24T12:01:21.180766 | 2022-03-29T07:55:56 | 2022-03-29T07:55:56 | 136,397,477 | 1 | 0 | Apache-2.0 | 2020-08-06T14:50:34 | 2018-06-06T23:43:53 | Java | UTF-8 | Java | false | false | 4,242 | java | /*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.workbench.common.screens.datasource.management.backend.core;
import org.kie.workbench.common.screens.datasource.management.model.DataSourceDef;
import org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo;
import org.kie.workbench.common.screens.datasource.management.model.DriverDef;
import org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo;
/**
* Runtime system for the data sources management.
*/
public interface DataSourceRuntimeManager {
/**
* Deploys a data source definition in the data sources runtime system.
* @param dataSourceDef Data source definition to be deployed.
* @param options deployment options to apply.
* @return the deployment information if the deployment was successful, an exception is thrown in any other case.
*/
DataSourceDeploymentInfo deployDataSource(DataSourceDef dataSourceDef,
DeploymentOptions options) throws Exception;
/**
* Gets the deployment information for given data source.
* @param uuid the data source identifier.
* @return The deployment information or null if the data source wasn't deployed.
* @throws Exception if the deployment information couldn't be retrieved.
*/
DataSourceDeploymentInfo getDataSourceDeploymentInfo(String uuid) throws Exception;
/**
* Un-deploys a data source from the data sources runtime system.
* @param deploymentInfo the deployment information for a previously deployed data source.
* @param options un-deployment options to apply.
* @throws Exception if the un-deployment failed.
*/
void unDeployDataSource(DataSourceDeploymentInfo deploymentInfo,
UnDeploymentOptions options) throws Exception;
/**
* Deploys a driver in the data sources runtime system.
* @param driverDef Driver definition to be deployed.
* @param options deployment options to appy.
*/
DriverDeploymentInfo deployDriver(DriverDef driverDef,
DeploymentOptions options) throws Exception;
/**
* Gets the deployment information for a given driver.
* @param uuid the driver identifier.
* @return The deployment information or null if the driver wasn't deployed.
* @throws Exception if the deployment information couldn't be retrieved.
*/
DriverDeploymentInfo getDriverDeploymentInfo(String uuid) throws Exception;
/**
* Un-deploys a driver from data sources runtime system.
* @param deploymentInfo deployment information about the driver to un-deploy
* @param options un-deployment options to apply.
* @throws Exception if the un-deployment failed.
*/
void unDeployDriver(DriverDeploymentInfo deploymentInfo,
UnDeploymentOptions options) throws Exception;
/**
* Gets a reference to a previously deployed data source.
* @param uuid a data source identifier.
* @return if the data source is properly deployed a reference to the data source is returned, in any other case
* an exception is thrown.
* @throws Exception if the data source is not deployed or in cases when there are a communication error with the
* server, etc.
*/
DataSource lookupDataSource(String uuid) throws Exception;
/**
* Indicates if the DataSourceRuntimeManager has started properly.
* @throws Exception if the DataSourceManagement runtime has not started throws an exception.
*/
void hasStarted() throws Exception;
} | [
"manstis@users.noreply.github.com"
] | manstis@users.noreply.github.com |
c048ae563de8d8a8eed84ac0a3605b5e0fb04e49 | b8a86d2ceca828d7f08a53270fd29ac9460fa696 | /app/src/main/java/com/biaoyuan/transfernet/ui/mine/MineSendWaitPackageFgt.java | cbdbbda45eba4a93ca5f62a5265f9c2e27ddf01d | [] | no_license | enmaoFu/qmcs_net | 3de8c2963bba0bbf95fe3d73f751bd0e0dab5ddf | 767d4f5389a72cd33236a0f54c44760624088036 | refs/heads/master | 2021-07-04T14:50:12.504650 | 2017-09-20T12:47:35 | 2017-09-20T12:47:36 | 104,214,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,579 | java | package com.biaoyuan.transfernet.ui.mine;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.and.yzy.frame.adapter.recyclerview.BaseQuickAdapter;
import com.and.yzy.frame.adapter.recyclerview.listener.OnItemClickListener;
import com.and.yzy.frame.util.PtrInitHelper;
import com.and.yzy.frame.util.RetrofitUtils;
import com.biaoyuan.transfernet.R;
import com.biaoyuan.transfernet.adapter.MinePackageWaitAdapter;
import com.biaoyuan.transfernet.base.BaseFgt;
import com.biaoyuan.transfernet.config.UserManger;
import com.biaoyuan.transfernet.domain.MinePackageWaitInfo;
import com.biaoyuan.transfernet.http.Mine;
import com.biaoyuan.transfernet.util.AppJsonUtil;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import in.srain.cube.views.ptr.PtrDefaultHandler;
import in.srain.cube.views.ptr.PtrFrameLayout;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
/**
* 我的发送的包裹-待送达
* Created by Administrator on 2017/5/11.
*/
public class MineSendWaitPackageFgt extends BaseFgt {
//下拉刷新
@Bind(R.id.rv_data)
RecyclerView mRecyclerView;
@Bind(R.id.ptr_frame)
PtrFrameLayout mPtrFrame;
private MinePackageWaitAdapter mAdapter;
private int targetPage = 1;
//用来标记是否在加载
private boolean isLoading = false;
@Override
public int getLayoutId() {
return R.layout.ptr_recyclerview;
}
@Override
public void initData() {
PtrInitHelper.initPtr(getActivity(), mPtrFrame);
mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
//刷新页码归一,重新开启下拉加载
targetPage = 1;
doHttp(RetrofitUtils.createApi(Mine.class).myParcelIsSentByType(Integer.parseInt(UserManger.pageSize),targetPage,4,UserManger.getBaseId()),1);
}
});
//实例化布局管理器
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
//实例化适配器
mAdapter = new MinePackageWaitAdapter(R.layout.item_mine_send_package,new ArrayList<MinePackageWaitInfo>());
//设置布局管理器
mRecyclerView.setLayoutManager(layoutManager);
//设置间隔样式
/*mTekeRecyclerview.addItemDecoration(
new HorizontalDividerItemDecoration.Builder(getActivity())
.color(Color.parseColor(getResources().getString(R.string.parseColor)))
.sizeResId(R.dimen.size_0_5p)
.build());*/
//大小不受适配器影响
mRecyclerView.setHasFixedSize(true);
//设置加载动画类型
//mAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
//设置删除动画类型
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
//设置没有数据的页面
setEmptyView(mAdapter,null);
//设置adapter
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnItemTouchListener(new OnItemClickListener() {
@Override
public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
Bundle bundle = new Bundle();
String packageId = String.valueOf(mAdapter.getItem(position).getPackage_id());
bundle.putString("packageId",packageId);
bundle.putString("key","fcbg");
bundle.putString("key1","wait");
startActivity(MineSendPackageDetailAty.class,bundle);
}
});
//上拉加载更多
mAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
if (mRecyclerView==null){
return;
}
mRecyclerView.post(new Runnable() {
@Override
public void run() {
if (targetPage == 1) {
mAdapter.loadMoreEnd();
return;
}
doHttp(RetrofitUtils.createApi(Mine.class).myParcelIsSentByType(Integer.parseInt(UserManger.pageSize),targetPage,4,UserManger.getBaseId()),2);
}
});
}
}, mRecyclerView);
}
@Override
public void onUserVisible() {
super.onUserVisible();
//如果选中了第一个
isLoading = true;
//刷新界面
targetPage = 1;
doHttp(RetrofitUtils.createApi(Mine.class).myParcelIsSentByType(Integer.parseInt(UserManger.pageSize),targetPage,4,UserManger.getBaseId()),1);
}
@Override
public boolean setIsInitRequestData() {
return true;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
showLoadingContentDialog();
}
@Override
public void requestData() {
doHttp(RetrofitUtils.createApi(Mine.class).myParcelIsSentByType(Integer.parseInt(UserManger.pageSize),targetPage,4,UserManger.getBaseId()),1);
}
@Override
public void onSuccess(String result, Call<ResponseBody> call, Response<ResponseBody> response, int what) {
super.onSuccess(result, call, response, what);
isLoading = false;
switch (what){
case 1:
mPtrFrame.refreshComplete();
mAdapter.removeAll();
List<MinePackageWaitInfo> minePackageInfos = AppJsonUtil.getArrayList(result,MinePackageWaitInfo.class);
if (minePackageInfos != null) {
mAdapter.setNewData(minePackageInfos);
if (minePackageInfos.size()<Integer.parseInt(UserManger.pageSize)){
mAdapter.loadMoreEnd();
}
}else {
mAdapter.loadMoreEnd();
}
//增加页码
targetPage++;
break;
case 2:
//加载更多
List<MinePackageWaitInfo> minePackageInfosTwo = AppJsonUtil.getArrayList(result,MinePackageWaitInfo.class);
if (minePackageInfosTwo != null && minePackageInfosTwo.size() > 0) {
mAdapter.addDatas(minePackageInfosTwo);
mAdapter.loadMoreComplete();
} else {
mAdapter.loadMoreEnd();
}
//增加页码
targetPage++;
break;
}
}
@Override
public void onFailure(String result, Call<ResponseBody> call, Response<ResponseBody> response, int what) {
super.onFailure(result, call, response, what);
isLoading = false;
if (mPtrFrame != null) {
mPtrFrame.refreshComplete();
mAdapter.loadMoreComplete();
}
}
@Override
public void onError(Call<ResponseBody> call, Throwable t, int what) {
super.onError(call, t, what);
isLoading = false;
if (mPtrFrame != null) {
mPtrFrame.refreshComplete();
mAdapter.loadMoreComplete();
}
}
}
| [
"fuenmao@126.com"
] | fuenmao@126.com |
677c7fbec16d5fec436abec901198b0679d75194 | 86c4a05630a9df6022e522941f694cb2b6225bd2 | /vertx-web-client/src/main/java/io/vertx/ext/web/client/impl/cache/NoOpCacheStore.java | f468b9220405cc2ca417330e4dc4aecdd8955923 | [
"Apache-2.0"
] | permissive | vert-x3/vertx-web | 51aeea0b4b72f5cfb8916c50397363e14d2c94b6 | 1c07141e3cf431bf20c95d2246932b50118b97de | refs/heads/master | 2023-09-01T07:16:28.502447 | 2023-08-31T12:05:26 | 2023-08-31T12:05:26 | 26,628,954 | 1,140 | 702 | Apache-2.0 | 2023-09-14T11:21:22 | 2014-11-14T08:15:20 | Java | UTF-8 | Java | false | false | 1,322 | java | /*
* Copyright 2021 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.ext.web.client.impl.cache;
import io.vertx.core.Future;
import io.vertx.ext.web.client.spi.CacheStore;
/**
* A {@link CacheStore} implementation that does nothing.
*
* @author <a href="mailto:craigday3@gmail.com">Craig Day</a>
*/
public final class NoOpCacheStore implements CacheStore {
@Override
public Future<CachedHttpResponse> get(CacheKey key) {
return Future.failedFuture("The no-op cache store cannot return results");
}
@Override
public Future<CachedHttpResponse> set(CacheKey key, CachedHttpResponse response) {
return Future.succeededFuture(response);
}
@Override
public Future<Void> delete(CacheKey key) {
return Future.succeededFuture();
}
@Override
public Future<Void> flush() {
return Future.succeededFuture();
}
}
| [
"cday@zendesk.com"
] | cday@zendesk.com |
6b26da4b66f2fccce53422e74c2504c90c603703 | 498102d3b28d3c9c0f27cbdb24c8d28c8dcd8b82 | /20171123/src/com/java/regex/Demo5_Method.java | 630cb1410bd1d9bb8bf73a867d20d39641f10f49 | [] | no_license | luoxiao233/Practice | 744187dde0fe47d2ee40278805bf193296859b35 | aa68b4ebb0fac354a0a148e099dd5411cbe0f09a | refs/heads/master | 2021-05-07T04:18:07.430399 | 2017-12-21T13:38:46 | 2017-12-21T13:38:46 | 111,271,632 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 321 | java | package com.java.regex;
public class Demo5_Method {
public static void main(String[] args) {
String s = "haha hehe xixi";
String[] arr = s.split(" "); //方法的作用为把s 分割为了{hehe,hehe,xixi}的String数组
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}
| [
"home_dkx@126.com"
] | home_dkx@126.com |
4268f63343307476da2ff19b751063962205414b | 6a658e3f3c5ab5a26fa5e0f47700aaea12344056 | /src/org/lb/lbjscheme/vm/VirtualMachine.java | e07804efc05b449a07d64d827e67d36b56180827 | [
"BSD-3-Clause"
] | permissive | jxnuzhangwen/lbjScheme | 85422210217f3fecebab1ff381f179468542c06d | c08d6d74a4971716b5a2b08bdde38d3585b2e9be | refs/heads/master | 2020-05-19T16:06:47.328012 | 2014-03-29T17:49:07 | 2014-03-29T17:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,174 | java | // lbjScheme
// An experimental Scheme subset interpreter in Java, based on SchemeNet.cs
// Copyright (c) 2013, Leif Bruder <leifbruder@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package org.lb.lbjscheme.vm;
import java.util.*;
import org.lb.lbjscheme.*;
public final class VirtualMachine {
private static final False _false = False.getInstance();
private final Environment globalEnvironment;
private final Stack<Environment> _environmentStack = new Stack<Environment>();
private final Stack<Integer> _continueStack = new Stack<Integer>();
private final Stack<LinkedList<SchemeObject>> _argumentsStack = new Stack<LinkedList<SchemeObject>>();
private int ip;
private Environment environmentRegister;
private int continueRegister;
private SchemeObject valueRegister;
private LinkedList<SchemeObject> argumentsRegister;
public VirtualMachine(final Environment globalEnv) {
globalEnvironment = globalEnv;
}
void executeCall() throws SchemeException {
final List<SchemeObject> parameters = argumentsRegister;
if (valueRegister instanceof Builtin) {
valueRegister = ((Builtin) valueRegister).apply(parameters);
ip = continueRegister;
return;
}
if (valueRegister instanceof CompiledLambda) {
final CompiledLambda closure = (CompiledLambda) valueRegister;
environmentRegister = new Environment(closure.captured);
environmentRegister.expand(closure.parameterNames,
closure.hasRestParameter, parameters);
ip = closure.pc;
return;
}
// TODO: Lambdas from (eval)?
throw new SchemeException("Internal error: Invalid CALL target: "
+ valueRegister.getClass().getSimpleName());
}
void executeContinue() {
ip = continueRegister;
}
void executeDefineVariable(Symbol variable) throws SchemeException {
environmentRegister.define(variable, valueRegister);
ip++;
}
void executeGetVariable(Symbol variable) throws SchemeException {
valueRegister = environmentRegister.get(variable);
ip++;
}
void executeInitArgs() {
argumentsRegister = new LinkedList<SchemeObject>();
ip++;
}
void executeJump(int position) {
ip = position;
}
void executeJumpIfFalse(int position) {
ip = valueRegister == _false ? position : ip + 1;
}
void executeLiteral(SchemeObject value) {
valueRegister = value;
ip++;
}
void executeMakeClosure(String name, int position,
boolean hasRestParameter, List<Symbol> parameterNames) {
valueRegister = new CompiledLambda(name, environmentRegister, position,
parameterNames, hasRestParameter);
ip++;
}
void executePopAll() {
environmentRegister = _environmentStack.pop();
continueRegister = _continueStack.pop();
argumentsRegister = _argumentsStack.pop();
ip++;
}
void executePushAll() {
_argumentsStack.push(argumentsRegister);
_continueStack.push(continueRegister);
_environmentStack.push(environmentRegister);
ip++;
}
void executePushArg() {
argumentsRegister.addFirst(valueRegister);
ip++;
}
void executeSetArgumentRegisterToValue() {
// TODO: Check
argumentsRegister = new LinkedList<SchemeObject>();
for (SchemeObject i : (SchemeList) valueRegister)
argumentsRegister.add(i);
ip++;
}
void executeSetContinuationRegisterToPosition(int position) {
continueRegister = position;
ip++;
}
void executeSetVariable(Symbol variable) throws SchemeException {
environmentRegister.set(variable, valueRegister);
ip++;
}
public SchemeObject run(final CompiledProgram prog) throws SchemeException {
return run(prog, 0);
}
public SchemeObject run(final CompiledProgram prog, final int initialIp)
throws SchemeException {
if (!prog.isRunnable())
throw new SchemeException(
"Internal error: Program is not runnable yet");
ip = initialIp;
environmentRegister = globalEnvironment;
continueRegister = -1;
valueRegister = Nil.getInstance();
argumentsRegister = new LinkedList<SchemeObject>();
_argumentsStack.clear();
_continueStack.clear();
_environmentStack.clear();
final int numStatements = prog.getNumberOfStatements();
prog.setVm(this);
while (ip < numStatements && ip >= 0)
prog.executeOpcode(ip);
if (!_argumentsStack.isEmpty() || !_continueStack.isEmpty()
|| !_environmentStack.isEmpty())
throw new SchemeException(
"Bad program: Stack not empty after last instruction");
if (!argumentsRegister.isEmpty())
throw new SchemeException(
"Bad program: Arguments register not empty after last instruction");
return valueRegister;
}
}
| [
"leifbruder@gmail.com"
] | leifbruder@gmail.com |
1deec14778aab0b4de718ff2fb2deb4b3e240a7d | f5db49fd68369186a0ddf9bb5901276a5fe0cdf3 | /app/src/main/java/com/example/locationplacesautocomplete/PlaceJSONParser.java | 9a498e9cd93859f5a6d0c2d4aafe2497c31e0676 | [] | no_license | martharamkoti/LocationPlacesAutoComplete | fce013a595d4ab58106b04818e9a62f819ad5cbd | 7d6c98294a35845f48af78bb8a8f75a65375fdaf | refs/heads/master | 2021-01-01T17:36:06.392358 | 2017-07-23T16:59:38 | 2017-07-23T16:59:38 | 98,112,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,195 | java | package com.example.locationplacesautocomplete;
/**
* Created by vave on 22/7/17.
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class PlaceJSONParser {
/** Receives a JSONObject and returns a list */
public List<HashMap<String,String>> parse(JSONObject jObject){
JSONArray jPlaces = null;
try {
/** Retrieves all the elements in the 'places' array */
jPlaces = jObject.getJSONArray("predictions");
} catch (JSONException e) {
e.printStackTrace();
}
/** Invoking getPlaces with the array of json object
* where each json object represent a place
*/
return getPlaces(jPlaces);
}
private List<HashMap<String, String>> getPlaces(JSONArray jPlaces){
int placesCount = jPlaces.length();
List<HashMap<String, String>> placesList = new ArrayList<HashMap<String,String>>();
HashMap<String, String> place = null;
/** Taking each place, parses and adds to list object */
for(int i=0; i<placesCount;i++){
try {
/** Call getPlace with place JSON object to parse the place */
place = getPlace((JSONObject)jPlaces.get(i));
placesList.add(place);
} catch (JSONException e) {
e.printStackTrace();
}
}
return placesList;
}
/** Parsing the Place JSON object */
private HashMap<String, String> getPlace(JSONObject jPlace){
HashMap<String, String> place = new HashMap<String, String>();
String id="";
String reference="";
String description="";
try {
description = jPlace.getString("description");
id = jPlace.getString("id");
reference = jPlace.getString("reference");
place.put("description", description);
place.put("_id",id);
place.put("reference",reference);
} catch (JSONException e) {
e.printStackTrace();
}
return place;
}
} | [
"ramkoti@vave.co.in"
] | ramkoti@vave.co.in |
90293754164baa19364459c6c17afdf6aafce2a8 | 62ad978e49b8bfb31d52afb99e64e01b4e72473c | /restaurant/src/main/java/com/hcl/restaurant/repo/MenuCategoryCustomRepo.java | a83643c2b2e6ac3f9f9e0976b8d53a28aa22f6e2 | [] | no_license | vivekhcl295/demo | 9cb29ef87926a6c65dae3a0489d99632024bcfc7 | f3cc8206488de7db8559f99e24fc8a3441c3ae0e | refs/heads/main | 2023-05-28T05:43:00.226505 | 2021-06-03T08:04:44 | 2021-06-03T08:04:44 | 370,331,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.hcl.restaurant.repo;
import com.hcl.restaurant.entity.MenuCategory;
import java.util.List;
public interface MenuCategoryCustomRepo {
List<MenuCategory> findAllByRestaurantId(Long restaurantId);
}
| [
"vivek.kurmi@hcl.com"
] | vivek.kurmi@hcl.com |
32a9d73d7285183e37a92ff91dd19e8d7e6339ac | d3d6167baa7987b373a07461fb5ec46accbede00 | /src/com/example/pinker/fileservice/FileHelper.java | f7704e18bdaefa616d2baa6dd0eaaf703e9035b9 | [] | no_license | skaudrey/Pinker | a87bd5a15af507438ba6750fcbc7044a6df1edd2 | b6e4c26f9940070df4ea3cf6adbe7ce18fe54309 | refs/heads/master | 2021-01-19T06:51:04.496132 | 2017-04-07T22:53:57 | 2017-04-07T22:53:57 | 87,507,127 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,417 | java | package com.example.pinker.fileservice;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.http.util.EncodingUtils;
import android.content.Context;
import android.util.Log;
public class FileHelper {
private Context context;
public FileHelper(Context context) throws IOException {
super();
this.context = context;
try {
init();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String sep="\r\n";
String filePath = "/sdcard/Pinker/";
File userFile;
String userFilePath;
File checkFile;
String checkFilePath;
File pwdFile;
String pwdFilePath;
File routesFile;
String routesFilePath;
public static void makeRootDirectory(String filePath) {
File file = null;
try {
file = new File(filePath);
if (!file.exists()) {
file.mkdir();
}
} catch (Exception e) {
Log.i("error:", e+"");}
}
// 生成文件
public File makeFilePath(String fileName) {
File file = null;
try {
file = new File(filePath + fileName);
if (!file.exists()) {
file.createNewFile();
}
} catch (Exception e) {
e.printStackTrace();
}
return file;
}
//初始化本地文件夹文件
public void init() throws Exception {
makeRootDirectory(filePath);
userFile=makeFilePath("user.txt");
userFilePath=filePath+"user.txt";
checkFile=makeFilePath("check.txt");
checkFilePath=filePath+"check.txt";
pwdFile=makeFilePath("pwd.txt");
pwdFilePath=filePath+"pwd.txt";
routesFile=makeFilePath("routes.txt");
routesFilePath=filePath+"routes.txt";
//以私有方式读写数据,创建出来的文件只能被该应用访问
String info="无"+sep+"无"+sep+"无"+sep+"无"+sep+"无"+sep
+"无"+sep+"无"+sep+"无"+sep+"无";
if(readFile(userFilePath).equals("")){
writeFile(userFilePath,info);
}
}
//写入txt文件
public void writeFile(String filePath,String content) throws IOException{
FileOutputStream fou = new FileOutputStream(filePath);
fou.write(content.getBytes());
fou.close();
}
//读取txt文件
public String readFile(String filePath) throws Exception {
String res="";
try{
FileInputStream fin = new FileInputStream(filePath);
int length = fin.available();
byte [] buffer = new byte[length];
fin.read(buffer);
res = EncodingUtils.getString(buffer, "UTF-8");
fin.close();
}catch(Exception e){
e.printStackTrace();}
return res;
}
//读取user.txt中特定项
public String getUserItem(int number) throws Exception{
String buffer=readFile(userFilePath);
String[]str;
str=buffer.split(sep);
return str[number];
}
//写入个人信息user.txt
public void saveUserFile(
String c,//ID
String c0,//用户名
String c1,//密码
String c2,//电话
String c3,//性别
String c4,//生日
String c5,//年龄
String c6,//联系人
String c7,//个性签名
String c8//信用等级
) throws Exception
{
String info=readFile(userFilePath);
String[]str;
String buffer="";
str=info.split(sep);
String C[]={c,c0,c1,c2,c3,c4,c5,c6,c7,c8};
for(int i=0;i<9;i++){
if(!(C[i].equals(""))){
str[i]=C[i];
buffer=buffer+str[i]+sep;
}
}
writeFile(userFilePath,buffer);
}
//写入是否自动登录check.txt
public void saveCheckCondition(String st) throws IOException{
writeFile(checkFilePath,st);
}
//返回状态自动登录check.txt
public boolean getCheckCondition() throws Exception{
String st=readFile(checkFilePath);
if(st.equals("1")){
return true;
}
return false;
}
//写入是否记住密码pwd.txt
public void savePwdCondition(String st) throws IOException{
writeFile(pwdFilePath,st);
}
//返回状态记住密码pwd.txt
public boolean getPwdCondition() throws Exception{
String st=readFile(pwdFilePath);
if(st.equals("1")){
return true;
}
return false;
}
//写入routes.txt
public void saveRoutes(){
}
//读取routes.txt
public void getRoutes(){
}
}
| [
"Skaudrey@163.com"
] | Skaudrey@163.com |
a1dced711fc459d68243910a5c6c245eca76c46c | 7cac0adee00495d0bc26695d7975b27d9046edf6 | /src/test/java/com/testcase/n11/page/n11/N11KontrolPage.java | 4803397c83f78412923e463e334941f4fc9c68d9 | [] | no_license | infonaltest/testcase.n11 | c479eb9b44e2b21176ae431f8137d38047871af3 | 9a8a04711450d4c6042299225b5c0fb678e59bcc | refs/heads/master | 2021-01-10T09:47:42.278903 | 2016-01-03T23:30:21 | 2016-01-03T23:30:21 | 48,964,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.testcase.n11.page.n11;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.testcase.n11.base.n11.AbstractN11Page;
import junit.framework.Assert;
public class N11KontrolPage extends AbstractN11Page {
public N11KontrolPage(WebDriver driver) {
super(driver);
// TODO Auto-generated constructor stub
}
@Override
public void navigateTo() {
// TODO Auto-generated method stub
}
public void searchAuthor() {
clickElement(".catMenuItem", 7);
clickElement(".subCatMenu .mainCat a[title*='Kitap']", 0);
clickElement(".filterArea a[title*='Yazarlar']");
List<WebElement> elements = driver.findElements(By.cssSelector("#authorsList li"));
if (elements.size() >= 80) {
clickElement(".pagination .pageLink", 1);
if(findElement(".pageInfo .currentPage").getAttribute("value").equals("2")){
System.out.println("2. Sayfadasınız.");
}
}
}
}
| [
"hsakman@tmobtech.com"
] | hsakman@tmobtech.com |
ed91316a7febbdb2318bb2bdd57bef857d2930d0 | 5bf5511dcabd60be6a6113ca7540d2d4d7852ad6 | /src/practice/Book.java | accb963205d904d513c6828ea44cbb7f64adf4e5 | [] | no_license | seokhoyoun/Collection | 7d3cd17df2ca438091289241c1c2d1f083402a08 | e4154330b146f97d23c9d321c6ebe723bc5e3614 | refs/heads/master | 2020-04-11T21:13:44.232018 | 2019-01-15T02:37:39 | 2019-01-15T02:37:39 | 162,099,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | package practice;
import java.io.Serializable;
public class Book implements Serializable{
/**
*
*/
private static final long serialVersionUID = -830388153478364982L;
// Field
private String bNo; // 도서번호
private int category; // 도서분류코드(1.인문/2.자연과학/3.의료/4.기타)
private String title; // 책제목
private String author; // 저자
// Constructor
public Book() {
}
public Book(String bNo, int category, String title, String author) {
super();
this.bNo = bNo;
this.category = category;
this.title = title;
this.author = author;
}
// Getter and Setter
public String getbNo() {
return bNo;
}
public void setbNo(String bNo) {
this.bNo = bNo;
}
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String toString() {
return this.bNo+" "+this.category+" "+this.title+" "+this.author;
}
}
| [
"axlover@hotmail.com"
] | axlover@hotmail.com |
edc8c90acbe5d63a0bf149a20f17af33728b4f71 | 5bd826b57e0a6bacffaded378588ea6bdfedbcc2 | /FirstJavaProject/src/javaproject01/MultiplicationTable.java | 1c7f4667087e2979749353bd60deae0c78306192 | [] | no_license | sindhugajarla/java87 | 17977c34684bc13d5289e7542648212f8ab4571a | 61c976c037cfeb2053a79c9eec43930d9b97321f | refs/heads/master | 2022-10-23T12:44:28.171919 | 2020-06-15T18:02:29 | 2020-06-15T18:02:29 | 272,505,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package javaproject01;
public class MultiplicationTable {
void printMultiplication() {
for(int i=1;i<=10;i++) {
System.out.printf("%d * %d = %d", 5, i, 5*i).println();
}
}
void print(int table) {
for(int i=1;i<=10;i++) {
System.out.printf("%d * %d =%d", table ,i, table*i).println();
}
}
void print(int table, int from, int to) {
for(int i=from;i<=to;i++) {
System.out.printf("%d * %d =%d", table ,i, table*i).println();
}
}
}
| [
"sindhu.jd@yahoo.com"
] | sindhu.jd@yahoo.com |
e210c19f6e3107280fbb30b0e9324b16411fb33d | 5904fa1ffb74873cf11ad30c8ed48b88c4ac2d9a | /src/main/java/com/goosen/controller/BaseController.java | fb81619263990ea8b299d092e87de396d0d3102f | [
"MIT"
] | permissive | goosen123/mgmp-mp-demo1 | 99af2eddf6ab0ce2d2143d638e0b1eb629f483ba | 3be5c1f12eda823eebe627d25b59a9521eabb158 | refs/heads/master | 2020-03-22T17:40:18.308846 | 2018-07-10T10:50:09 | 2018-07-10T10:50:09 | 140,408,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,303 | java | package com.goosen.controller;
//import com.jk.common.DateEditor;
//import com.jk.common.StringEditor;
//import com.jk.util.WebUtil;
//import com.xiaoleilu.hutool.log.Log;
//import com.xiaoleilu.hutool.log.LogFactory;
//import org.apache.shiro.authz.UnauthorizedException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.github.pagehelper.PageInfo;
import com.goosen.commons.model.response.BaseCudRespData;
import com.goosen.commons.utils.BeanUtil;
import com.goosen.commons.utils.CommonUtil;
public class BaseController {
// protected final transient Logger log = LoggerFactory.getLogger(this.getClass());
// protected final transient Log log = LogFactory.get(this.getClass());
protected static final String FAILURE = "failure";
protected static final String SUCCESS = "success";
/**
* 默认页为1
*/
protected static final Integer PAGENUM = 1;
/**
* 页码大小10
*/
protected static final Integer PAGESIZE = 10;
/**
* ajax
* 提示常量
*/
protected static final String SUCCESS_LOAD_MESSAGE = "加载成功!";
protected static final String FAILURE_LOAD_MESSAGE = "加载失败!";
/**
* 保存
* 提示常量
*/
protected static final String SUCCESS_SAVE_MESSAGE = "保存成功!";
protected static final String FAILURE_SAVE_MESSAGE = "保存失败!";
/**
* 更新
* 提示常量
*/
protected static final String SUCCESS_UPDATE_MESSAGE = "更新成功!";
protected static final String FAILURE_UPDATE_MESSAGE = "更新失败!";
/**
* 充�??
* 提示常量
*/
protected static final String SUCCESS_CREDIT_MESSAGE = "充�?�成�?!";
protected static final String FAILURE_CREDIT_MESSAGE = "充�?�失�?!";
/**
* 删除
* 提示常量
*/
protected static final String SUCCESS_DELETE_MESSAGE = "删除成功!";
protected static final String FAILURE_DELETE_MESSAGE = "删除失败!";
protected static final String WARNING_DELETE_MESSAGE = "已经删除!";
/**
* 禁用启用
*/
protected static final String SUCCESS_ENABLE_TRUE = "启用成功!";
protected static final String SUCCESS_ENABLE_FALSE = "禁用成功!";
protected static final String BASERESPPACKAGE = "com.goosen.commons.model.response.";
protected static BaseCudRespData<String> baseCudRespData;
// @InitBinder
// protected void initBinder(WebDataBinder binder) {
// binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
// binder.registerCustomEditor(Date.class, new DateEditor(true));
// binder.registerCustomEditor(String.class, "password", new StringEditor(true));
// }
// @ExceptionHandler
// public void exceptionHandler(Exception exception,
// HttpServletRequest request,
// HttpServletResponse response) throws Exception {
//
// if (exception instanceof UnauthorizedException) {
// if(WebUtil.isAjaxRequest(request)){
// response.setStatus(HttpServletResponse.SC_FORBIDDEN);//无权限异�? 主要用于ajax请求返回
// response.setHeader("No-Permission", "{\"code\":403,\"msg\":'No Permission'}");
// response.setContentType("text/html;charset=utf-8");
// }else {
// response.sendRedirect("/admin/403");
// }
// }
// }
public static String getSession(String key) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
Object obj = request.getSession().getAttribute(key);
if (obj == null) {
return null;
}
return obj.toString();
}
public static void setSession(String key, Object value) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
request.getSession().setAttribute(key, value);
}
public static void removeSession(String key) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
request.getSession().removeAttribute(key);
}
public static void addPageParams(Integer pageNum,Integer pageSize,Map<String, Object> map) {
if(!CommonUtil.isVaileNum(pageNum))
pageNum = PAGENUM;
if(!CommonUtil.isVaileNum(pageSize))
pageSize = PAGESIZE;
map.put("pageNum", pageNum);
map.put("pageSize", pageSize);
}
public static BaseCudRespData<String> buildBaseCudRespData(String id) {
if(baseCudRespData == null)
baseCudRespData = new BaseCudRespData<String>();
baseCudRespData.setId(id);
return baseCudRespData;
}
public static Object buildBaseModelRespData(Map<String, Object> map,Object model) {
if(map != null && map.size() > 0)
BeanUtil.mapToBean(map, model);
return model;
}
public static Object buildBaseListRespData(List<Map<String, Object>> list,String respPackage) throws ClassNotFoundException, InstantiationException, IllegalAccessException{
List<Object> resultList = new ArrayList<Object>();
if(list == null || list.size() == 0)
return resultList;
Class c1 = Class.forName(BASERESPPACKAGE+respPackage);
for (int i = 0; i < list.size(); i++) {
Object model = c1.newInstance();
Map<String, Object> map = list.get(i);
if(map != null && map.size() > 0)
BeanUtil.mapToBean(map, model);
resultList.add(model);
}
return resultList;
}
public static Object buildBasePageRespData(PageInfo<Map<String, Object>> pageInfo,String respPackage) throws ClassNotFoundException, InstantiationException, IllegalAccessException{
PageInfo<Object> resultPage = new PageInfo<Object>();
List<Object> resultList = new ArrayList<Object>();
if(pageInfo == null){
resultPage.setList(resultList);
return resultPage;
}
List<Map<String, Object>> list = pageInfo.getList();
if(list != null && list.size() > 0){
Class c1 = Class.forName(BASERESPPACKAGE+respPackage);
for (int i = 0; i < list.size(); i++) {
Object model = c1.newInstance();
Map<String, Object> map = list.get(i);
if(map != null && map.size() > 0)
BeanUtil.mapToBean(map, model);
resultList.add(model);
}
}
BeanUtil.beanCopyUnFieldNotNull(resultPage, pageInfo, "list");
resultPage.setList(resultList);
return resultPage;
}
}
| [
"2630344884@qq.com"
] | 2630344884@qq.com |
c7ce58a66341915e584abd2d2fe4e4c9abffac9b | 7f295e507b7b357e179dac472ed5dcf8e1e63b2d | /src/main/java/kg/FootFood/FootFood/dao/OrderRepository.java | 9ed6a44987d7b8e7e090dc7d87b4491beaf972ad | [] | no_license | DenisKim04/FootFood | ae966fd08d375753e7c9a4f55ecd671ed2240f3f | 6529ffa96e4a297139ebe27e96f023432e9b3989 | refs/heads/master | 2023-06-27T12:01:11.802201 | 2021-08-03T10:24:54 | 2021-08-03T10:24:54 | 391,305,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package kg.FootFood.FootFood.dao;
import kg.FootFood.FootFood.models.order.Order;
import org.springframework.data.jpa.repository.JpaRepository;
public interface OrderRepository extends JpaRepository<Order,Long> {
}
| [
"kimden57@gmial.com"
] | kimden57@gmial.com |
66bed2239b931521e3f229927f93b10daef496cc | 2e27fdf2d7f814221263a3aee1419c7e08af8a73 | /CountShortestPaths.java | c58592bc1b4ade134edb8439331673d629e9c657 | [] | no_license | nganesan91/java-samples | 042cc9f8b1772ae73f85a3535d2ca722bc5629fb | 23d3efc2219cfbdbd1c257f9dbd7a0f518efe11e | refs/heads/master | 2021-05-29T22:46:10.246076 | 2015-10-28T17:04:47 | 2015-10-28T17:04:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,198 | java | import java.util.Scanner;
/**
* Given is an undirected graph and two of its vertices s and t. Give an O(m+ n) algorithm
* that computes the number of shortest paths from s to t.
*
* @author Nitish Krishna Ganesan
*/
class List1{
int listOfNodes=0;
int arr[];
List1(int totalVertices, int totalEdges){
arr = new int[totalEdges];
}
void add(int node){
arr[listOfNodes]=node;
listOfNodes++;
}
}
public class CountShortestPaths {
static int seen[];
static int shortest;
static int shortestCount;
public static void main(String args[]){
Scanner s1 = new Scanner(System.in);
int totalVertices = s1.nextInt();
int totalEdges = s1.nextInt();
List1 totalList1[] = new List1[totalVertices+1];
int arrayA[] = new int[totalEdges];
int arrayB[] = new int[totalEdges];
int source = s1.nextInt();
int dest = s1.nextInt();
// creating a List1 of lists for total number of vertices
for(int i=0;i<=totalVertices;i++){
totalList1[i] = new List1(totalVertices,totalEdges);
}
for(int i=0;i<totalEdges;i++){
arrayA[i]=s1.nextInt();
arrayB[i]=s1.nextInt();
totalList1[arrayA[i]].add(arrayB[i]);
totalList1[arrayB[i]].add(arrayA[i]);
}
seen = new int[totalVertices];
for(int i=0;i<totalVertices;i++){
seen[i]=0;
}
int distance=0;
// starting the depth first search
DFS(source,dest,totalList1,distance);
System.out.println(shortestCount);
}
static void DFS(int vertex,int dest,List1[] totalList1,int distance){
// marking node asa seen
seen[vertex]=1;
distance+=1;
// if the node has reached destination
if(vertex==dest){
// if it the first time destination is reached
// the distance is set as shortest
if(shortest==0){
shortest=distance;
shortestCount=1;
distance-=1;
seen[vertex]=0;
}
// else if a shorter route is found that distance
// is set
else if(distance < shortest){
shortest = distance;
shortestCount=1;
seen[vertex]=0;
}
// if a same short route is found count is increased
else if(shortest==distance){
shortestCount+=1;
seen[vertex]=0;
}
// if a longer route is found the node is just marked
// as seen and DFS continues
else{
seen[vertex]=0;
}
}else{
for(int i=0;i<totalList1[vertex].listOfNodes;i++){
// every node is checked if it is not seen
if(seen[totalList1[vertex].arr[i]]==0){
DFS(totalList1[vertex].arr[i],dest,totalList1,distance);
}
}
// when the DFS returns the previous node distance is reduced
distance-=1;
seen[vertex]=0;
}
}
}
| [
"g.nitishkrishna@gmail.com"
] | g.nitishkrishna@gmail.com |
da9011ab20a7210438ca7ef09b5a25236dd7196a | a67b8ddae6c0ceeca6e5eaf1abaedd7d992650fa | /Lesson5/src/ua/od/hillel/SumOfTwo.java | 546f69aa38a518d6d36222226d5f84582d3d8ce4 | [] | no_license | pavel693/Homework | 4466417f55df6b85591c506aa767b17283fe0185 | 7bf0d0a3e8da4d0f9e72ae6cb0e8357a8b1f8bc8 | refs/heads/master | 2020-04-18T16:25:40.229422 | 2016-12-15T08:31:06 | 2016-12-15T08:31:06 | 66,166,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | package ua.od.hillel;
import java.util.Scanner;
public class SumOfTwo {
public static int sumOfTwo() {
Scanner scanner = new Scanner(System.in);
System.out.println("Please, enter first number: ");
int a = scanner.nextInt();
System.out.println("Please, enter second number: ");
int b = scanner.nextInt();
int sum = a + b;
return sum;
}
public static void main(String[] args) {
int sum = sumOfTwo();
System.out.println("Sum of two numbers is: " + sum);
}
}
| [
"pavel.693@gmail.com"
] | pavel.693@gmail.com |
c11711599a099ea0d0dd966b01da5ec4b7bcec60 | 9a5640733b9fbdca72a0cc3867d544fb8a7ddd4b | /.svn/pristine/c1/c11711599a099ea0d0dd966b01da5ec4b7bcec60.svn-base | 9cb2ea9c60d7df001eba6075beac5f5a3a7c8c17 | [] | no_license | xcr1234/crm | ec46763b04682d0ffa9e7e932d9d162c70eaeff2 | 0c872815643a4029f377d987426303944d6dfb71 | refs/heads/master | 2021-01-11T21:03:16.674783 | 2017-02-19T18:07:29 | 2017-02-19T18:07:29 | 79,236,631 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | package com.oraclewdp.crm.persistence;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* 把属性值注入到field当中去,或者从field中提取属性值
*/
public class FieldInvoker {
public static void set(Field field,Object object,Object value){
//通过set方法注入
try {
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(),field.getDeclaringClass());
Method method = propertyDescriptor.getWriteMethod();
method.invoke(object,value);
} catch (Exception e) {
throw new PersistenceException("反射出错",e);
}
}
public static Object get(Field field,Object object){
try {
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(),field.getDeclaringClass());
Method method = propertyDescriptor.getReadMethod();
return method.invoke(object);
}catch (Exception e){
throw new PersistenceException("反射出错",e);
}
}
}
| [
"530551426@qq.com"
] | 530551426@qq.com | |
e16a19a38ca28de3f4f4c9edc2ddafd27b225e18 | eed520de44803652aac955be38752dccac20aa2a | /ParseStarterProject/src/main/java/com/parse/starter/gameActivity.java | 7f33ac42a05c7f7d639e50fe16cda1dc5d95adb2 | [] | no_license | ashish-kr1/Chatting_Application_With_ParseServer_on_Android | d5f700df8216da5d68a828d6c40e6fa656c8c65f | 2f2f4e420f365028b49654e4f1aa59a103a508fd | refs/heads/master | 2021-05-03T19:37:20.662051 | 2018-02-06T07:51:19 | 2018-02-06T07:51:19 | 120,420,048 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,263 | java | package com.parse.starter;
import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class gameActivity extends AppCompatActivity {
public void back(View view){
Intent intent = new Intent(getApplicationContext(), UserListActivity.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.note_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
if (item.getItemId() == R.id.crct) {
Intent intent = new Intent(getApplicationContext(), UserListActivity.class);
startActivity(intent);
return true;
}
return false;
}
int activeState=0;
boolean gameIsActive=true;
int[] gameState={2,2,2,2,2,2,2,2,2};
int[][] winningPosition={{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public void dropIn(View view){
ImageView counter= (ImageView) view;
int tappedCounter=Integer.parseInt(counter.getTag().toString());
if(gameState[tappedCounter]==2 && gameIsActive){
gameState[tappedCounter]=activeState;
counter.setTranslationY(-1000f);
if(activeState==0) {
counter.setImageResource(R.drawable.yellow);
activeState=1;
}
else{
counter.setImageResource(R.drawable.red);
activeState=0;
}
counter.animate().setDuration(300).translationYBy(1000f);
for(int[] win: winningPosition)
{
if(gameState[win[0]]==gameState[win[1]]&& gameState[win[1]]==gameState[win[2]] && gameState[win[0]]!=2)
{
gameIsActive=false;
String winner="Red";
if (gameState[win[0]]==0){
winner="yellow";
}
TextView winnerMessage=(TextView)findViewById(R.id.winnerMessage);
winnerMessage.setText(winner+ " has won");
LinearLayout Layout=(LinearLayout)findViewById(R.id.playAgainLayout);
Layout.setVisibility(View.VISIBLE);
}else{
boolean gameIsOver=true;
for(int counterState:gameState){
if(counterState==2) gameIsOver=false;
}
if(gameIsOver){
TextView winnerMessage=(TextView)findViewById(R.id.winnerMessage);
winnerMessage.setText("Ashish says Draw");
LinearLayout Layout=(LinearLayout)findViewById(R.id.playAgainLayout);
Layout.setVisibility(View.VISIBLE);
}
}
}
}}
public void playAgain(View view){
gameIsActive=true;
LinearLayout Layout=(LinearLayout)findViewById(R.id.playAgainLayout);
Layout.setVisibility(View.INVISIBLE);
activeState=0;
for (int i=0;i<gameState.length;i++){
gameState[i]=2;
}
GridLayout grid=(GridLayout)findViewById(R.id.gridLayout);
for (int i=0;i<grid.getChildCount();i++)
{
((ImageView) grid.getChildAt(i)).setImageResource(0);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game);
setTitle("3*3 Game");
}
}
| [
"ashishraj108786@gmail.com"
] | ashishraj108786@gmail.com |
02b93ced399914a7715c03d86883f77482d327a7 | 783afe43ff51ed096f53eadef9a8bb546478565a | /EclipseProject/src/BackEnd/Model/SubmissionTable.java | 962cbb42169d6457123a05975aebfdc20e566039 | [] | no_license | Antoineb3/ENSF409Project | d6e9bcebd6a556cb60e799977997eea14da70385 | 4921916cfdf53059e3202caef839589e1e3d272f | refs/heads/master | 2021-04-15T11:14:22.268637 | 2018-04-12T16:50:19 | 2018-04-12T16:50:19 | 126,536,649 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,062 | java | package BackEnd.Model;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import SharedObjects.Grade;
import SharedObjects.Submission;
/**
* This class implements the abstract methods in the Table class for the submission table.
* @author Antoine Bizon, Ross Bartlett
* @version 1.0
* @since 2018-03-30
*/
public class SubmissionTable extends Table {
/**
* Constructs an object of class SubmissionTable.
* @param execute the Statement executor object.
* @param tableName the name of the table.
*/
public SubmissionTable(StatementExecutor execute, String tableName) {
super(execute, tableName);
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)
* @see BackEnd.Model.Table#addToDB(java.io.Serializable)
*/
@Override
public <T extends Serializable> ArrayList<Integer> addToDB(T addition) {
Submission submission = (Submission) addition;
String update = "INSERT INTO " + tableName +
" VALUES ( " + IDGenerator.generateID() + ", " +
submission.getAssignID() + ", " +
submission.getStudentID() + ", '" +
submission.getPath() + "', '" +
submission.getTitle() + "', " +
submission.getSubmissionGrade() + ", '" +
submission.getComments() + "', '" +
submission.getTimestamp()+ "');";
ArrayList<Integer> result = new ArrayList<Integer>();
result.add(execute.preformUpdate(update));
return result;
}
/* (non-Javadoc)
* @see BackEnd.Model.Table#listFromResultSet(java.sql.ResultSet)
*/
@Override
protected ArrayList<? extends Serializable> listFromResultSet(ResultSet results) {
ArrayList<Submission> submissions = new ArrayList<Submission>();
try {
while(results.next()) {
submissions.add(new Submission(results.getInt(1), results.getInt(2), results.getInt(3), results.getString(4),
results.getString(5), results.getInt(6), results.getString(7), results.getString(8)));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return submissions;
}
}
| [
"antoineb374@gmail.com"
] | antoineb374@gmail.com |
f593f62020e85b85af9e925968b078bb93dee4a9 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i40535.java | 1fcd8c559a2b60518a4f267c68fdcdd5f46128aa | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package number_of_direct_superinterfaces;
public interface i40535 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
73e31c8894be1b9723be6f7f137b6af2ea79777b | 6130a2f4f1b0690c6d89e3ca521e6bd323b86b5d | /learnkeys-kit/src/main/java/org/example/encrypt/DigestUtil.java | 5eaa88eb4b3ba4b8cd734dc3301d38bc3946e402 | [
"Apache-2.0"
] | permissive | TBuddha/learnkeys | e105e74dd845359fd8acc24ee7b314223a39a231 | efc17cc421775916fd2936c0e67d19d176363e45 | refs/heads/master | 2022-09-25T21:00:45.414747 | 2021-07-01T07:25:55 | 2021-07-01T07:25:55 | 253,672,342 | 2 | 0 | Apache-2.0 | 2022-09-16T21:08:04 | 2020-04-07T02:59:10 | Java | UTF-8 | Java | false | false | 522 | java | package org.example.encrypt;
import org.apache.commons.codec.digest.DigestUtils;
/**
* @author zhout
* @date 2020/9/14 16:30
*/
public class DigestUtil {
public static void main(String[] args) {
// MD5加密,返回32位字符串
System.out.println(DigestUtils.md5Hex("123"));
// SHA-1加密
System.out.println(DigestUtils.sha1Hex("123"));
// SHA-256加密
System.out.println(DigestUtils.sha256Hex("123"));
// SHA-512加密
System.out.println(DigestUtils.sha512Hex("123"));
}
}
| [
"zhoutao@yunjiacloud.com"
] | zhoutao@yunjiacloud.com |
4ffdf071caae6670b689266512eda4ac93fffe3c | cca864aec821ea3637c3426c3ef7b0648a858a1f | /app/src/main/java/com/msw/mesapp/ui/widget/EditextDialog.java | 40738c296f81c2ae6e1f11386bd8f66ed4c46745 | [] | no_license | ZSCDumin/MesApp | 5e3f8bf6b21133bc91aa0b3c0359b5ee38163780 | 7912554ab575fced35ff0abc57b4b77026f05a6f | refs/heads/master | 2020-03-10T14:13:13.446849 | 2018-12-17T10:50:01 | 2018-12-17T10:50:01 | 129,420,846 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,081 | java | package com.msw.mesapp.ui.widget;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.flyco.animation.Attention.Swing;
import com.flyco.animation.SlideEnter.SlideBottomEnter;
import com.flyco.dialog.utils.CornerUtils;
import com.flyco.dialog.widget.base.BaseDialog;
import com.msw.mesapp.R;
/**
* Created by Mr.Meng on 2018/3/15.
*/
public class EditextDialog extends BaseDialog<EditextDialog> implements
View.OnClickListener{
private Context context;
private EditText et;
private TextView no;
private TextView yes;
private String ss="";
public EditextDialog(Context context) {
super(context);
this.context = context;
}
@Override
public View onCreateView() {
widthScale(0.85f);
showAnim(new SlideBottomEnter());
// dismissAnim(this, new ZoomOutExit());
View inflate = View.inflate(context, R.layout.custom_edittext, null);
et = (EditText) inflate.findViewById(R.id.et);
no = (TextView) inflate.findViewById(R.id.no);
yes = (TextView) inflate.findViewById(R.id.yes);
yes.setOnClickListener(this);
return inflate;
}
@Override
public void setUiBeforShow() {
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.yes:
// 点击了确认按钮
dismiss();
if (this.mClickListener != null) {
this.mClickListener.onOKClick(et);
}
break;
default:
break;
}
}
//创建接口
public static interface OnOKClickListener {
public void onOKClick(EditText et);
}
//生命接口对象
private OnOKClickListener mClickListener;
//设置监听器 也就是实例化接口
public void setOnClickListener(final OnOKClickListener clickListener) {
this.mClickListener = clickListener;
}
}
| [
"2712220318@qq.com"
] | 2712220318@qq.com |
0e7770ad397ccb5694686d0544a11eb354adb5c8 | daacb2e1afe33dfaac56a7c08eacf1d2cb0f4ae0 | /app/src/main/java/com/bawei/dingjianfei20200106/Icmetart/ICallBack.java | 8c21bf24bdbaa1de079fc6f4e3b5e13857b051b3 | [] | no_license | dingjianfei0811/weektest02 | d801e488ea360a8b465e155faed1147e149d5a23 | 5701978b8330325c3a66d5982420fc5c5e4907dc | refs/heads/master | 2020-12-05T04:41:24.063933 | 2020-01-06T02:44:39 | 2020-01-06T02:44:39 | 232,010,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package com.bawei.dingjianfei20200106.Icmetart;
import com.bawei.dingjianfei20200106.model.bean.Bean;
import com.bawei.dingjianfei20200106.model.bean.BeanRight;
/**
* 作者:丁建飞
* 时间:2020/1/6 9:20
* 类名:com.bawei.dingjianfei20200106.Icmetart
*/
public interface ICallBack {
interface IView{
void onBean(Bean bean);
void OnBeanError(Throwable throwable);
void onBeanRight(BeanRight beanRight);
void OnBeanRightError(Throwable throwable);
}
interface IPresenter{
void getBean();
void getBeanRight(String name);
}
interface IModel{
void getBean(ImodeCallBack imodeCallBack);
void getBeanRight(String name,ImodeCallBack imodeCallBack);
interface ImodeCallBack{
void onBean(Bean bean);
void OnBeanError(Throwable throwable);
void onBeanRight(BeanRight beanRight);
void OnBeanRightError(Throwable throwable);
}
}
}
| [
"2281505373@qq"
] | 2281505373@qq |
97c0b0a792c03c15ab1cfecca4ed71ca75b9e917 | 2529e8040ca696fe665227ea551c20d0479c4f07 | /src/main/java/net/simpleframework/lib/net/sf/cglib/transform/impl/AccessFieldTransformer.java | 926fdaba19b8cdd6a4283ee8f4ebcd133b196076 | [] | no_license | toinfinity/simple-common | 38bc3363118c74612b6f236ff0e66d63c0fb91bc | 98c3e2b7add307ba79c6fcb90ebea07a5e19b200 | refs/heads/master | 2021-01-15T14:59:04.923879 | 2015-11-16T08:14:19 | 2015-11-16T08:14:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | /*
* Copyright 2003 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.simpleframework.lib.net.sf.cglib.transform.impl;
import net.simpleframework.lib.net.sf.cglib.core.CodeEmitter;
import net.simpleframework.lib.net.sf.cglib.core.Constants;
import net.simpleframework.lib.net.sf.cglib.core.Signature;
import net.simpleframework.lib.net.sf.cglib.core.TypeUtils;
import net.simpleframework.lib.net.sf.cglib.transform.ClassEmitterTransformer;
import net.simpleframework.lib.org.objectweb.asm.Opcodes;
import net.simpleframework.lib.org.objectweb.asm.Type;
public class AccessFieldTransformer extends ClassEmitterTransformer {
private final Callback callback;
public AccessFieldTransformer(final Callback callback) {
this.callback = callback;
}
public interface Callback {
String getPropertyName(Type owner, String fieldName);
}
@Override
public void declare_field(final int access, final String name, final Type type,
final Object value) {
super.declare_field(access, name, type, value);
final String property = TypeUtils.upperFirst(callback.getPropertyName(getClassType(), name));
if (property != null) {
CodeEmitter e;
e = begin_method(Opcodes.ACC_PUBLIC, new Signature("get" + property, type,
Constants.TYPES_EMPTY), null);
e.load_this();
e.getfield(name);
e.return_value();
e.end_method();
e = begin_method(Opcodes.ACC_PUBLIC, new Signature("set" + property, Type.VOID_TYPE,
new Type[] { type }), null);
e.load_this();
e.load_arg(0);
e.putfield(name);
e.return_value();
e.end_method();
}
}
}
| [
"cknet@126.com"
] | cknet@126.com |
e2989e17545b74a4a7b432935c050b3dae2bf82f | 59b28febfd1ddec92f190110e08166a65a42f9d2 | /src/org/mohsin/geek/Array/ThreeColors.java | a4ebc0b159666f46a0313bd5432d18b182d874b4 | [] | no_license | mustafacse/Geeksforgeeks | 6b383829382fa06102c597248463448f046d2b96 | 18f8131d07f36e01c8db2184813f495cf1a7aa11 | refs/heads/master | 2020-04-06T04:27:53.835506 | 2017-02-02T11:48:57 | 2017-02-02T11:48:57 | 73,790,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package org.mohsin.geek.Array;
public class ThreeColors {
public static int mix(char str[]){
int rCount = 0,bCount = 0,gCount = 0;
for(int i = 0;i < str.length;++i){
switch(str[i]){
case 'R': ++rCount;
break;
case 'G': ++gCount;
break;
case 'B': ++bCount;
break;
}
}
if(rCount == str.length || bCount == str.length || gCount == str.length)
return str.length;
if(rCount%2 == 0 && gCount%2 == 0 && bCount%2 == 0)
return 2;
if(rCount%2 != 0 && gCount%2 != 0 && bCount%2 != 0)
return 2;
return 1;
}
public static void main(String[] args) {
char str[] = {'R', 'G', 'B', 'R'};
System.out.println(mix(str));
}
}
| [
"M1037586@mindtree.com"
] | M1037586@mindtree.com |
45a5d7190e13a5896cac5e7696256553bc41e1d7 | cb0bba7fb56999e26672f2f6f53625e38e9f2987 | /edgesim/core/SimSettings.java | 21ad9d2a8e590b5eae2f994e6c467cbfc9d58c5d | [] | no_license | NinjaEzio/EdgeSim | 9e54379d8b139d104b648802e393bf5ee539f046 | 65996958ef9027987baefce7b93cd25fef32a6b0 | refs/heads/master | 2020-03-22T10:02:42.011785 | 2018-07-05T16:51:26 | 2018-07-05T16:51:26 | 139,877,179 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,115 | java | package edgesim.core;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import edgesim.utils.SimLogger;
public class SimSettings {
private static SimSettings instance = null;
private Document edgeDevicesDoc = null;
//enumarations for the VM, appplication, and place.
//if you want to add different types on your config file,
//you may modify current types or add new types here.
public static enum VM_TYPES { EDGE_VM, CLOUD_VM }
public static enum APP_TYPES { AUGMENTED_REALITY, HEALTH_APP, HEAVY_COMP_APP, INFOTAINMENT_APP }
public static enum PLACE_TYPES { ATTRACTIVENESS_L1, ATTRACTIVENESS_L2, ATTRACTIVENESS_L3 }
//predifined IDs for cloud components.
public static int CLOUD_DATACENTER_ID = 1000;
public static int CLOUD_HOST_ID = CLOUD_DATACENTER_ID + 1;
public static int CLOUD_VM_ID = CLOUD_DATACENTER_ID + 2;
//predifined IDs for edge devices
public static int EDGE_ORCHESTRATOR_ID = 2000;
public static int GENERIC_EDGE_DEVICE_ID = EDGE_ORCHESTRATOR_ID + 1;
//delimiter for output file.
public static String DELIMITER = ";";
private double SIMULATION_TIME; //minutes unit in properties file
private double WARM_UP_PERIOD; //minutes unit in properties file
private double INTERVAL_TO_GET_VM_LOAD_LOG; //minutes unit in properties file
private double INTERVAL_TO_GET_VM_LOCATION_LOG; //minutes unit in properties file
private boolean FILE_LOG_ENABLED; //boolean to check file logging option
private boolean DEEP_FILE_LOG_ENABLED; //boolean to check deep file logging option
private int MIN_NUM_OF_MOBILE_DEVICES;
private int MAX_NUM_OF_MOBILE_DEVICES;
private int MOBILE_DEVICE_COUNTER_SIZE;
private int NUM_OF_EDGE_DATACENTERS;
private int NUM_OF_EDGE_HOSTS;
private int NUM_OF_EDGE_VMS;
private double WAN_PROPOGATION_DELAY; //seconds unit in properties file
private double LAN_INTERNAL_DELAY; //seconds unit in properties file
private int BANDWITH_WLAN; //Mbps unit in properties file
private int BANDWITH_WAN; //Mbps unit in properties file
private int BANDWITH_GSM; //Mbps unit in properties file
private int MIPS_FOR_CLOUD; //MIPS
private String[] SIMULATION_SCENARIOS;
private String[] ORCHESTRATOR_POLICIES;
// mean waiting time (minute) is stored for each place types
private double[] mobilityLookUpTable;
// following values are stored for each applications defined in applications.xml
// [0] usage percentage (%)
// [1] prob. of selecting cloud (%)
// [2] poisson mean (sec)
// [3] active period (sec)
// [4] idle period (sec)
// [5] avg data upload (KB)
// [6] avg data download (KB)
// [7] avg task length (MI)
// [8] required # of cores
// [9] vm utilization (%)
private double[][] taskLookUpTable = new double[APP_TYPES.values().length][11];
private SimSettings() {
}
public static SimSettings getInstance() {
if(instance == null) {
instance = new SimSettings();
}
return instance;
}
/**
* Reads configuration file and stores information to local variables
* @param propertiesFile
* @return
*/
public boolean initialize(String propertiesFile, String edgeDevicesFile, String applicationsFile){
boolean result = false;
InputStream input = null;
try {
input = new FileInputStream(propertiesFile);
// load a properties file
Properties prop = new Properties();
prop.load(input);
SIMULATION_TIME = (double)60 * Double.parseDouble(prop.getProperty("simulation_time")); //seconds
WARM_UP_PERIOD = (double)60 * Double.parseDouble(prop.getProperty("warm_up_period")); //seconds
INTERVAL_TO_GET_VM_LOAD_LOG = (double)60 * Double.parseDouble(prop.getProperty("vm_load_check_interval")); //seconds
INTERVAL_TO_GET_VM_LOCATION_LOG = (double)60 * Double.parseDouble(prop.getProperty("vm_location_check_interval")); //seconds
FILE_LOG_ENABLED = Boolean.parseBoolean(prop.getProperty("file_log_enabled"));
DEEP_FILE_LOG_ENABLED = Boolean.parseBoolean(prop.getProperty("deep_file_log_enabled"));
MIN_NUM_OF_MOBILE_DEVICES = Integer.parseInt(prop.getProperty("min_number_of_mobile_devices"));
MAX_NUM_OF_MOBILE_DEVICES = Integer.parseInt(prop.getProperty("max_number_of_mobile_devices"));
MOBILE_DEVICE_COUNTER_SIZE = Integer.parseInt(prop.getProperty("mobile_device_counter_size"));
WAN_PROPOGATION_DELAY = Double.parseDouble(prop.getProperty("wan_propogation_delay"));
LAN_INTERNAL_DELAY = Double.parseDouble(prop.getProperty("lan_internal_delay"));
BANDWITH_WLAN = 1000 * Integer.parseInt(prop.getProperty("wlan_bandwidth"));
BANDWITH_WAN = 1000 * Integer.parseInt(prop.getProperty("wan_bandwidth"));
BANDWITH_GSM = 1000 * Integer.parseInt(prop.getProperty("gsm_bandwidth"));
//It is assumed that
//-Storage and RAM are unlimited in cloud
//-Each task is executed with maximum capacity (as if there is no task in the cloud)
MIPS_FOR_CLOUD = Integer.parseInt(prop.getProperty("mips_for_cloud"));
ORCHESTRATOR_POLICIES = prop.getProperty("orchestrator_policies").split(",");
SIMULATION_SCENARIOS = prop.getProperty("simulation_scenarios").split(",");
//avg waiting time in a place (min)
double place1_mean_waiting_time = Double.parseDouble(prop.getProperty("attractiveness_L1_mean_waiting_time"));
double place2_mean_waiting_time = Double.parseDouble(prop.getProperty("attractiveness_L2_mean_waiting_time"));
double place3_mean_waiting_time = Double.parseDouble(prop.getProperty("attractiveness_L3_mean_waiting_time"));
//mean waiting time (minute)
mobilityLookUpTable = new double[]{
place1_mean_waiting_time, //ATTRACTIVENESS_L1
place2_mean_waiting_time, //ATTRACTIVENESS_L2
place3_mean_waiting_time //ATTRACTIVENESS_L3
};
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (input != null) {
try {
input.close();
result = true;
} catch (IOException e) {
e.printStackTrace();
}
}
}
parseApplicatinosXML(applicationsFile);
parseEdgeDevicesXML(edgeDevicesFile);
return result;
}
/**
* returns the parsed XML document for edge_devices.xml
*/
public Document getEdgeDevicesDocument(){
return edgeDevicesDoc;
}
/**
* returns simulation time (in seconds unit) from properties file
*/
public double getSimulationTime()
{
return SIMULATION_TIME;
}
/**
* returns warm up period (in seconds unit) from properties file
*/
public double getWarmUpPeriod()
{
return WARM_UP_PERIOD;
}
/**
* returns VM utilization log collection interval (in seconds unit) from properties file
*/
public double getVmLoadLogInterval()
{
return INTERVAL_TO_GET_VM_LOAD_LOG;
}
/**
* returns VM location log collection interval (in seconds unit) from properties file
*/
public double getVmLocationLogInterval()
{
return INTERVAL_TO_GET_VM_LOCATION_LOG;
}
/**
* returns deep statistics logging status from properties file
*/
public boolean getDeepFileLoggingEnabled()
{
return DEEP_FILE_LOG_ENABLED;
}
/**
* returns deep statistics logging status from properties file
*/
public boolean getFileLoggingEnabled()
{
return FILE_LOG_ENABLED;
}
/**
* returns WAN propogation delay (in second unit) from properties file
*/
public double getWanPropogationDelay()
{
return WAN_PROPOGATION_DELAY;
}
/**
* returns internal LAN propogation delay (in second unit) from properties file
*/
public double getInternalLanDelay()
{
return LAN_INTERNAL_DELAY;
}
/**
* returns WLAN bandwidth (in Mbps unit) from properties file
*/
public int getWlanBandwidth()
{
return BANDWITH_WLAN;
}
/**
* returns WAN bandwidth (in Mbps unit) from properties file
*/
public int getWanBandwidth()
{
return BANDWITH_WAN;
}
/**
* returns GSM bandwidth (in Mbps unit) from properties file
*/
public int getGsmBandwidth()
{
return BANDWITH_GSM;
}
/**
* returns the minimum number of the mobile devices used in the simulation
*/
public int getMinNumOfMobileDev()
{
return MIN_NUM_OF_MOBILE_DEVICES;
}
/**
* returns the maximunm number of the mobile devices used in the simulation
*/
public int getMaxNumOfMobileDev()
{
return MAX_NUM_OF_MOBILE_DEVICES;
}
/**
* returns the number of increase on mobile devices
* while iterating from min to max mobile device
*/
public int getMobileDevCounterSize()
{
return MOBILE_DEVICE_COUNTER_SIZE;
}
/**
* returns the number of edge datacenters
*/
public int getNumOfEdgeDatacenters()
{
return NUM_OF_EDGE_DATACENTERS;
}
/**
* returns the number of edge hosts running on the datacenters
*/
public int getNumOfEdgeHosts()
{
return NUM_OF_EDGE_HOSTS;
}
/**
* returns the number of edge VMs running on the hosts
*/
public int getNumOfEdgeVMs()
{
return NUM_OF_EDGE_VMS;
}
/**
* returns MIPS of the central cloud
*/
public int getMipsForCloud()
{
return MIPS_FOR_CLOUD;
}
/**
* returns simulation screnarios as string
*/
public String[] getSimulationScenarios()
{
return SIMULATION_SCENARIOS;
}
/**
* returns orchestrator policies as string
*/
public String[] getOrchestratorPolicies()
{
return ORCHESTRATOR_POLICIES;
}
/**
* returns mobility characteristic within an array
* the result includes mean waiting time (minute) or each place type
*/
public double[] getMobilityLookUpTable()
{
return mobilityLookUpTable;
}
/**
* returns application characteristic within two dimensional array
* the result includes the following values for each application type
* [0] usage percentage (%)
* [1] prob. of selecting cloud (%)
* [2] poisson mean (sec)
* [3] active period (sec)
* [4] idle period (sec)
* [5] avg data upload (KB)
* [6] avg data download (KB)
* [7] avg task length (MI)
* [8] required # of cores
* [9] vm utilization (%)
*/
public double[][] getTaskLookUpTable()
{
return taskLookUpTable;
}
private void isAttribtuePresent(Element element, String key) {
String value = element.getAttribute(key);
if (value.isEmpty() || value == null){
throw new IllegalArgumentException("Attribure '" + key + "' is not found in '" + element.getNodeName() +"'");
}
}
private void isElementPresent(Element element, String key) {
try {
String value = element.getElementsByTagName(key).item(0).getTextContent();
if (value.isEmpty() || value == null){
throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'");
}
} catch (Exception e) {
throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'");
}
}
private void parseApplicatinosXML(String filePath)
{
Document doc = null;
try {
File devicesFile = new File(filePath);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(devicesFile);
doc.getDocumentElement().normalize();
NodeList appList = doc.getElementsByTagName("application");
for (int i = 0; i < appList.getLength(); i++) {
Node appNode = appList.item(i);
Element appElement = (Element) appNode;
isAttribtuePresent(appElement, "name");
isElementPresent(appElement, "usage_percentage");
isElementPresent(appElement, "prob_cloud_selection");
isElementPresent(appElement, "poisson_interarrival");
isElementPresent(appElement, "active_period");
isElementPresent(appElement, "idle_period");
isElementPresent(appElement, "data_upload");
isElementPresent(appElement, "data_download");
isElementPresent(appElement, "task_length");
isElementPresent(appElement, "required_core");
isElementPresent(appElement, "vm_utilization");
String appName = appElement.getAttribute("name");
SimSettings.APP_TYPES appType = APP_TYPES.valueOf(appName);
double usage_percentage = Double.parseDouble(appElement.getElementsByTagName("usage_percentage").item(0).getTextContent());
double prob_cloud_selection = Double.parseDouble(appElement.getElementsByTagName("prob_cloud_selection").item(0).getTextContent());
double poisson_interarrival = Double.parseDouble(appElement.getElementsByTagName("poisson_interarrival").item(0).getTextContent());
double active_period = Double.parseDouble(appElement.getElementsByTagName("active_period").item(0).getTextContent());
double idle_period = Double.parseDouble(appElement.getElementsByTagName("idle_period").item(0).getTextContent());
double data_upload = Double.parseDouble(appElement.getElementsByTagName("data_upload").item(0).getTextContent());
double data_download = Double.parseDouble(appElement.getElementsByTagName("data_download").item(0).getTextContent());
double task_length = Double.parseDouble(appElement.getElementsByTagName("task_length").item(0).getTextContent());
double required_core = Double.parseDouble(appElement.getElementsByTagName("required_core").item(0).getTextContent());
double vm_utilization = Double.parseDouble(appElement.getElementsByTagName("vm_utilization").item(0).getTextContent());
double delay_sensitivity = Double.parseDouble(appElement.getElementsByTagName("delay_sensitivity").item(0).getTextContent());
taskLookUpTable[appType.ordinal()][0] = usage_percentage; //usage percentage [0-100]
taskLookUpTable[appType.ordinal()][1] = prob_cloud_selection; //prob. of selecting cloud [0-100]
taskLookUpTable[appType.ordinal()][2] = poisson_interarrival; //poisson mean (sec)
taskLookUpTable[appType.ordinal()][3] = active_period; //active period (sec)
taskLookUpTable[appType.ordinal()][4] = idle_period; //idle period (sec)
taskLookUpTable[appType.ordinal()][5] = data_upload; //avg data upload (KB)
taskLookUpTable[appType.ordinal()][6] = data_download; //avg data download (KB)
taskLookUpTable[appType.ordinal()][7] = task_length; //avg task length (MI)
taskLookUpTable[appType.ordinal()][8] = required_core; //required # of core
taskLookUpTable[appType.ordinal()][9] = vm_utilization; //vm utilization [0-100]
taskLookUpTable[appType.ordinal()][10] = delay_sensitivity; //delay_sensitivity [0-1]
}
} catch (Exception e) {
SimLogger.printLine("Edge Devices XML cannot be parsed! Terminating simulation...");
e.printStackTrace();
System.exit(0);
}
}
private void parseEdgeDevicesXML(String filePath)
{
try {
File devicesFile = new File(filePath);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
edgeDevicesDoc = dBuilder.parse(devicesFile);
edgeDevicesDoc.getDocumentElement().normalize();
NodeList datacenterList = edgeDevicesDoc.getElementsByTagName("datacenter");
for (int i = 0; i < datacenterList.getLength(); i++) {
NUM_OF_EDGE_DATACENTERS++;
Node datacenterNode = datacenterList.item(i);
Element datacenterElement = (Element) datacenterNode;
isAttribtuePresent(datacenterElement, "arch");
isAttribtuePresent(datacenterElement, "os");
isAttribtuePresent(datacenterElement, "vmm");
isElementPresent(datacenterElement, "costPerBw");
isElementPresent(datacenterElement, "costPerSec");
isElementPresent(datacenterElement, "costPerMem");
isElementPresent(datacenterElement, "costPerStorage");
Element location = (Element)datacenterElement.getElementsByTagName("location").item(0);
isElementPresent(location, "attractiveness");
isElementPresent(location, "wlan_id");
isElementPresent(location, "x_pos");
isElementPresent(location, "y_pos");
NodeList hostList = datacenterElement.getElementsByTagName("host");
for (int j = 0; j < hostList.getLength(); j++) {
NUM_OF_EDGE_HOSTS++;
Node hostNode = hostList.item(j);
Element hostElement = (Element) hostNode;
isElementPresent(hostElement, "core");
isElementPresent(hostElement, "mips");
isElementPresent(hostElement, "ram");
isElementPresent(hostElement, "storage");
NodeList vmList = hostElement.getElementsByTagName("VM");
for (int k = 0; k < vmList.getLength(); k++) {
NUM_OF_EDGE_VMS++;
Node vmNode = vmList.item(k);
Element vmElement = (Element) vmNode;
isAttribtuePresent(vmElement, "vmm");
isElementPresent(vmElement, "core");
isElementPresent(vmElement, "mips");
isElementPresent(vmElement, "ram");
isElementPresent(vmElement, "storage");
}
}
}
} catch (Exception e) {
SimLogger.printLine("Edge Devices XML cannot be parsed! Terminating simulation...");
e.printStackTrace();
System.exit(0);
}
}
} | [
"15114576057@163.com"
] | 15114576057@163.com |
ecbd2c9c6d70e72951460f5f29da2de654af7ae1 | 8be2f70ace638bdaf9774ab4941f54ff3374c9c0 | /Car.java | 9d8e98ae6751aa15a8fc4876be8ec07e6b66c298 | [] | no_license | nagelalexgit/MotorTax-Project | 97473feee6c2c56b7e9c976896ab549a3dc0f029 | 506eafa5e1e42d2e4f1f98af3a72188e4f7f56df | refs/heads/master | 2020-03-18T08:01:27.015564 | 2018-05-22T23:04:08 | 2018-05-22T23:04:08 | 134,484,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,258 | java | import java.io.*;
/**
* @(#)Car.java
*
*
* @author
* @version 1.00 2016/11/17
*/
public class Car implements Serializable{
private RegNo regNo;
private String brand;
private String model;
private int engSize;
private String fuel;
private int co2;
private double value;
private Person owner;
String motorTax;
String euro = "\u20ac";
public Car() {
regNo = new RegNo();
brand = "No Brand Specified";
model = "No Model Specified";
engSize = 0;
fuel = "No Fuel Type Specified";
co2 = 0;
value = 0.0f;
owner = new Person();
}
public Car(int day,int month,String year,String location,String brand,String model,int engSize,String fuel,int co2,double value,String name,int age,String gender) {
regNo = new RegNo(day,month,year,location);
setBrand(brand);
setModel(model);
setEngSize(engSize);
setFuel(fuel);
setCo2(co2);
setValue(value);
owner = new Person(name,age,gender);
}
public Car(String brand,String model,int engSize,String fuel,int co2,double value,Person owner,RegNo regNo) {
setBrand(brand);
setModel(model);
setEngSize(engSize);
setFuel(fuel);
setCo2(co2);
setValue(value);
setOwner(owner);
setRegNo(regNo);
}
//--------------------------------------------------------
public void setRegNo(int day,int month,String year,String location)
{
regNo.setDay(day);
regNo.setMonth(month);
regNo.setYear(year);
regNo.setLocation(location);
}
public void setRegNo(RegNo regNo)
{
this.regNo=regNo;
}
public void setBrand(String brand)
{
this.brand=brand;
}
public void setModel(String model)
{
this.model=model;
}
public void setEngSize(int engSize)
{
this.engSize=engSize;
}
public void setFuel(String fuel)
{
this.fuel=fuel;
}
public void setCo2(int co2)
{
this.co2=co2;
}
public void setValue(double value)
{
this.value=value;
}
public void setOwner(Person owner)
{
this.owner=owner;
}
public void setOwner(String name,int age,String gender)
{
owner.setName(name);
owner.setAge(age);
owner.setGender(gender);
}
//---------------------------------------------------------
public String getBrand()
{
return brand;
}
public String getModel()
{
return model;
}
public float getEngSize()
{
return engSize;
}
public String getFuel()
{
return fuel;
}
public int getCo2()
{
return co2;
}
public double getValue()
{
return value;
}
public Person getOwner()
{
return owner;
}
public RegNo getRegNo()
{
return regNo;
}
//----------------------------------------------------------
public String toString()
{
return "\n********************************************\n" + regNo + "\nCar Brand: " + brand + "\nCar Model: " + model + "\nEngine Size: " + engSize + "CC" +
"\nFuel Type: " + fuel + "\nCar Value: " + euro + value + "\nCo2 Emission : " + co2 + " g/km" +
"\nOwner: " + owner.toString() + "\n" + motorTaxRate();
}
public String motorTaxRate()
{
int year = Integer.parseInt(regNo.getYear());
float engineSize = getEngSize();
int co2 = getCo2();
String motorTax = "";
if (year <= 2008)
{
if(engineSize>=0 && engineSize <=1000)
{
motorTax = ("Your anual Motor Tax is: " + euro + 199);
}
else if(engineSize<=1100)
{
motorTax = ("Your anual Motor Tax is: " + euro + 299);
}
else if(engineSize<=1200)
{
motorTax = ("Your anual Motor Tax is: " + euro + 330);
}
else if(engineSize<=1300)
{
motorTax = ("Your anual Motor Tax is: " + euro + 358);
}
else if(engineSize<=1400)
{
motorTax = ("Your anual Motor Tax is: " + euro + 385);
}
else if(engineSize<=1500)
{
motorTax = ("Your anual Motor Tax is: " + euro + 413);
}
else if(engineSize<=1600)
{
motorTax = ("Your anual Motor Tax is: " + euro + 330);
}
else if(engineSize<=1700)
{
motorTax = ("Your anual Motor Tax is: " + euro + 544);
}
else if(engineSize<=1800)
{
motorTax = ("Your anual Motor Tax is: " + euro + 636);
}
else if(engineSize<=1900)
{
motorTax = ("Your anual Motor Tax is: " + euro + 673);
}
else if(engineSize<=2000)
{
motorTax = ("Your anual Motor Tax is: " + euro + 710);
}
else if(engineSize<=2100)
{
motorTax = ("Your anual Motor Tax is: " + euro + 906);
}
else if(engineSize<=2200)
{
motorTax = ("Your anual Motor Tax is: " + euro + 951);
}
else if(engineSize<=2300)
{
motorTax = ("Your anual Motor Tax is: " + euro + 994);
}
else if(engineSize<=2400)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1034);
}
else if(engineSize<=2500)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1080);
}
else if(engineSize<=2600)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1294);
}
else if(engineSize<=2700)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1345);
}
else if(engineSize<=2800)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1391);
}
else if(engineSize<=2900)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1443);
}
else if(engineSize<=3000)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1494);
}
else
{
motorTax = ("Your anual Motor Tax is: " + euro + 1809);
}
}
else
{
if(co2<=0)
{
motorTax = ("Your anual Motor Tax is: " + euro + 120);
}
else if(co2<=80)
{
motorTax = ("Your anual Motor Tax is: " + euro + 170);
}
else if(co2<=100)
{
motorTax = ("Your anual Motor Tax is: " + euro + 180);
}
else if(co2<=110)
{
motorTax = ("Your anual Motor Tax is: " + euro + 190);
}
else if(co2<=120)
{
motorTax = ("Your anual Motor Tax is: " + euro + 200);
}
else if(co2<=130)
{
motorTax = ("Your anual Motor Tax is: " + euro + 270);
}
else if(co2<=140)
{
motorTax = ("Your anual Motor Tax is: " + euro + 280);
}
else if(co2<=155)
{
motorTax = ("Your anual Motor Tax is: " + euro + 390);
}
else if(co2<=170)
{
motorTax = ("Your anual Motor Tax is: " + euro + 570);
}
else if(co2<=190)
{
motorTax = ("Your anual Motor Tax is: " + euro + 750);
}
else if(co2<=225)
{
motorTax = ("Your anual Motor Tax is: " + euro + 1200);
}
else
{
motorTax = ("Your anual Motor Tax is: " + euro + 2350);
}
}
return motorTax;
}
} | [
"nagel.alex.stop@gmail.com"
] | nagel.alex.stop@gmail.com |
d59d4059fa43ecd73c6997faf0dcc8366ecb302d | 85910ed3cdcc219f52ec662f828ed1f0e32f9220 | /versioneye_maven_crawler/src/main/java/versioneye/utils/MavenCentralUtils.java | 12edfe29a1d7fcee0cd0ad665dbd64d00b6f98e9 | [
"MIT"
] | permissive | emilva/crawl_j | 8ce50f05dac95814ac03bb6e3c014fcf2647b258 | 39ecd31ec360d6f1e52befb37954f0320fa33822 | refs/heads/master | 2020-03-18T12:16:31.910098 | 2018-12-12T13:11:50 | 2018-12-12T13:11:50 | 134,718,940 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,084 | java | package versioneye.utils;
import com.versioneye.utils.HttpUtils;
import com.versioneye.utils.LogUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.maven.model.Model;
import org.codehaus.jackson.map.ObjectMapper;
import com.versioneye.domain.Crawle;
import com.versioneye.domain.Repository;
import versioneye.dto.Document;
import versioneye.dto.ResponseJson;
import versioneye.maven.MavenUrlProcessor;
import versioneye.maven.PomReader;
import com.versioneye.persistence.IProductDao;
import java.io.Reader;
/**
* Created with IntelliJ IDEA.
* User: robertreiz
* Date: 7/27/13
* Time: 8:30 PM
*/
public class MavenCentralUtils {
static final Logger logger = LogManager.getLogger(MavenCentralUtils.class.getName());
public static final String LINK_FILE = "http://search.maven.org/remotecontent?filepath=";
private MavenUrlProcessor mavenUrlProcessor;
private LogUtils logUtils;
private HttpUtils httpUtils;
private IProductDao productDao;
private Crawle crawle;
private Repository repository;
private MavenUrlUtils mavenUrlUtils = new MavenUrlUtils();
public void crawleArtifact(String groupId, String artifactId){
String urlToProduct = mavenUrlUtils.getProductUrl(groupId, artifactId);
String jsonUrl = mavenUrlUtils.getProductJsonUrl(groupId, artifactId);
String url = jsonUrl.toString();
try{
Reader resultReader = httpUtils.getResultReader( url );
ObjectMapper mapper = new ObjectMapper();
ResponseJson resp = mapper.readValue(resultReader, ResponseJson.class);
resultReader.close();
for (Document doc: resp.getResponse().getDocs()){
if (doc.getA() == null || doc.getG() == null || doc.getV() == null)
continue;
if (productDao.doesVersionExistAlreadyByGA(groupId, artifactId, doc.getV()) )
continue;
String urlToVersion = mavenUrlUtils.getVersionUrl( groupId, artifactId, doc.getV() );
String urlToPom = mavenUrlUtils.getPomUrl( groupId, artifactId, doc.getV() );
mavenUrlProcessor.updateNode(urlToPom, urlToVersion, urlToProduct, getRepository(), crawle);
}
} catch (Exception ex) {
logUtils.addError("error in CrawlerMavenDefaultJson.crawleArtifact( "+groupId+", "+artifactId+" )", ex.toString(), crawle);
}
}
public Model fetchModel(String groupId, String artifactId, String version) {
try {
String urlToPom = mavenUrlUtils.getPomUrl( groupId, artifactId, version );
Reader reader = httpUtils.getResultReader( urlToPom );
return PomReader.readSinglePom(reader);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public Model fetchModelFromUrl(String urlToPom, String username, String password) {
try {
Reader reader = httpUtils.getResultReader( urlToPom, username, password );
return PomReader.readSinglePom(reader);
} catch (Exception ex) {
logger.error("ERROR in fetchModelFromUrl: " + urlToPom + " - " + ex.toString());
logger.error(ex.getStackTrace());
return null;
}
}
public void setMavenUrlProcessor(MavenUrlProcessor mavenUrlProcessor) {
this.mavenUrlProcessor = mavenUrlProcessor;
}
public Crawle getCrawle() {
return crawle;
}
public void setCrawle(Crawle crawle) {
this.crawle = crawle;
}
public Repository getRepository() {
return repository;
}
public void setRepository(Repository repository) {
this.repository = repository;
}
public void setHttpUtils(HttpUtils httpUtils) {
this.httpUtils = httpUtils;
}
public void setLogUtils(LogUtils logUtils) {
this.logUtils = logUtils;
}
public void setProductDao(IProductDao productDao) {
this.productDao = productDao;
}
}
| [
"robert.reiz.81@gmail.com"
] | robert.reiz.81@gmail.com |
a60708d40715fd9c2b0d79262876e2db69c00971 | c63fd15eccabde9f0a5346da51ddb2d048ac1c30 | /ProfitLoss.java | def77fe3868182d33c47eabefb0b4300f80f48e8 | [] | no_license | Tanmay-Shinde/Java | 15a09a094ca333feb3ba45a0e2ddb70b88bba119 | 6adde52361e3201834e2dee2eed8f1a5f6cf6ba9 | refs/heads/main | 2023-07-02T01:23:13.814014 | 2021-07-27T07:14:00 | 2021-07-27T07:14:00 | 389,580,396 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | public class ProfitLoss
{
void main(int cp,int sp)
{
if(cp>=sp)
{
System.out.println("Loss");
}
else
{
System.out.println("Profit");
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
b659a91b6ba9da5df3d1ac5ca3d51dd3814a8ea7 | 07f2fa83cafb993cc107825223dc8279969950dd | /game_logic_server/src/main/java/com/xgame/logic/server/game/bag/entity/type/ChestsItemControl.java | c9b6358940c7c55ee8d7487c0eda86c42fcdadb0 | [] | no_license | hw233/x2-slg-java | 3f12a8ed700e88b81057bccc7431237fae2c0ff9 | 03dcdab55e94ee4450625404f6409b1361794cbf | refs/heads/master | 2020-04-27T15:42:10.982703 | 2018-09-27T08:35:27 | 2018-09-27T08:35:27 | 174,456,389 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,386 | java | package com.xgame.logic.server.game.bag.entity.type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import com.xgame.common.CampV2;
import com.xgame.common.ItemConf;
import com.xgame.config.building.BuildingPirFactory;
import com.xgame.config.item.ArmyBoxControl;
import com.xgame.config.item.ItemBox;
import com.xgame.config.item.ItemBoxControl;
import com.xgame.config.item.PeiJianBoxControl;
import com.xgame.config.items.ItemsPir;
import com.xgame.config.items.ItemsPirFactory;
import com.xgame.config.peiJian.PeiJianPir;
import com.xgame.config.peiJian.PeiJianPirFactory;
import com.xgame.drop.DropService;
import com.xgame.logic.server.core.gamelog.constant.GameLogSource;
import com.xgame.logic.server.core.language.Language;
import com.xgame.logic.server.core.language.view.error.ErrorCodeEnum;
import com.xgame.logic.server.core.utils.InjectorUtil;
import com.xgame.logic.server.game.bag.ItemKit;
import com.xgame.logic.server.game.bag.converter.ItemConverter;
import com.xgame.logic.server.game.bag.entity.Item;
import com.xgame.logic.server.game.bag.entity.ItemContext;
import com.xgame.logic.server.game.bag.entity.ItemControl;
import com.xgame.logic.server.game.constant.SystemEnum;
import com.xgame.logic.server.game.customweanpon.entity.DesignMap;
import com.xgame.logic.server.game.player.entity.Player;
import com.xgame.logic.server.game.soldier.constant.SoldierChangeType;
import com.xgame.logic.server.game.soldier.entity.Soldier;
/**
* 重新实现宝箱使用逻辑 type=7
* 返回宝箱开启道具列表给客户端
* 服务端实现道具的添加 刷新
* @author dingpeng.qu
*
*/
public class ChestsItemControl extends ItemControl {
/** 固定宝箱 */
public static final int TYPE_GD = 1;
/** 随机宝箱 */
public static final int TYPE_SJ = 2;
/** 兵种宝箱 */
public static final int TYPE_BZBX =3;
/** 充值活动宝箱 */
public static final int TYPE_CZHD =4;
/** 配件宝箱 */
public static final int TYPE_PJ =5;
public ChestsItemControl(int type) {
super(type);
}
@Override
public boolean use(Player player, int itemId, int num, ItemContext rewardContext, Object ... param) {
if(num < 1){
return false;
}
ItemsPir configModel = ItemsPirFactory.get(itemId);
int v1 = Integer.parseInt(configModel.getV1());
if(v1 == TYPE_GD) {
List<ItemConf> itemConfs = useFixedBox(player,num,configModel);
player.send(ItemConverter.getBoxItems(itemConfs));
return true;
} else if(v1 == TYPE_SJ) {
//批量使用随机宝箱必须每次都参与随机 不能像固定箱子一样直接*num
List<ItemConf> itemConfs = useRandomBox(player,num,configModel);
player.send(ItemConverter.getBoxItems(itemConfs));
return true;
} else if(v1 == TYPE_BZBX) {
List<ItemConf> itemConfs = useSoldierBox(player,num,configModel);
player.send(ItemConverter.getBoxItems(itemConfs));
return true;
} else if(v1 == TYPE_PJ){
//批量使用配件宝箱
List<ItemConf> itemConfs = usePeiJianBox(player,num,configModel);
player.send(ItemConverter.getBoxItems(itemConfs));
return true;
}
return false;
}
/**
* 使用固定(判定背包是否足够,游戏当中背包数量无限制)
* @param player
* @param num
* @param configModel
* @return
*/
private List<ItemConf> useFixedBox(Player player, int num,ItemsPir configModel) {
List<ItemConf> itemConfs = new ArrayList<ItemConf>();
Map<Integer,ItemConf> itemConfMap = new HashMap<Integer,ItemConf>();
List<Item> itemList = new ArrayList<Item>();
ItemBoxControl control = configModel.getV2();
Iterator<ItemBox> iterator = control.getItemBoxs().iterator();
while (iterator.hasNext()) {
ItemBox itemBox = iterator.next();
ItemContext rewardContext = ItemKit.addItem(player, itemBox.getTid(), itemBox.getNum() * num, SystemEnum.BOX, GameLogSource.USE_FIX_BOX);
itemList.addAll(rewardContext.getFinalItemList());
//进行重复性叠加
if(null != itemConfMap.get(itemBox.getTid())){
ItemConf itemConf = itemConfMap.get(itemBox.getTid());
itemConf.setNum(itemConf.getNum()+itemBox.getNum() * num);
itemConfMap.put(itemBox.getTid(), itemConf);
}else{
itemConfMap.put(itemBox.getTid(), new ItemConf(itemBox.getTid(), itemBox.getNum() * num));
}
}
//返回道具列表
player.send(ItemConverter.getMsgItems(itemList));
itemConfs.addAll(itemConfMap.values());
return itemConfs;
}
/**
* 使用随机道具
* 随机产生道具
* @param playerBagManager
*/
private List<ItemConf> useRandomBox(Player player, int num,ItemsPir configModel) {
List<ItemConf> itemConfs = new ArrayList<ItemConf>();
Map<Integer,ItemConf> itemConfMap = new HashMap<Integer,ItemConf>();
List<Item> itemList = new ArrayList<>();
ItemBoxControl control = configModel.getV2();
for(int j=0;j<num;j++) {
for(int i = 0;i<control.getCount();i++) {
// 处理掉落
ItemBox itemBox = DropService.getDrop(control.getItemBoxs());
ItemContext rewardContext = ItemKit.addItem(player, itemBox.getTid(), itemBox.getNum(), SystemEnum.BOX, GameLogSource.USE_FIX_BOX);
itemList.addAll(rewardContext.getFinalItemList());
//进行重复性叠加
if(null != itemConfMap.get(itemBox.getTid())){
ItemConf itemConf = itemConfMap.get(itemBox.getTid());
itemConf.setNum(itemConf.getNum()+itemBox.getNum());
itemConfMap.put(itemBox.getTid(), itemConf);
}else{
itemConfMap.put(itemBox.getTid(), new ItemConf(itemBox.getTid(), itemBox.getNum()));
}
}
}
//返回道具列表
player.send(ItemConverter.getMsgItems(itemList));
itemConfs.addAll(itemConfMap.values());
return itemConfs;
}
/**
* 使用兵种宝箱
* 产出兵种
* 最高级的4个兵种中,随机抽取1种赠送100单位
* @param playerBagManager
*/
private List<ItemConf> useSoldierBox(Player player, int num,ItemsPir configModel) {
List<ItemConf> itemConfs = new ArrayList<ItemConf>();
Map<Integer,ItemConf> itemConfMap = new HashMap<Integer,ItemConf>();
ArmyBoxControl control = configModel.getV2();
//获取建筑兵种并倒序
Map<Integer,CampV2> campV2Map = BuildingPirFactory.get(control.getBuildId()).getV2();
Collection<CampV2> camps = campV2Map.values();
List<CampV2> campsList = new ArrayList<CampV2>(camps);
Collections.reverse(campsList);
int soldierType = player.getSoldierManager().getSoldierTypeByBuildTid(control.getBuildId());
for(int j=0;j<num;j++) {
for(int i = 0;i<control.getCount();i++) {
// 处理掉落
ItemBox itemBox = DropService.getDrop(control.getDropList());
//根据建筑 品质 id获取对应兵种id
CampV2 campV2 = campsList.get(itemBox.getTid()-1);
DesignMap designMap = player.getCustomWeaponManager().queryLastestDesignMap(player, soldierType, campV2.getT(), 0);
if(designMap == null) {
Language.ERRORCODE.send(player, ErrorCodeEnum.E120_SHOP.CODE6);
return null;
}
Soldier soldier = player.getSoldierManager().getOrCreateSoldier(player, designMap.getId());
soldier.updateSoldierByType(itemBox.getNum(), SoldierChangeType.COMMON);
//进行重复性叠加
if(null != itemConfMap.get(campsList.get(itemBox.getTid()-1).getGlobalId())){
ItemConf itemConf = itemConfMap.get(campsList.get(itemBox.getTid()-1).getGlobalId());
itemConf.setNum(itemConf.getNum()+itemBox.getNum());
itemConfMap.put(campsList.get(itemBox.getTid()-1).getGlobalId(), itemConf);
}else{
itemConfMap.put(campsList.get(itemBox.getTid()-1).getGlobalId(), new ItemConf(campsList.get(itemBox.getTid()-1).getGlobalId(), itemBox.getNum()));
}
}
}
//发送兵种更新信息
player.getSoldierManager().send(player);
InjectorUtil.getInjector().dbCacheService.update(player);
itemConfs.addAll(itemConfMap.values());
return itemConfs;
}
/**
* 使用配件宝箱
* @param playerBagManager
*/
private List<ItemConf> usePeiJianBox(Player player, int num,ItemsPir configModel) {
List<ItemConf> itemConfs = new ArrayList<ItemConf>();
List<Item> itemList = new ArrayList<Item>();
Map<Integer,ItemConf> itemConfMap = new HashMap<Integer,ItemConf>();
PeiJianBoxControl control = (PeiJianBoxControl)configModel.getV2();
//已解锁配件ID
Set<Integer> unlockIds = player.roleInfo().getSoldierData().getUnlockPeijians().keySet();
//宝箱配置配件组ID
List<Integer> peiJianIds = control.getPeiJianList();
//根据品质将配件组ID转化为配件ID
List<Integer> ids = new ArrayList<Integer>();
for(int peiJianId : peiJianIds){
PeiJianPir pjp = PeiJianPirFactory.getInstance().getPeiJianPirByType6AndQuality(peiJianId, control.getLevel());
if(null != pjp){
ids.add(pjp.getId());
}
}
ids.removeAll(unlockIds);
//存在未解锁配件则产出配件 否则产出道具
Random random = new Random();
for(int i=0;i<num;i++){
if(null != ids && ids.size()>0){
int id = ids.get(random.nextInt(ids.size()));
player.getCustomWeaponManager().unlockPeijian(player, id, GameLogSource.USE_PEIJIAN_BOX);
//进行重复性叠加
if(null != itemConfMap.get(id)){
ItemConf itemConf = itemConfMap.get(id);
itemConf.setNum(itemConf.getNum()+1);
itemConfMap.put(id, itemConf);
}else{
itemConfMap.put(id, new ItemConf(id, 1));
}
ids.remove(Integer.valueOf(id));
}else{
int dropNum = random.nextInt(control.getItemMax())%(control.getItemMax()-control.getItemMin()+1)+control.getItemMin();
ItemContext rewardContext = ItemKit.addItem(player, control.getItemId(), dropNum, SystemEnum.BOX, GameLogSource.USE_PEIJIAN_BOX);
itemList.addAll(rewardContext.getFinalItemList());
//进行重复性叠加
if(null != itemConfMap.get(control.getItemId())){
ItemConf itemConf = itemConfMap.get(control.getItemId());
itemConf.setNum(itemConf.getNum()+dropNum);
itemConfMap.put(control.getItemId(), itemConf);
}else{
itemConfMap.put(control.getItemId(), new ItemConf(control.getItemId(), dropNum));
}
}
}
//返回道具列表
if(itemList != null && itemList.size()>0){
player.send(ItemConverter.getMsgItems(itemList));
}
itemConfs.addAll(itemConfMap.values());
return itemConfs;
}
}
| [
"ityuany@126.com"
] | ityuany@126.com |
aa91fea9fdccae40dc23fabc8c119d3c818ed3f0 | ddd38972d2e73c464ee77024f6ba4d6e11aac97b | /platform/arcus-lib/src/main/java/com/iris/platform/rule/catalog/action/AbstractActionTemplate.java | f3ee22e55a7f489f8c86ef7fc99f63a0230a473d | [
"Apache-2.0"
] | permissive | arcus-smart-home/arcusplatform | bc5a3bde6dc4268b9aaf9082c75482e6599dfb16 | a2293efa1cd8e884e6bedbe9c51bf29832ba8652 | refs/heads/master | 2022-04-27T02:58:20.720270 | 2021-09-05T01:36:12 | 2021-09-05T01:36:12 | 168,190,985 | 104 | 50 | Apache-2.0 | 2022-03-10T01:33:34 | 2019-01-29T16:49:10 | Java | UTF-8 | Java | false | false | 2,002 | java | /*
* Copyright 2019 Arcus Project
*
* 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.iris.platform.rule.catalog.action;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Function;
import com.iris.common.rule.action.ActionContext;
import com.iris.platform.rule.catalog.ActionTemplate;
import com.iris.platform.rule.catalog.function.FunctionFactory;
import com.iris.platform.rule.catalog.template.TemplatedValue;
public abstract class AbstractActionTemplate implements ActionTemplate {
private final Set<String> contextVariables;
protected AbstractActionTemplate(Set<String> contextVariables) {
this.contextVariables = contextVariables;
}
protected Set<String> getContextVariables() {
return contextVariables;
}
// If the templated value resolves with variables available in the context, then resolve it with the ActionContext later.
// If the templated value resolves with variables available now, then turn it into a function that returns a constant
public <O> Function<ActionContext, O> generateContextFunction(final TemplatedValue<O> value, Map<String, Object> variables) {
if (value.hasContextVariables(contextVariables)) {
return FunctionFactory.INSTANCE.createGetTemplatedValueFromActionContext(value);
}
else {
O resolvedValue = value.apply(variables);
return FunctionFactory.INSTANCE.createConstant(ActionContext.class, resolvedValue);
}
}
}
| [
"b@yoyo.com"
] | b@yoyo.com |
878c4906e373c6cb3d948d00bed0b82d9ef175c7 | 8df62a3f0714f1a11a505f225c51ceb75ff61eb5 | /base/src/main/java/com/realmax/base/signature/NumberPlateResultBean.java | 042dddce033f18889a1aaa8d74d0dcd0c7fe2b11 | [] | no_license | ayuanindex/TeachingSample | 3d7e64865e5c99a9631d0b4a2580ed451097c823 | f29ed8b52a1c573dfd6edf588e72bb49dbec7e0d | refs/heads/master | 2022-12-12T18:54:59.634852 | 2020-08-24T03:33:50 | 2020-08-24T03:33:50 | 269,332,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,017 | java | package com.realmax.base.signature;
import com.realmax.base.network.HttpUtil;
@HttpUtil.POST("https://ocr.tencentcloudapi.com/")
public class NumberPlateResultBean {
/**
* Response : {"Number":"京N0L9U8","Confidence":99,"Error":{"Code":"FailedOperation.OcrFailed","Message":"Ocr识别失败"},"RequestId":"210103d3-db06-4691-abe0-c0853aae606b"}
*/
private ResponseBean Response;
public ResponseBean getResponse() {
return Response;
}
public void setResponse(ResponseBean Response) {
this.Response = Response;
}
public static class ResponseBean {
/**
* Number : 京N0L9U8
* Confidence : 99
* Error : {"Code":"FailedOperation.OcrFailed","Message":"Ocr识别失败"}
* RequestId : 210103d3-db06-4691-abe0-c0853aae606b
*/
private String Number;
private int Confidence;
private ErrorBean Error;
private String RequestId;
public String getNumber() {
return Number;
}
public void setNumber(String Number) {
this.Number = Number;
}
public int getConfidence() {
return Confidence;
}
public void setConfidence(int Confidence) {
this.Confidence = Confidence;
}
public ErrorBean getError() {
return Error;
}
public void setError(ErrorBean Error) {
this.Error = Error;
}
public String getRequestId() {
return RequestId;
}
public void setRequestId(String RequestId) {
this.RequestId = RequestId;
}
public static class ErrorBean {
/**
* Code : FailedOperation.OcrFailed
* Message : Ocr识别失败
*/
private String Code;
private String Message;
public String getCode() {
return Code;
}
public void setCode(String Code) {
this.Code = Code;
}
public String getMessage() {
return Message;
}
public void setMessage(String Message) {
this.Message = Message;
}
@Override
public String toString() {
return "ErrorBean{" +
"Code='" + Code + '\'' +
", Message='" + Message + '\'' +
'}';
}
}
@Override
public String toString() {
return "ResponseBean{" +
"Number='" + Number + '\'' +
", Confidence=" + Confidence +
", Error=" + Error +
", RequestId='" + RequestId + '\'' +
'}';
}
}
@Override
public String toString() {
return "NumberPlateResultBean{" +
"Response=" + Response +
'}';
}
}
| [
"lzy2118053626@hotmaill.com"
] | lzy2118053626@hotmaill.com |
8632db36dd70d5cbc8c24bc3d31517ac5c86b005 | 6a6524d9f3085be09259a1cd633d04d70d4e60ea | /instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/ChannelFutureListenerInstrumentation.java | 5c2282af009784736680caba6af62ec15e57c791 | [
"Apache-2.0"
] | permissive | kumarh1982/opentelemetry-java-instrumentation | 69b5b2d53a690fb325a857f9e5d56868ea7c8b4e | ed8ffeaed1a73129c278f762ae3ec4f39d788aec | refs/heads/main | 2023-04-24T11:41:52.881258 | 2021-05-14T22:38:57 | 2021-05-14T22:38:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,904 | java | /*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.netty.v4_0;
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface;
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.javaagent.instrumentation.netty.v4_0.client.NettyHttpClientTracer.tracer;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import io.netty.channel.ChannelFuture;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.Map;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
public class ChannelFutureListenerInstrumentation implements TypeInstrumentation {
@Override
public ElementMatcher<ClassLoader> classLoaderOptimization() {
return hasClassesNamed("io.netty.channel.ChannelFutureListener");
}
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return implementsInterface(named("io.netty.channel.ChannelFutureListener"));
}
@Override
public Map<? extends ElementMatcher<? super MethodDescription>, String> transformers() {
return singletonMap(
isMethod()
.and(named("operationComplete"))
.and(takesArgument(0, named("io.netty.channel.ChannelFuture"))),
ChannelFutureListenerInstrumentation.class.getName() + "$OperationCompleteAdvice");
}
public static class OperationCompleteAdvice {
@Advice.OnMethodEnter
public static Scope activateScope(@Advice.Argument(0) ChannelFuture future) {
/*
Idea here is:
- To return scope only if we have captured it.
- To capture scope only in case of error.
*/
Throwable cause = future.cause();
if (cause == null) {
return null;
}
Context parentContext = future.channel().attr(AttributeKeys.CONNECT_CONTEXT).getAndRemove();
if (parentContext == null) {
return null;
}
Scope parentScope = parentContext.makeCurrent();
Context errorContext = tracer().startSpan("CONNECT", SpanKind.CLIENT);
tracer().endExceptionally(errorContext, cause);
return parentScope;
}
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void deactivateScope(@Advice.Enter Scope scope) {
if (scope != null) {
scope.close();
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
bbd16c93ad875ff94f63d82c698dbb3c2ae60063 | 0d86bf60157aa70f390b42132dec1d977d42347e | /Day35.java | 623283d983c69cca3f8ba555f204582f773190e6 | [] | no_license | vansh180198/Daily_Coding | cfcb3b937f91ae23774e91541692c91a0a5060e9 | fe8bb1b124f9af3100bf26b7990b43d841667f1c | refs/heads/main | 2023-02-27T05:49:00.644163 | 2021-02-10T18:30:57 | 2021-02-10T18:30:57 | 321,734,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | public class Day35 {
public static void main(String[] args) {
char[] arr={'G', 'B', 'R', 'R', 'B', 'R', 'G'};
sort(arr);
for (int i = 0; i <arr.length ; i++) {
System.out.print(arr[i]+" ");
}
}
public static char[] sort(char[] arr) {
int start = 0;
int mid = 0;
int end= arr.length - 1;
while (mid <= end) {
switch (arr[mid]) {
case 'R':
swap(arr,start, mid);
start++;
mid++;
break;
case 'G':
mid++;
break;
case 'B':
swap(arr, mid, end);
end--;
break;
}
}
return arr;
}
private static void swap(char[] arr, int i, int j) {
char temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
9aa231c1041ba9beb43c265313f738b2ec8c6f8c | cc28eb89211aab45d71af5ba85e58ec54c98aad4 | /ProgrammingBasics02/SimpleOperationsandCalculationsMoreExercises/TriangleArea.java | 6048490b92b361212475674a3d98293e3379f19d | [
"Apache-2.0"
] | permissive | dplamenov/Homework-and-Exercises | 0ce3292674ad5235d5b488310973571e0b758b25 | 81e7316d23b4b182d67e09278004e88d1bfc2023 | refs/heads/master | 2021-12-18T16:54:45.250953 | 2021-12-13T19:14:17 | 2021-12-13T19:14:17 | 120,272,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package SimpleOperationsandCalculationsMoreExercises;
import java.util.Scanner;
public class TriangleArea {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double a = Double.parseDouble(scanner.nextLine());
double h = Double.parseDouble(scanner.nextLine());
double area = (a * h) / 2;
System.out.printf("%.2f", area);
}
}
| [
"dimitar.plamenov@gmail.com"
] | dimitar.plamenov@gmail.com |
bf20da0d264718d8e33c54f415f9eb74eff8889e | 8b8092afd783daa1d0016f4da0806881a7e3f71f | /api/src/main/java/io/minio/PutObjectBaseArgs.java | e4019d2a54785c76dec919f2e781939cb94fda1f | [
"Apache-2.0"
] | permissive | oniono/minio-java | e542e835555239d1b2470f47a020aebcc6479cff | 1ffbf7e20d54cc035197653b402dd2e646da4940 | refs/heads/master | 2023-08-17T20:30:09.863656 | 2021-10-21T20:08:03 | 2021-10-21T20:08:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,876 | java | /*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 MinIO, Inc.
*
* 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 io.minio;
import com.google.common.base.Objects;
import java.io.IOException;
/** Base argument class for {@link PutObjectArgs} and {@link UploadObjectArgs}. */
public abstract class PutObjectBaseArgs extends ObjectWriteArgs {
protected long objectSize;
protected long partSize;
protected int partCount;
protected String contentType;
protected boolean preloadData;
public long objectSize() {
return objectSize;
}
public long partSize() {
return partSize;
}
public int partCount() {
return partCount;
}
/** Gets content type. It returns if content type is set (or) value of "Content-Type" header. */
public String contentType() throws IOException {
if (contentType != null) {
return contentType;
}
if (this.headers().containsKey("Content-Type")) {
return this.headers().get("Content-Type").iterator().next();
}
return null;
}
public boolean preloadData() {
return preloadData;
}
/** Base argument builder class for {@link PutObjectBaseArgs}. */
@SuppressWarnings("unchecked") // Its safe to type cast to B as B is inherited by this class
public abstract static class Builder<B extends Builder<B, A>, A extends PutObjectBaseArgs>
extends ObjectWriteArgs.Builder<B, A> {
private void validateSizes(long objectSize, long partSize) {
if (partSize > 0) {
if (partSize < MIN_MULTIPART_SIZE) {
throw new IllegalArgumentException(
"part size " + partSize + " is not supported; minimum allowed 5MiB");
}
if (partSize > MAX_PART_SIZE) {
throw new IllegalArgumentException(
"part size " + partSize + " is not supported; maximum allowed 5GiB");
}
}
if (objectSize >= 0) {
if (objectSize > MAX_OBJECT_SIZE) {
throw new IllegalArgumentException(
"object size " + objectSize + " is not supported; maximum allowed 5TiB");
}
} else if (partSize <= 0) {
throw new IllegalArgumentException(
"valid part size must be provided when object size is unknown");
}
}
protected long[] getPartInfo(long objectSize, long partSize) {
validateSizes(objectSize, partSize);
if (objectSize < 0) return new long[] {partSize, -1};
if (partSize <= 0) {
// Calculate part size by multiple of MIN_MULTIPART_SIZE.
double dPartSize = Math.ceil((double) objectSize / MAX_MULTIPART_COUNT);
dPartSize = Math.ceil(dPartSize / MIN_MULTIPART_SIZE) * MIN_MULTIPART_SIZE;
partSize = (long) dPartSize;
}
if (partSize > objectSize) partSize = objectSize;
long partCount = partSize > 0 ? (long) Math.ceil((double) objectSize / partSize) : 1;
if (partCount > MAX_MULTIPART_COUNT) {
throw new IllegalArgumentException(
"object size "
+ objectSize
+ " and part size "
+ partSize
+ " make more than "
+ MAX_MULTIPART_COUNT
+ "parts for upload");
}
return new long[] {partSize, partCount};
}
/**
* Sets flag to control data preload of stream/file. When this flag is enabled, entire
* part/object data is loaded into memory to enable connection retry on network failure in the
* middle of upload.
*
* @deprecated As this behavior is enabled by default and cannot be turned off.
*/
@Deprecated
public B preloadData(boolean preloadData) {
operations.add(args -> args.preloadData = preloadData);
return (B) this;
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PutObjectBaseArgs)) return false;
if (!super.equals(o)) return false;
PutObjectBaseArgs that = (PutObjectBaseArgs) o;
return objectSize == that.objectSize
&& partSize == that.partSize
&& partCount == that.partCount
&& Objects.equal(contentType, that.contentType)
&& preloadData == that.preloadData;
}
@Override
public int hashCode() {
return Objects.hashCode(
super.hashCode(), objectSize, partSize, partCount, contentType, preloadData);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c88768e67f55ae73f7109fef5e7255f96e68728f | cb2d857961c76ca348f644ad013e77cdb3c13806 | /src/main/java/com/reseau/model/Attribuer.java | 7debefda9fddfcbaab076297523d03a447743955 | [] | no_license | simojanati/ReseauSocial | 16a68e6e60b09c85cde280fd42ec548d93f137d9 | 381222962a96ff875d6267300ef9f329b846747a | refs/heads/master | 2021-01-09T06:23:22.255499 | 2017-02-07T00:15:28 | 2017-02-07T00:15:28 | 80,970,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package com.reseau.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Attribuer implements Serializable {
/**
*
*/
private static final long serialVersionUID = 947690502176945810L;
@Id
private AttribuerID attribuerID;
private Date dateAttribution;
public AttribuerID getAttribuerID() {
return attribuerID;
}
public void setAttribuerID(AttribuerID attribuerID) {
this.attribuerID = attribuerID;
}
public Date getDateAttribution() {
return dateAttribution;
}
public void setDateAttribution(Date dateAttribution) {
this.dateAttribution = dateAttribution;
}
public Utilisateur getEtudiant(){
return getAttribuerID().getIdEtudiant();
}
public Classe getClasse(){
return getAttribuerID().getIdClasse();
}
public void setEtudiant(Etudiant etudiant){
getAttribuerID().setIdEtudiant(etudiant);
}
public void setClasse(Classe classe){
getAttribuerID().setIdClasse(classe);
}
public Attribuer(AttribuerID attribuerID, Date dateAttribution) {
super();
this.attribuerID = attribuerID;
this.dateAttribution = dateAttribution;
}
public Attribuer() {
super();
// TODO Auto-generated constructor stub
}
}
| [
"simojanati92@gmail.com"
] | simojanati92@gmail.com |
29fa7f7a09bc0c467834a7f670a6896437dd9825 | e27942cce249f7d62b7dc8c9b86cd40391c1ddd4 | /modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201705/mcm/PendingInvitationSelector.java | 3aad1e240b7dec21d6187d2e08c768d8e2c8dfad | [
"Apache-2.0"
] | permissive | mo4ss/googleads-java-lib | b4b6178747d25d16ae6aa0c80d80ee18a2dfe01a | efaa9c3bd8a46a3ed4b00963dc9760c6dd8bd641 | refs/heads/master | 2022-12-05T00:30:56.740813 | 2022-11-16T10:47:15 | 2022-11-16T10:47:15 | 108,132,394 | 0 | 0 | Apache-2.0 | 2022-11-16T10:47:16 | 2017-10-24T13:41:43 | Java | UTF-8 | Java | false | false | 7,873 | java | // Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* PendingInvitationSelector.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.adwords.axis.v201705.mcm;
/**
* Selector for getPendingInvitations method.
*/
public class PendingInvitationSelector implements java.io.Serializable {
/* Manager customer IDs to check for sent invitations. */
private long[] managerCustomerIds;
/* Client customer IDs to check for received invitations. */
private long[] clientCustomerIds;
public PendingInvitationSelector() {
}
public PendingInvitationSelector(
long[] managerCustomerIds,
long[] clientCustomerIds) {
this.managerCustomerIds = managerCustomerIds;
this.clientCustomerIds = clientCustomerIds;
}
@Override
public String toString() {
return com.google.common.base.MoreObjects.toStringHelper(this.getClass())
.omitNullValues()
.add("clientCustomerIds", getClientCustomerIds())
.add("managerCustomerIds", getManagerCustomerIds())
.toString();
}
/**
* Gets the managerCustomerIds value for this PendingInvitationSelector.
*
* @return managerCustomerIds * Manager customer IDs to check for sent invitations.
*/
public long[] getManagerCustomerIds() {
return managerCustomerIds;
}
/**
* Sets the managerCustomerIds value for this PendingInvitationSelector.
*
* @param managerCustomerIds * Manager customer IDs to check for sent invitations.
*/
public void setManagerCustomerIds(long[] managerCustomerIds) {
this.managerCustomerIds = managerCustomerIds;
}
public long getManagerCustomerIds(int i) {
return this.managerCustomerIds[i];
}
public void setManagerCustomerIds(int i, long _value) {
this.managerCustomerIds[i] = _value;
}
/**
* Gets the clientCustomerIds value for this PendingInvitationSelector.
*
* @return clientCustomerIds * Client customer IDs to check for received invitations.
*/
public long[] getClientCustomerIds() {
return clientCustomerIds;
}
/**
* Sets the clientCustomerIds value for this PendingInvitationSelector.
*
* @param clientCustomerIds * Client customer IDs to check for received invitations.
*/
public void setClientCustomerIds(long[] clientCustomerIds) {
this.clientCustomerIds = clientCustomerIds;
}
public long getClientCustomerIds(int i) {
return this.clientCustomerIds[i];
}
public void setClientCustomerIds(int i, long _value) {
this.clientCustomerIds[i] = _value;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof PendingInvitationSelector)) return false;
PendingInvitationSelector other = (PendingInvitationSelector) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.managerCustomerIds==null && other.getManagerCustomerIds()==null) ||
(this.managerCustomerIds!=null &&
java.util.Arrays.equals(this.managerCustomerIds, other.getManagerCustomerIds()))) &&
((this.clientCustomerIds==null && other.getClientCustomerIds()==null) ||
(this.clientCustomerIds!=null &&
java.util.Arrays.equals(this.clientCustomerIds, other.getClientCustomerIds())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getManagerCustomerIds() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(getManagerCustomerIds());
i++) {
java.lang.Object obj = java.lang.reflect.Array.get(getManagerCustomerIds(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
if (getClientCustomerIds() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(getClientCustomerIds());
i++) {
java.lang.Object obj = java.lang.reflect.Array.get(getClientCustomerIds(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(PendingInvitationSelector.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/mcm/v201705", "PendingInvitationSelector"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("managerCustomerIds");
elemField.setXmlName(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/mcm/v201705", "managerCustomerIds"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
elemField.setMaxOccursUnbounded(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("clientCustomerIds");
elemField.setXmlName(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/mcm/v201705", "clientCustomerIds"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
elemField.setMaxOccursUnbounded(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"jradcliff@users.noreply.github.com"
] | jradcliff@users.noreply.github.com |
68f1568155613fb009054aaae2d9348a35065800 | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_2/src/g/Calc_1_2_69.java | 69ffc5d166df244094453f9c1cf1da2867b281de | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package g;
public class Calc_1_2_69 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
9d4f07fe4805dc6047fe0a58ee2656c1dbf53d7c | b67a12a8669619b155b9196469a614136701f2ac | /sdk/paylib/runtime-src/com/thumb/payapi/myepay/MyEpayPay.java | 670823508091f419c82c6a8898cef52dcc7f0104 | [] | no_license | rusteer/pay | f849ee646b90674be35837373489e738859dd7c8 | 9252827763fe60a5a11f18f0e3a9c2dc9eb7d044 | refs/heads/master | 2021-01-17T19:18:16.010638 | 2016-08-04T06:44:35 | 2016-08-04T06:44:35 | 63,956,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.thumb.payapi.myepay;
import android.app.Activity;
import com.thumb.payapi.Pay.PayCallback;
public class MyEpayPay {
public static void init(final Activity context) {}
public static void pay(final Activity context, final int payIndex, final PayCallback callback) {}
}
| [
"rusteer@outlook.com"
] | rusteer@outlook.com |
e679f952120ced11c8bc049add2403179c594e91 | 641631d2251ac110cfb17ccc8dbda1859ccaa3bf | /Java project/src/main/java/pl/coderslab/repository/security/UserRepository.java | cf0190c0ba14c993ca627e8e6780ca5740e3ef55 | [] | no_license | kamilsmierciak/smarthome | 5b13088adc6ceb5de9ebd6bee09db082be7c6bc6 | 07d9ac35b76d43c220f66d7f260252eedad60a39 | refs/heads/master | 2020-03-25T18:25:51.565055 | 2018-08-31T10:38:52 | 2018-08-31T10:38:52 | 144,030,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package pl.coderslab.repository.security;
import org.springframework.data.jpa.repository.JpaRepository;
import pl.coderslab.entity.User;
public interface UserRepository extends JpaRepository<User, Long> {
User findByEmail(String email);
void delete(User user);
} | [
"kamilsmierciak@gmail.com"
] | kamilsmierciak@gmail.com |
8277b9eab01808296246edae47a41c081aed22bf | 928bdfb9b0f4b6db0043526e095fe1aa822b8e64 | /src/main/java/com/taobao/api/response/OpenSmsRmdelaymsgResponse.java | 91435df70eb8a344d0f6145fa0461ef211583368 | [] | no_license | yu199195/jsb | de4f4874fb516d3e51eb3badb48d89be822e00f7 | 591ad717121dd8da547348aeac551fc71da1b8bd | refs/heads/master | 2021-09-07T22:25:09.457212 | 2018-03-02T04:54:18 | 2018-03-02T04:54:18 | 102,316,111 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package com.taobao.api.response;
import com.taobao.api.TaobaoResponse;
import com.taobao.api.domain.BmcResultVoid;
import com.taobao.api.internal.mapping.ApiField;
public class OpenSmsRmdelaymsgResponse
extends TaobaoResponse {
private static final long serialVersionUID = 8448485188414333932L;
@ApiField("result")
private BmcResultVoid result;
public void setResult(BmcResultVoid result) {
this.result = result;
}
public BmcResultVoid getResult() {
return this.result;
}
}
| [
"yu.xiao@happylifeplat.com"
] | yu.xiao@happylifeplat.com |
79a91e78d57410c62cbd499e53c57ece05c90cb5 | 1253a999a75ea196941a6644b3a578e3a81c19d0 | /backend/a407/src/main/java/com/ssafy/a407/exceptions/FileUploadExceptionAdvice.java | 991d63d7ab0570cb6ae3be7f6b6d4d314b1448d3 | [] | no_license | sy9612/biscuit | 95869ff38a7904479929c9edd3bda3c43a354c85 | 410f07bd5523c2cde90211314892722a36c28512 | refs/heads/master | 2023-05-29T10:16:20.121670 | 2021-06-16T07:47:57 | 2021-06-16T07:47:57 | 377,413,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package com.ssafy.a407.exceptions;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.ssafy.a407.message.ResponseMessage;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class FileUploadExceptionAdvice extends ResponseEntityExceptionHandler {
@ExceptionHandler(MaxUploadSizeExceededException.class)
public ResponseEntity<ResponseMessage> handleMaxSizeException(MaxUploadSizeExceededException exc) {
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseMessage("File too large!"));
}
} | [
"sy9612@naver.com"
] | sy9612@naver.com |
3470ed86ba0b55f9a4037aa729f46bba2b793e07 | 80eabbe616cfddde19a1969638163fdea1cfac4f | /StrukturData/src/searchingKelas/Searching.java | 35218c63f72f20da6f85cd7d145864f2e788d121 | [] | no_license | 145314042/myProject | fc2630fb5623044f01f3aa13e687efdec775778b | a3143200d49e810fc275fe72a8948b196a52364e | refs/heads/master | 2021-01-13T03:33:31.705379 | 2017-07-03T15:31:46 | 2017-07-03T15:31:46 | 77,520,763 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,636 | java | package searchingKelas;
public class Searching {
public void cetak(int[] data) {
for (int i = 0; i < data.length; i++) {
System.out.println(data[i]);
}
}
public int sequensialSearch(int[] data, int cari) {
System.out.println("SEQUENTIAL SEARCH");
int i;
for (i = 0; i < data.length; i++) {
System.out.print("Iterasi ke-" + (i + 1));
System.out.println("[idx:" + i + "]");
if (data[i] == cari) {
System.out.println("Selesai");
return i;
}
}
return -1;
}
public int binarySearch(int[] data, int cari) {
System.out.println("BINARY SEARCH");
int IndekAwal;
int IndekAkhir;
int IndekTengah;
int iterasi = 0;
IndekAwal = 0;
IndekAkhir = data.length - 1;
while (IndekAwal <= IndekAkhir) {
System.out.print("Iterasi ke-" + iterasi++);
//MENCARI TITIK TENGAH
IndekTengah = (IndekAwal + IndekAkhir) / 2;
System.out.println(" [idx_awal:" + IndekAwal + ", idx_akhir:" + IndekAkhir + ", idx_tengah:" + IndekTengah + "]");
//PROSES MEMBAGI DATA MENJADI 2 BAGIAN SAMPAI TERSISA 1 DATA YANG DICARI
if (data[IndekTengah] == cari) {
return IndekTengah;
} else if (data[IndekTengah] > cari) {
IndekAkhir = IndekTengah - 1;
} else {
IndekAwal = IndekTengah + 1;
}
}
return -1;
}
}
| [
"Lycorice@Lycorice-PC"
] | Lycorice@Lycorice-PC |
96fc4fe2ca345592dfaa8150e5fad16cee016aa9 | 05aa86f858b0588969eb7dbcceb11e395dc75655 | /app/src/main/java/jasontian/chessclockpro/Preferences/PreferenceManager.java | 6a1a77d9c0795bd137f9274f8e67c002f0b8ca16 | [] | no_license | json-tian/Chess-Clock | 75265f249c4ba343d1cfbf892adfdc92c58f7215 | 3eefc5a7047c5fd33245e5d122d8664e5a82e254 | refs/heads/master | 2022-08-10T02:06:18.324630 | 2019-03-18T15:03:09 | 2019-03-18T15:03:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,069 | java | package jasontian.chessclockpro.Preferences;
import android.app.Activity;
import android.content.SharedPreferences;
import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
public abstract class PreferenceManager {
public static boolean addSetting(Activity activity, String item){
String[] pref = getStringFromPreferences(activity,"", "times").split(",");
ArrayList<String> test = new ArrayList<>(Arrays.asList(pref));
if(test.get(0) != "") {
test.set(0, String.valueOf(Integer.parseInt(test.get(0)) + 1));
test.add(item);
} else {
test.set(0, "1");
test.add(item);
}
String temp = "";
for (int i = 0; i < test.size(); i ++) {
temp += test.get(i);
temp += ",";
}
temp = temp.substring(0, temp.length()-1);
return putStringInPreferences(activity, temp, "times");
}
public static boolean removeSetting(Activity activity, String item) {
String[] pref = getStringFromPreferences(activity, "", "times").split(",");
ArrayList<String> newPref = new ArrayList<>(Arrays.asList(pref));
for (int i = 1; i < pref.length; i ++ ) {
if (newPref.get(i).equals(item)) {
newPref.remove(i);
Log.d("REMOVALLLLLLLLLLLLLLLLL", item);
break;
}
}
String temp = "";
temp += String.valueOf(Integer.parseInt(pref[0]) - 1) + ",";
for (int i = 1; i < newPref.size(); i ++) {
temp += newPref.get(i);
temp += ",";
}
temp = temp.substring(0, temp.length()-1);
return putStringInPreferences(activity, temp, "times");
}
public static boolean exists(Activity activity, String item) {
String[] pref = getStringFromPreferences(activity, "", "times").split(",");
for (int i = 1; i < pref.length; i ++) {
if (pref[i].equals(item))
return true;
}
return false;
}
public static String[] getTime(Activity activity){
String times = getStringFromPreferences(activity,"", "times");
return convertStringToArray(times);
}
private static boolean putStringInPreferences(Activity activity, String item, String key){
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, item);
editor.commit();
return true;
}
private static String getStringFromPreferences(Activity activity,String defaultValue,String key){
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(activity);
String temp = sharedPreferences.getString(key, defaultValue);
return temp;
}
private static String[] convertStringToArray(String str){
String[] arr = str.split(",");
return arr;
}
}
| [
"tianjason6@gmail.com"
] | tianjason6@gmail.com |
55e4d8decdf304c2a0a6c5242b1534e9f8a6c7dd | 14fa54f314581d95e596952e1b244756d5db7b79 | /app/src/main/java/com/example/micha/contentdata/main/MainContract.java | 9a4ed6f9490c6a78fd7485f69e4cbe937bb68a8f | [] | no_license | Mazogu/ContentProviders | c20ed4cc1fb00c060eeb913848990951766cecab | e901ac33fd1f9536b4f873c15501449b7773a0cf | refs/heads/master | 2021-04-30T06:49:35.602595 | 2018-02-14T01:03:01 | 2018-02-14T01:03:01 | 121,455,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.example.micha.contentdata.main;
import com.example.micha.contentdata.BasePresenter;
import com.example.micha.contentdata.BaseView;
import com.example.micha.contentdata.model.Person;
/**
* Created by micha on 2/12/2018.
*/
public interface MainContract {
interface MPresenter extends BasePresenter<MView>{
void addPerson(Person person);
}
interface MView extends BaseView{
}
}
| [
"michael_doom@hotmail.com"
] | michael_doom@hotmail.com |
200f2128a3dc36519e4962e5c33fa6e36d2ef26a | eefe6d9a8aed413225f0e36b1bb622eab9f1aa78 | /2.software-test/src/com/example/MathUtil.java | 4744cbae1ac6fd486e1638d03d31604f5031426f | [] | no_license | KyoichiroTomatsu-R/ex-bbs | ad988919fc17e0a19a7b008e0841edab6bd708f0 | b5c15041f1fae6e99f5e6ecc177fe254a8065651 | refs/heads/master | 2023-05-13T13:50:45.009885 | 2021-06-04T01:05:44 | 2021-06-04T01:05:44 | 371,566,408 | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 260 | java | package com.example;
public class MathUtil {
public static double power(int num1,int num2) {
if(num1 >= 100 || num2 >= 100) {
throw new IllegalArgumentException("100以上の値は不正です");
}
return Math.pow(num1, num2);
}
}
| [
"kyoichiro.tomatsu@rakus.co.jp"
] | kyoichiro.tomatsu@rakus.co.jp |
a1631f74b3ae23e32523c408ec9f82cd8de8fef5 | 8fa6e740fdbab106e56eb004c0b7e28db58ea9e3 | /Zafiro/src/Librerias/ZafObtConCen/ZafObtConCen.java | 5f421d34a78ed80f51aaae41808b3616b288878c | [] | no_license | Bostel87/Zafiro_Escritorio | 639d476ea105ce87267c8a9424d56c7f2e65c676 | c47268d8df084cdd3d39f63026178333caed4f71 | refs/heads/master | 2020-11-24T17:04:46.216747 | 2019-12-16T15:24:34 | 2019-12-16T15:24:34 | 228,260,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,357 | java | /*
* ZafObtConCen.java
*
* Created on 1 de febrero de 2007, 11:48 AM
*/
package Librerias.ZafObtConCen;
import Librerias.ZafUtil.ZafUtil;
import java.sql.*;
/**
*
* @author Javier Ayapata
* ver 0.1
*/
public class ZafObtConCen {
Librerias.ZafParSis.ZafParSis objZafParSis;
Librerias.ZafUtil.ZafUtil objUti;
Connection CONN_LOCAL=null;
public int intCodReg=0;
/** Creates a new instance of ZafObtConCen */
public ZafObtConCen(Librerias.ZafParSis.ZafParSis ZafParsis) {
this.objZafParSis = ZafParsis;
objUti = new ZafUtil();
ObtenerConeccion(objZafParSis.getStringConexionCentral(), objZafParSis.getUsuarioConexionCentral(), objZafParSis.getClaveConexionCentral() );
}
private void ObtenerConeccion(String str_conloc, String str_user , String str_clacon ){
try
{
Abrir_Conexion(str_conloc, str_user , str_clacon );
Statement stm=CONN_LOCAL.createStatement();
ResultSet rst;
String sql = "SELECT co_regdes FROM tbm_cfgBasDatRep where co_grp=5";
rst=stm.executeQuery(sql);
while(rst.next()){
intCodReg=rst.getInt("co_regdes");
}
stm.close();
stm=null;
rst.close();
rst=null;
Cerrar_Conexion();
}
catch (java.sql.SQLException e) { objUti.mostrarMsgErr_F1(new javax.swing.JInternalFrame(), e); }
catch (Exception e) { objUti.mostrarMsgErr_F1(new javax.swing.JInternalFrame(), e); }
}
private void Abrir_Conexion(String str_strcon, String str_usrcon, String str_cla){
try{
//System.out.println("ABRIR CONEXION....");
CONN_LOCAL=DriverManager.getConnection( str_strcon, str_usrcon, str_cla );
CONN_LOCAL.setAutoCommit(false);
}
catch(SQLException Evt){ objUti.mostrarMsgErr_F1(new javax.swing.JInternalFrame(), Evt); }
}
private void Cerrar_Conexion(){
try{
///System.out.println("CERRANDO CONEXION....");
CONN_LOCAL.close();
CONN_LOCAL=null;
}
catch(SQLException Evt){ objUti.mostrarMsgErr_F1(new javax.swing.JInternalFrame(), Evt); }
}
}
| [
""
] | |
99bd9eb26afb10135af212a3e1b87eece3a94716 | ff17fb7bfd7d9bcb6db0552c3c4ff89f8b973282 | /EngCalc-hm322-master/app/src/main/java/com/example/engcalc/MainActivity.java | 2bca859f47aba0cdf7a48223a3363efd9cfc41e4 | [] | no_license | sols-git/Andoid-Kotlin | f425aba94558c0356b5672c2f88fe1608ff0e7e7 | 73d2700776aaeed828fb14b83a921686060521c1 | refs/heads/main | 2022-12-12T05:59:02.746997 | 2020-09-12T11:40:43 | 2020-09-12T11:40:43 | 294,922,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,760 | java | package com.example.engcalc;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ToggleButton;
public class MainActivity extends AppCompatActivity {
private TextView stackStr;
private TextView inputStr;
private ViewGroup stdCalcLyaout;
private ViewGroup engCalcLyaout;
private ToggleButton tggButton;
private String lastOperator = "="; // последняя операция
private double result = 0.0;
private boolean cntrOperarion = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
stdCalcLyaout = findViewById(R.id.stdCalc);
engCalcLyaout = findViewById(R.id.engCalc);
tggButton = findViewById(R.id.toggleButton);
stdCalcLyaout.setVisibility(View.GONE);
engCalcLyaout.setVisibility(View.VISIBLE);
tggButton.setChecked(true);
stackStr = findViewById(R.id.stack);
inputStr = findViewById(R.id.inputkey);
inputStr.setText("0");
}
private double calcByLastOperator(double newOperand) {
double res = 0.0;
if (lastOperator.equals("=") || lastOperator.equals("±") || lastOperator.equals("%") || lastOperator.equals("C")) {
res = newOperand;
} else {
switch (lastOperator) {
case "+":
res = result + newOperand;
break;
case "-":
res = result - newOperand;
break;
case "÷":
res = result / newOperand;
break;
case "x":
res = result * newOperand;
break;
default:
res = result;
break;
}
}
return res;
}
private double calc(double newOperand, String newOperator) {
double res = 0.0;
switch (newOperator) {
case "±":
result = calcByLastOperator(newOperand);
res = result * -1;
break;
case "%":
result = calcByLastOperator(newOperand);
res = result / 100;
break;
case "C":
//res = calcByLastOperator(newOperand);
lastOperator = "=";
break;
case "=":
res = calcByLastOperator(newOperand);
lastOperator = "=";
break;
default:
if (newOperator.equals("+") || newOperator.equals("-") || newOperator.equals("÷") || newOperator.equals("x")) {
res = calcByLastOperator(newOperand);
}
break;
}
lastOperator = newOperator;
result = res;
return result;
}
public void onNumberClick(View view) {
Button button = (Button) view;
stackStr.append(button.getText());
if (cntrOperarion) {
inputStr.setText("");
cntrOperarion = false;
}
inputStr.append(button.getText());
inputStr.setText(inputStr.getText().toString().replaceFirst("^0+(?!$)", ""));
}
public void onOperationClick(View view) {
Button button = (Button) view;
String op = button.getText().toString();
String operandStr = inputStr.getText().toString();
double operand = Double.valueOf(operandStr);
double resD = calc(operand, op);
String resS = String.valueOf(resD);
switch (op) {
case "C":
stackStr.setText("");
inputStr.setText("0");
break;
case "+":
case "-":
case "÷":
case "x":
stackStr.append(button.getText());
cntrOperarion = true;
break;
case "=":
case "±":
case "%":
stackStr.setText("");
inputStr.setText(resS);
cntrOperarion = true;
break;
}
}
public void onTogglClick(View view) {
tggButton = (ToggleButton) view;
if (!tggButton.isChecked())
{
stdCalcLyaout.setVisibility(View.VISIBLE);
engCalcLyaout.setVisibility(View.GONE);
}
else {
stdCalcLyaout.setVisibility(View.GONE);
engCalcLyaout.setVisibility(View.VISIBLE);
}
}
}
| [
"sergei_solovev@mail.ru"
] | sergei_solovev@mail.ru |
acac1309ae34aae74f969069693c3ffdaac0706b | 2d9642ecae0338692c91c9fa8bd532bf3f2fe9fe | /src/作业/JSample7_3_1.java | 086e763522dc2201b5c7c318b75c18490ae6af66 | [] | no_license | xulin090204/- | 35062264cadc79159a8f854837d5acd0ad90cae6 | b763ebe70d24945c88f03bf21b4e5ccf3286be94 | refs/heads/master | 2020-07-18T13:40:28.957906 | 2019-09-30T08:02:46 | 2019-09-30T08:02:46 | 206,256,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package 作业;
public class JSample7_3_1 {
public static void main(String[] args) {
String str ="ni";
str=str+"wo";
System.out.println(str);
}
}
| [
"54882428+xulin090204@users.noreply.github.com"
] | 54882428+xulin090204@users.noreply.github.com |
7b8bf66b837bead818601b7c95f114eb412d0f37 | 152f0cf802a38852a1c727c923df4117cf9b91b5 | /Blatt06_Mediathek/src/de/uni_hamburg/informatik/swt/se2/mediathek/werkzeuge/rueckgabe/VerleihkartenTableModel.java | 3103cee7752e201ed089223bdf3c34bceba237fc | [] | no_license | modprobe/SE2 | fc619fe2692d7788af5595a489e80e1b53a1e25c | 63a80c6a41f52960714814ace4b36ea920dddc72 | refs/heads/master | 2021-01-10T19:25:37.153220 | 2014-07-07T15:33:57 | 2014-07-07T15:33:57 | 20,152,179 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,529 | java | package de.uni_hamburg.informatik.swt.se2.mediathek.werkzeuge.rueckgabe;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import de.uni_hamburg.informatik.swt.se2.mediathek.materialien.Verleihkarte;
/**
* Dieses TableModel hält die Verleihkarten, die an der Oberfläche angezeigt
* werden sollen. Für jedes Medium wird zusätzlich angezeigt, ob es verliehen
* ist oder nicht. Aufgabe eines Tablemodels ist es u.a., für die jeweiligen
* Spalten und Zeilen einer GUI-Tabelle die anzuzeigenden Einträge zu liefern.
* Für jede Zeile weiß dieses Modell, welche Verleihkarte dort dargestellt wird.
*
*
* @author SE2-Team
* @version SoSe 2014
*/
public class VerleihkartenTableModel extends AbstractTableModel
{
private static final long serialVersionUID = 1L;
private static final String[] COLUMN_IDENTIFIERS = new String[] { "Kunde",
"Mediumtyp", "Titel", "Ausleihdatum", "Ausleihdauer (Tage)",
"Mietgebühr (€)" };
/**
* Die Liste, die die Verleihkarten zwischenspeichert/cached und die
* Sortierreihenfolge repräsentiert.
*/
private List<Verleihkarte> _verleihkartenListe;
/**
* Konstruktor. Initialisiert ein neues VerleihkartenTableModel.
*/
public VerleihkartenTableModel()
{
_verleihkartenListe = new ArrayList<Verleihkarte>();
}
@Override
public int getColumnCount()
{
return COLUMN_IDENTIFIERS.length;
}
@Override
public String getColumnName(int column)
{
return COLUMN_IDENTIFIERS[column];
}
@Override
public int getRowCount()
{
return _verleihkartenListe.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex)
{
String ergebnis = null;
Verleihkarte verleihkarte = _verleihkartenListe.get(rowIndex);
switch (columnIndex)
{
case 0:
ergebnis = verleihkarte.getEntleiher().getVorname() + " "
+ verleihkarte.getEntleiher().getNachname();
break;
case 1:
ergebnis = verleihkarte.getMedium().getMedienBezeichnung();
break;
case 2:
ergebnis = verleihkarte.getMedium().getTitel();
break;
case 3:
ergebnis = verleihkarte.getAusleihdatum().toString();
break;
case 4:
ergebnis = Integer.toString(verleihkarte.getAusleihdauer());
break;
case 5:
ergebnis = verleihkarte.getMietgebuehr().getFormatiertenString();
}
return ergebnis;
}
/**
* Liefert die Verleihkarte, die in der Zeile mit der gegebenen Nummer
* dargestellt wird.
*
* @param zeile Die Nummer der Tabellenzeile
*
* @require zeileExistiert(zeile)
*
* @ensure result != null
*/
public Verleihkarte getVerleihkartenFuerZeile(int zeile)
{
assert zeileExistiert(zeile) : "Vorbedingung verletzt: zeileExistiert(zeile)";
return _verleihkartenListe.get(zeile);
}
/**
* Setzt die anzuzeigenden Verleihkarten.
*
* @param verleihkarten Eine Liste der zu setzenden Verleihkarten.
* Nachträgliche Änderungen der Liste wirken sich auch auf das
* Model aus.
*
* @require verleihkarten != null
*/
public void setVerleihkarten(List<Verleihkarte> verleihkarten)
{
assert verleihkarten != null : "Vorbedingung verletzt: verleihkarten != null";
_verleihkartenListe = verleihkarten;
sortiereVerleihkarten();
fireTableDataChanged();
}
/**
* Prüft, ob für die gegebene Tabellen-Zeile eine Verleihkarte in dem
* TableModel existiert.
*
* @param zeile Die Nummer der Tabellenzeile
*/
public boolean zeileExistiert(int zeile)
{
boolean result = false;
if ((zeile < _verleihkartenListe.size()) && (zeile >= 0))
{
result = true;
}
return result;
}
/**
* Sortiert die Verleihkarten nach der im VerleihkartenComparator
* angegebenen Sortierreihenfolge.
*/
private void sortiereVerleihkarten()
{
Collections.sort(_verleihkartenListe, new VerleihkartenComparator());
}
}
| [
"3timmerm@informatik.uni-hamburg.de"
] | 3timmerm@informatik.uni-hamburg.de |
d2aca6753373babe46776396786ecf2f7580a698 | fde71b2aecafdda732c859b22cf89e389c47be3f | /src/com/javapandeng/controller/LoginController.java | 64c9b2134cf7cc26e8862348764c26f292db46a7 | [] | no_license | BrightCheng01/FruitShop | ce517f7f96f957aa86418dbd1676d94e06a1c06d | 56d91edc04b7e1f8c8f124a3c736dd15e0c8b7e2 | refs/heads/master | 2022-12-25T09:32:12.778485 | 2020-10-11T07:12:50 | 2020-10-11T07:12:50 | 303,061,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,210 | java | package com.javapandeng.controller;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONPOJOBuilder;
import com.javapandeng.base.BaseController;
import com.javapandeng.po.*;
import com.javapandeng.service.ItemCategoryService;
import com.javapandeng.service.ItemService;
import com.javapandeng.service.ManageService;
import com.javapandeng.service.UserService;
import com.javapandeng.service.impl.ManageServiceImpl;
import com.javapandeng.utils.Consts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
/*登录控制器*/
@Controller
@RequestMapping("/login")
public class LoginController extends BaseController {
@Autowired
ManageService manageService;
@Autowired
ItemService itemService;
@Autowired
UserService userService;
@Autowired
private ItemCategoryService itemCategoryService;
/*管理员登录前*/
@RequestMapping("login")
public String login()
{
return "/login/mLogin";
}
/*登录验证*/
@RequestMapping("toLogin")
public String toLogin(Manage manage, HttpServletRequest request)
{
System.out.println(manageService);
System.out.println("首先执行");
Manage byEntity = manageService.getByEntity(manage);
System.out.println("dsadsad");
System.out.println(manageService);
System.out.println("dsadsad");
if(byEntity==null)
{
return "redirect:/login/mlogout";
}
request.getSession().setAttribute(Consts.MANAGE,byEntity);
return "/login/mIndex";
}
/*管理员退出*/
@RequestMapping("mlogout")
public String mlogout(HttpServletRequest request)
{
request.getSession().setAttribute(Consts.MANAGE,null);
return "/login/mLogin";
}
/*前端首页*/
@RequestMapping("/uIndex")
public String uIndex(Model model, Item item,HttpServletRequest request)
{
//找到所有父类目
String sql1 = "select * from item_category where isDelete = 0 " +
" and pid is null order by name ";
List<ItemCategory> fatherList =itemCategoryService.listBySqlReturnEntity(sql1);
List<CategoryDto> list = new ArrayList<>();
if(!CollectionUtils.isEmpty(fatherList))
{
for(ItemCategory ic:fatherList)
{
CategoryDto dto = new CategoryDto();
dto.setFather(ic); //设置弗雷目
//c查询二级分类(找父类目的儿子们)
String sql2 = " select * from item_category where isDelete=0 and pid = " +
ic.getId();
List<ItemCategory> childrens = itemCategoryService.listBySqlReturnEntity(sql2);
dto.setChildrens(childrens);
list.add(dto);
model.addAttribute("lbs" ,list);
}
}
//取前十个折扣商品
List<Item> zks= itemService.listBySqlReturnEntity("select * from item where isDelete = 0 and zk is not null order by zk desc limit 0 ,10");
model.addAttribute("zks",zks);
//热销商品
List<Item> rxs= itemService.listBySqlReturnEntity("select * from item where isDelete = 0 order by gmNum desc limit 0 ,10");
model.addAttribute("rxs",rxs);
return "login/uIndex";
}
/*跳转到普通用户注册*/
@RequestMapping("/res")
public String res(){
return "login/res";
}
/*执行普通用户注册*/
@RequestMapping("/toRes")
public String toRes(User user){
userService.insert(user);
return "login/uLogin";
}
/*普通用户登录功能*/
@RequestMapping("/uLogin")
public String uLogin()
{
return "login/uLogin";
}
/*执行普通用户登录*/
@RequestMapping("/utoLogin")
public String utoLogin(User user,HttpServletRequest request){
User byEntity = userService.getByEntity(user);
if(byEntity==null){
return "redirect:/login/res";
}
else{
request.getSession().setAttribute("role",2);
request.getSession().setAttribute(Consts.USERNAME,byEntity.getUserName());
request.getSession().setAttribute(Consts.USERID,byEntity.getId());
return "redirect:/login/uIndex";
}
}
/*会员退出*/
@RequestMapping("uLogout")
public String uLogout(HttpServletRequest request)
{
HttpSession session=request.getSession();
session.invalidate();
return "redirect:/login/uIndex";
}
/*修改密码入口*/
@RequestMapping("/pass")
public String pass(HttpServletRequest request)
{
Object attribute = request.getSession().getAttribute((Consts.USERID));
if(attribute==null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
User load =userService.load(userId);
request.setAttribute("obj",load);
return "login/pass";
}
/*修改密码执行*/
@RequestMapping("/upass")
@ResponseBody
public String upass(String password,HttpServletRequest request)
{
JSONObject js =new JSONObject();
Object attribute = request.getSession().getAttribute((Consts.USERID));
if(attribute==null){
js.put(Consts.RES,0);
return js.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
User load =userService.load(userId);
load.setPassWord(password);
userService.updateById(load);
request.setAttribute("obj",load);
js.put(Consts.RES,1);
return js.toString();
}
}
| [
"956725039@qq.com"
] | 956725039@qq.com |
089b809507622cc92682b770046afd03bfcd5f71 | ab6f6d7caff3a59468cac22e670279112fe0bc6e | /onelinelibrary/src/main/java/onelinelibrary/com/onelinelibrary/main_module/toolbox/JsonRequest.java | 67ad005cffa1a81592e5cae70747ace614e5511f | [] | no_license | dhruvkaushal11/OneLineLibrary | 831ca6d598e755c30eeb55f0f0f591ced307d1b8 | de6c09ae4438a27968ec9fb7565f66d04ee97670 | refs/heads/master | 2021-01-12T09:14:49.204526 | 2016-12-19T20:22:30 | 2016-12-19T20:22:30 | 76,807,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,515 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* 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 onelinelibrary.com.onelinelibrary.main_module.toolbox;
import onelinelibrary.com.onelinelibrary.main_module.NetworkResponse;
import onelinelibrary.com.onelinelibrary.main_module.Request;
import onelinelibrary.com.onelinelibrary.main_module.Response;
import onelinelibrary.com.onelinelibrary.main_module.Response.ErrorListener;
import onelinelibrary.com.onelinelibrary.main_module.Response.Listener;
import onelinelibrary.com.onelinelibrary.main_module.VolleyLog;
import java.io.UnsupportedEncodingException;
/**
* A request for retrieving a T type response body at a given URL that also
* optionally sends along a JSON body in the request specified.
*
* @param <T> JSON type of response expected
*/
public abstract class JsonRequest<T> extends Request<T> {
/** Default charset for JSON request. */
protected static final String PROTOCOL_CHARSET = "utf-8";
/** Content type for request. */
private static final String PROTOCOL_CONTENT_TYPE =
String.format("application/json; charset=%s", PROTOCOL_CHARSET);
private final Listener<T> mListener;
private final String mRequestBody;
/**
* Deprecated constructor for a JsonRequest which defaults to GET unless {@link #getPostBody()}
* or {@link #getPostParams()} is overridden (which defaults to POST).
*
* @deprecated Use {@link #JsonRequest(int, String, String, Listener, ErrorListener)}.
*/
public JsonRequest(String url, String requestBody, Listener<T> listener,
ErrorListener errorListener) {
this(Method.DEPRECATED_GET_OR_POST, url, requestBody, listener, errorListener);
}
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
ErrorListener errorListener) {
super(method, url, errorListener);
mListener = listener;
mRequestBody = requestBody;
}
@Override
protected void deliverResponse(T response) {
mListener.onResponse(response);
}
@Override
abstract protected Response<T> parseNetworkResponse(NetworkResponse response);
/**
* @deprecated Use {@link #getBodyContentType()}.
*/
@Override
public String getPostBodyContentType() {
return getBodyContentType();
}
/**
* @deprecated Use {@link #getBody()}.
*/
@Override
public byte[] getPostBody() {
return getBody();
}
@Override
public String getBodyContentType() {
return PROTOCOL_CONTENT_TYPE;
}
@Override
public byte[] getBody() {
try {
return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET);
} catch (UnsupportedEncodingException uee) {
VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s",
mRequestBody, PROTOCOL_CHARSET);
return null;
}
}
}
| [
"dhurv"
] | dhurv |
3d4e0faac883edf357dd29e51bf52de9eee274ec | 86fa7e5cfc1717ea388b077a4ea8d478498fbf44 | /MockCert/src/main/java/com/mock/entity/Events.java | 6255d196bc300b72310b1e07d711266ef2fa4329 | [] | no_license | jenyjacob/Spring | 7ea8b3c278c83522549b1badae7a3eafb84b77cf | 6462156bdae62a26885ca070c038171764c2b73a | refs/heads/master | 2022-12-10T14:58:37.201042 | 2020-09-15T16:51:03 | 2020-09-15T16:51:03 | 295,786,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package com.mock.entity;
import java.time.LocalDate;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "events")
public class Events {
@Id
private Integer eventId;
private String name;
private LocalDate eventDate;
private String venue;
private Integer maxCount;
public Integer getEventId() {
return eventId;
}
public void setEventId(Integer eventId) {
this.eventId = eventId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getEventDate() {
return eventDate;
}
public void setEventDate(LocalDate eventDate) {
this.eventDate = eventDate;
}
public String getVenue() {
return venue;
}
public void setVenue(String venue) {
this.venue = venue;
}
public Integer getMaxCount() {
return maxCount;
}
public void setMaxCount(Integer maxCount) {
this.maxCount = maxCount;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((eventId == null) ? 0 : eventId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Events other = (Events) obj;
if (eventId == null) {
if (other.eventId != null)
return false;
} else if (!eventId.equals(other.eventId))
return false;
return true;
}
}
| [
"jenyjacob@hotmail.com"
] | jenyjacob@hotmail.com |
997eedcc130b36da9e14c67c2f6b815c7e9d609f | 21bcd1da03415fec0a4f3fa7287f250df1d14051 | /sources/p212io/fabric/sdk/android/p493p/p498e/C14330v.java | 181d58df90eb59efb6bef7f080e48b2b6f5f9cc7 | [] | no_license | lestseeandtest/Delivery | 9a5cc96bd6bd2316a535271ec9ca3865080c3ec8 | bc3fae8f30804a2520e6699df92c2e6a4a0a7cfc | refs/heads/master | 2022-04-24T12:14:22.396398 | 2020-04-25T21:50:29 | 2020-04-25T21:50:29 | 258,875,870 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,494 | java | package p212io.fabric.sdk.android.p493p.p498e;
/* renamed from: io.fabric.sdk.android.p.e.v */
/* compiled from: SettingsJsonConstants */
public class C14330v {
/* renamed from: A */
public static final boolean f42276A = false;
/* renamed from: A0 */
public static final String f42277A0 = "show_always_send_button";
/* renamed from: B */
public static final boolean f42278B = false;
/* renamed from: B0 */
public static final String f42279B0 = "always_send_button_title";
/* renamed from: C */
public static final boolean f42280C = true;
/* renamed from: C0 */
public static final String f42281C0 = "Send Crash Report?";
/* renamed from: D */
public static final boolean f42282D = true;
/* renamed from: D0 */
public static final String f42283D0 = "Looks like we crashed! Please help us fix the problem by sending a crash report.";
/* renamed from: E */
public static final boolean f42284E = true;
/* renamed from: E0 */
public static final boolean f42285E0 = true;
/* renamed from: F */
public static final int f42286F = 1;
/* renamed from: F0 */
public static final boolean f42287F0 = true;
/* renamed from: G */
public static final String f42288G = "update_endpoint";
/* renamed from: G0 */
public static final String f42289G0 = "Send";
/* renamed from: H */
public static final String f42290H = "update_suspend_duration";
/* renamed from: H0 */
public static final String f42291H0 = "Always Send";
/* renamed from: I */
public static final String f42292I = null;
/* renamed from: I0 */
public static final String f42293I0 = "Don't Send";
/* renamed from: J */
public static final int f42294J = 3600;
/* renamed from: K */
public static final String f42295K = "prompt_enabled";
/* renamed from: L */
public static final String f42296L = "collect_reports";
/* renamed from: M */
public static final String f42297M = "collect_logged_exceptions";
/* renamed from: N */
public static final String f42298N = "collect_analytics";
/* renamed from: O */
public static final String f42299O = "firebase_crashlytics_enabled";
/* renamed from: P */
public static final boolean f42300P = false;
/* renamed from: Q */
public static final boolean f42301Q = true;
/* renamed from: R */
public static final boolean f42302R = true;
/* renamed from: S */
public static final boolean f42303S = false;
/* renamed from: T */
public static final boolean f42304T = false;
/* renamed from: U */
public static final String f42305U = "identifier";
/* renamed from: V */
public static final String f42306V = "status";
/* renamed from: W */
public static final String f42307W = "url";
/* renamed from: X */
public static final String f42308X = "reports_url";
/* renamed from: Y */
public static final String f42309Y = "ndk_reports_url";
/* renamed from: Z */
public static final String f42310Z = "update_required";
/* renamed from: a */
public static final String f42311a = "expires_at";
/* renamed from: a0 */
public static final String f42312a0 = "icon";
/* renamed from: b */
public static final String f42313b = "app";
/* renamed from: b0 */
public static final boolean f42314b0 = false;
/* renamed from: c */
public static final String f42315c = "analytics";
/* renamed from: c0 */
public static final String f42316c0 = "hash";
/* renamed from: d */
public static final String f42317d = "beta";
/* renamed from: d0 */
public static final String f42318d0 = "width";
/* renamed from: e */
public static final String f42319e = "session";
/* renamed from: e0 */
public static final String f42320e0 = "height";
/* renamed from: f */
public static final String f42321f = "prompt";
/* renamed from: f0 */
public static final String f42322f0 = "prerendered";
/* renamed from: g */
public static final String f42323g = "settings_version";
/* renamed from: g0 */
public static final String f42324g0 = "log_buffer_size";
/* renamed from: h */
public static final String f42325h = "features";
/* renamed from: h0 */
public static final String f42326h0 = "max_chained_exception_depth";
/* renamed from: i */
public static final String f42327i = "cache_duration";
/* renamed from: i0 */
public static final String f42328i0 = "max_custom_exception_events";
/* renamed from: j */
public static final int f42329j = 0;
/* renamed from: j0 */
public static final String f42330j0 = "max_custom_key_value_pairs";
/* renamed from: k */
public static final String f42331k = "url";
/* renamed from: k0 */
public static final String f42332k0 = "identifier_mask";
/* renamed from: l */
public static final String f42333l = "flush_interval_secs";
/* renamed from: l0 */
public static final String f42334l0 = "send_session_without_crash";
/* renamed from: m */
public static final String f42335m = "max_byte_size_per_file";
/* renamed from: m0 */
public static final String f42336m0 = "max_complete_sessions_count";
/* renamed from: n */
public static final String f42337n = "max_file_count_per_send";
/* renamed from: n0 */
public static final int f42338n0 = 3600;
/* renamed from: o */
public static final String f42339o = "max_pending_send_file_count";
/* renamed from: o0 */
public static final int f42340o0 = 64000;
/* renamed from: p */
public static final String f42341p = "forward_to_google_analytics";
/* renamed from: p0 */
public static final int f42342p0 = 8;
/* renamed from: q */
public static final String f42343q = "include_purchase_events_in_forwarded_events";
/* renamed from: q0 */
public static final int f42344q0 = 64;
/* renamed from: r */
public static final String f42345r = "track_custom_events";
/* renamed from: r0 */
public static final int f42346r0 = 64;
/* renamed from: s */
public static final String f42347s = "track_predefined_events";
/* renamed from: s0 */
public static final int f42348s0 = 255;
/* renamed from: t */
public static final String f42349t = "sampling_rate";
/* renamed from: t0 */
public static final boolean f42350t0 = false;
/* renamed from: u */
public static final String f42351u = "flush_on_background";
/* renamed from: u0 */
public static final int f42352u0 = 4;
/* renamed from: v */
public static final String f42353v = "https://e.crashlytics.com/spi/v2/events";
/* renamed from: v0 */
public static final String f42354v0 = "title";
/* renamed from: w */
public static final int f42355w = 600;
/* renamed from: w0 */
public static final String f42356w0 = "message";
/* renamed from: x */
public static final int f42357x = 8000;
/* renamed from: x0 */
public static final String f42358x0 = "send_button_title";
/* renamed from: y */
public static final int f42359y = 1;
/* renamed from: y0 */
public static final String f42360y0 = "show_cancel_button";
/* renamed from: z */
public static final int f42361z = 100;
/* renamed from: z0 */
public static final String f42362z0 = "cancel_button_title";
}
| [
"zsolimana@uaedomain.local"
] | zsolimana@uaedomain.local |
a64d63c952d8b70cb2d7ef9001acc64ba1c503a9 | a3759e0e833488001b2c5ddb13e1440231c06408 | /src/java/mx/unam/ecologia/gye/model/SequenceImpl.java | 9e319bb7def506ad4fc19b5cbfdaec88fec7534d | [] | no_license | dwimberger/gye-coalescence | 225b8c204d8ab2cbe8481e83a55db1b5a43f135c | d19b2609d8f512b17696c0f2d36c0569b8d6183d | refs/heads/master | 2020-04-26T09:22:42.140011 | 2015-03-14T11:27:53 | 2015-03-14T11:27:53 | 32,206,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,402 | java | //@license@
package mx.unam.ecologia.gye.model;
import cern.colt.Arrays;
import cern.colt.list.LongArrayList;
import mx.unam.ecologia.gye.util.IdentityGenerator;
import java.util.ArrayList;
/**
* Implementation of {@link Sequence}.
* <p/>
*
* @author Dieter Wimberger (wimpi)
* @version @version@ (@date@)
*/
public class SequenceImpl
implements Sequence {
private int m_UnitSize;
private ArrayList<SequenceUnit> m_Sequence;
private boolean m_TracingChanges = false;
private LongArrayList m_ChangeTrace;
private double m_LastMutation = Double.MAX_VALUE;
private SequenceImpl(ArrayList<SequenceUnit> alist) {
m_Sequence = alist;
}//constructor
public SequenceImpl(int unitsize) {
m_UnitSize = unitsize;
m_Sequence = new ArrayList<SequenceUnit>();
}//constructor
public int getUnitSize() {
return m_UnitSize;
}//getUnitSize
public void setUnitSize(int unitSize) {
m_UnitSize = unitSize;
}//setUnitSize
public boolean isTracingChanges() {
return m_TracingChanges;
}//isTracingChanges
public void setTracingChanges(boolean trackChanges) {
if (m_ChangeTrace == null) {
m_ChangeTrace = new LongArrayList();
}
m_TracingChanges = trackChanges;
}//setTracingChanges
public LongArrayList getChangeTrace() {
return m_ChangeTrace;
}//getChangeTrace
public void setChangeTrace(LongArrayList lal) {
m_ChangeTrace = lal;
}//setChangeTrace
public SequenceUnit get(int pos) {
return m_Sequence.get(pos);
}//get
public int size() {
return m_Sequence.size();
}//size
public int getSize() {
return m_Sequence.size() * m_UnitSize;
}//getSize
public void replace(int pos, SequenceUnit t) {
m_Sequence.set(pos, t);
traceChange();
}//replace
public void add(SequenceUnit t) {
m_Sequence.add(t);
traceChange();
}//add
public void add(int pos, SequenceUnit t) {
m_Sequence.add(pos, t);
traceChange();
}//add
public void remove(int pos) {
m_Sequence.remove(pos);
traceChange();
}//remove
public String toString() {
final StringBuilder sbuf = new StringBuilder();
int size = m_Sequence.size();
for (int i = 0; i < size; i++) {
sbuf.append(m_Sequence.get(i).toString());
}
return sbuf.toString();
}//toString
public final String toTraceString() {
if (m_ChangeTrace == null) {
return "";
}
m_ChangeTrace.trimToSize();
return Arrays.toString(m_ChangeTrace.elements());
}//toString
public final String toFullString() {
final StringBuilder sbuf = new StringBuilder();
sbuf.append(toString());
sbuf.append(toTraceString());
//sbuf.append('|');
//sbuf.append(m_LastMutation);
return sbuf.toString();
}//toFullString
public String toStoreString() {
final StringBuilder sbuf = new StringBuilder();
int size = m_Sequence.size();
sbuf.append(m_Sequence.get(0).toString());
sbuf.append('(');
sbuf.append(size);
sbuf.append(')');
m_ChangeTrace.trimToSize();
long[] trace = m_ChangeTrace.elements();
sbuf.append(';');
if (trace.length > 0) {
for (int i = 0; i < trace.length; i++) {
sbuf.append(trace[i]);
if (i < (trace.length - 1)) {
sbuf.append(',');
}
}
}
if (m_LastMutation < Double.MAX_VALUE) {
sbuf.append('|');
sbuf.append(m_LastMutation);
}
return sbuf.toString();
}//toStoreString
public String toShortString() {
final StringBuilder sbuf = new StringBuilder();
int size = m_Sequence.size();
sbuf.append(m_Sequence.get(0).toString());
sbuf.append('(');
sbuf.append(size);
sbuf.append(')');
return sbuf.toString();
}//toStoreString
public Sequence getCopy() {
SequenceImpl s = new SequenceImpl((ArrayList<SequenceUnit>) m_Sequence.clone());
s.m_UnitSize = this.m_UnitSize;
s.m_ChangeTrace = this.m_ChangeTrace.copy();
s.m_TracingChanges = this.m_TracingChanges;
s.m_LastMutation = this.m_LastMutation;
return s;
}//getCopy
public double getLastMutation() {
return m_LastMutation;
}//getLastMutation
public void setLastMutation(double d) {
m_LastMutation = d;
}//setLastMutation
private void traceChange() {
if (m_TracingChanges) {
m_ChangeTrace.add(IdentityGenerator.nextIdentity());
}//traceChange
}//traceChange
}//class SequenceImpl | [
"dwimberger@c0662b7b-4a33-0410-9fff-99edae9a65ff"
] | dwimberger@c0662b7b-4a33-0410-9fff-99edae9a65ff |
d274c9e4b2a9dca673c9215a04fc522f82939495 | 892bffc2691f38a853402f3973bf8175bc8716a8 | /okr/src/main/java/com/eximbay/okr/model/MemberForAllDetailsMemberModel.java | 31e4e123489335391b980c22ea1e41977d342a5e | [] | no_license | JeongWu/okr-system | 1aab5d440bc4e28daaeafde3d149bf47c562cf64 | 6ea91309e1c67a04c6aec2333118b96433b6874b | refs/heads/master | 2023-04-01T13:58:19.958532 | 2021-04-01T07:17:13 | 2021-04-01T07:17:13 | 351,608,127 | 0 | 0 | null | 2021-04-01T07:17:13 | 2021-03-25T23:51:52 | JavaScript | UTF-8 | Java | false | false | 574 | java | package com.eximbay.okr.model;
import java.util.List;
import com.eximbay.okr.dto.team.TeamDto;
import com.eximbay.okr.dto.objective.ObjectiveDto;
import lombok.Data;
@Data
public class MemberForAllDetailsMemberModel {
private Integer memberSeq;
private String name;
private String localName;
private String position;
private String introduction;
private String image;
private String useFlag;
private List<ObjectiveDto> objectives;
private List<TeamDto> teams;
private Integer keyResults = 0;
private Integer feedbacks = 0;
}
| [
"park961003@naver.com"
] | park961003@naver.com |
e4c332445df3b059fe946037978fb670876d377f | 235dfb33d21d5c1fcbbc3ff450739250c50abbb6 | /ode/Development/apps/webapp/ode-core/src/main/java/com/bah/ode/asn/OdeTravelerInfo.java | 1a697ae446beb099ea7f06e2f7e1d6aaf6d549d6 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | OSADP/SEMI-ODE | 91bf6d32d3f638f8f5a3d5678836a43690f9f9de | 37cba20a7a54d891338068c1134c797ae977f279 | refs/heads/master | 2021-06-18T16:07:35.170019 | 2017-02-18T20:23:34 | 2017-02-18T20:23:34 | 61,062,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,981 | java | package com.bah.ode.asn;
import java.util.ArrayList;
import com.bah.ode.asn.oss.dsrc.TravelerInformation;
import com.bah.ode.asn.oss.dsrc.TravelerInformation.DataFrames;
import com.bah.ode.asn.oss.dsrc.TravelerInformation.DataFrames.Sequence_;
import com.bah.ode.model.OdeObject;
import com.bah.ode.util.CodecUtils;
public class OdeTravelerInfo extends OdeObject {
private static final long serialVersionUID = 3570277012168173163L;
private Integer dataFrameCount;
private ArrayList<OdeAdvisoryDataFrame> dataFrames;
private OdeDSRCmsgID msgID;
private String packetID;
private String urlB;
public OdeTravelerInfo(TravelerInformation tim) {
super();
if (tim.hasDataFrameCount())
setDataFrameCount(tim.getDataFrameCount().intValue());
if (tim.dataFrames != null)
setDataFrames2(tim.dataFrames);
if (tim.msgID != null)
setMsgID(OdeDSRCmsgID.valueOf(tim.msgID.name()));
if (tim.hasPacketID())
setPacketID(CodecUtils.toHex(tim.getPacketID().byteArrayValue()));
if (tim.hasUrlB())
setUrlB(tim.getUrlB().stringValue());
}
private void setDataFrames2(DataFrames dataFrames2) {
dataFrames = new ArrayList<OdeAdvisoryDataFrame>();
ArrayList<Sequence_> elements = dataFrames2.elements;
for (Sequence_ element : elements) {
if (element != null)
dataFrames.add(new OdeAdvisoryDataFrame(element));
}
}
public Integer getDataFrameCount() {
return dataFrameCount;
}
public OdeTravelerInfo setDataFrameCount(Integer dataFrameCount) {
this.dataFrameCount = dataFrameCount;
return this;
}
public ArrayList<OdeAdvisoryDataFrame> getDataFrames() {
return dataFrames;
}
public OdeTravelerInfo setDataFrames(ArrayList<OdeAdvisoryDataFrame> dataFrames) {
this.dataFrames = dataFrames;
return this;
}
public OdeDSRCmsgID getMsgID() {
return msgID;
}
public OdeTravelerInfo setMsgID(OdeDSRCmsgID msgID) {
this.msgID = msgID;
return this;
}
public String getPacketID() {
return packetID;
}
public OdeTravelerInfo setPacketID(String packetID) {
this.packetID = packetID;
return this;
}
public String getUrlB() {
return urlB;
}
public OdeTravelerInfo setUrlB(String urlB) {
this.urlB = urlB;
return this;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((dataFrameCount == null) ? 0 : dataFrameCount.hashCode());
result = prime * result
+ ((dataFrames == null) ? 0 : dataFrames.hashCode());
result = prime * result + ((msgID == null) ? 0 : msgID.hashCode());
result = prime * result + ((packetID == null) ? 0 : packetID.hashCode());
result = prime * result + ((urlB == null) ? 0 : urlB.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OdeTravelerInfo other = (OdeTravelerInfo) obj;
if (dataFrameCount == null) {
if (other.dataFrameCount != null)
return false;
} else if (!dataFrameCount.equals(other.dataFrameCount))
return false;
if (dataFrames == null) {
if (other.dataFrames != null)
return false;
} else if (!dataFrames.equals(other.dataFrames))
return false;
if (msgID != other.msgID)
return false;
if (packetID == null) {
if (other.packetID != null)
return false;
} else if (!packetID.equals(other.packetID))
return false;
if (urlB == null) {
if (other.urlB != null)
return false;
} else if (!urlB.equals(other.urlB))
return false;
return true;
}
}
| [
"musavi_hamid@bah.com"
] | musavi_hamid@bah.com |
a34908167a2abc4b984e699fdd18ee36ed204e5d | f2df397d0ab4fe9f483559e8cf86ab1c06205b40 | /mms-ent/repo-amp/src/main/java/gov/nasa/jpl/view_repo/actions/HtmlToPdfActionExecuter.java | b05233ec14ae9ba342d08f3fd04b7abf74eb1f56 | [] | no_license | wobrschalek/mms | e51c25148e0ec5f51fbf5f3425d23a457d7f382d | 80466eff059d7fc014e4461e88b844eb925480d2 | refs/heads/master | 2020-03-18T15:35:49.938948 | 2018-03-10T04:53:13 | 2018-03-10T04:53:13 | 134,916,795 | 0 | 0 | null | 2018-05-26T00:35:25 | 2018-05-26T00:35:25 | null | UTF-8 | Java | false | false | 7,488 | java | package gov.nasa.jpl.view_repo.actions;
import java.util.List;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.model.Repository;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.extensions.webscripts.Status;
import gov.nasa.jpl.view_repo.util.EmsScriptNode;
import gov.nasa.jpl.view_repo.util.NodeUtil;
import gov.nasa.jpl.view_repo.webscripts.HostnameGet;
import gov.nasa.jpl.view_repo.webscripts.HtmlToPdfPost;
/**
* Action for converting HTML to PDF in the background asynchronously
*
* @author lho
*
*/
public class HtmlToPdfActionExecuter extends ActionExecuterAbstractBase {
static Logger logger = Logger.getLogger(HtmlToPdfActionExecuter.class);
/**
* Injected variables from Spring configuration
*/
private ServiceRegistry services;
private Repository repository;
private StringBuffer response = new StringBuffer();
private Status responseStatus;
// Parameter values to be passed in when the action is created
public static final String NAME = "htmlToPdf";
public static final String PARAM_SITE_NAME = "siteName";
public static final String PARAM_DOCUMENT_ID = "documentId";
public static final String PARAM_COVER = "cover";
public static final String PARAM_HTML = "html";
public static final String PARAM_HEADER = "header";
public static final String PARAM_FOOTER = "footer";
public static final String PARAM_TAG_ID = "tagId";
public static final String PARAM_DOC_NUM = "docnum";
public static final String PARAM_VERSION = "version";
public static final String PARAM_TIME_STAMP = "timeStamp";
public static final String PARAM_DISPLAY_TIME = "displayTime";
public static final String PARAM_CUSTOM_CSS = "customCss";
public static final String PARAM_WORKSPACE = "workspace";
public static final String PARAM_POST_JSON = "postJson";
public static final String PARAM_TOC = "toc";
public static final String PARAM_TOF = "tof";
public static final String PARAM_TOT = "tot";
public static final String PARAM_INDEX = "index";
public static final String PARAM_DISABLED_COVER_PAGE = "disabledCoverPage";
public void setRepository(Repository rep) {
repository = rep;
}
public void setServices(ServiceRegistry sr) {
services = sr;
}
public HtmlToPdfActionExecuter() {
super();
}
public HtmlToPdfActionExecuter(Repository repositoryHelper,
ServiceRegistry registry) {
super();
setRepository(repositoryHelper);
setServices(registry);
}
@Override
protected void executeImpl(Action action, NodeRef nodeRef) {
HtmlToPdfActionExecuter instance = new HtmlToPdfActionExecuter(
repository, services);
instance.clearCache();
instance.executeImplImpl(action, nodeRef);
}
private void executeImplImpl(final Action action, final NodeRef nodeRef) {
EmsScriptNode jobNode = new EmsScriptNode(nodeRef, services, response);
String documentId = (String) action
.getParameterValue(PARAM_DOCUMENT_ID);
String tagId = (String) action.getParameterValue(PARAM_TAG_ID);
String timeStamp = (String) action.getParameterValue(PARAM_TIME_STAMP);
String htmlContent = (String) action.getParameterValue(PARAM_HTML);
String coverContent = (String) action.getParameterValue(PARAM_COVER);
String toc = (String) action.getParameterValue(PARAM_TOC);
String tof = (String) action.getParameterValue(PARAM_TOF);
String tot = (String) action.getParameterValue(PARAM_TOT);
String indices = (String) action.getParameterValue(PARAM_INDEX);
String headerContent = (String) action.getParameterValue(PARAM_HEADER);
String footerContent = (String) action.getParameterValue(PARAM_FOOTER);
String docNum = (String) action.getParameterValue(PARAM_DOC_NUM);
String displayTime = (String) action.getParameterValue(PARAM_DISPLAY_TIME);
String customCss = (String) action.getParameterValue(PARAM_CUSTOM_CSS);
String disabledCvrPg = (String)action.getParameterValue(PARAM_DISABLED_COVER_PAGE);
timeStamp = timeStamp.toLowerCase().replace("/", "-").replaceAll("\\s+", "").replaceAll("[^A-Za-z0-9]", "");
Boolean disabledCoverPage = false;
if(!StringUtils.isEmpty(disabledCvrPg)) disabledCoverPage = Boolean.parseBoolean(disabledCvrPg);
HtmlToPdfPost htmlToPdf = new HtmlToPdfPost(repository, services);
EmsScriptNode pdfNode = null;
try{
pdfNode = htmlToPdf.convert(documentId, tagId, timeStamp,
htmlContent, coverContent, toc, tof, tot, indices, headerContent, footerContent, docNum, displayTime, customCss, disabledCoverPage);
response.append(htmlToPdf.getResponse().toString());
response.append("Sending email to user...");
}
catch(Throwable ex){
ex.printStackTrace();
}
finally{
//htmlToPdf.cleanupFiles();
sendEmail(jobNode, pdfNode, response);
}
}
protected void sendEmail(EmsScriptNode jobNode, EmsScriptNode pdfNode,
StringBuffer response) {
String status = (pdfNode != null) ? "completed"
: "completed with errors";
String subject = String.format("HTML to PDF generation %s.", status);
EmsScriptNode logNode = ActionUtil.saveLogToFile(jobNode,
MimetypeMap.MIMETYPE_TEXT_PLAIN, services,
subject + System.lineSeparator() + System.lineSeparator()
+ response.toString());
String msg = buildEmailMessage(pdfNode, response, logNode);
ActionUtil.sendEmailToModifier(jobNode, msg, subject, services);
if (logger.isDebugEnabled())
logger.debug("Completed HTML to PDF generation.");
}
protected String buildEmailMessage(EmsScriptNode pdfNode,
StringBuffer response, EmsScriptNode logNode) {
StringBuffer buf = new StringBuffer();
HostnameGet hostnameGet = new HostnameGet(this.repository,
this.services);
String contextUrl = hostnameGet.getAlfrescoUrl() + "/share/page/document-details?nodeRef=";
if (pdfNode == null) {
buf.append("HTML to PDF generation completed with errors. Please review the below link for detailed information.");
} else {
buf.append("HTML to PDF generation succeeded.");
buf.append(System.lineSeparator());
buf.append(System.lineSeparator());
buf.append("You can access the PDF file at ");
buf.append(contextUrl + pdfNode.getNodeRef().getStoreRef().getProtocol() + "://" + pdfNode.getNodeRef().getStoreRef().getIdentifier() + "/" + pdfNode.getNodeRef().getId());
}
buf.append(System.lineSeparator());
buf.append(System.lineSeparator());
//EmsScriptNode parentNode = null;
//if(pdfNode != null) parentNode = pdfNode.getParent();
//if(parentNode != null){
// String shareUrl = hostnameGet.getShareUrl();
// buf.append("Directory link: ");
// buf.append(shareUrl);
// buf.append("/share/page/repository#filter=path%7C%2F");
// buf.append(parentNode.getUrl().replace("/d/d",""));
// buf.append(System.lineSeparator());
// buf.append(System.lineSeparator());
//}
//buf.append("Log: ");
//buf.append(contextUrl);
//buf.append(logNode.getUrl().replace("/d/d",""));
return buf.toString();
}
protected void clearCache() {
response = new StringBuffer();
responseStatus = new Status();
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
// TODO Auto-generated method stub
}
}
| [
"jason.han@jpl.nasa.gov"
] | jason.han@jpl.nasa.gov |
bf78c81841ae9919d1cdc82e26e6d8cce587dc33 | 937ced9eab5f8f9143e782f822d79935d238de5d | /app/src/main/java/com/hunter/appstreetassignment/detail/DbImage.java | 4dac7be3dd7f28a079576f88b189ede3a151cf10 | [] | no_license | SMARTVIK/AppStreetAssignment | edf4fbbb979c2cc7a15a7bfcaf80b1aef1bbbda0 | 79b5774a837dd6f402d4f0cc815f1e0a81ed09fe | refs/heads/master | 2020-03-29T15:47:07.058353 | 2018-09-25T12:19:29 | 2018-09-25T12:19:29 | 150,080,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.hunter.appstreetassignment.detail;
public class DbImage {
}
| [
"vivek@groomefy.com"
] | vivek@groomefy.com |
b53b3814b1476e379d90d68f0d5aace995a2bf6d | 738b64e2fa1afe798133ff70be0a698372d1f89f | /src/java/controllers/KorisnikController.java | 07eb9c7e454f8f87f7ca7e69f437db8a5f1da566 | [] | no_license | tekosds/Imenik | ada358a7975035a482b348862dac93ef51defc3e | 143369c805f0b5a2175194b99e6bd1432ce76403 | refs/heads/master | 2021-01-21T11:11:13.455475 | 2017-03-01T11:11:25 | 2017-03-01T11:11:25 | 83,532,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,476 | 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 controllers;
import static java.lang.System.in;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.inject.Scope;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import modeli.KontaktModel;
import modeli.KorisnikModel;
import org.json.JSONArray;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import pojo.Kontakt;
import pojo.Korisnik;
/**
*
* @author PC
*/
@Controller
@RequestMapping(value = "/korisnik")
public class KorisnikController {
private int idLogovanog = 0;
@RequestMapping(value = "/prijava", method = RequestMethod.GET)
public ModelAndView prijava(ModelMap mm) {
mm.addAttribute("view", "korisnik/prijava");
ModelAndView modelAndView = new ModelAndView("logovanje");
return modelAndView;
}
@RequestMapping(value = "/pregled", method = RequestMethod.GET)
public ModelAndView pregled(ModelMap mm) {
KorisnikModel km = new KorisnikModel();
Korisnik korisnik = km.find(idLogovanog);
mm.addAttribute("korisnik", korisnik);
mm.addAttribute("view", "pocetna");
ModelAndView modelAndView = new ModelAndView("layout");
return modelAndView;
}
@RequestMapping(value = "/registracija", method = RequestMethod.GET)
public ModelAndView registracija(ModelMap mm) {
mm.addAttribute("view", "korisnik/registracija");
ModelAndView modelAndView = new ModelAndView("logovanje");
return modelAndView;
}
@RequestMapping(value = "/kreiraj", method = RequestMethod.POST)
public ModelAndView kreiraj(@ModelAttribute("form") Korisnik korisnik, ModelMap model) {
KorisnikModel km = new KorisnikModel();
km.create(korisnik);
model.addAttribute("view", "korisnik/prijava");
ModelAndView modelAndView = new ModelAndView("logovanje");
return modelAndView;
}
@RequestMapping(value = "/pocetna/{idLogovanog}", method = RequestMethod.POST)
public ModelAndView pocetna(@PathVariable int idLogovanog, ModelMap model) {
KorisnikModel km = new KorisnikModel();
Korisnik k = km.find(idLogovanog);
model.addAttribute("korisnik", k);
model.addAttribute("view", "pocetna");
ModelAndView modelAndView = new ModelAndView("logovanje");
return modelAndView;
}
@RequestMapping(value = "/prijavljivanje", method = RequestMethod.POST)
public ModelAndView prijavljivanje(@ModelAttribute("form") Korisnik korisnik, ModelMap model, HttpServletRequest request, HttpServletResponse response) {
KorisnikModel km = new KorisnikModel();
korisnik.setId(0);
List<Korisnik> korisnici = km.findKorisnika(korisnik);
for(Korisnik k : korisnici){
if (k.getUsername().equals(korisnik.getUsername()) && k.getPassword().equals(korisnik.getPassword())){
korisnik.setId(k.getId());
korisnik.setEmail(k.getEmail());
korisnik.setPhoneNumber(k.getPhoneNumber());
}
}
if(korisnik.getId()!=0){
request.getSession().setAttribute("logovani", korisnik);
request.setAttribute("idLogovanog", korisnik.getId());
idLogovanog = korisnik.getId();
model.addAttribute("korisnik", korisnik);
model.addAttribute("view", "pocetna");
ModelAndView modelAndView = new ModelAndView("layout");
return modelAndView;
}
else {
model.addAttribute("view", "korisnik/prijava");
ModelAndView modelAndView = new ModelAndView("logovanje");
return modelAndView;
}
}
}
| [
"tekosds@gmail.com"
] | tekosds@gmail.com |
09659f471ffd1ab04bf35460b89f2b777c180d53 | 6b1616f9a27f18597d0d683cf6273d050d47bc47 | /src/main/java/com/iviberberi/spring5recipeapp/converters/CategoryToCategoryCommand.java | cdd52790bf395454d5c3b5fb3e974c1c48b10f69 | [] | no_license | Mr-randomize/spring5-recipe-app | 550d4a78183f00ad5007d2c8e98018f2478b44f5 | d02cda40c401dd16027a4e0900d5a4924df694a9 | refs/heads/master | 2021-06-17T21:07:30.466600 | 2021-04-06T09:39:37 | 2021-04-06T09:39:37 | 192,751,623 | 0 | 0 | null | 2019-06-19T14:45:39 | 2019-06-19T14:45:39 | null | UTF-8 | Java | false | false | 848 | java | package com.iviberberi.spring5recipeapp.converters;
import com.iviberberi.spring5recipeapp.commands.CategoryCommand;
import com.iviberberi.spring5recipeapp.domain.Category;
import lombok.Synchronized;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
@Component
public class CategoryToCategoryCommand implements Converter<Category, CategoryCommand> {
@Synchronized
@Nullable
@Override
public CategoryCommand convert(Category source) {
if (source == null) {
return null;
}
final CategoryCommand categoryCommand = new CategoryCommand();
categoryCommand.setId(source.getId());
categoryCommand.setDescription(source.getDescription());
return categoryCommand;
}
}
| [
"iviberberi@gmail.com"
] | iviberberi@gmail.com |
8eba1fba0b2ac0da21562626a9fa7c4bef8572a7 | d1bd1246f161b77efb418a9c24ee544d59fd1d20 | /java/Raptor/src/org/javenstudio/raptor/bigdb/replication/regionserver/ReplicationSource.java | e8345b94428bc063493a80f9a52cca56911137d5 | [] | no_license | navychen2003/javen | f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a | a3c2312bc24356b1c58b1664543364bfc80e816d | refs/heads/master | 2021-01-20T12:12:46.040953 | 2015-03-03T06:14:46 | 2015-03-03T06:14:46 | 30,912,222 | 0 | 1 | null | 2023-03-20T11:55:50 | 2015-02-17T10:24:28 | Java | UTF-8 | Java | false | false | 23,810 | java | package org.javenstudio.raptor.bigdb.replication.regionserver;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.NavigableMap;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.javenstudio.common.util.Logger;
import org.javenstudio.raptor.conf.Configuration;
import org.javenstudio.raptor.fs.FileStatus;
import org.javenstudio.raptor.fs.FileSystem;
import org.javenstudio.raptor.fs.Path;
import org.javenstudio.raptor.bigdb.DBConstants;
import org.javenstudio.raptor.bigdb.DBServerAddress;
import org.javenstudio.raptor.bigdb.KeyValue;
import org.javenstudio.raptor.bigdb.client.DBConnection;
import org.javenstudio.raptor.bigdb.client.DBConnectionManager;
import org.javenstudio.raptor.bigdb.ipc.DBRegionInterface;
import org.javenstudio.raptor.bigdb.regionserver.wal.DBLog;
import org.javenstudio.raptor.bigdb.regionserver.wal.DBLogKey;
import org.javenstudio.raptor.bigdb.regionserver.wal.WALEdit;
import org.javenstudio.raptor.bigdb.replication.ReplicationPaxosWrapper;
import org.javenstudio.raptor.bigdb.util.Bytes;
import org.javenstudio.raptor.bigdb.util.Threads;
/**
* Class that handles the source of a replication stream.
* Currently does not handle more than 1 slave
* For each slave cluster it selects a random number of peers
* using a replication ratio. For example, if replication ration = 0.1
* and slave cluster has 100 region servers, 10 will be selected.
* <p/>
* A stream is considered down when we cannot contact a region server on the
* peer cluster for more than 55 seconds by default.
* <p/>
*
*/
public class ReplicationSource extends Thread
implements ReplicationSourceInterface {
private static final Logger LOG = Logger.getLogger(ReplicationSource.class);
// Queue of logs to process
private PriorityBlockingQueue<Path> queue;
// container of entries to replicate
private DBLog.Entry[] entriesArray;
private DBConnection conn;
// Helper class for paxos
private ReplicationPaxosWrapper zkHelper;
private Configuration conf;
// ratio of region servers to chose from a slave cluster
private float ratio;
private Random random;
// should we replicate or not?
private AtomicBoolean replicating;
// id of the peer cluster this source replicates to
private String peerClusterId;
// The manager of all sources to which we ping back our progress
private ReplicationSourceManager manager;
// Should we stop everything?
private AtomicBoolean stop;
// List of chosen sinks (region servers)
private List<DBServerAddress> currentPeers;
// How long should we sleep for each retry
private long sleepForRetries;
// Max size in bytes of entriesArray
private long replicationQueueSizeCapacity;
// Max number of entries in entriesArray
private int replicationQueueNbCapacity;
// Our reader for the current log
private DBLog.Reader reader;
// Current position in the log
private long position = 0;
// Path of the current log
private volatile Path currentPath;
private FileSystem fs;
// id of this cluster
private byte clusterId;
// total number of edits we replicated
private long totalReplicatedEdits = 0;
// The znode we currently play with
private String peerClusterZnode;
// Indicates if this queue is recovered (and will be deleted when depleted)
private boolean queueRecovered;
// List of all the dead region servers that had this queue (if recovered)
private String[] deadRegionServers;
// Maximum number of retries before taking bold actions
private long maxRetriesMultiplier;
// Current number of entries that we need to replicate
private int currentNbEntries = 0;
// Current number of operations (Put/Delete) that we need to replicate
private int currentNbOperations = 0;
// Indicates if this particular source is running
private volatile boolean running = true;
// Metrics for this source
private ReplicationSourceMetrics metrics;
/**
* Instantiation method used by region servers
*
* @param conf configuration to use
* @param fs file system to use
* @param manager replication manager to ping to
* @param stopper the atomic boolean to use to stop the regionserver
* @param replicating the atomic boolean that starts/stops replication
* @param peerClusterZnode the name of our znode
* @throws IOException
*/
public void init(final Configuration conf,
final FileSystem fs,
final ReplicationSourceManager manager,
final AtomicBoolean stopper,
final AtomicBoolean replicating,
final String peerClusterZnode)
throws IOException {
this.stop = stopper;
this.conf = conf;
this.replicationQueueSizeCapacity =
this.conf.getLong("replication.source.size.capacity", 1024*1024*64);
this.replicationQueueNbCapacity =
this.conf.getInt("replication.source.nb.capacity", 25000);
this.entriesArray = new DBLog.Entry[this.replicationQueueNbCapacity];
for (int i = 0; i < this.replicationQueueNbCapacity; i++) {
this.entriesArray[i] = new DBLog.Entry();
}
this.maxRetriesMultiplier =
this.conf.getLong("replication.source.maxretriesmultiplier", 10);
this.queue =
new PriorityBlockingQueue<Path>(
conf.getInt("bigdb.regionserver.maxlogs", 32),
new LogsComparator());
this.conn = DBConnectionManager.getConnection(conf);
this.zkHelper = manager.getRepZkWrapper();
this.ratio = this.conf.getFloat("replication.source.ratio", 0.1f);
this.currentPeers = new ArrayList<DBServerAddress>();
this.random = new Random();
this.replicating = replicating;
this.manager = manager;
this.sleepForRetries =
this.conf.getLong("replication.source.sleepforretries", 1000);
this.fs = fs;
this.clusterId = Byte.valueOf(zkHelper.getClusterId());
this.metrics = new ReplicationSourceMetrics(peerClusterZnode);
// Finally look if this is a recovered queue
this.checkIfQueueRecovered(peerClusterZnode);
}
// The passed znode will be either the id of the peer cluster or
// the handling story of that queue in the form of id-servername-*
private void checkIfQueueRecovered(String peerClusterZnode) {
String[] parts = peerClusterZnode.split("-");
this.queueRecovered = parts.length != 1;
this.peerClusterId = this.queueRecovered ?
parts[0] : peerClusterZnode;
this.peerClusterZnode = peerClusterZnode;
this.deadRegionServers = new String[parts.length-1];
// Extract all the places where we could find the hlogs
for (int i = 1; i < parts.length; i++) {
this.deadRegionServers[i-1] = parts[i];
}
}
/**
* Select a number of peers at random using the ratio. Mininum 1.
*/
private void chooseSinks() {
this.currentPeers.clear();
List<DBServerAddress> addresses =
this.zkHelper.getPeersAddresses(peerClusterId);
Set<DBServerAddress> setOfAddr = new HashSet<DBServerAddress>();
int nbPeers = (int) (Math.ceil(addresses.size() * ratio));
LOG.info("Getting " + nbPeers +
" rs from peer cluster # " + peerClusterId);
for (int i = 0; i < nbPeers; i++) {
DBServerAddress address;
// Make sure we get one address that we don't already have
do {
address = addresses.get(this.random.nextInt(addresses.size()));
} while (setOfAddr.contains(address));
LOG.info("Choosing peer " + address);
setOfAddr.add(address);
}
this.currentPeers.addAll(setOfAddr);
}
@Override
public void enqueueLog(Path log) {
this.queue.put(log);
this.metrics.sizeOfLogQueue.set(queue.size());
}
@Override
public void run() {
connectToPeers();
// We were stopped while looping to connect to sinks, just abort
if (this.stop.get()) {
return;
}
// If this is recovered, the queue is already full and the first log
// normally has a position (unless the RS failed between 2 logs)
if (this.queueRecovered) {
this.position = this.zkHelper.getDBLogRepPosition(
this.peerClusterZnode, this.queue.peek().getName());
}
int sleepMultiplier = 1;
// Loop until we close down
while (!stop.get() && this.running) {
// Get a new path
if (!getNextPath()) {
if (sleepForRetries("No log to process", sleepMultiplier)) {
sleepMultiplier++;
}
continue;
}
// Open a reader on it
if (!openReader(sleepMultiplier)) {
// Reset the sleep multiplier, else it'd be reused for the next file
sleepMultiplier = 1;
continue;
}
// If we got a null reader but didn't continue, then sleep and continue
if (this.reader == null) {
if (sleepForRetries("Unable to open a reader", sleepMultiplier)) {
sleepMultiplier++;
}
continue;
}
boolean gotIOE = false;
currentNbEntries = 0;
try {
if(readAllEntriesToReplicateOrNextFile()) {
continue;
}
} catch (IOException ioe) {
LOG.warn(peerClusterZnode + " Got: ", ioe);
gotIOE = true;
if (ioe.getCause() instanceof EOFException) {
boolean considerDumping = false;
if (this.queueRecovered) {
try {
FileStatus stat = this.fs.getFileStatus(this.currentPath);
if (stat.getLen() == 0) {
LOG.warn(peerClusterZnode + " Got EOF and the file was empty");
}
considerDumping = true;
} catch (IOException e) {
LOG.warn(peerClusterZnode + " Got while getting file size: ", e);
}
} else if (currentNbEntries != 0) {
LOG.warn(peerClusterZnode + " Got EOF while reading, " +
"looks like this file is broken? " + currentPath);
considerDumping = true;
currentNbEntries = 0;
}
if (considerDumping &&
sleepMultiplier == this.maxRetriesMultiplier &&
processEndOfFile()) {
continue;
}
}
} finally {
try {
// if current path is null, it means we processEndOfFile hence
if (this.currentPath != null && !gotIOE) {
this.position = this.reader.getPosition();
}
if (this.reader != null) {
this.reader.close();
}
} catch (IOException e) {
gotIOE = true;
LOG.warn("Unable to finalize the tailing of a file", e);
}
}
// If we didn't get anything to replicate, or if we hit a IOE,
// wait a bit and retry.
// But if we need to stop, don't bother sleeping
if (!stop.get() && (gotIOE || currentNbEntries == 0)) {
if (sleepForRetries("Nothing to replicate", sleepMultiplier)) {
sleepMultiplier++;
}
continue;
}
sleepMultiplier = 1;
shipEdits();
}
LOG.debug("Source exiting " + peerClusterId);
}
/**
* Read all the entries from the current log files and retain those
* that need to be replicated. Else, process the end of the current file.
* @return true if we got nothing and went to the next file, false if we got
* entries
* @throws IOException
*/
protected boolean readAllEntriesToReplicateOrNextFile() throws IOException{
long seenEntries = 0;
if (this.position != 0) {
this.reader.seek(this.position);
}
DBLog.Entry entry = this.reader.next(this.entriesArray[currentNbEntries]);
while (entry != null) {
WALEdit edit = entry.getEdit();
this.metrics.logEditsReadRate.inc(1);
seenEntries++;
// Remove all KVs that should not be replicated
removeNonReplicableEdits(edit);
DBLogKey logKey = entry.getKey();
// Don't replicate catalog entries, if the WALEdit wasn't
// containing anything to replicate and if we're currently not set to replicate
if (!(Bytes.equals(logKey.getTablename(), DBConstants.ROOT_TABLE_NAME) ||
Bytes.equals(logKey.getTablename(), DBConstants.META_TABLE_NAME)) &&
edit.size() != 0 && replicating.get()) {
logKey.setClusterId(this.clusterId);
currentNbOperations += countDistinctRowKeys(edit);
currentNbEntries++;
} else {
this.metrics.logEditsFilteredRate.inc(1);
}
// Stop if too many entries or too big
if ((this.reader.getPosition() - this.position)
>= this.replicationQueueSizeCapacity ||
currentNbEntries >= this.replicationQueueNbCapacity) {
break;
}
entry = this.reader.next(entriesArray[currentNbEntries]);
}
LOG.debug("currentNbOperations:" + currentNbOperations +
" and seenEntries:" + seenEntries +
" and size: " + (this.reader.getPosition() - this.position));
// If we didn't get anything and the queue has an object, it means we
// hit the end of the file for sure
return seenEntries == 0 && processEndOfFile();
}
private void connectToPeers() {
// Connect to peer cluster first, unless we have to stop
while (!this.stop.get() && this.currentPeers.size() == 0) {
try {
chooseSinks();
Thread.sleep(this.sleepForRetries);
} catch (InterruptedException e) {
LOG.error("Interrupted while trying to connect to sinks", e);
}
}
}
/**
* Poll for the next path
* @return true if a path was obtained, false if not
*/
protected boolean getNextPath() {
try {
if (this.currentPath == null) {
this.currentPath = queue.poll(this.sleepForRetries, TimeUnit.MILLISECONDS);
this.metrics.sizeOfLogQueue.set(queue.size());
}
} catch (InterruptedException e) {
LOG.warn("Interrupted while reading edits", e);
}
return this.currentPath != null;
}
/**
* Open a reader on the current path
*
* @param sleepMultiplier by how many times the default sleeping time is augmented
* @return true if we should continue with that file, false if we are over with it
*/
protected boolean openReader(int sleepMultiplier) {
try {
LOG.info("Opening log for replication " + this.currentPath.getName() +
" at " + this.position);
try {
this.reader = null;
this.reader = DBLog.getReader(this.fs, this.currentPath, this.conf);
} catch (FileNotFoundException fnfe) {
if (this.queueRecovered) {
// We didn't find the log in the archive directory, look if it still
// exists in the dead RS folder (there could be a chain of failures
// to look at)
for (int i = this.deadRegionServers.length - 1; i > 0; i--) {
Path deadRsDirectory =
new Path(this.manager.getLogDir(), this.deadRegionServers[i]);
Path possibleLogLocation =
new Path(deadRsDirectory, currentPath.getName());
if (this.manager.getFs().exists(possibleLogLocation)) {
// We found the right new location
LOG.info("Log " + this.currentPath + " still exists at " +
possibleLogLocation);
// Breaking here will make us sleep since reader is null
break;
}
}
// TODO What happens if the log was missing from every single location?
// Although we need to check a couple of times as the log could have
// been moved by the master between the checks
} else {
// If the log was archived, continue reading from there
Path archivedLogLocation =
new Path(manager.getOldLogDir(), currentPath.getName());
if (this.manager.getFs().exists(archivedLogLocation)) {
currentPath = archivedLogLocation;
LOG.info("Log " + this.currentPath + " was moved to " +
archivedLogLocation);
// Open the log at the new location
this.openReader(sleepMultiplier);
}
// TODO What happens the log is missing in both places?
}
}
} catch (IOException ioe) {
LOG.warn(peerClusterZnode + " Got: ", ioe);
// TODO Need a better way to determinate if a file is really gone but
// TODO without scanning all logs dir
if (sleepMultiplier == this.maxRetriesMultiplier) {
LOG.warn("Waited too long for this file, considering dumping");
return !processEndOfFile();
}
}
return true;
}
/**
* Do the sleeping logic
* @param msg Why we sleep
* @param sleepMultiplier by how many times the default sleeping time is augmented
* @return
*/
protected boolean sleepForRetries(String msg, int sleepMultiplier) {
try {
LOG.debug(msg + ", sleeping " + sleepForRetries + " times " + sleepMultiplier);
Thread.sleep(this.sleepForRetries * sleepMultiplier);
} catch (InterruptedException e) {
LOG.debug("Interrupted while sleeping between retries");
}
return sleepMultiplier < maxRetriesMultiplier;
}
/**
* We only want KVs that are scoped other than local
* @param edit The KV to check for replication
*/
protected void removeNonReplicableEdits(WALEdit edit) {
NavigableMap<byte[], Integer> scopes = edit.getScopes();
List<KeyValue> kvs = edit.getKeyValues();
for (int i = 0; i < edit.size(); i++) {
KeyValue kv = kvs.get(i);
// The scope will be null or empty if
// there's nothing to replicate in that WALEdit
if (scopes == null || !scopes.containsKey(kv.getFamily())) {
kvs.remove(i);
i--;
}
}
}
/**
* Count the number of different row keys in the given edit because of
* mini-batching. We assume that there's at least one KV in the WALEdit.
* @param edit edit to count row keys from
* @return number of different row keys
*/
private int countDistinctRowKeys(WALEdit edit) {
List<KeyValue> kvs = edit.getKeyValues();
int distinctRowKeys = 1;
KeyValue lastKV = kvs.get(0);
for (int i = 0; i < edit.size(); i++) {
if (!kvs.get(i).matchingRow(lastKV)) {
distinctRowKeys++;
}
}
return distinctRowKeys;
}
/**
* Do the shipping logic
*/
protected void shipEdits() {
int sleepMultiplier = 1;
while (!stop.get()) {
try {
DBRegionInterface rrs = getRS();
LOG.debug("Replicating " + currentNbEntries);
rrs.replicateLogEntries(Arrays.copyOf(this.entriesArray, currentNbEntries));
this.manager.logPositionAndCleanOldLogs(this.currentPath,
this.peerClusterZnode, this.position, queueRecovered);
this.totalReplicatedEdits += currentNbEntries;
this.metrics.shippedBatchesRate.inc(1);
this.metrics.shippedOpsRate.inc(
this.currentNbOperations);
this.metrics.setAgeOfLastShippedOp(
this.entriesArray[this.entriesArray.length-1].getKey().getWriteTime());
LOG.debug("Replicated in total: " + this.totalReplicatedEdits);
break;
} catch (IOException ioe) {
LOG.warn("Unable to replicate because ", ioe);
try {
boolean down;
do {
down = isSlaveDown();
if (down) {
LOG.debug("The region server we tried to ping didn't answer, " +
"sleeping " + sleepForRetries + " times " + sleepMultiplier);
Thread.sleep(this.sleepForRetries * sleepMultiplier);
if (sleepMultiplier < maxRetriesMultiplier) {
sleepMultiplier++;
} else {
chooseSinks();
}
}
} while (!stop.get() && down);
} catch (InterruptedException e) {
LOG.debug("Interrupted while trying to contact the peer cluster");
}
}
}
}
/**
* If the queue isn't empty, switch to the next one
* Else if this is a recovered queue, it means we're done!
* Else we'll just continue to try reading the log file
* @return true if we're done with the current file, false if we should
* continue trying to read from it
*/
protected boolean processEndOfFile() {
if (this.queue.size() != 0) {
this.currentPath = null;
this.position = 0;
return true;
} else if (this.queueRecovered) {
this.manager.closeRecoveredQueue(this);
this.abort();
return true;
}
return false;
}
public void startup() {
String n = Thread.currentThread().getName();
Thread.UncaughtExceptionHandler handler =
new Thread.UncaughtExceptionHandler() {
public void uncaughtException(final Thread t, final Throwable e) {
LOG.fatal("Set stop flag in " + t.getName(), e);
abort();
}
};
Threads.setDaemonThreadRunning(
this, n + ".replicationSource," + clusterId, handler);
}
/**
* Hastily stop the replication, then wait for shutdown
*/
private void abort() {
LOG.info("abort");
this.running = false;
terminate();
}
public void terminate() {
LOG.info("terminate");
Threads.shutdown(this, this.sleepForRetries);
}
/**
* Get a new region server at random from this peer
* @return
* @throws IOException
*/
private DBRegionInterface getRS() throws IOException {
if (this.currentPeers.size() == 0) {
throw new IOException(this.peerClusterZnode + " has 0 region servers");
}
DBServerAddress address =
currentPeers.get(random.nextInt(this.currentPeers.size()));
return this.conn.getDBRegionConnection(address);
}
/**
* Check if the slave is down by trying to establish a connection
* @return true if down, false if up
* @throws InterruptedException
*/
public boolean isSlaveDown() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
Thread pingThread = new Thread() {
public void run() {
try {
DBRegionInterface rrs = getRS();
// Dummy call which should fail
rrs.getDBServerInfo();
latch.countDown();
} catch (IOException ex) {
LOG.info("Slave cluster looks down: " + ex.getMessage());
}
}
};
pingThread.start();
// awaits returns true if countDown happened
boolean down = ! latch.await(this.sleepForRetries, TimeUnit.MILLISECONDS);
pingThread.interrupt();
return down;
}
/**
* Get the id that the source is replicating to
*
* @return peer cluster id
*/
public String getPeerClusterZnode() {
return this.peerClusterZnode;
}
/**
* Get the path of the current DBLog
* @return current hlog's path
*/
public Path getCurrentPath() {
return this.currentPath;
}
/**
* Comparator used to compare logs together based on their start time
*/
public static class LogsComparator implements Comparator<Path> {
@Override
public int compare(Path o1, Path o2) {
return Long.valueOf(getTS(o1)).compareTo(getTS(o2));
}
@Override
public boolean equals(Object o) {
return true;
}
/**
* Split a path to get the start time
* For example: 10.20.20.171%3A60020.1277499063250
* @param p path to split
* @return start time
*/
private long getTS(Path p) {
String[] parts = p.getName().split("\\.");
return Long.parseLong(parts[parts.length-1]);
}
}
}
| [
"navychen2003@hotmail.com"
] | navychen2003@hotmail.com |
5031761f852e41463d13375e93be5dd0220c764a | 21ae8c3c78b541ab35fe1f6d484b1065bf8fe616 | /target/tomcat/work/Tomcat/localhost/jeecg/org/apache/jsp/webpage/system/log/userBroswerPie_jsp.java | a60a45bef9f01c5bdf416048ab1da7b186a4dde5 | [] | no_license | teduFanechka/jeecg | c114bfc6e85851fbd47b4448addaf70c556757a2 | 96e19fc06fb4bced39672b45e8a72308287c4f03 | refs/heads/master | 2020-04-17T21:36:11.444504 | 2019-02-18T00:35:57 | 2019-02-18T00:35:57 | 166,957,698 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 12,597 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2018-04-12 07:29:42 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.webpage.system.log;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class userBroswerPie_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("/WEB-INF/tld/easyui.tld", Long.valueOf(1523501919062L));
_jspx_dependants.put("/context/mytags.jsp", Long.valueOf(1521446129245L));
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ft_005fmutiLang_0026_005flangKey_005fnobody;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005ft_005fmutiLang_0026_005flangKey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.release();
_005fjspx_005ftagPool_005ft_005fmutiLang_0026_005flangKey_005fnobody.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
out.write('\n');
// c:set
org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_005fset_005f0 = (org.apache.taglibs.standard.tag.rt.core.SetTag) _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
_jspx_th_c_005fset_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fset_005f0.setParent(null);
// /context/mytags.jsp(9,0) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fset_005f0.setVar("webRoot");
// /context/mytags.jsp(9,0) name = value type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fset_005f0.setValue(basePath);
int _jspx_eval_c_005fset_005f0 = _jspx_th_c_005fset_005f0.doStartTag();
if (_jspx_th_c_005fset_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f0);
return;
}
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f0);
out.write('\n');
if (_jspx_meth_c_005fset_005f1(_jspx_page_context))
return;
out.write("\n");
out.write("<script type=\"text/javascript\">\n");
out.write("\t$(function() {\n");
out.write("\t\t$(document).ready(function() {\n");
out.write("\t\t\tvar chart;\n");
out.write("\t\t\t$.ajax({\n");
out.write("\t\t\t\ttype : \"POST\",\n");
out.write("\t\t\t\turl : \"logController.do?getBroswerBar&reportType=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${reportType}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\",\n");
out.write("\t\t\t\tsuccess : function(jsondata) {\n");
out.write("\t\t\t\t\tdata = eval(jsondata);\n");
out.write("\t\t\t\t\tchart = new Highcharts.Chart({\n");
out.write("\t\t\t\t\t\tchart : {\n");
out.write("\t\t\t\t\t\t\trenderTo : 'containerPie',\n");
out.write("\t\t\t\t\t\t\tplotBackgroundColor : null,\n");
out.write("\t\t\t\t\t\t\tplotBorderWidth : null,\n");
out.write("\t\t\t\t\t\t\tplotShadow : false\n");
out.write("\t\t\t\t\t\t},\n");
out.write("\t\t\t\t\t\ttitle : {\n");
out.write("\t\t\t\t\t\t\ttext : \"");
if (_jspx_meth_t_005fmutiLang_005f0(_jspx_page_context))
return;
out.write("\"\n");
out.write("\t\t\t\t\t\t},\n");
out.write("\t\t\t\t\t\txAxis : {\n");
out.write("\t\t\t\t\t\t\tcategories : [ 'IE9', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 7.0', 'Firefox', 'Chrome' ]\n");
out.write("\t\t\t\t\t\t},\n");
out.write("\t\t\t\t\t\ttooltip : {\n");
out.write("\t\t\t\t\t\t\tshadow: false,\n");
out.write("\t\t\t\t\t\t\tpercentageDecimals : 1,\n");
out.write("\t\t\t\t\t\t\tformatter: function() {\n");
out.write(" \t\t\t\t\treturn '<b>'+this.point.name + '</b>:' + Highcharts.numberFormat(this.percentage, 1) +'%';\n");
out.write(" \t\t\t\t\t}\n");
out.write("\n");
out.write("\t\t\t\t\t\t},\n");
out.write("\t\t\t\t\t\texporting:{ \n");
out.write("\t\t\t filename:'pie', \n");
out.write("\t\t\t url:'");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${ctxPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("/logController.do?export' \n");
out.write("\t\t\t }, \n");
out.write("\t\t\t\t\t\tplotOptions : {\n");
out.write("\t\t\t\t\t\t\tpie : {\n");
out.write("\t\t\t\t\t\t\t\tallowPointSelect : true,\n");
out.write("\t\t\t\t\t\t\t\tcursor : 'pointer',\n");
out.write("\t\t\t\t\t\t\t\tshowInLegend : true,\n");
out.write("\t\t\t\t\t\t\t\tdataLabels : {\n");
out.write("\t\t\t\t\t\t\t\t\tenabled : true,\n");
out.write("\t\t\t\t\t\t\t\t\tcolor : '#000000',\n");
out.write("\t\t\t\t\t\t\t\t\tconnectorColor : '#000000',\n");
out.write("\t\t\t\t\t\t\t\t\tformatter : function() {\n");
out.write("\t\t\t\t\t\t\t\t\t\treturn '<b>' + this.point.name + '</b>: ' + Highcharts.numberFormat(this.percentage, 1)+\"%\";\n");
out.write("\t\t\t\t\t\t\t\t\t}\n");
out.write("\t\t\t\t\t\t\t\t}\n");
out.write("\t\t\t\t\t\t\t}\n");
out.write("\t\t\t\t\t\t},\n");
out.write("\t\t\t\t\t\tseries : data\n");
out.write("\t\t\t\t\t});\n");
out.write("\t\t\t\t}\n");
out.write("\t\t\t});\n");
out.write("\t\t});\n");
out.write("\t});\n");
out.write("</script>\n");
out.write("<div id=\"containerPie\" style=\"width: 80%; height: 80%\"></div>\n");
out.write("\n");
out.write("\n");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fset_005f1(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:set
org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_005fset_005f1 = (org.apache.taglibs.standard.tag.rt.core.SetTag) _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
_jspx_th_c_005fset_005f1.setPageContext(_jspx_page_context);
_jspx_th_c_005fset_005f1.setParent(null);
// /webpage/system/log/userBroswerPie.jsp(3,0) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fset_005f1.setVar("ctxPath");
// /webpage/system/log/userBroswerPie.jsp(3,0) name = value type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fset_005f1.setValue(new org.apache.jasper.el.JspValueExpression("/webpage/system/log/userBroswerPie.jsp(3,0) '${pageContext.request.contextPath}'",_el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),"${pageContext.request.contextPath}",java.lang.Object.class)).getValue(_jspx_page_context.getELContext()));
int _jspx_eval_c_005fset_005f1 = _jspx_th_c_005fset_005f1.doStartTag();
if (_jspx_th_c_005fset_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f1);
return true;
}
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f1);
return false;
}
private boolean _jspx_meth_t_005fmutiLang_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// t:mutiLang
org.jeecgframework.tag.core.easyui.MutiLangTag _jspx_th_t_005fmutiLang_005f0 = (org.jeecgframework.tag.core.easyui.MutiLangTag) _005fjspx_005ftagPool_005ft_005fmutiLang_0026_005flangKey_005fnobody.get(org.jeecgframework.tag.core.easyui.MutiLangTag.class);
_jspx_th_t_005fmutiLang_005f0.setPageContext(_jspx_page_context);
_jspx_th_t_005fmutiLang_005f0.setParent(null);
// /webpage/system/log/userBroswerPie.jsp(21,15) name = langKey type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_t_005fmutiLang_005f0.setLangKey("user.browser.analysis");
int _jspx_eval_t_005fmutiLang_005f0 = _jspx_th_t_005fmutiLang_005f0.doStartTag();
if (_jspx_th_t_005fmutiLang_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ft_005fmutiLang_0026_005flangKey_005fnobody.reuse(_jspx_th_t_005fmutiLang_005f0);
return true;
}
_005fjspx_005ftagPool_005ft_005fmutiLang_0026_005flangKey_005fnobody.reuse(_jspx_th_t_005fmutiLang_005f0);
return false;
}
}
| [
"41047253+teduFanechka@users.noreply.github.com"
] | 41047253+teduFanechka@users.noreply.github.com |
15c585020e1ec537a66a23ab70711344c567f7b5 | f7d8f16ad3f200212c9e68551533faadb3cac609 | /MVPDianShang-master/app/src/main/java/com/example/asus/jingdong/view/adapter/HomePagerMiaoAdapte.java | d638c8670035464c1e2e00db7f67d5d91a2f6525 | [] | no_license | chzlx1314/Xiangmu | 8ea74f10a33f1036b5a09dfafb3e263dc1904bee | 0863ee6fc92f128c5d86c6840e89d0a8762530cb | refs/heads/master | 2021-08-12T02:58:53.120026 | 2017-11-14T10:41:06 | 2017-11-14T10:41:06 | 110,677,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,306 | java | package com.example.asus.jingdong.view.adapter;
import android.content.Context;
import android.graphics.Paint;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.asus.jingdong.R;
import com.example.asus.jingdong.model.bean.HomePagerData;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 类描述 首页秒杀页面的适配器
*/
public class HomePagerMiaoAdapte extends RecyclerView.Adapter<HomePagerMiaoAdapte.HolderView> {
Context context;
List<HomePagerData.MiaoshaBean.ListBeanX> list;
public HomePagerMiaoAdapte(Context context, List<HomePagerData.MiaoshaBean.ListBeanX> list) {
this.context = context;
this.list = list;
}
@Override
public HolderView onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.homepage_fragment_miao_item, parent, false);
HolderView viewHolder = new HolderView(view);
return viewHolder;
}
@Override
public void onBindViewHolder(HolderView holder, int position) {
HomePagerData.MiaoshaBean.ListBeanX bean = list.get(position);
holder.miaoPrices.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//数字划线效果
holder.miaoPrices.setText(bean.getBargainPrice()+"");
holder.miaoPrice.setText(bean.getPrice()+"");
String images = bean.getImages();
String[] split = images.split("\\|");
Glide.with(context).load(split[0]).into(holder.miaoImage);
//设置tag值
holder.itemView.setTag(position);
}
@Override
public int getItemCount() {
return list == null ? 0 : list.size();
}
public class HolderView extends RecyclerView.ViewHolder {
@BindView(R.id.miao_image)
ImageView miaoImage;
@BindView(R.id.miao_price)
TextView miaoPrice;
@BindView(R.id.miao_prices)
TextView miaoPrices;
public HolderView(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| [
"31463864+chzlx1314@users.noreply.github.com"
] | 31463864+chzlx1314@users.noreply.github.com |
cbfe025ef3c52c9c3f037a89e74cc40044ca5c2f | 21065c02b35ed0e2a93cb9c648cf6e45704e8025 | /src/main/java/com/spdukraine/pitchbook/googleclone/ServletInitializer.java | 107c0180a1cd926705575a0b8a006d44d0b9ad49 | [] | no_license | IvanLukashchuk/gc | 5510738589c3ba2b03fe49c5c9d75fdb70edaa76 | a3ec10b8eeae45e716c5f0af304df432b811730a | refs/heads/master | 2020-03-27T04:40:56.262357 | 2015-08-17T07:22:35 | 2015-08-17T07:22:35 | 40,841,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.spdukraine.pitchbook.googleclone;
import com.spdukraine.pitchbook.googleclone.config.SpringConfig;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringConfig.class);
}
}
| [
"ivan.lukashchuk@gmail.com"
] | ivan.lukashchuk@gmail.com |
e9578805f4ed562aeb4f6cc160ab5711ea35a5f9 | ed0102dcefb8eff8004e564a20b2e6280f7e6d95 | /clc3-consumer/src/main/java/clc3/consumer/ConsumerConfiguration.java | 18a4c1e25cec6ddfb09208b6b96c1a8313c45b04 | [] | no_license | glockyco/clc3-project | 9b7c48bc11aae484893b313c8f0ee80308b81f79 | 2c1236f8750a772e474afe4ba5fe46bbe4fea8b6 | refs/heads/master | 2022-04-30T06:47:53.245749 | 2020-01-18T07:28:06 | 2020-01-21T10:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | package clc3.consumer;
import clc3.cosmos.CosmosConfiguration;
import clc3.download.DownloadConfiguration;
import clc3.metrics.calculation.MetricsCalculationConfiguration;
import clc3.metrics.persistence.MetricsPersistenceConfiguration;
import clc3.queue.QueueConfiguration;
import clc3.unpacking.UnpackingConfiguration;
import com.google.gson.Gson;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({
CosmosConfiguration.class,
DownloadConfiguration.class,
MetricsCalculationConfiguration.class,
MetricsPersistenceConfiguration.class,
QueueConfiguration.class,
UnpackingConfiguration.class
})
public class ConsumerConfiguration {
@Bean
public Gson gson() {
return new Gson();
}
}
| [
"johann.aichberger@fh-hagenberg.at"
] | johann.aichberger@fh-hagenberg.at |
ae57f9ba1234f652b93c19e973da97cacc414f1e | 5e5a40d02130cbd6cd3e6adb7cc0b66b6a5df6ca | /src/main/java/org/caltech/miniswingpilot/AppConfig.java | e844a80fd7e2b5db5ed25c2d5555f8755efa3325 | [] | no_license | boykis82/ec2test | f8d2d864a3ec93d2a6d8ef0c43f625e1df0f6fe6 | 30679bbeddedd6e5cdcd70bd481e990114b6af8f | refs/heads/master | 2023-04-19T16:31:28.419293 | 2021-04-29T23:56:55 | 2021-04-29T23:56:55 | 360,031,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package org.caltech.miniswingpilot;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.caltech.miniswingpilot.domain.CustTypCd;
import org.caltech.miniswingpilot.util.EnumMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.lang.NonNullApi;
import javax.persistence.EntityManager;
import java.util.Optional;
@Configuration
@EnableJpaAuditing
public class AppConfig {
@Bean
public AuditorAware<String> auditorAware() {
return () -> Optional.of("강인수");
}
@Bean
public JPAQueryFactory jpaQueryFactory(EntityManager em) {
return new JPAQueryFactory(em);
}
@Bean
public EnumMapper enumMapper() {
EnumMapper enumMapper = new EnumMapper();
enumMapper.put("custTypCd", CustTypCd.class);
return enumMapper;
}
}
| [
"boykis82@gmail.com"
] | boykis82@gmail.com |
512411b6d12960fc05481ac41262f708ba020c42 | bf2590d2cbc32bcff82e2f52454ff303d619e3e8 | /src/main/java/com/thrivent/model/Output.java | 0464292d5f46bca89c96880be2f55cb39d255095 | [] | no_license | nisha-ti/test | 0c789985fe7e47db62fe47d2a4088018e6782816 | 75dc4baf277c84db58a703b76ece5e53aca2ee53 | refs/heads/master | 2022-12-29T06:45:17.220542 | 2020-10-14T14:21:04 | 2020-10-14T14:21:04 | 304,033,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,725 | java | package com.thrivent.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"FullName_Input",
"AddressLine1_Input", "City_Input", "StateProvince_Input",
"Email2_Input", "Email4_Input", "user_fields", "PersonIds"})
public class Output {
@JsonProperty("FullName_Input")
private String fullName_Input;
@JsonProperty("AddressLine1_Input")
private String addressLine1_Input;
@JsonProperty("City_Input")
private String city_Input;
@JsonProperty("StateProvince_Input")
private String stateProvince_Input;
@JsonProperty("Email2_Input")
private String email2_Input;
@JsonProperty("Email4_Input")
private String email4_Input;
@JsonProperty("user_fields")
private List<UserFields> user_fields;
@JsonProperty("PersonIds")
private String personIds;
public String getFullName_Input() {
return fullName_Input;
}
public void setFullName_Input(String fullName_Input) {
this.fullName_Input = fullName_Input;
}
public String getAddressLine1_Input() {
return addressLine1_Input;
}
public void setAddressLine1_Input(String addressLine1_Input) {
this.addressLine1_Input = addressLine1_Input;
}
public String getCity_Input() {
return city_Input;
}
public void setCity_Input(String city_Input) {
this.city_Input = city_Input;
}
public String getStateProvince_Input() {
return stateProvince_Input;
}
public void setStateProvince_Input(String stateProvince_Input) {
this.stateProvince_Input = stateProvince_Input;
}
public String getEmail2_Input() {
return email2_Input;
}
public void setEmail2_Input(String email2_Input) {
this.email2_Input = email2_Input;
}
public String getEmail4_Input() {
return email4_Input;
}
public void setEmail4_Input(String email4_Input) {
this.email4_Input = email4_Input;
}
public List<UserFields> getUser_fields() {
return user_fields;
}
public void setUser_fields(List<UserFields> user_fields) {
this.user_fields = user_fields;
}
public String getPersonIds() {
return personIds;
}
public void setPersonIds(String personIds) {
this.personIds = personIds;
}
}
| [
"nisha.thomas@rcggs.com"
] | nisha.thomas@rcggs.com |
f2a31ffa020e6a8d9c2253919b943876cdbd5a0c | 01b7af545cff6bc9c69e3b813148b7484449f104 | /MODEL/PROGRAM/JPO/IEFFindRevision_mxJPO.java | f45c77809f8c189da78ad0ae158adb70d6fae17a | [] | no_license | rgarbhe-processia/Tiger-DEV | c674b417935076ef41e8cb99a60ba423f51a89a1 | 75d8ad323df5cbb309e52ae4017cc2d00f6d1f0e | refs/heads/master | 2020-04-14T10:57:45.934483 | 2020-01-10T09:55:41 | 2020-01-10T09:55:41 | 163,800,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java |
/**
* IEFFindRevision.java Copyright Dassault Systemes, 1992-2007. All Rights Reserved. This program contains proprietary and trade secret information of Dassault Systemes and its subsidiaries, Copyright
* notice is precautionary only and does not evidence any actual or intended publication of such program This JPO gets all revisions for a BusinessObject Project. Infocentral Migration to UI level 3
* $Archive: $ $Revision: 1.2$ $Author: ds-unamagiri$ rahulp
* @since AEF 9.5.2.0
*/
import java.util.HashMap;
import matrix.db.BusinessObject;
import matrix.db.BusinessObjectList;
import matrix.db.Context;
import matrix.db.JPO;
import com.matrixone.apps.domain.util.MapList;
public class IEFFindRevision_mxJPO {
public IEFFindRevision_mxJPO(Context context, String[] args) throws Exception {
}
@com.matrixone.apps.framework.ui.ProgramCallable
public Object getList(Context context, String[] args) throws Exception {
MapList totalresultList = new MapList();
HashMap paramMap = (HashMap) JPO.unpackArgs(args);
String objectId = (String) paramMap.get("objectId");
BusinessObject obj = new BusinessObject(objectId);
obj.open(context);
BusinessObjectList list = obj.getRevisions(context);
for (int i = 0; i < list.size(); i++) {
BusinessObject rev = (BusinessObject) list.get(i);
rev.open(context);
String busid = rev.getObjectId();
HashMap map = new HashMap();
map.put("id", busid);
map.put("type", rev.getTypeName());
map.put("name", rev.getName());
map.put("revision", rev.getRevision());
rev.close(context);
totalresultList.add(map);
}
obj.close(context);
return totalresultList;
}
}
| [
"rgarbhe@processia.com"
] | rgarbhe@processia.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.