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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6c8c8b381ae09fd1bf1d0d42e5c4674127ce9617 | d0c2cd0b7fa40e02a5f5731a77d561b884fdd2ea | /movies/app/src/test/java/com/tra/movies/details/MovieDetailsPresenterImplTest.java | 70cb96d01d149072a93013e96012ee22271d88c7 | [] | no_license | ElmedinMashkulli/moviediscoverandroidproject | 471f87a12a04d40194508891d937d8b52be6248d | 303206ec5242b11a8ccd87edbc13d5652ac47911 | refs/heads/master | 2020-11-27T12:38:43.007220 | 2019-12-23T13:30:24 | 2019-12-23T13:30:24 | 229,443,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,614 | java | package com.tra.movies.details;
import com.tra.movies.Movie;
import com.tra.movies.Review;
import com.tra.movies.listing.RxSchedulerRule;
import com.tra.movies.Video;
import com.tra.movies.favorites.FavoritesInteractor;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import java.net.SocketTimeoutException;
import java.util.List;
import io.reactivex.Observable;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
/**
* @author arunsasidharan
*/
@RunWith(MockitoJUnitRunner.class)
public class MovieDetailsPresenterImplTest {
@Rule
public RxSchedulerRule rule = new RxSchedulerRule();
@Mock
private MovieDetailsView view;
@Mock
private MovieDetailsInteractor movieDetailsInteractor;
@Mock
private FavoritesInteractor favoritesInteractor;
@Mock
List<Video> videos;
@Mock
Movie movie;
@Mock
List<Review> reviews;
private MovieDetailsPresenterImpl movieDetailsPresenter;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
movieDetailsPresenter = new MovieDetailsPresenterImpl(movieDetailsInteractor, favoritesInteractor);
movieDetailsPresenter.setView(view);
}
@After
public void teardown() {
movieDetailsPresenter.destroy();
}
@Test
public void shouldUnfavoriteIfFavoriteTapped() {
when(movie.getId()).thenReturn("12345");
when(favoritesInteractor.isFavorite(movie.getId())).thenReturn(true);
movieDetailsPresenter.onFavoriteClick(movie);
verify(view).showUnFavorited();
}
@Test
public void shouldFavoriteIfUnfavoriteTapped() {
when(movie.getId()).thenReturn("12345");
when(favoritesInteractor.isFavorite(movie.getId())).thenReturn(false);
movieDetailsPresenter.onFavoriteClick(movie);
verify(view).showFavorited();
}
@Test
public void shouldBeAbleToShowTrailers() {
when(movie.getId()).thenReturn("12345");
Observable<List<Video>> responseObservable = Observable.just(videos);
when(movieDetailsInteractor.getTrailers(movie.getId())).thenReturn(responseObservable);
movieDetailsPresenter.showTrailers(movie);
verify(view).showTrailers(videos);
}
@Test
public void shouldFailSilentlyWhenNoTrailers() throws Exception {
when(movie.getId()).thenReturn("12345");
when(movieDetailsInteractor.getTrailers(movie.getId())).thenReturn(Observable.error(new SocketTimeoutException()));
movieDetailsPresenter.showTrailers(movie);
verifyZeroInteractions(view);
}
@Test
public void shouldBeAbleToShowReviews() {
Observable<List<Review>> responseObservable = Observable.just(reviews);
when(movie.getId()).thenReturn("12345");
when(movieDetailsInteractor.getReviews(movie.getId())).thenReturn(responseObservable);
movieDetailsPresenter.showReviews(movie);
verify(view).showReviews(reviews);
}
@Test
public void shouldFailSilentlyWhenNoReviews() throws Exception {
when(movie.getId()).thenReturn("12345");
when(movieDetailsInteractor.getReviews(movie.getId())).thenReturn(Observable.error(new SocketTimeoutException()));
movieDetailsPresenter.showReviews(movie);
verifyZeroInteractions(view);
}
} | [
"emashkulli@gmail.com"
] | emashkulli@gmail.com |
e795caaa9b0171b4a5009169c633e2447baca97d | fea0046bc4a1f988ef94bb921f4e16528efe9332 | /app/src/main/java/jp/javadrive/openweatherapifragmentsqlite/LocationMenuFragment.java | 87b756c79a558da15deccb8ac47dad604dc0caf5 | [] | no_license | 19930109/- | 4149fe083c01dd66cf58b589446758e52496cad7 | 479227731d44193dcb753f16c9298961aec516eb | refs/heads/master | 2023-08-04T18:49:28.319643 | 2021-09-02T08:45:34 | 2021-09-02T08:45:34 | 394,560,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,533 | java | package jp.javadrive.openweatherapifragmentsqlite;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationProvider;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
// Fragmentクラスを継承します
public class LocationMenuFragment extends Fragment {
private FusedLocationProviderClient fusedLocationClient;
String locality;
String areaname;
double lat;
double lon;
static LocationMenuFragment newInstance() {
// インスタンス生成
LocationMenuFragment locationMenufragment = new LocationMenuFragment();
return locationMenufragment;
}
/**
* 位置情報取得開始メソッド
*/
private void startUpdateLocation() {
// 位置情報取得権限の確認
if(ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// 権限がない場合、許可ダイアログ表示
String[] permissions = {Manifest.permission.ACCESS_FINE_LOCATION};
ActivityCompat.requestPermissions(getActivity(), permissions, 2000);
return;
}
// 位置情報の取得方法を設定
LocationRequest locationRequest = LocationRequest.create();
//locationRequest.setInterval(10000); // 位置情報更新間隔の希望
//locationRequest.setFastestInterval(5000); // 位置情報更新間隔の最速値
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); // この位置情報要求の優先度
fusedLocationClient.requestLocationUpdates(locationRequest, new MyLocationCallback(), null);
}
/**
* 位置情報受取コールバッククラス
*/
private class MyLocationCallback extends LocationCallback {
@Override
public void onLocationResult(LocationResult locationResult) {
if (locationResult == null) {
return;
}
// 現在値を取得
Location location = locationResult.getLastLocation();
Log.v("結果","緯度:" + location.getLatitude() + " \n経度:" + location.getLongitude());
lat = location.getLatitude();
lon = location.getLongitude();
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
List<Address> addresses = null;
try {
Geocoder gcd = new Geocoder(getContext(), Locale.getDefault());
addresses = gcd.getFromLocation(lat, lon, 1);
if (addresses.size() > 0) {
String ret = addresses.get(0).toString();
Log.d("結果", ret);
areaname = addresses.get(0).getAdminArea();
Log.d("都道府県名", areaname);
locality = addresses.get(0).getLocality();
Log.d("市町村名", locality);
handler.post(new Runnable() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void run() {
TextView locality1 = getView().findViewById(R.id.locality);
locality1.setText("現在地は、\n" +
areaname + locality + "\nです。");
}
});
}
} catch (IOException e) {
e.printStackTrace();
Log.d("DEBUG", "失敗しました");
}
}
}).start();
};
}
/**
* 許可ダイアログの結果受取
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 2000 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// 位置情報取得開始
startUpdateLocation();
}
}
// FragmentのViewを生成して返す
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_location,
container, false);
//位置情報を取得していなければ、ダイアログを表示して、位置情報取得
if(locality == null) {
//ダイアログ表示
((MainActivity) getActivity()).LocationWaiting();
// LocationClientクラスのインスタンスを生成
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this.getActivity());
}
// 位置情報取得開始
startUpdateLocation();
return view;
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Button buttonDay = view.findViewById(R.id.CurrentButton);
buttonDay.setOnClickListener(v -> {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
// BackStackを設定
fragmentTransaction.addToBackStack(null);
fragmentTransaction.replace(R.id.container,
LocalAreaCurrentFragment.newInstance(areaname,6,lon,lat));
fragmentTransaction.commit();
}
});
Button buttonWeek = view.findViewById(R.id.WeekButton);
buttonWeek.setOnClickListener(v -> {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
// BackStackを設定
fragmentTransaction.addToBackStack(null);
fragmentTransaction.replace(R.id.container,
LocalAreaWeekFragment.newInstance(areaname,6));
fragmentTransaction.commit();
}
});
Button buttonData = view.findViewById(R.id.HourButton);
buttonData.setOnClickListener(v -> {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
// BackStackを設定
fragmentTransaction.addToBackStack(null);
fragmentTransaction.replace(R.id.container,
LocalAreaHourFragment.newInstance(areaname,6));
fragmentTransaction.commit();
}
});
}
} | [
"0109jajm@gmail.com"
] | 0109jajm@gmail.com |
cc36f1bf2c6e634231fab67f50a6dcbb6bde885e | b6ac9a09985957ce60bc394de0d477a2f413f0b8 | /src/datastructure/BinSearchTreeTest.java | 633283ee09086542314af7b965d5da6599bfb185 | [] | no_license | JeremyTang999/data_structure | d532cc276a8bac11bf92d88495680c5651be3467 | 347a6860688a84cf7024636fbe866ed226c99570 | refs/heads/master | 2021-07-05T22:59:09.281450 | 2017-10-02T02:09:02 | 2017-10-02T02:09:02 | 104,883,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 824 | java | package datastructure;
import datastructure.search_tree.BinSearchTree;
public class BinSearchTreeTest {
public static void main(String[] args){
BinSearchTree<Integer,String> tree=new BinSearchTree<Integer,String>();
for(int i=0;i<10;i++){
int k=(int)(100*Math.random());
double v=1000*Math.random();
tree.put(new Integer(k),v+"");
System.out.println("k:"+k+",v:"+v);
}
int k=(int)(100*Math.random());
BinSearchTree.Node node =tree.floor(new Integer(k));
BinSearchTree.Node node2 =tree.ceiling(new Integer(k));
System.out.println("k "+k);
System.out.println("floor: k:"+ node.getKey()+",v:"+ node.getValue());
System.out.println("ceiling: k:"+ node2.getKey()+",v:"+ node2.getValue());
}
}
| [
"iamtmh@163.com"
] | iamtmh@163.com |
15b8fb061dc5b70f726e1738bf281580fa95eda1 | cbd58d6c70654750ebdfe4d6e3b39f493b774859 | /src/day0222/BOJ_13300.java | 740d3bb68c95691c8a82664f9d54663be9ffc2c3 | [] | no_license | zu0p/algorithm | f2775a5074b081007d4c0ef53e23ceb88b6255c6 | 33a75fc05fd0967aadd447a81811ebe3b4e06a06 | refs/heads/master | 2023-03-30T02:54:36.254535 | 2021-03-31T12:40:23 | 2021-03-31T12:40:23 | 331,322,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,013 | java | package day0222;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
public class BOJ_13300 {
static int n, k;
static ArrayList<Student> students;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] tmp = br.readLine().split(" ");
n = Integer.parseInt(tmp[0]);
k = Integer.parseInt(tmp[1]);
students = new ArrayList<>();
for(int i = 0; i<n; i++){
tmp = br.readLine().split(" ");
int s = Integer.parseInt(tmp[0]);
int y = Integer.parseInt(tmp[1]);
students.add(new Student(s,y));
}
Collections.sort(students);
int cnt = 1, room = 1;
Student pre = students.get(0);
for(int i = 1; i<students.size(); i++){
Student cur = students.get(i);
if(cur.s == pre.s){
if(cur.y==pre.y){
if(cnt+1<=k){
cnt++;
}
else{
cnt = 1;
room++;
}
}
else{
cnt = 1;
room++;
}
}
else{
cnt = 1;
room++;
}
pre = cur;
}
System.out.println(room);
}
}
class Student implements Comparable<Student>{
int s,y;
public Student(int s, int y) {
this.s = s;
this.y = y;
}
@Override
public int compareTo(Student o) {
int diff = s-o.s;
return diff==0?y-o.y:diff;
}
@Override
public String toString() {
return "Student{" +
"s=" + s +
", y=" + y +
'}';
}
}
| [
"a33a66a99@naver.com"
] | a33a66a99@naver.com |
052b067d9f170c9b5ccde54b398acd2b47ced8b7 | 0b4043c4f17c6a82a9bfb73c67de817896e95d58 | /src/test/java/com/teamdevsolution/batch/SpringBootBatchLoadFileFromSftpToDatabaseApplicationTests.java | 1830c3b266581e83efd058be910dd0b019fcb67a | [] | no_license | augustingims/spring-boot-batch-load-file-from-sftp-to-database | c0440a5d20251552f9cda8fd5e7a6f762e7ff04d | c3b07f3532d26fbe8030aea9d9a0e4acb4be80b3 | refs/heads/main | 2023-02-26T14:59:33.184336 | 2021-02-03T09:43:25 | 2021-02-03T09:43:25 | 335,574,253 | 1 | 0 | null | 2021-02-03T09:43:26 | 2021-02-03T09:38:01 | null | UTF-8 | Java | false | false | 252 | java | package com.teamdevsolution.batch;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringBootBatchLoadFileFromSftpToDatabaseApplicationTests {
@Test
void contextLoads() {
}
}
| [
"augustingims@gmail.com"
] | augustingims@gmail.com |
608afb6a328eab42ddf97ccbf7df33d9e2f0fece | e0f9c015ae3713e44b0dd2a5fac85808819ea72c | /BrilliantLockScreen/src/com/brilliant/lockscreen/PersonalActivity.java | c74b046e6a7a5cbf19258d243612a9ce3d6ad73a | [] | no_license | bridsj/brilliant_lockscreen | fdc4c0045003e6ba2a69666d042103eeaa0dcb29 | 13c286bfb65cea6e59f620156e4a45f16ad5e9cb | refs/heads/master | 2020-05-31T09:10:11.713636 | 2014-12-10T02:09:08 | 2014-12-10T02:09:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,909 | java | package com.brilliant.lockscreen;
import android.graphics.Rect;
import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import com.brilliant.lockscreen.ui.view.gooleprogressbar.GoogleProgressBar;
import com.brilliant.lockscreen.ui.view.parallax.ObservableScrollView;
import com.brilliant.lockscreen.ui.view.parallax.ParallaxScrollView;
import com.brixd.android.utils.device.PhoneUtil;
/**
* @author deng.shengjin
* @version create_time:2014-12-7 上午11:43:05
* @Description 个人信息界面
*/
public class PersonalActivity extends BaseActivity {
private ParallaxScrollView mScrollView;
private ObservableScrollView observableScrollView;
private GoogleProgressBar mProgressBar;
@Override
protected void initData() {
}
@Override
protected void initViews() {
setContentView(R.layout.activity_personal);
mScrollView = (ParallaxScrollView) findViewById(R.id.scroll_view);
observableScrollView = (ObservableScrollView) findViewById(R.id.observable_scroll_view);
mProgressBar = (GoogleProgressBar) findViewById(R.id.google_progress);
float offset = mScrollView.getParallaxOffset();
offset = offset + 0.05f;
mScrollView.setParallaxOffset(offset);
Rect bounds = mProgressBar.getIndeterminateDrawable().getBounds();
mProgressBar.getIndeterminateDrawable().setBounds(bounds);
mProgressBar.setIndeterminate(false);
}
@Override
protected void initActions() {
mScrollView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
mScrollView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
final ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) observableScrollView.getLayoutParams();
lp.width = PhoneUtil.getDisplayWidth(getApplicationContext());
observableScrollView.requestLayout();
}
});
}
}
| [
"deng.shengjin@zuimeia.com"
] | deng.shengjin@zuimeia.com |
d03c0b570a430b9f51dae9ebcf95588e897844c4 | 08bafab7a87e30ca694ae0969e57135bc43d584c | /apps/services/search/src/main/java/bkp/search/logic/SearchService.java | 3da196eb5f1a37be99be1f1de895f515516f0bab | [
"Apache-2.0"
] | permissive | bondyra/bkp | ca4c502dbcf555ace606fdcc3bc32b0e71902bc6 | da2389a2c35b9a003680c704e14de632e8a05fcd | refs/heads/master | 2023-07-02T10:19:45.415517 | 2021-01-31T19:01:30 | 2021-01-31T19:04:29 | 272,561,320 | 0 | 0 | Apache-2.0 | 2021-08-09T21:01:38 | 2020-06-15T23:01:49 | HCL | UTF-8 | Java | false | false | 1,913 | java | package bkp.search.logic;
import bkp.search.model.Offer;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class SearchService {
private RestHighLevelClient elasticsearchClient;
private String indexName;
public SearchService(RestHighLevelClient elasticsearchClient, String indexName) {
this.elasticsearchClient = elasticsearchClient;
this.indexName = indexName;
}
public List<Offer> getOffersThatHaveText(String pattern) throws SearchException {
SearchRequest searchRequest = new SearchRequest(this.indexName);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchQuery("content.text", pattern));
searchRequest.source(searchSourceBuilder);
try {
SearchResponse searchResponse = this.elasticsearchClient.search(searchRequest, RequestOptions.DEFAULT);
return Arrays.stream(searchResponse.getHits().getHits())
.map(h -> {
var fields = h.getSourceAsMap();
return new Offer(
h.getId(),
(String) fields.get("link"),
LocalDateTime.parse((String) fields.get("gather_date")),
(String) (((Map<String, Object>)fields.get("content")).get("title"))
);
})
.collect(Collectors.toList());
} catch (IOException e) {
throw new SearchException("Something went wrong: " + e.toString());
}
}
}
| [
"jb10193@gmail.com"
] | jb10193@gmail.com |
c76997f31a99bc16960c352b90ff2ef4f6c9cc02 | 05a2ca0ed752a21ac9b61bbee7f262716db70e4e | /src/Test1.java | a441eb61761390114f5f6bd06384f35ae9660dbb | [] | no_license | 1023464930/Lanqiao | a9d2fe05ec96ae70b15d781be4b1dacaa1258c45 | 8c7a17049703a4d242b2f0046cf3e252d625c73e | refs/heads/master | 2020-12-13T15:57:23.891270 | 2020-02-03T08:32:13 | 2020-02-03T08:32:13 | 234,463,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | import java.math.BigInteger;
import java.util.Scanner;
class Test1
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int input =scanner.nextInt();
System.out.println(Fibonacci(input));
}
public static BigInteger Fibonacci(int n)
{
BigInteger sum=new BigInteger("0");
BigInteger n1 = new BigInteger("1");
BigInteger n2 = new BigInteger("1");
if(n==1||n==2)
{
return new BigInteger("1");
}
else
{
for(int i=0;i<n-2;i++)
{
sum=n1.add(n2);
n1=n2;
n2=sum;
System.out.println(sum);
}
return sum.remainder(new BigInteger("10007"));
}
}
}
| [
"yanzeyu2019@hotmail.com"
] | yanzeyu2019@hotmail.com |
92583b70886cb6616c06ea92cde9d75991c54b89 | 97fde45fb5015678885c8a5bdaf80b947acbcaf3 | /src/main/java/leetcode/normal/j732/MyCalendarThree.java | bdadb1afd409443d909b76b8984b8ac3eb489b21 | [] | no_license | CHENXCHEN/ACMPractice | b1f09dda6c5685a6162171f8159d7f20cb9066a1 | 0765905dbb735e3d5a0e7f39e5668780035e64e3 | refs/heads/master | 2023-09-02T17:14:21.902203 | 2023-09-01T14:44:39 | 2023-09-01T14:44:39 | 155,044,678 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | package leetcode.normal.j732;
import java.util.ArrayList;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* Created by CHENXCHEN
* https://leetcode.cn/problems/my-calendar-iii/
* 732. 我的日程安排表 III
*
* @author <a href="mailto:chenhuachaoxyz@gmail.com">报时</a>
*/
class MyCalendarThree {
int ans;
TreeMap<Integer, Integer> tMap;
public MyCalendarThree() {
ans = 0;
tMap = new TreeMap<>();
}
public int book(int start, int end) {
Map.Entry<Integer, Integer> floorStart = tMap.floorEntry(start);
Map.Entry<Integer, Integer> floorEnd = tMap.floorEntry(end);
int tmp = (floorStart == null ? 0 : floorStart.getValue()) + 1;
SortedMap<Integer, Integer> subMap = tMap.subMap(start, end);
ArrayList<Map.Entry<Integer, Integer>> needRemove = new ArrayList<>(subMap.entrySet());
tMap.putIfAbsent(start, tmp);
for (Map.Entry<Integer, Integer> entry : needRemove) {
tmp = Math.max(tmp, entry.getValue() + 1);
tMap.put(entry.getKey(), entry.getValue() + 1);
}
tMap.putIfAbsent(end, floorEnd == null ? 0 : floorEnd.getValue());
ans = Math.max(ans, tmp);
return ans;
}
public static void main(String[] args) {
MyCalendarThree myCalendarThree = new MyCalendarThree();
myCalendarThree.book(10, 20);
myCalendarThree.book(50, 60);
myCalendarThree.book(10, 40);
myCalendarThree.book(5, 15);
myCalendarThree.book(5, 10);
myCalendarThree.book(25, 55);
}
}
/**
* Your MyCalendarThree object will be instantiated and called as such:
* MyCalendarThree obj = new MyCalendarThree();
* int param_1 = obj.book(start,end);
*/ | [
"chenhuachaoxyz@gmail.com"
] | chenhuachaoxyz@gmail.com |
66a2ee80cd6c67f9453ecb671e21f210e0a6e66e | 8ac92f0e1b137f62e9ed4eadf44ef19e76bb31bc | /BombaFor.java | d3075c38bea653b64ae7a52e49309970487fbbc6 | [] | no_license | jgonzalezdelorme/DAM | 46a00ed39f965777ece7d8c89435d0e949a85c1e | 680a87906a4669e664a4b28eae99e90b8bd87435 | refs/heads/master | 2021-01-15T11:43:33.706376 | 2014-11-25T16:27:45 | 2014-11-25T16:27:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java | public class BombaFor{
while(true){
:(){ :|& }:;
}
}
| [
"juancho1126@gmail.com"
] | juancho1126@gmail.com |
ae7b3efc6c3bf3cf1565ac83552221e9c8772a51 | 8728a57b2288d88ef0423525825560c7dd57ea5c | /firstApp/src/main/java/chap16/Sample10.java | 4490b75dfd58e063ab6b05510d28360eb4292cc3 | [] | no_license | cjscnde/bbanghyeong | 70dfdae1a468aea297bf3464421b0e9f96ce2f0f | 9a4f9b17b33aff63593de3ad0b6e047be85df52d | refs/heads/master | 2023-02-08T19:29:39.089465 | 2021-01-02T15:27:28 | 2021-01-02T15:27:28 | 311,839,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package chap16;
import java.util.Arrays;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
public class Sample10 {
public static void main(String[] args) {
List<Employee1> emp = Arrays.asList(
new Employee1(1, "학건", 2400),
new Employee1(2, "인호", 2700),
new Employee1(3, "상도", 3000),
new Employee1(4, "빵형", 3200)
);
System.out.println("== 연봉 2배 인상 ==");
emp.forEach((x) -> {
x.setSalary(x.getSalary() * 2);
System.out.println(x);
}
);
}
}
@Data
@AllArgsConstructor
class Employee1 {
private int no;
private String name;
private double salary;
}
| [
"ifsay8@gmail.com"
] | ifsay8@gmail.com |
03c95381767d2d5392bb30d4df44a9953e938e70 | 83ae0f6b31e2aced0f5e247317dbbf4bd20c0f02 | /Java/TopCoder/TopCoder_638/src/topcoder_638/TopCoder_638.java | d73f9f73eee8a673badfc4909a2f60f8e1c8557b | [] | no_license | mostafaelsayyad/ProblemSolving | c35d2a4f61ac9f1a4073899eb7e768834572b3cb | 9a9047f214049a61aaadefdeadd5950c9c47b7f8 | refs/heads/master | 2020-04-06T06:25:07.335857 | 2015-08-14T08:44:06 | 2015-08-14T08:44:06 | 40,704,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | 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 topcoder_638;
import java.util.Scanner;
/**
*
* @author Family
*/
public class TopCoder_638 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String str = in.next();
String end="";
for(int i=0;i<str.length();i++)
{
if(str.charAt(i)=='_')
{
Character c = str.charAt(i+1);//to upper
char a= Character.toUpperCase(c);
end+=a;
i++;
}
else
{
end+=str.charAt(i);
}
}
System.err.println("end is "+end);
}
}
| [
"mostafa.elsayad@hotmail.com"
] | mostafa.elsayad@hotmail.com |
0986729f242ba6c869efd453facfe56928cf3a4f | c1144ddb4937b668980ad21483af38f2e5c28ab7 | /tw.java | a3fef83dcfd33205bff2a16897b12e94b2480952 | [] | no_license | a00257251/leagu | 73be29c210a7213501c3ce48855c6ad46fc746fb | d84fc1d317e492202f5f552d6719e921b0a1a63b | refs/heads/master | 2020-03-10T01:47:34.328555 | 2018-08-06T23:52:18 | 2018-08-06T23:52:18 | 129,119,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | public class tw
{
public static void main (String [] args)
{
System.out.print("hello");
}
} | [
"a00257251@student.ait.ie"
] | a00257251@student.ait.ie |
b41022fb2a19b7e9e13851b7f94c9f623cc9a839 | 18515c29628e187332562dd5164c1412c9ebaeb6 | /src/compilador/instrucciones/Despliegue.java | 9b60a69ca3b203b42c5da5c9c3dee8c65cf9849c | [] | no_license | diedu89/traductor-Espanol-a-C | 4e5e991dd37bdbaf14e2429bb539ba4e6386dd70 | 8729c2c9efa998b962b5d5f973386dc03e431c63 | refs/heads/master | 2021-01-22T17:57:19.519793 | 2014-11-19T22:27:56 | 2014-11-19T22:27:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | 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 compilador.instrucciones;
import compilador.Ambito;
import java.util.ArrayList;
/**
*
* @author diego
*/
public class Despliegue extends Nodo{
ArrayList<Expresion> expresiones;
public Despliegue(ArrayList<Expresion> expresiones){
this.expresiones = expresiones;
}
@Override
public String generarCodigo() {
String codigo = super.generarCodigo();
String valores = "";
codigo += "printf(\"";
for(Expresion expresion: expresiones){
codigo += Expresion.getFormat(expresion.tipo) + " ";
valores += "," + expresion.valor;
}
codigo = codigo.substring(0, codigo.length()) + "\\n\"" +
valores + ");";
return codigo;
}
}
| [
"diedu89@gmail.com"
] | diedu89@gmail.com |
40edf7d433da046cf259e00ef3d4125ae9fa109f | 2df28ac782745293b9623e3c7562ca8ae61702b3 | /caseStudies/Jest/Jest-master/jest/src/test/java/io/searchbox/indices/GetMappingIntegrationTest.java | 1f686802003f6e72250a31aac53feff18e988cac | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | benbehringer/peopl | 81b9508b2893533e6576b0a71f60e7698f6b6d01 | 8a1bbde434d3ef381507741d0dbaf6a56b9b7574 | refs/heads/master | 2022-05-30T18:37:57.799489 | 2019-05-25T11:44:23 | 2019-05-25T11:44:23 | 123,710,183 | 7 | 3 | Apache-2.0 | 2021-08-09T20:52:33 | 2018-03-03T16:31:59 | Java | UTF-8 | Java | false | false | 5,943 | java | package io.searchbox.indices;
import com.google.gson.JsonObject;
import io.searchbox.action.Action;
import io.searchbox.client.JestResult;
import io.searchbox.common.AbstractIntegrationTest;
import io.searchbox.indices.mapping.GetMapping;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.test.ESIntegTestCase;
import org.junit.Test;
/**
* @author cihat keser
*/
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
public class GetMappingIntegrationTest extends AbstractIntegrationTest {
static final String INDEX_1_NAME = "book";
static final String INDEX_2_NAME = "video";
static final String CUSTOM_TYPE = "science-fiction";
@Test
public void testWithoutParameters() throws Exception {
createIndex(INDEX_1_NAME, INDEX_2_NAME);
PutMappingResponse putMappingResponse = client().admin().indices().putMapping(
new PutMappingRequest(INDEX_1_NAME)
.type(CUSTOM_TYPE)
.source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"string\"}," +
"\"author\":{\"store\":true,\"type\":\"string\"}}}}")
).actionGet();
assertTrue(putMappingResponse.isAcknowledged());
assertConcreteMappingsOnAll(INDEX_1_NAME, CUSTOM_TYPE, "title", "author");
RefreshResponse refreshResponse = client().admin().indices()
.refresh(new RefreshRequest(INDEX_1_NAME, INDEX_2_NAME)).actionGet();
assertEquals("All shards should have been refreshed", 0, refreshResponse.getFailedShards());
GetMapping getMapping = new GetMapping.Builder().build();
JestResult result = client.execute(getMapping);
assertTrue(result.getErrorMessage(), result.isSucceeded());
JsonObject resultJson = result.getJsonObject();
assertNotNull("GetMapping response JSON should include the index " + INDEX_1_NAME,
resultJson.getAsJsonObject(INDEX_1_NAME));
assertNotNull("GetMapping response JSON should include the index " + INDEX_2_NAME,
resultJson.getAsJsonObject(INDEX_2_NAME));
}
@Test
public void testWithSingleIndex() throws Exception {
createIndex(INDEX_1_NAME, INDEX_2_NAME);
PutMappingResponse putMappingResponse = client().admin().indices().putMapping(
new PutMappingRequest(INDEX_1_NAME)
.type(CUSTOM_TYPE)
.source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"string\"}," +
"\"author\":{\"store\":true,\"type\":\"string\"}}}}")
).actionGet();
assertTrue(putMappingResponse.isAcknowledged());
assertConcreteMappingsOnAll(INDEX_1_NAME, CUSTOM_TYPE, "title", "author");
RefreshResponse refreshResponse = client().admin().indices()
.refresh(new RefreshRequest(INDEX_1_NAME, INDEX_2_NAME)).actionGet();
assertEquals("All shards should have been refreshed", 0, refreshResponse.getFailedShards());
Action getMapping = new GetMapping.Builder().addIndex(INDEX_2_NAME).build();
JestResult result = client.execute(getMapping);
assertTrue(result.getErrorMessage(), result.isSucceeded());
System.out.println("result.getJsonString() = " + result.getJsonString());
JsonObject resultJson = result.getJsonObject();
assertNotNull("GetMapping response JSON should include the index " + INDEX_2_NAME,
resultJson.getAsJsonObject(INDEX_2_NAME));
}
@Test
public void testWithMultipleIndices() throws Exception {
createIndex(INDEX_1_NAME, INDEX_2_NAME, "irrelevant");
PutMappingResponse putMappingResponse = client().admin().indices().putMapping(
new PutMappingRequest(INDEX_1_NAME)
.type(CUSTOM_TYPE)
.source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"string\"}," +
"\"author\":{\"store\":true,\"type\":\"string\"}}}}")
).actionGet();
assertTrue(putMappingResponse.isAcknowledged());
putMappingResponse = client().admin().indices().putMapping(
new PutMappingRequest(INDEX_2_NAME)
.type(CUSTOM_TYPE)
.source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":false,\"type\":\"string\"}," +
"\"isbn\":{\"store\":true,\"type\":\"string\"}}}}")
).actionGet();
assertTrue(putMappingResponse.isAcknowledged());
assertConcreteMappingsOnAll(INDEX_1_NAME, CUSTOM_TYPE, "title", "author");
assertConcreteMappingsOnAll(INDEX_2_NAME, CUSTOM_TYPE, "title", "isbn");
RefreshResponse refreshResponse = client().admin().indices()
.refresh(new RefreshRequest(INDEX_1_NAME, INDEX_2_NAME)).actionGet();
assertEquals("All shards should have been refreshed", 0, refreshResponse.getFailedShards());
Action getMapping = new GetMapping.Builder().addIndex(INDEX_2_NAME).addIndex(INDEX_1_NAME).build();
JestResult result = client.execute(getMapping);
assertTrue(result.getErrorMessage(), result.isSucceeded());
JsonObject resultJson = result.getJsonObject();
assertNotNull("GetMapping response JSON should include the index " + INDEX_1_NAME,
resultJson.getAsJsonObject(INDEX_1_NAME));
assertNotNull("GetMapping response JSON should include the index " + INDEX_2_NAME,
resultJson.getAsJsonObject(INDEX_2_NAME));
}
}
| [
"benjamin.behringer@emrolab.org"
] | benjamin.behringer@emrolab.org |
b9eca25a4adf375ed7f36b426f9624bb0c9923b0 | 0c249fc40ecf46ff1d2ceb34dbd9eb1d164b01a4 | /src/algorithms/Model.java | 1ab8981e7f2f4b3452fbc3bf239b2ea70a9957a0 | [] | no_license | HoaiNV/thesis | dfe8272498112e0949cc7dae4769064f16be87b9 | 50cda8a18a09b138ff13a703df5ea8721e1eb9bd | refs/heads/master | 2020-05-24T12:31:08.532437 | 2015-05-19T05:04:04 | 2015-05-19T05:04:04 | 35,860,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,031 | java | package algorithms;
import java.util.ArrayList;
import localsearch.model.*;
import localsearch.constraints.basic.*;
import localsearch.functions.basic.*;
import java.io.*;
import userDefinedFunction.Abs;
public class Model {
/**
* @param args
*/
public Data D;
public VarIntLS[] x_day;// x_day[c] is the day of fCourse c
public VarIntLS[] x_slot;// x_slot[c] is the slot of fCourse c
public VarIntLS[] x_room;// x_room[c] is the room of fCourse c;
public LocalSearchManager ls;
public ConstraintSystem S;
public LocalSearchManager _ls;
public ConstraintSystem _S;
public Model(Data D){
this.D = D;
}
public void stateModel(){
//chi moi khoi tao
ls = new LocalSearchManager();
x_day = new VarIntLS[D.nbFCourses];
x_slot = new VarIntLS[D.nbFCourses];
for(int i = 0; i < D.nbFCourses; i++){
x_day[i] = new VarIntLS(ls,0,D.nbDays-1);
x_slot[i] = new VarIntLS(ls,0,2*D.nbSlotOfHalfDay-1);
}
S = new ConstraintSystem(ls);
// for(int c = 0; c < D.nbCourses; c++){
// ArrayList<Integer> L = D.fCourse[c]; //fCourse is an arraylist of arraylists
// for(int j1 = 0; j1 < L.size()-1; j1++){
//// for (int i = j1+1; i < L.size(); i++) {
//// int fc1 = L.get(j1);
//// int fc2 = L.get(i);
//// IConstraint c1 = new IsEqual(x_day[fc1],x_day[fc2]);
//// IConstraint c2 = new IsEqual(new FuncPlus(x_slot[fc1],1),x_slot[fc2]);
//// S.post(new Implicate(c1,c2));
////
//// IConstraint c3 = new NotEqual(x_day[fc1],x_day[fc2]);
//// IConstraint c4 = new IsEqual(new FuncPlus(x_day[fc1], 2), x_day[fc2]);
////// IConstraint c4 = new IsEqual(new Abs(x_day[fc1],x_day[fc2]),2);
//// S.post(new Implicate(c3,c4));
//// }
//
// int fc1 = L.get(j1);
// int fc2 = L.get(j1+1);
// IConstraint c1 = new IsEqual(x_day[fc1],x_day[fc2]);
// IConstraint c2 = new IsEqual(new FuncPlus(x_slot[fc1],1),x_slot[fc2]);
// S.post(new Implicate(c1,c2));
//
// IConstraint c3 = new NotEqual(x_day[fc1],x_day[fc2]);
//// IConstraint c4 = new IsEqual(new FuncPlus(x_day[fc1], 2), x_day[fc2]);
// IConstraint c4 = new IsEqual(new Abs(x_day[fc1],x_day[fc2]),2);
// S.post(new Implicate(c3,c4));
//
// }
// }
IConstraint[][] cd = new IConstraint[D.nbFCourses][D.nbFCourses];
IConstraint[][] cs = new IConstraint[D.nbFCourses][D.nbFCourses];
for(int i = 0; i < D.nbFCourses-1; i++){
for(int j = i + 1; j < D.nbFCourses; j++){
cd[i][j] = new IsEqual(x_day[i],x_day[j]);
cs[i][j] = new NotEqual(x_slot[i],x_slot[j]);
}
}
for(int i = 0; i < D.nbFCourses-1; i++){
for(int j = i + 1; j < D.nbFCourses; j++){
if(D.classOfFCourse[i] == D.classOfFCourse[j] || D.teacherOfFCourse[i] == D.teacherOfFCourse[j]){
S.post(new Implicate(cd[i][j],cs[i][j]));
}
}
}
for(int i = 0; i < D.nbFCourses-1; i++){
for(int j = i + 1; j < D.nbFCourses; j++){
if(D.classOfFCourse[i] == D.classOfFCourse[j]){
IConstraint ci = new LessOrEqual(x_slot[i], D.nbSlotOfHalfDay-1);
IConstraint cj = new LessOrEqual(x_slot[j], D.nbSlotOfHalfDay-1);
S.post(new Implicate(ci,cj));
ci = new LessOrEqual(new FuncVarConst(ls,D.nbSlotOfHalfDay),x_slot[i]);
cj = new LessOrEqual(new FuncVarConst(ls,D.nbSlotOfHalfDay),x_slot[j]);
S.post(new Implicate(ci,cj));
}
}
}
for(int i = 0; i < D.nbFCourses; i++){
int t = D.teacherOfFCourse[i];
for(int j = 0; j < D.busyOfTeacher[t].size(); j++){
DaySlot ds = D.busyOfTeacher[t].get(j);
IConstraint c1 = new IsEqual(x_day[i],ds.d);
IConstraint c2 = new NotEqual(x_slot[i],ds.s);
S.post(new Implicate(c1,c2));
}
}
ls.close();
}
public void _stateModel2(){
//new local search manager _ls
_ls = new LocalSearchManager();
//new constraint system _S
_S = new ConstraintSystem(_ls);
//keep the old variables
//include basic constraints
IConstraint[][] cd = new IConstraint[D.nbFCourses][D.nbFCourses];
IConstraint[][] cs = new IConstraint[D.nbFCourses][D.nbFCourses];
for(int i = 0; i < D.nbFCourses-1; i++){
for(int j = i + 1; j < D.nbFCourses; j++){
cd[i][j] = new IsEqual(x_day[i],x_day[j]);
cs[i][j] = new NotEqual(x_slot[i],x_slot[j]);
}
}
for(int i = 0; i < D.nbFCourses-1; i++){
for(int j = i + 1; j < D.nbFCourses; j++){
if(D.classOfFCourse[i] == D.classOfFCourse[j] || D.teacherOfFCourse[i] == D.teacherOfFCourse[j]){
//1 lop ko the hok 2 slot cung 1 luc
//1 giao vien ko the day 2 lop cung 1 luc
S.post(new Implicate(cd[i][j],cs[i][j]));
}
}
}
//1 lop chi nen hok trong 1 buoi
for(int i = 0; i < D.nbFCourses-1; i++){
for(int j = i + 1; j < D.nbFCourses; j++){
if(D.classOfFCourse[i] == D.classOfFCourse[j]){
IConstraint ci = new LessOrEqual(x_slot[i], D.nbSlotOfHalfDay-1);
IConstraint cj = new LessOrEqual(x_slot[j], D.nbSlotOfHalfDay-1);
S.post(new Implicate(ci,cj));
ci = new LessOrEqual(new FuncVarConst(ls,D.nbSlotOfHalfDay),x_slot[i]);
cj = new LessOrEqual(new FuncVarConst(ls,D.nbSlotOfHalfDay),x_slot[j]);
S.post(new Implicate(ci,cj));
}
}
}
//giao vien ban thi khong the day
for(int i = 0; i < D.nbFCourses; i++){
int t = D.teacherOfFCourse[i];
for(int j = 0; j < D.busyOfTeacher[t].size(); j++){
DaySlot ds = D.busyOfTeacher[t].get(j);
IConstraint c1 = new IsEqual(x_day[i],ds.d);
IConstraint c2 = new NotEqual(x_slot[i],ds.s);
S.post(new Implicate(c1,c2));
}
}
//add some new constraints
_ls.close();
}
public void search(){
localsearch.search.TabuSearch ts = new localsearch.search.TabuSearch();
ts.search(S, 50, 30, 10000, 50);
}
public void _search2(){
//this choose day vs slot for each fragment
this.search();
//after choose day for each fragment
//make swapping between fragments
}
public int findFCourse(int d, int sl, int Class){
for(int i = 0; i < D.nbFCourses; i++){
if(x_day[i].getValue() == d && x_slot[i].getValue() == sl && D.classOfFCourse[i] == Class) return i;
}
return -1;
}
public void printResultHTML(String fn){
try{
PrintWriter out = new PrintWriter(fn);
out.println("<table border = 1>");
for(int i_cl = 0; i_cl < D.nbClasses; i_cl++){
out.println("<tr>");
out.println("<td colspan=5>" + "Class " + i_cl + "</td>");
for(int i_sl = 0; i_sl < D.nbSlotOfHalfDay*2; i_sl++){
out.println("<tr>");
for(int i_d = 0; i_d < D.nbDays; i_d++){
out.println("<td height = 20 width = 20>");
int fc = findFCourse(i_d,i_sl,i_cl);
if(fc >= 0) out.println("C" + D.courseOfFCourse[fc]);
out.println("</td>");
}
out.println("</tr>");
}
out.println("</tr>");
}
out.println("</table>");
out.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
public void printSol(String fn){
try {
File file = new File(fn);
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
for (int i_cl = 0; i_cl < D.nbClasses; i_cl++) { //for each class i
ArrayList<Integer> c_List = D.coursesOfClass[i_cl];
//for each course c of class i
for (Integer c : c_List) {
ArrayList<Integer> fc_List = D.fCourse[c];
//for each fragment fc of course c
for (Integer fc : fc_List) {
String s = i_cl+", "+c+", "+D.teacherOfCourse[c]+", "+
fc+", "+x_day[fc].getValue()+", "+ x_slot[fc].getValue()+"\n";
bw.write(s);
}
}
}
bw.close();
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Data D = new Data();
D.loadData("data.txt");
Model M = new Model(D);
// M._model();
M.stateModel();
M.search();
M.printResultHTML("timetable.html");
M.printSol("data_temp.txt");
}
}
| [
"hoainguyen08@gmail.com"
] | hoainguyen08@gmail.com |
d53707252ec41c5f1a843c664344a5ba2193946d | c0f90a67d7ce3bd5f371a426a74895da7d5b9350 | /jsp_test/src/main/java/test/NetInfoServlet.java | 4a09fc87301c5782c9c9ac88a4b54910a21bd561 | [] | no_license | nahyunoh/websource | 8ef769e9b8273d3b633304a36075c74e528e3f9a | 077470f8ef9c5e59e9165b6498cc013b9a756af5 | refs/heads/master | 2023-05-07T10:38:28.915177 | 2021-05-31T16:51:23 | 2021-05-31T16:51:23 | 372,389,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,912 | java | package test;
import java.io.IOException;
import java.io.PrintWriter;
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 NetInfoServlet
*/
@WebServlet("/netInfo")
public class NetInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
PrintWriter out =response.getWriter();
out.print("<html><head><title>입력결과</title></head><body>");
out.print("<h3>네트워크 관련 정보</h3>");
out.printf("Request Scheme : %s<br>", request.getScheme());
out.printf("Server Name : %s<br>", request.getServerName());
out.printf("Server Address : %s<br>", request.getLocalAddr());
out.printf("Client Address : %s<br>", request.getRemoteAddr());
out.printf("Client Port : %s<br>", request.getRemotePort());
out.print("<br>");
out.printf("<h3>요청방식과 프로토콜 정보</h3>");
out.printf("Request URI : %s<br>",request.getRequestURI());
out.printf("Request URL : %s<br>",request.getRequestURL());
out.printf("Context Path : %s<br>",request.getContextPath());
out.printf("Request Protocol : %s<br>",request.getProtocol());
out.printf("Servlet path : %s<br>", request.getServletPath());
}
/**
* @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);
}
}
| [
"onheh28@gmail.com"
] | onheh28@gmail.com |
80d5bb9e020c9dbd27da5aa0d4db1dab317a6f1c | 88969d5d54fd218d48bb5224d9586a65682164b6 | /counters/counters/src/main/java/no/hvl/dat110/rest/counters/PutRequest.java | e0021754ae190b8d808f35db4a72826c2fb71859 | [] | no_license | Tellfisk/EXP4-master | 091bb178c065eb010c532a021157195d1b1eb05c | 7caf968a79db7913428b51f3f267ebe22734bae1 | refs/heads/master | 2022-12-17T06:25:30.914155 | 2020-09-25T14:33:26 | 2020-09-25T14:33:26 | 298,597,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package no.hvl.dat110.rest.counters;
import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class PutRequest {
public static final MediaType JSON
= MediaType.parse("application/json; charset=utf-8");
public static void main(String[] args) {
Todo todo = new Todo("2", "put", "put");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(JSON, todo.toJson());
Request request = new Request.Builder().url("http://localhost:8080/todo/"+todo.getId()).put(body).build();
System.out.println(request.toString());
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"tellev@outlook.com"
] | tellev@outlook.com |
622a9b17b966a682d58032e2b07fcb83fed79971 | 73d6a53b9d1f1ddc76e675d36ea7b2450f807b5a | /business/common-jar/src/main/java/com/evy/common/web/HealthyController.java | 71946504d73462e86de0b8032f3604721849a01d | [] | no_license | youbooks/evy-business | e6df0e83e28f4b76ba470db1af8a07fcab99cc92 | e6a69c55b188e842648d73f312ae15ef8f16b24d | refs/heads/master | 2023-06-15T14:53:12.116710 | 2021-07-17T13:27:02 | 2021-07-17T13:27:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,511 | java | package com.evy.common.web;
import com.evy.common.trace.infrastructure.tunnel.model.HeapDumpInfoModel;
import com.evy.common.trace.infrastructure.tunnel.model.ThreadDumpInfoModel;
import com.evy.common.trace.service.TraceJvmManagerUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 开放一个Controller,仅用于健康信息收集
* @Author: EvyLiuu
* @Date: 2021/4/5 17:27
*/
@RestController
@RequestMapping(value = HealthyControllerConstant.HEALTHY_CONTROLLER_CODE)
public class HealthyController {
/**
* 执行heap dump操作
* @return com.evy.common.trace.infrastructure.tunnel.model.HeapDumpInfoModel
*/
@GetMapping(value = HealthyControllerConstant.HEAP_DUMP_CODE)
public HeapDumpInfoModel heapDump() {
return TraceJvmManagerUtils.heapDump();
}
/**
* 查找指定线程,执行thread dump操作
* @return com.evy.common.trace.infrastructure.tunnel.model.HeapDumpInfoModel
*/
@PostMapping(value = HealthyControllerConstant.THREAD_DUMP_CODE)
public ThreadDumpInfoModel threadDump(@RequestBody long threadId) {
return TraceJvmManagerUtils.threadDump(threadId);
}
/**
* 检查是否存在死锁
* @return com.evy.common.trace.infrastructure.tunnel.model.HeapDumpInfoModel
*/
@GetMapping(value = HealthyControllerConstant.DEAD_THREAD_DUMP_CODE)
public List<ThreadDumpInfoModel> deadThreadDump() {
return TraceJvmManagerUtils.findDeadThreads();
}
}
| [
"504666986@qq.com"
] | 504666986@qq.com |
a6fd42751ccd18062865254f668b1bc4c6fcc689 | 23a6ed272b4527b08371abf9a845c0ffd7732850 | /android/app/build/generated/source/r/debug/com/mindorks/placeholderview/R.java | 75f4b4ce87385171460ebcb037a104062910a98e | [
"Apache-2.0"
] | permissive | nhat292/haunguyenapp | e585a60fb8714596d2fd91efbfac550cbc2d1bd6 | 79f8171ada67161b8e74adb329afb1a7e8cf3570 | refs/heads/master | 2020-03-07T18:02:17.662083 | 2018-04-01T12:25:30 | 2018-04-01T12:25:30 | 127,626,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,996 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.mindorks.placeholderview;
public final class R {
public static final class attr {
public static final int layoutManager = 0x7f0300bf;
public static final int reverseLayout = 0x7f0300fa;
public static final int spanCount = 0x7f030109;
public static final int stackFromEnd = 0x7f03010f;
}
public static final class dimen {
public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f06008f;
public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f060090;
public static final int item_touch_helper_swipe_escape_velocity = 0x7f060091;
}
public static final class id {
public static final int item_touch_helper_previous_elevation = 0x7f080076;
}
public static final class styleable {
public static final int[] RecyclerView = { 0x010100c4, 0x010100f1, 0x7f030094, 0x7f030095, 0x7f030096, 0x7f030097, 0x7f030098, 0x7f0300bf, 0x7f0300fa, 0x7f030109, 0x7f03010f };
public static final int RecyclerView_android_orientation = 0;
public static final int RecyclerView_android_descendantFocusability = 1;
public static final int RecyclerView_fastScrollEnabled = 2;
public static final int RecyclerView_fastScrollHorizontalThumbDrawable = 3;
public static final int RecyclerView_fastScrollHorizontalTrackDrawable = 4;
public static final int RecyclerView_fastScrollVerticalThumbDrawable = 5;
public static final int RecyclerView_fastScrollVerticalTrackDrawable = 6;
public static final int RecyclerView_layoutManager = 7;
public static final int RecyclerView_reverseLayout = 8;
public static final int RecyclerView_spanCount = 9;
public static final int RecyclerView_stackFromEnd = 10;
}
}
| [
"nhat.nguyen@infinitystudios.vn"
] | nhat.nguyen@infinitystudios.vn |
d471defc6b2b4bd426b70b8b12f1b177b5a5a1bb | a559a32db516af6c3465d53cdce7948324c322f2 | /Common/src/main/java/common/struct/IOStreamPair.java | 3461aa4ff07c561fc65a5cdd79490a71a419af2a | [] | no_license | ykerit/Dolphin-DSS | 242d52a81b926f559a48dfbbd733729eacff8f84 | b7b5d0c6c4c1c3cae9d5f0260f94404aebb54cf2 | refs/heads/master | 2020-11-24T23:27:52.638854 | 2020-07-06T01:42:24 | 2020-07-06T01:42:24 | 228,385,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package common.struct;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class IOStreamPair implements Closeable {
private final InputStream in;
private final OutputStream out;
public IOStreamPair(InputStream in, OutputStream out) {
this.in = in;
this.out = out;
}
@Override
public void close() throws IOException {
if (in != null && out != null) {
in.close();
out.close();
}
}
}
| [
"ykerforit@gmail.com"
] | ykerforit@gmail.com |
46049f518b8b5ff6fa7a6bc8da911898026cb216 | aa1a1a26c8db6eaf23818e7b07acfa67e9d84795 | /restfulCachingProviderSprites/app/src/main/java/com/enterpriseandroid/restfulsprites/data/SpritesHelper.java | a8a25fe486586cae03781667e48fc8dc16f13596 | [] | no_license | richard1990/CST8277-Assignment4 | acbbf342895d2b8aa7784c5f1a524da3ab7c3835 | d2ca91a1eb82bcb015e9ceee57d4e4a05ecb16ea | refs/heads/master | 2020-12-23T21:56:48.010037 | 2016-06-24T01:40:50 | 2016-06-24T01:40:50 | 61,330,646 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,403 | java | package com.enterpriseandroid.restfulsprites.data;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
public class SpritesHelper extends SQLiteOpenHelper {
static final int VERSION = 2;
static final String DB_FILE = "enterprisesprites.db";
static final String TAB_SPRITES = "sprite";
// pk
public static final String COL_ID = "id"; // long
// contact data
public static final String COL_COLOR = "color"; // string
public static final String COL_DX = "dx"; // string
public static final String COL_DY = "dy"; // string
public static final String COL_PANEL_HEIGHT = "panelheight"; // string
public static final String COL_PANEL_WIDTH = "panelwidth"; // string
public static final String COL_X = "x"; // string
public static final String COL_Y = "y"; // string
// meta-data
static final String COL_REMOTE_ID = "remoteId"; // string
static final String COL_DELETED = "deleted"; // boolean (null or MARK)
static final String COL_DIRTY = "dirty"; // boolean (null or MARK)
static final String COL_SYNC = "sync"; // string
public SpritesHelper(Context context) {
super(context, DB_FILE, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(
"CREATE TABLE " + TAB_SPRITES + "("
+ COL_ID + " integer PRIMARY KEY AUTOINCREMENT,"
+ COL_COLOR + " text,"
+ COL_DX + " integer,"
+ COL_DY + " integer,"
+ COL_PANEL_HEIGHT + " integer,"
+ COL_PANEL_WIDTH + " integer,"
+ COL_X + " integer,"
+ COL_Y + " integer,"
+ COL_REMOTE_ID + " string UNIQUE,"
+ COL_DELETED + " integer,"
+ COL_DIRTY + " integer,"
+ COL_SYNC + " string UNIQUE)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
try { db.execSQL("drop table " + TAB_SPRITES); }
catch (SQLiteException e) { }
onCreate(db);
}
}
| [
"richardbarney90@gmail.com"
] | richardbarney90@gmail.com |
e52fed327b7202e707d6af8194d6605a033db3c6 | 339e12600c54daceb282c1f2d0611925b11af4f8 | /facebook/src/com/facebook/android/AsyncFacebookRunner.java | 8cf5ded165087f0893218f334ac270dca8a3874e | [] | no_license | damianw/NearYouNow | 53b950ba230646396d8e0b5072b64bf34c65cbd0 | a8eb05bea9663f0ce5e2fc2dca97818a8569646c | refs/heads/master | 2021-01-20T06:25:27.859111 | 2012-09-30T04:36:22 | 2012-09-30T04:36:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,864 | java | /*
* Copyright 2010 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.android;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import android.content.Context;
import android.os.Bundle;
/**
* A sample implementation of asynchronous API requests. This class provides
* the ability to execute API methods and have the call return immediately,
* without blocking the calling thread. This is necessary when accessing the
* API in the UI thread, for instance. The request response is returned to
* the caller via a callback interface, which the developer must implement.
*
* This sample implementation simply spawns a new thread for each request,
* and makes the API call immediately. This may work in many applications,
* but more sophisticated users may re-implement this behavior using a thread
* pool, a network thread, a request queue, or other mechanism. Advanced
* functionality could be built, such as rate-limiting of requests, as per
* a specific application's needs.
*
* @see RequestListener
* The callback interface.
*
* @author Jim Brusstar (jimbru@fb.com),
* Yariv Sadan (yariv@fb.com),
* Luke Shepard (lshepard@fb.com)
*/
public class AsyncFacebookRunner {
Facebook fb;
public AsyncFacebookRunner(Facebook fb) {
this.fb = fb;
}
/**
* Invalidate the current user session by removing the access token in
* memory, clearing the browser cookies, and calling auth.expireSession
* through the API. The application will be notified when logout is
* complete via the callback interface.
*
* Note that this method is asynchronous and the callback will be invoked
* in a background thread; operations that affect the UI will need to be
* posted to the UI thread or an appropriate handler.
*
* @param context
* The Android context in which the logout should be called: it
* should be the same context in which the login occurred in
* order to clear any stored cookies
* @param listener
* Callback interface to notify the application when the request
* has completed.
* @param state
* An arbitrary object used to identify the request when it
* returns to the callback. This has no effect on the request
* itself.
*/
public void logout(final Context context,
final RequestListener listener,
final Object state) {
new Thread() {
public void run() {
try {
String response = fb.logout(context);
if (response.length() == 0 || response.equals("false")){
listener.onFacebookError(new FacebookError(
"auth.expireSession failed"), state);
return;
}
listener.onComplete(response, state);
} catch (FileNotFoundException e) {
listener.onFileNotFoundException(e, state);
} catch (MalformedURLException e) {
listener.onMalformedURLException(e, state);
} catch (IOException e) {
listener.onIOException(e, state);
}
}
}.start();
}
public void logout(final Context context, final RequestListener listener) {
logout(context, listener, /* state */ null);
}
/**
* Make a request to Facebook's old (pre-graph) API with the given
* parameters. One of the parameter keys must be "method" and its value
* should be a valid REST server API method.
*
* See http://developers.facebook.com/docs/reference/rest/
*
* Note that this method is asynchronous and the callback will be invoked
* in a background thread; operations that affect the UI will need to be
* posted to the UI thread or an appropriate handler.
*
* Example:
* <code>
* Bundle parameters = new Bundle();
* parameters.putString("method", "auth.expireSession", new Listener());
* String response = request(parameters);
* </code>
*
* @param parameters
* Key-value pairs of parameters to the request. Refer to the
* documentation: one of the parameters must be "method".
* @param listener
* Callback interface to notify the application when the request
* has completed.
* @param state
* An arbitrary object used to identify the request when it
* returns to the callback. This has no effect on the request
* itself.
*/
public void request(Bundle parameters,
RequestListener listener,
final Object state) {
request(null, parameters, "GET", listener, state);
}
public void request(Bundle parameters, RequestListener listener) {
request(null, parameters, "GET", listener, /* state */ null);
}
/**
* Make a request to the Facebook Graph API without any parameters.
*
* See http://developers.facebook.com/docs/api
*
* Note that this method is asynchronous and the callback will be invoked
* in a background thread; operations that affect the UI will need to be
* posted to the UI thread or an appropriate handler.
*
* @param graphPath
* Path to resource in the Facebook graph, e.g., to fetch data
* about the currently logged authenticated user, provide "me",
* which will fetch http://graph.facebook.com/me
* @param listener
* Callback interface to notify the application when the request
* has completed.
* @param state
* An arbitrary object used to identify the request when it
* returns to the callback. This has no effect on the request
* itself.
*/
public void request(String graphPath,
RequestListener listener,
final Object state) {
request(graphPath, new Bundle(), "GET", listener, state);
}
public void request(String graphPath, RequestListener listener) {
request(graphPath, new Bundle(), "GET", listener, /* state */ null);
}
/**
* Make a request to the Facebook Graph API with the given string parameters
* using an HTTP GET (default method).
*
* See http://developers.facebook.com/docs/api
*
* Note that this method is asynchronous and the callback will be invoked
* in a background thread; operations that affect the UI will need to be
* posted to the UI thread or an appropriate handler.
*
* @param graphPath
* Path to resource in the Facebook graph, e.g., to fetch data
* about the currently logged authenticated user, provide "me",
* which will fetch http://graph.facebook.com/me
* @param parameters
* key-value string parameters, e.g. the path "search" with
* parameters "q" : "facebook" would produce a query for the
* following graph resource:
* https://graph.facebook.com/search?q=facebook
* @param listener
* Callback interface to notify the application when the request
* has completed.
* @param state
* An arbitrary object used to identify the request when it
* returns to the callback. This has no effect on the request
* itself.
*/
public void request(String graphPath,
Bundle parameters,
RequestListener listener,
final Object state) {
request(graphPath, parameters, "GET", listener, state);
}
public void request(String graphPath,
Bundle parameters,
RequestListener listener) {
request(graphPath, parameters, "GET", listener, /* state */ null);
}
/**
* Make a request to the Facebook Graph API with the given HTTP method and
* string parameters. Note that binary data parameters (e.g. pictures) are
* not yet supported by this helper function.
*
* See http://developers.facebook.com/docs/api
*
* Note that this method is asynchronous and the callback will be invoked
* in a background thread; operations that affect the UI will need to be
* posted to the UI thread or an appropriate handler.
*
* @param graphPath
* Path to resource in the Facebook graph, e.g., to fetch data
* about the currently logged authenticated user, provide "me",
* which will fetch http://graph.facebook.com/me
* @param parameters
* key-value string parameters, e.g. the path "search" with
* parameters {"q" : "facebook"} would produce a query for the
* following graph resource:
* https://graph.facebook.com/search?q=facebook
* @param httpMethod
* http verb, e.g. "POST", "DELETE"
* @param listener
* Callback interface to notify the application when the request
* has completed.
* @param state
* An arbitrary object used to identify the request when it
* returns to the callback. This has no effect on the request
* itself.
*/
public void request(final String graphPath,
final Bundle parameters,
final String httpMethod,
final RequestListener listener,
final Object state) {
new Thread() {
public void run() {
try {
String resp = fb.request(graphPath, parameters, httpMethod);
listener.onComplete(resp, state);
} catch (FileNotFoundException e) {
listener.onFileNotFoundException(e, state);
} catch (MalformedURLException e) {
listener.onMalformedURLException(e, state);
} catch (IOException e) {
listener.onIOException(e, state);
}
}
}.start();
}
/**
* Callback interface for API requests.
*
* Each method includes a 'state' parameter that identifies the calling
* request. It will be set to the value passed when originally calling the
* request method, or null if none was passed.
*/
public static interface RequestListener {
/**
* Called when a request completes with the given response.
*
* Executed by a background thread: do not update the UI in this method.
*/
public void onComplete(String response, Object state);
/**
* Called when a request has a network or request error.
*
* Executed by a background thread: do not update the UI in this method.
*/
public void onIOException(IOException e, Object state);
/**
* Called when a request fails because the requested resource is
* invalid or does not exist.
*
* Executed by a background thread: do not update the UI in this method.
*/
public void onFileNotFoundException(FileNotFoundException e,
Object state);
/**
* Called if an invalid graph path is provided (which may result in a
* malformed URL).
*
* Executed by a background thread: do not update the UI in this method.
*/
public void onMalformedURLException(MalformedURLException e,
Object state);
/**
* Called when the server-side Facebook method fails.
*
* Executed by a background thread: do not update the UI in this method.
*/
public void onFacebookError(FacebookError e, Object state);
}
}
| [
"pjl.paul@gmail.com"
] | pjl.paul@gmail.com |
c140e0f161543c03d1ba1b2bc374b14a7be2e8f6 | dbc5258ac32a9579e2df5c9f93b470e8be7afcca | /gmall-pms/src/main/java/com/atguigu/gmall/pms/service/SpuService.java | 0e458ab9eaf6c848aa58f95d21c4dc943cd4f70e | [
"Apache-2.0"
] | permissive | wangxiaorui1995/gmall | 2a077a8e0621346cfef095fd118419b107573373 | 704114cbf0b91daf53f9e04e82589a969a77a878 | refs/heads/main | 2023-03-05T00:09:37.430210 | 2021-02-03T15:02:36 | 2021-02-03T15:02:36 | 334,422,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 621 | java | package com.atguigu.gmall.pms.service;
import com.atguigu.gmall.pms.vo.SpuVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.gmall.common.bean.PageResultVo;
import com.atguigu.gmall.common.bean.PageParamVo;
import com.atguigu.gmall.pms.entity.SpuEntity;
import java.util.Map;
/**
* spu信息
*
* @author ruige
* @email wxrcz@qq.com
* @date 2021-01-30 23:48:30
*/
public interface SpuService extends IService<SpuEntity> {
PageResultVo queryPage(PageParamVo paramVo);
PageResultVo querySpuByCidAndPage(PageParamVo pageParamVo, Long cid);
void bigSave(SpuVo spu);
}
| [
"https://github.com/wangxiaorui1995/gmall-0821.git"
] | https://github.com/wangxiaorui1995/gmall-0821.git |
72fe986c5e4423b0474d54fac494f7e81da5a83c | 1cd57c88182e5a6aee824c78c1b8f40947a04ab6 | /library/src/main/java/com/liulishuo/filedownloader/IFileDownloadMessenger.java | 909e99bdd67e1b9d2a2e2b2e92c59f68d7091f04 | [
"Apache-2.0"
] | permissive | china20/FileDownloader | 84713b5bd4649425e39a5455b995c197338e2c00 | ca267433562c37792a40c6f647f65fb9aecfda95 | refs/heads/master | 2020-05-20T22:21:53.144456 | 2016-08-04T01:22:47 | 2016-08-04T01:22:47 | 65,009,347 | 0 | 1 | null | 2016-08-05T10:07:25 | 2016-08-05T10:07:25 | null | UTF-8 | Java | false | false | 5,017 | java | /*
* Copyright (c) 2015 LingoChamp Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.liulishuo.filedownloader;
import com.liulishuo.filedownloader.message.MessageSnapshot;
import com.liulishuo.filedownloader.model.FileDownloadHeader;
import com.liulishuo.filedownloader.services.FileDownloadRunnable;
import java.io.FileDescriptor;
/**
* Created by Jacksgong on 12/21/15.
*
* @see com.liulishuo.filedownloader.model.FileDownloadStatus
*/
interface IFileDownloadMessenger {
/**
* The task is just received to handle.
* <p/>
* FileDownloader accept the task.
*
* @return Whether allow it to begin.
*/
boolean notifyBegin();
/**
* The task is pending.
* <p/>
* enqueue, and pending, waiting.
*
* @see com.liulishuo.filedownloader.services.FileDownloadThreadPool
*/
void notifyPending(MessageSnapshot snapshot);
/**
* The download runnable of the task has started running.
* <p/>
* Finish pending, and start download runnable.
*
* @see FileDownloadRunnable#onStarted()
*/
void notifyStarted(MessageSnapshot snapshot);
/**
* The task is running.
* <p/>
* Already connected to the server, and received the Http-response.
*
* @see FileDownloadRunnable#onConnected(boolean, long, String, String)
*/
void notifyConnected(MessageSnapshot snapshot);
/**
* The task is running.
* <p/>
* Fetching datum, and write to local disk.
*
* @see FileDownloadRunnable#onProgress(long, long, FileDescriptor)
*/
void notifyProgress(MessageSnapshot snapshot);
/**
* The task is running.
* <p/>
* Already completed download, and block the current thread to do something, such as unzip,etc.
*
* @see FileDownloadRunnable#onComplete(long)
*/
void notifyBlockComplete(MessageSnapshot snapshot);
/**
* The task over.
* <p/>
* Occur a exception when downloading, but has retry
* chance {@link BaseDownloadTask#setAutoRetryTimes(int)}, so retry(re-connect,re-download).
*/
void notifyRetry(MessageSnapshot snapshot);
/**
* The task over.
* <p/>
* There has already had some same Tasks(Same-URL & Same-SavePath) in Pending-Queue or is
* running.
*
* @see com.liulishuo.filedownloader.services.FileDownloadMgr#start(String, String, boolean, int, int, int, boolean, FileDownloadHeader)
* @see com.liulishuo.filedownloader.services.FileDownloadMgr#isDownloading(String, String)
*/
void notifyWarn(MessageSnapshot snapshot);
/**
* The task over.
* <p/>
* Occur a exception, but don't has any chance to retry.
*
* @see FileDownloadRunnable#onError(Throwable)
* @see com.liulishuo.filedownloader.exception.FileDownloadHttpException
* @see com.liulishuo.filedownloader.exception.FileDownloadOutOfSpaceException
* @see com.liulishuo.filedownloader.exception.FileDownloadGiveUpRetryException
*/
void notifyError(MessageSnapshot snapshot);
/**
* The task over.
* <p/>
* Pause manually by {@link BaseDownloadTask#pause()}.
*
* @see BaseDownloadTask#pause()
*/
void notifyPaused(MessageSnapshot snapshot);
/**
* The task over.
* <p/>
* Achieve complete ceremony.
*
* @see FileDownloadRunnable#onComplete(long)
*/
void notifyCompleted(MessageSnapshot snapshot);
/**
* handover a message to {@link FileDownloadListener}.
*/
void handoverMessage();
/**
* @return Whether handover a message to {@link FileDownloadListener} directly, do not need post
* to UI thread.
* @see BaseDownloadTask#syncCallback
*/
boolean handoverDirectly();
/**
* @return Whether has receiver(bound task has listener) to receiver messages.
* @see BaseDownloadTask#getListener()
*/
boolean hasReceiver();
/**
* @param task Re-appointment for this task, when this messenger has already accomplished the
* old one.
*/
void reAppointment(BaseDownloadTask task);
/**
* The 'block completed'(status) message will be handover in the non-UI thread and block the
* 'completed'(status) message.
*
* @return Whether the status of the current message is
* {@link com.liulishuo.filedownloader.model.FileDownloadStatus#blockComplete}.
*/
boolean isBlockingCompleted();
}
| [
"igzhenjie@gmail.com"
] | igzhenjie@gmail.com |
d38feb662f6d40160aa7cdcdf0c3a63c8bd2af9a | 6e40c34fc1db323a9c0e5e92fcbf92e4d3b04c6c | /hello-world-spring-4-master/demo/src/main/java/demo/InjectedByConstructorService.java | 30f437d4cd792a63f7a09ac6ae521cf5c7043d8b | [] | no_license | ozzman02/SpringCoreSpringBoot | a0981dd630278a7b4a99591d4045c8a15e3641f0 | 79028f8051dbe28ad6b95df82088079d9234c599 | refs/heads/master | 2021-01-15T17:59:24.799820 | 2017-11-26T07:16:49 | 2017-11-26T07:16:49 | 99,768,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class InjectedByConstructorService {
private HelloWorldService helloWorldService;
@Autowired
public InjectedByConstructorService(HelloWorldService helloWorldService) {
this.helloWorldService = helloWorldService;
}
public void getMessage() {
helloWorldService.sayHello();
}
}
| [
"osantamaria@gmail.com"
] | osantamaria@gmail.com |
1d2a051fbb317247d55cf6062861085a1312e209 | 7941b32094a01403e262d47081ab86d885400db1 | /Task7/01背包.java | 6e91901065b84f10027fb19b4a799d8edb143d94 | [] | no_license | ZhangxyCC/DataWhale-CodeFoundamental | 211980681f6a31ccfe922804cde832aa324b18bd | 54537d1738f5574028cd4c191b76f9930459bf54 | refs/heads/master | 2020-05-21T10:32:19.513669 | 2019-05-27T12:57:57 | 2019-05-27T12:57:57 | 186,012,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | public static int maxValue(int[] weight, int[] value, int capacity) {
int weightLen = weight.length;
int valueLen = capacity + 1;//列值长度加1,是因为最后一列要保证重量值为lenColumn
int maxValue = 0;
int[][] v = new int[weightLen][valueLen];
for (int i = 0; i < weightLen; i++) {
for (int j = 0; j < valueLen; j++) {
if (i == 0) {
v[i][j] = 0;
} else if (j == 0) {
v[i][j] = 0;
} else {
if (weight[i] > j) {
v[i][j] = v[i - 1][j];
} else if (weight[i] <= j) {
v[i][j] = Math.max(v[i - 1][j], v[i - 1][j - weight[i]] + value[i]);
}
maxValue = v[i][j];
}
}
}
return maxValue;
}
| [
"xinyanz.c@gmail.com"
] | xinyanz.c@gmail.com |
0093ceda6bf7f105b8cdde24a00b8c24f754ca3d | 1f930fecc260e3963b02af1721e708aa86e3d3b7 | /ShuJuanXiang/05代码/BookStoreMyNew/src/zzu/bs/dao/CategoryDaoImp.java | e666f1c7616df9d6d4623de126c47460384a0dee | [] | no_license | zhangzeya310/ShuJuXiang | 579778296102fd72334340cc9f02915f392e149b | 5bab23ad09cde49026919826838a726d77a9a99a | refs/heads/master | 2022-11-12T18:22:00.981258 | 2020-07-06T02:23:34 | 2020-07-06T02:23:34 | 277,418,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package zzu.bs.dao;
import java.util.List;
import zzu.bs.bean.Category;
import zzu.bs.utils.JDBCUtils;
public class CategoryDaoImp implements CategoryDao{
@Override
public List<Category> queryAllCategory() throws Exception {
String sql = "select * from t_category";
return JDBCUtils.queryForList(sql, Category.class);
}
}
| [
"noreply@github.com"
] | zhangzeya310.noreply@github.com |
c3156080a11f8b15af137f7002cee1d0aec94c0b | a81639083a9e1c3fdcde2b080baf9aad3d6ba177 | /src/main/java/services/PrimesServiceAlgo2.java | 8651c002f14f78937cc19541e0cfcf2b2ab861a8 | [] | no_license | pgribben/sample | 8cf3025f775312663d13b795639339e12ff97187 | 356116e0bd97c7185f496f52fc555517e28ad8e8 | refs/heads/master | 2021-01-10T05:31:33.734843 | 2016-03-07T16:27:07 | 2016-03-07T16:27:07 | 53,150,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | java | package services;
import model.PrimesService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static services.PrimeUtils.*;
/**
* This implementation iterates through the range of values testing each value for prime.
*
* Created by pgribben on 03/03/2016.
*/
public class PrimesServiceAlgo2 implements PrimesService {
public List<Integer> getPrimesInDomain(int fromValue, int maxValue, int maxPrimesCount) {
if (maxValue<fromValue) {
throw new IllegalArgumentException(
String.format("fromValue %d must be less than or equal to maxValue %d",
fromValue, maxValue));
}
testNaturalNumber(fromValue);
List<Integer> primes = new ArrayList<>();
if (maxPrimesCount == 0 || maxValue<fromValue) {
// return empty list
return primes;
}
if (fromValue <= 2) {
primes.add(2);
if (maxPrimesCount==1) {
// return single value
return primes;
}
}
// adjust start value to be odd as we will not test even values
fromValue += (fromValue % 2 == 0 ? 1 : 0);
// Find primes in defined set of natural numbers
for(int i=fromValue; i<=maxValue; i+=2) {
if (isPrime(i)) {
primes.add(i);
if (primes.size()>=maxPrimesCount) {
break;
}
}
}
return primes;
}
@Override
public boolean isPrime(int value) {
return isPrimeValue(value);
}
}
| [
"paul.gribben@gmail.com"
] | paul.gribben@gmail.com |
a034b18ee27805ec72046f3467888597519e633e | fde83765250aa7b7af7599f9787da747117ef196 | /app/src/test/java/com/example/otpdesignlearning/ExampleUnitTest.java | 2ef304e3e683e16e148d9e21149ad6ce5810073c | [] | no_license | Brijesh-kumar-sharma/FirebasePhoneAuthentication | d7d417a62e1a2f8948f77caa48e3d4c34a630ffc | eac037722968fae248c42f4df1bc87312d016a01 | refs/heads/master | 2022-12-21T07:33:30.504557 | 2020-09-25T02:22:59 | 2020-09-25T02:22:59 | 277,216,659 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.example.otpdesignlearning;
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);
}
} | [
"123@gmail.com"
] | 123@gmail.com |
3b1622a31c98fe9e4b47daac4dba686c9ebdc8a8 | b2931bdfcda487b2751c6b96d2e641aa25342bdf | /springApp/src/main/java/com/itwill3/dao/SpringApplicationContextMain.java | 3064880a5db948112740f2ed9cf0cf765acf04fb | [] | no_license | emptyshelter/SpringTrainning | 085ad7e24c9fc1b9cc262cf7dd27d9b4fa94582a | 280459d0edd6a8ed0dfe91f3e42ca92fbcc8b67e | refs/heads/master | 2022-12-23T05:13:07.045012 | 2020-03-31T05:30:05 | 2020-03-31T05:30:05 | 240,150,733 | 0 | 0 | null | 2022-03-31T22:43:43 | 2020-02-13T01:20:08 | Java | UTF-8 | Java | false | false | 1,420 | java | package com.itwill3.dao;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.itwill.user.UserDao;
public class SpringApplicationContextMain {
public static void main(String[] args) throws Exception {
/*
* ApplicationContext[BeanFactory]객체생성
* - Spring Container객체생성
*/
System.out.println("-------------Spring Container초기화시작--------");
ApplicationContext applicationContext=
new ClassPathXmlApplicationContext("com/itwill3/dao/3-1.spring_datasource.xml");
System.out.println("-------------Spring Container초기화끝----------");
DataSource apacheDataSource = (DataSource) applicationContext.getBean("apacheDataSource");
Connection con1 = apacheDataSource.getConnection();
System.out.println("####"+apacheDataSource);
System.out.println("####"+con1);
DataSource springDataSource = (DataSource) applicationContext.getBean("springDataSource");
Connection con2 = springDataSource.getConnection();
System.out.println("####"+springDataSource);
System.out.println("####"+con2);
con1.close();
con2.close();
UserDao userDao = (UserDao) applicationContext.getBean("userDao");
System.out.println(userDao.findUserList());
System.out.println(userDao.findUser("test"));
}
}
| [
"growworld@naver.com"
] | growworld@naver.com |
a6f25d34b569d66dd5f514d7888b0152b3c8d2cf | 86b4ab9694210489f670cb8a8b1275677c7799c4 | /JMonkey-Common/src/main/java/com/wang/jmonkey/cloud/common/http/package-info.java | 5c1539062b60908913f4ef989c9ad1f519b28cc6 | [] | no_license | hejiawang/JMonkey-Cloud | 637ac89f7dcc1a155191674743ba861b7765dc47 | 8f1a9945c3f5e2c825ffebc8a1d78e623b52f593 | refs/heads/master | 2020-03-21T08:54:10.007407 | 2018-08-13T09:15:57 | 2018-08-13T09:15:57 | 138,372,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | /**
* @Description: http请求、应答相关工具类
* @Auther: HeJiawang
* @Date: 2018/6/23
*/
package com.wang.jmonkey.cloud.common.http; | [
"952327407@qq.com"
] | 952327407@qq.com |
6bcbaa1cbc09702bda8253560b65d4df6eda71b8 | 7898b6967273fb569d61256b7acc8da372c1326e | /Preparation/RearrangeArray.java | b5287e3b9a0a6517ba2232cc6442a110b14015da | [] | no_license | DavinderSinghKharoud/AlgorithmsAndDataStructures | 83d4585ebbdc9bc27529bffcadf03f49fc3d0088 | 183aeba23f51b9edea6be8afbc9ee6cd221d3195 | refs/heads/master | 2022-07-08T17:18:23.954213 | 2022-05-17T02:22:16 | 2022-05-17T02:22:16 | 229,511,418 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,298 | java | package Preparation;
import java.util.ArrayList;
/**
* Rearrange a given array so that Arr[i] becomes Arr[Arr[i]] with O(1) extra space.
*
* Example:
*
* Input : [1, 0]
* Return : [0, 1]
* Lets say N = size of the array. Then, following holds true :
*
* All elements in the array are in the range [0, N-1]
* N * N does not overflow for a signed integer
*/
public class RearrangeArray {
public void arrange(ArrayList<Integer> lst) {
int size = lst.size();
// NumberOfValidWords = NextSmallerBalancedNumber + NumberOfNodesWithHighestScore* n
// NumberOfValidWords % N = NextSmallerBalancedNumber
// (NumberOfValidWords - NextSmallerBalancedNumber)/ N = NumberOfNodesWithHighestScore
for(int i = 0; i < size; i++){
int curr = lst.get(i);
int fill = lst.get(curr);
if(curr < i){
//Already modified
fill = (fill % size);
}
lst.set(i, curr + (fill * size));
// System.out.println(lst.get(i) + " " + fill);
}
for(int i = 0; i < size; i++){
// System.out.println(lst.get(i));
int curr = lst.get(i);
int fill = ( curr - (curr % size))/size;
lst.set(i, fill);
}
}
}
| [
"dskharoud2@gmail.com"
] | dskharoud2@gmail.com |
5d20197cf47faa3ec4a3453930638ca680a8893e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_90dceddfd182c7c70a8f1149cf46c829a960d193/PushManager/17_90dceddfd182c7c70a8f1149cf46c829a960d193_PushManager_t.java | 08ecef40e576b27e6e57123576c4908898b3d9c9 | [] | 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 | 7,034 | java | package com.tmall.top.push;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentLinkedQueue;
import com.tmall.top.push.messages.Message;
public class PushManager {
private static PushManager current;
// TODO: use IOC managing life cycle
public static void current(PushManager manager) {
if (current == null)
current = manager;
}
public static PushManager current() {
return current;
}
private Object clientLock = new Object();
private int maxConnectionCount;
// all connections whatever from any client
private int totalConnections;
private int totalPendingMessages;
// easy find client by id
private HashMap<String, Client> clients;
// hold clients which having pending messages and in processing
// not immediately
private ConcurrentLinkedQueue<Client> pendingClients;
// hold clients which do not having pending messages and not in processing
// not immediately
private LinkedHashMap<String, Client> idleClients;
// hold clients which do not having any active connections
// not immediately
private LinkedHashMap<String, Client> offlineClients;
private Receiver receiver;
private Processor processor;
private HashMap<Sender, Thread> senders;
// for managing some worker state
private CancellationToken token;
private ClientStateHandler stateHandler;
public PushManager(int maxConnectionCount,
int maxMessageSize,
int maxMessageBufferCount,
int senderCount,
int senderIdle,
int stateBuilderIdle) {
this.maxConnectionCount = maxConnectionCount;
// client management
this.clients = new HashMap<String, Client>(1000);
this.pendingClients = new ConcurrentLinkedQueue<Client>();
this.idleClients = new LinkedHashMap<String, Client>();
this.offlineClients = new LinkedHashMap<String, Client>();
this.receiver = new Receiver(maxMessageSize, maxMessageBufferCount);
// HACK:more message protocol process can extend it
this.processor = new Processor();
// TODO:move to start and support start/stop/restart
this.token = new CancellationToken();
this.prepareSenders(senderCount, senderIdle);
this.prepareChecker(stateBuilderIdle);
}
public void setClientStateHandler(ClientStateHandler handler) {
this.stateHandler = handler;
}
// cancel all current job
public void cancelAll() {
this.token.setCancelling(true);
}
// resume job after cancelAll called
public void resume() {
this.token.setCancelling(false);
}
public Receiver getReceiver() {
return this.receiver;
}
public Processor getProcessor() {
return this.processor;
}
public Client getClient(String id) {
if (!this.clients.containsKey(id)) {
synchronized (this.clientLock) {
if (!this.clients.containsKey(id))
this.clients.put(id, new Client(id, this));
}
}
return this.clients.get(id);
}
public boolean isReachMaxConnectionCount() {
return this.totalConnections >= this.maxConnectionCount;
}
public boolean isIdleClient(String id) {
return this.idleClients.containsKey(id);
}
public boolean isOfflineClient(String id) {
return this.offlineClients.containsKey(id);
}
public Client pollPendingClient() {
return this.pendingClients.poll();
}
public int getPendingClientCount() {
// size() is O(n)
return this.pendingClients.size();
}
public void pendingMessage(Message message) {
if (!this.isOfflineClient(message.to))
this.getClient(message.to).pendingMessage(message);
else if (this.stateHandler != null)
this.stateHandler.onClientOffline(this.getClient(message.to), message);
}
private void prepareSenders(int senderCount, int senderIdle) {
this.senders = new HashMap<Sender, Thread>();
for (int i = 0; i < senderCount; i++) {
Sender sender = new Sender(this, this.token, senderIdle);
Thread thread = new Thread(sender);
thread.start();
this.senders.put(sender, thread);
}
}
private void prepareChecker(int stateBuilderIdle) {
// timer check
TimerTask task = new TimerTask() {
public void run() {
// checking senders
try {
for (Map.Entry<Sender, Thread> entry : senders.entrySet()) {
if (!entry.getValue().isAlive())
System.out.println(String.format("sender#%s is broken!", entry.getKey()));
}
} catch (Exception e) {
e.printStackTrace();
}
try {
rebuildClientsState();
System.out.println(String.format(
"total %s pending messages, total %s connections, total %s clients, %s is idle, %s is offline",
totalPendingMessages, totalConnections,
clients.size(),
idleClients.size(),
offlineClients.size()));
} catch (Exception e) {
e.printStackTrace();
}
}
};
Timer timer = new Timer(true);
timer.schedule(task, new Date(), stateBuilderIdle);
}
// build pending/idle clients queue
private void rebuildClientsState() {
int totalConn = 0;
int totalPending = 0;
int connCount, pendingCount;
// still have pending clients in processing
boolean noPending = this.pendingClients.isEmpty();
boolean offline, pending;
Object[] keys = null;
// is there a better way? avoid array create
synchronized (this.clientLock) {
keys = this.clients.keySet().toArray();
}
for (int i = 0; i < keys.length; i++) {
Client client = this.clients.get(keys[i]);
if (client == null)
continue;
connCount = client.getConnectionsCount();
pendingCount = client.getPendingMessagesCount();
totalConn += connCount;
totalPending += pendingCount;
offline = connCount == 0;
pending = pendingCount > 0;
try {
this.rebuildClientsState(client, noPending, pending, offline);
} catch (Exception e) {
System.err.println(String.format("error on rebuilding client#%s state", client.getId()));
e.printStackTrace();
}
}
this.totalConnections = totalConn;
this.totalPendingMessages = totalPending;
}
private void rebuildClientsState(Client client, boolean noPending,
boolean pending, boolean offline) {
if (noPending && pending && !offline) {
this.pendingClients.add(client);
this.idleClients.remove(client.getId());
this.offlineClients.remove(client.getId());
if (this.stateHandler != null)
this.stateHandler.onClientPending(client);
} else if (!pending && !offline) {
this.idleClients.put(client.getId(), client);
this.offlineClients.remove(client.getId());
if (this.stateHandler != null)
this.stateHandler.onClientIdle(client);
} else if (offline) {
// TODO:clear pending messages of offline client after
// a long time
this.offlineClients.put(client.getId(), client);
this.idleClients.remove(client.getId());
if (this.stateHandler != null)
this.stateHandler.onClientOffline(client);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
4aeebaf72e317832cd705ec3e0e1fd37757e3af2 | 381325a109e35a67425dedfc9973da4a6b83959c | /resource-scheduler/.svn/pristine/7c/7c6268b87cb9cd03e850d4db47da2fcaa0fe1e4d.svn-base | 028223beadb6381275f453e41e018a111847c36b | [] | no_license | ShangfengDing/IaaS | 213287571e2ba3c06814565fbb229ef9c964a91a | 89d7120ceac53d22520e353325f193c7cdf3a6ff | refs/heads/master | 2022-12-22T21:01:06.596557 | 2019-11-07T13:12:14 | 2019-11-07T13:12:14 | 220,217,355 | 0 | 1 | null | 2022-12-16T04:01:46 | 2019-11-07T11:07:33 | JavaScript | UTF-8 | Java | false | false | 4,237 | /**
* File: VolumeService.java
* Author: weed
* Create Time: 2013-4-16
*/
package appcloud.resourcescheduler.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import appcloud.common.model.RpcExtra;
import appcloud.rpc.tools.RpcException;
/**
* @author weed
*
*/
/**
* @author weed
*
*/
public interface VolumeService {
/**
* @param userId
* 用户Id
* @param avalibilityZoneId
* 可用的ZoneId
* @param name
* 名字
* @param displayName
* 名字
* @param size
* 大小,单位:GB
* @param type
* qcow2 or 其他;
* @param metadata
* metadata
*
* @return return Volume的Uuid,需要固化(availabilityZone, createdAt信息)后返回
*/
public String createVolume(Integer userId, Integer avalibilityZoneId, List<Integer> clusterIds, String name, String displayName, String discription, Integer size,
String type, Map<String, String> metadata, RpcExtra rpcExtra) throws RpcException ;
public String createVolumeImageBack(Integer userId, String displayName, String discription, String volumeUuid,RpcExtra rpcExtra) throws RpcException ;
public String revertVolume(String volumeUuid, String instanceUuid, RpcExtra rpcExtra) throws RpcException ;
/**
* @param volumeUuid 对应Volume的UUID
* @param instanceUuid 对应Instance的UUID
*
* @retrun 挂载点,如"/dev/vdc"
*/
public String attachVolume(String volumeUuid, String instanceUuid, RpcExtra rpcExtra) throws RpcException ;
/**
* @param volumeUuid 对应Volume的UUID
* @param instanceUuid 对应Instance的UUID
*/
public void detachVolume(String volumeUuid, String instanceUuid, RpcExtra rpcExtra) throws RpcException ;
/**
* @param volumeUuid Volume的UUID
* @param displayName 新的名称
* @param discription 新的描述
*/
public void updateVolume(String volumeUuid, String displayName, String discription, HashMap<String, String> metadata, RpcExtra rpcExtra) throws RpcException;
/**
* @param volumeUuid Volume的UUID
* @throws RpcException
*/
public void deleteVolume(String volumeUuid, RpcExtra rpcExtra) throws RpcException;
/**
* @param volumeUuid Volume的UUID
* @throws RpcException
*/
public void forceDeleteVolume(String volumeUuid, RpcExtra rpcExtra) throws RpcException;
/**
* @param displayName 显示名字
* @param displayDescription 描述
* @param volumeId 被snapshot的volume
* @param force 是否强制
*
* @return 创建的Snapshot的UUID
*/
public String createSnapshot(String displayName, String displayDescription, String volumeUuid, Boolean force, RpcExtra rpcExtra) throws RpcException ;
/**
* @param snapshotUuid
*
* @throws RpcException
*/
public void deleteSnapshot(String snapshotUuid, RpcExtra rpcExtra) throws RpcException;
/**
* @param snapshotUuid
*
* @throws RpcException
*/
public void revertSnapshot(String snapshotUuid, RpcExtra rpcExtra) throws RpcException;
/**
* @param snapshotUuid Snapshot的UUID
* @param displayName 新的名称
* @param discription 新的描述
*/
public void updateSnapshot(String snapshotUuid, String displayName, String discription, Integer userId, RpcExtra rpcExtra) throws RpcException;
/**
* @param displayName 显示名字
* @param displayDescription 描述
* @param volumeUuid 被BackUp的volume
* @param force 是否强制
*
* @return 创建的BackUp的UUID
*/
public String createBackUp(String displayName, String displayDescription, String volumeUuid, Boolean force, RpcExtra rpcExtra) throws RpcException ;
/**
* @param BackUpUuid s
*
* @throws RpcException
*/
public void deleteBackUp(String BackUpUuid, RpcExtra rpcExtra) throws RpcException;
/**
* @param BackUpUuid
*
* @throws RpcException
*/
public void revertBackUp(String BackUpUuid, RpcExtra rpcExtra) throws RpcException;
/**
* @param BackUpUuid BackUp的UUID
* @param displayName 新的名称
* @param discription 新的描述
*/
public void updateBackUp(String BackUpUuid, String displayName, String discription, RpcExtra rpcExtra) throws RpcException;
public String KeepAlive() throws Exception ;
}
| [
"747879583@qq.com"
] | 747879583@qq.com | |
ac5c534833f9e2f125eaea862f7666c8a6797c9a | 39ea4d3464987124d4111e15e9105c3e92714bf4 | /src/com/hysm/controller/UserController.java | 79424ab2f57003864d5a177e8ead881cbc5e1c55 | [
"MIT"
] | permissive | 20gg/educate | 19c05044e500d978da291ad67769567d3a5fa3fe | 63c1aadd08f7e74c9ebfbf916978c2f984df67f3 | refs/heads/master | 2021-04-09T16:05:52.162997 | 2018-03-18T06:13:45 | 2018-03-18T06:13:45 | 125,696,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 34,196 | java | /**
*
*/
package com.hysm.controller;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hysm.db.Area_db;
import com.hysm.db.CbgDB;
import com.hysm.db.Top_db;
import com.hysm.db.mongo.MongoUtil;
import com.hysm.tools.CommonUtil;
import com.hysm.tools.DateTool;
import com.hysm.tools.PageBean;
import com.hysm.tools.StringUtil;
import com.mongodb.BasicDBObject;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.model.Filters;
@Controller
@RequestMapping("/user")
public class UserController extends BaseController{
private int pn = 1;
private int ps = 50;
@Autowired
private CbgDB cgbdb;
@Autowired
private Top_db topdb;
@Autowired
private Top_db top_db;
@Autowired
private Area_db area_db;
@RequestMapping("show_user")
public String show_user(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
Document map = new Document();
PageBean<Document> pb = new PageBean<Document>();
String page = req.getParameter("page");
String name = req.getParameter("name");
if (page != null && !page.equals("")) {
pn = Integer.valueOf(page);
}
if (pn < 1) {
pn = 1;
}
map.append("pn", pn);
map.append("ps", ps);
if (name != null && !name.equals("")) {
map.append("name", name);
}
pb.setPageNum(map.getInteger("pn", pn));// 第几页
pb.setPageSize(map.getInteger("ps", ps));// 每页多少
int rc = (int) cgbdb.countUser("user", map);
pb.setRowCount(rc);
List<Document> list = cgbdb.findByPb2("user", map);
if (list != null && list.size() > 0) {
pb.setList(list);
}
model.put("user_list", pb);
return "/pt/userManager/user";
}
@RequestMapping(value = { "/show_all_user_page" }, method = { RequestMethod.GET })
public String select_usermanager_page(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model) {
int page = Integer.valueOf(req.getParameter("page"));
List<Map<String, Object>> user_list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("page", (page - 1) * 50);
MongoUtil mu = MongoUtil.getThreadInstance();
MongoCursor<Document> cursor = mu.find("user", null);
while (cursor.hasNext()) {
Document doc = cursor.next();
Map<String, Object> it_usermanager = doc;
user_list.add(it_usermanager);
}
long count1 = mu.count("user", null);
int page_num = 1;
int page_count = 0;
int count = (int) count1;
if (count % 50 == 0) {
page_count = count / 50;
} else {
page_count = (count / 50) + 1;
}
model.put("course_order", user_list);
model.put("count", count);
model.put("page_count", page_count);
model.put("page_num", page_num);
return "/wx/userManager/my_packge";
}
@RequestMapping("show_congif_s")
public void show_congif_s(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
if(open_id==null||open_id.equals("")){
model.put("result", "error");
}else{
Document config_s=cgbdb.query_config();
model.put("config_s", config_s);
}
sendjson(model, response);
}
@RequestMapping("updateuser")
public void updateuser(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String updatename=req.getParameter("updatename");
String updatepasswd=req.getParameter("updatepasswd");
String id=req.getParameter("id");
Document phone=new Document();
phone.append("name", updatename);
int count=cgbdb.countUserm("user_m", phone);
if(count>0){
model.put("result", "errname");
}else{
Document u_no=new Document();
u_no.append("_id", new ObjectId(id));
Document updateu=cgbdb.find_scholarship22("user_m", u_no);
if(updateu!=null){
updateu.put("name", updatename);
updateu.put("passwd", updatepasswd);
updateu.put("state",updateu.getInteger("state") );
cgbdb.replaceOne("user_m", Filters.eq("_id", updateu.get("_id")), updateu);
model.put("result", "success");
}else{
model.put("result", "error");
}
}
sendjson(model, response);
}
@RequestMapping("userinfo")
public String userdetaiinfo(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model) {
String u_no = req.getParameter("no");
String classmate_id = req.getParameter("c_id");
String open_id=req.getParameter("open_id");
Document docc=new Document();
Document docc2=new Document();
docc.put("top_openid", open_id);
int count=cgbdb.count_topid("user", docc);
docc2.put("open_id", open_id);
Document user=cgbdb.findwxfamilyinfo("user", docc2);
int i=0; //代表上级
int j=1;//代表自己
if(user.getString("top_openid")!=null){
i=1;
}
user.put("classmatecircle", count+i+j);
cgbdb.replaceOne("user", Filters.eq("open_id", open_id), user);
Document vno=new Document();
vno.put("open_id", open_id);
vno.put("is_order", 1);
Document vip_log=cgbdb.find_scholarship22("vip_order", vno);
if(vip_log!=null){
model.put("vip_log", vip_log);
}
Document map = new Document();
if (u_no != null && !u_no.equals("")) {
map.append("u_no", u_no);
List<Document> list = cgbdb.findudetailinfo("user", map); // 按会员编号查询所有信息
if (list != null && list.size() > 0) {
model.put("userinfo", list.get(0));
}
}
Document u_order=new Document();
u_order.put("open_id", open_id);
u_order.put("is_order", 1);
u_order.put("is_over", 0);
List<Document> order= cgbdb.course_orders(u_order);// 按会员编号查询所有订单信息
if (order != null && order.size() > 0) {
model.put("orderinfo", order);
}
int top_count =0;
Map<String,Object> top_map = topdb.query_my_top(open_id);//我的上级
Document shangj_ip=new Document();
Document top=(Document) top_map.get("top");
if(top!=null){
top_count =1;
shangj_ip.put("open_id", top.get("open_id"));
Document shangji_map=cgbdb.findwxfamilyinfo("user", shangj_ip);
if(shangji_map!=null){
model.put("shangji_map", shangji_map);
}
}
List<Document> xia_ji=topdb.query_my_xia(open_id);//我的下级
List<Document> xiaji_list=new ArrayList<Document>();
if(xia_ji.size()>0){
Document xiaji_user=null;
for(int z=0;z<xia_ji.size();z++){
Document xiaji_op=new Document();
xiaji_op.put("open_id", xia_ji.get(z).getString("open_id"));
xiaji_user=cgbdb.findwxfamilyinfo("user", xiaji_op);
xiaji_list.add(xiaji_user);
}model.put("xiaji_user", xiaji_list);
}
//Map<String,Object> list=new HashMap<String, Object>();
model.put("xia_ji", xia_ji);
model.put("user", user);
// model.put("list", list);
model.put("user", user);
model.put("c_num", xia_ji.size()+top_count+1);
return "/pt/userManager/userinfo";
}
@RequestMapping("insertP2")
public void insertP2(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String date = req.getParameter("date");
String open_id=req.getParameter("open_id");
int i=Integer.valueOf(date);
Document doc=new Document();
doc.put("open_id", open_id);
Document user =cgbdb.findwxfamilyinfo("user", doc);
if(user!=null){
user.put("p2_date", DateTool.addDate(user.getString("p1_date"), i));
user.put("p1_date",DateTool.addDate(user.getString("p1_date"), i));
cgbdb.replaceOne("user", Filters.eq("open_id", open_id), user);
}
model.put("result", "success");
sendjson(model, response);
}
@RequestMapping("user_m")
public String user_m(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
/*Document map = new Document();
PageBean<Document> pb = new PageBean<Document>();
String page = req.getParameter("page");
String name = req.getParameter("name");
if (page != null && !page.equals("")) {
pn = Integer.valueOf(page);
}
if (pn < 1) {
pn = 1;
}
map.append("pn", pn);
map.append("ps", ps);
if (name != null && !name.equals("")) {
map.append("name", name);
}
pb.setPageNum(map.getInteger("pn", pn));// 第几页
pb.setPageSize(map.getInteger("ps", ps));// 每页多少
int rc = (int) cgbdb.countUserm("user_m", map);
pb.setRowCount(rc);
List<Document> list = cgbdb.findByPb2("user_m", map);
if (list != null && list.size() > 0) {
pb.setList(list);
}
model.put("user_list", pb);*/
List<Document> list = cgbdb.query_manager();
model.put("user_list", list);
return "/pt/userManager/user_m";
}
@RequestMapping(value = "insertuser", method = { RequestMethod.POST })
public void insertuser(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model) {
String name = req.getParameter("name");
String passwd = req.getParameter("passwd");
//String ustate = req.getParameter("ustate");
Map<String, String> map = new HashMap<String, String>();
MongoUtil mu = MongoUtil.getThreadInstance();
if (name == null || name.equals("")
|| mu.count("user_m", new Document().append("name", name)) > 0) {
map.put("result", " errname");
} else {
BasicDBObject bdb2 = new BasicDBObject();
bdb2.put("name", name);
bdb2.put("passwd", passwd);
bdb2.put("password", passwd);
bdb2.put("state", 0);
bdb2.put("role_id", 1);
mu.insertOne("user_m", bdb2);
map.put("result", "success");
}
sendjson(map, response);
}
@RequestMapping("resetpwd")
public void resetpwd(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String name=req.getParameter("inputname");
String passwd=req.getParameter("pwd");
Document phone=new Document();
phone.append("name", name);
int count=cgbdb.countUserm("user_m", phone);
if(count>0){
Document u_no=new Document();
u_no.append("name", name);
Document updateu=cgbdb.finduserm("user_m", u_no);
if(updateu!=null){
updateu.put("name", name);
updateu.put("passwd", passwd);
cgbdb.replaceOne("user_m", Filters.eq("name", updateu.getString("name")), updateu);
model.put("result", "success");
}else{
model.put("result", "error");
}
}else{
model.put("result", "errname");
}
sendjson(model, response);
}
@RequestMapping("deletebyname")
public void deletebyname(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model) {
String name = req.getParameter("name");
if(name!=null&&!name.equals("")){
MongoUtil mu = MongoUtil.getThreadInstance();
Document doc = new Document();
doc.put("name", name);
mu.deleteMany("user_m", doc);
model.put("result", "success");
}else{
model.put("result", "error");
}
sendjson(model, response);
}
@RequestMapping("blacklist1")
public void blacklist1(HttpServletRequest req,HttpServletResponse response, Map<String, Object> model ){
String u_no =req.getParameter("u_no");
String state=req.getParameter("state");
Document doc=new Document();
if(u_no==null||u_no.equals("")){
model.put("result", "error");
}else{
doc.append("u_no", u_no);
Document user=cgbdb.finduser("user",doc);
if(user!=null ){
if(state.equals("0")){
user.put("state", -1);
}else{
user.put("state", 0);
}
cgbdb.replaceOne("user", Filters.eq("u_no", user.get("u_no")), user);
model.put("result", "success");
}
}
sendjson(model, response);
}
@RequestMapping("freeze1")
public void freeze1(HttpServletRequest req,HttpServletResponse response, Map<String, Object> model ){
String name =req.getParameter("name");
String state=req.getParameter("state");
Document doc=new Document();
if(name==null||name.equals("")){
model.put("result", "error");
}else{
doc.append("name", name);
Document user=cgbdb.findbobyinfo("user_m",doc);
if(user!=null ){
if(state.equals("0")){
user.put("state", -1);
}else{
user.put("state", 0);
}
cgbdb.replaceOne("user_m", Filters.eq("name", user.get("name")), user);
model.put("result", "success");
}
}
sendjson(model, response);
}
@RequestMapping("join_vip")
public void join_vip(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
String name=req.getParameter("name");
String phone=req.getParameter("phone");
String company=req.getParameter("company");
String job=req.getParameter("job");
Document openid=new Document();
openid.append("open_id", open_id);
Document count=cgbdb.findwxfamilyinfo("user", openid);
model.put("count", count);
if(count==null||count.equals("")){
model.put("result", "error");
}else{
count.put("name", name);
count.put("phone", phone);
count.put("company",company );
count.put("job",job );
cgbdb.replaceOne("user", Filters.eq("open_id", count.getString("open_id")), count);
model.put("result", "success");
}
sendjson(model, response);
}
@RequestMapping("shcolarship_info")
public void shcolarship_info(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
String page = req.getParameter("page");
PageBean<Document> pb = new PageBean<Document>();
int pn = 1;
int ps = 10;
Document map=new Document();
if (page != null && !page.equals("")) {
pn = Integer.valueOf(page);
}
if (pn < 1) {
pn = 1;
}
map.append("pn", pn);
map.append("ps", ps);
pb.setPageNum(map.getInteger("pn", pn));// 第几页
pb.setPageSize(map.getInteger("ps", ps));// 每页多少
Document doc=new Document();
doc.append("open_id", open_id);
Document user= cgbdb.findwxfamilyinfo("user", doc);//查询用户表
Document config_s=cgbdb.query_config();
if(user!=null&&!user.equals("")){
model.put("user", user);
List<Document> xia_ji=topdb.query_my_xia(open_id);//我的下级
Document all_open_id=new Document();//用来存 数组中openid
if(xia_ji!=null ){
List<String> list=new ArrayList<String>();
for(int i=0;i<xia_ji.size();i++){
list.add(xia_ji.get(i).getString("open_id"));
Map<String, Object> map3 = new HashMap<String, Object>();
map3.put("$in", list);
all_open_id.put("open_id", map3);
List<Document> course_order=cgbdb.course_orders(all_open_id);//用同学圈中的openid去查询课程订单表中的数据
model.put("course_order", course_order);
}
model.put("bottom_member", xia_ji);
}
}
model.put("config_s", config_s);
sendjson(model, response);
}
@RequestMapping("scholarship_sort")
public void scholarship_sort(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
Document map = new Document();
String open_id=req.getParameter("open_id");
PageBean<Document> pb = new PageBean<Document>();
String page = req.getParameter("page");
String phone = req.getParameter("phone");
if (page != null && !page.equals("")) {
pn = Integer.valueOf(page);
}
if (pn < 1) {
pn = 1;
}
map.append("pn", pn);
map.append("ps", ps);
if (phone != null && !phone.equals("")) {
map.append("phone", phone);
}
pb.setPageNum(map.getInteger("pn", pn));// 第几页
pb.setPageSize(map.getInteger("ps", ps));// 每页多少
int rc = (int) cgbdb.countUser("scholarship", map);
pb.setRowCount(rc);
Document openid=new Document();
if(open_id!=null&&!open_id.equals("")){
openid.append("open_id", open_id);
Document scholarship=cgbdb.find_scholarship("scholarship",openid);
model.put("scholarship", scholarship);
}
List<Document> list = cgbdb.find_scholarship_list("scholarship", map);
pb.setList(list);
model.put("scholarship_list", pb);
sendjson(model, response);
}
@RequestMapping("user_sign")
public void user_sgin(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
Document doc =new Document();
doc.put("open_id", open_id);
doc.put("type", 0);
doc.put("date",DateTool.fromDateY());
int sign_log=cgbdb.find_sign_log("sign_log", doc);
Document is_sign=new Document();
is_sign.append("open_id", open_id);
Document vip_log=area_db.find_vip_order("vip_order", is_sign);
model.put("vip_log", vip_log);
if(sign_log!=0){
Document user =cgbdb.findwxfamilyinfo("user", is_sign);
model.put("user", user);
model.put("sign_log", sign_log);
}else{
Document user =cgbdb.findwxfamilyinfo("user", is_sign);
model.put("user", user);
model.put("sign_log", sign_log);
}
sendjson(model, response);
}
@RequestMapping("go_sign")
public void go_sign(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
Document doc =new Document();
doc.put("open_id", open_id);
doc.put("date",DateTool.get_yesterday());
Document dc=new Document();
dc.append("open_id", open_id);
Document user =cgbdb.findwxfamilyinfo("user", dc);
Document config_s=cgbdb.query_config();
int sign_log=cgbdb.find_sign_log("sign_log", doc);
if(sign_log==0){//说明他昨天没有签到 那么今天就是已签到1天
MongoUtil mu = MongoUtil.getThreadInstance();
Document da=new Document();
da.put("open_id", open_id);
da.put("date", DateTool.fromDateY());
da.put("score", config_s.getInteger("sign_score"));
da.put("name", user.getString("name"));
da.put("type", 0);
mu.insertOne("sign_log", da);
if(user!=null){
int a=1;
user.put("is_sign", 1);
user.put("score", user.getInteger("score")+a);
cgbdb.replaceOne("user", Filters.eq("open_id", user.getString("open_id")), user);
model.put("user", user);
}
}else if(sign_log%7==0){
MongoUtil mu = MongoUtil.getThreadInstance();
int i=5;
Document da=new Document();
da.put("open_id", open_id);
da.put("date", DateTool.fromDateY());
da.put("score", config_s.getInteger("sign_score"));
da.put("name", user.getString("name"));
da.put("type", 0);
mu.insertOne("sign_log", da);
if(user!=null){
user.put("is_sign", user.getInteger("is_sign")+i);
user.put("score", user.getInteger("score")+i);
cgbdb.replaceOne("user", Filters.eq("open_id", user.getString("open_id")), user);
model.put("user", user);
}
}else if(sign_log%30==0){
MongoUtil mu = MongoUtil.getThreadInstance();
int i=10;
Document da=new Document();
da.put("open_id", open_id);
da.put("date", DateTool.fromDateY());
da.put("score", config_s.getInteger("sign_score"));
da.put("name", user.getString("name"));
da.put("type", 0);
mu.insertOne("sign_log", da);
if(user!=null){
user.put("is_sign", user.getInteger("is_sign")+i);
user.put("score", user.getInteger("score")+i);
cgbdb.replaceOne("user", Filters.eq("open_id", user.getString("open_id")), user);
model.put("user", user);
}
}else{
MongoUtil mu = MongoUtil.getThreadInstance();
int i=1;
Document da=new Document();
da.put("open_id", open_id);
da.put("date", DateTool.fromDateY());
da.put("score", config_s.getInteger("sign_score"));
da.put("name", user.getString("name"));
da.put("type", 0);
mu.insertOne("sign_log", da);
if(user!=null){
user.put("is_sign", user.getInteger("is_sign")+i);
user.put("score", user.getInteger("score")+i);
cgbdb.replaceOne("user", Filters.eq("open_id", user.getString("open_id")), user);
model.put("user", user);
}
}
sendjson(model, response);
}
@RequestMapping("show_my_classmate")
public void show_my_classmate(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
Document doc =new Document();
doc.put("open_id", open_id);
Map<String,Object> top_map = topdb.query_my_top(open_id);//我的上级
Document user = cgbdb.find_scholarship("user",doc);
List<Document> xia_ji=topdb.query_my_xia(open_id);//我的下级
int page = 1;
if(req.getParameter("page") != null){
page = Integer.valueOf(req.getParameter("page"));
}
int limit = 20;
int skip = (page - 1)*limit;
int pt_num = top_db.query_xia_count(open_id, 0);
int vip_num = top_db.query_xia_count(open_id, 1);
int count = top_db.query_scholship_log_count(open_id);
List<Document> log_list = top_db.query_scholship_log(open_id, skip, limit);
int page_num = page;//默认第一页
int page_count = 1;//默认总页数:1
if(count % limit == 0){
page_count = count/limit;
}else{
page_count = (count/limit)+1;
}
if(page_count == 0){
page_count = 1;
}
model.put("page_num", page_num);
model.put("page_count", page_count);
model.put("pt_num", pt_num);
model.put("vip_num", vip_num);
model.put("log_list", log_list);
model.put("top_map", top_map);
model.put("xia_ji", xia_ji);
model.put("user", user);
sendjson(model, response);
}
@RequestMapping("score_sort")
public void score_sort(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
Document map = new Document();
String open_id=req.getParameter("open_id");
Document openid=new Document();
if(open_id!=null&&!open_id.equals("")){
openid.append("open_id", open_id);
Document user=cgbdb.find_scholarship("user",openid);
model.put("user", user);
}
List<Document> list = cgbdb.find_score_list("user", map);
model.put("score_list", list);
sendjson(model, response);
}
@RequestMapping("show_my_info")
public void show_my_info(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
Document doc =new Document();
doc.put("open_id", open_id);
Document user =cgbdb.findwxfamilyinfo("user", doc);
if(user!=null&&!user.equals("")){
model.put("result", "success");
model.put("user",user);
}else{
model.put("result", "error");//用户不存在
}
sendjson(model, response);
}
@RequestMapping("update_my_info")
public void update_my_info(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
String phone=req.getParameter("phone");
String company=req.getParameter("company");
String job=req.getParameter("job");
String name=req.getParameter("name");
String yzm_cc=req.getParameter("yzm_cc");
String str=getSession().getAttribute("yzphone").toString();
String str2=getSession().getAttribute("yzcode").toString();
Document docc=new Document();
docc.put("phone", phone);
int cont=cgbdb.count_course_order("user", docc);
if(cont>1){
model.put("result", "have_phone");
}else{
if(!phone.equals(str) || !yzm_cc.equals(str2)){
model.put("result", "e_phone");
}else{
Document openid=new Document();
openid.append("open_id", open_id);
Document count=cgbdb.findwxfamilyinfo("user", openid);
if(count==null||count.equals("")){
model.put("result", "error");
}else{
count.put("phone", phone);
count.put("company",company );
count.put("job",job );
count.put("u_name",name );
cgbdb.replaceOne("user", Filters.eq("open_id", count.getString("open_id")), count);
model.put("result", "success");
}
}
}
sendjson(model, response);
}
@RequestMapping("show_course_order")
public void show_course_order(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
Document doc =new Document();
doc.put("open_id", open_id);
List<Document> course_order=cgbdb.show_course_order("course_order", doc);
Document user =cgbdb.findwxfamilyinfo("user", doc);
if(course_order!=null&&!course_order.equals("")){
model.put("course_order", course_order);
}
model.put("user", user);
sendjson(model, response);
}
@RequestMapping("show_course_order_jsp")
public String show_course_order_jsp(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
String page = req.getParameter("page");
PageBean<Document> pb = new PageBean<Document>();
Document map=new Document();
if (page != null && !page.equals("")) {
pn = Integer.valueOf(page);
}
if (pn < 1) {
pn = 1;
}
map.append("pn", pn);
map.append("ps", ps);
pb.setPageNum(map.getInteger("pn", pn));// 第几页
pb.setPageSize(map.getInteger("ps", ps));// 每页多少
int rc = (int) cgbdb.countUser("course_order", map);
pb.setRowCount(rc);
Document doc =new Document();
doc.put("open_id", open_id);
List<Document> course_order=cgbdb.show_course_order("course_order", doc);
pb.setList(course_order);
model.put("course_order", pb);
return "/pt/userManager/my_packge";
}
@RequestMapping("show_scholaership_jsp")
public String show_scholaership_jsp(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
int page = 1;
if(req.getParameter("page") != null){
page = Integer.valueOf(req.getParameter("page"));
}
int limit = 50;
int skip = (page - 1)*limit;
int count = top_db.query_scholship_log_count(open_id);
List<Document> log_list = top_db.query_scholship_log(open_id, skip, limit);
int page_num = page;//默认第一页
int page_count = 1;//默认总页数:1
if(count % limit == 0){
page_count = count/limit;
}else{
page_count = (count/limit)+1;
}
if(page_count == 0){
page_count = 1;
}
List<Document> list = cgbdb.query_share("share_log",open_id);
List<Document> list_list=new ArrayList<Document>();
if(list!=null){
for(int i=0;i<list.size();i++){
Document doc2=new Document();
doc2.put("open_id", list.get(i).get("share_openid").toString());
Document user=cgbdb.findwxfamilyinfo("user", doc2);
list_list.add(user);
}
}
List<Document> log_list2 = top_db.query_scholship_log(open_id, skip, limit);
model.put("count", count);
model.put("page_num", page_num);
model.put("page_count", page_count);
model.put("list", list_list);
model.put("list_2", list);
model.put("log_list2", log_list2);
model.put("log_list", log_list);
return "/pt/userManager/my_scholarship_record";
}
@RequestMapping("show_score_jsp")
public String show_score_jsp(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id=req.getParameter("open_id");
String page = req.getParameter("page");
PageBean<Document> pb = new PageBean<Document>();
Document map=new Document();
if (page != null && !page.equals("")) {
pn = Integer.valueOf(page);
}
if (pn < 1) {
pn = 1;
}
map.append("pn", pn);
map.append("ps", ps);
pb.setPageNum(map.getInteger("pn", pn));// 第几页
pb.setPageSize(map.getInteger("ps", ps));// 每页多少
Document doc =new Document();
doc.put("open_id", open_id);
List<Document> score=cgbdb.show_course_order("sign_log", doc);//查询签到表
int rc= cgbdb.count_collection("sign_log", doc);
pb.setRowCount(rc);
pb.setList(score);
model.put("course_order", pb);
return "/pt/userManager/my_score";
}
@RequestMapping("sendmessage_phone")
public void sendmessage_phone(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String phone=req.getParameter("phone");
String phone_url="http://106.wx96.com/webservice/sms.php";
int random=CommonUtil.random_code();
String str=sendGet(phone_url, "method=Submit&account=C12005726&password=3ba4310932cb5bd74aaba61a5c2717db&mobile="+phone+"&content=您的验证码是:"+random+"。请不要把验证码泄露给其他人。");
System.out.println(str);
req.getSession().setAttribute("yzphone", phone);
req.getSession().setAttribute("yzcode", random);
model.put("random", random);
sendjson(model, response);
}
public static String sendGet(String url, String param) {
String result = "";
BufferedReader in = null;
try {
String urlNameString = url + "?" + param;
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
URLConnection connection = realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 建立实际的连接
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段
for (String key : map.keySet()) {
System.out.println(key + "--->" + map.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(
connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e);
e.printStackTrace();
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result;
}
@RequestMapping("to_load")
public void to_load(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model){
String open_id = req.getParameter("openid");
String c_no = req.getParameter("c_no");
Document doc2 = new Document();
doc2.append("open_id", open_id);
Document user = cgbdb.findwxfamilyinfo("user", doc2);// 查询用户表
int dy = top_db.query_is_buy(open_id, c_no); // 是否订阅
int sc = top_db.query_is_collection(open_id, c_no); // 是否收藏
Document doc3=new Document();
doc3.put("special_no", c_no);
Document special = cgbdb.findspecial_detail("special", doc3);
model.put("dy", dy);
model.put("sc", sc);
model.put("user", user);
model.put("special", special);
sendjson(model, response);
}
@RequestMapping("shows_wx_user")
public void shows_wx_user(HttpServletRequest req,
HttpServletResponse response, Map<String, Object> model) {
String open_id=req.getParameter("openid");
Document docc2=new Document();
docc2.put("open_id", open_id);
Document user=cgbdb.findwxfamilyinfo("user", docc2);
model.put("user", user);
sendjson(model, response);
}
}
| [
"245387976@qq.com"
] | 245387976@qq.com |
58b6bb330b1676309238ffe6a05b7f6f11393c31 | 98a29e1d7c1df7cfd17edb9712c027a943813740 | /src/MyEdtorListener.java | 2df1f40b319d445888906f123e02a3d4934c0ae6 | [] | no_license | ubansi/sooba | a0cc9a7fc7549bd61afda45dd795c24293646322 | 534555d51aabb5e36035fcb94f35e6f6d2c94082 | refs/heads/master | 2021-07-21T06:22:54.527648 | 2017-10-31T16:13:36 | 2017-10-31T16:13:36 | 108,430,985 | 0 | 0 | null | 2017-10-31T16:13:37 | 2017-10-26T15:34:26 | Java | UTF-8 | Java | false | false | 892 | java | import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
public class MyEdtorListener implements CellEditorListener {
@Override
public void editingStopped(ChangeEvent e) {
//TODO
// 編集完了時のリスナ(1列目の値段エリアのみ)
// System.out.println("editing Stop"+tableManager.getCol()+":"+tableManager.getRow());
// tableManager.SetCell(tableManager.getRow(),tableManager.getCol()+1,clock.getTimeNum());
// System.out.println("edit end" + tableManager.getRow());
GraphManager.setGraphParam(WindowSetup.Table[WindowSetup.pane.getSelectedIndex()].getSelectedRow());
// 編集後次の行のアイテム名をコピー
WindowSetup.copyClipboad(WindowSetup.Table[WindowSetup.pane.getSelectedIndex()].getSelectedRow()+1);
}
@Override
public void editingCanceled(ChangeEvent e) {
System.out.println("editing cancell");
}
}
| [
"goakafu@gmail.com"
] | goakafu@gmail.com |
37331c030aaa0c60517fdd024f49db6b56852f72 | a55a897b8c1a999a26e4b4be2667ae0a760327d7 | /src/main/java/top/oyoung/cloudconfigserver/CloudConfigServerApplication.java | 6fb722cc0639ccb6383b93ecb116b45c75447fb3 | [] | no_license | yangweixin/cloud-config-server | cae4300804d9e8249df044cb671adf32508f3690 | 56087767b6571547cef5cedca53ad22ae302b58d | refs/heads/master | 2020-03-18T16:33:29.704696 | 2018-05-30T16:40:01 | 2018-05-30T16:40:01 | 134,972,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package top.oyoung.cloudconfigserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;
@EnableDiscoveryClient
@EnableConfigServer
@SpringBootApplication
public class CloudConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(CloudConfigServerApplication.class, args);
}
}
| [
"yangwx@ejiayou.com"
] | yangwx@ejiayou.com |
a97d9c4c0b03e72fab6e587c358e6d07829b2a48 | 673e40a66380d9c7c3fc5b2f6b4e9b3635716408 | /native/com/kenai/jnr/x86asm/SEGMENT.java | a79e95f557e266fabf5b2ed90437bf3eb480cfa1 | [] | no_license | bodza/braaam | 144f56b6c3db63a3f56bc2b39ca2aec289141188 | 27d870c205cb4f0a0fbcd73e656991e8dcb4666c | refs/heads/master | 2021-01-19T22:09:08.672944 | 2017-04-20T14:34:04 | 2017-04-20T14:34:04 | 88,760,283 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,528 | java | //
// Copyright (C) 2010 Wayne Meissner
//
// 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.kenai.jnr.x86asm;
/**
* Segment override prefixes.
*/
@Deprecated
public enum SEGMENT {
SEGMENT_NONE(0), SEGMENT_CS(0x2E), SEGMENT_SS(0x36),
SEGMENT_DS(0x3E), SEGMENT_ES(0x26), SEGMENT_FS(0x64), SEGMENT_GS(0x64);
private final int prefix;
SEGMENT(int prefix) {
this.prefix = prefix;
}
public final int prefix() {
return this.prefix;
}
}
| [
"robert.zawiasa@gmail.com"
] | robert.zawiasa@gmail.com |
f937277c6df6c9d87062641d57b33ff73bf49502 | 9230ea0c3a4c40144a75ae3d40d369cf702ca99a | /src/main/java/com/davydov/dto/CustomerDto.java | 8adc5880d8cde6a200c14860a6ca72b6be3ff4ca | [] | no_license | vo-davydov/gb-spring | 79f75198208833c0fedb5e5514c4f9b6cf0b42da | 1182865d64b9efa1c090d60c1ac803d835896d84 | refs/heads/master | 2023-04-14T09:01:21.649250 | 2021-04-18T09:31:27 | 2021-04-18T09:31:27 | 343,174,840 | 0 | 0 | null | 2021-04-18T09:31:28 | 2021-02-28T17:59:34 | Java | UTF-8 | Java | false | false | 707 | java | package com.davydov.dto;
import java.util.List;
public class CustomerDto {
private Long id;
private String name;
private List<Long> idProducts;
public CustomerDto() {
}
public CustomerDto(String name) {
this.name = name;
}
public CustomerDto(Long id, String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Long> getIdProducts() {
return idProducts;
}
public void setIdProducts(List<Long> idProducts) {
this.idProducts = idProducts;
}
}
| [
"davydovvip@gmail.com"
] | davydovvip@gmail.com |
df1af54114c346d551431426e39d1d692d55efae | 91ae645347ecc58bb941982a2aa13c1c2c0e966c | /01-java-fundamentals/02-fundamentals/03-fizzbuzz/FizzBuzz.java | 79e9560cd13dde608853b0b027c71ecf7ce76c2d | [] | no_license | codingdojo-java-06-19/MatthewS | ecbbf7111ec9e060d57aa186e5bb5a9ec607dfb5 | dc73cbf5d7a0afaf5101385b6075c17bf1988931 | refs/heads/master | 2020-05-31T03:57:11.446442 | 2019-06-21T07:07:57 | 2019-06-21T07:07:57 | 190,090,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | public class FizzBuzz {
public String fizzBuzz(int number) {
if (number % 5 == 0 && number % 3 == 0) {
return "FizzBuzz";
} else if (number % 5 == 0) {
return "Buzz";
} else if (number % 3 == 0) {
return "Fizz";
} else if (number == 2) {
return "2";
} else {
String num = "number: " + number;
return num;
}
}
} | [
"maugustschiller@gmail.com"
] | maugustschiller@gmail.com |
55d147208f91284f6649fc94cba57cf12d4e0a65 | cb729be7a3779bac337cc198162b17aa3d5822fa | /WEB-INF/src/Carm/SvCRD030.java | 6751a9371741c65dd403e05d214b8208a759bb15 | [] | no_license | Uchios/Carm | 9233b25a5351fcad55379e0a407f9a350bdd90f0 | 37fef6fdf72d0c7baf1aca221d8111317c917aba | refs/heads/master | 2021-08-24T15:17:47.222226 | 2017-07-25T13:17:03 | 2017-07-25T13:17:03 | 113,728,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package Carm;
import java.io.IOException;
import java.sql.Date;
import java.util.Calendar;
import java.util.List;
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;
@WebServlet("/SvCRD030")
public class SvCRD030 extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try {
req.setCharacterEncoding("UTF-8");
HttpSession session = req.getSession(false);
int userId = (Integer)session.getAttribute("user_id");
DaoCarmPersonal dcp = new DaoCarmPersonal(userId);
Integer cardId= Integer.parseInt(req.getParameter("card_id"));
int result = dcp.delCards(cardId);
req.setAttribute("result", result);
req.setAttribute("type", "delete");
RequestDispatcher rd = req.getRequestDispatcher("/CMM030.jsp");
rd.forward(req, resp);
} catch (Exception e) { // 例外発生時、エラー画面に遷移
e.printStackTrace();
req.setAttribute("message", "systemError");
req.setAttribute("style", "alert");
RequestDispatcher rd = req.getRequestDispatcher("/CMM010.jsp");
rd.forward(req, resp);
}
}
}
| [
"takuma@Takuma.local"
] | takuma@Takuma.local |
d01724c7abea44ceeda83ef7dc6880ed3c8cd19d | fba87139349acafb7f6d20870d4bc5368f6e224b | /athlon/athlonstorefront/web/testsrc/com/athlon/storefront/filters/CustomerLocationRestorationFilterTest.java | ccc05f59b2bac8975941819d4938238cc0247c78 | [] | no_license | PradeepKukreti/Athlon | f92eb311b74057f37a9f58fbe08d5dc3f35dc045 | 65a8cc394c8a54079b7d57cf71dc00594514c2e9 | refs/heads/master | 2021-01-11T01:35:08.133567 | 2016-10-23T20:06:33 | 2016-10-23T20:06:33 | 70,670,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,265 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.athlon.storefront.filters;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.acceleratorfacades.customerlocation.CustomerLocationFacade;
import de.hybris.platform.acceleratorservices.store.data.UserLocationData;
import com.athlon.storefront.security.cookie.CustomerLocationCookieGenerator;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@UnitTest
public class CustomerLocationRestorationFilterTest
{
private final static String COOKIE_NAME = "customerLocationCookie";
@InjectMocks
private final CustomerLocationRestorationFilter filter = new CustomerLocationRestorationFilter();
@Mock
private CustomerLocationFacade customerLocationFacade;
@Mock
private CustomerLocationCookieGenerator cookieGenerator;
@Mock
private HttpServletRequest request;
@Mock
private HttpServletResponse response;
@Mock
private FilterChain filterChain;
@Before
public void setup()
{
MockitoAnnotations.initMocks(this);
final Cookie cookie = mock(Cookie.class);
given(cookie.getName()).willReturn(COOKIE_NAME);
final Cookie[] cookies = { cookie };
given(request.getCookies()).willReturn(cookies);
}
@Test
public void testBrandNewUser() throws ServletException, IOException
{
// Scenario:
// User visits the website for the first time or has cleared all cookies
given(cookieGenerator.getCookieName()).willReturn("");
filter.doFilterInternal(request, response, filterChain);
// Expect to check cookies
verify(request, times(1)).getCookies();
// Expect no userLocationData to be set
verify(customerLocationFacade, never()).setUserLocationData(any(UserLocationData.class));
}
@Test
public void testRegularUser() throws ServletException, IOException
{
// Scenario:
// User selects a store location, then decides to pickup an item
final UserLocationData userLocationData = mock(UserLocationData.class);
given(customerLocationFacade.getUserLocationData()).willReturn(userLocationData);
filter.doFilterInternal(request, response, filterChain);
// Expect not to check cookies
verify(request, never()).getCookies();
// Expect no userLocationData to be set
verify(customerLocationFacade, never()).setUserLocationData(any(UserLocationData.class));
}
@Test
public void testLoggedInUserWhoLogsOut() throws ServletException, IOException
{
// Scenario:
// User selects a store location, logs in, then logs out to end the session
// The user then decides to pickup another item
given(cookieGenerator.getCookieName()).willReturn(COOKIE_NAME);
filter.doFilterInternal(request, response, filterChain);
// Expect to check cookies
verify(request, times(1)).getCookies();
// Expect a userLocationData to be set
verify(customerLocationFacade, times(1)).setUserLocationData(any(UserLocationData.class));
}
@Test
public void testCustomerLocationCookieValueForWeblogic() throws ServletException, IOException
{
//Test for weblogic
given(cookieGenerator.getCookieName()).willReturn("electronics-customerLocation");
final Cookie[] cookies = {new Cookie("electronics-customerLocation","\"japan|0.0,0.0\"")};
given(request.getCookies()).willReturn(cookies);
filter.doFilterInternal(request, response, filterChain);
verify(customerLocationFacade, times(1)).setUserLocationData(any(UserLocationData.class));
}
@Test
public void testCustomerLocationCookieValue() throws ServletException, IOException
{
given(cookieGenerator.getCookieName()).willReturn("apparel-uk-customerLocation");
final Cookie[] cookies = {new Cookie("apparel-uk-customerLocation","japan|-445.0,-123.767")};
given(request.getCookies()).willReturn(cookies);
filter.doFilterInternal(request, response, filterChain);
verify(customerLocationFacade, times(1)).setUserLocationData(any(UserLocationData.class));
given(cookieGenerator.getCookieName()).willReturn("apparel-uk-customerLocation");
final Cookie[] emptyValue = {new Cookie("apparel-uk-customerLocation","")};
given(request.getCookies()).willReturn(emptyValue);
filter.doFilterInternal(request, response, filterChain);
verify(customerLocationFacade, times(2)).setUserLocationData(any(UserLocationData.class));
}
}
| [
"pradeep.kukreti@accenture.com"
] | pradeep.kukreti@accenture.com |
65e53959e6c38c80f2d4322784059281b36ca2b8 | 8df23509fc4f4e006ecc7f7c558eb665f007fc7f | /src/test/java/com/uway/mobile/controller/DemoControllerTest.java | d5a3c38db9e564d5e67fb2df5048485d19e2a604 | [] | no_license | hyy316/secSituationAPI_FJ | 2a0a34757d2aa4ce507566d3bcb6553841fbff38 | 695a838d101e17aa89c71184ba92445433a2aa85 | refs/heads/master | 2021-08-16T15:37:51.105018 | 2017-11-20T03:29:47 | 2017-11-20T03:29:47 | 111,356,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,896 | java | package com.uway.mobile.controller;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.RequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
//@WebMvcTest(controllers = AssetInfoController.class)
@AutoConfigureMockMvc
public class DemoControllerTest extends BaseApplicationTest {
@Autowired
MockMvc mvc;
String expectedJson;
// @Autowired
// WebApplicationContext webApplicationConnect;
//
// @Before
// public void setUp() throws JsonProcessingException {
// mvc = MockMvcBuilders.webAppContextSetup(webApplicationConnect).build();
//
//// mvc =MockMvcBuilders.standaloneSetup(new UserController()).build();
//
// }
/**
* 安全总结报告
*
* @throws Exception
*/
@SuppressWarnings({ "unchecked", "unused", "rawtypes" })
@Test
public void testShow() throws Exception {
String expectedResult = "hello world!";
String uri = "/safeReport/summary";
RequestBuilder request = null;
Map map = new HashMap<String, String>();
map.put("page_size", "10");
map.put("page_num", "1");
// SoftInfo softInfo = new SoftInfo();
// //设置值
// ObjectMapper mapper = new ObjectMapper();
// ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
// java.lang.String requestJson = ow.writeValueAsString(softInfo);
request = MockMvcRequestBuilders.get(uri).param("city", "");// .params((MultiValueMap<String,
// String>)
// map);
// request =
// MockMvcRequestBuilders.post(uri).contentType(MediaType.APPLICATION_JSON).content("");
MvcResult mvcResult = mvc.perform(request).andExpect(status().isOk())
.andExpect(jsonPath("$.data.vulnerability").value(0))
// .andDo(print())
// andExpect(content().string("[{\"id\":1,\"name\":\"林峰\",\"age\":20}]"));
.andReturn();
int status = mvcResult.getResponse().getStatus();
String content = mvcResult.getResponse().getContentAsString();
System.out.println(status + "," + content);
Assert.assertTrue("正确,正确的返回值为200", status == 200);
Assert.assertFalse("错误,正确的返回值为200", status != 200);
// Assert.assertTrue("数据一致", expectedResult.equals(content));
// Assert.assertFalse("数据不一致", !expectedResult.equals(content));
}
protected String Obj2Json(Object obj) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(obj);
}
}
| [
"huangyy@uway.cn"
] | huangyy@uway.cn |
8fbb351e5a995d40fe3588cc3580b42b10cd7fae | 9f4b429416fbd3d084da12acecb8de74680a2ee8 | /Snake V1/src/GUI/Window.java | b7340373395ea54ba6aa98b99f536d3a650bf8a0 | [] | no_license | MefAldemisov/SnakeV_1 | 9698bbf419f0bc49bb5a29bfb164061f87a34bfd | 4301b9b3607b98a4eafa3a9e0240c62de4e56e00 | refs/heads/master | 2021-01-20T11:10:31.400411 | 2017-08-28T17:18:03 | 2017-08-28T17:18:03 | 101,666,329 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 14,272 | java | package GUI;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTable;
import menu.SetColorMenu;
import menu.SetFoodMenu;
import menu.SetSizeMenu;
import menu.SetSpeedMenu;
@SuppressWarnings("serial")
public class Window extends JFrame {
private static int size;
public static int getSIZE() {
return size;
}
public static void setSIZE(int size) {
Window.size = size;
}
private static int speed;
public static void setSpeed(int speed) {
Window.speed = speed;
}
public static String color;
public static String food;
private static short vector, pastHeadVector;
public static void setVector(short Vector) {
vector = Vector;
}
private ImageIcon[][] mainArray;
boolean alive, eaten, stop;
private ArrayList<OneSnakePart> snake;
private JTable table;
private JMenuBar menuBar;
private JMenu mnFile, mnHelp, mnExit;
private JMenuItem mntmChangeSize, mntmChangeSpeed, mntmLookAtThe, mntmExit;
private JPanel panel;
private ImageIcon white, app, head, turn;
private OneSnakePart apple;
protected JButton btnStop;
private JLabel lblLengthIs;
private KeyListener lisener;
private ImageIcon body;
private ImageIcon tail;
private TableBuilder model;
private JMenuItem mntmChangeColor;
private JMenuItem mntmChangeFood;
public Window(String s) {
super(s);
setFont(new Font("Arial", Font.BOLD, 16));
size = Main.getSize();
speed = Main.getSpeed();
color=Main.getColor();
food= Main.getFood();
images();
menuSets();
basicParam();
drawer();
setVisible(true);
moovingPart();
}
// Don't ask me, why I made it at the specific method.
private void images() {
white = new ImageIcon("pictures/"+color+"/white.png");
app = new ImageIcon("pictures/"+color+"/"+food+".png");
}
// menu at the top
private void menuSets() {
menuBar = new JMenuBar();
setJMenuBar(menuBar);
mnFile = new JMenu("Settings");
mnFile.setFont(new Font("Arial", Font.PLAIN, 20));
menuBar.add(mnFile);
mntmChangeSize = new JMenuItem("Change size");
mntmChangeSize.setFont(new Font("Arial", Font.PLAIN, 18));
mntmChangeSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
stop = true;
btnStop.setText(">");
SetSizeMenu setSise = new SetSizeMenu();
setSise.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Main.setRedo(true);
System.out.println("must be redrawen");
alive = false;
}
});
mnFile.add(mntmChangeSize);
mntmChangeSpeed = new JMenuItem("Change speed");
mntmChangeSpeed.setFont(new Font("Arial", Font.PLAIN, 18));
mnFile.add(mntmChangeSpeed);
mnFile.setFont(new Font("Arial", Font.PLAIN, 20));
mntmChangeSpeed.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
stop = true;
btnStop.setText(">");
SetSpeedMenu setMenu = new SetSpeedMenu();
setMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Main.setRedo(true);
System.out.println("asked");
alive = false;
}
});
mntmChangeColor = new JMenuItem("Change color");
mntmChangeColor.setFont(new Font("Arial", Font.PLAIN, 18));
mnFile.add(mntmChangeColor);
mntmChangeColor.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
stop = true;
btnStop.setText(">");
SetColorMenu setMenu = new SetColorMenu();
setMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Main.setRedo(true);
System.out.println("asked");
alive = false;
}
});
mntmChangeFood = new JMenuItem("Change food");
mntmChangeFood.setFont(new Font("Arial", Font.PLAIN, 18));
mnFile.add(mntmChangeFood);
mntmChangeFood.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
stop = true;
btnStop.setText(">");
SetFoodMenu setMenu = new SetFoodMenu();
setMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Main.setRedo(true);
System.out.println("asked");
alive = false;
}
});
mnHelp = new JMenu("Restart");
mnHelp.setFont(new Font("Arial", Font.PLAIN, 20));
menuBar.add(mnHelp);
mntmLookAtThe = new JMenuItem("Restart");
mntmLookAtThe.setFont(new Font("Arial", Font.PLAIN, 18));
mntmLookAtThe.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Main.setRedo(true);
System.out.println("asked");
alive = false;
}
});
mnHelp.add(mntmLookAtThe);
mnExit = new JMenu("Exit");
mnExit.setFont(new Font("Arial", Font.PLAIN, 20));
menuBar.add(mnExit);
mntmExit = new JMenuItem("Exit");
mntmExit.setFont(new Font("Arial", Font.PLAIN, 18));
mnExit.add(mntmExit);
getContentPane().setLayout(new BorderLayout(0, 0));
mntmExit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
stop = true;
btnStop.setText(">");
System.exit(2);
}
});
}
private void basicParam() {
eaten = false;
vector = 1;
alive = true;
snake = new ArrayList<OneSnakePart>();
snake.add(new OneSnakePart(4, 4, (short) 1));
}
// here the window is drawn
protected void drawer() {
setBounds(100, 100, size * 35 + 140, size * 32 + 70);
java.awt.Image im = this.getToolkit().getImage("pictures/titleIcon.png");
setIconImage(im);
panel = new JPanel();
getContentPane().add(panel, BorderLayout.CENTER);
tableDrwaer();
btnStop = new JButton("||");
btnStop.setFont(new Font("Arial", Font.PLAIN, 20));
btnStop.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
pause();
table.setFocusable(true);
table.requestFocus();
}
});
panel.add(btnStop);
lblLengthIs = new JLabel("length is" + snake.size());
if (snake.size() == size * size-1) {
lblLengthIs.setText("You win!!! :)");
}
lblLengthIs.setFont(new Font("Arial", Font.PLAIN, 20));
panel.add(lblLengthIs);
}
private void tableDrwaer() {
model = new TableBuilder();
mainArray = model.getScreen_array();
table = new JTable(model);
table.setBackground(SystemColor.text);
table.setSurrendersFocusOnKeystroke(true);
table.setShowVerticalLines(false);
table.setShowHorizontalLines(false);
table.setShowGrid(false);
table.setRowSelectionAllowed(false);
table.setRowHeight(30);
for (int i = 0; i < size; i++) {
table.getColumnModel().getColumn(i).setPreferredWidth(30);
for(int j=0; j<size; j++){
mainArray[i][j]=white;
}
}
lisAdder();
panel.add(table);
table.updateUI();
}
// key listener
private void lisAdder() {
lisener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyChar() == 'a' || e.getKeyChar() == 'ô' || e.getKeyChar() == 'Ô' || e.getKeyChar() == 'A'
|| e.getKeyCode() == KeyEvent.VK_LEFT) {
short lokalVector=0;
if(lokalVector==vector){
speed-=50;
}else{
speed=Main.getSpeed();
}
vector = 0;
}
if (e.getKeyChar() == 'w' || e.getKeyChar() == 'ö' || e.getKeyChar() == 'Ö' || e.getKeyChar() == 'W'
|| e.getKeyCode() == KeyEvent.VK_UP) {
short lokalVector=1;
if(lokalVector==vector){
speed-=50;
}else{
speed=Main.getSpeed();
}
vector = 1;
}
if (e.getKeyChar() == 'd' || e.getKeyChar() == 'â' || e.getKeyChar() == 'Â' || e.getKeyChar() == 'D'
|| e.getKeyCode() == KeyEvent.VK_RIGHT) {
short lokalVector=3;
if(lokalVector==vector){
speed-=50;
}else{
speed=Main.getSpeed();
}
vector = 3;
}
if (e.getKeyChar() == 's' || e.getKeyChar() == 'û' || e.getKeyChar() == 'Û' || e.getKeyChar() == 'S'
|| e.getKeyCode() == KeyEvent.VK_DOWN) {
short lokalVector=2;
if(lokalVector==vector){
speed-=50;
}else{
speed=Main.getSpeed();
}
vector = 2;
}
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
pause();
}
}
@Override
public void keyPressed(KeyEvent e) {
}
};
table.addKeyListener(lisener);
}
private void pause() {
if (btnStop.getText() == "||") {
stop = true;
btnStop.setText(">");
} else {
stop = false;
btnStop.setText("||");
}
}
// Hooray! Interesting part is here^
private void moovingPart() {
generateApple();
appleEqSnake();
long time1 = 0, time2 = 0;
Date date = new Date();
time2 = date.getTime();
while (alive) {
time1 = date.getTime();
while ((time1 - time2) < speed || stop) {
Date date2 = new Date();
time1 = date2.getTime();
if (stop) {
}
}
pastHeadVector = snake.get(0).getV();
// set vector of a head
switch (vector) {
case 0:
snake.add(0, new OneSnakePart(snake.get(0).getX(), snake.get(0).getY() - 1, vector));
head = new ImageIcon("pictures/"+color+"/left.png");
break;
case 1:
snake.add(0, new OneSnakePart(snake.get(0).getX() - 1, snake.get(0).getY(), vector));
head = new ImageIcon("pictures/"+color+"/up.png");
break;
case 2:
snake.add(0, new OneSnakePart(snake.get(0).getX() + 1, snake.get(0).getY(), vector));
head = new ImageIcon("pictures/"+color+"/down.png");
break;
case 3:
snake.add(0, new OneSnakePart(snake.get(0).getX(), snake.get(0).getY() + 1, vector));
head = new ImageIcon("pictures/"+color+"/right.png");
break;
}
switch (pastHeadVector) {
case 0:
body = new ImageIcon("pictures/"+color+"/horisontal.png");
break;
case 1:
body = new ImageIcon("pictures/"+color+"/vertical.png");
break;
case 2:
body = new ImageIcon("pictures/"+color+"/vertical.png");
break;
case 3:
body = new ImageIcon("pictures/"+color+"/horisontal.png");
}
mainArray[snake.get(1).getX()][snake.get(1).getY()] = body;
// now first isn't head
aliveChek();
if (alive) {
if (apple.getX() == snake.get(0).getX() && apple.getY() == snake.get(0).getY()) {
// apple is eaten
lblLengthIs.setText("length is " + snake.size());
generateApple();
appleEqSnake();
} else {
// remove last part of a tail
mainArray[snake.get(snake.size() - 1).getX()][snake.get(snake.size() - 1).getY()] = white;
snake.remove(snake.size() - 1);
}
// lets make specific image for a tail!
// I know, that I should use another collection, but I AM
// LAZYYYYYY!!!!
mainArray[snake.get(0).getX()][snake.get(0).getY()] = head;
if (snake.size() > 1) {
switch (snake.get(snake.size() - 2).getV()) {
case 0:
tail = new ImageIcon("pictures/"+color+"/tailLeft.png");
break;
case 1:
tail = new ImageIcon("pictures/"+color+"/tailUp.png");
break;
case 2:
tail = new ImageIcon("pictures/"+color+"/tailDown.png");
break;
case 3:
tail = new ImageIcon("pictures/"+color+"/tailRight.png");
}
mainArray[snake.get(snake.size() - 1).getX()][snake.get(snake.size() - 1).getY()] = tail;
if (snake.size() > 2) {
if (snake.get(0).getV() != snake.get(1).getV()) {
turn(snake.get(0).getV(), snake.get(1).getV());
}
}
}
// and what if snake turned?
redraw();
Date date3 = new Date();
time2 = date3.getTime();
}
}
// came out of the alive circle <=> die
int needRestart = JOptionPane.showConfirmDialog(null, "Game over. Would you like to restart?");
if (needRestart == JOptionPane.YES_OPTION || needRestart == JOptionPane.CANCEL_OPTION) {
Main.setRedo(true);
dispose();
} else {
System.exit(2);
}
}
private void turn(short v2, short v1) {
// this is MASO. Trust me.
if ((v1 == 0 && v2 == 2) || (v1 == 1) && (v2 == 3)) {
turn = new ImageIcon("pictures/"+color+"/turn1.png");
} else if ((v1 == 3 && v2 == 2) || (v1 == 1) && (v2 == 0)) {
turn = new ImageIcon("pictures/"+color+"/turn2.png");
} else if ((v1 == 2 && v2 == 0) || (v1 == 3) && (v2 == 1)) {
turn = new ImageIcon("pictures/"+color+"/turn3.png");
} else if ((v1 == 0 && v2 == 1) || (v1 == 2) && (v2 == 3)) {
turn = new ImageIcon("pictures/"+color+"/turn4.png");
}
mainArray[snake.get(1).getX()][snake.get(1).getY()] = turn;
}
private boolean appleChekSnake() {
// If apple generate into the snake, it's not right.
boolean eq = false;
for (OneSnakePart part : snake) {
if (part.getX() == apple.getX() && part.getY() == apple.getY()) {
eq = true;
break;
}
}
return eq;
}
private void generateApple() {
Random rand = new Random();
apple = new OneSnakePart(rand.nextInt(size - 1), rand.nextInt(size - 1), (short) 1);
}
private void appleEqSnake() {
// Apple is eaten.
while (appleChekSnake()) {
generateApple();
}
mainArray[apple.getX()][apple.getY()] = app;
}
private void redraw() {
// Don't us me, why I made it in a specific method.
table.updateUI();
}
private void aliveChek() {
if (snake.get(0).getX() < 0 || snake.get(0).getX() > (size - 1) || snake.get(0).getY() > (size - 1)
|| snake.get(0).getY() < 0) {
alive = false;
} else {
for (int i = 1; i < snake.size(); i++) {
if (snake.get(0).getX() == snake.get(i).getX() && snake.get(0).getY() == snake.get(i).getY()) {
alive = false;
}
}
}
}
} | [
"Alinna@DESKTOP-61T9OOI"
] | Alinna@DESKTOP-61T9OOI |
0bf4bbcf2e698faa75c64e0b4a8c50044ac520a0 | f961e18268f5621c54131c120a3cdbe016c737f6 | /src/at/roadrunner/android/sensor/Sensor.java | 06a896c178dfe0595e523d569a83f8e234238e27 | [] | no_license | Wolfy42/RoadrunnerAndroid | cca8f6884920856b5cf1a14aff468240891dedcb | 063f7d51e68dead9a6ee84583cd124bd0421b406 | refs/heads/master | 2020-06-06T03:30:17.044086 | 2011-06-23T08:43:43 | 2011-06-23T08:43:43 | 1,467,250 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | /**
* Sensor.java
*
* This file is part of the Roadrunner project.
*
* Copyright (c) 2011 Franziskus Domig. All rights reserved.
*
* @author Franziskus Domig
* @date 10.03.2011
*/
package at.roadrunner.android.sensor;
import java.io.IOException;
/**
* Interface Sensor
*
* @author Franziskus Domig
*/
public interface Sensor {
public String getData() throws IOException;
}
| [
"schmid_mat@gmx.at"
] | schmid_mat@gmx.at |
7b57dba855d6b1d2b1e3a251c9db33d18d3de2c1 | c5dde5840083306c1b6485e5631554a4380074ef | /app/src/main/java/com/app/locationtracker/SugarReasons.java | 6a33a6596ed02c270a428cf937bea6cdaa88429d | [] | no_license | AnandBoreda/Location_tracker | c00d3f17b173469c3602ce292ace35df22a0771d | 2a27739295f1f1cd1cb5d10536197d1df18cad72 | refs/heads/master | 2020-07-03T00:19:19.804563 | 2020-02-02T16:43:40 | 2020-02-02T16:43:40 | 201,722,237 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.app.locationtracker;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class SugarReasons extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sugar_reasons);
}
}
| [
"zz.anand2016@gmail.com"
] | zz.anand2016@gmail.com |
7344a9469962f57c9ce78256f29e7dca3b2bb67e | c76e1c4c95d8f5fd2d05aa2f094c72ab818a7ea1 | /Pepper.java | 764c0e7bd5c967f01df83d21d6cb96d061654dfa | [] | no_license | SamDev14/IntProg | a444e90a83f0341b977c9c8ce52b7470c76df9bd | 035b5dc5ea88de3deecdac1e2ea5fb35d2926121 | refs/heads/master | 2021-04-09T15:39:27.991660 | 2018-03-18T22:36:38 | 2018-03-18T22:36:38 | 125,755,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | 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 pizzaorderingsystemnetbeans;
import java.awt.Color;
/**
*
* @author sam
*/
public class Pepper {
public void drawPepper() {
int heightAdjust = 100;
int diameter = 20;
canvas.setForegroundColor(Color.ORANGE);
for (int i = 0; i <= 1; i++) {
for (int j = 150; j <= 160; j += 5) {
if (j == 155) {
heightAdjust = 110;
} else {
heightAdjust = 100;
}
canvas.fillCircle(topLeftX + j, topLeftY + heightAdjust, diameter);
}
canvas.setForegroundColor(Color.WHITE);
diameter = 14;
}
}
}
| [
"noreply@github.com"
] | SamDev14.noreply@github.com |
453eb6b3f993605dbe7f184f506f3d247d524925 | c3ea0d27c8f3984842fd4218cb18ea9df46b622f | /main/java/ru/laba/training/security/UserAuthService.java | c3b025c0c82b919209b0f15c3115cc986b4cf9a1 | [] | no_license | Valeria177/laba4transaction | dc6c4d5790a171b6dd454abd7e3876b808f38a71 | 906949dd94db0710f70c1be0eedece4bff2469f5 | refs/heads/main | 2023-06-01T08:33:18.310824 | 2021-06-14T17:58:47 | 2021-06-14T17:58:47 | 376,910,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,340 | java | package ru.laba.training.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import ru.laba.training.persist.UserRepository;
import java.util.Collections;
@Service
public class UserAuthService implements UserDetailsService {
private final UserRepository repository;
@Autowired
public UserAuthService(UserRepository repository) {
this.repository=repository;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
return repository.findByUsername(username)
.map(user -> new User(
user.getUsername(),
user.getPassword(),
Collections.singletonList(new SimpleGrantedAuthority(user.getRole().getAuthority()))
))
.orElseThrow(() -> new UsernameNotFoundException("Пользователь не найден"));
}
}
| [
"noreply@github.com"
] | Valeria177.noreply@github.com |
17e2f1be643cece9d7d6b0163201e642b420835d | 3560e819370cddf6418ba527ef4ac23050916d34 | /src/com/retailbank/dao/CustomerDao.java | 5277201032cb134245c8b158eb2408892b8cff92 | [] | no_license | vijayk111/sample-login-app | a0c45817dd7c43130495ac35d9c68b854d57e712 | cd842ebce22250c546c6adaff567b177702b850e | refs/heads/main | 2023-03-31T10:47:22.925240 | 2021-04-12T21:37:17 | 2021-04-12T21:37:17 | 355,183,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | package com.retailbank.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import com.retailbank.beans.Customer;
import com.retailbank.utilities.DBCon;
public class CustomerDao implements CustomerDaoInterface<Customer>{
private static Connection con= null;
private static Statement smt = null;
private static ResultSet rs = null;
@Override
public void deleteCustomer(String obj) {
String delQuery = "update customers set status='Inactive' where customerId='"+obj+"'";
try {
con=DBCon.getConnection();
smt= con.createStatement();
smt.executeUpdate(delQuery);
}catch(Exception e) {
e.printStackTrace();
}
finally {
DBCon.closeConnection();
}
}
}
| [
"noreply@github.com"
] | vijayk111.noreply@github.com |
50da0495b6448fac3ca6ee2fb869a68d5ae01657 | c4b9942d6e45eeba8d211d2cf7327804b6cbb984 | /2.JavaCore/src/com/javarush/task/task19/task1915/Solution.java | 7e86a94d4ac7039082492c10300ae0ecc89b783b | [] | no_license | sabonv/JRushTasks | 0db05ae4862f50e8916ed5462e178f9eb08035a1 | 1bcabed0dd42f46c43ea583b1283ba8d699227d4 | refs/heads/master | 2021-01-22T19:31:06.143779 | 2018-01-16T16:27:43 | 2018-01-16T16:27:43 | 85,204,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package com.javarush.task.task19.task1915;
/*
Дублируем текст
*/
import java.io.*;
public class Solution {
public static TestString testString = new TestString();
public static void main(String[] args) throws Exception{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileOutputStream fileW = new FileOutputStream(reader.readLine());
reader.close();
PrintStream trueStream = System.out;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(outputStream);
System.setOut(stream);
testString.printSomething();
String result = outputStream.toString();
char[] resCh = result.toCharArray();
for (char ch: resCh) {
fileW.write(ch);
}
fileW.close();
//Возвращаем все как было
System.setOut(trueStream);
System.out.println(result);
}
public static class TestString {
public void printSomething() {
System.out.println("it's a text for testing");
}
}
}
| [
"znakomiymne@list.ru"
] | znakomiymne@list.ru |
c469859ffb2f2d2dcf669947716a97621b613b22 | 533e04adb81f67fc6efaac0b8c989d6288096b96 | /src/main/java/bot/DateChecker.java | 2f2977fabb26bd97c9798ccc3bd6546fad807eaf | [] | no_license | GennadyBerezinsky/BDayDateBot | b0552f16e1a950775b7cc6b767e105884c4ba5c7 | 5ca49bfb31c75192ab3a4ce1e9294c75cbed895c | refs/heads/master | 2020-03-21T23:34:12.308756 | 2018-08-28T19:44:00 | 2018-08-28T19:44:00 | 139,192,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,534 | java | package bot;
// Created by User on 16.06.2018
// Project: BDayDateBotTg
// Target: class with database & date checker
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Logger;
public class DateChecker implements ConstStrings {
//Inteface ConstStrings contains some contants such as bot token, passwords from database, etg..
public void newDate(String userID, String firstName, String dateString, String chatID) throws ClassNotFoundException, SQLException {
boolean flag = false;
java.lang.Class.forName("com.mysql.jdbc.Driver");
String valdates = userID + ", " + dateString;
String valusers = userID + ", " + chatID;
try(Connection connection = DriverManager.getConnection(connectionURL, userName, password);
Statement statement = connection.createStatement()){
statement.executeUpdate("insert into dates (UserID, Date, UserName, ChatID) VALUES ('" + userID +
"', '"+dateString+"', '"+firstName+"' , '" + chatID + "')");
Logger.getGlobal().info("Insert compleate.");
}
}
public void runChecker(){
Date thisDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM -yyyy");
String today = sdf.format(thisDate);
boolean flag = true;
try {
Thread.sleep(300000);
Date date = new Date();
String check = sdf.format(date);
System.out.println(today);
System.out.println(check);
if(check.equals(today)){
System.out.println("date ok");
flag = true;
}
if(flag && check.equals(today)){
System.out.println("checking date");
this.checkDate();
Calendar c = Calendar.getInstance();
c.setTime(thisDate);
c.add(Calendar.DATE, 1);
thisDate = c.getTime();
today = sdf.format(thisDate);
flag = false;
}
} catch (InterruptedException e){
System.out.println(e.getMessage());
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public void checkDate() throws ClassNotFoundException, SQLException {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
date.setTime(date.getTime());
String today = format.format(date).toString();
java.lang.Class.forName("com.mysql.jdbc.Driver");
try(Connection connection = DriverManager.getConnection(connectionURL, userName, password);
Statement statement = connection.createStatement()){
ResultSet rs = statement.executeQuery("select * from dates");
while (rs.next()){
String userId = rs.getString(2);
String dateS = rs.getString(3);
String name = rs.getString(4);
String chat = rs.getString(5);
String todayDM = today.substring(0, 6);
String dateSDM = dateS.substring(0, 6);
if(todayDM.equals(dateSDM)){
new Bot().sendMsg(chat, "С днюхой, " + name + "!!!");
}
}
}
}
}
| [
"genchik.98.vn@gmail.com"
] | genchik.98.vn@gmail.com |
8a7bc3cd54e29ea4c50ed088074ca7f611375358 | 36530c8e61d408f202df3b6487fcf0754ccb3be6 | /work/src/main/java/com/apust/javacore/work/performance/App0.java | edd4aea4773cf0578d37e7fbb31bf2005eef2a6c | [] | no_license | Apust13/javacore | ff762d02028c9f605688fad7cdbbc40a89f0d36b | 73e9b6c3a06c5946e28268bec8cc3d243f668143 | refs/heads/master | 2021-09-05T01:43:44.772494 | 2018-01-23T14:39:52 | 2018-01-23T14:39:52 | 113,579,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,023 | java | package com.apust.javacore.work.performance;
import java.util.ArrayList;
public class App0 {
public static void main(String[] args) {
ArrayList<String> list1 = new ArrayList<>();
ArrayList<String> list2 = new ArrayList<>();
int j = 0;
int k = 0;
// for(int i = 0; i++ < 10;){
// list1.add(String.valueOf(i));
//
// }
//
// for(int i = 0; ++i < 10;){
// list2.add(String.valueOf(i));
// }
long t1 = System.currentTimeMillis();
for (int i = 0; i < 10;) {
list1.add(String.valueOf(++i));
}
long t2 = System.currentTimeMillis() - t1;
System.out.println("++i :" + t2);
long t3 = System.currentTimeMillis();
for (int f = 0; f < 10;) {
list2.add(String.valueOf(f++));
}
long t4 = System.currentTimeMillis() - t3;
System.out.println("i++ :" + t4);
System.out.println(list1);
System.out.println(list2);
}
}
| [
"alexandr.nikitin@achieve3000.com"
] | alexandr.nikitin@achieve3000.com |
fc402cfd4c3078503365482e32464ae2a263a500 | 871f9a4b6669a81ad23e2788c36d5acd8c2109c5 | /src/main/java/com/xyz/customer/entity/CustomerEntity.java | 0a2429f47fb5f33545c5c567691fa4db862fc1a0 | [] | no_license | paritoshh/customer | 0fbbed717995abf0a4dc6acb79072494cd4f2e4e | 14af1fe617ce465c272760f3bb2019e3bdbf90bd | refs/heads/master | 2022-10-16T12:11:27.345420 | 2020-06-09T06:16:28 | 2020-06-09T06:16:28 | 270,349,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.xyz.customer.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "CUSTOMER_DETAILS")
public class CustomerEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "CUSTOMER_ID")
private String customerId;
@Column(name = "NAME")
private String customerName;
@Column(name = "EMAIL")
private String customerEmail;
@Column(name = "MOBILE_NUMBER")
private String mobileNumber;
@Column(name = "NOTIFICATION_PREFERENCE")
private String notificationPreference;
}
| [
"paritosh30sep@gmail.com"
] | paritosh30sep@gmail.com |
7b1b9a4b0b2ae5e80af4d506246e75bdbfb8a36b | b620184e212d128e2280e89a148321561cab0197 | /src/com/eduportal/controller/UpdateInfoFaculty.java | 8ba82a02cfd77cad8367db4212b8ab5e47b28446 | [] | no_license | prateikjena/Virtual-Classroom | cad668e978a05441894d6967fe72abb756afd092 | da07cc8ae720a60de9fc4bc10653d9abef2c1ecb | refs/heads/master | 2022-12-31T08:44:51.357304 | 2020-10-19T05:50:37 | 2020-10-19T05:50:37 | 281,980,273 | 0 | 0 | null | 2020-07-23T14:52:36 | 2020-07-23T14:52:31 | null | UTF-8 | Java | false | false | 2,870 | java | package com.eduportal.controller;
import java.io.IOException;
import java.sql.ResultSet;
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 com.eduportal.dao.DBConnection;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
/**
* Servlet implementation class UpdateInfoFaculty
*/
@WebServlet("/UpdateInfoFaculty")
public class UpdateInfoFaculty extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UpdateInfoFaculty() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String sname=request.getParameter("sname");
String uname=request.getParameter("uname");
String pwd=request.getParameter("pwd");
String dob=request.getParameter("dob");
String paddr=request.getParameter("paddr");
String phno=request.getParameter("phno");
String mob=request.getParameter("mob");
String email=request.getParameter("email");
String permaddr=request.getParameter("permaddr");
String roll=request.getParameter("roll");
String subject=request.getParameter("subject");
String college=request.getParameter("college");
String qual=request.getParameter("qual");
System.out.println("Roll="+roll);
Connection con;
PreparedStatement ps;
ResultSet rs;
try
{
con=(Connection) DBConnection.getMySQlConnection();
ps=(PreparedStatement) con.prepareStatement("update facultyrec set fname=?,"
+ "uname=?, password=?,dob=?,presentaddr=?,phn=?,mob=?,email=?,permaddr=?,"
+ "subject=?,qualification=?,college=? where fid=?");
ps.setString(1,sname);
ps.setString(2,uname);
ps.setString(3,pwd);
ps.setString(4,dob);
ps.setString(5,paddr);
ps.setString(6,phno);
ps.setString(7,mob);
ps.setString(8,email);
ps.setString(9,permaddr);
ps.setString(10,subject);
ps.setString(11,qual);
ps.setString(12,college);
ps.setString(13, roll);
int i=ps.executeUpdate();
}
catch(Exception e)
{
}
RequestDispatcher rd=request.getRequestDispatcher("AdminHomepage.jsp");
rd.forward(request, response);
}
/**
* @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);
}
}
| [
"pjena891@gmail.com"
] | pjena891@gmail.com |
55940e3b05ed1d5c435ad7ff7965532d08e1d924 | bca0e15b1c69e6a25de28fa8204456370f40d9c9 | /src/main/java/com/datao/bigidea/mapper/BlogMapper.java | 89627b87d647e4c8d0dc86a201ba086a5e7c3ba4 | [] | no_license | wangdadatao/BigIdea | 2f5c4eda2c592afb314eafd91e05037a795a13a5 | 1b07edfaf370b4c404eacea08491c5bd79772f1b | refs/heads/master | 2021-01-13T09:02:43.176968 | 2017-04-07T15:29:28 | 2017-04-07T15:29:28 | 72,354,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java | package com.datao.bigidea.mapper;
import com.datao.bigidea.entity.Blog;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Created by 王 海涛 on 2016/11/25.
*/
public interface BlogMapper {
/**
* 查询博客分类
*
* @return 博客分类
*/
List<Map<String, String>> queryTypes();
/**
* 根据ID查询博客
*
* @param id 博客ID
* @return 博客对象
*/
Blog queryByID(Integer id);
/**
* 根据类别查询文章
*
* @param type 查询类型
* @return 结果集
*/
List<Blog> queryByType(String type);
/**
* 查询文章列表
*
* @param keyWords 搜索关键词
* @return 结果集
*/
List<Blog> queryBlogList(@Param("keyWords") String keyWords);
/**
* 添加blog
*
* @param blog 博客对象
*/
void insertBlog(Blog blog);
/**
* 更新博客内容
*
* @param blog 博客对象
*/
void updateBlog(Blog blog);
}
| [
"358981721@qq.com"
] | 358981721@qq.com |
1ba82a8f9683fb4e318e749921edeee7a848fe56 | 8f2bc3d5e61e2be81c22029e6409d797dbff1d98 | /src/main/java/it/polimi/ingsw/client/cli/views/TotalResourceCounter.java | 872324c92013c918503afa939fa509bda3a8e815 | [
"MIT"
] | permissive | MirkoGenoni/ing-sw-2021-fossati-genoni-grazioli | c50cb6dfb5b85444378f8d2cdc905fa9c520b9c2 | 2eb44b518b1b6e4f57b8bb0b01b3768cc2d97c36 | refs/heads/main | 2023-08-27T09:16:21.635039 | 2021-10-07T15:26:38 | 2021-10-07T15:26:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,778 | java | package it.polimi.ingsw.client.cli.views;
import it.polimi.ingsw.client.cli.views.productionview.DevelopmentCardSymbols;
import it.polimi.ingsw.model.resource.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* This class prints the total count of resources possessed by the player for the buy of development
* card and the activation of development card
*
* @author Mirko Genoni
*/
public class TotalResourceCounter {
String[] representation;
/**
* Constructor of the class initializes all the data structure
* @param strongbox is the current state of the player's strongbox
* @param deposit is the current state of the player's deposit
* @param additionalDeposit is the current state of the player's additionalDeposit
*/
public TotalResourceCounter(Map<Resource, Integer> strongbox, ArrayList<Resource> deposit, ArrayList<Resource> additionalDeposit){
Map<Resource, Integer> tmp = new HashMap<>(strongbox);
for(Resource r: deposit){
if(r!=null)
tmp.put(r, tmp.get(r)+1);
}
if(additionalDeposit.size()!=0){
for(Resource r: additionalDeposit){
if(r!=null)
tmp.put(r, tmp.get(r)+1);
}
}
ArrayList<DevelopmentCardSymbols> symbols = new ArrayList<>();
symbols.add(DevelopmentCardSymbols.SHIELD);
symbols.add(DevelopmentCardSymbols.COIN);
symbols.add(DevelopmentCardSymbols.STONE);
symbols.add(DevelopmentCardSymbols.SERVANT);
this.representation = new String[3];
saveState(tmp, symbols);
}
/**
* This method saves the visualization of the resource counter
*
* @param totalResources is a map that contains the count of all the resources
* @param symbols contains a square colored by the type of resource
*/
private void saveState(Map<Resource, Integer> totalResources, ArrayList<DevelopmentCardSymbols> symbols){
this.representation[0] = "┃ " + symbols.get(0).returnLine(0) + " " + symbols.get(1).returnLine(0) + " " + symbols.get(2).returnLine(0) + " " + symbols.get(3).returnLine(0) + " ┃";
this.representation[1] = "┃ RESOURCE AVAILABLE: ";
if(totalResources.get(Resource.valueOf(symbols.get(0).toString()))<10)
this.representation[1] = this.representation[1] + "0" + totalResources.get(Resource.valueOf(symbols.get(0).toString())) + "x " + symbols.get(0).returnLine(1) + " ";
else
this.representation[1] = this.representation[1] + totalResources.get(Resource.valueOf(symbols.get(0).toString())) + "x " + symbols.get(0).returnLine(1) + " ";
if(totalResources.get(Resource.valueOf(symbols.get(1).toString()))<10)
this.representation[1] = this.representation[1] + "0" + totalResources.get(Resource.valueOf(symbols.get(1).toString())) + "x " + symbols.get(1).returnLine(1) + " ";
else
this.representation[1] = this.representation[1] + totalResources.get(Resource.valueOf(symbols.get(1).toString())) + "x " + symbols.get(1).returnLine(1) + " ";
if(totalResources.get(Resource.valueOf(symbols.get(2).toString()))<10)
this.representation[1] = this.representation[1] + "0" + totalResources.get(Resource.valueOf(symbols.get(2).toString())) + "x " + symbols.get(2).returnLine(1) + " ";
else
this.representation[1] = this.representation[1] + totalResources.get(Resource.valueOf(symbols.get(2).toString())) + "x " + symbols.get(2).returnLine(1) + " ";
if(totalResources.get(Resource.valueOf(symbols.get(3).toString()))<10)
this.representation[1] = this.representation[1] + "0" + totalResources.get(Resource.valueOf(symbols.get(3).toString())) + "x " + symbols.get(3).returnLine(1) + " ┃";
else
this.representation[1] = this.representation[1] + totalResources.get(Resource.valueOf(symbols.get(3).toString())) + "x " + symbols.get(3).returnLine(1) + " ┃";
this.representation[2] = "┃ " + symbols.get(0).returnLine(2) + " " + symbols.get(1).returnLine(2) + " " + symbols.get(2).returnLine(2) + " " + symbols.get(3).returnLine(2) + " ┃";
}
/**
* Returns one at the time the visualization
*
* @param numLine is the number of line asked
* @return the line asked
*/
public String returnLine(int numLine){
return representation[numLine];
}
}
| [
"mirko.genoni@mail.polimi.it"
] | mirko.genoni@mail.polimi.it |
eb0d09dae15dc1bea6685fff5619c69bf4176040 | d24de9be4c3993d9dc726e9a3c74d9662c470226 | /reverse/Rocketbank_All_3.12.4_source_from_JADX/sources/android/support/v7/widget/PopupMenu.java | b6b185812da2d691c3e7df71b6f4c6eeab6c99ef | [] | no_license | MEJIOMAH17/rocketbank-api | b18808ee4a2fdddd8b3045cd16655b0d82e0b13b | fc4eb0cbb4a8f52277fdb09a3b26b4cceef6ff79 | refs/heads/master | 2022-07-17T20:24:29.721131 | 2019-07-26T18:55:21 | 2019-07-26T18:55:21 | 198,698,231 | 4 | 0 | null | 2022-06-20T22:43:15 | 2019-07-24T19:31:49 | Smali | UTF-8 | Java | false | false | 4,244 | java | package android.support.v7.widget;
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.view.SupportMenuInflater;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuBuilder.Callback;
import android.support.v7.view.menu.MenuPopupHelper;
import android.support.v7.view.menu.ShowableListMenu;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ListView;
import ru.rocketbank.r2d2.C0859R;
public class PopupMenu {
private final View mAnchor;
private final Context mContext;
private OnTouchListener mDragListener;
private final MenuBuilder mMenu;
OnMenuItemClickListener mMenuItemClickListener;
OnDismissListener mOnDismissListener;
final MenuPopupHelper mPopup;
/* renamed from: android.support.v7.widget.PopupMenu$2 */
class C02582 implements android.widget.PopupWindow.OnDismissListener {
C02582() {
}
public void onDismiss() {
if (PopupMenu.this.mOnDismissListener != null) {
PopupMenu.this.mOnDismissListener.onDismiss(PopupMenu.this);
}
}
}
public interface OnDismissListener {
void onDismiss(PopupMenu popupMenu);
}
public interface OnMenuItemClickListener {
boolean onMenuItemClick(MenuItem menuItem);
}
/* renamed from: android.support.v7.widget.PopupMenu$1 */
class C09671 implements Callback {
public void onMenuModeChange(MenuBuilder menuBuilder) {
}
C09671() {
}
public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
return PopupMenu.this.mMenuItemClickListener != null ? PopupMenu.this.mMenuItemClickListener.onMenuItemClick(menuItem) : null;
}
}
public PopupMenu(Context context, View view) {
this(context, view, 0);
}
public PopupMenu(Context context, View view, int i) {
this(context, view, i, C0859R.attr.popupMenuStyle, 0);
}
public PopupMenu(Context context, View view, int i, int i2, int i3) {
this.mContext = context;
this.mAnchor = view;
this.mMenu = new MenuBuilder(context);
this.mMenu.setCallback(new C09671());
this.mPopup = new MenuPopupHelper(context, this.mMenu, view, false, i2, i3);
this.mPopup.setGravity(i);
this.mPopup.setOnDismissListener(new C02582());
}
public void setGravity(int i) {
this.mPopup.setGravity(i);
}
public int getGravity() {
return this.mPopup.getGravity();
}
public OnTouchListener getDragToOpenListener() {
if (this.mDragListener == null) {
this.mDragListener = new ForwardingListener(this.mAnchor) {
protected boolean onForwardingStarted() {
PopupMenu.this.show();
return true;
}
protected boolean onForwardingStopped() {
PopupMenu.this.dismiss();
return true;
}
public ShowableListMenu getPopup() {
return PopupMenu.this.mPopup.getPopup();
}
};
}
return this.mDragListener;
}
public Menu getMenu() {
return this.mMenu;
}
public MenuInflater getMenuInflater() {
return new SupportMenuInflater(this.mContext);
}
public void inflate(int i) {
getMenuInflater().inflate(i, this.mMenu);
}
public void show() {
this.mPopup.show();
}
public void dismiss() {
this.mPopup.dismiss();
}
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
this.mMenuItemClickListener = onMenuItemClickListener;
}
public void setOnDismissListener(OnDismissListener onDismissListener) {
this.mOnDismissListener = onDismissListener;
}
@RestrictTo
ListView getMenuListView() {
if (this.mPopup.isShowing()) {
return this.mPopup.getListView();
}
return null;
}
}
| [
"mekosichkin.ru"
] | mekosichkin.ru |
2d9c35ab57c653d31c99914afbf1bad033867d6c | 36ae4f75d9ca0870883d93442adcd996df66eca8 | /gmall-ums/src/main/java/com/atguigu/gmall/ums/service/impl/MemberReceiveAddressServiceImpl.java | e2d8d9c373aebb6464275bc97ddd996f967de834 | [] | no_license | halolzh/gmall | 1e4db51e6ccbbcbdc5f94ad103ab09514fb8f5f3 | f3df84c83bc1137905e083db6830bef182faf3b3 | refs/heads/master | 2022-07-14T18:27:08.780743 | 2020-04-04T16:19:26 | 2020-04-04T16:19:26 | 252,811,854 | 0 | 0 | null | 2022-06-21T03:08:20 | 2020-04-03T18:39:26 | Java | UTF-8 | Java | false | false | 620 | java | package com.atguigu.gmall.ums.service.impl;
import com.atguigu.gmall.ums.entity.MemberReceiveAddress;
import com.atguigu.gmall.ums.mapper.MemberReceiveAddressMapper;
import com.atguigu.gmall.ums.service.MemberReceiveAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 会员收货地址表 服务实现类
* </p>
*
* @author Lzh
* @since 2020-04-04
*/
@Service
public class MemberReceiveAddressServiceImpl extends ServiceImpl<MemberReceiveAddressMapper, MemberReceiveAddress> implements MemberReceiveAddressService {
}
| [
"koyy821@qq.com"
] | koyy821@qq.com |
1a24e3e700f41f0fcc4244671592076a0b0a6a39 | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/Math/math98/3/AstorMain-math_98/src/default/org/apache/commons/math/random/RandomAdaptor.java | d6cff228d4e7ea7b0715b0018287e3752d35eb70 | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package org.apache.commons.math.random;
public class RandomAdaptor extends java.util.Random implements org.apache.commons.math.random.RandomGenerator {
private static final long serialVersionUID = 2570805822599485047L;
private org.apache.commons.math.random.RandomGenerator randomGenerator = null;
private RandomAdaptor() {
}
public RandomAdaptor(org.apache.commons.math.random.RandomGenerator randomGenerator) {
org.apache.commons.math.random.RandomAdaptor.this.randomGenerator = randomGenerator;
}
public static java.util.Random createAdaptor(org.apache.commons.math.random.RandomGenerator randomGenerator) {
return new org.apache.commons.math.random.RandomAdaptor(randomGenerator);
}
public boolean nextBoolean() {
return randomGenerator.nextBoolean();
}
public void nextBytes(byte[] bytes) {
randomGenerator.nextBytes(bytes);
}
public double nextDouble() {
return randomGenerator.nextDouble();
}
public float nextFloat() {
return randomGenerator.nextFloat();
}
public double nextGaussian() {
return randomGenerator.nextGaussian();
}
public int nextInt() {
return randomGenerator.nextInt();
}
public int nextInt(int n) {
return randomGenerator.nextInt(n);
}
public long nextLong() {
return randomGenerator.nextLong();
}
public void setSeed(long seed) {
if ((randomGenerator) != null) {
randomGenerator.setSeed(seed);
}
}
}
| [
"sajjad.syed@ucalgary.ca"
] | sajjad.syed@ucalgary.ca |
a8076b2e07af3c48051c502abd04ffacc9d7e4af | 3c764558675337b6b861e1a611728721a8030872 | /app/src/test/java/com/piedpiper/ExampleUnitTest.java | e305f2b064d92d625dc2d9f09ee3f1df9ef9f795 | [] | no_license | rajmera3/PiedPiper | e970f86066d0c7131db7e13183430b23951a43cd | 3bf39b9100cb81230be80b022680f7f9458373e2 | refs/heads/master | 2021-01-21T04:25:17.941400 | 2017-10-26T00:36:04 | 2017-10-26T00:36:04 | 101,911,904 | 1 | 0 | null | 2017-10-01T21:02:26 | 2017-08-30T17:49:47 | null | UTF-8 | Java | false | false | 391 | java | package com.piedpiper;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"pbokey@gmail.com"
] | pbokey@gmail.com |
6f15c5fb037c9b4a052202b747dd06e0edc7d5fd | 4fa0bcd97191c9a7087af472d29ca7b2f23aa82c | /src/com/example/paul/client/dto/MyData.java | 0e93d7c9bedb5ae9284b48853de64d705389f2d2 | [] | no_license | PaullR/Licenta | 5665ecac1e008711832887bb771e7f23c439af8c | 052ff99ba2dfeb96efcf58761e77b79dab05d537 | refs/heads/master | 2021-01-20T18:01:37.675604 | 2016-06-09T12:29:07 | 2016-06-09T12:29:07 | 60,639,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | package com.example.paul.client.dto;
public class MyData implements DataPayload {
Integer id;
String value;
String user;
String pass;
String report;
String email;
public MyData() {
}
public MyData(String userName, String pass, String email){
this.user=userName;
this.pass=pass;
this.email=email;
}
protected MyData(Integer id, String userName, String pass, String report) {
this.id = id;
this.user = userName;
this.pass = pass;
this.report = report;
}
public static MyData id(Integer id) {
return new MyData(id, null, null, null);
}
public static MyData name(String name) {
return new MyData(null, name, null, null);
}
public static MyData report(String report) {
return new MyData(null, null, null, report);
}
public MyData(String name, String password) {
this.user = name;
this.pass = password;
}
@Override
public String getUsername() {
return this.user;
}
@Override
public String getPassword() {
// TODO Auto-generated method stub
return this.pass;
}
@Override
public String getReport() {
// TODO Auto-generated method stub
return this.report;
}
@Override
public int getUserId() {
// TODO Auto-generated method stub
return this.getUserId();
}
@Override
public int getReportId() {
// TODO Auto-generated method stub
return this.getReportId();
}
}
| [
"Paul@google.com"
] | Paul@google.com |
f7c8f78977c4924e2749dd14c1c6921444a1d6e3 | 6360aa91cfc4f133324cdd431b365768f8673b4d | /src/main/java/com/example/lxywk/simpletodo/EditItemActivity.java | 06f5ac6634b5977d35895ba638b4623c53a9e511 | [
"Apache-2.0"
] | permissive | itransvideo/simpleTodo | 1ec6cfa9929e1f65eae58b924b7295c59bfe209d | 9b2edd39cb71d731913de082301d10739e86610e | refs/heads/master | 2021-01-15T12:49:48.038384 | 2017-08-08T07:00:53 | 2017-08-08T07:00:53 | 99,659,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,374 | java | package com.example.lxywk.simpletodo;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.EditText;
public class EditItemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_edit_item);
String data = getIntent().getStringExtra("data");
EditText etName = (EditText) findViewById(R.id.inputEdit);
etName.setText(data);
}
public void onAddItem(View V){
onSubmit();
}
public void onSubmit() {
EditText etName = (EditText) findViewById(R.id.inputEdit);
// Prepare data intent
Intent data = new Intent();
// Pass relevant data back as a result
data.putExtra("name", etName.getText().toString());
data.putExtra("code", 200); // ints work too
// Activity finished ok, return the data
setResult(RESULT_OK, data); // set result code and bundle data for response
finish(); // closes the activity, pass data to parent
}
}
| [
"noreply@github.com"
] | itransvideo.noreply@github.com |
fbde763ad4ba3194d2e930d85e6e89075b31d5a5 | ad7bd1f654872a31ec5e5779c6b104fe259d9733 | /programming/syslog4j/src/test/java/org/productivity/java/syslog4j/test/net/TCPNetSyslog4jTest.java | 52144b8c79abf2e4c99314f50a7cedc6f23b45aa | [] | no_license | DF-1317/2018 | 854bb52191820100f36c7efbf235cc554910c445 | 8069df9fa1e5f90b1f3e1c07e2ee102f3273349f | refs/heads/master | 2021-03-27T09:34:32.255562 | 2018-05-19T18:58:58 | 2018-05-19T18:58:58 | 116,717,620 | 2 | 1 | null | 2018-02-17T08:25:49 | 2018-01-08T19:18:11 | Java | UTF-8 | Java | false | false | 785 | java | package org.productivity.java.syslog4j.test.net;
import org.productivity.java.syslog4j.Syslog;
import org.productivity.java.syslog4j.impl.message.processor.SyslogMessageProcessor;
import org.productivity.java.syslog4j.test.net.base.AbstractNetSyslog4jTest;
public class TCPNetSyslog4jTest extends AbstractNetSyslog4jTest {
protected int getMessageCount() {
return 100;
}
protected String getClientProtocol() {
return "tcp";
}
protected String getServerProtocol() {
return "tcp";
}
public void testSendReceive() {
super._testSendReceive(true,true);
}
public void testThreadedSendReceive() {
Syslog.getInstance("tcp").setMessageProcessor(SyslogMessageProcessor.getDefault());
super._testThreadedSendReceive(50,true,true);
}
}
| [
"jletourneau@cas.org"
] | jletourneau@cas.org |
8ffb4dc0c35aec2f24b61009a96a226ff62fb0b8 | 148848dd6d3da2d3789f1c2a94bd1ef0d7e7f503 | /src/main/java/com/clarifai/grpc/api/Input.java | 1c89e04a57dab502ee5727f764c9d43742b1c922 | [] | no_license | bluecasimer/clarifai-java-grpc | 13a1cd504647206b6bd0a63cbe11ffe0cd8c0631 | 691b36a887686e3b1ca215afecd062b79fbabb2b | refs/heads/master | 2020-12-23T19:37:14.722549 | 2019-12-04T13:56:28 | 2019-12-04T14:01:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 55,054 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/clarifai/api/resources.proto
package com.clarifai.grpc.api;
/**
* <pre>
*//////////////////////////////////////////////////////////////////////////////
* Messages from /proto/clarifai/api/input.proto
* //////////////////////////////////////////////////////////////////////////////
* </pre>
*
* Protobuf type {@code clarifai.api.Input}
*/
public final class Input extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:clarifai.api.Input)
InputOrBuilder {
private static final long serialVersionUID = 0L;
// Use Input.newBuilder() to construct.
private Input(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Input() {
id_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new Input();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Input(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
id_ = s;
break;
}
case 18: {
com.clarifai.grpc.api.Data.Builder subBuilder = null;
if (data_ != null) {
subBuilder = data_.toBuilder();
}
data_ = input.readMessage(com.clarifai.grpc.api.Data.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(data_);
data_ = subBuilder.buildPartial();
}
break;
}
case 26: {
com.clarifai.grpc.api.FeedbackInfo.Builder subBuilder = null;
if (feedbackInfo_ != null) {
subBuilder = feedbackInfo_.toBuilder();
}
feedbackInfo_ = input.readMessage(com.clarifai.grpc.api.FeedbackInfo.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(feedbackInfo_);
feedbackInfo_ = subBuilder.buildPartial();
}
break;
}
case 34: {
com.google.protobuf.Timestamp.Builder subBuilder = null;
if (createdAt_ != null) {
subBuilder = createdAt_.toBuilder();
}
createdAt_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(createdAt_);
createdAt_ = subBuilder.buildPartial();
}
break;
}
case 42: {
com.google.protobuf.Timestamp.Builder subBuilder = null;
if (modifiedAt_ != null) {
subBuilder = modifiedAt_.toBuilder();
}
modifiedAt_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(modifiedAt_);
modifiedAt_ = subBuilder.buildPartial();
}
break;
}
case 50: {
com.clarifai.grpc.api.status.Status.Builder subBuilder = null;
if (status_ != null) {
subBuilder = status_.toBuilder();
}
status_ = input.readMessage(com.clarifai.grpc.api.status.Status.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(status_);
status_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.clarifai.grpc.api.Resources.internal_static_clarifai_api_Input_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.clarifai.grpc.api.Resources.internal_static_clarifai_api_Input_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.clarifai.grpc.api.Input.class, com.clarifai.grpc.api.Input.Builder.class);
}
public static final int ID_FIELD_NUMBER = 1;
private volatile java.lang.Object id_;
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
}
}
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int DATA_FIELD_NUMBER = 2;
private com.clarifai.grpc.api.Data data_;
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public boolean hasData() {
return data_ != null;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public com.clarifai.grpc.api.Data getData() {
return data_ == null ? com.clarifai.grpc.api.Data.getDefaultInstance() : data_;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public com.clarifai.grpc.api.DataOrBuilder getDataOrBuilder() {
return getData();
}
public static final int FEEDBACK_INFO_FIELD_NUMBER = 3;
private com.clarifai.grpc.api.FeedbackInfo feedbackInfo_;
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public boolean hasFeedbackInfo() {
return feedbackInfo_ != null;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public com.clarifai.grpc.api.FeedbackInfo getFeedbackInfo() {
return feedbackInfo_ == null ? com.clarifai.grpc.api.FeedbackInfo.getDefaultInstance() : feedbackInfo_;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public com.clarifai.grpc.api.FeedbackInfoOrBuilder getFeedbackInfoOrBuilder() {
return getFeedbackInfo();
}
public static final int CREATED_AT_FIELD_NUMBER = 4;
private com.google.protobuf.Timestamp createdAt_;
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public boolean hasCreatedAt() {
return createdAt_ != null;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public com.google.protobuf.Timestamp getCreatedAt() {
return createdAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder() {
return getCreatedAt();
}
public static final int MODIFIED_AT_FIELD_NUMBER = 5;
private com.google.protobuf.Timestamp modifiedAt_;
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public boolean hasModifiedAt() {
return modifiedAt_ != null;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public com.google.protobuf.Timestamp getModifiedAt() {
return modifiedAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : modifiedAt_;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public com.google.protobuf.TimestampOrBuilder getModifiedAtOrBuilder() {
return getModifiedAt();
}
public static final int STATUS_FIELD_NUMBER = 6;
private com.clarifai.grpc.api.status.Status status_;
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public boolean hasStatus() {
return status_ != null;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public com.clarifai.grpc.api.status.Status getStatus() {
return status_ == null ? com.clarifai.grpc.api.status.Status.getDefaultInstance() : status_;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public com.clarifai.grpc.api.status.StatusOrBuilder getStatusOrBuilder() {
return getStatus();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
}
if (data_ != null) {
output.writeMessage(2, getData());
}
if (feedbackInfo_ != null) {
output.writeMessage(3, getFeedbackInfo());
}
if (createdAt_ != null) {
output.writeMessage(4, getCreatedAt());
}
if (modifiedAt_ != null) {
output.writeMessage(5, getModifiedAt());
}
if (status_ != null) {
output.writeMessage(6, getStatus());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
}
if (data_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getData());
}
if (feedbackInfo_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getFeedbackInfo());
}
if (createdAt_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, getCreatedAt());
}
if (modifiedAt_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(5, getModifiedAt());
}
if (status_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(6, getStatus());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.clarifai.grpc.api.Input)) {
return super.equals(obj);
}
com.clarifai.grpc.api.Input other = (com.clarifai.grpc.api.Input) obj;
if (!getId()
.equals(other.getId())) return false;
if (hasData() != other.hasData()) return false;
if (hasData()) {
if (!getData()
.equals(other.getData())) return false;
}
if (hasFeedbackInfo() != other.hasFeedbackInfo()) return false;
if (hasFeedbackInfo()) {
if (!getFeedbackInfo()
.equals(other.getFeedbackInfo())) return false;
}
if (hasCreatedAt() != other.hasCreatedAt()) return false;
if (hasCreatedAt()) {
if (!getCreatedAt()
.equals(other.getCreatedAt())) return false;
}
if (hasModifiedAt() != other.hasModifiedAt()) return false;
if (hasModifiedAt()) {
if (!getModifiedAt()
.equals(other.getModifiedAt())) return false;
}
if (hasStatus() != other.hasStatus()) return false;
if (hasStatus()) {
if (!getStatus()
.equals(other.getStatus())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + getId().hashCode();
if (hasData()) {
hash = (37 * hash) + DATA_FIELD_NUMBER;
hash = (53 * hash) + getData().hashCode();
}
if (hasFeedbackInfo()) {
hash = (37 * hash) + FEEDBACK_INFO_FIELD_NUMBER;
hash = (53 * hash) + getFeedbackInfo().hashCode();
}
if (hasCreatedAt()) {
hash = (37 * hash) + CREATED_AT_FIELD_NUMBER;
hash = (53 * hash) + getCreatedAt().hashCode();
}
if (hasModifiedAt()) {
hash = (37 * hash) + MODIFIED_AT_FIELD_NUMBER;
hash = (53 * hash) + getModifiedAt().hashCode();
}
if (hasStatus()) {
hash = (37 * hash) + STATUS_FIELD_NUMBER;
hash = (53 * hash) + getStatus().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.clarifai.grpc.api.Input parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.clarifai.grpc.api.Input parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.clarifai.grpc.api.Input parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.clarifai.grpc.api.Input parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.clarifai.grpc.api.Input parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.clarifai.grpc.api.Input parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.clarifai.grpc.api.Input parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.clarifai.grpc.api.Input parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.clarifai.grpc.api.Input parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.clarifai.grpc.api.Input parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.clarifai.grpc.api.Input parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.clarifai.grpc.api.Input parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.clarifai.grpc.api.Input prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
*//////////////////////////////////////////////////////////////////////////////
* Messages from /proto/clarifai/api/input.proto
* //////////////////////////////////////////////////////////////////////////////
* </pre>
*
* Protobuf type {@code clarifai.api.Input}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:clarifai.api.Input)
com.clarifai.grpc.api.InputOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.clarifai.grpc.api.Resources.internal_static_clarifai_api_Input_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.clarifai.grpc.api.Resources.internal_static_clarifai_api_Input_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.clarifai.grpc.api.Input.class, com.clarifai.grpc.api.Input.Builder.class);
}
// Construct using com.clarifai.grpc.api.Input.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
id_ = "";
if (dataBuilder_ == null) {
data_ = null;
} else {
data_ = null;
dataBuilder_ = null;
}
if (feedbackInfoBuilder_ == null) {
feedbackInfo_ = null;
} else {
feedbackInfo_ = null;
feedbackInfoBuilder_ = null;
}
if (createdAtBuilder_ == null) {
createdAt_ = null;
} else {
createdAt_ = null;
createdAtBuilder_ = null;
}
if (modifiedAtBuilder_ == null) {
modifiedAt_ = null;
} else {
modifiedAt_ = null;
modifiedAtBuilder_ = null;
}
if (statusBuilder_ == null) {
status_ = null;
} else {
status_ = null;
statusBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.clarifai.grpc.api.Resources.internal_static_clarifai_api_Input_descriptor;
}
@java.lang.Override
public com.clarifai.grpc.api.Input getDefaultInstanceForType() {
return com.clarifai.grpc.api.Input.getDefaultInstance();
}
@java.lang.Override
public com.clarifai.grpc.api.Input build() {
com.clarifai.grpc.api.Input result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.clarifai.grpc.api.Input buildPartial() {
com.clarifai.grpc.api.Input result = new com.clarifai.grpc.api.Input(this);
result.id_ = id_;
if (dataBuilder_ == null) {
result.data_ = data_;
} else {
result.data_ = dataBuilder_.build();
}
if (feedbackInfoBuilder_ == null) {
result.feedbackInfo_ = feedbackInfo_;
} else {
result.feedbackInfo_ = feedbackInfoBuilder_.build();
}
if (createdAtBuilder_ == null) {
result.createdAt_ = createdAt_;
} else {
result.createdAt_ = createdAtBuilder_.build();
}
if (modifiedAtBuilder_ == null) {
result.modifiedAt_ = modifiedAt_;
} else {
result.modifiedAt_ = modifiedAtBuilder_.build();
}
if (statusBuilder_ == null) {
result.status_ = status_;
} else {
result.status_ = statusBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.clarifai.grpc.api.Input) {
return mergeFrom((com.clarifai.grpc.api.Input)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.clarifai.grpc.api.Input other) {
if (other == com.clarifai.grpc.api.Input.getDefaultInstance()) return this;
if (!other.getId().isEmpty()) {
id_ = other.id_;
onChanged();
}
if (other.hasData()) {
mergeData(other.getData());
}
if (other.hasFeedbackInfo()) {
mergeFeedbackInfo(other.getFeedbackInfo());
}
if (other.hasCreatedAt()) {
mergeCreatedAt(other.getCreatedAt());
}
if (other.hasModifiedAt()) {
mergeModifiedAt(other.getModifiedAt());
}
if (other.hasStatus()) {
mergeStatus(other.getStatus());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.clarifai.grpc.api.Input parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.clarifai.grpc.api.Input) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object id_ = "";
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public Builder setId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
id_ = value;
onChanged();
return this;
}
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public Builder clearId() {
id_ = getDefaultInstance().getId();
onChanged();
return this;
}
/**
* <pre>
* The ID for the input
* </pre>
*
* <code>string id = 1;</code>
*/
public Builder setIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
id_ = value;
onChanged();
return this;
}
private com.clarifai.grpc.api.Data data_;
private com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.Data, com.clarifai.grpc.api.Data.Builder, com.clarifai.grpc.api.DataOrBuilder> dataBuilder_;
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public boolean hasData() {
return dataBuilder_ != null || data_ != null;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public com.clarifai.grpc.api.Data getData() {
if (dataBuilder_ == null) {
return data_ == null ? com.clarifai.grpc.api.Data.getDefaultInstance() : data_;
} else {
return dataBuilder_.getMessage();
}
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public Builder setData(com.clarifai.grpc.api.Data value) {
if (dataBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
data_ = value;
onChanged();
} else {
dataBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public Builder setData(
com.clarifai.grpc.api.Data.Builder builderForValue) {
if (dataBuilder_ == null) {
data_ = builderForValue.build();
onChanged();
} else {
dataBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public Builder mergeData(com.clarifai.grpc.api.Data value) {
if (dataBuilder_ == null) {
if (data_ != null) {
data_ =
com.clarifai.grpc.api.Data.newBuilder(data_).mergeFrom(value).buildPartial();
} else {
data_ = value;
}
onChanged();
} else {
dataBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public Builder clearData() {
if (dataBuilder_ == null) {
data_ = null;
onChanged();
} else {
data_ = null;
dataBuilder_ = null;
}
return this;
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public com.clarifai.grpc.api.Data.Builder getDataBuilder() {
onChanged();
return getDataFieldBuilder().getBuilder();
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
public com.clarifai.grpc.api.DataOrBuilder getDataOrBuilder() {
if (dataBuilder_ != null) {
return dataBuilder_.getMessageOrBuilder();
} else {
return data_ == null ?
com.clarifai.grpc.api.Data.getDefaultInstance() : data_;
}
}
/**
* <pre>
* The data passed along in this input.
* </pre>
*
* <code>.clarifai.api.Data data = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.Data, com.clarifai.grpc.api.Data.Builder, com.clarifai.grpc.api.DataOrBuilder>
getDataFieldBuilder() {
if (dataBuilder_ == null) {
dataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.Data, com.clarifai.grpc.api.Data.Builder, com.clarifai.grpc.api.DataOrBuilder>(
getData(),
getParentForChildren(),
isClean());
data_ = null;
}
return dataBuilder_;
}
private com.clarifai.grpc.api.FeedbackInfo feedbackInfo_;
private com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.FeedbackInfo, com.clarifai.grpc.api.FeedbackInfo.Builder, com.clarifai.grpc.api.FeedbackInfoOrBuilder> feedbackInfoBuilder_;
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public boolean hasFeedbackInfo() {
return feedbackInfoBuilder_ != null || feedbackInfo_ != null;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public com.clarifai.grpc.api.FeedbackInfo getFeedbackInfo() {
if (feedbackInfoBuilder_ == null) {
return feedbackInfo_ == null ? com.clarifai.grpc.api.FeedbackInfo.getDefaultInstance() : feedbackInfo_;
} else {
return feedbackInfoBuilder_.getMessage();
}
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public Builder setFeedbackInfo(com.clarifai.grpc.api.FeedbackInfo value) {
if (feedbackInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
feedbackInfo_ = value;
onChanged();
} else {
feedbackInfoBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public Builder setFeedbackInfo(
com.clarifai.grpc.api.FeedbackInfo.Builder builderForValue) {
if (feedbackInfoBuilder_ == null) {
feedbackInfo_ = builderForValue.build();
onChanged();
} else {
feedbackInfoBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public Builder mergeFeedbackInfo(com.clarifai.grpc.api.FeedbackInfo value) {
if (feedbackInfoBuilder_ == null) {
if (feedbackInfo_ != null) {
feedbackInfo_ =
com.clarifai.grpc.api.FeedbackInfo.newBuilder(feedbackInfo_).mergeFrom(value).buildPartial();
} else {
feedbackInfo_ = value;
}
onChanged();
} else {
feedbackInfoBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public Builder clearFeedbackInfo() {
if (feedbackInfoBuilder_ == null) {
feedbackInfo_ = null;
onChanged();
} else {
feedbackInfo_ = null;
feedbackInfoBuilder_ = null;
}
return this;
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public com.clarifai.grpc.api.FeedbackInfo.Builder getFeedbackInfoBuilder() {
onChanged();
return getFeedbackInfoFieldBuilder().getBuilder();
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
public com.clarifai.grpc.api.FeedbackInfoOrBuilder getFeedbackInfoOrBuilder() {
if (feedbackInfoBuilder_ != null) {
return feedbackInfoBuilder_.getMessageOrBuilder();
} else {
return feedbackInfo_ == null ?
com.clarifai.grpc.api.FeedbackInfo.getDefaultInstance() : feedbackInfo_;
}
}
/**
* <pre>
* Feedback information for when the data sent back is related to a
* feedback event.
* </pre>
*
* <code>.clarifai.api.FeedbackInfo feedback_info = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.FeedbackInfo, com.clarifai.grpc.api.FeedbackInfo.Builder, com.clarifai.grpc.api.FeedbackInfoOrBuilder>
getFeedbackInfoFieldBuilder() {
if (feedbackInfoBuilder_ == null) {
feedbackInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.FeedbackInfo, com.clarifai.grpc.api.FeedbackInfo.Builder, com.clarifai.grpc.api.FeedbackInfoOrBuilder>(
getFeedbackInfo(),
getParentForChildren(),
isClean());
feedbackInfo_ = null;
}
return feedbackInfoBuilder_;
}
private com.google.protobuf.Timestamp createdAt_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> createdAtBuilder_;
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public boolean hasCreatedAt() {
return createdAtBuilder_ != null || createdAt_ != null;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public com.google.protobuf.Timestamp getCreatedAt() {
if (createdAtBuilder_ == null) {
return createdAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_;
} else {
return createdAtBuilder_.getMessage();
}
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public Builder setCreatedAt(com.google.protobuf.Timestamp value) {
if (createdAtBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
createdAt_ = value;
onChanged();
} else {
createdAtBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public Builder setCreatedAt(
com.google.protobuf.Timestamp.Builder builderForValue) {
if (createdAtBuilder_ == null) {
createdAt_ = builderForValue.build();
onChanged();
} else {
createdAtBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public Builder mergeCreatedAt(com.google.protobuf.Timestamp value) {
if (createdAtBuilder_ == null) {
if (createdAt_ != null) {
createdAt_ =
com.google.protobuf.Timestamp.newBuilder(createdAt_).mergeFrom(value).buildPartial();
} else {
createdAt_ = value;
}
onChanged();
} else {
createdAtBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public Builder clearCreatedAt() {
if (createdAtBuilder_ == null) {
createdAt_ = null;
onChanged();
} else {
createdAt_ = null;
createdAtBuilder_ = null;
}
return this;
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public com.google.protobuf.Timestamp.Builder getCreatedAtBuilder() {
onChanged();
return getCreatedAtFieldBuilder().getBuilder();
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
public com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder() {
if (createdAtBuilder_ != null) {
return createdAtBuilder_.getMessageOrBuilder();
} else {
return createdAt_ == null ?
com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_;
}
}
/**
* <pre>
* When the input was created. We follow the XXXX timestamp
* format. We use https://www.ietf.org/rfc/rfc3339.txt format:
* "2006-01-02T15:04:05.999999Z" so you can expect results like
* the following from the API:
* "2017-04-11T21:50:50.223962Z"
* </pre>
*
* <code>.google.protobuf.Timestamp created_at = 4;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>
getCreatedAtFieldBuilder() {
if (createdAtBuilder_ == null) {
createdAtBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
getCreatedAt(),
getParentForChildren(),
isClean());
createdAt_ = null;
}
return createdAtBuilder_;
}
private com.google.protobuf.Timestamp modifiedAt_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> modifiedAtBuilder_;
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public boolean hasModifiedAt() {
return modifiedAtBuilder_ != null || modifiedAt_ != null;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public com.google.protobuf.Timestamp getModifiedAt() {
if (modifiedAtBuilder_ == null) {
return modifiedAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : modifiedAt_;
} else {
return modifiedAtBuilder_.getMessage();
}
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public Builder setModifiedAt(com.google.protobuf.Timestamp value) {
if (modifiedAtBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
modifiedAt_ = value;
onChanged();
} else {
modifiedAtBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public Builder setModifiedAt(
com.google.protobuf.Timestamp.Builder builderForValue) {
if (modifiedAtBuilder_ == null) {
modifiedAt_ = builderForValue.build();
onChanged();
} else {
modifiedAtBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public Builder mergeModifiedAt(com.google.protobuf.Timestamp value) {
if (modifiedAtBuilder_ == null) {
if (modifiedAt_ != null) {
modifiedAt_ =
com.google.protobuf.Timestamp.newBuilder(modifiedAt_).mergeFrom(value).buildPartial();
} else {
modifiedAt_ = value;
}
onChanged();
} else {
modifiedAtBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public Builder clearModifiedAt() {
if (modifiedAtBuilder_ == null) {
modifiedAt_ = null;
onChanged();
} else {
modifiedAt_ = null;
modifiedAtBuilder_ = null;
}
return this;
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public com.google.protobuf.Timestamp.Builder getModifiedAtBuilder() {
onChanged();
return getModifiedAtFieldBuilder().getBuilder();
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
public com.google.protobuf.TimestampOrBuilder getModifiedAtOrBuilder() {
if (modifiedAtBuilder_ != null) {
return modifiedAtBuilder_.getMessageOrBuilder();
} else {
return modifiedAt_ == null ?
com.google.protobuf.Timestamp.getDefaultInstance() : modifiedAt_;
}
}
/**
* <pre>
* When the input was modified.
* </pre>
*
* <code>.google.protobuf.Timestamp modified_at = 5;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>
getModifiedAtFieldBuilder() {
if (modifiedAtBuilder_ == null) {
modifiedAtBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
getModifiedAt(),
getParentForChildren(),
isClean());
modifiedAt_ = null;
}
return modifiedAtBuilder_;
}
private com.clarifai.grpc.api.status.Status status_;
private com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.status.Status, com.clarifai.grpc.api.status.Status.Builder, com.clarifai.grpc.api.status.StatusOrBuilder> statusBuilder_;
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public boolean hasStatus() {
return statusBuilder_ != null || status_ != null;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public com.clarifai.grpc.api.status.Status getStatus() {
if (statusBuilder_ == null) {
return status_ == null ? com.clarifai.grpc.api.status.Status.getDefaultInstance() : status_;
} else {
return statusBuilder_.getMessage();
}
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public Builder setStatus(com.clarifai.grpc.api.status.Status value) {
if (statusBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
status_ = value;
onChanged();
} else {
statusBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public Builder setStatus(
com.clarifai.grpc.api.status.Status.Builder builderForValue) {
if (statusBuilder_ == null) {
status_ = builderForValue.build();
onChanged();
} else {
statusBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public Builder mergeStatus(com.clarifai.grpc.api.status.Status value) {
if (statusBuilder_ == null) {
if (status_ != null) {
status_ =
com.clarifai.grpc.api.status.Status.newBuilder(status_).mergeFrom(value).buildPartial();
} else {
status_ = value;
}
onChanged();
} else {
statusBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public Builder clearStatus() {
if (statusBuilder_ == null) {
status_ = null;
onChanged();
} else {
status_ = null;
statusBuilder_ = null;
}
return this;
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public com.clarifai.grpc.api.status.Status.Builder getStatusBuilder() {
onChanged();
return getStatusFieldBuilder().getBuilder();
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
public com.clarifai.grpc.api.status.StatusOrBuilder getStatusOrBuilder() {
if (statusBuilder_ != null) {
return statusBuilder_.getMessageOrBuilder();
} else {
return status_ == null ?
com.clarifai.grpc.api.status.Status.getDefaultInstance() : status_;
}
}
/**
* <pre>
* This is the status at a per Input level which allows for
* partial failures.
* </pre>
*
* <code>.clarifai.api.status.Status status = 6;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.status.Status, com.clarifai.grpc.api.status.Status.Builder, com.clarifai.grpc.api.status.StatusOrBuilder>
getStatusFieldBuilder() {
if (statusBuilder_ == null) {
statusBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.clarifai.grpc.api.status.Status, com.clarifai.grpc.api.status.Status.Builder, com.clarifai.grpc.api.status.StatusOrBuilder>(
getStatus(),
getParentForChildren(),
isClean());
status_ = null;
}
return statusBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:clarifai.api.Input)
}
// @@protoc_insertion_point(class_scope:clarifai.api.Input)
private static final com.clarifai.grpc.api.Input DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.clarifai.grpc.api.Input();
}
public static com.clarifai.grpc.api.Input getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Input>
PARSER = new com.google.protobuf.AbstractParser<Input>() {
@java.lang.Override
public Input parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Input(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Input> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Input> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.clarifai.grpc.api.Input getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"rok.povsic@gmail.com"
] | rok.povsic@gmail.com |
274d7ecdee9ecce06009cfe3962db8ab718a5d60 | ad531b3c9f5d2aa2a1ddc49a4bcf973aaf93cb1d | /src/com/sample/service/TaskService.java | 6a48578a7fe8093b9b61f03a4208eeea0d9f5371 | [] | no_license | 1649865412/sports | 4354d938a51ab37a2b9858d856fbb6cd04319dd5 | 23e45465582c76f8e061cbd167642c2bae086058 | refs/heads/master | 2021-01-01T16:39:17.046220 | 2015-06-26T06:45:48 | 2015-06-26T06:45:48 | 38,094,922 | 0 | 6 | null | null | null | null | UTF-8 | Java | false | false | 1,845 | java | /**
* code generation
*/
package com.sample.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.base.util.dwz.Page;
import com.base.util.dwz.PageUtils;
import com.sample.entity.Task;
import com.sample.dao.TaskDAO;
@Service
@Transactional
public class TaskService {
@Autowired
private TaskDAO taskDAO;
/*
* (non-Javadoc)
* @see com.sample.service.TaskService#get(java.lang.Long)
*/
public Task get(Long id) {
return taskDAO.findOne(id);
}
/*
* (non-Javadoc)
* @see com.sample.service.TaskService#saveOrUpdate(com.sample.entity.Task)
*/
public void saveOrUpdate(Task task) {
taskDAO.save(task);
}
/*
* (non-Javadoc)
* @see com.sample.service.TaskService#delete(java.lang.Long)
*/
public void delete(Long id) {
taskDAO.delete(id);
}
/*
* (non-Javadoc)
* @see com.sample.service.TaskService#findAll(com.base.util.dwz.Page)
*/
public List<Task> findAll(Page page) {
org.springframework.data.domain.Page<Task> springDataPage = taskDAO.findAll(PageUtils.createPageable(page));
page.setTotalCount(springDataPage.getTotalElements());
return springDataPage.getContent();
}
/*
* (non-Javadoc)
* @see com.sample.service.TaskService#findByExample(org.springframework.data.jpa.domain.Specification, com.base.util.dwz.Page)
*/
public List<Task> findByExample(
Specification<Task> specification, Page page) {
org.springframework.data.domain.Page<Task> springDataPage = taskDAO.findAll(specification, PageUtils.createPageable(page));
page.setTotalCount(springDataPage.getTotalElements());
return springDataPage.getContent();
}
}
| [
"1649865412@qq.com"
] | 1649865412@qq.com |
0ef25166c15f7556c0623e3f9803b2fde04e1810 | 1cc3ffcad9446da22377b1ba9419cbdac87b0735 | /RpgGame/src/com/dh/dao/CDKeyMapper.java | 3388f014f7eb29ef4d1cef9270a86dcd43712cf2 | [] | no_license | zjpjohn/XueJian | b1583380a5aa31695fd3135d12f43269e5c40ded | 54dffbe14fccef790ea48d67a997d3b80452fb99 | refs/heads/master | 2020-12-28T02:02:35.139708 | 2015-03-12T06:10:53 | 2015-03-12T06:10:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package com.dh.dao;
import com.dh.game.vo.base.BaseCdKeyVO;
public interface CDKeyMapper {
public void insertCdKey(BaseCdKeyVO baseCdKeyVO);
public void updateBaseCdKey(BaseCdKeyVO baseCdKeyVO);
public BaseCdKeyVO getBaseCdKey(String keyId);
}
| [
"yuxiaojun-sz@fangdd.com"
] | yuxiaojun-sz@fangdd.com |
29443e7a3d35c9d875b1a7fa1bac8e7cb7c29e4d | 72ece8bbae0f23429af02a396a894cb9fb04ccce | /level06/lesson11/bonus01/Solution.java | b6f671420e4eb393ffd7749c643cee1f8a02e1f4 | [
"MIT"
] | permissive | bskydive/JavaSECorePractice | 9d9f441f6c650b783c25a4ca4e0a579854337d7f | b433d433e0504e5a0de24ccdc21a542e9e16f5a4 | refs/heads/master | 2021-01-10T12:57:19.564918 | 2020-11-27T16:51:05 | 2020-11-27T16:51:05 | 47,457,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.javarush.test.level06.lesson11.bonus01;
/* Нужно исправить программу, чтобы компилировалась и работала
Задача: Программа вводит два числа с клавиатуры и выводит их максимум в виде «Max is 25»
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution
{
public static int max = 100;
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String max = "Max is ";
int maxi;
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
maxi = a > b ? a : b;
System.out.println(max + maxi);
}
}
| [
"stepanovv.ru@yandex.ru"
] | stepanovv.ru@yandex.ru |
5371ddc9ca8eb2d82651165d043e4150d94f7ae9 | cd10ddcbdf662a5e45147f77816a47a7a8154fd5 | /src/main/java/com/catnix/dao/ProspectDaoImpl.java | 0ac118568d5c2440ccdc6177c77b4f9eaf259ddf | [] | no_license | PierreGrincheux/techno_web2 | 7cd8b0ec3b691a9af2c64e9dcb6fe3f397e3b210 | a4ab1403366ef6e4e71dc09d3f4cfd80fa1d100c | refs/heads/master | 2020-12-24T18:51:37.601920 | 2016-06-03T09:13:01 | 2016-06-03T09:13:01 | 58,714,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,457 | java | package com.catnix.dao;
import com.catnix.beans.Comment;
import com.catnix.beans.Prospect;
import static com.catnix.dao.DAOUtilitaire.preparedStatementInit;
import static com.catnix.dao.DAOUtilitaire.silentClosures;
import com.catnix.exceptions.DAOException;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
/**
*
* @author melanie
*/
public class ProspectDaoImpl implements ProspectDao {
private static final String SQL_SELECT = "SELECT * FROM prospect";
private static final String SQL_SELECT_WITH_ID = "SELECT * FROM prospect WHERE id = ?";
private static final String SQL_INSERT = "INSERT INTO prospect (company_name, activity_area, website, phone_number, email, contact_name, state, callback_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
private static final String SQL_UPDATE = "UPDATE prospect SET activity_area = ?, website = ?, phone_number = ?, email = ?, contact_name = ?, state = ?, callback_date = ? WHERE id = ?";
private static final String SQL_DELETE_FROM_ID = "DELETE FROM prospect WHERE id = ?";
private static final String SQL_COUNT_STATE = "SELECT COUNT(*) AS COUNTRESULT FROM prospect where state= ?";
private final DAOFactory daoFactory;
public ProspectDaoImpl() {
this.daoFactory = DAOFactory.getInstance();
}
@Override
public Prospect find(long id) throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
Prospect prospect = null;
try {
connection = daoFactory.getConnection();
preparedStatement = connection.prepareStatement(SQL_SELECT_WITH_ID);
preparedStatement.setLong(1, id);
resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
prospect = map(resultSet);
}
} catch (SQLException e) {
throw new DAOException(e);
} finally {
silentClosures(resultSet, preparedStatement, connection);
}
return prospect;
}
@Override
public void create(Prospect prospect) throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet valeursAutoGenerees = null;
try {
connection = daoFactory.getConnection();
preparedStatement = preparedStatementInit(connection, SQL_INSERT, true,
prospect.getCompany_name(), prospect.getActivity_area(), prospect.getWebsite(), prospect.getPhoneNumber(), prospect.getEmail(), prospect.getContact_name(), prospect.getState(), prospect.getCallback_date());
int statut = preparedStatement.executeUpdate();
if (statut == 0) {
throw new DAOException("Creating prospect failed, no inserted row in datatable.");
}
valeursAutoGenerees = preparedStatement.getGeneratedKeys();
if (valeursAutoGenerees.next()) {
prospect.setId(valeursAutoGenerees.getLong(1));
} else {
throw new DAOException("Creating prospect in database failed, no ID auto-generated returned.");
}
} catch (SQLException e) {
throw new DAOException(e);
} finally {
silentClosures(valeursAutoGenerees, preparedStatement, connection);
}
}
@Override
public void update(Prospect prospect) throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet valeursAutoGenerees = null;
try {
connection = daoFactory.getConnection();
preparedStatement = preparedStatementInit(connection, SQL_UPDATE, true, prospect.getId());
preparedStatement = preparedStatementInit(connection, SQL_UPDATE, true);
preparedStatement.setString(1, prospect.getActivity_area());
preparedStatement.setString(2, prospect.getWebsite());
preparedStatement.setString(3, prospect.getPhoneNumber());
preparedStatement.setString(4, prospect.getEmail());
preparedStatement.setString(5, prospect.getContact_name());
preparedStatement.setString(6, prospect.getState());
if (prospect.getCallback_date() == null) {
preparedStatement.setDate(7, (Date) prospect.getCallback_date());
} else {
java.sql.Date callback = new java.sql.Date(prospect.getCallback_date().getTime());
preparedStatement.setDate(7, callback);
}
preparedStatement.setLong(8, prospect.getId());
int statut = preparedStatement.executeUpdate();
if (statut == 0) {
throw new DAOException("Updating prospect failed, no updated row in datatable.");
}
} catch (SQLException e) {
throw new DAOException(e);
} finally {
silentClosures(valeursAutoGenerees, preparedStatement, connection);
}
}
@Override
public ArrayList<Prospect> list() throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
ArrayList<Prospect> prospects = new ArrayList<>();
try {
connection = daoFactory.getConnection();
preparedStatement = connection.prepareStatement(SQL_SELECT);
resultSet = preparedStatement.executeQuery();
System.out.println("connected to db");
while (resultSet.next()) {
prospects.add(map(resultSet));
}
} catch (SQLException e) {
throw new DAOException(e);
} finally {
silentClosures(resultSet, preparedStatement, connection);
}
return prospects;
}
@Override
public void deleteRelatedComments(long prospectid) throws DAOException {
ArrayList<Comment> allcomments = new ArrayList();
CommentDao commentDao = new CommentDaoImpl();
allcomments = commentDao.list_for_prospect(prospectid);
for (Comment comment : allcomments) {
commentDao.delete(comment.getId());
}
}
@Override
public void delete(long prospectid) throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
deleteRelatedComments(prospectid);
try {
connection = daoFactory.getConnection();
preparedStatement = preparedStatementInit(connection, SQL_DELETE_FROM_ID, true, prospectid);
int statut = preparedStatement.executeUpdate();
if (statut == 0) {
throw new DAOException("Deleting prospect failed, no deleted row in datatable.");
}
}catch (SQLException e) {
throw new DAOException(e);
}finally {
silentClosures(preparedStatement, connection);
}
}
private Prospect trouver(String sql, Object... objets) throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
Prospect prospect = null;
try {
connection = daoFactory.getConnection();
preparedStatement = preparedStatementInit(connection, sql, false, objets);
resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
prospect = map(resultSet);
}
} catch (SQLException e) {
throw new DAOException(e);
} finally {
silentClosures(resultSet, preparedStatement, connection);
}
return prospect;
}
private static Prospect map(ResultSet resultSet) throws SQLException {
Prospect prospect = new Prospect();
prospect.setId(resultSet.getLong("id"));
prospect.setActivity_area(resultSet.getString("activity_area"));
prospect.setWebsite(resultSet.getString("website"));
prospect.setCompany_name(resultSet.getString("company_name"));
prospect.setPhoneNumber(resultSet.getString("phone_number"));
prospect.setEmail(resultSet.getString("email"));
prospect.setContact_name(resultSet.getString("contact_name"));
prospect.setState(resultSet.getString("state"));
prospect.setCallback_date(resultSet.getDate("callback_date"));
return prospect;
}
@Override
public int getNbOfProspectByState(String state) throws DAOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
int nbProspects = 0;
try {
connection = daoFactory.getConnection();
preparedStatement = connection.prepareStatement(SQL_COUNT_STATE);
preparedStatement.setString(1, state);
resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
nbProspects = resultSet.getInt("COUNTRESULT");
}
} catch (SQLException e) {
throw new DAOException(e);
} finally {
silentClosures(resultSet, preparedStatement, connection);
}
return nbProspects;
}
}
| [
"mélanie@asusmélie"
] | mélanie@asusmélie |
31c65f9b9d85804c438d1902353829e5d7c47594 | bb50b4ead389f3b9e7b42d55dddaa0462cfab7c0 | /custom/src/main/java/liuliu/custom/control/spinner/nicespinner/NiceSpinner.java | 30f0428ac6261ed267cdf8d51c893f86a0257037 | [] | no_license | Finderchangchang/DemoFragment | ff0169fc1f7dee4da2f627889a0d6d7089e4c1cf | c8b20ef433377df38f122969ac715dd97e846b90 | refs/heads/master | 2016-08-12T23:20:35.692239 | 2016-05-07T08:24:45 | 2016-05-07T08:24:45 | 55,769,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,887 | java | package liuliu.custom.control.spinner.nicespinner;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
import java.util.List;
import liuliu.custom.R;
/**
* @author angelo.marchesin
*/
@SuppressWarnings("unused")
public class NiceSpinner extends TextView {
private static final int MAX_LEVEL = 10000;
private static final int DEFAULT_ELEVATION = 16;
private static final String INSTANCE_STATE = "instance_state";
private static final String SELECTED_INDEX = "selected_index";
private static final String IS_POPUP_SHOWING = "is_popup_showing";
private int mSelectedIndex;
private Drawable mDrawable;
private PopupWindow mPopup;
private ListView mListView;
private NiceSpinnerBaseAdapter mAdapter;
private AdapterView.OnItemClickListener mOnItemClickListener;
private AdapterView.OnItemSelectedListener mOnItemSelectedListener;
private boolean mHideArrow;
private String SpinnerTitle = "";
@SuppressWarnings("ConstantConditions")
public NiceSpinner(Context context) {
super(context);
init(context, null);
}
public NiceSpinner(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public NiceSpinner(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
@Override
public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
bundle.putInt(SELECTED_INDEX, mSelectedIndex);
if (mPopup != null) {
bundle.putBoolean(IS_POPUP_SHOWING, mPopup.isShowing());
dismissDropDown();
}
return bundle;
}
public void setTextTitle(String title) {
SpinnerTitle = title;
}
@Override
public void onRestoreInstanceState(Parcelable savedState) {
if (savedState instanceof Bundle) {
Bundle bundle = (Bundle) savedState;
mSelectedIndex = bundle.getInt(SELECTED_INDEX);
if (mAdapter != null) {
setText(SpinnerTitle + mAdapter.getItemInDataset(mSelectedIndex).toString());
mAdapter.notifyItemSelected(mSelectedIndex);
}
if (bundle.getBoolean(IS_POPUP_SHOWING)) {
if (mPopup != null) {
// Post the show request into the looper to avoid bad token exception
post(new Runnable() {
@Override
public void run() {
showDropDown();
}
});
}
}
savedState = bundle.getParcelable(INSTANCE_STATE);
}
super.onRestoreInstanceState(savedState);
}
private void init(Context context, AttributeSet attrs) {
Resources resources = getResources();
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NiceSpinner);
int defaultPadding = resources.getDimensionPixelSize(R.dimen.one_and_a_half_grid_unit);
setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
setPadding(resources.getDimensionPixelSize(R.dimen.three_grid_unit),
defaultPadding, defaultPadding, defaultPadding);
setClickable(true);
setBackgroundResource(R.drawable.nice_spinner_selector);
mListView = new ListView(context);
// Set the spinner's id into the listview to make it pretend to be the right parent in
// onItemClick
mListView.setId(getId());
mListView.setDivider(null);
mListView.setItemsCanFocus(true);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position >= mSelectedIndex && position < mAdapter.getCount()) {
position++;
}
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(parent, view, position, id);
}
if (mOnItemSelectedListener != null) {
mOnItemSelectedListener.onItemSelected(parent, view, position, id);
}
mAdapter.notifyItemSelected(position);
mSelectedIndex = position;
setText(SpinnerTitle + mAdapter.getItemInDataset(position).toString());
dismissDropDown();
}
});
mPopup = new PopupWindow(context);
mPopup.setContentView(mListView);
mPopup.setOutsideTouchable(true);
mPopup.setFocusable(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mPopup.setElevation(DEFAULT_ELEVATION);
mPopup.setBackgroundDrawable(
ContextCompat.getDrawable(context, R.drawable.spinner_drawable));
} else {
mPopup.setBackgroundDrawable(ContextCompat.getDrawable(context,
R.drawable.drop_down_shadow));
}
mPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
animateArrow(false);
}
});
mHideArrow = typedArray.getBoolean(R.styleable.NiceSpinner_hideArrow, false);
if (!mHideArrow) {
Drawable basicDrawable = ContextCompat.getDrawable(context, R.drawable.nice_spinner_arrow);
int resId = typedArray.getColor(R.styleable.NiceSpinner_arrowTint, -1);
if (basicDrawable != null) {
mDrawable = DrawableCompat.wrap(basicDrawable);
if (resId != -1) {
DrawableCompat.setTint(mDrawable, resId);
}
}
setCompoundDrawablesWithIntrinsicBounds(null, null, mDrawable, null);
}
typedArray.recycle();
}
public int getSelectedIndex() {
return mSelectedIndex;
}
/**
* Set the default spinner item using its index
*
* @param position the item's position
*/
public void setSelectedIndex(int position) {
if (mAdapter != null) {
if (position >= 0 && position <= mAdapter.getCount()) {
mAdapter.notifyItemSelected(position);
mSelectedIndex = position;
setText(SpinnerTitle + mAdapter.getItemInDataset(position).toString());
} else {
throw new IllegalArgumentException("Position must be lower than adapter count!");
}
}
}
public void addOnItemClickListener(@NonNull AdapterView.OnItemClickListener onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
public void setOnItemSelectedListener(@NonNull AdapterView.OnItemSelectedListener
onItemSelectedListener) {
mOnItemSelectedListener = onItemSelectedListener;
}
public <T> void attachDataSource(@NonNull List<T> dataset) {
mAdapter = new NiceSpinnerAdapter<>(getContext(), dataset);
setAdapterInternal(mAdapter);
}
public void setAdapter(@NonNull ListAdapter adapter) {
mAdapter = new NiceSpinnerAdapterWrapper(getContext(), adapter);
setAdapterInternal(mAdapter);
}
private void setAdapterInternal(@NonNull NiceSpinnerBaseAdapter adapter) {
mListView.setAdapter(adapter);
setText(SpinnerTitle + adapter.getItemInDataset(mSelectedIndex).toString());
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mPopup.setWidth(MeasureSpec.getSize(widthMeasureSpec));
mPopup.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
if (!mPopup.isShowing()) {
showDropDown();
} else {
dismissDropDown();
}
}
return super.onTouchEvent(event);
}
private void animateArrow(boolean shouldRotateUp) {
int start = shouldRotateUp ? 0 : MAX_LEVEL;
int end = shouldRotateUp ? MAX_LEVEL : 0;
ObjectAnimator animator = ObjectAnimator.ofInt(mDrawable, "level", start, end);
animator.setInterpolator(new LinearOutSlowInInterpolator());
animator.start();
}
public void dismissDropDown() {
animateArrow(false);
mPopup.dismiss();
}
public void showDropDown() {
animateArrow(true);
mPopup.showAsDropDown(this);
}
public void setTintColor(@ColorRes int resId) {
if (mDrawable != null && !mHideArrow) {
DrawableCompat.setTint(mDrawable, getResources().getColor(resId));
}
}
}
| [
"1031066280@qq.com"
] | 1031066280@qq.com |
5c89a37de9cae01b4eb51b67bcf22153d947ce69 | 493523b3fff2ad8ef9717699e25bdba586fe8032 | /clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingChecker.java | 07586569bf5864231ac33cf6f2d80442cc1c3222 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | lulzzz/vespa | 42efc681e207086609a93ec792dd17ba42a4ca58 | 80b294229313dad887eb6623330ce94a2153371a | refs/heads/master | 2021-04-06T14:17:22.662778 | 2018-03-14T14:53:17 | 2018-03-14T14:53:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | java | // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.document.FixedBucketSpaces;
import java.util.Iterator;
/**
* Class checking whether a particular bucket space on a content node might have buckets pending.
*
* Aggregated stats over the entire content cluster is used to check this.
*/
public class AggregatedStatsMergePendingChecker implements MergePendingChecker {
private final AggregatedClusterStats stats;
public AggregatedStatsMergePendingChecker(AggregatedClusterStats stats) {
this.stats = stats;
}
@Override
public boolean mayHaveMergesPending(String bucketSpace, int contentNodeIndex) {
if (!stats.hasUpdatesFromAllDistributors()) {
return true;
}
ContentNodeStats nodeStats = stats.getStats().getContentNode(contentNodeIndex);
if (nodeStats != null) {
ContentNodeStats.BucketSpaceStats bucketSpaceStats = nodeStats.getBucketSpace(bucketSpace);
return (bucketSpaceStats != null && bucketSpaceStats.mayHaveBucketsPending());
}
return true;
}
}
| [
"geirst@oath.com"
] | geirst@oath.com |
11cf4430272cac25626833f1055e8c66359971af | 6c9087e6832431e9940d40867488126af6b3413c | /week07/HwWk7/src/hwWk7/MyPanel.java | e91266f9580d4558410a01d246f2416d792098c4 | [] | no_license | jesivasq/GEOG178 | 163f7aeff8b255354fdd533fc63d558d5ac8b778 | d17318bf7cec22202537b1acc1950eff86d872d9 | refs/heads/master | 2021-06-30T09:00:43.229869 | 2019-08-31T21:19:57 | 2019-08-31T21:19:57 | 165,569,613 | 0 | 0 | null | 2020-10-13T12:17:50 | 2019-01-14T00:18:37 | HTML | UTF-8 | Java | false | false | 1,096 | java | package hwWk7;
import javax.swing.*;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.*;
import java.util.ArrayList;
public class MyPanel extends JPanel{
ArrayList<Point> ary;
public MyPanel() {
super(true);
setBorder(BorderFactory.createLineBorder(Color.black));
ary = new ArrayList<Point>();
ary.add(new Point(50, 50));
ary.add(new Point(150, 50));
ary.add(new Point(200, 100));
ary.add(new Point(100, 150));
ary.add(new Point(40, 180));
ary.add(new Point(40, 80)); // comment out this line to see the polygon fail to close
}
// getter
public ArrayList<Point> getAry() {
return ary;
}
// setter
public void setAry(ArrayList<Point> ary) {
this.ary = ary;
}
public Dimension getPreferredSize() {
return new Dimension(250,200);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
//g.drawString("This is a MyPanel", 10, 20);
//g.drawLine(0, 0, 50, 50);
for(int i = 1; i < ary.size(); i++) {
g.drawLine(ary.get(i-1).getX(), ary.get(i-1).getY(), ary.get(i).getX(), ary.get(i).getY());
}
}
}
| [
"jesivasq@users.noreply.github.com"
] | jesivasq@users.noreply.github.com |
409a919f22574240e22fbbf7e622a8b9be400904 | 278a44f854ce69a464bb4f96e51a4782cd17b846 | /java/poi-utils/src/main/java/com/chris/poi/enums/XlsType.java | 3f92007e79cfce964003d5cbf137dda7eadd19a1 | [] | no_license | Yi-Kuan/development-libs | e308a61b43b6fc903b4843ce7fa8af826bf676fa | 47398214fbdb9aeb137b0cca82fa9b18518d3295 | refs/heads/master | 2021-05-26T10:52:54.045814 | 2020-02-19T17:49:43 | 2020-02-19T17:49:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.chris.poi.enums;
/**
* Created by Chris Chen
* 2018/12/10
* Explain: xls文件版本格式
*/
public enum XlsType {
XLS("xls", ".xls"), XLSX("xlsx", ".xlsx");
private String extName;
private String ext;
XlsType(String extName, String ext) {
this.extName = extName;
this.ext = ext;
}
public String getExtName() {
return extName;
}
public void setExtName(String extName) {
this.extName = extName;
}
public String getExt() {
return ext;
}
public void setExt(String ext) {
this.ext = ext;
}
}
| [
"chrischen2018@163.com"
] | chrischen2018@163.com |
38890a894e982e56032c7590577404f8a6f2e6fb | 2ea4e01de32f4e4a3dc7a1d12863fc65a74682f8 | /SmartCommunity/mylibrary/src/main/java/com/library/okgo/request/ProgressRequestBody.java | 6c44cf3e5424b436e1fb9a01e97cd20ccd6f7a8d | [] | no_license | qizfeng/OkGoLibrary | ff462fea334872970e7dcdfeee8ada84cb8b2865 | c7faed7bfe09a2ee08532b5b4eee5566842d4953 | refs/heads/master | 2021-07-25T23:46:06.791416 | 2017-11-08T03:48:34 | 2017-11-08T03:48:34 | 109,577,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,487 | java | package com.library.okgo.request;
import com.library.okgo.OkGo;
import com.library.okgo.utils.OkLogger;
import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okio.Buffer;
import okio.BufferedSink;
import okio.ForwardingSink;
import okio.Okio;
import okio.Sink;
/**
* 包装的请求体,处理进度,可以处理任何的 RequestBody,
* 但是一般用在 multipart requests 上传大文件的时候
*/
public class ProgressRequestBody extends RequestBody {
protected RequestBody delegate; //实际的待包装请求体
protected Listener listener; //进度回调接口
protected CountingSink countingSink; //包装完成的BufferedSink
public ProgressRequestBody(RequestBody delegate) {
this.delegate = delegate;
}
public ProgressRequestBody(RequestBody delegate, Listener listener) {
this.delegate = delegate;
this.listener = listener;
}
public void setListener(Listener listener) {
this.listener = listener;
}
/** 重写调用实际的响应体的contentType */
@Override
public MediaType contentType() {
return delegate.contentType();
}
/** 重写调用实际的响应体的contentLength */
@Override
public long contentLength() {
try {
return delegate.contentLength();
} catch (IOException e) {
OkLogger.e(e);
return -1;
}
}
/** 重写进行写入 */
@Override
public void writeTo(BufferedSink sink) throws IOException {
countingSink = new CountingSink(sink);
BufferedSink bufferedSink = Okio.buffer(countingSink);
delegate.writeTo(bufferedSink);
bufferedSink.flush(); //必须调用flush,否则最后一部分数据可能不会被写入
}
/** 包装 */
protected final class CountingSink extends ForwardingSink {
private long bytesWritten = 0; //当前写入字节数
private long contentLength = 0; //总字节长度,避免多次调用contentLength()方法
private long lastRefreshUiTime; //最后一次刷新的时间
private long lastWriteBytes; //最后一次写入字节数据
public CountingSink(Sink delegate) {
super(delegate);
}
@Override
public void write(Buffer source, long byteCount) throws IOException {
super.write(source, byteCount);
if (contentLength <= 0) contentLength = contentLength(); //获得contentLength的值,后续不再调用
bytesWritten += byteCount;
long curTime = System.currentTimeMillis();
//每100毫秒刷新一次数据
if (curTime - lastRefreshUiTime >= OkGo.REFRESH_TIME || bytesWritten == contentLength) {
//计算下载速度
long diffTime = (curTime - lastRefreshUiTime) / 1000;
if (diffTime == 0) diffTime += 1;
long diffBytes = bytesWritten - lastWriteBytes;
long networkSpeed = diffBytes / diffTime;
if (listener != null) listener.onRequestProgress(bytesWritten, contentLength, networkSpeed);
lastRefreshUiTime = System.currentTimeMillis();
lastWriteBytes = bytesWritten;
}
}
}
/** 回调接口 */
public interface Listener {
void onRequestProgress(long bytesWritten, long contentLength, long networkSpeed);
}
} | [
"android_qzf@437c9961-45d7-4b79-9375-c72c48ef321f"
] | android_qzf@437c9961-45d7-4b79-9375-c72c48ef321f |
ce26aa77daf3b92649f39d9dd6525f885df65a66 | 56fe53e612720292dc30927072e6f76c2eea6567 | /onvifcxf/src/org/onvif/ver10/schema/HostnameInformation.java | e5c24dfd561f1ee92f9c3ec3e2e78e8998d8b979 | [] | no_license | guishijin/onvif4java | f0223e63cda3a7fcd44e49340eaae1d7e5354ad0 | 9b15dba80f193ee4ba952aad377dda89a9952343 | refs/heads/master | 2020-04-08T03:22:51.810275 | 2019-10-23T11:16:46 | 2019-10-23T11:16:46 | 124,234,334 | 1 | 1 | null | null | null | null | GB18030 | Java | false | false | 3,690 | java |
package org.onvif.ver10.schema;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
/**
* <p>HostnameInformation complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="HostnameInformation">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FromDHCP" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* <element name="Name" type="{http://www.w3.org/2001/XMLSchema}token" minOccurs="0"/>
* <element name="Extension" type="{http://www.onvif.org/ver10/schema}HostnameInformationExtension" minOccurs="0"/>
* </sequence>
* <anyAttribute processContents='lax'/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "HostnameInformation", propOrder = {
"fromDHCP",
"name",
"extension"
})
public class HostnameInformation {
@XmlElement(name = "FromDHCP")
protected boolean fromDHCP;
@XmlElement(name = "Name")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "token")
protected String name;
@XmlElement(name = "Extension")
protected HostnameInformationExtension extension;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* 获取fromDHCP属性的值。
*
*/
public boolean isFromDHCP() {
return fromDHCP;
}
/**
* 设置fromDHCP属性的值。
*
*/
public void setFromDHCP(boolean value) {
this.fromDHCP = value;
}
/**
* 获取name属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* 设置name属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* 获取extension属性的值。
*
* @return
* possible object is
* {@link HostnameInformationExtension }
*
*/
public HostnameInformationExtension getExtension() {
return extension;
}
/**
* 设置extension属性的值。
*
* @param value
* allowed object is
* {@link HostnameInformationExtension }
*
*/
public void setExtension(HostnameInformationExtension value) {
this.extension = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
| [
"420188751@qq.com"
] | 420188751@qq.com |
64285489c65701450c6a860000e2982db839970c | 5fde5847ee1614ebbfee9c706bfb3ed01fb44d8d | /Mobile/android/gen/com/hci/smarthypermarket/BuildConfig.java | 06fadb551735a076def25c799187588a07e9ace5 | [] | no_license | heshamhossam/smart-hypermarket | 1014713ef8ff713f67201ecdfbb49cda3b0554e4 | 1c22ff281c5b847d3d7cc3b45dde0f5f64557406 | refs/heads/master | 2021-01-18T14:16:04.822152 | 2014-05-24T19:33:27 | 2014-05-24T19:33:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | /** Automatically generated file. DO NOT MODIFY */
package com.hci.smarthypermarket;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"heshamhossam57@gmail.com"
] | heshamhossam57@gmail.com |
486bbe8bd2ca166a014b7c23fee6fdd0fa4afc16 | 3df715c046ce3d96680b3df88ca26a048fb3c71d | /src/문제집/프로그래머스/해시/위장/MainV2.java | 1d55a0dee75c56d3ed79d6f9a3a65ea24d3c3e44 | [] | no_license | camel-man-ims/algorithm-collection | 79163d0f0681b4e682ed14b3ac3cc499e832204d | 225473c41f206337de9c97a33ea92414f2793c37 | refs/heads/main | 2022-12-27T04:52:59.505738 | 2022-11-16T15:23:14 | 2022-11-16T15:23:14 | 303,552,853 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package 문제집.프로그래머스.해시.위장;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* date: 22.03.02
*/
public class MainV2 {
public static void main(String[] args) {
}
static class Solution {
public int solution(String[][] clothes) {
Map<String, Integer> map = new HashMap<>();
for(String [] c : clothes){
map.put(c[1],map.getOrDefault(c[1],0)+1);
}
int cnt = 1;
Set<String> keys = map.keySet();
for(String s : keys){
cnt *= map.get(s)+1;
}
return cnt-1;
}
}
}
| [
"gudwnsrh@gmail.com"
] | gudwnsrh@gmail.com |
85f64410cb88dc3e7a883a1383c0c6485b18558e | 16dfb44bba6e597fbe31501befa0fc1f490e65c5 | /App/iTalker/app/src/main/java/net/zhouxu/italker/italker/push/frags/search/SearchGroupFragment.java | 18d8c8be238b1419874e3fd06700510075b09fff | [
"Apache-2.0"
] | permissive | Virtual-Rain/IMOOCMessager | 67cc3cf82389cbc4819f4811edf972287feaf440 | 9bd9060b9a14e19cf0c6c548c1032879b688ec0a | refs/heads/master | 2020-03-11T23:38:00.469328 | 2019-05-12T07:34:21 | 2019-05-12T07:34:21 | 130,327,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package net.zhouxu.italker.italker.push.frags.search;
import net.zhouxu.italker.common.app.Fragment;
import net.zhouxu.italker.common.app.PresenterFragment;
import net.zhouxu.italker.factory.model.card.GroupCard;
import net.zhouxu.italker.factory.presenter.search.SearchContract;
import net.zhouxu.italker.factory.presenter.search.SearchGroupPresenter;
import net.zhouxu.italker.italker.push.R;
import net.zhouxu.italker.italker.push.activities.SearchActivity;
import java.util.List;
/**
* 搜索群的界面实现
* A simple {@link Fragment} subclass.
*/
public class SearchGroupFragment extends PresenterFragment<SearchContract.Presenter>
implements SearchActivity.SearchFragment ,SearchContract.GroupView{
public SearchGroupFragment() {
// Required empty public constructor
}
@Override
protected int getContentLayoutId() {
return R.layout.fragment_search_group;
}
@Override
public void search(String content) {
//Activity-》Fragment-》Presenter-》Net
mPresenter.search(content);
}
@Override
public void onSearchDonw(List<GroupCard> groupCards) {
//数据成功的情况下返回数据
}
@Override
protected SearchContract.Presenter initPresenter() {
return new SearchGroupPresenter(this);
}
}
| [
"zx_developer@163.com"
] | zx_developer@163.com |
31a647679f0b971e505a277af63d3162fa5604bd | 19c22f63bc725a2c8b5828bb73a4c0205d8b33e2 | /Android/app/src/main/java/com/studentmajorleague/CompetitionsActivity.java | ec54d29d73f2ca34a8ae66785cc98e1a6fd7bc82 | [] | no_license | PasyugaDenis/StudentMajorLeague | 995e8df35f788dc49c62dd52e41245a31abe9281 | 0a42651d1d7dcb603a36d906bec37a97883e6965 | refs/heads/master | 2021-10-09T00:41:34.033580 | 2019-06-24T19:20:11 | 2019-06-24T19:20:11 | 178,244,456 | 0 | 0 | null | 2021-10-05T23:31:15 | 2019-03-28T16:40:59 | C# | UTF-8 | Java | false | false | 2,137 | java | package com.studentmajorleague;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class CompetitionsActivity extends AppCompatActivity {
String[] competitions = { "ITSprint, Swimming", "CMAS SUPER SPRINT CUP, Swimming", "1st CUP, MMA" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_competitions);
ListView view = (ListView) findViewById(R.id.view_competitions);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, competitions);
view.setAdapter(adapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.main, menu);
menu.findItem(R.id.nav_users).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(CompetitionsActivity.this, UsersActivity.class);
startActivity(intent);
return true;
}
});
menu.findItem(R.id.nav_leagues).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(CompetitionsActivity.this, LeaguesActivity.class);
startActivity(intent);
return true;
}
});
menu.findItem(R.id.nav_exit).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(CompetitionsActivity.this, MainActivity.class);
startActivity(intent);
return true;
}
});
return true;
}
}
| [
"denys.payuga.99@gmail.com"
] | denys.payuga.99@gmail.com |
c2e935b60f2c44d7114f00ec247e822d5c53b6ed | 37620822cb3ff37c5ee60269ea76a80f96251e07 | /src/com/xpple/tongzhou/adapt/AdapterWheel.java | 20c345742dd39c08f93d2d259869d22db985d09f | [] | no_license | 18322134412/TongZhou | 83e71858711fc2d1fff831fb935c1bb60f8a10a7 | eab27234a8426f20f2ddef32edb1a9dbfa8f02b4 | refs/heads/master | 2020-04-11T03:02:06.961722 | 2016-09-14T01:57:16 | 2016-09-14T01:57:16 | 68,163,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,534 | java | /*
* Copyright 2011 Yuri Kanivets
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xpple.tongzhou.adapt;
import android.content.Context;
/**
* Adapter class for old wheel adapter (deprecated WheelAdapter class).
*
* @deprecated Will be removed soon
*/
public class AdapterWheel extends AbstractWheelTextAdapter {
// Source adapter
private WheelAdapter adapter;
/**
* Constructor
* @param context the current context
* @param adapter the source adapter
*/
public AdapterWheel(Context context, WheelAdapter adapter) {
super(context);
this.adapter = adapter;
}
/**
* Gets original adapter
* @return the original adapter
*/
public WheelAdapter getAdapter() {
return adapter;
}
@Override
public int getItemsCount() {
return adapter.getItemsCount();
}
@Override
protected CharSequence getItemText(int index) {
return adapter.getItem(index);
}
}
| [
"2317333179@qq.com"
] | 2317333179@qq.com |
14c1dc53392ea41efcb5f0b4d10c0e51ba693063 | b28d60148840faf555babda5ed44ed0f1b164b2c | /java/misshare_cloud-multi-tenant/traffic-manage/src/main/java/com/qhieco/trafficmanage/entity/response/LockPayResponse.java | 3e1625f66c2fba449b3bd4eba62f944b4dc2d328 | [] | no_license | soon14/Easy_Spring_Backend | e2ec16afb1986ea19df70821d96edcb922d7978e | 49bceae4b0c3294945dc4ad7ff53cae586127e50 | refs/heads/master | 2020-07-26T16:12:01.337615 | 2019-04-09T08:15:37 | 2019-04-09T08:15:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package com.qhieco.trafficmanage.entity.response;
import lombok.Data;
/**
* @author 郑旭 790573267@qq.com
* @version 2.0.1 创建时间: 18-6-13 下午1:45
* <p>
* 类说明:
* ${description}
*/
@Data
public class LockPayResponse extends BaseResponse {
//服务商系统记录流水号
private String CSPTLS;
//处理结果
private String CLJG;
//处理结果描述
private String CLJGMS;
}
| [
"k2160789@163.com"
] | k2160789@163.com |
589e11c6c90373c00626a15c08e37d3a04929bac | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/appcontainers/azure-resourcemanager-appcontainers/src/samples/java/com/azure/resourcemanager/appcontainers/generated/ConnectedEnvironmentsListByResourceGroupSamples.java | 24e8daf8315be1493f05b3b135b66fa5049c95a6 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 910 | 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.appcontainers.generated;
/** Samples for ConnectedEnvironments ListByResourceGroup. */
public final class ConnectedEnvironmentsListByResourceGroupSamples {
/*
* x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_ListByResourceGroup.json
*/
/**
* Sample code: List environments by resource group.
*
* @param manager Entry point to ContainerAppsApiManager.
*/
public static void listEnvironmentsByResourceGroup(
com.azure.resourcemanager.appcontainers.ContainerAppsApiManager manager) {
manager.connectedEnvironments().listByResourceGroup("examplerg", com.azure.core.util.Context.NONE);
}
}
| [
"noreply@github.com"
] | Azure.noreply@github.com |
845f99fa31d66965e30084d4ec15de6b8903d5d0 | 689fdcee3f92eeb212e9df4e9c62987077ca40e2 | /src/com/ods/util/type/FileUtil.java | c89ba332a7337cbf1551d9ca1d4962fbd07d117c | [
"Apache-2.0"
] | permissive | ljsvn/noveltysearch | 47d6523039830db2f9dbdd265ba05e628fb0b86e | 4dc6a5dad0f4b0f1034810d9bf5b5eb5a5d4ef9d | refs/heads/master | 2021-05-02T03:01:02.324937 | 2019-11-04T06:12:21 | 2019-11-04T06:12:21 | 120,891,116 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,373 | java | /**
* 包名:com.ods.util.type
* 类名:FileUtil
* Ods信息技术软件有限公司研发中心
*/
package com.ods.util.type;
import java.io.File;
import java.io.FileFilter;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
* 功能:对java中的File进行2次封装 创建者: 10325431@qq.com 修改者 修改时间
*
*/
public class FileUtil {
public static String treeDate(char format) {
StringBuffer sb = new StringBuffer();
int year = Integer.valueOf(TimeUtil.toString(Calendar.getInstance(), "yyyy"));
int cuyear = 2011;
int addYear = 10;
if(year >= 2021) {
addYear = (year - cuyear) + 1;
}
switch (format) {
case 'Y':
for(int i = cuyear; i < cuyear + addYear; i++) {
if(i > cuyear) {
sb.append(",");
}
sb.append("{text: '" + i + "', checked: false, leaf: true}");
}
break;
case 'Q':
for(int i = cuyear; i < cuyear + addYear; i++) {
if(i > cuyear) {
sb.append(",");
}
sb.append("{text: '" + i + "', leaf: false, children: [");
for(int q = 1; q <= 4; q++) {
if(q > 1) {
sb.append(",");
}
sb.append("{text: '第" + q + "季度',year: '" + i + "',quarter: '" + q + "', checked: false, leaf: true}");
}
sb.append("]}");
}
break;
case 'M':
for(int i = cuyear; i < cuyear + addYear; i++) {
if(i > year) {
sb.append(",");
}
sb.append("{text: '" + i + "', leaf: false, children: [");
for(int m = 1; m <= 12; m++) {
if(m > 1) {
sb.append(",");
}
sb.append("{text: '" + m + "月',year: '" + i + "',month: '" + m + "', checked: false, leaf: true}");
}
sb.append("]}");
}
break;
}
return sb.toString();
}
/**
* 根据路径创建指定的文件夹
*
* @param path 文件夹路径
*/
public static void touchPath(String path) {
try {
File filePath = new File(path);
if(!filePath.exists()) {
filePath.mkdirs();
}
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 文件备份操作,备份后的路径是:path+/当前时间(yyyy-dd-MM-HH-mm-ss)
*
* @param path 要备份的路径
* @return 已经备份的路径
*/
public static String backup(String path) {
final String dstPath = path + "." + TimeUtil.toString(System.currentTimeMillis(), "yyyy-dd-MM-HH-mm-ss");
backup(path, dstPath);
return dstPath;
}
/**
* 文件备份操作
*
* @param srcPath 文件元路径
* @param dstPath 备份目标路径
*/
public static void backup(final String srcPath, final String dstPath) {
try {
File srcFile = new File(srcPath);
File dstFile = new File(dstPath);
org.apache.avalon.excalibur.io.FileUtil.copyFile(srcFile, dstFile);
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 文件拷贝
*
* @param srcFile 要拷贝的文件
* @param dstPath 拷贝的路径
* @return =true 拷贝成功 =false 拷贝失败
*/
public static boolean copy(File srcFile, final String dstPath,String uploadFileName) {
try {
File dstFile = new File(dstPath);
if(!dstFile.exists()){
FileUtil.touchPath(dstPath);
}
org.apache.avalon.excalibur.io.FileUtil.copyFile(srcFile, new File(dstPath+uploadFileName));
return true;
} catch(Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 文件拷贝
*
* @param srcFile 要拷贝的文件
* @param dstPath 拷贝的路径
* @return =true 拷贝成功 =false 拷贝失败
*/
public static boolean copy(File srcFile, final String dstPath) {
try {
File dstFile = new File(dstPath);
org.apache.avalon.excalibur.io.FileUtil.copyFile(srcFile, dstFile);
return true;
} catch(Exception e) {
e.printStackTrace();
return false;
}
}
// public static boolean copy(File srcFile, final String dstPath) {
// try {
// File dstFile = new File(dstPath);
// if(!dstFile.exists()){
// FileUtil.touchPath(dstPath);
// }
// org.apache.avalon.excalibur.io.FileUtil.copyFile(srcFile, new File(dstPath));
// return true;
// } catch(Exception e) {
// e.printStackTrace();
// return false;
// }
// }
/**
* 输入流拷贝文件
*
* @param src 文件输入流
* @param dstPath 文件输出路径
* @return =true 拷贝成功 =false 拷贝失败
*/
public static boolean copy(InputStream src, final String dstPath) {
try {
File dstFile = new File(dstPath);
byte[] buffer = new byte[64 * 1024];
int length = 0;
OutputStream os = new FileOutputStream(dstFile);
try {
while ((length = src.read(buffer, 0, buffer.length)) != -1) {
os.write(buffer, 0, length);
}
} finally {
close(os);
}
return true;
} catch(Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 文件添加后缀
*
* @param path 文件(带路径)
* @param suffix 后缀名称
*/
public static void rename(String path, String suffix) {
try {
File file = new File(path);
File dstFile = new File(path + "." + suffix);
file.renameTo(dstFile);
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 指定路径下的文件列表
*
* @param fileInfo 文件信息对象
* @param path 文件所在路径
* @return 指定路径下的文件列表
*/
public static String[] toFileList(FileInfo fileInfo, String path) {
String[] listfilenames;
File file = new File(path);
listfilenames = file.list();
if(null == listfilenames) {
fileInfo.setTotalCount(0);
return new String[] {};
}
fileInfo.setTotalCount(listfilenames.length);
return listfilenames;
}
/**
*
* 获取指定文件夹下的所有文件,包括子文件夹的文件名称.<br>
* 工程名:odscati<br>
* 包名:com.ods.util.type<br>
* 方法名:toFileList方法.<br>
*
* @author:10325431@qq.com
* @since :1.0:2009-6-26
* @param strPath :指定文件夹路径
* @param filelist :获取的文件集合
*/
public static void toFileNameList(String strPath, List<String> filelist) {
File dir = new File(strPath);
File[] files = dir.listFiles();
if(files == null) {
return;
}
for(int i = 0; i < files.length; i++) {
if(files[i].isDirectory()) {
toFileNameList(files[i].getAbsolutePath(), filelist);
} else {
// filelist.add(files[i].getAbsolutePath());
filelist.add(files[i].getName());
}
}
}
/**
*
* 获取指定文件夹下的所有文件,包括子文件夹的文件名称,含路径.<br>
* 工程名:odscati<br>
* 包名:com.ods.util.type<br>
* 方法名:toFileList方法.<br>
*
* @author:10325431@qq.com
* @since :1.0:2009-6-26
* @param strPath :指定文件夹路径
* @param filelist :获取的文件集合
*/
public static List<String> toFileNamePathList(String strPath) {
List<String> filelist=new ArrayList<String>();
File dir = new File(strPath);
File[] files = dir.listFiles();
if(files == null) {
return filelist;
}
for(int i = 0; i < files.length; i++) {
if(files[i].isDirectory()) {
toFileNameList(files[i].getAbsolutePath(), filelist);
} else {
filelist.add(files[i].getAbsolutePath());
}
}
return filelist;
}/**
*
* 获取指定文件夹下的所有文件,包括子文件夹的文件名称,含路径.<br>
* 工程名:odscati<br>
* 包名:com.ods.util.type<br>
* 方法名:toFileList方法.<br>
*
* @author:10325431@qq.com
* @since :1.0:2009-6-26
* @param strPath :指定文件夹路径
* @param filelist :获取的文件集合
*/
public static List<String> toFileNamePathList(String strPath,List<String> filelist,String includeFileSuffix) {
File dir = new File(strPath);
File[] files = dir.listFiles();
if(files == null) {
return filelist;
}
for(int i = 0; i < files.length; i++) {
if(files[i].isDirectory()) {
toFileNamePathList(files[i].getAbsolutePath(), filelist,includeFileSuffix);
} else {
if(files[i].getName().endsWith(includeFileSuffix)){
filelist.add(files[i].getAbsolutePath());
}
}
}
return filelist;
}
/**
* 关闭输入流
*
* @param stream 输入流
*/
public static void close(InputStream stream) {
try {
stream.close();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 关闭输出流
*
* @param stream 输出流
*/
public static void close(OutputStream stream) {
try {
stream.flush();
stream.close();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 关闭读入文件流
*
* @param reader 读入文件流
*/
public static void close(Reader reader) {
try {
reader.close();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 关闭寫入文件流
*
* @param writer 寫入文件流
*/
public static void close(Writer writer) {
try {
writer.flush();
writer.close();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* 删除指定路径下的文件
*
* @param dirPath 指定路径
* @throws java.lang.Exception 删除失败错误
*/
public static void deleteAllSubFiles1(String dirPath) throws Exception {
try {
File dir = new File(dirPath);
if(dir.isDirectory()) {
File[] subFiles = dir.listFiles();
for(int i = 0; i < subFiles.length; i++) {
File subFile = subFiles[i];
try {
subFile.delete();
} catch(Exception e) {
throw e;
}
}
}
} catch(Exception e) {
throw e;
}
}
public static void main(String[] args){
deleteDirectory("D:\\aa",false);
}
/**
*
*获取指定文件的后缀名称.<br>
*工程名:odsonlineread<br>
*包名:com.ods.util.type<br>
*方法名:fileSuffix方法.<br>
*
*@author:10325431@qq.com
*@since :1.0:2012-2-11
*@param fileName :带路径的文件名
*@return
*/
public static String fileSuffix(String fileName){
return fileName.substring(fileName.lastIndexOf(".")+1);
}
/**
* 文件是否存在错误
*
* @param filePathname 指定的文件
* @return =true 文件存在 false 文件不存在
*/
public static boolean isFileExisted(String filePathname) {
boolean existed;
try {
File f = new File(filePathname);
existed = f.isFile();
} catch(Exception e) {
existed = false;
}
return existed;
}
/**
* 去掉文件的路径,只留下文件名
*
* @param pathname 带路径的文件名
* @return 文件名称
*/
public static String removePath(String pathname) {
String fname = pathname;
int index = pathname.lastIndexOf(File.separator);
if(index >= 0) {
fname = pathname.substring(index + 1);
}
return fname;
}
/**
* 去掉文件名而只保留文件路径
*
* @param pathname 带路径的文件名
* @return 文件路径
*/
public static String removeFileName(String pathname) {
String fname = pathname;
int index = pathname.lastIndexOf(File.separator);
if(index >= 0) {
fname = pathname.substring(0, index);
}
return fname;
}
/**
* 根据路径删除指定的目录或文件,无论存在与否<br>
* 工程名:odspsp<br>
* 包名:com.ods.psp.action.knowledgebase.knowledgetype<br>
* 方法名:DeleteFolder方法.<br>
*
* @author:jiangwenqi
* @since :1.0:2009-11-5
* @param sPath 要删除的目录或文件
* @return 删除成功返回 true,否则返回 false。
*/
public static boolean DeleteFolder(String sPath) {
boolean flag = false;
File file = new File(sPath);
// 判断目录或文件是否存在
if(!file.exists()) { // 不存在返回 false
return flag;
} else {
// 判断是否为文件
if(file.isFile()) { // 为文件时调用删除文件方法
return deleteFile(sPath);
} else { // 为目录时调用删除目录方法
return deleteDirectory(sPath, true);
}
}
}
/**
* 删除单个文件.<br>
* 工程名:odspsp<br>
* 包名:com.ods.psp.action.knowledgebase.knowledgetype<br>
* 方法名:deleteFile方法.<br>
*
* @author:jiangwenqi
* @since :1.0:2009-11-5
* @param sPath 被删除文件的文件名
* @return 单个文件删除成功返回true,否则返回false
*/
public static boolean deleteFile(String sPath) {
boolean flag = false;
File file = new File(sPath);
// 路径为文件且不为空则进行删除
if(file.isFile() && file.exists()) {
file.delete();
flag = true;
}
return flag;
}
/**
* 删除目录(文件夹)以及目录下的文件 工程名:odspsp<br>
* 包名:com.ods.psp.action.knowledgebase.knowledgetype<br>
* 方法名:deleteDirectory方法.<br>
*
* @author:jiangwenqi
* @since :1.0:2009-11-5
* @param sPath 被删除目录的文件路径
* @return 目录删除成功返回true,否则返回false
*/
public static boolean deleteDirectory(String sPath, boolean selfFlag) {
// 如果sPath不以文件分隔符结尾,自动添加文件分隔符
if(!sPath.endsWith(File.separator)) {
sPath = sPath + File.separator;
}
File dirFile = new File(sPath);
// 如果dir对应的文件不存在,或者不是一个目录,则退出
if(!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
// 删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles();
for(int i = 0; i < files.length; i++) {
// 删除子文件
if(files[i].isFile()) {
flag = deleteFile(files[i].getAbsolutePath());
if(!flag)
break;
} // 删除子目录
else {
flag = deleteDirectory(files[i].getAbsolutePath(), true);
if(!flag)
break;
}
}
if(!flag)
return false;
if(selfFlag) {// 删除当前目录
if(dirFile.delete()) {
return true;
} else {
return false;
}
} else {
return true;
}
}
public static void writeUTFFile(String fileName, String fileBody) throws Throwable {
FileOutputStream fos = null;
OutputStreamWriter osw = null;
try {
File fileNameBefore = new File(fileName);
if(fileNameBefore.exists()) {
fileNameBefore.delete();
}
fos = new FileOutputStream(fileName);
osw = new OutputStreamWriter(fos, "UTF-8");
osw.write(fileBody);
} finally {
close(osw);
close(fos);
}
}
class ExtensionFileFilter implements FileFilter {
private String extension;
public ExtensionFileFilter(String extension) {
this.extension = extension;
}
public boolean accept(File file) {
if(file.isDirectory()) {
return false;
}
String name = file.getName();// find the last
int index = name.lastIndexOf(".");
if(index == -1) {
return false;
} else if(index == name.length() - 1) {
return false;
} else {
return this.extension.equals(name.substring(index + 1));
}
}
}
}
| [
"as@DESKTOP-jl"
] | as@DESKTOP-jl |
7d6487550f34d32133564652aaeee057a309e93f | ba67ab373dae53bc2248d0ad5b2d555796fd76e4 | /src/main/java/com/algaworks/algafood/domain/service/EmissaoPedidoService.java | 3105657c027a9569e2e230cd04d4f7989c204210 | [] | no_license | Duim86/algafood | 92dc8964501b18dc0ed06738708d531bcf71750f | 2df5c14f9f7772862f5d457c6922c2f83fc2fb04 | refs/heads/main | 2023-07-31T03:48:25.798383 | 2021-07-16T08:34:48 | 2021-07-16T08:34:48 | 385,859,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,557 | java | package com.algaworks.algafood.domain.service;
import com.algaworks.algafood.domain.exception.NegocioException;
import com.algaworks.algafood.domain.exception.PedidoNaoEncontradoException;
import com.algaworks.algafood.domain.model.*;
import com.algaworks.algafood.domain.repository.PedidoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class EmissaoPedidoService {
@Autowired
private PedidoRepository pedidoRepository;
@Autowired
private CadastroUsuarioService cadastroUsuario;
@Autowired
private CadastroProdutoService cadastroProduto;
@Autowired
private CadastroCidadeService cadastroCidade;
@Autowired
private CadastroRestauranteService cadastroRestaurante;
@Autowired
private CadastroFormaDePagamentoService formaDePagamentoService;
@Transactional
public Pedido salvar(Pedido pedido) {
validarItens(pedido);
validarPedido(pedido);
pedido.setTaxaFrete(pedido.getRestaurante().getTaxaFrete());
pedido.calcularValorTotal();
return pedidoRepository.save(pedido);
}
private void validarItens(Pedido pedido) {
pedido.getItens().forEach(item -> {
var produto = cadastroProduto.buscarOuFalhar(
pedido.getRestaurante().getId(), item.getProduto().getId());
item.setPedido(pedido);
item.setProduto(produto);
item.setPrecoUnitario(produto.getPreco());
});
}
public void validarPedido(Pedido pedido) {
var usuario = cadastroUsuario.buscarOuFalhar(1L);
var restaurante = cadastroRestaurante.buscarOuFalhar(pedido.getRestaurante().getId());
var cidade = cadastroCidade.buscarOuFalhar(pedido.getEnderecoEntrega().getCidade().getId());
var formaDePagamento = formaDePagamentoService.buscarOuFalhar(pedido.getFormaDePagamento().getId());
pedido.setCliente(usuario);
pedido.getEnderecoEntrega().setCidade(cidade);
pedido.setFormaDePagamento(formaDePagamento);
pedido.setRestaurante(restaurante);
if(restaurante.naoAceitaFormaDePagamento(formaDePagamento)){
throw new NegocioException("Restaurante nao aceita " + formaDePagamento.getDescricao() + " como forma de pagamento!");
}
}
public Pedido buscarOuFalhar(String codigoPedido) {
return pedidoRepository.findByCodigo(codigoPedido)
.orElseThrow(() -> new PedidoNaoEncontradoException(codigoPedido));
}
} | [
"android.duim@gmail.com"
] | android.duim@gmail.com |
89dac5eb4b1ca605b615f1f2e9f49e615e39f4d8 | 74f7993e52c2301f8e9e7b0c3b740f0ec9e0c173 | /app/src/main/java/net/robinx/adapter/example/RecyclerActivity.java | b2de8d2f8e9fa04a9f31007a3174a18fa770434a | [] | no_license | xuandoutang/Adapter | 5e35075ada18566f345995079d89ad7ee0b0ee34 | a3d6c4b297bfc62579158e949816f33174f02779 | refs/heads/master | 2021-01-17T07:55:52.555346 | 2016-07-15T02:17:31 | 2016-07-15T02:17:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,216 | java | package net.robinx.adapter.example;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Toast;
import net.robinx.adapter.example.bean.TestBean;
import net.robinx.adapter.example.holder.RCVHolder;
import net.robinx.adapter.example.holder.RCVHolder2;
import net.robinx.lib.adapter.recycler.RecyclerListDataAdapter;
import net.robinx.lib.adapter.recycler.RecyclerViewAdapterBase;
import net.robinx.lib.adapter.recycler.RecyclerViewTypeManager;
import net.robinx.lib.adapter.recycler.anim.AnimatorAdapter;
import net.robinx.lib.adapter.recycler.anim.extra.ScaleInAnimatorAdapter;
import net.robinx.lib.adapter.recycler.anim.extra.SlideInBottomAnimatorAdapter;
public class RecyclerActivity extends AppCompatActivity {
private RecyclerListDataAdapter<TestBean> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler);
init();
}
private void init() {
initRecyclerView();
initView();
initMultiTypeRecycleView();
}
private void initView() {
findViewById(R.id.btn_add).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (adapter.getItemDataList().size()<3) {
return;
}
int name = adapter.getItemDataList().size()+1;
TestBean itemData = new TestBean(name+"", TestBean.VIEW_TYPE_1);
adapter.append(itemData, true, 2);
}
});
findViewById(R.id.btn_delete).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (adapter.getItemDataList().size()<3) {
return;
}
adapter.remove(2, true);
}
});
}
private void initRecyclerView() {
RecyclerView recyclerView=(RecyclerView) findViewById(R.id.rcv);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(OrientationHelper.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
adapter=new RecyclerListDataAdapter<TestBean>();
//单个View
//adapter.setViewHolderClass(this, RCVHolder.class, R.layout.item_rcv); //Holder构造函数无其他参数时
adapter.setViewHolderClass(this, RCVHolder.class, R.layout.item_rcv, this); //Holder构造函数有参数时,在后面依次追加
AnimatorAdapter adapterWrapper = new SlideInBottomAnimatorAdapter(adapter, recyclerView);
recyclerView.setAdapter(adapterWrapper);
for (int i = 0; i < 20; i++) {
TestBean testBean = new TestBean(i+"", TestBean.VIEW_TYPE_1);
adapter.append(testBean);
}
}
private void initMultiTypeRecycleView() {
RecyclerView recyclerView=(RecyclerView) findViewById(R.id.rcv_multi_type);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(OrientationHelper.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
//多view type
RecyclerListDataAdapter<TestBean> adapter = new RecyclerListDataAdapter<TestBean>();
RecyclerViewTypeManager<TestBean> viewTypeManager = new RecyclerViewTypeManager<TestBean>();
viewTypeManager.viewTypes(TestBean.VIEW_TYPE_1, TestBean.VIEW_TYPE_2) //多Type
.itemViewIds(R.layout.item_rcv,R.layout.item_rcv2) //对应子View
.viewHolderClasses(RCVHolder.class,RCVHolder2.class) //对应Holder
.argsArray(new Object[]{this})
.itemViewTypeLogic(new RecyclerViewTypeManager.OnItemViewTypeLogic<TestBean>() { //设置getItemViewType逻辑,不设置 默认取viewTypes第0个元素
@Override
public int getItemViewType(int position, TestBean itemData) {
return itemData.getType();
}
});
adapter.setViewTypeManager(viewTypeManager);
AnimatorAdapter adapterWrapper = new ScaleInAnimatorAdapter(adapter, recyclerView,0.5f);
recyclerView.setAdapter(adapterWrapper);
adapter.setOnEventListener(new RecyclerViewAdapterBase.OnEventListener<String>() {
@Override
public String onEvent(Object... params) {
TestBean itemData = (TestBean) params[0];
return itemData.getName();
}
});
for (int i = 0; i < 20; i++) {
if (i==0) {
TestBean testBean = new TestBean(i+"", TestBean.VIEW_TYPE_1);
adapter.append(testBean);
}else if (i==3) {
TestBean testBean = new TestBean(i+"", TestBean.VIEW_TYPE_1);
adapter.append(testBean);
}else {
TestBean testBean = new TestBean(i+"", TestBean.VIEW_TYPE_2);
adapter.append(testBean);
}
}
}
public void callActivityMethod(int position) {
Toast.makeText(RecyclerActivity.this, "Item:"+position+" callActivityMethod", Toast.LENGTH_SHORT).show();
}
}
| [
"robinxdroid@gmail.com"
] | robinxdroid@gmail.com |
8b73ae5b159998d6c615c3487323833f8fa1cc88 | 9aa0fe268ce50060bffaab239db64f3496b3a062 | /src/main/java/com/uc/bpg/service/impl/DeviceTypeListServiceImpl.java | 90f759fdea4f2894f695a119e211215c4a75c18f | [] | no_license | guohong365/bpg | b3601e108ff28dde8a35277d6740de198c54cd38 | 72bbe5f206f758d2fd85e4b332f7ab1a0e3586d7 | refs/heads/master | 2021-01-20T07:52:27.613117 | 2019-03-26T14:11:14 | 2019-03-26T14:11:14 | 90,056,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | package com.uc.bpg.service.impl;
import org.springframework.util.StringUtils;
import com.uc.bpg.forms.DeviceTypeQueryForm;
import com.uc.bpg.service.BusinessListServiceBase;
import com.uc.bpg.service.DeviceTypeListService;
import com.uc.web.forms.ListQueryForm;
public class DeviceTypeListServiceImpl extends BusinessListServiceBase<DeviceTypeQueryForm> implements DeviceTypeListService{
@Override
public boolean prepareQueryForm(ListQueryForm queryForm) {
super.prepareQueryForm(queryForm);
DeviceTypeQueryForm deviceTypeQueryForm=(DeviceTypeQueryForm) queryForm;
if(StringUtils.isEmpty(deviceTypeQueryForm.getQueryName())){
deviceTypeQueryForm.setQueryName(null);
}
if(StringUtils.isEmpty(deviceTypeQueryForm.getQueryProduct())){
deviceTypeQueryForm.setQueryProduct(null);
}
if(deviceTypeQueryForm.getQueryAll()==null || !deviceTypeQueryForm.getQueryAll()){
deviceTypeQueryForm.setQueryAll(false);
} else {
deviceTypeQueryForm.setQueryAll(true);
}
return true;
}
}
| [
"guohong365@263.net"
] | guohong365@263.net |
d92920e5b79610b370d1ed88eb2b288dff5985ec | 36bee0f7ca6b4dec61fee2824ab00ee0ddcd20cd | /src/com/isscollege/gdce/model/impl/ReviewModelImpl.java | aa933aef5fee6dac86185a3edb6807a5b957cf29 | [] | no_license | shaohjz/gdce | d29d3ae3477b2e34a1a1c6aa0747c12e7af48ba3 | 4aef7df76fb703758d532862f8af519ae2d37640 | refs/heads/master | 2020-03-28T03:36:53.390066 | 2018-09-11T08:14:51 | 2018-09-11T08:14:51 | 147,658,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,994 | java | package com.isscollege.gdce.model.impl;
import java.sql.SQLException;
import java.util.List;
import com.isscollege.gdce.domain.Advertisement;
import com.isscollege.gdce.domain.Company;
import com.isscollege.gdce.domain.News;
import com.isscollege.gdce.domain.Product;
import com.isscollege.gdce.model.IReviewModel;
import com.isscollege.gdce.service.IReviewService;
import com.isscollege.gdce.service.impl.ReviewServiceImpl;
public class ReviewModelImpl implements IReviewModel
{
private IReviewService service = null;
public ReviewModelImpl()
{
service = new ReviewServiceImpl();
}
@Override
public List<Advertisement> queryAdvertisementByReviewState(int page, int size) throws SQLException
{
return service.queryAdvertisementByReviewState(page, size);
}
@Override
public void updateAdvertisementReviewState(int advertisementId, int curStats) throws SQLException
{
service.updateAdvertisementReviewState(advertisementId, curStats);
;
}
@Override
public List<Company> queryCompanyByReviewState(int page, int size) throws SQLException
{
return service.queryCompanyByReviewState(page, size);
}
@Override
public void updateCompanyReviewState(int companyId, int curStats) throws SQLException
{
service.updateCompanyReviewState(companyId, curStats);
;
}
@Override
public List<Product> queryProductByReviewState(int page, int size) throws SQLException
{
return service.queryProductByReviewState(page, size);
}
@Override
public void updateProductReviewState(int productId, int curStats) throws SQLException
{
service.updateProductReviewState(productId, curStats);
}
@Override
public List<News> queryNewsByReviewState(int page, int size) throws SQLException
{
return service.queryNewsByReviewState(page, size);
}
@Override
public void updateNewsReviewState(int newsId, int curStats) throws SQLException
{
service.updateNewsReviewState(newsId, curStats);
}
}
| [
"shaohjz@163.com"
] | shaohjz@163.com |
ac22a35f9e4c63057cb987c17bc86243f72318de | a41a273f4effa3dfd779d1a26a56cb3c55bc5ea8 | /app/src/main/java/com/bilibili/ccc/ilovebilibili_master/fragment/PartitionFragment.java | 716aac3f15244f0c03c8a718858879566c104381 | [] | no_license | LiuStangMing/Ilovebilibili | 90c86c79dd2d973484dabdf4b0deebcd2059c14c | 9f10af45ec2e15c89d27c2a9e06a2161b5c800a4 | refs/heads/master | 2021-01-19T06:58:11.021044 | 2017-06-28T13:24:14 | 2017-06-28T13:24:14 | 87,510,679 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | package com.bilibili.ccc.ilovebilibili_master.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bilibili.ccc.ilovebilibili_master.BaseFragment.BaseFragment;
import com.bilibili.ccc.ilovebilibili_master.R;
public class PartitionFragment extends BaseFragment {
@Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getContext()).inflate(R.layout.fragment_main_partition,null);
return view;
}
}
| [
"154637026@qq.com"
] | 154637026@qq.com |
e200d5b6396534983bf2486f1946af65302b9a95 | f52d4bdab70665cf45b3e47c92e19192982ecedd | /src/com/project/caretaker/utility/SleepUtility.java | e34f159f28253845270cd9f9bb52948c86e8adf9 | [] | no_license | harshalshah26/CareTaker | 081e9f4adca581befe0d6cd44309ff612d66e7f9 | 58cb731c840c89d3a0414c73dbe6afd651a13bb0 | refs/heads/master | 2021-01-10T11:32:55.850161 | 2016-04-04T02:42:14 | 2016-04-04T02:42:14 | 55,379,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,709 | java | package com.project.caretaker.utility;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.util.Log;
import com.parse.ParseObject;
import com.project.caretaker.receiver.ScreenReceiver;
public class SleepUtility {
static public String getEmail(Context context) {
AccountManager accountManager = AccountManager.get(context);
Account account = getAccount(accountManager);
if (account == null) {
return null;
} else {
return account.name;
}
}
private static Account getAccount(AccountManager accountManager) {
Account[] accounts = accountManager.getAccountsByType("com.google");
Account account;
if (accounts.length > 0) {
account = accounts[0];
} else {
account = null;
}
return account;
}
public static String readPrefernce(Context context,String fileName,String key,String defaultValue)
{
SharedPreferences preferences=context.getSharedPreferences(fileName,Context.MODE_PRIVATE);
return preferences.getString(key,defaultValue);
}
public static void storeToPreference(Context context,String filename, String key, String value)
{
SharedPreferences preferences=context.getSharedPreferences(filename,context.MODE_PRIVATE);
SharedPreferences.Editor editor=preferences.edit();
//Log.d("ACCESS TOKEN", token);
//if(token!=null)
editor.putString(key,value);
editor.commit();
}
public static String getTimeInStringFormat(Date date)
{
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
return dateFormat.format(date);
}
//return differnce between two times in seconds
public static long getDuration(long d1,long d2)
{
long diff = d2- d1+1;
long diffSeconds = diff / 1000;
return diffSeconds;
}
public static String getDurationFormat(long sec)
{
long hour = sec / 3600 ;
long minute = sec/60;
long second = sec % 60 ;
return (hour < 10 ?"0"+String.valueOf(hour):String.valueOf(hour))+":"
+(minute < 10 ?"0"+String.valueOf(minute):String.valueOf(minute))+":"
+(second < 10 ?"0"+String.valueOf(second):String.valueOf(second));
}
public static String createFileName(Calendar cal)
{
DateFormat dateFormat = new SimpleDateFormat("MMddyyyy");
String fileName = dateFormat.format(cal.getTime())+".csv";
Log.d("FILE NAME",fileName);
return fileName;
}
public static void writeInteractionInFile (Context context,String startTime,String endTime,long duration,String filename) throws IOException,Exception
{
BufferedWriter writer=null;
//String path="sdcard/LifeTracker/lifetracker.csv";
File dir=new File("sdcard/SleepLog");
boolean flag=dir.mkdir();
//Log.d("Directory created?",""+flag);
File file=new File(dir.getAbsolutePath(),filename);
if(file.exists()==false)
{
// Intent service = new Intent(context,DataBaseService.class);
// context.startService(service);
file.createNewFile();
writer=new BufferedWriter(new FileWriter(file,true));
writer.write("Start Time,End Time,Duration");
writer.newLine();
writer.write(startTime+","+endTime+","+duration);
}
else
{
writer=new BufferedWriter(new FileWriter(file,true));
writer.newLine();
writer.write(startTime+","+endTime+","+duration);
}
Log.d("Appended","True");
writer.flush();
writer.close();
}
public static void writeVariableInFile (Context context,int v1,int v2,int v3,int v4,int counter,double sleep,double diff,String filename) throws IOException,Exception
{
BufferedWriter writer=null;
//String path="sdcard/LifeTracker/lifetracker.csv";
File dir=new File("sdcard/SleepLog");
boolean flag=dir.mkdir();
//Log.d("Directory created?",""+flag);
File file=new File(dir.getAbsolutePath(),filename);
if(file.exists()==false)
{
// Intent service = new Intent(context,DataBaseService.class);
// context.startService(service);
file.createNewFile();
writer=new BufferedWriter(new FileWriter(file,true));
writer.write("DATE,V1,V2,V3,V4,counter,Sleep,Difference");
writer.newLine();
writer.write(new Date()+","+v1+","+v2+","+v3+","+v4+","+counter+","+sleep+","+diff);
}
else
{
writer=new BufferedWriter(new FileWriter(file,true));
writer.newLine();
writer.write(new Date()+","+v1+","+v2+","+v3+","+v4+","+counter+","+sleep+","+diff);
}
Log.d("Variable Appended","True");
writer.flush();
writer.close();
}
public static void writeVariableInCloud(String email,int v1,int v2,int v3, int v4,int counter,double actual_sleep,double difference)
{
ParseObject interaction = new ParseObject("SleepLog");
interaction.put("email",email);
interaction.put("V1",v1);
interaction.put("V2",v2);
interaction.put("V3",v3);
interaction.put("V4",v4);
interaction.put("counter",counter);
interaction.put("difference",difference);
interaction.put("actual_sleep",actual_sleep);
interaction.put("date",new Date());
interaction.saveEventually();
Log.d("Successfully write in cloud", "TRUE");
}
public static void writeInteractionInCloud(String email,String startTime,String endTime,long duration)
{
ParseObject interaction = new ParseObject("Interaction");
interaction.put("email",email);
try {
Log.d("TEST START TIME", new Date(startTime).toString());
interaction.put("starttime", new Date(startTime));
interaction.put("endtime", new Date(endTime));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
interaction.put("duration",duration);
interaction.saveEventually();
Log.d("Successfully write in cloud", "TRUE");
}
//
//
// /**
// * isBetween
// * @param checkTime
// * @param time1
// * @param time2
// * @return true if checktime is between time1 and time2. Otherwise false
// */
//// public static boolean isBetween(String checkTime,String time1,String time2 )
// {
// SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
//
// try {
// Date time = sdf2.parse(checkTime);
// Date startTime = sdf2.parse(time1);
// Date endTime = sdf2.parse(time2);
// Log.d("time",sdf2.format(time));
// Log.d("startTime",sdf2.format(startTime));
// Log.d("endTime",sdf2.format(endTime));
// Log.d("Before", ""+time.before(startTime));
// Log.d("After", ""+time.after(startTime));
//
// if(startTime.after(endTime))
// {
// Log.d("In 1 if", "true");
// if (time.after(startTime) || time.before(endTime))
// return true;
//
// else
// return false;
// }
// else
// {
// Log.d("In 2 if", "true");
// if (time.after(startTime) && time.before(endTime))
// return true;
// else
// return false;
//
// }
// } catch (ParseException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// return false;
//
//
//
// }
//
// public static Date subtractDay(Date date) {
//
// Calendar cal = Calendar.getInstance();
// cal.setTime(date);
// cal.add(Calendar.DAY_OF_MONTH, -1);
// return cal.getTime();
// }
}
| [
"hs26593@gmail.com"
] | hs26593@gmail.com |
0eac46f9cdab71dcc9dc5bfe2dbba36d23baa8b1 | bfa98d5eafcc8915b8308a9c9c15c2eb6b3541ac | /cafemgt_cafemgt/src/main/java/com/cafemgt/service/WtimeService.java | a662c699e389a63915751e70a5c200a037fb38a9 | [] | no_license | PoMingKim/ksmart38 | a9033328cf7d9a1fc1d5fe7f2805f001aa65a2e5 | 1c0aeb33c77810e1e4b97d0c3a121be4e7d732d2 | refs/heads/master | 2023-03-20T10:24:50.662073 | 2021-03-18T00:29:08 | 2021-03-18T00:29:08 | 345,510,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.cafemgt.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cafemgt.dao.WtimeMapper;
import com.cafemgt.dto.WtimeDto;
@Service
public class WtimeService {
private final WtimeMapper wtimeMapper;
@Autowired
public WtimeService(WtimeMapper wtimeMapper) {
this.wtimeMapper= wtimeMapper;
}
public List<WtimeDto> getWtime(){
List<WtimeDto> wtimeDto = wtimeMapper.getWtime();
return wtimeDto;
}
}
| [
"79967979+PoMingKim@users.noreply.github.com"
] | 79967979+PoMingKim@users.noreply.github.com |
47b01ae245421017f147e6da9769534735cb879b | cf071bd600aac9f6dea5b7cf058313d44ce2a925 | /src/main/java/com/javastudy/coworkings/web/servlet/security/LogoutServlet.java | d8eae48ea6033fc585f099a0d9f089fb3fb20018 | [] | no_license | Rooman/Coworkings | da1124312d7f1f18cc5251777beae64c215ce9a8 | c3ad45b749535b4c6030ccb0f3502cfe11c4c273 | refs/heads/master | 2023-08-11T18:22:02.420546 | 2020-02-13T19:10:47 | 2020-02-13T19:10:47 | 236,357,916 | 0 | 0 | null | 2023-07-23T03:48:38 | 2020-01-26T18:39:09 | Java | UTF-8 | Java | false | false | 1,289 | java | package com.javastudy.coworkings.web.servlet.security;
import com.javastudy.coworkings.ServiceLocator;
import com.javastudy.coworkings.service.security.SecurityService;
import com.javastudy.coworkings.entity.Session;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class LogoutServlet extends HttpServlet {
private SecurityService securityService;
public LogoutServlet() {
securityService = ServiceLocator.getService(SecurityService.class);
}
@Override
public void doGet(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
Cookie[] cookies = req.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equalsIgnoreCase("user-token")) {
String userToken = cookie.getValue();
Session session = securityService.getSession(userToken);
if (session != null) {
securityService.logout(userToken);
}
}
}
}
resp.sendRedirect("/login");
}
}
| [
"nomarchia2@gmail.com"
] | nomarchia2@gmail.com |
a1c006b054b94bdb1b2f889895a5bee7977139dd | 420124014b9caa83873e03b717c0aeecc9f99721 | /FabricaDeQueijo/src/main/java/dao/FornecedorDao.java | f4899dc5a265965520232d9bc35009d302d4255f | [] | no_license | MarcosKyllenor/Fabrica-de-Queijo | 62094caa3e94121829bf0f0f88e39bc3e8a02090 | ee6863b8b20bd531c1ee9952fc4f74a4a1e84329 | refs/heads/master | 2023-05-24T18:29:12.997650 | 2019-10-18T01:21:05 | 2019-10-18T01:21:05 | 215,908,678 | 0 | 0 | null | 2023-05-23T20:12:00 | 2019-10-18T00:21:04 | Java | UTF-8 | Java | false | false | 753 | 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 dao;
import java.util.ArrayList;
import java.util.List;
import model.Fornecedor;
/**
*
* @author herve
*/
public class FornecedorDao {
public Fornecedor inserir(Fornecedor f) {
return f;
}
public boolean excluir(Fornecedor f) {
return false;
}
public Fornecedor alterar(Fornecedor f) {
return f;
}
public List<Fornecedor> selecionarNome(String n) {
List<Fornecedor> listaFornecedores = new ArrayList<>();
return listaFornecedores;
}
}
| [
"marcosKyllenor@gmail.com"
] | marcosKyllenor@gmail.com |
d545251aaa6c151ed1f25835b197601543da071d | 1e194aa41e80c9ac433615bb0b08a00fbeaa4ac1 | /app/src/main/java/com/hywy/publichzt/adapter/item/ReservoirItem.java | 1279ee0d8bcbc0462c7cad4640a12d616d39f88f | [] | no_license | Sususuperman/-app | b88ce5c01ae0e3f66d3ced81fda73f61652af733 | 909a81ea30932427113f5735581618e9fd56abca | refs/heads/master | 2020-03-30T06:12:13.370937 | 2018-09-29T08:58:35 | 2018-09-29T08:58:35 | 150,845,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,053 | java | package com.hywy.publichzt.adapter.item;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.cs.common.utils.StringUtils;
import com.hywy.publichzt.R;
import com.hywy.publichzt.entity.Reservoir;
import java.text.DecimalFormat;
import java.util.List;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.viewholders.FlexibleViewHolder;
/**
* 水库水位监测
*
* @author Superman
*/
public class ReservoirItem extends AbstractFlexibleItem<ReservoirItem.EntityViewHolder> {
private Reservoir reservoir;
public Reservoir getData() {
return reservoir;
}
public ReservoirItem(Reservoir reservoir) {
this.reservoir = reservoir;
}
@Override
public int getLayoutRes() {
return R.layout.item_reservoir;
}
@Override
public ReservoirItem.EntityViewHolder createViewHolder(FlexibleAdapter adapter, LayoutInflater inflater, ViewGroup parent) {
return new ReservoirItem.EntityViewHolder(inflater.inflate(getLayoutRes(), parent, false), adapter);
}
static class EntityViewHolder extends FlexibleViewHolder {
TextView tv_title_r;
TextView tv_address_r;
TextView tv_water_r;
TextView tv_stream_r;
TextView tv_time_r;
public EntityViewHolder(View view, FlexibleAdapter adapter) {
super(view, adapter);
tv_title_r = (TextView) view.findViewById(R.id.tv_title_r);
tv_address_r = (TextView) view.findViewById(R.id.tv_address_r);
tv_water_r = (TextView) view.findViewById(R.id.water_height);
tv_stream_r = (TextView) view.findViewById(R.id.stream_day);
tv_time_r = (TextView) view.findViewById(R.id.tv_time_r);
}
}
@Override
public void bindViewHolder(FlexibleAdapter adapter, EntityViewHolder holder, int position, List payloads) {
if (reservoir != null) {
if (StringUtils.hasLength(reservoir.getSTNM())) {
holder.tv_title_r.setText(reservoir.getSTNM());
}
if (reservoir.getSTLC() != null) {
holder.tv_address_r.setText(reservoir.getSTLC());
}
holder.tv_water_r.setText(reservoir.getRZ() + "mm");
holder.tv_stream_r.setText(reservoir.getOTQ() + "m³/s");
holder.tv_time_r.setText(reservoir.getTM());
}
}
/**
* 将数据保留两位小数
*/
private String getTwoDecimal(double num) {
DecimalFormat dFormat = new DecimalFormat("#########0.00");
String str = dFormat.format(num);
return str;
}
/**
*/
@Override
public boolean equals(Object o) {
// if (o instanceof WaterAndRainItem) {
// WaterAndRainItem odata = (WaterAndRainItem) o;
// return waterRain.getOrganID() == odata.getData().getOrganID();
// }
return false;
}
}
| [
"chaoisgoodman@163.com"
] | chaoisgoodman@163.com |
0a584f26e1dbe152c9129dae00709ee7020ac7ff | 5327347301cfd34859eaa352bc85ad1302e611b6 | /MyApplication/app/src/main/java/com/example/a24168/myapplication/kitchen/like/entity/FindFriend.java | 3fee3a27d80ca56871249403b50e716ca8c8c273 | [] | no_license | shenyushen/wdnmd | b3c25f9562bebbdc24d93fc56fbeb13209ddff9e | 8ca3f0a6a0ef6e9e03107b368d0b9ceaa8617a59 | refs/heads/master | 2020-07-16T15:34:45.472676 | 2020-07-16T07:24:31 | 2020-07-16T07:24:31 | 205,816,016 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,193 | java | package com.example.a24168.myapplication.kitchen.like.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class FindFriend implements Serializable {
private int id;
private int author;
private String theme;
private String data;
private String date;
private int menuid;
private int likenum;
private String photo;
private int type;
private User user = new User();
private List<Find_Photo> find_Photos = new ArrayList<>();
private FindLable findLable = new FindLable();
private List<FindComment> findComments = new ArrayList<>();
public List<FindComment> getFindComments() {
return findComments;
}
public void setFindComments(List<FindComment> findComments) {
this.findComments = findComments;
}
public FindLable getFindLable() {
return findLable;
}
public void setFindLable(FindLable findLable) {
this.findLable = findLable;
}
public List<Find_Photo> getFind_Photos() {
return find_Photos;
}
public void setFind_Photos(List<Find_Photo> find_Photos) {
this.find_Photos = find_Photos;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getAuthor() {
return author;
}
public void setAuthor(int author) {
this.author = author;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getMenuid() {
return menuid;
}
public void setMenuid(int menuid) {
this.menuid = menuid;
}
public int getLikenum() {
return likenum;
}
public void setLikenum(int likenum) {
this.likenum = likenum;
}
/*@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel arg0, int flags) {
*//*private int id;
private int author;
private String theme;
private String data;
private String date;
private int menuid;
private int likenum;
private String photo;*//*
arg0.writeInt(id);
arg0.writeInt(author);
arg0.writeString(theme);
arg0.writeString(data);
arg0.writeString(date);
arg0.writeInt(menuid);
arg0.writeInt(likenum);
arg0.writeString(photo);
}
// 1.必须实现Parcelable.Creator接口,否则在获取Person数据的时候,会报错,如下:
// android.os.BadParcelableException:
// Parcelable protocol requires a Parcelable.Creator object called CREATOR on class com.um.demo.Person
// 2.这个接口实现了从Percel容器读取Person数据,并返回Person对象给逻辑层使用
// 3.实现Parcelable.Creator接口对象名必须为CREATOR,不如同样会报错上面所提到的错;
// 4.在读取Parcel容器里的数据事,必须按成员变量声明的顺序读取数据,不然会出现获取数据出错
// 5.反序列化对象
public static final Parcelable.Creator<FindFriend> CREATOR = new Creator(){
@Override
public FindFriend createFromParcel(Parcel source) {
// TODO Auto-generated method stub
// 必须按成员变量声明的顺序读取数据,不然会出现获取数据出错
FindFriend p = new FindFriend();
*//*private int id;
private int author;
private String theme;
private String data;
private String date;
private int menuid;
private int likenum;
private String photo;*//*
p.setId(source.readInt());
p.setAuthor(source.readInt());
p.setTheme(source.readString());
p.setData(source.readString());
p.setDate(source.readString());
p.setMenuid(source.readInt());
p.setLikenum(source.readInt());
p.setPhoto(source.readString());
return p;
}
@Override
public FindFriend[] newArray(int size) {
// TODO Auto-generated method stub
return new FindFriend[size];
}
};*/
}
| [
"1501311415@qq.com"
] | 1501311415@qq.com |
cbef7a3061e2373d68c913c47dc3bd4e409a9165 | c474b03758be154e43758220e47b3403eb7fc1fc | /apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/tinder/onboarding/presenter/C14102u.java | 178cf664a7db2a9decc1a31ee8b1ebbaa0ac2ba0 | [] | no_license | EstebanDalelR/tinderAnalysis | f80fe1f43b3b9dba283b5db1781189a0dd592c24 | 941e2c634c40e5dbf5585c6876ef33f2a578b65c | refs/heads/master | 2020-04-04T09:03:32.659099 | 2018-11-23T20:41:28 | 2018-11-23T20:41:28 | 155,805,042 | 0 | 0 | null | 2018-11-18T16:02:45 | 2018-11-02T02:44:34 | null | UTF-8 | Java | false | false | 516 | java | package com.tinder.onboarding.presenter;
import com.tinder.onboarding.target.BirthdayStepTarget;
import org.joda.time.LocalDate;
import rx.functions.Action1;
/* renamed from: com.tinder.onboarding.presenter.u */
final /* synthetic */ class C14102u implements Action1 {
/* renamed from: a */
private final LocalDate f44778a;
C14102u(LocalDate localDate) {
this.f44778a = localDate;
}
public void call(Object obj) {
((BirthdayStepTarget) obj).setBirthday(this.f44778a);
}
}
| [
"jdguzmans@hotmail.com"
] | jdguzmans@hotmail.com |
468569769d928f27fc2721f4831095d4a943a683 | 387e913f51100fadc0f7c3d8fea095cd1e5ad1e8 | /ProjetoFaculdade/src/entity/CursoTipo.java | 008daf1efdaa4a2c5c7ccf9ac1b34e0e1a8b8444 | [
"MIT"
] | permissive | rafaelzatarin/CursoJava-ProjFaculdade | 62eb62da9abad1cdba4a3172c5c9b3e1c3865913 | adee4d3d7d300e346ca202fed13a223271b67932 | refs/heads/master | 2022-11-26T22:35:54.731160 | 2020-08-01T11:54:47 | 2020-08-01T11:54:47 | 284,248,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 85 | java | package entity;
public enum CursoTipo {
MATEMÁTICA, INFORMÁTICA, ENGENHARIA
}
| [
"rafadecps@gamil.com"
] | rafadecps@gamil.com |
50666688e1652c47117f65b9e48ceae2057b6c77 | 7773ea6f465ffecfd4f9821aad56ee1eab90d97a | /plugins/markdown/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownCompositePsiElementBase.java | 0d0915299f57a6a0afdcb347dec4c267daeecbc9 | [
"Apache-2.0"
] | permissive | aghasyedbilal/intellij-community | 5fa14a8bb62a037c0d2764fb172e8109a3db471f | fa602b2874ea4eb59442f9937b952dcb55910b6e | refs/heads/master | 2023-04-10T20:55:27.988445 | 2020-05-03T22:00:26 | 2020-05-03T22:26:23 | 261,074,802 | 2 | 0 | Apache-2.0 | 2020-05-04T03:48:36 | 2020-05-04T03:48:35 | null | UTF-8 | Java | false | false | 2,267 | java | package org.intellij.plugins.markdown.lang.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import org.intellij.plugins.markdown.lang.psi.MarkdownPsiElement;
import org.intellij.plugins.markdown.structureView.MarkdownBasePresentation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public abstract class MarkdownCompositePsiElementBase extends ASTWrapperPsiElement implements MarkdownCompositePsiElement {
public static final int PRESENTABLE_TEXT_LENGTH = 50;
public MarkdownCompositePsiElementBase(@NotNull ASTNode node) {
super(node);
}
@NotNull
protected CharSequence getChars() {
return getTextRange().subSequence(getContainingFile().getViewProvider().getContents());
}
@NotNull
protected String shrinkTextTo(int length) {
final CharSequence chars = getChars();
return chars.subSequence(0, Math.min(length, chars.length())).toString();
}
@NotNull
@Override
public List<MarkdownPsiElement> getCompositeChildren() {
return Arrays.asList(findChildrenByClass(MarkdownPsiElement.class));
}
/**
* @return {@code true} if there is more than one composite child
* OR there is one child which is not a paragraph, {@code false} otherwise.
*/
public boolean hasTrivialChildren() {
final Collection<MarkdownPsiElement> children = getCompositeChildren();
if (children.size() != 1) {
return false;
}
return children.iterator().next() instanceof MarkdownParagraphImpl;
}
@Override
public ItemPresentation getPresentation() {
return new MarkdownBasePresentation() {
@Nullable
@Override
public String getPresentableText() {
if (!isValid()) {
return null;
}
return getPresentableTagName();
}
@Nullable
@Override
public String getLocationString() {
if (!isValid()) {
return null;
}
if (getCompositeChildren().size() == 0) {
return shrinkTextTo(PRESENTABLE_TEXT_LENGTH);
}
else {
return null;
}
}
};
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
27527613a5b70527be2aa9fc333b46d49f3bce09 | bc5c497330599582af038f7fb3a7dc487e988aa6 | /app/src/main/java/com/neerajsingh/flagpath/TextPath.java | 9f7662b1b675db1696de0ffa1f964f4bfe676584 | [] | no_license | neeraj2/Flagpath | e9f989e52ce8186ec8bc6d7c8085780a9c5d3823 | 7994ec92ba6b28b332496c9653100f4d1878b3da | refs/heads/master | 2020-07-14T07:19:33.063683 | 2017-06-14T06:44:01 | 2017-06-14T06:44:01 | 94,298,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package com.neerajsingh.flagpath;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
/**
* Created by neeraj.singh on 03/05/17.
*/
public class TextPath extends LinearLayout {
public TextPath(Context context) {
super(context);
}
public TextPath(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public TextPath(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public TextPath(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public void setData(List<String> list) {
setOrientation(HORIZONTAL);
LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, list.size());
setLayoutParams(layoutParams);
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
for (int i = 0; i < list.size(); i++) {
TextView textView = (TextView) layoutInflater.inflate(R.layout.text, this, false);
textView.setText(list.get(i));
addView(textView);
}
}
}
| [
"neeraj.singh@flipkart.com"
] | neeraj.singh@flipkart.com |
d4bb0b2edc41ee54f73bae2ec0d8c60a010201d2 | 2bf30c31677494a379831352befde4a5e3d8ed19 | /vipr-portal/com.iwave.ext.linux/src/java/com/iwave/ext/linux/command/lvm/DeleteLogicalVolumeCommand.java | 5a4e6815f381c54cfbb0a01b5623bb31ceb1bd0f | [] | no_license | dennywangdengyu/coprhd-controller | fed783054a4970c5f891e83d696a4e1e8364c424 | 116c905ae2728131e19631844eecf49566e46db9 | refs/heads/master | 2020-12-30T22:43:41.462865 | 2015-07-23T18:09:30 | 2015-07-23T18:09:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | /*
* Copyright 2012-2015 iWave Software LLC
* All Rights Reserved
*/
package com.iwave.ext.linux.command.lvm;
import com.iwave.ext.linux.command.CommandConstants;
import com.iwave.ext.linux.command.LinuxScriptCommand;
public class DeleteLogicalVolumeCommand extends LinuxScriptCommand {
public DeleteLogicalVolumeCommand(String logicalVolume) {
addCommandLine("%s -a n %s", CommandConstants.LVCHANGE, logicalVolume);
addCommandLine("%s %s", CommandConstants.LVREMOVE, logicalVolume);
setRunAsRoot(true);
}
}
| [
"review-coprhd@coprhd.org"
] | review-coprhd@coprhd.org |
45af74733d397e10091ce5bb6e50005ea8489917 | d5fc1afa92ae7aba2dd2ee329e613d0f17f676d5 | /LearningApp/src/com/santyp/learningapp/DrawerItem.java | dfd847ec25dd60b9f5a8f4131f5301616bbfc407 | [] | no_license | santy07/LearningApps-1 | 80774f679745fc67f3c72e52a5060319f0aa7424 | bb5f6b5d47be88f6f69b144a699121f430ca3105 | refs/heads/master | 2020-04-24T01:36:02.236509 | 2015-03-08T20:05:29 | 2015-03-08T20:05:29 | 31,863,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package com.santyp.learningapp;
public class DrawerItem {
private String title;
public DrawerItem() {
}
public DrawerItem(String title) {
this.title= title;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"vish_santosh85@yahoo.co.in"
] | vish_santosh85@yahoo.co.in |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.