blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
3e4c012c34c50ea5c863ef17524db17c2928dc23
b774c9b9d8a685d0a382a4995c273eea0dfe075a
/java-concurrent-8/src/main/java/com/hailong/curcurrent/juc/TestSchedule.java
2bbd6e59d42c4962ea5dd260bec8553af3a018a8
[]
no_license
314649558/java-concurrent-parent
c2b932e7001d7c670aacba05274041a3a823c35b
e8d6bcb94ea97dc2417faa66865fbf2810c3aa2b
refs/heads/master
2022-12-22T00:19:58.561730
2021-01-01T14:16:26
2021-01-01T14:16:26
250,960,943
0
0
null
2022-12-16T14:51:44
2020-03-29T05:30:00
Java
UTF-8
Java
false
false
1,173
java
package com.hailong.curcurrent.juc; import lombok.extern.slf4j.Slf4j; import java.time.DayOfWeek; import java.time.Duration; import java.time.LocalDateTime; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** * Created by Administrator on 2020/3/22. */ @Slf4j(topic = "c.TestSchedule") public class TestSchedule { public static void main(String[] args) { LocalDateTime now=LocalDateTime.now();//当前时间 log.info("{}",now); //获取本周四 18点整的时间 LocalDateTime time=now.withHour(18).withMinute(0).withSecond(0).withNano(0).with(DayOfWeek.THURSDAY); if(now.compareTo(time)>0){ time=time.plusWeeks(1); } log.debug("{}",time); //首次启动时候的应该延时的时间 long initDelay= Duration.between(now,time).toMillis(); long period=7*24*60*60*1000; ScheduledExecutorService pool= Executors.newScheduledThreadPool(1); pool.scheduleAtFixedRate(()->{ log.info("running..."); },initDelay,period, TimeUnit.MILLISECONDS); } }
[ "314649558@qq.com" ]
314649558@qq.com
9bfa3374765fcfba026ed70b4a9a6760e19e3ad6
bb4a8a795eb6f1a1f7c3a73521a8d3ad14e13f65
/Java Core/StringCalculator/src/com/yash/StringCalculator.java
0a074b3a4596d2e9709f2107a7b3c6ad70853d86
[]
no_license
pradyumn0611/classdemos
d8889fd11545362d656267a12235e09bfc542714
e9c7c6b3e604a470c179a2fa2ff759cafb036c35
refs/heads/master
2023-02-11T19:39:49.040665
2021-01-02T11:57:33
2021-01-02T11:57:33
326,162,634
0
0
null
null
null
null
UTF-8
Java
false
false
54
java
package com.yash; public class StringCalculator { }
[ "jpradyumn67@gmail.com" ]
jpradyumn67@gmail.com
ad6f2a57014a7dd377e81355a64fc2e7cd7189ce
32bca5ddebccc1ae560d944ccc790ce35a87c1f5
/app/src/main/java/com/patelheggere/bitbucketintegration/ui/home/HomeFragment.java
18677ef46ccd1790c91220fddee579d910f21675
[]
no_license
patelheggere/BitBucketIntegration
9a01761a41864938db9a221b0a276db3e38b6cec
dce62cf3b9d137cf60a5c22fb6aafe0e1ce02575
refs/heads/master
2022-06-09T21:09:43.165158
2020-05-09T11:48:35
2020-05-09T11:48:35
262,559,251
0
0
null
null
null
null
UTF-8
Java
false
false
2,914
java
package com.patelheggere.bitbucketintegration.ui.home; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; import com.patelheggere.bitbucketintegration.R; import com.patelheggere.bitbucketintegration.ui.dashboard.DashboardFragment; import com.patelheggere.bitbucketintegration.ui.notifications.NotificationsFragment; import java.util.ArrayList; import java.util.List; public class HomeFragment extends Fragment { private HomeViewModel homeViewModel; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { homeViewModel = ViewModelProviders.of(this).get(HomeViewModel.class); View root = inflater.inflate(R.layout.fragment_home, container, false); ViewPager viewPager = (ViewPager) root.findViewById(R.id.viewpager); setupViewPager(viewPager); // Set Tabs inside Toolbar TabLayout tabs = (TabLayout) root.findViewById(R.id.result_tabs); tabs.setupWithViewPager(viewPager); return root; } // Add Fragments to Tabs private void setupViewPager(ViewPager viewPager) { Adapter adapter = new Adapter(getChildFragmentManager()); adapter.addFragment(new DashboardFragment(), "Today"); adapter.addFragment(new NotificationsFragment(), "Week"); // adapter.addFragment(new MonthFixturesFragment(), "Month"); // adapter.addFragment(new AllFixturesFragment(), "Month"); // adapter.addFragment(new MyTeamsFixturesFragment(), "My Teams"); viewPager.setAdapter(adapter); } static class Adapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public Adapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } }
[ "patelheggere@gmail.com" ]
patelheggere@gmail.com
a2aa9a97beb1a2dc0425c016bf253dfac63c9351
5ecc656246d50f88344368fb1db97bdb7702b72c
/src/main/java/com/vince/exercise/ExerciseApplication.java
f959e8843c9472346d1a3db3158b1da6d09c377e
[]
no_license
vsruby/exercise
b8dbf5ab57b4c600e50f9b297d43891d28cc4928
73ec2cd88531b01bae1430801d15d633a02a092b
refs/heads/master
2020-04-09T21:42:44.625315
2018-12-06T21:41:05
2018-12-06T21:41:05
160,610,480
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package com.vince.exercise; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication public class ExerciseApplication { public static void main(String[] args) { SpringApplication.run(ExerciseApplication.class, args); } }
[ "vsruby91@gmail.com" ]
vsruby91@gmail.com
740b891e072e92c722b6a3053e251bcf35438c70
1c8c51b70de24925d3b169083c0a1f66bb676142
/src/main/java/data/概率/随机事件.java
2509aa1c3b9d96bad6a8e5bfb698eeca9ff9e4fa
[]
no_license
xugeiyangguang/kownledgeGraph
867b733c19b7ac3ca034468843a4cad59755ea2c
e1f0d5d048449440bade905bd6265bbd8557e866
refs/heads/master
2022-12-09T19:15:59.060402
2020-04-01T11:32:53
2020-04-01T11:32:53
222,592,654
0
0
null
2022-12-06T00:43:16
2019-11-19T02:40:27
Java
UTF-8
Java
false
false
52
java
package data.概率; public class 随机事件 { }
[ "yixuyangguang_2017@163.com" ]
yixuyangguang_2017@163.com
aa4d72f1c6fdd82e5dc950b1bdd062ffc9b9d62b
d7f49fcf5f7716d3dc91ef0ebb3b947ef705f689
/src/main/java/com/maktab/onlineQuizManagement/service/UserService.java
9ff42f8681b4494042b681d16c06e8b187c39ba3
[]
no_license
mahsa-shafiee/online-quiz-management-system
43370c09f56439585bc7397466e9c466192eee8b
a4596d5713e1ef8e81c9902d003ecd2545265396
refs/heads/master
2022-12-18T18:12:58.491330
2020-09-25T12:06:56
2020-09-25T12:06:56
290,307,664
0
0
null
null
null
null
UTF-8
Java
false
false
6,561
java
package com.maktab.onlineQuizManagement.service; import com.maktab.onlineQuizManagement.model.dao.UserDao; import com.maktab.onlineQuizManagement.model.dao.UserSpecifications; import com.maktab.onlineQuizManagement.model.entity.*; import com.maktab.onlineQuizManagement.model.entity.enums.UserRegistrationStatus; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestBody; import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.stream.Collectors; @Service @Transactional @Log4j2 public class UserService implements UserDetailsService { private final UserDao userDao; private final RoleService roleService; private final StudentService studentService; private final TeacherService teacherService; private final PasswordEncoder passwordEncoder; private final static int PAGE_SIZE = 5; public UserService(UserDao userDao, PasswordEncoder passwordEncoder, RoleService roleService, StudentService studentService, TeacherService teacherService) { this.userDao = userDao; this.passwordEncoder = passwordEncoder; this.roleService = roleService; this.studentService = studentService; this.teacherService = teacherService; } public void saveUser(User user) { userDao.save(user); } public void registerNewUser(User user, HttpServletRequest request) { Role role = roleService.getRole("ROLE_" + request.getParameter("role").toUpperCase()); user.setRoles(Collections.singletonList(role)); user.setPassword(passwordEncoder.encode(user.getPassword())); user.setRegistrationStatus(UserRegistrationStatus.NOT_CONFIRMED); user.setConfirmationToken(UUID.randomUUID().toString()); saveUser(user); if (role.getName().equals("ROLE_TEACHER")) { teacherService.save((Teacher) user); } else { studentService.save((Student) user); } // emailService.sendRegistrationEmail(user, request); } public void confirmUserRegistration(String token) { User user = findByConfirmationToken(token); user.setRegistrationStatus(UserRegistrationStatus.WAITING_FOR_CONFIRMATION); saveUser(user); } public User findByEmailAddress(String emailAddress) { Optional<User> found = userDao.findByEmailAddress(emailAddress); return found.orElse(null); } public User findByEmailAddressAndPassword(User user) { Optional<User> found = userDao.findByEmailAddressAndPassword(user.getEmailAddress(), (user.getPassword())); return found.orElse(null); } public User findByConfirmationToken(String token) { Optional<User> found = userDao.findByConfirmationToken(token); return found.orElse(null); } public User findById(int id) { Optional<User> found = userDao.findById(id); return found.orElse(null); } public List<User> getPage(int pageNumber) { if (pageNumber < 1) pageNumber = 1; PageRequest request = PageRequest.of(pageNumber - 1, PAGE_SIZE, Sort.Direction.ASC, "id"); List<User> users = userDao.findAll(request).getContent(); return users.isEmpty() ? getPage(--pageNumber) : users; } public List<User> search(String name, String family, String emailAddress, String role, String registrationStatus, int pageNumber) { if (pageNumber < 1) pageNumber = 1; PageRequest pageRequest = PageRequest.of(pageNumber - 1, PAGE_SIZE, Sort.Direction.ASC, "id"); List<User> users = userDao.findAll(UserSpecifications.findMaxMatch (name, family, emailAddress, role, registrationStatus), pageRequest) .getContent(); return users; } public User getUser(int id) { return userDao.findById(id).orElse(null); } public void updateUser(@RequestBody User user) { User found = getUser(user.getId()); user.setRegistrationStatus(found.getRegistrationStatus()); user.setConfirmationToken(found.getConfirmationToken()); userDao.save(user); } public List<Course> getCoursePage(int id, int page) { List<Course> courses = findById(id).getCourses(); courses = courses.stream() .sorted(Comparator.comparingInt(Course::getId)) .skip((page - 1) * PAGE_SIZE) .limit(PAGE_SIZE) .collect(Collectors.toList()); return courses; } @Override public UserDetails loadUserByUsername(String emailAddress) throws UsernameNotFoundException { Optional<User> user = userDao.findByEmailAddress(emailAddress); log.info(user.toString()); if (!user.isPresent()) { throw new UsernameNotFoundException("Invalid username or password."); } return new org.springframework.security.core.userdetails.User( user.get().getEmailAddress(), user.get().getPassword(), mapRolesToAuthorities(user.get().getRoles())); } private Collection<? extends GrantedAuthority> mapRolesToAuthorities(Collection<Role> roles) { return roles.stream() .map(role -> new SimpleGrantedAuthority(role.getName())) .collect(Collectors.toList()); } public Object confirmUserRegistration(int id) { User user = getUser(id); if (user.getRegistrationStatus().equals(UserRegistrationStatus.CONFIRMED)) { return null; } else { user.setRegistrationStatus(UserRegistrationStatus.CONFIRMED); updateUser(user); return user; } } }
[ "mahsashafiee79@gmail.com" ]
mahsashafiee79@gmail.com
a0c666a35a184a57a4201fea94e62dcac3f3edf7
225d6de40dd31ed124b44c166c112e94edc9357b
/SelectImagePicture/src/com/dawan/huahua/base/BitmapCache.java
5361bb169fc56da745a6f5d9eac6bbf7c03292eb
[]
no_license
DengLiBin/WorkSpace
c19e7a586023625c244ba8d783cc0c26d415203c
87c1571713b3cbaaefb8d8737312ee766ad48a79
refs/heads/master
2021-01-10T18:05:16.677331
2016-03-15T09:23:19
2016-03-15T09:23:19
53,930,197
1
0
null
null
null
null
UTF-8
Java
false
false
3,303
java
package com.dawan.huahua.base; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.lang.ref.SoftReference; import java.util.HashMap; import com.dawan.huahua.image.ASelectPicActivity; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.widget.ImageView; public class BitmapCache extends Activity { public Handler h = new Handler(); public final String TAG = getClass().getSimpleName(); private HashMap<String, SoftReference<Bitmap>> imageCache = new HashMap<String, SoftReference<Bitmap>>(); public void put(String path, Bitmap bmp) { if (!TextUtils.isEmpty(path) && bmp != null) { imageCache.put(path, new SoftReference<Bitmap>(bmp)); } } public void displayBmp(final ImageView iv, final String thumbPath, final String sourcePath, final ImageCallback callback) { if (TextUtils.isEmpty(thumbPath) && TextUtils.isEmpty(sourcePath)) { Log.e(TAG, "no paths pass in"); return; } final String path; final boolean isThumbPath; if (!TextUtils.isEmpty(thumbPath)) { path = thumbPath; isThumbPath = true; } else if (!TextUtils.isEmpty(sourcePath)) { path = sourcePath; isThumbPath = false; } else { // iv.setImageBitmap(null); return; } if (imageCache.containsKey(path)) { SoftReference<Bitmap> reference = imageCache.get(path); Bitmap bmp = reference.get(); if (bmp != null) { if (callback != null) { callback.imageLoad(iv, bmp, sourcePath); } iv.setImageBitmap(bmp); Log.d(TAG, "hit cache"); return; } } iv.setImageBitmap(null); new Thread() { Bitmap thumb; public void run() { try { if (isThumbPath) { thumb = BitmapFactory.decodeFile(thumbPath); if (thumb == null) { thumb = revitionImageSize(sourcePath); } } else { thumb = revitionImageSize(sourcePath); } } catch (Exception e) { } if (thumb == null) { thumb = ASelectPicActivity.bimap; } Log.e(TAG, "-------thumb------"+thumb); put(path, thumb); if (callback != null) { h.post(new Runnable() { @Override public void run() { callback.imageLoad(iv, thumb, sourcePath); } }); } } }.start(); } public Bitmap revitionImageSize(String path) throws IOException { BufferedInputStream in = new BufferedInputStream(new FileInputStream( new File(path))); BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(in, null, options); in.close(); int i = 0; Bitmap bitmap = null; while (true) { if ((options.outWidth >> i <= 256) && (options.outHeight >> i <= 256)) { in = new BufferedInputStream( new FileInputStream(new File(path))); options.inSampleSize = (int) Math.pow(2.0D, i); options.inJustDecodeBounds = false; bitmap = BitmapFactory.decodeStream(in, null, options); break; } i += 1; } return bitmap; } public interface ImageCallback { public void imageLoad(ImageView imageView, Bitmap bitmap, Object... params); } }
[ "mdjros123@163.com" ]
mdjros123@163.com
76a2ac958fcbc6d8bf8e27a21f121ff1c69c6951
4c043255edbace56755fee9241cdd221a8c75a7f
/src/test/java/course/write/AddCourseCommandTest.java
85b3d7f2cce25af30c69488df27d6f62777774b8
[]
no_license
gay88358/CQRS_Student_Management
290f231267e5906b541dc95d8f67a40fc1556c8b
082fc9db9e4ce0805d411439650f113da10e1b9f
refs/heads/main
2023-07-09T23:57:36.122492
2023-06-28T15:03:53
2023-06-28T15:03:53
316,629,463
0
0
null
null
null
null
UTF-8
Java
false
false
1,088
java
package course.write; import common.IntegrationTest; import common.Result; import course.write.addCourse.AddCourseCommand; import course.write.addCourse.AddCourseCommandHandler; import course.write.domain.Course; import course.write.domain.CourseRepository; import course.write.domain.CourseRepositoryImp; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import static org.junit.Assert.*; public class AddCourseCommandTest extends IntegrationTest { private static final String COURSE_NAME = "OOP"; @Autowired CourseRepository repository; @Test public void add_course() { // Arrangement AddCourseCommand command = new AddCourseCommand(COURSE_NAME); AddCourseCommandHandler handler = new AddCourseCommandHandler(repository); // Act Result<Long> result = handler.handle(command); Long courseId = result.getValue(); // Assert Course course = repository.findBy(courseId); assertEquals(COURSE_NAME, course.getName()); System.out.println("123"); } }
[ "gay88358@yahoo.com.tw" ]
gay88358@yahoo.com.tw
1c1c6184b77d293d4cba14437f7851136cb0fdd0
cf121c906baebcbdc045709a0f99c5ceeae46783
/exercise8/app/src/main/java/layout/FragmentThree.java
bb1ff0766076d9b4db257a20a07a04900af9e799
[]
no_license
kinshukkashyup/AndroidStudioProjects
68a729224ab93ce6f5a7056bfffb2255b974874a
cc1aeb7a7c03f68fbd90115c0c6dbccd0a242acb
refs/heads/master
2020-03-21T01:40:52.027207
2018-06-20T00:36:16
2018-06-20T00:36:16
137,955,813
0
0
null
null
null
null
UTF-8
Java
false
false
913
java
package layout; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.kingbradley.exercise8.R; import android.app.Fragment; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link FragmentThree.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link FragmentThree#newInstance} factory method to * create an instance of this fragment. */ public class FragmentThree extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.acctivity_fragment_three, container, false); } }
[ "kinshukkashyup@gmail.com" ]
kinshukkashyup@gmail.com
0fd395029ebb7b277d2de9b51dfd8431ccadb535
845ef06c83dd38c1a498e16fee8f6f519dcf6473
/portlets/songs-portlet/docroot/WEB-INF/service/com/cabins/songs/service/persistence/BandPersistence.java
6d65f886b1408981983218f60b584ea94e8cca3a
[]
no_license
juliocamarero/Cabins
57284adf48cab24c9b729abc1cd00540c7f01a9b
a77b4fd07c41a8bd2dcd9c691382b43d33c9f2d4
refs/heads/master
2021-01-22T12:02:49.969448
2010-02-14T10:36:40
2010-02-14T10:36:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,101
java
/** * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.cabins.songs.service.persistence; import com.liferay.portal.service.persistence.BasePersistence; /** * <a href="BandPersistence.java.html"><b><i>View Source</i></b></a> * * @author Julio Camarero */ public interface BandPersistence extends BasePersistence { public void cacheResult(com.cabins.songs.model.Band band); public void cacheResult(java.util.List<com.cabins.songs.model.Band> bands); public void clearCache(); public com.cabins.songs.model.Band create(long bandId); public com.cabins.songs.model.Band remove(long bandId) throws com.cabins.songs.NoSuchBandException, com.liferay.portal.SystemException; public com.cabins.songs.model.Band remove(com.cabins.songs.model.Band band) throws com.liferay.portal.SystemException; public com.cabins.songs.model.Band update(com.cabins.songs.model.Band band) throws com.liferay.portal.SystemException; public com.cabins.songs.model.Band update( com.cabins.songs.model.Band band, boolean merge) throws com.liferay.portal.SystemException; public com.cabins.songs.model.Band updateImpl( com.cabins.songs.model.Band band, boolean merge) throws com.liferay.portal.SystemException; public com.cabins.songs.model.Band findByPrimaryKey(long bandId) throws com.cabins.songs.NoSuchBandException, com.liferay.portal.SystemException; public com.cabins.songs.model.Band fetchByPrimaryKey(long bandId) throws com.liferay.portal.SystemException; public com.cabins.songs.model.Band findBygroupId(long groupId) throws com.cabins.songs.NoSuchBandException, com.liferay.portal.SystemException; public com.cabins.songs.model.Band fetchBygroupId(long groupId) throws com.liferay.portal.SystemException; public com.cabins.songs.model.Band fetchBygroupId(long groupId, boolean retrieveFromCache) throws com.liferay.portal.SystemException; public java.util.List<Object> findWithDynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) throws com.liferay.portal.SystemException; public java.util.List<Object> findWithDynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end) throws com.liferay.portal.SystemException; public java.util.List<com.cabins.songs.model.Band> findAll() throws com.liferay.portal.SystemException; public java.util.List<com.cabins.songs.model.Band> findAll(int start, int end) throws com.liferay.portal.SystemException; public java.util.List<com.cabins.songs.model.Band> findAll(int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException; public void removeBygroupId(long groupId) throws com.cabins.songs.NoSuchBandException, com.liferay.portal.SystemException; public void removeAll() throws com.liferay.portal.SystemException; public int countBygroupId(long groupId) throws com.liferay.portal.SystemException; public int countAll() throws com.liferay.portal.SystemException; }
[ "juliocamarero@MacBook-de-Julio.local" ]
juliocamarero@MacBook-de-Julio.local
1934c97c66e0f09f40c5aa0ea3e9df470db2b7f0
d3eaeb9cf26184e3babcb8acfe3105c65b1a23e6
/src/main/java/com/github/chen0040/ls/methods/naive/SweepingSearch.java
4a30475638550e066db1c9d513cedae64940b5d5
[ "MIT" ]
permissive
chen0040/java-local-search
eafca3f282d6142628bb40279a45aedc8c4cc62e
f0fbbc235a036fcafeab50fd6e0779250846a885
refs/heads/master
2020-12-30T18:02:23.425415
2017-05-16T04:46:28
2017-05-16T04:46:28
90,941,793
1
0
null
null
null
null
UTF-8
Java
false
false
2,640
java
package com.github.chen0040.ls.methods.naive; import com.github.chen0040.ls.CostEvaluationMethod; import com.github.chen0040.ls.GradientEvaluationMethod; import com.github.chen0040.ls.LocalSearch; import com.github.chen0040.ls.TerminationEvaluationMethod; import com.github.chen0040.ls.solutions.NumericSolution; import com.github.chen0040.ls.solutions.NumericSolutionUpdateResult; /** * Created by xschen on 23/8/15. */ public class SweepingSearch extends LocalSearch { private int intervalCount; @Override public void copy(LocalSearch rhs){ super.copy(rhs); SweepingSearch rhs2 = (SweepingSearch)rhs; intervalCount = rhs2.intervalCount; } @Override public LocalSearch makeCopy(){ SweepingSearch clone = new SweepingSearch(); clone.copy(this); return clone; } public SweepingSearch(){ intervalCount = 100; } @Override public NumericSolution minimize(double[] x_0, final CostEvaluationMethod evaluate, GradientEvaluationMethod calc_gradient, TerminationEvaluationMethod should_terminate, Object constraint) { NumericSolution best_solution = new NumericSolution(); double[] x = x_0.clone(); double fx = evaluate.apply(x, getLowerBounds(), getUpperBounds(), constraint); best_solution.tryUpdateSolution(x, fx); int iteration = 0; NumericSolutionUpdateResult state = null; int m = x.length; int L = 0; for(int i=0; i < m; ++i){ L = L * intervalCount + (intervalCount - 1); } while(L > 0) { double[] x_next = create(getLowerBounds(), getUpperBounds(), L); double fx_next = evaluate.apply(x_next, getLowerBounds(), getUpperBounds(), constraint); state = best_solution.tryUpdateSolution(x_next, fx_next); if(state.improved()) { notifySolutionUpdated(best_solution, state, iteration); } step(new NumericSolution(x_next, fx_next), state, iteration); L--; iteration++; } return best_solution; } private double[] create(double[] lower, double[] upper, int L){ int m = lower.length; int[] indices = new int[m]; for(int i=0; i < m; ++i){ int index = L % intervalCount; indices[i] = index; L = L / intervalCount; } double[] x = new double[m]; for(int i=0; i < m; ++i){ x[i] = lower[i] + indices[i] * (upper[i] - lower[i]) / intervalCount; } return x; } }
[ "xs0040@gmail.com" ]
xs0040@gmail.com
e2e10d0e41c3cf57341d909c366c38a98ffe9200
459135da5d33609b90a55c58d4c8b880f7163a19
/src/java/Servlets/RemoverFuncionario.java
346c293e503e00f48273b746ff95234e36e2555e
[]
no_license
GuilhermeUhrigshardt/RHINDO
5235500ca3167b67c2037d666b9a0bd2a4d2793c
dcd0530c135148eba9ce24a983f072af28f845c2
refs/heads/master
2023-08-03T10:56:26.814729
2023-07-21T18:43:26
2023-07-21T18:43:26
90,795,395
0
0
null
null
null
null
UTF-8
Java
false
false
4,044
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 Servlets; import DAO.FuncionarioDAO; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author guilh */ @WebServlet(name = "RemoverFuncionario", urlPatterns = {"/RemoverFuncionario"}) public class RemoverFuncionario extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, ClassNotFoundException { HttpSession session = request.getSession(false); if (session.getAttribute("funcionario") == null) { request.setAttribute("msg", "Acesso negado!"); RequestDispatcher rd = getServletContext().getRequestDispatcher("/erro.jsp"); rd.forward(request, response); } FuncionarioDAO funcionarioDAO = new FuncionarioDAO(); int id = Integer.valueOf(request.getParameter("fun")); funcionarioDAO.removerFuncionario(id); request.setAttribute("msg", "Funcionário removido com sucesso!"); RequestDispatcher rd = getServletContext().getRequestDispatcher("/manter_funcionarios.jsp"); rd.forward(request, response); } // <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 { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(RemoverFuncionario.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(RemoverFuncionario.class.getName()).log(Level.SEVERE, null, ex); } } /** * 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 { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(RemoverFuncionario.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(RemoverFuncionario.class.getName()).log(Level.SEVERE, null, ex); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "guilh@DESKTOP-1TD2G1T" ]
guilh@DESKTOP-1TD2G1T
1d53e1aaf8b794313f39fd96597f3b0b5a664583
7f5d15782492849cc97a789bbbd70f612ba8a12b
/src/com/armadialogcreator/gui/FXUtil.java
a06a3c6f681184b224e3d77c071f70054b541298
[ "MIT" ]
permissive
kayler-renslow/arma-dialog-creator
76dae08a19ff363f86823e9ae207f20999a90517
706afc4382c02fffea87fb8bdee5e54ee851a3d8
refs/heads/master
2021-01-23T21:47:38.919271
2019-03-01T01:00:42
2019-03-01T01:00:42
59,430,696
99
18
MIT
2019-03-01T01:00:43
2016-05-22T19:39:13
Java
UTF-8
Java
false
false
1,987
java
package com.armadialogcreator.gui; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Platform; import javafx.concurrent.Task; import javafx.scene.Parent; import javafx.scene.control.Tooltip; import javafx.util.Duration; import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; /** Misc utilities for JavaFX @author Kayler @since 05/31/2016 */ public class FXUtil { /** Wait until <code>parent.isVisible()</code> is true and then run the given Runnable @param parent parent to check visibility of @param runnable runnable to run (on JavaFX thread) */ public static void runWhenVisible(@NotNull Parent parent, @NotNull Runnable runnable) { Task<Boolean> loadTask = new Task<Boolean>() { @Override protected Boolean call() throws Exception { while (!parent.isVisible()) { try { Thread.sleep(300); } catch (InterruptedException ignore) { } } Platform.runLater(runnable); return true; } }; Thread thread = new Thread(loadTask); thread.setDaemon(false); thread.start(); } /** As of Java 8, setting the tooltip show delay isn't possible. Until an official implementation, this is one way to configure the tooltip show delay @param tooltip tooltip to change delay of @param delayMillis milliseconds before the tooltip can appear */ public static void hackTooltipStartTiming(Tooltip tooltip, double delayMillis) { try { Field fieldBehavior = tooltip.getClass().getDeclaredField("BEHAVIOR"); fieldBehavior.setAccessible(true); Object objBehavior = fieldBehavior.get(tooltip); Field fieldTimer = objBehavior.getClass().getDeclaredField("activationTimer"); fieldTimer.setAccessible(true); Timeline objTimer = (Timeline) fieldTimer.get(objBehavior); objTimer.getKeyFrames().clear(); objTimer.getKeyFrames().add(new KeyFrame(new Duration(delayMillis))); } catch (Exception e) { e.printStackTrace(System.out); } } }
[ "kaylerrenslow@gmail.com" ]
kaylerrenslow@gmail.com
2bdf8997ba93c86fcaf006a6c77b0a67ac919d57
08f30006f2e8f45b9811d0337093c7d51994023b
/app/src/main/java/com/uprayzner/mediator/views/sticky_header/MyStickyRecyclerHeadersDecoration.java
5ab8ac02f8d28cfa2d09ea7e8bcf1dcb027a6faf
[ "Apache-2.0" ]
permissive
luffycheung/Mediator_Android
d558f9a2a3ffb6283731a15775328bd50c29f080
9dc20ed5f2d5215f33bc28cf042436ea0e7d31c5
refs/heads/master
2021-01-17T02:08:58.340254
2016-06-15T18:28:11
2016-06-16T11:17:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,811
java
package com.uprayzner.mediator.views.sticky_header; import android.graphics.Canvas; import android.graphics.Rect; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.SparseArray; import android.view.View; import com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersAdapter; import com.timehop.stickyheadersrecyclerview.caching.HeaderProvider; import com.timehop.stickyheadersrecyclerview.caching.HeaderViewCache; import com.timehop.stickyheadersrecyclerview.calculation.DimensionCalculator; import com.timehop.stickyheadersrecyclerview.util.LinearLayoutOrientationProvider; import com.timehop.stickyheadersrecyclerview.util.OrientationProvider; /** * Copyright 2016 U.Prayzner * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * 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. */ public class MyStickyRecyclerHeadersDecoration extends RecyclerView.ItemDecoration { private final StickyRecyclerHeadersAdapter mAdapter; private final SparseArray<Rect> mHeaderRects = new SparseArray<>(); private final HeaderProvider mHeaderProvider; private final OrientationProvider mOrientationProvider; private final MyHeaderPositionCalculator mHeaderPositionCalculator; private final MyHeaderRenderer mRenderer; private final DimensionCalculator mDimensionCalculator; /** * The following field is used as a buffer for internal calculations. Its sole purpose is to avoid * allocating new Rect every time we need one. */ private final Rect mTempRect = new Rect(); // TODO: Consider passing in orientation to simplify orientation accounting within calculation public MyStickyRecyclerHeadersDecoration(StickyRecyclerHeadersAdapter adapter) { this(adapter, new LinearLayoutOrientationProvider(), new DimensionCalculator()); } private MyStickyRecyclerHeadersDecoration(StickyRecyclerHeadersAdapter adapter, OrientationProvider orientationProvider, DimensionCalculator dimensionCalculator) { this(adapter, orientationProvider, dimensionCalculator, new MyHeaderRenderer(orientationProvider), new HeaderViewCache(adapter, orientationProvider)); } private MyStickyRecyclerHeadersDecoration(StickyRecyclerHeadersAdapter adapter, OrientationProvider orientationProvider, DimensionCalculator dimensionCalculator, MyHeaderRenderer headerRenderer, HeaderProvider headerProvider) { this(adapter, headerRenderer, orientationProvider, dimensionCalculator, headerProvider, new MyHeaderPositionCalculator(adapter, headerProvider, orientationProvider, dimensionCalculator)); } private MyStickyRecyclerHeadersDecoration(StickyRecyclerHeadersAdapter adapter, MyHeaderRenderer headerRenderer, OrientationProvider orientationProvider, DimensionCalculator dimensionCalculator, HeaderProvider headerProvider, MyHeaderPositionCalculator headerPositionCalculator) { mAdapter = adapter; mHeaderProvider = headerProvider; mOrientationProvider = orientationProvider; mRenderer = headerRenderer; mDimensionCalculator = dimensionCalculator; mHeaderPositionCalculator = headerPositionCalculator; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); int itemPosition = parent.getChildAdapterPosition(view); if (itemPosition == RecyclerView.NO_POSITION) { return; } if (mHeaderPositionCalculator.hasNewHeader(itemPosition, mOrientationProvider.isReverseLayout(parent))) { View header = getHeaderView(parent, itemPosition); setItemOffsetsForHeader(outRect, header, mOrientationProvider.getOrientation(parent)); } } /** * Sets the offsets for the first item in a section to make room for the header view * * @param itemOffsets rectangle to define offsets for the item * @param header view used to calculate offset for the item * @param orientation used to calculate offset for the item */ private void setItemOffsetsForHeader(Rect itemOffsets, View header, int orientation) { mDimensionCalculator.initMargins(mTempRect, header); if (orientation == LinearLayoutManager.VERTICAL) { itemOffsets.top = header.getHeight() + mTempRect.top + mTempRect.bottom; } else { itemOffsets.left = header.getWidth() + mTempRect.left + mTempRect.right; } } @Override public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) { super.onDrawOver(canvas, parent, state); final int childCount = parent.getChildCount(); if (childCount <= 0 || mAdapter.getItemCount() <= 0) { return; } for (int i = 0; i < childCount; i++) { View itemView = parent.getChildAt(i); int position = parent.getChildAdapterPosition(itemView); if (position == RecyclerView.NO_POSITION) { continue; } boolean hasStickyHeader = mHeaderPositionCalculator.hasStickyHeader(itemView, mOrientationProvider.getOrientation(parent), position); if (hasStickyHeader || mHeaderPositionCalculator.hasNewHeader(position, mOrientationProvider.isReverseLayout(parent))) { View header = mHeaderProvider.getHeader(parent, position); //re-use existing Rect, if any. Rect headerOffset = mHeaderRects.get(position); if (headerOffset == null) { headerOffset = new Rect(); mHeaderRects.put(position, headerOffset); } mHeaderPositionCalculator.initHeaderBounds(headerOffset, parent, header, itemView, hasStickyHeader); mRenderer.drawHeader(parent, canvas, header, headerOffset); } } } /** * Gets the position of the header under the specified (x, y) coordinates. * * @param x x-coordinate * @param y y-coordinate * @return position of header, or -1 if not found */ public int findHeaderPositionUnder(int x, int y) { for (int i = 0; i < mHeaderRects.size(); i++) { Rect rect = mHeaderRects.get(mHeaderRects.keyAt(i)); if (rect.contains(x, y)) { return mHeaderRects.keyAt(i); } } return -1; } /** * Gets the header view for the associated position. If it doesn't exist yet, it will be * created, measured, and laid out. * * @param parent * @param position * @return Header view */ public View getHeaderView(RecyclerView parent, int position) { return mHeaderProvider.getHeader(parent, position); } /** * Invalidates cached headers. This does not invalidate the recyclerview, you should do that manually after * calling this method. */ public void invalidateHeaders() { mHeaderProvider.invalidate(); } }
[ "u.prayzner@bvblogic.com" ]
u.prayzner@bvblogic.com
4aecfb5d5f9d9ac5e0422e7073b599b20c7ad5ff
519ea937a37be3006d0b1f3de81b1f52f6a6f90d
/app/src/main/java/com/example/android/music_o_player/CategoriesClickListener.java
1d6995222b263465e22769f5dd9c36304c32ecfd
[]
no_license
himanshudhiman1997/Musical-structure-app-android-Udacity
32f6f1832eb0d5c7af619e669a5922263fce4b28
bd9c6d724c3574da3f9eaa75b506ad0a82ed3cfb
refs/heads/master
2020-12-02T21:24:08.072293
2017-07-05T11:13:49
2017-07-05T11:13:49
96,310,788
1
0
null
null
null
null
UTF-8
Java
false
false
367
java
package com.example.android.music_o_player; import android.view.View; import android.widget.Toast; /** * Created by mr on 06-11-2016. */ public class CategoriesClickListener implements View.OnClickListener { @Override public void onClick(View view) { Toast.makeText(view.getContext(),"list of categories ",Toast.LENGTH_SHORT).show(); } }
[ "himanshudhiman" ]
himanshudhiman
560ceb95e993222f88e88065489e9d1671feac5f
16b25d7f9675b1ac876dcacf2f816a47501440cf
/pyg_sellergoods_service/src/main/java/com/pinyougou/sellergoods/service/impl/BrandServiceImpl.java
c7469b6c52bd298dbf8647f92310f53c70dddf85
[]
no_license
ghuiiu/PinYouGouByGorx
d8df39f2ea12885d0d5a933010b41d8164ddc459
435fe13a29dc65dd8b234f68ad459831378b7a4f
refs/heads/master
2022-12-21T11:38:01.225585
2020-07-16T16:18:12
2020-07-16T16:18:12
172,822,116
0
0
null
2022-12-16T07:12:51
2019-02-27T01:46:53
JavaScript
UTF-8
Java
false
false
2,516
java
package com.pinyougou.sellergoods.service.impl; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.pinyougou.mapper.TbBrandMapper; import com.pinyougou.pojo.TbBrand; import com.pinyougou.pojo.TbBrandExample; import com.pinyougou.pojo.TbBrandExample.Criteria; import com.pinyougou.sellergoods.service.BrandService; import entity.PageResult; /** * 服务实现层 * @author Administrator * */ @Service public class BrandServiceImpl implements BrandService { @Autowired private TbBrandMapper brandMapper; /** * 查询全部 */ @Override public List<TbBrand> findAll() { return brandMapper.selectByExample(null); } /** * 按分页查询 */ @Override public PageResult findPage(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); Page<TbBrand> page= (Page<TbBrand>) brandMapper.selectByExample(null); return new PageResult(page.getTotal(), page.getResult()); } /** * 增加 */ @Override public void add(TbBrand brand) { brandMapper.insert(brand); } /** * 修改 */ @Override public void update(TbBrand brand){ brandMapper.updateByPrimaryKey(brand); } /** * 根据ID获取实体 * @param id * @return */ @Override public TbBrand findOne(Long id){ return brandMapper.selectByPrimaryKey(id); } /** * 批量删除 */ @Override public void delete(Long[] ids) { for(Long id:ids){ brandMapper.deleteByPrimaryKey(id); } } @Override public PageResult findPage(TbBrand brand, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); TbBrandExample example=new TbBrandExample(); Criteria criteria = example.createCriteria(); if(brand!=null){ if(brand.getName()!=null && brand.getName().length()>0){ criteria.andNameLike("%"+brand.getName()+"%"); } if(brand.getFirstChar()!=null && brand.getFirstChar().length()>0){ criteria.andFirstCharEqualTo(brand.getFirstChar()); } } Page<TbBrand> page= (Page<TbBrand>)brandMapper.selectByExample(example); return new PageResult(page.getTotal(), page.getResult()); } /** * 需求:查询品牌下拉列表 * 查询数据格式:[{id:'1',text:'联想'},{id:'2',text:'华为'}] * 返回值:List<Map> */ @Override public List<Map> findBrandList() { return brandMapper.selectOptionList(); } }
[ "963293406@qq.com" ]
963293406@qq.com
9aa1a7a64f643c418829669002ac0be5d460edb1
7a640701c2f53b48f3930698733156e6c1775616
/webapp/源代码-这个不用复制/hfblog/src/com/hfhuaizhi/servlet/UpdateTongxun.java
51e2674a3312a2e241c9b4ec4f0d7b883f6b3c57
[]
no_license
hfhuaizhi/hfblog
87eb82ec9d5e149c17dfb66d25aa3dbaadb7bc43
1457cedb527f4d486294f95d249d4710711d4cc4
refs/heads/master
2021-07-24T22:23:45.325088
2017-11-04T03:35:46
2017-11-04T03:35:46
109,400,255
0
0
null
null
null
null
UTF-8
Java
false
false
2,926
java
package com.hfhuaizhi.servlet; 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 javax.servlet.http.HttpSession; import org.apache.commons.beanutils.BeanUtils; import com.hfhuaizhi.dao.TongxunDao; import com.hfhuaizhi.dao.UserDao; import com.hfhuaizhi.domain.Tongxun; import com.hfhuaizhi.domain.User; public class UpdateTongxun extends HttpServlet { /** * Constructor of the object. */ public UpdateTongxun() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getSession().getAttribute("username")==null){ response.sendRedirect("login.jsp"); return; } response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); PrintWriter out = response.getWriter(); Tongxun user = new Tongxun(); Tongxun tmp = null; try { BeanUtils.populate(user, request.getParameterMap()); System.out.println(user); TongxunDao dao = new TongxunDao(); int i = dao.updateTongxun(user); HttpSession session = request.getSession(); if(i<1){ session.setAttribute("erroruser", "出现错误"); } response.sendRedirect("GetTongxunlu"); //request.getRequestDispatcher("GetTongxunlu").forward(request, response); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); response.sendRedirect("GetTongxunlu"); //request.getRequestDispatcher("GetTongxunlu.jsp").forward(request, response); } out.flush(); out.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }
[ "2323089526@qq.com" ]
2323089526@qq.com
25f92bb711b85a7d9364b518c2e998571b2a64cf
3b2090ecf36e2274e296fc55499bd0027723c3a2
/app/src/main/java/allen/testmg/api/ApiConstant.java
d4639263ace7c37824340a27b1a3f2c713864dd9
[]
no_license
allenatwork/renewmanga
322d78861662cdf54e615e9c3e17ea23c4e7f5f0
e93953bc8a1be49d790c4a4cb64aa3ec923f2481
refs/heads/master
2021-01-09T09:38:15.145384
2017-02-10T10:21:31
2017-02-10T10:21:31
81,198,733
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package allen.testmg.api; /** * Created by Admin on 9/9/2016. */ public class ApiConstant { public static final String HOST = "http://123.30.149.80:8883/"; }
[ "anh.dao@ntq-solution.com.vn" ]
anh.dao@ntq-solution.com.vn
fe719a37f80459fd3f9b1843cfd575dae0393368
1ae6b68e500d86d54c2d03b7d4629a6c591a1336
/src/aksha/adapters/TabsPagerAdapter.java
1305dd4b3efd92ed36fa6cf26b3c7b8f5f01607e
[]
no_license
krishnapratap007/Mosaic
769dfd1b7eade3e192c7825c911368d725b1e729
dcaf4cab184a6411eebfb1ccd169d57f1a3ad7ed
refs/heads/master
2016-09-06T02:29:28.522984
2015-03-27T09:37:39
2015-03-27T09:37:39
32,975,804
0
0
null
null
null
null
UTF-8
Java
false
false
2,338
java
package aksha.adapters; import java.util.Stack; import aksha.addmandi.AddMandiHome; import aksha.addretailer.MyRetailers; import aksha.addretailer.RetailersHome; import aksha.expenses.ExpensesHome; import aksha.farmers.FarmerHome; import aksha.farmers.MyFarmer; import aksha.mopwheat.MOPWheatHome; import aksha.mytasks.MyTasks; import aksha.plannedactivity.PlannedActivities; import aksha.reportsfa.Reports_FA; import aksha.stock.Stock; import aksha.upcomingdemo.UpcomingDemoHome; import android.content.Context; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.view.ViewGroup; public class TabsPagerAdapter extends FragmentPagerAdapter{ int lnth; public TabsPagerAdapter(Context cont,FragmentManager fm, int length) { super(fm); lnth = length; } @Override public Fragment getItem(int arg0) { // TODO Auto-generated method stub switch (arg0) { case 0: return new MyTasks(); case 1: return new PlannedActivities(); /* case 2: return new MOPWheatHome();*/ case 2: return new MyRetailers(); // return new ExpensesHome(); case 3: return new FarmerHome(); case 4: return new Stock(); case 5: return new UpcomingDemoHome(); case 6: return new Reports_FA(); /* case 4: return new MOPMustardHome(); case 5: return new RetailerHomeScreen();*/ /*case 6: return new PotashContent(); */ } return null; } @Override public int getCount() { // TODO Auto-generated method stub return lnth; } public String makeFragmentName(int viewId, int position) { return "android:switcher:" + viewId + ":" + position; } @Override public void destroyItem(ViewGroup container, int position, Object object) { super.destroyItem(container, position, object); } }
[ "agentk@localhost.localdomain" ]
agentk@localhost.localdomain
27cd7f434364a9c0ad5b4af7bdc930090fa10185
8308597105da081c2cf5ec9fd643ce001f174b4f
/microserivcecloud/microservicecloud-consumer-dept-feign/src/main/java/com/atguigu/springcloud/ConsumerApplicationfeign.java
3627bc31bb180634e477997735769c33063ca8a6
[]
no_license
LiuWenChuang/microserivcecloud
b5d16c7c9efdaab8fb5c14994da73604793fce3b
321aad458d89004f9f32500d0898e13d24af4e4f
refs/heads/master
2022-06-22T07:27:13.626990
2019-08-12T17:34:18
2019-08-12T17:34:18
201,978,070
0
0
null
2022-06-21T01:39:22
2019-08-12T17:30:04
Java
UTF-8
Java
false
false
679
java
package com.atguigu.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.feign.EnableFeignClients; @SpringBootApplication @EnableEurekaClient//开启 eureka 的客户端 @EnableFeignClients(basePackages={"com.liuchuang.springcloud"}) //@ComponentScan("com.liuchuang.springcloud") 千万不要加上 public class ConsumerApplicationfeign { public static void main(String[] args) { // TODO Auto-generated method stub SpringApplication.run(ConsumerApplicationfeign.class, args); } }
[ "liuchuang@whohelp.cc" ]
liuchuang@whohelp.cc
6fcfff44bd51c5f572325b2dc192ce1231211b57
a2d54bc4e6db31c6811b897076062cab208d3c17
/chapter11/StaticTest02.java
91e380a213ea5c7712ab2639afffc70b2fc75e37
[]
no_license
tiejian147/javaStudy
50f5c3224325fc431b528d7f5456ca68d09a3cb8
6fc96cd017f568ce79a685d6cc93c7368fa7d063
refs/heads/master
2022-10-23T18:17:12.115695
2020-06-10T10:21:47
2020-06-10T10:21:47
256,085,846
0
0
null
null
null
null
UTF-8
Java
false
false
2,838
java
/** * 什么是受变量声明为实例的,什么时候声明为静态的? * 如果这个类型的所有对象的某个属性值都是一样的, * 不建议定义为实例变量,浪费内存空间,建议定义为类级别特征, * 定义为静态变量,在方法区中只保留一份,节省内存开销。 * * 一个对象一份的是实例变量。 * 所有对象一份的是静态变量。 * */ public class StaticTest02{ public static void main(String[] args){ // Chinese p1 = new Chinese("23564564645","张三","中国"); // Chinese p2 = new Chinese("25234654","李四","中国"); // System.out.println(p1.idCard); // System.out.println(p1.name); // System.out.println(p1.country); // System.out.println("------------------------------"); // System.out.println(p2.idCard); // System.out.println(p2.name); // System.out.println(p2.country); Chinese p1 = new Chinese("23564564645","张三"); Chinese p2 = new Chinese("25234654","李四"); //打印国籍: System.out.println(Chinese.country); System.out.println(p1.idCard); System.out.println(p1.name); System.out.println(p2.idCard); System.out.println(p2.name); } } // class Chinese{ // //身份证号 // //每一个人的身份证号不同,所以身份证号应该是实例变量,一个对象一份 // String idCard; // //姓名 // //姓名也是一个人一个姓名,姓名也应该是实例变量 // String name ; // //国籍 // //对于”中国人“这个类来说,国籍都是中国,不会随着对象的改变而改变 // //显然国际级并不是对象级别的特征 // //国籍属于整个类的特征,整个族的特征 // String country; // //无参数构造方法: // public Chinese(){ // } // //有参数的构造方法 // public Chinese(String s1,String s2,String s3){ // idCard = s1; // name = s2; // country = s3; // } // } class Chinese{ //身份证号 //每一个人的身份证号不同,所以身份证号应该是实例变量,一个对象一份 String idCard; //姓名 //姓名也是一个人一个姓名,姓名也应该是实例变量 String name ; //国籍 //重点重点五颗星:加static的变量叫做静态变量 //静态变量在类加载时初始化,不需要new对象,静态变量的空间就开出来了 //静态变量存储在方法区 static String country = "中国"; //无参数构造方法: public Chinese(){ } //有参数的构造方法 public Chinese(String s1,String s2){ idCard = s1; name = s2; } }
[ "shengchao.liu@yi23.net" ]
shengchao.liu@yi23.net
10ed1689312cac11d74418c703fe343cd5a8159e
62942510900b2f63741082000a7dbea1f7e06226
/src/main/java/com/ryt/web/dao/area/AreaProvinceDao.java
a10ba4ebb64e7c48e7fe8abb46db094a66567a4f
[]
no_license
jyma1991/RuyTonWeb
3e19ab48d77edfc0ed7d266784bfc0dbfcf009e8
384abbd5cca4916ed96a69372f8f552b5977e970
refs/heads/master
2020-04-16T17:24:43.787560
2016-10-16T10:24:53
2016-10-16T10:24:53
44,539,420
0
0
null
null
null
null
UTF-8
Java
false
false
186
java
package com.ryt.web.dao.area; import org.durcframework.core.dao.BaseDao; import com.ryt.web.entity.area.AreaProvince; public interface AreaProvinceDao extends BaseDao<AreaProvince> { }
[ "1146990355@qq.com" ]
1146990355@qq.com
7ecf6ee7351403d3097dc26a8a4bbc8ae699ad86
08ad44d1e94cf1677f3e27fefffb9f59500962cc
/Echanneling/doctor-service/src/main/java/com/abhishek/doctor/DemoApplication.java
7d57079279a7bc585b678d7a12dd980c7acf7443
[]
no_license
ShaleelAbhishek/Spring-boot-basics
29023bcf6db60218c894a78ae4f4fb6f660202c2
3a54af5f2a53f5582777de80610a1f257703dcc2
refs/heads/master
2023-08-03T04:37:05.234314
2020-04-29T14:15:15
2020-04-29T14:15:15
244,447,633
0
0
null
2023-07-23T07:31:25
2020-03-02T18:43:02
Java
UTF-8
Java
false
false
396
java
package com.abhishek.doctor; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "shaleelca@gmail.com" ]
shaleelca@gmail.com
3e7bf66c773f272d59a6121dfbaf1befe183be90
7f7460501861b0f8b90bac0ecb671e6e70b6cb2a
/src/flappyBird/Renderer.java
620a5ee840524cac76bcf962ec6360b56b7a2dc1
[]
no_license
ncclapyohands/FlappyBird
29a8ac1726184284df09cc53589ddb1270f37c47
22082737e2751486d424d7b201fb0255d0538f77
refs/heads/master
2023-04-28T08:54:38.111397
2021-05-09T05:08:24
2021-05-09T05:08:24
365,671,937
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package flappyBird; import javax.swing.*; import java.awt.*; public class Renderer extends JPanel { private static final long serialVersionUID = 1L; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); FlappyBird.flappyBird.repaint(g); } }
[ "unconfigured@null.spigotmc.org" ]
unconfigured@null.spigotmc.org
8f3c8c559e875c7047db07ba7f846d6b29cbb9d1
fc5d43b082837058d9a39b10a590c4843155ad84
/Sads_MT/src/Sads.java
e22566505bb7f7df6dcad582abf5354dd5831cd7
[]
no_license
priya-marimuthu/PriyaGitRep
986506891aaff7ec8e72964cde91654c735c31c9
b5bdb43655e21c58acb739aae67c1ffdd85e965c
refs/heads/master
2020-12-24T15:41:15.571565
2012-01-19T05:13:04
2012-01-19T05:13:04
3,206,651
0
1
null
null
null
null
UTF-8
Java
false
false
28
java
public class Sads { }
[ "sadhana.krishnan@aspiresys.com" ]
sadhana.krishnan@aspiresys.com
62831ad792945639ea6f7cfa10bb42b9ec1fcce3
79e0693400df4ede9a4a63ea7f21c76c43dfeabc
/Assignment4_Haojie_Zhang/src/Business/Ticket.java
37a272bfdee6c1e94e770a9f37865f59d2326776
[]
no_license
dreamteam30/dreamteam30
86e5b6ccaae0e63773fa8b445e592a8aac8d2bd2
549d76b0a3ebef02e80bd2a105e797153eecccd6
refs/heads/master
2021-01-14T03:01:06.409320
2020-03-17T22:15:14
2020-03-17T22:15:14
242,579,336
0
0
null
2020-02-29T05:01:36
2020-02-23T19:40:56
Java
UTF-8
Java
false
false
1,170
java
package Business; import java.util.Date; /** * * @author lhm */ public class Ticket { private int ticketnumber; private int customerID; private Seat seat; private String FN; private String SN; private int count=0; public Ticket(int ticketnumber,int customerID, String FN, String SN ){ this.ticketnumber=ticketnumber; this.customerID=customerID; this.FN=FN; this.SN=SN; } public int getCustomerID() { return customerID; } public void setCustomerID(int customerID) { this.customerID = customerID; } public String getFN() { return FN; } public void setFN(String FN) { this.FN = FN; } public String getSN() { return SN; } public void setSN(String SN) { this.SN = SN; } public Seat getSeat() { return seat; } public void setSeat(Seat seat) { this.seat = seat; } @Override public String toString(){ return this.customerID + " " + this.seat; } }
[ "zhanghaoj@husky.com" ]
zhanghaoj@husky.com
01867597d90f0bb528dafb4367e7b4e32af1cba9
9c3561b84a27c3054b420c7ab00e1f2d9f96a1b6
/src/test/java/bitFury/guerillaMail/GuerrillaMail.java
a9c83cf5ab56e310afb42add53661c6a8db6651e
[]
no_license
forgetdomani/BitFury
e4c161199f9d1bd3db5e3e27a3c6d4e2bc5d60d7
33af8a094ee5bba405c5eb0ac14464d2a35623a4
refs/heads/master
2020-03-17T05:20:20.692529
2018-05-18T12:09:19
2018-05-18T12:09:19
133,311,587
0
0
null
null
null
null
UTF-8
Java
false
false
14,076
java
package bitFury.guerillaMail; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * Interface with guerrilla mail site. * * @author <a reef="https://github.com/DavidePastore">DavidePastore</a> * @url documentation: * https://docs.google.com/document/d/1Qw5KQP1j57BPTDmms5nspe-QAjNEsNg8cQHpAAycYNM/edit?hl=en */ public class GuerrillaMail { // For requests private HttpClient httpclient = new DefaultHttpClient(); private HttpResponse httpResponse; private HttpPost httpPost; private String stringResponse; private JSONObject jSonObject; // API Address private final String apiAddr = "http://api.guerrillamail.com/ajax.php?f=%s"; // GuerrillaMail final public static final String EN = "en"; public static final String FR = "fr"; public static final String NL = "nl"; public static final String RU = "ru"; public static final String TR = "tr"; public static final String UK = "uk"; public static final String AR = "ar"; public static final String KO = "ko"; public static final String JP = "jp"; public static final String ZH = "zh"; public static final String ZH_HANT = "zh-hant"; public static final String DE = "de"; public static final String ES = "es"; public static final String IT = "it"; public static final String PT = "pt"; // GuerrillaMail attributes private ArrayList<EMail> emails = new ArrayList<EMail>(); private String lang = "en"; private String emailAddress; private String sidToken; private long timestamp; private String alias; private int seqOldestEMail = 0; /** * Constructor. */ public GuerrillaMail() throws Exception { } /** * Constructor. * * @param lang * the language code. GuerrillaMail contains final Strings for this. */ public GuerrillaMail(String lang) throws Exception { this.lang = lang; } /** * The function is used to initialize a session and set the client with an email * address. If the account is expired you will get another address. * * @throws Exception */ private void _getEmailAddress() throws Exception { httpPost = new HttpPost(String.format(apiAddr, "get_email_address")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("lang", lang)); if (sidToken != null) { formparams.add(new BasicNameValuePair("sid_token", sidToken)); } UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); jSonObject = new JSONObject(stringResponse); if (jSonObject.has("email_addr")) { saveData(jSonObject); } else { throw new Exception("Email not found: " + stringResponse); } } /** * Set the email address to a different email address. */ private void _setEmailUser(String emailUser) throws Exception { httpPost = new HttpPost(String.format(apiAddr, "set_email_user")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("email_user", emailUser)); formparams.add(new BasicNameValuePair("lang", lang)); formparams.add(new BasicNameValuePair("sid_token", sidToken)); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); jSonObject = new JSONObject(stringResponse); if (jSonObject.has("email_addr")) { saveData(jSonObject); } else { throw new Exception("Email not found: " + stringResponse); } } /** * Check for new email on the server. * * @return list of new messages */ private ArrayList<EMail> _checkEmail() throws Exception { httpPost = new HttpPost(String.format(apiAddr, "check_email")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("sid_token", sidToken)); formparams.add(new BasicNameValuePair("seq", String.valueOf(seqOldestEMail))); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); jSonObject = new JSONObject(stringResponse); if (jSonObject.has("list")) { JSONArray jSonArray = jSonObject.getJSONArray("list"); for (int i = 0; i < jSonArray.length(); i++) { if (!emails.contains(jSonArray.getJSONObject(i))) { emails.add(new EMail(jSonArray.getJSONObject(i))); } } seqOldestEMail = emails.get(emails.size() - 1).getId(); } else { throw new Exception("_checkEmail doesn't find list of emails: " + stringResponse); } return emails; } /** * Get email list. * * @return list of new messages */ private ArrayList<EMail> _getEmailList() throws Exception { httpPost = new HttpPost(String.format(apiAddr, "get_email_list")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("lang", "en")); formparams.add(new BasicNameValuePair("sid_token", sidToken)); formparams.add(new BasicNameValuePair("offset", String.valueOf(seqOldestEMail))); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); // System.out.println("RESPONSE: " + stringResponse); jSonObject = new JSONObject(stringResponse); if (jSonObject.has("list")) { JSONArray jSonArray = jSonObject.getJSONArray("list"); for (int i = 0; i < jSonArray.length(); i++) { if (!emails.contains(jSonArray.getJSONObject(i))) { emails.add(new EMail(jSonArray.getJSONObject(i))); } } // seqOldestEMail = emails.get(emails.size()-1).getMailId(); } else { throw new Exception("_getEmailList doesn't find list of emails: " + stringResponse); } return emails; } /** * Get the contents of an email. * * @param emailId * the id of the email you want to fetch. * @return the email. */ private EMail _fetchEmail(int emailId) throws Exception { EMail email = null; if (emailExists(emailId)) { email = emails.get(emailPosition(emailId)); httpPost = new HttpPost(String.format(apiAddr, "fetch_email")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("sid_token", sidToken)); formparams.add(new BasicNameValuePair("email_id", String.valueOf(emailId))); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); jSonObject = new JSONObject(stringResponse); if (jSonObject.has("mail_id")) { email.setBody(jSonObject.getString("mail_body")); } else { throw new Exception("_fetchEmail doesn't find email content: " + stringResponse); } } return email; } /** * Forget the current email address. * * @return true if successful, false otherwise. * @throws Exception */ private void _forgetMe() throws Exception { httpPost = new HttpPost(String.format(apiAddr, "forget_me")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("lang", "en")); formparams.add(new BasicNameValuePair("sid_token", sidToken)); formparams.add(new BasicNameValuePair("email_addr", emailAddress)); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); if (!Boolean.valueOf(stringResponse)) { throw new Exception("forgetMe isn't successfull."); } else { emailAddress = null; emails = new ArrayList<EMail>(); seqOldestEMail = -1; sidToken = null; timestamp = -1; } } /** * Delete all the email with the parameter id. * * @param emailIds * the ArrayList with all the emailId that you want to delete. * @throws IOException * @throws ClientProtocolException */ private void _delEmail(ArrayList<Integer> emailIds) throws ClientProtocolException, IOException { Iterator<Integer> iterator = emailIds.iterator(); httpPost = new HttpPost(String.format(apiAddr, "del_email")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("lang", "en")); formparams.add(new BasicNameValuePair("sid_token", sidToken)); // Adding all the email ids in the form while (iterator.hasNext()) { formparams.add(new BasicNameValuePair("email_ids[]", Integer.toString(iterator.next()))); } UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); // System.out.s("RESPONSE: "+stringResponse); } /** * Extend the email address time by 1 hour. A maximum of 2 hours can be * extended. * * @throws Exception */ private void _extend() throws Exception { httpPost = new HttpPost(String.format(apiAddr, "extend")); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("lang", "en")); formparams.add(new BasicNameValuePair("sid_token", sidToken)); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost); stringResponse = EntityUtils.toString(httpResponse.getEntity()); jSonObject = new JSONObject(stringResponse); if (jSonObject.has("expired")) { if (jSonObject.getBoolean("expired")) { throw new Exception("The email has expired."); } timestamp = jSonObject.getLong("email_timestamp"); sidToken = jSonObject.getString("sid_token"); int affected = jSonObject.getInt("affected"); if (!Utils.fromIntToBoolean(affected)) { throw new Exception("The extension is not successful."); } } else { throw new Exception("_extend doesn't find response content: " + stringResponse); } } /** * Save data of the email address from the request. * * @param jSonObject * jsonObject * @throws JSONException */ private void saveData(JSONObject jSonObject) throws JSONException { emailAddress = jSonObject.getString("email_addr"); sidToken = jSonObject.getString("sid_token"); timestamp = jSonObject.getLong("email_timestamp"); alias = jSonObject.getString("alias"); } /** * Check if an email is in the emails store. * * @param emailId * the id of the email * @return true or false */ private boolean emailExists(int emailId) { for (int i = 0; i < emails.size(); i++) { EMail emailTemp = emails.get(i); if (emailTemp.getId() == emailId) { return true; } } return false; } /** * Return the position where the email is in the emails store. * * @param emailId * the id of the email * @return the position in the ArrayList<EMail> * @throws Exception */ private int emailPosition(int emailId) throws Exception { for (int i = 0; i < emails.size(); i++) { EMail emailTemp = emails.get(i); if (emailTemp.getId() == emailId) { return i; } } throw new Exception("The email store doesn't contain the email."); } /** * Check for new email on the server. * * @return list of new messages */ public ArrayList<EMail> checkEmail() throws Exception { return _checkEmail(); } /** * Get the contents of an email. * * @param emailId * the id of the email you want to fetch. * @return the email. * @throws Exception */ public EMail fetchEmail(int emailId) throws Exception { return _fetchEmail(emailId); } /** * Forget the current email address. * * @throws Exception */ public void forgetMe() throws Exception { if (emailAddress != null) { _forgetMe(); } } /** * Delete all the email with the parameter id. * * @param emailIds * the ArrayList with all the emailId that you want to delete. * @throws IOException * @throws ClientProtocolException */ public void delEmail(ArrayList<Integer> emailIds) throws ClientProtocolException, IOException { _delEmail(emailIds); } /** * Extend the email address time by 1 hour. A maximum of 2 hours can be * extended. * * @throws Exception */ public void extend() throws Exception { if (emailAddress != null) { _extend(); } else { throw new Exception("Email address is null."); } } /* GET METHODS */ /** * Get email address. If the account is expired you will get another address. * * @return the email address. * @throws Exception */ public String getEmailAddress() throws Exception { if (emailAddress == null) { _getEmailAddress(); } return this.emailAddress; } /** * Get the email list. * * @return list of new messages */ public ArrayList<EMail> getEmailList() throws Exception { return this._getEmailList(); } /* SET METHODS */ /** * Set the email user part of the address. * * @param emailUser * the email user part of the address. */ public void setEmailUser(String emailUser) throws Exception { _setEmailUser(emailUser); } }
[ "37404362+forgetdomani@users.noreply.github.com" ]
37404362+forgetdomani@users.noreply.github.com
4daec8b534c9c6f3beb4052a3940aeeb09f4c0d9
ceeacb5157b67b43d40615daf5f017ae345816db
/generated/sdk/appservice/azure-resourcemanager-appservice-generated/src/main/java/com/azure/resourcemanager/appservice/generated/models/CertificateCollection.java
696067bcbc845845c3a87221a8b276af48028e2d
[ "LicenseRef-scancode-generic-cla" ]
no_license
ChenTanyi/autorest.java
1dd9418566d6b932a407bf8db34b755fe536ed72
175f41c76955759ed42b1599241ecd876b87851f
refs/heads/ci
2021-12-25T20:39:30.473917
2021-11-07T17:23:04
2021-11-07T17:23:04
218,717,967
0
0
null
2020-11-18T14:14:34
2019-10-31T08:24:24
Java
UTF-8
Java
false
false
2,163
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.appservice.generated.models; import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.appservice.generated.fluent.models.CertificateInner; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Collection of certificates. */ @Fluent public final class CertificateCollection { @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateCollection.class); /* * Collection of resources. */ @JsonProperty(value = "value", required = true) private List<CertificateInner> value; /* * Link to next page of resources. */ @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** * Get the value property: Collection of resources. * * @return the value value. */ public List<CertificateInner> value() { return this.value; } /** * Set the value property: Collection of resources. * * @param value the value value to set. * @return the CertificateCollection object itself. */ public CertificateCollection withValue(List<CertificateInner> value) { this.value = value; return this; } /** * Get the nextLink property: Link to next page of resources. * * @return the nextLink value. */ public String nextLink() { return this.nextLink; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (value() == null) { throw logger .logExceptionAsError( new IllegalArgumentException("Missing required property value in model CertificateCollection")); } else { value().forEach(e -> e.validate()); } } }
[ "actions@github.com" ]
actions@github.com
fdc9eccadca3355c740aa1f2465a94cd20aa9ac6
458531bcfa9eba628f24b95187288964d367a175
/src/main/java/flarestar/mirror/mock/element/TypeParameterElement.java
d7e770a8ab1c920b7766c92ce708e3e7bd035b6b
[ "MIT" ]
permissive
diosmosis/java-mirror-mocks
8850f9c029a6c5ae5b938748cb8529b703743b11
c942e61a4d6a0a2b8c9fbcaa8c75fb568b62b532
refs/heads/master
2021-01-10T12:05:38.164045
2016-01-12T11:55:42
2016-01-12T11:55:42
49,325,170
0
0
null
null
null
null
UTF-8
Java
false
false
2,280
java
package flarestar.mirror.mock.element; import flarestar.mirror.mock.type.TypeMirrorFactory; import javax.lang.model.element.*; import javax.lang.model.type.TypeMirror; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; /** * TODO */ public class TypeParameterElement implements javax.lang.model.element.TypeParameterElement { private TypeVariable typeVariable; private Element genericElement; private List<TypeMirror> bounds = null; private Name simpleName; public TypeParameterElement(TypeVariable typeVariable, Element genericElement) { this.typeVariable = typeVariable; this.genericElement = genericElement; simpleName = new Name(typeVariable.getName()); } public Element getGenericElement() { return genericElement; } public List<? extends TypeMirror> getBounds() { if (bounds == null) { bounds = new ArrayList<TypeMirror>(); for (Type bound : typeVariable.getBounds()) { bounds.add(TypeMirrorFactory.make(bound, genericElement)); } } return bounds; } public TypeMirror asType() { return TypeMirrorFactory.make(this); } public ElementKind getKind() { return ElementKind.TYPE_PARAMETER; } public List<? extends AnnotationMirror> getAnnotationMirrors() { return new ArrayList<AnnotationMirror>(); } public <A extends Annotation> A getAnnotation(Class<A> aClass) { return null; } public Set<Modifier> getModifiers() { return new HashSet<Modifier>(); } public Name getSimpleName() { return simpleName; } public Element getEnclosingElement() { return getGenericElement(); // TODO: not sure if this is correct behavior } public List<? extends Element> getEnclosedElements() { return new ArrayList<Element>(); } public <R, P> R accept(ElementVisitor<R, P> elementVisitor, P p) { return elementVisitor.visitTypeParameter(this, p); } public TypeVariable getTypeVariable() { return typeVariable; } }
[ "benaka@piwik.pro" ]
benaka@piwik.pro
1914f56c7c03c03318e2d9659c35049078c351bc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/13/13_246955efe8bac499345205b010afeea6c9ebcc4c/ScopableSubscriberParticipant/13_246955efe8bac499345205b010afeea6c9ebcc4c_ScopableSubscriberParticipant_s.java
896cf6c8f1de3e1d20bd79ab6828dfd12848cc11
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,107
java
/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.team.internal.ui.synchronize; import org.eclipse.core.runtime.CoreException; import org.eclipse.team.core.subscribers.Subscriber; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor; import org.eclipse.team.ui.synchronize.ISynchronizeScope; import org.eclipse.team.ui.synchronize.SubscriberParticipant; /** * subscriber particpant that supports filtering using scopes. */ public abstract class ScopableSubscriberParticipant extends SubscriberParticipant { /** * No arg contructor used to create workspace scope and for * creation of persisted participant after startup */ public ScopableSubscriberParticipant() { } public ScopableSubscriberParticipant(ISynchronizeScope scope) { super(scope); } /* (non-Javadoc) * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.Subscriber) */ protected void setSubscriber(Subscriber subscriber) { super.setSubscriber(subscriber); try { ISynchronizeParticipantDescriptor descriptor = getDescriptor(); setInitializationData(descriptor); } catch (CoreException e) { TeamUIPlugin.log(e); } if (getSecondaryId() == null) { setSecondaryId(Long.toString(System.currentTimeMillis())); } } /** * Return the descriptor for this participant * @return the descriptor for this participant */ protected abstract ISynchronizeParticipantDescriptor getDescriptor(); }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
ce2be2d61c169ff211cb2ffba05e4c6e9d53d092
85320a1cd5e4c4f5cf38f5c9070b435b49f50f42
/src/main/java/com/webser/constants/HttpStatus.java
440742703ceb9ed48068260bbfc232ed61e189dc
[]
no_license
lj12306/VertxWebApi
edced81a248d0de21d0407423c12a02303d3ae34
eb50c625903a3d4757a8470b5715dd320928e12c
refs/heads/master
2023-06-26T06:34:17.707898
2021-07-21T08:42:42
2021-07-21T08:42:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
package com.webser.constants; public enum HttpStatus { OK(200, "success"), PLAYER_REGISTER(201,"head register"), REDIRECT_LOGIN(202,"remote device login"), ERROR(501, "error"), JSON_ERROR(502,"json error"), PARAMETER_ERROR(503,"parameter error"); private final int code; private final String message; HttpStatus(int code, String message) { this.code = code; this.message = message; } public int code() { return code; } public String message() { return message; } }
[ "898864814@qq.com" ]
898864814@qq.com
5b2a96a58d5a66330210032aafdf24bf0bc1d0ce
a8b21a1d132d1faf50586b60a5a72fb5fba37fa8
/src/java/com/jogamp/common/jvm/JVMUtil.java
fda7f744ec1b300ddfaaf814bf89c1a5946cc5d5
[ "BSD-3-Clause", "BSD-3-Clause-No-Nuclear-Warranty", "BSD-4-Clause", "BSD-2-Clause" ]
permissive
mbien/gluegen
b468279ebe02dd733e9dc5d1e4d7f54e47333139
7d5421c064df7d12ebcb3043ee09160755b2ef66
refs/heads/master
2020-11-30T13:02:59.924012
2011-08-17T23:30:34
2011-08-17T23:30:34
369,055
1
0
null
null
null
null
UTF-8
Java
false
false
2,911
java
/* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ package com.jogamp.common.jvm; import java.nio.ByteBuffer; import com.jogamp.common.nio.Buffers; import jogamp.common.Debug; import com.jogamp.gluegen.runtime.NativeLibLoader; /** * Currently this tool works around the Hotspot race condition bugs: <PRE> 4395095 JNI access to java.nio DirectBuffer constructor/accessor 6852404 Race condition in JNI Direct Buffer access and creation routines </PRE> * * Make sure to initialize this class as soon as possible, * before doing any multithreading work. * */ public class JVMUtil { private static final boolean DEBUG = Debug.debug("JVMUtil"); static { // JNILibLoaderBase.loadLibrary("jvm", null, false); NativeLibLoader.loadGlueGenRT(); ByteBuffer buffer = Buffers.newDirectByteBuffer(64); if( ! initialize(buffer) ) { throw new RuntimeException("Failed to initialize the JVMUtil "+Thread.currentThread().getName()); } if(DEBUG) { Exception e = new Exception("JVMUtil.initSingleton() .. initialized "+Thread.currentThread().getName()); e.printStackTrace(); } } public static void initSingleton() { } private JVMUtil() {} private static native boolean initialize(java.nio.ByteBuffer buffer); }
[ "sgothel@jausoft.com" ]
sgothel@jausoft.com
08b71ebd282e67749c3466d56229d698676e1c73
6a6d717ee1f99ab57e6149a5f00cf2f7218caa96
/app/src/main/java/com/example/google_analytics_assignment/Electronic_Product.java
0dd2409a2740006761d9813128168d5ed99c42ba
[]
no_license
hamada-al/mcc-g-analytics
165c1e7690e6f4fedfec42527e7a129ee43e5e0d
ced3c51f88413240a1ee8bdbb16432cca0ea940d
refs/heads/master
2023-04-04T06:53:29.168484
2021-04-03T16:29:38
2021-04-03T16:29:38
354,336,002
0
0
null
null
null
null
UTF-8
Java
false
false
1,511
java
package com.example.google_analytics_assignment; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Electronic_Product extends AppCompatActivity { Button bntLap; Button btnPhone; Button btnTV; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_electronic__product); bntLap = findViewById(R.id.bntLap); btnPhone = findViewById(R.id.btnPhone); btnTV = findViewById(R.id.btnTV); bntLap.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { //Create your Intent Here Intent i = new Intent(Electronic_Product.this,Det_LHP.class); startActivity(i); } }); btnPhone.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { //Create your Intent Here Intent i = new Intent(Electronic_Product.this,Det_I12PM.class); startActivity(i); } }); btnTV.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { //Create your Intent Here Intent i = new Intent(Electronic_Product.this,Det_STV.class); startActivity(i); } }); } }
[ "hamada126352@gmail.com" ]
hamada126352@gmail.com
9786f7a9ecd047a5152a45ef57135199e0a0eb3c
3c33df77baeced69a9348faede2e09562d28dbb1
/src/main/java/com/sean/学习/哈希表/model/SubKey2.java
90590c00c13cf40460452fbe4983597c991d86d6
[]
no_license
seanzed/algorithm-learning
90e800c51ac077fad98da5ebcd79f89b04a5b890
3b44d0f2edae7a36c400ddcc98209948b08222a5
refs/heads/master
2021-05-24T10:08:00.994819
2021-04-06T03:56:59
2021-04-06T03:56:59
253,510,595
1
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.sean.学习.哈希表.model; public class SubKey2 extends Key { public SubKey2(int value) { super(value); } @Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || (obj.getClass() != SubKey1.class && obj.getClass() != SubKey2.class)) return false; return ((Key) obj).value == value; } }
[ "chenxu071@ke.com" ]
chenxu071@ke.com
8abbaac44b8e0b6b822e3d5ebd5aa59f45705fbb
71bf9b577365637af0ea84d26763277ccc626cec
/app/src/test/java/com/softgyan/intentservice/ExampleUnitTest.java
77e2da1fcd3959e7c08f91b9cae116996f86d92c
[]
no_license
ritunjaykumar/IntentService
9343895d3e3abadcb3a1b5a8424ea8c05ed3c894
3b7fd75960abfe61e77bff9d8fb6e4106ebd48ac
refs/heads/master
2023-03-11T06:41:34.281210
2021-02-16T15:28:51
2021-02-16T15:28:51
339,442,559
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.softgyan.intentservice; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "ritunjaykumar7777@gmail.com" ]
ritunjaykumar7777@gmail.com
233b6439a32faced1021331dab25280566997e5e
5935f2400589aa4e295d3fb106eccd8d543b355d
/cjlite_web/src/cjlite/web/core/ResourceFolder.java
8106a8ee8f8dfc912231b79647c93d33779a9394
[ "Apache-2.0" ]
permissive
spesoul/cjlite
a16f0f93d4744d555f1cf16bea63d7ce367fc758
9069b6fb9d8ac973db76f1ecf9f4b3a5f12caf55
refs/heads/master
2021-06-20T20:08:44.676244
2017-08-15T07:23:26
2017-08-15T07:23:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
/** * */ package cjlite.web.core; import java.io.File; import cjlite.config.Config; import cjlite.log.Logger; import cjlite.utils.FilePath; import cjlite.web.StaticFolderName; /** * @author ming * */ final class ResourceFolder { private static final Logger logger = Logger.thisClass(); private final Config config; private final String folderRootPath; private final String subFolderPath; private final boolean webRootFolder; private final StaticFolderName subFolderName; public ResourceFolder(Config config, String folderRootPath, String subFolderPath, StaticFolderName sub, boolean webRootFolder) { this.config = config; this.folderRootPath = folderRootPath; this.subFolderPath = subFolderPath; this.webRootFolder = webRootFolder; this.subFolderName = sub; } public StaticResource lookup(String requestPath) { String filePath = FilePath.join(this.subFolderPath, requestPath); File file = new File(filePath); boolean result = file.exists() && !file.isDirectory(); // logger.debug("File:{0}; Exist:{1}", filePath, result); if (result) { String webFilePath = FilePath.join(subFolderName.getFolderName(), requestPath); return new StaticResource(this, filePath, webFilePath, webRootFolder, file); } return null; } public StaticResource lookup_v2(String requestPath) { String filePath = FilePath.join(this.folderRootPath, requestPath); File file = new File(filePath); boolean result = file.exists() && !file.isDirectory(); // logger.debug("File:{0}; Exist:{1}", filePath, result); if (result) { return new StaticResource(this, filePath, requestPath, webRootFolder, file); } return null; } }
[ "mwchen@cn.ibm.com" ]
mwchen@cn.ibm.com
8ba768d6207599b4c5ce4c854ae815f2c4a68173
d67f6450b24fb08f2f61b74dcdecce3025ee3efc
/gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set200/dark/Card200_109.java
2c7c943f09a716c2e99e345769a7c1e13239af40
[ "MIT" ]
permissive
cburyta/gemp-swccg-public
00a974d042195e69d3c104e61e9ee5bd48728f9a
05529086de91ecb03807fda820d98ec8a1465246
refs/heads/master
2023-01-09T12:45:33.347296
2020-10-26T14:39:28
2020-10-26T14:39:28
309,400,711
0
0
MIT
2020-11-07T04:57:04
2020-11-02T14:47:59
null
UTF-8
Java
false
false
4,824
java
package com.gempukku.swccgo.cards.set200.dark; import com.gempukku.swccgo.cards.AbstractNormalEffect; import com.gempukku.swccgo.cards.GameConditions; import com.gempukku.swccgo.cards.effects.DrawsNoMoreThanBattleDestinyEffect; import com.gempukku.swccgo.cards.effects.PeekAtTopCardsOfReserveDeckAndStackEffect; import com.gempukku.swccgo.cards.effects.usage.OncePerBattleEffect; import com.gempukku.swccgo.common.*; import com.gempukku.swccgo.game.PhysicalCard; import com.gempukku.swccgo.game.SwccgGame; import com.gempukku.swccgo.logic.TriggerConditions; import com.gempukku.swccgo.logic.actions.RequiredGameTextTriggerAction; import com.gempukku.swccgo.logic.actions.TopLevelGameTextAction; import com.gempukku.swccgo.logic.effects.AddUntilEndOfBattleModifierEffect; import com.gempukku.swccgo.logic.effects.ShuffleReserveDeckEffect; import com.gempukku.swccgo.logic.effects.choose.TakeStackedCardIntoHandEffect; import com.gempukku.swccgo.logic.modifiers.MayNotCancelBattleDestinyModifier; import com.gempukku.swccgo.logic.modifiers.MayNotModifyBattleDestinyModifier; import com.gempukku.swccgo.logic.timing.EffectResult; import java.util.Collections; import java.util.List; /** * Set: Set 0 * Type: Effect * Title: Imperial Justice (V) */ public class Card200_109 extends AbstractNormalEffect { public Card200_109() { super(Side.DARK, 3, PlayCardZoneOption.YOUR_SIDE_OF_TABLE, "Imperial Justice"); setVirtualSuffix(true); setLore("'There's nothing you could have done Luke, had you been there. You'd have been killed too.'"); setGameText("Deploy on table; shuffle your Reserve Deck, peek at top three cards, and stack them face-up here. During battle, may take a card here into hand to prevent all battle destiny draws from being modified or canceled (each player may draw no more than one battle destiny). [Immune to Alter]"); addIcons(Icon.A_NEW_HOPE, Icon.VIRTUAL_SET_0); addImmuneToCardTitle(Title.Alter); } @Override protected List<RequiredGameTextTriggerAction> getGameTextRequiredAfterTriggers(final SwccgGame game, EffectResult effectResult, final PhysicalCard self, int gameTextSourceCardId) { String playerId = self.getOwner(); GameTextActionId gameTextActionId = GameTextActionId.OTHER_CARD_ACTION_1; // Check condition(s) if (TriggerConditions.justDeployed(game, effectResult, self)) { RequiredGameTextTriggerAction action = new RequiredGameTextTriggerAction(self, gameTextSourceCardId, gameTextActionId); action.setPerformingPlayer(playerId); // Perform result(s) action.appendEffect( new ShuffleReserveDeckEffect(action, playerId)); action.appendEffect( new PeekAtTopCardsOfReserveDeckAndStackEffect(action, playerId, 3, self)); return Collections.singletonList(action); } return null; } @Override protected List<TopLevelGameTextAction> getGameTextTopLevelActions(final String playerId, SwccgGame game, final PhysicalCard self, int gameTextSourceCardId) { String opponent = game.getOpponent(playerId); GameTextActionId gameTextActionId = GameTextActionId.OTHER_CARD_ACTION_2; // Check condition(s) if (GameConditions.isOncePerBattle(game, self, playerId, gameTextSourceCardId, gameTextActionId) && GameConditions.hasStackedCards(game, self)) { final TopLevelGameTextAction action = new TopLevelGameTextAction(self, gameTextSourceCardId, gameTextActionId); action.setText("Take stacked card into hand"); action.setActionMsg("Prevent all battle destiny draws from being modified or canceled"); // Update usage limit(s) action.appendUsage( new OncePerBattleEffect(action)); // Pay cost(s) action.appendCost( new TakeStackedCardIntoHandEffect(action, playerId, self)); // Perform result(s) action.appendEffect( new AddUntilEndOfBattleModifierEffect(action, new MayNotModifyBattleDestinyModifier(self), "Prevents all battle destiny draws from being modified")); action.appendEffect( new AddUntilEndOfBattleModifierEffect(action, new MayNotCancelBattleDestinyModifier(self), "Prevents all battle destiny draws from being canceled")); action.appendEffect( new DrawsNoMoreThanBattleDestinyEffect(action, playerId, 1)); action.appendEffect( new DrawsNoMoreThanBattleDestinyEffect(action, opponent, 1)); return Collections.singletonList(action); } return null; } }
[ "andrew@bender.io" ]
andrew@bender.io
ad566781b50aa83c6ecc1e6297f5e9350dfb36fd
35fb2da4617b574264a39ae84b903f17826a9c1a
/EmbusteF/src/java/classes/Atendimento.java
d42ead845c22545435fa43872a1eadb48ac297a1
[]
no_license
joaocarlospercegona/trabalhoweb
2bd2df38a31f9c1063606febd62de3e5c19e777b
87e8777697cf9210c3dd884e97921798fb272faf
refs/heads/master
2020-09-10T17:24:01.872325
2019-11-14T20:07:43
2019-11-14T20:07:43
221,777,353
0
0
null
null
null
null
UTF-8
Java
false
false
4,241
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 classes; import java.time.LocalDate; import java.util.Date; /** * * @author joao */ public class Atendimento { private int atendimento_codigo; private Date atendimento_data_hora; private String atendimento_cpf_cliente; private String atendimento_situacao; private int atendimento_cod_produto; private int atendimento_cod_tipo_atendimento; private String atendimento_descricao; private String atendimento_solucao; private int atendimento_nivel; public Atendimento() { } public Atendimento(int atendimento_codigo, Date atendimento_data_hora, String atendimento_cpf_cliente, String atendimento_situacao, int atendimento_cod_produto, int atendimento_cod_tipo_atendimento, String atendimento_descricao, String atendimento_solucao, int atendimento_nivel) { this.atendimento_codigo = atendimento_codigo; this.atendimento_data_hora = atendimento_data_hora; this.atendimento_cpf_cliente = atendimento_cpf_cliente; this.atendimento_situacao = atendimento_situacao; this.atendimento_cod_produto = atendimento_cod_produto; this.atendimento_cod_tipo_atendimento = atendimento_cod_tipo_atendimento; this.atendimento_descricao = atendimento_descricao; this.atendimento_solucao = atendimento_solucao; this.atendimento_nivel = atendimento_nivel; } public int getAtendimento_nivel() { return atendimento_nivel; } public void setAtendimento_nivel(int atendimento_nivel) { this.atendimento_nivel = atendimento_nivel; } public int getAtendimento_codigo() { return atendimento_codigo; } public void setAtendimento_codigo(int atendimento_codigo) { this.atendimento_codigo = atendimento_codigo; } public Date getAtendimento_data_hora() { return atendimento_data_hora; } public void setAtendimento_data_hora(Date atendimento_data_hora) { this.atendimento_data_hora = atendimento_data_hora; } public String getAtendimento_cpf_cliente() { return atendimento_cpf_cliente; } public void setAtendimento_cpf_cliente(String atendimento_cpf_cliente) { this.atendimento_cpf_cliente = atendimento_cpf_cliente; } public String getAtendimento_situacao() { return atendimento_situacao; } public void setAtendimento_situacao(String atendimento_situacao) { this.atendimento_situacao = atendimento_situacao; } public int getAtendimento_cod_produto() { return atendimento_cod_produto; } public void setAtendimento_cod_produto(int atendimento_cod_produto) { this.atendimento_cod_produto = atendimento_cod_produto; } public int getAtendimento_cod_tipo_atendimento() { return atendimento_cod_tipo_atendimento; } public void setAtendimento_cod_tipo_atendimento(int atendimento_cod_tipo_atendimento) { this.atendimento_cod_tipo_atendimento = atendimento_cod_tipo_atendimento; } public String getAtendimento_descricao() { return atendimento_descricao; } public void setAtendimento_descricao(String atendimento_descricao) { this.atendimento_descricao = atendimento_descricao; } public String getAtendimento_solucao() { return atendimento_solucao; } public void setAtendimento_solucao(String atendimento_solucao) { this.atendimento_solucao = atendimento_solucao; } @Override public String toString() { return "Atendimento{" + "atendimento_codigo=" + atendimento_codigo + ", atendimento_data_hora=" + atendimento_data_hora + ", atendimento_cpf_cliente=" + atendimento_cpf_cliente + ", atendimento_situacao=" + atendimento_situacao + ", atendimento_cod_produto=" + atendimento_cod_produto + ", atendimento_cod_tipo_atendimento=" + atendimento_cod_tipo_atendimento + ", atendimento_descricao=" + atendimento_descricao + ", atendimento_solucao=" + atendimento_solucao + ", atendimento_nivel=" + atendimento_nivel + '}'; } }
[ "joaokarlospercegona@gmail.com" ]
joaokarlospercegona@gmail.com
4c6b09f053f4d71427bc2667e120ee5b32da45f7
590dde75a91d6489f86dd72bba65e678b1934d5f
/data/src/main/java/com/projects/android/data/repository/PostCache.java
34d20365d0fdefdf230f7a3948093283f2e749ad
[]
no_license
moustafatammam/PostAssessment
903582bacf79506e82d897f9a4f6919b00c78e1d
11e1d34c39bf1930737f29ff4bc42c0284532bbf
refs/heads/master
2022-10-22T13:55:17.321029
2020-06-13T18:34:44
2020-06-13T18:34:44
271,031,934
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.projects.android.data.repository; import com.projects.android.data.model.DataPost; import java.util.List; import io.reactivex.Completable; import io.reactivex.Observable; import io.reactivex.Single; /** * an interface that defines how other layers communicates with it * it is implemented by the cache layer */ public interface PostCache { Completable savePost(DataPost dataPost); Completable saveAllPosts(List<DataPost> dataPosts); Completable deletePost(DataPost dataPost); Completable updatePost(DataPost dataPost); Observable<List<DataPost>> getAllPosts(); Observable<DataPost> getPostById(int id); Single<Boolean> isAllCached(); Single<Boolean> isCached(int id); Observable<Integer> getCount(); }
[ "moust.tammam@gmail.com" ]
moust.tammam@gmail.com
c7d46f98e452cf47f9e31328238a256ec43d96c5
09dca990b8eb1bfb8df821f56e55043953cad016
/hb-04-one-to-many-uni/src/com/hibernate/demo/DeleteCourseAndReviewsDemo.java
2e6f9400b6f5f9a57fbd2435ce902c75caa4dfdf
[]
no_license
kjavvaji/Hibernate
b510eab5b39c91242f6c2ec40a1b517615fefe04
d29f02e888550d4341b7ed0eda5d026333bcd41a
refs/heads/master
2020-07-27T02:17:40.350505
2019-09-16T15:30:06
2019-09-16T15:30:06
208,834,115
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package com.hibernate.demo; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.hibernate.demo.entity.Course; import com.hibernate.demo.entity.Instructor; import com.hibernate.demo.entity.InstructorDetail; import com.hibernate.demo.entity.Review; import com.hibernate.demo.entity.Student; public class DeleteCourseAndReviewsDemo { public static void main(String[] args) { //Create Session factory SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Instructor.class) .addAnnotatedClass(InstructorDetail.class) .addAnnotatedClass(Course.class) .addAnnotatedClass(Review.class) .buildSessionFactory(); // Create Session Session session = factory.getCurrentSession(); try { //Start a transaction session.beginTransaction(); // get the course int theId = 10; Course tempCourse = session.get(Course.class,theId); // print the course System.out.println(tempCourse); // delete the course session.delete(tempCourse); // commit transaction session.getTransaction().commit(); System.out.println("Done !!"); } finally { //add clean up code session.close(); factory.close(); } } }
[ "kjavvaji@my.okcu.edu" ]
kjavvaji@my.okcu.edu
cf041243670a2e77d564537c5505559266499a2a
2a73ec76a88059a589897696445e9a363129e47f
/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java
c92cab6ed60ba76c3cf0610250bae21a1e0f2602
[ "Apache-2.0" ]
permissive
qiffang/meeting
5bd8d214ae28871b89b4a204e6374cca6e42d4a1
73280a11bb9ae0eaec0469e4f31fd4849e41bd8c
refs/heads/master
2021-01-12T07:15:50.453836
2016-12-20T09:51:52
2016-12-20T09:51:52
76,926,001
0
0
null
null
null
null
UTF-8
Java
false
false
5,750
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.openmeetings.core.session.store; import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.openmeetings.db.entity.room.Client; import org.apache.openmeetings.db.entity.server.Server; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; /** * Stores the session in the memory. * Is NOT designed to be clustered across multiple servers. * * <ul> * <li>client by streamid</li> * <li>client by publicSID</li> * <li>client by userId</li> * <li>clients by roomId</li> * <li>roomIds by server</li> * </ul> * * @author sebawagner * */ public class HashMapStore implements IClientPersistenceStore { protected static final Logger log = Red5LoggerFactory.getLogger(HashMapStore.class, webAppRootKey); private Map<String, Client> clientsByStreamId = new ConcurrentHashMap<>(); @Override public void clear() { clientsByStreamId = new ConcurrentHashMap<>(); } @Override public void put(String streamId, Client rcl) { clientsByStreamId.put(rcl.getStreamid(), rcl); } @Override public boolean containsKey(Server server, String streamId) { return clientsByStreamId.containsKey(streamId); } @Override public Client get(Server server, String streamId) { return clientsByStreamId.get(streamId); } @Override public List<Client> getClientsByPublicSID(Server server, String publicSID) { List<Client> clientList = new ArrayList<>(); for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { Client cl = e.getValue(); if (cl.getPublicSID().equals(publicSID)) { clientList.add(cl); } } return clientList; } @Override public Map<Long,List<Client>> getClientsByPublicSID(String publicSID) { Map<Long,List<Client>> clientMapList = new HashMap<>(); List<Client> clientList = new ArrayList<>(); for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { Client cl = e.getValue(); if (cl.getPublicSID().equals(publicSID)) { clientList.add(cl); } } clientMapList.put(null, clientList); return clientMapList; } @Override public Collection<Client> getClients() { return clientsByStreamId.values(); } @Override public Collection<Client> getClientsWithServer() { //there is no server object to be loaded, memory cache means //there is no cluster enabled return getClients(); } @Override public Collection<Client> getClientsByServer(Server server) { return clientsByStreamId.values(); } @Override public List<Client> getClientsByUserId(Server server, Long userId) { List<Client> clientList = new ArrayList<>(); for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { Client cl = e.getValue(); if (cl.getUserId().equals(userId)) { clientList.add(cl); } } return clientList; } @Override public List<Client> getClientsByRoomId(Long roomId) { List<Client> clientList = new ArrayList<>(); for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { Client cl = e.getValue(); if (cl.getRoomId() != null && cl.getRoomId().equals(roomId)) { clientList.add(cl); } } return clientList; } @Override public void remove(Server server, String streamId) { clientsByStreamId.remove(streamId); } @Override public int size() { return clientsByStreamId.size(); } @Override public int sizeByServer(Server server) { return clientsByStreamId.size(); } @Override public Collection<Client> values() { return clientsByStreamId.values(); } public int getTotalNumberOfSessions() { return clientsByStreamId.size(); } /** * Print some session statistics to the debug out * * @param detailLevel */ public void printDebugInformation(List<DEBUG_DETAILS> detailLevel) { log.debug("Session Statistics Start ################## "); log.debug(getDebugInformation(detailLevel)); log.debug("Session Statistics End ################## "); } @Override public String getDebugInformation(List<DEBUG_DETAILS> detailLevel) { StringBuilder statistics = new StringBuilder(); if (detailLevel.contains(DEBUG_DETAILS.SIZE)) { addNewLine(statistics, "Number of sessions Total " + getTotalNumberOfSessions()); } return statistics.toString(); } private static void addNewLine(StringBuilder strBuilder, String message) { strBuilder.append(message + "\n\r"); } @Override public List<Long> getRoomsIdsByServer(Server server) { Set<Long> rooms = new HashSet<>(); for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { Client cl = e.getValue(); Long roomId = cl.getRoomId(); if (roomId != null && roomId.longValue() > 0 && !rooms.contains(roomId)) { rooms.add(roomId); } } return new ArrayList<Long>(rooms); } }
[ "andy.qi@logicmonitor.com" ]
andy.qi@logicmonitor.com
198f9c85e6dddd0472ff2de3f29263dfe4e8ee36
c8303b4e301533ee1b2346beb69f7e48ca0feb6d
/src/main/java/com/aijuts/cxll/service/OrderService.java
a5b6539106923bdc3f122532a69cef2ef3421596
[]
no_license
aijuts/CX100WebService
505d5767dbfe36599d865753b58d1121c9cd8a3d
57e62f44fee882e6352b0eee359d4014a0cc62cd
refs/heads/master
2020-12-24T14:35:23.758944
2013-09-17T09:37:04
2013-09-17T09:37:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,568
java
package com.aijuts.cxll.service; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.sql.DataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.aijuts.cxll.entity.Order; import com.aijuts.cxll.util.Tool; @Service("orderService") @Transactional public class OrderService { // private static final Logger logger = LoggerFactory.getLogger(OrderService.class); private JdbcTemplate jdbcTemplate; private Tool tool; @Resource(name="dataSource") public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); tool = new Tool(); } public List<Order> getOrderAll(int userid) { String sql = "SELECT o.orderid, o.code, o.[state], o.addtime, o.schedule, o.sellerid, o.consumerid, m.name, m.fid, o.consuercount, o.total " + "FROM cxlm.dbo.t_order o WITH(NOLOCK) left join dbo.t_member m on o.consumerid = m.userid " + "WHERE 1=1 AND o.[type]=2 AND o.[state] NOT IN (1,2,5,7,9,10) AND o.sellerid = " + userid + " " + "ORDER BY o.orderid DESC"; return jdbcTemplate.query(sql, new BeanPropertyRowMapper<Order>(Order.class)); } public int insertOrder(String addtime, String rectime, String schedule, int sellerid, int userid, int number, int loge, int type, String content) { String sql = "insert into t_order " + "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) " + "select @@identity orderid"; Map<String, Object> map = new HashMap<String, Object>(); int count = 0; String code = tool.getRandomTime(); try { Object[] orderInfo = {code, 3, 1, addtime, rectime, schedule, sellerid, userid, number, loge, 0, 0, 0, "", type, 0, 0, content, "", 0}; // Object[] orderInfo = {code, 3, 1, "2013-09-03 14:27:21", "2013-09-03 15:00:00", "2013-09-03 15:00:00", 7, 394, 8, 0, 0, 0, 0, "", 2, 0, 0, "", "", 0}; count = jdbcTemplate.update(sql, orderInfo); if (count > 0) { map = getOrderDetail(code); count = (Integer) map.get("orderid"); } } catch (Exception e) { // TODO: handle exception // logger.error("方法insertOrder异常:" + e); } return count; } public Map<String, Object> getOrderDetail(String code) { String sql = "select * from dbo.t_order where code = '" + code + "'"; Map<String, Object> map = new HashMap<String, Object>(); try { map = jdbcTemplate.queryForMap(sql); } catch (Exception e) { // TODO: handle exception // logger.error("方法getOrderDetail异常:" + e); } return map; } public int updateOrder(int orderid, String code) { String sql = "update t_order set code = '" + code + "' where orderid = " + orderid; int count = 0; try { count = jdbcTemplate.update(sql); } catch (Exception e) { // TODO: handle exception // logger.error("方法updateOrder异常:" + e); } return count; } public int deleteOrder(int orderid) { String sql = "delete from dbo.t_order where orderid = " + orderid; int count = 0; try { count = jdbcTemplate.update(sql); } catch (Exception e) { // TODO: handle exception // logger.error("方法deleteOrder异常:" + e); } return count; } }
[ "sz@cx100.cn" ]
sz@cx100.cn
e18239b441114e974991edffc31c02c856a684b3
0625ee385381fdd5869c7e634416725cfb1dda24
/moco-core/src/main/java/com/github/dreamhead/moco/action/MocoAsyncAction.java
b0b4fcf332d5afd6c801f702dd6f47327b0b2867
[ "MIT" ]
permissive
witchlock/moco
b9ee94ed854141983472f82914b9b02960377c5a
b52daf8e8bafd0912391971bbead3ff4dc63c7e8
refs/heads/master
2020-12-31T06:57:52.617007
2013-11-21T22:24:39
2013-11-21T22:24:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
860
java
package com.github.dreamhead.moco.action; import com.github.dreamhead.moco.MocoEventAction; import com.github.dreamhead.moco.procedure.LatencyProcedure; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class MocoAsyncAction implements MocoEventAction { private final MocoEventAction action; private final LatencyProcedure procedure; private final ExecutorService service = Executors.newCachedThreadPool(); public MocoAsyncAction(MocoEventAction action, LatencyProcedure procedure) { this.action = action; this.procedure = procedure; } @Override public void execute() { service.execute(new Runnable() { @Override public void run() { procedure.execute(); action.execute(); } }); } }
[ "dreamhead.cn@gmail.com" ]
dreamhead.cn@gmail.com
2553a5cd087b9d7a2fcc02346d77404cec96ae6d
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/28/28_e6d4708640f684f802889d641c0ee8953b9a5989/ShellAnsweredQuestion/28_e6d4708640f684f802889d641c0ee8953b9a5989_ShellAnsweredQuestion_s.java
98946c5379f2f6c2c03faeede5effa13774b4257
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
894
java
package org.akquinet.audit; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class ShellAnsweredQuestion { private ProcessBuilder _command; private OutputStream _out; private InputStream _in; public ShellAnsweredQuestion(String command) { _command = new ProcessBuilder(command); } public boolean answer() { int retVal = 1; try { Process p = _command.start(); _out = p.getOutputStream(); _in = p.getInputStream(); p.waitFor(); retVal = p.exitValue(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return retVal == 0; } public OutputStream getOutputStream() { return _out; } public InputStream getInputStream() { return _in; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
40a9e9089afb9e3cf7e458c477e96af8803bcd1f
125198af567e3c18f25492ad141138d7580a2a4e
/fe/src/main/java/org/apache/impala/catalog/iceberg/IcebergHiveCatalog.java
e90e3be888cfce9275ba88b6fc3e5fb505dd9d43
[ "BSD-3-Clause", "PSF-2.0", "LicenseRef-scancode-openssl", "LicenseRef-scancode-mit-modification-obligations", "LicenseRef-scancode-ssleay-windows", "bzip2-1.0.6", "OpenSSL", "LicenseRef-scancode-google-patent-license-webrtc", "dtoa", "MIT", "LicenseRef-scancode-unknown-license-reference", "Minpack", "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown" ]
permissive
ColdZoo/impala
28fcfed00f7d7a2c85b6967c0e78826368a5a54e
300398e90ace6aa2ca64adff529a859d67ee8588
refs/heads/master
2023-03-28T03:30:31.710195
2021-03-22T00:16:32
2021-03-30T02:12:34
255,270,874
0
0
Apache-2.0
2021-03-30T02:12:36
2020-04-13T08:26:08
null
UTF-8
Java
false
false
3,633
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.impala.catalog.iceberg; import java.util.Map; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.iceberg.PartitionSpec; import org.apache.iceberg.Schema; import org.apache.iceberg.Table; import org.apache.iceberg.catalog.TableIdentifier; import org.apache.iceberg.exceptions.NoSuchTableException; import org.apache.iceberg.hadoop.ConfigProperties; import org.apache.iceberg.hive.HiveCatalog; import org.apache.impala.catalog.FeIcebergTable; import org.apache.impala.catalog.TableLoadingException; import org.apache.impala.common.FileSystemUtil; import org.apache.impala.thrift.TIcebergCatalog; import org.apache.impala.util.IcebergUtil; import com.google.common.base.Preconditions; /** * Implementation of IcebergCatalog for tables stored in HiveCatalog. */ public class IcebergHiveCatalog implements IcebergCatalog { private static IcebergHiveCatalog instance_; public synchronized static IcebergHiveCatalog getInstance() { if (instance_ == null) { instance_ = new IcebergHiveCatalog(); } return instance_; } private HiveCatalog hiveCatalog_; private IcebergHiveCatalog() { HiveConf conf = new HiveConf(IcebergHiveCatalog.class); conf.setBoolean(ConfigProperties.ENGINE_HIVE_ENABLED, true); hiveCatalog_ = new HiveCatalog(conf); } @Override public Table createTable( TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties) { return hiveCatalog_.createTable(identifier, schema, spec, location, properties); } @Override public Table loadTable(FeIcebergTable feTable) throws TableLoadingException { Preconditions.checkState( feTable.getIcebergCatalog() == TIcebergCatalog.HIVE_CATALOG); TableIdentifier tableId = IcebergUtil.getIcebergTableIdentifier(feTable); return loadTable(tableId, null); } @Override public Table loadTable(TableIdentifier tableId, String tableLocation) throws TableLoadingException { Preconditions.checkState(tableId != null); try { return hiveCatalog_.loadTable(tableId); } catch (Exception e) { throw new TableLoadingException(String.format( "Failed to load Iceberg table with id: %s", tableId), e); } } @Override public boolean dropTable(FeIcebergTable feTable, boolean purge) { Preconditions.checkState( feTable.getIcebergCatalog() == TIcebergCatalog.HIVE_CATALOG); TableIdentifier tableId = IcebergUtil.getIcebergTableIdentifier(feTable); return hiveCatalog_.dropTable(tableId, purge); } @Override public void renameTable(FeIcebergTable feTable, TableIdentifier newTableId) { TableIdentifier oldTableId = IcebergUtil.getIcebergTableIdentifier(feTable); hiveCatalog_.renameTable(oldTableId, newTableId); } }
[ "ColdZoo@users.noreply.github.com" ]
ColdZoo@users.noreply.github.com
97c12047e97bbf98a13fd81b6ebbeef4bb9584d3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_250412c76f4443c9f4a5643b3761ae046934f51e/ServerInfoDialog/2_250412c76f4443c9f4a5643b3761ae046934f51e_ServerInfoDialog_t.java
0a3a57f940b86aebc5733beedaa6412a040fe1ec
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,121
java
/* * Copyright (c) 2006-2014 DMDirc Developers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.dmdirc.addons.lagdisplay; import com.dmdirc.Server; import com.dmdirc.ServerManager; import com.dmdirc.ServerState; import com.dmdirc.addons.ui_swing.MainFrame; import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPanel; import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupWindow; import com.dmdirc.util.annotations.factory.Factory; import com.dmdirc.util.annotations.factory.Unbound; import java.util.List; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; /** * Shows information about all connected servers. */ @Factory(inject = true, singleton = true) public class ServerInfoDialog extends StatusbarPopupWindow { /** * A version number for this class. It should be changed whenever the class structure is changed * (or anything else that would prevent serialized objects being unserialized with the new * class). */ private static final long serialVersionUID = 3; /** The lag display manager. */ protected final LagDisplayManager manager; /** Swing main frame. */ private final MainFrame mainFrame; /** Server manager to retrieve servers from. */ private final ServerManager serverManager; /** * Creates a new ServerInfoDialog. * * @param manager The {@link LagDisplayManager} we're using for info * @param parent The {@link JPanel} to use for positioning * @param mainFrame The frame that will own this dialog. * @param serverManager The manager to use to iterate servers. */ public ServerInfoDialog( final LagDisplayManager manager, @Unbound final StatusbarPanel<JLabel> parent, final MainFrame mainFrame, final ServerManager serverManager) { super(parent, mainFrame); this.manager = manager; this.mainFrame = mainFrame; this.serverManager = serverManager; } /** {@inheritDoc} */ @Override protected void initContent(final JPanel panel) { final List<Server> servers = serverManager.getServers(); if (servers.isEmpty()) { panel.add(new JLabel("No open servers.")); } else { if (manager.shouldShowGraph()) { panel.add(new PingHistoryPanel(manager, mainFrame), "span, grow, wrap"); panel.add(new JSeparator(), "span, grow, wrap"); } for (final Server server : servers) { panel.add(new JLabel(server.getName())); panel.add(new JLabel(server.getState() == ServerState.CONNECTED ? server.getNetwork() : "---", JLabel.CENTER), "grow"); panel.add(new JLabel(server.getState() == ServerState.CONNECTED ? manager.getTime(server) : "---", JLabel.RIGHT), "grow, wrap"); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d8917d3c16a056f6d6143fc30c72f675daca6040
75c811e02644a4a0ba08748e652cbed0c3a670e6
/Practicas/src/tutorialYT/FormMenu.java
c390e9df4e8ad4425833f6d915b5a666d8f0759a
[]
no_license
AdolfoHm/practicasJava
4dfd196c188d4e86c005dec41622994fdc21bb17
252182dc3ef61b4bbe4011615f57dfb679ade1f8
refs/heads/master
2020-12-27T21:47:19.273298
2020-04-06T01:57:46
2020-04-06T01:57:46
238,069,028
0
0
null
null
null
null
UTF-8
Java
false
false
1,569
java
package tutorialYT; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class FormMenu extends JFrame implements ActionListener { private JMenuBar menubar; private JMenu menu1, menu2; private JMenuItem menuitem1, menuitem2, menuitem3, menuitem4; public FormMenu() { setLayout(null); setTitle("FormMenu"); menubar = new JMenuBar(); setJMenuBar(menubar); menu1 = new JMenu("Opciones"); menubar.add(menu1); menu2 = new JMenu("Prueba"); menubar.add(menu2); menuitem1 = new JMenuItem("Rojo"); menuitem1.addActionListener(this); menu1.add(menuitem1); menuitem2 = new JMenuItem("Verde"); menuitem2.addActionListener(this); menu1.add(menuitem2); menuitem3 = new JMenuItem("Azul"); menuitem3.addActionListener(this); menu1.add(menuitem3); menuitem4 = new JMenuItem("Limpiar"); menuitem4.addActionListener(this); menu1.add(menuitem4); } public void actionPerformed(ActionEvent e) { Container fondo = this.getContentPane(); if(e.getSource() == menuitem1) { fondo.setBackground(new Color(255,0,0)); } if(e.getSource() == menuitem2) { fondo.setBackground(new Color(0,255,0)); } if(e.getSource() == menuitem3) { fondo.setBackground(new Color(0,0,255)); } if(e.getSource() == menuitem4) { fondo.setBackground(new Color(255,255,255)); } } public static void main(String args[]) { FormMenu formulario1 = new FormMenu(); formulario1.setBounds(0, 0, 400, 300); formulario1.setVisible(true); formulario1.setLocationRelativeTo(null); } }
[ "ahideroa@gmail.com" ]
ahideroa@gmail.com
7e611c04ebf3e0d9b2c3882b03169d8c660ab442
c9628f670ff8ec298c2e3cb6c7223ecc4644cfa6
/app/src/main/java/com/orem/bashhub/adapter/EventUsersAdapter.java
48c1e0b52264868784d8903317079faf987b92b3
[]
no_license
GurpreetSinghMetho/bash
06d50a6e4377c68afb6863abea42ae2eddffc203
2534014d4b0764cb68de964122bd88f9edcfe796
refs/heads/master
2023-06-22T23:04:35.586027
2021-07-21T09:30:43
2021-07-21T09:30:43
388,044,532
0
0
null
null
null
null
UTF-8
Java
false
false
4,314
java
package com.orem.bashhub.adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.orem.bashhub.R; import com.orem.bashhub.data.BashDetailsPOJO; import com.orem.bashhub.data.UsersListPOJO; import com.orem.bashhub.databinding.ItemEventUsersBinding; import com.orem.bashhub.fragment.FollowersFragment; import com.orem.bashhub.interfaces.OnBgApi; import com.orem.bashhub.utils.Const; import com.orem.bashhub.utils.Utils; import java.util.List; public class EventUsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { BashDetailsPOJO bashData; private Context mContext; private List<UsersListPOJO.Data> list; private boolean isPaid; private OnBgApi listener; private String loggedInUser; public EventUsersAdapter(Context mContext, List<UsersListPOJO.Data> list, boolean isPaid, OnBgApi listener, BashDetailsPOJO bashData) { this.mContext = mContext; this.list = list; this.isPaid = isPaid; this.listener = listener; this.bashData = bashData; loggedInUser = Const.getLoggedInUserID(mContext); } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new Holder(ItemEventUsersBinding.inflate(LayoutInflater.from(mContext), parent, false)); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { Holder h = (Holder) holder; h.bind(); } @Override public int getItemCount() { return list.size(); } private void messageClick(String numbers) { try { Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setType("vnd.android-dir/mms-sms"); sendIntent.putExtra("sms_body", ""); sendIntent.putExtra("address", numbers); mContext.startActivity(sendIntent); } catch (Exception e) { Utils.showMessageDialog(mContext, "", mContext.getString(R.string.failed_to_find_msg_app)); } } class Holder extends RecyclerView.ViewHolder { ItemEventUsersBinding binding; Holder(ItemEventUsersBinding binding) { super(binding.getRoot()); this.binding = binding; } public void bind() { UsersListPOJO.Data item = list.get(getAdapterPosition()); binding.setData(item); boolean paid = false; if (isPaid == true) { if (bashData.isIamHost(item.id)) { paid = false; } else { paid = true; } } binding.setIsPaid(paid); binding.executePendingBindings(); binding.tvStatus1.setText(item.following_me.equals(Const.ONE) ? mContext.getString(R.string.prompt_follows_you) : ""); binding.tvStatus.setVisibility(item.id.equals(loggedInUser) ? View.GONE : View.VISIBLE); binding.tvStatus1.setVisibility(item.id.equals(loggedInUser) || !item.following_me.equals(Const.ONE) ? View.GONE : View.VISIBLE); if (!item.id.equals(loggedInUser)) { if (bashData.isIamHost(Const.getLoggedInUserID(mContext))) { binding.ivSend.setVisibility(View.VISIBLE); } else { if (item.getFollow().equalsIgnoreCase("1") && item.following_me.equalsIgnoreCase("1")) { binding.ivSend.setVisibility(View.VISIBLE); } else binding.ivSend.setVisibility(View.INVISIBLE); } } binding.ivSend.setOnClickListener(v -> { messageClick(item.country_code + item.phone_number); }); binding.outer.setOnClickListener(view -> { FollowersFragment fragment = new FollowersFragment(); fragment.setData(item.id); fragment.setListener(listener); Utils.goToFragment(mContext, fragment, R.id.fragment_container); }); } } }
[ "guri.preet@gmail.com" ]
guri.preet@gmail.com
76253cf94af6c8ce7bc1d7533d6153c13471b798
140e77bded32a3dc1c6efd178d3a8ff10306ac62
/SEAD-VA-extensions/services/sead-registry/sead-registry-jdbc-support/src/main/java/org/seadva/registry/database/model/dao/vaRegistry/AgentProfileDao.java
fa9730e4802c9462fd225e3056967dfffc5aca74
[]
no_license
Data-to-Insight-Center/IU-DPN
34a5f7421065cbc7b91acc9ca037538eb67867ec
b520eecdd1e180613ac857dcd68868a9e61bcf02
refs/heads/master
2021-01-01T15:36:00.380469
2020-02-01T16:13:13
2020-02-01T16:13:13
26,720,346
0
0
null
2020-02-01T16:13:10
2014-11-16T16:40:03
Java
UTF-8
Java
false
false
301
java
package org.seadva.registry.database.model.dao.vaRegistry; import org.seadva.registry.database.model.obj.vaRegistry.AgentProfile; /** * DAO interface for table: AgentProfile. * @author autogenerated */ public interface AgentProfileDao { boolean putAgentProfile(AgentProfile agentProfile); }
[ "varadharaju.aravindh@gmail.com" ]
varadharaju.aravindh@gmail.com
6d68307a6efdc20e89164b441d692ad6f9befad3
3cd4ff1fbf5e8f8e601f4c216597416ba9afe3a2
/Board.java
51987d7dd853cca30a9176ca1b642b96b93edf63
[]
no_license
Romulus-II/Chinese-Checkers
d309ebcd49b804b051e71d20702f95560c9aac17
6698303cb1e20028e6ff3bf2e81e67f50622ee25
refs/heads/master
2020-12-07T04:18:22.129513
2020-02-25T18:25:20
2020-02-25T18:25:20
232,629,614
1
0
null
null
null
null
UTF-8
Java
false
false
12,163
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 chinesecheckers; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.ArcType; /** * * @author gfragoso */ public class Board { private Pane pane; private Canvas canvas; private GraphicsContext ctx; private Space[][] content; private final int PIECE_WIDTH = 5; private final Team[] TEAM; private int teams_generated = 0; public Board(Canvas canvas, Pane pane, int num_players){ this.pane = pane; this.canvas = canvas; ctx = canvas.getGraphicsContext2D(); content = createBoard(); drawBoard(content); TEAM = new Team[num_players]; switch(num_players){ case 1: createTeam1(content); break; case 2: createTeam2(content); createTeam5(content); break; case 3: createTeam1(content); createTeam3(content); createTeam5(content); break; case 4: createTeam2(content); createTeam3(content); createTeam5(content); createTeam6(content); break; case 5: createTeam1(content); createTeam2(content); createTeam3(content); createTeam5(content); createTeam6(content); break; case 6: createTeam1(content); createTeam2(content); createTeam3(content); createTeam4(content); createTeam5(content); createTeam6(content); break; } } public Space[][] createBoard(){ //Instantiate the content as an empty grid Space[][] b = new Space[17][25]; //fill all of the spaces with "dummy" spaces int y = 8; for(int i = 0; i < b.length; i++){ int x = -12; for(int j = 0; j < b[0].length; j++){ b[i][j] = new Space(x, y); x++; } y--; } //Set piecesspaces onto content b[0][12].placeOnBoard(); for(int i = 11; i <= 13; i+=2){b[1][i].placeOnBoard();} for(int i = 10; i <= 14; i+=2){b[2][i].placeOnBoard();} for(int i = 9; i <= 15; i+=2){b[3][i].placeOnBoard();} for(int i = 0; i <= 24; i+=2){b[4][i].placeOnBoard();} for(int i = 1; i <= 23; i+=2){b[5][i].placeOnBoard();} for(int i = 2; i <= 22; i+=2){b[6][i].placeOnBoard();} for(int i = 3; i <= 21; i+=2){b[7][i].placeOnBoard();} for(int i = 4; i <= 20; i+=2){b[8][i].placeOnBoard();} for(int i = 3; i <= 21; i+=2){b[9][i].placeOnBoard();} for(int i = 2; i <= 22; i+=2){b[10][i].placeOnBoard();} for(int i = 1; i <= 23; i+=2){b[11][i].placeOnBoard();} for(int i = 0; i <= 24; i+=2){b[12][i].placeOnBoard();} for(int i = 9; i <= 15; i+=2){b[13][i].placeOnBoard();} for(int i = 10; i <= 14; i+=2){b[14][i].placeOnBoard();} for(int i = 11; i <= 13; i+=2){b[15][i].placeOnBoard();} b[16][12].placeOnBoard(); return b; } private void drawBoard(Space[][] b){ double width = 10, x = 40, y = 40; final double BASE_X = 40, BASE_Y = 40; double xPadding = 25, yPadding = 40; int index = 0; for(int i = 0; i < b[0].length; i++){ ctx.beginPath(); ctx.setFill(Color.BLACK); ctx.fillText("" + index, x, 15); ctx.closePath(); index++; x+=xPadding; } String[] left_axis = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r"}; for(int i = 0; i < b.length; i++){ ctx.beginPath(); ctx.setFill(Color.BLACK); ctx.fillText(left_axis[i], 15, y); ctx.closePath(); y+=yPadding; } y = BASE_Y; for(int i = 0; i < b.length; i++){ x = BASE_X; for(int j = 0; j < b[0].length; j++){ if(b[i][j].isOnBoard()) { ctx.beginPath(); ctx.setLineWidth(2); ctx.setStroke(Color.BLACK); ctx.setFill(Color.DARKGRAY); ctx.fillArc(x, y, width, width, 0, 360, ArcType.CHORD); ctx.closePath(); b[i][j].setCoordinates(x, y); } x+=xPadding; } y+=yPadding; } } private void createTeam1(Space[][] b){ Color c = Color.RED; Space[] goal = {b[16][12], b[15][11], b[15][13], b[14][10], b[14][12], b[14][14], b[13][9], b[13][11], b[13][13], b[13][15]}; Piece[] team = new Piece[10]; int team_count = 0; for(int i = 0; i < 4; i++){ for(int j = 0; j < 25; j++){ if(b[i][j].isOnBoard()){ team[team_count] = new Piece(j, i, goal, "red", c, pane); team[team_count].setOnSpace(b[i][j]); team_count++; } } } TEAM[teams_generated] = new Team("Red", team, goal); teams_generated++; System.out.println("Created team 1"); } private void createTeam2(Space[][] b){ Color c = Color.PURPLE; Space[] goal = {b[12][0], b[12][2], b[12][4], b[12][6], b[11][1], b[11][3], b[11][5], b[10][2], b[10][4], b[9][3]}; Piece[] team = new Piece[10]; int team_count = 0; for(int i = 18; i <= 24; i+=2){ if(b[4][i].isOnBoard()){ team[team_count] = new Piece(i, 4, goal, "purple", c, pane); team[team_count].setOnSpace(b[4][i]); team_count++; } } for(int i = 19; i <= 23; i+=2){ if(b[5][i].isOnBoard()){ team[team_count] = new Piece(i, 5, goal, "purple", c, pane); team[team_count].setOnSpace(b[5][i]); team_count++; } } team[team_count] = new Piece(20, 6, goal, "purple", c, pane); team[team_count].setOnSpace(b[6][20]); team_count++; team[team_count] = new Piece(22, 6, goal, "purple", c, pane); team[team_count].setOnSpace(b[6][22]); team_count++; team[team_count] = new Piece(21, 7, goal, "purple", c, pane); team[team_count].setOnSpace(b[7][21]); TEAM[teams_generated] = new Team("Purple", team, goal); teams_generated++; System.out.println("Created team 2"); } private void createTeam3(Space[][] b){ Color c = Color.GREEN; Space[] goal = {b[4][0], b[4][2], b[4][4], b[4][6], b[5][1], b[5][3], b[5][5], b[6][2], b[6][4], b[7][3]}; Piece[] team = new Piece[10]; int team_count = 0; team[team_count] = new Piece(21, 9, goal, "green", c, pane); team[team_count].setOnSpace(b[9][21]); team_count++; team[team_count] = new Piece(20, 10, goal, "green", c, pane); team[team_count].setOnSpace(b[10][20]); team_count++; team[team_count] = new Piece(22, 10, goal, "green", c, pane); team[team_count].setOnSpace(b[10][22]); team_count++; for(int i = 19; i <= 23; i+=2){ if(b[11][i].isOnBoard()){ team[team_count] = new Piece(i, 11, goal, "green", c, pane); team[team_count].setOnSpace(b[11][i]); team_count++; } } for(int i = 18; i <= 24; i+=2){ if(b[12][i].isOnBoard()){ team[team_count] = new Piece(i, 12, goal, "green", c, pane); team[team_count].setOnSpace(b[12][i]); team_count++; } } TEAM[teams_generated] = new Team("Green", team, goal); teams_generated++; System.out.println("Created team 3"); } private void createTeam4(Space[][] b){ Color c = Color.DARKORANGE; Space[] goal = {b[0][12], b[1][11], b[1][13], b[2][10], b[2][12], b[2][14], b[3][9], b[3][11], b[3][13], b[3][15]}; Piece[] team = new Piece[10]; int team_count = 0; for(int i = b.length-4; i < b.length; i++){ for(int j = 0; j < 25; j++){ if(b[i][j].isOnBoard()){ team[team_count] = new Piece(j, i, goal, "orange", c, pane); team[team_count].setOnSpace(b[i][j]); team_count++; } } } TEAM[teams_generated] = new Team("Orange", team, goal); teams_generated++; System.out.println("Created team 4"); } private void createTeam5(Space[][] b){ Color c = Color.BLUE; Space[] goal = {b[12][24], b[12][22], b[12][20], b[12][18], b[11][23], b[11][21], b[11][19], b[10][22], b[10][20], b[9][21]}; Piece[] team = new Piece[10]; int team_count = 0; team[team_count] = new Piece(9, 3, goal, "blue", c, pane); team[team_count].setOnSpace(b[9][3]); team_count++; team[team_count] = new Piece(10, 2, goal, "blue", c, pane); team[team_count].setOnSpace(b[10][2]); team_count++; team[team_count] = new Piece(10, 4, goal, "blue", c, pane); team[team_count].setOnSpace(b[10][4]); team_count++; for(int i = 1; i <= 5; i+=2){ if(b[11][i].isOnBoard()){ team[team_count] = new Piece(i, 11, goal, "blue", c, pane); team[team_count].setOnSpace(b[11][i]); team_count++; } } for(int i = 0; i <= 6; i+=2){ if(b[12][i].isOnBoard()){ team[team_count] = new Piece(i, 12, goal, "blue", c, pane); team[team_count].setOnSpace(b[12][i]); team_count++; } } TEAM[teams_generated] = new Team("Blue", team, goal); teams_generated++; System.out.println("Created team 5"); } private void createTeam6(Space[][] b){ Color c = Color.YELLOW; Space[] goal = {b[12][18], b[12][20], b[12][22], b[12][24], b[11][19], b[11][21], b[11][23], b[10][20], b[10][22], b[9][21]}; Piece[] team = new Piece[10]; int team_count = 0; for(int i = 0; i <= 6; i+=2){ if(b[4][i].isOnBoard()){ team[team_count] = new Piece(i, 4, goal, "yellow", c, pane); team[team_count].setOnSpace(b[4][i]); team_count++; } } for(int i = 1; i <= 5; i+=2){ if(b[5][i].isOnBoard()){ team[team_count] = new Piece(i, 5, goal, "yellow", c, pane); team[team_count].setOnSpace(b[5][i]); team_count++; } } team[team_count] = new Piece(2, 6, goal, "yellow", c, pane); team[team_count].setOnSpace(b[6][2]); team_count++; team[team_count] = new Piece(4, 6, goal, "yellow", c, pane); team[team_count].setOnSpace(b[6][4]); team_count++; team[team_count] = new Piece(3, 7, goal, "yellow", c, pane); team[team_count].setOnSpace(b[7][3]); TEAM[teams_generated] = new Team("Yellow", team, goal); teams_generated++; System.out.println("Created team 6"); } }
[ "noreply@github.com" ]
Romulus-II.noreply@github.com
6a71c5ea88341a15a40dc8cc6719f0a9860b9a2f
3aabcb0cce79766f075e629cebe39444062e1f6b
/AoC_2/src/Main.java
c2dcc10ac036e2d9f943bd2667b52510e5acfed7
[]
no_license
MikkoAro/AoC-2020
b1b270f0e3f60adfb407a252dc78c04ccb449804
c8d2eb9164ce40127b37777f429149b2fa756f59
refs/heads/master
2023-01-29T14:19:21.450483
2020-12-10T18:31:33
2020-12-10T18:31:33
318,281,146
0
0
null
null
null
null
UTF-8
Java
false
false
1,311
java
import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static int validPasswordCount; public static void main(String[] args) { ArrayList<String> input = new ArrayList<String>(); try { FileInputStream fis=new FileInputStream("resources/input.txt"); Scanner sc=new Scanner(fis); while(sc.hasNextLine()) { input.add((sc.nextLine())); } sc.close(); } catch(IOException e) { e.printStackTrace(); } for (String row : input) { String pattern = "(\\d+)-(\\d+) (.*): (.*)"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(row); if (m.find( )) { int lowValue = Integer.parseInt(m.group(1)); int highValue = Integer.parseInt(m.group(2)); String searchChar = m.group(3); String password = m.group(4); int count = password.length() - password.replaceAll(searchChar,"").length(); if (lowValue <= count && count <= highValue) { validPasswordCount++; } } else { System.out.println("NO MATCH"); } } System.out.println(validPasswordCount); } }
[ "M9492@student.jamk.fi" ]
M9492@student.jamk.fi
7a3be03ca0adcc0f008e473bc7060bd4912994c4
84ef3970e5e80832f659528e149e2e183c36d66a
/Chapter20/src/Exercise3.java
83ee28402351ef4479e78d9f392f1feb9f08da7a
[]
no_license
mullinska/Java
44d9f9124683b76248f204750ab73d5e2db9cf22
47cdf7670841acfe98ed9cbbae6fd99f3de6639e
refs/heads/master
2021-01-11T23:20:46.928143
2017-01-25T01:34:49
2017-01-25T01:34:49
78,568,818
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
import java.util.Scanner; public class Exercise3 { public static void main(String[] args) { // TODO Auto-generated method stub int games = 10; int wins = 0; int losses = 0; while (games > 0) { int number = (int) (Math.random() * 10); Scanner scan = new Scanner( System.in ); int counter = 3; while (counter > 0) { int guess = scan.nextInt(); if (guess > number + 1 || guess < number - 1) { System.out.println("Cold"); } else { System.out.println("Hot"); } if (guess == number) { counter = 0; wins++; } else if (counter < 2) { losses++; } counter--; } games--; } System.out.println(wins + " wins, " + losses + " losses"); } }
[ "mullinska@dcsdk12.org" ]
mullinska@dcsdk12.org
21fc2c75678994fcb6c6650d8afe68d7446878b5
7a50a90569f7b4030c9b2a0e5b58502142c17b96
/app/src/main/java/Adapter/Home_Icon_Adapter.java
ccfd75c14b1050ea7748a94bb19405ec5bbd342a
[]
no_license
dharinisp4/Vijay_laxmi-master
053ea93fd1cfadf051b5d46e9d4a62091cce5029
93607faffa4e480616886dc96939063f4ccca355
refs/heads/master
2020-07-27T22:29:18.052606
2019-10-19T05:53:33
2019-10-19T05:53:33
209,232,932
1
0
null
null
null
null
UTF-8
Java
false
false
2,497
java
package Adapter; import android.content.Context; import android.content.SharedPreferences; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import java.util.List; import Config.BaseURL; import Model.Home_Icon_model; import trolley.tcc.R; import static android.content.Context.MODE_PRIVATE; /** * Created by Rajesh Dabhi on 22/6/2017. */ public class Home_Icon_Adapter extends RecyclerView.Adapter<Home_Icon_Adapter.MyViewHolder> { private List<Home_Icon_model> modelList; private Context context; String language; SharedPreferences preferences; public class MyViewHolder extends RecyclerView.ViewHolder { public TextView title; public ImageView image; public MyViewHolder(View view) { super(view); title = (TextView) view.findViewById(R.id.service_text); image = (ImageView) view.findViewById(R.id.service_image); } } public Home_Icon_Adapter(List<Home_Icon_model> modelList) { this.modelList = modelList; } @Override public Home_Icon_Adapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.row_headre_catogaries, parent, false); context = parent.getContext(); return new Home_Icon_Adapter.MyViewHolder(itemView); } @Override public void onBindViewHolder(Home_Icon_Adapter.MyViewHolder holder, int position) { Home_Icon_model mList = modelList.get(position); Glide.with(context) .load(BaseURL.IMG_CATEGORY_URL + mList.getImage()) .placeholder(R.drawable.icon) .crossFade() .diskCacheStrategy(DiskCacheStrategy.ALL) .dontAnimate() .into(holder.image); preferences = context.getSharedPreferences("lan", MODE_PRIVATE); language=preferences.getString("language",""); if (language.contains("english")) { holder.title.setText(mList.getTitle()); } else { holder.title.setText(mList.getTitle()); } } @Override public int getItemCount() { return modelList.size(); } }
[ "dharinisingh04@gmail.com" ]
dharinisingh04@gmail.com
3a459d49a99bf6b093f98d0a75b287636db6caa9
d5e07ad160aa1bc4ac749c54efa94a52c087d98b
/nodes/src/main/java/org/nodes/rdf/InformedLabels.java
19760aa97efe1d6da6f924becdaa927e1fcb79a1
[ "MIT" ]
permissive
yassmarzou/nodes
0268bc15815165dc6993ead903440e898f0c70e3
fb575596908bcbd830eda15595135f01f57ba943
refs/heads/master
2021-01-21T08:14:54.133281
2015-12-14T08:55:36
2015-12-14T08:55:36
46,875,993
0
0
null
2015-11-25T17:15:44
2015-11-25T17:15:44
null
UTF-8
Java
false
false
7,923
java
package org.nodes.rdf; import static java.util.Collections.reverseOrder; import static org.nodes.util.Functions.log2; import static org.nodes.util.Series.series; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import org.nodes.DTGraph; import org.nodes.DTLink; import org.nodes.DTNode; import org.nodes.Node; import org.nodes.classification.Classified; import org.nodes.util.FrequencyModel; import org.nodes.util.Functions; import org.nodes.util.MaxObserver; import org.nodes.util.Series; /** * Version of HubAvoidance which takes instance labels into account * @author Peter * */ public class InformedLabels implements Scorer { private List<? extends Node<String>> instances; // * Marginal counts // The outer lists collects a frequencymodel for each depth d // The frequency model counts for each node in how d-neighborhoods of // instances it occurs. private List<FrequencyModel<String>> counts; // * Counts conditional on class // the first list collects by class, the rest the same as counts private List<List<FrequencyModel<String>>> classCounts; private FrequencyModel<Integer> classes; private int numClasses, maxDepth; /** * * @param graph The graph from which to extract instances * @param instances The instance nodes * @param maxDepth The maximum depth to which neighbourhoods will be analysed * @param instanceSize The number of nodes to extract for each instance */ public InformedLabels( DTGraph<String, String> graph, Classified<? extends Node<String>> instances, int maxDepth) { this.instances = instances; this.maxDepth = maxDepth; int numInstances = instances.size(); numClasses = instances.numClasses(); classes = new FrequencyModel<Integer>(instances.classes()); // ** Intitialize the counts object counts = new ArrayList<FrequencyModel<String>>(maxDepth + 1); // * set the 0 index to null, so that the indices match up with the // depths they represent counts.add(null); for(int d : series(1, maxDepth + 1)) counts.add(new FrequencyModel<String>()); // ** Initialize the classCounts object classCounts = new ArrayList<List<FrequencyModel<String>>>(); for(int i : series(numClasses)) { ArrayList<FrequencyModel<String>> classCount = new ArrayList<FrequencyModel<String>>(maxDepth + 1); // * set the 0 index to null, so that the indices match up with the // depths they represent classCount.add(null); for(int d : series(1, maxDepth + 1)) classCount.add(new FrequencyModel<String>()); classCounts.add(classCount); } for(int i : series(instances.size())) { Node<String> instance = instances.get(i); int cls = instances.cls(i); Set<Node<String>> core = new LinkedHashSet<Node<String>>(); core.add(instance); count(1, core, cls); } } private void count(int depth, Set<Node<String>> core, int cls) { if(depth > maxDepth) return; Set<Node<String>> shell = new HashSet<Node<String>>(); for(Node<String> node : core) for(Node<String> neighbor : node.neighbors()) if(! core.contains(neighbor)) shell.add(neighbor); core.addAll(shell); for(Node<String> node : core) { for(String label : labels((DTNode<String, String>) node)) { counts.get(depth).add(label); // marginal over all classes classCounts.get(cls).get(depth).add(label); // conditional by class } } count(depth + 1, core, cls); } private class InformedComp implements Comparator<String> { private int depth; public InformedComp(int depth) { this.depth = depth; } @Override public int compare(String first, String second) { return Double.compare(classEntropy(first, depth), classEntropy(second, depth)); } } private class UninformedComp implements Comparator<String> { private int depth; public UninformedComp(int depth) { this.depth = depth; } @Override public int compare(String first, String second) { return Double.compare(bintropy(first, depth), bintropy(second, depth)); } } public Comparator<String> informedComparator(int depth) { return new InformedComp(depth); } public Comparator<String> uninformedComparator(int depth) { return new UninformedComp(depth); } private double bintropy(String node, int depth) { double p = p(node, depth); return bintropy(p); } private static double bintropy(double p) { if(p == 0.0 || p == 1.0) return 0.0; double q = 1.0 - p; return - (p * log2(p) + q * log2(q)); } /** * Non-Viable nodes should be filtered out of any list of potential nodes to * consider for processing * * @param node * @return */ public boolean viableHub(Node<String> node, int depth, int numInstances) { if(counts.get(depth).frequency(node.label()) < numInstances) return false; return true; } /** * The probability that a random instance is in the depth-neighbourhood of * the given node * * @param node * @param depth * @return */ public double p(String label, int depth) { if(depth == 0) return 0.0; return counts.get(depth).frequency(label) / (double) instances.size(); } /** * The probability that a random instance of the given class is in the * depth-neighborhood of the given node. * * @param node * @param depth * @param cls * @return */ public double p(String label, int cls, int depth) { List<FrequencyModel<String>> cns = classCounts.get(cls); if(depth == 0) return 0.0; return cns.get(depth).frequency(label) / classes.frequency(cls); } /** * The prior probability of a given class * @param cls * @return */ public double p(int cls) { return classes.probability(cls); } /** * The probability of a class for a given node * * It is the entropy over this distribution that we want minimized * @return */ public double pClass(int cls, String label, int depth) { double div = p(label, depth); if(div == 0.0) return 0.0; return p(label, cls, depth) * p(cls) / div; } public double classEntropy(String label, int depth) { double entropy = 0.0; for(int cls : classes.tokens()) { double p = pClass(cls, label, depth); entropy += p == 0.0 ? 0.0 : p * log2(p); } return - entropy; } @Override public double score(Node<String> node, int depth) { return - classEntropy(node.label(), depth); } /** * All the labels this node could take. * * @param node * @return */ public List<String> labels(DTNode<String, String> node) { List<String> labels = new ArrayList<String>(node.degree()); labels.add(node.label()); for(DTLink<String, String> link : node.linksOut()) { if(link.to().equals(link.from())) continue; String label = "out: "; label += link.tag() + " "; label += link.other(node) + " "; labels.add(label); } for(DTLink<String, String> link : node.linksIn()) { if(link.to().equals(link.from())) continue; String label = " in: "; label += link.tag() + " "; label += link.other(node); labels.add(label); } return labels; } public String chooseLabelInformed(DTNode<String, String> node, int depth) { return choose(labels(node), Collections.reverseOrder(informedComparator(depth))); } public String chooseLabelUninformed(DTNode<String, String> node, int depth) { return choose(labels(node), uninformedComparator(depth)); } public String choose(List<String> labels, Comparator<String> comp) { MaxObserver<String> mo = new MaxObserver<String>(1, comp); mo.observe(labels); return mo.elements().get(0); } }
[ "p@peterbloem.nl" ]
p@peterbloem.nl
f554bcb2244fa689bb1a6623111afac24ccf04a1
141e60553d1d97ade9341493fc81556a98e35a46
/src/test/java/com/ngs/SpringBootWebappSecurityDemoLdapApplicationTests.java
657211565cc18c32b1620a2e7f0bc13f8573fefe
[]
no_license
ngsankar-lab/SpringBoot-webapp-security-demo-LDAP
38ba0fcd037205917265804cff688a0a65039583
883d87b0ea1f5ca5168791b8a670bcb9dd338979
refs/heads/master
2020-12-12T14:22:31.246772
2020-01-15T18:56:12
2020-01-15T18:56:12
234,149,219
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package com.ngs; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class SpringBootWebappSecurityDemoLdapApplicationTests { @Test void contextLoads() { } }
[ "ngsankar@gmail.com" ]
ngsankar@gmail.com
b8f5bfab45802695adc62b4171e337a4bd09b008
4222169dab02851c9eaf61e6f6b02d4f2645c112
/src/main/java/com/progrema/mkos/entities/expensepayment/wrapper/ExpensePaymentWrapper.java
db5ed6bb6439556f1304dde017237b7596dc84a4
[]
no_license
iqbalpakeh/project_mkos
aa0f0fa0c2e468b650307d15f878fe94f2030008
9bdb546b78b8eaeeda4e7ef5381cafe86635ceed
refs/heads/main
2023-04-01T23:57:44.353275
2021-03-28T23:30:08
2021-03-28T23:30:08
305,209,484
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package com.progrema.mkos.entities.expensepayment.wrapper; import com.progrema.mkos.entities.expensepayment.ExpensePayment; import lombok.Getter; import java.util.ArrayList; import java.util.List; @Getter public class ExpensePaymentWrapper { private final long timestamp; private final List<ExpensePayment> expenses; public ExpensePaymentWrapper(long timestamp) { this.timestamp = timestamp; this.expenses = new ArrayList<>(); } public void addExpensePayment(ExpensePayment expensePayment) { this.expenses.add(expensePayment); } }
[ "iqbalpakeh@gmail.com" ]
iqbalpakeh@gmail.com
d6478bb11ceb96bb550e3b6e2fd3c76bd9a4ad1a
569d5fd96ca82f2c3a589a66363241dd75b6f94b
/aacesys/src/com/ascent/servlet/UserManagerServlet.java
fce0a3014b2b310423cc2b2ad6830c5b91a93655
[]
no_license
wanghe2014/inter110
98f9097216940a9e2191d682ea4d6d4a177c150c
cc6d1a989e8db10463bcce347a15b1f9aebc3d8e
refs/heads/master
2016-09-05T14:51:48.475423
2013-12-29T16:36:24
2013-12-29T16:36:24
null
0
0
null
null
null
null
GB18030
Java
false
false
8,548
java
package com.ascent.servlet; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.ascent.bean.Productuser; import com.ascent.dao.UserManagerDAO; public class UserManagerServlet extends HttpServlet{ private static final String CONTENT_TYPE = "text/html; charset=GBK"; private ServletContext sc=null; public void init() throws ServletException { super.init(); sc=this.getServletContext(); } // Process the HTTP Post request public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ doGet(request, response); } public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{ //获取登录状态(登录或退出系统); String loginstate= request.getParameter("a"); if(loginstate.equals("all"))//为退出系统动作 { this.findAllUser(request, response); } if(loginstate.equals("regis"))//为退出系统动作 { this.addUser(request, response); } if(loginstate.equals("finduser"))//查找用户 { this.findProductUserbyid(request, response); } if(loginstate.equals("update"))//更新用户信息 { this.updateProductUser(request, response); } if(loginstate.equals("updatesuper"))//更新用户信息 { this.updateUserSuper(request, response); } if(loginstate.equals("delsuser"))//更新用户信息 { this.delSoftUser(request, response); } return; } //Clean up resources public void destroy() { } //查询所有用户 public void findAllUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ UserManagerDAO um = new UserManagerDAO(); HttpSession mysession = request.getSession(false); List allProductList = um.getAllProductUser(); mysession.setAttribute("allproductlist", allProductList); RequestDispatcher rd=sc.getRequestDispatcher("/product/products_showusers.jsp"); rd.forward(request,response); } //更改用户的权限 public void updateUserSuper(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String userid=request.getParameter("uid"); String supers = request.getParameter("superuser"); int uid= Integer.valueOf(userid); UserManagerDAO um = new UserManagerDAO(); um.updateSuperuser(uid, supers); HttpSession mysession = request.getSession(false); List allProductList = um.getAllProductUser(); mysession.setAttribute("allproductlist", allProductList); RequestDispatcher rd=sc.getRequestDispatcher("/product/products_showusers.jsp"); rd.forward(request,response); } // 软删除用户 public void delSoftUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String userid=request.getParameter("uid"); String valuea=request.getParameter("value"); int a = Integer.valueOf(valuea); int uid= Integer.valueOf(userid); UserManagerDAO um = new UserManagerDAO(); um.delSoftuser(uid,a); HttpSession mysession = request.getSession(false); List allProductList = um.getAllProductUser(); mysession.setAttribute("allproductlist", allProductList); RequestDispatcher rd=sc.getRequestDispatcher("/product/products_showusers.jsp"); rd.forward(request,response); } public void findProductUserbyid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String userid=request.getParameter("uid"); int uid= Integer.valueOf(userid); UserManagerDAO um = new UserManagerDAO(); HttpSession mysession = request.getSession(false); Productuser allProductuser = um.getProductUserByid(uid); mysession.setAttribute("UID_Productuser", allProductuser); RequestDispatcher rd=sc.getRequestDispatcher("/product/updateproductuser.jsp"); rd.forward(request,response); } public void updateProductUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String uids = request.getParameter("uid"); String citys =request.getParameter("city"); String usernames =request.getParameter("username"); String fullnames =request.getParameter("fullname"); String titles =request.getParameter("title"); String tels =request.getParameter("tel"); String passwords =request.getParameter("password"); String zips =request.getParameter("zip"); String jobs =request.getParameter("job"); String emails =request.getParameter("email"); String countrys =request.getParameter("country"); String companynames =request.getParameter("companyname"); String companyaddresss= request.getParameter("companyaddress"); String notes =request.getParameter("note"); Productuser productuser = new Productuser(); productuser.setUid(Integer.valueOf(uids)); productuser.setCity(citys); productuser.setUsername(usernames); productuser.setFullname(fullnames); productuser.setTitle(titles); productuser.setTel(tels); productuser.setPassword(passwords); productuser.setZip(zips); productuser.setJob(jobs); productuser.setEmail(emails); productuser.setCountry(countrys); productuser.setCompanyname(companynames); productuser.setCompanyaddress(companyaddresss); productuser.setNote(notes); UserManagerDAO um = new UserManagerDAO(); um.updateProductuser(productuser); HttpSession mysession = request.getSession(false); List allProductList = um.getAllProductUser(); mysession.setAttribute("allproductlist", allProductList); RequestDispatcher rd=sc.getRequestDispatcher("/product/products_showusers.jsp"); rd.forward(request,response); } public void addUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ HttpSession session = request.getSession(false); UserManagerDAO um = new UserManagerDAO(); // 从session中取验证码 String code_temp = (String)session.getAttribute("CODE"); //获取页面form里的属性值 String codes =request.getParameter("code"); String usernames =request.getParameter("username"); String passwords =request.getParameter("password"); String companynames =request.getParameter("companyname"); String companyaddresss= request.getParameter("companyaddress"); String countrys =request.getParameter("country"); String citys =request.getParameter("city"); String jobs =request.getParameter("job"); String tels =request.getParameter("tel"); String zips =request.getParameter("zip"); String emails =request.getParameter("email"); //将session中验证码强行清空,更安全 session.setAttribute("CODE", null); if(!code_temp.equalsIgnoreCase(codes.trim())){ //"您输入的验证码不匹配,请重新注册" request.setAttribute("error","regist_tip.code.error"); RequestDispatcher rd=sc.getRequestDispatcher("/product/register.jsp"); rd.forward(request,response); }else{ Productuser pu= um.findProductUserByusername(usernames); if(pu!=null){ //"您使用的用户名已经被占用了,请重新注册" request.setAttribute("error","regist_tip.username.used"); RequestDispatcher rd=sc.getRequestDispatcher("/product/register.jsp"); rd.forward(request,response); }else { Productuser productuser = new Productuser(); productuser.setCity(citys); productuser.setUsername(usernames); productuser.setTel(tels); productuser.setPassword(passwords); productuser.setZip(zips); productuser.setJob(jobs); productuser.setEmail(emails); productuser.setCountry(countrys); productuser.setCompanyname(companynames); productuser.setCompanyaddress(companyaddresss); productuser.setSuperuser("1"); um.addProductUser(productuser); RequestDispatcher rd=sc.getRequestDispatcher("/product/regist_succ.jsp"); rd.forward(request,response); } } } }
[ "286968546@qq.com" ]
286968546@qq.com
c30bd532f1a3ed8403aa1f1f3945c703a193a786
ba7f3cb4f0a1e2e4812db211680e3cfc260872b2
/ my-waverider/src/main/java/com/taobao/top/waverider/command/Command.java
184279d837c4bdfbbd1d707ddf44956fdb1fb462
[]
no_license
zhujinfei5151/my-waverider
82f188ef52aec0b85358a549811a3969616b6b75
d252127c952cb9e7647d3e3b3c92758cc5da2a23
refs/heads/master
2021-01-01T10:40:12.958322
2012-04-19T12:18:04
2012-04-19T12:18:04
40,796,563
0
0
null
null
null
null
UTF-8
Java
false
false
4,876
java
/** * waverider */ package com.taobao.top.waverider.command; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.nio.ByteBuffer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.taobao.top.waverider.session.Session; import com.taobao.top.waverider.slave.SlaveState; /** * <p> * 命令 * </p> * * @author <a href="mailto:sihai@taobao.com">sihai</a> * */ public class Command { private static Log logger = LogFactory.getLog(Command.class); public static Long HEART_BEAT_COMMAND = 0L; // 心跳Command Type值 public static Long AVAILABLE_COMMAND_START = 10L; // 上层可用Command Type起始值 //===================================================================== // Header //===================================================================== private Long type; // 命令类型, 上层自定义, 0L-10L保留系统使用 private Integer length; // 整个报文的长度 //===================================================================== // Body(负载) //===================================================================== private ByteBuffer payLoad; // 命令负载, 上层自定义 /** * 命令依附的Session, Master端有效 */ private Session session; public Command() { this(null, null, null); } /** * * @param type * @param payLoad */ public Command(Long type, ByteBuffer payLoad){ this(null, type, payLoad); } /** * * @param type * @param payLoad */ public Command(Session session, Long type, ByteBuffer payLoad){ this.session = session; this.type = type; this.payLoad = payLoad; } /** * 获取命令类型 * @return */ public Long getType(){ return type; } /** * 设置命令类型 * @param type */ public void setType(Long type){ this.type = type; } /** * 获取命令长度 * @return */ public Integer getLength() { return length; } /** * 设置命令长度 * @param length */ public void setLength(Integer length) { this.length = length; } /** * * @param payLoad */ public void setPayLoad(ByteBuffer payLoad){ this.payLoad = payLoad; } /** * 获取命令的负载 * @return */ public ByteBuffer getPayLoad(){ return payLoad; } /** * 获取命令依附的Session, Master端有效 * @return */ public Session getSession() { return session; } /** * 设置命令依附的Session, Master端有效 * @return */ public void setSession(Session session) { this.session = session; } /** * 获取整个报文长度 * @return */ public int getSize() { int size = 0; size += getHeaderSize(); size += payLoad.remaining(); return size; } //===================================================================== // 工具方法 //===================================================================== /** * 命令头部长度 * @return */ public static int getHeaderSize() { int size = 0; size += Long.SIZE / Byte.SIZE; size += Integer.SIZE / Byte.SIZE; return size; } /** * 将命令写到ByteBuffer中 * @return */ public ByteBuffer marshall(){ int length = getSize(); ByteBuffer buffer = ByteBuffer.allocate(length); buffer.putLong(type); buffer.putInt(length); buffer.put(payLoad); buffer.flip(); payLoad.clear(); return buffer; } /** * 将ByteBuffer转换成命令 * @param buffer * @return */ public static Command unmarshall(ByteBuffer buffer) { if(buffer.remaining() < getHeaderSize()) { throw new RuntimeException("Wrong command."); } Command command = new Command(); command.setType(buffer.getLong()); command.setLength(buffer.getInt()); // 在新缓冲区(payLoad)上调用array()方法还是会返回整个数组。 command.setPayLoad(buffer.slice()); return command; } public static void main(String[] args) { ByteArrayOutputStream bout = null; ObjectOutputStream objOutputStream = null; try { bout = new ByteArrayOutputStream(); objOutputStream = new ObjectOutputStream(bout); SlaveState slaveState = new SlaveState(); slaveState.setId(1L); slaveState.setIsMasterCandidate(false); objOutputStream.writeObject(slaveState); objOutputStream.flush(); Command command = CommandFactory.createHeartbeatCommand(ByteBuffer.wrap(bout.toByteArray())); ByteBuffer buffer = command.marshall(); Command cmd = Command.unmarshall(buffer); SlaveState ss = SlaveState.fromByteBuffer(cmd.getPayLoad()); System.out.println(cmd.toString()); }catch(IOException e) { throw new RuntimeException(e); }finally{ try { if(objOutputStream != null) { objOutputStream.close(); } if(bout != null) { bout.close(); } } catch (IOException e) { e.printStackTrace(); } } } }
[ "iacrqq@gmail.com" ]
iacrqq@gmail.com
e3d13a8fcce4ff8337e5144b20ba2da7a51ae70d
d02550c2489c26aa6561a21d6a3b84602bd12532
/programming/Ben_S_PPW_2013/src/edu/ppw/EventManager.java
650a8d4aa89a0d2995a0b3742fb29d78d2f0a3f5
[]
no_license
madhephaestus/prgramming-physical-world
152dbe76edb0bf5da6479bb79f80738c04eaa4a6
b8a78da9d37c503353f1eebdd02b04b27ac2f0e3
refs/heads/master
2020-06-04T04:19:07.413699
2013-11-05T21:00:22
2013-11-05T21:00:22
32,235,925
0
1
null
null
null
null
UTF-8
Java
false
false
646
java
package edu.ppw; import com.neuronrobotics.sdk.dyio.peripherals.ServoChannel; public class EventManager { boolean channelOneHasFired=false; boolean channelTwoHasFired=false; public void onCompletion(ServoChannel myChannel) { int channelNumber = myChannel.getChannel().getChannelNumber(); System.out.println("The event has happened"+myChannel.getChannel().getChannelNumber()); if(channelNumber == 11){ channelOneHasFired=true; } if(channelNumber == 12){ channelTwoHasFired=true; } } public boolean hasCompletedCycle(){ return channelOneHasFired && channelTwoHasFired; } }
[ "bensecino@gmail.com" ]
bensecino@gmail.com
d5d3ba086a9483cb260726aa706313c05099667e
5fcf01a6eb75c56a7bc437d145948d3e6fac7ffc
/home/src/main/component/java/com/lcfarm/android/home/application/HomeApplication.java
e5bf5510e9c6e27ec04197294ed2d12c6eb5aa5c
[]
no_license
Cheney2006/ComponentSample
b6f598b8eedb64ede72c5311ba806110f47a4931
53084a42f7ea3473a547db77870893e68543c0ef
refs/heads/master
2022-04-21T20:55:21.162560
2020-04-13T07:27:25
2020-04-13T07:27:25
254,824,607
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.lcfarm.android.home.application; import android.content.Context; import com.lcfarm.android.base.application.BaseApplication; public class HomeApplication extends BaseApplication { @Override public void onCreate() { super.onCreate(); } @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); } }
[ "chenyun@nongfadai.com" ]
chenyun@nongfadai.com
f37e0a7778068caab275d1db826b5ba99c01e88c
8549c8692cf72e6bdb36a1c75b33fbd7cefb475f
/MTA Framewrok/MTA-Core/src/main/java/com/arthur/mta/utbdbservice/sql/datanucleus/DataNucleusTerm.java
7e74b82be07da2f29a682a59c2943ab60bce0a4d
[]
no_license
NCCUCS-PLSM/SaaS-Data
3e4d30a04b3f4b653d7ce1fb66a95d9206a7b675
577bbc54480927a8aa93c5182683304d22be34e0
refs/heads/master
2021-03-12T23:51:15.168140
2013-12-23T01:52:50
2013-12-23T01:52:50
11,502,003
1
0
null
null
null
null
UTF-8
Java
false
false
708
java
package com.arthur.mta.utbdbservice.sql.datanucleus; import com.arthur.mta.utbdbservice.sql.Term; class DataNucleusTerm implements Term{ private String columnName; private String tableAlias; public DataNucleusTerm(String columnName){ this.columnName = columnName; } public DataNucleusTerm(String tableAlias ,String columnName){ this.columnName = columnName; this.tableAlias = tableAlias; } public void setColumnName(String columnName) { this.columnName = columnName; } public void setTableAlias(String tableAlias) { this.tableAlias = tableAlias; } public String getColumnName() { return this.columnName; } public String getTableAlias() { return this.tableAlias; } }
[ "jiujye@gmail.com" ]
jiujye@gmail.com
a9ff03fc636f07967cf2d0eb8a5a24b8b38a7fee
70ee41b86f1569c6388a294ddcf22bbb9c7cd3fa
/01.Java Fundamentals/01.Java Advanced/03.Linear Data Structures/src/_07_MatchingBrackets.java
d55046e43c1188961d0df365aa4439366ab95c97
[ "MIT" ]
permissive
mdamyanova/SoftUni-Java-Web-Development
1cf49a4ab663919621c38f0f8008945bf3023999
72b302e9ebcb77e87e4d0c048680c930eb62a250
refs/heads/master
2020-04-08T13:29:41.774902
2019-08-08T11:39:15
2019-08-08T11:39:15
159,393,679
2
0
null
null
null
null
UTF-8
Java
false
false
718
java
import java.util.ArrayDeque; import java.util.Deque; import java.util.Scanner; public class _07_MatchingBrackets { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String expression = scanner.nextLine(); Deque<Integer> stack = new ArrayDeque<>(); for (int i = 0; i < expression.length(); i++) { char ch = expression.charAt(i); if (ch == '(') { stack.push(i); } else if (ch == ')') { int startIndex = stack.pop(); String contents = expression.substring(startIndex, i + 1); System.out.println(contents); } } } }
[ "mdamyanova181@gmail.com" ]
mdamyanova181@gmail.com
851ff307ad014ee848d6dc89eb6bdf8be7386d35
9d299cff363afa2535ad0c72516fc9fbbf003b29
/consumer-feign/src/main/java/com/hand/spring/feign/UserFeignClient.java
59de159036c7d9091a6b368a8ab94dddbaefd62c
[]
no_license
JerryYuanJ/SpringCloudDemo
6d510201fb14b2ec71399bfa265423525dbb3b8a
f8a1fc4adebad1256bc735c06ea6eb9a59d667df
refs/heads/master
2021-05-15T13:05:52.712137
2017-10-31T03:30:22
2017-10-31T03:30:22
108,509,721
0
0
null
null
null
null
UTF-8
Java
false
false
1,040
java
package com.hand.spring.feign; import com.hand.spring.bean.User; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Created by Joker on 2017/10/31. */ @FeignClient("micro-service-user-provider2") public interface UserFeignClient { @RequestMapping(value = "/user/{id}", method = RequestMethod.GET) User findById(@PathVariable("id") Long id); // 两个坑:1. @GetMapping不支持 2. @PathVariable得设置value @RequestMapping(value = "/user", method = RequestMethod.POST) User postUser(@RequestBody User user); // 该请求不会成功,只要参数是复杂对象,即使指定了是GET方法,feign依然会以POST方法进行发送请求。 @RequestMapping(value = "/get-user", method = RequestMethod.GET) User getUser(User user); }
[ "610819167@qq.com" ]
610819167@qq.com
f66fe9e08942da69306d1e5005275df1385edb71
4e7d87840cf911e3a37bebfcf9dc4bcb3a4a7c4d
/spring-vault-core/src/main/java/org/springframework/vault/core/lease/event/LeaseErrorListener.java
f8bc1c04c6cd1d60ea373867da24f926353e5bd4
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
domix/spring-vault
d78cb062aba2a5df2c551a6356aebb605edbee60
b28d97fe1bcc6fcf2b7147b30b4f656ad6327080
refs/heads/master
2021-01-21T07:30:31.256543
2017-05-12T09:48:48
2017-05-12T09:50:52
91,616,514
1
0
null
2017-05-17T20:18:05
2017-05-17T20:18:05
null
UTF-8
Java
false
false
1,167
java
/* * Copyright 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.springframework.vault.core.lease.event; /** * Listener for Vault exceptional {@link SecretLeaseEvent}s. * <p> * Error events can occur during secret retrieval, lease renewal, lease revocation and * secret rotation. * * @author Mark Paluch */ public interface LeaseErrorListener { /** * Callback for a {@link SecretLeaseEvent} * * @param leaseEvent the event object, must not be {@literal null}. * @param exception the thrown {@link Exception}. */ void onLeaseError(SecretLeaseEvent leaseEvent, Exception exception); }
[ "mpaluch@pivotal.io" ]
mpaluch@pivotal.io
185a3d2b77db134246bd2e1406e028bdc36fd074
cbb36b02bc8701d7061d8c7343673bf57f82d05d
/app/src/main/java/com/example/coursawy/database/Database.java
fedaf0491165f57eeedeaaec19807ef409eeeef8
[]
no_license
momenrollins/coursawy
f5bbbcfbe55a4bbb167ed69ba0daa58545256501
f1dbc3092b3047f981e3b303a881535b2d92d7f9
refs/heads/master
2023-02-08T05:14:22.184383
2021-01-05T04:56:31
2021-01-05T04:56:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package com.example.coursawy.database; import com.google.firebase.firestore.CollectionReference; import com.google.firebase.firestore.FirebaseFirestore; public class Database { public static final String USERS_BRANCH = "USERS"; private static FirebaseFirestore firebaseFirestore; private static FirebaseFirestore getInstance(){ if (firebaseFirestore == null){ firebaseFirestore = FirebaseFirestore.getInstance(); } return firebaseFirestore; } public static CollectionReference getUsersReference() { return getInstance().collection(USERS_BRANCH); } }
[ "abofawzy02@gmail.com" ]
abofawzy02@gmail.com
9d984ab434eadf937c8d8a315c11f8effc3f75ef
709e50acc806087d819a90fc6e3bb22871a89d07
/app/src/main/java/com/dicoding/galaksi/Galaksi.java
f62cc36109a9918eca0d9b693664c3f5c60a8fbf
[]
no_license
FadillahAR/Android-dasar
1bbc72a8cb8662d884703d19428f60f8661551d4
e882c0e4cacf595ffdae8db3576d3ecbd29c8404
refs/heads/master
2020-12-13T09:18:37.314564
2020-01-16T17:32:38
2020-01-16T17:32:38
234,374,498
0
1
null
null
null
null
UTF-8
Java
false
false
533
java
package com.dicoding.galaksi; public class Galaksi { private String name; private String detail; private int photo; public int getPhoto() { return photo; } public void setPhoto(int photo) { this.photo = photo; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "fadillahauliarahman02@gmail.com" ]
fadillahauliarahman02@gmail.com
cf0cc866a0f0d4cf3896cd05ee0e1061bfc5f57d
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_31675.java
4b32e839b2b1dacf279065c7e16f5b8337377a47
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
867
java
@Override public void removeFailedMigrations(){ if (!exists()) { LOG.info("Repair of failed migration in Schema History table " + table + " not necessary as table doesn't exist."); return; } boolean failed=false; List<AppliedMigration> appliedMigrations=allAppliedMigrations(); for ( AppliedMigration appliedMigration : appliedMigrations) { if (!appliedMigration.isSuccess()) { failed=true; } } if (!failed) { LOG.info("Repair of failed migration in Schema History table " + table + " not necessary. No failed migration detected."); return; } try { clearCache(); jdbcTemplate.execute("DELETE FROM " + table + " WHERE " + database.quote("success") + " = " + database.getBooleanFalse()); } catch ( SQLException e) { throw new FlywaySqlException("Unable to repair Schema History table " + table,e); } }
[ "sonnguyen@utdallas.edu" ]
sonnguyen@utdallas.edu
031717f0f3ad19790b1655894bfe65e4ee65da8c
5c78f28190aaea1a45275e5cfcb15ac2ff252c6e
/src/com/linksong/sort/Leetcode018.java
852212aa29f20c619d50abacfc96e93b2bb93a10
[]
no_license
linksong/LeetCode
f7b2f2347f8bdb57a043a447815fc473ed5b57f7
0fe558df65aea0198b0dda0d8da0a3e00e6dce11
refs/heads/master
2023-06-01T01:25:53.875870
2021-06-10T13:55:04
2021-06-10T13:55:04
316,521,762
0
0
null
null
null
null
UTF-8
Java
false
false
3,935
java
package com.linksong.sort; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author 1625159399@qq.com * @date 2021/6/4 22:17 */ public class Leetcode018 { /** * * 错解 第一个元素固定-》1,2,3,号元素递增 * @param nums * @param target * @return */ public static List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> result = new ArrayList<>(); if (nums.length < 4 || nums == null) { return result; } Arrays.sort(nums); for (int i = 0; i < nums.length; i++) { if (nums[i] > target || nums[i] + nums[i + 1] + nums[i + 2] + nums[i + 3] > target) { break; } if (i > 0 && nums[i] == nums[i + 1]) { continue; } int left = i; int right = nums.length - 1; while (left < right) { int sum = nums[left] + nums[left + 1] + nums[left + 2] + nums[right]; if (sum == target) { result.add(Arrays.asList(nums[left], nums[left + 1], nums[left + 2], nums[right])); while (left < right && nums[left + 1] == nums[left]) { left++; } while (left < right && nums[right] == nums[right - 1]) { right--; } left++; right--; } else if (sum < target) { left++; } else if (sum > target) { right--; } } } return result; } class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> quadruplets = new ArrayList<List<Integer>>(); if (nums == null || nums.length < 4) { return quadruplets; } Arrays.sort(nums); int length = nums.length; for (int i = 0; i < length - 3; i++) { if (i > 0 && nums[i] == nums[i - 1]) { continue; } if (nums[i] + nums[i + 1] + nums[i + 2] + nums[i + 3] > target) { break; } if (nums[i] + nums[length - 3] + nums[length - 2] + nums[length - 1] < target) { continue; } for (int j = i + 1; j < length - 2; j++) { if (j > i + 1 && nums[j] == nums[j - 1]) { continue; } if (nums[i] + nums[j] + nums[j + 1] + nums[j + 2] > target) { break; } if (nums[i] + nums[j] + nums[length - 2] + nums[length - 1] < target) { continue; } int left = j + 1, right = length - 1; while (left < right) { int sum = nums[i] + nums[j] + nums[left] + nums[right]; if (sum == target) { quadruplets.add(Arrays.asList(nums[i], nums[j], nums[left], nums[right])); while (left < right && nums[left] == nums[left + 1]) { left++; } left++; while (left < right && nums[right] == nums[right - 1]) { right--; } right--; } else if (sum < target) { left++; } else { right--; } } } } return quadruplets; } } }
[ "1625159399@qq.com" ]
1625159399@qq.com
ac8a9c56dceecbc44fc8ff496ab4088f1a3e5c2d
0e40997a79f71b26d41c94049420fcaca281a160
/HW2-TravelAgency2-Starter/src/triptypes/CabinType.java
5de4c336d1a97bed8474c8015a249f0dadc0634b
[]
no_license
camerongilinsky/CompSci2
152be2d9445c719274660615387c124ef90f7fa3
b135fafe05b613f940d0746ba092e279b8080d36
refs/heads/master
2020-04-17T06:31:16.105868
2019-04-21T16:26:52
2019-04-21T16:26:52
166,328,320
1
0
null
null
null
null
UTF-8
Java
false
false
732
java
// COURSE: CSCI1620 // TERM: Spring 2019 // // NAME: Cameron Gilinsky and Carter Kennell // RESOURCES: Piazza discussion board posts by the students and instructors for this class package triptypes; /** * This enum presents the four cabin types on standard cruise ships. * @author ckgilinsky and ckennell */ public enum CabinType { /** * An exterior room onboard that has a small private balcony for guests. */ BALCONY, /** * An interior room on the ship with no window. */ INTERIOR, /** * An exterior room on the ship with a fixed window. */ OCEAN_VIEW, /** * A luxury suite on the ship with a large balcony, sitting room, and * separate bedroom. */ SUITE }
[ "Cameron@Cameron" ]
Cameron@Cameron
2494fa6c0cbe569e482b6e41a8c62953e2696c9b
8ab3b2757a820b38d0debaa7d76e9d5608d1413d
/src/com/android/inmoprueba1/CustomPageAdapter.java
8b683fb1f4b91d4e5e0009b0a8e7ff2880e3f3ac
[]
no_license
jcolinas26/GoRelaxing
e7e5010dd29156a983b4b68b6948990b347fb646
c0d25924be12755a2fc5f67203d18c10eb979bf1
refs/heads/master
2021-01-01T18:55:06.442130
2015-08-08T17:21:03
2015-08-08T17:21:03
40,140,419
0
1
null
null
null
null
UTF-8
Java
false
false
1,745
java
package com.android.inmoprueba1; import java.util.List; import android.content.Context; import android.os.Parcelable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; //Clase auxiliar para crear el viewpager de resultado public class CustomPageAdapter extends PagerAdapter { private final List<String> urls; private final Context context; public CustomPageAdapter(Context context, List<String> urls) { super(); this.urls = urls; this.context = context; } @Override public void destroyItem(View collection, int position, Object view) { ((ViewPager) collection).removeView((LinearLayout) view); } @Override public void finishUpdate(View arg0) { // TODO Auto-generated method stub } @Override public int getCount() { return urls.size(); } @Override public Object instantiateItem(View collection, int position) { LinearLayout linearLayout = new LinearLayout(context); linearLayout.setOrientation(1); ImageView image = new ImageView(context); image = CargarImagenes.downloadImg(image, urls.get(position)); linearLayout.addView(image); ((ViewPager) collection).addView(linearLayout, 0); return linearLayout; } @Override public boolean isViewFromObject(View view, Object object) { return view == ((LinearLayout) object); } @Override public void restoreState(Parcelable arg0, ClassLoader arg1) { // TODO Auto-generated method stub } @Override public Parcelable saveState() { // TODO Auto-generated method stub return null; } @Override public void startUpdate(View arg0) { // TODO Auto-generated method stub } }// end class
[ "jcolinas26@gmail.com" ]
jcolinas26@gmail.com
fdab9c283fce6e8950b15d5739424cc7db7352d2
8727b1cbb8ca63d30340e8482277307267635d81
/PolarServer/src/com/game/skill/structs/Skill.java
98fa3bb1fc3fff3a52292714c22e7316db3de289
[]
no_license
taohyson/Polar
50026903ded017586eac21a7905b0f1c6b160032
b0617f973fd3866bed62da14f63309eee56f6007
refs/heads/master
2021-05-08T12:22:18.884688
2015-12-11T01:44:18
2015-12-11T01:44:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,979
java
package com.game.skill.structs; import org.apache.log4j.Logger; import com.game.data.bean.Q_skill_modelBean; import com.game.data.manager.DataManager; import com.game.object.GameObject; import com.game.player.structs.Player; /** * 技能 * */ public class Skill extends GameObject { /** * Logger for this class */ private static final Logger logger = Logger.getLogger(Skill.class); private static final long serialVersionUID = -4048773480706290213L; /** * 技能模板Id */ private int skillModelId; /** * 技能等级 */ private int skillLevel; /** * 加成过的等级 */ private transient int realLevel; //transient关键字指定其不被序列化 public int getSkillModelId() { return skillModelId; } public void setSkillModelId(int skillModelId) { this.skillModelId = skillModelId; } public int getSkillLevel() { return skillLevel; } public void setSkillLevel(int skillLevel) { this.skillLevel = skillLevel; } /** * 获取 加成过的等级 * @param player * @return */ public int getRealLevel(Player player) { int addlevel = 0; Integer allAdd = player.getSkillLevelUp().get(-1); if (allAdd != null) { addlevel += player.getSkillLevelUp().get(-1); } Integer currentAdd = player.getSkillLevelUp().get(skillModelId); if (currentAdd != null) { addlevel += player.getSkillLevelUp().get(skillModelId); } if (getSkillLevel() + addlevel < 1) { addlevel = 1 - getSkillLevel(); } Q_skill_modelBean model = DataManager.getInstance().q_skill_modelContainer .getMap().get( getSkillModelId() + "_" + (getSkillLevel() + addlevel)); if (model != null) { realLevel = getSkillLevel() + addlevel; return realLevel; } else { // 加成过的技能没有等级判断 if (addlevel != 0) { logger.error("全部加成等级" + allAdd + "当前技能加成" + currentAdd + "找不到等级模型 对应的技能:" + skillModelId); } return skillLevel; } } }
[ "zhuyuanbiao@ZHUYUANBIAO.rd.com" ]
zhuyuanbiao@ZHUYUANBIAO.rd.com
76d62674d2dbb8dbea286a3da2d3723dccf06797
1b89cf336c5163e2e9c8d04a69e12aeffb763c68
/TESTE.jpa/src/main/java/Conexao/dao/AgenciaDAO.java
1450dbe72727c524305ea7f3104617bdd2e5dcf0
[]
no_license
karinykeny/Projeto_Teste_PSC
27da0b7e8f1a000491eb7ada73f1503e6f573625
71aacd888b38dfcf3157f86153697e8fa93ced09
refs/heads/master
2022-06-22T01:13:31.524576
2019-09-23T00:19:59
2019-09-23T00:19:59
207,188,125
0
0
null
2022-02-10T00:27:58
2019-09-08T23:46:28
Java
UTF-8
Java
false
false
101
java
package Conexao.dao; public class AgenciaDAO extends GenericoDAO{ public AgenciaDAO() { } }
[ "karinykeny@gmail.com" ]
karinykeny@gmail.com
4815b802e5424f91598f2929264f4b51a66bf311
146715a4435c363abfed8f4493abe1536e995232
/StuManager/src/com/aitehulian/web/servlet/VerifyCodeServlet.java
74238ee235d5d75f6be101da2531cee68d083a19
[]
no_license
bramble-sea/Sublime
a6d69f071691d8a23c483d174aba3e9a11a9068e
b6d1242ae7950290f5dc0be9c43ac849720b06a1
refs/heads/master
2020-05-16T05:43:24.202852
2016-09-13T13:12:04
2016-09-13T13:12:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,128
java
package com.aitehulian.web.servlet; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Random; import javax.imageio.ImageIO; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.aitehulian.common.Constants; /** * 验证码生成器 * @author qysy * */ public class VerifyCodeServlet extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; private int width=120;//验证码宽 private int height=40;//验证码高 private int codeCount=4;//验证码个数 private int lineCount=10;//干扰线的条数 private int x=0; private int fontHeight;//字体高度 private int codeY; char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'i', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9' }; /** * 初始化验证码图片属性 */ public void init() throws ServletException { //从web.xml中获取初始信息 String strWidth=this.getInitParameter("width"); String strHeight=this.getInitParameter("height"); String strCodeCount=this.getInitParameter("codeCount"); String strLineCount=this.getInitParameter("lineCount"); //将信息转换成数值 try{ if(strWidth!=null&&strWidth.length()>0){ width=Integer.parseInt(strWidth); } if(strHeight!=null&&strHeight.length()>0){ height=Integer.parseInt(strHeight); } if(strCodeCount!=null&&strCodeCount.length()>0){ codeCount=Integer.parseInt(strCodeCount); } if(strLineCount!=null&&strLineCount.length()>0){ lineCount=Integer.parseInt(strLineCount); } }catch(NumberFormatException e){ e.printStackTrace(); } x=width/(codeCount+1); fontHeight=height-2; codeY=height-4; } @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //定义图像buffer BufferedImage buffImg=new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g=buffImg.createGraphics(); //创建一个随机数生成器 Random rand=new Random(); //将图像填充成白色 g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); //创建字体(字体大小根据图片的高度来定) Font font=new Font("Fixedsys",Font.PLAIN,fontHeight); //设置字体 g.setFont(font); //画边框 g.setColor(Color.BLACK); g.drawRect(0, 0, width-1, height-1); //随机产生N条干扰线。 g.setColor(Color.BLACK); for (int i = 0; i < lineCount; i++) { int x=rand.nextInt(width); int y=rand.nextInt(height); int x1=rand.nextInt(20); int y1=rand.nextInt(20); g.drawLine(x, y, x+x1, y+y1); } //randomCode保存随机产生的验证码。 StringBuffer randomCode=new StringBuffer(); int red=0,green=0,blue=0; //随机产生验证码 for (int i = 0; i < codeCount; i++) { String strRand=String.valueOf(codeSequence[rand.nextInt(32)]); //产生随机的颜色分量 red=rand.nextInt(255); green=rand.nextInt(255); blue=rand.nextInt(255); //绘制到图像中 g.setColor(new Color(red, green, blue)); g.drawString(strRand, (i+1)*x, codeY); //四个随机数组合在一起用于校验 randomCode.append(strRand); } HttpSession session=req.getSession(); session.setAttribute(Constants.CODE_VALIDATE_KEY, randomCode.toString()); //禁止图像缓存 resp.setHeader("Pragma", "no-cache"); resp.setHeader("Cache-Control", "no-cache"); resp.setDateHeader("Expires", 0); //设置响应文件类型 resp.setContentType("image/jpeg"); //将图片输出到Servlet输出流中。 ServletOutputStream sos=resp.getOutputStream(); ImageIO.write(buffImg, "jpeg",sos); sos.close(); } }
[ "dai95zhenwei@126.com" ]
dai95zhenwei@126.com
e7c7948f28a6d849a1e94f34b2ad4ea02366ed0a
9b139eea84ca76759d606a437afbc6dcb62ab1e6
/app/src/main/java/oska/joyiochat/rajawali/CupObjRenderer.java
8a70a4d15017acb1eb9dcec604a876b975ae2034
[ "MIT" ]
permissive
TheOska/JoyioChat
1df32e6a4e802674e7424e9d8b0844939e170706
406f8fff47017e96c5348e2965a6c87efef524b7
refs/heads/master
2021-06-18T10:47:19.582694
2017-06-04T10:02:10
2017-06-04T10:02:10
61,275,825
4
0
null
null
null
null
UTF-8
Java
false
false
3,985
java
package oska.joyiochat.rajawali; import android.content.Context; import android.graphics.Color; import android.util.Log; import org.rajawali3d.Object3D; import org.rajawali3d.animation.Animation3D; import org.rajawali3d.cameras.Camera; import org.rajawali3d.lights.DirectionalLight; import org.rajawali3d.lights.PointLight; import org.rajawali3d.loader.LoaderOBJ; import org.rajawali3d.loader.ParsingException; import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.methods.SpecularMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.Texture; import oska.joyiochat.R; import oska.joyiochat.listener.RenderListener; import oska.joyiochat.utils.RajawaliUtils; /** * Created by TheOska on 11/22/2016. */ /** * This class is aiming to setup and config: * 1. Rajawali sense(include light source and camera) * 2. 3D object rendering (include render which object for .obj source) * 3. 3D object moving(changing the 3D object position) */ public class CupObjRenderer extends MovableObjectRenderer { private PointLight mLight; private DirectionalLight mDirectionalLight; private Context context; // Type Object3D can contain more than one 3d elements in one obj file private Object3D mObjectGroup; private Animation3D mLightAnim; private Camera camera; private RenderListener renderListener; private final String TAG = "ObjRender"; private boolean renderCompleted; public CupObjRenderer(Context context) { super(context); this.context = context; setFrameRate(30); this.renderListener = (RenderListener)context; } @Override public void initScene() { renderCompleted = false; camera = getCurrentCamera(); initProjection(); initPicker(); initLighting(); camera.setZ(RajawaliUtils.DEFAULT_CAMERA_Z_POS); LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.deer1_obj); try { objParser.parse(); mObjectGroup = objParser.getParsedObject(); // mObjectGroup.setMaterial(material); } catch (ParsingException e) { e.printStackTrace(); } Material sunGlassesMat1 = new Material(); sunGlassesMat1.setDiffuseMethod(new DiffuseMethod.Lambert()); sunGlassesMat1.setSpecularMethod(new SpecularMethod.Phong(Color.WHITE, 150)); sunGlassesMat1.enableLighting(true); Material sunGlassesMat2 = new Material(); sunGlassesMat2.setDiffuseMethod(new DiffuseMethod.Lambert()); sunGlassesMat2.setSpecularMethod(new SpecularMethod.Phong(Color.WHITE, 150)); sunGlassesMat2.enableLighting(true); try { sunGlassesMat1.addTexture(new Texture("sunGlassesMat1", R.drawable.tear_material)); sunGlassesMat2.addTexture(new Texture("sunGlassesMat2", R.drawable.tear_material)); } catch (ATexture.TextureException e) { e.printStackTrace(); } sunGlassesMat1.setColorInfluence(0); sunGlassesMat2.setColorInfluence(0); for (int i = 0; i < mObjectGroup.getNumChildren(); i++){ Log.d("oska12345" , "mObjectGroup name " + mObjectGroup.getChildAt(i).getName() ); } // mObjectGroup.getChildAt(0).setMaterial(sunGlassesMat1); // mObjectGroup.getChildAt(1).setMaterial(sunGlassesMat2); initObj(0,0,0,0.35f); // setChildOffsetPosX(RajawaliUtils.GLASSES_OBJ_OFFSET_X); // setChildOffsetPosY(RajawaliUtils.GLASSES_OBJ_OFFSET_Y); setupLighting(); renderListener.onRendered(); setRenderCompleted(); // mMediaPlayer.start(); } @Override public Object3D getObject3D() { return mObjectGroup; } @Override public Camera getCamera() { return camera; } }
[ "theoska@outlook.com" ]
theoska@outlook.com
18f98e18cda60b175fb9952bd14768d91c75521d
ddfc19cf6e33ce12cda0b43d4f763b94ffeab658
/test/src/test/java/org/corfudb/runtime/view/stream/StreamAddressSpaceTest.java
18db44f3e6c6ea57ade0077f86b462950cdb6304
[ "Apache-2.0" ]
permissive
awesomeDataTool/CorfuDB
268a5f3c00c611e76b1d0d3b10f26c0dba02c731
0f455a2a93c25aa35e216f2d7c6aea85be3770e4
refs/heads/master
2023-06-01T09:59:32.473079
2021-06-16T17:23:41
2021-06-16T17:23:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,646
java
package org.corfudb.runtime.view.stream; import static org.assertj.core.api.Java6Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.DataInputStream; import java.io.DataOutput; import java.util.Collections; import java.util.stream.LongStream; import com.google.common.collect.ImmutableSet; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufInputStream; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; import org.corfudb.runtime.view.Address; import org.junit.Test; @SuppressWarnings("checkstyle:magicnumber") public class StreamAddressSpaceTest { @Test public void testStreamAddressSpaceMerge() { StreamAddressSpace streamA = new StreamAddressSpace(); final int numStreamAEntries = 100; LongStream.range(0, numStreamAEntries).forEach(streamA::addAddress); assertThat(streamA.getTrimMark()).isEqualTo(Address.NON_ADDRESS); assertThat(streamA.getTail()).isEqualTo(numStreamAEntries - 1); // need to take higher trim mark? StreamAddressSpace streamB = new StreamAddressSpace(); final int numStreamBEntries = 130; LongStream.range(0, numStreamBEntries).forEach(streamB::addAddress); final long streamBTrimMark = 40; streamB.trim(streamBTrimMark); assertThat(streamB.getTrimMark()).isEqualTo(streamBTrimMark); assertThat(streamB.getTail()).isEqualTo(numStreamBEntries - 1); // Merge steamB into streamA and verify that the highest trim mark is // adopted in streamA StreamAddressSpace.merge(streamA, streamB); assertThat(streamA.getTrimMark()).isEqualTo(streamBTrimMark); assertThat(streamA.getTail()).isEqualTo(numStreamBEntries - 1); LongStream.range(streamBTrimMark + 1, numStreamBEntries).forEach(address -> assertThat(streamA.contains(address)).isTrue() ); } @Test public void constructorTest() { StreamAddressSpace obj1 = new StreamAddressSpace(5L, Collections.emptySet()); assertThat(obj1.getTrimMark()).isEqualTo(5L); assertThat(obj1.size()).isEqualTo(0L); StreamAddressSpace obj2 = new StreamAddressSpace(5L, Collections.singleton(6L)); assertThat(obj2.getTrimMark()).isEqualTo(5L); assertThat(obj2.size()).isEqualTo(1L); assertThat(obj2.contains(6L)).isTrue(); StreamAddressSpace obj3 = new StreamAddressSpace(Collections.singleton(6L)); assertThat(obj3.getTrimMark()).isEqualTo(Address.NON_ADDRESS); assertThat(obj3.size()).isEqualTo(1L); assertThat(obj3.contains(6L)).isTrue(); } @Test public void selectTest() { StreamAddressSpace obj1 = new StreamAddressSpace(5L, Collections.emptySet()); assertThrows(IllegalArgumentException.class, () -> obj1.select(0)); obj1.trim(5L); assertThrows(IllegalArgumentException.class, () -> obj1.select(0)); obj1.addAddress(6L); assertThat(obj1.contains(6L)).isTrue(); assertThat(obj1.select(0)).isEqualTo(6L); obj1.addAddress(8L); obj1.trim(6L); assertThat(obj1.select(0)).isEqualTo(8L); obj1.trim(8L); assertThrows(IllegalArgumentException.class, () -> obj1.select(0)); } @Test public void testConstructorTrim() { StreamAddressSpace obj1 = new StreamAddressSpace(2L, ImmutableSet.of(1L, 2L, 3L, 4L)); assertThat(obj1.size()).isEqualTo(2); assertThat(obj1.contains(1L)).isFalse(); assertThat(obj1.contains(2L)).isFalse(); assertThat(obj1.contains(3L)).isTrue(); assertThat(obj1.contains(4L)).isTrue(); assertThat(obj1.contains(-1L)).isFalse(); } @Test public void testTrim() { StreamAddressSpace obj1 = new StreamAddressSpace(ImmutableSet.of(1L, 2L, 3L, 4L)); assertThat(obj1.size()).isEqualTo(4); assertThat(obj1.contains(1L)).isTrue(); assertThat(obj1.contains(2L)).isTrue(); assertThat(obj1.contains(3L)).isTrue(); assertThat(obj1.contains(4L)).isTrue(); obj1.trim(2L); assertThat(obj1.size()).isEqualTo(2); assertThat(obj1.contains(1L)).isFalse(); assertThat(obj1.contains(2L)).isFalse(); assertThat(obj1.contains(3L)).isTrue(); assertThat(obj1.contains(4L)).isTrue(); obj1.trim(4L); assertThat(obj1.size()).isEqualTo(0); assertThat(obj1.contains(3L)).isFalse(); assertThat(obj1.contains(4L)).isFalse(); } @Test public void testCopy() { StreamAddressSpace obj1 = new StreamAddressSpace(); StreamAddressSpace obj1Copy = obj1.copy(); assertThat(obj1Copy.getTrimMark()).isEqualTo(obj1.getTrimMark()); assertThat(obj1Copy.size()).isEqualTo(obj1.size()); assertNotSame(obj1Copy, obj1); StreamAddressSpace obj2 = new StreamAddressSpace(ImmutableSet.of(1L, 2L)); StreamAddressSpace obj2Copy = obj2.copy(); assertThat(obj2Copy.getTrimMark()).isEqualTo(obj2.getTrimMark()); assertThat(obj2Copy.size()).isEqualTo(obj2.size()); assertThat(obj2Copy.contains(1L)).isTrue(); assertThat(obj2Copy.contains(2L)).isTrue(); assertNotSame(obj2Copy, obj2); } @Test public void testToArray() { StreamAddressSpace obj1 = new StreamAddressSpace(3, ImmutableSet.of(1L, 2L, 3L, 4L, 5L)); assertThat(obj1.toArray()).containsExactly(4L, 5L); obj1.trim(5); assertThat(obj1.toArray()).isEmpty(); } @Test @SuppressWarnings("ConstantConditions") public void testEquality() { assertThat(new StreamAddressSpace().equals(null)).isFalse(); assertThat(new StreamAddressSpace().equals(new StreamAddressSpace())).isTrue(); assertThat(new StreamAddressSpace(2L, Collections.emptySet()).equals(new StreamAddressSpace())).isFalse(); assertThat(new StreamAddressSpace(2L, Collections.emptySet()) .equals(new StreamAddressSpace(2L, Collections.emptySet()))).isTrue(); // TODO(Maithem): Re-enable after this fix https://github.com/RoaringBitmap/RoaringBitmap/pull/451 //assertThat(new StreamAddressSpace(2L, Collections.EMPTY_SET) // .equals(new StreamAddressSpace(2L, ImmutableSet.of(1L, 2L)))).isTrue(); assertThat(new StreamAddressSpace(ImmutableSet.of(1L, 2L)) .equals(new StreamAddressSpace(ImmutableSet.of(1L, 2L)))).isTrue(); } @Test public void testStreamSerialization() throws Exception { StreamAddressSpace obj1 = new StreamAddressSpace(3, ImmutableSet.of(1L, 2L, 3L, 4L, 5L)); ByteBuf buf = Unpooled.buffer(); DataOutput output = new ByteBufOutputStream(buf); obj1.serialize(output); DataInputStream inputStream = new DataInputStream(new ByteBufInputStream(buf)); StreamAddressSpace deserialized = StreamAddressSpace.deserialize(inputStream); assertThat(obj1.getTrimMark()).isEqualTo(deserialized.getTrimMark()); assertThat(obj1.size()).isEqualTo(deserialized.size()); assertThat(obj1.toArray()).isEqualTo(deserialized.toArray()); } @Test public void testToString() { StreamAddressSpace sas = new StreamAddressSpace(); assertThat(sas.toString()).isEqualTo("[-6, -6]@-1 size 0"); sas.addAddress(4L); assertThat(sas.toString()).isEqualTo("[4, 4]@-1 size 1"); sas.trim(4L); assertThat(sas.toString()).isEqualTo("[-6, -6]@4 size 0"); } }
[ "noreply@github.com" ]
awesomeDataTool.noreply@github.com
4283dffb8a41eb4dec8403c6ca81454c9c81335b
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/ui/appbrand/b.java
e15c7c90e44c97530315cb2d9f493b0d768b1fa1
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
12,995
java
package com.tencent.mm.ui.appbrand; import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; import android.graphics.Point; import android.os.Bundle; import android.os.Looper; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewStub; import android.view.Window; import android.view.WindowManager.LayoutParams; import android.widget.Button; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.R.e; import com.tencent.mm.R.f; import com.tencent.mm.R.h; import com.tencent.mm.R.i; import com.tencent.mm.R.l; import com.tencent.mm.R.m; import com.tencent.mm.kernel.h; import com.tencent.mm.plugin.voip.widget.MMCheckBox; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMHandlerThread; import com.tencent.mm.sdk.platformtools.MMStack; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.mm.ui.aw; import com.tencent.mm.ui.widget.a.i; import java.util.ArrayList; import java.util.List; public final class b extends i implements DialogInterface { private LinearLayout acrm; private int adNc; private ImageView adNd; private ImageView adNe; private Button adNf; private ViewGroup adNg; private TextView adNh; private TextView adNi; private TextView adNj; private TextView adNk; public List<b> adNl; public a adNm; CompoundButton.OnCheckedChangeListener adNn; private int mMode; private View.OnClickListener mWW; private String sWX; private boolean tYg; private TextView xtJ; public b(Context paramContext, int paramInt, String paramString) { super(paramContext, R.m.TopstoryFeedbackDialog); AppMethodBeat.i(249664); this.adNl = new ArrayList(); this.mWW = new View.OnClickListener() { public final void onClick(View paramAnonymousView) { AppMethodBeat.i(249667); com.tencent.mm.hellhoundlib.b.b localb = new com.tencent.mm.hellhoundlib.b.b(); localb.cH(paramAnonymousView); com.tencent.mm.hellhoundlib.a.a.c("com/tencent/mm/ui/appbrand/AppBrandNoticeMoreDialog$1", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V", this, localb.aYj()); int i = paramAnonymousView.getId(); if (b.a(b.this) != null) { if (i != R.h.fwe) { break label86; } b.a(b.this).jlN(); } for (;;) { com.tencent.mm.hellhoundlib.a.a.a(this, "com/tencent/mm/ui/appbrand/AppBrandNoticeMoreDialog$1", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V"); AppMethodBeat.o(249667); return; label86: if ((i == R.h.fvV) || (i == R.h.fwa)) { b.a(b.this).jlO(); } else if ((i == R.h.fvW) || (i == R.h.fwb)) { b.a(b.this).jlP(); } else if (i == R.h.fwc) { b.a(b.this).esm(); } } } }; this.adNn = new CompoundButton.OnCheckedChangeListener() { public final void onCheckedChanged(CompoundButton paramAnonymousCompoundButton, boolean paramAnonymousBoolean) { AppMethodBeat.i(249668); ((b.b)paramAnonymousCompoundButton.getTag()).wwJ = paramAnonymousBoolean; if (paramAnonymousBoolean) { b.b(b.this); } for (;;) { b.d(b.this); AppMethodBeat.o(249668); return; b.c(b.this); } } }; this.mMode = paramInt; this.sWX = paramString; this.adNc = 0; if (!Util.isNullOrNil(paramString)) { if ((bU(paramString, 0)) || (bU(paramString, 1)) || (bU(paramString, 2))) { bool = true; } this.tYg = bool; } this.acrm = ((LinearLayout)com.tencent.mm.ui.af.mU(paramContext).inflate(R.i.geS, null)); this.adNd = ((ImageView)this.acrm.findViewById(R.h.fvU)); this.adNd.setColorFilter(paramContext.getResources().getColor(R.e.BG_2)); this.adNe = ((ImageView)this.acrm.findViewById(R.h.fvT)); this.adNe.setColorFilter(paramContext.getResources().getColor(R.e.BG_2)); setCanceledOnTouchOutside(true); if (this.mMode == 0) { ((ViewStub)this.acrm.findViewById(R.h.fvZ)).inflate(); this.adNf = ((Button)this.acrm.findViewById(R.h.fwe)); this.adNg = ((ViewGroup)this.acrm.findViewById(R.h.fvY)); this.adNh = ((TextView)this.acrm.findViewById(R.h.fvV)); this.xtJ = ((TextView)this.acrm.findViewById(R.h.fvW)); this.adNf.setOnClickListener(this.mWW); this.adNh.setOnClickListener(this.mWW); this.xtJ.setOnClickListener(this.mWW); paramContext = new ArrayList(); paramString = this.acrm.getContext(); paramContext.add(new b(1, paramString.getString(R.l.gwN))); paramContext.add(new b(2, paramString.getString(R.l.gwM))); paramContext.add(new b(3, paramString.getString(R.l.gwO))); nk(paramContext); AppMethodBeat.o(249664); return; } ((ViewStub)this.acrm.findViewById(R.h.fwd)).inflate(); this.adNi = ((TextView)this.acrm.findViewById(R.h.fwc)); this.adNj = ((TextView)this.acrm.findViewById(R.h.fwa)); this.adNk = ((TextView)this.acrm.findViewById(R.h.fwb)); if (this.tYg) { this.adNi.setOnClickListener(this.mWW); } for (;;) { this.adNj.setOnClickListener(this.mWW); this.adNk.setOnClickListener(this.mWW); AppMethodBeat.o(249664); return; this.adNi.setVisibility(8); } } private void Lx(boolean paramBoolean) { AppMethodBeat.i(249679); if (paramBoolean) { this.adNd.setVisibility(0); this.adNe.setVisibility(8); AppMethodBeat.o(249679); return; } this.adNd.setVisibility(8); this.adNe.setVisibility(0); AppMethodBeat.o(249679); } private MMCheckBox a(Context paramContext, b paramb) { AppMethodBeat.i(249673); MMCheckBox localMMCheckBox = new MMCheckBox(new ContextThemeWrapper(paramContext, R.m.gZr), null, R.m.gZr); localMMCheckBox.setText(paramb.displayName); localMMCheckBox.setTag(paramb); localMMCheckBox.setTextSize(0, com.tencent.mm.cd.a.br(paramContext, R.f.SmallTextSize)); localMMCheckBox.setOnCheckedChangeListener(this.adNn); AppMethodBeat.o(249673); return localMMCheckBox; } private static boolean bU(String paramString, int paramInt) { AppMethodBeat.i(249682); boolean bool = ((com.tencent.mm.plugin.appbrand.appusage.af)h.ax(com.tencent.mm.plugin.appbrand.appusage.af.class)).bP(paramString, paramInt); AppMethodBeat.o(249682); return bool; } private void nk(List<b> paramList) { AppMethodBeat.i(249670); if (paramList.isEmpty()) { Log.i("MicroMsg.AppBrandNoticeMoreDialog", "has no reason data"); AppMethodBeat.o(249670); return; } this.adNl.clear(); this.adNl.addAll(paramList); Context localContext = this.acrm.getContext(); LinearLayout localLinearLayout = new LinearLayout(localContext); int i = 0; LinearLayout.LayoutParams localLayoutParams; Object localObject; while (i < paramList.size() / 3) { localLinearLayout.setOrientation(0); j = 0; while (j < 3) { localLayoutParams = new LinearLayout.LayoutParams(-2, localContext.getResources().getDimensionPixelOffset(R.f.NormalIconSize)); localObject = a(localContext, (b)paramList.get(i * 3 + j)); if (j != 0) { localLayoutParams.leftMargin = localContext.getResources().getDimensionPixelOffset(R.f.Edge_1_5_A); } localLinearLayout.addView((View)localObject, localLayoutParams); j += 1; } i += 1; } this.adNg.addView(localLinearLayout); localLinearLayout = new LinearLayout(localContext); int j = 0; while (j < paramList.size() - i * 3) { localObject = (b)paramList.get(i * 3 + j); localLinearLayout.setOrientation(0); localLayoutParams = new LinearLayout.LayoutParams(-2, localContext.getResources().getDimensionPixelOffset(R.f.NormalIconSize)); localObject = a(localContext, (b)localObject); if (j != 0) { localLayoutParams.leftMargin = localContext.getResources().getDimensionPixelOffset(R.f.Edge_1_5_A); } localLinearLayout.addView((View)localObject, localLayoutParams); j += 1; } this.adNg.addView(localLinearLayout); AppMethodBeat.o(249670); } public final void dismiss() { AppMethodBeat.i(249693); if (Looper.myLooper() != Looper.getMainLooper()) { MMHandlerThread.postToMainThread(new Runnable() { public final void run() { AppMethodBeat.i(249674); b.this.dismiss(); AppMethodBeat.o(249674); } }); Log.e("MicroMsg.AppBrandNoticeMoreDialog", Util.getStack().toString()); AppMethodBeat.o(249693); return; } try { super.dismiss(); AppMethodBeat.o(249693); return; } catch (Exception localException) { Log.e("MicroMsg.AppBrandNoticeMoreDialog", "dismiss exception, e = " + localException.getMessage()); AppMethodBeat.o(249693); } } public final void lc(View paramView) { AppMethodBeat.i(249692); Context localContext = paramView.getContext(); Point localPoint = aw.bf(localContext); int i; Window localWindow; WindowManager.LayoutParams localLayoutParams; int[] arrayOfInt; int j; int k; int m; if (this.mMode == 0) { i = com.tencent.mm.cd.a.bs(localContext, R.f.flx) + com.tencent.mm.cd.a.bs(localContext, R.f.flv) + com.tencent.mm.cd.a.bs(localContext, R.f.flu); localWindow = getWindow(); if (localWindow != null) { localLayoutParams = localWindow.getAttributes(); localLayoutParams.gravity = 8388661; localLayoutParams.verticalMargin = 0.0F; localLayoutParams.horizontalMargin = 0.0F; arrayOfInt = new int[2]; paramView.getLocationOnScreen(arrayOfInt); localLayoutParams.x = (localPoint.x - arrayOfInt[0] - paramView.getMeasuredWidth() / 2 - com.tencent.mm.cd.a.bs(localContext, R.f.flt) - com.tencent.mm.cd.a.bs(localContext, R.f.flv) / 2); j = aw.mL(localContext); k = com.tencent.mm.cd.a.bs(localContext, R.f.fly); m = com.tencent.mm.cd.a.bs(localContext, R.f.flw); if (arrayOfInt[1] + paramView.getMeasuredHeight() + i + k - m <= localPoint.y - aw.bk(localContext)) { break label293; } localLayoutParams.y = (arrayOfInt[1] - j - i - k + m); Lx(false); } } for (;;) { localWindow.setAttributes(localLayoutParams); try { super.show(); AppMethodBeat.o(249692); return; } catch (Exception paramView) { Log.printErrStackTrace("MicroMsg.AppBrandNoticeMoreDialog", paramView, "", new Object[0]); AppMethodBeat.o(249692); } j = com.tencent.mm.cd.a.bs(localContext, R.f.flz) + com.tencent.mm.cd.a.bs(localContext, R.f.flv) + com.tencent.mm.cd.a.bs(localContext, R.f.flu); i = j; if (this.tYg) { break; } i = j - com.tencent.mm.cd.a.bs(localContext, R.f.flA); break; label293: localLayoutParams.y = (arrayOfInt[1] - j + paramView.getMeasuredHeight() + k - m); Lx(true); } } protected final void onCreate(Bundle paramBundle) { AppMethodBeat.i(249688); super.onCreate(paramBundle); setContentView(this.acrm); AppMethodBeat.o(249688); } public static abstract interface a { public abstract void esm(); public abstract void jlN(); public abstract void jlO(); public abstract void jlP(); } public final class b { public int adNp; public String displayName; public boolean wwJ; public b(int paramInt, String paramString) { this.adNp = paramInt; this.displayName = paramString; this.wwJ = false; } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes6.jar * Qualified Name: com.tencent.mm.ui.appbrand.b * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
b3a4a34e3d373e2f991ec7a532fb95eb8df44d05
677197bbd8a9826558255b8ec6235c1e16dd280a
/src/fm/qingting/qtradio/model/DataCenterInfo.java
ab210942a1d297bb0f4d4dfc68d137190e17bdba
[]
no_license
xiaolongyuan/QingTingCheat
19fcdd821650126b9a4450fcaebc747259f41335
989c964665a95f512964f3fafb3459bec7e4125a
refs/heads/master
2020-12-26T02:31:51.506606
2015-11-11T08:12:39
2015-11-11T08:12:39
45,967,303
0
1
null
2015-11-11T07:47:59
2015-11-11T07:47:59
null
UTF-8
Java
false
false
2,473
java
package fm.qingting.qtradio.model; import fm.qingting.qtradio.log.LogModule; import fm.qingting.qtradio.logger.QTLogger; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class DataCenterInfo { private Map<String, List<String>> mapBestDataCenter = new HashMap(); public Map<String, List<PingInfo>> mapServiceInfo; public List<String> getBestDataCenterByName(String paramString) { Object localObject; if (paramString == null) localObject = null; do { return localObject; if (!this.mapBestDataCenter.containsKey(paramString)) break; localObject = (List)this.mapBestDataCenter.get(paramString); } while (localObject != null); if (this.mapServiceInfo != null) { List localList = (List)this.mapServiceInfo.get(paramString); if ((localList == null) || (localList.size() == 0)) return null; Collections.sort(localList, new PingInfoComparator()); ArrayList localArrayList1 = new ArrayList(); ArrayList localArrayList2 = new ArrayList(); int i = 0; if (i < localList.size()) { if (!((PingInfo)localList.get(i)).hasPinged()) return null; String str2 = ((PingInfo)localList.get(i)).getBestMDomainIP(); if ((str2 != null) && (!str2.equalsIgnoreCase(""))) { if (!paramString.equalsIgnoreCase("download")) break label239; localArrayList1.add(0, str2); localArrayList2.add(0, Long.valueOf(((PingInfo)localList.get(i)).getBestMDomainTime() + 2L * ((PingInfo)localList.get(i)).getTotalBackUPSTime())); } while (true) { i++; break; label239: localArrayList1.add(str2); localArrayList2.add(Long.valueOf(((PingInfo)localList.get(i)).getBestMDomainTime() + 2L * ((PingInfo)localList.get(i)).getTotalBackUPSTime())); } } String str1 = QTLogger.getInstance().buildSpeedTest(paramString, localArrayList1, localArrayList2); if (str1 != null) LogModule.getInstance().send("SpeedTestResult", str1); this.mapBestDataCenter.put(paramString, localArrayList1); return localArrayList1; } return null; } } /* Location: /Users/zhangxun-xy/Downloads/qingting2/classes_dex2jar.jar * Qualified Name: fm.qingting.qtradio.model.DataCenterInfo * JD-Core Version: 0.6.2 */
[ "cnzx219@qq.com" ]
cnzx219@qq.com
9bbe8e6f7cb88b570e2b7b4e7852f1ee3b059d12
d9e875db56ce72e1a1d4e8148086db24ab82947b
/bildit/helloworld/servlet/HellowWorldServlet.java
ea7ff36c01e42ed2e3507c9e827949587d1d910d
[]
no_license
jadilovic/Exercises20.1
52cd5709fa04fb46ba9494e386392a4e8282ba38
7aa8f74187d7a827256257c8e91185676622927b
refs/heads/master
2020-08-14T10:16:31.590393
2019-10-17T13:51:46
2019-10-17T13:51:46
215,149,248
0
0
null
null
null
null
UTF-8
Java
false
false
1,660
java
package bildit.helloworld.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class HellowWorldServlet */ @WebServlet("/HelloServlet") public class HellowWorldServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public HellowWorldServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // napraviti novi PrintWriter objekt za ispis odgovora PrintWriter out = response.getWriter(); Date datum = new Date(); // odgovor za ispisati u browseru out.println("<html>"); out.println("<body>"); out.println("<h1>Hello World</h1>"); out.println("<p>Simple servlet</p>"); out.println("<p>Todays date is</p>" + datum + "<p>Bosnian Time</p>"); out.println("</body>"); out.println("</html>"); // zatvoriti PrintWriter out.close(); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "adilovic79@yahoo.com" ]
adilovic79@yahoo.com
b8ccb388d3ffff1b8b40eaab754f027826a64a38
b6152e4bfe141191c172a0c5c960d228f89c794c
/Legacy_Parser/commons-io-2.5-src-for-test/src/main/java/org/apache/commons/io/input/TailerListenerAdapter.java
74c9404599460f0191571f8d85ea2c8b1dc4a399
[ "Apache-2.0" ]
permissive
5pecia1/DeepAPISearcher
2e94957bee141520144a5bd975535c7486977111
df3291386bc4ddc538720a82c5eb9de182d79bdc
refs/heads/master
2021-06-21T19:53:16.512948
2017-08-23T10:56:57
2017-08-23T10:56:57
83,258,989
1
0
null
null
null
null
UTF-8
Java
false
false
2,369
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.io.input; /** * {@link TailerListener} Adapter. * * @version $Id: TailerListenerAdapter.java 1714076 2015-11-12 16:06:41Z krosenvold $ * @since 2.0 */ public class TailerListenerAdapter implements TailerListener { /** * The tailer will call this method during construction, * giving the listener a method of stopping the tailer. * @param tailer the tailer. */ public void init(final Tailer tailer) { } /** * This method is called if the tailed file is not found. */ public void fileNotFound() { } /** * Called if a file rotation is detected. * * This method is called before the file is reopened, and fileNotFound may * be called if the new file has not yet been created. */ public void fileRotated() { } /** * Handles a line from a Tailer. * @param line the line. */ public void handle(final String line) { } /** * Handles an Exception . * @param ex the exception. */ public void handle(final Exception ex) { } /** * Called each time the Tailer reaches the end of the file. * * <b>Note:</b> this is called from the tailer thread. * * Note: a future version of commons-io will pull this method up to the TailerListener interface, * for now clients must subclass this class to use this feature. * * @since 2.5 */ public void endOfFileReached() { } }
[ "5o1.3an9@gmail.com" ]
5o1.3an9@gmail.com
1265148756209eff5c3a9a4464df4efdf30cb785
6499f0301c1afd7029b8d2675dad5f3586a7d98b
/JavaLayout/app/src/test/java/com/getapp/javalayout/ExampleUnitTest.java
58a3b3fc3695066c0c0ee0964289ffb83883748d
[]
no_license
rajdeep114/AndroidAppDevelopment
19e276a222d14ab6edd659259503820bb56d3199
9d365223bcc55f1d95723c745fcffbec0b125692
refs/heads/master
2021-01-10T05:39:19.953430
2016-03-14T23:44:43
2016-03-14T23:44:43
51,803,745
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.getapp.javalayout; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "rajdeep114@gmail.com" ]
rajdeep114@gmail.com
407bf5c8258518d00f7972723ca3a4ce0b2b26cf
4431b22e1e2fae49e1e011d6125cfbcb04b9a15b
/JAVA/Project2/src/com/VTI/backend/datalayer/ProjectTeam_Repository.java
36c7c3126576f268f6ab7548c509107e92a8db7a
[]
no_license
vipblank/NDP_91
4efc11e0d9a5ea283dbacb64b0e2c884d5f41bda
3d3e584993d4eb2cd73da85877e6dc27ac48c2ac
refs/heads/master
2023-04-27T06:30:02.834634
2021-05-20T14:18:44
2021-05-20T14:18:44
351,673,381
0
0
null
null
null
null
UTF-8
Java
false
false
4,184
java
package com.VTI.backend.datalayer; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.VTI.entity.Employee; import com.VTI.entity.Manager; import com.VTI.entity.Project; import com.VTI.entity.ProjectTeam; import com.VTI.ultis.jdbcUltis; public class ProjectTeam_Repository implements IProjectTeam_Repository{ private jdbcUltis jdbc; public ProjectTeam_Repository() throws FileNotFoundException, IOException { jdbc = new jdbcUltis(); } @Override public List<ProjectTeam> ProjectTeamInfor1(int id) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException { String sql = "SELECT pjt.ProjectID, pjt.ManagerID, mg.Fullname AS mgName, pjt.EmployeeID, ep.Fullname AS epName FROM db_quanlynhanvien.projectteam pjt\r\n" + "INNER JOIN employee ep ON ep.EmployeeID = pjt.EmployeeID\r\n" + "INNER JOIN manager mg ON mg.ManagerID = pjt.ManagerID\r\n" + "WHERE pjt.ProjectID = ?\r\n" + "ORDER BY pjt.ProjectID;"; PreparedStatement preparedStatement = jdbc.createPrepareStatement(sql); preparedStatement.setInt(1, id); ResultSet resultSet = preparedStatement.executeQuery(); List<ProjectTeam> listPjTeam = new ArrayList<ProjectTeam>(); while (resultSet.next()) { ProjectTeam projectTeam = new ProjectTeam(); Manager_Repository manager_Repository = new Manager_Repository(); Employee_repository employee_repository = new Employee_repository(); Project_Repository project_Repository = new Project_Repository(); Project project = project_Repository.GetProjectbyID(resultSet.getInt(1)); projectTeam.setProject(project); Manager manager = manager_Repository.GetManagerbyID(resultSet.getInt(2)); projectTeam.setManager(manager); Manager manager1 = manager_Repository.GetManagerbyName(resultSet.getString(3)); projectTeam.setManager1(manager1); Employee employee = employee_repository.GetEmployeebyID(resultSet.getInt(4)); projectTeam.setEmployee(employee); Employee employee1 = employee_repository.GetEmployeeByName(resultSet.getString(5)); projectTeam.setEmployee1(employee1); listPjTeam.add(projectTeam); } return listPjTeam; } @Override public List<ProjectTeam> ProjectTeamInfor(String PjName) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException { String sql = "SELECT pjt.ProjectID, pj.ProjectName, pjt.ManagerID, mg.Fullname AS mgName, pjt.EmployeeID, ep.Fullname AS epName FROM db_quanlynhanvien.projectteam pjt\r\n" + "INNER JOIN employee ep ON ep.EmployeeID = pjt.EmployeeID\r\n" + "INNER JOIN manager mg ON mg.ManagerID = pjt.ManagerID\r\n" + "INNER JOIN project pj ON pj.ProjectID = pjt.ProjectID\r\n" + "WHERE pj.ProjectName = ?;"; PreparedStatement preparedStatement = jdbc.createPrepareStatement(sql); preparedStatement.setString(1, PjName); ResultSet resultSet = preparedStatement.executeQuery(); List<ProjectTeam> listPjTeam = new ArrayList<ProjectTeam>(); while (resultSet.next()) { ProjectTeam projectTeam = new ProjectTeam(); Manager_Repository manager_Repository = new Manager_Repository(); Employee_repository employee_repository = new Employee_repository(); Project_Repository project_Repository = new Project_Repository(); Project project = project_Repository.GetProjectbyID(resultSet.getInt(1)); projectTeam.setProject(project); Project project1 = project_Repository.GetProjectbyName(resultSet.getString(2)); projectTeam.setProject1(project1); Manager manager = manager_Repository.GetManagerbyID(resultSet.getInt(3)); projectTeam.setManager(manager); Manager manager1 = manager_Repository.GetManagerbyName(resultSet.getString(4)); projectTeam.setManager1(manager1); Employee employee = employee_repository.GetEmployeebyID(resultSet.getInt(5)); projectTeam.setEmployee(employee); Employee employee1 = employee_repository.GetEmployeeByName(resultSet.getString(6)); projectTeam.setEmployee1(employee1); listPjTeam.add(projectTeam); } return listPjTeam; } }
[ "nguyenphuongtccs@gmail.com" ]
nguyenphuongtccs@gmail.com
533ef3b5e5d2f490563694e22770dee8eb21830f
8655bc778c4d4f1388badbbdd3486e069069b29f
/dominioDoProblema/Troglodita.java
4acad8173acd4cfdd54258f180ce32e35c28b1d3
[]
no_license
igorVinicius/Troglodytes
b44e6bfb0f31a0e9a83240146f2b48fecca91296
25816a32fb0c765b3b046cb4ed91b6ae09298ca9
refs/heads/master
2016-09-06T03:17:13.104278
2013-07-18T04:13:05
2013-07-18T04:13:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package dominioDoProblema; public class Troglodita { protected Posicao posicaoOcupada; protected Jogador jogadorDono; public Posicao peguePosicao() { return posicaoOcupada; } public void definaPosicao(Posicao posicao){ this.posicaoOcupada = posicao; } public boolean jogadorDono(Jogador possivelDono) { return possivelDono == jogadorDono; } public void defineJogadorDono(Jogador novoDono){ jogadorDono = novoDono; } public boolean retorneSimbolo() { return jogadorDono.obterSimbolo(); } }
[ "igorvinicius.rt@gmail.com" ]
igorvinicius.rt@gmail.com
329ea6c40597c326037baafefbc6eb76b92753c6
ae79a6e216e510d1aeeb9cc704bd8704db1d894b
/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PersistentTopicTest.java
a687381090d59ef70ae6777287f5d56157753df6
[ "LicenseRef-scancode-protobuf", "Apache-2.0", "LicenseRef-scancode-unknown" ]
permissive
Huanli-Meng/pulsar
51098ab1bb76d44c0f1d2f19a0c2db90c564818f
c73285205dafaf5bed827ad99f7fb8edd3ddb7f2
refs/heads/master
2022-10-15T19:55:52.867692
2022-10-13T06:46:14
2022-10-13T06:46:14
232,692,976
0
2
Apache-2.0
2020-01-09T01:13:46
2020-01-09T01:13:45
null
UTF-8
Java
false
false
18,726
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.pulsar.broker.service.persistent; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import java.io.ByteArrayOutputStream; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import lombok.Cleanup; import org.apache.bookkeeper.client.LedgerHandle; import org.apache.bookkeeper.mledger.ManagedLedger; import org.apache.pulsar.broker.service.BrokerTestBase; import org.apache.pulsar.broker.stats.PrometheusMetricsTest; import org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsGenerator; import org.apache.pulsar.client.api.*; import org.apache.pulsar.common.naming.NamespaceBundle; import org.apache.pulsar.common.naming.TopicName; import org.apache.pulsar.common.policies.data.Policies; import org.apache.pulsar.common.policies.data.TopicStats; import org.awaitility.Awaitility; import org.junit.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @Test(groups = "broker") public class PersistentTopicTest extends BrokerTestBase { @BeforeMethod(alwaysRun = true) @Override protected void setup() throws Exception { super.baseSetup(); } @AfterMethod(alwaysRun = true) @Override protected void cleanup() throws Exception { super.internalCleanup(); } /** * Test validates that broker cleans up topic which failed to unload while bundle unloading. * * @throws Exception */ @Test public void testCleanFailedUnloadTopic() throws Exception { final String topicName = "persistent://prop/ns-abc/failedUnload"; // 1. producer connect Producer<byte[]> producer = pulsarClient.newProducer().topic(topicName).enableBatching(false) .messageRoutingMode(MessageRoutingMode.SinglePartition).create(); PersistentTopic topicRef = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get(); assertNotNull(topicRef); ManagedLedger ml = topicRef.ledger; LedgerHandle ledger = mock(LedgerHandle.class); Field handleField = ml.getClass().getDeclaredField("currentLedger"); handleField.setAccessible(true); handleField.set(ml, ledger); doNothing().when(ledger).asyncClose(any(), any()); NamespaceBundle bundle = pulsar.getNamespaceService().getBundle(TopicName.get(topicName)); pulsar.getNamespaceService().unloadNamespaceBundle(bundle, 5, TimeUnit.SECONDS).get(); retryStrategically((test) -> !pulsar.getBrokerService().getTopicReference(topicName).isPresent(), 5, 500); assertFalse(pulsar.getBrokerService().getTopicReference(topicName).isPresent()); producer.close(); } /** * Test validates if topic's dispatcher is stuck then broker can doscover and unblock it. * * @throws Exception */ @Test public void testUnblockStuckSubscription() throws Exception { final String topicName = "persistent://prop/ns-abc/stuckSubscriptionTopic"; final String sharedSubName = "shared"; final String failoverSubName = "failOver"; Consumer<String> consumer1 = pulsarClient.newConsumer(Schema.STRING).topic(topicName) .subscriptionType(SubscriptionType.Shared).subscriptionName(sharedSubName).subscribe(); Consumer<String> consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName) .subscriptionType(SubscriptionType.Failover).subscriptionName(failoverSubName).subscribe(); Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName).create(); PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get(); PersistentSubscription sharedSub = topic.getSubscription(sharedSubName); PersistentSubscription failOverSub = topic.getSubscription(failoverSubName); PersistentDispatcherMultipleConsumers sharedDispatcher = (PersistentDispatcherMultipleConsumers) sharedSub .getDispatcher(); PersistentDispatcherSingleActiveConsumer failOverDispatcher = (PersistentDispatcherSingleActiveConsumer) failOverSub .getDispatcher(); // build backlog consumer1.close(); consumer2.close(); // block sub to read messages sharedDispatcher.havePendingRead = true; failOverDispatcher.havePendingRead = true; producer.newMessage().value("test").eventTime(5).send(); producer.newMessage().value("test").eventTime(5).send(); consumer1 = pulsarClient.newConsumer(Schema.STRING).topic(topicName).subscriptionType(SubscriptionType.Shared) .subscriptionName(sharedSubName).subscribe(); consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName).subscriptionType(SubscriptionType.Failover) .subscriptionName(failoverSubName).subscribe(); Message<String> msg = consumer1.receive(2, TimeUnit.SECONDS); assertNull(msg); msg = consumer2.receive(2, TimeUnit.SECONDS); assertNull(msg); // allow reads but dispatchers are still blocked sharedDispatcher.havePendingRead = false; failOverDispatcher.havePendingRead = false; // run task to unblock stuck dispatcher: first iteration sets the lastReadPosition and next iteration will // unblock the dispatcher read because read-position has not been moved since last iteration. sharedSub.checkAndUnblockIfStuck(); failOverDispatcher.checkAndUnblockIfStuck(); assertTrue(sharedSub.checkAndUnblockIfStuck()); assertTrue(failOverDispatcher.checkAndUnblockIfStuck()); msg = consumer1.receive(5, TimeUnit.SECONDS); assertNotNull(msg); msg = consumer2.receive(5, TimeUnit.SECONDS); assertNotNull(msg); } @Test public void testDeleteNamespaceInfiniteRetry() throws Exception { //init namespace final String myNamespace = "prop/ns" + UUID.randomUUID(); admin.namespaces().createNamespace(myNamespace, Sets.newHashSet("test")); final String topic = "persistent://" + myNamespace + "/testDeleteNamespaceInfiniteRetry"; conf.setForceDeleteNamespaceAllowed(true); //init topic and policies pulsarClient.newProducer().topic(topic).create().close(); admin.namespaces().setMaxConsumersPerTopic(myNamespace, 0); Awaitility.await().atMost(3, TimeUnit.SECONDS).until(() -> admin.namespaces().getMaxConsumersPerTopic(myNamespace) == 0); PersistentTopic persistentTopic = spy((PersistentTopic) pulsar.getBrokerService().getTopicIfExists(topic).get().get()); Policies policies = new Policies(); policies.deleted = true; persistentTopic.onPoliciesUpdate(policies); verify(persistentTopic, times(0)).checkReplicationAndRetryOnFailure(); policies.deleted = false; persistentTopic.onPoliciesUpdate(policies); verify(persistentTopic, times(1)).checkReplicationAndRetryOnFailure(); } @Test public void testAccumulativeStats() throws Exception { final String topicName = "persistent://prop/ns-abc/aTopic"; final String sharedSubName = "shared"; final String failoverSubName = "failOver"; Consumer<String> consumer1 = pulsarClient.newConsumer(Schema.STRING).topic(topicName) .subscriptionType(SubscriptionType.Shared).subscriptionName(sharedSubName).subscribe(); Consumer<String> consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName) .subscriptionType(SubscriptionType.Failover).subscriptionName(failoverSubName).subscribe(); Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName).create(); PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get(); // stats are at zero before any activity TopicStats stats = topic.getStats(false, false, false); assertEquals(stats.getBytesInCounter(), 0); assertEquals(stats.getMsgInCounter(), 0); assertEquals(stats.getBytesOutCounter(), 0); assertEquals(stats.getMsgOutCounter(), 0); producer.newMessage().value("test").eventTime(5).send(); Message<String> msg = consumer1.receive(); assertNotNull(msg); msg = consumer2.receive(); assertNotNull(msg); // send/receive result in non-zero stats TopicStats statsBeforeUnsubscribe = topic.getStats(false, false, false); assertTrue(statsBeforeUnsubscribe.getBytesInCounter() > 0); assertTrue(statsBeforeUnsubscribe.getMsgInCounter() > 0); assertTrue(statsBeforeUnsubscribe.getBytesOutCounter() > 0); assertTrue(statsBeforeUnsubscribe.getMsgOutCounter() > 0); consumer1.unsubscribe(); consumer2.unsubscribe(); producer.close(); topic.getProducers().values().forEach(topic::removeProducer); assertEquals(topic.getProducers().size(), 0); // consumer unsubscribe/producer removal does not result in stats loss TopicStats statsAfterUnsubscribe = topic.getStats(false, false, false); assertEquals(statsAfterUnsubscribe.getBytesInCounter(), statsBeforeUnsubscribe.getBytesInCounter()); assertEquals(statsAfterUnsubscribe.getMsgInCounter(), statsBeforeUnsubscribe.getMsgInCounter()); assertEquals(statsAfterUnsubscribe.getBytesOutCounter(), statsBeforeUnsubscribe.getBytesOutCounter()); assertEquals(statsAfterUnsubscribe.getMsgOutCounter(), statsBeforeUnsubscribe.getMsgOutCounter()); } @Test public void testPersistentPartitionedTopicUnload() throws Exception { final String topicName = "persistent://prop/ns/failedUnload"; final String ns = "prop/ns"; final int partitions = 5; final int producers = 1; // ensure that the number of bundle is greater than 1 final int bundles = 2; admin.namespaces().createNamespace(ns, bundles); admin.topics().createPartitionedTopic(topicName, partitions); List<Producer> producerSet = new ArrayList<>(); for (int i = 0; i < producers; i++) { producerSet.add(pulsarClient.newProducer(Schema.STRING).topic(topicName).create()); } assertFalse(pulsar.getBrokerService().getTopics().containsKey(topicName)); pulsar.getBrokerService().getTopicIfExists(topicName).get(); assertTrue(pulsar.getBrokerService().getTopics().containsKey(topicName)); // ref of partitioned-topic name should be empty assertFalse(pulsar.getBrokerService().getTopicReference(topicName).isPresent()); NamespaceBundle bundle = pulsar.getNamespaceService().getBundle(TopicName.get(topicName)); pulsar.getNamespaceService().unloadNamespaceBundle(bundle, 5, TimeUnit.SECONDS).get(); for (Producer producer : producerSet) { producer.close(); } } @DataProvider(name = "topicAndMetricsLevel") public Object[][] indexPatternTestData() { return new Object[][]{ new Object[] {"persistent://prop/autoNs/test_delayed_message_metric", true}, new Object[] {"persistent://prop/autoNs/test_delayed_message_metric", false}, }; } @Test(dataProvider = "topicAndMetricsLevel") public void testDelayedDeliveryTrackerMemoryUsageMetric(String topic, boolean exposeTopicLevelMetrics) throws Exception { PulsarClient client = pulsar.getClient(); String namespace = TopicName.get(topic).getNamespace(); admin.namespaces().createNamespace(namespace); final int messages = 100; CountDownLatch latch = new CountDownLatch(messages); @Cleanup Producer<String> producer = client.newProducer(Schema.STRING).topic(topic).enableBatching(false).create(); @Cleanup Consumer<String> consumer = client.newConsumer(Schema.STRING) .topic(topic) .subscriptionName("test_sub") .subscriptionType(SubscriptionType.Shared) .messageListener((MessageListener<String>) (consumer1, msg) -> { try { latch.countDown(); consumer1.acknowledge(msg); } catch (PulsarClientException e) { e.printStackTrace(); } }) .subscribe(); for (int a = 0; a < messages; a++) { producer.newMessage() .value(UUID.randomUUID().toString()) .deliverAfter(30, TimeUnit.SECONDS) .sendAsync(); } producer.flush(); latch.await(10, TimeUnit.SECONDS); ByteArrayOutputStream output = new ByteArrayOutputStream(); PrometheusMetricsGenerator.generate(pulsar, exposeTopicLevelMetrics, true, true, output); String metricsStr = output.toString(StandardCharsets.UTF_8); Multimap<String, PrometheusMetricsTest.Metric> metricsMap = PrometheusMetricsTest.parseMetrics(metricsStr); Collection<PrometheusMetricsTest.Metric> metrics = metricsMap.get("pulsar_delayed_message_index_size_bytes"); Assert.assertTrue(metrics.size() > 0); int topicLevelNum = 0; int namespaceLevelNum = 0; for (PrometheusMetricsTest.Metric metric : metrics) { if (exposeTopicLevelMetrics && metric.tags.get("topic").equals(topic)) { Assert.assertTrue(metric.value > 0); topicLevelNum++; } else if (!exposeTopicLevelMetrics && metric.tags.get("namespace").equals(namespace)) { Assert.assertTrue(metric.value > 0); namespaceLevelNum++; } } if (exposeTopicLevelMetrics) { Assert.assertTrue(topicLevelNum > 0); Assert.assertEquals(0, namespaceLevelNum); } else { Assert.assertTrue(namespaceLevelNum > 0); Assert.assertEquals(topicLevelNum, 0); } } @Test public void testUpdateCursorLastActive() throws Exception { final String topicName = "persistent://prop/ns-abc/aTopic"; final String sharedSubName = "shared"; final String failoverSubName = "failOver"; long beforeAddConsumerTimestamp = System.currentTimeMillis(); Thread.sleep(1); Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING).topic(topicName) .subscriptionType(SubscriptionType.Shared).subscriptionName(sharedSubName) .acknowledgmentGroupTime(0, TimeUnit.MILLISECONDS).subscribe(); Consumer<String> consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName) .subscriptionType(SubscriptionType.Failover).subscriptionName(failoverSubName) .acknowledgmentGroupTime(0, TimeUnit.MILLISECONDS).subscribe(); Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName).create(); PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get(); PersistentSubscription persistentSubscription = topic.getSubscription(sharedSubName); PersistentSubscription persistentSubscription2 = topic.getSubscription(failoverSubName); // `addConsumer` should update last active assertTrue(persistentSubscription.getCursor().getLastActive() > beforeAddConsumerTimestamp); assertTrue(persistentSubscription2.getCursor().getLastActive() > beforeAddConsumerTimestamp); long beforeAckTimestamp = System.currentTimeMillis(); Thread.sleep(1); producer.newMessage().value("test").send(); Message<String> msg = consumer.receive(); assertNotNull(msg); consumer.acknowledge(msg); msg = consumer2.receive(); assertNotNull(msg); consumer2.acknowledge(msg); // Make sure ack commands have been sent to broker Awaitility.waitAtMost(5, TimeUnit.SECONDS) .until(() -> persistentSubscription.getCursor().getLastActive() > beforeAckTimestamp); Awaitility.waitAtMost(5, TimeUnit.SECONDS) .until(() -> persistentSubscription2.getCursor().getLastActive() > beforeAckTimestamp); // `acknowledgeMessage` should update last active assertTrue(persistentSubscription.getCursor().getLastActive() > beforeAckTimestamp); assertTrue(persistentSubscription2.getCursor().getLastActive() > beforeAckTimestamp); long beforeRemoveConsumerTimestamp = System.currentTimeMillis(); Thread.sleep(1); consumer.unsubscribe(); consumer2.unsubscribe(); producer.close(); // `removeConsumer` should update last active assertTrue(persistentSubscription.getCursor().getLastActive() > beforeRemoveConsumerTimestamp); assertTrue(persistentSubscription2.getCursor().getLastActive() > beforeRemoveConsumerTimestamp); } }
[ "noreply@github.com" ]
Huanli-Meng.noreply@github.com
f7016a19be1d8e0036d98ce2930d899763007441
93cde80c42d0c65581c6bf1740d91cd726fe9189
/LibTest/src/main/java/com/springpractice/libtest/NewMain.java
022f7e181b83942c9a52b074a2554fe1805aa3e0
[]
no_license
J4-D06-0041/Dynamic-DAO-Mapper
b447b8b74e4e761325d6e7b4032f4d9d96d39c78
87d44ab099f5ad3b389119c6d6d033a31dab0095
refs/heads/master
2020-03-29T10:51:38.106366
2014-08-27T08:17:18
2014-08-27T08:17:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
515
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.springpractice.libtest; import com.springpractice.testapp.NewClass; /** * * @author Jody */ public class NewMain { /** * @param args the command line arguments */ public static void main(String[] args) { NewClass x = new NewClass(); System.out.println(x.greet()); } }
[ "intex.jero@gmail.com" ]
intex.jero@gmail.com
b8f87145479d4100b308fa8526d80a5691192eaa
3768f9584e197d6848f5fbe3832f63efe3579d48
/StringLog/src/Node.java
c3a22851dc9ca1007d089d743770dc74824e6c1e
[]
no_license
csc202/StringLL
de89c47a3ad62598caee3611f8ed81d27559e41f
0d26c819f6e4fd14e2c52fc67f874650ae475d1e
refs/heads/master
2021-01-11T11:02:33.550582
2015-09-21T21:14:30
2015-09-21T21:14:30
42,613,710
0
0
null
null
null
null
UTF-8
Java
false
false
438
java
public class Node <T>{ private T data; private Node<T> ptr; public Node(T data) { this.data = data; this.ptr = null; } public Node(T data, Node<T> ptr) { this.data = data; this.ptr = ptr; } public T getData() { return data; } public void setData(T data) { this.data = data; } public Node<T> getPtr() { return ptr; } public void setPtr(Node<T> ptr) { this.ptr = ptr; } }
[ "tkanchanawanchai6403@AN112515-CT103.nvstu.edu" ]
tkanchanawanchai6403@AN112515-CT103.nvstu.edu
34165e3f6634a2ba0adb0ad12799a3fe75d4795b
a466e0a30674a541741f979b155f3637c1a74f26
/Applications/wotaskd/Sources/com/webobjects/monitor/wotaskd/rest/delegates/MHostRestDelegate.java
a4c9d32e268144c963517035bdeaa2c9b47278bc
[]
no_license
wocommunity/wonder
c2971adadfc103f24191f60095c6d88a49dc128f
c0af44e73c9a2a6799b3ecfa1cf451123348cc43
refs/heads/master
2023-06-08T08:15:33.261856
2023-05-28T03:26:27
2023-05-28T03:26:27
1,520,916
89
85
null
2023-05-20T07:53:55
2011-03-24T13:30:25
Java
UTF-8
Java
false
false
903
java
package com.webobjects.monitor.wotaskd.rest.delegates; import com.webobjects.eocontrol.EOClassDescription; import com.webobjects.foundation.NSArray; import com.webobjects.monitor._private.MHost; import er.extensions.eof.ERXQ; import er.rest.ERXRestContext; public class MHostRestDelegate extends JavaMonitorRestDelegate { public Object createObjectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) { return new MHost(siteConfig(), (String)id, MHost.MAC_HOST_TYPE); } public Object objectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) { return (siteConfig().hostWithName((String)id)); } public Object primaryKeyForObject(Object obj, ERXRestContext context) { NSArray<MHost> objects = ERXQ.filtered(siteConfig().hostArray(), ERXQ.is("name", obj)); return objects.size() == 0 ? null : objects.objectAtIndex(0); } }
[ "probert@macti.ca" ]
probert@macti.ca
6e741c1af2b4c91ddb348ab7fcd473d70e72a360
683f869c4d76c5f5b0e96fee063648e2455ad8b3
/src/main/java/com/bezkoder/spring/files/upload/service/FilesStorageService.java
2f1d288d96daf8440bc45fb90937faa4d6b889d7
[]
no_license
tonqa/spring-boot-data-jpa-mysql
650090da769769db7fc75aaaa085d96710d7451f
65b729f3fa5e2006bdb1414acc0b606440cd00ca
refs/heads/main
2023-02-09T23:41:40.034235
2021-01-01T19:08:40
2021-01-01T19:08:40
322,265,264
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.bezkoder.spring.files.upload.service; import java.nio.file.Path; import java.util.stream.Stream; import org.springframework.core.io.Resource; import org.springframework.web.multipart.MultipartFile; public interface FilesStorageService { public void init(); public void save(MultipartFile file); public Resource load(String filename); public void deleteAll(); public Stream<Path> loadAll(); }
[ "tonqa@gmx.de" ]
tonqa@gmx.de
74caadb00107d3dc6431440d1ec39b382bd98b51
77edce1ea2f4966e06eac75540a39e94866cd331
/day2/shapes.java
9ae19d5a53b5e73d986c9b3d1089ec61dac6102e
[]
no_license
aravindpandiyarajan2004/100daysofcode-
6311e7a5bc33e11ccf8184b269a512c97be6ca85
644758e7a4da57c819abf49ad838103856505584
refs/heads/main
2023-08-18T22:38:12.643352
2021-09-27T17:26:19
2021-09-27T17:26:19
402,101,522
0
2
null
null
null
null
UTF-8
Java
false
false
407
java
import java.io.*; import java.util.*; class shapes { public static void main(String[]arg) { square a=new square(); a.getdata(); a.print(); } } class square { int s,area; void getdata() { Scanner user_input=new Scanner(System.in); System.out.print("enter the values of s:"); s=user_input.nextInt(); } void print() { area=s*s; System.out.println("Area of the square is:"+area); } }
[ "noreply@github.com" ]
aravindpandiyarajan2004.noreply@github.com
d487f9ce0483580e58ad7312a6d2a6887214417a
5feb0b467444cf1be5053852e651e41c85a558a2
/src/Irony/Parsing/NonTerminalSet.java
bc5c91982a6f83dc2ed09ac10d2276519fe5fbb2
[]
no_license
Javonet-io-user/5ee9a988-bcad-4ad2-8bb6-159982bd7831
fe9122a1d34782ecc7447a96d2c9f13f7abf6c8a
f9b7b6f3ed9513e49a4df2d211e0e63cc4493c41
refs/heads/master
2020-04-07T02:47:46.418799
2018-11-17T14:04:12
2018-11-17T14:04:12
157,990,107
0
0
null
null
null
null
UTF-8
Java
false
false
1,715
java
package Irony.Parsing;import Common.Activation;import static Common.Helper.Convert;import static Common.Helper.getGetObjectName;import static Common.Helper.getReturnObjectName;import static Common.Helper.ConvertToConcreteInterfaceImplementation;import Common.Helper;import com.javonet.Javonet; import com.javonet.JavonetException; import com.javonet.JavonetFramework; import com.javonet.api.NObject; import com.javonet.api.NEnum; import com.javonet.api.keywords.NRef; import com.javonet.api.keywords.NOut; import com.javonet.api.NControlContainer;import java.util.concurrent.atomic.AtomicReference;import Irony.Parsing.*; import jio.System.Collections.Generic.*;public class NonTerminalSet extends HashSet<NonTerminal> {protected NObject javonetHandle; public NonTerminalSet (){ super((NObject) null); try { javonetHandle = Javonet.New("NonTerminalSet"); super.setJavonetHandle(javonetHandle); } catch (JavonetException _javonetException) { _javonetException.printStackTrace(); } }public NonTerminalSet(NObject handle) {super(handle);this.javonetHandle=handle;}public void setJavonetHandle(NObject handle) { this.javonetHandle = handle; }/** * Method */ public java.lang.String ToString (){ try { return (java.lang.String) javonetHandle.invoke("ToString");} catch (JavonetException _javonetException) { _javonetException.printStackTrace(); return "";} } static { try { Activation.initializeJavonet(); } catch (java.lang.Exception e) { e.printStackTrace(); } }}
[ "support@javonet.com" ]
support@javonet.com
4d99b63ea1458110275d21587acc854d822c8b50
c3cbe9386385b93c26b7eb3605e78650b78984bd
/android/src/main/java/com/netease/im/uikit/contact/core/item/TextItem.java
d64a3d5b04eb7caa4553f9140998af2a603999cf
[]
no_license
cpunion/react-native-netease-im
6afd27dd007b64dd194b29d2eeae175862738fc3
1b9bcdbe9353fd13009cb5cb14a49529f6fe0c02
refs/heads/master
2021-01-19T18:51:21.016846
2017-10-31T13:33:14
2017-10-31T13:33:14
101,173,327
1
1
null
2017-08-23T11:38:10
2017-08-23T11:38:10
null
UTF-8
Java
false
false
816
java
package com.netease.im.uikit.contact.core.item; import android.text.TextUtils; import com.netease.im.uikit.contact.core.model.ContactGroupStrategy; import com.netease.im.uikit.contact.core.query.TextComparator; public class TextItem extends AbsContactItem implements Comparable<TextItem> { private final String text; public TextItem(String text) { this.text = text != null ? text : ""; } public final String getText() { return text; } @Override public int getItemType() { return ItemTypes.TEXT; } @Override public String belongsGroup() { String group = TextComparator.getLeadingUp(text); return !TextUtils.isEmpty(group) ? group : ContactGroupStrategy.GROUP_SHARP; } @Override public int compareTo(TextItem item) { return TextComparator.compareIgnoreCase(text, item.text); } }
[ "hj644473762@gmail.com" ]
hj644473762@gmail.com
ac9ac6805c0734463312869a79181d9dcca2c4c1
b9bbddbc7c196787ea17b7450ac80f285f3aa636
/src/com/lavesh/design/patterns/structural/proxy/commands/CommandExecutorImpl.java
00b78027a2cfdf7c3727eaf816a5ca506b2b32d0
[]
no_license
hemrajanilavesh/design-patterns
fe1b3f616bcde36d622062efe059ff92331d25fe
3188f6b16bbedd97d1bb8cea5ead6554ee2b4311
refs/heads/main
2023-06-16T21:20:28.190476
2021-07-11T05:30:08
2021-07-11T05:30:08
381,555,805
0
0
null
null
null
null
UTF-8
Java
false
false
240
java
package com.lavesh.design.patterns.structural.proxy.commands; public class CommandExecutorImpl implements CommandExecutor { @Override public void runCommand() { System.out.println("Command executed successfully."); } }
[ "hemrajanilavesh@gmail.com" ]
hemrajanilavesh@gmail.com
93e8265b6d27ce45aa8e9984ded6040941dd84ac
f55c304c9cba15730c9330fb92d632318ff4c2ed
/basestar-expression/src/main/java/io/basestar/expression/compare/package-info.java
39f6469c355a07c353bc8c30819dcd2772a3af41
[ "Apache-2.0" ]
permissive
basestar/basestar
5ef74ad9e8fa2a422deb504f97069b248cbe3544
541a7e2d64ff6fece7574843dd1a3a54c8251b1e
refs/heads/master
2023-01-03T23:13:40.730886
2021-10-28T12:52:27
2021-10-28T12:52:27
253,273,643
3
3
Apache-2.0
2022-12-27T14:41:10
2020-04-05T15:58:55
Java
UTF-8
Java
false
false
730
java
/** * Comparison expressions */ package io.basestar.expression.compare; /*- * #%L * basestar-expression * %% * Copyright (C) 2019 - 2020 Basestar.IO * %% * 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. * #L% */
[ "matt@arcneon.com" ]
matt@arcneon.com
3c81cb50a693d9cf9cbb98f739fda8ccc9d41531
4dc252817784f246f18501a21eaf4b7c9ac0e436
/cleiton/exercicioRetangulo/src/retangulo/Retangulo.java
d9389cc0f9109fcaafff5600a4f94135965d23fc
[]
no_license
fxpro-com/tddDAS
06506fb615af22c34683b0c410ac327edf84e16b
cb7e393aab806d01fb36f6ecaf2d9b778fc86fd9
refs/heads/master
2021-09-22T14:45:56.661576
2014-05-21T15:53:35
2014-05-21T15:53:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package retangulo; public class Retangulo { Ponto pontoA,pontoB; public boolean verificaSeEhRetangulo(double xmin,double ymin,double xmax,double ymax) { if( (ymax - ymin) > 0 && (xmax - xmin) > 0) return true; return false; } public double calculoPerimetro(double xmin,double ymin,double xmax,double ymax) { double perimetro = ( (ymax - ymin) + (xmax - xmin) )*2; return perimetro; } public double calculoArea(double xmin,double ymin,double xmax,double ymax) { double area = Math.pow( (ymax - ymin)*(xmax - xmin), 2); return area; } public boolean verificaSobrePosicao(Ponto pontoA, Ponto pontoB) { if(pontoA.getXmax() - pontoB.getXmax() > 0) return true; if(pontoA.getYmax() - pontoA.getYmax() > 0) return true; return false; } }
[ "cleitoncsg@gmail.com" ]
cleitoncsg@gmail.com
9bdf767bae6f2e75ff21e2899db32a58049f6199
45f960a3df0025a632ea4a3cd4f48abb23e81069
/src/main/java/com/gibran/exceptions/InexistentTokenException.java
6a35e0bca9fa464ccaa6a457428d5c6e397a40b8
[]
no_license
gibranpulga/SimpleAsyncHttpServer
1ce73f316ddcb41dc5b3a22db9b8477c8e4ded46
a677f96f0d5c8940d194475b95ee1750e834e910
refs/heads/master
2021-01-22T18:54:04.929347
2017-03-16T10:43:56
2017-03-16T10:43:56
85,132,413
0
0
null
null
null
null
UTF-8
Java
false
false
93
java
package com.gibran.exceptions; public class InexistentTokenException extends Exception { }
[ "gnpa@gft.com" ]
gnpa@gft.com
8534191a90e55eedba9406bc39ab3f3c92aa490d
a63359d64e400f9fe303da24407df3b4d8d63a62
/conference/src/main/java/com/bratek/domain/Session.java
13494dff1f6c0d0aa5eaa1e2bcc501420eb5f483
[]
no_license
mhbratek/MicroServices
f79842d642db08a05c07d3735de252cdab140403
bd3fa88916be058b5aede0ce68fdca07c5dbc5b3
refs/heads/master
2021-04-12T08:56:13.184433
2018-03-22T19:22:34
2018-03-22T19:22:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,790
java
package com.bratek.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import javax.validation.constraints.*; import java.io.Serializable; import java.time.ZonedDateTime; import java.util.HashSet; import java.util.Set; import java.util.Objects; /** * A Session. */ @Entity @Table(name = "session") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Session implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @Column(name = "title", nullable = false) private String title; @NotNull @Lob @Column(name = "description", nullable = false) private byte[] description; @Column(name = "description_content_type", nullable = false) private String descriptionContentType; @NotNull @Column(name = "start_date_time", nullable = false) private ZonedDateTime startDateTime; @NotNull @Column(name = "end_data_time", nullable = false) private ZonedDateTime endDataTime; @ManyToMany(mappedBy = "sessions") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Speaker> speakers = new HashSet<>(); // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTitle() { return title; } public Session title(String title) { this.title = title; return this; } public void setTitle(String title) { this.title = title; } public byte[] getDescription() { return description; } public Session description(byte[] description) { this.description = description; return this; } public void setDescription(byte[] description) { this.description = description; } public String getDescriptionContentType() { return descriptionContentType; } public Session descriptionContentType(String descriptionContentType) { this.descriptionContentType = descriptionContentType; return this; } public void setDescriptionContentType(String descriptionContentType) { this.descriptionContentType = descriptionContentType; } public ZonedDateTime getStartDateTime() { return startDateTime; } public Session startDateTime(ZonedDateTime startDateTime) { this.startDateTime = startDateTime; return this; } public void setStartDateTime(ZonedDateTime startDateTime) { this.startDateTime = startDateTime; } public ZonedDateTime getEndDataTime() { return endDataTime; } public Session endDataTime(ZonedDateTime endDataTime) { this.endDataTime = endDataTime; return this; } public void setEndDataTime(ZonedDateTime endDataTime) { this.endDataTime = endDataTime; } public Set<Speaker> getSpeakers() { return speakers; } public Session speakers(Set<Speaker> speakers) { this.speakers = speakers; return this; } public Session addSpeakers(Speaker speaker) { this.speakers.add(speaker); speaker.getSessions().add(this); return this; } public Session removeSpeakers(Speaker speaker) { this.speakers.remove(speaker); speaker.getSessions().remove(this); return this; } public void setSpeakers(Set<Speaker> speakers) { this.speakers = speakers; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Session session = (Session) o; if (session.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), session.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "Session{" + "id=" + getId() + ", title='" + getTitle() + "'" + ", description='" + getDescription() + "'" + ", descriptionContentType='" + getDescriptionContentType() + "'" + ", startDateTime='" + getStartDateTime() + "'" + ", endDataTime='" + getEndDataTime() + "'" + "}"; } }
[ "mhbratek@gmail.com" ]
mhbratek@gmail.com
028d087c7c552731f898df671e98ae05e2701478
ca3c67e38dde679d695e4b2837b641220802b768
/app/src/main/java/com/example/weixi/smarthome/MainActivity.java
fa8d96e9b9f3a32a5f71be33ac71b15ec1c9059a
[]
no_license
wwinsa/SmartHome
31c7935a8423598333526ac4094bc2a765003618
3afa048fd9a07d0f7fa7edf55e6671ff0f8dec9a
refs/heads/master
2020-05-27T08:37:53.398724
2019-06-07T00:18:00
2019-06-07T00:18:00
188,549,211
0
0
null
null
null
null
UTF-8
Java
false
false
12,577
java
package com.example.weixi.smarthome; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.UUID; import static com.example.weixi.smarthome.BlueToothActivity.REQUEST_ENABLE_BT; public class MainActivity extends AppCompatActivity { private Button btn_temp,btn_humi,btn_smoke,btn_ch4,btn_send, btn_rep; //bluetooth private BluetoothAdapter bluetoothAdapter; // 选中发送数据的蓝牙设备,全局变量,否则连接在方法执行完就结束了 private BluetoothDevice selectDevice; private BluetoothSocket clientSocket; // 获取到向设备写的输出流,全局变量,否则连接在方法执行完就结束了 private InputStream is;// 获取到输入流 private OutputStream os; private final UUID MY_UUID = UUID .fromString("00001101-0000-1000-8000-00805F9B34FB"); //data private ArrayList<Integer> temp =new ArrayList<Integer>(); private ArrayList<Integer> humi =new ArrayList<Integer>(); private ArrayList<Integer> smoke =new ArrayList<Integer>(); private ArrayList<Integer> ch4 =new ArrayList<Integer>(); //thread boolean flag = false; String tmp1, tmp2, s , s2 = "0"; int wx1, wx2, wx3; int sig = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initUI(); initdata(); setListeners(); bt(); btn_temp.setText("温度:"+temp.get(temp.size()-1)+"度"); btn_humi.setText("湿度"+humi.get(humi.size()-1)); btn_smoke.setText("烟雾浓度"+smoke.get(smoke.size()-1)); btn_ch4.setText("甲醛浓度"+ch4.get(ch4.size()-1)); } private void bt(){ bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); // 蓝牙未打开,询问打开 if (!bluetoothAdapter.isEnabled()) { Intent turnOnBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(turnOnBtIntent, REQUEST_ENABLE_BT); } //通过地址绑定进行蓝牙连接 selectDevice = bluetoothAdapter.getRemoteDevice("98:D3:32:70:8B:76"); if(selectDevice != null){ Toast.makeText(this,"已连接",Toast.LENGTH_SHORT).show(); } //receive new Thread(new Runnable() { @Override public void run() { try { // 判断客户端接口是否为空 if (clientSocket == null) { // 获取到客户端接口 clientSocket = selectDevice .createRfcommSocketToServiceRecord(MY_UUID); // 向服务端发送连接 clientSocket.connect(); // 获取到输入流 is = clientSocket.getInputStream(); Log.d("Connect","connected"); os = clientSocket.getOutputStream(); } // 无线循环来接收数据 while (true) { // // 创建一个128字节的缓冲 // byte[] buffer = new byte[128]; // // // 每次读取128字节,并保存其读取的角标 // int count = is.read(buffer); // //数据分段 // //手动整合 // if(flag){ // tmp2 = new String(buffer,0,count,"utf-8"); // // s =tmp1 + tmp2; // Log.d("UBG",s); // for(int i =0 ; i < s.length(); i++){ // if(s.charAt(i) > '0' && s.charAt(i) < '9'){ // s2 = s2 + s.charAt(i); // } // } // // temp.add(Integer.parseInt(s2)); // flag = false; // } // else{ // flag = true; // s2 = "0"; // tmp1 = new String(buffer,0,count,"utf-8"); // } // // // 创建Message类,向handler发送数据 // Message msg = new Message(); // // 发送一个String的数据,让他向上转型为obj类型 // msg.obj = s; // // 发送数据 // handler.sendMessage(msg); int tmp , t2, t3; tmp = is.read(); Log.d("INT->",String.valueOf(tmp)); if(tmp == 1){ t2 = is.read(); t3 = is.read(); Log.d("INT2->",String.valueOf(t3)); ch4.add(t3); s = String.valueOf(t3); } if(tmp == 2){ t2 = is.read(); t3 = is.read(); Log.d("INT3->",String.valueOf(t3)); smoke.add(t3); s = String.valueOf(t3); } //数据分段 //手动整合 // if(flag){ // wx2 = is.read(); // tmp2 = String.valueOf(wx2); // // s =tmp1 + tmp2; // Log.d("UBG",s); // for(int i =0 ; i < s.length(); i++){ // if(s.charAt(i) > '0' && s.charAt(i) < '9'){ // s2 = s2 + s.charAt(i); // } // } // // temp.add(Integer.parseInt(s2)); // flag = false; // } // else if(flag == false){ // flag = true; // s2 = "0"; // wx1 = is.read(); // tmp1 = String.valueOf(wx1); // // } // 创建Message类,向handler发送数据 Message msg = new Message(); // 发送一个String的数据,让他向上转型为obj类型 msg.obj = s; // 发送数据 handler.sendMessage(msg); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } }).start(); } private void initdata(){ temp.add(25); temp.add(27); temp.add(30); temp.add(35); temp.add(23); humi.add(25); humi.add(27); humi.add(30); humi.add(35); humi.add(23); smoke.add(3); smoke.add(25); smoke.add(10); ch4.add(10); ch4.add(21); ch4.add(24); } private void initUI(){ btn_temp = findViewById(R.id.btn_temp); btn_humi = findViewById(R.id.btn_humi); btn_smoke = findViewById(R.id.btn_smoke); btn_ch4 = findViewById(R.id.btn_ch4); btn_send = findViewById(R.id.btn_send); btn_rep = findViewById(R.id.btn_rep); } private void setListeners(){ OnClick onClick = new OnClick(); btn_temp.setOnClickListener(onClick); btn_humi.setOnClickListener(onClick); btn_smoke.setOnClickListener(onClick); btn_ch4.setOnClickListener(onClick); btn_send.setOnClickListener(onClick); btn_rep.setOnClickListener(onClick); } private class OnClick implements View.OnClickListener{ @Override public void onClick(View view) { Intent intent = null; Bundle bundle = new Bundle(); switch (view.getId()){ case R.id.btn_temp: intent = new Intent(MainActivity.this,TempActivity.class); bundle.putIntegerArrayList("temp",temp); intent.putExtras(bundle); startActivity(intent); break; case R.id.btn_humi: intent = new Intent(MainActivity.this,HumiActivity.class); bundle.putIntegerArrayList("humi",humi); intent.putExtras(bundle); startActivity(intent); break; case R.id.btn_smoke: intent = new Intent(MainActivity.this,Smoke2Activity.class); bundle.putIntegerArrayList("smoke",smoke); intent.putExtras(bundle); startActivity(intent); break; case R.id.btn_ch4: intent = new Intent(MainActivity.this,Ch4Activity.class); bundle.putIntegerArrayList("ch4",ch4); intent.putExtras(bundle); startActivity(intent); break; case R.id.btn_rep: intent = new Intent(MainActivity.this,ReportActivity.class); bundle.putIntegerArrayList("smoke",smoke); intent.putExtras(bundle); bundle.putIntegerArrayList("ch4",ch4); intent.putExtras(bundle); startActivity(intent); break; case R.id.btn_send: //send new Thread(new Runnable() { @Override public void run() { try { // 获取到输出流,向外写数据 os = clientSocket.getOutputStream(); // 判断是否拿到输出流 if (os != null) { // 需要发送的信息 byte[] text = {2}; // 以utf-8的格式发送出去 os.write(text); } toast("发送信息成功,请查收"); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } }).start(); break; } } } // 创建handler,因为我们接收是采用线程来接收的,在线程中无法操作UI,所以需要handler Handler handler = new Handler() { @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); //通过msg传递过来的信息,吐司一下收到的信息 Toast.makeText(MainActivity.this, (String) msg.obj, Toast.LENGTH_SHORT).show(); btn_temp.setText("温度:"+temp.get(temp.size()-1)+"度"); btn_humi.setText("湿度:"+humi.get(humi.size()-1)); btn_smoke.setText("烟雾浓度"+smoke.get(smoke.size()-1)); btn_ch4.setText("甲醛浓度"+ch4.get(ch4.size()-1)); } }; public void toast(String str){ Toast.makeText(this, str, Toast.LENGTH_SHORT).show(); } }
[ "weixiang1998@126.com" ]
weixiang1998@126.com
34a41bed6ac7bb7ceb50edbccb9ab63c8729b59f
e3959191c701c15dc2746587e4e16a73e7bf98c6
/event-producer/event-producer-web/src/main/java/com/mercedes/ed/ep/web/dstore/FuelEvent.java
27ab453a7dc5b62c09003b3a728af7eb3cadd4ac
[]
no_license
pankaj-koushik/Fuel-Cost-Calculator
ef7b37754e46f2ba3bf402bf024816a0e1e699c5
9d3ec269cd88bdff3fe87f9200b30ebd0adb86d0
refs/heads/main
2023-03-12T11:56:54.266641
2021-03-01T11:55:58
2021-03-01T11:55:58
343,152,897
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package com.mercedes.ed.ep.web.dstore; import lombok.Data; import org.springframework.data.mongodb.core.mapping.Document; @Data @Document("fuel_event") /** * Event Store model -> Save all the events in permanent storage. */ public class FuelEvent extends PersistableMongoEntity{ /** * Boolean value which indicates car fuel lid status. * true -> lid opened * false -> lid closed */ private boolean fuellid; /** * City of which fuel price will be used to calculate cost */ private String city; private String carId; }
[ "pankaj.koushik@in.ibm.com" ]
pankaj.koushik@in.ibm.com
db4f7d90abbe8eb43749896a5bb1c61e1765bb1e
f8378cc873a1fe5db0b5bb20a665c60535574d01
/src/main/java/com/management/api/domain/Permission.java
d52d57da74ee619dbc89f437b7116e9e52674da1
[]
no_license
mercykip/management
f633b38961ec49f2051b0f1a258f6308d1d7b695
41445cdc1efff0729d871e9fe8b06a3ea443d258
refs/heads/main
2023-08-18T03:32:18.623725
2021-09-24T06:27:35
2021-09-24T06:27:35
409,314,153
0
1
null
null
null
null
UTF-8
Java
false
false
395
java
//package com.management.api.domain; // //import javax.persistence.Entity; //import javax.persistence.GeneratedValue; //import javax.persistence.GenerationType; //import javax.persistence.Id; // //@Entity //public class Permission { // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // private Integer id; // // // Ex: READ,WRITE,UPDATE // private String name; //}
[ "mercyjemosop@gmail.com" ]
mercyjemosop@gmail.com
75a88de82aabcc8067e65f416ee6c5d15a2c9011
fc1bf26252525f1dca780f0c26cea165c3b3f531
/com/planet_ink/coffee_mud/Commands/Dig.java
2a69404f08100f99e4fb1d86363e09f24030565c
[ "Apache-2.0" ]
permissive
mikael2/CoffeeMud
8ade6ff60022dbe01f55172ba3f86be0de752124
a70112b6c67e712df398c940b2ce00b589596de0
refs/heads/master
2020-03-07T14:13:04.765442
2018-03-28T03:59:22
2018-03-28T03:59:22
127,521,360
1
0
null
2018-03-31T10:11:54
2018-03-31T10:11:53
null
UTF-8
Java
false
false
4,968
java
package com.planet_ink.coffee_mud.Commands; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2011-2018 Bo Zimmerman 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. */ public class Dig extends StdCommand { public Dig() { } private final String[] access = I(new String[] { "DIG" }); @Override public String[] getAccessWords() { return access; } public int getDiggingDepth(Item item) { if(item==null) return 1; switch(item.material()&RawMaterial.MATERIAL_MASK) { case RawMaterial.MATERIAL_METAL: case RawMaterial.MATERIAL_MITHRIL: case RawMaterial.MATERIAL_WOODEN: if(item.Name().toLowerCase().indexOf("shovel")>=0) return 5+item.phyStats().weight(); return 1+(item.phyStats().weight()/5); case RawMaterial.MATERIAL_SYNTHETIC: case RawMaterial.MATERIAL_ROCK: case RawMaterial.MATERIAL_GLASS: if(item.Name().toLowerCase().indexOf("shovel")>=0) return 14+item.phyStats().weight(); return 1+(item.phyStats().weight()/7); default: return 1; } } public boolean isOccupiedWithOtherWork(MOB mob) { if(mob==null) return false; for(final Enumeration<Ability> a=mob.effects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null) &&(!A.isAutoInvoked()) &&((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_COMMON_SKILL)) return true; } return false; } @Override public boolean preExecute(MOB mob, List<String> commands, int metaFlags, int secondsElapsed, double actionsRemaining) throws java.io.IOException { if(secondsElapsed==0) { if(isOccupiedWithOtherWork(mob)) { CMLib.commands().postCommandFail(mob,new StringXVector(commands),L("You are too busy to dig right now.")); return false; } if(mob.isInCombat()) { CMLib.commands().postCommandFail(mob,new StringXVector(commands),L("You are too busy fighting right now.")); return false; } final String msgStr=L("<S-NAME> start(s) digging a hole with <O-NAME>."); Item I=mob.fetchWieldedItem(); if(I==null) I=mob.getNaturalWeapon(); final CMMsg msg=CMClass.getMsg(mob,mob.location(),I,CMMsg.MSG_DIG,msgStr); msg.setValue(1); if(mob.location().okMessage(mob,msg)) mob.location().send(mob,msg); else return false; } else if((secondsElapsed % 8)==0) { if(mob.isInCombat()) { CMLib.commands().postCommandFail(mob,new StringXVector(commands),L("You stop digging.")); return false; } final String msgStr=L("<S-NAME> continue(s) digging a hole with <O-NAME>."); Item I=mob.fetchWieldedItem(); if(I==null) I=mob.getNaturalWeapon(); final CMMsg msg=CMClass.getMsg(mob,mob.location(),I,CMMsg.MSG_DIG,msgStr); msg.setValue(getDiggingDepth(I)); if(mob.location().okMessage(mob,msg)) mob.location().send(mob,msg); else return false; } return true; } @Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final CMMsg msg=CMClass.getMsg(mob,null,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> stop(s) digging.")); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); mob.clearCommandQueue(); } return false; } @Override public double combatActionsCost(final MOB mob, final List<String> cmds) { return 30.0 * mob.phyStats().speed(); } @Override public double actionsCost(final MOB mob, final List<String> cmds) { return 10.0 * mob.phyStats().speed(); } @Override public boolean canBeOrdered() { return true; } }
[ "bo@zimmers.net" ]
bo@zimmers.net
869842ab6f9673a3649d11d3382d7926db345e82
78b4f35d01c9ec929b3a48f458c78306419e0b57
/app/src/main/java/com/drs/baseadapter/adapter/TestAdapter.java
34bda941c68404e7b849db6eaf62b2510e601727
[]
no_license
drs0214/ListBaseAdapter
5255da18a7b9ff8e3a29aab437384198add425b8
1325ec3f1d6c68b0fe590b7402e94d5d8e986723
refs/heads/master
2020-09-08T20:19:22.385325
2019-11-12T14:09:26
2019-11-12T14:09:26
221,233,088
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package com.drs.baseadapter.adapter; import android.content.Context; import com.drs.baseadapter.TestItemDelagate; import com.drs.baseadapterlib.listview.MultiItemTypeAdapter; import java.util.List; /** * @author: drs * @time: 2019/11/12 10:48 * @des: */ public class TestAdapter extends MultiItemTypeAdapter{ public TestAdapter(Context context, List datas) { super(context, datas); addItemViewDelegate(new TestItemDelagate()); } }
[ "dongrunsheng@aerozhonghuan.com" ]
dongrunsheng@aerozhonghuan.com