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
ceddece0c4069cdeb507bf94e6932c7e904abea4
db956180409f6e66bc2e169e42bbe05f2cbe9a12
/allbase/src/main/java/com/dixon/allbase/fun/SelectChangeManagerVForce.java
9f471ebeaefc51e7e00779667690cd7f8b704081
[]
no_license
zhxyComing/Note
76e8dd87291aac425c60be5a3a6218fae225b956
fb0f5f163b49358575583df83ea5c51fac0f3f33
refs/heads/master
2022-11-28T12:33:49.329217
2020-08-06T09:06:09
2020-08-06T09:06:09
282,204,702
0
0
null
null
null
null
UTF-8
Java
false
false
1,066
java
package com.dixon.allbase.fun; import java.util.HashMap; import java.util.Map; /** * 提供类似RadioButton的功能:选中一个,其他全部取消 * <p> * 强制引用版本 需要自行回收 * 主要为了适配put(xxx,new xxx)局部变量被回收的情况 * * @param <T> */ public abstract class SelectChangeManagerVForce<T> { private Map<String, T> map = new HashMap<>(); public void put(String tag, T obj) { map.put(tag, obj); } public void setSelected(String tag) { for (String key : map.keySet()) { T obj = map.get(key); if (obj != null) { if (key.equals(tag)) { selected(key, obj); } else { clearSelected(key, obj); } } } } protected abstract void selected(String tag, T obj); protected abstract void clearSelected(String tag, T obj); public void clear() { map.clear(); } public void remove(String tag) { map.remove(tag); } }
[ "xuzheng@luojilab.com" ]
xuzheng@luojilab.com
ce871764fb3084eea1c04d91f47f6a2daf46a8a1
7400e51f169ccf1bccf805d1e64ce5bead2f45bd
/app/src/main/java/fandradetecinfo/com/meupeso/dummy/DummyContent.java
2746b9947b42a43659fdba80057b4f192ed162c5
[]
no_license
NandoRunner/MeuPeso
6d301fd8d85aa79764b31bf58819b9ca7d22fc8b
600484cf1f4919d651720f2259ee713713ba2980
refs/heads/master
2021-06-20T17:03:24.945665
2020-11-25T22:33:52
2020-11-25T22:33:52
92,437,426
0
0
null
null
null
null
UTF-8
Java
false
false
1,942
java
package fandradetecinfo.com.meupeso.dummy; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Helper class for providing sample content for user interfaces created by * Android template wizards. * <p> * Replace all uses of this class before publishing your app. */ public class DummyContent { /** * An array of sample (dummy) items. */ public static final List<DummyItem> ITEMS = new ArrayList<DummyItem>(); /** * A map of sample (dummy) items, by ID. */ public static final Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>(); private static final int COUNT = 25; static { // Add some sample items. for (int i = 1; i <= COUNT; i++) { addItem(createDummyItem(i)); } } private static void addItem(DummyItem item) { ITEMS.add(item); ITEM_MAP.put(item.id, item); } private static DummyItem createDummyItem(int position) { return new DummyItem(String.valueOf(position), "Item " + position, makeDetails(position)); } private static String makeDetails(int position) { StringBuilder builder = new StringBuilder(); builder.append("Details about Item: ").append(position); for (int i = 0; i < position; i++) { builder.append("\nMore details information here."); } return builder.toString(); } /** * A dummy item representing a piece of content. */ public static class DummyItem { public final String id; public final String content; public final String details; public DummyItem(String id, String content, String details) { this.id = id; this.content = content; this.details = details; } @Override public String toString() { return content; } } }
[ "nando.az@gmail.com" ]
nando.az@gmail.com
65d425f3c0ef467667fbc102f6533bdb0a2ab264
73be5349b4d35dcf75b4d5f97d94cd76bfc043fd
/vap-study/src/main/java/jdk/proxy/ProxyTest.java
d2e220a10548d1a805592841f757ae95114f1776
[]
no_license
VanadisGithub/vaps
da03de95368e29060df28e5ada0904f29446aa2b
956eeca3d50eba4ece4f241e8358452bdb372dc5
refs/heads/master
2023-03-06T11:51:02.493885
2021-08-10T11:58:02
2021-08-10T11:58:02
177,907,688
0
0
null
null
null
null
UTF-8
Java
false
false
1,573
java
package jdk.proxy; import java.lang.reflect.Proxy; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodInterceptor; /** * ProxyTest * * @author yaoyuan * @date 2021/1/15 3:18 下午 */ public class ProxyTest { /** * https://www.jianshu.com/p/46d092bb737d * * 在Spring的AOP编程中: * 如果加入容器的目标对象有实现接口,用JDK代理 * 如果目标对象没有实现接口,用Cglib代理 * * @param args */ public static void main(String[] args) { proxy(); cglib(); } /** * 动态代理 */ private static void proxy() { Say person = new Person(); Say say = (Say)Proxy.newProxyInstance( person.getClass().getClassLoader(), person.getClass().getInterfaces(), (proxy, method, args1) -> { System.out.print("Person替你说:"); return method.invoke(person, args1); }); say.sayHello(); } private static void cglib() { Person2 person = new Person2(); //1.工具类 Enhancer en = new Enhancer(); //2.设置父类 en.setSuperclass(person.getClass()); //3.设置回调函数 en.setCallback((MethodInterceptor)(obj, method, args, methodProxy) -> { System.out.print("Person2替你说:"); return methodProxy.invokeSuper(obj, args); }); //4.创建子类(代理对象) Person2 say = (Person2)en.create(); say.sayHello(); } }
[ "yy287502@alibaba-inc.com" ]
yy287502@alibaba-inc.com
097c8e9cebab240c25fabd5e1d6f02d3ff7d5bc2
f6b3d03f3cd8288271564996e541fc08624f5c8a
/src/lesson5/lab5/prob3/Circle.java
8379791a4102a04252635e857b7c61b0c4c13677
[]
no_license
dle79/ModernJavaProgramming
68d94908d79078b11f10883d113d26d63a61d263
08a3b6f73025a8f66bbec350b73aee5fda663363
refs/heads/master
2021-01-22T11:41:30.377304
2015-08-13T19:51:24
2015-08-13T19:51:24
39,470,444
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package lesson5.lab5.prob3; final public class Circle implements Shape { private double radius; public Circle(double radius){ this.radius = radius; } public double getRadius(){ return radius; } public double computeArea(){ return Math.PI*radius*radius; } }
[ "nguyenngockhuong@gmail.com" ]
nguyenngockhuong@gmail.com
155ce02a291d542419edffce371d477be6b08178
a444b68b3bf7b4be32919afa17fcdd8e267629d9
/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationListenerService.java
7af900907e08ded0f78f562b2b4f54711a6aaac5
[ "MIT" ]
permissive
citiesocial/react-native-push-notification
16eb113cfc0d4edfacd9543cb1a4d5dc0eb2f0e1
b81e99dd399f134e69b6900c1e55fcba80c7be89
refs/heads/master
2020-05-25T04:14:13.888832
2019-05-21T03:05:06
2019-05-21T03:05:06
187,622,301
0
0
null
null
null
null
UTF-8
Java
false
false
7,592
java
package com.dieam.reactnativepushnotification.modules; import java.util.Map; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; import android.app.ActivityManager; import android.app.ActivityManager.RunningAppProcessInfo; import android.app.Application; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.support.v4.app.JobIntentService; import android.util.Log; import com.dieam.reactnativepushnotification.helpers.ApplicationBadgeHelper; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContext; import org.json.JSONObject; import java.util.List; import java.util.Random; import com.quantumgraph.sdk.QG; import com.quantumgraph.sdk.NotificationJobIntentService; import static com.dieam.reactnativepushnotification.modules.RNPushNotification.LOG_TAG; public class RNPushNotificationListenerService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage message) { String from = message.getFrom(); Map dataMap = message.getData(); if (dataMap.containsKey("message") && QG.isQGMessage(dataMap.get("message").toString())) { Bundle qgData = new Bundle(); qgData.putString("message", dataMap.get("message").toString()); Context context = getApplicationContext(); if (from == null || context == null) { return; } Intent intent = new Intent(context, NotificationJobIntentService.class); intent.setAction("QG"); intent.putExtras(qgData); JobIntentService.enqueueWork(context, NotificationJobIntentService.class, 1000, intent); return; } RemoteMessage.Notification remoteNotification = message.getNotification(); final Bundle bundle = new Bundle(); // Putting it from remoteNotification first so it can be overriden if message // data has it if (remoteNotification != null) { // ^ It's null when message is from GCM bundle.putString("title", remoteNotification.getTitle()); bundle.putString("message", remoteNotification.getBody()); } for(Map.Entry<String, String> entry : message.getData().entrySet()) { bundle.putString(entry.getKey(), entry.getValue()); } JSONObject data = getPushData(bundle.getString("data")); // Copy `twi_body` to `message` to support Twilio if (bundle.containsKey("twi_body")) { bundle.putString("message", bundle.getString("twi_body")); } if (data != null) { if (!bundle.containsKey("message")) { bundle.putString("message", data.optString("alert", null)); } if (!bundle.containsKey("title")) { bundle.putString("title", data.optString("title", null)); } if (!bundle.containsKey("sound")) { bundle.putString("soundName", data.optString("sound", null)); } if (!bundle.containsKey("color")) { bundle.putString("color", data.optString("color", null)); } final int badge = data.optInt("badge", -1); if (badge >= 0) { ApplicationBadgeHelper.INSTANCE.setApplicationIconBadgeNumber(this, badge); } } Log.v(LOG_TAG, "onMessageReceived: " + bundle); // We need to run this on the main thread, as the React code assumes that is true. // Namely, DevServerHelper constructs a Handler() without a Looper, which triggers: // "Can't create handler inside thread that has not called Looper.prepare()" Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { public void run() { // Construct and load our normal React JS code bundle ReactInstanceManager mReactInstanceManager = ((ReactApplication) getApplication()).getReactNativeHost().getReactInstanceManager(); ReactContext context = mReactInstanceManager.getCurrentReactContext(); // If it's constructed, send a notification if (context != null) { handleRemotePushNotification((ReactApplicationContext) context, bundle); } else { // Otherwise wait for construction, then send the notification mReactInstanceManager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() { public void onReactContextInitialized(ReactContext context) { handleRemotePushNotification((ReactApplicationContext) context, bundle); } }); if (!mReactInstanceManager.hasStartedCreatingInitialContext()) { // Construct it in the background mReactInstanceManager.createReactContextInBackground(); } } } }); } private JSONObject getPushData(String dataString) { try { return new JSONObject(dataString); } catch (Exception e) { return null; } } private void handleRemotePushNotification(ReactApplicationContext context, Bundle bundle) { // If notification ID is not provided by the user for push notification, generate one at random if (bundle.getString("id") == null) { Random randomNumberGenerator = new Random(System.currentTimeMillis()); bundle.putString("id", String.valueOf(randomNumberGenerator.nextInt())); } Boolean isForeground = isApplicationInForeground(); RNPushNotificationJsDelivery jsDelivery = new RNPushNotificationJsDelivery(context); bundle.putBoolean("foreground", isForeground); bundle.putBoolean("userInteraction", false); jsDelivery.notifyNotification(bundle); // If contentAvailable is set to true, then send out a remote fetch event if (bundle.getString("contentAvailable", "false").equalsIgnoreCase("true")) { jsDelivery.notifyRemoteFetch(bundle); } Log.v(LOG_TAG, "sendNotification: " + bundle); Application applicationContext = (Application) context.getApplicationContext(); RNPushNotificationHelper pushNotificationHelper = new RNPushNotificationHelper(applicationContext); pushNotificationHelper.sendToNotificationCentre(bundle); } private boolean isApplicationInForeground() { ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); List<RunningAppProcessInfo> processInfos = activityManager.getRunningAppProcesses(); if (processInfos != null) { for (RunningAppProcessInfo processInfo : processInfos) { if (processInfo.processName.equals(getApplication().getPackageName())) { if (processInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { for (String d : processInfo.pkgList) { return true; } } } } } return false; } }
[ "dteout@gmail.com" ]
dteout@gmail.com
e750bd92df0ec83d93a5ef550949cd057d165c12
467ead96f5ed745cc91758bd882e5605745e5055
/src/in/co/madhur/observer/CurrentConditionsDisplay.java
ce44a18fe8652c48838a6914b2753c0a16205be0
[]
no_license
madhur/designpatterns-java
52901003eb114c60e26e4f8bf3975ff9a5147378
b268b5e13ce22f377c73b4f1d3c22b1b60dec9f0
refs/heads/master
2021-09-26T17:49:50.170983
2017-11-02T16:56:09
2017-11-02T16:56:09
109,248,554
1
0
null
null
null
null
UTF-8
Java
false
false
713
java
package in.co.madhur.observer; public class CurrentConditionsDisplay implements Observer, DisplayElement { private float temperature; private float humidity; private Subject weatherData; public CurrentConditionsDisplay(Subject weatherData) { this.weatherData = weatherData; weatherData.registerObserver(this); } @Override public void update(float temperature, float humidity, float pressure) { this.temperature = temperature; this.humidity = humidity; display(); } public void display() { System.out.println("Current conditions: " + temperature + "F degrees and " + humidity + "% humidity"); } }
[ "ahuja.madhur@gmail.com" ]
ahuja.madhur@gmail.com
658454063cad9a33218763d087a2ebdb6afde638
2fdffe7e079fdd418a57592c0b313d24df7e2075
/src/main/java/com/lwam/lwam/entity/Address.java
9c5ab0c65b0397e09edfe80d3fb7f0da5539bc0a
[]
no_license
Asbhatu/BackendApp
a544987267069fcbbed373fa3ec173c0a7b46d36
05be22e58f3830adfd6e9376dfdc8c87bb80cfd5
refs/heads/master
2020-04-02T03:05:50.827075
2018-12-15T23:27:57
2018-12-15T23:27:57
153,946,028
0
0
null
null
null
null
UTF-8
Java
false
false
2,547
java
package com.lwam.lwam.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name = "address") public class Address { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "address_id") private long addressId; @Column(name = "zoba") private String zoba; @Column(name = "sub_zoba") private String subZoba; @Column(name = "mimihidar") private String mimihidar; @Column(name = "village_address") private String villageAddress; @Enumerated(EnumType.STRING) @Column(length = 10) private AddressType addressType; @ManyToOne @JoinColumn(name = "user_profile_id") private UserProfile userProfile; public Address() { } public Address(String zoba, String subZoba, String mimihidar, String villageAddress, AddressType addressType) { this.subZoba = subZoba; this.mimihidar = mimihidar; this.villageAddress = villageAddress; this.addressType = addressType; } public UserProfile getUserProfile() { return userProfile; } public void setUserProfile(UserProfile userProfile) { this.userProfile = userProfile; } public long getAddressId() { return addressId; } public void setAddressId(long addressId) { this.addressId = addressId; } public String getZoba() { return zoba; } public void setZoba(String zoba) { this.zoba = zoba; } public String getSubZoba() { return subZoba; } public void setSubZoba(String subZoba) { this.subZoba = subZoba; } public String getMimihidar() { return mimihidar; } public void setMimihidar(String mimihidar) { this.mimihidar = mimihidar; } public String getVillageAddress() { return villageAddress; } public void setVillageAddress(String villageAddress) { this.villageAddress = villageAddress; } public AddressType getAddressType() { return addressType; } public void setAddressType(AddressType addressType) { this.addressType = addressType; } @Override public String toString() { return String.format("Address[addressId=%d, zoba='%s, subZoba='%s', mimihidar='%s'," + "villageAddress='%s', addressType='%s ]", addressId, zoba, subZoba, mimihidar, villageAddress, addressType.toString()); } }
[ "awetpeter@gmail.com" ]
awetpeter@gmail.com
d5012e9ea568061ac2d36e3a60e801d89e47362e
a778a2aa9c20f0a15d38a10cc6acab168aa6dab0
/gateway/src/test/java/presencia/digital/web/rest/UserResourceIntTest.java
d84d141a4f1e312691ddf6165b0636a037f97108
[]
no_license
Rubentxu/PresenciaShop
cb0b0441e75277e366b5ba0d8d2791548c05c401
5cf70786eb0d0b93cb3587ca37c3dfbfd097d58f
refs/heads/master
2021-07-19T05:47:15.726171
2017-10-22T16:52:45
2017-10-22T16:52:45
107,877,380
0
0
null
null
null
null
UTF-8
Java
false
false
24,062
java
package presencia.digital.web.rest; import presencia.digital.GatewayApp; import presencia.digital.domain.Authority; import presencia.digital.domain.User; import presencia.digital.repository.UserRepository; import presencia.digital.security.AuthoritiesConstants; import presencia.digital.service.MailService; import presencia.digital.service.UserService; import presencia.digital.service.dto.UserDTO; import presencia.digital.service.mapper.UserMapper; import presencia.digital.web.rest.errors.ExceptionTranslator; import presencia.digital.web.rest.vm.ManagedUserVM; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import java.time.Instant; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the UserResource REST controller. * * @see UserResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = GatewayApp.class) public class UserResourceIntTest { private static final String DEFAULT_ID = "id1"; private static final String DEFAULT_LOGIN = "johndoe"; private static final String UPDATED_LOGIN = "jhipster"; private static final String DEFAULT_PASSWORD = "passjohndoe"; private static final String UPDATED_PASSWORD = "passjhipster"; private static final String DEFAULT_EMAIL = "johndoe@localhost"; private static final String UPDATED_EMAIL = "jhipster@localhost"; private static final String DEFAULT_FIRSTNAME = "john"; private static final String UPDATED_FIRSTNAME = "jhipsterFirstName"; private static final String DEFAULT_LASTNAME = "doe"; private static final String UPDATED_LASTNAME = "jhipsterLastName"; private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40"; private static final String DEFAULT_LANGKEY = "en"; private static final String UPDATED_LANGKEY = "fr"; @Autowired private UserRepository userRepository; @Autowired private MailService mailService; @Autowired private UserService userService; @Autowired private UserMapper userMapper; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; private MockMvc restUserMockMvc; private User user; @Before public void setup() { MockitoAnnotations.initMocks(this); UserResource userResource = new UserResource(userRepository, mailService, userService); this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setMessageConverters(jacksonMessageConverter) .build(); } /** * Create a User. * * This is a static method, as tests for other entities might also need it, * if they test an entity which has a required relationship to the User entity. */ public static User createEntity() { User user = new User(); user.setLogin(DEFAULT_LOGIN); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); user.setEmail(DEFAULT_EMAIL); user.setFirstName(DEFAULT_FIRSTNAME); user.setLastName(DEFAULT_LASTNAME); user.setImageUrl(DEFAULT_IMAGEURL); user.setLangKey(DEFAULT_LANGKEY); return user; } @Before public void initTest() { userRepository.deleteAll(); user = createEntity(); } @Test public void createUser() throws Exception { int databaseSizeBeforeCreate = userRepository.findAll().size(); // Create the User Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( null, DEFAULT_LOGIN, DEFAULT_PASSWORD, DEFAULT_FIRSTNAME, DEFAULT_LASTNAME, DEFAULT_EMAIL, true, DEFAULT_IMAGEURL, DEFAULT_LANGKEY, null, null, null, null, authorities); restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isCreated()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate + 1); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); } @Test public void createUserWithExistingId() throws Exception { int databaseSizeBeforeCreate = userRepository.findAll().size(); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( "1L", DEFAULT_LOGIN, DEFAULT_PASSWORD, DEFAULT_FIRSTNAME, DEFAULT_LASTNAME, DEFAULT_EMAIL, true, DEFAULT_IMAGEURL, DEFAULT_LANGKEY, null, null, null, null, authorities); // An entity with an existing ID cannot be created, so this API call must fail restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test public void createUserWithExistingLogin() throws Exception { // Initialize the database userRepository.save(user); int databaseSizeBeforeCreate = userRepository.findAll().size(); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( null, DEFAULT_LOGIN, // this login should already be used DEFAULT_PASSWORD, DEFAULT_FIRSTNAME, DEFAULT_LASTNAME, "anothermail@localhost", true, DEFAULT_IMAGEURL, DEFAULT_LANGKEY, null, null, null, null, authorities); // Create the User restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test public void createUserWithExistingEmail() throws Exception { // Initialize the database userRepository.save(user); int databaseSizeBeforeCreate = userRepository.findAll().size(); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( null, "anotherlogin", DEFAULT_PASSWORD, DEFAULT_FIRSTNAME, DEFAULT_LASTNAME, DEFAULT_EMAIL, // this email should already be used true, DEFAULT_IMAGEURL, DEFAULT_LANGKEY, null, null, null, null, authorities); // Create the User restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test public void getAllUsers() throws Exception { // Initialize the database userRepository.save(user); // Get all the users restUserMockMvc.perform(get("/api/users") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); } @Test public void getUser() throws Exception { // Initialize the database userRepository.save(user); // Get the user restUserMockMvc.perform(get("/api/users/{login}", user.getLogin())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.login").value(user.getLogin())) .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) .andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY)); } @Test public void getNonExistingUser() throws Exception { restUserMockMvc.perform(get("/api/users/unknown")) .andExpect(status().isNotFound()); } @Test public void updateUser() throws Exception { // Initialize the database userRepository.save(user); int databaseSizeBeforeUpdate = userRepository.findAll().size(); // Update the user User updatedUser = userRepository.findOne(user.getId()); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( updatedUser.getId(), updatedUser.getLogin(), UPDATED_PASSWORD, UPDATED_FIRSTNAME, UPDATED_LASTNAME, UPDATED_EMAIL, updatedUser.getActivated(), UPDATED_IMAGEURL, UPDATED_LANGKEY, updatedUser.getCreatedBy(), updatedUser.getCreatedDate(), updatedUser.getLastModifiedBy(), updatedUser.getLastModifiedDate(), authorities); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isOk()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeUpdate); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); } @Test public void updateUserLogin() throws Exception { // Initialize the database userRepository.save(user); int databaseSizeBeforeUpdate = userRepository.findAll().size(); // Update the user User updatedUser = userRepository.findOne(user.getId()); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( updatedUser.getId(), UPDATED_LOGIN, UPDATED_PASSWORD, UPDATED_FIRSTNAME, UPDATED_LASTNAME, UPDATED_EMAIL, updatedUser.getActivated(), UPDATED_IMAGEURL, UPDATED_LANGKEY, updatedUser.getCreatedBy(), updatedUser.getCreatedDate(), updatedUser.getLastModifiedBy(), updatedUser.getLastModifiedDate(), authorities); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isOk()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeUpdate); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); } @Test public void updateUserExistingEmail() throws Exception { // Initialize the database with 2 users userRepository.save(user); User anotherUser = new User(); anotherUser.setLogin("jhipster"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); anotherUser.setFirstName("java"); anotherUser.setLastName("hipster"); anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.save(anotherUser); // Update the user User updatedUser = userRepository.findOne(user.getId()); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( updatedUser.getId(), updatedUser.getLogin(), updatedUser.getPassword(), updatedUser.getFirstName(), updatedUser.getLastName(), "jhipster@localhost", // this email should already be used by anotherUser updatedUser.getActivated(), updatedUser.getImageUrl(), updatedUser.getLangKey(), updatedUser.getCreatedBy(), updatedUser.getCreatedDate(), updatedUser.getLastModifiedBy(), updatedUser.getLastModifiedDate(), authorities); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); } @Test public void updateUserExistingLogin() throws Exception { // Initialize the database userRepository.save(user); User anotherUser = new User(); anotherUser.setLogin("jhipster"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); anotherUser.setFirstName("java"); anotherUser.setLastName("hipster"); anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.save(anotherUser); // Update the user User updatedUser = userRepository.findOne(user.getId()); Set<String> authorities = new HashSet<>(); authorities.add(AuthoritiesConstants.USER); ManagedUserVM managedUserVM = new ManagedUserVM( updatedUser.getId(), "jhipster", // this login should already be used by anotherUser updatedUser.getPassword(), updatedUser.getFirstName(), updatedUser.getLastName(), updatedUser.getEmail(), updatedUser.getActivated(), updatedUser.getImageUrl(), updatedUser.getLangKey(), updatedUser.getCreatedBy(), updatedUser.getCreatedDate(), updatedUser.getLastModifiedBy(), updatedUser.getLastModifiedDate(), authorities); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); } @Test public void deleteUser() throws Exception { // Initialize the database userRepository.save(user); int databaseSizeBeforeDelete = userRepository.findAll().size(); // Delete the user restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeDelete - 1); } @Test public void getAllAuthorities() throws Exception { restUserMockMvc.perform(get("/api/users/authorities") .accept(TestUtil.APPLICATION_JSON_UTF8) .contentType(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$").isArray()) .andExpect(jsonPath("$").value(containsInAnyOrder(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN))); } @Test public void testUserEquals() throws Exception { TestUtil.equalsVerifier(User.class); User user1 = new User(); user1.setId("id1"); User user2 = new User(); user2.setId(user1.getId()); assertThat(user1).isEqualTo(user2); user2.setId("id2"); assertThat(user1).isNotEqualTo(user2); user1.setId(null); assertThat(user1).isNotEqualTo(user2); } @Test public void testUserFromId() { assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID); assertThat(userMapper.userFromId(null)).isNull(); } @Test public void testUserDTOtoUser() { UserDTO userDTO = new UserDTO( DEFAULT_ID, DEFAULT_LOGIN, DEFAULT_FIRSTNAME, DEFAULT_LASTNAME, DEFAULT_EMAIL, true, DEFAULT_IMAGEURL, DEFAULT_LANGKEY, DEFAULT_LOGIN, null, DEFAULT_LOGIN, null, Stream.of(AuthoritiesConstants.USER).collect(Collectors.toSet())); User user = userMapper.userDTOToUser(userDTO); assertThat(user.getId()).isEqualTo(DEFAULT_ID); assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(user.getActivated()).isEqualTo(true); assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY); assertThat(user.getCreatedBy()).isNull(); assertThat(user.getCreatedDate()).isNotNull(); assertThat(user.getLastModifiedBy()).isNull(); assertThat(user.getLastModifiedDate()).isNotNull(); assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER); } @Test public void testUserToUserDTO() { user.setId(DEFAULT_ID); user.setCreatedBy(DEFAULT_LOGIN); user.setCreatedDate(Instant.now()); user.setLastModifiedBy(DEFAULT_LOGIN); user.setLastModifiedDate(Instant.now()); Set<Authority> authorities = new HashSet<>(); Authority authority = new Authority(); authority.setName(AuthoritiesConstants.USER); authorities.add(authority); user.setAuthorities(authorities); UserDTO userDTO = userMapper.userToUserDTO(user); assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID); assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(userDTO.isActivated()).isEqualTo(true); assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY); assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate()); assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate()); assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER); assertThat(userDTO.toString()).isNotNull(); } @Test public void testAuthorityEquals() throws Exception { Authority authorityA = new Authority(); assertThat(authorityA).isEqualTo(authorityA); assertThat(authorityA).isNotEqualTo(null); assertThat(authorityA).isNotEqualTo(new Object()); assertThat(authorityA.hashCode()).isEqualTo(0); assertThat(authorityA.toString()).isNotNull(); Authority authorityB = new Authority(); assertThat(authorityA).isEqualTo(authorityB); authorityB.setName(AuthoritiesConstants.ADMIN); assertThat(authorityA).isNotEqualTo(authorityB); authorityA.setName(AuthoritiesConstants.USER); assertThat(authorityA).isNotEqualTo(authorityB); authorityB.setName(AuthoritiesConstants.USER); assertThat(authorityA).isEqualTo(authorityB); assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode()); } }
[ "rubentxu@rubentxu-ubuntu16.4" ]
rubentxu@rubentxu-ubuntu16.4
d53d02585fe27770e97729fb02696946df401a0f
e2781779f4ab24d79098e39f742092c75bc752b5
/Bigdata_Map_Reduce/MapReduce Code/combiner.java
c2027e445454ba5a68bd7d4f51666500a5676615
[]
no_license
praveenM417/Data-Engineering-Data-Science
2589601f51f384c667edc5f3106dc984d3f1921f
9c9cf5a77714474c0a5be2a7d09061951a8d34d3
refs/heads/master
2022-12-20T20:33:06.561492
2020-09-22T02:12:31
2020-09-22T02:12:31
275,698,536
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package com.letterFrequency.hd.wc; import java.io.IOException; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.Reducer.Context; import textPairKey.TextPair; public class combiner extends Reducer <TextPair, IntWritable, TextPair, IntWritable> { private IntWritable result = new IntWritable(); /* Initialising seconf text Pair */ private static TextPair mapOutputKey1 = new TextPair(); public void reduce(TextPair key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { /*Aggregation (sum) of counts of similar keys */ int sum = 0; for (IntWritable val : values) { sum += val.get(); } result.set(sum); context.write(key, result); } }
[ "58869683+praveenM417@users.noreply.github.com" ]
58869683+praveenM417@users.noreply.github.com
3e3d560d2e0a2de2470332a6233fa3af33355834
2dffa4174257fa1319c1a09f78f6537de347ef7c
/src/day41_arrayList/UpdatingArrayList.java
7b7df764f9cdcd52510123063aada63804c9b09c
[]
no_license
VolodymyrPodoinitsyn/java-programming
a618ac811691028ce31377d5e0aa85b558e87388
2fae5d86a9c120fdb682fd8c1841b4f88c137183
refs/heads/master
2023-05-14T14:45:11.224117
2021-06-07T18:11:27
2021-06-07T18:11:27
374,758,971
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package day41_arrayList; import java.util.ArrayList; import java.util.List; public class UpdatingArrayList { public static void main(String[] args) { List<String> myCars = new ArrayList<>(); myCars.add("Toyota"); myCars.add("Mazda"); myCars.add("Ford"); myCars.add("BMW"); myCars.add("Tesla"); myCars.add("Moskvitch"); myCars.add(0, "Jeep"); myCars.add(1, "Lada"); myCars.add(2, "Yugo"); System.out.println(myCars); String allCarsIn1St = myCars.toString(); System.out.println("allCarsIn1St = " + allCarsIn1St); myCars.set(0, "Lamborghini"); System.out.println("after set = " + myCars.toString()); myCars.set(4, "Honda"); System.out.println("after set = " + myCars.toString()); System.out.println("index of Ford = " + myCars.indexOf("Ford")); int moskvichIndex = myCars.indexOf("Moskvitch"); System.out.println("moskvichIndex = " + moskvichIndex); myCars.set(moskvichIndex, "Jiguli"); System.out.println(myCars); myCars.set(myCars.indexOf("Ford"), "WV"); if (myCars.contains("Lada")) { myCars.set(myCars.indexOf("Lada"), "Bugatti"); } else { System.out.println("Lada is not founded"); } System.out.println("After set Bugatti = " + myCars.toString()); for (int i = 0; i < myCars.size(); i++) { if (myCars.get(i).equals("Lamborghini")) { myCars.set(i,"Prius"); } else if (myCars.get(i).equals("Bugatti")) { myCars.set(i,"Lexus"); } else if (myCars.get(i).equals("Yugo")) { myCars.set(i,"Audi"); } } System.out.println("After set = " + myCars.toString()); } }
[ "podoinitsynvladimir@gmail.com" ]
podoinitsynvladimir@gmail.com
e347ef173492bd89b759364b5082194117eef043
a549d0442c9cee8ec49c9f7ce14b1392c1a718df
/src/main/java/edu/uci/ics/kpmckeow/service/api_gateway/exceptions/ModelValidationException.java
49047292eaade7c28e8c64fe6c8c26bfe18a1449
[]
no_license
chbohn/wk7-activity1-request_validation
04418985d5179be208fb125c719996432706fa50
a758bf3976db164c79123049d7d65ba3fd14b04b
refs/heads/master
2020-06-08T16:58:38.465011
2019-05-16T20:00:40
2019-05-16T20:00:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package edu.uci.ics.kpmckeow.service.api_gateway.exceptions; public class ModelValidationException extends Exception { public ModelValidationException() { } public ModelValidationException(String message) { super(message); } public ModelValidationException(String message, Throwable cause) { super(message, cause); } }
[ "kpmckeow@uci.edu" ]
kpmckeow@uci.edu
b2dcb1c7ab1702955a74582a85bd984b059dd6cd
fb7a19f6d9059081017204f27fda5b57433806ea
/server/src/main/java/cc/aguesuka/btfind/dht/handler/IDhtQueryChain.java
64be5a2684900e4f9ca62b76fbf3b8c9200698b3
[]
no_license
aguesuka/ague-dht
7cf3b64b93d302c15adde690366452301ac29ef9
9cfe5be68aed4edc92d34ef7a2669c47d2b4a861
refs/heads/master
2023-05-24T18:18:44.699000
2021-05-11T15:18:48
2021-05-11T15:18:48
208,762,320
15
6
null
2022-07-11T21:05:39
2019-09-16T09:33:59
Java
UTF-8
Java
false
false
802
java
package cc.aguesuka.btfind.dht.handler; import cc.aguesuka.btfind.dht.beans.KrpcMessage; /** * @author :aguesuka * 2019/9/11 20:00 */ public interface IDhtQueryChain extends IBaseDhtChain{ /** * 收到请求时 * * @param query 请求 */ default void onQuery(KrpcMessage query){ } /** * 收到ping请求 * * @param query 请求消息 */ void onPing(KrpcMessage query); /** * findNode请求 * * @param query 请求消息 */ void onFindNodes(KrpcMessage query); /** * GetPeer请求 * * @param query 请求消息 */ void onGetPeer(KrpcMessage query); /** * AnnouncePeer请求 * * @param query 请求消息 */ void onAnnouncePeer(KrpcMessage query); }
[ "373848003@qq.com" ]
373848003@qq.com
c6cee31ea1fe89beceb419c903663165fb91ca84
cf058294e706b0ffec595fdf556fd7db6f09829c
/app/src/main/java/com/docpoc/doctor/Pt/PtLogin.java
fc7dc6a4bcd4cc1dd293210458886e61db00012d
[]
no_license
empieretech/DoctorPocket_24Jun2017
eeca4deeb5631319d1bdbd3608b277c16b832331
e9fad07da973d61a0c9f8bf2304c6faf1b4faed1
refs/heads/master
2021-01-01T16:54:44.187800
2017-09-12T06:05:25
2017-09-12T06:05:25
97,951,542
0
0
null
null
null
null
UTF-8
Java
false
false
24,996
java
package com.docpoc.doctor.Pt; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.crashlytics.android.Crashlytics; import com.docpoc.doctor.App; import com.docpoc.doctor.Dr.DrDashboardActivity; import com.docpoc.doctor.ForgotPassword; import com.docpoc.doctor.ImageLoader.Constant; import com.docpoc.doctor.PreLogin; import com.docpoc.doctor.R; import com.docpoc.doctor.TermsConditionActivity; import com.docpoc.doctor.classes.Internet; import com.docpoc.doctor.gcm.MyGcmRegistrationService; import com.docpoc.doctor.utils.AngellinaTextView; import com.docpoc.doctor.utils.RobottoEditTextView; import com.docpoc.doctor.utils.RobottoTextView; import com.docpoc.doctor.webServices.AsynchTaskListner; import com.docpoc.doctor.webServices.BaseTask; import com.docpoc.doctor.webServices.MyConstants; import com.docpoc.doctor.webServices.GlobalBeans; import com.docpoc.doctor.webServices.ServerAPI; import com.docpoc.doctor.webServices.Utils; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.GraphRequest; import com.facebook.GraphResponse; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.google.ads.conversiontracking.AdWordsConversionReporter; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.gcm.GoogleCloudMessaging; import org.json.JSONException; import org.json.JSONObject; import java.util.Arrays; import io.fabric.sdk.android.Fabric; public class PtLogin extends Activity implements OnClickListener, AsynchTaskListner { public RobottoTextView tv_logIn, tv_forget, tv_signUp, tv_terms, tvDoctorSignUp; public RobottoEditTextView et_email, et_password; public ProgressDialog mprogressDialog; public LoginButton loginButton; public CallbackManager callbackManager; public GoogleCloudMessaging gcm; public Context context = this; public static PtLogin staticThis; public static final String REG_ID = "regId"; private static final String APP_VERSION = "appVersion"; public static final String TAG = "Login Activity"; public String regId = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_pt_login); staticThis = this; Utils.logUser(); AngellinaTextView text = (AngellinaTextView) findViewById(R.id.custom_text); App.user.setUser_Type(MyConstants.USER_PT); et_email = (RobottoEditTextView) findViewById(R.id.activity_pt_login_et_emailId); et_password = (RobottoEditTextView) findViewById(R.id.activity_pt_login_et_pwd); et_email.setText("sagar.jeff@gmail.com"); et_password.setText("1234"); tv_logIn = (RobottoTextView) findViewById(R.id.activity_pt_login_tv_logIN); tv_forget = (RobottoTextView) findViewById(R.id.activity_pt_login_tv_forget); tv_signUp = (RobottoTextView) findViewById(R.id.activity_pt_login_tv_SignUp); tv_signUp.setText(Html.fromHtml("Don't have an account? <b><u>Sign Up</u></b>")); tvDoctorSignUp = (RobottoTextView) findViewById(R.id.tvDoctorSignUp); tvDoctorSignUp.setText(Html.fromHtml("Doctor? <b><u>Click here</b>")); tv_terms = (RobottoTextView) findViewById(R.id.activity_pt_login_tv_terms); tv_terms.setText(Html.fromHtml("By signing in you agree to our <br> <b><u>Terms & Conditions</u></b>")); loginButton = (LoginButton) findViewById(R.id.login_button); callbackManager = CallbackManager.Factory.create(); setListener(); AdWordsConversionReporter.reportWithConversionId(this.getApplicationContext(), "877929938", "OY--CObClmwQ0svQogM", "0.00", false); if (android.os.Build.VERSION.SDK_INT >= 23) { //Android M Or Over if (!Settings.canDrawOverlays(this)) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); startActivityForResult(intent, 0); } } registerGCM(); setUpHomePAge(); } public void setUpHomePAge() { final SharedPreferences prefs = getSharedPreferences(MyConstants.PREF, Context.MODE_PRIVATE); String userTYPE = prefs.getString(MyConstants.USER_TYPE, ""); if (!(userTYPE.isEmpty())) { String userID = prefs.getString(MyConstants.USER_ID, ""); String userName = prefs.getString(MyConstants.USER_EMAIL, ""); String name = prefs.getString(MyConstants.PT_NAME, ""); String PT_ZONE = prefs.getString(MyConstants.PT_ZONE, ""); String PROFILE_PIC = prefs.getString(MyConstants.PROFILE_PIC, ""); if (userTYPE.equalsIgnoreCase(MyConstants.USER_PT)) { App.user.setUser_Type(MyConstants.USER_PT); App.user.setCurrent_zone_date_time(PT_ZONE); App.user.setProfileUrl(PROFILE_PIC); App.user.setUserID(userID); App.user.setUserEmail(userName); App.user.setUserName(userName); App.user.setName(name); Intent intent = new Intent(this, PTDashboardActivity.class); this.startActivity(intent); } else { App.user.setUser_Type(MyConstants.USER_DR); Intent intent = new Intent(this, DrDashboardActivity.class); this.startActivity(intent); } } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.activity_pt_login_tv_logIN: //Intent intent = new Intent(this, PtDashboard_OldActivity.class); // this.startActivity(intent); loginAPI(); break; case R.id.activity_pt_login_tv_forget: ForgotPassword fP = new ForgotPassword(); fP.displayLayout(PtLogin.this); break; case R.id.activity_pt_login_tv_SignUp: Intent intent3 = new Intent(this, PtSignUp.class); this.startActivity(intent3); break; case R.id.activity_pt_login_tv_terms: Intent intent4 = new Intent(this, TermsConditionActivity.class); this.startActivity(intent4); break; case R.id.img_left_arrow: finish(); break; } // TODO Auto-generated method stub } public String registerGCM() { if (!Internet.isAvailable(PtLogin.this)) { Internet.showAlertDialog(PtLogin.this, "Error!", "No Internet Connection", false); return null; } gcm = GoogleCloudMessaging.getInstance(this); regId = getRegistrationId(context); if (TextUtils.isEmpty(regId)) { registerDevice(); Log.d("RegisterActivity", "registerGCM - successfully registered with GCM server - regId: " + regId); } else { // Toast.makeText(getApplicationContext(),"RegId already available. RegId: " + regId, // Toast.LENGTH_LONG).show(); } return regId; } @SuppressLint("NewApi") private String getRegistrationId(Context context) { final SharedPreferences prefs = getSharedPreferences( DrDashboardActivity.class.getSimpleName(), Context.MODE_PRIVATE); String registrationId = prefs.getString(REG_ID, ""); if (registrationId.isEmpty()) { Log.i(TAG, "Registration not found."); return ""; } int registeredVersion = prefs.getInt(APP_VERSION, Integer.MIN_VALUE); int currentVersion = getAppVersion(context); if (registeredVersion != currentVersion) { Log.i(TAG, "App version changed."); return ""; } return registrationId; } public void registerDevice() { if (Utils.isNetworkAvailable(PtLogin.this)) { if (checkPlayServices()) { // Start IntentService to register this application with GCM. // Utils.showSimpleSpinProgressDialog(instance, "Please wait..."); Intent intent = new Intent(this, MyGcmRegistrationService.class); startService(intent); } } } private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000; private boolean checkPlayServices() { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); int resultCode = apiAvailability.isGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.SUCCESS) { if (apiAvailability.isUserResolvableError(resultCode)) { apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST) .show(); } else { Log.i("GCM ::", "GCM This device is not supported."); finish(); } return false; } return true; } private void setListener() { loginButton.setReadPermissions(Arrays.asList("public_profile", "email","user_birthday","user_location","user_location")); // @[@"public_profile", @"email", @"user_friends",@"user_birthday",@"user_location",@"user_hometown"]; loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { /* new AlertDialog.Builder(PtLogin.this) .setTitle("FB") .setMessage("Success") .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); */ GraphRequest request = GraphRequest.newMeRequest( loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted(JSONObject object, GraphResponse response) { Log.v("HomeActivity", response.toString()); try { String email = object.getString("email"); String name = object.getString("name"); String id = object.getString("id"); String gender = object.getString("gender"); getPTProfileAPI(id, name, email); } catch (JSONException e) { e.printStackTrace(); } } }); Bundle parameters = new Bundle(); parameters.putString("fields", "timezone,locale,id,first_name,last_name,name,email,birthday,picture.type(large),location,hometown"); //parameters:@{@"fields": @"timezone,locale,id,first_name,last_name,name,email,birthday,picture.type(large),location,hometown"}] request.setParameters(parameters); request.executeAsync(); } @Override public void onCancel() { } @Override public void onError(FacebookException e) { new AlertDialog.Builder(PtLogin.this) .setTitle("FB") .setMessage("Error") .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } }); tv_logIn.setOnClickListener(this); tv_forget.setOnClickListener(this); tv_signUp.setOnClickListener(this); tv_terms.setOnClickListener(this); } public void loginAPI() { final String userID = et_email.getText().toString(); final String pwd = et_password.getText().toString(); if (userID.length() < 2 && pwd.length() < 1) { new AlertDialog.Builder(PtLogin.this) .setTitle("Error!") .setMessage("Emai id or Password can not be blank.") .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); return; } if (!Internet.isAvailable(PtLogin.this)) { Internet.showAlertDialog(PtLogin.this, "Error!", "No Internet Connection", false); return; } BaseTask.run(new BaseTask.TaskListener() { @Override public JSONObject onTaskRunning(int taskId, Object data) { final SharedPreferences prefs = staticThis.getSharedPreferences( DrDashboardActivity.class.getSimpleName(), Context.MODE_PRIVATE); String deviceID = ""; if (prefs.contains(REG_ID)) deviceID = prefs.getString(REG_ID, ""); String urlStr = "login.php?access_token=testermanishrahul234142test" + "&device=android&userName=" + userID + "&password=" + pwd + "&deviceId=" + deviceID; Log.i("URL", "URL FIRED : " + urlStr); return ServerAPI.Login(urlStr, PtLogin.this); //return updateHistory(); } @Override public void onTaskResult(int taskId, JSONObject result) { if (mprogressDialog != null) { mprogressDialog.dismiss(); mprogressDialog = null; } onLoginResult(result); } @Override public void onTaskProgress(int taskId, Object... values) { } @Override public void onTaskPrepare(int taskId, Object data) { mprogressDialog = new ProgressDialog(PtLogin.this); mprogressDialog.setMessage("Login..."); mprogressDialog.setCancelable(false); mprogressDialog.show(); } @Override public void onTaskCancelled(int taskId) { if (mprogressDialog != null) { mprogressDialog.dismiss(); mprogressDialog = null; } } }); } public void onLoginResult(JSONObject jsonResponse) { GlobalBeans.LoginResultBean loginResult = new GlobalBeans.LoginResultBean(); if (jsonResponse != null) { try { loginResult.message = jsonResponse.getString("message"); if (jsonResponse.getString("status").equals("1")) { try { // appdelegate.appdelegateMessageBadgeValue = jsonData[@"document"][@"response"][@"data"][@"messageBadgeVal"]; String userID = jsonResponse.getJSONObject("data").getString("user_id"); String userName = jsonResponse.getJSONObject("data").getString("userName"); String current_zone_date_time = jsonResponse.getJSONObject("data").getString("zone"); String image_url = jsonResponse.getJSONObject("data").getString("image_url"); String messageBadgeVal = jsonResponse.getJSONObject("data").getString("messageBadgeVal"); String name = jsonResponse.getJSONObject("data").getString("name"); SharedPreferences sharedpreferences = getSharedPreferences(MyConstants.PREF, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(MyConstants.USER_TYPE, MyConstants.USER_PT); editor.putString(MyConstants.USER_EMAIL, userName); editor.putString(MyConstants.USER_ID, userID); editor.putString(MyConstants.PT_ZONE, current_zone_date_time); editor.putString(MyConstants.PT_NAME, name); editor.putString(MyConstants.PROFILE_PIC, MyConstants.BASE_URL + image_url); editor.commit(); App.user.setProfileUrl(MyConstants.BASE_URL + image_url.replaceAll("\\/", "/")); App.user.setUser_Type(MyConstants.USER_PT); App.user.setUserID(userID); App.user.setUserID(userID); App.user.setMessageBadgeVal(messageBadgeVal); App.user.setUserEmail(userName); App.user.setUserName(userName); App.user.setName(name); App.user.setCurrent_zone_date_time(current_zone_date_time); Intent intent = new Intent(this, PTDashboardActivity.class); this.startActivity(intent); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Toast.makeText(PtLogin.this, loginResult.message, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Log.e("login", e.toString()); } } } public void getPTProfileAPI(final String FB_id, final String Name, final String email) { BaseTask.run(new BaseTask.TaskListener() { @Override public JSONObject onTaskRunning(int taskId, Object data) { String urlStr = ""; urlStr = "getProfile.php?access_token=testermanishrahul234142test&user_id=" + FB_id; return ServerAPI.generalAPI(PtLogin.this, urlStr); //return updateHistory(); } @Override public void onTaskResult(int taskId, JSONObject result) { if (mprogressDialog != null) { mprogressDialog.dismiss(); mprogressDialog = null; } onProfileResult(result, FB_id, Name, email); } @Override public void onTaskProgress(int taskId, Object... values) { } @Override public void onTaskPrepare(int taskId, Object data) { mprogressDialog = new ProgressDialog(PtLogin.this); mprogressDialog.setMessage("Please wait..."); mprogressDialog.show(); } @Override public void onTaskCancelled(int taskId) { if (mprogressDialog != null) { mprogressDialog.dismiss(); mprogressDialog = null; } } }); } public void onProfileResult(JSONObject jsonResponse, String fb_id, String name, String email) { if (jsonResponse != null) { try { Log.i("responce", jsonResponse.toString()); if (jsonResponse.getString("status").equals("1")) { try { App.user.setUser_Type(MyConstants.USER_PT); String userID = jsonResponse.getString("user_id"); String userName = jsonResponse.getString("userName"); String current_zone_date_time = jsonResponse.getString("zone"); String image_url = jsonResponse.getString("image_url"); String messageBadgeVal = jsonResponse.getString("messageBadgeVal"); name = jsonResponse.getString("name"); SharedPreferences sharedpreferences = getSharedPreferences(MyConstants.PREF, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(MyConstants.USER_TYPE, MyConstants.USER_PT); editor.putString(MyConstants.USER_EMAIL, userName); editor.putString(MyConstants.USER_ID, userID); editor.putString(MyConstants.PT_ZONE, current_zone_date_time); editor.putString(MyConstants.PT_NAME, name); editor.putString(MyConstants.PROFILE_PIC, MyConstants.BASE_URL + image_url); editor.commit(); App.user.setProfileUrl(MyConstants.BASE_URL + image_url.replaceAll("\\/", "/")); App.user.setUserID(userID); App.user.setUserID(userID); App.user.setMessageBadgeVal(messageBadgeVal); App.user.setUserEmail(userName); App.user.setUserName(userName); App.user.setName(name); App.user.setCurrent_zone_date_time(current_zone_date_time); Intent intent = new Intent(this, PTDashboardActivity.class); this.startActivity(intent); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Intent i = new Intent(PtLogin.this, PtSignUp.class); i.putExtra("FB_id", fb_id); i.putExtra("Name", name); i.putExtra("Email", email); startActivity(i); Toast.makeText(PtLogin.this, "Sign Up", Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Log.e("login", e.toString()); } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { callbackManager.onActivityResult(requestCode, resultCode, data); } public static void storeRegistrationId(String regId) { final SharedPreferences prefs = staticThis.getSharedPreferences( DrDashboardActivity.class.getSimpleName(), Context.MODE_PRIVATE); int appVersion = getAppVersion(staticThis); App.user.setUser_DeviceID(regId); Log.i(TAG, "Saving regId on app version " + appVersion + regId); SharedPreferences.Editor editor = prefs.edit(); editor.putString(REG_ID, regId); editor.putInt(APP_VERSION, appVersion); editor.commit(); // new CallRequest(staticThis).updateDevice("p", App.user.getUserID(), regId); } private static int getAppVersion(Context context) { try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { Log.d("RegisterActivity", "I never expected this! Going down, going down!" + e); throw new RuntimeException(e); } } @Override public void onTaskCompleted(String result, Constant.REQUESTS request) { } @Override public void onProgressUpdate(String uniqueMessageId, int progres) { } @Override public void onProgressComplete(String uniqueMessageId, String result, Constant.REQUESTS request) { } }
[ "sojitra.sagar@empieretech.com" ]
sojitra.sagar@empieretech.com
62ca38f36ae7621c1e0683ecb2a9e8203bb7e478
bf31dfdd7bdbb1af29818c7c46187128caa2d755
/yoonstagram_0803/app/src/main/java/com/example/yoonstagram_0803/adapter/OnItemClickListener.java
321848d687b370f930f428597fcac8dfd19217e8
[]
no_license
jihazard/android
df0fc76ed7a6b9125b6f8ccfc63f78d793fb7081
81dca895a2ad99f277fb63b311e25367f77b41c7
refs/heads/master
2020-06-21T18:25:55.522304
2019-08-14T08:28:10
2019-08-14T08:28:10
197,525,707
0
0
null
null
null
null
UTF-8
Java
false
false
88
java
package com.example.yoonstagram_0803.adapter; public interface OnItemClickListener { }
[ "yoonjh238@gmail.com" ]
yoonjh238@gmail.com
4592276060721bf7cfa2e7583f1e76575c5e3e0e
87648f124dc4301f517890559d8bd9915fac4021
/server/src/main/java/com/lingxi/system/entity/Dictionary.java
d5ec2f4d9a85a66c8464a303f948f566e249a8f8
[]
no_license
yuancongcong/springboot-rbac
c9c16a59803f4829723c371f06e052bef6b3e559
213d9fc43ee3f4d98554c16ddf2508d44048d040
refs/heads/master
2020-03-18T01:44:35.816897
2018-05-20T14:37:39
2018-05-20T14:37:39
134,157,445
1
0
null
null
null
null
UTF-8
Java
false
false
765
java
package com.lingxi.system.entity; import com.alibaba.fastjson.annotation.JSONField; import com.lingxi.framework.base.IdEntity; import lombok.Getter; import lombok.Setter; import javax.persistence.*; import java.util.List; @Getter @Setter @Entity @Table(name="sys_dictionary") public class Dictionary extends IdEntity { private String name; private String code; private Boolean isLeaf; private Integer level; private String flag; private Long sort; private Long pid; /** 级联删除菜单配置 */ @OneToMany(cascade = CascadeType.REMOVE,fetch = FetchType.LAZY) @JoinColumn(name = "pid") @JSONField(serialize = false) private List<Dictionary> children2; @Transient private List<Dictionary> children; }
[ "772610229@qq.com" ]
772610229@qq.com
b8cff67f122af4d5bb9edb3f02793be1a00ded2c
f772c3a368f272841b9327865ebc4d5c67b1a0df
/src/learn/corejava/TestAnimalSuper.java
dcc9ab1a9321a0d8c4ecfb925e5dfa53021aee2c
[ "MIT" ]
permissive
pppatil7/100-days-of-code
a3ad3a9d014fd9dd96c24b3db0ee88bc94edddf9
c040c0835f4e1c636c2118272372e8af457b4118
refs/heads/master
2023-03-05T05:00:12.795803
2021-02-17T17:54:10
2021-02-17T17:54:10
275,379,446
2
0
null
2020-06-27T13:38:04
2020-06-27T13:38:03
null
UTF-8
Java
false
false
127
java
package learn.corejava; public class TestAnimalSuper { public static void main(String[] args) { Dog1 d=new Dog1(); } }
[ "pundalikpatil7218@gmail.com" ]
pundalikpatil7218@gmail.com
0f0ff0d44f4a81cbd70935bf6f1f137aeaf1f368
ddbb398d9157a838d0712ded71d18dcbc561cfe1
/src/leetCode/MaximalRectangle.java
ea2d1b5b3f1b644759be58d4fadcbc84930c3c3b
[]
no_license
faxiyu/leetcode
dbf8fc47470e87af3eaec5e030d51532de341dc1
61940e3cd64bdfa2a1cc5b76b3f0ffe55952758a
refs/heads/master
2023-02-19T17:03:36.111767
2021-01-15T02:12:48
2021-01-15T02:12:48
329,785,608
0
0
null
null
null
null
GB18030
Java
false
false
1,409
java
package leetCode; import java.util.Stack; /** * 给定一个仅包含 0 和 1 、大小为 rows x cols 的二维二进制矩阵,找出只包含 1 的最大矩形,并返回其面积。 * @author 14257 *largestRectangleArea */ public class MaximalRectangle { public static void main(String[] args) { char[][] matrix = {{'1','0','1','0','0'},{'1','0','1','1','1'},{'1','1','1','1','1'},{'1','0','0','1','0'}}; int[] heights=new int[matrix[0].length]; int max=0; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].length; j++) { if (matrix[i][j]=='1') { heights[j]+=1; }else { heights[j]=0; } } max=Math.max(largestRectangleArea(heights),max); } System.out.println(max); } private static int largestRectangleArea(int[] heights) { int max=0; Stack<Integer> stack = new Stack<>(); for (int i = 0; i < heights.length; i++) { while(!stack.isEmpty()&&heights[i]<heights[stack.peek()]) { int high=heights[stack.pop()]; int width; if (stack.isEmpty()) { width=i; }else { width=i-stack.peek()-1; } max=Math.max(max, width*high); } stack.add(i); } while(!stack.isEmpty()) { int high = heights[stack.pop()]; int width; if (stack.isEmpty()) { width=heights.length; }else { width=heights.length-stack.peek()-1; } max=Math.max(max, width*high); } return max; } }
[ "14257@DESKTOP-6JJ5TM8.mshome.net" ]
14257@DESKTOP-6JJ5TM8.mshome.net
424cf8bd9d6d78590fa35ffdc4f2a029fb6e2e1f
24271255d1ee1fb47c0623b1a4ab5ef11616ca84
/SpringbootSchoolShop/src/main/java/com/zhang/ssmschoolshop/controller/admin/AdminOrderController.java
11f44d3577f53a4ca89319f58c01566c9b9c7929
[]
no_license
Guessx/OnlineSchoolShop
b9fcc950f86b6219ceba3cdd6bf2992d763136a4
812170d7242353e4accf88edc8703cafa688cf33
refs/heads/master
2022-11-22T05:23:46.170480
2022-04-16T09:09:00
2022-04-16T09:09:00
245,599,230
0
0
null
2020-03-07T08:57:41
2020-03-07T08:57:41
null
UTF-8
Java
false
false
8,231
java
package com.zhang.ssmschoolshop.controller.admin; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.zhang.ssmschoolshop.entity.*; import com.zhang.ssmschoolshop.service.EmailService; import com.zhang.ssmschoolshop.service.GoodsService; import com.zhang.ssmschoolshop.service.OrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpSession; import java.util.ArrayList; import java.util.List; @Controller @RequestMapping("/admin/order") public class AdminOrderController { @Autowired private OrderService orderService; @Autowired private GoodsService goodsService; @Autowired private EmailService emailService; @RequestMapping("/send") public String sendOrder(@RequestParam(value = "page",defaultValue = "1")Integer pn, Model model, HttpSession session) { Admin admin = (Admin) session.getAttribute("admin"); if (admin == null) { return "redirect:/admin/login"; } //一页显示几个数据 PageHelper.startPage(pn, 2); //查询未发货订单 OrderExample orderExample = new OrderExample(); orderExample.or().andIssendEqualTo(false); List<Order> orderList = orderService.selectOrderByExample(orderExample); model.addAttribute("sendOrder", orderList); //查询该订单中的商品 for (int i = 0; i < orderList.size(); i++) { //获取订单项中的goodsid Order order = orderList.get(i); OrderItemExample orderItemExample = new OrderItemExample(); orderItemExample.or().andOrderidEqualTo(order.getOrderid()); List<OrderItem> orderItemList = orderService.getOrderItemByExample(orderItemExample); List<Integer> goodsIdList = new ArrayList<>(); List<Goods> goodsList = new ArrayList<>(); for (OrderItem orderItem : orderItemList) { // goodsIdList.add(orderItem.getGoodsid()); Goods goods = goodsService.selectById(orderItem.getGoodsid()); goods.setNum(orderItem.getNum()); goodsList.add(goods); } //根据goodsid查询商品 /*GoodsExample goodsExample = new GoodsExample(); goodsExample.or().andGoodsidIn(goodsIdList); List<Goods> goodsList = goodsService.selectByExample(goodsExample);*/ order.setGoodsInfo(goodsList); //查询地址 Address address = orderService.getAddressByKey(order.getAddressid()); order.setAddress(address); orderList.set(i, order); } //显示几个页号 PageInfo page = new PageInfo(orderList,5); model.addAttribute("pageInfo", page); return "adminAllOrder"; } @RequestMapping("/sendGoods") public String sendGoods(Integer orderid, HttpSession session) { Admin admin = (Admin) session.getAttribute("admin"); if (admin == null) { return "redirect:/admin/login"; } Order order = new Order(); order.setOrderid(orderid); order.setIssend(true); orderService.updateOrderByKey(order); // 发送信息给用户 管理员已经发货了 // emailService.sendEmailToUser(); return "redirect:/admin/order/send"; } @RequestMapping("/receiver") public String receiveOrder(@RequestParam(value = "page",defaultValue = "1")Integer pn, Model model, HttpSession session) { Admin admin = (Admin) session.getAttribute("admin"); if (admin == null) { return "redirect:/admin/login"; } //一页显示几个数据 PageHelper.startPage(pn, 2); //查询未收货订单 OrderExample orderExample = new OrderExample(); orderExample.or().andIssendEqualTo(true).andIsreceiveEqualTo(false); List<Order> orderList = orderService.selectOrderByExample(orderExample); model.addAttribute("sendOrder", orderList); //查询该订单中的商品 for (int i = 0; i < orderList.size(); i++) { //获取订单项中的goodsid Order order = orderList.get(i); OrderItemExample orderItemExample = new OrderItemExample(); orderItemExample.or().andOrderidEqualTo(order.getOrderid()); List<OrderItem> orderItemList = orderService.getOrderItemByExample(orderItemExample); List<Integer> goodsIdList = new ArrayList<>(); /*for (OrderItem orderItem : orderItemList) { goodsIdList.add(orderItem.getGoodsid()); } */ List<Goods> goodsList = new ArrayList<>(); for (OrderItem orderItem : orderItemList) { // goodsIdList.add(orderItem.getGoodsid()); Goods goods = goodsService.selectById(orderItem.getGoodsid()); goods.setNum(orderItem.getNum()); goodsList.add(goods); } //根据goodsid查询商品 /* GoodsExample goodsExample = new GoodsExample(); goodsExample.or().andGoodsidIn(goodsIdList); List<Goods> goodsList = goodsService.selectByExample(goodsExample);*/ order.setGoodsInfo(goodsList); //查询地址 Address address = orderService.getAddressByKey(order.getAddressid()); order.setAddress(address); orderList.set(i, order); } //显示几个页号 PageInfo page = new PageInfo(orderList,5); model.addAttribute("pageInfo", page); return "adminOrderReceive"; } @RequestMapping("/complete") public String completeOrder(@RequestParam(value = "page", defaultValue = "1") Integer pn, Model model, HttpSession session) { Admin admin = (Admin) session.getAttribute("admin"); if (admin == null) { return "redirect:/admin/login"; } //一页显示几个数据 PageHelper.startPage(pn, 2); //查询已完成订单 OrderExample orderExample = new OrderExample(); orderExample.or().andIssendEqualTo(true).andIsreceiveEqualTo(true).andIscompleteEqualTo(true); List<Order> orderList = orderService.selectOrderByExample(orderExample); model.addAttribute("sendOrder", orderList); //查询该订单中的商品 for (int i = 0; i < orderList.size(); i++) { //获取订单项中的goodsid Order order = orderList.get(i); OrderItemExample orderItemExample = new OrderItemExample(); orderItemExample.or().andOrderidEqualTo(order.getOrderid()); List<OrderItem> orderItemList = orderService.getOrderItemByExample(orderItemExample); List<Integer> goodsIdList = new ArrayList<>(); /*for (OrderItem orderItem : orderItemList) { goodsIdList.add(orderItem.getGoodsid()); }*/ List<Goods> goodsList = new ArrayList<>(); for (OrderItem orderItem : orderItemList) { // goodsIdList.add(orderItem.getGoodsid()); Goods goods = goodsService.selectById(orderItem.getGoodsid()); goods.setNum(orderItem.getNum()); goodsList.add(goods); } //根据goodsid查询商品 /*GoodsExample goodsExample = new GoodsExample(); goodsExample.or().andGoodsidIn(goodsIdList); List<Goods> goodsList = goodsService.selectByExample(goodsExample);*/ order.setGoodsInfo(goodsList); //查询地址 Address address = orderService.getAddressByKey(order.getAddressid()); order.setAddress(address); orderList.set(i, order); } //显示几个页号 PageInfo page = new PageInfo(orderList, 5); model.addAttribute("pageInfo", page); return "adminOrderComplete"; } }
[ "994683607@qq.com" ]
994683607@qq.com
720df6d4f68fb38b5dc64a1a51046e706ef5f853
98041a2d393624d73887ef26a5f7b0d12583b76a
/backend/src/main/java/com/devsuperior/dslearnbds/dto/NotificationDTO.java
68e0290ca992f3a69de75c0fbca7b0f40efcbfe4
[]
no_license
fmrenan/dslearn
4d7253f1379ee28462ce6a4281d491bb475f760d
abb5567caaad63fdaa9f45da17ffbf8398c2823f
refs/heads/main
2023-06-02T16:57:38.632028
2021-06-13T18:41:47
2021-06-13T18:41:47
375,437,874
0
0
null
null
null
null
UTF-8
Java
false
false
1,553
java
package com.devsuperior.dslearnbds.dto; import java.io.Serializable; import java.time.Instant; import com.devsuperior.dslearnbds.entities.Notification; public class NotificationDTO implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String text; private Instant moment; private boolean read; private String route; private Long userID; public NotificationDTO() {} public NotificationDTO(Long id, String text, Instant moment, boolean read, String route, Long userID) { super(); this.id = id; this.text = text; this.moment = moment; this.read = read; this.route = route; this.userID = userID; }; public NotificationDTO(Notification entity) { id = entity.getId(); text = entity.getText(); moment = entity.getMoment(); read = entity.isRead(); route = entity.getRoute(); userID = entity.getUser().getId(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Instant getMoment() { return moment; } public void setMoment(Instant moment) { this.moment = moment; } public boolean isRead() { return read; } public void setRead(boolean read) { this.read = read; } public String getRoute() { return route; } public void setRoute(String route) { this.route = route; } public Long getUserID() { return userID; } public void setUserID(Long userID) { this.userID = userID; } }
[ "fmrenan@outlook.com" ]
fmrenan@outlook.com
fd459005d54d2b7886c6f4f4f604cb61283ab8ed
ad62bbec32fa21ae7ac59cf00135003f025dc6f8
/Prob157.java
34cafe461126f0122352f883d7b041443b1daf21
[]
no_license
havanagrawal/project-euler
27237f99d879ca71f6f2908f24aa00e6752bad7a
6cb913b4fce3bab493f4ab0aaa78e5e8724c5e6e
refs/heads/master
2021-01-10T11:36:28.179705
2015-09-26T12:01:24
2015-09-26T12:01:24
43,203,575
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
class Prob157 { public static long GCD(long i, long j) { while (i!=0 && j!=0) { if (i>j) i%=j; else j%=i; } if (j==0) return i; else return j; } public static void main(String args[]) { long x, y; long num, den; long no_of_sols=0, n=10, t=6, total=0; long start = System.currentTimeMillis(); for (n=10; n<=Math.pow(10, t); n*=10) { for (x=n+1; x<=2*n; x++) { num=n*x; den=x-n; if (GCD(num, den)==den) { no_of_sols++; //Find factors of x and y and add to number of solutions. y=num/den; for (long i=2; i<=x; i++) { if (x%i==0 && y%i==0) no_of_sols++; } } } System.out.println("The sols for n="+n+" are: "+no_of_sols); total+=no_of_sols; no_of_sols=0; } long end = System.currentTimeMillis(); System.out.println("The number of solutions for n<="+t+" are: "+total); System.out.println("Exec time: "+(end-start)); } }
[ "havanagrawal@gmail.com" ]
havanagrawal@gmail.com
06314c869a1e2a3faeb62902d9e4e40121bdc946
32cd38142028dbb703101ddd59367541de99722d
/app/src/main/java/com/maning/gankmm/bean/weather/WeatherInfoBean.java
651418805e7ebf45d86f2aac6800ef63336cb91a
[ "Apache-2.0" ]
permissive
maning0303/GankMM
b6659cdfe4092b8f0678abd9b25f6be2750013d9
60f58b12956763f74daa68eeb0424f78e6d9178a
refs/heads/master
2023-08-04T04:21:17.692138
2021-11-05T10:36:06
2021-11-05T10:36:06
54,034,810
669
186
null
2016-07-14T10:01:56
2016-03-16T13:37:35
Java
UTF-8
Java
false
false
2,801
java
package com.maning.gankmm.bean.weather; import java.io.Serializable; /** * @author : maning * @date : 2020-10-14 * @desc : 自己组装使用的天气数据 */ public class WeatherInfoBean implements Serializable { private static final long serialVersionUID = 8274082861209944804L; //天气 private String weather_desc; //温度 private String temperature; //体感 private String feels_like; //气压 private String pressure; //湿度 private String humidity; //可见度 private String visibility; //风向文字 private String wind_direction; //风速 private String wind_speed; //风力等级 private String wind_scale; //经纬度 private double longitude; private double latitude; private String city_name; public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public String getCity_name() { return city_name; } public void setCity_name(String city_name) { this.city_name = city_name; } public String getWeather_desc() { return weather_desc; } public void setWeather_desc(String weather_desc) { this.weather_desc = weather_desc; } public String getTemperature() { return temperature; } public void setTemperature(String temperature) { this.temperature = temperature; } public String getFeels_like() { return feels_like; } public void setFeels_like(String feels_like) { this.feels_like = feels_like; } public String getPressure() { return pressure; } public void setPressure(String pressure) { this.pressure = pressure; } public String getHumidity() { return humidity; } public void setHumidity(String humidity) { this.humidity = humidity; } public String getVisibility() { return visibility; } public void setVisibility(String visibility) { this.visibility = visibility; } public String getWind_direction() { return wind_direction; } public void setWind_direction(String wind_direction) { this.wind_direction = wind_direction; } public String getWind_speed() { return wind_speed; } public void setWind_speed(String wind_speed) { this.wind_speed = wind_speed; } public String getWind_scale() { return wind_scale; } public void setWind_scale(String wind_scale) { this.wind_scale = wind_scale; } }
[ "154292322@qq.com" ]
154292322@qq.com
6f3f19fc72d87cf57b422ee574892868a6ca660e
7eda8bf32c30737ee0eb30b557f41f306f3c9864
/pretest/test/LinkedListTestA.java
2d8b6f953e08b500a362071869085412d3d7062f
[]
no_license
William-Carrera/DATAPRO
56558b00d4f67b95c6ea14302ec5dafd46530595
33b670094df2ddcb69a5abd189aea1c6f66ff6b2
refs/heads/main
2023-03-08T05:42:30.214788
2021-02-20T21:06:49
2021-02-20T21:06:49
340,752,889
0
0
null
null
null
null
UTF-8
Java
false
false
5,970
java
package test; import static org.junit.Assert.*; import java.util.Iterator; import java.util.Random; import org.junit.Test; import exercises.LinkedList; public class LinkedListTestA { protected LinkedList<String> testList; protected static Random randy = new Random(System.currentTimeMillis()); protected void reset() { testList = new LinkedList<String>(); } protected String[] data = { "Augustus", "Tiberius", "Caligula", "Claudius", "Nero", "Galba", "Otho", "Vitellius", "Vespasian", "Titus", "Domitian", "Nerva", "Trajan", "Hadrian", "Antoninus Pius", "Marcus Aurelius", "Commodus" }; protected void populate(int size) { for (int i = 0; i < size && i < data.length; i++) testList.add(data[i]); } @Test public void emptySize() { reset(); assertEquals(0, testList.size()); } @Test public void emptyIndexNeg() { reset(); boolean caught = false; try { testList.get(-1); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void emptyIndexZero() { reset(); boolean caught = false; try { testList.get(0); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void emptyIndexPos() { reset(); boolean caught = false; try { testList.get(5); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void emptyIterator() { reset(); int i = 0; for (Iterator<String> it = testList.iterator(); it.hasNext(); ) i++; assertEquals(0, i); } @Test public void oneSize() { reset(); populate(1); assertEquals(1, testList.size()); } @Test public void oneIndexNeg() { reset(); populate(1); boolean caught = false; try { testList.get(-1); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void oneIndexZero() { reset(); populate(1); assertEquals(data[0], testList.get(0)); } @Test public void oneIndexPos() { reset(); populate(1); boolean caught = false; try { testList.get(5); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void oneIterator() { reset(); populate(1); int i = 0; for (Iterator<String> it = testList.iterator(); it.hasNext(); ) { assertEquals(data[i], it.next()); i++; } assertEquals(1, i); } @Test public void fillSize() { reset(); populate(8); assertEquals(8, testList.size()); } @Test public void fillIndexNeg() { reset(); populate(8); boolean caught = false; try { testList.get(-1); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void fillIndexValid() { reset(); populate(8); for (int i = 0; i < 8; i++) assertEquals(data[i], testList.get(i)); } @Test public void fillIndexPosOut() { reset(); populate(8); boolean caught = false; try { testList.get(10); } catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void fillIterator() { reset(); populate(8); int i = 0; for (Iterator<String> it = testList.iterator(); it.hasNext(); ) { assertEquals(data[i], it.next()); i++; } assertEquals(8, i); } @Test public void getEmpty() { reset(); boolean caught = false; try { testList.get(-1); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); caught = false; try { testList.get(0); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); caught = false; try { testList.get(1); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void getOne() { reset(); populate(1); boolean caught = false; try { testList.get(-1); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); assertEquals(data[0], testList.get(0)); caught = false; try { testList.get(1); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } @Test public void getFill() { reset(); populate(8); boolean caught = false; try { testList.get(-1); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); for (int i = 0; i < 8; i++) assertEquals(data[i], testList.get(i)); caught = false; try { testList.get(8); }catch (IndexOutOfBoundsException ioobe) { caught = true; } assertTrue(caught); } }
[ "william.carrera@my.wheaton.edu" ]
william.carrera@my.wheaton.edu
234927f8fa54061a6acb196ce9350030d22632b4
a924876e41822f8a38b35d58a8321d1da8bd3436
/src/com/javarush/test/level12/lesson12/home05/Solution.java
82755542779f48c314a817ffdd970413cf2c20ae
[]
no_license
sameclone/javarush
3543ab84019533007ae4602c0f46be9555534f6b
abae505686868e3250a7ef662b99a94afe246a40
refs/heads/master
2021-01-23T13:44:27.473410
2015-08-04T17:53:08
2015-08-04T17:53:08
40,197,402
0
0
null
null
null
null
UTF-8
Java
false
false
1,725
java
package com.javarush.test.level12.lesson12.home05; /* Что это? «Кот», «Тигр», «Лев», «Бык», «Корова», «Животное» Напиши метод, который определяет, какой объект передали в него. Программа должна выводить на экран одну из надписей: «Кот», «Тигр», «Лев», «Бык», «Корова», «Животное». Замечание: постарайся определять тип животного как можно более точно. */ public class Solution { public static void main(String[] args) { System.out.println(getObjectType(new Cat())); System.out.println(getObjectType(new Tiger())); System.out.println(getObjectType(new Lion())); System.out.println(getObjectType(new Bull())); System.out.println(getObjectType(new Cow())); System.out.println(getObjectType(new Animal())); } public static String getObjectType(Object o) { if(o instanceof Tiger) return "Тигр"; if(o instanceof Lion) return "Лев"; if(o instanceof Cat) return "Кот"; if(o instanceof Bull) return "Бык"; if(o instanceof Cow) return "Корова"; return "Животное"; } public static class Cat extends Animal //<--Классы наследуются!! { } public static class Tiger extends Cat { } public static class Lion extends Cat { } public static class Bull extends Animal { } public static class Cow extends Animal { } public static class Animal { } }
[ "same_clone@mail.ru" ]
same_clone@mail.ru
60f4af8d262a7265fbfb07a300ace8778b3b306d
4728ca3e6077d6b128defe0007ca69aa92747e5e
/NewsTest/android/app/src/debug/java/com/newstest/ReactNativeFlipper.java
c5968fc256a2323e740d03085421b60ccb71291b
[]
no_license
LakshmiShivakumarWovvtech/assignments
40c5179cf8752a198d5c5deca553985933402afc
d19d2033f9906c0d6719db7ffe6556342004bec7
refs/heads/master
2023-03-14T15:16:27.969610
2021-03-01T08:15:20
2021-03-01T08:15:20
343,337,979
0
0
null
null
null
null
UTF-8
Java
false
false
3,263
java
/** * Copyright (c) Facebook, Inc. and its affiliates. * * <p>This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. */ package com.newstest; import android.content.Context; import com.facebook.flipper.android.AndroidFlipperClient; import com.facebook.flipper.android.utils.FlipperUtils; import com.facebook.flipper.core.FlipperClient; import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; import com.facebook.flipper.plugins.inspector.DescriptorMapping; import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; import okhttp3.OkHttpClient; public class ReactNativeFlipper { public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); client.addPlugin(new ReactFlipperPlugin()); client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); NetworkingModule.setCustomClientBuilder( new NetworkingModule.CustomClientBuilder() { @Override public void apply(OkHttpClient.Builder builder) { builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); } }); client.addPlugin(networkFlipperPlugin); client.start(); // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized // Hence we run if after all native modules have been initialized ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( new ReactInstanceManager.ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); reactContext.runOnNativeModulesQueueThread( new Runnable() { @Override public void run() { client.addPlugin(new FrescoFlipperPlugin()); } }); } }); } else { client.addPlugin(new FrescoFlipperPlugin()); } } } }
[ "lakshmi.s@wovvtech.com" ]
lakshmi.s@wovvtech.com
6a4e73a1c774e745c7345f3cb1239e7c6018f110
11e6f9b6f6daf350e64ff45614602ed59879fe14
/SpringDemo2/src/main/java/com/example/Student.java
40c7d10137ee6e1801f968bf14d6c3d804fe6428
[]
no_license
alrha486/SIST-Spring
cbecd05404a3a5991b67dfe7737a255d8b49a036
7e77f968ccf13c89bffee01d5c12a2c4dcf49bd9
refs/heads/master
2020-04-08T19:03:12.801882
2018-12-28T09:01:39
2018-12-28T09:01:39
159,637,181
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package com.example; import java.util.ArrayList; public class Student { private String name; private int age; private ArrayList<String> hobbies; private double height; private double weight; public Student(String name, int age, ArrayList<String> hobbies) { this.name = name; this.age = age; this.hobbies = hobbies; } public void setHeight(double height) { this.height = height; } public void setWeight(double weight) { this.weight = weight; } @Override public String toString() { return "Student [name=" + name + ", age=" + age + ", hobbies=" + hobbies + ", height=" + height + ", weight=" + weight + "]"; } }
[ "alrha486@naver.com" ]
alrha486@naver.com
43177172971ac6a80ff887e3b7f6268a27bda47a
7adb266c6ecec5a77323de5e233ae930b006c6fe
/app/src/main/java/com/example/rowan/pplcontact/SyncData.java
cbf964917f440fcada2c9ec200215a959b588dc0
[]
no_license
shitu13/PPLContact
433063f350bd2bb3caeeccb70e2c2f452cf6298a
01179c208d50eb588d5cab5b2bc9697873485f57
refs/heads/master
2020-04-15T03:07:18.377089
2018-08-15T06:27:37
2018-08-15T06:27:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,812
java
package com.example.rowan.pplcontact; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.support.annotation.NonNull; import android.util.Log; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; 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.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import static android.content.ContentValues.TAG; public class SyncData extends Activity{ String path; public void getDataFromFirebase(final Context context) { final ProgressDialog dialog=ProgressDialog. show(context,"","Updating...",true); DatabaseReference reference =FirebaseDatabase.getInstance().getReference("UserData"); reference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for(DataSnapshot ds:dataSnapshot.getChildren()){ String name = ds.child("Name").getValue().toString(); String designation = ds.child("Designation").getValue().toString(); String branch = ds.child("Branch").getValue().toString(); String phone = ds.child("Phone").getValue().toString(); String mobile= ds.child("Mobile").getValue().toString(); String mail = ds.child("Email").getValue().toString(); String fb = ds.child("FbId").getValue().toString(); String image=ds.child("Image").getValue().toString(); String empId=ds.getKey(); String whtsapp=ds.child("Whtsapp").getValue().toString(); String viber=ds.child("Viber").getValue().toString(); Log.d(TAG, "onDataChange: "+empId+" "+whtsapp); DataHolder newData = new DataHolder(name, phone, mail, fb, mobile, designation,branch,image,empId,whtsapp,viber); DatabaseHelper databaseHelper=new DatabaseHelper(context); databaseHelper.InsertData(newData); } dialog.dismiss(); // startActivity(new Intent(context,ContactList.class)); } @Override public void onCancelled(DatabaseError databaseError) { } }); } public void UpdateData(HashMap<String,String> data,boolean type) { DatabaseReference reference =FirebaseDatabase.getInstance(). getReference("UserData").child(data.get("EmpId")); if(data.containsKey("Name")) reference.child("Name").setValue(data.get("Name")); if(data.containsKey("Designation")) reference.child("Designation").setValue(data.get("Designation")); if(data.containsKey("Branch")) reference.child("Branch").setValue(data.get("Branch")); if(data.containsKey("Phone")) reference.child("Phone").setValue(data.get("Phone")); if(data.containsKey("Mobile")) reference.child("Mobile").setValue(data.get("Mobile")); if(data.containsKey("Email")) reference.child("Email").setValue(data.get("Email")); if(data.containsKey("FbId")) reference.child("FbId").setValue(data.get("FbId")); if(data.containsKey("Whtsapp")) reference.child("Whtsapp").setValue(data.get("Whtsapp")); if(data.containsKey("Viber")) reference.child("Viber").setValue(data.get("Viber")); if(type) reference.child("Image").setValue("NoImage"); } public void UploadPhoto(Uri uri, final String empid,Boolean flag) { final DatabaseReference reference =FirebaseDatabase.getInstance(). getReference("UserData").child(empid); if(flag) { FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageReference = storage.getReference(); final StorageReference filepath = storageReference.child(empid).child(uri.getLastPathSegment()); Task<Uri> urlTask = filepath.putFile(uri).continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { if (!task.isSuccessful()) { throw task.getException(); } // Continue with the task to get the download URL return filepath.getDownloadUrl(); } }).addOnCompleteListener(new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if (task.isSuccessful()) { Uri downloadUri = task.getResult(); path = downloadUri.toString(); reference.child("Image").setValue(path); } else { // Handle failures // ... } } }); } else { reference.child("Image").setValue("NoImage"); path="NoImage"; } } }
[ "rowanhossain@gmail.com" ]
rowanhossain@gmail.com
d6bbc12921232f5842f048a737ff93c144ca04be
a16723781a853d0caf0a2bd0eed4d60add6a7da2
/pinyougou/pinyougou-pojo/src/main/java/com/pinyougou/vo/OrderVo.java
debd4592999652e4f07d1d02781b1951244c969c
[]
no_license
wufengmei/pinyougou_01
236d0925119684ecef04a91f10594421d454919d
e650767a02f4fa9043315b3df18c289c438e13b1
refs/heads/master
2020-04-08T06:15:49.139145
2018-11-29T07:28:13
2018-11-29T07:28:13
159,090,939
0
0
null
null
null
null
UTF-8
Java
false
false
1,309
java
package com.pinyougou.vo; import com.pinyougou.pojo.TbOrder; import java.util.List; public class OrderVo { private TbOrder tbOrder; private String createTime; private String createTime1; private String paymentTime; private String paymentTime1; private List orderItemList; public List getOrderItemList() { return orderItemList; } public void setOrderItemList(List itemList) { this.orderItemList = itemList; } public String getPaymentTime() { return paymentTime; } public void setPaymentTime(String paymentTime) { this.paymentTime = paymentTime; } public String getPaymentTime1() { return paymentTime1; } public void setPaymentTime1(String paymentTime1) { this.paymentTime1 = paymentTime1; } public String getCreateTime1() { return createTime1; } public void setCreateTime1(String createTime1) { this.createTime1 = createTime1; } public TbOrder getTbOrder() { return tbOrder; } public void setTbOrder(TbOrder tbOrder) { this.tbOrder = tbOrder; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } }
[ "517462069@qq.com" ]
517462069@qq.com
4966cd6a0bc3dfc58720e12a40587562c7c52306
c0e5768e13aee0eeb1944415910fe6f8fee833b8
/nbproject/src/LinkedStack/LinearNode.java
c86fbc2c9565d3a45e38dad700ac66597da9f481
[]
no_license
diogo12lopes/Trabalho-Ed
8995f9c4dba4f70e7656343422a173e08188fd42
fb321f57f13f28f6505f3f6bf63f55fe8504ac89
refs/heads/master
2022-12-08T06:03:44.540120
2020-09-04T10:34:15
2020-09-04T10:34:15
291,154,990
0
0
null
null
null
null
UTF-8
Java
false
false
1,506
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 LinkedStack; /** * * @author Diogo Lopes 8180121 * @param <T> WildType */ public class LinearNode<T> { /** * reference to next node in list */ private LinearNode<T> next; /** * element stored at this node */ private T element; /** * Creates an empty node. */ public LinearNode() { this.next = null; this.element = null; } /** * Creates a node storing the specified element. * * @param elem element to be stored */ public LinearNode(T elem) { this.next = null; this.element = elem; } /** * * @return The node following */ public LinearNode<T> getNext() { return this.next; } /** * Sets the node that follows this one. * * @param node node to follow this one */ public void setNext(LinearNode<T> node) { this.next = node; } /** * Returns the element stored in this node. * * @return T element stored at this node */ public T getElement() { return element; } /** * Sets the element stored in this node. * * @param elem element to be stored at this node */ public void setElement(T elem) { this.element = elem; } }
[ "49435047+diogo12lopes@users.noreply.github.com" ]
49435047+diogo12lopes@users.noreply.github.com
615bc36c826352c5975b2fd849685bf11f9ad71a
b405a6f7a3358c9008f7a7b30046201647de988d
/Branches/Edexer/Technical/Code/edexer/src/main/java/com/edexer/model/Role.java
a353c9c021d0a53b3bcb5638607347d38ff22409
[]
no_license
edexcompany/edexer
1b9fb02ec4839406ff7c9f448986785b0a873ab7
74621fd172d52948c1878a2c299e941f2bfea0e8
refs/heads/master
2016-09-06T13:12:31.104932
2015-06-04T22:25:00
2015-06-04T22:25:00
35,110,101
0
0
null
null
null
null
UTF-8
Java
false
false
1,872
java
package com.edexer.model; // Generated Feb 13, 2015 8:24:16 AM by Hibernate Tools 3.6.0 import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; /** * Role generated by hbm2java */ @Entity @Table(name = "role", catalog = "edexer") public class Role implements java.io.Serializable { private Integer roleId; private String roleName; private String roleDesc; private Set users = new HashSet(0); public Role() { } public Role(String roleName) { this.roleName = roleName; } public Role(String roleName, String roleDesc, Set users) { this.roleName = roleName; this.roleDesc = roleDesc; this.users = users; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "role_id", unique = true, nullable = false) public Integer getRoleId() { return this.roleId; } public void setRoleId(Integer roleId) { this.roleId = roleId; } @Column(name = "role_name", nullable = false, length = 50) public String getRoleName() { return this.roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } @Column(name = "role_desc", length = 50) public String getRoleDesc() { return this.roleDesc; } public void setRoleDesc(String roleDesc) { this.roleDesc = roleDesc; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "role") public Set getUsers() { return this.users; } public void setUsers(Set users) { this.users = users; } @Override public boolean equals(Object obj) { if (!(obj instanceof Role)) return false; if (this.getRoleId() == ((Role) obj).getRoleId()) return true; return false; } }
[ "y.radwan@edex.co" ]
y.radwan@edex.co
1f2a267e84382110214928def439e30fb4db3e3e
f83bd2a093c2d97256853c1790d98151a6a0c230
/app/src/main/java/com/example/multiable/pos/Fragment/UpPullMenuFragment.java
29dc4c92251648a0797cbad31d5201b7cde28c1f
[]
no_license
Developmc/POS
ea919954bc8cb85bf480422d7ef26653933516c5
e1760071b068d4b155fc4d2ce439de9f38919359
refs/heads/master
2021-01-10T17:07:07.540065
2015-11-14T02:31:28
2015-11-14T02:31:28
44,851,629
0
0
null
null
null
null
UTF-8
Java
false
false
2,530
java
package com.example.multiable.pos.Fragment; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.GridView; import com.example.multiable.pos.Adapter.UpPullTypeAdapter; import com.example.multiable.pos.Adapter.UpPullTypeChildAdapter; import com.example.multiable.pos.R; /** * Created by macremote on 2015/10/27. */ public class UpPullMenuFragment extends Fragment { private View view ; private GridView gridViewLeft ; private GridView gridViewRight; private UpPullTypeAdapter adapterLeft ; private UpPullTypeChildAdapter adapterRight ; private boolean[] leftArray ; private boolean[] rightArray ; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_up_pull_menu,container,false); initData() ; initView(); return view ; } private void initData() { leftArray = new boolean[40] ; rightArray = new boolean[20] ; for (int i=0;i<leftArray.length;i++) { leftArray[i] = false ; } for(int i=0;i<rightArray.length;i++){ rightArray[i] = false ; } } private void initView() { gridViewLeft=(GridView)view.findViewById(R.id.gridViewLeft); gridViewRight=(GridView)view.findViewById(R.id.gridViewRight); adapterLeft = new UpPullTypeAdapter(getActivity(),leftArray); adapterRight = new UpPullTypeChildAdapter(getActivity(),rightArray); gridViewLeft.setAdapter(adapterLeft); gridViewLeft.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { adapterLeft.setLeftArray(position); adapterLeft.notifyDataSetChanged(); } }); gridViewRight.setAdapter(adapterRight); gridViewRight.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { adapterRight.setRightArray(position); // 重绘刷新视图 adapterRight.notifyDataSetChanged(); } }); } }
[ "a8392569" ]
a8392569
86f5dac10dc5b9869137e8a7ae151b56bce4fad4
e93b46b849609a590ba4d11119ae23207f04b14a
/src/main/java/com/northwind/np/dto/OrderDTO.java
a998446b98d47a89bf70831a70e0831eefeccfe5
[ "MIT" ]
permissive
Dioti/NorthwindAPI
71e80e9be72091662a0c370f3a1f396e60c0f976
f651920c9bda03098cd13504b0ab855a30ed71ae
refs/heads/main
2023-08-22T22:57:10.588468
2021-10-25T03:00:48
2021-10-25T03:00:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,591
java
package com.northwind.np.dto; import com.northwind.np.entities.OrderEntity; import java.math.BigDecimal; import java.time.Instant; public class OrderDTO { private int orderID; private String customerId; private int employeeId; private Instant orderDate; private Instant shipDate; private BigDecimal freight; private String shipCompanyName; private String shipCountry, shipRegion; public OrderDTO(OrderEntity orderEntity) { this.orderID = orderEntity.getId(); this.customerId = orderEntity.getCustomerID().getId(); this.employeeId = orderEntity.getEmployeeID().getId(); this.orderDate = orderEntity.getOrderDate(); this.shipDate = orderEntity.getShippedDate(); this.freight = orderEntity.getFreight(); this.shipCompanyName = orderEntity.getShipName(); this.shipCountry = orderEntity.getShipCountry(); this.shipRegion = orderEntity.getShipRegion(); } public int getOrderID() { return orderID; } public String getCustomerId() { return customerId; } public int getEmployeeId() { return employeeId; } public Instant getOrderDate() { return orderDate; } public Instant getShipDate() { return shipDate; } public BigDecimal getFreight() { return freight; } public String getShipCompanyName() { return shipCompanyName; } public String getShipCountry() { return shipCountry; } public String getShipRegion() { return shipRegion; } }
[ "natasha.pearl08@gmail.com" ]
natasha.pearl08@gmail.com
1d2c0eca8884c9b266baeebfe67416739622cf58
a34bbed0a0d716cc2b39cfd1dee69cefc92263a7
/src/main/java/org/kartashov/part15_regex_and_compression/regex/Example1.java
50a7aebf223112d6559c6f01bed92a5c610c8776
[]
no_license
serhiikartashov/java-se
2e8a0d535ce221b34dcf5abdd80011ad303788f0
2d9c774d8df62eeae6911b4260974067fcfdb169
refs/heads/master
2022-11-27T09:42:31.375292
2022-11-15T13:17:02
2022-11-15T13:17:02
156,975,124
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package org.kartashov.part15_regex_and_compression.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example1 { public static void main(String[] args) { // String to be scanned to find the pattern. String line = "DIAGNOSTIC IMPRESSION\n" + "\n" + "RegExr was created by gskinner.com, and is proudly hosted by Media Temple."; String pattern = "^([\\s ]*Impression[\\t ]*(?::[\\s ]*|\\r*\\n)|[\\s ]*Impressions[\\t ]*(?::[\\s ]*|\\r*\\n)|[\\s ]*DIAGNOSTIC IMPRESSION[\\t ]*(?::[\\s ]*|.[\\s ]*|\\r*\\n))"; Pattern r = Pattern.compile(pattern); // Now create matcher object. Matcher m = r.matcher(line); if (m.find()) { System.out.println(m.group()); }else { System.out.println("NO MATCH"); } } }
[ "kartashovsearhiy@gmail.com" ]
kartashovsearhiy@gmail.com
404211e4769558cf5299e0489f548819be8950cf
adb963ba9c7c0941a46bba02143a9e25e162cc86
/src/main/java/cn/vcinema/partner/PartnerInfo.java
b0f702a43ef2fa0951bd76d8c1ff560e9e71b833
[]
no_license
Baiyuhan/pumpkin_partner_api_demo
2aee4d4350022eacc7dfa89ebaf54028cd2af35d
76900afb0eab56fac2cb0ee10232b211bb7ee191
refs/heads/master
2021-05-05T01:41:12.651224
2018-01-30T05:41:07
2018-01-30T05:41:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,705
java
/* * Copyright (c) 2017-present, Pumpkin Movie, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Pumpkin Movie. * * As with any software that integrates with the pumpkin movie platform, your use of * this software is subject to the Pumpkin Movie Developer Principles and Policies * [http://developers.vcinema.com/policy/]. This copyright 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 cn.vcinema.partner; /** * Partner Info * * User: Xulin Zhuang * Date: 29/1/2018 * Time: 12:55 PM */ public class PartnerInfo { final static String format = "JSON"; final static String pay_action = "/pay/redeem_code"; final static String movie_action = "/movie"; final static String httpPostMethod = "POST"; final static String httpGetMethod = "GET"; final static String pid = "TEST_PID"; final static String codeType = "m1"; final static String accessSecret = "TEST_ACCESS_SECRET"; final static String version = "v1"; }
[ "zhuangxulin@vcinema.cn" ]
zhuangxulin@vcinema.cn
02c2ff0b263ad2b5752f7cea7fc10c003ed025aa
216f5a020c413fc3462a6c93468e454d3f070b9f
/src/main/java/com/aimacademyla/model/enums/BillableUnitType.java
a0cdd0147b0e1ddbf4e00fd9510424036da736d1
[ "MIT" ]
permissive
dybkim/aimacademy_webapp
1b6b4674264ca7da91fc57e017ca8d840c296d98
ff7fbf7b42fcd7ba4830768ef71ced450b4e192e
refs/heads/master
2022-12-22T17:50:28.167260
2020-08-21T03:24:43
2020-08-21T03:24:43
100,982,597
0
0
MIT
2022-12-16T08:38:11
2017-08-21T18:52:38
Java
UTF-8
Java
false
false
602
java
package com.aimacademyla.model.enums; public enum BillableUnitType{ PER_HOUR("hour"), PER_SESSION("session"), ERROR("error"); private String type; BillableUnitType(String type){ this.type = type; } public String toString(){ return type; } public static BillableUnitType parseString(String type){ type = type.toLowerCase(); switch(type){ case "hour": return PER_HOUR; case "session": return PER_SESSION; default: return ERROR; } } }
[ "dybkim@gmail.com" ]
dybkim@gmail.com
4f2ceaa059e9265a9cb6e02ef8ef15c3bca073d2
dd9b689741f11923591d967b60af523ae6544a4b
/mingrui-shop-parent/mingrui-shop-service-api/mingrui-shop-service-api-user/src/main/java/com/baidu/shop/dto/UserDTO.java
592889cf23a0b76f8767cffc53b7be6269f17236
[]
no_license
lushenshen/mr-shop
88036fbfedd5977ebcdef825032c2cd6872aa078
ff70d93521ce0652b2fe85f862b9bdc9795bfe61
refs/heads/master
2023-01-01T01:17:25.146354
2020-10-15T06:46:13
2020-10-15T06:46:13
290,692,537
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
package com.baidu.shop.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; /** * @ClassName UserDTO * @Description: TODO * @Author shenyaqi * @Date 2020/9/20 * @Version V1.0 **/ @Data @ApiModel(value = "用户DTO") public class UserDTO { @ApiModelProperty(value = "用户主键",example = "1") private Integer id; @ApiModelProperty(value = "账户") private String username; @ApiModelProperty(value = "密码") private String password; @ApiModelProperty(value = "手机号") private String phone; private Date created; private String salt; }
[ "3188490799@qq.com" ]
3188490799@qq.com
6ed847f68526e965c103af83a3ad844a88626d87
e135c80892fe5cf75e31ba70a9cb869fd2c20c07
/02.Databases_Fundamentals_2016/02.Databases_Advanced_Hibernate/06.Hibernate_Midterm_Exam/mass-defect-exam/src/main/java/massdefect/app/repositories/PlanetRepository.java
0dec10bde11da393e70052104c73ab3532f20208
[]
no_license
NikolayShaliavski/SoftUni
444f3ec76886af21e84d472631ca56c958453570
08b8b345ebbef8de87db777ad59fb7c5044f1003
refs/heads/master
2021-06-22T00:30:49.970663
2021-01-08T15:20:44
2021-01-08T15:20:44
63,480,683
2
0
null
null
null
null
UTF-8
Java
false
false
604
java
package massdefect.app.repositories; import massdefect.app.domain.entities.planets.Planet; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface PlanetRepository extends JpaRepository<Planet,Long> { Planet findByName(String name); @Query(value = "SELECT pl FROM Anomaly AS a " + "RIGHT OUTER JOIN a.originPlanet AS pl " + "WHERE a.originPlanet IS NULL") List<Planet> findPlanetsWithoutTeleports(); }
[ "nshaliavski@gmail.com" ]
nshaliavski@gmail.com
fa46c950ca8e8da307ef4cce4599295897b7783f
51050b91d06afd6070ec395c0b58d79e0cf21fe2
/mars/mips/instructions/syscalls/SyscallInputDialogString.java
d98eb2c2cf3b7b88416dbb6941e4292394c091be
[ "MIT" ]
permissive
saagarjha/MARS
80294a39b5a67cc4c83671b112ddb3890b1941cc
96159c432400f1566064be68c5c84c9997447577
refs/heads/master
2021-07-17T21:31:34.387922
2020-05-04T19:17:58
2020-05-04T19:17:58
130,517,812
3
1
null
null
null
null
UTF-8
Java
false
false
4,848
java
package mars.mips.instructions.syscalls; import mars.util.*; import mars.mips.hardware.*; import mars.simulator.*; import mars.*; import javax.swing.JOptionPane; /* Copyright (c) 2003-2008, Pete Sanderson and Kenneth Vollmar Developed by Pete Sanderson (psanderson@otterbein.edu) and Kenneth Vollmar (kenvollmar@missouristate.edu) 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. (MIT license, http://www.opensource.org/licenses/mit-license.html) */ /** * Service to input data. * */ public class SyscallInputDialogString extends AbstractSyscall { /** * Build an instance of the syscall with its default service number and name. */ public SyscallInputDialogString() { super(54, "InputDialogString"); } /** * System call to input data. */ public void simulate(ProgramStatement statement) throws ProcessingException { // Input arguments: // $a0 = address of null-terminated string that is the message to user // $a1 = address of input buffer for the input string // $a2 = maximum number of characters to read // Outputs: // $a1 contains status value // 0: valid input data, correctly parsed // -1: input data cannot be correctly parsed // -2: Cancel was chosen // -3: OK was chosen but no data had been input into field String message = new String(); // = ""; int byteAddress = RegisterFile.getValue(4); // byteAddress of string is in $a0 char ch[] = {' '}; // Need an array to convert to String try { ch[0] = (char)Globals.memory.getByte(byteAddress); while (ch[0] != 0) // only uses single location ch[0] { message = message.concat(new String(ch)); // parameter to String constructor is a char[] array byteAddress++; ch[0] = (char)Globals.memory.getByte(byteAddress); } } catch (AddressErrorException e) { throw new ProcessingException(statement, e); } // Values returned by Java's InputDialog: // A null return value means that "Cancel" was chosen rather than OK. // An empty string returned (that is, inputString.length() of zero) // means that OK was chosen but no string was input. String inputString = null; inputString = JOptionPane.showInputDialog(message); byteAddress = RegisterFile.getValue(5); // byteAddress of string is in $a1 int maxLength = RegisterFile.getValue(6); // input buffer size for input string is in $a2 try { if (inputString == null) // Cancel was chosen { RegisterFile.updateRegister(5, -2); // set $a1 to -2 flag } else if (inputString.length() == 0) // OK was chosen but there was no input { RegisterFile.updateRegister(5, -3); // set $a1 to -3 flag } else { // The buffer will contain characters, a '\n' character, and the null character // Copy the input data to buffer as space permits for (int index = 0; (index < inputString.length()) && (index < maxLength - 1); index++) { Globals.memory.setByte(byteAddress + index, inputString.charAt(index)); } if (inputString.length() < maxLength - 1) { Globals.memory.setByte(byteAddress + (int)Math.min(inputString.length(), maxLength - 2), '\n'); // newline at string end } Globals.memory.setByte(byteAddress + (int)Math.min((inputString.length() + 1), maxLength - 1), 0); // null char to end string if (inputString.length() > maxLength - 1) { // length of the input string exceeded the specified maximum RegisterFile.updateRegister(5, -4); // set $a1 to -4 flag } else { RegisterFile.updateRegister(5, 0); // set $a1 to 0 flag } } // end else } // end try catch (AddressErrorException e) { throw new ProcessingException(statement, e); } } }
[ "saagar@saagarjha.com" ]
saagar@saagarjha.com
f7e72ee3713fd1296b5303782bb68aef5796ba34
0395edb5677d1e83677b27248d49e7e76f78c873
/app/src/main/java/guo/edwin/wisdomapp/GuideActivity.java
6597571fba44d90ad24503bc89d7a2a33c498568
[]
no_license
EdwinGuo/WisdomApp
85202ad3d8624842f53b084219fc54dcb8089ab6
473acc4ccef1f1cceec71b223c114e25c5f69648
refs/heads/master
2020-06-16T05:23:48.993150
2016-12-23T14:58:03
2016-12-23T14:58:03
75,242,397
0
0
null
null
null
null
UTF-8
Java
false
false
5,261
java
package guo.edwin.wisdomapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import java.util.ArrayList; import guo.edwin.wisdomapp.Utils.Helper; /** * Created by EdwinGuo on 2016-12-01. */ public class GuideActivity extends Activity { // viewPager hold the guide images ViewPager guideVP; // image array list to hold all the guide images int[] guideImages = new int[]{R.drawable.guide_image_1, R.drawable.guide_image_2, R.drawable.guide_image_3}; // image view to hold to image ArrayList<ImageView> guideImgViews = new ArrayList<ImageView>(); // linear layout for the grey/red points LinearLayout guide_ll; // get the red point View guide_red_point; float mPointWidth; // guide button Button guide_button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.acitivity_guide); guideVP = (ViewPager) findViewById(R.id.guide_vp); guide_ll = (LinearLayout) findViewById(R.id.guide_ll_btn_group); guide_red_point = (View) findViewById(R.id.guide_ll_point_red); initView(); guideVP.setAdapter(new GuidePager()); guide_button = (Button) findViewById(R.id.guide_btn); guideVP.setOnPageChangeListener(new GuidePageListener()); guide_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Helper.updatePreference(GuideActivity.this); System.out.println("What is the preference from guide? " + Helper.jumpToGuide(GuideActivity.this)); startActivity(new Intent(GuideActivity.this, MainActivity.class)); finish(); } }); } public void initView(){ // instantinate the images as well as the guide // points for(int i=0; i<guideImages.length; i++){ ImageView guideV = new ImageView(this); guideV.setImageResource(guideImages[i]); guideImgViews.add(guideV); // instantinate the points View greyPointView = new View(this); LinearLayout.LayoutParams guide_llp = new LinearLayout.LayoutParams(38, 38); if(i > 0){ guide_llp.leftMargin = 25; } greyPointView.setLayoutParams(guide_llp); greyPointView.setBackgroundResource(R.drawable.guide_grey_point); guide_ll.addView(greyPointView); } // retrieve view tree, set listener for after layout event finish guide_ll.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { System.out.println("layout finish"); guide_ll.getViewTreeObserver() .removeGlobalOnLayoutListener(this); mPointWidth = guide_ll.getChildAt(1).getLeft() - guide_ll.getChildAt(0).getLeft(); System.out.println("point distance:" + mPointWidth); } }); } class GuidePageListener implements ViewPager.OnPageChangeListener { // scroll event @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int len = (int) (mPointWidth * positionOffset + position * mPointWidth); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) guide_red_point .getLayoutParams(); params.leftMargin = len; guide_red_point.setLayoutParams(params); } @Override public void onPageSelected(int position) { if (position == (guideImages.length - 1)){ guide_button.setVisibility(View.VISIBLE); } } @Override public void onPageScrollStateChanged(int state) { } } public class GuidePager extends PagerAdapter{ @Override public int getCount() { return guideImgViews.size(); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public Object instantiateItem(ViewGroup container, int position){ container.addView(guideImgViews.get(position)); return guideImgViews.get(position); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } } }
[ "zijing.guo@scotiabank.com" ]
zijing.guo@scotiabank.com
c1014659e72594e9c0c65f379e1f54c35a499b6b
1fa2be0b9d62e6c8c99825fceacab19916e50e45
/ZhihuDaily/app/src/main/java/info/saberlion/zhihudaily/ui/MainActivity.java
4cf82e35257d31bb33d3badaa36ff0556e34562f
[]
no_license
Saberlion/learning-android
c17ff7d3735713ef1ce49ea4f56bec77914b64a9
94492e23fbf6ac1b63c85e703e76405599cec822
refs/heads/master
2021-01-10T15:29:36.380146
2015-11-11T15:15:06
2015-11-11T15:15:06
45,122,503
0
0
null
null
null
null
UTF-8
Java
false
false
6,840
java
package info.saberlion.zhihudaily.ui; import android.content.res.Configuration; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Locale; import info.saberlion.zhihudaily.R; import info.saberlion.zhihudaily.utils.IntentUtils; import info.saberlion.zhihudaily.utils.ToastUtils; public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener { final static String TAG = MainActivity.class.getName(); ViewPager viewPager; DatePagerAdapter datePagerAdapter; TabLayout tabLayout; protected int provideContentViewId() { return R.layout.activity_main; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate : "); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); viewPager = (ViewPager) findViewById(R.id.pager); datePagerAdapter = new DatePagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(datePagerAdapter); tabLayout = (TabLayout) findViewById(R.id.sliding_tabs); tabLayout.setupWithViewPager(viewPager); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Log.i(TAG, "onConfigurationChanged : " ); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @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(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { // Handle the camera action } else if (id == R.id.nav_gallery) { } else if (id == R.id.nav_slideshow) { } else if (id == R.id.nav_manage) { } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { }else if (id == R.id.nav_github) { IntentUtils.openAbout(this); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } /** * 实现再按一次退出提醒 */ private long exitTime = 0; @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { if ((System.currentTimeMillis() - exitTime) > 3000) { ToastUtils.showShort(R.string.exit_toast); exitTime = System.currentTimeMillis(); } else { finish(); System.exit(0); } return true; } return super.onKeyDown(keyCode, event); } private class DatePagerAdapter extends FragmentPagerAdapter { List<String> titles = new ArrayList<>(); List<String> DateArray = new ArrayList<>(); public DatePagerAdapter(FragmentManager fm) { super(fm); for(int i = 0;i <7;i++){ Calendar date = Calendar.getInstance(); date.add(Calendar.DAY_OF_YEAR, 1 - i); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd", Locale.US); String dateStr = simpleDateFormat.format(date.getTime()); if(i == 0){ titles.add("今日热点"); } else{ titles.add(dateStr); } DateArray.add(dateStr); } } @Override public Fragment getItem(int position) { Fragment fragment = new ContextListFragment(); Bundle bundle = new Bundle(); bundle.putString("date",DateArray.get(position)); fragment.setArguments(bundle); return fragment; } @Override public int getCount() { return DateArray.size(); } @Override public CharSequence getPageTitle(int position) { return titles.get(position); } } }
[ "fxre@qq.com" ]
fxre@qq.com
723330c5c92831e006dd7e3e00aa5c008ab65ca3
9053740a414c614b64c25f32212c2adbf4ad5d5a
/subprojects/core/src/main/groovy/org/gradle/api/internal/tasks/options/OptionElement.java
8e2051dd94170ed289265792d2d1607aa59d0503
[]
no_license
leex4418/gradle
fc27396db3dcb9943af400366634c5db6b7918da
3d67208cfa6b91f946c75ca0da75070297df67af
refs/heads/master
2021-01-15T14:37:27.569245
2013-11-13T05:21:52
2013-11-13T05:21:52
14,357,493
1
0
null
null
null
null
UTF-8
Java
false
false
971
java
/* * Copyright 2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gradle.api.internal.tasks.options; import java.util.List; public interface OptionElement { Class<?> getDeclaredClass(); List getAvailableValues(); Class<?> getOptionType(); String getElementName(); String getOptionName(); void apply(Object object, List<String> parameterValues); String getDescription(); }
[ "rene@breskeby.com" ]
rene@breskeby.com
eba1828056b71565083ddb962ee3d183a69eff49
c4902cb4c54ad0337bf2ccb98aa4486a4c600510
/src/main/java/com/alsecotask/materialassets/model/Asset.java
f9fce318d233eaa463b9d4398289b10dc00ed3fd
[]
no_license
udrepo/material-assets
3c3d278fea63a60aecf5e8fd3d01dbaec49a8c70
94152221994d13f9ff350291f03d8a9481975c48
refs/heads/master
2023-08-18T23:25:19.911460
2021-09-20T05:46:48
2021-09-20T05:46:48
387,535,732
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
package com.alsecotask.materialassets.model; import lombok.*; import org.hibernate.annotations.Type; import javax.persistence.*; import java.util.UUID; @Entity @Table @Data public class Asset { @Id @GeneratedValue @Type(type="uuid-char") private UUID id; private String name; private double price; @ManyToOne(fetch= FetchType.EAGER) @JoinColumn(name="employee_id", referencedColumnName="id") private Employee employee; }
[ "ulan.0418@gmail.com" ]
ulan.0418@gmail.com
c024d34985fe2a7dec1f3655ae54728438b4f32b
6a1310207db6ca0516d9c0e54350ec10a291b705
/task-management/src/main/java/com/tr/task/aspect/LogingAspect.java
8a926de9604d3b02d7f06cd1831cf1fbaaa18b16
[]
no_license
ozaytunctan/task-management-repo
34344f9efce39f76637e34cedb940f7c31d6db82
1eec24a5a729d2406757291adc5d1c63d4c81459
refs/heads/master
2023-03-11T12:33:55.521872
2021-03-06T20:26:33
2021-03-06T20:26:33
341,481,676
0
0
null
null
null
null
UTF-8
Java
false
false
1,759
java
package com.tr.task.aspect; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import com.tr.task.utils.FactoryUtils; @Component @Aspect public class LogingAspect { private static final Logger LOGGER = LoggerFactory.getLogger(LogingAspect.class); @Pointcut("@annotation(com.tr.task.aspect.Loggable)") public void executeLogMethod() { }; // @Before("executeLogMethod()") // public void executeLogMetod(JoinPoint joinPoint) { // StringBuilder message = new StringBuilder(); // message.append(joinPoint.getSignature().getDeclaringTypeName()); // message.append("."); // message.append(joinPoint.getSignature().getName() + "()"); // // Object[] args = joinPoint.getArgs(); // // if (args != null && args.length > 0) { // // message.append(" args:[|"); // Arrays.asList(args).forEach(arg -> { // message.append(arg); // message.append("|"); // }); // message.append("]"); // } // // LOGGER.info(message.toString()); // // } @Around("@annotation(com.tr.task.aspect.Loggable)") public Object around(ProceedingJoinPoint joinPoint) throws Throwable { long startTime = FactoryUtils.tic(); StringBuilder message = new StringBuilder(); message.append(joinPoint.getSignature().getDeclaringTypeName()); message.append("."); message.append(joinPoint.getSignature().getName() + "()"); Object returnValue = joinPoint.proceed(); long elapsedTime = FactoryUtils.toc(startTime); LOGGER.info(message.toString()); LOGGER.info("Elapsed Time:" + elapsedTime + "ms"); return returnValue; } }
[ "ozaytunctan@gmail.com" ]
ozaytunctan@gmail.com
c2224cf8d5b41ad2ef9feda9f8c552a31a20c9a6
b59ba67780c63d8ce94911eae5d1f557b36b47db
/src/com/foxlink/realtime/service/OTPendingService.java
3a115352c9b1e867d26296b99c35015d54b78366
[]
no_license
Bigshen/RealTime-1
2d3790d90b4b6bc13bad49091ea17481724ded01
8784a3dc5fe9ee92d99ccd8e70c54bb24b4d5809
refs/heads/master
2023-05-13T11:02:18.496810
2023-05-08T07:51:30
2023-05-08T07:51:30
181,420,308
0
0
null
2023-05-08T07:51:31
2019-04-15T05:49:02
JavaScript
UTF-8
Java
false
false
4,066
java
package com.foxlink.realtime.service; import java.util.List; import org.apache.log4j.Logger; import com.foxlink.realtime.DAO.EmpOTPendingDAO; import com.foxlink.realtime.model.EmpInOTPendingSheet; import com.foxlink.realtime.util.CommonUtils; public class OTPendingService extends Service<EmpInOTPendingSheet> { private static Logger logger=Logger.getLogger(OTPendingService.class); private EmpOTPendingDAO empOTPendingDAO=null; public OTPendingService() { super(); } public void setEmpOTPendingDAO(EmpOTPendingDAO dao) { this.empOTPendingDAO=dao; } @Override public boolean AddNewRecord(EmpInOTPendingSheet t) { // TODO Auto-generated method stub return false; } @Override public boolean UpdateRecord(EmpInOTPendingSheet t) { // TODO Auto-generated method stub return false; } @Override public boolean DeleteRecord(String recordID, String updateUser) { // TODO Auto-generated method stub return false; } @Override public List<EmpInOTPendingSheet> FindAllRecords() { // TODO Auto-generated method stub return null; } public List<EmpInOTPendingSheet> FindAllRecords(String WorkshopNo,String LineNo,String RCNo,String CostID,String ClassNo, String SwipeCradDate,boolean isAbnormal){ List<EmpInOTPendingSheet> empOTPendingList=null; try { empOTPendingList=empOTPendingDAO.FindAllRecords(WorkshopNo,LineNo, RCNo, CostID, ClassNo, new CommonUtils().ConvertString2SQLDate(SwipeCradDate),isAbnormal); } catch(Exception ex) { logger.error("FindAllRecords is failed ",ex); } return empOTPendingList; } public List<EmpInOTPendingSheet> GetCalOverTime(String WorkshopNo,String LineNo,String RCNo,String AssistantAccount,String AssistantId,String ClassNo,int CheckState, String OverTimeDate,int OverTimeType,String ItemNumber,int isAbnormal){ List<EmpInOTPendingSheet> empOTPendingList=null; try { empOTPendingList=empOTPendingDAO.GetCalOverTime(WorkshopNo,LineNo, RCNo, AssistantAccount, AssistantId,ClassNo,CheckState, new CommonUtils().ConvertString2SQLDate(OverTimeDate),OverTimeType,ItemNumber,isAbnormal); } catch(Exception ex) { logger.error("FindAllRecords is failed ",ex); } return empOTPendingList; } @Override public List<EmpInOTPendingSheet> FindAllRecords(int currentPage, String queryCritirea, String queryParam) { // TODO Auto-generated method stub return null; } @Override public List<EmpInOTPendingSheet> FindRecord(EmpInOTPendingSheet t) { // TODO Auto-generated method stub return null; } @Override public List<EmpInOTPendingSheet> FindQueryRecord(String userDataCostId, int currentPage, EmpInOTPendingSheet t) { // TODO Auto-generated method stub return null; } @Override public List<EmpInOTPendingSheet> FindQueryRecords(String userDataCostId, EmpInOTPendingSheet t) { // TODO Auto-generated method stub return null; } public List<EmpInOTPendingSheet> FindAllRecordsByDepid(String WorkshopNo, String LineNo, String RCNo, String CostID, String ClassNo, String SwipeCradDate, boolean isAbnormal) { List<EmpInOTPendingSheet> empOTPendingList=null; try { empOTPendingList=empOTPendingDAO.FindAllRecordsByDepid(WorkshopNo,LineNo, RCNo, CostID, ClassNo, new CommonUtils().ConvertString2SQLDate(SwipeCradDate),isAbnormal); } catch(Exception ex) { logger.error("FindAllRecordsByDepid is failed ",ex); } return empOTPendingList; } public List<EmpInOTPendingSheet> GetCalOverTimeByDepid(String WorkshopNo,String LineNo,String RCNo,String AssistantAccount,String AssistantId,String ClassNo,int CheckState, String OverTimeDate,int OverTimeType,String ItemNumber,int isAbnormal) { List<EmpInOTPendingSheet> empOTPendingList=null; try { empOTPendingList=empOTPendingDAO.GetCalOverTimeByDepid(WorkshopNo,LineNo, RCNo, AssistantAccount, AssistantId,ClassNo,CheckState, new CommonUtils().ConvertString2SQLDate(OverTimeDate),OverTimeType,ItemNumber,isAbnormal); } catch(Exception ex) { logger.error("GetCalOverTimeByDepid is failed ",ex); } return empOTPendingList; } }
[ "34222206+asd3354389@users.noreply.github.com" ]
34222206+asd3354389@users.noreply.github.com
748f7ae7728f9837d2d1728b6f6412a81881b74d
93d56a23451663dad44a8e742f4df9d5080db868
/LMM_Support_src/main/java/modchu/lib/lmm/common/mc190_222/ModchuLmrModel.java
e42bf54ce645229df8fc6d9791c264e3d54a4dee
[]
no_license
Modchu/ModchuLib
29e77cbb6b303aa910c27da9a98bcfb5043e2b44
f32adbcad30da993ce337abeff2c135d7af1352d
refs/heads/master
2021-07-12T06:57:09.879558
2021-02-21T14:03:27
2021-02-21T14:03:27
7,611,520
5
2
null
2013-03-12T11:02:52
2013-01-14T19:57:43
Java
UTF-8
Java
false
false
14,753
java
package modchu.lib.lmm.common.mc190_222; import java.util.Map; import java.util.Random; import modchu.lib.Modchu_CastHelper; import modchu.lib.Modchu_Main; import modchu.lib.Modchu_Reflect; import modchu.model.ModchuModel_IEntityCaps; import modchu.model.ModchuModel_Main; import modchu.model.ModchuModel_ModelDataMaster; import modchu.model.ModchuModel_ModelRenderer; import modchu.model.multimodel.base.MultiModelBaseBiped; import net.blacklab.lmr.entity.maidmodel.IModelCaps; import net.blacklab.lmr.entity.maidmodel.ModelMultiBase; import net.blacklab.lmr.entity.maidmodel.ModelRenderer; import net.minecraft.client.model.TextureOffset; public class ModchuLmrModel extends ModelMultiBase { public MultiModelBaseBiped master; public ModelRenderer dummyModelRenderer; public ModchuLmrModel(Class<? extends MultiModelBaseBiped> masterClass) { init(masterClass, null, (Object[]) null); } public ModchuLmrModel(Class<? extends MultiModelBaseBiped> masterClass, float psize) { init(masterClass, new Class[]{ float.class }, psize); } public ModchuLmrModel(Class<? extends MultiModelBaseBiped> masterClass, float psize, float pYOffset) { init(masterClass, new Class[]{ float.class, float.class }, psize, pYOffset); } public ModchuLmrModel(Class<? extends MultiModelBaseBiped> masterClass, float psize, float pYOffset, int par3, int par4) { init(masterClass, new Class[]{ float.class, float.class, int.class, int.class }, psize, pYOffset, par3, par4); } public ModchuLmrModel(MultiModelBaseBiped masterModel) { init(masterModel, (Object[]) null); } public ModchuLmrModel(MultiModelBaseBiped masterModel, float psize) { init(masterModel, psize); } public ModchuLmrModel(MultiModelBaseBiped masterModel, float psize, float pyoffset) { init(masterModel, psize, pyoffset); } public ModchuLmrModel(MultiModelBaseBiped masterModel, float psize, float pyoffset, int par3, int par4) { init(masterModel, psize, pyoffset, par3, par4); } public void init(Class<? extends MultiModelBaseBiped> masterClass, Class[] c, Object... o) { if (masterClass != null) ;else throw new RuntimeException("Modchu_LmrModel init masterClass null !!"); Object instance = o != null ? Modchu_Reflect.newInstance(masterClass, c, o) : Modchu_Reflect.newInstance(masterClass); //Modchu_Debug.mDebug("Modchu_LmrModel instance="+instance); master = instance instanceof MultiModelBaseBiped ? (MultiModelBaseBiped) instance : null; if (master != null) ;else throw new RuntimeException("Modchu_LmrModel init master null !! masterClass=" + masterClass); initAfter(); } public void init(MultiModelBaseBiped masterModel, Object... o) { if (masterModel != null) ;else throw new RuntimeException("Modchu_LmrModel init masterModel null !!"); master = masterModel; initAfter(); } private void initAfter() { if (Modchu_Main.getMinecraftVersion() > 179) { ModelRenderer dummyModelRenderer = (ModelRenderer) Modchu_Main.newModchuCharacteristicObject("Modchu_LmrDummyModelRenderer", this); Arms = new ModelRenderer[]{ dummyModelRenderer, dummyModelRenderer }; //HeadMount = new ModelRenderer(this, "HeadMount"); //HeadTop = new ModelRenderer(this, "HeadTop"); } dummyModelRenderer = new ModelRenderer(this, 0, 0); dummyModelRenderer.addBox(0, 0, 0, 0, 0, 0, 0.0F); } public String getModelName() { return Modchu_Main.lastIndexProcessing(master.getClass().getSimpleName(), "_"); } private ModchuModel_IEntityCaps getModchu_IModelCaps(Object iModelCaps) { return ModchuModel_ModelDataMaster.instance.getPlayerData(iModelCaps); } public void worldEventLoad(Object event) { if (master != null) master.worldEventLoad(event); } @Override public void initModel(float psize, float pyoffset) { if (master != null) master.initModel(psize, pyoffset); } public void superInitModel(float psize, float pyoffset) { } @Override public float getHeight() { return master != null ? master.getHeight(null) : 1.6F; } public float superGetHeight() { return 1.62F; } @Override public float getWidth() { return master != null ? master.getWidth(null) : 0.8F; } public float superGetWidth() { return 0.8F; } @Override public float getyOffset() { return master != null ? master.getYOffset(null) : 1.62F; } public float superGetyOffset() { return 1.62F; } @Override public float getMountedYOffset() { return master != null ? master.getMountedYOffset(null) : 0.0F; } public float superGetMountedYOffset() { return 0.0F; } @Override public void renderItems(IModelCaps iModelCaps) { if (master != null) master.renderItems(getModchu_IModelCaps(iModelCaps)); } public void superRenderItems(Object iModelCaps) { } @Override public void renderFirstPersonHand(IModelCaps iModelCaps) { if (master != null) master.renderFirstPersonHand(getModchu_IModelCaps(iModelCaps), 0); } public void superRenderFirstPersonHand(Object iModelCaps) { } @Override public float[] getArmorModelsSize() { return master.getArmorModelsSize(); } @Override public float getHeight(IModelCaps iModelCaps) { return master != null ? master.getHeight(getModchu_IModelCaps(iModelCaps)) : super.getHeight(iModelCaps); } @Override public float getWidth(IModelCaps iModelCaps) { return master != null ? master.getWidth(getModchu_IModelCaps(iModelCaps)) : super.getWidth(iModelCaps); } @Override public float getyOffset(IModelCaps iModelCaps) { return master != null ? master.getYOffset(getModchu_IModelCaps(iModelCaps)) : super.getyOffset(iModelCaps); } @Override public float getMountedYOffset(IModelCaps iModelCaps) { return master != null ? master.getMountedYOffset(getModchu_IModelCaps(iModelCaps)) : super.getMountedYOffset(iModelCaps); } @Override public float getLeashOffset(IModelCaps iModelCaps) { return master != null ? master.getLeashOffset(getModchu_IModelCaps(iModelCaps)) : super.getLeashOffset(iModelCaps); } @Override public String getUsingTexture() { return master != null ? master.getUsingTexture() : super.getUsingTexture(); } public String superGetUsingTexture() { return super.getUsingTexture(); } @Override public boolean isItemHolder() { return master != null ? master.isItemHolder(null) : super.isItemHolder(); } public boolean superIsItemHolder() { return super.isItemHolder(); } @Override public boolean isItemHolder(IModelCaps iModelCaps) { return master != null ? master.isItemHolder(getModchu_IModelCaps(iModelCaps)) : super.isItemHolder(iModelCaps); } public boolean superIsItemHolder(Object iModelCaps) { return super.isItemHolder((IModelCaps) iModelCaps); } @Override public void showAllParts() { if (master != null) master.showAllParts(null); else super.showAllParts(); } public void superShowAllParts() { super.showAllParts(); } @Override public void showAllParts(IModelCaps iModelCaps) { if (master != null) master.showAllParts(getModchu_IModelCaps(iModelCaps)); else super.showAllParts(iModelCaps); } public void superShowAllParts(Object iModelCaps) { super.showAllParts((IModelCaps) iModelCaps); } @Override public int showArmorParts(int parts, int index) { return master != null ? master.showArmorParts(null, parts, index) : super.showArmorParts(parts, index); } public int superShowArmorParts(int parts, int index) { return super.showArmorParts(parts, index); } @Override public Map<String, Integer> getModelCaps() { return (Map<String, Integer>) super.getModelCaps(); } public Map<String, Integer> superGetModelCaps() { return super.getModelCaps(); } @Override public Object getCapsValue(int pIndex, Object... pArg) { return master != null ? master.getCapsValue(pIndex, pArg) : super.getCapsValue(pIndex, pArg); } public Object superGetCapsValue(int pIndex, Object... pArg) { return super.getCapsValue(pIndex, pArg); } @Override public boolean setCapsValue(int pIndex, Object... pArg) { return master != null ? master.setCapsValue(pIndex, pArg) : super.setCapsValue(pIndex, pArg); } public boolean superSetCapsValue(int pIndex, Object... pArg) { return super.setCapsValue(pIndex, pArg); } @Override public void render(IModelCaps iModelCaps, float par2, float par3, float ticksExisted, float pheadYaw, float pheadPitch, float par7, boolean pIsRender) { String eventName = "modchuLmrModelRenderBefore"; boolean isCanceled = false; if (ModchuModel_Main.modchuLibEvent(eventName)) { boolean flag = true; Object[] o = ModchuModel_Main.modchuLibEvent(eventName, new Object[]{ iModelCaps, par2, par3, ticksExisted, pheadYaw, pheadPitch, par7, pIsRender, this }); if (o != null) { if (o.length > 0) isCanceled = Modchu_CastHelper.Boolean(o[0]); else if (o.length > 1) iModelCaps = (IModelCaps) o[1]; else if (o.length > 2) par2 = Modchu_CastHelper.Float(o[2]); else if (o.length > 3) par3 = Modchu_CastHelper.Float(o[3]); else if (o.length > 4) ticksExisted = Modchu_CastHelper.Float(o[4]); else if (o.length > 5) pheadYaw = Modchu_CastHelper.Float(o[5]); else if (o.length > 6) pheadPitch = Modchu_CastHelper.Float(o[6]); else if (o.length > 7) par7 = Modchu_CastHelper.Float(o[7]); else if (o.length > 8) pIsRender = Modchu_CastHelper.Boolean(o[8]); } } if (isCanceled) return; if (master != null) { master.render(getModchu_IModelCaps(iModelCaps), par2, par3, ticksExisted, pheadYaw, pheadPitch, par7, pIsRender); renderItems(iModelCaps); } else super.render(iModelCaps, par2, par3, ticksExisted, pheadYaw, pheadPitch, par7, pIsRender); eventName = "modchuLmrModelRenderAfter"; if (ModchuModel_Main.modchuLibEvent(eventName)) ModchuModel_Main.modchuLibEvent(eventName, new Object[]{ iModelCaps, par2, par3, ticksExisted, pheadYaw, pheadPitch, par7, pIsRender, this }); } public void superRender(Object iModelCaps, float par2, float par3, float ticksExisted, float pheadYaw, float pheadPitch, float par7, boolean pIsRender) { super.render((IModelCaps) iModelCaps, par2, par3, ticksExisted, pheadYaw, pheadPitch, par7, pIsRender); } @Override public void setRotationAngles(float par1, float par2, float pTicksExisted, float pHeadYaw, float pHeadPitch, float par6, IModelCaps iModelCaps) { String eventName = "modchuLmrModelSetRotationAnglesBefore"; boolean isCanceled = false; if (ModchuModel_Main.modchuLibEvent(eventName)) { boolean flag = true; Object[] o = ModchuModel_Main.modchuLibEvent(eventName, new Object[]{ par1, par2, pTicksExisted, pHeadYaw, pHeadPitch, par6, iModelCaps, this }); if (o != null) { if (o.length > 0) isCanceled = Modchu_CastHelper.Boolean(o[0]); else if (o.length > 1) par1 = Modchu_CastHelper.Float(o[1]); else if (o.length > 2) par2 = Modchu_CastHelper.Float(o[2]); else if (o.length > 3) pTicksExisted = Modchu_CastHelper.Float(o[3]); else if (o.length > 4) pHeadYaw = Modchu_CastHelper.Float(o[4]); else if (o.length > 5) pHeadPitch = Modchu_CastHelper.Float(o[5]); else if (o.length > 6) par6 = Modchu_CastHelper.Float(o[6]); else if (o.length > 7) iModelCaps = (IModelCaps) o[7]; } } if (isCanceled) return; if (master != null) master.setRotationAngles(par1, par2, pTicksExisted, pHeadYaw, pHeadPitch, par6, getModchu_IModelCaps(iModelCaps)); else super.setRotationAngles(par1, par2, pTicksExisted, pHeadYaw, pHeadPitch, par6, iModelCaps); eventName = "modchuLmrModelSetRotationAnglesAfter"; if (ModchuModel_Main.modchuLibEvent(eventName)) ModchuModel_Main.modchuLibEvent(eventName, new Object[]{ par1, par2, pTicksExisted, pHeadYaw, pHeadPitch, par6, iModelCaps, this }); } public void superSetRotationAngles(float par1, float par2, float pTicksExisted, float pHeadYaw, float pHeadPitch, float par6, Object iModelCaps) { super.setRotationAngles(par1, par2, pTicksExisted, pHeadYaw, pHeadPitch, par6, (IModelCaps) iModelCaps); } @Override public void setLivingAnimations(IModelCaps iModelCaps, float par2, float par3, float pRenderPartialTicks) { String eventName = "modchuLmrModelSetLivingAnimationsBefore"; boolean isCanceled = false; if (ModchuModel_Main.modchuLibEvent(eventName)) { boolean flag = true; Object[] o = ModchuModel_Main.modchuLibEvent(eventName, new Object[]{ iModelCaps, par2, par3, pRenderPartialTicks, this }); if (o != null) { if (o.length > 0) isCanceled = Modchu_CastHelper.Boolean(o[0]); else if (o.length > 1) iModelCaps = (IModelCaps) o[1]; else if (o.length > 2) par2 = Modchu_CastHelper.Float(o[2]); else if (o.length > 3) par3 = Modchu_CastHelper.Float(o[3]); else if (o.length > 4) pRenderPartialTicks = Modchu_CastHelper.Float(o[4]); } } if (isCanceled) return; if (master != null) master.setLivingAnimations(getModchu_IModelCaps(iModelCaps), par2, par3, pRenderPartialTicks); else super.setLivingAnimations(iModelCaps, par2, par3, pRenderPartialTicks); eventName = "modchuLmrModelSetLivingAnimationsAfter"; if (ModchuModel_Main.modchuLibEvent(eventName)) ModchuModel_Main.modchuLibEvent(eventName, new Object[]{ iModelCaps, par2, par3, pRenderPartialTicks, this }); } public void superSetLivingAnimations(Object iModelCaps, float par2, float par3, float pRenderPartialTicks) { super.setLivingAnimations((IModelCaps) iModelCaps, par2, par3, pRenderPartialTicks); } @Override public ModelRenderer getRandomModelBox(Random random) { if (master != null) { Object o = master.getRandomModelBox(random); if (o != null && o instanceof ModchuModel_ModelRenderer) { ModchuModel_ModelRenderer modelRenderer = (ModchuModel_ModelRenderer) o; dummyModelRenderer.setRotationPoint(modelRenderer.rotationPointX, modelRenderer.rotationPointY, modelRenderer.rotationPointZ); } } return dummyModelRenderer; } public ModelRenderer superGetRandomModelBox(Object random) { return super.getRandomModelBox((Random) random); } /* @Override protected void setTextureOffset(String par1Str, int par2, int par3) { if (master != null) master.setTextureOffset(par1Str, par2, par3); else super.setTextureOffset(par1Str, par2, par3); } public void superSetTextureOffset(String par1Str, int par2, int par3) { super.setTextureOffset(par1Str, par2, par3); } */ @Override public TextureOffset getTextureOffset(String par1Str) { return (TextureOffset) super.getTextureOffset(par1Str); } public TextureOffset superGetTextureOffset(String par1Str) { return super.getTextureOffset(par1Str); } /* @Override public boolean canSpawnHear(World world, int pX, int pY, int pZ) { return master != null ? master.canSpawnHear(world, pX, pY, pZ) : super.canSpawnHear(world, pX, pY, pZ); } public boolean superCanSpawnHear(Object world, int pX, int pY, int pZ) { return super.canSpawnHear((World) world, pX, pY, pZ); } */ }
[ "kawd82jstskl@yahoo.co.jp" ]
kawd82jstskl@yahoo.co.jp
790463bf7800d88bcdbce7ba0754b91068ed7977
e42afd54dcc0add3d2b8823ee98a18c50023a396
/java-gkehub/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1beta1/GkeHubMembershipServiceClient.java
a7d376be1d585e30c4d4f7dd6a1365877b91af97
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
degloba/google-cloud-java
eea41ebb64f4128583533bc1547e264e730750e2
b1850f15cd562c659c6e8aaee1d1e65d4cd4147e
refs/heads/master
2022-07-07T17:29:12.510736
2022-07-04T09:19:33
2022-07-04T09:19:33
180,201,746
0
0
Apache-2.0
2022-07-04T09:17:23
2019-04-08T17:42:24
Java
UTF-8
Java
false
false
45,649
java
/* * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.gkehub.v1beta1; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.gkehub.v1beta1.stub.GkeHubMembershipServiceStub; import com.google.cloud.gkehub.v1beta1.stub.GkeHubMembershipServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: The GKE Hub MembershipService handles the registration of many Kubernetes * clusters to Google Cloud, represented with the * [Membership][google.cloud.gkehub.v1beta1.Membership] resource. * * <p>GKE Hub is currently only available in the global region. * * <p>&#42;&#42;Membership management may be non-trivial:&#42;&#42; it is recommended to use one of * the Google-provided client libraries or tools where possible when working with Membership * resources. * * <p>This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * String name = "name3373707"; * Membership response = gkeHubMembershipServiceClient.getMembership(name); * } * }</pre> * * <p>Note: close() needs to be called on the GkeHubMembershipServiceClient object to clean up * resources such as threads. In the example above, try-with-resources is used, which automatically * calls close(). * * <p>The surface of this class includes several types of Java methods for each of the API's * methods: * * <ol> * <li>A "flattened" method. With this type of method, the fields of the request type have been * converted into function parameters. It may be the case that not all fields are available as * parameters, and not every API method will have a flattened method entry point. * <li>A "request object" method. This type of method only takes one parameter, a request object, * which must be constructed before the call. Not every API method will have a request object * method. * <li>A "callable" method. This type of method takes no parameters and returns an immutable API * callable object, which can be used to initiate calls to the service. * </ol> * * <p>See the individual methods for example code. * * <p>Many parameters require resource names to be formatted in a particular way. To assist with * these names, this class includes a format method for each type of name, and additionally a parse * method to extract the individual identifiers contained within names that are returned. * * <p>This class can be customized by passing in a custom instance of * GkeHubMembershipServiceSettings to create(). For example: * * <p>To customize credentials: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * GkeHubMembershipServiceSettings gkeHubMembershipServiceSettings = * GkeHubMembershipServiceSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) * .build(); * GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create(gkeHubMembershipServiceSettings); * }</pre> * * <p>To customize the endpoint: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * GkeHubMembershipServiceSettings gkeHubMembershipServiceSettings = * GkeHubMembershipServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); * GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create(gkeHubMembershipServiceSettings); * }</pre> * * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @Generated("by gapic-generator-java") public class GkeHubMembershipServiceClient implements BackgroundResource { private final GkeHubMembershipServiceSettings settings; private final GkeHubMembershipServiceStub stub; private final OperationsClient operationsClient; /** Constructs an instance of GkeHubMembershipServiceClient with default settings. */ public static final GkeHubMembershipServiceClient create() throws IOException { return create(GkeHubMembershipServiceSettings.newBuilder().build()); } /** * Constructs an instance of GkeHubMembershipServiceClient, using the given settings. The channels * are created based on the settings passed in, or defaults for any settings that are not set. */ public static final GkeHubMembershipServiceClient create(GkeHubMembershipServiceSettings settings) throws IOException { return new GkeHubMembershipServiceClient(settings); } /** * Constructs an instance of GkeHubMembershipServiceClient, using the given stub for making calls. * This is for advanced usage - prefer using create(GkeHubMembershipServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final GkeHubMembershipServiceClient create(GkeHubMembershipServiceStub stub) { return new GkeHubMembershipServiceClient(stub); } /** * Constructs an instance of GkeHubMembershipServiceClient, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GkeHubMembershipServiceClient(GkeHubMembershipServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((GkeHubMembershipServiceStubSettings) settings.getStubSettings()).createStub(); this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected GkeHubMembershipServiceClient(GkeHubMembershipServiceStub stub) { this.settings = null; this.stub = stub; this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } public final GkeHubMembershipServiceSettings getSettings() { return settings; } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public GkeHubMembershipServiceStub getStub() { return stub; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ public final OperationsClient getOperationsClient() { return operationsClient; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Memberships in a given project and location. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * String parent = "parent-995424086"; * for (Membership element : * gkeHubMembershipServiceClient.listMemberships(parent).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param parent Required. The parent (project and location) where the Memberships will be listed. * Specified in the format `projects/&#42;/locations/&#42;`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMembershipsPagedResponse listMemberships(String parent) { ListMembershipsRequest request = ListMembershipsRequest.newBuilder().setParent(parent).build(); return listMemberships(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Memberships in a given project and location. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * ListMembershipsRequest request = * ListMembershipsRequest.newBuilder() * .setParent("parent-995424086") * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .setFilter("filter-1274492040") * .setOrderBy("orderBy-1207110587") * .build(); * for (Membership element : * gkeHubMembershipServiceClient.listMemberships(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMembershipsPagedResponse listMemberships(ListMembershipsRequest request) { return listMembershipsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Memberships in a given project and location. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * ListMembershipsRequest request = * ListMembershipsRequest.newBuilder() * .setParent("parent-995424086") * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .setFilter("filter-1274492040") * .setOrderBy("orderBy-1207110587") * .build(); * ApiFuture<Membership> future = * gkeHubMembershipServiceClient.listMembershipsPagedCallable().futureCall(request); * // Do something. * for (Membership element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<ListMembershipsRequest, ListMembershipsPagedResponse> listMembershipsPagedCallable() { return stub.listMembershipsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Memberships in a given project and location. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * ListMembershipsRequest request = * ListMembershipsRequest.newBuilder() * .setParent("parent-995424086") * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .setFilter("filter-1274492040") * .setOrderBy("orderBy-1207110587") * .build(); * while (true) { * ListMembershipsResponse response = * gkeHubMembershipServiceClient.listMembershipsCallable().call(request); * for (Membership element : response.getResponsesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<ListMembershipsRequest, ListMembershipsResponse> listMembershipsCallable() { return stub.listMembershipsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the details of a Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * String name = "name3373707"; * Membership response = gkeHubMembershipServiceClient.getMembership(name); * } * }</pre> * * @param name Required. The Membership resource name in the format * `projects/&#42;/locations/&#42;/memberships/&#42;`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership getMembership(String name) { GetMembershipRequest request = GetMembershipRequest.newBuilder().setName(name).build(); return getMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the details of a Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * GetMembershipRequest request = * GetMembershipRequest.newBuilder().setName("name3373707").build(); * Membership response = gkeHubMembershipServiceClient.getMembership(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership getMembership(GetMembershipRequest request) { return getMembershipCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the details of a Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * GetMembershipRequest request = * GetMembershipRequest.newBuilder().setName("name3373707").build(); * ApiFuture<Membership> future = * gkeHubMembershipServiceClient.getMembershipCallable().futureCall(request); * // Do something. * Membership response = future.get(); * } * }</pre> */ public final UnaryCallable<GetMembershipRequest, Membership> getMembershipCallable() { return stub.getMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * register other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * String parent = "parent-995424086"; * Membership resource = Membership.newBuilder().build(); * String membershipId = "membershipId517665681"; * Membership response = * gkeHubMembershipServiceClient.createMembershipAsync(parent, resource, membershipId).get(); * } * }</pre> * * @param parent Required. The parent (project and location) where the Memberships will be * created. Specified in the format `projects/&#42;/locations/&#42;`. * @param resource Required. The membership to create. * @param membershipId Required. Client chosen ID for the membership. `membership_id` must be a * valid RFC 1123 compliant DNS label: * <p>1. At most 63 characters in length 2. It must consist of lower case alphanumeric * characters or `-` 3. It must start and end with an alphanumeric character * <p>Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]&#42;[a-z0-9])?`, with a maximum * length of 63 characters. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Membership, OperationMetadata> createMembershipAsync( String parent, Membership resource, String membershipId) { CreateMembershipRequest request = CreateMembershipRequest.newBuilder() .setParent(parent) .setResource(resource) .setMembershipId(membershipId) .build(); return createMembershipAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * register other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * CreateMembershipRequest request = * CreateMembershipRequest.newBuilder() * .setParent("parent-995424086") * .setMembershipId("membershipId517665681") * .setResource(Membership.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); * Membership response = gkeHubMembershipServiceClient.createMembershipAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Membership, OperationMetadata> createMembershipAsync( CreateMembershipRequest request) { return createMembershipOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * register other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * CreateMembershipRequest request = * CreateMembershipRequest.newBuilder() * .setParent("parent-995424086") * .setMembershipId("membershipId517665681") * .setResource(Membership.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); * OperationFuture<Membership, OperationMetadata> future = * gkeHubMembershipServiceClient.createMembershipOperationCallable().futureCall(request); * // Do something. * Membership response = future.get(); * } * }</pre> */ public final OperationCallable<CreateMembershipRequest, Membership, OperationMetadata> createMembershipOperationCallable() { return stub.createMembershipOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * register other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * CreateMembershipRequest request = * CreateMembershipRequest.newBuilder() * .setParent("parent-995424086") * .setMembershipId("membershipId517665681") * .setResource(Membership.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); * ApiFuture<Operation> future = * gkeHubMembershipServiceClient.createMembershipCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<CreateMembershipRequest, Operation> createMembershipCallable() { return stub.createMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes a Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * unregister other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * String name = "name3373707"; * gkeHubMembershipServiceClient.deleteMembershipAsync(name).get(); * } * }</pre> * * @param name Required. The Membership resource name in the format * `projects/&#42;/locations/&#42;/memberships/&#42;`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Empty, OperationMetadata> deleteMembershipAsync(String name) { DeleteMembershipRequest request = DeleteMembershipRequest.newBuilder().setName(name).build(); return deleteMembershipAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes a Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * unregister other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * DeleteMembershipRequest request = * DeleteMembershipRequest.newBuilder() * .setName("name3373707") * .setRequestId("requestId693933066") * .build(); * gkeHubMembershipServiceClient.deleteMembershipAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Empty, OperationMetadata> deleteMembershipAsync( DeleteMembershipRequest request) { return deleteMembershipOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes a Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * unregister other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * DeleteMembershipRequest request = * DeleteMembershipRequest.newBuilder() * .setName("name3373707") * .setRequestId("requestId693933066") * .build(); * OperationFuture<Empty, OperationMetadata> future = * gkeHubMembershipServiceClient.deleteMembershipOperationCallable().futureCall(request); * // Do something. * future.get(); * } * }</pre> */ public final OperationCallable<DeleteMembershipRequest, Empty, OperationMetadata> deleteMembershipOperationCallable() { return stub.deleteMembershipOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes a Membership. * * <p>&#42;&#42;This is currently only supported for GKE clusters on Google Cloud&#42;&#42;. To * unregister other clusters, follow the instructions at * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * DeleteMembershipRequest request = * DeleteMembershipRequest.newBuilder() * .setName("name3373707") * .setRequestId("requestId693933066") * .build(); * ApiFuture<Operation> future = * gkeHubMembershipServiceClient.deleteMembershipCallable().futureCall(request); * // Do something. * future.get(); * } * }</pre> */ public final UnaryCallable<DeleteMembershipRequest, Operation> deleteMembershipCallable() { return stub.deleteMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * String name = "name3373707"; * Membership resource = Membership.newBuilder().build(); * FieldMask updateMask = FieldMask.newBuilder().build(); * Membership response = * gkeHubMembershipServiceClient.updateMembershipAsync(name, resource, updateMask).get(); * } * }</pre> * * @param name Required. The membership resource name in the format: * `projects/[project_id]/locations/global/memberships/[membership_id]` * @param resource Required. Only fields specified in update_mask are updated. If you specify a * field in the update_mask but don't specify its value here that field will be deleted. If * you are updating a map field, set the value of a key to null or empty string to delete the * key from the map. It's not possible to update a key's value to the empty string. If you * specify the update_mask to be a special path "&#42;", fully replaces all user-modifiable * fields to match `resource`. * @param updateMask Required. Mask of fields to update. At least one field path must be specified * in this mask. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Membership, OperationMetadata> updateMembershipAsync( String name, Membership resource, FieldMask updateMask) { UpdateMembershipRequest request = UpdateMembershipRequest.newBuilder() .setName(name) .setResource(resource) .setUpdateMask(updateMask) .build(); return updateMembershipAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * UpdateMembershipRequest request = * UpdateMembershipRequest.newBuilder() * .setName("name3373707") * .setUpdateMask(FieldMask.newBuilder().build()) * .setResource(Membership.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); * Membership response = gkeHubMembershipServiceClient.updateMembershipAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Membership, OperationMetadata> updateMembershipAsync( UpdateMembershipRequest request) { return updateMembershipOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * UpdateMembershipRequest request = * UpdateMembershipRequest.newBuilder() * .setName("name3373707") * .setUpdateMask(FieldMask.newBuilder().build()) * .setResource(Membership.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); * OperationFuture<Membership, OperationMetadata> future = * gkeHubMembershipServiceClient.updateMembershipOperationCallable().futureCall(request); * // Do something. * Membership response = future.get(); * } * }</pre> */ public final OperationCallable<UpdateMembershipRequest, Membership, OperationMetadata> updateMembershipOperationCallable() { return stub.updateMembershipOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing Membership. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * UpdateMembershipRequest request = * UpdateMembershipRequest.newBuilder() * .setName("name3373707") * .setUpdateMask(FieldMask.newBuilder().build()) * .setResource(Membership.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); * ApiFuture<Operation> future = * gkeHubMembershipServiceClient.updateMembershipCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<UpdateMembershipRequest, Operation> updateMembershipCallable() { return stub.updateMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Generates the manifest for deployment of the GKE connect agent. * * <p>&#42;&#42;This method is used internally by Google-provided libraries.&#42;&#42; Most * clients should not need to call this method directly. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * GenerateConnectManifestRequest request = * GenerateConnectManifestRequest.newBuilder() * .setName("name3373707") * .setConnectAgent(ConnectAgent.newBuilder().build()) * .setVersion("version351608024") * .setIsUpgrade(true) * .setRegistry("registry-690212803") * .setImagePullSecretContent(ByteString.EMPTY) * .build(); * GenerateConnectManifestResponse response = * gkeHubMembershipServiceClient.generateConnectManifest(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final GenerateConnectManifestResponse generateConnectManifest( GenerateConnectManifestRequest request) { return generateConnectManifestCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Generates the manifest for deployment of the GKE connect agent. * * <p>&#42;&#42;This method is used internally by Google-provided libraries.&#42;&#42; Most * clients should not need to call this method directly. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * GenerateConnectManifestRequest request = * GenerateConnectManifestRequest.newBuilder() * .setName("name3373707") * .setConnectAgent(ConnectAgent.newBuilder().build()) * .setVersion("version351608024") * .setIsUpgrade(true) * .setRegistry("registry-690212803") * .setImagePullSecretContent(ByteString.EMPTY) * .build(); * ApiFuture<GenerateConnectManifestResponse> future = * gkeHubMembershipServiceClient.generateConnectManifestCallable().futureCall(request); * // Do something. * GenerateConnectManifestResponse response = future.get(); * } * }</pre> */ public final UnaryCallable<GenerateConnectManifestRequest, GenerateConnectManifestResponse> generateConnectManifestCallable() { return stub.generateConnectManifestCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not * depend on an existing Hub membership resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * ValidateExclusivityRequest request = * ValidateExclusivityRequest.newBuilder() * .setParent("parent-995424086") * .setCrManifest("crManifest-1971077186") * .setIntendedMembership("intendedMembership-2074920351") * .build(); * ValidateExclusivityResponse response = * gkeHubMembershipServiceClient.validateExclusivity(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ValidateExclusivityResponse validateExclusivity(ValidateExclusivityRequest request) { return validateExclusivityCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not * depend on an existing Hub membership resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * ValidateExclusivityRequest request = * ValidateExclusivityRequest.newBuilder() * .setParent("parent-995424086") * .setCrManifest("crManifest-1971077186") * .setIntendedMembership("intendedMembership-2074920351") * .build(); * ApiFuture<ValidateExclusivityResponse> future = * gkeHubMembershipServiceClient.validateExclusivityCallable().futureCall(request); * // Do something. * ValidateExclusivityResponse response = future.get(); * } * }</pre> */ public final UnaryCallable<ValidateExclusivityRequest, ValidateExclusivityResponse> validateExclusivityCallable() { return stub.validateExclusivityCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the * cluster if needed. * * <p>Exclusivity artifacts include the Membership custom resource definition (CRD) and the * singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity * artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub. * * <p>The Membership CRD is versioned, and may require conversion when the GKE Hub API server * begins serving a newer version of the CRD and corresponding CR. The response will be the * converted CRD and CR if there are any differences between the versions. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * GenerateExclusivityManifestRequest request = * GenerateExclusivityManifestRequest.newBuilder() * .setName("name3373707") * .setCrdManifest("crdManifest1401188132") * .setCrManifest("crManifest-1971077186") * .build(); * GenerateExclusivityManifestResponse response = * gkeHubMembershipServiceClient.generateExclusivityManifest(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final GenerateExclusivityManifestResponse generateExclusivityManifest( GenerateExclusivityManifestRequest request) { return generateExclusivityManifestCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the * cluster if needed. * * <p>Exclusivity artifacts include the Membership custom resource definition (CRD) and the * singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity * artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub. * * <p>The Membership CRD is versioned, and may require conversion when the GKE Hub API server * begins serving a newer version of the CRD and corresponding CR. The response will be the * converted CRD and CR if there are any differences between the versions. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = * GkeHubMembershipServiceClient.create()) { * GenerateExclusivityManifestRequest request = * GenerateExclusivityManifestRequest.newBuilder() * .setName("name3373707") * .setCrdManifest("crdManifest1401188132") * .setCrManifest("crManifest-1971077186") * .build(); * ApiFuture<GenerateExclusivityManifestResponse> future = * gkeHubMembershipServiceClient.generateExclusivityManifestCallable().futureCall(request); * // Do something. * GenerateExclusivityManifestResponse response = future.get(); * } * }</pre> */ public final UnaryCallable< GenerateExclusivityManifestRequest, GenerateExclusivityManifestResponse> generateExclusivityManifestCallable() { return stub.generateExclusivityManifestCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class ListMembershipsPagedResponse extends AbstractPagedListResponse< ListMembershipsRequest, ListMembershipsResponse, Membership, ListMembershipsPage, ListMembershipsFixedSizeCollection> { public static ApiFuture<ListMembershipsPagedResponse> createAsync( PageContext<ListMembershipsRequest, ListMembershipsResponse, Membership> context, ApiFuture<ListMembershipsResponse> futureResponse) { ApiFuture<ListMembershipsPage> futurePage = ListMembershipsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListMembershipsPagedResponse(input), MoreExecutors.directExecutor()); } private ListMembershipsPagedResponse(ListMembershipsPage page) { super(page, ListMembershipsFixedSizeCollection.createEmptyCollection()); } } public static class ListMembershipsPage extends AbstractPage< ListMembershipsRequest, ListMembershipsResponse, Membership, ListMembershipsPage> { private ListMembershipsPage( PageContext<ListMembershipsRequest, ListMembershipsResponse, Membership> context, ListMembershipsResponse response) { super(context, response); } private static ListMembershipsPage createEmptyPage() { return new ListMembershipsPage(null, null); } @Override protected ListMembershipsPage createPage( PageContext<ListMembershipsRequest, ListMembershipsResponse, Membership> context, ListMembershipsResponse response) { return new ListMembershipsPage(context, response); } @Override public ApiFuture<ListMembershipsPage> createPageAsync( PageContext<ListMembershipsRequest, ListMembershipsResponse, Membership> context, ApiFuture<ListMembershipsResponse> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListMembershipsFixedSizeCollection extends AbstractFixedSizeCollection< ListMembershipsRequest, ListMembershipsResponse, Membership, ListMembershipsPage, ListMembershipsFixedSizeCollection> { private ListMembershipsFixedSizeCollection( List<ListMembershipsPage> pages, int collectionSize) { super(pages, collectionSize); } private static ListMembershipsFixedSizeCollection createEmptyCollection() { return new ListMembershipsFixedSizeCollection(null, 0); } @Override protected ListMembershipsFixedSizeCollection createCollection( List<ListMembershipsPage> pages, int collectionSize) { return new ListMembershipsFixedSizeCollection(pages, collectionSize); } } }
[ "neenushaji@google.com" ]
neenushaji@google.com
e7472d9a942de395b51ad33133dd32a8700acc1a
96fac21d9eaed5c50c08924baddf81ba3468b840
/src/main/java/com/jpmorgan/stockmarket/model/stocks/PreferredStockImpl.java
b3c5ca900eabf512dbb72e03dcebf04b8b338a77
[]
no_license
Daniel-R-Afonso/tech-skill
b8895bbcf68c9b08d17ecb4f65954b91cb74d4ba
0f622303f8faf7d04ea88ec692d289daf01e352a
refs/heads/master
2020-04-11T04:30:14.462438
2016-02-10T11:29:14
2016-02-10T11:29:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,182
java
package com.jpmorgan.stockmarket.model.stocks; import com.jpmorgan.stockmarket.model.Trade; import com.jpmorgan.stockmarket.enums.TradeType; import org.joda.time.DateTime; import java.util.Date; import java.util.SortedMap; import java.util.TreeMap; /** * Created by David Afonso on 06/02/2016. */ public class PreferredStockImpl implements Stock{ private String symbol; private Double lastDividend; private Double fixedDividend; private Double parValue; private TreeMap<Date, Trade> trades; public PreferredStockImpl(String symbol, double lastDividend, double fixedDividend, double parValue) { this.symbol = symbol; this.lastDividend = lastDividend; this.fixedDividend = fixedDividend; this.parValue = parValue; this.trades = new TreeMap<Date, Trade>(); } public PreferredStockImpl() { } public String getSymbol() { return symbol; } public void setSymbol(String symbol) { this.symbol = symbol; } public Double getLastDividend() { return lastDividend; } public void setLastDividend(Double lastDividend) { this.lastDividend = lastDividend; } public Double getFixedDividend() { return fixedDividend; } public void setFixedDividend(Double fixedDividend) { this.fixedDividend = fixedDividend; } public Double getParValue() { return parValue; } public void setParValue(Double parValue) { this.parValue = parValue; } public TreeMap<Date, Trade> getTrades() { return trades; } public void setTrades(TreeMap<Date, Trade> trades) { this.trades = trades; } @Override public Double calcDividend(Double tickerPrice) { return this.getFixedDividend()*this.getParValue()/tickerPrice; } @Override public Double calcPERatio(Double tickerPrice) { return tickerPrice/this.getLastDividend(); } @Override public void buy(Integer quantity, Double tickerPrice) { Trade trade = new Trade(TradeType.BUY, quantity, tickerPrice); this.trades.put(new Date(), trade); } @Override public void sell(Integer quantity, Double price) { Trade trade = new Trade(TradeType.SELL, quantity, price); this.trades.put(new Date(), trade); } @Override public Double getPrice() { if (this.trades.size() > 0) { // Uses the last trade price as price return this.trades.lastEntry().getValue().getPrice(); } else { // No trades = price 0? :) return 0.0; } } @Override public Double calculateStockPrice() { Double summatoryPriceQty = 0.0; Integer summatoryQty = 0; Date now = new Date(); Date startTime = new DateTime().minusMinutes(1).toDate(); SortedMap<Date, Trade> trades = this.trades.tailMap(startTime); for (Trade trade: trades.values()) { summatoryQty += trade.getQuantity(); summatoryPriceQty += trade.getPrice() * trade.getQuantity(); } return summatoryPriceQty/summatoryQty; } }
[ "daniel_afonso@me.com" ]
daniel_afonso@me.com
1653ebcfb11070361cb2e24f61362d14b1aa3280
4347a963d792ac9633d052fc9cddb24b62c7f9f4
/JavaClass/src/ch06/Add1.java
260e0381181a169661413f8657e65266fa6e4755
[]
no_license
parkjaewon1/JavaClass
629ca103525ab4402b9876c7bfe79ccaf08d17de
54bf2c6428e803ca1e4847499352898682ace53d
refs/heads/master
2023-04-10T08:32:49.127689
2021-04-15T14:21:31
2021-04-15T14:21:31
350,326,556
0
0
null
null
null
null
UHC
Java
false
false
624
java
package ch06; class B1 { static void multiply( int x, int y) { System.out.printf("%d * %d = %d\n",x,y,x*+y); } } public class Add1 { void add(int x, int y) { System.out.printf("%d + %d = %d\n",x,y,x+y); } static void minus(int x, int y) { System.out.printf("%d - %d = %d\n",x,y,x-y); } public static void main(String[] args) { Add1 a1 = new Add1(); a1.add(10, 20); // main에서 사용할 때는 반드 객체를 생성하고 사용 Add1.minus(12, 4); // 사용하려는 클래스명과 main(실행)문이 있는 클래스와 같을 경우에는 생략 가능 minus(17, 6); B1.multiply(12, 7); } }
[ "48577510+parkjaewon1@users.noreply.github.com" ]
48577510+parkjaewon1@users.noreply.github.com
7fa87011f77d68a5475a865bdb527c8a83920db3
3d72c4a4ffa0dc1490a141ca7aace663947bcc4e
/Client/src/messages/AuthorizationRequest.java
41dad2ebfeeaa362137991e8488f90e236df46ee
[]
no_license
MaXSem13/OpenServer
c274ec0ae7fd875a1493b1c9cc989130fa395c56
5dc5ef5d2a43d960236cd226d67d6c9936134e9b
refs/heads/master
2022-08-16T19:48:23.433059
2020-05-22T13:43:21
2020-05-22T13:43:21
266,118,512
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package messages; import java.io.Serializable; public class AuthorizationRequest extends RequestInfo implements Serializable { String login; String password; public AuthorizationRequest(String login, String password, RequestType requestType){ super(requestType); this.login = login; this.password = password; } }
[ "masemenov_3@edu.hse.ru" ]
masemenov_3@edu.hse.ru
a51becf1e49aeecaa8222cf416e160b392c2aabe
9f5be8dd23dd91aa3b963c3a3bb906568292c42f
/src/main/java/com/hrpc/rpc/spring/RpcInteceptorBean.java
aa4e90579a0c8963726338b0b47f20874dda5b4f
[]
no_license
hoho1221/hrpc
676465e73f359dafdbad15e99e351aec90bafe0f
d5ae4d9ff531ad0aa722540cc1f194ab683a9767
refs/heads/master
2021-09-19T16:06:31.637410
2018-07-29T08:42:26
2018-07-29T08:42:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
789
java
package com.hrpc.rpc.spring; import com.hrpc.rpc.interceptor.ServiceInteceptor; import com.hrpc.rpc.netty.MsgRecvExecutor; import lombok.Data; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** * Created by changqi on 2017/7/11. */ @Data public class RpcInteceptorBean implements ApplicationContextAware { private String interfaceName; private String ref; private ApplicationContext context; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { MsgRecvExecutor.getInstance().registerInteceptor2InteceptorMap(interfaceName, (ServiceInteceptor) applicationContext.getBean(ref)); } }
[ "changqi.win@foxmail.com" ]
changqi.win@foxmail.com
28e1e2dca212e76eb93fdc5a3339b089bb837747
3f42d7ecaa0a8a6a929e0674a2953be852609f70
/Aerolinea/src/interfaz/Ventana.java
adf360a2c1421e3c703fb67bd699729a6dbd705d
[]
no_license
jefersonjl99/Java
a810fb2fa75395932f7f9408fdea4ff002023188
576b73b68e83fb0baa8eef1ee082e3b5b3b85c0f
refs/heads/main
2023-06-11T14:35:01.012436
2021-07-05T19:51:17
2021-07-05T19:51:17
381,227,584
0
0
null
null
null
null
UTF-8
Java
false
false
29,120
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 interfaz; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.border.Border; /** * * @author ssrs_ */ public class Ventana extends JFrame implements ActionListener, KeyListener { private static final ImagenFondo IMAGEN_FONDO = new ImagenFondo(); public static final int ANCHO = 720, ALTO = 520; public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_RESET = "\u001B[0m"; private static final Color COLOR = new Color(51, 51, 55); private static final Color COLOR1 = new Color(1, 153, 194); private static final Border BORDE = BorderFactory.createSoftBevelBorder(1, Color.YELLOW, Color.GREEN, Color.MAGENTA, Color.BLUE); ; private static final Font FUENTE = new Font("TimesRoman", Font.BOLD, 10); private static JPanel panel_num_matricez; private static JPanel panel_dimensiones; private static JPanel panel_salida_matriz; private final JScrollPane scroll_Dimensiones = new JScrollPane(panel_dimensiones, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); private final JScrollPane scroll_Tabla = new JScrollPane(panel_salida_matriz, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); private final JLabel label_num_matricez = new JLabel("Numero Matrices:"); private JLabel label_dimensiones; private JLabel texto_out_final; private final JTextField field_num_matricez = new JTextField("6"); private JTextField[] field_dimensiones; private JLabel[] label_tamaño_matriz; private JLabel[][] label_salida_final; private final JButton boton_usuario = new JButton("Usuario"); private final JButton boton_admin = new JButton("Admin"); private final JButton boton_encargado = new JButton("Encargado"); private JButton[] botones_acciones; public Ventana() { setTitle("Matrices Encadenadas"); setIconImage(new ImageIcon(Ventana.class.getResource("/recursos/1.jpg")).getImage()); setUndecorated(true); setLayout(null); setSize(ANCHO, ALTO); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setContentPane(IMAGEN_FONDO); requestFocus(); getRootPane().setBorder(BorderFactory.createSoftBevelBorder(1, Color.YELLOW, Color.GREEN, Color.MAGENTA, Color.BLUE)); getContentPane().setLayout(null); iniciarComponentes(); } private void iniciarComponentes() { boton_usuario.setBounds(ANCHO / 2 - 50, ALTO / 2 - 30, 100, 20); boton_usuario.setCursor(new Cursor(Cursor.HAND_CURSOR)); boton_usuario.setForeground(COLOR1); boton_usuario.setBackground(COLOR); boton_usuario.setBorder(BORDE); boton_usuario.addActionListener(this); boton_usuario.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { boton_usuario.setBackground((COLOR1)); boton_usuario.setForeground((COLOR)); } @Override public void mouseExited(MouseEvent e) { boton_usuario.setBackground((COLOR)); boton_usuario.setForeground((COLOR1)); } }); boton_admin.setBounds(ANCHO / 2 - 50, ALTO / 2 - 5, 100, 20); boton_admin.setCursor(new Cursor(Cursor.HAND_CURSOR)); boton_admin.setForeground(COLOR1); boton_admin.setBackground(COLOR); boton_admin.setBorder(BORDE); boton_admin.addActionListener(this); boton_admin.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { boton_admin.setBackground((COLOR1)); boton_admin.setForeground((COLOR)); } @Override public void mouseExited(MouseEvent e) { boton_admin.setBackground((COLOR)); boton_admin.setForeground((COLOR1)); } }); boton_encargado.setBounds(ANCHO / 2 - 50, ALTO / 2 + 20, 100, 20); boton_encargado.setCursor(new Cursor(Cursor.HAND_CURSOR)); boton_encargado.setForeground(COLOR1); boton_encargado.setBackground(COLOR); boton_encargado.setBorder(BORDE); boton_encargado.addActionListener(this); boton_encargado.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { boton_encargado.setBackground((COLOR1)); boton_encargado.setForeground((COLOR)); } @Override public void mouseExited(MouseEvent e) { boton_encargado.setBackground((COLOR)); boton_encargado.setForeground((COLOR1)); } }); add(boton_admin); add(boton_usuario); add(boton_encargado); scroll_Dimensiones.setBounds(210, 5, 500, 90); scroll_Dimensiones.setVisible(false); scroll_Dimensiones.setBorder(BORDE); scroll_Dimensiones.getHorizontalScrollBar().setCursor(new Cursor(Cursor.HAND_CURSOR)); scroll_Dimensiones.getHorizontalScrollBar().setBackground(Color.BLACK); scroll_Tabla.setBounds(5, 100, 705, 410); scroll_Tabla.setVisible(false); scroll_Tabla.setBorder(BORDE); scroll_Tabla.getHorizontalScrollBar().setCursor(new Cursor(Cursor.HAND_CURSOR)); scroll_Tabla.getHorizontalScrollBar().setBackground(Color.BLACK); scroll_Tabla.setBorder(BORDE); scroll_Tabla.getVerticalScrollBar().setCursor(new Cursor(Cursor.HAND_CURSOR)); scroll_Tabla.getVerticalScrollBar().setBackground(Color.BLACK); add(scroll_Dimensiones); add(scroll_Tabla); } @Override public void actionPerformed(ActionEvent e) { ////////////////////BOTON ADMIN////////////////////////////////// if (e.getSource() == boton_admin) { panel_num_matricez = new JPanel(); add(panel_num_matricez); panel_num_matricez.requestFocus(); panel_num_matricez.setBackground(COLOR); panel_num_matricez.setForeground(COLOR1); panel_num_matricez.setBounds(5, 5, 200, 90); panel_num_matricez.setBorder(BORDE); panel_num_matricez.setLayout(null); botones_acciones = new JButton[3]; for (int i = 0; i < botones_acciones.length; i++) { botones_acciones[i] = new JButton(); botones_acciones[i].setBounds(25, -25 + ((i + 1) * 30), 150, 20); botones_acciones[i].setCursor(new Cursor(Cursor.HAND_CURSOR)); botones_acciones[i].setForeground(COLOR1); botones_acciones[i].setBackground(COLOR); botones_acciones[i].setBorder(BORDE); botones_acciones[i].addActionListener(this); botones_acciones[i].addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { Object o = arg0.getSource(); if (o instanceof JButton) { JButton boton = (JButton) o; boton.setBackground((COLOR1)); boton.setForeground((COLOR)); } } @Override public void mouseExited(MouseEvent e) { Object o = e.getSource(); if (o instanceof JButton) { JButton boton = (JButton) o; boton.setBackground((COLOR)); boton.setForeground((COLOR1)); } } }); switch (i) { case 0: botones_acciones[i].setText("Agregar Ciudad"); break; case 1: botones_acciones[i].setText("Eliminar Ciudad"); break; case 2: botones_acciones[i].setText("Agregar Vuelo"); break; default: break; } panel_num_matricez.add(botones_acciones[i]); } }////////////////////BOTON ADMIN////////////////////////////////// ////////////////////BOTON USUARIO////////////////////////////////// if (e.getSource() == boton_usuario) { panel_num_matricez = new JPanel(); add(panel_num_matricez); panel_num_matricez.requestFocus(); panel_num_matricez.setBackground(COLOR); panel_num_matricez.setForeground(COLOR1); panel_num_matricez.setBounds(5, 5, 200, 90); panel_num_matricez.setBorder(BORDE); panel_num_matricez.setLayout(null); botones_acciones = new JButton[3]; for (int i = 0; i < botones_acciones.length; i++) { botones_acciones[i] = new JButton(); botones_acciones[i].setBounds(25, -25 + ((i + 1) * 30), 150, 20); botones_acciones[i].setCursor(new Cursor(Cursor.HAND_CURSOR)); botones_acciones[i].setForeground(COLOR1); botones_acciones[i].setBackground(COLOR); botones_acciones[i].setBorder(BORDE); botones_acciones[i].addActionListener(this); botones_acciones[i].addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { Object o = arg0.getSource(); if (o instanceof JButton) { JButton boton = (JButton) o; boton.setBackground((COLOR1)); boton.setForeground((COLOR)); } } @Override public void mouseExited(MouseEvent e) { Object o = e.getSource(); if (o instanceof JButton) { JButton boton = (JButton) o; boton.setBackground((COLOR)); boton.setForeground((COLOR1)); } } }); switch (i) { case 0: botones_acciones[i].setText("Listar Vuelos"); break; case 1: botones_acciones[i].setText("Informacion de Vuelo"); break; case 2: botones_acciones[i].setText("Hacer Reserva"); break; default: break; } panel_num_matricez.add(botones_acciones[i]); } }////////////////////BOTON USUARIO////////////////////////////////// ////////////////////BOTON ENCARGADO////////////////////////////////// if (e.getSource() == boton_encargado) { panel_num_matricez = new JPanel(); add(panel_num_matricez); panel_num_matricez.requestFocus(); panel_num_matricez.setBackground(COLOR); panel_num_matricez.setForeground(COLOR1); panel_num_matricez.setBounds(5, 5, 200, 90); panel_num_matricez.setBorder(BORDE); panel_num_matricez.setLayout(null); botones_acciones = new JButton[1]; botones_acciones[0] = new JButton(); botones_acciones[0].setBounds(25, -25 + (2 * 30), 150, 20); botones_acciones[0].setCursor(new Cursor(Cursor.HAND_CURSOR)); botones_acciones[0].setForeground(COLOR1); botones_acciones[0].setBackground(COLOR); botones_acciones[0].setBorder(BORDE); botones_acciones[0].addActionListener(this); botones_acciones[0].setText("Generar Archivo"); botones_acciones[0].addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { Object o = arg0.getSource(); if (o instanceof JButton) { JButton boton = (JButton) o; boton.setBackground((COLOR1)); boton.setForeground((COLOR)); } } @Override public void mouseExited(MouseEvent e) { Object o = e.getSource(); if (o instanceof JButton) { JButton boton = (JButton) o; boton.setBackground((COLOR)); boton.setForeground((COLOR1)); } } }); panel_num_matricez.add(botones_acciones[0]); }////////////////////BOTON ENCARGADO////////////////////////////////// ////////////////////BOTON ENCARGADO////////////////////////////////// if (e.getSource() == botones_acciones[0]) { remove(panel_num_matricez); revalidate(); repaint(); } ////////////////////BOTON GENERAR////////////////////////////////// // if (e.getSource() == boton_generar) { // // texto_out_final = new JLabel("Digite valores y presione procesar"); // texto_out_final.setBounds(110, 50, 100 * Integer.parseInt(field_num_matricez.getText()), 15); // texto_out_final.setForeground(COLOR1); // panel_dimensiones = new JPanel(); // panel_dimensiones.requestFocus(); // panel_dimensiones.addKeyListener(this); // scroll_Dimensiones.setViewportView(panel_dimensiones); // scroll_Dimensiones.setVisible(true); // panel_dimensiones.setLayout(null); // panel_dimensiones.setBackground(COLOR); // panel_dimensiones.add(boton_procesar); // panel_dimensiones.add(texto_out_final); // panel_dimensiones.setPreferredSize(new Dimension((Integer.parseInt(field_num_matricez.getText()) * 30) + 75, 80)); // // field_dimensiones = new JTextField[Integer.parseInt(field_num_matricez.getText())]; // label_tamaño_matriz = new JLabel[Integer.parseInt(field_num_matricez.getText())]; // label_dimensiones = new JLabel("Dimensiones:"); // // int cont = 0, dim = 1, limite_matricez = Integer.parseInt(field_num_matricez.getText()); // String dim_iniciales; // char w; // // for (w = 'A'; w <= 'Z'; w++) { // if (cont == limite_matricez) { // break; // } else { // label_tamaño_matriz[cont] = new JLabel(Character.toString(w)); // cont++; // } // } // label_dimensiones.setForeground(COLOR1); // label_dimensiones.setBounds(5, -15 + (20 * (0 + 1)), 100, 20); // panel_dimensiones.add(label_dimensiones); // // for (int x = 0; x < Integer.parseInt(field_num_matricez.getText()); x++) { // dim_iniciales = dim + "," + (dim + 1); // field_dimensiones[x] = new JTextField(); // // panel_dimensiones.add(field_dimensiones[x]); // panel_dimensiones.add(label_tamaño_matriz[x]); // // field_dimensiones[x].setBounds(80 + (31 * (x + 1)), 5, 30, 20); // label_tamaño_matriz[x].setBounds(90 + (31 * (x + 1)), 25, 30, 20); // label_tamaño_matriz[x].setForeground(COLOR1); // // field_dimensiones[x].setText(dim_iniciales); // field_dimensiones[x].setBackground(COLOR1); // field_dimensiones[x].setForeground(Color.BLACK); // field_dimensiones[x].setBorder(BORDE); // field_dimensiones[x].addKeyListener(new KeyListener() { // @Override // public void keyPressed(KeyEvent e) { // if (KeyEvent.VK_ENTER == e.getKeyCode()) { // boton_procesar.doClick(); // } // if (KeyEvent.VK_ESCAPE == e.getKeyCode()) { // System.exit(0); // } // } // // @Override // public void keyTyped(KeyEvent e) { // } // // @Override // public void keyReleased(KeyEvent e) { // } // }); // field_dimensiones[x].addKeyListener(new KeyAdapter() { // @Override // public void keyTyped(KeyEvent e) { // char caracter = e.getKeyChar(); // // Verificar si la tecla pulsada no es un digito // if (((caracter < '0') || (caracter > '9')) && (caracter != ',')) { // e.consume(); // ignorar el evento de teclado // } // } // }); // field_dimensiones[x].addFocusListener(new FocusListener() { // @Override // public void focusGained(FocusEvent e) { // Object o = e.getSource(); // if (o instanceof JTextField) { // JTextField field_in_valores_monedas = (JTextField) o; // field_in_valores_monedas.setSelectionStart(0); // field_in_valores_monedas.setSelectionEnd(field_in_valores_monedas.getText().length()); // field_in_valores_monedas.setBackground(Color.BLACK); // field_in_valores_monedas.setForeground(COLOR1); // } // } // // @Override // public void focusLost(FocusEvent e) { // Object o = e.getSource(); // if (o instanceof JTextField) { // JTextField field_in_valores_monedas = (JTextField) o; // field_in_valores_monedas.setBackground(COLOR1); // field_in_valores_monedas.setForeground(Color.BLACK); // } // } // }); // // dim++; // } // field_dimensiones[0].requestFocus(); // }////////////////////BOTON GENERAR////////////////////////////////// ///////////////////////BOTON PROCESAR/////////////////// // if (e.getSource() == boton_procesar) { // // panel_salida_matriz = new JPanel(); // panel_salida_matriz.setBackground(COLOR); // panel_salida_matriz.setLayout(null); // panel_salida_matriz.setBorder(BORDE); // panel_salida_matriz.requestFocus(); // panel_salida_matriz.addKeyListener(this); // field_dimensiones[0].requestFocus(); // // int nmatrices, tamaño_max_x = 0, tamaño_max_y, tamaños_max_x[], tamaños_max_y[], error = 0; // nmatrices = Integer.parseInt(field_num_matricez.getText()); // // String totalText = ""; // for (int i = 0; i < nmatrices; i++) { // totalText += field_dimensiones[i].getText() + ","; // } // String[] textElements = totalText.split(","); // System.out.println(Arrays.toString(textElements)); // // int dimensiones[] = new int[field_dimensiones.length + 1]; // int cont = 1; // for (int i = 1; i < textElements.length - 1; i += 2) { // int elemento_actual = Integer.parseInt(textElements[i]); // for (int j = i; j < i + 2; j++) { // if (Integer.parseInt(textElements[j]) == elemento_actual) { // dimensiones[cont] = Integer.parseInt(textElements[j]); // } else { // System.out.println("error"); // error = 1; // break; // } // elemento_actual = Integer.parseInt(textElements[j]); // } // cont++; // } // // dimensiones[0] = Integer.parseInt(textElements[0]); // dimensiones[dimensiones.length - 1] = Integer.parseInt(textElements[textElements.length - 1]); // System.out.println(Arrays.toString(dimensiones)); // // if (error != 1) { // // OptimizacionProductoMatricez optimizar = new OptimizacionProductoMatricez(dimensiones); // ArrayList<String>[][] cadenas = optimizar.getMatriz_cadenas(); // ArrayList<Integer>[][] numeros = optimizar.getMatriz_numeros(); // ArrayList<String>[][] minimos = optimizar.getMatriz_min_cad(); // // label_salida_final = new JLabel[nmatrices + 1][nmatrices + 1]; // for (int i = 0; i < nmatrices + 1; i++) { // for (int j = 0; j < nmatrices + 1; j++) { // // label_salida_final[i][j] = new JLabel(); // panel_salida_matriz.add(label_salida_final[i][j]); // // if (i == 0 && j == 0) { // label_salida_final[i][j].setText(""); // } else if (i == 0) { // label_salida_final[i][j].setText(" j = " + (j - 1) + " "); // } else if (j == 0) { // label_salida_final[i][j].setText(" i = " + (i - 1) + " "); // } else if (i >= j) { // label_salida_final[i][j].setText("0"); // } else { // // String s = ""; // for (int k = 0; k < cadenas[i][j].size(); k++) { // // s += "<html><p><div style='text-align: center;'><font color='red'>k=" + (k + i - 1) + "</font> Asigno " + numeros[i][j].get(k) + "<p>" + minimos[i][j].get(k) + "<p>" + cadenas[i][j].get(k) + "</div><p><html>"; // } // s += "<html><p>= <font color='#3BFF00'>" + numeros[i][j].get(numeros[i][j].size() - 1) + "</font> <font color='yellow'>" + cadenas[i][j].get(cadenas[i][j].size() - 1) + "</font><html>"; // label_salida_final[i][j].setText(s); // } // } // } // // tamaños_max_x = new int[nmatrices + 1]; // tamaños_max_y = new int[nmatrices + 1]; // for (int i = 0; i < nmatrices + 1; i++) { // tamaño_max_y = 0; // for (int j = 0; j < nmatrices + 1; j++) { // if (tamaño_max_y < label_salida_final[i][j].getMinimumSize().getHeight()) { // tamaño_max_y = (int) label_salida_final[i][j].getMinimumSize().getHeight() + 20; // } // } // tamaños_max_y[i] = tamaño_max_y; // } // // for (int j = 0; j < nmatrices + 1; j++) { // tamaño_max_x = 0; // for (int i = 0; i < nmatrices + 1; i++) { // if (tamaño_max_x < label_salida_final[i][j].getMinimumSize().getWidth()) { // tamaño_max_x = (int) label_salida_final[i][j].getMinimumSize().getWidth() * (int) ((j + 1) * 2) - 20; // } // } // tamaños_max_x[j] = tamaño_max_x; // } // // int suma_tamaños_Y = 5, suma_tamaños_X = 5; // for (int i = 0; i < nmatrices + 1; i++) { // suma_tamaños_X = 5; // for (int j = 0; j < nmatrices + 1; j++) { // // if (i == 0 && j == 0) { // label_salida_final[i][j].setBounds(suma_tamaños_X, suma_tamaños_Y, tamaños_max_x[j], tamaños_max_y[i] - 20); // } else if (i == 0) { // label_salida_final[i][j].setBounds(suma_tamaños_X, suma_tamaños_Y, tamaños_max_x[j], tamaños_max_y[i] - 20); // } else if (j == 0) { // label_salida_final[i][j].setBounds(suma_tamaños_X, suma_tamaños_Y, tamaños_max_x[j], tamaños_max_y[i]); // } else { // label_salida_final[i][j].setBounds(suma_tamaños_X, suma_tamaños_Y, tamaños_max_x[j], tamaños_max_y[i]); // } // // label_salida_final[i][j].setHorizontalAlignment(SwingConstants.CENTER); // label_salida_final[i][j].setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); // label_salida_final[i][j].setForeground(Color.WHITE); // if (i == 0 && j > 0 || j == 0 && i > 0) { // label_salida_final[i][j].setForeground(Color.CYAN); // } // // suma_tamaños_X += tamaños_max_x[j]; // // } // if (i > 0) { // suma_tamaños_Y += tamaños_max_y[i]; // } // } // // texto_out_final.setForeground(COLOR1); // texto_out_final.setText("<html>Producto minimo: <font color='#3BFF00'>" + numeros[1][nmatrices].get(numeros[1][nmatrices].size() - 1) + "</font> - <font color='yellow'>" + cadenas[1][nmatrices].get(cadenas[1][nmatrices].size() - 1) + "</font><html>"); // // scroll_Tabla.setViewportView(panel_salida_matriz); // scroll_Tabla.setVisible(true); // panel_salida_matriz.setPreferredSize(new Dimension((suma_tamaños_X) + 25, suma_tamaños_Y + 25)); // } else { // texto_out_final.setForeground(Color.red); // texto_out_final.setText("Dimensiones invalidas"); // scroll_Tabla.setVisible(false); // JOptionPane.showMessageDialog(null, "Dimensiones invalidas"); // } // }///////////////////////BOTON PROCESAR/////////////////// } @Override public void keyPressed(KeyEvent e) { // if (e.getSource() == field_num_matricez) { // if (KeyEvent.VK_ENTER == e.getKeyCode()) { // boton_generar.doClick(); // } // if (KeyEvent.VK_ESCAPE == e.getKeyCode()) { // System.exit(0); // } // } if (e.getSource() == panel_dimensiones || e.getSource() == panel_num_matricez || e.getSource() == panel_salida_matriz) { if (KeyEvent.VK_ESCAPE == e.getKeyCode()) { System.exit(0); } } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } } //////////////////////////////////////////////////////// ////////////Cambia el fondo////////////////// ////////////////////////////////////////////////////// class ImagenFondo extends JPanel { private Image imagen; @Override public void paint(Graphics g) { try { imagen = ImageIO.read(ImagenFondo.class.getResource("/recursos/1.jpg")); } catch (IOException ex) { Logger.getLogger(ImagenFondo.class.getName()).log(Level.SEVERE, null, ex); } g.drawImage(imagen, 0, 0, getWidth(), getHeight(), null); setOpaque(false); super.paint(g); } } /////////////////////////////////////////////////////////////////////// ////////////////////////////////////////
[ "jeferson.jl99@gmail.com" ]
jeferson.jl99@gmail.com
baf0ac592289aab1bea103f5c16bf42445daa129
aaa9751e4ed70a7b3b41fa2025900dd01205518a
/org.eclipse.rcpl.libs/src2/org/apache/poi/hwpf/model/PieceDescriptor.java
93416496375c5815c976f962463857ef82078bb8
[]
no_license
rassisi/rcpl
596f0c0aeb4b4ae838f001ad801f9a9c42e31759
93b4620bb94a45d0f42666b0bf6ffecae2c0d063
refs/heads/master
2022-09-20T19:57:54.802738
2020-05-10T20:54:01
2020-05-10T20:54:01
141,136,917
0
0
null
2022-09-01T23:00:59
2018-07-16T12:40:18
Java
UTF-8
Java
false
false
4,105
java
/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ package org.apache.poi.hwpf.model; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @Internal public final class PieceDescriptor { short descriptor; private static BitField fNoParaLast = BitFieldFactory.getInstance(0x01); private static BitField fPaphNil = BitFieldFactory.getInstance(0x02); private static BitField fCopied = BitFieldFactory.getInstance(0x04); int fc; PropertyModifier prm; boolean unicode; public PieceDescriptor(byte[] buf, int offset) { descriptor = LittleEndian.getShort(buf, offset); offset += LittleEndian.SHORT_SIZE; fc = LittleEndian.getInt(buf, offset); offset += LittleEndian.INT_SIZE; prm = new PropertyModifier( LittleEndian.getShort(buf, offset)); // see if this piece uses unicode. if ((fc & 0x40000000) == 0) { unicode = true; } else { unicode = false; fc &= ~(0x40000000);//gives me FC in doc stream fc /= 2; } } public int getFilePosition() { return fc; } public void setFilePosition(int pos) { fc = pos; } public boolean isUnicode() { return unicode; } public PropertyModifier getPrm() { return prm; } protected byte[] toByteArray() { // set up the fc int tempFc = fc; if (!unicode) { tempFc *= 2; tempFc |= (0x40000000); } int offset = 0; byte[] buf = new byte[8]; LittleEndian.putShort(buf, offset, descriptor); offset += LittleEndian.SHORT_SIZE; LittleEndian.putInt(buf, offset, tempFc); offset += LittleEndian.INT_SIZE; LittleEndian.putShort(buf, offset, prm.getValue()); return buf; } public static int getSizeInBytes() { return 8; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + descriptor; result = prime * result + ( ( prm == null ) ? 0 : prm.hashCode() ); result = prime * result + ( unicode ? 1231 : 1237 ); return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) return true; if ( obj == null ) return false; if ( getClass() != obj.getClass() ) return false; PieceDescriptor other = (PieceDescriptor) obj; if ( descriptor != other.descriptor ) return false; if ( prm == null ) { if ( other.prm != null ) return false; } else if ( !prm.equals( other.prm ) ) return false; if ( unicode != other.unicode ) return false; return true; } @Override public String toString() { return "PieceDescriptor (pos: " + getFilePosition() + "; " + ( isUnicode() ? "unicode" : "non-unicode" ) + "; prm: " + getPrm() + ")"; } }
[ "Ramin@DESKTOP-69V2J7P.fritz.box" ]
Ramin@DESKTOP-69V2J7P.fritz.box
5cfc92b2cf33a8cfe3b4c4d4aaf3ed027d5aff7d
c02448bf7f4c24ea1db436496c811c71516f4c53
/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java
6f4c58660cb56447700a804bc8a435233ef243cc
[]
no_license
deadbrother/remoteSharing
b3c4f58eb9dfcbed0f22d6f7d1221b0c35931069
899e33296bbb1d9f896e344e3870df9519313f09
refs/heads/master
2023-07-12T16:56:55.879957
2020-11-17T06:16:36
2020-11-17T06:16:36
97,083,761
0
0
null
null
null
null
UTF-8
Java
false
false
4,938
java
/* * Copyright 1999-2101 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.druid.sql.ast.expr; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import com.alibaba.druid.sql.ast.SQLExpr; import com.alibaba.druid.sql.ast.SQLExprImpl; import com.alibaba.druid.sql.ast.SQLKeep; import com.alibaba.druid.sql.ast.SQLOrderBy; import com.alibaba.druid.sql.ast.SQLOver; import com.alibaba.druid.sql.visitor.SQLASTVisitor; public class SQLAggregateExpr extends SQLExprImpl implements Serializable { private static final long serialVersionUID = 1L; protected String methodName; protected SQLAggregateOption option; protected final List<SQLExpr> arguments = new ArrayList<SQLExpr>(); protected SQLKeep keep; protected SQLOver over; protected SQLOrderBy withinGroup; protected boolean ignoreNulls = false; public SQLAggregateExpr(String methodName){ this.methodName = methodName; } public SQLAggregateExpr(String methodName, SQLAggregateOption option){ this.methodName = methodName; this.option = option; } public String getMethodName() { return this.methodName; } public void setMethodName(String methodName) { this.methodName = methodName; } public SQLOrderBy getWithinGroup() { return withinGroup; } public void setWithinGroup(SQLOrderBy withinGroup) { if (withinGroup != null) { withinGroup.setParent(this); } this.withinGroup = withinGroup; } public SQLAggregateOption getOption() { return this.option; } public void setOption(SQLAggregateOption option) { this.option = option; } public List<SQLExpr> getArguments() { return this.arguments; } public void addArgument(SQLExpr argument) { if (argument != null) { argument.setParent(this); } this.arguments.add(argument); } public SQLOver getOver() { return over; } public void setOver(SQLOver over) { if (over != null) { over.setParent(this); } this.over = over; } public SQLKeep getKeep() { return keep; } public void setKeep(SQLKeep keep) { if (keep != null) { keep.setParent(this); } this.keep = keep; } public boolean isIgnoreNulls() { return this.ignoreNulls; } public void setIgnoreNulls(boolean ignoreNulls) { this.ignoreNulls = ignoreNulls; } @Override protected void accept0(SQLASTVisitor visitor) { if (visitor.visit(this)) { acceptChild(visitor, this.arguments); acceptChild(visitor, this.over); } visitor.endVisit(this); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((arguments == null) ? 0 : arguments.hashCode()); result = prime * result + ((methodName == null) ? 0 : methodName.hashCode()); result = prime * result + ((option == null) ? 0 : option.hashCode()); result = prime * result + ((over == null) ? 0 : over.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SQLAggregateExpr other = (SQLAggregateExpr) obj; if (arguments == null) { if (other.arguments != null) { return false; } } else if (!arguments.equals(other.arguments)) { return false; } if (methodName == null) { if (other.methodName != null) { return false; } } else if (!methodName.equals(other.methodName)) { return false; } if (over == null) { if (other.over != null) { return false; } } else if (!over.equals(other.over)) { return false; } if (option != other.option) { return false; } return true; } }
[ "wangwenqiang@bonc.com.cn" ]
wangwenqiang@bonc.com.cn
fbd1deff8dc65a2426dfdbcd92d2e8773fa933ad
92246d207343880a693b1579eacdc90f5673d48e
/src/com/gourx/app/model/JudgeBloodTypeByParentModel.java
1e1cbddb0d90f4f4c337944c65325a33aa038987
[ "Apache-2.0" ]
permissive
Gouvia/bloodType_project
b3c1e1c056c47dbdc36c86616d42d49cacae7eb6
a0a334ab8416e4ff82c558bb34edc598b651662a
refs/heads/master
2020-06-13T07:13:09.002205
2019-07-01T02:02:12
2019-07-01T02:02:12
194,582,464
0
0
null
null
null
null
UTF-8
Java
false
false
2,461
java
package com.gourx.app.model; public class JudgeBloodTypeByParentModel { /** * 根据父母的血型判断孩子的血型 * @param pa 父亲的血型 * @param mo 母亲的血型 * @return 孩子可能的血型 * 血型规则如下:0=O型 1=A型 2=B型 3=AB型 * @throws IllegalArgumentException pa 和 mo 不能为负数并且要小于4 * */ public static void JudgeBloodType(int pa,int mo) { //1 验证清理参数 if(pa<0 || pa>3) { throw new IllegalArgumentException("父亲的血型范围不能为负数并且要小于4"); } if(mo<0 || mo>3) { throw new IllegalArgumentException("母亲的血型范围不能为负数并且要小于4"); } //2 执行业务逻辑 getBloodType(pa,mo); //3组装业务并返回结果 } /** * 根据父母的血型判断孩子可能和不可能的血型 * @param pa 父亲的血型 * @param mo 母亲的血型 * 血型规则如下:0=O型 1=A型 2=B型 3=AB型 * */ private static void getBloodType(int pa,int mo) { if(pa==0 && mo==0) { System.out.println("这对父母的孩子的血型只能为O型,不可能为A、B、AB型"); }else if((pa==0 && mo==1)||(pa==1 && mo==0)) { System.out.println("这对父母的孩子的血型可能为O型和A型,不可能为B、AB型"); }else if(pa==1 && mo==1) { System.out.println("这对父母的孩子的血型可能为O型和A型,不可能为B、AB型"); }else if((pa==2 && mo==1)||(pa==1 && mo==2)) { System.out.println("这对父母的孩子的血型可能为O型、A型、B型、AB型"); }else if((pa==3 && mo==1)||(pa==1 && mo==3)) { System.out.println("这对父母的孩子的血型可能为A型、B型、AB型,不可能为O型"); }else if((pa==0 && mo==2)||(pa==2 && mo==0)) { System.out.println("这对父母的孩子的血型可能为O型和 B型,不可能为A、AB型"); }else if(pa==2 && mo==2) { System.out.println("这对父母的孩子的血型可能为O型和B型,不可能为A、AB型"); }else if((pa==2 && mo==3)||(pa==3 && mo==2)) { System.out.println("这对父母的孩子的血型可能为A型、B型、AB型,不可能为O型"); }else if((pa==0 && mo==3)||(pa==3 && mo==0)) { System.out.println("这对父母的孩子的血型可能为B型和A型,不可能为O、AB型"); }else{ System.out.println("这对父母的孩子的血型可能为A型、B型、AB型,不可能为O型"); } } }
[ "gourx128@163.com" ]
gourx128@163.com
b388477a9c50d9ef381247de5df327cc9789dc69
ff530b3f58a22d2278973edc1364c95467ad0d30
/src/main/java/ua/rd/ioc/NoSuchBeanException.java
8c47bd0941a031901f770c15de05aa01ab92f571
[]
no_license
DmyP/SpringIoC
398429430eaba472447d81883fd9e1688c7b0a37
f1a84dff075905d15cf9ce93910f7dc0ab4b59e2
refs/heads/master
2021-07-08T21:40:18.582437
2017-10-06T13:30:10
2017-10-06T13:30:10
105,639,144
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package ua.rd.ioc; public class NoSuchBeanException extends RuntimeException { public NoSuchBeanException() { super("NoSuchBean"); } }
[ "pechenyi.d@gmail.com" ]
pechenyi.d@gmail.com
a41ca438f45e92e62453a2f5e5da395982ba6ee1
56c0e7cf6f22e198004654867e08c664ce03d2ca
/src/main/java/org/apache/ibatis/reflection/invoker/GetFieldInvoker.java
c35cf5cd342a226d14310f9674ca96e742072605
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
github291406933/mybatis-analysis
488358aa71ac818dd9896b973fc68a99b81d2d29
95fa5105f739b734828191d0454a99455f2067a6
refs/heads/master
2020-04-01T07:36:28.997750
2019-02-28T02:20:51
2019-02-28T02:20:51
152,995,938
1
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
/** * Copyright 2009-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.reflection.invoker; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; /** * 利用反射,获取在target中对应Field字段值 * @author Clinton Begin */ public class GetFieldInvoker implements Invoker { private final Field field; public GetFieldInvoker(Field field) { this.field = field; } @Override public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { return field.get(target); } @Override public Class<?> getType() { return field.getType(); } }
[ "huangcanjia@comodin.cn" ]
huangcanjia@comodin.cn
a208ad94a8bfe053f97b568d861eb6b8230fd401
fec6faf83e30461ba0003c3bc0506571d97df390
/src/main/java/com/okta/developer/social/domain/AbstractAuditingEntity.java
486570b6a5e665a48fc6e0861314c3c4de78c2d2
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
oktadev/okta-spring-boot-social-login-example
1cfe3a6dbefc33bac66541d283a4f2f69f15fe4d
60e0f987724efecf0ee36f9b627d874f55945d2b
refs/heads/master
2023-01-28T07:33:08.234914
2020-12-04T23:26:47
2020-12-04T23:26:47
169,480,824
2
0
null
null
null
null
UTF-8
Java
false
false
2,222
java
package com.okta.developer.social.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.envers.Audited; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.io.Serializable; import java.time.Instant; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; /** * Base abstract class for entities which will hold definitions for created, last modified by and created, * last modified by date. */ @MappedSuperclass @Audited @EntityListeners(AuditingEntityListener.class) public abstract class AbstractAuditingEntity implements Serializable { private static final long serialVersionUID = 1L; @CreatedBy @Column(name = "created_by", nullable = false, length = 50, updatable = false) @JsonIgnore private String createdBy; @CreatedDate @Column(name = "created_date", updatable = false) @JsonIgnore private Instant createdDate = Instant.now(); @LastModifiedBy @Column(name = "last_modified_by", length = 50) @JsonIgnore private String lastModifiedBy; @LastModifiedDate @Column(name = "last_modified_date") @JsonIgnore private Instant lastModifiedDate = Instant.now(); public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public Instant getCreatedDate() { return createdDate; } public void setCreatedDate(Instant createdDate) { this.createdDate = createdDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public Instant getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } }
[ "matt.raible@okta.com" ]
matt.raible@okta.com
ec51e51305b9588ab85076430b8723d3df1088a4
5141d9297a4a36f095bd10c791ca29cbeab55f1e
/app/src/main/java/com/chebarbado/test_forasoft_itunesapi/Adapters/AlbumListAdapter.java
a2603a2a8caeb1af8134692c788b66f7de5114da
[]
no_license
Chebarbado/Test_forasoft_itunesApi
bcf4992aa1519e15895d4885be5d9d2d42c95268
4e9c35676620a94a54328aaea98a9abfc5f5d72d
refs/heads/master
2020-03-28T14:19:38.942608
2018-09-12T11:15:21
2018-09-12T11:15:21
148,468,758
0
0
null
null
null
null
UTF-8
Java
false
false
4,152
java
package com.chebarbado.test_forasoft_itunesapi.Adapters; import android.app.Activity; import android.content.Context; import android.support.annotation.NonNull; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.Filterable; import android.widget.ImageView; import android.widget.TextView; import com.chebarbado.test_forasoft_itunesapi.R; import com.chebarbado.test_forasoft_itunesapi.model.Albums; import com.squareup.picasso.Picasso; import java.util.ArrayList; public class AlbumListAdapter extends ArrayAdapter<Albums> implements Filterable { ArrayList<Albums> albums; ArrayList<Albums> resReq; Context context; int resource; public AlbumListAdapter(Context context, int resource, ArrayList<Albums> albums) { super(context, resource, albums); this.albums = albums; this.context = context; this.resource = resource; resReq = new ArrayList<>(); resReq.addAll(albums); } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater layoutInflater = (LayoutInflater) getContext() .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = layoutInflater.inflate(R.layout.list_item_layout, null, false); } Albums albums = getItem(position); ImageView imageView = (ImageView) convertView.findViewById(R.id.image_view_artwork); Picasso.get().load(albums.getArtwork()).into(imageView); TextView collectionName = (TextView) convertView.findViewById(R.id.collection_name); collectionName.setText(albums.getCollectionName()); TextView artistName = (TextView) convertView.findViewById(R.id.artist_name_text_view); artistName.setText(albums.getArtistName()); TextView trackCount = (TextView) convertView.findViewById(R.id.track_count); trackCount.setText(String.valueOf(albums.getTrackCount())); return convertView; } // Фильтр по альбомам @NonNull @Override public Filter getFilter() { Filter filter = new Filter() { // Фильтруем в соответствии с вводом в EditText @Override protected FilterResults performFiltering(CharSequence charSequence) { FilterResults result = new FilterResults(); if (charSequence == null || charSequence.length() == 0) { result.values = resReq; // здесь контролируем чтобы при пустой строке было отображение всего списка. result.count = resReq.size(); } else { ArrayList<Albums> filteredList = new ArrayList<>(); charSequence = charSequence.toString().toLowerCase(); for (Albums p : resReq) { if (p.getCollectionName().toLowerCase().startsWith(charSequence.toString())) //если начинается с введенной строки добавляем в результат filteredList.add(p); } result.values = filteredList; result.count = filteredList.size(); } return result; } @Override protected void publishResults(CharSequence charSequence, FilterResults filterResults) { refreshData(); albums.clear(); albums.addAll((ArrayList<Albums>) filterResults.values); Log.d("ATTENTION", "performFiltering: " + getCount()); notifyDataSetChanged(); } }; return filter; } // Сбрасываем массив альбомов до начального public void refreshData() { albums.clear(); albums.addAll(resReq); } }
[ "6420527@gmail.com" ]
6420527@gmail.com
7503a7875270f1c7ca2a6285f8f8658b75440426
da743d91c7f24087f70c031d5730990e777afb70
/android/app/src/main/java/com/equalai/MainApplication.java
81d41385a998aa9218510cf9dc44e255a1102647
[]
no_license
juanjopm09/EqualAI
f9b1ae1397c733d9d25da88d86912b21e0b4bcc3
e4829eb538edf2495046dad2a749ad5440dce074
refs/heads/master
2020-06-01T06:39:34.872499
2019-05-31T02:42:39
2019-05-31T02:42:39
190,682,733
0
0
null
2019-06-07T03:24:27
2019-06-07T03:24:27
null
UTF-8
Java
false
false
1,242
java
package com.equalai; import android.app.Application; import com.facebook.react.ReactApplication; import com.oblador.vectoricons.VectorIconsPackage; import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new VectorIconsPackage(), new RNGestureHandlerPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
[ "pablomoto1000@gmail.com" ]
pablomoto1000@gmail.com
c01a348d58f4c9bd93e094fe1af95b0d3fec0196
eb3b365aabb892ec5f44289b95a7830dae56a8a4
/src/main/java/com/txts/task/SchedulerAllJob.java
6eb3766f51f7d921734a5f3db88c4134d6f79f21
[]
no_license
baldass/exh
b0bd579c6bbb961cda3336f2d2d3cc13b67d8b39
9858fb629e3f96b2d7071c9b4130b618aa3e7e92
refs/heads/master
2022-06-26T14:23:29.564242
2019-11-19T17:22:39
2019-11-19T17:22:39
155,844,117
0
1
null
2022-06-17T02:01:35
2018-11-02T09:32:14
Java
UTF-8
Java
false
false
4,602
java
package com.txts.task; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; import org.quartz.JobBuilder; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SimpleScheduleBuilder; import org.quartz.SimpleTrigger; import org.quartz.TriggerBuilder; import org.quartz.impl.StdSchedulerFactory; import org.springframework.stereotype.Component; /** * Created by 赵亚辉 on 2017/12/18. */ @SuppressWarnings("all") @Component public class SchedulerAllJob { private StdSchedulerFactory schedulerFactoryBean; public SchedulerAllJob(){ Properties props = new Properties(); schedulerFactoryBean= new StdSchedulerFactory(); try { schedulerFactoryBean.initialize(props); } catch (SchedulerException e) { // TODO Auto-generated catch block e.printStackTrace(); } } //日期格式转换器 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat df2 = new SimpleDateFormat("HH:mm:ss"); public void restartScheduleJobs() throws Exception { try { this.stop(); this.scheduleJobs(); } catch (Exception e) { e.printStackTrace(); } } /* * 此处可以注入数据库操作,查询出所有的任务配置 */ /** * 该方法用来启动所有的定时任务 * @throws Exception */ public void scheduleJobs() throws Exception { //定时器对象 Scheduler scheduler = schedulerFactoryBean.getScheduler(); //秒数执行 this.scheduleJobSimple(scheduler, 6, 1); this.scheduleJobSimple(scheduler, 11, 2); //cron表达式 this.scheduleJob(scheduler, "0 * * * * ?", 4); this.scheduleJob(scheduler, "30 * * * * ?", 4); scheduler.start(); } public void stop() throws SchedulerException { Scheduler scheduler = schedulerFactoryBean.getScheduler(); scheduler.clear(); //清楚全部的任务 } private void scheduleJob(Scheduler scheduler,String cron,int num) throws SchedulerException{ try { /* * 此处可以先通过任务名查询数据库,如果数据库中存在该任务,则按照ScheduleRefreshDatabase类中的方法,更新任务的配置以及触发器 * 如果此时数据库中没有查询到该任务,则按照下面的步骤新建一个任务,并配置初始化的参数,并将配置存到数据库中 */ JobDetail jobDetail = JobBuilder.newJob(ScheduledJob.class) .withIdentity("job"+num, "group"+num).build(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); //放入执行时需要的参数 jobDataMap.put("test", "cron"); // 根据cron表达式 执行 CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cron); CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity("trigger"+num, "group"+num) .withSchedule(scheduleBuilder).build(); scheduler.scheduleJob(jobDetail,cronTrigger); } catch (Exception e) { e.printStackTrace(); } } private void scheduleJobSimple(Scheduler scheduler,int seconds,int num) throws SchedulerException{ /* * 此处可以先通过任务名查询数据库,如果数据库中存在该任务,则按照ScheduleRefreshDatabase类中的方法,更新任务的配置以及触发器 * 如果此时数据库中没有查询到该任务,则按照下面的步骤新建一个任务,并配置初始化的参数,并将配置存到数据库中 */ try { JobDetail jobDetail = JobBuilder.newJob(ScheduledJob.class) .withIdentity("job"+num, "group"+num).build(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); //放入执行时需要的参数 jobDataMap.put("test", "simple"); //每x秒执行一次 SimpleScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.repeatSecondlyForever(seconds); SimpleTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity("trigger"+num, "group"+num).withSchedule(scheduleBuilder).build(); scheduler.scheduleJob(jobDetail,cronTrigger); } catch (Exception e) { e.printStackTrace(); } } }
[ "chigj@amtxts.com" ]
chigj@amtxts.com
9aac98e70ed14631157732a1054ba5fd61c3ee32
ae4cb3cc1de2317c640941e6b93079704ffe1f32
/src/main/java/com/belyaev/dao/exception/DAOException.java
d5c3d676291bccd09db29a994abc98791bb809e8
[]
no_license
PesahLavan/department-employee
360e7277e08d154e59b30abc5b3300b1e0e250ff
ad0e715c388b20eaa48b9148c94b7d83efb89cee
refs/heads/master
2021-09-03T21:42:31.122644
2018-01-12T07:39:49
2018-01-12T07:39:49
113,315,129
0
1
null
null
null
null
UTF-8
Java
false
false
430
java
package com.belyaev.dao.exception; /** * @author Pavel Belyaev * @since 27-Nov-17 */ public class DAOException extends Exception { public DAOException() { super(); } public DAOException(String message) { super(message); } public DAOException(String message, Throwable cause) { super(message, cause); } public DAOException(Throwable cause) { super(cause); } }
[ "pesahlavan@mail.ru" ]
pesahlavan@mail.ru
89711997a4e88ce2a2bf07378fc39853e040d1b0
5e73f5a6ccffc7fb30197ec8dc2a99f4619bef60
/Web2/JVM-studay/src/main/java/jmm/ClassLoadLook.java
243e19f50835eec92a533ca4ec1f5e5f78411747
[]
no_license
Deerlet-7/exercise
47a26bb0bd0dcbbfaf0302e0b73371b1acd6dae5
925eadc9d2b65a7fef70729541750e35473594ce
refs/heads/master
2021-07-24T03:45:16.375668
2020-09-05T13:13:25
2020-09-05T13:13:25
215,069,832
1
0
null
null
null
null
UTF-8
Java
false
false
462
java
package jmm; public class ClassLoadLook { public static void main(String[] args) throws ClassNotFoundException { Child2 c2 = new Child2(200, "child2"); int x = InterfaceLoad.X; Class c3 = Child.class; //大家想想下边的打印顺序 Class.forName("jmm.Child3"); int a = Child.A; // new Child(200); //再次修改一下,把Child类定义在parent类外边,再看看运行结果 } }
[ "liyan000611@outlook.com" ]
liyan000611@outlook.com
c285803c5738449cd403ffcdfd7febc255aba6fc
6fe0473cfa3699bc3ed99ae159ea5bcfd29b9e4b
/euler/Problem079.java
26a8f3ce11ce17af44a005a835630e239440f969
[]
no_license
digideskio/contest
52836b5b7afc9d59194626f17844bdfd5e755a93
83657f96544a742ef746eda926622799fd080369
refs/heads/master
2021-01-21T03:46:16.857522
2015-03-25T22:42:56
2015-03-25T22:42:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,645
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package projecteuler; /** * * @author Manan */ public class Problem079 { /* * I solved this problem in Excel with basic number sorting and logic * reasoning is as follows: */ /* Sorted without repeats: 890 Analysis: Sequence: 790 no 4's or 5's 7 7 769 nothing comes before 7 3 3 762 nothing comes after 0 1 6 760 nothing comes after 9 6 x 736 2 x 8 x 731 our sequence needs these properties: 729 starts with 7 9 x 728 ends with 0 0 x 720 719 process to get the solution: 718 1. start with 7 716 2. go through each ending and see if a sequence 710 terminates unexpectedly/repeates values 690 3. attain result (no repeats, ends with 0) 689 680 629 620 389 380 368 362 319 318 316 290 289 180 168 162 160 129 */ }
[ "manan.shah.777@gmail.com" ]
manan.shah.777@gmail.com
ffcd74b38bffdab6ff1d58451e78c7e7193fa6f7
d4d1636f62f71577d782c18a97a5a2f8ec5e9dcd
/src/main/java/com/hesj/threads/four/BlockingQueueWithSync.java
6494ac9f811d1ef2decaa359db8e50f3157d6235
[]
no_license
hesj/threads
7db5cecee20efb8082b6254ea070b8dbdec5e5ca
82239f3794898e1553caf23d8a35097ac855f0d4
refs/heads/master
2022-11-30T01:31:58.403375
2020-07-27T17:34:26
2020-07-27T17:34:26
282,692,855
0
0
null
null
null
null
UTF-8
Java
false
false
924
java
package com.hesj.threads.four; import java.util.ArrayList; import java.util.List; public class BlockingQueueWithSync<E> implements BlockingQueue<E> { private List<E> queue = new ArrayList<>(); private int maxSize; BlockingQueueWithSync(int maxSize) { this.maxSize = maxSize; } @Override public synchronized void put(E e) throws InterruptedException { while (this.size() == maxSize) { wait(); } queue.add(e); notifyAll(); } @Override public synchronized E take() throws InterruptedException { while (this.size() == 0) { wait(); } E remove = queue.remove(0); notifyAll(); return remove; } @Override public synchronized int size() { return queue.size(); } @Override public synchronized boolean isEmpty() { return queue.isEmpty(); } }
[ "ageminis@outlook.com" ]
ageminis@outlook.com
9b4b90ba97816235f42dba174734884ecbbddb33
408b3acf76f6e22b7620ee3e912748b6d0d715f4
/wakfu.common/src/com/ankamagames/framework/fileFormat/html/parser/lexer/impl/TokenTagImpl.java
148d5f4cb06168e4e13558496abd1c7c5b55be6c
[]
no_license
brunorcunha/wakfu-dirty-legacy
537dad1950f4518050941ff2711a2faffa48f1a4
a3f2edf829e4b690e350eed1962d5d0d9bba25ed
refs/heads/master
2021-06-18T08:43:52.395945
2015-05-04T14:58:56
2015-05-04T14:58:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,392
java
package com.ankamagames.framework.fileFormat.html.parser.lexer.impl; import com.ankamagames.framework.fileFormat.html.parser.*; import com.ankamagames.framework.fileFormat.html.parser.datasource.*; import java.util.*; public class TokenTagImpl implements TokenTag { private List<TagAttribute> attrs; private StringBuffer tagName; private StringBuffer rawHtml; private boolean isClosed; private boolean endClosed; private PageSource pageSource; private int startIndex; private int endIndex; private int tokenIndex; TokenTagImpl() { super(); this.attrs = null; this.tagName = null; this.rawHtml = null; this.isClosed = false; this.endClosed = false; this.pageSource = null; this.startIndex = -1; this.endIndex = -1; this.tokenIndex = -1; } void initValue() { if (this.attrs == null) { this.attrs = new ArrayList<TagAttribute>(); } this.attrs.clear(); this.tagName = new StringBuffer(""); this.rawHtml = new StringBuffer(""); this.isClosed = false; this.endClosed = false; this.pageSource = null; this.startIndex = -1; this.endIndex = -1; } @Override public List<TagAttribute> getAttrs() { return this.attrs; } void setAttribute(final List<TagAttribute> attrs) { this.attrs = attrs; } void addAttribute(final TagAttribute attr) { if (this.attrs == null) { this.attrs = new ArrayList<TagAttribute>(); } this.attrs.add(attr); } void addAttribute(final String attrName, final String attrValue) { if (this.attrs == null) { this.attrs = new ArrayList<TagAttribute>(); } this.attrs.add(new TagAttribute(attrName, attrValue)); } @Override public String getTagName() { return this.tagName.toString(); } void setTagName(final String tagName) { this.tagName = new StringBuffer(tagName); } void appendTagName(final char ch) { this.tagName.append(ch); } @Override public boolean isClosedTag() { return this.isClosed; } void setCloseTag(final boolean closed) { this.isClosed = closed; } @Override public boolean isEndClosed() { return this.endClosed; } void setEndClosed(final boolean endClosed) { this.endClosed = endClosed; } @Override public int getEndPosition() { return this.endIndex; } void setEndPosition(final int position) { this.endIndex = position; } @Override public PageSource getPage() { return this.pageSource; } void setPageSource(final PageSource ps) { this.pageSource = ps; } @Override public int getStartPosition() { return this.startIndex; } void setStartPosition(final int position) { this.endIndex = position; } @Override public String toHtml() { String strRet = "<"; if (this.isClosed) { strRet += "/"; } strRet += this.tagName; if (this.attrs != null && this.attrs.size() > 0) { for (final TagAttribute attr : this.attrs) { strRet = strRet + " " + attr.getAttrName() + "=\"" + attr.getAttrValue() + "\""; } } if (this.endClosed) { strRet += "/"; } return strRet + ">"; } void setToHtml(final String rawHtml) { this.rawHtml = new StringBuffer(rawHtml); } @Override public String toString() { String retString = "[TAG]"; if (this.isClosed) { retString += "/"; } retString = retString + this.tagName + "("; if (this.attrs != null) { for (final TagAttribute tAttr : this.attrs) { retString = retString + tAttr.getAttrName() + ":" + tAttr.getAttrValue() + " "; } } retString = retString.trim(); retString += ")"; return retString; } void setIndex(final int idx) { this.tokenIndex = idx; } @Override public int getIndex() { return this.tokenIndex; } }
[ "hussein.aitlahcen@gmail.com" ]
hussein.aitlahcen@gmail.com
5d637af31af46db402c939124c7c35f752a71915
fce501f921c557e5f408f0b8827de64a57db8abc
/app/src/main/java/edu/uncc/wins/gestureslive/StretchSegmentToPointLength.java
d8974b64e406608f001393368f8ea4a1829fa6f6
[]
no_license
jackbandy/HighFiveLive-android
51fc96058c89db8d29df5ac6a288fc643c4c6114
bdf60560220da1416d57172caa0cece0127b9f7b
refs/heads/master
2021-01-19T01:58:04.815684
2016-07-15T20:41:36
2016-07-15T20:41:36
37,877,291
3
1
null
null
null
null
UTF-8
Java
false
false
2,874
java
package edu.uncc.wins.gestureslive; import android.util.Log; import java.util.ArrayList; /** * StretchSegmentToPointLength.java * Class for a preprocessor to handle a new segment and output an adjusted segment. * This is mainly for the DFT, which needs data points provided in a power of two * * Created by jbandy3 on 6/16/2015. */ public class StretchSegmentToPointLength extends SegmentHandler { private int desiredPointLength; public StretchSegmentToPointLength(SegmentHandler nextHandler, int pointLength) { super(nextHandler); desiredPointLength = pointLength; } @Override /** * Do something with the raw segment data * @param segmentPoints a 3-item array, whose items are all the coordinates of the segment */ void handleNewSegment(ArrayList<Coordinate> segmentPoints, double[] featureVector) { //process the data, features not yet extracted at this point //Log.v("TAG", "RECEIVED segment from segmentor"); //myNextHandler.handleNewSegment(keepAtCenter(segmentPoints), null); myNextHandler.handleNewSegment(pushToLeft(segmentPoints), null); //Log.v("TAG", "PUSHED to handler from preprocessor"); } private ArrayList<Coordinate> pushToLeft(ArrayList<Coordinate> segmentPoints){ ArrayList<Coordinate> toPass = new ArrayList<Coordinate>(desiredPointLength); Coordinate fluffCoordinate = new Coordinate(0.,0.,0.); int initialSize = segmentPoints.size(); int fluffPointsNeeded = desiredPointLength - initialSize; int currentSize = 0; //Add the actual segment points toPass.addAll(currentSize, segmentPoints); currentSize += initialSize; //Fill in the last part of the array while(currentSize< desiredPointLength) toPass.add(currentSize++,fluffCoordinate); return toPass; } private ArrayList<Coordinate> keepAtCenter(ArrayList<Coordinate> segmentPoints){ ArrayList<Coordinate> toPass = new ArrayList<Coordinate>(desiredPointLength); Coordinate fluffCoordinate = new Coordinate(0.,0.,0.); int initialSize = segmentPoints.size(); int fluffPointsNeeded = desiredPointLength - initialSize; int currentSize = 0; //Fill in the first part of the array while(currentSize < fluffPointsNeeded / 2) toPass.add(currentSize++,fluffCoordinate); //Add the actual segment points //Log.v("TAG", "Old Points: " + segmentPoints.toString()); toPass.addAll(currentSize, segmentPoints); //Log.v("TAG", "New Points: " + toPass.toString()); currentSize += initialSize; //Fill in the last part of the array while(currentSize< desiredPointLength) toPass.add(currentSize++,fluffCoordinate); return toPass; } }
[ "jack.bandy@my.wheaton.edu" ]
jack.bandy@my.wheaton.edu
e33e9f987693327eb0e2ac960ba484bcecd29f7b
005932dc8ec03617d7f741e5c80881c1d37979a4
/rsocket-core/src/main/java/io/rsocket/util/AbstractionLeakingFrameUtils.java
7e5a5d771db19cd39165c8d99105094c602700c7
[ "Apache-2.0" ]
permissive
zmyer/rsocket-java
42c98d7636f7e26b029057cf51b560da36232e72
92b8009e07c546fdab5f0e397c66a9bb5165b42d
refs/heads/1.0.x
2020-08-18T05:11:49.031444
2019-06-06T07:36:23
2019-06-06T07:36:23
132,728,684
0
0
Apache-2.0
2019-10-17T09:13:00
2018-05-09T08:49:19
Java
UTF-8
Java
false
false
3,661
java
/* * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.rsocket.util; import static io.netty.util.ReferenceCountUtil.release; import static io.rsocket.framing.FrameLengthFrame.createFrameLengthFrame; import static io.rsocket.framing.StreamIdFrame.createStreamIdFrame; import static io.rsocket.util.DisposableUtils.disposeQuietly; import io.netty.buffer.ByteBufAllocator; import io.rsocket.Frame; import io.rsocket.framing.FrameFactory; import io.rsocket.framing.FrameLengthFrame; import io.rsocket.framing.StreamIdFrame; import java.util.Objects; import reactor.util.function.Tuple2; import reactor.util.function.Tuples; public final class AbstractionLeakingFrameUtils { private AbstractionLeakingFrameUtils() {} /** * Returns a {@link Tuple2} of the stream id, and the frame. This strips the frame length and * stream id header from the abstraction leaking frame. * * @param abstractionLeakingFrame the abstraction leaking frame * @return a {@link Tuple2} of the stream id, and the frame * @throws NullPointerException if {@code abstractionLeakingFrame} is {@code null} */ public static Tuple2<Integer, io.rsocket.framing.Frame> fromAbstractionLeakingFrame( Frame abstractionLeakingFrame) { Objects.requireNonNull(abstractionLeakingFrame, "abstractionLeakingFrame must not be null"); FrameLengthFrame frameLengthFrame = null; StreamIdFrame streamIdFrame = null; try { frameLengthFrame = createFrameLengthFrame(abstractionLeakingFrame.content()); streamIdFrame = frameLengthFrame.mapFrameWithoutFrameLength(StreamIdFrame::createStreamIdFrame); io.rsocket.framing.Frame frame = streamIdFrame.mapFrameWithoutStreamId(FrameFactory::createFrame); return Tuples.of(streamIdFrame.getStreamId(), frame); } finally { disposeQuietly(frameLengthFrame, streamIdFrame); release(abstractionLeakingFrame); } } /** * Returns an abstraction leaking frame with the stream id and frame. This adds the frame length * and stream id header to the frame. * * @param byteBufAllocator the {@link ByteBufAllocator} to use * @param streamId the stream id * @param frame the frame * @return an abstraction leaking frame with the stream id and frame * @throws NullPointerException if {@code byteBufAllocator} or {@code frame} is {@code null} */ public static Frame toAbstractionLeakingFrame( ByteBufAllocator byteBufAllocator, int streamId, io.rsocket.framing.Frame frame) { Objects.requireNonNull(byteBufAllocator, "byteBufAllocator must not be null"); Objects.requireNonNull(frame, "frame must not be null"); StreamIdFrame streamIdFrame = null; FrameLengthFrame frameLengthFrame = null; try { streamIdFrame = createStreamIdFrame(byteBufAllocator, streamId, frame); frameLengthFrame = createFrameLengthFrame(byteBufAllocator, streamIdFrame); return frameLengthFrame.mapFrame(byteBuf -> Frame.from(byteBuf.retain())); } finally { disposeQuietly(frame, streamIdFrame, frameLengthFrame); } } }
[ "yuri@schimke.ee" ]
yuri@schimke.ee
75c6909b6a4ea2d7cd7ddddc985a191d96406661
65a6345a544888bcbdbc5c04aa4942a3c201e219
/src/main/java/mayday/Reveal/filter/gui/RuleSetEditorItem.java
02dcebaeef7321346085fe610b2b9b4d029dd0f7
[]
no_license
Integrative-Transcriptomics/Mayday-level2
e7dd61ba68d149bed845b173cced4db012ba55b1
46a28829e8ead11794951fbae6d61e7ff37cad4a
refs/heads/master
2023-01-11T21:57:47.943395
2016-04-25T12:59:01
2016-04-25T12:59:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
package mayday.Reveal.filter.gui; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import mayday.Reveal.data.SNVList; import mayday.core.gui.properties.items.AbstractPropertiesItem; @SuppressWarnings("serial") public class RuleSetEditorItem extends AbstractPropertiesItem { public RuleSetEditorItem() { super("SNP Rule Set"); } private SNVList snpList; private RuleEditorPanel rep; public RuleSetEditorItem(SNVList snpList) { this(); setLayout(new BorderLayout()); this.snpList = snpList; rep = new RuleEditorPanel(snpList); add(rep, BorderLayout.CENTER); } @Override public Object getValue() { return null; } @Override public void setValue(Object value) {} @Override public boolean hasChanged() { return false; } public void apply() { rep.doExternalApply(); } protected class OpenEditorAction extends AbstractAction { public OpenEditorAction() { super( "Open Rule Set Editor" ); } public void actionPerformed( ActionEvent event ) { new RuleEditorDialog(snpList).setVisible(true); } } }
[ "adrian.geissler@student.uni-tuebingen.de" ]
adrian.geissler@student.uni-tuebingen.de
ebc5d0d493412b093364e5b30ad58ff224a214fd
f3b63db883c3c055d7b420fba1438870144d95f8
/language/src/main/java/net/frodwith/jaque/exception/NockControlFlowException.java
805e77717d38a5b84d33e63eb8279e41832897c3
[]
no_license
stjordanis/jaque-fresh
e7c96d4dc51a8036c359032d5e5e0b0fde7db282
9f8ba432549f3e7d5bba3121dc32067debf0d3d7
refs/heads/master
2022-04-14T18:24:07.750116
2019-01-16T20:06:08
2019-01-16T20:06:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package net.frodwith.jaque.exception; import com.oracle.truffle.api.nodes.ControlFlowException; import net.frodwith.jaque.data.NockFunction; import net.frodwith.jaque.data.NockCall; public final class NockControlFlowException extends ControlFlowException { public final NockCall call; public NockControlFlowException(NockCall call) { this.call = call; } }
[ "frodwith@gmail.com" ]
frodwith@gmail.com
d2beead75a972cc24c27deba5c233cf7bf5f3759
30bd33b2bd018a72b77bcebaa616e4e6497a1d80
/ChatSite/app/src/main/java/apps/nocturnal/com/chatsite/UsersActivity.java
aedaf61c996a10782541a8052aa89aa73c4bfaf9
[]
no_license
Leonardo-daVinci/ChatSite
b879f1d2f47e34cea5dcf7db07af7c800426879a
39f0bf39ca785fa38cddf58798d913aa045dfe2f
refs/heads/master
2023-01-31T14:04:51.179917
2019-06-12T18:08:06
2019-06-12T18:08:06
191,614,669
0
0
null
2022-12-09T06:07:45
2019-06-12T17:18:25
Java
UTF-8
Java
false
false
4,564
java
package apps.nocturnal.com.chatsite; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.firebase.ui.database.FirebaseRecyclerOptions; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.squareup.picasso.Picasso; import de.hdodenhof.circleimageview.CircleImageView; public class UsersActivity extends AppCompatActivity { private Toolbar mToolbar; private RecyclerView mUsersList; private FirebaseRecyclerAdapter<Users,UsersActivity.UsersViewholder> mUsersAdapter; private DatabaseReference mDatabase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_users); mToolbar = findViewById(R.id.users_appbar); setSupportActionBar(mToolbar); getSupportActionBar().setTitle("All User"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mUsersList = findViewById(R.id.users_list); mUsersList.setHasFixedSize(true); mUsersList.setLayoutManager(new LinearLayoutManager(this)); mDatabase = FirebaseDatabase.getInstance().getReference().child("Users"); mDatabase.keepSynced(true); //new //new Use mDatabase instead of UserRef DatabaseReference UserRef = FirebaseDatabase.getInstance().getReference().child("Users"); Query UserQuery = UserRef.orderByKey(); FirebaseRecyclerOptions UsersOptions = new FirebaseRecyclerOptions.Builder<Users>().setQuery(UserQuery,Users.class).build(); mUsersAdapter = new FirebaseRecyclerAdapter<Users, UsersViewholder>(UsersOptions) { @Override protected void onBindViewHolder(@NonNull UsersViewholder holder, int position, @NonNull final Users model) { holder.setName(model.getName()); holder.setStatus(model.getStatus()); holder.setImage(getBaseContext(),model.getImage()); final String user_id = getRef(position).getKey(); holder.mView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent profileIntent = new Intent (UsersActivity.this, ProfileActivity.class); profileIntent.putExtra("user_id",user_id); startActivity(profileIntent); } }); } @NonNull @Override public UsersViewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.users_adapter, parent,false); return new UsersActivity.UsersViewholder(view); } }; mUsersList.setAdapter(mUsersAdapter); } @Override protected void onStart() { super.onStart(); mUsersAdapter.startListening(); } @Override protected void onStop() { super.onStop(); mUsersAdapter.stopListening(); } public static class UsersViewholder extends RecyclerView.ViewHolder{ View mView; UsersViewholder(View itemView) { super(itemView); mView = itemView; } public void setName(String name){ TextView userNameView = mView.findViewById(R.id.users_display_name); userNameView.setText(name); } public void setStatus (String status){ TextView userStatusView = mView.findViewById(R.id.users_status); userStatusView.setText(status); } public void setImage (Context context, String image){ CircleImageView userImage = mView.findViewById(R.id.users_image); Picasso.get().load(image).into(userImage); //check this later Picasso.with(context).load(image).into(userImage) } } }
[ "akshitkeoliya4@gmail.com" ]
akshitkeoliya4@gmail.com
ec61b066bb71cd8cd8cacfcf5ff2c8225ffd7f56
5054008541a1b3988805d73f12ca2a20e25aa4fd
/app/src/main/java/me/gumenny/githubler/presentation/view/ProgressView.java
39a849838e98befceec210791d731d47121d769d
[]
no_license
Arkadzi/githubler
4cf69890be0a9a9e1d27932d768872c489065faa
02b3d5e24eceee53ae375b282eada3a4f2ffcade
refs/heads/master
2021-01-21T05:59:15.168855
2017-08-31T21:53:51
2017-08-31T21:53:51
101,931,005
0
0
null
null
null
null
UTF-8
Java
false
false
146
java
package me.gumenny.githubler.presentation.view; public interface ProgressView extends View { void showProgress(); void hideProgress(); }
[ "humennyi.arkadii@gmail.com" ]
humennyi.arkadii@gmail.com
bb2289dba261d8ac1f97f6fb353e0aa57a05aa58
7c8ae6b33e3d2b5d91179093e1cde99bc61da310
/crud_agenda_telefonica/src/com/agenda/persistence/ReadAgenda.java
afe92c18f0af095be410f59e043207261843e85d
[]
no_license
ubiratantavares/JPA_Hibernate
70a308a178b23e556dde93e0374c6e542208dd7d
e9d41b2dc98d07a1c0b0a6c26d44b23564a49e25
refs/heads/main
2023-06-20T23:37:50.235402
2021-08-02T14:10:14
2021-08-02T14:10:14
388,299,219
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package com.agenda.persistence; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import com.agenda.modelo.Agenda; public class ReadAgenda { public Agenda consultar(Integer codigo) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("exemploPU"); EntityManager em = emf.createEntityManager(); Agenda agenda = em.find(Agenda.class, codigo); return agenda; } }
[ "ust1973@gmail.com" ]
ust1973@gmail.com
762ac95f9c1b072cb465be6a7df2f0512feffde9
ddce6aa9aa6ac13312376ec08e6b0453d3412e57
/alternativmud-server/src/main/java/net/alternativmud/logic/game/commands/Time.java
3158139298cb25c6812b178eb5de6f88fd76b115
[ "MIT" ]
permissive
Jblew/alternativ-mud
d5cc1a587d462eeb3d01b809e80fd4205ff5083a
7845d89b3c92aa3d41704dde628c391bfe1cb264
refs/heads/master
2021-01-01T17:05:05.206726
2019-06-23T11:24:10
2019-06-23T11:24:10
15,583,256
2
1
MIT
2020-10-23T22:06:26
2014-01-02T12:37:40
Java
UTF-8
Java
false
false
433
java
package net.alternativmud.logic.game.commands; import net.alternativmud.App; import net.alternativmud.logic.game.Gameplay; /** * @author noosekpl */ public class Time implements Command { @Override public String execute(Gameplay game, String[] parts) { return "Czas(dla twojej strefy): "+ App.getApp().getWorld().getTimeMachine() .getString(game.getCharacter().getLocationCoordinates()); } }
[ "jedrzejblew@gmail.com" ]
jedrzejblew@gmail.com
89662fee316bfd3de40ac41c7b333e158c3a0aeb
0681a75162d05279d98b4a3ccd9c7b9fada529c9
/src/test/java/com/mahmud/recipeapp/converters/NotesCommandToNotesTest.java
bd83aff0c0f821b612514415b92af245c3abb2b0
[]
no_license
MahmudSiraj/recipe-app
28c9b199ce4b5435adb6702d86fca2ffde7e7470
2268b02c0743f1a9e6648c83cc84d5aa86d4e3d0
refs/heads/master
2020-06-29T02:07:26.916487
2019-09-18T22:46:52
2019-09-18T22:46:52
200,405,666
0
0
null
null
null
null
UTF-8
Java
false
false
1,213
java
package com.mahmud.recipeapp.converters; import com.mahmud.recipeapp.commands.NotesCommand; import com.mahmud.recipeapp.domain.Notes; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class NotesCommandToNotesTest { public static final Long ID_VALUE = new Long(1L); public static final String RECIPE_NOTES = "Notes"; NotesCommandToNotes converter; @Before public void setUp() throws Exception { converter = new NotesCommandToNotes(); } @Test public void testNullParameter() throws Exception { assertNull(converter.convert(null)); } @Test public void testEmptyObject() throws Exception { assertNotNull(converter.convert(new NotesCommand())); } @Test public void convert() throws Exception { //given NotesCommand notesCommand = new NotesCommand(); notesCommand.setId(ID_VALUE); notesCommand.setRecipeNotes(RECIPE_NOTES); //when Notes notes = converter.convert(notesCommand); //then assertNotNull(notes); assertEquals(ID_VALUE, notes.getId()); assertEquals(RECIPE_NOTES, notes.getRecipeNotes()); } }
[ "mahmud.siraj@outlook.com" ]
mahmud.siraj@outlook.com
d70cef016595250a8e2e8f4c3182a874163d97ff
b153668e5bd2920c45ab9c595c8a0bc70c3c11b6
/app/src/main/java/com/knobtviker/thermopile/di/qualifiers/presentation/messengers/FramMessenger.java
acc5d2ac5788fb141a0249f52dd92cd28801fd6f
[]
no_license
knobtviker/thermopile
2a60724d0d49f3b48141323e4b2e6f9e3cd0624e
2df36081522314e3433a6bad7db9168c16398af7
refs/heads/master
2020-12-25T18:52:29.170952
2018-09-10T19:55:56
2018-09-10T19:55:56
94,003,548
7
2
null
2018-09-10T19:55:57
2017-06-11T12:39:36
Java
UTF-8
Java
false
false
370
java
package com.knobtviker.thermopile.di.qualifiers.presentation.messengers; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Created by bojan on 17/08/2018. */ @Qualifier @Documented @Retention(RUNTIME) public @interface FramMessenger { }
[ "knobtviker@gmail.com" ]
knobtviker@gmail.com
11cff608a413871f64ffcf8f545167bd7fb10158
428a3a87dde694519a4c698cdc3b444cec146bf5
/src/main/java/com/chickling/kmanager/jmx/JMXExecutor.java
582568a48e708924599913290b0df21ec7955148
[ "Apache-2.0" ]
permissive
xaecbd/kmanager
27ccfcafb656b9c62385acb1ffb698ee28db28cd
4c3adb198d5f39eb5257f5af91cd16b07cb0d80c
refs/heads/master
2020-04-25T09:12:38.609419
2019-02-26T08:30:02
2019-02-26T08:30:02
172,669,402
7
1
Apache-2.0
2019-02-26T08:30:03
2019-02-26T08:28:15
Java
UTF-8
Java
false
false
238
java
package com.chickling.kmanager.jmx; import javax.management.remote.JMXConnector; /** * @author Hulva Luva.H * @since 2017-07-11 * */ public interface JMXExecutor { public void doWithConnection(JMXConnector jmxc); }
[ "lvsweet217@163.com" ]
lvsweet217@163.com
5feb22f99db56c406f6a46ad9b6ea4b66ce78ddf
c7308f49b2fed2c3d326e432a1e8a0106580a6a8
/Q_1300.java
6f1385385d15417215fdc0ba6cac2fdbe5c8229f
[]
no_license
kafkaaaa/baekjoon
5b0b227115733b4c88dbc444abaf169c05034eea
1f3a8347512d812223fa0fc2057235a4ac23d034
refs/heads/master
2022-06-17T06:01:33.631666
2022-05-19T14:33:08
2022-05-19T14:33:08
237,454,206
3
0
null
null
null
null
UTF-8
Java
false
false
948
java
package stepbystep; import java.util.Scanner; // Binary Search // https://www.acmicpc.net/problem/1300 public class Q_1300 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); scan.close(); long left = 1; long right = K; long mid; long result = 0; // binary search while (left <= right) { mid = (left + right) / 2; long cnt = 0; // mid 이하의 수의 개수를 카운트 for (int i = 1; i <= N; i++) { cnt += Math.min(mid / i, N); } if (cnt < K) { left = mid + 1; } else { result = mid; right = mid - 1; } } System.out.println(result); } }
[ "csky222@naver.com" ]
csky222@naver.com
c9e8c12974ea07d655e140b3a71fbeec05b91941
6794781fe38222a9f4c19f48dfb908103657be4a
/src/Learn/ArrayAndString/MinimumSizeSubarraySum.java
faba98a7d987e66102d046db4581714f12a03a3a
[]
no_license
zt19994/leetcode
6856a4106cad448d091e52b32406e2ee5dd16828
ed695b82b136a5d2dd91624eccadf5d79a21c1f0
refs/heads/master
2020-03-27T14:46:05.160037
2019-04-20T06:01:24
2019-04-20T06:01:24
146,677,694
0
0
null
null
null
null
UTF-8
Java
false
false
1,571
java
package Learn.ArrayAndString; import org.junit.Test; /** * 最小长度数组和 * * @author zhongtao on 2018/9/19 */ public class MinimumSizeSubarraySum { /** * 两层for循环,有点慢 */ public int minSubArrayLen(int s, int[] nums) { int result = Integer.MAX_VALUE; int k = 0; for (int i = 0; i < nums.length; i++) { int sum = 0; for (int j = i; j < nums.length; j++) { sum += nums[j]; if (sum >= s) { k = j - i + 1; result = k < result ? k : result; break; } } } return result < Integer.MAX_VALUE ? result : 0; } /** * 双指针,快速 */ public int minSubArrayLen1(int s, int[] nums) { int result = 0; int start = 0; int sum = 0; for (int i = 0; i < nums.length; i++) { sum += nums[i]; while (sum - nums[start] >= s) { sum -= nums[start]; start++; } //获取最小值 if (sum >= s) { if (result == 0 || result > i - start + 1) { result = i - start + 1; } } } return result; } /** * 测试 */ @Test public void test() { int[] nums = {2, 3, 1, 2, 4, 3, 7}; int i = minSubArrayLen(7, nums); int j = minSubArrayLen1(7, nums); System.out.println(i + " " + j); } }
[ "zt191610942@163.com" ]
zt191610942@163.com
4b7ce169e014a5a46d5fabbd196f8219c1692600
60cc93c313611e726b81e89a701f4b1b6fd6efa3
/trees/jebl/evolution/trees/ReRootedTree.java
520a1cb59971d30d8e96613f005cacdb90c02862
[]
no_license
jnarag/teaspoon
491743a723eabe774b68b19691d00fae7d9cb572
3615ab83bf23175fc589a26df3e051265405102f
refs/heads/master
2021-01-10T09:49:42.747319
2018-08-14T14:15:02
2018-08-14T14:15:02
53,742,467
6
1
null
2017-04-24T12:45:42
2016-03-12T16:51:25
Java
UTF-8
Java
false
false
899
java
package jebl.evolution.trees; /** * @author Andrew Rambaut * @author Alexei Drummond * @version $Id: ReRootedTree.java 776 2007-09-05 11:17:12Z rambaut $ */ public class ReRootedTree extends FilteredRootedTree { public enum RootingType { MID_POINT("midpoint"), LEAST_SQUARES("least squares"); RootingType(String name) { this.name = name; } public String toString() { return name; } private String name; } public ReRootedTree(final RootedTree source, RootingType rootingType) { super(source); switch (rootingType) { case MID_POINT: break; case LEAST_SQUARES: break; default: throw new IllegalArgumentException("Unknown enum value"); } } // PRIVATE members // private final Node rootChild1; // private final Node rootChild2; // private final double rootLength1; // private final double rootLength2; }
[ "jayna@zoo-jayna02.zoo.ox.ac.uk" ]
jayna@zoo-jayna02.zoo.ox.ac.uk
47e3fc7db83908a8eb42f99939cce3a9d173140b
e8534dd7c3d26b5ca048b276194709b0772aa8b1
/src/main/java/com/github/jstumpp/uups/SourceLocator.java
b4e506c319c6a73fb96ae75f8a328e3f8aa3ec62
[ "MIT" ]
permissive
Calevin/uups
9aad44c0512b3cee04c1726fa1b60290e8a87a2a
fd282833a9a5f2101cdeca4c9a84baf2be76d651
refs/heads/master
2022-03-09T05:21:51.156933
2019-02-26T10:38:23
2019-02-26T10:38:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,914
java
package com.github.jstumpp.uups; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; interface SourceLocator { static SourceLocator local() { return local(new File(System.getProperty("user.dir")).toPath()); } static SourceLocator local(final Path path) { Path bin = path.resolve("bin"); Path target = path.resolve("target"); return filename -> { try { List<String> files = Arrays.asList(filename, filename.replace(".", File.separator) + ".java"); List<Path> source = new ArrayList<>(); source.add(Paths.get(filename)); Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { if (dir.toFile().isHidden()) { return FileVisitResult.SKIP_SUBTREE; } if (dir.equals(bin) || dir.equals(target)) { return FileVisitResult.SKIP_SUBTREE; } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { return files.stream() .filter(f -> file.toString().endsWith(f)) .findFirst() .map(f -> { source.add(0, file.toAbsolutePath()); return FileVisitResult.TERMINATE; }) .orElse(FileVisitResult.CONTINUE); } }); return new Source(source.get(0), Files.readAllLines(source.get(0), StandardCharsets.UTF_8)); } catch (IOException e) { return new Source(Paths.get(filename), Collections.emptyList()); } }; } Source source(String filename); public class Source { private static final int[] RANGE = {0, 0}; private final Path path; private final List<String> lines; public Source(final Path path, final List<String> lines) { this.path = path; this.lines = lines; } public Path getPath() { return path; } public List<String> getLines() { return lines; } public int[] range(final int line, final int size) { if (line < lines.size()) { int from = Math.max(line - size, 0); int toset = Math.max((line - from) - size, 0); int to = Math.min(from + toset + size * 2, lines.size()); int fromset = Math.abs((to - line) - size); from = Math.max(from - fromset, 0); return new int[]{from, to}; } return RANGE; } public String source(final int from, final int to) { if (from >= 0 && to <= lines.size()) { return lines.subList(from, to).stream() .map(l -> l.length() == 0 ? " " : l) .collect(Collectors.joining("\n")); } return ""; } @Override public String toString() { return path.toString(); } } }
[ "Stumpp@movisens.com" ]
Stumpp@movisens.com
f08188570fcef61b3a20884030b36c5180dcb6ff
c0f5a9aa6365e22b3da2868fd184ce0510fd950c
/src/main/java/com/wiwi/edb/order/dao/OrderDao.java
2d098c42257224e1e3b507b49682fd8f220e6d7b
[]
no_license
gaozhenhong/comfreemakertest
2b8947bc262c803661a97b7fc51e3aa2cacc9676
061f111cf8ee5a80d86e54f2bac3eadd81ec7137
refs/heads/master
2021-01-22T20:12:41.273639
2017-05-22T01:30:32
2017-05-22T01:30:32
85,292,358
0
0
null
null
null
null
UTF-8
Java
false
false
8,787
java
package com.wiwi.edb.order.dao; import com.wiwi.edb.order.hotelOrder.HotelOrderUtil; import com.wiwi.edb.order.hotelOrder.model.HotelOrder; import com.wiwi.edb.order.model.Order; import com.wiwi.edb.order.model.Order.Status; import com.wiwi.jsoil.db.DaoBase; import com.wiwi.jsoil.db.DbAdapter; import com.wiwi.jsoil.db.PageUtil; import com.wiwi.jsoil.db.Transaction; import com.wiwi.jsoil.exception.DaoException; import com.wiwi.jsoil.exception.RenderException; import com.wiwi.jsoil.sys.model.User; import com.wiwi.jsoil.util.SqlUtil; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import org.json.JSONArray; public class OrderDao extends DaoBase { private String sql; public OrderDao() { this.sql = null; } public void insert(Order instance) throws DaoException, RenderException { DbAdapter.insert2SingleTable(instance, "edb_order"); } public void update(Order instance) throws DaoException, RenderException { DbAdapter.update2SingleTable(instance, "edb_order"); } public void setStatusOnlyOrder(long orderId, Order.Status status) throws DaoException { if (status == null) return; if ((status == Order.Status.CHECKOUT) || (status == Order.Status.ON_TIME_CANCEL)) { this.sql = "UPDATE EDB_ORDER set status=?,finishTime=? where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { status.name(), new Date(), Long.valueOf(orderId) }); } else { this.sql = "UPDATE EDB_ORDER set status=? where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { status.name(), Long.valueOf(orderId) }); } } public int setOrderSettlementInfo(Date settlementTime, Long userId, Long orderId) throws DaoException { if ((settlementTime == null) || (userId == null) || (orderId == null)) return 0; this.sql = "UPDATE EDB_ORDER set isSettlement=1,settlementTime = ?,settlementUserId=? where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { settlementTime, userId, orderId }); return 1; } public void setAllStatus(long orderId, Order.Status status) throws DaoException { if ((status == null) || (orderId == 0L)) return; Transaction tran = new Transaction(); this.sql = "UPDATE EDB_ORDER_DETAILS set status='" + status + "' where orderId = '" + orderId + "'"; tran.executeUpdate(this.sql); this.sql = "UPDATE FG_RESERVATION_ROOM set status='" + status + "' where orderId = '" + orderId + "'"; tran.executeUpdate(this.sql); if ((status == Order.Status.CHECKOUT) || (status == Order.Status.ON_TIME_CANCEL)) this.sql = "UPDATE EDB_ORDER set status='" + status + "',finishTime=now() where id = '" + orderId + "'"; else this.sql = "UPDATE EDB_ORDER set status='" + status + "' where id = '" + orderId + "'"; tran.executeUpdate(this.sql); tran.commit(); } public long countOtherStatusOrderDetails(long orderId, Order.Status status) throws DaoException { this.sql = "select count(*) from EDB_ORDER_DETAILS where orderId = ? and status <> ?"; return DbAdapter.count(this.sql, new Object[] { Long.valueOf(orderId), status.name() }); } public void updatePayPrice(long orderId, double payPrice) throws DaoException { this.sql = "UPDATE EDB_ORDER set payPrice=?,payStatus= if( ?>totalPrice,'EXCESS', \t\tif(?=totalPrice,'PAY_IN_FULL', \t\t\tif(?=0,'NO_PAYMENT','DEBT') \t\t) ) where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { Double.valueOf(payPrice), Double.valueOf(payPrice), Double.valueOf(payPrice), Double.valueOf(payPrice), Long.valueOf(orderId) }); } public void plusPayPrice(long orderId, double addPayPrice) throws DaoException { if (addPayPrice == 0D) return; this.sql = "UPDATE EDB_ORDER set payPrice= payPrice + ?,payStatus= if( (payPrice + ?)>totalPrice,'EXCESS', \t\tif((payPrice + ?)=totalPrice,'PAY_IN_FULL', \t\t\tif((payPrice + ?)=0,'NO_PAYMENT','DEBT') \t\t) ) where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { Double.valueOf(addPayPrice), Double.valueOf(addPayPrice), Double.valueOf(addPayPrice), Double.valueOf(addPayPrice), Long.valueOf(orderId) }); } public void updateTotalPrice(long orderId, double totalPrice) throws DaoException { this.sql = "UPDATE EDB_ORDER set totalPrice=?,payStatus= if( payPrice>?,'EXCESS', \t\tif(payPrice=?,'PAY_IN_FULL', \t\t\tif(payPrice=0,'NO_PAYMENT','DEBT') \t\t) ) where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { Double.valueOf(totalPrice), Double.valueOf(totalPrice), Double.valueOf(totalPrice), Long.valueOf(orderId) }); } public void updateOrderBaseInfo(String orderName, String orderTelephone, String origin, long orderId, User user) throws DaoException { this.sql = "UPDATE EDB_ORDER set orderName=?,orderTelephone=?,origin=?,lastModifyUserId=? ,lastModifyTime=now() where id=?"; DbAdapter.executeUpdate(this.sql, new Object[] { orderName, orderTelephone, origin, Long.valueOf(user.getId().longValue()), Long.valueOf(orderId) }); } public void delete(String ids) throws DaoException { if (ids.startsWith(",")) ids = ids.substring(1); if (ids.indexOf(",") != -1) ids = ids.replaceAll(",", "','"); if (!(ids.startsWith("'"))) ids = "'" + ids; if (!(ids.endsWith("'"))) { ids = ids + "'"; } Transaction tran = new Transaction(); this.sql = "DELETE from FG_RESERVATION_ROOM where orderId in (" + ids + ") "; tran.executeUpdate(this.sql); this.sql = "DELETE from EDB_ORDER_DETAILS where orderId in (" + ids + ") "; tran.executeUpdate(this.sql); this.sql = "DELETE from EDB_ORDER WHERE id in (" + ids + ") "; tran.executeUpdate(this.sql); tran.commit(); } public Order get(long id) throws DaoException, RenderException { this.sql = "select o.*, org.name as companyName FROM edb_order o, s_organization org WHERE o.companyId = org.id and o.id ='" + id + "'"; return ((Order)DbAdapter.get(this.sql, Order.class)); } public List<Order> getList(PageUtil pageUtil) throws DaoException, RenderException { this.sql = "select o.*, org.name as companyName FROM edb_order o, s_organization org WHERE o.companyId = org.id "; return DbAdapter.getList(this.sql, pageUtil, Order.class); } public JSONArray getCanSettlementSupplierList(long selfCompanyId, Date beginDate, Date endDate) throws DaoException, RenderException { String statusInSql = SqlUtil.getInSqlStr(HotelOrderUtil.getCanSettlementStatus()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.sql = "select o.companyId,org.name as companyName,count(*) as orderNumber,sum(totalPrice)as sales ,sum(payPrice) as returnAmount from edb_order o ,s_organization org where o.companyId = org.id and (o.deleteFlag is null OR o.deleteFlag<>1) and o.isSettlement=0 and o.origin='" + HotelOrder.ORDER_ORIGIN_FREEGO + "'" + " and o.status in (" + statusInSql + ")"; if ((beginDate != null) && (endDate != null)) this.sql = this.sql + " and date(o.finishTime) between '" + sdf.format(beginDate) + "' and '" + sdf.format(endDate) + "'"; this.sql = this.sql + " and o.originDetails not in (select code from fg_hotel where companyId = '" + selfCompanyId + "' )" + " group by o.supplierId"; return DbAdapter.getJSONArray(this.sql); } public JSONArray getSettlementInfoList(Integer companyId, Long supplierId, Date beginDate, Date endDate) throws DaoException, RenderException { String statusInSql = SqlUtil.getInSqlStr(HotelOrderUtil.getCanSettlementStatus()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.sql = "select o.companyId,org.name as companyName,count(*) as orderNumber,sum(totalPrice)as sales ,sum(payPrice) as returnAmount from edb_order o ,s_organization org where o.companyId = org.id and (o.deleteFlag is null OR o.deleteFlag<>1) and o.isSettlement=0 and o.origin='" + HotelOrder.ORDER_ORIGIN_FREEGO + "'" + " and o.status in (" + statusInSql + ")"; if ((companyId != null) && (companyId.intValue() != 0)) this.sql = this.sql + "and o.companyId ='" + companyId + "'"; if ((supplierId != null) && (supplierId.longValue() != 0L)) this.sql = this.sql + "and o.supplierId ='" + supplierId + "'"; if ((beginDate != null) && (endDate != null)) this.sql = this.sql + " and date(o.finishTime) between '" + sdf.format(beginDate) + "' and '" + sdf.format(endDate) + "'"; this.sql = this.sql + " group by o.supplierId"; return DbAdapter.getJSONArray(this.sql); } }
[ "13987190791@139.com" ]
13987190791@139.com
057fa359fa10bf43dc380572648bb79fc82e2d7e
14aacd43c9e52e53b762071bfb2b8b16366ed84a
/unalcol/optimization/unalcol/optimization/real/ScaledHyperCube.java
fe64cacf57a5230d3cfef312d4ccb8a55ec6216d
[]
no_license
danielrcardenas/unalcol
26ff523a80a4b62b687e2b2286523fa2adde69c4
b56ee54145a7c5bcc0faf187c09c69b7587f6ffe
refs/heads/master
2021-01-15T17:15:02.732499
2019-04-28T05:18:09
2019-04-28T05:18:09
203,480,783
0
0
null
2019-08-21T01:19:47
2019-08-21T01:19:47
null
UTF-8
Java
false
false
1,305
java
package unalcol.optimization.real; import unalcol.search.multilevel.CodeDecodeMap; import unalcol.real.Array; import unalcol.real.array.LinealScale; public class ScaledHyperCube extends CodeDecodeMap<double[], double[]> { protected LinealScale scale = null; public ScaledHyperCube( double[] min, double[] max ){ this.scale = new LinealScale(min, max); } public ScaledHyperCube( HyperCube space ){ this.scale = new LinealScale(space.min, space.max); } /** * Generates a thing from the given genome * @param genome Genome of the thing to be expressed * @return A thing expressed from the genome */ public double[] decode(double[] genome) { return scale.inverse(genome); } /** * Generates a genome from the given thing * @param thing A thing expressed from the genome * @return Genome of the thing */ public double[] code(double[] thing) { return scale.apply(thing); } public static void main( String[] args){ ScaledHyperCube scale = new ScaledHyperCube(Array.create(5, -10.0), Array.create(5, 10.0)); for( int i=-10; i<=10; i++){ double[] x = scale.code(Array.create(5, i)); for( int k=0; k<x.length; k++ ){ System.out.print(" "+x[k]); } System.out.println(); } } }
[ "jgomezpe@unal.edu.co" ]
jgomezpe@unal.edu.co
b637ca0f4210b70ba201874a9cfeaa4e3c7922ff
afa3b830b097561766cd296abb884334b3619452
/PronosSur/app/src/main/java/big/win/classes/Utils.java
1b9fc59e1476e38e9a40607c5b317c7d23baa3d9
[]
no_license
abomoarno/my_apps
e39e3c65ba1e9ba755a1ede20e07bd15b30eee82
4dd584d5489e30886d7b4443fa6f111ed5efd012
refs/heads/master
2023-02-24T08:22:23.125338
2021-01-23T09:34:11
2021-01-23T09:34:11
332,173,325
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
package big.win.classes; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.ConnectivityManager; import android.net.NetworkInfo; import java.io.FileInputStream; import java.io.FileOutputStream; public class Utils { private Context context; public static String URL_RACINE = "http://www.bigwinner.eu/"; public static int PREMIUM_1_MOIS; public static int PREMIUM_3_MOIS; public static int PREMIUM_6_MOIS; public static int PREMIUM_12_MOIS; public static int GOAL_12_MOIS; public static int GOAL_3_MOIS; public static int GOAL_6_MOIS; public static int GOAL_1_MOIS; public static final String GOAL_GOAL_EXPIRE = "goal_goal_expire"; public static final String PREMIUM_EXPIRE = "premium_expire"; public static final Boolean GOAL_GOAL_STATUS = false; public static final Boolean PREMIUM_STATUS = false; public Utils(Context context) { this.context = context; } public boolean isNetworkReachable() { final ConnectivityManager mManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE); NetworkInfo current = null; if (mManager != null) { current = mManager.getActiveNetworkInfo(); } return current != null && (current.getState() == NetworkInfo.State.CONNECTED); } }
[ "abomoarno@gmail.com" ]
abomoarno@gmail.com
1ce321558f89707a9f81f864ccbcf77bf662f73b
db34b2279289209d25848c584dbd49e385789eeb
/app/src/main/java/custom/SlideOutAnimation.java
debe335b46b891a2bba443d199c66c3c9e50c8a8
[]
no_license
fhasovic/MapBoxFabricDemo
0e1e56b8f44a1fd96224f7023184f7e953292c6f
a147f177915edbb6e3f57d4635c200f2a8e21db8
refs/heads/master
2021-04-27T16:41:11.846575
2017-12-07T06:36:52
2017-12-07T06:36:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,735
java
package custom; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.view.View; import android.view.ViewGroup; import android.view.animation.AccelerateDecelerateInterpolator; /** * This animation causes the view to slide out to the borders of the screen. On * animation end, the view is restored to its original state and is set to * <code>View.INVISIBLE</code>. * * @author SiYao * */ public class SlideOutAnimation extends Animation implements Combinable { int direction; TimeInterpolator interpolator; long duration; AnimationListener listener; ValueAnimator slideAnim; /** * This animation causes the view to slide out to the borders of the screen. * On animation end, the view is restored to its original state and is set * to <code>View.INVISIBLE</code>. * * @param view * The view to be animated. */ public SlideOutAnimation(View view) { this.view = view; direction = DIRECTION_LEFT; interpolator = new AccelerateDecelerateInterpolator(); duration = DURATION_LONG; listener = null; } @Override public void animate() { getAnimatorSet().start(); } @Override public AnimatorSet getAnimatorSet() { ViewGroup parentView = (ViewGroup) view.getParent(), rootView = (ViewGroup) view .getRootView(); while (!parentView.equals(rootView)) { parentView.setClipChildren(false); parentView = (ViewGroup) parentView.getParent(); } rootView.setClipChildren(false); final int[] locationView = new int[2]; view.getLocationOnScreen(locationView); switch (direction) { case DIRECTION_LEFT: slideAnim = ObjectAnimator.ofFloat(view, View.X, -locationView[0] - view.getWidth()); break; case DIRECTION_RIGHT: slideAnim = ObjectAnimator.ofFloat(view, View.X, rootView.getRight()); break; case DIRECTION_UP: slideAnim = ObjectAnimator.ofFloat(view, View.Y, -locationView[1] - view.getHeight()); break; case DIRECTION_DOWN: slideAnim = ObjectAnimator.ofFloat(view, View.Y, rootView.getBottom()); break; default: break; } AnimatorSet slideSet = new AnimatorSet(); slideSet.play(slideAnim); slideSet.setInterpolator(interpolator); slideSet.setDuration(duration); slideSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.INVISIBLE); slideAnim.reverse(); if (getListener() != null) { getListener().onAnimationEnd(SlideOutAnimation.this); } } }); return slideSet; } /** * The available directions to slide in from are <code>DIRECTION_LEFT</code> * , <code>DIRECTION_RIGHT</code>, <code>DIRECTION_TOP</code> and * <code>DIRECTION_BOTTOM</code>. * * @return The direction to slide the view out to. * @see Animation */ public int getDirection() { return direction; } /** * The available directions to slide in from are <code>DIRECTION_LEFT</code> * , <code>DIRECTION_RIGHT</code>, <code>DIRECTION_TOP</code> and * <code>DIRECTION_BOTTOM</code>. * * @param direction * The direction to set to slide the view out to. * @return This object, allowing calls to methods in this class to be * chained. * @see Animation */ public SlideOutAnimation setDirection(int direction) { this.direction = direction; return this; } /** * @return The interpolator of the entire animation. */ public TimeInterpolator getInterpolator() { return interpolator; } /** * @param interpolator * The interpolator of the entire animation to set. */ public SlideOutAnimation setInterpolator(TimeInterpolator interpolator) { this.interpolator = interpolator; return this; } /** * @return The duration of the entire animation. */ public long getDuration() { return duration; } /** * @param duration * The duration of the entire animation to set. * @return This object, allowing calls to methods in this class to be * chained. */ public SlideOutAnimation setDuration(long duration) { this.duration = duration; return this; } /** * @return The listener for the end of the animation. */ public AnimationListener getListener() { return listener; } /** * @param listener * The listener to set for the end of the animation. * @return This object, allowing calls to methods in this class to be * chained. */ public SlideOutAnimation setListener(AnimationListener listener) { this.listener = listener; return this; } }
[ "ckp17291@gmail.com" ]
ckp17291@gmail.com
36c5a7de7dd5f57c236720a26ac08eec23bc9ea1
b9637a722bc82e04be6e2fa6c28cdf62570ab840
/Demo_Hibernate_App/src/entities/Category.java
e256b33a3bc42b7e845c70c802a1377ed23cd2aa
[]
no_license
VinhMark/SEM-4-STRUST
6d81929b900fb59ef232bfac0867a04c954c83fd
f5005785ed9dbac9a7273e141c38ddbecea15c79
refs/heads/master
2021-08-08T20:06:40.458180
2017-11-11T02:42:28
2017-11-11T02:42:28
110,311,589
1
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
package entities; // Generated Aug 3, 2017 10:05:26 AM by Hibernate Tools 5.2.3.Final import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; /** * Category generated by hbm2java */ @Entity @Table(name = "Category", catalog = "mydemo") public class Category implements java.io.Serializable { private int id; private String name; private Set<Product> products = new HashSet<Product>(0); public Category() { } public Category(int id) { this.id = id; } public Category(int id, String name, Set<Product> products) { this.id = id; this.name = name; this.products = products; } @Id @GeneratedValue(strategy= GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false) public int getId() { return this.id; } public void setId(int id) { this.id = id; } @Column(name = "name", length = 50) public String getName() { return this.name; } public void setName(String name) { this.name = name; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "category") public Set<Product> getProducts() { return this.products; } public void setProducts(Set<Product> products) { this.products = products; } }
[ "=" ]
=
84e27cd8e27e54073a0eca635fbe70ec16784a43
a0fe24777aa22d728f9d6fbe2c03ca78fb67c12d
/src/main/java/alivestill/Neteast/Main.java
3bf7881b56ce37016057db399bf8608312919072
[]
no_license
AliveStill/chaos
ac5019cad2c81673a23d9852a131920ed514f621
902a8de66d61862645aeb9d82facc087019412e9
refs/heads/master
2023-08-14T12:51:02.826599
2021-09-26T02:25:10
2021-09-26T02:25:10
410,427,104
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package alivestill.Neteast; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int ret = 0; int num = n; while (num != 0) { int lastBit = num % 10; if (lastBit != 0 && n % lastBit == 0) { ++ ret; } num /= 10; } System.out.println(ret); } }
[ "linghaijun2018@outlook.com" ]
linghaijun2018@outlook.com
95fdb540faa4f858de64351dc6aec437cd1f63cd
f19cdd0c92265620c15b2484038187adb929fb12
/src/main/java/br/com/foodclub/models/Endereco.java
a986a38a88c36d4c810c52eca3c167d71264d13a
[]
no_license
JPcedeira09/BackendFoodClub
2a0e48230fc13ce982d71f1222b854cec137a139
a9f24dfe63856c67d365d9c1a080ca4e01b2d9e6
refs/heads/master
2020-03-23T12:47:48.205061
2018-07-19T13:27:44
2018-07-19T13:27:44
141,582,487
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package br.com.foodclub.models; public class Endereco { private int id_enderecos; private String CEP; private String rua; private String complemento; private String bairro; private String cidade; private String estado; public Endereco() { super(); } public int getId_enderecos() { return id_enderecos; } public void setId_enderecos(int id_enderecos) { this.id_enderecos = id_enderecos; } public String getCEP() { return CEP; } public void setCEP(String cEP) { this.CEP = cEP; } public String getRua() { return rua; } public void setRua(String rua) { this.rua = rua; } public String getComplemento() { return complemento; } public void setComplemento(String complemento) { this.complemento = complemento; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } public Endereco(int id_enderecos, String cEP, String rua, String complemento, String bairro, String cidade, String estado) { super(); this.id_enderecos = id_enderecos; this.CEP = cEP; this.rua = rua; this.complemento = complemento; this.bairro = bairro; this.cidade = cidade; this.estado = estado; } }
[ "jp.cedeira@gmail.com" ]
jp.cedeira@gmail.com
7c3786afba47d6f5e3fbee6facc87320fbeb0669
0dd1f1310f5660b7c0079e3f1c21bbf407497718
/Client side Android Application/addpost/app/src/androidTest/java/com/example/addpost/ExampleInstrumentedTest.java
177532ea1e271c53ebb28431d116137184e2f42c
[]
no_license
amoljagdalepucsd/Android-app-development-A-client-side-android-application-
80290b96ee4d98b3e2502869d583f1e0427a26fe
ac349cc5197ac2bd08069122cdd27d6cdebe711d
refs/heads/master
2022-08-06T15:56:31.779441
2020-05-25T02:23:50
2020-05-25T02:23:50
266,654,890
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package com.example.addpost; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.addpost", appContext.getPackageName()); } }
[ "jagdaleamol17@gmail.com" ]
jagdaleamol17@gmail.com
8648295115c795a25c60761bf87118a2adf4d7c6
b2f07f3e27b2162b5ee6896814f96c59c2c17405
/com/sun/org/apache/xml/internal/serializer/Serializer.java
9c81bf7c3e5d0c439f4f2c01194b88f79731ddc3
[]
no_license
weiju-xi/RT-JAR-CODE
e33d4ccd9306d9e63029ddb0c145e620921d2dbd
d5b2590518ffb83596a3aa3849249cf871ab6d4e
refs/heads/master
2021-09-08T02:36:06.675911
2018-03-06T05:27:49
2018-03-06T05:27:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
944
java
package com.sun.org.apache.xml.internal.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import org.xml.sax.ContentHandler; public abstract interface Serializer { public abstract void setOutputStream(OutputStream paramOutputStream); public abstract OutputStream getOutputStream(); public abstract void setWriter(Writer paramWriter); public abstract Writer getWriter(); public abstract void setOutputFormat(Properties paramProperties); public abstract Properties getOutputFormat(); public abstract ContentHandler asContentHandler() throws IOException; public abstract DOMSerializer asDOMSerializer() throws IOException; public abstract boolean reset(); } /* Location: C:\Program Files\Java\jdk1.7.0_79\jre\lib\rt.jar * Qualified Name: com.sun.org.apache.xml.internal.serializer.Serializer * JD-Core Version: 0.6.2 */
[ "yuexiahandao@gmail.com" ]
yuexiahandao@gmail.com
80b9aa2ac9ba9b1d843dc5bfe136d08951bfa116
9b51b2810d8cbc76d071b03ed1ef695b1e7909bd
/src/test/java/stepdefinitions/ExampleSteps.java
cde225edc71891c909119e5669b09a5810e37809
[]
no_license
sebastianossa123/PracticeSreenPlay
36ec69bb1d49f1f18814efae97e9ab8587cad200
8d44f54a26ba0664927ab45ba45fc8a5180b6acb
refs/heads/master
2022-12-08T10:29:08.282161
2020-09-05T16:11:39
2020-09-05T16:11:39
290,248,897
0
0
null
null
null
null
UTF-8
Java
false
false
1,113
java
package stepdefinitions; import cucumber.api.java.en.*; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.abilities.BrowseTheWeb; import net.serenitybdd.screenplay.actions.Open; import net.thucydides.core.annotations.Managed; import org.openqa.selenium.WebDriver; import task.Login; import userinterfaces.HomePage; public class ExampleSteps { @Managed(driver = "chrome" ) private WebDriver navegador; private Actor actor = Actor.named("Sebastian"); private HomePage homePage = new HomePage(); @Given("^that a new customer accesses the purchasing website$") public void thatANewCustomerAccessesThePurchasingWebsite() { actor.can(BrowseTheWeb.with(navegador)); actor.wasAbleTo(Open.browserOn(homePage)); navegador.manage().window().maximize(); } @When("^the person is in the users menu$") public void thePersonIsInTheUsersMenu() { actor.wasAbleTo( Login.login() ); } @Then("^he sees the products listed in the page$") public void heSeesTheProductsListedInThePage() { } }
[ "sebastianossa245469@correo.itm.edu.co" ]
sebastianossa245469@correo.itm.edu.co
f27bc35e1a22ff2fa4d22b3f195f6c005273a952
5349772eaf6116c14786f254508272b74c5dab97
/src/com/javaforever/clocksimplejee4/testcontroller/EditUserController.java
c38cb67c25129d70fc77105a91e3b796d7140333
[]
no_license
jerryshensjf2/clocksimplejee
e5b7d5b8bd79c99590c3b71caf6682868882a38b
d60abf7ea88f72d0ba8d32e173ee33f4a297bcd9
refs/heads/master
2021-01-10T09:02:06.804089
2015-12-14T09:39:11
2015-12-14T09:39:11
47,878,450
1
0
null
null
null
null
UTF-8
Java
false
false
3,430
java
package com.javaforever.clocksimplejee4.testcontroller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.javaforever.clocksimplejee4.daoimpl.UserDaoImpl; import com.javaforever.clocksimplejee4.domain.User; import com.javaforever.clocksimplejee4.service.UserService; import com.javaforever.clocksimplejee4.serviceimpl.UserServiceImpl; public class EditUserController extends BaseTestController { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { User user = new User(); user.setId(Long.parseLong(request.getParameter("id"))); user.setEmpid(Long.parseLong(request.getParameter("empid"))); user.setUsername(request.getParameter("username")); user.setFirstname(request.getParameter("firstname")); user.setLastname(request.getParameter("lastname")); user.setSex(request.getParameter("sex")); user.setAddress(request.getParameter("address")); user.setAddress1(request.getParameter("address1")); user.setNamec(request.getParameter("namec")); user.setNamej(request.getParameter("namej")); user.setPhone(request.getParameter("phone")); user.setMobile(request.getParameter("mobile")); user.setIsadmin(request.getParameter("isadmin")); user.setIsactive(request.getParameter("isactive")); UserService clockService = new UserServiceImpl(); clockService.editUser(user); request.getSession(true).setAttribute("userData", clockService.getUser(user.getId())); response.sendRedirect("../test/usergpinterface.jsp"); } catch (Exception e){ e.printStackTrace(); } finally { out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "jerry_shen_sjf@qq.com" ]
jerry_shen_sjf@qq.com
2df86134690f03b13bc5c5d8fbd598cb94412b35
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/mockito/2016/12/DoesNothing.java
9287ae76c5e7260b187b8823c6c4a5e363dd58a1
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
885
java
/* * Copyright (c) 2007 Mockito contributors * This program is made available under the terms of the MIT License. */ package org.mockito.internal.stubbing.answers; import java.io.Serializable; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.mockito.stubbing.ValidableAnswer; import static org.mockito.internal.exceptions.Reporter.onlyVoidMethodsCanBeSetToDoNothing; public class DoesNothing implements Answer<Object>, ValidableAnswer, Serializable { private static final long serialVersionUID = 4840880517740698416L; public Object answer(InvocationOnMock invocation) throws Throwable { return null; } @Override public void validateFor(InvocationOnMock invocation) { if (!new InvocationInfo(invocation).isVoid()) { throw onlyVoidMethodsCanBeSetToDoNothing(); } } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
1c461a5d765d5ac77f0dd27b38bc2fd807282e67
2c52b8edcf98bae0713cb270c9c70f81bb4cb1cb
/2.JavaCore/src/com/javarush/task/task14/task1413/Computer.java
9e08ac601bb7a1d61cd2ac5032acea99a576422e
[]
no_license
atums/JavaRushTasks
860a051cbf0686c0136700d88e7c1705e37fc0c0
42999cdb08b35b5e52f2bdf65c9164e0dd8e9b40
refs/heads/master
2020-03-11T03:13:50.867239
2018-04-18T11:37:50
2018-04-18T11:37:50
129,740,981
0
0
null
null
null
null
UTF-8
Java
false
false
561
java
package com.javarush.task.task14.task1413; /** * Created by tums on 24.07.2017. */ public class Computer { private Keyboard keyboard; private Mouse mouse; private Monitor monitor; public Computer(Keyboard keyboard, Mouse mouse, Monitor monitor) { this.keyboard = keyboard; this.mouse = mouse; this.monitor = monitor; } public Keyboard getKeyboard() { return keyboard; } public Monitor getMonitor() { return monitor; } public Mouse getMouse() { return mouse; } }
[ "alex.tums@gmail.com" ]
alex.tums@gmail.com
d357fee2cbd52488cbde659efb6533e7a0b50e08
45736204805554b2d13f1805e47eb369a8e16ec3
/com/mysql/cj/xdevapi/SqlResult.java
59433b258135c529beded6d2535166fc2715f282
[]
no_license
KrOySi/ArchWare-Source
9afc6bfcb1d642d2da97604ddfed8048667e81fd
46cdf10af07341b26bfa704886299d80296320c2
refs/heads/main
2022-07-30T02:54:33.192997
2021-08-08T23:36:39
2021-08-08T23:36:39
394,089,144
2
0
null
null
null
null
UTF-8
Java
false
false
546
java
/* * Decompiled with CFR 0.150. */ package com.mysql.cj.xdevapi; import com.mysql.cj.xdevapi.InsertResult; import com.mysql.cj.xdevapi.Result; import com.mysql.cj.xdevapi.RowResult; import com.mysql.cj.xdevapi.XDevAPIError; public interface SqlResult extends Result, InsertResult, RowResult { default public boolean nextResult() { return false; } @Override default public Long getAutoIncrementValue() { throw new XDevAPIError("Method getAutoIncrementValue() is allowed only for insert statements."); } }
[ "67242784+KrOySi@users.noreply.github.com" ]
67242784+KrOySi@users.noreply.github.com
2a7a118f8adf6ba402a2c5c0e3e66ce29868ba72
2b18f9ce58d2f9e4619695deae2d184ec64dae88
/SSM-SMS-master/sms/src/main/java/pers/huangyuhui/sms/service/impl/TeacherServiceImpl.java
6895a0972a782c3add1f49f9538d06052d93ab61
[ "MIT" ]
permissive
TomAlen/template
3ba973436f11310456bc4a4680a7d4e01a7bdacb
9ab1b5310a9ba911d6ee78c37450879bf72cb247
refs/heads/master
2023-04-04T13:07:50.082953
2019-09-02T09:44:44
2019-09-02T09:44:44
205,825,165
0
0
null
2023-03-31T17:12:39
2019-09-02T09:40:53
JavaScript
UTF-8
Java
false
false
1,520
java
package pers.huangyuhui.sms.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import pers.huangyuhui.sms.bean.LoginForm; import pers.huangyuhui.sms.bean.Teacher; import pers.huangyuhui.sms.dao.TeacherMapper; import pers.huangyuhui.sms.service.TeacherService; import java.util.List; /** * @project: sms * @description: 业务层实现类-操控教师信息 * @author: 黄宇辉 * @date: 6/18/2019-9:48 AM * @version: 1.0 * @website: https://yubuntu0109.github.io/ */ @Service public class TeacherServiceImpl implements TeacherService { //注入Mapper接口对象 @Autowired private TeacherMapper teacherMapper; @Override public Teacher login(LoginForm loginForm) { return teacherMapper.login(loginForm); } @Override public List<Teacher> selectList(Teacher teacher) { return teacherMapper.selectList(teacher); } @Override public Teacher findByTno(Teacher teacher) { return teacherMapper.findByTno(teacher); } @Override public int insert(Teacher teacher) { return teacherMapper.insert(teacher); } @Override public int update(Teacher teacher) { return teacherMapper.update(teacher); } @Override public int updatePassowrd(Teacher teacher) { return teacherMapper.updatePassword(teacher); } @Override public int deleteById(Integer[] ids) { return teacherMapper.deleteById(ids); } }
[ "1127568664@qq.com" ]
1127568664@qq.com
0082efa0404bf894aa03f1e7b35332b28945e229
43537ffa4702c0f7ed20d425dd08b8a08b118b7c
/tcsapi/src/main/java/com/pacificfjord/pfapi/TCSUserProfileDelegate.java
2de811dd2bdc0ad2ed7e31693a82dd561d6896f5
[]
no_license
santiagoalberto416/publicity
bbb4a43abab0b2dad0410d1a5b7392774d0ed864
ca8fd962e50ac3ff3558ba6ebd1024e1013fac10
refs/heads/master
2021-05-02T09:36:02.667699
2016-11-04T22:38:38
2016-11-04T22:38:38
72,889,179
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package com.pacificfjord.pfapi; import org.json.JSONObject; /** * Created by tom on 21/01/14. */ public interface TCSUserProfileDelegate { public void done(boolean success, JSONObject profile); }
[ "skirk@santiagos-iMac.local" ]
skirk@santiagos-iMac.local
416f2321eada782a480e95a9cde8939b6dccbde2
a2440dbe95b034784aa940ddc0ee0faae7869e76
/modules/lwjgl/bgfx/src/generated/java/org/lwjgl/bgfx/BGFXProfilerBeginI.java
be51af3b26ac9e2facdb0b48d5ccb4ec173ead76
[ "LGPL-2.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
LWJGL/lwjgl3
8972338303520c5880d4a705ddeef60472a3d8e5
67b64ad33bdeece7c09b0f533effffb278c3ecf7
refs/heads/master
2023-08-26T16:21:38.090410
2023-08-26T16:05:52
2023-08-26T16:05:52
7,296,244
4,835
1,004
BSD-3-Clause
2023-09-10T12:03:24
2012-12-23T15:40:04
Java
UTF-8
Java
false
false
2,136
java
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.bgfx; import org.lwjgl.system.*; import org.lwjgl.system.libffi.*; import static org.lwjgl.system.APIUtil.*; import static org.lwjgl.system.MemoryUtil.*; import static org.lwjgl.system.libffi.LibFFI.*; /** * Profiler region begin. * * <h3>Type</h3> * * <pre><code> * void (*{@link #invoke}) ( * bgfx_callback_interface_t *_this, * char const *_name, * uint32_t _abgr, * char const *_filePath, * uint16_t _line * )</code></pre> */ @FunctionalInterface @NativeType("void (*) (bgfx_callback_interface_t *, char const *, uint32_t, char const *, uint16_t)") public interface BGFXProfilerBeginI extends CallbackI { FFICIF CIF = apiCreateCIF( FFI_DEFAULT_ABI, ffi_type_void, ffi_type_pointer, ffi_type_pointer, ffi_type_uint32, ffi_type_pointer, ffi_type_uint16 ); @Override default FFICIF getCallInterface() { return CIF; } @Override default void callback(long ret, long args) { invoke( memGetAddress(memGetAddress(args)), memGetAddress(memGetAddress(args + POINTER_SIZE)), memGetInt(memGetAddress(args + 2 * POINTER_SIZE)), memGetAddress(memGetAddress(args + 3 * POINTER_SIZE)), memGetShort(memGetAddress(args + 4 * POINTER_SIZE)) ); } /** * Will be called when a profiler region begins. * * <p>Not thread safe and it can be called from any thread.</p> * * @param _this the callback interface * @param _name region name, contains dynamic string * @param _abgr color of profiler region * @param _filePath file path where {@code profiler_begin} was called * @param _line line where {@code profiler_begin} was called */ void invoke(@NativeType("bgfx_callback_interface_t *") long _this, @NativeType("char const *") long _name, @NativeType("uint32_t") int _abgr, @NativeType("char const *") long _filePath, @NativeType("uint16_t") short _line); }
[ "iotsakp@gmail.com" ]
iotsakp@gmail.com
8a21c14df78add8e07bcf2372d6a17038c13ba1b
7a325b13f1d4e2cfccf84a3ce29d2fc11298e049
/app/src/main/java/com/example/contactapp/CreateNewContact.java
b993a64585499711287c6667ba54e6e6d9c97a84
[]
no_license
ShaishavMaisuria/ContactApplication
5efb76ef127deb5259f89721de0ad3884085527d
a7747aabcc074be0451678cec707ead2c9d298fa
refs/heads/master
2023-03-20T18:39:46.518527
2021-03-16T02:59:27
2021-03-16T02:59:27
346,924,217
0
0
null
null
null
null
UTF-8
Java
false
false
7,145
java
package com.example.contactapp; import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; import org.jetbrains.annotations.NotNull; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; /** * A simple {@link Fragment} subclass. * Use the {@link CreateNewContact#newInstance} factory method to * create an instance of this fragment. */ public class CreateNewContact extends Fragment { private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; private String mParam1; private String mParam2; private String TAG="CreateNewContact"; public CreateNewContact() { // Required empty public constructor } public static CreateNewContact newInstance(String param1, String param2) { CreateNewContact fragment = new CreateNewContact(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } EditText name; EditText Email; EditText number; EditText Type; String userName; String userEmail; String userNumber; String userType; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view= inflater.inflate(R.layout.fragment_create_new_contact, container, false); getActivity().setTitle("Create NEw Contact"); name= view.findViewById(R.id.editTextUpdatePersonName); Email= view.findViewById(R.id.editTextUpdateEmailAddress); number= view.findViewById(R.id.editTextUpdatePhone); Type= view.findViewById(R.id.editTextUpdateType); view.findViewById(R.id.buttonCreateSubmit).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { userName=name.getText().toString(); userEmail=Email.getText().toString(); userNumber=number.getText().toString(); userType=Type.getText().toString().toUpperCase(); Log.d(TAG,"createSubmit userName"+userName); Log.d(TAG,"createSubmit userEmail"+userEmail); Log.d(TAG,"createSubmit userNumber"+userNumber); Log.d(TAG,"createSubmit userNumber"+userType); if(userName.isEmpty()){ Toast.makeText(getActivity(), "userName is empty", Toast.LENGTH_SHORT).show(); } else if(userEmail.isEmpty()){ Toast.makeText(getActivity(), "UserEmail is empty", Toast.LENGTH_SHORT).show(); }else if(userNumber.isEmpty()){ Toast.makeText(getActivity(), "userNumber is empty", Toast.LENGTH_SHORT).show(); }else if(userType.isEmpty()){ Toast.makeText(getActivity(), "userType is empty", Toast.LENGTH_SHORT).show(); } else{ Log.d(TAG," userType " +userType); if(userType.equalsIgnoreCase("OFFICE") || userType.equalsIgnoreCase("CELL") || userType.equalsIgnoreCase("HOME") ){ Log.d(TAG,"Start CreateContact "); createContact(userName,userEmail,userNumber,userType); Log.d(TAG,"End CreateContact "); } else{ Toast.makeText(getActivity(), "Select proper Type Office,Cell,Home", Toast.LENGTH_SHORT).show(); } } } }); view.findViewById(R.id.buttonCreateCancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.gotToContactDisplay(); } }); return view; } private final OkHttpClient client = new OkHttpClient(); void createContact(String name, String email, String phone,String type){ RequestBody formBody = new FormBody.Builder() .add("name", name) .add("email",email) .add("phone",phone) .add("type",type) .build(); Request request = new Request.Builder() .url("https://www.theappsdr.com/contact/create") .post(formBody) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { e.printStackTrace(); } @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { if(response.isSuccessful()){ ResponseBody responseBody = response.body(); String body = responseBody.string(); Log.d(TAG,"OnResponse " + body); final String[] contacts= body.split("\n"); getActivity().runOnUiThread(new Runnable() { @Override public void run() { Log.d(TAG,"runUIThread ID " + Thread.currentThread().getId()); Log.d(TAG,"Start mListener "); mListener.gotToContactDisplay(); } }); } else{ Log.d(TAG,"Error Response "); ResponseBody responseBody = response.body(); String body = responseBody.string(); Log.d(TAG,"Error OnResponse " +body); } } }); } CreateNewConatactListener mListener; @Override public void onAttach(@NonNull Context context) { super.onAttach(context); if (context instanceof CreateNewConatactListener) { mListener = (CreateNewConatactListener) context; } else { throw new RuntimeException(context.toString() + "must implement CreateNewConatactListener"); } } interface CreateNewConatactListener { void gotToContactDisplay(); } }
[ "smaisuri@uncc.edu" ]
smaisuri@uncc.edu
237579837174164b7b66a52344428299d082e767
75b3c3e366a2d81d9f0fed655f9c2fa8b23343d8
/AppWithoutPermisson/app/src/androidTest/java/com/example/appwithoutpermission/ExampleInstrumentedTest.java
205888f020d58e32da9d6f4f5ba9f9838c7c8172
[]
no_license
zedzedQ/CIS433
4502db1a924a85f9ac1ae39e273e38ad81d73df8
6b171e539fa632fca25d95dd6a652e81456f8d45
refs/heads/master
2020-12-18T19:26:13.559017
2020-03-14T16:27:03
2020-03-14T16:27:03
235,497,289
1
0
null
null
null
null
UTF-8
Java
false
false
780
java
package com.example.appwithoutpermission; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.appwithoutpermission", appContext.getPackageName()); } }
[ "nathanquan.us@gmail.com" ]
nathanquan.us@gmail.com
cb26b9af2aaeba6007050fd17e563677f9eac2d5
93772b53f390a71b534a32602cf8ead589f4b9c4
/AlarmService/app/src/main/java/com/example/alarmservice/Second.java
b1012020d383ce5954f749f436f973a8141a5116
[]
no_license
Garima88825/Android-Projects
5d21912fa99a24ced785e8a52b73e75087eba97d
bc35d451255ef00069bdaf37c0e5859a9f22f8a5
refs/heads/master
2023-07-22T13:36:05.286120
2021-09-06T04:40:39
2021-09-06T04:40:39
403,482,541
0
0
null
null
null
null
UTF-8
Java
false
false
1,261
java
package com.example.alarmservice; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import android.app.Service; import android.content.Intent; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; import android.widget.Toast; public class Second extends Service { @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { Toast.makeText(this, "Alarm will stop after the entered seconds", Toast.LENGTH_SHORT).show(); Uri myalarm = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), myalarm); r.play(); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } r.stop(); stopSelf(); return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy() { Toast.makeText(this, "Alarm Stopped", Toast.LENGTH_SHORT).show(); super.onDestroy(); } }
[ "garima190730@keshav.du.ac.in" ]
garima190730@keshav.du.ac.in
186ce37ee206b40837878e4c1832bd00bade292b
10060db18060c9309d776bd01f447e2d16148934
/shopping/src/main/java/com/shop/myapplication/IWantWithDraw.java
c25444c3de5f00666fba93dc08778d836f8c08dd
[]
no_license
fjingui/shoppingapp
162a47091d9fd7564eedb04cd96d3e05096078ab
e481e094afe4bda0613cc67518e28c5789421ca5
refs/heads/master
2021-05-09T06:00:42.522218
2018-12-26T14:13:23
2018-12-26T14:13:23
119,323,506
0
0
null
null
null
null
UTF-8
Java
false
false
5,051
java
package com.shop.myapplication; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.bean.list.ChrgDetail; import com.bean.list.Global_Final; import com.bean.list.WithDrawAcctBean; import com.utils.list.GetDataFromServer; import com.utils.list.HttpPostReqData; import com.utils.list.ParseJsonData; public class IWantWithDraw extends AppCompatActivity { private EditText withmoney; private TextView alldraw; private TextView zfbacc; private TextView zfbname; private Button summit; private String cust_acct; private String balance="0"; private float remian; private ChrgDetail upAccountDetail = new ChrgDetail(); private String accdetailjson; private GetDataFromServer getacctbalance; private GetDataFromServer getwithacc; private WithDrawAcctBean wdab; private static final int KO = 0111; private static final int KO2 = 0112; private Handler getbalancehdl = new Handler(){ @Override public void handleMessage(Message msg) { if (msg.what == 0111){ balance = getacctbalance.getGetresult(); withmoney.setHint("账号可提现金额"+balance+"元"); alldraw.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { withmoney.setText(balance); } }); } if(msg.what == 0112){ wdab = ParseJsonData.parseObjectJson(getwithacc.getGetresult(),WithDrawAcctBean.class); String a_str = wdab.getTx_account().substring(3,8); String a_str02 = wdab.getTx_account(); String a_str03 = a_str02.replace(a_str,"*****"); String str_2 = wdab.getTx_account_name().substring(0,1); zfbacc.setText(a_str03); zfbname.setText(str_2+"***"); } } }; @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId()==android.R.id.home){ finish(); return true; } return super.onOptionsItemSelected(item); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_iwant_with_draw); getSupportActionBar().setDisplayHomeAsUpEnabled(true); withmoney = (EditText) findViewById(R.id.withdrawmoney); alldraw = (TextView) findViewById(R.id.allwithdraw); zfbacc = (TextView) findViewById(R.id.zfb_acc); zfbname = (TextView) findViewById(R.id.zfb_name); summit = (Button) findViewById(R.id.submitbtn); initData(); summit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TextUtils.isEmpty(withmoney.getText())){ withmoney.setError("请输入提现金额"); View Error = withmoney; Error.isShown(); }else if (Float.parseFloat(withmoney.getText().toString()) == 0 || Float.parseFloat(balance)<Float.parseFloat(withmoney.getText().toString())){ withmoney.setError("提现金额不足!"); View Error = withmoney; Error.isShown(); }else { remian = Float.parseFloat(balance) -Float.parseFloat(withmoney.getText().toString()); setAcctChrgDeail(); new HttpPostReqData().PostData(Global_Final.accdtailinsert,accdetailjson); finish(); } } }); } public void initData(){ cust_acct = getIntent().getStringExtra("cust_acct"); getacctbalance = new GetDataFromServer(getbalancehdl,null,KO); getacctbalance.setParam(cust_acct); new Thread(new Runnable() { @Override public void run() { getacctbalance.getData(Global_Final.accountbalance); } }).start(); getwithacc = new GetDataFromServer(getbalancehdl,null,KO2); getwithacc.setParam(cust_acct); new Thread(new Runnable() { @Override public void run() { getwithacc.getData(Global_Final.withdraw_get); } }).start(); } public void setAcctChrgDeail(){ upAccountDetail.setCust_acct(Long.parseLong(cust_acct)); upAccountDetail.setPay_money(Float.parseFloat(withmoney.getText().toString())); upAccountDetail.setPay_type("提现"); upAccountDetail.setBalance(remian); accdetailjson = ParseJsonData.parseToJson(upAccountDetail); } }
[ "18956662004@189.cn" ]
18956662004@189.cn