blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dcfcdba8f74f41a9f40201687f189d50ed34c72f | 4cc25da9330aa3c5bc031b4128da1f2ed6a26dc0 | /main/app/src/main/java/com/example/main/ui/home/HomeFragment.java | 9825c5726d96e6df6b4f5967da3a3f8889f3d18a | [] | no_license | DaV1nc1-404/dev1.0final | bbf64802170888b4f13e390deb024a4f24b4f58f | bd185e49e494a2b3caac7588c18aa38ce90669be | refs/heads/master | 2022-09-18T20:03:15.698475 | 2020-06-01T03:30:41 | 2020-06-01T03:30:41 | 268,416,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package com.example.main.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.main.R;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
final TextView textView = root.findViewById(R.id.text_home);
homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
}
| [
"IAMEN1GMA@protonmail.ch"
] | IAMEN1GMA@protonmail.ch |
3495522b1d8973ac302fb9c6d3e80a9381cf97a5 | 85afa6c5b7d98afd385a20e5e52ec0958e283157 | /springboot-pattern/src/main/java/com/springboot/pattern/util/SpringContextUtils.java | 4ea2697470272e395483817037e7962c8babcb17 | [] | no_license | winkol/spring-cloud-template | a4bc75c0d703b3d8c01b8891f5169959c4a0766f | ac4e62a7ed81c36130290aa536afa0fe49f62720 | refs/heads/master | 2022-12-13T13:28:21.123340 | 2021-08-12T07:34:17 | 2021-08-12T07:34:17 | 183,975,884 | 1 | 1 | null | 2022-12-06T00:43:18 | 2019-04-29T00:53:35 | Java | UTF-8 | Java | false | false | 1,698 | java | package com.springboot.pattern.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @Author: Dong.L
* @Create: 2019-09-30 8:58
* @Description: 普通类获取bean工具类
*/
@Component
public class SpringContextUtils implements ApplicationContextAware {
/**
* 上下文对象实例
*/
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (null == SpringContextUtils.applicationContext) {
SpringContextUtils.applicationContext = applicationContext;
}
}
/**
* 获取applicationContext
*
* @return
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
/**
* 根据beanName获取Bean
*
* @param beanName
* @return
*/
public static Object getBean(String beanName) {
return getApplicationContext().getBean(beanName);
}
/**
* 通过clazz获取Bean
*
* @param clazz
* @param <T>
* @return
*/
public static <T> T getBean(Class<T> clazz) {
return getApplicationContext().getBean(clazz);
}
/**
* 通过beanName,以及clazz返回指定的Bean
*
* @param beanName
* @param clazz
* @param <T>
* @return
*/
public static <T> T getBean(String beanName, Class<T> clazz) {
return getApplicationContext().getBean(beanName, clazz);
}
}
| [
"ld.5200@163.com"
] | ld.5200@163.com |
1877bb5b1a837ebc880acd5b36dd958cac909ce8 | 50225059f99dbc134ef667a3b624d155453f4eff | /fullBackup/html/Project testing/Spring Examples/JavaBasedConfiguration/edu/aspire/config/AppConfig.java | 8e2ce72878ebe2b93af817a08a519a2975871a44 | [] | no_license | ADARSHb29/Daily-status | 7c67e33d981084b7323f80c2f6c1fc12f7493c3c | e271eff3447cd47fce6671dffd3be08a7cb1df2f | refs/heads/master | 2021-09-05T18:24:53.300618 | 2018-01-30T07:28:57 | 2018-01-30T07:28:57 | 115,399,952 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 566 | java | package edu.aspire.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import edu.aspire.bean.GreetingService;
import edu.aspire.bean.GreetingServiceImpl;
@Configuration
public class AppConfig {
@Bean(name="gs1")
public GreetingService getGs1(){
GreetingServiceImpl gs = new GreetingServiceImpl();
gs.setGreeting("Good Morning");
return gs;
}
@Bean(name="gs2")
public GreetingService getGs2(){
GreetingServiceImpl gs = new GreetingServiceImpl("Good Afternoon");
return gs;
}
}
| [
"adarsh_b@photonint.com"
] | adarsh_b@photonint.com |
a6510334e9c45a3e95e0967eb9306534588db085 | d5a1476da81dd59102394af4ce958e9811b7a170 | /app/src/main/java/com/example/het/mex/Signup.java | 355ef3ed167c9152f74b84234e939900bda1b128 | [] | no_license | Het21/MeX | 3047a93930ef2aa165ca9aeee2829c3da645e676 | a367b74fea6aee1c98d565d838fe16a2bf0e004b | refs/heads/master | 2021-09-28T23:28:37.223259 | 2021-09-13T04:02:29 | 2021-09-13T04:02:29 | 177,265,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,606 | java | package com.example.het.mex;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
public class Signup extends AppCompatActivity {
// private static final String POST_URL = "http://ptsv2.com/t/dz7dh-1551415957/post";
private static final String POST_URL ="https://mex1242523-busy-ratel.eu-gb.mybluemix.net/register";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
mainFun();
}
public void mainFun(){
// Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Signup");
}
// Register button click handler
public void RegisterButtonClicked(View view) {
final EditText Name = (EditText)findViewById(R.id.name);
final EditText e_id = (EditText)findViewById(R.id.e_id);
final EditText email = (EditText)findViewById(R.id.email);
final EditText password = (EditText)findViewById(R.id.pwd);
String name = Name.getText().toString();
String E_id = e_id.getText().toString();
String Email = email.getText().toString();
String Password = password.getText().toString();
if(name.length()!=0 && E_id.length()!=0 && Email.length()!=0 && Password.length()!=0){
// Toast.makeText(Signup.this,"Name:"+Name.getText().toString() + " empId:"+e_id.getText().toString() + " email:"+email.getText().toString()+" password:"+Password.getText().toString(),Toast.LENGTH_LONG).show();
StringRequest postRequest = new StringRequest(Request.Method.POST, POST_URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(Signup.this,"Registration successful",Toast.LENGTH_SHORT).show();
Intent i = new Intent(Signup.this,MainActivity.class);
startActivity(i);
finish();
//response
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(Signup.this,"Error",Toast.LENGTH_SHORT).show();
//error
}
}){
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String,String>();
params.put("name",Name.getText().toString());
params.put("employee_id",e_id.getText().toString());
params.put("email",email.getText().toString());
params.put("password",password.getText().toString());
return params;
}
};
MySingleton.getInstance(this).addToRequestQueue(postRequest);
}
else {
Toast.makeText(Signup.this,"Please complete all fields",Toast.LENGTH_SHORT).show();
}
}
}
| [
"hetpatel8520@gmail.com"
] | hetpatel8520@gmail.com |
ebab6ff1e504a335b3d0e333e3b22be7dc6b6a11 | 1e3698740423ea63a59ea099b1abd2db76a3a598 | /Object_Oriented_Programming_Java/Currency/src/CurrencyV.java | 82956aea687e8c780295a2deb6d9ca80f08bfd3b | [] | no_license | madbillyblack/HSRW_Course_Work | 8aa6b65acf71003092116aef3a66d6b29f0dfed5 | 2be53d049177d6ed1c0c8ef77a3a822a6999b606 | refs/heads/master | 2020-08-22T09:43:02.911643 | 2019-10-20T15:06:04 | 2019-10-20T15:06:04 | 216,367,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java |
public abstract class CurrencyV
{
abstract double dollarValue();
}
| [
"William-Lawrence.Cole@hsrw.org"
] | William-Lawrence.Cole@hsrw.org |
5da0ed2a82ef6847ecce3f3669816ce14368a1f7 | 1192117a834179c82be5a94522dd3a8432a217a3 | /app/src/main/java/com/example/actividadsecundaria/MainActivity.java | c05774c97d5764da305f176f241ba2275a3a7459 | [] | no_license | jzaldumbide/ActividadSecundaria | bea468196a3237617b56d3143f81c4cddc5a032c | 7ad4a7c0ad1c920f9cdcb44f0f110be8fe4ad1a0 | refs/heads/master | 2020-08-24T22:38:27.690949 | 2019-10-22T22:22:11 | 2019-10-22T22:22:11 | 216,919,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.example.actividadsecundaria;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"jzaldumbide@gmail.com"
] | jzaldumbide@gmail.com |
fb3b3441ad0e4a6ffdf46bce3030f9be9f72d0c1 | f02b1c3e23227096a5a11f70d9dd210e80066df2 | /src/main/java/com/upserve/uppend/blobs/FilePage.java | 428c5c7ad22e1dd4ead62ee074fe14c9e45f0fdb | [
"MIT"
] | permissive | Nslboston/uppend | 4660388120732ab5ea68c94511581f332ec24a65 | bcaa776a45c234508ac657ef5d12258dd7b4b4a2 | refs/heads/master | 2020-04-13T06:23:05.009799 | 2018-09-13T19:12:01 | 2018-09-13T19:12:01 | 163,019,037 | 0 | 0 | null | 2018-12-24T19:34:18 | 2018-12-24T19:34:18 | null | UTF-8 | Java | false | false | 2,329 | java | package com.upserve.uppend.blobs;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import static java.lang.Integer.min;
/**
* Mapped Byte Buffer backed implementation of Page
*/
public class FilePage implements Page {
private final FileChannel channel;
private final int pageSize;
private final long pageStart;
/**
* Constructor for a file channel backed page
* @param channel the open file channel
* @param pageStart the start of the page
* @param pageSize the page size
*/
FilePage(FileChannel channel, long pageStart, int pageSize) {
this.channel = channel;
this.pageStart = pageStart;
this.pageSize = pageSize;
}
@Override
public int get(int pagePosition, byte[] dst, int bufferOffset) {
final int desiredRead = dst.length - bufferOffset;
final int availableToRead = pageSize - pagePosition;
final int actualRead = min(desiredRead, availableToRead);
// Make a local buffer with local position
ByteBuffer byteBuffer = ByteBuffer.wrap(dst, bufferOffset, actualRead);
final int channelRead;
try {
channelRead = channel.read(byteBuffer, pageStart + pagePosition);
} catch (IOException e) {
throw new UncheckedIOException("Unable to read from page", e);
}
if (channelRead != actualRead) throw new IllegalStateException("Failed to read past end of file");
return actualRead;
}
@Override
public int put(int pagePosition, byte[] src, int bufferOffset) {
final int desiredWrite = src.length - bufferOffset;
final int availableToWrite = pageSize - pagePosition;
final int actualWrite = min(desiredWrite, availableToWrite);
// Make a local buffer with local position
ByteBuffer byteBuffer = ByteBuffer.wrap(src, bufferOffset, actualWrite);
final int channelWrite;
try {
channelWrite = channel.write(byteBuffer, pageStart + pagePosition);
} catch (IOException e) {
throw new UncheckedIOException("Unable to write to page", e);
}
if (channelWrite != actualWrite) throw new IllegalStateException("Failed to write all bytes to file page");
return actualWrite;
}
}
| [
"stu3b3@gmail.com"
] | stu3b3@gmail.com |
4f6221668c9bc3c60083f64419c63e10408739f1 | 44ebc4aa5d02ce6af3f7d61d5954efd042fb1c52 | /src/main/java/com/ecyrd/jspwiki/auth/UserManager.java | 29064b7f7f995d8e211d6595d660bb4632d58590 | [
"MIT",
"Apache-2.0"
] | permissive | inexas/ProcessLab | 09923890584850e80c80452cc82148f142f9621c | 3ec78e27cf83d41c12893b0bef41c1a2e53ee840 | refs/heads/master | 2021-01-20T12:06:29.632097 | 2010-03-17T14:16:43 | 2010-03-17T14:16:43 | 493,295 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 32,622 | java | /*
Copyright (c) Inexas 2010
Modifications licensed under the Inexas Software License V1.0. You
may not use this file except in compliance with the License.
The License is available at: http://www.inexas.com/ISL-V1.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.
The original file and contents are licensed under a separate license:
see below.
*/
/*
JSPWiki - a JSP-based WikiWiki clone.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.ecyrd.jspwiki.auth;
import java.io.Serializable;
import java.security.Permission;
import java.security.Principal;
import java.text.MessageFormat;
import java.util.*;
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.auth.permissions.AllPermission;
import com.ecyrd.jspwiki.auth.permissions.WikiPermission;
import com.ecyrd.jspwiki.auth.user.AbstractUserDatabase;
import com.ecyrd.jspwiki.auth.user.DuplicateUserException;
import com.ecyrd.jspwiki.auth.user.UserDatabase;
import com.ecyrd.jspwiki.auth.user.UserProfile;
import com.ecyrd.jspwiki.event.WikiEventListener;
import com.ecyrd.jspwiki.event.WikiEventManager;
import com.ecyrd.jspwiki.event.WikiSecurityEvent;
import com.ecyrd.jspwiki.filters.PageFilter;
import com.ecyrd.jspwiki.filters.SpamFilter;
import com.ecyrd.jspwiki.i18n.InternationalizationManager;
import com.ecyrd.jspwiki.rpc.RPCCallable;
import com.ecyrd.jspwiki.rpc.json.JSONRPCManager;
import com.ecyrd.jspwiki.ui.InputValidator;
import com.ecyrd.jspwiki.util.ClassUtil;
import com.ecyrd.jspwiki.util.MailUtil;
import com.ecyrd.jspwiki.workflow.*;
/**
* Provides a facade for obtaining user information.
*
* @author Andrew Jaquith
* @since 2.3
*/
public final class UserManager implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2973551721941143595L;
private static final String USERDATABASE_PACKAGE = "com.ecyrd.jspwiki.auth.user";
private static final String SESSION_MESSAGES = "profile";
private static final String PARAM_EMAIL = "email";
private static final String PARAM_FULLNAME = "fullname";
private static final String PARAM_PASSWORD = "password";
private static final String PARAM_LOGINNAME = "loginname";
private static final String UNKNOWN_CLASS = "<unknown>";
private WikiEngine m_engine;
private static final Logger log = Logger.getLogger(UserManager.class);
/** Message key for the "save profile" message. */
public static final String SAVE_APPROVER = "workflow.createUserProfile";
private static final String PROP_DATABASE = "jspwiki.userdatabase";
protected static final String SAVE_TASK_MESSAGE_KEY = "task.createUserProfile";
protected static final String SAVED_PROFILE = "userProfile";
protected static final String SAVE_DECISION_MESSAGE_KEY = "decision.createUserProfile";
protected static final String FACT_SUBMITTER = "fact.submitter";
protected static final String PREFS_LOGIN_NAME = "prefs.loginname";
protected static final String PREFS_FULL_NAME = "prefs.fullname";
protected static final String PREFS_EMAIL = "prefs.email";
private String userIdPattern, userIdMessage;
private String userPasswordPattern, userPasswordMessage;
// private static final String PROP_ACLMANAGER = "jspwiki.aclManager";
/** Associates wiki sessions with profiles */
private final Map<WikiSession, UserProfile> m_profiles = new WeakHashMap<WikiSession, UserProfile>();
/** The user database loads, manages and persists user identities */
private UserDatabase m_database;
private boolean m_useJAAS = true;
/**
* Constructs a new UserManager instance.
*/
public UserManager() {
//
}
/**
* Initializes the engine for its nefarious purposes.
*
* @param engine
* the current wiki engine
* @param props
* the wiki engine initialization properties
*/
@SuppressWarnings("deprecation")
public final void initialize(WikiEngine engine, Properties props) {
m_engine = engine;
m_useJAAS = AuthenticationManager.SECURITY_JAAS.equals(props.getProperty(AuthenticationManager.PROP_SECURITY,
AuthenticationManager.SECURITY_JAAS));
// Attach the PageManager as a listener
// XXX: it would be better if we did this in PageManager directly
addWikiEventListener(engine.getPageManager());
JSONRPCManager.registerGlobalObject("users", new JSONUserModule(this), new AllPermission(null));
// todo Update these by way of an en event manager
userIdPattern = engine.getNamedValue("SiteConfig=UserIdPattern");
userIdMessage = engine.getNamedValue("SiteConfig=UserIdMessage");
userPasswordPattern = engine.getNamedValue("SiteConfig=UserPasswordPattern");
userPasswordMessage = engine.getNamedValue("SiteConfig=UserPasswordMessage");
}
/**
* Returns the UserDatabase employed by this WikiEngine. The UserDatabase is
* lazily initialized by this method, if it does not exist yet. If the
* initialization fails, this method will use the inner class
* DummyUserDatabase as a default (which is enough to get JSPWiki running).
*
* @return the dummy user database
* @since 2.3
*/
public final UserDatabase getUserDatabase() {
// FIXME: Must not throw RuntimeException, but something else.
if(m_database != null) {
return m_database;
}
if(!m_useJAAS) {
m_database = new DummyUserDatabase();
return m_database;
}
String dbClassName = UNKNOWN_CLASS;
try {
dbClassName = WikiEngine.getRequiredProperty(m_engine.getWikiProperties(),
PROP_DATABASE);
log.info("Attempting to load user database class " + dbClassName);
Class<?> dbClass = ClassUtil.findClass(USERDATABASE_PACKAGE, dbClassName);
m_database = (UserDatabase)dbClass.newInstance();
m_database.initialize(m_engine, m_engine.getWikiProperties());
log.info("UserDatabase initialized.");
} catch(NoRequiredPropertyException e) {
log.error("You have not set the '" + PROP_DATABASE
+ "'. You need to do this if you want to enable user management by JSPWiki.");
} catch(ClassNotFoundException e) {
log.error("UserDatabase class " + dbClassName + " cannot be found", e);
} catch(InstantiationException e) {
log.error("UserDatabase class " + dbClassName + " cannot be created", e);
} catch(IllegalAccessException e) {
log.error("You are not allowed to access this user database class", e);
} finally {
if(m_database == null) {
log
.info("I could not create a database object you specified (or didn't specify), so I am falling back to a default.");
m_database = new DummyUserDatabase();
}
}
return m_database;
}
/**
* <p>
* Retrieves the {@link com.ecyrd.jspwiki.auth.user.UserProfile}for the user
* in a wiki session. If the user is authenticated, the UserProfile returned
* will be the one stored in the user database; if one does not exist, a new
* one will be initialized and returned. If the user is anonymous or
* asserted, the UserProfile will <i>always</i> be newly initialized to
* prevent spoofing of identities. If a UserProfile needs to be initialized,
* its {@link com.ecyrd.jspwiki.auth.user.UserProfile#isNew()} method will
* return <code>true</code>, and its login name will will be set
* automatically if the user is authenticated. Note that this method does
* not modify the retrieved (or newly created) profile otherwise; other
* fields in the user profile may be <code>null</code>.
* </p>
* <p>
* If a new UserProfile was created, but its
* {@link com.ecyrd.jspwiki.auth.user.UserProfile#isNew()} method returns
* <code>false</code>, this method throws an {@link IllegalStateException}.
* This is meant as a quality check for UserDatabase providers; it should
* only be thrown if the implementation is faulty.
* </p>
*
* @param session
* the wiki session, which may not be <code>null</code>
* @return the user's profile, which will be newly initialized if the user
* is anonymous or asserted, or if the user cannot be found in the
* user database
*/
public final UserProfile getUserProfile(WikiSession session) {
// Look up cached user profile
UserProfile profile = m_profiles.get(session);
boolean newProfile = profile == null;
Principal user = null;
// If user is authenticated, figure out if this is an existing profile
if(session.isAuthenticated()) {
user = session.getUserPrincipal();
try {
profile = getUserDatabase().find(user.getName());
newProfile = false;
} catch(NoSuchPrincipalException e) {
//
}
}
if(newProfile) {
profile = getUserDatabase().newProfile();
if(user != null) {
profile.setLoginName(user.getName());
}
if(!profile.isNew()) {
throw new IllegalStateException(
"New profile should be marked 'new'. Check your UserProfile implementation.");
}
}
// Stash the profile for next time
m_profiles.put(session, profile);
return profile;
}
/**
* <p>
* Saves the {@link com.ecyrd.jspwiki.auth.user.UserProfile}for the user in
* a wiki session. This method verifies that a user profile to be saved
* doesn't collide with existing profiles; that is, the login name or full
* name is already used by another profile. If the profile collides, a
* <code>DuplicateUserException</code> is thrown. After saving the profile,
* the user database changes are committed, and the user's credential set is
* refreshed; if custom authentication is used, this means the user will be
* automatically be logged in.
* </p>
* <p>
* When the user's profile is saved succcessfully, this method fires a
* {@link WikiSecurityEvent#PROFILE_SAVE} event with the WikiSession as the
* source and the UserProfile as target. For existing profiles, if the
* user's full name changes, this method also fires a "name changed" event (
* {@link WikiSecurityEvent#PROFILE_NAME_CHANGED}) with the WikiSession as
* the source and an array containing the old and new UserProfiles,
* respectively. The <code>NAME_CHANGED</code> event allows the GroupManager
* and PageManager can change group memberships and ACLs if needed.
* </p>
* <p>
* Note that WikiSessions normally attach event listeners to the
* UserManager, so changes to the profile will automatically cause the
* correct Principals to be reloaded into the current WikiSession's Subject.
* </p>
*
* @param session
* the wiki session, which may not be <code>null</code>
* @param profile
* the user profile, which may not be <code>null</code>
* @throws DuplicateUserException
* if the proposed profile's login name or full name collides
* with another
* @throws WikiException
* if the save fails for some reason. If the current user does
* not have permission to save the profile, this will be a
* {@link com.ecyrd.jspwiki.auth.WikiSecurityException}; if if
* the user profile must be approved before it can be saved, it
* will be a
* {@link com.ecyrd.jspwiki.workflow.DecisionRequiredException}.
* All other WikiException indicate a condition that is not
* normal is probably due to mis-configuration
*/
public final void setUserProfile(WikiSession session, UserProfile profile) throws DuplicateUserException,
WikiException {
// Verify user is allowed to save profile!
Permission p = new WikiPermission(m_engine.getApplicationName(), WikiPermission.EDIT_PROFILE_ACTION);
if(!m_engine.getAuthorizationManager().checkPermission(session, p)) {
throw new WikiSecurityException("You are not allowed to save wiki profiles.");
}
// Check if profile is new, and see if container allows creation
boolean newProfile = profile.isNew();
// Check if another user profile already has the fullname or loginname
UserProfile oldProfile = getUserProfile(session);
boolean nameChanged = (oldProfile == null || oldProfile.getFullname() == null)
? false
: !(oldProfile.getFullname().equals(profile.getFullname()) &&
oldProfile.getLoginName().equals(profile.getLoginName()));
UserProfile otherProfile;
try {
otherProfile = getUserDatabase().findByLoginName(profile.getLoginName());
if(otherProfile != null && !otherProfile.equals(oldProfile)) {
throw new DuplicateUserException("The login name '" + profile.getLoginName() + "' is already taken.");
}
} catch(NoSuchPrincipalException e) {
//
}
try {
otherProfile = getUserDatabase().findByFullName(profile.getFullname());
if(otherProfile != null && !otherProfile.equals(oldProfile)) {
throw new DuplicateUserException("The full name '" + profile.getFullname() + "' is already taken.");
}
} catch(NoSuchPrincipalException e) {
//
}
// For new accounts, create approval workflow for user profile save.
if(newProfile && oldProfile != null && oldProfile.isNew()) {
WorkflowBuilder builder = WorkflowBuilder.getBuilder(m_engine);
Principal submitter = session.getUserPrincipal();
Task completionTask = new SaveUserProfileTask(m_engine);
// Add user profile attribute as Facts for the approver (if
// required)
boolean hasEmail = profile.getEmail() != null;
Fact[] facts = new Fact[hasEmail ? 4 : 3];
facts[0] = new Fact(PREFS_FULL_NAME, profile.getFullname());
facts[1] = new Fact(PREFS_LOGIN_NAME, profile.getLoginName());
facts[2] = new Fact(FACT_SUBMITTER, submitter.getName());
if(hasEmail) {
facts[3] = new Fact(PREFS_EMAIL, profile.getEmail());
}
Workflow workflow = builder.buildApprovalWorkflow(submitter,
SAVE_APPROVER,
null,
SAVE_DECISION_MESSAGE_KEY,
facts,
completionTask,
null);
workflow.setAttribute(SAVED_PROFILE, profile);
m_engine.getWorkflowManager().start(workflow);
boolean approvalRequired = workflow.getCurrentStep() instanceof Decision;
// If the profile requires approval, redirect user to message page
if(approvalRequired) {
throw new DecisionRequiredException("This profile must be approved before it becomes active");
}
// If the profile doesn't need approval, then just log the user in
try {
AuthenticationManager mgr = m_engine.getAuthenticationManager();
if(newProfile && !mgr.isContainerAuthenticated()) {
mgr.login(session, profile.getLoginName(), profile.getPassword());
}
} catch(WikiException e) {
throw new WikiSecurityException(e.getMessage());
}
// Alert all listeners that the profile changed...
// ...this will cause credentials to be reloaded in the wiki session
fireEvent(WikiSecurityEvent.PROFILE_SAVE, session, profile);
}
// For existing accounts, just save the profile
else {
// If login name changed, rename it first
if(nameChanged && oldProfile != null && !oldProfile.getLoginName().equals(profile.getLoginName())) {
getUserDatabase().rename(oldProfile.getLoginName(), profile.getLoginName());
}
// Now, save the profile (userdatabase will take care of timestamps
// for us)
getUserDatabase().save(profile);
if(nameChanged) {
// Fire an event if the login name or full name changed
UserProfile[] profiles = new UserProfile[] { oldProfile, profile };
fireEvent(WikiSecurityEvent.PROFILE_NAME_CHANGED, session, profiles);
} else {
// Fire an event that says we have new a new profile (new
// principals)
fireEvent(WikiSecurityEvent.PROFILE_SAVE, session, profile);
}
}
}
/**
* <p>
* Extracts user profile parameters from the HTTP request and populates a
* UserProfile with them. The UserProfile will either be a copy of the
* user's existing profile (if one can be found), or a new profile (if not).
* The rules for populating the profile as as follows:
* </p>
* <ul>
* <li>If the <code>email</code> or <code>password</code> parameter values
* differ from those in the existing profile, the passed parameters override
* the old values.</li>
* <li>For new profiles, the user-supplied <code>fullname</code parameter is
* always used; for existing profiles the existing value is used, and
* whatever value the user supplied is discarded. The wiki name is
* automatically computed by taking the full name and extracting all
* whitespace.</li>
* <li>In all cases, the created/last modified timestamps of the user's
* existing or new profile always override whatever values the user
* supplied.</li>
* <li>If container authentication is used, the login name property of the
* profile is set to the name of
* {@link com.ecyrd.jspwiki.WikiSession#getLoginPrincipal()}. Otherwise, the
* value of the <code>loginname</code> parameter is used.</li>
* </ul>
*
* @param context
* the current wiki context
* @return a new, populated user profile
*/
public final UserProfile parseProfile(WikiContext context) {
// Retrieve the user's profile (may have been previously cached)
UserProfile profile = getUserProfile(context.getWikiSession());
HttpServletRequest request = context.getHttpRequest();
// Extract values from request stream (cleanse whitespace as needed)
String loginName = request.getParameter(PARAM_LOGINNAME);
String password = request.getParameter(PARAM_PASSWORD);
String fullname = request.getParameter(PARAM_FULLNAME);
String email = request.getParameter(PARAM_EMAIL);
loginName = InputValidator.isBlank(loginName) ? null : loginName;
password = InputValidator.isBlank(password) ? null : password;
fullname = InputValidator.isBlank(fullname) ? null : fullname;
email = InputValidator.isBlank(email) ? null : email;
// A special case if we have container authentication
if(m_engine.getAuthenticationManager().isContainerAuthenticated()) {
// If authenticated, login name is always taken from container
if(context.getWikiSession().isAuthenticated()) {
loginName = context.getWikiSession().getLoginPrincipal().getName();
}
}
// Set the profile fields!
profile.setLoginName(loginName);
profile.setEmail(email);
profile.setFullname(fullname);
profile.setPassword(password);
return profile;
}
/**
* Validates a user profile, and appends any errors to the session errors
* list. If the profile is new, the password will be checked to make sure it
* isn't null. Otherwise, the password is checked for length and that it
* matches the value of the 'password2' HTTP parameter. Note that we have a
* special case when container-managed authentication is used and the user
* is not authenticated; this will always cause validation to fail. Any
* validation errors are added to the wiki session's messages collection
* (see {@link WikiSession#getMessages()}.
*
* @param context
* the current wiki context
* @param profile
* the supplied UserProfile
*/
@SuppressWarnings("unchecked")
public final void validateProfile(WikiContext context, UserProfile profile) {
boolean isNew = profile.isNew();
WikiSession session = context.getWikiSession();
InputValidator validator = new InputValidator(SESSION_MESSAGES, context);
ResourceBundle rb = context.getBundle(InternationalizationManager.CORE_BUNDLE);
//
// Query the SpamFilter first
//
List<PageFilter> ls = m_engine.getFilterManager().getFilterList();
for(PageFilter pf : ls) {
if(pf instanceof SpamFilter) {
if(((SpamFilter)pf).isValidUserProfile(context, profile) == false) {
session.addMessage(SESSION_MESSAGES, "Invalid userprofile");
return;
}
break;
}
}
// If container-managed auth and user not logged in, throw an error
if(m_engine.getAuthenticationManager().isContainerAuthenticated()
&& !context.getWikiSession().isAuthenticated()) {
session.addMessage(SESSION_MESSAGES, rb.getString("security.error.createprofilebeforelogin"));
}
final String loginName = profile.getLoginName();
final String password = profile.getPassword();
validator.validateNotNull(loginName, rb.getString("security.user.loginname"));
if(userIdPattern != null && userIdPattern.length() > 0) {
validator.validatePattern(loginName, userIdPattern, userIdMessage);
}
if(userPasswordPattern != null && userPasswordPattern.length() > 0) {
validator.validatePattern(password, userPasswordPattern, userPasswordMessage);
}
validator.validateNotNull(profile.getFullname(), rb.getString("security.user.fullname"));
validator.validate(profile.getEmail(), rb.getString("security.user.email"), InputValidator.EMAIL);
// If new profile, passwords must match and can't be null
if(!m_engine.getAuthenticationManager().isContainerAuthenticated()) {
if(password == null) {
if(isNew) {
session.addMessage(SESSION_MESSAGES, rb.getString("security.error.blankpassword"));
}
} else {
HttpServletRequest request = context.getHttpRequest();
String password2 = (request == null) ? null : request.getParameter("password2");
if(!password.equals(password2)) {
session.addMessage(SESSION_MESSAGES, rb.getString("security.error.passwordnomatch"));
}
}
}
UserProfile otherProfile;
String fullName = profile.getFullname();
// It's illegal to use as a full name someone else's login name
try {
otherProfile = getUserDatabase().find(fullName);
if(otherProfile != null && !profile.equals(otherProfile) && !fullName.equals(otherProfile.getFullname())) {
Object[] args = { fullName };
session.addMessage(SESSION_MESSAGES, MessageFormat.format(rb
.getString("security.error.illegalfullname"),
args));
}
} catch(NoSuchPrincipalException e) { /* It's clean */
}
// It's illegal to use as a login name someone else's full name
try {
otherProfile = getUserDatabase().find(loginName);
if(otherProfile != null && !profile.equals(otherProfile) && !loginName.equals(otherProfile.getLoginName())) {
Object[] args = { loginName };
session.addMessage(SESSION_MESSAGES, MessageFormat.format(rb
.getString("security.error.illegalloginname"),
args));
}
} catch(NoSuchPrincipalException e) { /* It's clean */
}
}
/**
* A helper method for returning all of the known WikiNames in this system.
*
* @return An Array of Principals
* @throws WikiSecurityException
* If for reason the names cannot be fetched
*/
public Principal[] listWikiNames()
throws WikiSecurityException {
return getUserDatabase().getWikiNames();
}
/**
* This is a database that gets used if nothing else is available. It does
* nothing of note - it just mostly thorws NoSuchPrincipalExceptions if
* someone tries to log in.
*/
public static class DummyUserDatabase extends AbstractUserDatabase {
/**
* No-op.
*
* @throws WikiSecurityException
* never...
*/
@SuppressWarnings("deprecation")
public void commit() throws WikiSecurityException {
// No operation
}
/**
* No-op.
*
* @param loginName
* the login name to delete
* @throws WikiSecurityException
* never...
*/
public void deleteByLoginName(String loginName) throws WikiSecurityException {
// No operation
}
/**
* No-op; always throws <code>NoSuchPrincipalException</code>.
*
* @param index
* the name to search for
* @return the user profile
* @throws NoSuchPrincipalException
* never...
*/
public UserProfile findByEmail(String index) throws NoSuchPrincipalException {
throw new NoSuchPrincipalException("No user profiles available");
}
/**
* No-op; always throws <code>NoSuchPrincipalException</code>.
*
* @param index
* the name to search for
* @return the user profile
* @throws NoSuchPrincipalException
* never...
*/
public UserProfile findByFullName(String index) throws NoSuchPrincipalException {
throw new NoSuchPrincipalException("No user profiles available");
}
/**
* No-op; always throws <code>NoSuchPrincipalException</code>.
*
* @param index
* the name to search for
* @return the user profile
* @throws NoSuchPrincipalException
* never...
*/
public UserProfile findByLoginName(String index) throws NoSuchPrincipalException {
throw new NoSuchPrincipalException("No user profiles available");
}
/**
* No-op; always throws <code>NoSuchPrincipalException</code>.
*
* @param uid
* the unique identifier to search for
* @return the user profile
* @throws NoSuchPrincipalException
* never...
*/
public UserProfile findByUid(String uid) throws NoSuchPrincipalException {
throw new NoSuchPrincipalException("No user profiles available");
}
/**
* No-op; always throws <code>NoSuchPrincipalException</code>.
*
* @param index
* the name to search for
* @return the user profile
* @throws NoSuchPrincipalException
* never...
*/
public UserProfile findByWikiName(String index) throws NoSuchPrincipalException {
throw new NoSuchPrincipalException("No user profiles available");
}
/**
* No-op.
*
* @return a zero-length array
* @throws WikiSecurityException
* never...
*/
public Principal[] getWikiNames() throws WikiSecurityException {
return new Principal[0];
}
/**
* No-op.
*
* @param engine
* the wiki engine
* @param props
* the properties used to initialize the wiki engine
* @throws NoRequiredPropertyException
* never...
*/
public void initialize(WikiEngine engine, Properties props) throws NoRequiredPropertyException {
//
}
/**
* No-op; always throws <code>NoSuchPrincipalException</code>.
*
* @param loginName
* the login name
* @param newName
* the proposed new login name
* @throws DuplicateUserException
* never...
* @throws WikiSecurityException
* never...
*/
public void rename(String loginName, String newName) throws DuplicateUserException, WikiSecurityException {
throw new NoSuchPrincipalException("No user profiles available");
}
/**
* No-op.
*
* @param profile
* the user profile
* @throws WikiSecurityException
* never...
*/
public void save(UserProfile profile) throws WikiSecurityException {
//
}
}
// workflow task inner
// classes....................................................
/**
* Inner class that handles the actual profile save action. Instances of
* this class are assumed to have been added to an approval workflow via
* {@link com.ecyrd.jspwiki.workflow.WorkflowBuilder#buildApprovalWorkflow(Principal, String, Task, String, com.ecyrd.jspwiki.workflow.Fact[], Task, String)}
* ; they will not function correctly otherwise.
*
* @author Andrew Jaquith
*/
public static class SaveUserProfileTask extends Task {
private static final long serialVersionUID = 6994297086560480285L;
private final UserDatabase m_db;
private final WikiEngine m_engine;
/**
* Constructs a new Task for saving a user profile.
*
* @param engine
* the wiki engine
*/
public SaveUserProfileTask(WikiEngine engine) {
super(SAVE_TASK_MESSAGE_KEY);
m_engine = engine;
m_db = engine.getUserManager().getUserDatabase();
}
/**
* Saves the user profile to the user database.
*
* @return {@link com.ecyrd.jspwiki.workflow.Outcome#STEP_COMPLETE} if
* the task completed successfully
* @throws WikiException
* if the save did not complete for some reason
*/
public Outcome execute() throws WikiException {
// Retrieve user profile
UserProfile profile = (UserProfile)getWorkflow().getAttribute(SAVED_PROFILE);
// Save the profile (userdatabase will take care of timestamps for
// us)
m_db.save(profile);
// Send e-mail if user supplied an e-mail address
if(profile.getEmail() != null) {
try {
String app = m_engine.getApplicationName();
String to = profile.getEmail();
String subject = "Welcome to " + app;
String content = "Congratulations! Your new profile on "
+ app + " has been created. Your profile details are as follows: \n\n"
+ "Login name: " + profile.getLoginName() + "\n"
+ "Your name : " + profile.getFullname() + "\n"
+ "E-mail : " + profile.getEmail() + "\n\n"
+ "If you forget your password, you can reset it at "
+ m_engine.getURL(WikiContext.LOGIN, null, null, true);
MailUtil.sendMessage(m_engine, to, subject, content);
} catch(AddressException e) {
//
} catch(MessagingException e) {
log.error("Could not send registration confirmation e-mail. Is the e-mail server running?");
}
}
return Outcome.STEP_COMPLETE;
}
}
// events processing .......................................................
/**
* Registers a WikiEventListener with this instance. This is a convenience
* method.
*
* @param listener
* the event listener
*/
public final synchronized void addWikiEventListener(WikiEventListener listener) {
WikiEventManager.addWikiEventListener(this, listener);
}
/**
* Un-registers a WikiEventListener with this instance. This is a
* convenience method.
*
* @param listener
* the event listener
*/
public final synchronized void removeWikiEventListener(WikiEventListener listener) {
WikiEventManager.removeWikiEventListener(this, listener);
}
/**
* Fires a WikiSecurityEvent of the provided type, Principal and target
* Object to all registered listeners.
*
* @see com.ecyrd.jspwiki.event.WikiSecurityEvent
* @param type
* the event type to be fired
* @param session
* the wiki session supporting the event
* @param profile
* the user profile (or array of user profiles), which may be
* <code>null</code>
*/
protected final void fireEvent(int type, WikiSession session, Object profile) {
if(WikiEventManager.isListening(this)) {
WikiEventManager.fireEvent(this, new WikiSecurityEvent(session, type, profile));
}
}
/**
* Implements the JSON API for usermanager.
* <p>
* Even though this gets serialized whenever container shuts down/restarts,
* this gets reinstalled to the session when JSPWiki starts. This means that
* it's not actually necessary to save anything.
*/
public static final class JSONUserModule implements RPCCallable, Serializable {
private static final long serialVersionUID = 1L;
private volatile UserManager m_manager;
/**
* Create a new JSONUserModule.
*
* @param mgr
* Manager
*/
public JSONUserModule(UserManager mgr) {
m_manager = mgr;
}
/**
* Directly returns the UserProfile object attached to an uid.
*
* @param uid
* The user id (e.g. WikiName)
* @return A UserProfile object
* @throws NoSuchPrincipalException
* If such a name does not exist.
*/
public UserProfile getUserInfo(String uid)
throws NoSuchPrincipalException {
if(m_manager != null) {
UserProfile prof = m_manager.getUserDatabase().find(uid);
return prof;
}
throw new IllegalStateException("The manager is offline.");
}
}
}
| [
"kwhittingham@inexas.com"
] | kwhittingham@inexas.com |
05756164518289f83e09e7d41416408db9d3a28e | 8c8ec6d25a7da6d1568033ff6c76a9e970505f12 | /app/src/main/java/com/example/jinbailiang/fresco_test/PhotoWallActivity.java | 65ba813c50ae103c23e31ad661ac9f6dcd1d3346 | [] | no_license | jinbailiang1020/DemoList_jinbai01 | c36640dbf517fec7dc835a0932ca7e1586ba39e8 | 02662f36f6d7d5641ec739ec02e33f3280e48b42 | refs/heads/master | 2021-01-11T18:11:56.604744 | 2017-01-19T09:33:54 | 2017-01-19T09:33:54 | 79,512,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,281 | java | package com.example.jinbailiang.fresco_test;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.example.jinbailiang.demos_jinbai.R;
import com.facebook.fresco.helper.photoview.PictureBrowse;
import com.facebook.fresco.helper.photoview.entity.PhotoInfo;
import java.util.ArrayList;
/**
* Created by android_ls on 16/11/2.
*/
public class PhotoWallActivity extends AppCompatActivity {
private RecyclerView mRecyclerView;
private PhotoWallAdapter mPhotoWallAdapter;
private GridLayoutManager mLayoutManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo_wall);
String[] images = {
"http://g.hiphotos.baidu.com/imgad/pic/item/c75c10385343fbf22c362d2fb77eca8065388fa0.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f9nuk0nvrdj20u011haci.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f9mp3xhjdhj20u00u0ta9.jpg",
"http://ww2.sinaimg.cn/large/610dc034gw1f9lmfwy2nij20u00u076w.jpg",
"http://ww2.sinaimg.cn/large/610dc034gw1f9kjnm8uo1j20u00u0q5q.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f9j7nvnwjdj20u00k0jsl.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f9frojtu31j20u00u0go9.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f9em0sj3yvj20u00w4acj.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f9dh2ohx2vj20u011hn0r.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f9cayjaa96j20u011hqbs.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f9b46kpoeoj20ku0kuwhc.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f978bh1cerj20u00u0767.jpg",
"http://ww4.sinaimg.cn/large/610dc034gw1f96kp6faayj20u00jywg9.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f95hzq3p4rj20u011htbm.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f9469eoojtj20u011hdjy.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f91ypzqaivj20u00k0jui.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f8zlenaornj20u011idhv.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f8xz7ip2u5j20u011h78h.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f8xff48zauj20u00x5jws.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f8w2tr9bgzj20ku0mjdi8.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f8uxlbptw7j20ku0q1did.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f8rgvvm5htj20u00u0q8s.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f8qd9a4fx7j20u011hq78.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f8kmud15q1j20u011hdjg.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f8bc5c5n4nj20u00irgn8.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f8a5uj64mpj20u00u0tca.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f88ylsqjvqj20u011hn5i.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f87z2n2taej20u011h11h.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f867mvc6qjj20u00u0wh7.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f837uocox8j20f00mggoo.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f820oxtdzzj20hs0hsdhl.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f80uxtwgxrj20u011hdhq.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f7z9uxopq0j20u011hju5.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f7y296c5taj20u00u0tay.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7wws4xk5nj20u011hwhb.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7sszr81ewj20u011hgog.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f7rmrmrscrj20u011hgp1.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7qgschtz8j20hs0hsac7.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f7mixvc7emj20ku0dv74p.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7lughzrjmj20u00k9jti.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7kpy9czh0j20u00vn0us.jpg",
"http://ww2.sinaimg.cn/large/610dc034jw1f7jkj4hl41j20u00mhq68.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7hu7d460oj20u00u075u.jpg",
"http://ww1.sinaimg.cn/large/610dc034jw1f7ef7i5m1zj20u011hdjm.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f7d97id9mbj20u00u0q4g.jpg",
"http://ww4.sinaimg.cn/large/610dc034jw1f7cmpd95iaj20u011hjtt.jpg",
"http://ww2.sinaimg.cn/large/610dc034gw1f7bm1unn17j20u00u00wm.jpg",
"http://ww3.sinaimg.cn/large/610dc034jw1f8mssipb9sj20u011hgqk.jpg"
};
ArrayList<PhotoInfo> data = new ArrayList<>();
for (int i = 0; i < images.length; i++) {
PhotoInfo photoInfo = new PhotoInfo();
photoInfo.originalUrl = images[i];
photoInfo.thumbnailUrl = images[i];
data.add(photoInfo);
}
mRecyclerView = (RecyclerView)findViewById(R.id.rv_photo_wall);
mLayoutManager = new GridLayoutManager(this, 4);
mRecyclerView.setLayoutManager(mLayoutManager);
mPhotoWallAdapter = new PhotoWallAdapter(data, new OnItemClickListener<PhotoInfo>() {
@Override
public void onItemClick(View view, ArrayList<PhotoInfo> photos, int position) {
// MLog.i("position = " + position);
// MLog.i("photos.get(position).thumbnailUrl = " + photos.get(position).thumbnailUrl);
PictureBrowse.newBuilder(PhotoWallActivity.this)
.setLayoutManager(mLayoutManager)
.setPhotoList(photos)
.setCurrentPosition(position)
.enabledAnimation(true)
.start();
// PictureBrowse.newBuilder(PhotoWallActivity.this)
// .setPhotoList(photos)
// .setCurrentPosition(position)
// .start();
// String originalUrl = photos.get(position).originalUrl;
// PictureBrowse.newBuilder(PhotoWallActivity.this)
// .setThumbnailView(view)
// .setOriginalUrl(originalUrl)
// .enabledAnimation(true)
// .start();
// PictureBrowse.newBuilder(PhotoWallActivity.this)
// .setThumbnailView(view)
// .setPhotoInfo(photos.get(position))
// .enabledAnimation(true)
// .start();
// String originalUrl = photos.get(position).originalUrl;
// PictureBrowse.newBuilder(PhotoWallActivity.this)
// .setOriginalUrl(originalUrl)
// .start();
}
});
mRecyclerView.setAdapter(mPhotoWallAdapter);
}
}
| [
"493757041@qq.com"
] | 493757041@qq.com |
123b89547c820663a4f079ef8da2a5cad17baea8 | fa61db85cc877d63dc473313e8f6bc136f3f84d7 | /src/p50_02FirstCharacterInStream/Solution.java | 6a85e515d3c957d9b0604a660b037f783f371270 | [] | no_license | jiaweichen666/JianzhiOffer | b31b2e92eb253935dc8873849460236b273c08d6 | 8329fa7c2960f2e12fd4469d8e20762277810894 | refs/heads/master | 2021-04-26T22:25:06.295657 | 2018-05-28T16:38:44 | 2018-05-28T16:38:44 | 124,087,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | java | package p50_02FirstCharacterInStream;
/**
* Description:请实现一个函数用来找出字符流中第一个只出现一次的字符。
* 例如,当从字符流中只读出前两个字符"go"时,第一个只出现一次的字符是"g"。
* 当从该字符流中读出前六个字符“google"时,第一个只出现一次的字符是"l"。
* 输出描述:如果当前字符流没有存在出现一次的字符,返回#字符。
* Tips:使用一个数组记录每个字符出现的次数,使用一个list,在字符第一次被读入时加入list
* 查找当前读入的字符流中第一个不重复的字符时,直接从list队列头部取元素使用辅助数组判断是否只出现了一次
* 如果是直接返回,如果不是取下一个元素继续判断,若一直判断到list为空还未找到,则直接返回‘#’
*/
import java.util.LinkedList;
public class Solution {
//Insert one char from stringstream
private int[] flags;
private LinkedList<Character> list;
public Solution(){
flags = new int[65535];
list = new LinkedList<>();
}
public void Insert(char ch)
{
flags[ch]++;
if (flags[ch] == 1)
list.addLast(ch);
}
//return the first appearence once char in current stringstream
public char FirstAppearingOnce()
{
while (!list.isEmpty()){
char cur = list.getFirst();
if (flags[cur] == 1)
return cur;
else
list.removeFirst();
}
return '#';
}
} | [
"1096448779@qq.com"
] | 1096448779@qq.com |
4e044d79a8ead8def200519fd884e9d51e2a30f5 | e8ab6930c0c00fd3f9dc893f863dc556d2e7bd1d | /src/main/java/com/spaneos/shoppingcart/web/WelcomeServlet.java | 613d8cf3da2b864ffeb4a6018234b64cfac97cb7 | [] | no_license | alnswa/shoppingcart | ce60347e4d60578d1a74d82740f37d49f137e79c | 1324bb91cdbe57b80ea056790e15783185a5c7d4 | refs/heads/master | 2020-05-18T03:54:40.435014 | 2015-09-10T06:54:56 | 2015-09-10T06:54:56 | 42,227,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.spaneos.shoppingcart.web;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/viewnames")
public class WelcomeServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setAttribute("names", "Lakshman,Manoj,Rajesh,Krish,Balu,Don");
req.getRequestDispatcher("viewnames.jsp").forward(req, resp);
}
}
| [
"lakshman.a@spaneos.com"
] | lakshman.a@spaneos.com |
a90ac4c7d31c225d712672df2dbe8ae34cb708b5 | 7eb8fde842c0676d4092a25e35329ccace2623f5 | /nacos-1.0.0/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java | 583eb26c4e809a7a71ce3acf7fcb42bb5d854250 | [
"Apache-2.0"
] | permissive | dingzhenbo/driftbottle-service | c5fdd77b56c4cfd77488bd32dff23e9c6621388a | 99afa1bdde07a26d41182ae1b9d03d4addb27679 | refs/heads/master | 2022-12-12T21:01:48.364471 | 2019-07-22T02:03:52 | 2019-07-22T02:03:52 | 193,198,543 | 1 | 1 | Apache-2.0 | 2022-12-10T01:23:41 | 2019-06-22T06:11:22 | Java | UTF-8 | Java | false | false | 13,874 | java | /*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* 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.alibaba.nacos.naming.misc;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.api.common.Constants;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.naming.consistency.ConsistencyService;
import com.alibaba.nacos.naming.consistency.Datum;
import com.alibaba.nacos.naming.consistency.KeyBuilder;
import com.alibaba.nacos.naming.consistency.RecordListener;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
/**
* Switch manager
*
* @author nkorange
* @since 1.0.0
*/
@Component
public class SwitchManager implements RecordListener<SwitchDomain> {
@Autowired
private SwitchDomain switchDomain;
@Resource(name = "consistencyDelegate")
private ConsistencyService consistencyService;
ReentrantLock lock = new ReentrantLock();
@PostConstruct
public void init() {
try {
consistencyService.listen(UtilsAndCommons.getSwitchDomainKey(), this);
} catch (NacosException e) {
Loggers.SRV_LOG.error("listen switch provider failed.", e);
}
}
public void update(String entry, String value, boolean debug) throws Exception {
try {
lock.lock();
Datum datum = consistencyService.get(UtilsAndCommons.getSwitchDomainKey());
SwitchDomain switchDomain;
if (datum != null && datum.value != null) {
switchDomain = (SwitchDomain) datum.value;
} else {
switchDomain = this.switchDomain.clone();
}
if (SwitchEntry.BATCH.equals(entry)) {
//batch update
SwitchDomain dom = JSON.parseObject(value, SwitchDomain.class);
dom.setEnableStandalone(switchDomain.isEnableStandalone());
if (dom.getHttpHealthParams().getMin() < SwitchDomain.HttpHealthParams.MIN_MIN
|| dom.getTcpHealthParams().getMin() < SwitchDomain.HttpHealthParams.MIN_MIN) {
throw new IllegalArgumentException("min check time for http or tcp is too small(<500)");
}
if (dom.getHttpHealthParams().getMax() < SwitchDomain.HttpHealthParams.MIN_MAX
|| dom.getTcpHealthParams().getMax() < SwitchDomain.HttpHealthParams.MIN_MAX) {
throw new IllegalArgumentException("max check time for http or tcp is too small(<3000)");
}
if (dom.getHttpHealthParams().getFactor() < 0
|| dom.getHttpHealthParams().getFactor() > 1
|| dom.getTcpHealthParams().getFactor() < 0
|| dom.getTcpHealthParams().getFactor() > 1) {
throw new IllegalArgumentException("malformed factor");
}
switchDomain = dom;
}
if (entry.equals(SwitchEntry.DISTRO_THRESHOLD)) {
Float threshold = Float.parseFloat(value);
if (threshold <= 0) {
throw new IllegalArgumentException("distroThreshold can not be zero or negative: " + threshold);
}
switchDomain.setDistroThreshold(threshold);
}
if (entry.equals(SwitchEntry.CLIENT_BEAT_INTERVAL)) {
long clientBeatInterval = Long.parseLong(value);
switchDomain.setClientBeatInterval(clientBeatInterval);
}
if (entry.equals(SwitchEntry.PUSH_VERSION)) {
String type = value.split(":")[0];
String version = value.split(":")[1];
if (!version.matches(UtilsAndCommons.VERSION_STRING_SYNTAX)) {
throw new IllegalArgumentException("illegal version, must match: " + UtilsAndCommons.VERSION_STRING_SYNTAX);
}
if (StringUtils.equals(SwitchEntry.CLIENT_JAVA, type)) {
switchDomain.setPushJavaVersion(version);
} else if (StringUtils.equals(SwitchEntry.CLIENT_PYTHON, type)) {
switchDomain.setPushPythonVersion(version);
} else if (StringUtils.equals(SwitchEntry.CLIENT_C, type)) {
switchDomain.setPushCVersion(version);
} else if (StringUtils.equals(SwitchEntry.CLIENT_GO, type)) {
switchDomain.setPushGoVersion(version);
} else {
throw new IllegalArgumentException("unsupported client type: " + type);
}
}
if (entry.equals(SwitchEntry.PUSH_CACHE_MILLIS)) {
Long cacheMillis = Long.parseLong(value);
if (cacheMillis < SwitchEntry.MIN_PUSH_CACHE_TIME_MIILIS) {
throw new IllegalArgumentException("min cache time for http or tcp is too small(<10000)");
}
switchDomain.setDefaultPushCacheMillis(cacheMillis);
}
// extremely careful while modifying this, cause it will affect all clients without pushing enabled
if (entry.equals(SwitchEntry.DEFAULT_CACHE_MILLIS)) {
Long cacheMillis = Long.parseLong(value);
if (cacheMillis < SwitchEntry.MIN_CACHE_TIME_MIILIS) {
throw new IllegalArgumentException("min default cache time is too small(<1000)");
}
switchDomain.setDefaultCacheMillis(cacheMillis);
}
if (entry.equals(SwitchEntry.MASTERS)) {
List<String> masters = Arrays.asList(value.split(","));
switchDomain.setMasters(masters);
}
if (entry.equals(SwitchEntry.DISTRO)) {
boolean enabled = Boolean.parseBoolean(value);
switchDomain.setDistroEnabled(enabled);
}
if (entry.equals(SwitchEntry.CHECK)) {
boolean enabled = Boolean.parseBoolean(value);
switchDomain.setHealthCheckEnabled(enabled);
}
if (entry.equals(SwitchEntry.PUSH_ENABLED)) {
boolean enabled = Boolean.parseBoolean(value);
switchDomain.setPushEnabled(enabled);
}
if (entry.equals(SwitchEntry.SERVICE_STATUS_SYNC_PERIOD)) {
Long millis = Long.parseLong(value);
if (millis < SwitchEntry.MIN_SERVICE_SYNC_TIME_MIILIS) {
throw new IllegalArgumentException("serviceStatusSynchronizationPeriodMillis is too small(<5000)");
}
switchDomain.setServiceStatusSynchronizationPeriodMillis(millis);
}
if (entry.equals(SwitchEntry.SERVER_STATUS_SYNC_PERIOD)) {
Long millis = Long.parseLong(value);
if (millis < SwitchEntry.MIN_SERVER_SYNC_TIME_MIILIS) {
throw new IllegalArgumentException("serverStatusSynchronizationPeriodMillis is too small(<15000)");
}
switchDomain.setServerStatusSynchronizationPeriodMillis(millis);
}
if (entry.equals(SwitchEntry.HEALTH_CHECK_TIMES)) {
Integer times = Integer.parseInt(value);
switchDomain.setCheckTimes(times);
}
if (entry.equals(SwitchEntry.DISABLE_ADD_IP)) {
boolean disableAddIP = Boolean.parseBoolean(value);
switchDomain.setDisableAddIP(disableAddIP);
}
if (entry.equals(SwitchEntry.SEND_BEAT_ONLY)) {
boolean sendBeatOnly = Boolean.parseBoolean(value);
switchDomain.setSendBeatOnly(sendBeatOnly);
}
if (entry.equals(SwitchEntry.LIMITED_URL_MAP)) {
Map<String, Integer> limitedUrlMap = new HashMap<>(16);
String limitedUrls = value;
if (!StringUtils.isEmpty(limitedUrls)) {
String[] entries = limitedUrls.split(",");
for (int i = 0; i < entries.length; i++) {
String[] parts = entries[i].split(":");
if (parts.length < 2) {
throw new IllegalArgumentException("invalid input for limited urls");
}
String limitedUrl = parts[0];
if (StringUtils.isEmpty(limitedUrl)) {
throw new IllegalArgumentException("url can not be empty, url: " + limitedUrl);
}
int statusCode = Integer.parseInt(parts[1]);
if (statusCode <= 0) {
throw new IllegalArgumentException("illegal normal status code: " + statusCode);
}
limitedUrlMap.put(limitedUrl, statusCode);
}
switchDomain.setLimitedUrlMap(limitedUrlMap);
}
}
if (entry.equals(SwitchEntry.ENABLE_STANDALONE)) {
String enabled = value;
if (!StringUtils.isNotEmpty(enabled)) {
switchDomain.setEnableStandalone(Boolean.parseBoolean(enabled));
}
}
if (entry.equals(SwitchEntry.OVERRIDDEN_SERVER_STATUS)) {
String status = value;
if (Constants.NULL_STRING.equals(status)) {
status = StringUtils.EMPTY;
}
switchDomain.setOverriddenServerStatus(status);
}
if (entry.equals(SwitchEntry.DEFAULT_INSTANCE_EPHEMERAL)) {
String defaultEphemeral = value;
switchDomain.setDefaultInstanceEphemeral(Boolean.parseBoolean(defaultEphemeral));
}
if (debug) {
update(switchDomain);
} else {
consistencyService.put(UtilsAndCommons.getSwitchDomainKey(), switchDomain);
}
} finally {
lock.unlock();
}
}
public void update(SwitchDomain newSwitchDomain) {
switchDomain.setMasters(newSwitchDomain.getMasters());
switchDomain.setAdWeightMap(newSwitchDomain.getAdWeightMap());
switchDomain.setDefaultPushCacheMillis(newSwitchDomain.getDefaultPushCacheMillis());
switchDomain.setClientBeatInterval(newSwitchDomain.getClientBeatInterval());
switchDomain.setDefaultCacheMillis(newSwitchDomain.getDefaultCacheMillis());
switchDomain.setDistroThreshold(newSwitchDomain.getDistroThreshold());
switchDomain.setHealthCheckEnabled(newSwitchDomain.isHealthCheckEnabled());
switchDomain.setDistroEnabled(newSwitchDomain.isDistroEnabled());
switchDomain.setPushEnabled(newSwitchDomain.isPushEnabled());
switchDomain.setEnableStandalone(newSwitchDomain.isEnableStandalone());
switchDomain.setCheckTimes(newSwitchDomain.getCheckTimes());
switchDomain.setHttpHealthParams(newSwitchDomain.getHttpHealthParams());
switchDomain.setTcpHealthParams(newSwitchDomain.getTcpHealthParams());
switchDomain.setMysqlHealthParams(newSwitchDomain.getMysqlHealthParams());
switchDomain.setIncrementalList(newSwitchDomain.getIncrementalList());
switchDomain.setServerStatusSynchronizationPeriodMillis(newSwitchDomain.getServerStatusSynchronizationPeriodMillis());
switchDomain.setServiceStatusSynchronizationPeriodMillis(newSwitchDomain.getServiceStatusSynchronizationPeriodMillis());
switchDomain.setDisableAddIP(newSwitchDomain.isDisableAddIP());
switchDomain.setSendBeatOnly(newSwitchDomain.isSendBeatOnly());
switchDomain.setLimitedUrlMap(newSwitchDomain.getLimitedUrlMap());
switchDomain.setDistroServerExpiredMillis(newSwitchDomain.getDistroServerExpiredMillis());
switchDomain.setPushGoVersion(newSwitchDomain.getPushGoVersion());
switchDomain.setPushJavaVersion(newSwitchDomain.getPushJavaVersion());
switchDomain.setPushPythonVersion(newSwitchDomain.getPushPythonVersion());
switchDomain.setPushCVersion(newSwitchDomain.getPushCVersion());
switchDomain.setEnableAuthentication(newSwitchDomain.isEnableAuthentication());
switchDomain.setOverriddenServerStatus(newSwitchDomain.getOverriddenServerStatus());
switchDomain.setDefaultInstanceEphemeral(newSwitchDomain.isDefaultInstanceEphemeral());
}
public SwitchDomain getSwitchDomain() {
return switchDomain;
}
@Override
public boolean interests(String key) {
return KeyBuilder.matchSwitchKey(key);
}
@Override
public boolean matchUnlistenKey(String key) {
return KeyBuilder.matchSwitchKey(key);
}
@Override
public void onChange(String key, SwitchDomain domain) throws Exception {
update(domain);
}
@Override
public void onDelete(String key) throws Exception {
}
}
| [
"1439536344@qq.com"
] | 1439536344@qq.com |
3611966644d1540b4c8e9bbd82dc960215c777ba | 85039736ceff1b33d9425d127cb39b2a9b50245a | /spring-demo-annotations/src/com/tkp/demo/AnnotationDemoApp.java | c8cc04b583c9b808658cb77af37bd74fd6a1707d | [] | no_license | riskiidice/spring-hibernate-course | 918f8e8ae88bffd30bc8814f9a4ce03782595fbf | a99cc554e79d79cddcb73359154148307b0338ac | refs/heads/master | 2020-03-30T15:00:23.643742 | 2018-10-19T15:44:07 | 2018-10-19T15:44:07 | 151,344,556 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | package com.tkp.demo;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class AnnotationDemoApp {
public static void main(String[] args) {
// read spring config file
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext("applicationContext.xml");
// get bean from spring container
Coach theCoach = context.getBean("tennisCoach", Coach.class);
// call a method
System.out.println(theCoach.getDailyWorkout());
System.out.println(theCoach.getDailyFortune());
// close container
context.close();
}
}
| [
"thesecondstageshow@gmail.com"
] | thesecondstageshow@gmail.com |
8b39688b7996096d081e6db4463b3b98a6747eea | 1f7a50871282dfd68262a084ccdc2e5e22d5cbde | /spring-boot-shiro-demo/src/main/java/com/summer/springboot/shiro/demo/controller/StudentController.java | 14018e2788f8cfccaf19d4c996730f142fe3092d | [] | no_license | xia45399/spring-boot-demos | 0b5477cf27a4b60116433206c95814d03c82e4a3 | 7e1293259da10939e29a3a71f4e648cea187062d | refs/heads/master | 2022-06-30T01:53:29.972506 | 2019-06-26T14:31:33 | 2019-06-26T14:31:33 | 184,356,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package com.summer.springboot.shiro.demo.controller;
import com.summer.springboot.shiro.demo.pojo.Student;
import com.summer.springboot.shiro.demo.service.StudentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("student")
public class StudentController {
@Resource
private StudentService studentService;
@RequestMapping("/testAnon")
public Object testAnon() {
return "该接口拦截但是不鉴权";
}
@RequiresPermissions("student:getStudentById")
@RequestMapping("/getStudentById")
public Student getStudentById(long id) {
return studentService.getStudentById(id);
}
@RequiresPermissions("student:qryAll")
@RequestMapping("/qryAll")
public Object qryAll() {
return studentService.qryAll();
}
@RequiresPermissions("student:addStudent")
@RequestMapping("/addStudent")
public int addStudent(@Validated @RequestBody Student student) {
int count = studentService.insertStudent(student);
return count;
}
}
| [
"453993887@qq.com"
] | 453993887@qq.com |
28a0dced9062e14b9c6790684a22e4f8c482693e | d3329cd8c14a0221398b5385c4e65aface01d353 | /HBProj18-HBGenericGenerators--sequence-oracle2/src/com/nt/entity/College.java | 9f7aaa635bf06264678c313f790e55e5fa013c64 | [] | no_license | dalalsunil1986/Hibernate-1 | 7fa2b517d67a6e7a460a5f3fa4d3f9e4c0fb9385 | 19d3a49f95f0bc13889aef9ec0ed15548b827162 | refs/heads/master | 2020-07-22T08:06:54.223626 | 2018-10-12T12:37:39 | 2018-10-12T12:37:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.nt.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.GenericGenerator;
import lombok.Data;
@SuppressWarnings("serial")
@Entity
@Data
public class College implements Serializable {
@Id
@GenericGenerator(name="gen1",strategy="sequence")
@GeneratedValue(generator="gen1")
private int id;
private String name;
private String location;
private int strength;
private String grade;
} | [
"karrasankar158@gmail.com"
] | karrasankar158@gmail.com |
b53eb20f8eb3ffaaf1b5cf5d2d8ff8dd601beacb | 74ad84aad4c2e31895cd91cbdfc704228bee6163 | /src/com/CounterBooking.java | 101db30a04d99686d09e9f1d9619846d398e933c | [] | no_license | ulaganathan95/Discs | d4f59dcf1c89355694ad13e7920c7bd73badb5e7 | 683c95dde229d11e734a6d8ad61c7a321d407fc8 | refs/heads/master | 2020-03-30T07:42:25.473685 | 2018-09-30T11:20:21 | 2018-09-30T11:20:21 | 150,960,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com;
import java.util.ArrayList;
public class CounterBooking extends Booking{
public CounterBooking(int noOfTickets, double movieRate, int maxTicketsAllowed, double totalCharge) {
super(noOfTickets, movieRate, maxTicketsAllowed, totalCharge);
}
@Override
public void calculateTicket() {
double TotalCharge=this.noOfTickets*this.movieRate;
}
}
| [
"ulagan007@gmail.com"
] | ulagan007@gmail.com |
9a7bc3416583952f988fd632dcb51d1f1bd79a9b | 1152415a53c13971fcec4761f6f0e671ebf4c61c | /src/test/java/br/com/helenharumi/conceitosjava/AppTest.java | 7b58dc499c540e20e0ddcf75126626ed6668552f | [] | no_license | helenharumi/conceitosjava | 31c93b47b5b71c7536a18eb441714a3d193ec818 | e118989b134981a9b40461ea87748053caf92617 | refs/heads/master | 2023-02-28T20:30:54.073712 | 2021-02-07T01:45:56 | 2021-02-07T01:45:56 | 336,616,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package br.com.helenharumi.conceitosjava;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"helen.harumi1@gmail.com"
] | helen.harumi1@gmail.com |
61b9ccabb25fa5b8093a808e4dded2c95696a0b7 | 3c3d5dda5b1220252ec7945437f00639a956551e | /src/test/java/com/rpuch/pulsar/reactor/impl/ReactiveConsumerImplTest.java | 86f6b6b03ee8eb81ed94ff8b4a3117fe992507e1 | [
"Apache-2.0"
] | permissive | rpuch/pulsar-reactive-client | 62eacb251c97e6d1109ff3df0219517bcf4993a3 | 7cf711c3495a79bccff9067cc618a101539e7ad6 | refs/heads/master | 2023-03-26T05:07:06.498020 | 2021-03-27T11:56:10 | 2021-03-27T11:56:10 | 341,636,607 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,620 | java | package com.rpuch.pulsar.reactor.impl;
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.ConsumerStats;
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.MessageId;
import org.apache.pulsar.client.api.Messages;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import reactor.test.StepVerifier;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import static com.rpuch.pulsar.reactor.utils.Futures.failedFuture;
import static java.util.Collections.singletonList;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* @author Roman Puchkovskiy
*/
@ExtendWith(MockitoExtension.class)
class ReactiveConsumerImplTest {
@InjectMocks
private ReactiveConsumerImpl<String> reactiveConsumer;
@Mock
private Consumer<String> coreConsumer;
@Mock
private Message<String> message;
@Mock
private Messages<String> messages;
@Mock
private MessageId messageId;
@Test
void getTopicConsultsWithCoreConsumer() {
when(coreConsumer.getTopic()).thenReturn("a");
assertThat(reactiveConsumer.getTopic(), is("a"));
}
@Test
void getSubscriptionConsultsWithCoreConsumer() {
when(coreConsumer.getSubscription()).thenReturn("a");
assertThat(reactiveConsumer.getSubscription(), is("a"));
}
@Test
void unsubscribeCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.unsubscribeAsync()).thenReturn(completedFuture(null));
reactiveConsumer.unsubscribe().block();
verify(coreConsumer).unsubscribeAsync();
}
@Test
void messagesCallsReceiveAsyncMethodOnCoreConsumer() {
when(coreConsumer.receiveAsync()).then(NextMessageAnswer.produce("a", "b"));
reactiveConsumer.messages()
.as(StepVerifier::create)
.assertNext(message -> assertThat(message.getValue(), is("a")))
.assertNext(message -> assertThat(message.getValue(), is("b")))
.expectTimeout(Duration.ofMillis(100))
.verify();
}
@Test
void messagesConvertsFutureFailureToError() {
RuntimeException exception = new RuntimeException("Oops");
when(coreConsumer.receiveAsync()).thenReturn(failedFuture(exception));
reactiveConsumer.messages()
.as(StepVerifier::create)
.expectErrorSatisfies(ex -> assertThat(ex, sameInstance(exception)))
.verify();
}
@Test
void receiveCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.receiveAsync()).thenReturn(completedFuture(message));
reactiveConsumer.receive()
.as(StepVerifier::create)
.expectNext(message)
.verifyComplete();
}
@Test
void receiveConvertsFutureFailureToError() {
RuntimeException exception = new RuntimeException("Oops");
when(coreConsumer.receiveAsync()).thenReturn(failedFuture(exception));
reactiveConsumer.receive()
.as(StepVerifier::create)
.expectErrorSatisfies(ex -> assertThat(ex, sameInstance(exception)))
.verify();
}
@Test
void batchReceiveCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.batchReceiveAsync()).thenReturn(completedFuture(messages));
reactiveConsumer.batchReceive()
.as(StepVerifier::create)
.expectNext(messages)
.verifyComplete();
}
@Test
void batchReceiveConvertsFutureFailureToError() {
RuntimeException exception = new RuntimeException("Oops");
when(coreConsumer.batchReceiveAsync()).thenReturn(failedFuture(exception));
reactiveConsumer.batchReceive()
.as(StepVerifier::create)
.expectErrorSatisfies(ex -> assertThat(ex, sameInstance(exception)))
.verify();
}
@Test
void acknowledgeMessageCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.acknowledgeAsync(message)).thenReturn(completedFuture(null));
reactiveConsumer.acknowledge(message).block();
verify(coreConsumer).acknowledgeAsync(message);
}
@Test
void acknowledgeMessageIdCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.acknowledgeAsync(messageId)).thenReturn(completedFuture(null));
reactiveConsumer.acknowledge(messageId).block();
verify(coreConsumer).acknowledgeAsync(messageId);
}
@Test
void acknowledgeMessagesCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.acknowledgeAsync(messages)).thenReturn(completedFuture(null));
reactiveConsumer.acknowledge(messages).block();
verify(coreConsumer).acknowledgeAsync(messages);
}
@Test
void acknowledgeMessageIdListCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.acknowledgeAsync(singletonList(messageId))).thenReturn(completedFuture(null));
reactiveConsumer.acknowledge(singletonList(messageId)).block();
verify(coreConsumer).acknowledgeAsync(singletonList(messageId));
}
@Test
void negativeAcknowledgeMessageIsRelayedToCoreConsumer() {
reactiveConsumer.negativeAcknowledge(message);
verify(coreConsumer).negativeAcknowledge(message);
}
@Test
void negativeAcknowledgeMessageIdIsRelayedToCoreConsumer() {
reactiveConsumer.negativeAcknowledge(messageId);
verify(coreConsumer).negativeAcknowledge(messageId);
}
@Test
void negativeAcknowledgeMessagesIsRelayedToCoreConsumer() {
reactiveConsumer.negativeAcknowledge(messages);
verify(coreConsumer).negativeAcknowledge(messages);
}
@Test
void reconsumeLaterMessageCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.reconsumeLaterAsync(message, 1, TimeUnit.SECONDS))
.thenReturn(completedFuture(null));
reactiveConsumer.reconsumeLater(message, 1, TimeUnit.SECONDS).block();
verify(coreConsumer).reconsumeLaterAsync(message, 1, TimeUnit.SECONDS);
}
@Test
void reconsumeLaterMessagesCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.reconsumeLaterAsync(messages, 1, TimeUnit.SECONDS))
.thenReturn(completedFuture(null));
reactiveConsumer.reconsumeLater(messages, 1, TimeUnit.SECONDS).block();
verify(coreConsumer).reconsumeLaterAsync(messages, 1, TimeUnit.SECONDS);
}
@Test
void acknowledgeCumulativeMessageCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.acknowledgeCumulativeAsync(message))
.thenReturn(completedFuture(null));
reactiveConsumer.acknowledgeCumulative(message).block();
verify(coreConsumer).acknowledgeCumulativeAsync(message);
}
@Test
void acknowledgeCumulativeMessageIdCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.acknowledgeCumulativeAsync(messageId))
.thenReturn(completedFuture(null));
reactiveConsumer.acknowledgeCumulative(messageId).block();
verify(coreConsumer).acknowledgeCumulativeAsync(messageId);
}
@Test
void reconsumeLaterCumulativeCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.reconsumeLaterCumulativeAsync(message, 1, TimeUnit.SECONDS))
.thenReturn(completedFuture(null));
reactiveConsumer.reconsumeLaterCumulative(message, 1, TimeUnit.SECONDS).block();
verify(coreConsumer).reconsumeLaterCumulativeAsync(message, 1, TimeUnit.SECONDS);
}
@Test
void getStatsConsultsWithCoreConsumer() {
ConsumerStats stats = mock(ConsumerStats.class);
when(coreConsumer.getStats()).thenReturn(stats);
assertThat(reactiveConsumer.getStats(), sameInstance(stats));
}
@Test
void hasReachedEndOfTopicConsultsWithCoreConsumer() {
when(coreConsumer.hasReachedEndOfTopic()).thenReturn(true);
assertThat(reactiveConsumer.hasReachedEndOfTopic(), is(true));
}
@Test
void redeliverUnacknowledgedMessagesCallsSameMethodOnCoreConsumer() {
reactiveConsumer.redeliverUnacknowledgedMessages();
verify(coreConsumer).redeliverUnacknowledgedMessages();
}
@Test
void getLastMessageIdReturnsResultFromGetLastMessageIdAsync() {
when(coreConsumer.getLastMessageIdAsync()).thenReturn(completedFuture(messageId));
reactiveConsumer.getLastMessageId()
.as(StepVerifier::create)
.expectNext(messageId)
.verifyComplete();
}
@Test
void seekByMessageIdCallsCorrespondingAsyncMethodOnCoreConsumer() {
MessageId messageId = mock(MessageId.class);
when(coreConsumer.seekAsync(messageId)).thenReturn(completedFuture(null));
reactiveConsumer.seek(messageId).block();
verify(coreConsumer).seekAsync(messageId);
}
@Test
void seekByTimestampCallsCorrespondingAsyncMethodOnCoreConsumer() {
when(coreConsumer.seekAsync(123)).thenReturn(completedFuture(null));
reactiveConsumer.seek(123).block();
verify(coreConsumer).seekAsync(123);
}
@Test
void isConnectedConsultsWithCoreConsumer() {
when(coreConsumer.isConnected()).thenReturn(true);
assertThat(reactiveConsumer.isConnected(), is(true));
}
@Test
void getConsumerNameConsultsWithCoreConsumer() {
when(coreConsumer.getConsumerName()).thenReturn("a");
assertThat(reactiveConsumer.getConsumerName(), is("a"));
}
@Test
void pausePausesCoreConsumer() {
reactiveConsumer.pause();
verify(coreConsumer).pause();
}
@Test
void resumeResumesCoreConsumer() {
reactiveConsumer.resume();
verify(coreConsumer).resume();
}
@Test
void getLastDisconnectedTimestampConsultsWithCoreConsumer() {
when(coreConsumer.getLastDisconnectedTimestamp()).thenReturn(123L);
assertThat(reactiveConsumer.getLastDisconnectedTimestamp(), is(123L));
}
} | [
"roman.puchkovskiy@gmail.com"
] | roman.puchkovskiy@gmail.com |
16616c5854117d8353bfa6bc68d190ae3e56e8d6 | 86cca729cf7af493b146a273e1b5b22e756bc9de | /tests/daikon-tests/MapQuick/issta-goals/MapQuick2/ElementaryRoute.java | a4b49e85454e716a9bd62002eace6bea86d67fd3 | [] | no_license | carolemieux/daikon | 9c385a71b21260aa52295fd7ace20a1c8645c85b | 039525982eb092239cde4178dae2096463418ca3 | refs/heads/master | 2021-01-21T16:18:44.596890 | 2016-05-13T23:35:46 | 2016-05-13T23:35:46 | 38,269,518 | 1 | 0 | null | 2015-06-29T20:26:37 | 2015-06-29T20:26:36 | null | UTF-8 | Java | false | false | 8,307 | java | package MapQuick2;
import MapQuick.*;
import java.util.*;
import junit.framework.Assert;
/**
* An ElementaryRoute represents a route from one location to another along
* a single geographic feature.
* ElementaryRoutes are immutable.<p>
*
* ElementaryRoute abstracts over a sequence
* of GeoSegments, all of which have the same name, thus providing a
* representation for nonlinear or nonatomic geographic features.
* As an example, an ElementaryRoute might represent the course of a
* winding river, or travel along a road through intersections but
* remaining on the same road.<p>
*
* ElementaryRoute adds the following specification field to Route:
* @specfield name : String
* @endspec
* <p>
* <b>Rationale</b>:
*
* Since GeoSegments are linear, and because even straight courses may be
* split into multiple GeoSegments for other reasons (such as representing
* intersections), some features cannot be represented by a single
* GeoSegment. However, when labeling rivers on a map, giving driving
* directions along roads, etc., multiple segments along the same feature
* should be treated as a unit. For instance, it would not be useful for
* directions to say,
* <pre>
* Turn right onto Lombard Street and go 0.1 miles.
* Turn left onto Lombard Street and go 0.1 miles.
* Turn right onto Lombard Street and go 0.1 miles.
* Turn left onto Lombard Street and go 0.1 miles.
* Turn right onto Lombard Street and go 0.1 miles.
* Turn left onto Lombard Street and go 0.1 miles.
* Turn right onto Lombard Street and go 0.1 miles.</pre>
* Instead, the directions should say,
* <pre>
* Turn right onto Lombard Street and go 0.7 miles.</pre>
*
* As another example, Mass Ave might be represented by one segment from
* the Harvard Bridge to Vassar Street, another from Vassar Street to Main
* Street, and another from Main Street to Prospect Street. The directions
* should not say
* <pre>
* Turn right onto Mass Ave and go 0.2 miles.
* Continue onto Mass Ave and go 0.4 miles.
* Continue onto Mass Ave and go 0.2 miles.</pre>
* Instead, the directions should say,
* <pre>
* Turn right onto Mass Ave and go 0.8 miles.</pre>
* <p>
**/
public class ElementaryRoute extends Route {
/*@ invariant this.name != null; */
// fields
/*@ spec_public */ private String name;
/*@ spec_public */ private final static double REP_SCALE_FACTOR = 1000000.0;
/*@ requires gs != null; */
/**@ requires gs.name != null; */
/**@ requires gs.p1 != null; */
/**@ requires gs.p2 != null; */
/*@ ensures gs.name == this.name; */
// Constructors
/**
* Constructs a new ElementaryRoute.
* @effects Constructs a new ElementaryRoute, r, such that
* r.name = gs.name. The specification fields of r inherited
* from Route are set according to the specification of
* Route(GeoSegment gs).
* @see Route#Route(GeoSegment gs)
**/
public ElementaryRoute(GeoSegment gs){
super(gs);
this.name = gs.name();
}
/*@ requires el != null; */
/*@ requires gs != null; */
/*@ requires gs.p1 != null; */
/*@ requires gs.p2 != null; */
// Constructs a Route consisting of a GeoSegment gs added to the Route r
// requires: gs != null && el != null && gs.p1 = r.end && gs.name = r.name
// effects:
// this.start = r.start
// this.end = gs.p2
// this.length = r.length + gs.length
// this.startHeading = r.startHeading
// this.endHeading = gs.heading
private ElementaryRoute(ElementaryRoute el,GeoSegment gs){
super(el,gs);
Assert.assert(gs.name().equals(el.name()));
this.name = el.name();
}
/*@ requires gs != null; */
/**@ requires gs.p1 != null; */
/**@ requires gs.p2 != null; */
/*@ ensures \result != null; */
// Producers
/**
* Extends the route by adding a new segment to its end. The segment must
* be properly oriented, and its name must be the same as the name of
* this ElementaryRoute.<p>
*
* @requires gs != null && gs.p1 = this.end && gs.name = this.name
* @return a new ElementaryRoute r such that
* r.end = gs.p2
* && r.endHeading = gs.heading
* && r.length = this.length + gs.length
**/
public ElementaryRoute addSegment(GeoSegment gs){
// the assert is done in the constructor
return new ElementaryRoute(this,gs);
}
/*@ ensures \result == this.name; */
/**@ ensures \result == \old(this.name); */
// Observers
// @return this.name
public String name(){
return this.name;
}
/*@ also_ensures \result != null; */
/**
* Give directions for following this ElementaryRoute, starting at its
* start point and facing in the specified heading.
* @requires 0 <= heading < 360
* @return a one-line newline-terminated human-readable directions string.
* The directions string is of the form
* <pre>
* Turn right onto Baker Street and go 1.2 miles.
* </pre>
* Here, "Turn right" rotates the traveler from the given heading to
* this.startHeading, "Baker Street" is this.name, and 1.2 miles is
* this.length. The length is printed with tenth-of-a-mile precision.<p>
*
* Let the turn angle be a. The tur n should be annotated as
* <pre>
* Continue if a < 10
* Turn slight right if 10 <= a < 60
* Turn right if 60 <= a < 120
* Turn sharp right if 120 <= a < 179
* U-turn if 179 <= a
* </pre>
* and likewise for left turns.<p>
**/
public String directions(double heading){
Assert.assert((0<= heading) && (heading<360));
// calculate both the initial angle
boolean clockwise = false;
double initial = this.startHeading() - heading;
double angle;
if (initial >= 0)
clockwise = true;
if(Math.abs(initial)<180){
angle = initial;
}
else{
angle= 360 - Math.abs(initial);
if(clockwise)
angle = -angle;
}
String direction;
// if angle is positive, deal with the right case
if(angle>=0){
if(angle<10)
direction = "Continue";
else if(angle <60)
direction = "Turn slight right";
else if(angle<120)
direction = "Turn right";
else if(angle<179)
direction = "Turn sharp right";
else
direction ="U-turn";
} else {
//if angle is negative, deal with the left case
if(angle>-10)
direction = "Continue";
else if(angle>-60)
direction = "Turn slight left";
else if(angle>-120)
direction = "Turn left";
else if(angle>-179)
direction = "Turn sharp left";
else
direction ="U-turn";
}
//rounding business, is there something more efficient?
double l = this.length() * 10;
l = Math.round(l);
l = l /10;
return direction+" onto "+this.name()+" and go "+l+" miles.\n";
}
// return an array of ElementaryRoute[] with the only element <this>
public ElementaryRoute[] elementaryRoutes(){
ElementaryRoute[] erArray = new ElementaryRoute[1];
erArray[0] = this;
return erArray;
}
/**
* Compares the specified Object with with this ElementaryRoute for equality.
* @return r != null && (r instanceof ElementaryRoute)
* && r.name = this.name && r.start = this.start && r.end = this.end
* && r.startHeading = this.startHeading
* && r.endHeading = this.endHeading && r.length = this.length
**/
public boolean equals(Object er){
Assert.assert(er != null);
Assert.assert(er instanceof ElementaryRoute);
if((er != null) && (er instanceof ElementaryRoute)){
ElementaryRoute r = (ElementaryRoute)er;
return super.equals(r) && (this.name() == r.name());
}else
return false;
}
/**
* @return a valid hashcode for this.
**/
public int hashCode() {
// 2 ElementaryRoutes are equal if they have the same name, the same start,
// the same end, the same startHeading, the same endHeading and the same
// length
return super.hashCode() + name.hashCode();
}
/**
* @return a string representation of this.
**/
public String toString(){
return "Elementary"+super.toString()+ this.name()+ "}";
}
} // ElementaryRoute
| [
"mernst@cs.washington.edu"
] | mernst@cs.washington.edu |
327f1110852294ba95f361859b231e2f32f259f5 | d1032521f281c74b1b48c3edd5f810c8bed00d1e | /src/main/java/com/github/pires/obd/reader/activity/MapActivityFragment.java | 50633252c4336de1393e536e8fa6e36add6a10df | [
"Apache-2.0"
] | permissive | namgk/android-obd-reader | 06a475268869318cc22b38a65930677b862ac641 | fe2c39af4d7429ac5cfef7f5165bbb0ed32a8c3f | refs/heads/master | 2021-01-22T14:05:40.394524 | 2015-08-16T01:49:18 | 2015-08-16T01:49:18 | 39,325,763 | 0 | 0 | null | 2015-07-19T07:13:25 | 2015-07-19T07:13:25 | null | UTF-8 | Java | false | false | 674 | java | package com.github.pires.obd.reader.activity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.pires.obd.reader.R;
import roboguice.fragment.RoboFragment;
/**
* A placeholder fragment containing a simple view.
*/
public class MapActivityFragment extends RoboFragment {
public MapActivityFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_map, container, false);
}
}
| [
"namtrang@Nams-MacBook-Air.local"
] | namtrang@Nams-MacBook-Air.local |
6fd6ecdeb08e4271ec74b2a7563375c12a9186c7 | 962e519c9c17e6247402050d64fa95d9904360d0 | /src/main/java/com/wj/store/controller/ex/FileUploadException.java | 50de8796d8f10f95105cf0f5f53eb90a47e71374 | [] | no_license | qwerasdzxc123/store | ef714f0e215dca57400ea0f8d7127b0b6b41105a | 59ff92d74b73919064afbed09f16946cee2654dd | refs/heads/master | 2023-08-21T17:01:02.948155 | 2021-09-11T03:54:29 | 2021-09-11T03:54:29 | 405,277,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | package com.wj.store.controller.ex;
/** 文件上传相关异常的基类 */
public class FileUploadException extends RuntimeException {
public FileUploadException() {
super();
}
public FileUploadException(String message) {
super(message);
}
public FileUploadException(String message, Throwable cause) {
super(message, cause);
}
public FileUploadException(Throwable cause) {
super(cause);
}
protected FileUploadException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"WangJin@qq.com"
] | WangJin@qq.com |
14c1f5f5157b19fce401513a6a1123a7f5915dc4 | 5f33b60ccc2c90c762a1997c31334d87df1cf935 | /first_java/src/main/java/SumSeries.java | ea82d46c310d95c8763251b99fa626a24470da51 | [] | no_license | akspreet/hsbc_sep | 11db0483a17ff42c36ff4e8b6533a0a2e067b352 | 7d39edd659091cd073733041542eece015ee0161 | refs/heads/master | 2022-12-31T22:48:38.223668 | 2020-10-20T10:51:59 | 2020-10-20T10:51:59 | 295,686,609 | 0 | 0 | null | 2020-09-23T10:30:32 | 2020-09-15T10:01:47 | Java | UTF-8 | Java | false | false | 323 | java |
public class SumSeries {
public static void main(String[] args) {
int x=4;
int n=5;
int fact[] =new int[10];
fact[0]=1;
for(int i=1; i<=n; i++)
fact[i]=fact[i-1]*i;
double sum=0;
for(int i=0; i<=n; i++)
sum=sum+ (Math.pow(x,i)/fact[i]);
System.out.println("Sum of the series is "+sum);
}
}
| [
"akspreet2497@gmail.com"
] | akspreet2497@gmail.com |
61e35171977737be13ed1f7f9ea8c9e162e07eff | accffaac0ecf4942987942deae47045b1df3f6fa | /src/main/java/com/example/crawler_server/utils/TaskUtil.java | 5ef03234cf936aca4594862212112de4f0744bbe | [] | no_license | modianor/crawler_server | 6c8494e98ab8a43977e7d51da5dc540a909c54a6 | 8ea931ce3c89c1010cceb27d58b8188abc37fa0e | refs/heads/master | 2023-08-23T09:50:23.605619 | 2021-10-21T09:26:02 | 2021-10-21T09:26:02 | 419,659,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.example.crawler_server.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.crawler_server.entity.Task;
public class TaskUtil {
public static String dump_task(Task task) {
return JSON.toJSONString(task);
}
public static Task load_task(String task_json) {
return JSON.parseObject(task_json, Task.class);
}
}
| [
"hui.wang@miotech.com"
] | hui.wang@miotech.com |
d99dee3a850547a58f908696406cb04f61014b47 | 03ba1cab492e21c6c8b2ea1e655622ecfdd8ffa8 | /trunk/modules/common/common-util/src/main/java/org/grouter/common/jms/XTimesRebind.java | fe44cea0676bed55556a11b370488e15508d22d3 | [
"Apache-2.0"
] | permissive | BackupTheBerlios/grouter-svn | 1655525584c8a7b496fac85a3dcb7620e71d8c17 | 24e90197319c99c521a0c7fdc314ebb122ea9bd4 | refs/heads/master | 2021-01-22T17:47:39.490895 | 2009-09-20T11:01:07 | 2009-09-20T11:01:07 | 40,664,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,096 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.grouter.common.jms;
import org.apache.log4j.Logger;
import org.grouter.common.exception.RemoteGrouterException;
/**
* Rebinds x number of times.
*
* @author Georges Polyzois
*/
public class XTimesRebind extends RebindBehavior
{
/** Logger. */
private static Logger logger = Logger.getLogger(XTimesRebind.class);
/** Counter for max number of retires to rebind. */
private int numberOfTimes = 1;
/**
* Constructor.
*
* @param numberOfTimes int
*/
public XTimesRebind(int numberOfTimes)
{
this.numberOfTimes = numberOfTimes;
}
/**
* The algorithm implementation for rebinding goes here.
*/
public void rebind(AbstractDestination dest)
{
logger.info("Rebinding using behavior implementation : " + this.getClass().getName());
for (int i = 0; i < numberOfTimes; i++)
{
try
{
dest.unbind();
dest.bind();
logger.debug("We rebinded to the destination on attempt number " + numberOfTimes);
return;
} catch (RemoteGrouterException e)
{
//ignore
}
}
}
}
| [
"gepo01@6e64f7dd-db05-0410-9ee2-d86f13d23bb4"
] | gepo01@6e64f7dd-db05-0410-9ee2-d86f13d23bb4 |
8ef61e15169a1a626bf445f2cd6b42b15df6887f | 2563630b956ab313a3f0d3f3c1a5e2621c5b6caa | /src/main/java/com/lianfu/gasserversys/mode/GasDevice.java | 6135a5eb183084dcd204ba86ef7206e8df0b47ef | [] | no_license | ql120322/gasserversys | 76165e866ed4577ae293c34ad3da29aae25e1ffd | b48cebbd7570b9376b32d6d27b66d05a4d58056c | refs/heads/master | 2022-12-16T05:06:08.409725 | 2020-09-22T02:46:44 | 2020-09-22T02:46:44 | 297,515,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,022 | java | package com.lianfu.gasserversys.mode;
import org.springframework.stereotype.Component;
@Component
public class GasDevice {
private int did;
private String gas_name;//所属加油站名称
private String appid;//所属加油站appid
private String Refueling_gun_ip;//加油枪ip
private String Refueling_gun_name;//加油枪别名
private String Entrytime;//录入时间
private String Updata;//修改时间
public int getDid() {
return did;
}
public void setDid(int did) {
this.did = did;
}
public String getGas_name() {
return gas_name;
}
public void setGas_name(String gas_name) {
this.gas_name = gas_name;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getRefueling_gun_ip() {
return Refueling_gun_ip;
}
public void setRefueling_gun_ip(String refueling_gun_ip) {
Refueling_gun_ip = refueling_gun_ip;
}
public String getRefueling_gun_name() {
return Refueling_gun_name;
}
public void setRefueling_gun_name(String refueling_gun_name) {
Refueling_gun_name = refueling_gun_name;
}
public String getEntrytime() {
return Entrytime;
}
public void setEntrytime(String entrytime) {
Entrytime = entrytime;
}
public String getUpdata() {
return Updata;
}
public void setUpdata(String updata) {
Updata = updata;
}
@Override
public String toString() {
return "GasDevice{" +
"did=" + did +
", gas_name='" + gas_name + '\'' +
", appid='" + appid + '\'' +
", Refueling_gun_ip='" + Refueling_gun_ip + '\'' +
", Refueling_gun_name='" + Refueling_gun_name + '\'' +
", Entrytime='" + Entrytime + '\'' +
", Updata='" + Updata + '\'' +
'}';
}
}
| [
"1203229191@qq.com"
] | 1203229191@qq.com |
8ffedb8d9d8d91175e15210292343dc3204ccfa0 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-418-13-14-PESA_II-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/listener/chaining/AbstractChainingListener_ESTest_scaffolding.java | 292c11b86e6587931884318c105a0688c07304fe | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Apr 03 01:55:24 UTC 2020
*/
package org.xwiki.rendering.listener.chaining;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractChainingListener_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
dda447c48a472c0409edc7fab03160e76bd2e1a4 | 615b95efeab2ba137b7e4eadd4bd80ec05b15932 | /APCSA/src/Unit14/FancyWord.java | 81d767a9c4f5f6e8e5f92ba530a6080c617e9ecc | [] | no_license | spagettoucher143/APCSA | db82d37f138fbe40999dfc430174f1c934905afd | 09e30511374be056f8e4b3cd3f23e1d38366b721 | refs/heads/master | 2021-05-08T13:48:06.426740 | 2018-04-27T21:55:20 | 2018-04-27T21:55:20 | 120,034,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package Unit14;
import java.util.Arrays;
import java.util.Scanner;
import static java.lang.System.*;
public class FancyWord {
private char[][] mat;
public FancyWord() {
}
public FancyWord(String s) {
mat = new char[s.length()][s.length()];
for(int q=0;q<s.length();q++){
Arrays.fill(mat[q], ' ');
}
for(int q=0;q<s.length();q++){
mat[0][q]=s.charAt(q);
mat[s.length()-1][q]=s.charAt(q);
}
for(int q=1;q<s.length()-1;q++){
for(int w=1;w<s.length();w++){
if(q==w)mat[q][w]=s.charAt(q);
if(q+w==s.length()-1)mat[q][w]=s.charAt(w);
}
}
}
public String toString() {
String output = "";
for(int q=0;q<mat.length;q++){
for(int e=0;e<mat[q].length;e++)output+=mat[q][e];
output+="\n";
}
return output + "\n\n";
}
} | [
"Derek_000@Home_PC2"
] | Derek_000@Home_PC2 |
3e09d7beffb3996b856ccc73c8353e0672ae6343 | c37248dff43ff9701c36fe2d01df0143cfa806d9 | /Lecture4/src/ClassWork/TestVarArg.java | 816de46cc9ddfc1d340dedc95b5098c14b2d393d | [] | no_license | ziaullahmughal/JSpringEVS4all | f367dc25a17d84d4a4ec0659dbabd5e48a99d942 | 4be00853daa9844b2205853792338b1966a5b71f | refs/heads/master | 2020-12-01T17:07:30.641227 | 2020-03-06T10:31:02 | 2020-03-06T10:31:02 | 230,706,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | 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 ClassWork;
/**
*
* @author zia
*/
public class TestVarArg {
public static void main(String[] args) {
print(10);
print(10, 11.1, "two");
print('a', 'c');
print();
}
public static void print (Object...arg){
for (Object o : arg){
System.out.print(o + " ");
}
System.out.println();
}
}
| [
"59131718+ziaullahmughal@users.noreply.github.com"
] | 59131718+ziaullahmughal@users.noreply.github.com |
f7186516a88fa7cb42b1daebdbbc387bd9a4ec9c | b33d1ad61816b8ec15557ae5ded109bae5bf72e1 | /73 - LETP/src/lry/dip/client/Panneau.java | a9887a2489d0585efcebb69f5f7dc807dcb314b4 | [] | no_license | Crezius/Tous_les_-_exo_java | 2a4b5bb6bb0df9224e3f3204050c7c1ea4e227e4 | cbd8e47bef4b8dcb7bc233f995ff63a85607dd10 | refs/heads/master | 2020-04-20T01:02:04.912461 | 2019-02-05T01:31:21 | 2019-02-05T01:31:21 | 168,534,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,348 | java | package lry.dip.client;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Panneau extends JPanel{
/******************** Variables ***********************/
private final static int LARGEUR = 120;
private final static int HAUTEUR = 20;
private static final long serialVersionUID = 1L;
private JComboBox<String> titre = new JComboBox<>();
private JTextField nom = new JTextField();
private JTextField prenom = new JTextField();
private JTextArea adresse = new JTextArea();
private JPanel panLabel, panSaisie;
private JLabel labTitre, labNom, labPrenom, labAdresse;
/******************** Constructeur ***********************/
public Panneau() {
labTitre = new JLabel("Titre : ");
labNom = new JLabel("Nom : ");
labPrenom = new JLabel("Prenom : ");
labAdresse = new JLabel("Adresse : ");
labTitre.setSize(LARGEUR, HAUTEUR);
labNom.setSize(LARGEUR, HAUTEUR);
labPrenom.setSize(LARGEUR, HAUTEUR);
labAdresse.setSize(LARGEUR, HAUTEUR);
titre.setSize(LARGEUR, HAUTEUR);
nom.setSize(LARGEUR, HAUTEUR);
prenom.setSize(LARGEUR, HAUTEUR);
titre.addItem("Homme");
titre.addItem("Femme");
titre.addItem("Hélicoptère Apache");
// panLabel = new JPanel();
panSaisie = new JPanel();
this.setLayout(new BorderLayout());
// this.add(panLabel, BorderLayout.WEST);
this.add(panSaisie, BorderLayout.NORTH);
this.add(labAdresse, BorderLayout.SOUTH);
this.add(adresse, BorderLayout.SOUTH);
GridLayout grid = new GridLayout(4, 2);
// GridLayout g2 = new GridLayout(3, 0);
// g1.setVgap(10);
// panLabel.setLayout(g1);
panSaisie.setLayout(grid);
panSaisie.add(labTitre);
panSaisie.add(titre);
panSaisie.add(labNom);
panSaisie.add(nom);
panSaisie.add(labPrenom);
panSaisie.add(prenom);
panSaisie.add(labAdresse);
}
/*********************** Getter / Setter ********************/
public JComboBox<String> getTitre() {
return titre;
}
public void setTitre(JComboBox<String> titre) {
this.titre = titre;
}
public JTextField getNom() {
return nom;
}
public void setNom(JTextField nom) {
this.nom = nom;
}
public JTextField getPrenom() {
return prenom;
}
public void setPrenom(JTextField prenom) {
this.prenom = prenom;
}
public JTextArea getAdresse() {
return adresse;
}
public void setAdresse(JTextArea adresse) {
this.adresse = adresse;
}
public JPanel getPanLabel() {
return panLabel;
}
public void setPanLabel(JPanel panLabel) {
this.panLabel = panLabel;
}
public JPanel getPanSaisie() {
return panSaisie;
}
public void setPanSaisie(JPanel panSaisie) {
this.panSaisie = panSaisie;
}
public JLabel getLabTitre() {
return labTitre;
}
public void setLabTitre(JLabel labTitre) {
this.labTitre = labTitre;
}
public JLabel getLabNom() {
return labNom;
}
public void setLabNom(JLabel labNom) {
this.labNom = labNom;
}
public JLabel getLabAdresse() {
return labAdresse;
}
public void setLabAdresse(JLabel labAdresse) {
this.labAdresse = labAdresse;
}
/******************** Fonctions ************************/
}
| [
"arnaud.guignard@etu.univ-nantes.f"
] | arnaud.guignard@etu.univ-nantes.f |
66000880ba5d1fe7c2a7d506093c6b8f293af835 | 1b3bfa661f8e008b9a3eb20b04fc5dda4b0c5d6a | /app/src/main/java/com/naca/mealacle/p06/CartListAdapter.java | 840f65366fea844a65d65b4151ee73314ff0b98c | [] | no_license | 2021-Collathon-team-5/Mealacle_app | a853124541037badfd49ead1a80af39c88adae71 | 8275152b4a9a953de946d24988e7d2c4a699cc25 | refs/heads/master | 2023-08-25T14:47:06.402204 | 2021-11-12T14:25:05 | 2021-11-12T14:25:05 | 410,916,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,000 | java | package com.naca.mealacle.p06;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.naca.mealacle.BR;
import com.naca.mealacle.R;
import com.naca.mealacle.data.CartProduct;
import com.naca.mealacle.data.Food;
import com.naca.mealacle.databinding.CartElementBinding;
import com.naca.mealacle.p04.FoodListAdapter;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedList;
import javax.net.ssl.HttpsURLConnection;
public class CartListAdapter extends RecyclerView.Adapter<CartListAdapter.BindingViewHolder> {
private LinkedList<CartProduct> cartList;
private Context context;
public interface OnItemClickListener {
void onItemClick(View v, int position);
}
public static OnItemClickListener mListener = null;
public CartListAdapter(LinkedList<CartProduct> cartList, Context context) {
this.cartList = cartList;
this.context = context;
}
@NonNull
@Override
public BindingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
CartElementBinding binding = CartElementBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new BindingViewHolder(binding);
}
@Override
public void onBindViewHolder(@NonNull BindingViewHolder holder, int position) {
holder.bind(cartList.get(position));
}
@Override
public int getItemCount() {
return cartList.size();
}
public void setOnItemClickListener(OnItemClickListener listener) {
this.mListener = listener;
}
public class BindingViewHolder extends RecyclerView.ViewHolder {
CartElementBinding binding;
ImageView imageView;
Bitmap bitmap;
public BindingViewHolder(@NonNull CartElementBinding binding) {
super(binding.getRoot());
this.binding = binding;
binding.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = getBindingAdapterPosition();
if(position != RecyclerView.NO_POSITION){
cartList.remove(position);
notifyItemRemoved(position);
}
}
});
binding.increase.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View v) {
int position = getBindingAdapterPosition();
if(position != RecyclerView.NO_POSITION){
cartList.get(position).setCount(cartList.get(position).getCount() + 1);
binding.count.setText(Integer.toString(cartList.get(position).getCount()));
binding.total.setText(cartList.get(position).getTotal());
if(CartListAdapter.mListener != null) {
CartListAdapter.mListener.onItemClick(v, position);
}
}
}
});
binding.decrease.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = getBindingAdapterPosition();
if(position != RecyclerView.NO_POSITION){
cartList.get(position).setCount(cartList.get(position).getCount() - 1);
binding.count.setText(Integer.toString(cartList.get(position).getCount()));
binding.total.setText(cartList.get(position).getTotal());
if(CartListAdapter.mListener != null) {
CartListAdapter.mListener.onItemClick(v, position);
}
}
}
});
}
public void bind(CartProduct cartProduct) {
binding.setVariable(BR.cart, cartProduct);
imageView = binding.foodimage;
ReviewLoadTask task = new ReviewLoadTask(cartProduct.getFood().getImages());
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private class ReviewLoadTask extends AsyncTask<Void, Void, Bitmap> {
private String urlStr;
public ReviewLoadTask(String url){
this.urlStr = url;
}
@Override
protected Bitmap doInBackground(Void... voids) {
Bitmap bitmap = null;
try{
URL url = new URL(urlStr);
bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());
}catch (Exception e){}
return bitmap;
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
try{
if(bitmap != null) {
Glide.with(context).load(bitmap).into(imageView);
}
else {
Glide.with(context).load(itemView.getResources().getDrawable(R.drawable.ic_launcher_background)).into(imageView);
}
} catch (Exception e){
e.printStackTrace();
}
}
}
}
}
| [
"radium96@naver.com"
] | radium96@naver.com |
4d1bcd7d0a0082685ab3f8405d93cf2d89fc9d79 | 840e23084cc09278f40e51fb8c9b49185d431493 | /src/main/java/com/dms/entitiy/CmLineMEntity.java | 8e8da9a57fd4bd1bb492fa8e45f64cae4c01bee5 | [] | no_license | nohhhhhhh/00.dms-api-server | a82e6e2a341ad318e1f9a9dc3e8451e033a95ce0 | a077003fcba763217b4c8ee09b0997cc4cb5b135 | refs/heads/master | 2023-07-18T09:22:56.998493 | 2021-09-06T23:44:39 | 2021-09-06T23:44:39 | 385,157,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,291 | java | package com.dms.entitiy;
import java.sql.Timestamp;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
@Entity
@Table(name = "CM_LINE_M", schema = "dbo")
@IdClass(CmLineMEntityPK.class)
public class CmLineMEntity {
private String lineId;
private String lineNm;
private String parentLineId;
private int seq;
private String pmsYn;
private String wgtYn;
private String ifYn;
private String ifId;
private String plantId;
private String description;
private String useYn;
private Timestamp createDt;
private String createUserId;
private Timestamp updateDt;
private String updateUserId;
private String api;
private String tid;
@Id
@Column(name = "LINE_ID")
public String getLineId() {
return lineId;
}
public void setLineId(String lineId) {
this.lineId = lineId;
}
@Basic
@Column(name = "LINE_NM")
public String getLineNm() {
return lineNm;
}
public void setLineNm(String lineNm) {
this.lineNm = lineNm;
}
@Basic
@Column(name = "PARENT_LINE_ID")
public String getParentLineId() {
return parentLineId;
}
public void setParentLineId(String parentLineId) {
this.parentLineId = parentLineId;
}
@Basic
@Column(name = "SEQ")
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
@Basic
@Column(name = "PMS_YN")
public String getPmsYn() {
return pmsYn;
}
public void setPmsYn(String pmsYn) {
this.pmsYn = pmsYn;
}
@Basic
@Column(name = "WGT_YN")
public String getWgtYn() {
return wgtYn;
}
public void setWgtYn(String wgtYn) {
this.wgtYn = wgtYn;
}
@Basic
@Column(name = "IF_YN")
public String getIfYn() {
return ifYn;
}
public void setIfYn(String ifYn) {
this.ifYn = ifYn;
}
@Basic
@Column(name = "IF_ID")
public String getIfId() {
return ifId;
}
public void setIfId(String ifId) {
this.ifId = ifId;
}
@Id
@Column(name = "PLANT_ID")
public String getPlantId() {
return plantId;
}
public void setPlantId(String plantId) {
this.plantId = plantId;
}
@Basic
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Basic
@Column(name = "USE_YN")
public String getUseYn() {
return useYn;
}
public void setUseYn(String useYn) {
this.useYn = useYn;
}
@Basic
@CreationTimestamp
@Column(name = "CREATE_DT", insertable = true, updatable = false)
public Timestamp getCreateDt() {
return createDt;
}
public void setCreateDt(Timestamp createDt) {
this.createDt = createDt;
}
@Basic
@Column(name = "CREATE_USER_ID", insertable = true, updatable = false)
public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
@Basic
@UpdateTimestamp
@Column(name = "UPDATE_DT", insertable = false, updatable = true, columnDefinition = "DATETIME(2)")
public Timestamp getUpdateDt() {
return updateDt;
}
public void setUpdateDt(Timestamp updateDt) {
this.updateDt = updateDt;
}
@Basic
@Column(name = "UPDATE_USER_ID", insertable = false, updatable = true)
public String getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}
@Basic
@Column(name = "API")
public String getApi() {
return api;
}
public void setApi(String api) {
this.api = api;
}
@Basic
@Column(name = "TID")
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CmLineMEntity that = (CmLineMEntity) o;
return Objects.equals(lineId, that.lineId) &&
Objects.equals(lineNm, that.lineNm) &&
Objects.equals(parentLineId, that.parentLineId) &&
Objects.equals(seq, that.seq) &&
Objects.equals(pmsYn, that.pmsYn) &&
Objects.equals(wgtYn, that.wgtYn) &&
Objects.equals(ifYn, that.ifYn) &&
Objects.equals(ifId, that.ifId) &&
Objects.equals(plantId, that.plantId) &&
Objects.equals(description, that.description) &&
Objects.equals(useYn, that.useYn) &&
Objects.equals(createDt, that.createDt) &&
Objects.equals(createUserId, that.createUserId) &&
Objects.equals(updateDt, that.updateDt) &&
Objects.equals(updateUserId, that.updateUserId) &&
Objects.equals(api, that.api) &&
Objects.equals(tid, that.tid);
}
@Override
public int hashCode() {
return Objects
.hash(lineId, lineNm, parentLineId, seq, pmsYn, wgtYn, ifYn, ifId, plantId, description,
useYn, createDt, createUserId, updateDt, updateUserId, api, tid);
}
}
| [
"01023571995a@gmail.com"
] | 01023571995a@gmail.com |
1c9ef5990b3c5cab26bd0ec59e3208f4f41af2f8 | de2f9a7ab587cbce18e162b3f0704995d8513b1b | /src/BTL_NHOM15/QuanLyNhanVien.java | ef9d6f5bdd9ff9fd2fde52e018bad44a638d78e3 | [] | no_license | abch2409/baitapnhom | 7a0e9efa9a89a8bdc71976ed64bf0a5e87b98b6a | 8375c628287411e32b9d656059620d969d466503 | refs/heads/main | 2023-05-30T06:37:54.990678 | 2021-06-12T10:58:54 | 2021-06-12T10:58:54 | 376,267,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 50,699 | 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 BTL_NHOM15;
import BTL_NHOM15.login.DangNhap;
import java.awt.Color;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.GregorianCalendar;
import java.util.Locale;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class QuanLyNhanVien extends javax.swing.JFrame {
public static ArrayList<NhanVien> list = new ArrayList<NhanVien>();
ArrayList<NhanVien> listTim = new ArrayList<NhanVien>();
int dem = -1;
int vitri;
String pathFile;
String duongdananh = "E:\\avatame.png";
int timeRun = 0;
boolean xetNext = false;
public QuanLyNhanVien() {
initComponents();
setLocationRelativeTo(null);
setForeground(Color.red);
setTitle("QUAN LY NHAN VIEN");
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
txtMaNV = new java.awt.TextField();
txtTen = new java.awt.TextField();
txtTuoi = new java.awt.TextField();
txtMail = new java.awt.TextField();
txtLuong = new java.awt.TextField();
lblanh = new javax.swing.JLabel();
btnChonHinh = new javax.swing.JButton();
btnThem = new javax.swing.JButton();
btnSua = new javax.swing.JButton();
btnXoa = new javax.swing.JButton();
btnTim = new javax.swing.JButton();
btnNhapMoi = new javax.swing.JButton();
btnThoat = new javax.swing.JButton();
btnLuuFile = new javax.swing.JButton();
btnDocFile = new javax.swing.JButton();
btnHienThi = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tableNhanVien = new javax.swing.JTable();
btn2 = new javax.swing.JButton();
btn3 = new javax.swing.JButton();
btnSapXepTheoMa = new javax.swing.JButton();
btnSapXepTheoTen = new javax.swing.JButton();
btnSapXepTheoTuổi = new javax.swing.JButton();
btnSapXepTheoEmail = new javax.swing.JButton();
btnSapXepTheoLuong = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jlabelTable = new javax.swing.JLabel();
jButton1.setText("jButton1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel2.setForeground(new java.awt.Color(51, 51, 51));
jLabel2.setText("Nhập mã nhân viên");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel3.setForeground(new java.awt.Color(51, 51, 51));
jLabel3.setText("Nhập tên nhân viên");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel4.setForeground(new java.awt.Color(51, 51, 51));
jLabel4.setText("Nhập tuổi");
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel5.setForeground(new java.awt.Color(51, 51, 51));
jLabel5.setText("Nhập email");
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel6.setForeground(new java.awt.Color(51, 51, 51));
jLabel6.setText("Nhập lương");
txtMaNV.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
txtMaNV.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
txtMaNV.setName(""); // NOI18N
txtMaNV.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtMaNVActionPerformed(evt);
}
});
txtTen.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
txtTen.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
txtTuoi.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
txtMail.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
txtLuong.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
lblanh.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
lblanh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BTL_NHOM15/login/avatasinhvienmacdinh.png"))); // NOI18N
lblanh.setText(" AVATAR");
btnChonHinh.setBackground(new java.awt.Color(204, 0, 0));
btnChonHinh.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnChonHinh.setForeground(new java.awt.Color(255, 255, 255));
btnChonHinh.setText("Chọn hình");
btnChonHinh.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnChonHinhActionPerformed(evt);
}
});
btnThem.setBackground(new java.awt.Color(255, 0, 204));
btnThem.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnThem.setForeground(new java.awt.Color(255, 255, 255));
btnThem.setText("Thêm");
btnThem.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
btnThemAncestorAdded(evt);
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
btnThem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnThemActionPerformed(evt);
}
});
btnSua.setBackground(new java.awt.Color(255, 0, 204));
btnSua.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSua.setForeground(new java.awt.Color(255, 255, 255));
btnSua.setText("Sửa");
btnSua.setToolTipText("");
btnSua.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSuaActionPerformed(evt);
}
});
btnXoa.setBackground(new java.awt.Color(255, 0, 204));
btnXoa.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnXoa.setForeground(new java.awt.Color(255, 255, 255));
btnXoa.setText("Xóa");
btnXoa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnXoaActionPerformed(evt);
}
});
btnTim.setBackground(new java.awt.Color(0, 0, 0));
btnTim.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnTim.setForeground(new java.awt.Color(255, 255, 255));
btnTim.setText("Tìm nhân viên");
btnTim.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnTimActionPerformed(evt);
}
});
btnNhapMoi.setBackground(new java.awt.Color(255, 0, 204));
btnNhapMoi.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnNhapMoi.setForeground(new java.awt.Color(255, 255, 255));
btnNhapMoi.setText("Nhập Mới");
btnNhapMoi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNhapMoiActionPerformed(evt);
}
});
btnThoat.setBackground(new java.awt.Color(255, 0, 204));
btnThoat.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnThoat.setForeground(new java.awt.Color(255, 255, 255));
btnThoat.setText("Thoát");
btnThoat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnThoatActionPerformed(evt);
}
});
btnLuuFile.setBackground(new java.awt.Color(255, 0, 204));
btnLuuFile.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnLuuFile.setForeground(new java.awt.Color(255, 255, 255));
btnLuuFile.setText("Lưu File");
btnLuuFile.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLuuFileActionPerformed(evt);
}
});
btnDocFile.setBackground(new java.awt.Color(255, 0, 204));
btnDocFile.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnDocFile.setForeground(new java.awt.Color(255, 255, 255));
btnDocFile.setText("Đọc File");
btnDocFile.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDocFileActionPerformed(evt);
}
});
btnHienThi.setBackground(new java.awt.Color(255, 0, 204));
btnHienThi.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnHienThi.setForeground(new java.awt.Color(255, 255, 255));
btnHienThi.setText("Reset");
btnHienThi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHienThiActionPerformed(evt);
}
});
tableNhanVien.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
tableNhanVien.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"Mã nhân viên", "Họ và Tên", "Tuổi", "Email", "Lương", "Hình"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tableNhanVien.setRowHeight(60);
tableNhanVien.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tableNhanVienMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tableNhanVien);
btn2.setBackground(new java.awt.Color(102, 0, 255));
btn2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btn2.setForeground(new java.awt.Color(255, 255, 255));
btn2.setText("<<");
btn2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
btn3.setBackground(new java.awt.Color(102, 0, 255));
btn3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btn3.setForeground(new java.awt.Color(255, 255, 255));
btn3.setText(">>");
btn3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
btnSapXepTheoMa.setBackground(new java.awt.Color(255, 102, 0));
btnSapXepTheoMa.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSapXepTheoMa.setForeground(new java.awt.Color(255, 255, 255));
btnSapXepTheoMa.setText("Sắp xếp theo mã");
btnSapXepTheoMa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSapXepTheoMaActionPerformed(evt);
}
});
btnSapXepTheoTen.setBackground(new java.awt.Color(0, 0, 204));
btnSapXepTheoTen.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSapXepTheoTen.setForeground(new java.awt.Color(255, 255, 255));
btnSapXepTheoTen.setText("Sắp xếp theo tên");
btnSapXepTheoTen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSapXepTheoTenActionPerformed(evt);
}
});
btnSapXepTheoTuổi.setBackground(new java.awt.Color(255, 51, 0));
btnSapXepTheoTuổi.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSapXepTheoTuổi.setForeground(new java.awt.Color(255, 255, 255));
btnSapXepTheoTuổi.setText("Sắp xếp theo tuổi");
btnSapXepTheoTuổi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSapXepTheoTuổiActionPerformed(evt);
}
});
btnSapXepTheoEmail.setBackground(new java.awt.Color(0, 153, 0));
btnSapXepTheoEmail.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSapXepTheoEmail.setForeground(new java.awt.Color(255, 255, 255));
btnSapXepTheoEmail.setText("Sắp xếp theo email");
btnSapXepTheoEmail.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSapXepTheoEmailActionPerformed(evt);
}
});
btnSapXepTheoLuong.setBackground(new java.awt.Color(0, 102, 102));
btnSapXepTheoLuong.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSapXepTheoLuong.setForeground(new java.awt.Color(255, 255, 255));
btnSapXepTheoLuong.setText("Sắp xếp theo lương");
btnSapXepTheoLuong.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSapXepTheoLuongActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel1.setText("QUẢN LÝ NHÂN VIÊN");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(43, 43, 43)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(454, 454, 454))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(272, 272, 272)
.addComponent(btn2)
.addGap(26, 26, 26)
.addComponent(btn3)
.addGap(82, 82, 82)
.addComponent(jlabelTable, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(40, 40, 40)))
.addComponent(jLabel3))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtTen, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtMaNV, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtTuoi, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtMail, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtLuong, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(94, 94, 94)
.addComponent(lblanh, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(136, 136, 136)
.addComponent(btnChonHinh))))
.addGroup(layout.createSequentialGroup()
.addComponent(btnTim, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(btnSapXepTheoMa, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(btnSapXepTheoTen, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnSapXepTheoTuổi)))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnLuuFile, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnDocFile, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnSua, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnThem, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnXoa, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnHienThi, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(btnNhapMoi, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnThoat, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(btnSapXepTheoEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnSapXepTheoLuong)))))
.addGap(56, 56, 56))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel1)
.addGap(77, 77, 77)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtMaNV, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtTen, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtTuoi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(txtMail, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtLuong, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn2)
.addComponent(btn3)
.addComponent(jlabelTable)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnThem)
.addComponent(btnXoa))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnSua)
.addComponent(btnHienThi))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnLuuFile)
.addComponent(btnDocFile))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnNhapMoi)
.addComponent(btnThoat)))
.addComponent(lblanh, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addComponent(btnChonHinh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnSapXepTheoLuong)
.addComponent(btnSapXepTheoEmail)
.addComponent(btnSapXepTheoTuổi)
.addComponent(btnSapXepTheoTen)
.addComponent(btnSapXepTheoMa)
.addComponent(btnTim))
.addGap(21, 21, 21)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(52, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void txtMaNVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaNVActionPerformed
}//GEN-LAST:event_txtMaNVActionPerformed
private void btnChonHinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChonHinhActionPerformed
duongdananh = ChonFile();
lblanh.setIcon(SelectImage(duongdananh));
}//GEN-LAST:event_btnChonHinhActionPerformed
private String ChonFile() {
String duongDan = "";
JFileChooser c = new JFileChooser();
int val = c.showOpenDialog(null);
if (val == JFileChooser.APPROVE_OPTION) {
String tenFile = c.getSelectedFile().getName();
String tenODia = c.getCurrentDirectory().toString();
duongDan = tenODia + "\\" + tenFile;
JOptionPane.showMessageDialog(this, "Chọn File thành công");
} else {
JOptionPane.showMessageDialog(this, "Bạn chưa chọn File nào!!");
}
return duongDan;
}
private ImageIcon SelectImage(String path) {
ImageIcon MyImage = new ImageIcon(path);
Image img = MyImage.getImage();
Image newImg = img.getScaledInstance(lblanh.getWidth(), lblanh.getHeight(), Image.SCALE_SMOOTH);
ImageIcon image = new ImageIcon(newImg);
return image;
}
private void btnThemAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_btnThemAncestorAdded
// TODO add your handling code here:
}//GEN-LAST:event_btnThemAncestorAdded
private void btnThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThemActionPerformed
try {
String loiSo = "(^-)*\\d+(.\\d+)*";
String loiEmail = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
if (txtMaNV.getText().equals("") || txtTen.getText().equals("") || txtTuoi.getText().equals("") || txtMail.getText().equals("") || txtLuong.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Vui Lòng Điền Đầy Đủ Thông Tin");
} else if (txtTen.getText().matches(loiSo) == true) {
JOptionPane.showMessageDialog(this, "Tên nhân viên không được nhập số", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtTen.setBackground(Color.RED);
} else if (txtTuoi.getText().matches(loiSo) == false) {
JOptionPane.showMessageDialog(this, "Tuổi nhân viên không được nhập ký tự", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtTuoi.setBackground(Color.RED);
} else if (txtMail.getText().matches(loiEmail) == false) {
JOptionPane.showMessageDialog(this, "Email bạn nhập chưa hợp lệ", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtMail.setBackground(Color.RED);
} else if (txtLuong.getText().matches(loiSo) == false) {
JOptionPane.showMessageDialog(this, "Lương chỉ được nhập số", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtLuong.setBackground(Color.RED);
} else if (kiemTraTrung(txtMaNV.getText()) == true) {
JOptionPane.showMessageDialog(this, "Mã nhân viên không được trùng", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtMaNV.setBackground(Color.RED);
} else if (kiemTraTuoi(Integer.parseInt(txtTuoi.getText())) == true) {
JOptionPane.showMessageDialog(this, "Tuổi Phải Từ 16 Đến 55", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtTuoi.setBackground(Color.RED);
} else if (kiemTraLuong(Double.parseDouble(txtLuong.getText())) == true) {
JOptionPane.showMessageDialog(this, "Lương phải lớn hơn 5 triệu", "Lỗi", JOptionPane.ERROR_MESSAGE);
txtLuong.setBackground(Color.RED);
} else {
txtMaNV.setBackground(null);
txtLuong.setBackground(null);
txtMail.setBackground(null);
txtTuoi.setBackground(null);
txtTen.setBackground(null);
themNhanVien();
filltable();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Lỗi 1 : " + e, "Lỗi", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_btnThemActionPerformed
public void themNhanVien() {
NhanVien nv = new NhanVien();
nv.setMaNV(txtMaNV.getText().toString());
nv.setTenNV(txtTen.getText().toString());
nv.setTuoi(Integer.parseInt(txtTuoi.getText().toString()));
nv.setEmail(txtMail.getText().toString());
nv.setLuong(Double.parseDouble(txtLuong.getText().toString()));
nv.setAnh(duongdananh);
list.add(nv);
}
public void filltable() {
DefaultTableModel defaultTableModel = (DefaultTableModel) tableNhanVien.getModel();
defaultTableModel.setRowCount(0);
for (NhanVien nv : list) {
Locale locale=new Locale("vi","VN");
NumberFormat numberFormat=NumberFormat.getCurrencyInstance(locale);
Object[] row = new Object[]{nv.getMaNV(), nv.getTenNV(), nv.getTuoi(), nv.getEmail(), numberFormat.format(nv.getLuong()), nv.getAnh()};
defaultTableModel.addRow(row);
}
}
private void btnSuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuaActionPerformed
if (tableNhanVien.getSelectedRow() >= 0) {
suaNhanVien();
filltable();
} else {
JOptionPane.showMessageDialog(this, "chọn tên người cập nhật trên bảng");
}
}//GEN-LAST:event_btnSuaActionPerformed
public void suaNhanVien() {
int dongTable = tableNhanVien.getSelectedRow();
NhanVien nv = list.get(dongTable);
nv.setMaNV(txtMaNV.getText());
nv.setTenNV(txtTen.getText());
nv.setTuoi(Integer.parseInt(txtTuoi.getText()));
nv.setEmail(txtMail.getText().toString());
nv.setLuong(Double.parseDouble(txtLuong.getText().toString()));
nv.setAnh(duongdananh);
}
public boolean kiemTraLuong(Double luong) {
boolean check = false;
if (luong < 5000000) {
check = true;
}
return check;
}
public boolean kiemTraTuoi(int tuoi) {
boolean check = false;
if (tuoi < 15 || tuoi > 55) {
check = true;
}
return check;
}
public boolean kiemTraTrung(String maNhanVien) {
boolean check = false;
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getMaNV().equalsIgnoreCase(maNhanVien)) {
check = true;
}
}
return check;
}
private void btnXoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnXoaActionPerformed
int input = JOptionPane.showConfirmDialog(null, "Bạn Chắc Muốn Xóa Chứ", "THÔNG BÁO", JOptionPane.YES_NO_OPTION);
tableNhanVien.getSelectedRow();
if (input == 0) {
list.remove(tableNhanVien.getSelectedRow());
DefaultTableModel defaultTableModel = (DefaultTableModel) tableNhanVien.getModel();
defaultTableModel.setRowCount(0);
for (NhanVien nhanVien : list) {
Object[] row = new Object[]{
nhanVien.getMaNV(), nhanVien.getTenNV(), nhanVien.getTuoi(), nhanVien.getEmail(), nhanVien.getLuong(), nhanVien.getAnh()
};
defaultTableModel.addRow(row);
}
}
}//GEN-LAST:event_btnXoaActionPerformed
private void btnTimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTimActionPerformed
DialogTim dailog = new DialogTim();
dailog.setVisible(true);
dailog.setOnSearchEvent(new DialogTim.OnSearchEvent() {
@Override
public void onSearch(String value) {
listTim.clear();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getMaNV().startsWith(value) == true || list.get(i).getTenNV().startsWith(value) == true || list.get(i).getEmail().startsWith(value) == true || String.valueOf(list.get(i).getTuoi()).startsWith(value) == true || String.valueOf(list.get(i).getLuong()).startsWith(value) == true) {
NhanVien nv1 = new NhanVien();
nv1.setMaNV(list.get(i).getMaNV());
nv1.setTenNV(list.get(i).getTenNV());
nv1.setTuoi(list.get(i).getTuoi());
nv1.setEmail(list.get(i).getEmail());
nv1.setLuong(list.get(i).getLuong());
nv1.setAnh(duongdananh);
listTim.add(nv1);
}
}
filltableTim();
}
});
}//GEN-LAST:event_btnTimActionPerformed
public void filltableTim() {
DefaultTableModel defaultTableModel = (DefaultTableModel) tableNhanVien.getModel();
defaultTableModel.setRowCount(0);
for (NhanVien nv : listTim) {
Locale locale=new Locale("vi","VN");
NumberFormat numberFormat=NumberFormat.getCurrencyInstance(locale);
Object[] row = new Object[]{nv.getMaNV(), nv.getTenNV(), nv.getTuoi(), nv.getEmail(), numberFormat.format(nv.getLuong()), nv.getAnh()};
defaultTableModel.addRow(row);
}
}
private void btnNhapMoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNhapMoiActionPerformed
txtMaNV.setText("");
txtTen.setText("");
txtTuoi.setText("");
txtMail.setText("");
txtLuong.setText("");
}//GEN-LAST:event_btnNhapMoiActionPerformed
private void btnThoatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThoatActionPerformed
int diaLog = JOptionPane.YES_NO_OPTION;
int diaLogResult = JOptionPane.showConfirmDialog(null, "Bạn có muốn thoát chương trình?", "Warring", diaLog);
if (diaLogResult == JOptionPane.YES_OPTION) {
DangNhap dangNhap = new DangNhap();
dangNhap.setVisible(true);
this.dispose();
}
}//GEN-LAST:event_btnThoatActionPerformed
private void btnLuuFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLuuFileActionPerformed
try {
FileOutputStream fos = new FileOutputStream("E:\\NhanVien.txt");
ObjectOutputStream ois = new ObjectOutputStream(fos);
ois.writeObject(list);
ois.close();
JOptionPane.showMessageDialog(this, "Lưu File Thành Công");
return;
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Lỗi : " + ex);
}
}//GEN-LAST:event_btnLuuFileActionPerformed
private void btnDocFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDocFileActionPerformed
try {
FileInputStream fis = new FileInputStream("E:\\NhanVien.txt");
ObjectInputStream ois = new ObjectInputStream(fis);
list = (ArrayList<NhanVien>) ois.readObject();
for (NhanVien nhanVien : list) {
filltable();
ois.close();
fis.close();
}
JOptionPane.showMessageDialog(this, "Đọc File Thành Công");
return;
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Lỗi : " + ex);
}
}//GEN-LAST:event_btnDocFileActionPerformed
private void btnHienThiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHienThiActionPerformed
hienthi();
filltable();
}//GEN-LAST:event_btnHienThiActionPerformed
boolean search = false;
private void tableNhanVienMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableNhanVienMouseClicked
int viTri = tableNhanVien.getSelectedRow();
lblanh.setIcon(ResizeImage(String.valueOf(tableNhanVien.getValueAt(viTri, 5))));
if (!search) {
HienThiNhanVien(list.get(viTri));
} else {
HienThiNhanVien(listTim.get(viTri));
}
}//GEN-LAST:event_tableNhanVienMouseClicked
public ImageIcon ResizeImage(String ImagePath) {
ImageIcon MyImage = new ImageIcon(ImagePath);
Image img = MyImage.getImage();
Image newImg = img.getScaledInstance(lblanh.getWidth(), lblanh.getHeight(), Image.SCALE_SMOOTH);
ImageIcon image = new ImageIcon(newImg);
return image;
}
public void HienThiNhanVien(NhanVien nv) {
txtMaNV.setText(nv.getMaNV());
txtTen.setText(nv.getTenNV());
int tuoi1 = nv.getTuoi();
txtTuoi.setText(String.valueOf(tuoi1));
txtMail.setText(nv.getEmail());
double luong1 = (nv.getLuong());
txtLuong.setText(String.valueOf(luong1));
lblanh.setText(nv.getAnh());
}
public void hienthi() {
try {
DefaultTableModel defaultTableModel = (DefaultTableModel) tableNhanVien.getModel();
defaultTableModel.setRowCount(0);
for (NhanVien nv : list) {
Object[] row = new Object[]{
nv.getMaNV(), nv.getTenNV(), nv.getLuong(), nv.getTuoi(), nv.getEmail(), nv.getLuong()
};
defaultTableModel.addRow(row);
}
} catch (Exception e) {
}
}
private void btn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn2ActionPerformed
try {
dem = tableNhanVien.getSelectedRow();
dem--;
if (dem == list.size()) {
dem = 0;
}
tableNhanVien.setRowSelectionInterval(dem, dem);
tableNhanVienMouseClicked(null);
show(dem);
} catch (Exception ex) {
}
}//GEN-LAST:event_btn2ActionPerformed
public void show(int i) {
txtMaNV.setText(String.valueOf(tableNhanVien.getValueAt(i, 0)));
txtTen.setText(String.valueOf(tableNhanVien.getValueAt(i, 1)));
int tuoi = Integer.parseInt(tableNhanVien.getValueAt(i, 2).toString());
txtTuoi.setText(String.valueOf(tuoi));
txtMail.setText(String.valueOf(tableNhanVien.getValueAt(i, 3)));
double luong = Double.parseDouble(tableNhanVien.getValueAt(i, 4).toString());
txtLuong.setText(String.valueOf(luong));
lblanh.setText(String.valueOf(tableNhanVien.getValueAt(i, 5)));
}
private void btn3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn3ActionPerformed
try {
dem = tableNhanVien.getSelectedRow();
dem++;
if (dem == list.size()) {
dem = 0;
}
tableNhanVien.setRowSelectionInterval(dem, dem);
tableNhanVienMouseClicked(null);
show(dem);
} catch (Exception ex) {
}
}//GEN-LAST:event_btn3ActionPerformed
private void btnSapXepTheoMaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSapXepTheoMaActionPerformed
// TODO add your handling code here:
Comparator<NhanVien> sx = new Comparator<NhanVien>() {
@Override
public int compare(NhanVien o1, NhanVien o2) {
return o1.getMaNV().compareTo(o2.getMaNV());
}
};
Collections.sort(list, sx);
filltable();
}//GEN-LAST:event_btnSapXepTheoMaActionPerformed
private void btnSapXepTheoTenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSapXepTheoTenActionPerformed
// TODO add your handling code here:
Comparator<NhanVien> sx = new Comparator<NhanVien>() {
@Override
public int compare(NhanVien o1, NhanVien o2) {
return o1.getTenNV().compareTo(o2.getTenNV());
}
};
Collections.sort(list, sx);
filltable();
}//GEN-LAST:event_btnSapXepTheoTenActionPerformed
private void btnSapXepTheoTuổiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSapXepTheoTuổiActionPerformed
// TODO add your handling code here:
Comparator<NhanVien> sx = new Comparator<NhanVien>() {
@Override
public int compare(NhanVien o1, NhanVien o2) {
double d1 = o1.getTuoi();
double d2 = o2.getTuoi();
return Double.compare(d1, d2);
}
};
Collections.sort(list, sx);
filltable();
}//GEN-LAST:event_btnSapXepTheoTuổiActionPerformed
private void btnSapXepTheoEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSapXepTheoEmailActionPerformed
// TODO add your handling code here:
Comparator<NhanVien> sx = new Comparator<NhanVien>() {
@Override
public int compare(NhanVien o1, NhanVien o2) {
return o1.getEmail().compareTo(o2.getEmail());
}
};
Collections.sort(list, sx);
filltable();
}//GEN-LAST:event_btnSapXepTheoEmailActionPerformed
private void btnSapXepTheoLuongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSapXepTheoLuongActionPerformed
// TODO add your handling code here:
Comparator<NhanVien> sx = new Comparator<NhanVien>() {
@Override
public int compare(NhanVien o1, NhanVien o2) {
double d1 = o1.getLuong();
double d2 = o2.getLuong();
return Double.compare(d1, d2);
}
};
Collections.sort(list, sx);
filltable();
}//GEN-LAST:event_btnSapXepTheoLuongActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(QuanLyNhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(QuanLyNhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(QuanLyNhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(QuanLyNhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
if (DangNhap.xetDangNhap == true) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new QuanLyNhanVien().setVisible(true);
}
});
} else {
int input = JOptionPane.showConfirmDialog(null, "Xin lỗi bạn ! Bạn cần đăng nhập trước khi sử dụng hệ thống .\n Bạn có muốn đăng nhập hay không ?", "THÔNG BÁO", JOptionPane.YES_NO_OPTION);
if (input == 0) {
DangNhap dangNhap = new DangNhap();
dangNhap.setVisible(true);
}
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btn2;
private javax.swing.JButton btn3;
private javax.swing.JButton btnChonHinh;
private javax.swing.JButton btnDocFile;
private javax.swing.JButton btnHienThi;
private javax.swing.JButton btnLuuFile;
private javax.swing.JButton btnNhapMoi;
private javax.swing.JButton btnSapXepTheoEmail;
private javax.swing.JButton btnSapXepTheoLuong;
private javax.swing.JButton btnSapXepTheoMa;
private javax.swing.JButton btnSapXepTheoTen;
private javax.swing.JButton btnSapXepTheoTuổi;
private javax.swing.JButton btnSua;
private javax.swing.JButton btnThem;
private javax.swing.JButton btnThoat;
private javax.swing.JButton btnTim;
private javax.swing.JButton btnXoa;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel jlabelTable;
private javax.swing.JLabel lblanh;
private javax.swing.JTable tableNhanVien;
private java.awt.TextField txtLuong;
private java.awt.TextField txtMaNV;
private java.awt.TextField txtMail;
private java.awt.TextField txtTen;
private java.awt.TextField txtTuoi;
// End of variables declaration//GEN-END:variables
}
| [
"abch2409@gmail.com"
] | abch2409@gmail.com |
51c3fd8d5b6cb3731a884677aa49312e451098e8 | a2490b005268944e477a63ab740c79e92d63b664 | /src/test/java/io/wesquad/kata/java8/stream/StreamSummaryStatsTest.java | b901d9bde664398197eaf79424276ce5c15c7fb5 | [] | no_license | blueoceandevops/java8-workshop | e00fb31909170d6c17c3d317d7930bb3860389c6 | ee4c9b04d37447c7ee4e742b9aad3d0c7fcd43b9 | refs/heads/master | 2022-01-26T18:41:33.130453 | 2019-06-12T07:52:42 | 2019-06-12T07:52:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,498 | java | package io.wesquad.kata.java8.stream;
import io.wesquad.kata.java7.model.Summary;
import io.wesquad.kata.java8.model.Account;
import io.wesquad.kata.util.AccountFactory;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.IntSummaryStatistics;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
class StreamSummaryStatsTest {
@Test
void should_create_summary_of_account_balances_Java7() {
// arrange
List<Account> accounts = AccountFactory.getInstance().few();
// act
Summary result = new StreamSummaryStats().statsOnAccountsJava7(accounts);
// assert
Assertions.assertThat(result.getCount()).isEqualTo(15);
Assertions.assertThat(result.getSum()).isEqualTo(1037067L);
Assertions.assertThat(result.getMin()).isEqualTo(100L);
Assertions.assertThat(result.getMax()).isEqualTo(634534L);
}
@Test
void should_create_summary_of_account_balances_Java8() {
// arrange
List<Account> accounts = AccountFactory.getInstance().few();
// act
IntSummaryStatistics result = new StreamSummaryStats().statsOnAccountsJava8(accounts);
// assert
Assertions.assertThat(result.getCount()).isEqualTo(15);
Assertions.assertThat(result.getSum()).isEqualTo(1037067L);
Assertions.assertThat(result.getMin()).isEqualTo(100L);
Assertions.assertThat(result.getMax()).isEqualTo(634534L);
}
} | [
"newlight77@gmail.com"
] | newlight77@gmail.com |
24007593d72606f702bd68eee377875f65b1fa1c | 85dd53c1664b6b505508b29ac309a54831f6a532 | /src/main/java/com/algorithm/learn/DesignPattern/SingleTon/serial/Singleton.java | bb4591de1602671758cf57de1aa63116740e4bbd | [] | no_license | RayBreslinwcl/algorithm | c82532b0ea3081f656230fc898688f489635133a | c30078efaaa587af8a0fbe0b7b76fc8007ae712d | refs/heads/master | 2022-10-26T17:40:11.864783 | 2022-10-21T07:04:01 | 2022-10-21T07:04:01 | 219,244,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.algorithm.learn.DesignPattern.SingleTon.serial;
import java.io.Serializable;
public class Singleton implements Serializable {
//注意,此变量需要用volatile修饰以防止指令重排序
private static volatile Singleton singleton = null;
private Singleton(){
if(singleton != null){
throw new RuntimeException("Can not do this");
}
}
public static Singleton getInstance(){
//进入方法内,先判断实例是否为空,以确定是否需要进入同步代码块
if(singleton == null){
synchronized (Singleton.class){
//进入同步代码块时再次判断实例是否为空
if(singleton == null){
singleton = new Singleton();
}
}
}
return singleton;
}
// 定义readResolve方法,防止反序列化返回不同的对象
private Object readResolve(){
return singleton;
}
}
| [
"2728928100@qq.com"
] | 2728928100@qq.com |
76d05382ff3ea12d034cc6e978012a27377b61b2 | 5908573a33fc30f2bfc442f35808c42862f03bde | /Securea2.0/src/securea/grupos.java | 22ec9cc32b392abb6139ca6456f1d7b30f3d6d17 | [] | no_license | morenoscar/Seguridad | 83d93b7d5b2f499008ec738437d670d18b15c471 | 6a7e2017f46c7567c81e995f2520a98a0b7688d0 | refs/heads/master | 2020-07-17T13:56:37.572077 | 2016-11-25T16:21:07 | 2016-11-25T16:21:07 | 73,929,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,296 | 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 securea;
/**
*
* @author racso
*/
public class grupos extends javax.swing.JFrame {
/**
* Creates new form grupos
*/
public grupos() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
jScrollPane3 = new javax.swing.JScrollPane();
jTable3 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(jTable2);
jTable3.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane3.setViewportView(jTable3);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(57, 57, 57)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 452, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 452, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 452, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(52, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(72, 72, 72)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(grupos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(grupos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(grupos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(grupos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new grupos().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable jTable1;
private javax.swing.JTable jTable2;
private javax.swing.JTable jTable3;
// End of variables declaration//GEN-END:variables
}
| [
"racso0468@hotmail.com"
] | racso0468@hotmail.com |
da9fcba27b526159c30bbd39a050d6b5a9ddbcab | 3de73f56b1feb0ee0cf35d068424877f5d2a7ca1 | /hulk-ec/src/main/java/com/hulk/ec/launcher/ILauncherListener.java | 7020400f36de90fa910475450634da4e406d7f7d | [] | no_license | hulkTian/ec | 1ab27c7f325d026402408ac605fcc3774ca27b47 | 19d383e1f62a0ad54a04452dc2d4b56e27017765 | refs/heads/master | 2020-03-25T09:35:44.308420 | 2018-09-15T14:12:09 | 2018-09-15T14:12:23 | 143,672,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | package com.hulk.ec.launcher;
/**
* Created by hulkTian on 2018/8/26.
*/
public interface ILauncherListener {
void onLauncherFinish(OnLauncherFinishTag tag);
}
| [
"1509482122@qq.com"
] | 1509482122@qq.com |
5ba523b1cb4987ed3b93387d0587bff79c848a32 | 8dc0aa75638d619bc202952a7330af0f063079da | /src/com/cartmatic/estoresf/cmbehome/action/UcsNoticeRequest1005.java | 7c3e81f2b052a64fa3ad35f73c099f4b698ce18b | [] | no_license | 1649865412/eStore | 77c7eac2253ae2b3b9983b5b88d03a2f7860c95d | 53dff738d3d87283bed95811a7ef31dadef5e563 | refs/heads/master | 2021-01-18T06:38:50.327396 | 2015-11-27T06:29:16 | 2015-11-27T06:29:16 | 38,037,604 | 1 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,132 | java | package com.cartmatic.estoresf.cmbehome.action;
import com.cartmatic.estoresf.cmbehome.action.help.GsonUtils;
import com.google.gson.annotations.Expose;
public class UcsNoticeRequest1005 {
@Expose
private String Source;
@Expose
private String OptType;
@Expose
private String OrderNo;
@Expose
private String RefundNo;
@Expose
private String Amount;
@Expose
private String CState;
@Expose
private String CMsg;
@Expose
private String RefundTime;
public UcsNoticeRequest1005(String plainText) {
UcsNoticeRequest1005 noticeRequest= GsonUtils.fromJson(plainText,this.getClass());
if(noticeRequest!=null)
{
this.Source = noticeRequest.getSource();
this.OptType = noticeRequest.getOptType();
this.OrderNo = noticeRequest.getOrderNo();
this.RefundNo = noticeRequest.getRefundNo();
this.Amount = noticeRequest.getAmount();
this.CState = noticeRequest.getCState();
this.CMsg = noticeRequest.getCMsg();
this.RefundTime = noticeRequest.getRefundTime();
}
}
public String getSource() {
return Source;
}
public void setSource(String source) {
Source = source;
}
public String getOptType() {
return OptType;
}
public void setOptType(String optType) {
OptType = optType;
}
public String getOrderNo() {
return OrderNo;
}
public void setOrderNo(String orderNo) {
OrderNo = orderNo;
}
public String getRefundNo() {
return RefundNo;
}
public void setRefundNo(String refundNo) {
RefundNo = refundNo;
}
public String getAmount() {
return Amount;
}
public void setAmount(String amount) {
Amount = amount;
}
public String getCState() {
return CState;
}
public void setCState(String cState) {
CState = cState;
}
public String getCMsg() {
return CMsg;
}
public void setCMsg(String cMsg) {
CMsg = cMsg;
}
public String getRefundTime() {
return RefundTime;
}
public void setRefundTime(String refundTime) {
RefundTime = refundTime;
}
}
| [
"1649865412@qq.com"
] | 1649865412@qq.com |
af44ecaca27c0183b218003ed010bd63bbc941a6 | 67c8b1382f906951be7394def3dac02c32ad6121 | /AntHill.java | b532fff055c292715129fbe4b965a9f21690ebef | [] | no_license | Sthakur27/Ant-Colony | 140d69c0db2b93e688843c4fe4d3575d3097806e | 382ba90ef0b6514520dc2890ea0763899a14b256 | refs/heads/master | 2021-01-10T15:49:52.503359 | 2016-04-10T19:21:48 | 2016-04-10T19:21:48 | 55,917,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java | import java.util.*; import java.lang.Math;
public class AntHill{
int food,maxfood;
float xpos,ypos;
ArrayList<Ant_Abstract> occupants=new ArrayList<>();
static ArrayList<Worker> allWorkers=new ArrayList<Worker>();
static ArrayList<Scout> allScouts=new ArrayList<Scout>();
static ArrayList<Ant_Abstract> allAnts=new ArrayList<>();
AntHill(float x, float y){
xpos=x;ypos=y; food=0;
}
public void autoproduce(){
if (food-(3*allAnts.size())>0){
if(allScouts.size()*5<allWorkers.size()){
produceScout();
}
else{produceWorker();}
}
}
public void enter(Ant_Abstract ant){
occupants.add(ant);
//System.out.println("Ant entered at position "+(occupants.indexOf(ant)+1));
ant.xpos=this.xpos;
ant.ypos=this.ypos;
}
public void leave(Ant_Abstract ant){
occupants.remove(ant);
}
public void leave(int i){
occupants.remove(i);
}
public void produceWorker(int num){
for (int i=0;i<num;i++){
this.produceWorker();
}
}
public void produceScout(int num){
for (int i=0;i<num;i++){
this.produceScout();
}
}
public Worker produceWorker(){
food-=10;
Worker a=new Worker(xpos,ypos,0,this, ((int)Math.random()*1000)+5000); //5000
allAnts.add(a);
allWorkers.add(a);
enter(a);
return(a);
}
public Scout produceScout(){
food-=10;
Scout a=new Scout(xpos,ypos,0,this,((int)Math.random()*1000)+5000);
allAnts.add(a);
allScouts.add(a);
return(a);
}
public void feed(){
int rationing=(int)((1/3)*(food/occupants.size()));
for (Ant_Abstract ant:occupants){
if (ant.hunger>3){
this.food-=rationing;
ant.eat(rationing);
}
}
}
public void update(){
autoproduce();
}
} | [
"sidbthakur@gmail.com"
] | sidbthakur@gmail.com |
adf570860f8eff3dc6260e3f5a24c71c57ba32aa | e5bbe0eb9095055857375fa414f2b56b4bb122bb | /javabook/src/ch06/InitializerTest.java | 500bdb7024bc787ef9118d8ffb1601e1b91ebd04 | [] | no_license | kill5951/JAVA | 35fb19ef0796e6146890e7e8edcef9401b6e2b8f | ae01cf590802a6e7a24d6adc1986192f633f7040 | refs/heads/master | 2022-11-24T01:56:58.580426 | 2020-07-28T14:07:21 | 2020-07-28T14:07:21 | 283,229,413 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 753 | java | package ch06;
public class InitializerTest {
int iv;
static int cv;
static { //클래스 초기화 블록
System.out.println("static initializer");
cv=100;
}
{ // 인스턴스 초기화 블록
System.out.println("instance initializer");
iv = 100;
}
public InitializerTest(){ //파라미터 없는 생성자
System.out.printf("constructor iv: %d, cv:%d%n",iv,cv);
this.iv = 300;
}
public static void main(String[] args) {
InitializerTest it = new InitializerTest();
System.out.printf("객체 1 생성 후- cv: %d, iv: %d%n",InitializerTest.cv,it.iv);
InitializerTest it2 = new InitializerTest();
System.out.printf("객체 2 생성 후- cv: %d, iv: %d%n",InitializerTest.cv, it2.iv);
}
}
| [
"윤태준@192.168.219.5"
] | 윤태준@192.168.219.5 |
7c2ce100c5f6c80ec2f00547c3b7d739b23d4757 | ef3b14f689a0b9ac07ccefbea90e73528a32836c | /app/src/main/java/com/example/summit/calendar/AddEvent.java | 915a251ac4c014e44e691b1f9b1b1b60c561dac8 | [
"Apache-2.0"
] | permissive | supernovabirth/calendar_x | 938b5f0cc8332ef6e750581f1edc7ae407c74f85 | 610b5b95376bceb54cb2eae7bdd369230a3e0087 | refs/heads/master | 2021-06-09T04:12:21.458817 | 2016-12-09T00:35:25 | 2016-12-09T00:35:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,182 | java | package com.example.summit.calendar;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TimePicker;
import android.widget.Toast;
import java.sql.Time;
import java.util.Date;
public class AddEvent extends ActionBarActivity {
String title;
String location;
String duration;
String description;
Boolean reminder;
Date date;
Time time;
DatabaseEvent db;
EditText editTitle, editLocation, editDuration, editDescription;
Switch switchReminder;
DatePicker datePicker;
TimePicker timePicker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_event);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
editTitle = (EditText)findViewById(R.id.editText_title);
editLocation = (EditText)findViewById(R.id.editText_location);
editDuration = (EditText)findViewById(R.id.editText_duration);
editDescription = (EditText)findViewById(R.id.editText_description);
datePicker = (DatePicker)findViewById(R.id.datePicker);
timePicker = (TimePicker)findViewById(R.id.timePicker);
switchReminder = (Switch)findViewById(R.id.switch_reminder);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_add_event, menu);
return true;
}
public void confirm()
{
int valueDay = datePicker.getDayOfMonth();
int valueMonth =datePicker.getMonth()+1;
int valueYear = datePicker.getYear();
int valueHour = timePicker.getCurrentHour();
int valueMinutes = timePicker.getCurrentMinute();
boolean isInserted = db.insertData(editTitle.getText().toString(), valueDay,valueMonth,valueYear,valueHour,valueMinutes, editLocation.getText().toString(), editDuration.getText().toString(), editDescription.getText().toString());
if (isInserted == true){
Toast.makeText(AddEvent.this, "Event Scheduled", Toast.LENGTH_SHORT).show();
startActivity(new Intent(this, MainActivity.class));}
else
Toast.makeText(AddEvent.this, "Event Could Not Be Scheduled", Toast.LENGTH_SHORT).show();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id){
case R.id.action_save:
confirm();
break;
case R.id.action_cancel:
startActivity(new Intent(this, MainActivity.class));
break;
}
return super.onOptionsItemSelected(item);
}
}
| [
"pradiptashrestha@gmail.com"
] | pradiptashrestha@gmail.com |
7f2380b26ad432226c2400709d25a1ac54c71da5 | c06d832a9b901bb914a410ec72e2f7e07fcd2ff3 | /src/java/entities/service/PlatFacadeREST.java | 5a89ef8fdcbe9b5ef719d63731d28a1e368cd1be | [] | no_license | AminSleimi/TestWS | 8a364dcf28add57a9ed55c47b50bab33870a4d09 | 40684434dababa12161d33badbfdef64a923c83a | refs/heads/master | 2021-01-22T07:32:38.720055 | 2014-08-11T10:04:53 | 2014-08-11T10:04:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | 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 entities.service;
import entities.Plat;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
/**
*
* @author a.sleimi
*/
@Stateless
@Path("entities.plat")
public class PlatFacadeREST extends AbstractFacade<Plat> {
@PersistenceContext(unitName = "TestWSPU")
private EntityManager em;
public PlatFacadeREST() {
super(Plat.class);
}
@POST
@Override
@Consumes({"application/xml", "application/json"})
public void create(Plat entity) {
super.create(entity);
}
@PUT
@Path("{id}")
@Consumes({"application/xml", "application/json"})
public void edit(@PathParam("id") Integer id, Plat entity) {
super.edit(entity);
}
@DELETE
@Path("{id}")
public void remove(@PathParam("id") Integer id) {
super.remove(super.find(id));
}
@GET
@Path("{id}")
@Produces({ "application/json"})
public Plat find(@PathParam("id") Integer id) {
return super.find(id);
}
@GET
@Override
@Produces({ "application/json"})
public List<Plat> findAll() {
return super.findAll();
}
@GET
@Path("{from}/{to}")
@Produces({"application/xml", "application/json"})
public List<Plat> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
return super.findRange(new int[]{from, to});
}
@GET
@Path("count")
@Produces("text/plain")
public String countREST() {
return String.valueOf(super.count());
}
@Override
protected EntityManager getEntityManager() {
return em;
}
}
| [
"amin.sleimi@gmail.com"
] | amin.sleimi@gmail.com |
282f7dd34b343fa5caa45e9a264a47fda928fd9c | 13f3abff38a3ec69af7d5a9dbad91576b0067607 | /src/ec/edu/ups/vista/VentanaLeerProducto.java | e080de202948b2589b6eedeb857a3125cfad0e77 | [] | no_license | DianaPatriciaTacuri/Factura | 5a84ccbb878b0a8bcdaaeae20c1cdf0bc63409cc | 1d3e7b948266f30ab00ac39fccb33b2036271f73 | refs/heads/master | 2020-05-24T00:56:24.106575 | 2019-05-16T13:52:57 | 2019-05-16T13:52:57 | 187,026,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,574 | 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 ec.edu.ups.vista;
import ec.edu.ups.controlador.ControladorProducto;
import ec.edu.ups.modelo.Producto;
import java.util.Locale;
import java.util.ResourceBundle;
/**
*
* @author Usuario
*/
public class VentanaLeerProducto extends javax.swing.JInternalFrame {
private ControladorProducto controladorProducto;
private Locale localizacion;
private ResourceBundle mensajes;
public VentanaLeerProducto(ControladorProducto controladorProducto) {
this.mensajes=mensajes;
initComponents();
this.controladorProducto=controladorProducto;
cambiarIdioma();
}
public void cambiarIdioma(){
mensajes= ResourceBundle.getBundle("ec.edu.ups.idiomas.mensajes",VentanaPrincipal.localizacion);
lblbusvarProducto.setText(mensajes.getString("lblbuscarProducto"));
lblcantidad.setText(mensajes.getString("lblCantidada"));
lblmarca.setText(mensajes.getString("lblMarca"));
lblinhresar.setText(mensajes.getString("crear.lblingresar"));
lblnombre.setText(mensajes.getString("crear.lblnombre"));
lblcosto.setText(mensajes.getString("lblCosto"));
btnBuscar.setText(mensajes.getString("menu.item.buscar"));
btnCancelar.setText(mensajes.getString("crear.btncancelar"));
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lblinhresar = new javax.swing.JLabel();
txtCodigo = new javax.swing.JTextField();
lblmarca = new javax.swing.JLabel();
txtMarca = new javax.swing.JTextField();
lblnombre = new javax.swing.JLabel();
txtNombre = new javax.swing.JTextField();
lblcosto = new javax.swing.JLabel();
txtCosto = new javax.swing.JTextField();
lblcantidad = new javax.swing.JLabel();
txtCantidad = new javax.swing.JTextField();
btnBuscar = new javax.swing.JButton();
lblbusvarProducto = new javax.swing.JLabel();
btnCancelar = new javax.swing.JButton();
setBackground(new java.awt.Color(255, 0, 153));
lblinhresar.setText("Ingrese el codigo");
lblmarca.setText("Marca");
txtMarca.setEditable(false);
txtMarca.setEnabled(false);
lblnombre.setText("Nombre");
txtNombre.setEditable(false);
txtNombre.setEnabled(false);
lblcosto.setText("Costo");
txtCosto.setEditable(false);
txtCosto.setEnabled(false);
lblcantidad.setText("Cantidad");
txtCantidad.setEditable(false);
txtCantidad.setEnabled(false);
btnBuscar.setText("BUSCAR");
btnBuscar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBuscarActionPerformed(evt);
}
});
lblbusvarProducto.setFont(new java.awt.Font("Arial", 3, 18)); // NOI18N
lblbusvarProducto.setText("BUSCAR PRODUCTO");
btnCancelar.setText("CANCELAR");
btnCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelarActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(lblmarca, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(txtMarca, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblinhresar, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblcantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(txtCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblcosto, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(txtCosto, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(99, 99, 99)
.addComponent(lblbusvarProducto)))
.addContainerGap(64, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(lblbusvarProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblinhresar, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblmarca, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtMarca, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblcosto, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCosto, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblcantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
.addComponent(btnCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(24, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
int codigo =Integer.parseInt(txtCodigo.getText());
Producto buscarProducto=controladorProducto.read(codigo);
txtNombre.setText(buscarProducto.getNombre());
txtCosto.setText(String.valueOf(buscarProducto.getCosto()));
txtMarca.setText(buscarProducto.getMarca());
txtCantidad.setText(String.valueOf(buscarProducto.getCantidad()));
}//GEN-LAST:event_btnBuscarActionPerformed
private void btnBuscar1ActiontxtMarca(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscar1ActionPerformed
this.dispose();
}//GEN-LAST:event_btnBuscar1ActionPerformed
private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
this.dispose();
}//GEN-LAST:event_btnCancelarActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnBuscar;
private javax.swing.JButton btnCancelar;
private javax.swing.JLabel lblbusvarProducto;
private javax.swing.JLabel lblcantidad;
private javax.swing.JLabel lblcosto;
private javax.swing.JLabel lblinhresar;
private javax.swing.JLabel lblmarca;
private javax.swing.JLabel lblnombre;
private javax.swing.JTextField txtCantidad;
private javax.swing.JTextField txtCodigo;
private javax.swing.JTextField txtCosto;
private javax.swing.JTextField txtMarca;
private javax.swing.JTextField txtNombre;
// End of variables declaration//GEN-END:variables
}
| [
"Usuario@DESKTOP-PVMAU3S.mshome.net"
] | Usuario@DESKTOP-PVMAU3S.mshome.net |
de306b7c5bb310259d2b9bee034d9a09d2b817a1 | b2258818dfe6c994930af71afcf99b7f448954ce | /app/src/main/java/com/example/kid_tracking_app1/ChildModel.java | f6987296d26a42e93dcb4b523dccd5608ba7c368 | [] | no_license | Rasool6/Kid_Tracking_App | 50c41c8dab33243b2493f48a281c7f00363ca557 | 82c3d65549eb291d62cb62ddb22b540a547172fc | refs/heads/master | 2023-05-02T14:10:54.549872 | 2021-05-24T07:06:32 | 2021-05-24T07:06:32 | 370,260,012 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java | package com.example.kid_tracking_app1;
public class ChildModel {
String child_name;
String pin_genrate;
String child_age;
String latitutde;
String longitude;
public ChildModel(String child_name, String pin_genrate, String child_age,String latitutde,String longitude ) {
this.child_name = child_name;
this.pin_genrate = pin_genrate;
this.child_age = child_age;
this.latitutde=latitutde;
this.longitude=longitude;
}
public String getChild_name() {
return child_name;
}
public void setChild_name(String child_name) {
this.child_name = child_name;
}
public String getPin_genrate() {
return pin_genrate;
}
public void setPin_genrate(String pin_genrate) {
this.pin_genrate = pin_genrate;
}
public String getChild_age() {
return child_age;
}
public void setChild_age(String child_age) {
this.child_age = child_age;
}
public String getLatitutde() {
return latitutde;
}
public void setLatitutde(String latitutde) {
this.latitutde = latitutde;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}
| [
"kk0220091@gmail.com"
] | kk0220091@gmail.com |
adf9164bd1d7e063d38ce3f9462a824354434e46 | e7b3ffb19211c16a715574c4361bb21b7a4d5d67 | /app/src/main/java/com/example/morecipes/morecipes/Local/AddDataActivity.java | fcaef493314bc9c05b6fa71468a61cabcea785a9 | [] | no_license | dieg0espx/FinalProject-Android | 49440264c86e78f86a21896dcad6394d3534a986 | c26b2618e9c4f92174b74bbe886601546de8efff | refs/heads/master | 2020-12-14T19:45:40.125768 | 2020-01-23T09:06:16 | 2020-01-23T09:06:16 | 234,851,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,022 | java | package com.example.morecipes.morecipes.Local;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.morecipes.R;
public class AddDataActivity extends AppCompatActivity {
EditText etid,etname,etemail,etcity;
private Button btn_save;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_data);
//etid=(EditText)findViewById(R.id.editid);
etname=(EditText)findViewById(R.id.editname);
etemail=(EditText)findViewById(R.id.editemail);
etcity=(EditText)findViewById(R.id.editcity);
btn_save=(Button)findViewById(R.id.btn_add);
btn_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name=etname.getText().toString();
String email=etemail.getText().toString();
String city=etcity.getText().toString();
MyDatalist myDataList=new MyDatalist();
myDataList.setName(name);
myDataList.setEmail(email);
myDataList.setCity(city);
ReadDataActivity.myDatabase.myDao().addData(myDataList);
Toast.makeText(getApplicationContext(),"Data Save",Toast.LENGTH_LONG).show();
Intent intent = new Intent(AddDataActivity.this, ReadDataActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.fast_animation, R.anim.fast_animation);
}
});
}
public void go2List(View view) {
Intent intent = new Intent(AddDataActivity.this, ReadDataActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.fast_animation, R.anim.fast_animation);
}
}
| [
"espinosa9mx@gmail.com"
] | espinosa9mx@gmail.com |
8fd3fe95417f77d600c7cefc34873a70068cf846 | 3173887caf5893ea89639117a11de35d7a91ec9d | /org.jrebirth/core/src/main/java/org/jrebirth/core/concurrent/ConcurrentMessages.java | c2742d09c446213fa17b12eff84e4ad1f53bc964 | [
"Apache-2.0"
] | permissive | amischler/JRebirth | 875116eba814fcad772ef9b5c1840ed706b29093 | cf22e3eb042015cace84cb5ada35e40361aefef6 | refs/heads/master | 2020-12-25T04:19:50.250090 | 2013-09-26T14:04:36 | 2013-09-26T14:04:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,878 | java | /**
* Get more info at : www.jrebirth.org .
* Copyright JRebirth.org © 2011-2013
* Contact : sebastien.bordes@jrebirth.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jrebirth.core.concurrent;
import static org.jrebirth.core.resource.Resources.create;
import org.jrebirth.core.log.JRebirthMarkers;
import org.jrebirth.core.resource.i18n.LogMessage;
import org.jrebirth.core.resource.i18n.MessageContainer;
import org.jrebirth.core.resource.i18n.MessageItem;
/**
* The class <strong>ConcurrentMessages</strong>.
*
* Messages used by the Concurrent package.
*
* @author Sébastien Bordes
*/
public interface ConcurrentMessages extends MessageContainer {
/** JRebirthThread. */
/** "Run> {0}". */
MessageItem RUN_IT = create(new LogMessage("jrebirth.concurrent.runIt", JRebirthMarkers.CONCURRENT));
/** "Thread error : {0} ". */
MessageItem THREAD_ERROR = create(new LogMessage("jrebirth.concurrent.threadError", JRebirthMarkers.CONCURRENT));
/** "Runnable submitted with hashCode={}" . */
MessageItem JTP_QUEUED = create(new LogMessage("jrebirth.concurrent.jtpQueued", JRebirthMarkers.CONCURRENT));
/** "An exception occured during JRebirth BootUp" . */
MessageItem BOOT_UP_ERROR = create(new LogMessage("jrebirth.concurrent.bootUpError", JRebirthMarkers.CONCURRENT));
/** AbstractJrbRunnable. */
/** "An exception occured into the JRebirth Thread". */
MessageItem JIT_ERROR = create(new LogMessage("jrebirth.concurrent.jitError", JRebirthMarkers.CONCURRENT));
/** "An error occurred while shuting down the application ". */
MessageItem SHUTDOWN_ERROR = create(new LogMessage("jrebirth.concurrent.shutdownError", JRebirthMarkers.CONCURRENT));
/** JrebirthThreadPoolExecutor. */
/** "JTP returned an error" . */
MessageItem JTP_ERROR = create(new LogMessage("jrebirth.concurrent.jtpError", JRebirthMarkers.CONCURRENT));
/** "JTP returned an error with rootCause =>". */
MessageItem JTP_ERROR_EXPLANATION = create(new LogMessage("jrebirth.concurrent.jtpErrorExplanation", JRebirthMarkers.CONCURRENT));
/** "Future (hashcode={}) returned object : {}". */
MessageItem FUTURE_DONE = create(new LogMessage("jrebirth.concurrent.futureDone", JRebirthMarkers.CONCURRENT));
}
| [
"sebastien.bordes@jrebirth.org"
] | sebastien.bordes@jrebirth.org |
569e923a15c206e27f59ce7482f841f42abaae52 | 3ba3e8fb9395be4d4aea349af8b45b63b38893b8 | /Knowledge-master/app/src/main/java/com/dante/knowledge/mime/ui/LoadingView.java | 1a13bca511fa671194498c9b43eac4afba82da5e | [] | no_license | sengeiou/lucio | a10d237eda9cbc0ea7fc910acaf1e33f90b8df6b | 6bbd536323a4b2a8681584d7d482977a0008d5ed | refs/heads/master | 2020-06-12T09:05:09.610521 | 2016-07-01T14:51:55 | 2016-07-01T14:51:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.dante.knowledge.mime.ui;
import android.content.Context;
import android.view.View;
/**
* <Pre>
* 加载视图接口
* </Pre>
*
* @author 刘阳
* @version 1.0
* <p/>
* Create by 2016/1/28 16:27
*/
public interface LoadingView {
void showLoading();
void showContent();
void showError(int messageId, View.OnClickListener listener);
Context getContext();
}
| [
"lucio0314@163.com"
] | lucio0314@163.com |
7bfa17dca02981243486e6ca0fd65188e45b451b | c49100453bca205eb99febc54d8cf16201402895 | /gmall-api/src/main/java/com/atguigu/gmall/bean/WareInfo.java | 9ee54cc5aeea6a8e5e446b01572a21db856d21b4 | [] | no_license | jaquanli/gmall | fd7b9ace17a3268b55a6f5622ba1e65897a47700 | 8f85da50620509a644d20ac2dfa672d15ea7cf8c | refs/heads/master | 2020-04-08T15:06:59.654039 | 2018-12-22T07:34:32 | 2018-12-22T07:34:32 | 159,466,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.atguigu.gmall.bean;
/**
* 暂用不着
*/
public class WareInfo {
private Long id;
private String name;
private String address;
private String areacode;
public WareInfo(Long id, String name, String address, String areacode) {
this.id = id;
this.name = name;
this.address = address;
this.areacode = areacode;
}
public WareInfo() {
super();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getAreacode() {
return areacode;
}
public void setAreacode(String areacode) {
this.areacode = areacode == null ? null : areacode.trim();
}
} | [
"A@guigu.com"
] | A@guigu.com |
7c121d8c003f19186ba1add5a5078cc57c2f2ce6 | a7a64f16d839102c30baacf6d777f31a3866318f | /src/main/java/learn/basespecial/InnerClassTest.java | f947407f0f6cb234918ef65d3123edf16f10dd01 | [] | no_license | xiaohuajun/JavaLearn | a7556600246f6756711f0894fc242e269ec04c20 | eb9a04d76c255ecde25685e8a634499692d225a3 | refs/heads/master | 2022-06-26T05:27:52.045027 | 2021-07-11T07:36:49 | 2021-07-11T07:36:49 | 213,112,863 | 1 | 0 | null | 2022-05-25T06:57:05 | 2019-10-06T05:18:03 | Java | UTF-8 | Java | false | false | 2,250 | java | package learn.basespecial;
/**
* @author Danny.
* @version 1.0
* @date 2019/9/6 20:34
* @description 内部类可以实现接口,这样可以实现多继承
*/
public class InnerClassTest {
private static int h = 10;
private int b = 12;
public void testOuterClass() {
System.out.println("外部类的方法");
}
public static class StaticInnerClass {
public int a = 11;
public void outA() {
System.out.println(h);
}
}
public class InnerClass {
private int h = 19;
public void testInnerClass() {
System.out.println("this is InnerClass h=" + h);
System.out.println("this is outerClass static h=" + InnerClassTest.h);
System.out.println("this is outerClass static b=" + InnerClassTest.this.b);
testOuterClass();
}
}
/**
* 匿名内部类,自定义接口
*/
interface Listen {
/**
* 点击事件
* @param obj
*/
void onClick(Object obj);
}
public void noNameClassTest() {
//创建一个匿名内部类,并实现Listen接口,并重写里面的方法
Listen listen = new Listen() {
int lField = 22;
@Override
public void onClick(Object o) {
System.out.println("监听点击对象->" + o);
System.out.println("自己的字段->" + lField);
System.out.println("外部类的字段->" + b);
System.out.println("外部类的静态字段->" + h);
}
};
listen.onClick(new Object() {
@Override
public String toString() {
return "obj1";
}
});
}
public static void main(String[] args) {
//静态内部类的用法
InnerClassTest.StaticInnerClass a = new InnerClassTest.StaticInnerClass();
a.outA();
//成员内部类的用法
InnerClassTest.InnerClass innerClass = new InnerClassTest().new InnerClass();
innerClass.testInnerClass();
//匿名内部类的用法
InnerClassTest in = new InnerClassTest();
in.noNameClassTest();
}
}
| [
"18061741650@163.com"
] | 18061741650@163.com |
335ffdceedf9474600973e79abe585e7fef0f796 | 44338c4b428907d15a76ba1e071e258cb082abac | /app/src/main/java/nyc/c4q/huilin/neighborhoodhub/crier/CrierAdapter.java | fdb99e269ff248f7eb77ecf24fda8687a73efc13 | [] | no_license | nuily/NeighborHub | f354a09bbf8403ad6660eee91d7c023c9f075e7d | a774b64beb5e82471264fb7dc801e9ea915ab5c6 | refs/heads/master | 2021-06-11T14:39:50.369883 | 2017-02-05T21:32:02 | 2017-02-05T21:32:02 | 80,175,386 | 0 | 0 | null | 2017-02-05T21:32:02 | 2017-01-27T02:27:38 | Java | UTF-8 | Java | false | false | 1,280 | java | package nyc.c4q.huilin.neighborhoodhub.crier;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import nyc.c4q.huilin.neighborhoodhub.R;
import nyc.c4q.huilin.neighborhoodhub.model.CrierPosts.CrierPost;
/**
* Created by rook on 2/4/17.
*/
public class CrierAdapter extends RecyclerView.Adapter {
ArrayList<CrierPost> postList = new ArrayList<>();
public CrierAdapter(ArrayList<CrierPost> crierPosts) {
postList = crierPosts;
}
public void setData(ArrayList<CrierPost> postList) {
this.postList = postList;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_item, parent, false);
return new CrierViewHolder(itemView);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
CrierViewHolder viewHolder = (CrierViewHolder) holder;
CrierPost crierPost = postList.get(position);
viewHolder.bind(crierPost);
}
@Override
public int getItemCount() {
return postList.size();
}
}
| [
"rook@Vault-Tec.home"
] | rook@Vault-Tec.home |
86c8defd11023053c8cfd5f651fd0a8469f91874 | 5bc7ab0ef397a8df6d22c160236c60ac67a81201 | /HK3/QuyTrinhQuanLyPhanMem/Temp/SNAPTRANS/Source/SNAPTRANS/app/src/test/java/quanlyduan_group7/snaptrans/ExampleUnitTest.java | 962dfad3a90d8b732eaa9337dec361ed971f8776 | [] | no_license | thaihoc215/16HCB | 8c2780c1ad0e279697a41592385cdfdb8aeb1402 | 2282e72929ead18a24a5ebb7a57747bbcbe203b2 | refs/heads/master | 2018-09-07T02:55:24.436082 | 2018-06-08T10:14:23 | 2018-06-08T10:14:23 | 105,726,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package quanlyduan_group7.snaptrans;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"bboyfool215@gmail.com"
] | bboyfool215@gmail.com |
03790e065fb0067c21b58a32cbc074369a40b590 | 319a277d35bcd0d08c72ff03ad8048dc8076af74 | /hibernate/FetchingTechniques/src/main/java/org/unnati/example/entities/CustomerProfile.java | 9b1a336240183f940215c2c82c8ad60a7d7e0948 | [] | no_license | mayshukl/example | 261ee99cd3387844691201892499b2701afedb92 | 6646ea0ff8c6d00d6f80d543e1c1436f92efbfee | refs/heads/master | 2022-12-03T07:00:29.775298 | 2019-09-29T16:01:03 | 2019-09-29T16:01:03 | 148,917,098 | 0 | 0 | null | 2022-11-24T09:58:45 | 2018-09-15T15:59:39 | Java | UTF-8 | Java | false | false | 750 | java | package org.unnati.example.entities;
import javax.persistence.*;
@Entity
public class CustomerProfile {
@Id
@org.hibernate.annotations.GenericGenerator(name="ForeignIdGenerator",strategy = "foreign",parameters =@org.hibernate.annotations.Parameter( name="property" ,value = "userProfile"))
@GeneratedValue(generator="ForeignIdGenerator")
private int id;
@OneToOne
@PrimaryKeyJoinColumn
private UserProfile userProfile;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public UserProfile getUserProfile() {
return userProfile;
}
public void setUserProfile(UserProfile userProfile) {
this.userProfile = userProfile;
}
}
| [
"mayshukl@cisco.com"
] | mayshukl@cisco.com |
c7562e45a91690e2f10bc0a5fa0944c94d182cc0 | 238d18fdd9d141ff4ca425ff7daa41c402a5fc44 | /app/src/main/java/com/sankalpchauhan/flipkartgridchallenge/util/DarkModeHandler.java | a532e88b64b61d2a662286204156552c8feb2018 | [] | no_license | sankalpchauhan-me/Flipkart-Grid-2-Android-App | ec93181c55511248b2f51149746cb12db6ace3a0 | d7f1c27c3d5c77232d3f95cfa7a01a9032d5f783 | refs/heads/master | 2022-12-05T18:30:28.125962 | 2020-08-09T14:06:22 | 2020-08-09T14:06:22 | 286,243,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package com.sankalpchauhan.flipkartgridchallenge.util;
import androidx.appcompat.app.AppCompatDelegate;
public class DarkModeHandler {
private static final String lightMode = "light";
private static final String darkMode = "dark";
private static final String batterySaver= "battery";
public static void themeHelper(Boolean isDarkMode){
if(!isDarkMode){
applyTheme(lightMode);
} else {
applyTheme(darkMode);
}
}
private static void applyTheme(String theme){
switch (theme){
case lightMode:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
break;
case darkMode:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
break;
case batterySaver:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY);
break;
default:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
}
}
}
| [
"sankalpchauhan.me@gmail.com"
] | sankalpchauhan.me@gmail.com |
ada34a6d463b33870a88fb61b3eabc1246fb607e | a706ed78a33a7f65a56bbc1c19e5f10ef74d2e82 | /src/main/java/finalproject/finalproject/services/VillageService.java | 937fdd3e84fda9206dd9330f9bd04fedf610139a | [] | no_license | okalanang13/project_GenerateCV | fc5fca57681a79b26d86f38282355a8c79c5e101 | ca11571576a6eedffd0d727e9ab89954a56c83a6 | refs/heads/master | 2020-06-02T18:56:38.895231 | 2019-05-31T09:41:01 | 2019-05-31T09:41:01 | 191,273,013 | 0 | 0 | null | 2019-06-11T01:44:43 | 2019-06-11T01:44:43 | null | UTF-8 | Java | false | false | 509 | java | package finalproject.finalproject.services;
import finalproject.finalproject.entities.Village;
import finalproject.finalproject.repositories.VillageRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author RR17
*/
@Service
public class VillageService {
@Autowired
private VillageRepository villageImplement;
public Iterable<Village> findAllVillage(){
return villageImplement.findAll();
}
}
| [
"regitarachma@gmail.com"
] | regitarachma@gmail.com |
60c1c0e471d4d3c79c38b6cff4374fcec28c107c | ca2f1dd69af61575a83c1757fbe203a94586087e | /src/main/java/ru/itis/antonov/ConsoleResultOutput.java | a06f86bf94da1e202c0f221565755659a8528d4c | [] | no_license | anatolik2509/SpringCalculator | 006b6f927920784aef251d280576f09ea263df04 | 6a71424c9e84cf6be87e98200f5a9fa007f66610 | refs/heads/master | 2023-03-07T17:19:37.883229 | 2021-02-16T06:23:42 | 2021-02-16T06:23:42 | 339,216,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | package ru.itis.antonov;
public class ConsoleResultOutput implements ResultOutput{
@Override
public void printResult(String result) {
System.out.println(result);
}
}
| [
"antonov250901@mail.ru"
] | antonov250901@mail.ru |
995b934209fdccb5638778fc987d95ed29620f3d | e2744631f7ae5477157c4d1b969c7623c8833f35 | /core/src/main/java/r/base/package-info.java | 2ea9e66e1d95f8ebc3a8b735b58767a6df773888 | [] | no_license | jkingsbery/renjin | 147928df812bf92877d3f1076580e6ab0ca0a044 | d76df923ed7b77aef7f83a6bb9ee179ed57df3b8 | refs/heads/master | 2016-08-04T16:06:20.432322 | 2012-02-04T04:52:19 | 2012-02-04T04:52:19 | 3,235,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | /**
* Implementation of the "native" portions of the R base package.
* Note that the base package also includes what in other languages
* would be part of the language itself, such as the 'if', 'for',
* '<-' (assignment) functions etc.
*
*/
package r.base; | [
"alex@bedatadriven.com@b722d886-ae41-2056-5ac6-6db9963f4c99"
] | alex@bedatadriven.com@b722d886-ae41-2056-5ac6-6db9963f4c99 |
ffbf9338befd2da5b5e82d86a5310a948a556f89 | 8280fcd0cac237d99db508c426f68820448ee713 | /cardiodroid/app/src/main/java/com/dev/cardioid/ps/cardiodroid/utils/PreferencesUtils.java | 1a5e9366dc64f5509bd4630efbb59313154a4d22 | [] | no_license | PeteGabriel/CardioDroID | c28c3e4b1be8c4b544209c96e0683abe5f0b5173 | 1fe6ebb93a1b787f850545c3ad3946b3ea651c86 | refs/heads/master | 2021-06-07T02:24:41.570038 | 2016-11-07T22:07:56 | 2016-11-07T22:07:56 | 72,957,699 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,784 | java | package com.dev.cardioid.ps.cardiodroid.utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.preference.PreferenceManager;
import android.util.Log;
import com.dev.cardioid.ps.cardiodroid.R;
import com.dev.cardioid.ps.cardiodroid.activities.UserPreferencesActivity;
/**
* Provides easy retrieval from preferences.
*
*/
public class PreferencesUtils {
public static final String TAG = Utils.makeLogTag(PreferencesUtils.class);
public static final String PREFERENCES_READ_OP_DEFAULT_VALUE = "NOT_FOUND";
public static final String AUTH_PROCESS = "TYPE_AUTH";
public static final String ID_PROCESS = "TYPE_ID";
public static final String LOCATION_LATITUDE = "LATITUDE";
public static final String LOCATION_LONGITUDE = "LONGITUDE";
/**
* No instances of this class
*/
private PreferencesUtils(){/*no instances*/}
/**
* TODO
*/
public static boolean isUserRegistered(Context context){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean predicate = prefs.contains(UserPreferencesActivity.USER_ID_KEY);
Log.d(TAG, "IsUserRegister: " + predicate);
return predicate;
}
/**
* TODO
*/
public static String getRegisteredUserId(Context context){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String userID = prefs.getString(UserPreferencesActivity.USER_ID_KEY,
PREFERENCES_READ_OP_DEFAULT_VALUE);
Log.d(TAG, "RegisteredUserId: " + userID);
return userID;
}
public static void saveUserRegisterId(Context context, String addr){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putString(UserPreferencesActivity.USER_ID_KEY, addr);
editor.apply();
}
public static void saveDeviceAddress(Context context, String addr) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putString(UserPreferencesActivity.DEVICE_ADDR_KEY, addr);
editor.apply();
}
public static boolean isDeviceAddressFound(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean predicate = prefs.contains(UserPreferencesActivity.DEVICE_ADDR_KEY);
Log.d(TAG, "isDeviceAddressFound: " + predicate);
return predicate;
}
public static String getDeviceAddress(Context context){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String value = prefs.getString(UserPreferencesActivity.DEVICE_ADDR_KEY, PREFERENCES_READ_OP_DEFAULT_VALUE);
Log.d(TAG, "DeviceAddress: " + value);
return value;
}
public static String getIdentificationProcess(Context ctx){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String process = prefs.getString(UserPreferencesActivity.USER_IDENTIFICATION_PROCESS_KEY,
PREFERENCES_READ_OP_DEFAULT_VALUE);
Log.d(TAG, "Identification Process: " + process);
return process;
}
/**
* It tries to find the type of connection defined by the user in preferences.
* It returns -1 if any type can be used.
* If the WiFi was the value specified it will return the constant ConnectivityManager.TYPE_WIFI.
* If the mobile data type was selected it will return ConnectivityManager.TYPE_MOBILE.
*/
public static long getConnectionSpecifiedByUser(Context ctx){
//possible values
final String WIFI = ctx.getResources().getString(R.string.wifi_conn);
final String MOBILE = ctx.getResources().getString(R.string.mobile_conn);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String valueFromPrefs = prefs.getString(UserPreferencesActivity.TYPE_OF_CONNECTION_KEY, "");
if(valueFromPrefs.equals(WIFI))
return ConnectivityManager.TYPE_WIFI;
if(valueFromPrefs.equals(MOBILE))
return ConnectivityManager.TYPE_MOBILE;
else return -1;
}
public static int getTypeOfMapLayout(Context ctx){
final String key = "types_of_map_list_preference";
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String valueFromPrefs = prefs.getString(key, "");
return Integer.valueOf(valueFromPrefs);
}
public static int getVibrateActionDuration(Context ctx){
final String key = "vibrate_time_key";
final String DEFAULT_VIBRATE_TIME = "5000";
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String valueFromPrefs = prefs.getString(key, DEFAULT_VIBRATE_TIME);
return Integer.valueOf(valueFromPrefs);
}
} | [
"pedrogabriel@protonmail.ch"
] | pedrogabriel@protonmail.ch |
c9c8145f1ea6ddccce0719d56c0ed0b7f7519b03 | 1c323a486c3086e60d637f92e291816d07a7bbc5 | /src/main/java/ch/tbd/kafka/backuprestore/backup/storage/format/KafkaRecordWriterMultipartUpload.java | a13c0c5f023e40d42cab7bd48620de981506e95a | [] | no_license | antonioiorfino/kafka-backup | fca9719431156104ef512a890827c34a75ed09d3 | 13f3075322ae2352a02144edcb4be94ead4c5b84 | refs/heads/master | 2020-05-25T12:28:43.230434 | 2019-05-27T15:00:11 | 2019-05-27T15:00:11 | 187,799,710 | 0 | 0 | null | 2019-05-21T08:55:29 | 2019-05-21T08:55:29 | null | UTF-8 | Java | false | false | 5,600 | java | package ch.tbd.kafka.backuprestore.backup.storage.format;
import ch.tbd.kafka.backuprestore.backup.kafkaconnect.BackupSinkConnectorConfig;
import ch.tbd.kafka.backuprestore.backup.storage.S3OutputStream;
import ch.tbd.kafka.backuprestore.model.KafkaRecord;
import ch.tbd.kafka.backuprestore.model.avro.AvroKafkaRecord;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.Protocol;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import org.apache.kafka.connect.errors.ConnectException;
import org.apache.kafka.connect.sink.SinkRecord;
import org.springframework.util.SerializationUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
/**
* Class KafkaRecordWriterMultipartUpload.
* This represents TODO.
*
* @author iorfinoa
* @version $$Revision$$
*/
public class KafkaRecordWriterMultipartUpload implements RecordWriter {
private BackupSinkConnectorConfig conf;
private AmazonS3 amazonS3;
private String bucket;
private S3OutputStream s3out;
private OutputStream s3outWrapper;
private static final String LINE_SEPARATOR = System.lineSeparator();
private static final byte[] LINE_SEPARATOR_BYTES
= LINE_SEPARATOR.getBytes(StandardCharsets.UTF_8);
public KafkaRecordWriterMultipartUpload(BackupSinkConnectorConfig connectorConfig) {
this.conf = connectorConfig;
AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
builder.withRegion(connectorConfig.getRegionConfig());
builder.withCredentials(new ProfileCredentialsProvider());
if (connectorConfig.getProxyUrlConfig() != null && !connectorConfig.getProxyUrlConfig().isEmpty() && connectorConfig.getProxyPortConfig() > 0) {
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(Protocol.HTTPS);
config.setProxyHost(connectorConfig.getProxyUrlConfig());
config.setProxyPort(connectorConfig.getProxyPortConfig());
builder.withClientConfiguration(config);
}
this.amazonS3 = builder.build();
this.bucket = connectorConfig.getBucketName();
}
@Override
public void write(SinkRecord sinkRecord) {
KafkaRecord record = new KafkaRecord(sinkRecord.topic(), sinkRecord.kafkaPartition(), sinkRecord.kafkaOffset(), sinkRecord.timestamp(), getBuffer(sinkRecord.key()), getBuffer(sinkRecord.value()));
if (s3outWrapper == null) {
s3out = new S3OutputStream(key(record), conf, amazonS3);
this.s3outWrapper = s3out.wrapForCompression();
}
try {
AvroKafkaRecord avroKafkaRecord = AvroKafkaRecord.newBuilder()
.setTopic(record.getTopic())
.setPartition(record.getPartition())
.setOffset(record.getOffset())
.setTimestamp(record.getTimestamp())
.setKey(record.getKey())
.setValue(record.getValue())
.setHeaders(adaptHeaders(record.getHeaders()))
.build();
if (sinkRecord.headers() != null) {
sinkRecord.headers().forEach(header ->
record.addHeader(header.key(), SerializationUtils.serialize(header.value()))
);
}
s3outWrapper.write(serialize(avroKafkaRecord));
s3outWrapper.write(LINE_SEPARATOR_BYTES);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void close() {
}
@Override
public void commit() {
try {
s3out.commit();
s3outWrapper.close();
} catch (IOException e) {
throw new ConnectException(e);
}
}
public ByteBuffer getBuffer(Object obj) {
ObjectOutputStream ostream;
ByteArrayOutputStream bstream = new ByteArrayOutputStream();
try {
ostream = new ObjectOutputStream(bstream);
ostream.writeObject(obj);
ByteBuffer buffer = ByteBuffer.allocate(bstream.size());
buffer.put(bstream.toByteArray());
buffer.flip();
return buffer;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private String key(KafkaRecord record) {
return String.format("%s/%d/index-%d.avro-messages", record.getTopic(), record.getPartition(), record.getOffset());
}
private byte[] serialize(AvroKafkaRecord record) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream obj = new ObjectOutputStream(baos);
obj.writeObject(record);
byte[] bytes = baos.toByteArray();
obj.close();
baos.close();
return bytes;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private Map<CharSequence, ByteBuffer> adaptHeaders(Map<String, ByteBuffer> headers) {
if (headers == null) {
return null;
}
Map<CharSequence, ByteBuffer> newHeaders = new HashMap<>();
headers.forEach((key, value) -> {
newHeaders.put(key, value);
});
return newHeaders;
}
}
| [
"antonio.iorfino@post.ch"
] | antonio.iorfino@post.ch |
dd0745376d5fb70a33b12d510d3d6f79dc7ee109 | 527eefcef81217713952ff69bc6794e89393d61c | /android/app/src/main/java/com/rnativeboilerplate/MainActivity.java | fe4906e7a34cbe0e9d02c89124dcbee1cc001041 | [] | no_license | JanidHam/react-native-boilerplate | c793f5088f2488d78cbd483319981e3020d2c906 | ae02b04420eb1bcdeae9a4c5e7c4fdd79fdc193a | refs/heads/master | 2022-12-23T07:55:30.458645 | 2019-09-04T18:45:40 | 2019-09-04T18:45:40 | 206,389,104 | 0 | 0 | null | 2022-12-10T01:03:25 | 2019-09-04T18:43:04 | JavaScript | UTF-8 | Java | false | false | 363 | java | package com.rnativeboilerplate;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "rnativeBoilerplate";
}
}
| [
"janid.ham20@gmail.com"
] | janid.ham20@gmail.com |
bb90b351b9117f833647b6509fd2a8dc35c5a0cb | 158488a53bc14c7a42855f6faf474761da0cd5d8 | /app/src/test/java/com/maochun/instructionanimation/ExampleUnitTest.java | c9f628064f8fe465003609b67a732cd6b96837c8 | [] | no_license | MaochunS/Android-InstructionAnimation | 057ea080ba918a337937cb3d22f026b0c06ee0c7 | fd355b88b2a44e65b25634f3f9cb7eea96a2009d | refs/heads/master | 2022-12-25T20:54:04.879364 | 2020-10-06T06:10:41 | 2020-10-06T06:10:41 | 301,623,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package com.maochun.instructionanimation;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"52019408+MaochunS@users.noreply.github.com"
] | 52019408+MaochunS@users.noreply.github.com |
0e009141cb1f3400b15739bde8092b938c9512bc | 01d6bf6d7f8a9e8a598c17ff2d57a079e335e22b | /src/j/ext/workflow/JWFTaskNextConfig.java | e6fc3b2908379ba54bc350453911bb52662b72d3 | [] | no_license | ajunlonglive/JFramework | 9851fa1fc5ec9bd3e2a4cc5878df98d20e241e3c | 22e34e5ac9cca28ecbaf924fa770134500228fd4 | refs/heads/master | 2023-06-17T14:14:38.175255 | 2021-07-17T14:46:57 | 2021-07-17T14:46:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package j.ext.workflow;
public class JWFTaskNextConfig {
private String condition;
private String[] uuids;
public String getConditon(){
return this.condition;
}
public void setCondition(String condition){
this.condition=condition;
}
public String[] getUuids(){
return this.uuids;
}
public void setUuids(String _uuids){
this.uuids=_uuids==null?null:_uuids.split(",");
}
}
| [
"tech@gugumall.cn"
] | tech@gugumall.cn |
4fac968c86e8730866e9618d2f369799f4c7651b | 82625045ec6f7b0d00e2457f49bb01221d059c69 | /br/com/abc/javacore/Zcolecoes/test/BinarySearchTest.java | 5a415c3b66d8bd3fd631f9d491cc5fea5701ebcb | [] | no_license | josiastorre/projeto-java | e1269444248022e58f47efd788eae407a4cc0c88 | 240f4cdaebdbbf66594fcb4623b3c125d9a2faf3 | refs/heads/main | 2023-03-07T12:10:33.034171 | 2021-02-26T15:38:56 | 2021-02-26T15:38:56 | 342,614,050 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,684 | java | package br.com.abc.javacore.Zcolecoes.test;
import br.com.abc.javacore.Zcolecoes.classes.Produto;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class BinarySearchTest {
public static void main(String[] args) {
List<Integer> numeros = new ArrayList<>();
numeros.add(2);
numeros.add(0);
numeros.add(4);
numeros.add(3);
// (-(ponto de inserção)-1), -1 -1 = -2
Collections.sort(numeros);
//0,1,2,3
//0,2,3,4
System.out.println(Collections.binarySearch(numeros, 1));
List<Produto> produtos = new ArrayList<>();
Produto produto1 = new Produto("123", "Laptop Lenovo", 2000.0);
Produto produto2 = new Produto("321", "Picanha", 26.4);
Produto produto3 = new Produto("879", "Teclado Razer", 1000.0);
Produto produto4 = new Produto("012", "Samsung Galaxy S7 64Gb", 3250.5);
produtos.add(produto1);
produtos.add(produto2);
produtos.add(produto3);
produtos.add(produto4);
Collections.sort(produtos, new ProdutoNomeComparator());
Produto produto5 = new Produto("000", "Antena", 50);
for (Produto produto : produtos) {
System.out.println(produto);
}
System.out.println(Collections.binarySearch(produtos, produto5, new ProdutoNomeComparator()));
Integer[] arrayInteger = new Integer[4];
arrayInteger[0] = 2;
arrayInteger[1] = 0;
arrayInteger[2] = 4;
arrayInteger[3] = 3;
Arrays.sort(arrayInteger);
System.out.println(Arrays.binarySearch(arrayInteger,5));
}
}
| [
"josiastorre@gmail.com"
] | josiastorre@gmail.com |
a6a573e061164cc4e4ef61b2ba402fd90df43b64 | 686629bc361073c5759a6c2d9462afc866503cae | /app/src/main/java/com/example/nicks/myfoodfirst/photo1.java | 2f0ac3aeb93b79bced5ab67a5ef6030a9a2ce737 | [] | no_license | nicksonpatel/FoodFirst-Android | e10429a942ab941ee499be27cf5d52d772551dd4 | b095fac681057cd75fc82a0295ecbc8cb649ee06 | refs/heads/master | 2021-01-01T00:21:19.331455 | 2020-02-11T05:56:10 | 2020-02-11T05:56:10 | 239,095,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package com.example.nicks.myfoodfirst;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
public class photo1 extends Fragment {
public photo1() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_photo1, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ImageView one = (ImageView) view.findViewById(R.id.fragmentOneBackground);
Picasso.get().load(R.drawable.one).fit().centerCrop().into(one);
}
} | [
"60790114+nicksonpatel@users.noreply.github.com"
] | 60790114+nicksonpatel@users.noreply.github.com |
6480f3df427646b3b7906ccadc96d13e3b8e6b04 | 217fb1a510a2a19f4de8157ff78cd7a495547f69 | /goodscenter/goodscenter-service/src/main/java/com/camelot/goodscenter/service/impl/TradeInventoryServiceImpl.java | 474deba0ae57a6377b793bdeebb53b6f2f671a64 | [] | no_license | icai/shushimall | 9dc4f7cdb88327d9c5b177158322e8e4b6f7b1cd | 86d1a5afc06d1b0565cbafa64e9dd3a534be58b6 | refs/heads/master | 2022-12-03T14:24:32.631217 | 2020-08-25T16:00:39 | 2020-08-25T16:00:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,447 | java | package com.camelot.goodscenter.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.camelot.goodscenter.dao.ItemMybatisDAO;
import com.camelot.goodscenter.dao.ItemPriceDAO;
import com.camelot.goodscenter.dao.ItemSkuDAO;
import com.camelot.goodscenter.dao.TradeInventoryDAO;
import com.camelot.goodscenter.domain.ItemSku;
import com.camelot.goodscenter.dto.InventoryModifyDTO;
import com.camelot.goodscenter.dto.ItemAttr;
import com.camelot.goodscenter.dto.ItemCatCascadeDTO;
import com.camelot.goodscenter.dto.ItemDTO;
import com.camelot.goodscenter.dto.SellPrice;
import com.camelot.goodscenter.dto.SkuPictureDTO;
import com.camelot.goodscenter.dto.TradeInventoryDTO;
import com.camelot.goodscenter.dto.TradeInventoryInDTO;
import com.camelot.goodscenter.dto.TradeInventoryOutDTO;
import com.camelot.goodscenter.service.ItemCategoryService;
import com.camelot.goodscenter.service.TradeInventoryExportService;
import com.camelot.openplatform.common.DataGrid;
import com.camelot.openplatform.common.ExecuteResult;
import com.camelot.openplatform.common.Pager;
/**
* <p>Description: [库存]</p>
* Created on 2015年3月13日
* @author <a href="mailto: xxx@camelotchina.com">杨芳</a>
* @version 1.0
* Copyright (c) 2015 北京柯莱特科技有限公司 交付部
*/
@Service("tradeInventoryExportService")
public class TradeInventoryServiceImpl implements TradeInventoryExportService {
@Resource
private TradeInventoryDAO tradeInventoryDAO;
@Resource
private ItemPriceDAO itemPriceDAO;
@Resource
private ItemMybatisDAO itemMybatisDAO;
@Resource
private ItemCategoryService itemCategoryService;
@Resource
private ItemSkuDAO itemSkuDAO;
/**
* <p>Discription:[根据skuId查询库存]</p>
* Created on 2015年3月18日
* @param skuId
* @return
* @author:[杨芳]
*/
@Override
public ExecuteResult<TradeInventoryDTO> queryTradeInventoryBySkuId(Long skuId) {
ExecuteResult<TradeInventoryDTO> er=new ExecuteResult<TradeInventoryDTO>();
try{
er.setResult(tradeInventoryDAO.queryBySkuId(skuId));
er.setResultMessage("success");
}catch(Exception e){
er.setResultMessage(e.getMessage());
throw new RuntimeException(e);
}
return er;
}
/**
* <p>Discription:[根据条件查询库存列表]</p>
* Created on 2015年3月14日
* @param dto
* @param page
* @return
* @author:[杨芳]
*/
@Override
public ExecuteResult<DataGrid<TradeInventoryOutDTO>> queryTradeInventoryList(TradeInventoryInDTO dto,Pager page) {
ExecuteResult<DataGrid<TradeInventoryOutDTO>> result=new ExecuteResult<DataGrid<TradeInventoryOutDTO>>();
DataGrid<TradeInventoryOutDTO> dg=new DataGrid<TradeInventoryOutDTO>();
try{
List<TradeInventoryOutDTO> list=tradeInventoryDAO.queryTradeInventoryList(dto, page);
Long count=tradeInventoryDAO.queryCount(dto);
for(TradeInventoryOutDTO out:list){
//根据skuId查询商品sku的图片
List<SkuPictureDTO> pics=itemMybatisDAO.querySkuPics(out.getSkuId());
out.setSkuPicture(pics);
//根据skuId查询sku的销售价
List<SellPrice> sp=itemPriceDAO.querySkuSellPrices(out.getSkuId());
out.setAreaPrices(sp);
//根据skuId查询商品的名称、编码、状态、类目id、市场价以及sku的销售属性集合:keyId:valueId
TradeInventoryOutDTO td=tradeInventoryDAO.queryItemBySkuId(out.getSkuId());
out.setItemName(td.getItemName());
out.setItemId(td.getItemId());
out.setItemStatus(td.getItemStatus());
out.setMarketPrice(td.getMarketPrice());
out.setSkuStatus(td.getSkuStatus());
out.setCid(td.getCid());
out.setGuidePrice(td.getGuidePrice());
//根据cid查询类目属性
ExecuteResult<List<ItemCatCascadeDTO>> er=itemCategoryService.queryParentCategoryList(td.getCid());
out.setItemCatCascadeDTO(er.getResult());
//根据sku的销售属性keyId:valueId查询商品属性
// System.out.println(td.getAttributes()+"//////");
ExecuteResult<List<ItemAttr>> itemAttr=itemCategoryService.queryCatAttrByKeyVals(td.getAttributes());
out.setItemAttr(itemAttr.getResult());
}
dg.setRows(list);
dg.setTotal(count);
result.setResult(dg);
}catch(Exception e){
result.setResultMessage("error");
throw new RuntimeException(e);
}
return result;
}
/**
*
* <p>Discription:[批量修改库存]</p>
* Created on 2015年3月14日
* @param dto
* @return
* @author:[杨芳]
*/
@Override
public ExecuteResult<String> modifyInventoryByIds(List<InventoryModifyDTO> dtos){
ExecuteResult<String> er = new ExecuteResult<String>();
if (dtos == null || dtos.isEmpty()) {
er.addErrorMessage("参数不能为空!");
return er;
}
ItemDTO item = null;
ItemDTO dbItem = null;
for (InventoryModifyDTO im : dtos) {
TradeInventoryDTO dbSkuInv = tradeInventoryDAO.queryBySkuId(im.getSkuId());//数据库原库存
tradeInventoryDAO.modifyInventoryBySkuIds(im.getSkuId(), im.getTotalInventory());
ItemSku sku = this.itemSkuDAO.queryById(im.getSkuId());
dbItem = this.itemMybatisDAO.getItemDTOById(sku.getItemId());
item = new ItemDTO();
item.setItemId(sku.getItemId());
//计算商品总库存
item.setInventory(dbItem.getInventory()-(dbSkuInv.getTotalInventory()-im.getTotalInventory()));
this.itemMybatisDAO.updateItem(item);
}
return er;
}
}
| [
"331563342@qq.com"
] | 331563342@qq.com |
f160afaca66b1f33a9f633865d88148a4d3a1c99 | f5e31e0be7e54d8565edb049a3a33b8cabbd58ec | /mail/src/org/mail/service/receivingAddress/ReceivingAddressService.java | acad577bdac900f082b01999a69d22d79d8c22b4 | [] | no_license | Louis-Lou/mail-shop | 113875f56d94694d97486b8ff65a80f8b52efdf3 | 989f73d1b88738e67db37c64142051013504b17f | refs/heads/master | 2020-03-18T08:08:33.105688 | 2018-05-23T01:01:26 | 2018-05-23T01:01:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,632 | java | package org.mail.service.receivingAddress;
import java.sql.Timestamp;
import java.util.List;
import org.junit.Assert;
import org.mail.entity.ReceivingAddress;
import org.mail.entity.Users;
import org.mail.jdbc.JdbcTemplate;
import org.mail.service.user.UsersService;
import org.mail.util.MD5Util;
/**
* 收货地址业务类(DAO)
*
* @author Louis Lo
*
*/
public class ReceivingAddressService extends JdbcTemplate<ReceivingAddress> {
// 检查数据
/*
* public List<ReceivingAddress> testReceivingAddressQuery(){
* ReceivingAddressService receivingAddressService = new
* ReceivingAddressService(); List<ReceivingAddress> receivingAddress =
* receivingAddressService.quary("select * from receiving_address");
* System.out.println(receivingAddress); return receivingAddress; }
*/
// 检查收货地址
public boolean checkReceivingAddress(String raCountry, String raProvince, String raCity, String raDetail,
String rapreson) {
return exists(
"select * from Receiving_Address where racountry = ? and raprovince = ? and racity = ? and radetail = ? and RAPERSON = ? ",
raCountry, raProvince, raCity, raDetail ,rapreson);
}
// 添加数据
public int addReceivingAddress(String raPerson, String raPhone, String raCountry, String raProvince, String raCity,
String raDetail) {
Object[] parms = {raCountry, raProvince, raCity, raDetail, raPerson, raPhone, ReceivingAddress.ENABLED, 1,
new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()) };
return execute("insert into receiving_address values( ADDRESS_SEQ.nextval,?,?,?,?,?,?,?,?,?,?)", parms);
}
}
| [
"812764909@qq.com"
] | 812764909@qq.com |
65ee3244ebc8268898cc3494535dc3a0db9f815f | 8e228cb70cc58864627709a5b7709a0c30616d46 | /DropDots/core/src/com/cgranule/dropdots/helper/Assets.java | 0643b364cfec11d796be85fabc0f7346de54ad6d | [] | no_license | damarindra/Drop-Dots | 6cc11a2e6bb63afc570d6186f9ae9fd91d497561 | 51427644744bfec64d81bce701dfc7ea50d6dc45 | refs/heads/master | 2020-06-10T17:49:34.332125 | 2016-12-08T08:08:45 | 2016-12-08T08:08:45 | 75,916,712 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package com.cgranule.dropdots.helper;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.cgranule.dropdots.manager.GameManager;
import com.cgranule.dropdots.utils.Constants;
/**
* Created by Damar on 8/20/2015.
*/
public class Assets {
public static AssetManager manager;
public static void load()
{
manager = new AssetManager();
manager.load(Constants.SKIN_PATH, Skin.class);
manager.load(Constants.SOUND_ZAP, Music.class);
manager.load(Constants.SOUND_BUTTON, Sound.class);
}
public static Sound getAssetSound(String fileName) {
return Assets.manager.get(fileName, Sound.class);
}
public static Music getAssetMusic(String fileName) {
return Assets.manager.get(fileName, Music.class);
}
public static Skin getAssetSkin(){
return Assets.manager.get(Constants.SKIN_PATH, Skin.class);
}
}
| [
"damarind@gmail.com"
] | damarind@gmail.com |
220837d5ee7178d24815a950ffb9452ba3d01c8a | 12ed033aaabadf5e9e127b540d73c695813f33be | /src/dataManaging/AbstractItem.java | 8f38864fdd5463e7be2528cbf19c62c906482b85 | [] | no_license | brazil-internship-bigdata/TransformationManager1.0 | 025cb44dbf2e2d8723b7f9a822ed7e405d75eba1 | 6dcf28649b11398a9b7f242978e37fe0b3e477d7 | refs/heads/master | 2021-01-22T08:38:05.026650 | 2017-08-17T16:18:17 | 2017-08-17T16:18:17 | 92,624,376 | 0 | 0 | null | 2017-08-17T16:18:18 | 2017-05-27T21:13:04 | Java | UTF-8 | Java | false | false | 5,084 | java | package dataManaging;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import tools.exceptions.CancelledCommandException;
public abstract class AbstractItem implements Item {
//protected boolean jobRunning;
protected Date lastTransformation;
private DateFormat format = new SimpleDateFormat("dd.MM.yyyy-HH:mm:ss");
protected Date defaultDate = new Date(0L); //defaultDate to replace null. This date corresponds to a transformation that never happened yet.
private String identifier;
public static final String separator = " ";
public AbstractItem() throws CancelledCommandException{
this.identifier = new IdentifierPane().getIdentifier();
if(identifier == null)
throw new CancelledCommandException();
abstractInit();
}
public AbstractItem(String [] attributes) throws IllegalArgumentException {//String lastTransformationDate, String jobRunning) {
abstractInit();
if(attributes.length != numberOfAttributes()) {
throw new IllegalArgumentException("the line in the savings file couldn't be analyzed correctly. No field should be empty nor contain spaces");
}
identifier = attributes[0];
int indexOfDate = attributes.length -1;
// int indexOfJobRunning = attributes.length -1;
parseLastTransformationDate(attributes[indexOfDate]);
// this.jobRunning = attributes[indexOfJobRunning].equals("true");
}
private void abstractInit() {
// this.jobRunning = false;
lastTransformation = defaultDate;
init(); //abstract method for now
}
@Override
public boolean isJobRunning() {
// TODO check if the job is scheduled on the computer
// return jobRunning;
return false;
}
@Override
public String lastTransformationDate() {
return format.format(lastTransformation);
}
private void parseLastTransformationDate(String lastTransformationDate) {
try {
lastTransformation = format.parse(lastTransformationDate);
} catch (ParseException e) {
//lastTransformation = defaultDate; //No need to do that in my opinion
System.err.println("date of last transformation could not be read. The date remain what it was. (probably defaultDate)");
//e.printStackTrace();
}
}
@Override
public void setJobRunning(boolean b) {
// jobRunning = b;
}
@Override
public void setLastTransformationDate(Date date) {
lastTransformation = date;
}
@Override
public int numberOfAttributes() {
//last transformation date and jobRunning boolean
return 2 + numberOfCustomFields();
}
@Override
public String generateSavingTextLine() {
String res = getIdentifier();
res += separator + childSavingTextLine();
res += separator + lastTransformationDate();
// res += separator + jobRunning;
return res;
}
/**
* generates the saving text line of the item. This textline must contain the necessary attributes to represent an instance of this item. This doesn't take into account the attributes from superior classes
* @return the saving text line corresponding to this particular item.
*/
protected abstract String childSavingTextLine();
@Override
public void save() {
//Create the directory if it's necessary
File savingDirectory = new File(savingFolder());
if( !savingDirectory.isDirectory() ) {
savingDirectory.mkdirs();
}
//Create the file if it's necessary. The file is based on the name of the item. two items in the same directory shouldn't have the same name.
File savingFile = new File(savingDirectory, getIdentifier());
if( !savingFile.exists() ) {
try {
savingFile.createNewFile();
} catch (IOException e) {
System.err.println("the following item couldn't be saved: " + getIdentifier());
e.printStackTrace();
}
}
//generate the savingTextLine and print it in the savingFile. the previous content is erased when the PrintWriter is created.
String text = generateSavingTextLine();
try {
PrintWriter printer = new PrintWriter(savingFile);
printer.write(text);
printer.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
save();
}
}
@Override
public File savingFile() {
return new File( savingFolder() + identifier );
}
@Override
public File jobFile() {
return new File( transformationFolder() + "rootJob.kjb" );
}
// @Override
public String savingFolder() {
return "savings/" + childFolderPath();
}
@Override
public String transformationFolder() {
return "transformation/jobs/" + childFolderPath() + identifier + "/";
}
/**
* typical hierarchy of results, savings, transformation files etc... for a specific item
* @return <item type>/
*/
protected abstract String childFolderPath();
@Override
public void generateFolders() {
new File( savingFolder() ).mkdirs();
new File( transformationFolder() ).mkdirs();
}
@Override
public String getIdentifier() {
return identifier;
}
}
| [
"alexandre78ferrera@gmail.com"
] | alexandre78ferrera@gmail.com |
4975a1eab7bc8723d8449d89722f677aa55bff17 | ad6d94814b5f138c682767249091ddfffe344ae9 | /JavaSE_Practice/src/com/lv/javase/practice/IO/bio/BIOServer.java | 7c8af4d565db81033ced9df7557329bd5d7e605f | [] | no_license | angiely1115/java8 | 6162bbc720b19d4a47f65855c55db8b3e293c1f7 | b43ffdfc38241414bdf8b0cfcee943a833cfbe32 | refs/heads/master | 2021-10-14T06:57:06.482126 | 2019-02-02T05:58:36 | 2019-02-02T05:58:36 | 109,111,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package com.lv.javase.practice.IO.bio;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class BIOServer {
ServerSocket server;
//服务器
public BIOServer(int port){
try {
//把Socket服务端启动
server = new ServerSocket(port);
System.out.println("BIO服务已启动,监听端口是:" + port);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 开始监听,并处理逻辑
* @throws IOException
*/
public void listener() throws IOException{
//死循环监听
while(true){
//虽然写了一个死循环,如果一直没有客户端连接的话,这里一直不会往下执行
Socket client = server.accept();//等待客户端连接,阻塞方法
//拿到输入流,也就是乡村公路
InputStream is = client.getInputStream();
//缓冲区,数组而已
byte [] buff = new byte[1024];
int len = is.read(buff);
//只要一直有数据写入,len就会一直大于0
if(len > 0){
String msg = new String(buff,0,len);
System.out.println("收到" + msg);
}
}
}
public static void main(String[] args) throws IOException {
new BIOServer(8080).listener();
}
}
| [
"lvrongzhuan@cnhnkj.com"
] | lvrongzhuan@cnhnkj.com |
219c492427f2925bd6e4a60eea20eb8eb6ddfc1c | b7075f3398399b955ef00940a1e268612afb404a | /.svn/pristine/54/547609e121bb829b81908aea9738928a96d62b62.svn-base | 6ecf63c2bff6a934a4b9ef64b8d7b38f1b94c26b | [] | no_license | iuvei/GoldenApple | 5fffcea0b67a05c9ee36358d00ca6d11a889504c | 6faec199308e68d1f817bbec68987ff334067023 | refs/heads/master | 2020-05-20T12:22:21.932932 | 2019-01-14T05:33:31 | 2019-01-14T05:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | package com.goldenapple.lottery.data;
import com.goldenapple.lottery.base.net.RequestConfig;
@RequestConfig(api = "service?packet=Game&action=GetThirdPlatList")
public class GetThirdPlatCommand extends CommonAttribute{
}
| [
"429533813@qq.com"
] | 429533813@qq.com | |
5c8746391fa3164a2331981b4b8522baa6c61c05 | 2aa57d8a395414aeb182b9beba3728f083c30998 | /src/com/exam/Dish.java | 23115998fb33ce128de94f3488b8b8ba0868a1c6 | [] | no_license | joe19990131/FinalExam | 207c34e70b1468ec9049d4731fe2c085a010f0bb | 6ea7eda578330c65290f458cdf48f9d83c7e9a7b | refs/heads/master | 2020-03-21T15:14:40.370199 | 2018-06-26T07:45:48 | 2018-06-26T07:45:48 | 138,701,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package com.exam;
import java.util.ArrayList;
import java.util.List;
public class Dish {
int index;
String name;
int price;
int kcal;
public Dish() {
super();
}
public Dish(int index, String name, int price, int kcal) {
super();
this.index = index;
this.name = name;
this.price = price;
this.kcal = kcal;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getKcal() {
return kcal;
}
public void setKcal(int kcal) {
this.kcal = kcal;
}
}
| [
"joe21854946@gmail.com"
] | joe21854946@gmail.com |
a6e05fe2ede34561e75052b3eae1d420d69ebf95 | 32acbaa54de82917213f13b7526c1497d41e7d53 | /9. For loops/CountingHalf.java | 32f5c22ae72d35bb9356dca75ebb6d271e7f6d0f | [] | no_license | prasadareddy21/JavaByDoingSolutins | 29bca48799730ee0f869e136d417b06d28859442 | ddd16124f1b46efa9d9b596f23ddd1ef51c35457 | refs/heads/master | 2020-03-22T16:03:06.414440 | 2018-07-18T13:33:38 | 2018-07-18T13:33:38 | 140,299,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | public class CountingHalf
{
public static void main(String[] args)
{
for ( double x = -10 ; x <= 10 ; x += 0.5 )
{
System.out.println( x );
}
}
} | [
"prasadareddy21@gmail.com"
] | prasadareddy21@gmail.com |
7f302503c33df5b166ea1a928a1bca05594de9fa | 43942c8a88dfe31690251f2508e942fa01f1d3b7 | /src/grafo/Nodo.java | 7c1de2a5f96c1fa9eb968821785f952541c9ed0d | [] | no_license | Progra-Avanzada-Grupo-20/ColoreoGrafos | 65c573720e50e55da50b160ed8c48aeae9c9e431 | bcf05f5aec15aa1e5ce73c88d9f58cd968674858 | refs/heads/master | 2020-03-21T14:24:53.280320 | 2018-06-28T01:11:18 | 2018-06-28T01:11:18 | 138,655,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,823 | java | package grafo;
/**
* Clase que administra un nodo, sea su número, color y grado. <br>
*/
public class Nodo {
/**
* Color del nodo. <br>
*/
private int color;
/**
* Número del nodo. <br>
*/
private int numero;
/**
* Grado del nodo. <br>
*/
private int grado;
/**
* Crea un nodo. <br>
*/
public Nodo() {
this.numero = 0;
this.color = 0;
this.grado = 0;
}
/**
* Crea un nodo. <br>
*
* @param numero
* Número del nodo. <br>
* @param color
* Color del nodo. <br>
* @param grado
* Grado del nodo. <br>
*/
public Nodo(final int numero, final int color, final int grado) {
this.numero = numero;
this.color = color;
this.grado = grado;
}
/**
* Crea un nodo a partir de otro nodo. <br>
*
* @param nodo
* Nodo. <br>
*/
public Nodo(final Nodo nodo) {
this(nodo.numero, nodo.color, nodo.grado);
}
/**
* Devuelve el color del nodo. <br>
*
* @return Color del nodo. <br>
*/
public int getColor() {
return color;
}
/**
* Establece el color del nodo. <br>
*
* @param color
* Color. <br>
*/
public void setColor(final int color) {
this.color = color;
}
/**
* Devuelve el número del nodo. <br>
*
* @return Número del nodo. <br>
*/
public int getNumero() {
return numero;
}
/**
* Establece el número del nodo. <br>
*
* @param numero
* Número del nodo. <br>
*/
public void setNumero(final int numero) {
this.numero = numero;
}
/**
* Devuelve el grado del nodo. <br>
*
* @return Grado del nodo. <br>
*/
public int getGrado() {
return grado;
}
/**
* Establece el grado del nodo. <br>
*
* @param grado
* Grado del nodo. <br>
*/
public void setGrado(final int grado) {
this.grado = grado;
}
/**
* Copia los valores de un nodo en otro nodo. <br>
*
* @param nodo
* Nodo. <br>
*/
public void copiarValores(final Nodo nodo) {
numero = nodo.numero;
color = nodo.color;
grado = nodo.grado;
}
/**
* Intercambia un nodo con otro nodo adyacente. <br>
*
* @param ady
* Nodo adyacente. <br>
*/
public void intercambiar(Nodo ady) {
Nodo aux = new Nodo(this);
this.copiarValores(ady);
ady.copiarValores(aux);
}
/**
* Compara el grado de un nodo con su adyacente. <br>
*
* @param ady
* Nodo adyacente. <br>
* @return 1 si el grado del nodo es mayor que el grado del nodo adyacente.
* <br>
* 0 si el grado de los nodos es igual. <br>
* -1 si el grado del nodo es menor que el grado del nodo adyacente.
* <br>
*/
public int compararGrados(final Nodo ady) {
if (this.grado > ady.grado) {
return 1;
}
if (this.grado < ady.grado) {
return -1;
}
return 0;
}
} | [
"scarpello.franco@gmail.com"
] | scarpello.franco@gmail.com |
5b747b475a0a3b1d48551bee7efcd3d81b86a039 | f507569171656aa024cf0abe6d3d3a03b8bd3947 | /src/heapsort/HeapSort2.java | 20f4b42792743e22f0d4a0cc1400e961b97abf17 | [] | no_license | shmilyyuanyue/dailytest2 | 1d9b0d4506a9e5f0a1c0153087f1d2d8bb5cc957 | b9c41f7c1a396b1f0408826cd4abb7c3272704d2 | refs/heads/master | 2023-01-20T04:23:37.950095 | 2020-11-26T08:36:43 | 2020-11-26T08:36:43 | 316,169,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,835 | java | package heapsort;
import java.util.Arrays;
/*
* 堆排序demo
*/
public class HeapSort2
{
public static void main(String []args)
{
int []arr = {1,7,2,9,3,8,6,5,4};
sort(arr);
System.out.println(Arrays.toString(arr));
}
public static void sort(int []arr)
{
//1.构建大顶堆
for(int i=arr.length/2-1;i>=0;i--)
{
//从最后一个一个非叶子结点i从下至上,从右至左调整结构
adjustHeap(arr,i,arr.length);
}
//2.调整堆结构+交换堆顶元素与末尾元素
for(int j=arr.length-1;j>0;j--){
swap(arr,0,j);//将堆顶元素与末尾元素进行交换
adjustHeap(arr,0,j);//重新对堆进行调整
}
}
/*
* 调整大顶堆
*/
public static void adjustHeap(int []arr,int i,int length)
{
//i是父节点
while(2*i+1<length)
{
// k是子节点
int k=i*2+1;
//从i结点的左子结点开始,也就是2i+1处开始,使得k指向i的左右子节点中较大的一个
// 如果不存在右子节点,就不用比较了
if(k+1<length && arr[k]<arr[k+1])
{
//如果左子结点小于右子结点,k指向右子结点
k++;
}
// 比较该较大节点与父节点
if(arr[k] <arr[i])
break;
//如果子节点大于父节点,将子节点和父节点交换
swap(arr,i,k);
// 更新父节点,调整下面的子树
i = k;
}
}
/*
* 交换元素
*/
public static void swap(int []arr,int a ,int b)
{
int temp=arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
}
| [
"854668244@qq.com"
] | 854668244@qq.com |
ff7cf758e066b5f632c2d240f99d2232bd16317f | 8388d3009c0be9cb4e3ea25abbce7a0ad6f9b299 | /business/agriprpall/agriprpall-core/src/main/java/com/sinosoft/agriprpall/core/endorsemanage/specialendorse/service/PlantingEndorChgDetailService.java | 1c1ea2ac65eb145c0db91bd6c0af923e0c9c55f7 | [] | no_license | foxhack/NewAgri2018 | a182bd34d0c583a53c30d825d5e2fa569f605515 | be8ab05e0784c6e7e7f46fea743debb846407e4f | refs/heads/master | 2021-09-24T21:58:18.577979 | 2018-10-15T11:24:21 | 2018-10-15T11:24:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.sinosoft.agriprpall.core.endorsemanage.specialendorse.service;
import com.sinosoft.txnlist.api.plantinginsurancelist.dto.PlantingEndorChgDetailDto;
import com.sinosoft.txnlist.api.plantinginsurancelist.dto.PlantingPolicyListDto;
public interface PlantingEndorChgDetailService {
public void setPlantingEndorChgDetail(PlantingEndorChgDetailDto plantingEndorChgDetail, PlantingPolicyListDto plantingPolicyListOldSchema, PlantingPolicyListDto plantingPolicyListNewSchema) throws Exception;
}
| [
"vicentdk77@users.noreply.github.com"
] | vicentdk77@users.noreply.github.com |
f02a40316e2229a62ff65e481fcfba9326db3fb2 | 4036466e10fa1ec712e92f8f03da63bc2205a5c5 | /src/horzsolt/algorithms/array/CheckDuplicatesInArray.java | 97e148546368f287784b141d25270fb0bbee55f3 | [] | no_license | horzsolt/ranktasks | 85006e17a5e787f2f0daee4f1d562a41a520f8c9 | a8fabf0e216690abfebec84b776a134c6d9c75ee | refs/heads/master | 2021-04-24T20:00:12.367379 | 2018-07-06T13:56:16 | 2018-07-06T13:56:16 | 117,446,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package horzsolt.algorithms.array;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class CheckDuplicatesInArray {
/*
* brute force way of checking if array contains duplicates in Java
* comparing each element to all other elements of array
* complexity on order of O(n^2) not advised in production
*/
public static boolean bruteforce(String[] input) {
for (int i = 0; i < input.length; i++) {
for (int j = 0; j < input.length; j++) {
if (input[i].equals(input[j]) && i != j) {
return true;
}
}
}
return false;
}
/*
* detect duplicate in array by comparing size of List and Set
* since Set doesn't contain duplicate, size must be less for an array which contains duplicates
*/
public static boolean checkDuplicateUsingSet(String[] input) {
List inputList = Arrays.asList(input);
Set inputSet = new HashSet(inputList);
if (inputSet.size() < inputList.size()) return true;
return false;
}
/*
* Since Set doesn't allow duplicates add() return false
* if we try to add duplicates into Set and this property
* can be used to check if array contains duplicates in Java
*/
public static boolean checkDuplicateUsingAdd(String[] input) {
Set tempSet = new HashSet();
for (String str : input) {
if (!tempSet.add(str)) {
return true;
}
}
return false;
}
}
| [
"horzsolt2006@gmail.com"
] | horzsolt2006@gmail.com |
675aa2d51c3a2e8711220908502509ae58bc79ed | 7cd0a30a4393658978f07517eb9c48ffeb543f37 | /src/test/java/test/preserveorder/ChuckTest3.java | 74a9ac3758a311c692c0a2f2db38c6ba59220735 | [
"Apache-2.0"
] | permissive | aosp-caf-upstream/platform_external_testng | bf409569115825ef1160ea4fd78d4cb25727b27a | 232826a29199755858c2c5ea020117b413cfaf6d | refs/heads/pie | 2022-09-29T09:56:31.323500 | 2018-03-13T18:19:26 | 2018-03-13T18:19:26 | 188,864,850 | 0 | 0 | Apache-2.0 | 2022-09-15T03:37:04 | 2019-05-27T15:05:30 | Java | UTF-8 | Java | false | false | 559 | java | package test.preserveorder;
import org.testng.annotations.Test;
public class ChuckTest3 {
@Test(groups = {"functional"}, dependsOnMethods = {"c3TestTwo"})
public void c3TestThree() {
// System.out.println("chucktest3: test three");
}
@Test(groups = {"functional"})
public static void c3TestOne() {
// System.out.println("chucktest3: test one");
}
@Test(groups = {"functional"}, dependsOnMethods = {"c3TestOne"})
public static void c3TestTwo() {
// System.out.println("chucktest3: test two");
}
}
| [
"cedric@beust.com"
] | cedric@beust.com |
d97b9655f9f38d953829e8674efc0c3b4cf57ad3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/29/29_d715962e2a58789b8fb8100e8f80b9770417c3b2/RoundhouseAction/29_d715962e2a58789b8fb8100e8f80b9770417c3b2_RoundhouseAction_s.java | 3d54407a170a91cbb645b8952ffb63ecd53faedd | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,774 | java | /**
* Copyright (c) 2009 Cliffano Subagio
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.plugins.chucknorris;
import hudson.model.Action;
/**
* {@link RoundhouseAction} keeps the style and fact associated with the action.
* For more info, please watch <a
* href="http://www.youtube.com/watch?v=Vb7lnpk3tRY"
* >http://www.youtube.com/watch?v=Vb7lnpk3tRY</a>
* @author cliffano
*/
public final class RoundhouseAction implements Action {
/**
* The style.
*/
private Style mStyle;
/**
* The fact.
*/
private String mFact;
/**
* Constructs a RoundhouseAction with specified style and fact.
* @param style
* the style
* @param fact
* the fact
*/
public RoundhouseAction(final Style style, final String fact) {
super();
this.mStyle = style;
this.mFact = fact;
}
/**
* Gets the action display name.
* @return the display name
*/
public String getDisplayName() {
return "Chuck Norris";
}
/**
* This action doesn't provide any icon file.
* @return null
*/
public String getIconFileName() {
return null;
}
/**
* Gets the URL name for this action.
* @return the URL name
*/
public String getUrlName() {
return "chucknorris";
}
/**
* Gets the Chuck Norris style.
* @return the style
*/
public Style getStyle() {
return mStyle;
}
/**
* Gets the Chuck Norris fact.
* @return the fact
*/
public String getFact() {
return mFact;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b743786b36b8d56a6cd7ce3f30b0d3acb63eb947 | 74bf1f99b72e4c12a2003fb56b8cef73897a649f | /sdi3-12.Cli-SOAP/src/com/sdi/ui/admin/MainMenu.java | 6ee7fa2874a751bf9a4e0e887bc883ba58807a1b | [] | no_license | pabloblancoo/ShareMyTrip-V2 | c98d6be26423ce456544e5c64a46ceb7cbff4b37 | 821010e8a7b99b4ada0a05a05d0ed05ee2fbb486 | refs/heads/master | 2021-04-30T22:43:48.339006 | 2019-03-27T15:14:12 | 2019-03-27T15:14:12 | 53,318,305 | 0 | 0 | null | 2019-03-27T15:14:13 | 2016-03-07T10:53:21 | Java | UTF-8 | Java | false | false | 781 | java | package com.sdi.ui.admin;
import alb.util.menu.BaseMenu;
import com.sdi.ui.admin.action.DeshabilitarUsuarioAction;
import com.sdi.ui.admin.action.EliminarComentariosAction;
import com.sdi.ui.admin.action.ListarComentariosAction;
import com.sdi.ui.admin.action.ListarUsuariosAction;
public class MainMenu extends BaseMenu {
public MainMenu() {
menuOptions = new Object[][] { { "Administrador", null },
{ "Listado de usuarios", ListarUsuariosAction.class },
{ "Deshabilitar un usuario", DeshabilitarUsuarioAction.class },
{ "Listar comentarios y puntuaciones", ListarComentariosAction.class },
{ "Eliminar comentarios y puntuaciones", EliminarComentariosAction.class },
};
}
public static void main(String[] args) {
new MainMenu().execute();
}
}
| [
"santiagomartinagra@gmail.com"
] | santiagomartinagra@gmail.com |
78ed9dae8aa847fca2d93fb2e9c14228790c85c8 | ecae6be320cfd1dfe65b8c01447ecdb1b8e371b8 | /ForceApkObj/bin/ForceApkObj1/smali/android/support/v4/app/FragmentActivity$2.java | fc9fb368e5f46d2f77664c5bdbbe784f78305281 | [] | no_license | pickLXJ/android_jk | 30ec24bf5bae5dadaae60c9733bc5f7ded9443de | 49fc05e3f7557f51a78bca7e042de095c5203d39 | refs/heads/master | 2020-03-31T05:55:40.572757 | 2018-10-07T16:42:25 | 2018-10-07T16:42:25 | 151,962,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,721 | java | package android.support.v4.app; class FragmentActivity$2 { void a() { int a;
a=0;// .class Landroid/support/v4/app/FragmentActivity$2;
a=0;// .super Ljava/lang/Object;
a=0;// .source "FragmentActivity.java"
a=0;//
a=0;// # interfaces
a=0;// .implements Landroid/support/v4/app/FragmentContainer;
a=0;//
a=0;//
a=0;// # annotations
a=0;// .annotation system Ldalvik/annotation/EnclosingClass;
a=0;// value = Landroid/support/v4/app/FragmentActivity;
a=0;// .end annotation
a=0;//
a=0;// .annotation system Ldalvik/annotation/InnerClass;
a=0;// accessFlags = 0x0
a=0;// name = null
a=0;// .end annotation
a=0;//
a=0;//
a=0;// # instance fields
a=0;// .field final synthetic this$0:Landroid/support/v4/app/FragmentActivity;
a=0;//
a=0;//
a=0;// # direct methods
a=0;// .method constructor <init>(Landroid/support/v4/app/FragmentActivity;)V
a=0;// .locals 0
a=0;//
a=0;// .prologue
a=0;// .line 107
a=0;// iput-object p1, p0, Landroid/support/v4/app/FragmentActivity$2;->this$0:Landroid/support/v4/app/FragmentActivity;
a=0;//
a=0;// invoke-direct {p0}, Ljava/lang/Object;-><init>()V
a=0;//
a=0;// return-void
a=0;// .end method
a=0;//
a=0;//
a=0;// # virtual methods
a=0;// .method public findViewById(I)Landroid/view/View;
a=0;// .locals 1
a=0;// .param p1, "id" # I
a=0;//
a=0;// .prologue
a=0;// .line 110
a=0;// iget-object v0, p0, Landroid/support/v4/app/FragmentActivity$2;->this$0:Landroid/support/v4/app/FragmentActivity;
a=0;//
a=0;// invoke-virtual {v0, p1}, Landroid/support/v4/app/FragmentActivity;->findViewById(I)Landroid/view/View;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// return-object v0
a=0;// .end method
}}
| [
"240255473@qq.com"
] | 240255473@qq.com |
46f1e672dd0d03fc7f8cf4d234fd74765a8056c4 | 654074e2c968df9b7fc9c39ae9574f87deacfea3 | /app/src/main/java/net/codersgarage/iseeu/views/CameraViewService.java | ed8b696251656bec90d61ad6d2a5341ef8fe9c9f | [
"Apache-2.0"
] | permissive | GenjiLuo/ISeeU | 6ccdf34d8e01d1af79dae62f28a8ec2256ad2c11 | 6e56e65fb2f2623a47df232f203e45eb15108538 | refs/heads/master | 2020-03-17T16:53:17.875821 | 2016-06-21T19:51:43 | 2016-06-21T19:51:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,947 | java | package net.codersgarage.iseeu.views;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import net.codersgarage.iseeu.utils.Utils;
/**
* Created by s4kib on 6/14/16.
*/
public class CameraViewService extends SurfaceView implements SurfaceHolder.Callback, Camera.PreviewCallback {
private String SCOPE_TAG = getClass().getCanonicalName();
private SurfaceTexture surfaceTexture;
public CameraViewService(Context context) {
super(context);
init();
}
private void init() {
Log.d(SCOPE_TAG + " onInit", "Called");
surfaceTexture = new SurfaceTexture(10);
doOnStart();
}
private void doOnStart() {
try {
MainActivity.camera.setPreviewTexture(surfaceTexture);
MainActivity.camera.setPreviewCallback(this);
MainActivity.camera.startPreview();
} catch (Exception e) {
e.printStackTrace();
}
}
public void doOnStop() {
getHolder().removeCallback(this);
MainActivity.camera.stopPreview();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.d(SCOPE_TAG + " onCreated", "Called");
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.d(SCOPE_TAG + " onChanged", "Called");
doOnStart();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(SCOPE_TAG + " onDestroyed", "Called");
}
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Log.d(SCOPE_TAG + " Byte Received := ", "" + data.length);
data = Utils.frameByteToJpegByte(data, camera);
if (data != null) {
MainActivity.iSeeUClient.send(data);
}
}
}
| [
"s4kibs4mi@gmail.com"
] | s4kibs4mi@gmail.com |
d793b784cde2320b3ccc27f06d69d892e3814d07 | b1956b4077c4acedf437780a4f086abbfdf18542 | /Java/Data.java | 1ee1644a09c9b9be47d1c0149c8e87edb0fc1141 | [] | no_license | charla-n/CoRoT | 4eae748648f0a6d97badc429b3d466455be4f270 | b00d3f5e8564b72b7bfef886326e784921bfdbb8 | refs/heads/master | 2021-01-10T13:38:03.351405 | 2016-02-04T14:21:09 | 2016-02-04T14:21:09 | 50,285,984 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,458 | java | package prog;
public class Data {
private Object ra;
private Object dec;
private Object id;
private Object main_id;
private Object coo_bibcode;
private Object sp_type;
private Object nbref;
public Object getRa() {
return ra;
}
public void setRa(Object ra) {
this.ra = ra;
}
public Object getDec() {
return dec;
}
public void setDec(Object dec) {
this.dec = dec;
}
public Object getId() {
return id;
}
public void setId(Object id) {
this.id = id;
}
public Object getMain_id() {
return main_id;
}
public void setMain_id(Object main_id) {
this.main_id = main_id;
}
public Object getCoo_bibcode() {
return coo_bibcode;
}
public void setCoo_bibcode(Object coo_bibcode) {
this.coo_bibcode = coo_bibcode;
}
public Object getSp_type() {
return sp_type;
}
public void setSp_type(Object sp_type) {
this.sp_type = sp_type;
}
public Object getNbref() {
return nbref;
}
public void setNbref(Object nbref) {
this.nbref = nbref;
}
@Override
public String toString()
{
String csv = "";
try
{
csv += ((Long)ra).toString() + ";";
}
catch (Exception e)
{
csv += ((Double)ra).toString() + ";";
}
try
{
csv += ((Long)dec).toString() + ";";
}
catch (Exception e)
{
csv += ((Double)dec).toString() + ";";
}
csv += (String)id + ";" + (String)main_id + ";" + (String)coo_bibcode + ";" + (String)sp_type + ";" + ((Long)nbref).toString() + "\n";
return csv;
}
}
| [
"nicolas.charlas.au@gmail.com"
] | nicolas.charlas.au@gmail.com |
b4fedc5c0cb402c247d8e19d67ad0a269fcc245a | 719496920f72f308fc1aa1ba18ba4d724d5305f4 | /neptune/src/org/neptune/learning/mina/DemoClient.java | f8fb33d78afdd6d05d8b2a06fa9d78c745603e01 | [] | no_license | zysparrow/bryan-zhang | 33f074213132bd7c931f311d094d9676eef72033 | f67fc85b946d303695fef4d3620c1bab67b8a822 | refs/heads/master | 2021-05-29T13:08:27.682127 | 2013-02-01T06:50:46 | 2013-02-01T06:50:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,655 | java | package org.neptune.learning.mina;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.core.service.IoConnector;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
import org.apache.mina.filter.codec.textline.LineDelimiter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
public class DemoClient {
private static String host = "127.0.0.1";
private static int port = 3005;
public static void main(String[] args){
IoConnector connector = new NioSocketConnector();
connector.setConnectTimeout(30000);
//字符串发送
// connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(
// Charset.forName("UTF-8"),
// LineDelimiter.WINDOWS.getValue(),
// LineDelimiter.WINDOWS.getValue())));
//对象发送
connector.getFilterChain().addLast("codec",
new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
connector.setHandler(new DemoClientHandler());
IoSession session = null;
try{
ConnectFuture future = connector.connect(new InetSocketAddress(host, port));
future.awaitUninterruptibly();
session = future.getSession();
session.write(new Person("peter", 28));
}catch(Throwable t){
t.printStackTrace();
}
session.getCloseFuture().awaitUninterruptibly();
connector.dispose();
}
}
| [
"bryan.zhang.31@c3c2f732-976e-11de-9e98-d1f6c90d23ca"
] | bryan.zhang.31@c3c2f732-976e-11de-9e98-d1f6c90d23ca |
cfb160778d1cfd6ad4aed82c3ba7b586d6fa0d35 | 134d824a3aa8518ce19019669d6bd7d06afddcfc | /src/tech/aistar/day16/thread/JoinDemo.java | 7715e7c9f0205b721c80319ca901fc2ab549f4c9 | [] | no_license | likuisuper/core-java | c6c3debc64725b0313a2e3437467142d2ee7f9c0 | b1c4e494c16dbf234f77459c2a7d26669e549e61 | refs/heads/master | 2023-01-08T08:47:55.560108 | 2020-10-31T08:15:22 | 2020-10-31T08:15:22 | 280,603,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package tech.aistar.day16.thread;
/**
* 本类功能:join方法
* 在线程调用另外一个线程的join方法,会将当前线程挂起,而不是忙等待,直到目标线程结束
*
* @author cxylk
* @date 2020/8/13 19:21
*/
public class JoinDemo {
public static void main(String[] args) {
Thread father=new FatherThread();
father.start();
}
}
//父亲线程
class FatherThread extends Thread{
@Override
public void run() {
//完成的就是父亲线程需要完成的工作
System.out.println("BaBa正在烧饭...");
System.out.println("发现酱油没有了...");
//创建了儿子线程对象
Thread son=new SonThread();
try {
son.start();//必须先让儿子线程启动
son.join();//调用儿子线程join方法
//在一个线程父亲执行的时候,调用了另外一个线程儿子的join方法,
//导致父亲线程进入阻塞等待状态,直到儿子线程执行结束,那么父亲线程才会继续执行
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("BaBa继续做饭");
}
}
//熊孩子线程
class SonThread extends Thread{
@Override
public void run() {
//熊孩子需要完成的工作
for (int i = 5; i >=1 ; i--) {
System.out.println("熊孩子出去打酱油了,还有"+i+"分钟回来了");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("熊孩子酱油打回来了!!!");
}
}
| [
"likuisuper@qq.com"
] | likuisuper@qq.com |
52154daa73837b00e42aea84d9809b74ced6d0c9 | 134fca5b62ca6bac59ba1af5a5ebd271d9b53281 | /build/stx/libjava/tests/mauve/java/src/gnu/testlet/java/lang/Double/parseDouble.java | 2771bd3abd24ae20a8e8fb6f0c371edc02f8e164 | [
"MIT"
] | permissive | GunterMueller/ST_STX_Fork | 3ba5fb5482d9827f32526e3c32a8791c7434bb6b | d891b139f3c016b81feeb5bf749e60585575bff7 | refs/heads/master | 2020-03-28T03:03:46.770962 | 2018-09-06T04:19:31 | 2018-09-06T04:19:31 | 147,616,821 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,781 | java | // Tags: JDK1.2
// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
// Mauve is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
// Mauve is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Mauve; see the file COPYING. If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. */
package gnu.testlet.java.lang.Double;
import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;
/**
* Some checks for the parseDouble() method in the {@link Double} class.
*/
public class parseDouble implements Testlet {
/**
* Runs the test using the specified harness.
*
* @param harness the test harness (<code>null</code> not permitted).
*/
public void test(TestHarness harness) {
testRegular(harness);
testInfinities(harness);
testNaN(harness);
}
/**
* Tests some regular values.
*
* @param harness the test harness.
*/
public void testRegular(TestHarness harness) {
harness.check(Double.parseDouble("1.0"), 1.0);
harness.check(Double.parseDouble("+1.0"), 1.0);
harness.check(Double.parseDouble("-1.0"), -1.0);
harness.check(Double.parseDouble(" 1.0 "), 1.0);
harness.check(Double.parseDouble(" -1.0 "), -1.0);
harness.check(Double.parseDouble("2."), 2.0);
harness.check(Double.parseDouble(".3"), 0.3);
harness.check(Double.parseDouble("1e-9"), 1e-9);
harness.check(Double.parseDouble("1e137"), 1e137);
// test some bad formats
try {
/* double d = */ Double.parseDouble("");
harness.check(false);
} catch (NumberFormatException e) {
harness.check(true);
}
try {
/* double d = */ Double.parseDouble("X");
harness.check(false);
} catch (NumberFormatException e) {
harness.check(true);
}
try {
/* double d = */ Double.parseDouble("e");
harness.check(false);
} catch (NumberFormatException e) {
harness.check(true);
}
try {
/* double d = */ Double.parseDouble("+ 1.0");
harness.check(false);
} catch (NumberFormatException e) {
harness.check(true);
}
try {
/* double d = */ Double.parseDouble("- 1.0");
harness.check(false);
} catch (NumberFormatException e) {
harness.check(true);
}
// null argument should throw NullPointerException
try {
/* double d = */ Double.parseDouble(null);
harness.check(false);
} catch (NullPointerException e) {
harness.check(true);
}
}
/**
* Some checks for values that should parse to Double.POSITIVE_INFINITY
* or Double.NEGATIVE_INFINITY.
*
* @param harness the test harness.
*/
public void testInfinities(TestHarness harness) {
try {
harness.check(Double.parseDouble("Infinity"), Double.POSITIVE_INFINITY);
harness.check(Double.parseDouble("+Infinity"), Double.POSITIVE_INFINITY);
harness.check(Double.parseDouble("-Infinity"), Double.NEGATIVE_INFINITY);
harness.check(Double.parseDouble(" +Infinity "), Double.POSITIVE_INFINITY);
harness.check(Double.parseDouble(" -Infinity "), Double.NEGATIVE_INFINITY);
} catch (Exception e) {
harness.check(false);
harness.debug(e);
}
harness.check(Double.parseDouble("1e1000"), Double.POSITIVE_INFINITY);
harness.check(Double.parseDouble("-1e1000"), Double.NEGATIVE_INFINITY);
}
/**
* Some checks for 'NaN' values.
*
* @param harness the test harness.
*/
public void testNaN(TestHarness harness) {
try {
harness.check(Double.isNaN(Double.parseDouble("NaN")));
harness.check(Double.isNaN(Double.parseDouble("+NaN")));
harness.check(Double.isNaN(Double.parseDouble("-NaN")));
harness.check(Double.isNaN(Double.parseDouble(" +NaN ")));
harness.check(Double.isNaN(Double.parseDouble(" -NaN ")));
} catch (Exception e) {
harness.check(false);
harness.debug(e);
}
}
}
| [
"gunter.mueller@gmail.com"
] | gunter.mueller@gmail.com |
7dc345bafca7ab2e26c101917ca878c6e4a40373 | 7942d0e4f262244c23894f78f44fc1bb5d0c8d3a | /app/src/main/java/com/pccw/nowplayer/link/handler/NowIDLinkHandler.java | 10dfeeaddcea2bdad12e9c5472923f009d303c87 | [] | no_license | zhoumcu/nowtv | 45d5d1dd34d6f2f4719f5f0a69111351a14be05e | 78877fddf9e4af3555c0c20c287814576bf62893 | refs/heads/tablet | 2021-01-09T20:30:19.370392 | 2016-08-17T03:15:06 | 2016-08-17T03:15:06 | 65,776,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package com.pccw.nowplayer.link.handler;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.pccw.nowplayer.activity.mynow.NowIDActivity;
import com.pccw.nowplayer.activity.settings.YourBoxActivity;
import com.pccw.nowplayer.constant.Constants;
/**
* Created by Swifty on 2016/3/15.
*/
public class NowIDLinkHandler extends LinkHandler {
public static String[] getHooks() {
return new String[]{Constants.ACTION_NOW_ID};
}
@Override
public boolean handlerLink(Context context, String link, String link_prefix, String link_suffix, Bundle bundle) {
if (bundle == null) bundle = new Bundle();
Intent intent = new Intent(context, YourBoxActivity.class);
context.startActivity(intent);
return true;
}
}
| [
"1032324589@qq.com"
] | 1032324589@qq.com |
7d230e0a17f6b4487f616c6b029bb16d52c2b02e | 1ae2aa1466d1529de7715ac35cb4446593af11b0 | /uflowertv_api/src/main/java/com/uflowertv/model/po/XxjSpecialList.java | 8bb9503b8108215e2c27a652cf30adf12b45c01e | [] | no_license | soulShadowSQJ/app | cc146c070df6fb5b5d1c3027411a1c8695cad1ea | 4ea70b4bb7b0607554985e8f4e1bb722b34f520b | refs/heads/master | 2020-06-05T01:15:23.133637 | 2017-05-22T13:19:18 | 2017-05-22T13:19:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package com.uflowertv.model.po;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
@Entity
@Table(name="xxj_special_list")
@Data
public class XxjSpecialList implements Serializable{
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = -172954052503640893L;
@Id
@GeneratedValue
private Integer special_id;
private Integer video_id;
private String video_name;
private Integer xued_id;
private Integer grade_id;
private Integer subject_id;
private Integer point_id;
private String point_name;
private Integer term;
private Integer sort;
private String subject_name;
private Integer is_free;
public XxjSpecialList() {}
}
| [
"lgl48128244@126.com"
] | lgl48128244@126.com |
d1e061576c4373a94e048b29545debec20f647a4 | 003a09cf59e472180eddae8d8c64aa74cbd41b04 | /app/src/main/java/com/github/hellocharts/view/PreviewColumnChartView.java | a8ebeee4350a6fe6f78bb56f70fddda1a37ed33f | [] | no_license | colonel1435/CustomView | 1a846b34b0fb4ced17bd33460ac5b445be22010a | 1cd8d56ec555fea97c2953cfaca1cc499d6af775 | refs/heads/master | 2021-01-01T11:56:10.911171 | 2017-12-08T02:35:23 | 2017-12-08T02:35:23 | 78,183,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,414 | java | package com.github.hellocharts.view;
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import com.github.hellocharts.computator.PreviewChartComputator;
import com.github.hellocharts.gesture.PreviewChartTouchHandler;
import com.github.hellocharts.listener.ViewportChangeListener;
import com.github.hellocharts.model.BuildConfig;
import com.github.hellocharts.model.ColumnChartData;
import com.github.hellocharts.renderer.PreviewColumnChartRenderer;
/**
* Preview chart that can be used as overview for other ColumnChart. When you change Viewport of this chart, visible
* area of other chart will change. For that you need also to use
* {@link Chart#setViewportChangeListener(ViewportChangeListener)}
*
* @author Leszek Wach
*/
public class PreviewColumnChartView extends ColumnChartView {
private static final String TAG = "ColumnChartView";
protected PreviewColumnChartRenderer previewChartRenderer;
public PreviewColumnChartView(Context context) {
this(context, null, 0);
}
public PreviewColumnChartView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PreviewColumnChartView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
chartComputator = new PreviewChartComputator();
previewChartRenderer = new PreviewColumnChartRenderer(context, this, this);
touchHandler = new PreviewChartTouchHandler(context, this);
setChartRenderer(previewChartRenderer);
setColumnChartData(ColumnChartData.generateDummyData());
}
public int getPreviewColor() {
return previewChartRenderer.getPreviewColor();
}
public void setPreviewColor(int color) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "Changing preview area color");
}
previewChartRenderer.setPreviewColor(color);
ViewCompat.postInvalidateOnAnimation(this);
}
@Override
public boolean canScrollHorizontally(int direction) {
final int offset = computeHorizontalScrollOffset();
final int range = computeHorizontalScrollRange() - computeHorizontalScrollExtent();
if (range == 0) return false;
if (direction < 0) {
return offset > 0;
} else {
return offset < range - 1;
}
}
}
| [
"fusu1435@163.com"
] | fusu1435@163.com |
cab7a7da9d1485d16d3bbb24a2f0689e0b113469 | 498d01458f3fd7a9a0722eb7c699b9087b26d4f4 | /app/src/main/java/com/proj/limtick/LoginActivity.java | b899b685bedc2e7080f10d829d57c61c16d9fb2d | [] | no_license | Thilina96/LimTick | 9b367ba541745675c60ab6f12a252065e0dfe276 | 250103e682feb8eab49ba6e43a129c160d5c0db3 | refs/heads/master | 2023-01-01T01:43:58.458787 | 2020-10-27T05:06:05 | 2020-10-27T05:06:05 | 261,128,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,038 | java | package com.proj.limtick;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import io.paperdb.Paper;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.proj.limtick.Model.Users;
import com.proj.limtick.prevalent.prevalent;
public class LoginActivity extends AppCompatActivity {
private EditText InputNumber,InputPassword;
private Button LoginButton;
private ProgressDialog loadingBar;
private String parentDbName="Users";
private TextView AdminLink,NotAdminLink;
private CheckBox chkBoxRememberMe;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
LoginButton = (Button) findViewById(R.id.login_btn);
InputNumber = (EditText) findViewById(R.id.login_phone_num);
InputPassword = (EditText) findViewById(R.id.login_password_input);
AdminLink=(TextView)findViewById(R.id.admin_panel_link);
NotAdminLink=(TextView)findViewById(R.id.not_admin_panel_link);
loadingBar= new ProgressDialog(this);
chkBoxRememberMe=(CheckBox) findViewById(R.id.remember_me);
Paper.init(this);
LoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
loginUser();
}
});
AdminLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LoginButton.setText("Login Admin");
AdminLink.setVisibility(View.INVISIBLE);
NotAdminLink.setVisibility(View.VISIBLE);
parentDbName="Admins";
}
});
NotAdminLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LoginButton.setText("Login");
AdminLink.setVisibility(View.VISIBLE);
NotAdminLink.setVisibility(View.INVISIBLE);
parentDbName="Users";
}
});
}
private void loginUser() {
String phone = InputNumber.getText().toString();
String password = InputPassword.getText().toString();
if (TextUtils.isEmpty(phone))
{
Toast.makeText(this, "Please Enter a phone number..", Toast.LENGTH_SHORT).show();
}
else if (TextUtils.isEmpty(password))
{
Toast.makeText(this, "Please Enter the Password..", Toast.LENGTH_SHORT).show();
}
else
{
loadingBar.setTitle("Login Account");
loadingBar.setMessage("Please wait while we are checking the Credentials");
loadingBar.setCanceledOnTouchOutside(false);
loadingBar.show();
AllowAccessToAccount(phone,password);
}
}
private void AllowAccessToAccount(final String phone, final String password) {
if (chkBoxRememberMe.isChecked())
{
Paper.book().write(prevalent.UserPhoneKey,phone);
Paper.book().write(prevalent.UserPasswordKey,password);
}
final DatabaseReference RootRef;
RootRef= FirebaseDatabase.getInstance().getReference();
RootRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.child(parentDbName).child(phone).exists())
{
Users usersData= dataSnapshot.child(parentDbName).child(phone).getValue(Users.class);
if(usersData.getPhone().equals(phone))
{
if(usersData.getPassword().equals(password))
{
if (parentDbName.equals("Admins"))
{
Toast.makeText(LoginActivity.this, "logged in Successfully..", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
Intent intent = new Intent(LoginActivity.this,AdminHomeActivity.class);
startActivity(intent);
}
else if (parentDbName.equals("Users"))
{
Toast.makeText(LoginActivity.this, "logged in Successfully..", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
Intent intent = new Intent(LoginActivity.this,HomeActivity.class);
startActivity(intent);
}
}
else
{
Toast.makeText(LoginActivity.this, "Invalid Password..", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
}
}
else
{
Toast.makeText(LoginActivity.this, "Account with this "+ phone +" number do not exist", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"thilina.wickramasinghe@gmail.com"
] | thilina.wickramasinghe@gmail.com |
0faee58f4e03b934d54bd6353fc39a5ba118094b | 76d7d2cdb6ea914f3e5f4b535fe2e976450ac669 | /app/src/test/java/com/w0yne/nanodegree/myappportfolio/ExampleUnitTest.java | ac00a0923bd4826bff045bee55e5a17dd40b11e2 | [] | no_license | w0yne/MyAppPortfolio | 5b9e3fe88613dd21305b6865f812c81a25f31b73 | 45a51f886350b7b9570e48948ea5ad1f31eba950 | refs/heads/master | 2021-01-11T07:43:45.802779 | 2016-09-22T11:30:06 | 2016-09-22T11:30:06 | 68,914,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | /*
* Created by Stev Wayne on 2016/9/22
* Copyright (c) 2016 Stev Wayne. All rights reserved.
*/
package com.w0yne.nanodegree.myappportfolio;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"wyb7edmajor@gmail.com"
] | wyb7edmajor@gmail.com |
40dd963aabaa788f968ce46651a2fe8050a4a193 | 1011117f8b03cba554ed7e49cf8d6be9421e1955 | /HouseBlueprintMaker/src/net/davidmcginnis/dailyprogrammer/HouseBlueprintMaker/BuildingBlock.java | 2a10a00bb4527a17df3bf11d3c780f08de46ac6e | [] | no_license | davidov541/DailyProgrammerSolutions | ec7864a03e3ac261cb71ed89230ee11181ec4c6b | 12b10889f99a15b9f5bb522b1e547840ccbd56fb | refs/heads/master | 2021-01-10T11:51:36.760310 | 2016-02-07T19:15:00 | 2016-02-07T19:15:00 | 43,583,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package net.davidmcginnis.dailyprogrammer.HouseBlueprintMaker;
import java.util.Random;
public class BuildingBlock extends Block {
private Random _rand = new Random();
private boolean _displayDoor = false;
public boolean getIsOnGroundFloor()
{
return below instanceof EmptyBlock;
}
public BuildingBlock(boolean displayDoor)
{
_displayDoor = displayDoor;
}
@Override
public void Draw(char[][] output, int outputLine, int outputCol) {
// Fill block with door or window.
if(_displayDoor)
{
output[outputLine + 1][outputCol + 1] = '|';
output[outputLine + 1][outputCol + 2] = '|';
}
else if(_rand.nextBoolean())
{
output[outputLine + 1][outputCol + 1] = 'o';
}
}
}
| [
"mcginnda@hotmail.com"
] | mcginnda@hotmail.com |
fec3566e9a24fc4c72652ac78085622afb87dfed | 2fa35eaa9f0485965cdacea091aa5372e6947e4c | /WarehouseDemo/src/main/java/vkudryashov/webserver/service/SQLDialect.java | a2cba77093b69ecd97552c69c66ce920e9b6dbbb | [] | no_license | abelevoleg/backend | f8bff22012b36a6d6347dafe4488697a752f0564 | e582aa5bb0d3a1c763669ce6e71cd82fd8d9267e | refs/heads/master | 2022-12-26T15:46:57.100057 | 2020-10-10T14:36:14 | 2020-10-10T14:36:14 | 288,442,731 | 0 | 0 | null | 2020-10-10T14:36:15 | 2020-08-18T11:57:15 | JavaScript | UTF-8 | Java | false | false | 4,532 | java | package vkudryashov.webserver.service;
import java.sql.Types;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StringType;
public class SQLDialect extends Dialect {
public SQLDialect() {
registerColumnType(Types.BIT, "integer");
registerColumnType(Types.TINYINT, "tinyint");
registerColumnType(Types.SMALLINT, "smallint");
registerColumnType(Types.INTEGER, "integer");
registerColumnType(Types.BIGINT, "bigint");
registerColumnType(Types.FLOAT, "float");
registerColumnType(Types.REAL, "real");
registerColumnType(Types.DOUBLE, "double");
registerColumnType(Types.NUMERIC, "numeric");
registerColumnType(Types.DECIMAL, "decimal");
registerColumnType(Types.CHAR, "char");
registerColumnType(Types.VARCHAR, "varchar");
registerColumnType(Types.LONGVARCHAR, "longvarchar");
registerColumnType(Types.DATE, "date");
registerColumnType(Types.TIME, "time");
registerColumnType(Types.TIMESTAMP, "timestamp");
registerColumnType(Types.BINARY, "blob");
registerColumnType(Types.VARBINARY, "blob");
registerColumnType(Types.LONGVARBINARY, "blob");
// registerColumnType(Types.NULL, "null");
registerColumnType(Types.BLOB, "blob");
registerColumnType(Types.CLOB, "clob");
registerColumnType(Types.BOOLEAN, "integer");
registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", ""));
registerFunction("mod", new SQLFunctionTemplate(StringType.INSTANCE, "?1 % ?2"));
registerFunction("substr", new StandardSQLFunction("substr", StringType.INSTANCE));
registerFunction("substring", new StandardSQLFunction("substr", StringType.INSTANCE));
}
public boolean supportsIdentityColumns() {
return true;
}
public boolean hasDataTypeInIdentityColumn() {
return false; // As specify in NHibernate dialect
}
public String getIdentityColumnString() {
// return "integer primary key autoincrement";
return "integer";
}
public String getIdentitySelectString() {
return "select last_insert_rowid()";
}
public boolean supportsLimit() {
return true;
}
protected String getLimitString(String query, boolean hasOffset) {
return new StringBuffer(query.length() + 20).append(query).append(hasOffset ? " limit ? offset ?" : " limit ?")
.toString();
}
public boolean supportsTemporaryTables() {
return true;
}
public String getCreateTemporaryTableString() {
return "create temporary table if not exists";
}
public boolean dropTemporaryTableAfterUse() {
return false;
}
public boolean supportsCurrentTimestampSelection() {
return true;
}
public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
public String getCurrentTimestampSelectString() {
return "select current_timestamp";
}
public boolean supportsUnionAll() {
return true;
}
public boolean hasAlterTable() {
return false; // As specify in NHibernate dialect
}
public boolean dropConstraints() {
return false;
}
public String getAddColumnString() {
return "add column";
}
public String getForUpdateString() {
return "";
}
public boolean supportsOuterJoinForUpdate() {
return false;
}
public String getDropForeignKeyString() {
throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect");
}
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable,
String[] primaryKey, boolean referencesPrimaryKey) {
throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect");
}
public String getAddPrimaryKeyConstraintString(String constraintName) {
throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect");
}
public boolean supportsIfExistsBeforeTableName() {
return true;
}
public boolean supportsCascadeDelete() {
return false;
}
}
| [
"vakudryashov@inbox.ru"
] | vakudryashov@inbox.ru |
d8453cc61ca372cf38e2c4f8302e60394559f50e | 417b0e3d2628a417047a7a70f28277471d90299f | /src/test/java/com/microsoft/bingads/v11/api/test/entities/account/read/BulkAccountReadFromRowValuesIdTest.java | d3b80aeff4950dfd14e76b65dee242c811bd9fd0 | [
"MIT"
] | permissive | jpatton14/BingAds-Java-SDK | 30e330a5d950bf9def0c211ebc5ec677d8e5fb57 | b928a53db1396b7e9c302d3eba3f3cc5ff7aa9de | refs/heads/master | 2021-07-07T08:28:17.011387 | 2017-10-03T14:44:43 | 2017-10-03T14:44:43 | 105,914,216 | 0 | 0 | null | 2017-10-05T16:33:39 | 2017-10-05T16:33:39 | null | UTF-8 | Java | false | false | 1,189 | java | package com.microsoft.bingads.v11.api.test.entities.account.read;
import com.microsoft.bingads.v11.api.test.entities.account.BulkAccountTest;
import com.microsoft.bingads.v11.bulk.entities.BulkAccount;
import com.microsoft.bingads.internal.functionalinterfaces.Function;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class BulkAccountReadFromRowValuesIdTest extends BulkAccountTest {
@Parameter(value = 1)
public Long expectedResult;
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"123", 123L},
{"9223372036854775807", 9223372036854775807L},
});
}
@Test
public void testRead() {
this.<Long>testReadProperty("Id", this.datum, this.expectedResult, new Function<BulkAccount, Long>() {
@Override
public Long apply(BulkAccount c) {
return c.getId();
}
});
}
}
| [
"baliu@microsoft.com"
] | baliu@microsoft.com |
4309014f6e1e6b0ddb47d77a273ed92461a076ef | 3d3337c6ec06f86b4ae82dcca47977b2fd111c0b | /src/main/java/com/ljheee/chat/model/ChatRoomResponse.java | cea98450ff301aaea623e8d92dfb5801c04e0336 | [] | no_license | ljheee/simple-chat-room | e84bec5d97f0f9920ea49a9e5a53a1e5e7ed9d11 | d8d3bd8f4077d0a379881171451f86f3c0147607 | refs/heads/master | 2020-04-15T01:34:14.346787 | 2019-01-06T06:33:01 | 2019-01-06T06:33:01 | 164,281,857 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 693 | java | package com.ljheee.chat.model;
/**
* Created by lijianhua04 on 2019/1/5.
*/
public class ChatRoomResponse {
private String fromName;//发送人
private String chatValue; // 内容
public ChatRoomResponse() {
}
public ChatRoomResponse(String fromName, String chatValue) {
this.fromName = fromName;
this.chatValue = chatValue;
}
public String getFromName() {
return fromName;
}
public void setFromName(String fromName) {
this.fromName = fromName;
}
public String getChatValue() {
return chatValue;
}
public void setChatValue(String chatValue) {
this.chatValue = chatValue;
}
}
| [
"lijianhua04@meituan.com"
] | lijianhua04@meituan.com |
3ba321c6aa2dd5c3362f69d8bb76c5dd4821d968 | 79c6499bc151b24b099b8d349cbe5f504ba745a8 | /dailycode/src/main/java/com/ggj/java/spring/overrideparam/Person.java | 73c56d29de322987092d9330e10817ceece82e12 | [
"Apache-2.0"
] | permissive | Coldkris/javabase | 545e81687941e240b094f06e284c5dd971daad4d | 96943dabf4e5c544508de606ce2e465582b8cdd4 | refs/heads/master | 2020-03-18T06:18:43.610795 | 2018-02-27T03:34:12 | 2018-02-27T03:34:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,495 | java | package com.ggj.java.spring.overrideparam;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* author:gaoguzangjin
* Description:自定义bean
* Email:335424093@qq.com
* Date 2016/2/19 10:12
*/
@Component
public class Person implements BeanFactoryAware, BeanNameAware,
InitializingBean, DisposableBean,ApplicationContextAware , BeanFactoryPostProcessor {
private String name;
private String address;
private int phone;
private BeanFactory beanFactory;
private String beanName;
public Person() {
System.out.println("【构造器】调用Person的构造器实例化");
}
public String getName() {
return name;
}
public void setName(String name) {
System.out.println("【注入属性】注入属性name");
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
System.out.println("【注入属性】注入属性address");
this.address = address;
}
public int getPhone() {
return phone;
}
public void setPhone(int phone) {
System.out.println("【注入属性】注入属性phone");
this.phone = phone;
}
@Override
public String toString() {
return "Person [address=" + address + ", name=" + name + ", phone="
+ phone + "]";
}
// 这是BeanFactoryAware接口方法
@Override
public void setBeanFactory(BeanFactory arg) throws BeansException {
System.out
.println("【BeanFactoryAware接口】调用BeanFactoryAware.setBeanFactory()");
this.beanFactory = arg;
}
// 这是BeanNameAware接口方法
@Override
public void setBeanName(String arg) {
System.out.println("【BeanNameAware接口】调用BeanNameAware.setBeanName()");
this.beanName = arg;
}
// 这是InitializingBean接口方法
@Override
public void afterPropertiesSet() throws Exception {
System.out
.println("【InitializingBean接口】调用InitializingBean.afterPropertiesSet()");
}
// 这是DiposibleBean接口方法
@Override
public void destroy() throws Exception {
System.out.println("【DiposibleBean接口】调用DiposibleBean.destory()");
}
// 通过<bean>的init-method属性指定的初始化方法
public void myInit() {
System.out.println("【init-method】调用<bean>的init-method属性指定的初始化方法");
}
// 通过<bean>的destroy-method属性指定的初始化方法
public void myDestory() {
System.out.println("【destroy-method】调用<bean>的destroy-method属性指定的初始化方法");
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
System.out.println("ApplicationContextAware");
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
System.out.println("postProcessBeanFactory 3");
}
}
| [
"gaoguangjin@meituan.com"
] | gaoguangjin@meituan.com |
17677620296a9828bc3567d6e5a618b393f8122a | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2006-09-21/seasar2-2.4.0-rc-2/s2-framework/src/main/java/org/seasar/framework/container/IllegalInitMethodAnnotationRuntimeException.java | a3e4fe51ca83182d7459e0ed31a884b3359b88bb | [
"Apache-2.0"
] | permissive | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,632 | java | /*
* Copyright 2004-2006 the Seasar Foundation and the Others.
*
* 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.seasar.framework.container;
import org.seasar.framework.exception.SRuntimeException;
/**
* アノテーションで指定された{@link InitMethodDef initメソッド・インジェクション定義}が不正だった場合にスローされます。
* <p>
* アノテーションで指定されたメソッドが存在しない場合、 複数定義されている場合、 および引数が必要な場合に不正とみなされます。
* </p>
*
* @author higa
* @author belltree (Javadoc)
*
* @see org.seasar.framework.container.factory.ConstantAnnotationHandler
*/
public class IllegalInitMethodAnnotationRuntimeException extends
SRuntimeException {
private static final long serialVersionUID = 0L;
private Class componentClass_;
private String methodName_;
/**
* <code>IllegalInitMethodAnnotationRuntimeException</code>を構築します。
*
* @param componentClass
* アノテーションが指定されたクラス
* @param methodName
* アノテーションで指定されたメソッド名
*/
public IllegalInitMethodAnnotationRuntimeException(Class componentClass,
String methodName) {
super("ESSR0081", new Object[] { componentClass.getName(), methodName });
componentClass_ = componentClass;
methodName_ = methodName;
}
/**
* 例外の原因となったアノテーションが指定されたクラスを返します。
*
* @return アノテーションが指定されたクラス
*/
public Class getComponentClass() {
return componentClass_;
}
/**
* 例外の原因となったアノテーションで指定されたメソッド名を返します。
*
* @return アノテーションで指定されたメソッド名
*/
public String getMethodName() {
return methodName_;
}
} | [
"higa@319488c0-e101-0410-93bc-b5e51f62721a"
] | higa@319488c0-e101-0410-93bc-b5e51f62721a |
f8976d89cefaf16ce314529fed407c9062bf7fd7 | ee6c8834c5a6be2928002d172354d86b665ab5bc | /javaReptile/src/main/java/javaSocket/Demo1/ClientInstance.java | b13a9f39b90ca566c9274ab92135a22f1b8d59ee | [] | no_license | congjinfeng/LearningMaterials | 47909ec749c228db1729a166912ebdeee7381967 | 13c8a2bf592087de74dd7d7a522183cb615104a0 | refs/heads/master | 2021-06-19T04:50:17.047498 | 2019-10-24T06:34:55 | 2019-10-24T06:44:06 | 217,221,455 | 0 | 0 | null | 2021-06-04T02:15:31 | 2019-10-24T05:52:46 | Java | UTF-8 | Java | false | false | 1,987 | java | package javaSocket.Demo1;
import java.io.*;
import java.net.*;
import java.util.Scanner;
/**
* @author cong
* @ClassName: ClientInstance
* @Descrip:
* @since 2019/8/30 14:01
*/
public class ClientInstance {
public static void main(String [] args)
{
int port = 7000;
String host = "localhost";
// 创建一个套接字并将其连接到指定端口号
Socket socket = null;
try {
socket = new Socket(host, port);
DataInputStream dis = new DataInputStream(
new BufferedInputStream(socket.getInputStream()));
DataOutputStream dos = new DataOutputStream(
new BufferedOutputStream(socket.getOutputStream()));
Scanner sc = new Scanner(System.in);
boolean flag = false;
while (!flag) {
System.out.println("请输入正方形的边长:");
double length = sc.nextDouble();
dos.writeDouble(length);
dos.flush();
double area = dis.readDouble();
System.out.println("服务器返回的计算面积为:" + area);
while (true) {
System.out.println("继续计算?(Y/N)");
String str = sc.next();
if (str.equalsIgnoreCase("N")) {
dos.writeInt(0);
dos.flush();
flag = true;
break;
} else if (str.equalsIgnoreCase("Y")) {
dos.writeInt(1);
dos.flush();
break;
}
}
}
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| [
"605080158@qq.com"
] | 605080158@qq.com |
9fdb721ed3f2a31c63b923f2a26d1a5a63b42fbf | 7b169eea64413ac90d49b7d6409b4c3e519b2c63 | /dubbo-provider/src/main/java/com/xuzhe/entity/UserEntity.java | da0d0a872fcbc5d588f85a8656f5c256147022b7 | [
"Apache-2.0"
] | permissive | yoursNicholas/springbootdubbo | 7a5f87d96db91dabeef401050e70456cf7616105 | b5fea83464d36608a86009316008440cc23bbf8e | refs/heads/master | 2020-03-28T10:37:47.711759 | 2018-09-10T11:39:14 | 2018-09-10T11:39:14 | 148,128,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package com.xuzhe.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
@Data
@Entity
@Table(name = "t_user")
public class UserEntity extends BaseEntity implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "t_id")
private Long id;
@Column(name = "t_name")
private String name;
@Column(name = "t_age")
private int age;
@Column(name = "t_address")
private String address;
} | [
"805922710@qq.com"
] | 805922710@qq.com |
0527c8edf843a4ce9dff6e749ea28d0c94d5d2a6 | b403dbae8dee5e94bc17d49fd83566a92d62b1f1 | /app/src/main/java/cl/com/ripley/ripleyshop/home/interactor/SKU.java | e72c04eed142069831cce9d5d217aa76227cad46 | [] | no_license | Manuel28G/RipleyShop | 604f9a17f786e01525d14be811d991b872d9121e | 69d10f93bf096a8de9954b14128ecf7306b66a8e | refs/heads/develop | 2020-07-21T23:08:50.806686 | 2019-09-12T08:03:30 | 2019-09-12T08:03:30 | 206,994,705 | 0 | 0 | null | 2019-09-12T07:32:13 | 2019-09-07T16:23:49 | Java | UTF-8 | Java | false | false | 814 | java | package cl.com.ripley.ripleyshop.home.interactor;
import android.content.Context;
import cl.com.ripley.ripleyshop.general.model.GeneralInteractor;
import cl.com.ripley.ripleyshop.general.model.UtilHelper;
import cl.com.ripley.ripleyshop.home.presenter.Home;
import static cl.com.ripley.ripleyshop.general.model.Constants.FILE_SKU;
public class SKU implements GeneralInteractor {
private Context mCtx;
private Home.Presenter mPresenter;
public static final String TAG = SKU.class.toString();
public SKU(Context ctx, Home.Presenter presenter){
mCtx = ctx;
mPresenter = presenter;
}
@Override
public void run(){
String response = UtilHelper.readFile(mCtx, FILE_SKU);
if(response != null){
mPresenter.addSKUS(response);
}
}
}
| [
"man281192@gmail.com"
] | man281192@gmail.com |
09e493054bed8101133773786d8d54f3868a726f | a828e4ba030bd59fb3ac90d88b699c1a28754822 | /jobcoming/src/main/java/com/job/controller/UserAjaxController.java | 35c70b2279976a66af98461b37831854ed147c10 | [] | no_license | vokie123456/JobComing_v2 | 4ea51d5bd5aacc67d0723f08f9616e4ed77bc9f8 | c51b22c7efe9e5b2c439248bbe5bd52ee7599682 | refs/heads/master | 2020-05-28T10:00:45.210918 | 2016-12-24T15:55:19 | 2016-12-24T15:55:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,328 | java | package com.job.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.job.bean.User;
import com.job.service.RegisterService;
@Controller
@RequestMapping("/UserAjax")
public class UserAjaxController {
@Autowired
private RegisterService rs;
/**
* 验证用户是否重名
* @param userName
* @return
*/
@ResponseBody
@RequestMapping("/userIsExist")
public String userIsExist(@RequestParam("username")String userName){
User user=rs.getUserByName(userName);
if(user!=null){
return "the name is exist";
}
return null;
}
/**
* 验证邮箱是否存在
* @param email
* @return
*/
@ResponseBody
@RequestMapping("/emailIsExist")
public String emailIsExit(@RequestParam("email") String email){
User user=rs.getUserByEmail(email);
if(user!=null){
return "the email is exist";
}
return null;
}
@ResponseBody
@RequestMapping("/phoneIsExist")
public String phoneIsExist(@RequestParam("phone") long phone){
User user=rs.getUserByPhone(phone);
if(user!=null){
return "the phone is exist";
}
return null;
}
}
| [
"8508355@qq.com"
] | 8508355@qq.com |
2a7160aadeb74b4e014cbc0ddb559b4161c7e965 | 53fdbef31efce91dcc33784f8ce287eea3c7a9c1 | /app/src/main/java/com/example/clinicappproject/Contract.java | f2600ca9c87dc8fa5b85c9a5e58ffd4e9d3ec803 | [] | no_license | garychen2002/ClinicAppProject | 44c63be66d16ddafce4798362314d13bb3d17c52 | f1bcd573871c830ca1b4798969bf8f0ca8b45b2d | refs/heads/master | 2023-08-23T05:50:45.652202 | 2021-09-22T15:16:28 | 2021-09-22T15:16:28 | 389,779,885 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package com.example.clinicappproject;
import android.app.Activity;
public interface Contract {
public interface Model {
public void patientLogin(LoginListener callback, String username, String password);
public void doctorLogin(LoginListener callback, String username, String password);
}
public interface LoginView {
public String getUsername();
public String getPassword();
public void onLoginSuccess(User user);
public void onLoginFailure();
}
public interface Presenter {
public void checkPatientCredentials();
public void checkDoctorCredentials();
}
public interface LoginListener {
public void onSuccess(User user); // callback to view's onloginsuccess
public void onFailure();
}
}
| [
"realgarychen@gmail.com"
] | realgarychen@gmail.com |
b1c91bc7af0dd1f375c39fc3b1465af972c6b251 | b616105723226f52c8d34f3bfdb2b56b1c6ff6ed | /besu/src/main/java/org/tpc/protocol/besu/response/privacy/PrivGetPrivateTransaction.java | f8f98a7a8675745df20250e2baf16c9175790c18 | [] | no_license | tpchain/java-tpch-sdk | 101ed2419e6901a102df6fbf4327ed7c80f57948 | 174e711d5cfbcda5a7f9dc0758b3e4a92c0382b6 | refs/heads/master | 2022-12-23T12:08:28.999045 | 2020-09-28T01:16:50 | 2020-09-28T01:16:50 | 287,171,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | /*
* Copyright 2019 Web3 Labs Ltd.
*
* 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.tpc.protocol.besu.response.privacy;
import java.util.Optional;
import org.tpc.protocol.core.Response;
public class PrivGetPrivateTransaction extends Response<PrivateTransaction> {
public Optional<PrivateTransaction> getPrivateTransaction() {
return Optional.ofNullable(getResult());
}
}
| [
"slightingery@163.COM"
] | slightingery@163.COM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.