blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
1fd9fba38d7a30398c2a7f9924b23b98f20254bf
d366f4a38c29ddf9a92edf3f0cb79fed6ae131ce
/src/main/java/com/kishanprime/tinyurlshortner/service/IdConverterServiceImpl.java
76f4ee7ef722cdfaabe4a49babaf9c79baacc46b
[]
no_license
kishan-hub/tiny-url-shortner
b11d8c94b33f9d524c6dc03ec93d6fb3d3535651
65fc76b794557fca6dbe2294b14bce6cde971c71
refs/heads/master
2022-07-18T20:42:45.136528
2020-05-23T20:08:33
2020-05-23T20:08:33
266,183,096
1
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package com.kishanprime.tinyurlshortner.service; import org.springframework.stereotype.Service; /** * @author Nasim Salmany */ @Service public class IdConverterServiceImpl implements IdConverterService { private static final String POSSIBLE_ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; private static final long BASE = POSSIBLE_ALPHABET.length(); /** * Function to generate a shortenKey from integer ID */ @Override public String encode(long id) { StringBuilder shortenKey = new StringBuilder(); while (id > 0) { shortenKey.insert(0, POSSIBLE_ALPHABET.charAt((int) (id % BASE))); id = id / BASE; } return shortenKey.toString(); } /** * Function to get integer ID back from a shortenKey */ @Override public long decode(String shortenKey) { long num = 0; for (int i = 0; i < shortenKey.length(); i++) { num = num * BASE + POSSIBLE_ALPHABET.indexOf(shortenKey.charAt(i)); } return num; } }
[ "kumarkishan2991@gmail.com" ]
kumarkishan2991@gmail.com
61787dd37a08734b8239768eb34abe90a7855b4b
9734edcf03d0491ea8ec549571a4553948799c68
/src/main/java/com/perivoliotis/app/eSymposium/repos/custom/UserPostsRepositoryCustom.java
ec632060dfad667c8e438f815720f3df9eb453ec
[]
no_license
n-perivoliotis/eSymposium
bbe6e0d815909036bce05ecbfb03732ff8598eaa
c21243dfc91d6c7834b24fd2d0e12ef88521eb4a
refs/heads/master
2020-04-25T06:15:39.682360
2020-04-18T19:26:29
2020-04-18T19:26:29
172,574,506
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package com.perivoliotis.app.eSymposium.repos.custom; import com.perivoliotis.app.eSymposium.entities.facebook.UserPosts; public interface UserPostsRepositoryCustom { void saveOrUpdate(UserPosts userPosts); }
[ "nickperivol@hotmail.com" ]
nickperivol@hotmail.com
39d9bd9412d2290135d7e34d5f8672a6fb56438c
e676dc0e3b763c3411d35845a3614745765d0a9a
/TestProject/src/com/oocl/ita/TestMainClass.java
bcabd1a19f52cfc6503b250ddcbd5ac5e00e25be
[]
no_license
jaaaaag/TestProject
99578462b98e336e76d8422efb79dc3425535b76
e29913267e92cfa1c4b9f2e00bbf4bbc6b4ec633
refs/heads/master
2020-12-30T10:49:27.898882
2017-07-31T07:45:47
2017-07-31T07:45:47
98,858,912
0
0
null
null
null
null
UTF-8
Java
false
false
252
java
package com.oocl.ita; public class TestMainClass { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Test Class"); System.out.println("Test 2"); System.out.println("Test 3"); } }
[ "GERVAJO@ZHA-ITA129-W7.corp.oocl.com" ]
GERVAJO@ZHA-ITA129-W7.corp.oocl.com
9db0a420668209159f678078c208f49b2935405d
c42132ffc0dc9714b66e33e58f556d8285a322c7
/CoreJavaPractice/src/com/java/io/practice/CountLinesNWords.java
5739832a5b2f932689b359571be8e333cb03d315
[]
no_license
SaiKoushik1314/CoreJava
b0b8602e275641870a783395bc1d40a864d1483c
92ed2599f17026dc285eab66910c0c7b0298e8a1
refs/heads/master
2021-01-10T15:35:37.621064
2016-01-04T02:34:42
2016-01-04T02:34:42
48,969,877
0
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
package com.java.io.practice; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.StringTokenizer; public class CountLinesNWords { public static void main(String[] args) throws IOException { File inputFile = new File("myfile.txt"); FileInputStream fin = new FileInputStream(inputFile); DataInputStream in = new DataInputStream(fin); String data; StringTokenizer tokenizer; int lineCounter = 0; int wordCounter = 0; System.out.println("Content in the file " + inputFile.getName() + " is as follows:"); System.out.println("---------------------------------------------------------------"); while (in.available() != 0) { data = in.readLine(); System.out.println(data); tokenizer = new StringTokenizer(data); wordCounter += tokenizer.countTokens(); lineCounter += 1; } System.out.println(); System.out.println("No. of lines in the file: " + lineCounter); System.out.println("No. of words in the file: " + wordCounter); in.close(); } }
[ "sai.koushik1314@gmail.com" ]
sai.koushik1314@gmail.com
e226271f7acf83ab1c8370685c627c6da42444c6
217b6ca03aae468cbae64b519237044cd3178b33
/olyo/src/net/java/sip/communicator/service/protocol/ChatRoomConfigurationForm.java
4b8eef09dbd70da20a8da76eb50b39fad2fe3403
[]
no_license
lilichun/olyo
41778e668784ca2fa179c65a67d99f3b94fdbb45
b3237b7d62808a5b1d059a8dd426508e6e4af0b9
refs/heads/master
2021-01-22T07:27:30.658459
2008-06-19T09:57:36
2008-06-19T09:57:36
32,123,461
0
1
null
null
null
null
UTF-8
Java
false
false
1,697
java
/* * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ package net.java.sip.communicator.service.protocol; import java.util.*; /** * The <tt>ChatRoomConfigurationForm</tt> contains the chat room configuration. * It's meant to be implemented by protocol providers in order to provide an * access to the administration properties of a chat room. The GUI should be * able to obtain this form from the chat room and provide the user with the * user interface representation and the possibility to change it. * <br> * The <tt>ChatRoomConfigurationForm</tt> contains a list of * <tt>ChatRoomConfigurationFormField</tt>s. Each field corresponds to a chat * room configuration property. * * @author Yana Stamcheva */ public interface ChatRoomConfigurationForm { /** * Returns an Iterator over a set of <tt>ChatRoomConfigurationFormField</tt>s, * containing the current configuration of the chat room. This method is * meant to be used by bundles interested showing and changing the current * chat room configuration. * * @return a list of <tt>ChatRoomConfigurationFormField</tt>s, containing * the current configuration of the chat room */ public Iterator getConfigurationSet(); /** * Submits the information in this configuration form to the server. * * @throws OperationFailedException if the submit opeation do not succeed * for some reason (e.g. a wrong value is provided for a property) */ public void submit() throws OperationFailedException; }
[ "dongfengyu20032045@1a5f2d27-d927-0410-a143-5778ce1304a0" ]
dongfengyu20032045@1a5f2d27-d927-0410-a143-5778ce1304a0
21d4d7b5df48c8993441603e6cc8ac6d6324f7c4
b1f5f195ff12e64ae76609236667d5bb1b6a1834
/app/src/main/java/com/example/android/myapplication/MovieDetailsActivity.java
08ad5e69fb0f6569e38f1818b75f7a6473869c6d
[]
no_license
saegeullee/popular-movies-Udacity
a89dcfc41b2baecb22ca664e7508663a94ea80c6
797c4ac2a0284cc977d7cabf60ba17a4e70af4c9
refs/heads/master
2020-05-17T07:16:38.467897
2020-01-10T08:58:32
2020-01-10T08:58:32
183,576,639
0
0
null
null
null
null
UTF-8
Java
false
false
8,014
java
package com.example.android.myapplication; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; import android.net.Uri; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.example.android.myapplication.models.Movie; import com.example.android.myapplication.models.MovieTrailer; import com.example.android.myapplication.models.Review; import com.squareup.picasso.Picasso; import java.util.Date; import java.util.List; /** * Problem * 현재 이 액티비티에서 rotation 을 돌리면 api 호출을 다시 해서 데이터를 가져온다. * 그럼 viewModel 을 사용하는 이유가 사라진다. * * -> Problem solved by * Creating MovieDetailsViewModelFactory so that the movieId can be passed while instantiating MovieDetailsViewModel to * call get reviews and trailers method at MovieDetailsViewModel. */ public class MovieDetailsActivity extends AppCompatActivity implements MovieReviewsAdapter.OnReviewItemClickListener, MovieTrailersAdapter.OnTrailerItemClickListener { private static final String TAG = "MovieDetailsActivity"; private TextView release_date, vote_average, plot_synopsis; private TextView no_trailers, no_reviews; private ImageView poster_image; private Button mark_as_favorite; private Movie mMovie; private boolean isMarkedFavorite = false; private MovieDetailsViewModel movieDetailsViewModel; private RecyclerView reviewRecyclerView; private MovieReviewsAdapter mReviewAdapter; private RecyclerView trailersRecyclerView; private MovieTrailersAdapter mTrailerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_details); getIntentFromMainActivity(); initUI(); setupViewModel(); } private void setupViewModel() { if(mMovie != null) { MovieDetailsViewModelFactory factory = new MovieDetailsViewModelFactory(this, mMovie.getMovieId()); movieDetailsViewModel = ViewModelProviders.of(this, factory).get(MovieDetailsViewModel.class); movieDetailsViewModel.movieObserver().observe(this, new Observer<Movie>() { @Override public void onChanged(@Nullable Movie movie) { if (movie == null) { isMarkedFavorite = false; } else { isMarkedFavorite = true; } setMarkAsFavoriteBtn(); } }); didUserMarkThisMovieAsFavorite(); movieDetailsViewModel.movieReviewsObserver().observe(this, new Observer<List<Review>>() { @Override public void onChanged(@Nullable List<Review> reviews) { Log.d(TAG, "onChanged: reviews : " + reviews.toString()); if (reviews.size() == 0) { no_reviews.setVisibility(View.VISIBLE); } else { no_reviews.setVisibility(View.GONE); } mReviewAdapter.setReviews(reviews); } }); movieDetailsViewModel.movieTrailersObserver().observe(this, new Observer<List<MovieTrailer>>() { @Override public void onChanged(@Nullable List<MovieTrailer> movieTrailers) { Log.d(TAG, "onChanged: trailers : " + movieTrailers.toString()); if (movieTrailers.size() == 0) { no_trailers.setVisibility(View.VISIBLE); } else { no_trailers.setVisibility(View.GONE); } mTrailerAdapter.setTrailerList(movieTrailers); } }); } } /** * 현재 문제점 * 메인액티비티에서 popular에서 details Activity 로 갔다가 메인으로 * 되돌아오면 favorites 가 목록에 보인다. * -> 문제 해결 */ private void didUserMarkThisMovieAsFavorite() { if(mMovie != null) movieDetailsViewModel.getMovieByTitle(mMovie.getOriginal_title()); } private void getIntentFromMainActivity() { if(getIntent().hasExtra(getString(R.string.movie))) { mMovie = getIntent().getParcelableExtra(getString(R.string.movie)); Log.d(TAG, "onCreate: poster : " + mMovie.toString()); } } private void initUI() { release_date = findViewById(R.id.release_date); vote_average = findViewById(R.id.vote_average); plot_synopsis = findViewById(R.id.plot_synopsis); poster_image = findViewById(R.id.poster_image); mark_as_favorite = findViewById(R.id.mark_as_favorite); no_reviews = findViewById(R.id.noReviewNoticeText); no_trailers = findViewById(R.id.noTrailersNoticeText); reviewRecyclerView = findViewById(R.id.reviewsRecyclerView); reviewRecyclerView.setLayoutManager(new LinearLayoutManager(this)); reviewRecyclerView.setNestedScrollingEnabled(false); mReviewAdapter = new MovieReviewsAdapter(this, this); reviewRecyclerView.setAdapter(mReviewAdapter); trailersRecyclerView = findViewById(R.id.trailerRecyclerView); trailersRecyclerView.setLayoutManager(new LinearLayoutManager(this)); trailersRecyclerView.setNestedScrollingEnabled(false); mTrailerAdapter = new MovieTrailersAdapter(this); trailersRecyclerView.setAdapter(mTrailerAdapter); if(mMovie != null) { setTitle(mMovie.getOriginal_title()); vote_average.setText(String.valueOf(mMovie.getVote_average())); release_date.setText(mMovie.getRelease_date()); plot_synopsis.setText(mMovie.getOverview()); Picasso.get() .load(Constants.MOVIE_POSTER_IMAGE_PATH + mMovie.getPoster_path()) .into(poster_image); } mark_as_favorite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "onClick: isMarkedFavorite : " + isMarkedFavorite); if(mMovie != null && !isMarkedFavorite) { Date date = new Date(); mMovie.setUpdatedAt(date); movieDetailsViewModel.insertFavoriteMovie(mMovie); isMarkedFavorite = true; } else if(mMovie != null && isMarkedFavorite) { Date date = new Date(); mMovie.setUpdatedAt(date); movieDetailsViewModel.unFavoriteMovie(mMovie); isMarkedFavorite = false; } setMarkAsFavoriteBtn(); } }); } private void setMarkAsFavoriteBtn() { if(isMarkedFavorite) { mark_as_favorite.setText(R.string.mark_as_unfavorite); mark_as_favorite.setBackgroundColor(getResources().getColor(R.color.colorGrey)); } else { mark_as_favorite.setText(R.string.mark_as_favorite); mark_as_favorite.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); } } @Override public void onTrailerItemClicked(String key) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.YOUTUBE_VIDEO_URL + key)); startActivity(intent); } @Override public void onReviewItemClicked(String itemId) { } }
[ "lemix777@naver.com" ]
lemix777@naver.com
c18b9756364586885229713e61b0837ddff26ea9
c28c5709714f2f475964e001c4847c97e0453e5f
/services/src/main/java/org/usergrid/security/tokens/exceptions/ExpiredTokenException.java
f1a4e0005fb19f19563c008b7e8a405d055aeec9
[ "Apache-2.0" ]
permissive
futur/usergrid-stack
230062f37ba2fba2e5b98abc03fa28b4ab8c7a19
26a08f2aea4822a974f9ceef05da38b9c5639a96
refs/heads/master
2021-01-18T04:16:34.359879
2012-07-20T21:00:54
2012-07-20T21:00:54
5,169,813
1
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
/******************************************************************************* * Copyright 2012 Apigee Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package org.usergrid.security.tokens.exceptions; public class ExpiredTokenException extends TokenException { private static final long serialVersionUID = 1L; public ExpiredTokenException() { super(); } public ExpiredTokenException(String arg0, Throwable arg1) { super(arg0, arg1); } public ExpiredTokenException(String arg0) { super(arg0); } public ExpiredTokenException(Throwable arg0) { super(arg0); } }
[ "ed@anuff.com" ]
ed@anuff.com
fe75e721b174d928eea316b8f852690012db70c5
b99ededa22af2e22e05d33ccaee326e350c6aca3
/demo/src/main/java/com/example/demo/controller/HomeController.java
55b490bbbf42525518c8060cecf0f4a978c5a86b
[]
no_license
InwooJeong/BusanIT_SpringUnion
47d3c76765a8c32ac74ad497b2ec9e9f203b38c7
d3311b2b16f97d4043750dda61502f333052a90f
refs/heads/master
2023-08-23T16:50:09.239324
2021-11-04T01:36:00
2021-11-04T01:36:00
424,424,517
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.example.demo.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @Controller public class HomeController { @GetMapping("/") public String home(){ return "home"; } @GetMapping("/login") public String login() { return "/user/login"; } }
[ "sinth92@hotmail.com" ]
sinth92@hotmail.com
a3dd1e63d2bd40e7fd2b7d12be26e5a0418ab8de
8c76aba03b6c6426d961131946ea2e4337dbc6bf
/src/main/java/com/vigekoo/manage/sys/shiro/ShiroRealm.java
b58a7764e406946950affdc19856004a0f6794bf
[]
no_license
ljx2394972032/my_manage
aba0a1dc9afb7a7fde822123aa9297d6a1e7ce2f
e0c3253724763fcc6df80df66b7b081499304969
refs/heads/master
2020-03-21T17:41:47.733471
2018-06-27T07:43:49
2018-06-27T07:43:49
138,847,532
1
1
null
null
null
null
UTF-8
Java
false
false
2,512
java
package com.vigekoo.manage.sys.shiro; import com.vigekoo.manage.sys.constants.Constant; import com.vigekoo.manage.sys.entity.SysUser; import com.vigekoo.manage.sys.entity.SysUserToken; import com.vigekoo.manage.sys.service.SysUserService; import com.vigekoo.manage.sys.service.SysUserTokenService; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Set; /** * @author ljx * @Description: (认证) * @date 2017-6-23 15:07 */ @Component public class ShiroRealm extends AuthorizingRealm { @Autowired private SysUserService sysUserService; @Autowired private SysUserTokenService sysUserTokenService; @Override public boolean supports(AuthenticationToken token) { return token instanceof ShiroToken; } /** * 授权 */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { SysUser user = (SysUser) principals.getPrimaryPrincipal(); Long userId = user.getId(); //用户权限列表 Set<String> permsSet = sysUserService.getUserPermissions(userId); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); info.setStringPermissions(permsSet); return info; } /** * 认证 */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) { String accessToken = (String) token.getPrincipal(); //根据accessToken,查询用户信息 SysUserToken tokenEntity = sysUserTokenService.queryByToken(accessToken); //token失效 if (tokenEntity == null || tokenEntity.getExpireTime() == null || tokenEntity.getExpireTime().getTime() < System.currentTimeMillis()) { throw new IncorrectCredentialsException("token失效,请重新登录"); } //查询用户信息 SysUser user = sysUserService.queryObject(tokenEntity.getUserId()); //账号锁定 if (Constant.UserStatus.DISABLE.getValue() == user.getStatus()) { throw new LockedAccountException("账号已被锁定,请联系管理员"); } return new SimpleAuthenticationInfo(user, accessToken, getName()); } }
[ "30718142+ljx2394972032@users.noreply.github.com" ]
30718142+ljx2394972032@users.noreply.github.com
7c47443d97808e2da2a0f2b30e5af507c088f34f
78873b1d0d8bb2a3748256d06e755ddf9e38db10
/src/au/com/ball41/base/model/AutonomousBlockV1.java
e46ea00a641de2351d321042e63876f8ce31d1f2
[]
no_license
seren1ty/bomberfx
53c35db14de561c4a753c00d6e58f861ca8d4c75
a1445b1ef99e995172a3c1088aea2cc68bda73c8
refs/heads/master
2020-03-14T09:35:52.849970
2018-04-30T02:34:46
2018-04-30T02:34:46
131,547,846
0
0
null
null
null
null
UTF-8
Java
false
false
13,780
java
package au.com.ball41.base.model; import static au.com.ball41.base.model.Direction.DOWN; import static au.com.ball41.base.model.Direction.LEFT; import static au.com.ball41.base.model.Direction.RIGHT; import static au.com.ball41.base.model.Direction.UP; import static au.com.ball41.base.model.Direction.getXForDirection; import static au.com.ball41.base.model.Direction.getYForDirection; import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; public class AutonomousBlockV1 extends MovableBlock implements Runnable { enum DirectionPriorityType { NORMAL(1), PICKUP(5), TARGET(10); private int mPriorityIncreaseFactor; private DirectionPriorityType(int inPriorityIncreaseFactor) { mPriorityIncreaseFactor = inPriorityIncreaseFactor; } public int getPriorityIncreaseFactor() { return mPriorityIncreaseFactor; } } private class DirectionPriority { private Map<Direction, Integer> mDirectionCount = new HashMap<Direction, Integer>(); public DirectionPriority() { mDirectionCount.put(Direction.UP, 0); mDirectionCount.put(Direction.RIGHT, 0); mDirectionCount.put(Direction.DOWN, 0); mDirectionCount.put(Direction.LEFT, 0); } public void increase(Direction inDirection) { increase(inDirection, DirectionPriorityType.NORMAL); } public void increase(Direction inDirection, DirectionPriorityType inPriorityType) { mDirectionCount.put(inDirection, mDirectionCount.get(inDirection) + inPriorityType.getPriorityIncreaseFactor()); } public int getCount(Direction inDirection) { return mDirectionCount.get(inDirection); } public Direction getDirectionOfPriority(Set<Direction> inDangerousDirections, Priority inPriority) { Direction highestDirection = null; for (Direction currDir : mDirectionCount.keySet()) { if (inDangerousDirections.contains(currDir)) continue; if (highestDirection == null) { highestDirection = currDir; continue; } if (mDirectionCount.get(highestDirection) < mDirectionCount.get(currDir)) highestDirection = currDir; else if (mDirectionCount.get(highestDirection) == mDirectionCount.get(currDir)) highestDirection = (Math.random() * 10.0) > 5.0 ? highestDirection : currDir; } if (inPriority == Priority.IN_DANGER || inPriority == Priority.ATTACKING) return highestDirection; else return (Math.random() * 10.0) > 7.0 ? highestDirection : null; } } private enum Priority { IN_DANGER, ATTACKING, PICKUP, EXPLORE, DROP_BOMB; } private class BotState { private Priority mPriority; private DirectionPriority mDirectionPriority; private Set<Direction> mDangerousDirections; private Set<Direction> mBlockedDirections; public BotState() { mPriority = Priority.EXPLORE; mDirectionPriority = new DirectionPriority(); mDangerousDirections = new HashSet<Direction>(); mBlockedDirections = new HashSet<Direction>(); } public void setPriority(Priority priority) { mPriority = priority; } public Priority getPriority() { return mPriority; } public DirectionPriority getDirectionPriority() { return mDirectionPriority; } void addDangerousDirection(Direction inDirection) { mDangerousDirections.add(inDirection); } public Set<Direction> getDangerousDirections() { return mDangerousDirections; } public boolean isSafe(Direction inDirection) { return !getDangerousDirections().contains(inDirection); } private void addBlockedDirection(Direction inDirection) { mBlockedDirections.add(inDirection); } public boolean isNotBlockedAlready(Direction inDirection) { return !mBlockedDirections.contains(inDirection); } } private static final int PAUSE_TIME = 250; private static final int MAX_DEPTH = 10; private static final List<Direction> DIRECTIONS = new ArrayList<Direction>(Arrays.asList(UP, RIGHT, DOWN, LEFT)); private BotPlatform mPlatform; private boolean mActive; private int mLastBombIdNum; private boolean mCarefulModeActive; public AutonomousBlockV1(BotPlatform inPlatform, int inCurrentX, int inCurrentY, Type inType, int inIdNum, float inSpeed, Color inColor) { super(inCurrentX, inCurrentY, inType, inIdNum, inSpeed, inColor); mLastBombIdNum = -1; mPlatform = inPlatform; mActive = true; new Thread(this).start(); } public void run() { // Looping to determine next move while (platformActive() && isAlive()) handleBehaviour(); } private boolean platformActive() { return mActive; } private void handleBehaviour() { /* * v1 * * check x and y for danger (within a certain range?) if danger/bomb found then move determine reach of bomb check for * exits move to an exit (priority 1) * * if no danger then look for players if player found attack move to within range (priority 2) * * if no player found then look for pickups if pickup found go for pickup move to pickup (priority 3) * * if no pickups found then check surrounding blocks (crosshatch, then diagonal) and blowup drop bomb check for exits move * to an exit (priority 1) */ /* * v2 * * scan whole map generate 3 tiers of direction choices/priorities tier 3: general goal (eg. enemy player or pickup is * north of me = up is a priority) tier 2: surrounding area (eg. bomb is ticking on the above adjacent row = up is * dangerous) 2c: 3 rows up, right, down, left (lowest tier 2 influence) 2b: 2 rows up, right, down, left 2a: 1 row up, * right, down, left (highest tier 2 influence) tier 1: immediate/line of sight (eg. a bomb is ticking left of me on my row * = left is out, up is out, move right or down) use these direction priorities to decide final move */ /** * Path recognition plot paths to a certain depth add each path to a map with the key being the end goal either a Map of * List of possible paths, maybe prioritised OR a Map of the best path to each goal type if tied with another choice, try * to reuse/continue on last used path does path lead onto row/column of timer item, then its dangerous is the path blocked * how deep is the path (distance to goal) shorter paths would be prioritised only need enough info to decide on one of the * 4 initial directions/moves must recalculate path every time */ BotState state = new BotState(); // Depth of available positions in each direction for (int currentDepth = 1; currentDepth <= MAX_DEPTH; currentDepth++) { for (Direction inCurrDirection : DIRECTIONS) { scout(state, inCurrDirection, currentDepth); } } // If only one direction has >= 1 available spaces, activate CAREFUL_MODE checkIfCareNeeded(state); // When in CAREFUL_MODE, only drop a new bomb after the current one has exploded (i.e. check with getBomb(mLastBombId)) System.out.println("Acting: " + getIdNum() + ", priority: " + state.getPriority()); // Sort clear counts and move in that direction if priority is IN_DANGER // if (state.getPriority() == Priority.IN_DANGER) if (state.getPriority() == Priority.DROP_BOMB) { dropBomb(); state.setPriority(Priority.IN_DANGER); } Direction directionOfPriority = state.getDirectionPriority().getDirectionOfPriority(state.getDangerousDirections(), state.getPriority()); if (directionOfPriority != null) move(directionOfPriority); state.setPriority(Priority.EXPLORE); pause(); } private void checkIfCareNeeded(BotState inState) { int numOfRoomyDirections = 0; for (Direction currDirection : DIRECTIONS) { if (inState.getDirectionPriority().getCount(currDirection) >= 2) numOfRoomyDirections++; } if (numOfRoomyDirections <= 1) mCarefulModeActive = true; else mCarefulModeActive = false; } private void dropBomb() { if (mCarefulModeActive && getBomb(mLastBombIdNum) != null) return; System.out.println("Bomb dropped by bot: " + getIdNum()); mLastBombIdNum = mPlatform.dropBomb(getIdNum()); mPlatform.showBomb(getIdNum(), mLastBombIdNum); } private void scout(BotState inState, Direction inDirection, int inDepth) { // direction is dangerous OR direction was previously blocked if (inState.isSafe(inDirection) && inState.isNotBlockedAlready(inDirection)) { int newX = getXForDirection(getCurrentX(), inDirection, inDepth); int newY = getYForDirection(getCurrentY(), inDirection, inDepth); if (!mPlatform.isValidPosition(newX, newY)) { System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - NOT_VALID"); return; } Block blockAtPosition = mPlatform.getBlockAtPosition(newX, newY); if (blockAtPosition == null) // Available { System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - NULL_SPACE"); inState.getDirectionPriority().increase(inDirection); } else if (blockAtPosition.getType() == Type.PICKUP_BOMB || blockAtPosition.getType() == Type.PICKUP_FLAME) { if (inState.getPriority() == Priority.IN_DANGER) return; System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - FOUND_PICKUP"); // inState.setPriority(Priority.PICKUP); inState.getDirectionPriority().increase(inDirection, DirectionPriorityType.PICKUP); } else if (blockAtPosition.getType() == Type.PLAYER || blockAtPosition.getType() == Type.BOT) { if (inState.getPriority() == Priority.IN_DANGER) return; System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - FOUND_TARGET"); if (inDepth < getBombsReach()) { inState.setPriority(Priority.DROP_BOMB); } else { inState.setPriority(Priority.ATTACKING); inState.getDirectionPriority().increase(inDirection, DirectionPriorityType.TARGET); } } else if (blockAtPosition.getType() == Type.BOMB) { System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - FOUND_BOMB"); inState.setPriority(Priority.IN_DANGER); inState.addDangerousDirection(inDirection); } else if (blockAtPosition.getType() == Type.EXPLOSION) { System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - FOUND_EXPLOSION"); inState.addDangerousDirection(inDirection); } else if (blockAtPosition.getType() == Type.FIXED) { System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - BREAKABLE_BLOCK"); if (inDepth < getBombsReach()) inState.setPriority(Priority.DROP_BOMB); else inState.addBlockedDirection(inDirection); } else { // If fixed solid block, add to blocked directions... System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - SOLID_BLOCK"); inState.addBlockedDirection(inDirection); } } else { System.out.println("Depth: " + inDepth + ", Direction: " + inDirection + " - DIRECTION_OUT"); } } private void move(Direction inDirection) { if (inDirection == null) return; System.out.println("Moving bot: " + getIdNum()); mPlatform.moveBot(getIdNum(), getCurrentX(), getCurrentY(), inDirection); } private void pause() { try { Thread.sleep(PAUSE_TIME); } catch (InterruptedException ex) { ex.printStackTrace(); Logger.getLogger(ActionBlock.class.getName()).log(Level.SEVERE, null, ex); } } public void stop() { mActive = false; } }
[ "ball41@y7mail.com" ]
ball41@y7mail.com
55be138327ad163517ee40a02829681db40d9f56
c7a32973cb35160c65d7c722135b19b924288e42
/bungeeDBcompile/edu/cmu/cs/bungee/compile/Compile.java
ce1d4f05e9a77c24477b2bf1f0b9a214d86ffa6c
[]
no_license
derthick/bungee-view
f70c5e3df1f2f81f818949fe384ce32282157eb0
452d95b022c928da44daa01fa65867c651ae569b
refs/heads/master
2021-01-01T05:46:22.250420
2016-05-05T19:20:01
2016-05-05T19:20:01
58,075,795
0
0
null
null
null
null
UTF-8
Java
false
false
54,330
java
package edu.cmu.cs.bungee.compile; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; import org.eclipse.jdt.annotation.NonNull; import edu.cmu.cs.bungee.javaExtensions.FormattedTableBuilder; //import edu.cmu.cs.bungee.javaExtensions.FormattedTableBuilder.Justification; import edu.cmu.cs.bungee.javaExtensions.JDBCSample; import edu.cmu.cs.bungee.javaExtensions.MyLogger; import edu.cmu.cs.bungee.javaExtensions.MyResultSet; import edu.cmu.cs.bungee.javaExtensions.Util; import edu.cmu.cs.bungee.javaExtensions.UtilString; import edu.cmu.cs.bungee.javaExtensions.psk.cmdline.ApplicationSettings; import edu.cmu.cs.bungee.javaExtensions.psk.cmdline.StringToken; import edu.cmu.cs.bungee.javaExtensions.psk.cmdline.Token; public class Compile { public static final @NonNull String FACET_HIERARCHY_SEPARATOR = " -- "; private static final int MAX_ERRORS_TO_PRINT = 8; private static final int MIN_FACETS = 1000; private static final double MAX_CORRELATION_QUERY_INTERMEDIATE_ROWS = 2_000_000_000; private static final int MAX_HEAP_TABLE_ROWS = 1_000_000; private static final String[] TEMPORARY_TABLES = { "relevantFacets", "onItems", "restricted", "renames", "random_item_ID", "duplicates", "temp", "rawItemCounts" }; private final @NonNull JDBCSample jdbc; private final Database db; private String item_idType; private String countType; private String facet_idType; private static final StringToken SM_DB = new StringToken("db", "database to compile", "", Token.optRequired | Token.optSwitch, ""); private static final StringToken SM_SERVER = new StringToken("servre", "MySQL server", "", Token.optSwitch, "jdbc:mysql://localhost/"); private static final StringToken SM_USER = new StringToken("user", "MySQL user", "", Token.optSwitch, "bungee"); private static final StringToken SM_PASS = new StringToken("pass", "MySQL user password", "", Token.optSwitch, "p5pass"); private static final ApplicationSettings SM_MAIN = new ApplicationSettings(); static { // try { SM_MAIN.addToken(SM_DB); SM_MAIN.addToken(SM_SERVER); SM_MAIN.addToken(SM_USER); SM_MAIN.addToken(SM_PASS); // } catch (final Throwable t) { // JDBCSample.logp("Got error", MyLogger.SEVERE, t, "static // initialization"); // throw t; // } } public static void main(final String[] args) throws SQLException { if (SM_MAIN.parseArgs(args)) { final Compile compile = new Compile(Util.nonNull(SM_SERVER.getValue()), Util.nonNull(SM_DB.getValue()), Util.nonNull(SM_USER.getValue()), Util.nonNull(SM_PASS.getValue())); // final Level oldLevel = MyLogger.getLevel(); // MyLogger.setLevel(MyLogger.INFO); compile.compile(false); compile.jdbc.close(); // MyLogger.setLevel(oldLevel); } } public static void maybeCreateCorrelationsTable(final @NonNull JDBCSample jdbc) throws SQLException { final Compile compile = new Compile(jdbc); compile.maybeCreateCorrelationsTable(false); } private Compile(final @NonNull String _server, final @NonNull String _db, final @NonNull String _user, final @NonNull String _pass) throws SQLException { this(JDBCSample.getMySqlJDBCSample(_server, _db, _user, _pass)); } public Compile(final @NonNull JDBCSample _jdbc) throws SQLException { jdbc = _jdbc; db = new Database(jdbc, false); } public Compile(final Database _db) { db = _db; jdbc = db.getJdbc(); } public void compile(final boolean dontComputeCorrelations) throws SQLException { UtilString.printDateNmessage( "Compile.compile " + jdbc.dbName + " dontComputeCorrelations=" + dontComputeCorrelations); jdbc.setCollation(JDBCSample.COLLATE); dropObsoleteTables(jdbc); while (checkRawErrors() > 0) { // After all, tomorrow is another day. } summarize(); createTemp(); computeIDs(); computeIDtypes(); createFacet(); createItemFacet(); createItemOrder(); createUserActions(); setUpFacetSearch(); checkOutputTables(); maybeCreateCorrelationsTable(dontComputeCorrelations); jdbc.setCollation(JDBCSample.COLLATE); cleanUp(); UtilString.printDateNmessage("Compile.compile Done.\n"); } private void checkOutputTables() throws SQLException { UtilString.printDateNmessage("Checking output tables for errors..."); final int nErrors = findBrokenLinks(false); UtilString.printDateNmessage("...found " + nErrors + " errors in output tables."); } private void cleanUp() throws SQLException { UtilString.printDateNmessage("Cleaning up..."); jdbc.dropAndCreateTable("facet_map", "AS SELECT facet_id raw_facet_id, canonical_facet_id, sort" + " FROM temp INNER JOIN raw_facet USING (facet_id)"); jdbc.sqlUpdate("ALTER TABLE facet_map" + " ADD PRIMARY KEY (canonical_facet_id)"); // In case we've created non-temporary versions for debugging for (final String tempTable : TEMPORARY_TABLES) { jdbc.dropTable(tempTable); } jdbc.sqlUpdate("DROP INDEX `PRIMARY` ON raw_item_facet"); jdbc.sqlUpdate("DROP INDEX `facet` ON raw_item_facet"); optimizeTables(); } private void maybeCreateCorrelationsTable(boolean dontComputeCorrelations) throws SQLException { if (!dontComputeCorrelations) { // Use doubles to avoid overflow final double nItemFacets = jdbc.nRows("item_facetNtype_heap"); final double nItemsPerFacet = nItemFacets / jdbc.nRows("facet"); dontComputeCorrelations = nItemFacets * nItemsPerFacet > MAX_CORRELATION_QUERY_INTERMEDIATE_ROWS; if (dontComputeCorrelations) { System.err.println("Not computing correlations because " + jdbc.dbName + " nItemFacets=" + nItemFacets + " and nItemsPerFacet=" + nItemsPerFacet + "; product is " + (nItemFacets * nItemsPerFacet) + " vs. MAX_CORRELATION_QUERY_INTERMEDIATE_ROWS=" + MAX_CORRELATION_QUERY_INTERMEDIATE_ROWS); } } if (!dontComputeCorrelations) { createCorrelationsTable(); populateCorrelations(); } else { jdbc.dropTable("correlations"); } } private void createCorrelationsTable() throws SQLException { if (facet_idType == null) { final int maxFacetID = jdbc.sqlQueryInt("SELECT MAX(facet_id) FROM facet"); facet_idType = JDBCSample.unsignedTypeForMaxValue(Math.max(MIN_FACETS, maxFacetID)) + " NOT NULL"; } jdbc.dropAndCreateTable("correlations", "(facet1 " + facet_idType + ", facet2 " + facet_idType + ", correlation FLOAT NOT NULL, " + "KEY facet1 (facet1), KEY facet2 (facet2))" + "ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=FIXED"); } private void populateCorrelations() throws SQLException { UtilString.printDateNmessage("Finding pair correlations..."); jdbc.sqlUpdate("DROP FUNCTION IF EXISTS correlation"); final int nItems = jdbc.sqlQueryInt("SELECT COUNT(*) FROM item"); jdbc.sqlUpdate("CREATE FUNCTION correlation(n1 INT, n2 INT, n12 INT) " + " RETURNS FLOAT DETERMINISTIC NO SQL " + "BEGIN " + " DECLARE p1 FLOAT DEFAULT n1/" + nItems + "; " + " DECLARE p2 FLOAT DEFAULT n2/" + nItems + "; " + " DECLARE p12 FLOAT DEFAULT n12/" + nItems + "; " + " DECLARE num FLOAT DEFAULT p12 - p1*p2; " + " RETURN IF(num=0, 0, num/SQRT((p1-p1*p1)*(p2-p2*p2))); " + "END"); // ensureDBinitted(); final String[][] itemFacetTablePairs = { { "item_facetNtype_heap", "item_facetNtype_heap" }, }; for (final String[] itemFacetTablePair : itemFacetTablePairs) { jdbc.sqlUpdate("INSERT INTO correlations " + "SELECT itemFacetTable1.facet_id, itemFacetTable2.facet_id," + " correlation(facet1.n_items, facet2.n_items, COUNT(*)) correlation " + "FROM " + itemFacetTablePair[0] + " itemFacetTable1 INNER JOIN " + itemFacetTablePair[1] + " itemFacetTable2 USING (record_num) " + "INNER JOIN facet facet1 ON facet1.facet_id = itemFacetTable1.facet_id " + "INNER JOIN facet facet2 ON facet2.facet_id = itemFacetTable2.facet_id " + "WHERE itemFacetTable1.facet_id < itemFacetTable2.facet_id " + "GROUP BY itemFacetTable1.facet_id, itemFacetTable2.facet_id " + "HAVING correlation != 0"); } jdbc.sqlUpdate("DROP FUNCTION correlation"); } private void computeIDtypes() throws SQLException { final boolean isTemp = jdbc.tableExists("temp"); final int maxItemID = jdbc.sqlQueryInt("SELECT MAX(record_num) FROM item"); item_idType = JDBCSample.unsignedTypeForMaxValue(maxItemID); final int nCounts = jdbc.sqlQueryInt("SELECT MAX(cnt) FROM rawItemCounts" // + "INNER JOIN raw_facet_type ft ON f.facet_type_idxx = // ft.facet_type_id " // + "WHERE ft.sort > 0" ); countType = JDBCSample.unsignedTypeForMaxValue(nCounts); final int maxFacetID = jdbc.sqlQueryInt( isTemp ? "SELECT MAX(canonical_facet_id) FROM temp" : "SELECT MAX(facet_id) FROM raw_facet"); facet_idType = JDBCSample.unsignedTypeForMaxValue(Math.max(MIN_FACETS, maxFacetID)) + " NOT NULL"; final FormattedTableBuilder align = new FormattedTableBuilder(); // final DecimalFormat myFormatter = new DecimalFormat("###,###,##0"); // align.addLine("countType:", myFormatter.format(nCounts), countType); // align.addLine("tagType:", myFormatter.format(maxFacetID), // facet_idType); // align.addLine("itemType:", myFormatter.format(maxItemID), // item_idType); align.addLine("countType:", nCounts, countType); align.addLine("tagType:", maxFacetID, facet_idType); align.addLine("itemType:", maxItemID, item_idType); // align.setColumnJustification(0, Justification.RIGHT); // align.setColumnJustification(1, Justification.RIGHT); System.out.println(align.format()); } private void optimizeTables() throws SQLException { final String[] tables = "correlations, facet, images, item, item_facet, item_order, user_actions" // , raw_facet, raw_facet_type, raw_item_facet .split(","); for (final String table : tables) { // correlations may not exist if (jdbc.tableExists(table)) { UtilString.printDateNmessage("Optimizing " + table); jdbc.sqlUpdate("OPTIMIZE TABLE " + table); } } UtilString.printDateNmessage("Optimizing done."); } public static void dropObsoleteTables(final @NonNull JDBCSample jdbc) throws SQLException { final String[] obsolete = { "pairs", "temp", "tetrad_facets", "tetrad_items", "ancestor" }; for (final String table : obsolete) { jdbc.dropTable(table); } } private static final @NonNull String SUMMARIZE_SQL = "SELECT IF(sort < 0 OR nChildren < 1, ' no', ' yes') include, descendents," + "nChildren n_children, name, minTag, maxTag FROM" + " (SELECT raw_facet_type.sort, IF(raw_facet.parent_facet_id IS NULL, 0, COUNT(*)) nChildren," + " IF(descendents IS NULL, 0, descendents) descendents," + " raw_facet_type.name name," // + // " SUBSTRING_INDEX(GROUP_CONCAT(raw_facet.name SEPARATOR '%$%'), // '%$%', 3) example" + " SUBSTRING_INDEX(GROUP_CONCAT(raw_facet.name ORDER BY raw_facet.sort, raw_facet.name SEPARATOR '%$%'), '%$%', 1) minTag," + " SUBSTRING_INDEX(GROUP_CONCAT(raw_facet.name ORDER BY raw_facet.sort DESC, raw_facet.name DESC SEPARATOR '%$%'), '%$%', 1) maxTag" // + " LEFT(MIN(raw_facet.name), 20) minTag," // + " LEFT(MAX(raw_facet.name), 20) maxTag" + " FROM raw_facet_type" + " LEFT JOIN raw_facet ON raw_facet.parent_facet_id = raw_facet_type.facet_type_id" + " LEFT JOIN FacetTypeDescendents ON raw_facet_type.facet_type_id = FacetTypeDescendents.facet_type_id" + " GROUP BY raw_facet_type.facet_type_id) foo " + "ORDER BY sort"; private void summarize() throws SQLException { createFacet2FacetType(); System.out.println("\n\n\n\n"); printErrors(SUMMARIZE_SQL, "Summary:", "Include?,Descendents,Children,Facet,Min Child,Max Child\n", Integer.MAX_VALUE, Integer.MAX_VALUE); System.out.println("\n\n\n\n"); jdbc.dropTable("Facet2FacetType"); jdbc.dropTable("FacetTypeDescendents"); } private void createFacet2FacetType() throws SQLException { jdbc.dropAndCreateTable("Facet2FacetType", "(facet_id INT UNSIGNED NOT NULL DEFAULT 0," + " facet_type_id INT UNSIGNED NOT NULL DEFAULT 0," + " PRIMARY KEY (facet_id)" + " ) ENGINE=MyISAM"); @SuppressWarnings("resource") final PreparedStatement ps = jdbc.lookupPS("INSERT INTO Facet2FacetType VALUES (?, ?)"); try (ResultSet rs = jdbc.sqlQuery("SELECT facet_id FROM raw_facet");) { while (rs.next()) { final int facet_id = rs.getInt(1); final int facet_type_ID = db.getRawFacetType(facet_id); jdbc.sqlUpdateWithIntArgs(ps, facet_id, facet_type_ID); } } jdbc.dropAndCreateTable("FacetTypeDescendents", "(facet_type_id INT UNSIGNED NOT NULL DEFAULT 0," + "descendents INT UNSIGNED NOT NULL DEFAULT 0," + " PRIMARY KEY (facet_type_id)" + " ) ENGINE=MyISAM"); jdbc.sqlUpdate( "INSERT INTO FacetTypeDescendents (SELECT facet_type_id, COUNT(*) FROM Facet2FacetType GROUP BY facet_type_id)"); } private void createTemp() throws SQLException { // System.out.println("Creating temp..."); // Can't make this temporary, or you get "can't reopen table foo" // errors. jdbc.dropAndCreateTable("temp", "(facet_id INT UNSIGNED NOT NULL DEFAULT 0," + " name VARCHAR(255) NOT NULL," // Increasing varcharsize above 255 slows things waaaay // down + " parent_facet_id INT UNSIGNED NOT NULL DEFAULT 0," + " canonical_facet_id INT UNSIGNED NOT NULL DEFAULT 0," + " n_child_facets INT NOT NULL DEFAULT 0," + " children_offset INT NOT NULL DEFAULT 0," + " PRIMARY KEY (facet_id), KEY parent_facet_id (parent_facet_id )" // + ", KEY name (name)" + " ) ENGINE=Memory"); } /** * temp is: facet_id, name, parent_facet_id, canonical_facet_id, * n_child_facets, children_offset */ private void computeIDs() throws SQLException { jdbc.sqlUpdate("DROP PROCEDURE IF EXISTS computeIDs"); jdbc.sqlUpdate( "CREATE PROCEDURE computeIDs(parent INT, grandparent INT, canonicalID INT, parent_name VARCHAR(255)) " + "BEGIN " + " DECLARE done INT DEFAULT 0; " + " DECLARE child, nChildren, childOffset INT DEFAULT 0; " + " DECLARE child_name VARCHAR(255); " + " DECLARE cur CURSOR FOR SELECT facet_id, name FROM raw_facet" + " WHERE parent_facet_id = parent ORDER BY sort, name;" + " DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; " + " SELECT COUNT(*) INTO nChildren FROM raw_facet WHERE parent_facet_id = parent; " + " SET childOffset = @child_offset; " + " INSERT INTO temp VALUES(parent, parent_name, grandparent, canonicalID, nChildren, childOffset);" + " SET @child_offset = @child_offset + nChildren; " + " OPEN cur; " + " REPEAT " + " FETCH cur INTO child, child_name; " + " IF NOT done THEN " + " SET childOffset = childOffset + 1; " + " CALL computeIDs(child, parent, childOffset, child_name);" + " END IF; " + " UNTIL done END REPEAT; " + " CLOSE cur; " + "END "); // Skip facet_types that have no children. try (final ResultSet rs0 = jdbc.sqlQuery(facetTypesWithNchildren("= 0")); final ResultSet rs = jdbc.sqlQuery(facetTypesWithNchildren("> 0"));) { if (MyResultSet.nRows(rs0) > 0) { System.err.println("Warning: raw_facet_type with no children:\n" + MyResultSet.valueOfDeep(rs0)); } final int nFacetTypes = MyResultSet.nRows(rs); jdbc.sqlUpdate("SET @child_offset = " + nFacetTypes + ", max_sp_recursion_depth = 100;"); int ID = 1; @SuppressWarnings("resource") final PreparedStatement computeIDs = jdbc.lookupPS("CALL computeIDs(?, 0, ?, ?)"); while (rs.next()) { // for each facetType computeIDs.setInt(1, rs.getInt("facet_type_id")); computeIDs.setInt(2, ID++); computeIDs.setString(3, rs.getString("name")); jdbc.sqlUpdate(computeIDs); } } jdbc.sqlUpdate("DROP PROCEDURE computeIDs"); } private static @NonNull String facetTypesWithNchildren(final @NonNull String nChildrenPredicate) { return "SELECT facet_type_id, raw_facet_type.name " + "FROM raw_facet_type " + "INNER JOIN raw_facet ON parent_facet_id = facet_type_id " + "WHERE raw_facet_type.sort >= 0 " + "GROUP BY facet_type_id " + "HAVING COUNT(*) " + nChildrenPredicate + " ORDER BY raw_facet_type.sort"; } /** * For every combination of * * grandparent -- nonrestrictingFacet -- grandchild * * (where nonrestrictingFacet.totalCount == grandparent.totalCount and * nonrestrictingFacet has no siblings) * * Delete nonrestrictingFacet and make each grandchild a direct child of * grandparent. */ int promoteNonrestrictingFacets() throws SQLException { UtilString.printDateNmessage("Finding non-restrictive facets..."); // fixMissingItemFacets(); // findBrokenLinks(); computeRawItemCounts(); computeIDtypes(); return promoteNonrestrictingFacetsInternal(); // computeIDtypes uses rawItemCounts; compile drops it // jdbc.sqlUpdate("DROP TABLE rawItemCounts"); } private static final @NonNull String NON_RESTRICTING_FACETS_QUERY = "(SELECT grandparent.facet_id AS grandparentID," + " nonrestrictingFacet.facet_id AS nonrestrictingFacetID," + " nonrestrictingFacet.name AS nonrestrictingFacetName, grandparent.sort AS grandparentSort" + " FROM raw_facet nonrestrictingFacet" + " INNER JOIN raw_facet grandparent ON nonrestrictingFacet.parent_facet_id = grandparent.facet_id" + " INNER JOIN rawItemCounts nonrestrictingFacetCounts ON nonrestrictingFacet.facet_id = nonrestrictingFacetCounts.facet_id" + " INNER JOIN rawItemCounts grandparentCounts ON grandparent.facet_id = grandparentCounts.facet_id" + " INNER JOIN raw_facetNtype_nChildren grandparentNchildren ON grandparent.facet_id = grandparentNchildren.facet_id" + " WHERE grandparentCounts.cnt = nonrestrictingFacetCounts.cnt" + " AND grandparentNchildren.nChildren = 1)" + " UNION " + "(SELECT grandparent.facet_type_id AS grandparentID," + " nonrestrictingFacet.facet_id AS nonrestrictingFacetID," + " nonrestrictingFacet.name AS nonrestrictingFacetName, grandparent.sort AS grandparentSort" + " FROM raw_facet nonrestrictingFacet" + " INNER JOIN raw_facet_type grandparent ON nonrestrictingFacet.parent_facet_id = grandparent.facet_type_id" + " INNER JOIN rawItemCounts nonrestrictingFacetCounts ON nonrestrictingFacet.facet_id = nonrestrictingFacetCounts.facet_id" + " INNER JOIN rawItemCounts grandparentCounts ON grandparent.facet_type_id = grandparentCounts.facet_id" + " INNER JOIN raw_facetNtype_nChildren grandparentNchildren ON grandparent.facet_type_id = grandparentNchildren.facet_id" + " WHERE grandparentCounts.cnt = nonrestrictingFacetCounts.cnt" + " AND grandparentNchildren.nChildren = 1)" // See whether this order eliminates the need to recurse + " ORDER BY nonrestrictingFacetID DESC"; @SuppressWarnings("resource") private int promoteNonrestrictingFacetsInternal() throws SQLException { final int nExternalChanges = db.mergeDuplicateFacets(); int nChanges = 0; jdbc.dropAndCreateTable("raw_facetNtype_nChildren", "(facet_id " + facet_idType + ", nChildren " + item_idType + ", PRIMARY KEY (facet_id)) ENGINE=Memory"); jdbc.sqlUpdate("INSERT INTO raw_facetNtype_nChildren (SELECT parent_facet_id, COUNT(*) FROM raw_facet" + " GROUP BY parent_facet_id)"); final PreparedStatement setSortPS = db.lookupPS("UPDATE raw_facet SET sort = ? WHERE parent_facet_id = ?"); final PreparedStatement getChildrenPS = db.lookupPS("SELECT facet_id FROM raw_facet WHERE parent_facet_id = ?"); try (final ResultSet rs = jdbc.sqlQuery(NON_RESTRICTING_FACETS_QUERY);) { printErrors(rs, "\nParent tag has exactly the same items as child", "Parent ID,Child ID,ChildName,Parent Sort"); while (rs.next()) { final int nonrestrictingFacetID = rs.getInt("nonrestrictingFacetID"); final int grandparentID = rs.getInt("grandparentID"); if (!db.facetOrTypeExists(grandparentID)) { // db.log("Can't promote " + grandparentID + "." // + nonrestrictingFacetID + " because " // + grandparentID + " has been deleted."); } else if (!db.facetOrTypeExists(nonrestrictingFacetID)) { // db.log("Can't promote " + grandparentID + "." // + nonrestrictingFacetID + " because " // + nonrestrictingFacetID + " has been deleted."); } else { setSortPS.setString(1, rs.getString("grandparentSort")); setSortPS.setInt(2, nonrestrictingFacetID); db.updateOrPrint(setSortPS, "Update sort"); getChildrenPS.setInt(1, nonrestrictingFacetID); try (final ResultSet getChildrenRS = jdbc.sqlQuery(getChildrenPS);) { if (MyResultSet.nRows(getChildrenRS) > 0) { while (getChildrenRS.next()) { final int childID = getChildrenRS.getInt("facet_id"); final String originalChildAncestors = db.rawAncestorString(childID); db.log("Promoting nonrestrictingFacet's child " + originalChildAncestors + "\n to be " + db.rawAncestorString(grandparentID) + "'s child..."); db.setParent(childID, grandparentID); db.log("...Promoted nonrestrictingFacet's child " + originalChildAncestors + "\n to " + db.rawAncestorString(childID)); } } else { final String nonrestrictingFacetPath = db.rawAncestorString(nonrestrictingFacetID); // If grandparent is a top-level facet, setName is a // no-op. db.setName(grandparentID, rs.getString("nonrestrictingFacetName")); db.log("Promoting nonrestrictingFacet " + nonrestrictingFacetPath + "\n to " + db.rawAncestorString(grandparentID)); } db.deleteFacet(nonrestrictingFacetID); nChanges++; } } } if (nChanges > 0) { UtilString.printDateNmessage("PopulateHandler.promoteNonrestrictingFacetsInternal deleted " + nChanges + " redundant facets; recursing"); // assert fixMissingItemFacets() == 0; // too slow nChanges += promoteNonrestrictingFacetsInternal(); } } jdbc.dropTable("raw_facetNtype_nChildren"); return nExternalChanges + nChanges; } /** * Populate rawItemCounts with counts for both raw_facet's and * raw_facet_type's. */ void computeRawItemCounts() throws SQLException { // UtilString.printDateNmessage("Computing item counts..."); jdbc.dropAndCreateTable("rawItemCounts", "(facet_id INT UNSIGNED NOT NULL," + " cnt INT UNSIGNED NOT NULL," + " PRIMARY KEY (facet_id)" + ") ENGINE=Memory"); jdbc.sqlUpdate("INSERT INTO rawItemCounts" + " SELECT raw_item_facet.facet_id, COUNT(*) cnt" + " FROM raw_item_facet" + " INNER JOIN raw_facet ON raw_facet.facet_id = raw_item_facet.facet_id" + " GROUP BY facet_id"); jdbc.sqlUpdate("INSERT INTO rawItemCounts" + " SELECT facet_type_id, COUNT(DISTINCT record_num) cnt" + " FROM raw_item_facet" + " INNER JOIN raw_facet USING (facet_id)" + " INNER JOIN raw_facet_type type ON type.facet_type_id = raw_facet.parent_facet_id" + " GROUP BY facet_type_id"); } private void createFacet() throws SQLException { UtilString.printDateNmessage("Creating facet..."); // facet_idType += " NOT NULL"; jdbc.dropAndCreateTable("facet", "(facet_id " + facet_idType + ", name VARCHAR(200) NOT NULL, " + "parent_facet_id " + facet_idType + ", n_items " + countType + ", n_child_facets " + facet_idType + ", first_child_offset " + facet_idType + ", is_alphabetic BIT NOT NULL, " + "PRIMARY KEY (facet_id), KEY parent USING BTREE (parent_facet_id) )" + "ENGINE=MyISAM PACK_KEYS=1"); // parent.canonical_facet_id and cnt will be NULL for facet types. jdbc.sqlUpdate("INSERT INTO facet " + "SELECT" + " child.canonical_facet_id AS facet_id," + " child.name," + " IFNULL(parent.canonical_facet_id, 0) AS parent_facet_id," + " IFNULL(cnt, 0) AS n_items," + " child.n_child_facets," + " IF(child.n_child_facets > 0, child.children_offset, 0)," + " TRUE AS is_alphabetic " + "FROM (temp child LEFT JOIN rawItemCounts USING (facet_id)) " + "LEFT JOIN temp parent ON child.parent_facet_id = parent.facet_id"); // compute is_alphabetic jdbc.sqlUpdate(" UPDATE facet," + " (SELECT DISTINCT parent.facet_id unalph" + " FROM facet child1, facet child2, facet parent" + " WHERE child1.parent_facet_id = parent.facet_id " + " AND child2.parent_facet_id = parent.facet_id " + " AND child2.facet_id = child1.facet_id + 1 " + " AND child2.name < child1.name) foo" + " SET is_alphabetic = FALSE WHERE facet_id = unalph"); } /** * Create and populate item_facet (doesn't include facet_types). * * Create and populate item_facetNtype_heap. * * Compute n_items for facet_types. */ private void createItemFacet() throws SQLException { UtilString.printDateNmessage("Creating itemFacet..."); createItemFacetTable("MyISAM", "item_facet"); jdbc.sqlUpdate("INSERT INTO item_facet SELECT record_num," + " canonical_facet_id AS facet_id" + " FROM raw_item_facet INNER JOIN temp USING (facet_id)" // + " WHERE canonical_facet_id > 0" ); createItemFacetHeap(); UtilString.printDateNmessage("Populating item_facetNtype_heap..."); populateHeapTable(jdbc, "item_facetNtype_heap", "item_facet"); UtilString.printDateNmessage("Computing facet counts..."); jdbc.sqlUpdate("UPDATE facet SET n_items = " + "(SELECT COUNT(*) FROM item_facetNtype_heap WHERE item_facetNtype_heap.facet_id = facet.facet_id) " + "WHERE facet.parent_facet_id = 0"); } /** * Use ENGINE=Memory if it will fit */ private void createItemFacetHeap() throws SQLException { UtilString.printDateNmessage("Creating MEMORY table item_facetNtype_heap..."); createItemFacetTable("MEMORY", "item_facetNtype_heap"); final int itemFacetNbytes = jdbc.sqlQueryInt("SELECT data_length FROM information_schema.TABLES" + " WHERE table_schema = '" + jdbc.dbName + "' AND table_name = 'item_facet'"); final int maxNbytes = jdbc.sqlQueryInt("SELECT max_data_length FROM information_schema.TABLES" + " WHERE table_schema = '" + jdbc.dbName + "' AND table_name = 'item_facetNtype_heap'"); // System.out.println("Compile.createItemFacetHeap max data size=" // + UtilString.addCommas(maxNbytes) // + " estimated itemFacetNbytes=" // + UtilString.addCommas(2 * itemFacetNbytes)); // 2 * allows for addition of facet_type relationships if (2 * itemFacetNbytes > maxNbytes) { UtilString.printDateNmessage("OOPS, too big. Creating VIEW item_facetNtype_heap..."); jdbc.dropTable("item_facetNtype_heap"); jdbc.sqlUpdate("CREATE VIEW item_facetNtype_heap AS SELECT * FROM item_facet"); } } private void createItemFacetTable(final @NonNull String engine, final @NonNull String table) throws SQLException { // UtilString.printDateNmessage("createItemFacetHeapInternal " + table // + " " + engine); jdbc.sqlUpdate("DROP VIEW IF EXISTS " + table); jdbc.dropAndCreateTable(table, "(record_num " + item_idType + ", facet_id " + facet_idType + ", PRIMARY KEY (record_num, facet_id)" + ", KEY facet (facet_id)" + (engine.equals("MyISAM") ? "" : ", KEY item (record_num)") + ") ENGINE=" + engine + " PACK_KEYS=1 ROW_FORMAT=FIXED"); } // public static void populateItemFacetNtypeHeap(final @NonNull JDBCSample // jdbc) throws SQLException { // if (jdbc.nRows("item_facetNtype_heap") == 0) { // jdbc.sqlUpdate("INSERT INTO item_facetNtype_heap SELECT * FROM // item_facet"); // // JDBCSample.errorp("item_facetNtype_heap has fewer rows than item_facet in // " + jdbc.dbName, // "Compile.populateItemFacetNtypeHeap"); // } // } public static boolean populateOrReplaceHeapTable(final @NonNull JDBCSample jdbc, final String heapTable, final String copyFrom, final @NonNull String replaceSQL) throws SQLException { boolean result = true; try { assert jdbc.nRows(copyFrom) < MAX_HEAP_TABLE_ROWS; result = populateHeapTable(jdbc, heapTable, copyFrom); } catch (final AssertionError e) { jdbc.logp("Changing " + heapTable + " from MEMORY to MyISAM in " + jdbc.dbName, MyLogger.WARNING, "Compile.populateOrReplaceHeapTable"); jdbc.renameTable(heapTable, heapTable + "_OLD"); jdbc.sqlUpdate(replaceSQL); populateHeapTable(jdbc, heapTable, copyFrom); } return result; } public static boolean populateHeapTable(final @NonNull JDBCSample jdbc, final String heapTable, final String copyFrom) throws SQLException { final boolean result = jdbc.nRows(heapTable) == 0; if (result) { jdbc.sqlUpdate("INSERT INTO " + heapTable + " SELECT * FROM " + copyFrom); if (jdbc.nRows(heapTable) != jdbc.nRows(copyFrom)) { jdbc.errorp(heapTable + " has fewer rows than " + copyFrom + " in " + jdbc.dbName, "Compile.populateHeapTable"); } } return result; } private void createItemOrder() throws SQLException { createItemOrderStatic(jdbc); } /** * Create item_order and item_order_heap. Initialize the record_num column, * and call populateItemOrder to initialize the others. * * @throws SQLException */ public static void createItemOrderStatic(final @NonNull JDBCSample jdbc) throws SQLException { UtilString.printDateNmessage("Creating item_order..."); final int maxItemID = jdbc.sqlQueryInt("SELECT MAX(record_num) FROM item"); final String _item_idType = JDBCSample.unsignedTypeForMaxValue(maxItemID); final int maxFacetID = jdbc.sqlQueryInt("SELECT MAX(facet_id) FROM facet"); final String _facet_idType = JDBCSample.unsignedTypeForMaxValue(maxFacetID); final StringBuilder create = new StringBuilder(" (record_num "); create.append(_item_idType).append(", random_id ").append(_item_idType); final StringBuilder indexes = new StringBuilder( "ALTER TABLE item_order_heap ADD UNIQUE INDEX random_id USING BTREE (random_id)"); final StringBuilder update = new StringBuilder("INSERT INTO item_order SELECT record_num, 0"); try (final ResultSet rs = jdbc.sqlQuery("SELECT facet_id facet_type_id, first_child_offset FROM facet " + "WHERE parent_facet_id = 0 ORDER BY facet_id");) { while (rs.next()) { update.append(", 0"); final String columnName = sortColumnName(rs.getInt("facet_type_id")); create.append(", ").append(columnName).append(" ").append(_item_idType); appendIndex(indexes, columnName); } update.append(" FROM item"); create.append(", PRIMARY KEY (record_num)) ENGINE="); final String misc = (" PACK_KEYS=1 ROW_FORMAT=FIXED"); jdbc.dropAndCreateTable("item_order", create.toString() + "MyISAM" + misc); jdbc.dropAndCreateTable("item_order_heap", create.toString() + "HEAP" + misc); UtilString.printDateNmessage("Populating item_order with (item.record_num, 0, 0, ...)"); final String sql = update.toString(); assert sql != null; jdbc.sqlUpdate(sql); UtilString.printDateNmessage("Populating item_order remaining columns"); populateItemOrder(jdbc, rs, _item_idType, _facet_idType); } UtilString.printDateNmessage("Indexing item_order..."); final String sql = indexes.toString(); assert sql != null; jdbc.sqlUpdate(sql); // jdbc.sqlUpdate("INSERT INTO item_order_heap SELECT * FROM // item_order"); } public static final int SORT_BY_RECORD_NUM = 0; public static final int SORT_BY_RANDOM = -1; public static @NonNull String sortColumnName(final int facetTypeToSortBy) { return facetTypeToSortBy == SORT_BY_RANDOM ? "random_ID" : facetTypeToSortBy == SORT_BY_RECORD_NUM ? "record_num" : "col" + facetTypeToSortBy; } private static void appendIndex(final @NonNull StringBuilder indexes, final @NonNull String name) { indexes.append(", ADD UNIQUE INDEX ").append(name).append(" USING BTREE (").append(name).append(")"); } /** * Set the order for each facet_type column. * * @param facetTypeRS * [facet_type_id, first_child_offset] */ private static void populateItemOrder(final @NonNull JDBCSample jdbc, final @NonNull ResultSet facetTypeRS, final @NonNull String item_id_column_type, final @NonNull String facet_id_column_type) throws SQLException { reRandomizeItemOrder(item_id_column_type, jdbc); createOrderTable("columnOrder", item_id_column_type, jdbc); createPopulateItemOrderTables(facet_id_column_type, jdbc); @SuppressWarnings("resource") final PreparedStatement insertIntoColumnOrderPS = jdbc .lookupPS("INSERT INTO columnOrder" + " SELECT record_num, NULL FROM" + " (SELECT record_num, MAX(facet_id) facet_id" + " FROM item_facetNtype_heap" // ..Ensure facet_id is a descendent of facet_type_id + " WHERE facet_id BETWEEN ? AND ?" + " GROUP BY record_num) foo" + " INNER JOIN facetPaths USING (facet_id)" + " ORDER BY path, record_num"); facetTypeRS.afterLast(); int right = Integer.MAX_VALUE; while (facetTypeRS.previous()) { jdbc.sqlUpdate("TRUNCATE TABLE columnOrder"); final String columnName = sortColumnName(facetTypeRS.getInt("facet_type_id")); final int left = facetTypeRS.getInt("first_child_offset") + 1; jdbc.sqlUpdateWithIntArgs(insertIntoColumnOrderPS, left, right); jdbc.sqlUpdate(itemOrderUpdateSQL("columnOrder", columnName)); // Patch up any items that weren't handled above because they // have no tags of this type. jdbc.sqlUpdate("INSERT INTO columnOrder " + " SELECT record_num, NULL FROM item_order " + " WHERE " + columnName + " = 0 ORDER BY record_num"); jdbc.sqlUpdate(itemOrderUpdateSQL("columnOrder", columnName)); right = left - 1; } jdbc.dropTable("facetPaths"); jdbc.dropTable("columnOrder"); jdbc.dropTable("itemOrder"); } /** * reRandomize item_order.random_id * * This should only happen during compile, or on server restarts. */ public static void reRandomizeItemOrder(final @NonNull String item_id_column_type, final @NonNull JDBCSample jdbc) throws SQLException { createOrderTable("random_item_ID", item_id_column_type, jdbc); jdbc.sqlUpdate("INSERT INTO random_item_ID" + " SELECT record_num, NULL FROM item ORDER BY RAND()"); jdbc.sqlUpdate(itemOrderUpdateSQL("random_item_ID", "random_id")); jdbc.dropTable("random_item_ID"); } /** * <tableName> is a scratchpad for updating item_order. For each item_order * column, <tableName> is re-computed with different orders. Order is random * for random_id, deterministic for others. * * This should only happen during compile, or on server restarts. */ private static void createOrderTable(final @NonNull String tableName, final @NonNull String item_id_column_type, final @NonNull JDBCSample jdbc) throws SQLException { jdbc.dropTable(tableName); jdbc.sqlUpdate("CREATE TEMPORARY TABLE " + tableName + " (record_num " + item_id_column_type + ", _order " + item_id_column_type + " AUTO_INCREMENT" + ", PRIMARY KEY (record_num)" // AUTO_INCREMENT columns must be keys + ", UNIQUE INDEX _order USING BTREE (_order)" + ")" + " ENGINE=HEAP PACK_KEYS=1 ROW_FORMAT=FIXED"); } /** * <tableName> is a scratchpad for updating item_order. For each item_order * column, <tableName> is re-computed with different orders. Order is based * on facet tree for each item. * * This should only happen during compile, or on server restarts. */ private static void createPopulateItemOrderTables(final @NonNull String facet_id_column_type, final @NonNull JDBCSample jdbc) throws SQLException { jdbc.dropTable("facetPaths"); // Can't be TEMPORARY or you get 'Can't reopen table' jdbc.sqlUpdate("CREATE TABLE facetPaths (facet_id " + facet_id_column_type + ", path VARCHAR(255) NOT NULL" + ", PRIMARY KEY (facet_id)" + ") ENGINE=HEAP PACK_KEYS=1 ROW_FORMAT=FIXED"); jdbc.sqlUpdate("INSERT INTO facetPaths SELECT facet_id, LPAD(facet_id, 7, '0')" + " FROM facet " + " WHERE parent_facet_id = 0"); while (jdbc.sqlUpdate("INSERT IGNORE INTO facetPaths" + " SELECT facet.facet_id, CONCAT(fp.path, ' -- ', LPAD(facet.facet_id, 7, '0'))" + " FROM facet INNER JOIN facetPaths fp ON fp.facet_id = facet.parent_facet_id" + " WHERE parent_facet_id > 0;") > 0) { // Repeat while paths percolate to descendents } } private static @NonNull String itemOrderUpdateSQL(final @NonNull String tableName, final @NonNull String columnName) { return "UPDATE item_order, " + tableName + " order_table SET item_order." + columnName + " = order_table._order " + "WHERE item_order.record_num = order_table.record_num"; } private void createUserActions() throws SQLException { jdbc.sqlUpdate("CREATE TABLE IF NOT EXISTS user_actions (" + "timestamp DATETIME NOT NULL," + " location TINYINT(3) UNSIGNED NOT NULL," + " object VARCHAR(255) NOT NULL," + " modifiers MEDIUMINT(9) NOT NULL," + " session INT(11) NOT NULL," + " client VARCHAR(255) NOT NULL)" + "ENGINE=MyISAM PACK_KEYS=1"); } private int printErrors(final @NonNull String query, final String message, final String fieldList) throws SQLException { return printErrors(query, message, fieldList, MAX_ERRORS_TO_PRINT, Integer.MAX_VALUE); } private int printErrors(final @NonNull String query, final String message, final String fieldList, final int maxPrint, final int group_concat_max_len) throws SQLException { return printErrors(query, null, message, fieldList, maxPrint, group_concat_max_len); } private int printErrors(final ResultSet rs, final String message, final String fieldList) throws SQLException { return printErrors(rs, message, fieldList, MAX_ERRORS_TO_PRINT, Integer.MAX_VALUE); } private int printErrors(final ResultSet rs, final String message, final String fieldList, final int maxPrint, final int group_concat_max_len) throws SQLException { return printErrors(null, rs, message, fieldList, maxPrint, group_concat_max_len); } @SuppressWarnings("resource") private int printErrors(final String query, ResultSet rs, final String message, final String fieldList, final int maxPrint, final int group_concat_max_len) throws SQLException { final int oldMaxLength = jdbc.sqlQueryInt("SELECT @@group_concat_max_len"); jdbc.sqlUpdate("SET SESSION group_concat_max_len = " + group_concat_max_len); int nErrors = 0; if (rs == null) { assert query != null; rs = jdbc.sqlQuery(query); } final int row = rs.getRow(); try { nErrors = MyResultSet.nRows(rs); if (nErrors > 0 && maxPrint > 0) { UtilString.printDateNmessage( message + " (printing " + (Math.min(nErrors, maxPrint)) + " of " + nErrors + " such errors)"); final FormattedTableBuilder align = new FormattedTableBuilder(); final String[] fields = fieldList.split(","); final int nFields = fields.length; assert nFields < 20 : fieldList; align.addLine(Arrays.asList(fields)); while (rs.next() && rs.getRow() <= maxPrint) { align.addLine(MyResultSet.getRowValue(rs, query)); } System.out.println(align.format()); } } catch (final SQLException se) { jdbc.logp("SQL Exception: ", MyLogger.SEVERE, se, "Compile.printErrors"); se.printStackTrace(System.out); } finally { MyResultSet.resetRow(rs, row); } jdbc.sqlUpdate("SET SESSION group_concat_max_len = " + oldMaxLength); return nErrors; } private int checkRawErrors() throws SQLException { UtilString.printDateNmessage("Checking input tables for errors..."); int nErrors = 0; final String[] tablesWithNames = { "raw_facet", "raw_facet_type" }; for (final String table : tablesWithNames) { final int nErrs = printErrors("SELECT name FROM " + table + " WHERE name != TRIM(name)", "Warning: removing initial blank space from " + table + ".name", "Name"); if (nErrs > 0) { nErrors += nErrs; jdbc.sqlUpdate("UPDATE " + table + " SET name = TRIM(name);"); } } nErrors += nameUnnamedFacets(); nErrors += setEmptyItemDescFieldsToNull(); nErrors += findOrphans(); // assert nErrors == 0 : nErrors + " fatal errors; aborting"; nErrors += fixMissingParentRawItemFacets(); nErrors += findBrokenLinks(true); nErrors += promoteNonrestrictingFacets(); // nErrors += db.mergeDuplicateFacets(); // promoteNonrestrictingFacets // already did this assert findOrphans() == 0 : "fatal error; aborting"; UtilString.printDateNmessage("\n...found " + UtilString.addCommas(nErrors) + " errors in raw tables."); return nErrors; } private int nameUnnamedFacets() throws SQLException { final int nErrors = printErrors("SELECT child.facet_id, child.parent_facet_id, parent.name" + " FROM raw_facet child LEFT JOIN raw_facet parent" + " ON child.parent_facet_id = parent.facet_id" + " WHERE child.name IS NULL OR child.name = ''", "ERROR: No name in raw_facet", "facet_id, parent_facet_id, parent.name"); jdbc.sqlUpdate("REPLACE INTO raw_facet (SELECT parent.facet_id, CONCAT('<unnamed', parent.facet_id, '>')," + " parent.parent_facet_id, parent.sort FROM raw_facet parent" + " INNER JOIN raw_facet child ON child.parent_facet_id = parent.facet_id" + " WHERE parent.name IS NULL OR parent.name = '')"); assert !jdbc.isSqlQueryIntPositive("SELECT 1 FROM raw_facet WHERE name IS NULL OR name = '' LIMIT 1"); // jdbc.sqlUpdate("DELETE FROM raw_facet WHERE name IS NULL OR name = // ''"); return nErrors; } private int findOrphans() throws SQLException { return printErrors( "SELECT raw.facet_id, raw.name, raw.parent_facet_id" + " FROM raw_facet raw LEFT JOIN raw_facet parent ON raw.parent_facet_id = parent.facet_id" + " WHERE parent.facet_id IS NULL" + " AND raw.parent_facet_id > " + jdbc.sqlQueryInt("SELECT MAX(facet_type_id) FROM raw_facet_type"), "ERROR: No parent in raw_facet", "facet_id, name, parent_facet_id"); } public int findBrokenLinks(final boolean isRaw) throws SQLException { final String itemFacetTable = isRaw ? "raw_item_facet" : "item_facet"; final String facetNtypeTable = isRaw ? "raw_facet_n_type" : "facet"; if (isRaw) { jdbc.sqlUpdate("CREATE OR REPLACE VIEW raw_facet_n_type AS" + " SELECT facet_id, name, parent_facet_id FROM raw_facet UNION" + " SELECT facet_type_id, name, 0 FROM raw_facet_type"); } int nErrors = deleteUnusedItems(itemFacetTable) + deleteUnusedFacets(isRaw); // find itemFacets that refer to non-existent items final String q0 = "SELECT missingItemIDs.record_num, " + "CONCAT('[', COUNT(*), ' facets: ', " + "GROUP_CONCAT(DISTINCT facet_id ORDER BY facet_id), ']')" + "FROM " + itemFacetTable + " INNER JOIN (SELECT itemFacetRecordNums.record_num FROM" + "(SELECT DISTINCT record_num FROM " + itemFacetTable + ") itemFacetRecordNums " + "LEFT JOIN item USING (record_num)" + "WHERE item.record_num IS NULL) missingItemIDs USING (record_num)" + "GROUP BY missingItemIDs.record_num"; int noSuch = printErrors(q0, "ERROR: " + itemFacetTable + " refers to a non-existent item", "record_num, facetIDs", MAX_ERRORS_TO_PRINT, 100); // find itemFacets that refer to non-existent facets final String sql = "SELECT missingFacetIDs.facet_id, " + "CONCAT('[', COUNT(*), ' records: ', " + "GROUP_CONCAT(DISTINCT record_num ORDER BY record_num), ']')" + "FROM " + itemFacetTable + " INNER JOIN" + "(SELECT itemFacetFacetIDs.facet_id FROM" + "(SELECT DISTINCT facet_id FROM " + itemFacetTable + ") itemFacetFacetIDs " + "LEFT JOIN " + facetNtypeTable + " facet USING (facet_id)" + "WHERE facet.facet_id IS NULL) missingFacetIDs USING (facet_id)" + "GROUP BY missingFacetIDs.facet_id"; noSuch += printErrors(sql, "ERROR: " + itemFacetTable + " refers to a non-existent facet", "facet_id, items", MAX_ERRORS_TO_PRINT, 100); nErrors += noSuch; if (isRaw) { if (noSuch > 0) { UtilString.printDateNmessage("Deleting " + noSuch + " bogus facet/item links from raw_item_facet\n"); jdbc.sqlUpdate("DELETE raw_item_facet FROM raw_item_facet, " + "(SELECT itemFacet.facet_id, itemFacet.record_num" + " FROM raw_item_facet itemFacet" + " LEFT JOIN raw_facet_n_type facet USING (facet_id)" + " LEFT JOIN item USING (record_num)" + " WHERE facet.facet_id IS NULL OR item.record_num IS NULL) unused " + "WHERE raw_item_facet.record_num = unused.record_num " + "AND raw_item_facet.facet_id = unused.facet_id"); } jdbc.sqlUpdate("DROP VIEW IF EXISTS raw_facet_n_type"); } return nErrors; } private int deleteUnusedItems(final @NonNull String itemFacet) throws SQLException { jdbc.dropAndCreateTable("usedItems", "(record_num INT UNSIGNED NOT NULL DEFAULT 0," + " PRIMARY KEY (record_num)" + ") ENGINE=Memory"); jdbc.sqlUpdate("INSERT INTO usedItems" + " SELECT DISTINCT record_num FROM " + itemFacet); jdbc.dropAndCreateTable("unusedItems", "(record_num INT UNSIGNED NOT NULL DEFAULT 0," // + " description TEXT," + " PRIMARY KEY (record_num)" + ") ENGINE=Memory"); jdbc.sqlUpdate("INSERT INTO unusedItems " + "(SELECT item.record_num FROM item LEFT JOIN usedItems used USING (record_num)" + " WHERE used.record_num IS NULL)"); final String descField = jdbc .sqlQueryString("SELECT SUBSTRING_INDEX(itemDescriptionFields, ',', 1) FROM globals"); final int nErrors = printErrors( "SELECT record_num, " + descField + " FROM unusedItems INNER JOIN item USING (record_num)", "ERROR: Item is not associated with any facets", "record_num, " + descField); // assert nErrors == 0 : itemFacet + " has " + jdbc.nRows("unusedItems") // + " unassociated items"; if (nErrors > 0) { UtilString.printDateNmessage("Deleting " + nErrors + " bogus items with no facets"); jdbc.sqlUpdate("DELETE FROM item WHERE record_num IN (SELECT record_num FROM unusedItems)"); } jdbc.dropTable("usedItems"); jdbc.dropTable("unusedItems"); return nErrors; } private int deleteUnusedFacets(final boolean isRaw) throws SQLException { final String itemFacetTable = isRaw ? "raw_item_facet" : "item_facet"; final String facetTable = isRaw ? "raw_facet" : "facet"; jdbc.dropAndCreateTable("usedFacets", "(facet_id INT UNSIGNED NOT NULL DEFAULT 0," + " PRIMARY KEY (facet_id)" + ") ENGINE=Memory"); jdbc.sqlUpdate("REPLACE INTO usedFacets" + " SELECT DISTINCT facet_id FROM " + itemFacetTable); if (!isRaw) { jdbc.sqlUpdate("REPLACE INTO usedFacets" + " SELECT facet_id FROM facet WHERE parent_facet_id = 0"); } jdbc.dropAndCreateTable("unusedFacets", "AS SELECT CONCAT(parent.name, ' (', parent.facet_id, ') <', (SELECT COUNT(*) FROM " + itemFacetTable + " WHERE parent.facet_id = " + itemFacetTable + ".facet_id), '>') parent_name" + ", facet.name, facet.facet_id" + " FROM " + facetTable + " facet LEFT JOIN " + facetTable + " parent" + " ON facet.parent_facet_id = parent.facet_id" + " LEFT JOIN usedFacets ON facet.facet_id = usedFacets.facet_id" + " WHERE usedFacets.facet_id IS NULL"); int nUnusedFacets = printErrors( "SELECT parent_name, " + "CONCAT('[', COUNT(*), ' facets: ', GROUP_CONCAT(CONCAT(name, ' (', facet_id, ')')), ']') " + "FROM unusedFacets GROUP BY parent_name", "\nERROR: Facet is not associated with any items", "parent, facets"); if (isRaw && nUnusedFacets > 0) { nUnusedFacets = jdbc.nRows("unusedFacets"); UtilString.printDateNmessage("Deleting " + nUnusedFacets + " unused facets from raw_facet"); jdbc.sqlUpdate("DELETE facet FROM " + facetTable + " facet, unusedFacets WHERE facet.facet_id = unusedFacets.facet_id"); } jdbc.dropTable("usedFacets"); jdbc.dropTable("unusedFacets"); return nUnusedFacets; } /** * Find facet children that link to an item, but the parent doesn't * (including facet_type's). This is linear in raw_item_facet.nRows, and * thus very slow for Elamp_shot databases. * * if raw_item_facet(item, childFacet), ensure raw_item_facet(item, * parentFacet) * * @return nErrors */ public int fixMissingParentRawItemFacets() throws SQLException { return fixMissingParentRawItemFacetsInternal(0); } int fixMissingParentRawItemFacetsInternal(final int tableSuffix) throws SQLException { UtilString.printDateNmessage("Finding missing raw_item_facets..."); final String missingTableName = " missingParentItemFacets" + tableSuffix + " "; jdbc.dropAndCreateTable(missingTableName, "AS" + fixMissingRawItemFacetsSQL(false, tableSuffix)); int nRows = jdbc.nRows(missingTableName); UtilString.printDateNmessage("...found " + nRows + " missing raw_item_facets."); if (nRows == 0) { System.out.println(" Finding missing raw_item_type_facets..."); nRows = jdbc.sqlUpdate("INSERT INTO " + missingTableName + fixMissingRawItemFacetsSQL(true, tableSuffix)); UtilString.printDateNmessage("...found " + nRows + " missing raw_item_type_facets"); } // int nErrors = printErrors( // "SELECT name, facet_id, parentName, parent_facet_id, CONCAT('[', // COUNT(*), ' records: ', " // + "GROUP_CONCAT(DISTINCT record_num ORDER BY record_num), ']') FROM" // + missingTableName + "GROUP BY facet_id", // "ERROR: Item has facet child, but not its parent", // "childName, childFacetID, parentName, parentFacetID, items", 4, // 10); int nErrors = jdbc.nRows(missingTableName); if (nErrors > 0) { UtilString.printDateNmessage("Adding missing raw_item_facets..."); jdbc.sqlUpdate( "INSERT INTO raw_item_facet" + " SELECT record_num, parent_facet_id FROM" + missingTableName); UtilString.printDateNmessage("fixMissingParentRawItemFacetsInternal added " + UtilString.addCommas(nErrors) + " missing raw_item_facets; recursing"); // Keep propagating up nErrors += fixMissingParentRawItemFacetsInternal(tableSuffix + 1); } jdbc.dropTable(missingTableName); return nErrors; } private static @NonNull String fixMissingRawItemFacetsSQL(final boolean isType, final int tableSuffix) { if (tableSuffix == 0) { return fixMissingRawItemFacetsTopLevelSQL(isType); } else { return fixMissingRawItemFacetsRecursiveSQL(isType, tableSuffix); } } // childItemFacet is already in raw_item_facet static @NonNull String fixMissingRawItemFacetsTopLevelSQL(final boolean isType) { final String type = isType ? "_type" : ""; return " SELECT DISTINCT childItemFacet.record_num, parentFacet.facet" + type + "_id parent_facet_id" + " FROM raw_facet childFacet INNER JOIN raw_item_facet childItemFacet USING (facet_id) INNER JOIN raw_facet" + type + " parentFacet ON childFacet.parent_facet_id = parentFacet.facet" + type + "_id" + " LEFT JOIN raw_item_facet parentItemFacet ON" + " (parentItemFacet.facet_id = childFacet.parent_facet_id" + " AND parentItemFacet.record_num = childItemFacet.record_num)" + " WHERE parentItemFacet.facet_id IS NULL"; } // missingParentItemFacetsN is already in raw_item_facet static @NonNull String fixMissingRawItemFacetsRecursiveSQL(final boolean isType, final int tableSuffix) { final String type = isType ? "_type" : ""; final String missingTableName = " missingParentItemFacets" + (tableSuffix - 1) + " "; return " SELECT DISTINCT " + missingTableName + ".record_num, parentFacet.facet" + type + "_id parent_facet_id" + " FROM " + missingTableName + " INNER JOIN raw_facet childFacet ON childFacet.facet_id = " + missingTableName + ".parent_facet_id" + " INNER JOIN raw_facet" + type + " parentFacet ON childFacet.parent_facet_id = parentFacet.facet" + type + "_id" + " LEFT JOIN raw_item_facet parentItemFacet ON" + " (parentItemFacet.facet_id = parentFacet.facet" + type + "_id" + " AND parentItemFacet.record_num = " + missingTableName + ".record_num)" + " WHERE parentItemFacet.facet_id IS NULL"; } private void setUpFacetSearch() throws SQLException { UtilString.printDateNmessage("Setting up facet search..."); final int oldMaxLength = jdbc.sqlQueryInt("SELECT @@group_concat_max_len"); jdbc.sqlUpdate("SET SESSION group_concat_max_len = " + 65_000); // jdbc.sqlUpdate("UPDATE item SET facet_names = " // + "(SELECT GROUP_CONCAT(name) " // + "FROM item_facetNtype_heap INNER JOIN facet USING (facet_id)" // + " WHERE item.record_num = item_facetNtype_heap.record_num)"); jdbc.dropAndCreateTable("item_temp", "(record_num INT NOT NULL," + " facet_names TEXT NOT NULL" // + ", PRIMARY KEY (record_num)" + ")" + " ENGINE=MyISAM"); jdbc.sqlUpdate("INSERT INTO item_temp" + " SELECT STRAIGHT_JOIN record_num, GROUP_CONCAT(name)" + " FROM item_facet" + " INNER JOIN facet USING (facet_id)" + " GROUP BY record_num"); jdbc.sqlUpdate("UPDATE item, item_temp" + " SET item.facet_names = item_temp.facet_names" + " WHERE item.record_num = item_temp.record_num"); jdbc.dropTable("item_temp"); jdbc.ensureIndex("item", "search", "facet_names," + jdbc.sqlQueryString("SELECT itemDescriptionFields FROM globals").replace("item.", ""), "FULLTEXT"); jdbc.sqlUpdate("SET SESSION group_concat_max_len = " + oldMaxLength); // return nErrors; } private int setEmptyItemDescFieldsToNull() throws SQLException { int nEmptyFields = 0; final String itemDescs = jdbc.sqlQueryString("SELECT itemDescriptionFields FROM globals"); // if (itemDescs != null) { final String[] itemDescFields = itemDescs.split(","); for (final String field : itemDescFields) { // CONCAT_WS ignores nulls, so replace empty strings with NULLs. nEmptyFields = jdbc.sqlUpdate("UPDATE item SET " + field + " = NULL WHERE LENGTH(TRIM(" + field + ")) = 0"); if (nEmptyFields > 0) { UtilString.printDateNmessage( "Compile.setUpFacetSearch: found " + nEmptyFields + " empty values in item." + field); } } // } return nEmptyFields; } public static void ensureGlobalColumns(final JDBCSample jdbc2) throws SQLException { // JDBCSample.getMyLogger().logp( // "enter " + jdbc2.dbName + " " // + jdbc2.columnExists("globals", "thumb_regexp"), // MyLogger.WARNING, "Compile.ensureGlobalColumns"); if (!jdbc2.columnExists("globals", "build_args")) { jdbc2.sqlUpdate("ALTER TABLE globals ADD COLUMN build_args TEXT"); } if (!jdbc2.columnExists("globals", "thumb_URL")) { jdbc2.sqlUpdate("ALTER TABLE globals ADD COLUMN thumb_URL TEXT"); } if (!jdbc2.columnExists("globals", "thumb_regexp")) { jdbc2.sqlUpdate("ALTER TABLE globals ADD COLUMN thumb_regexp TEXT"); } // JDBCSample.getMyLogger().logp( // "exit " + jdbc2.dbName + " " // + jdbc2.columnExists("globals", "thumb_regexp"), // MyLogger.WARNING, "Compile.ensureGlobalColumns"); } public static @NonNull String[] ancestors(final @NonNull String ancestorString) { final String[] result = ancestorString.split(FACET_HIERARCHY_SEPARATOR); assert result != null; return result; } }
[ "markderthick@gmail.com" ]
markderthick@gmail.com
ad7bcee3ec684d5b275bf453464956f16b697b99
7639f2daa6535fe52bd0d472521100c86008121e
/src/csm/exceptions/ErrAlreadyDefinedElement.java
cb6ca3a6212597de7a7f20aa25573e5d86c66bac
[]
no_license
MartinSteffen/smile
eece810124fd74e618e95a28a893df5f2d03e0e4
e9c5ed25db49cac2a7a1581bb4b4602f5e204fac
refs/heads/master
2021-01-01T16:45:49.049876
2017-07-21T07:09:02
2017-07-21T07:09:02
97,910,939
0
0
null
null
null
null
UTF-8
Java
false
false
710
java
/** * */ package csm.exceptions; /** * Zeigt an, dass versucht wurde, einem Dictionary einen Wert * hinzuzufuegen, der dort bereits vorhanden ist. * * @author hsi */ public final class ErrAlreadyDefinedElement extends CSMEditException { private static final long serialVersionUID = 1L; /** * der Name, der bereits im Dictionary enthalten ist */ final public String name; /** * Erzeugt eine Exception mit dem Text "$name is already defined", * wobei fuer $name der uebergebene Name eingesetzt wird * * @param name der Name, der bereits im Dictionary enthalten ist */ public ErrAlreadyDefinedElement(String name) { super(name + " is already defined"); this.name = name; } }
[ "hsi@informatik.uni-kiel.de" ]
hsi@informatik.uni-kiel.de
c14c32d015d02aac214206907b77abf9cff6b12a
cc1280159e96bb88948527e633b6d7ccae62fe45
/ExperimentsCoG2021/Source/src/framework/ExecReplay.java
9017215c20f3ebee9f5c064a66629b770bf5c08d
[]
no_license
CommanderCero/AutoSubgoalMCTS_PTSP
ed9591871a013ac9dbed1c2c01cddfd2bf94a03d
d0ff3938e200a36c32bc0d9f21fbc4461ac628c2
refs/heads/master
2023-07-10T06:43:43.313087
2021-08-16T15:36:10
2021-08-16T15:36:10
358,175,996
3
1
null
2021-07-17T12:12:38
2021-04-15T07:59:48
Java
UTF-8
Java
false
false
3,025
java
package framework; import framework.core.*; import framework.utils.JEasyFrame; /** * This class may be used to execute the game in timed or un-timed modes, with or without * visuals. Competitors should implement his controller in a subpackage of 'controllers'. * The skeleton classes are already provided. The package * structure should not be changed (although you may create sub-packages in these packages). */ @SuppressWarnings("unused") public class ExecReplay extends Exec { /** * Name of the map tp execute the reply in. */ protected static String m_mapName; /** * Replay a previously saved game. * @param visual Indicates whether or not to use visuals * @param delay The delay between time-steps */ public static void replayGame(boolean visual, int delay) { ///Actions to execute. int[] actionsToExecute; try { actionsToExecute = readForces(m_actionFilename); //Create the game instance. m_game = new Game(m_mapName); m_game.go(); m_game.getShip().setStarted(true); //Indicate what are we running if(m_verbose) System.out.println("Running actions from " + m_actionFilename + " in map " + m_game.getMap().getFilename() + "..."); JEasyFrame frame; if(visual) { //View of the game, if applicable. m_view = new PTSPView(m_game, m_game.getMapSize(), m_game.getMap(), m_game.getShip(), m_controller); frame = new JEasyFrame(m_view, "PTSP-Game Replay: " + m_actionFilename); } for(int j=0;j<actionsToExecute.length;j++) { m_game.tick(actionsToExecute[j]); waitStep(delay); if(visual) m_view.repaint(); } if(m_verbose) m_game.printResults(); }catch(Exception e) { e.printStackTrace(); } } /** * The main method. Several options are listed - simply remove comments to use the option you want. * * @param args the command line arguments. Not needed in this class. */ public static void main(String[] args) { m_mapName = "maps/StageA/ptsp_map01.map"; //Set here the name of the map to play in. m_actionFilename = "route_20-Mar-2012_14.45.47.txt"; //Indicate here the name of the file with the actions saved TO SEE a replay. m_visibility = true; //Set here if the graphics must be displayed or not (for those modes where graphics are allowed). m_verbose = true; /////// 1. Executes a replay. /////// Note: using a delay of 0 with m_visibility=true will let you see close to nothing. We recommend delay=2 instead. int delay=5; //2: quickest, PTSPConstants.DELAY: human play speed, PTSPConstants.ACTION_TIME_MS: max. controller delay replayGame(m_visibility, delay); } }
[ "10519507+CommanderCero@users.noreply.github.com" ]
10519507+CommanderCero@users.noreply.github.com
10cdf831d60075ca8f473ee093ac447cb8491d43
c2df210c4041bdaee544801b968c24fa1c0c8b5f
/firstDay/src/com/com_9_6/app/Jar.java
b5407f114f0ce1ae77a7aa24975b4654247da7fb
[]
no_license
zsjsj/JAvaxu
91075ea3feb494ff32751d58a5a7c8ad871d4708
2f1fbc33c29aadc12380233268cd3032dffa3cbc
refs/heads/master
2020-03-29T18:08:15.115009
2018-09-25T02:22:25
2018-09-25T02:22:25
150,196,351
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package com_9_6.app; import java.util.LinkedList; import java.util.List; /** * 容器 */ public class Jar { public static int cam = 0 ; Object obj = new Object(); Object obj1 = new Object(); public synchronized void add() throws Exception { while(cam ==50){ this.wait(); } cam++; System.out.println(Thread.currentThread().getName() + " + : " + "生产后蜂蜜数"+Jar.cam); this.notifyAll(); } public synchronized Integer removeall() throws Exception { while(cam < 20){ this.wait(); } cam = 0; System.out.println(Thread.currentThread().getName() + "- : " +"吃光了"); this.notifyAll(); return cam ; } }
[ "1376151453@qq.com" ]
1376151453@qq.com
ec6ba18654d4edea8dd1c1d945b5ee87ca95f38f
eb8a29ebfcaa9cb45aef6c09311b3c356accf508
/DiscGolfSecurity/src/main/java/com/pliesveld/discgolf/security/domain/DiscUser.java
92bbd49ab955503e5999dadd5cfca5bb7d37e000
[]
no_license
pliesveld/discgolf
0b5bc742d85d03bb73bf62503d3d83465d5279e5
8f25ce8288362fabba88b459bda345d1970032bd
refs/heads/master
2021-03-22T04:45:04.984736
2017-09-23T18:17:24
2017-09-23T18:17:24
82,411,822
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package com.pliesveld.discgolf.security.domain; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.pliesveld.discgolf.persistence.domain.Player; import java.time.Instant; import java.util.Collection; @JsonIgnoreProperties(value = {"password", "accountNonExpired", "accountNonLocked", "enabled"}) final public class DiscUser extends User implements UserDetails { private static final long serialVersionUID = 5639683223516504866L; private String id; private Instant lastPasswordResetDate; public DiscUser(final PlayerAccount player, final Collection<GrantedAuthority> authorities) { super(player.getName(), player.getPassword(), authorities); // lastPasswordResetDate = student.getLastPasswordResetDate(); id = player.getEmail(); } public Instant getLastPasswordResetDate() { return lastPasswordResetDate; } public String getId() { return id; } }
[ "pliesveld@users.noreply.github.com" ]
pliesveld@users.noreply.github.com
4e170ff50ec748acfb0264c6f6dd06cb9dc99b01
6331c2bdb5c06a27ef48e11e2d55d922bfe12d4e
/app/src/androidTest/java/com/smart/im/media/test/ExampleInstrumentedTest.java
d2cf105118c4b885897c9426f2453e44eeef9b47
[]
no_license
xwlichen/smartim-media
53d0b45758da02dbc6c20355ee3353a5e64ffbed
a292f2690ff1746f3121dba2e790541635289189
refs/heads/master
2020-04-25T15:59:08.730427
2019-05-10T07:00:02
2019-05-10T07:00:02
172,894,926
1
0
null
null
null
null
UTF-8
Java
false
false
730
java
package com.smart.im.media.test; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.smart.im.media.test", appContext.getPackageName()); } }
[ "1960003945@qq.com" ]
1960003945@qq.com
3483bb6b39675832ea0fea8301a7287582b42266
87fe6833b485a8770cfcfde2cb5df2e7953443dc
/applet/src/org/studentrobotics/ide/checkout/DriveFinder.java
75f11967ad2ee1577ffb87b7bc97ee52c91fe1f9
[ "MIT" ]
permissive
fables-tales/srobo-ide
c4ef2121cb0c6d700ae050d3885f30a8ec54a073
ead2685b37782f57287bc6d607853af8c634366e
refs/heads/master
2022-12-03T04:24:56.615961
2012-11-13T23:22:22
2012-11-13T23:22:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package org.studentrobotics.ide.checkout; public class DriveFinder { private static DriveFinder instance = null; public static String findSroboDrive() { DriveFinder df = getInstance(); System.err.println("df is " + df.toString()); return df.findPath(); } private String findPath() { OperatingSystem os = getOS(); System.err.println("os is " + os.toString()); if (os == OperatingSystem.windows) { return new WindowsDrive().findPath(); } else if (os == OperatingSystem.nix) { return new LinuxDrive().findPath(); } else { CheckoutApplet.hasDied = true; return null; } } private static DriveFinder getInstance() { if (instance == null) { instance = new DriveFinder(); } return instance; } public OperatingSystem getOS(){ String os = System.getProperty("os.name").toLowerCase(); if (os.contains("win")) { return OperatingSystem.windows; // do a check for *nix (including apple) } else if (os.contains("nix") || os.contains("nux") || os.contains("mac")) { return OperatingSystem.nix; } else { return OperatingSystem.unknown; } } }
[ "samphippen@googlemail.com" ]
samphippen@googlemail.com
2864aafd3a81cb5597024e947b1cb7d57c92514c
6e57bdc0a6cd18f9f546559875256c4570256c45
/cts/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
3043f45a0ae1648c009102458bb15df8100a91dd
[]
no_license
dongdong331/test
969d6e945f7f21a5819cd1d5f536d12c552e825c
2ba7bcea4f9d9715cbb1c4e69271f7b185a0786e
refs/heads/master
2023-03-07T06:56:55.210503
2020-12-07T04:15:33
2020-12-07T04:15:33
134,398,935
2
1
null
2022-11-21T07:53:41
2018-05-22T10:26:42
null
UTF-8
Java
false
false
8,383
java
/* * Copyright 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.widget.cts; import static android.content.Context.KEYGUARD_SERVICE; import static junit.framework.Assert.assertEquals; import static org.mockito.Matchers.same; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import android.app.Activity; import android.app.Instrumentation; import android.app.KeyguardManager; import android.content.Context; import android.media.AudioAttributes; import android.media.session.MediaController; import android.media.session.PlaybackState; import android.support.test.InstrumentationRegistry; import android.support.test.annotation.UiThreadTest; import android.support.test.filters.LargeTest; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.VideoView2; import com.android.compatibility.common.util.MediaUtils; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; /** * Test {@link VideoView2}. */ @Ignore @LargeTest @RunWith(AndroidJUnit4.class) public class VideoView2Test { /** Debug TAG. **/ private static final String TAG = "VideoView2Test"; /** The maximum time to wait for an operation. */ private static final long TIME_OUT = 15000L; /** The interval time to wait for completing an operation. */ private static final long OPERATION_INTERVAL = 1500L; /** The duration of R.raw.testvideo. */ private static final int TEST_VIDEO_DURATION = 11047; /** The full name of R.raw.testvideo. */ private static final String VIDEO_NAME = "testvideo.3gp"; /** delta for duration in case user uses different decoders on different hardware that report a duration that's different by a few milliseconds */ private static final int DURATION_DELTA = 100; /** AudioAttributes to be used by this player */ private static final AudioAttributes AUDIO_ATTR = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_GAME) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) .build(); private Instrumentation mInstrumentation; private Activity mActivity; private KeyguardManager mKeyguardManager; private VideoView2 mVideoView; private MediaController mController; private String mVideoPath; @Rule public ActivityTestRule<VideoView2CtsActivity> mActivityRule = new ActivityTestRule<>(VideoView2CtsActivity.class); @Before public void setup() throws Throwable { mInstrumentation = InstrumentationRegistry.getInstrumentation(); mKeyguardManager = (KeyguardManager) mInstrumentation.getTargetContext().getSystemService(KEYGUARD_SERVICE); mActivity = mActivityRule.getActivity(); mVideoView = (VideoView2) mActivity.findViewById(R.id.videoview); mVideoPath = prepareSampleVideo(); mActivityRule.runOnUiThread(() -> { // Keep screen on while testing. mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mActivity.setTurnScreenOn(true); mActivity.setShowWhenLocked(true); mKeyguardManager.requestDismissKeyguard(mActivity, null); }); mInstrumentation.waitForIdleSync(); final View.OnAttachStateChangeListener mockAttachListener = mock(View.OnAttachStateChangeListener.class); if (!mVideoView.isAttachedToWindow()) { mVideoView.addOnAttachStateChangeListener(mockAttachListener); verify(mockAttachListener, timeout(TIME_OUT)).onViewAttachedToWindow(same(mVideoView)); } mController = mVideoView.getMediaController(); } @After public void tearDown() throws Throwable { /** call media controller's stop */ } private boolean hasCodec() { return MediaUtils.hasCodecsForResource(mActivity, R.raw.testvideo); } private String prepareSampleVideo() throws IOException { try (InputStream source = mActivity.getResources().openRawResource(R.raw.testvideo); OutputStream target = mActivity.openFileOutput(VIDEO_NAME, Context.MODE_PRIVATE)) { final byte[] buffer = new byte[1024]; for (int len = source.read(buffer); len > 0; len = source.read(buffer)) { target.write(buffer, 0, len); } } return mActivity.getFileStreamPath(VIDEO_NAME).getAbsolutePath(); } @UiThreadTest @Test public void testConstructor() { new VideoView2(mActivity); new VideoView2(mActivity, null); new VideoView2(mActivity, null, 0); } @Test public void testPlayVideo() throws Throwable { // Don't run the test if the codec isn't supported. if (!hasCodec()) { Log.i(TAG, "SKIPPING testPlayVideo(): codec is not supported"); return; } final MediaController.Callback mockControllerCallback = mock(MediaController.Callback.class); mActivityRule.runOnUiThread(() -> { mController.registerCallback(mockControllerCallback); mVideoView.setVideoPath(mVideoPath); mController.getTransportControls().play(); }); ArgumentCaptor<PlaybackState> someState = ArgumentCaptor.forClass(PlaybackState.class); verify(mockControllerCallback, timeout(TIME_OUT).atLeast(3)).onPlaybackStateChanged( someState.capture()); List<PlaybackState> states = someState.getAllValues(); assertEquals(PlaybackState.STATE_PAUSED, states.get(0).getState()); assertEquals(PlaybackState.STATE_PLAYING, states.get(1).getState()); assertEquals(PlaybackState.STATE_STOPPED, states.get(2).getState()); } @Test public void testPlayVideoOnTextureView() throws Throwable { // Don't run the test if the codec isn't supported. if (!hasCodec()) { Log.i(TAG, "SKIPPING testPlayVideoOnTextureView(): codec is not supported"); return; } final VideoView2.OnViewTypeChangedListener mockViewTypeListener = mock(VideoView2.OnViewTypeChangedListener.class); final MediaController.Callback mockControllerCallback = mock(MediaController.Callback.class); mActivityRule.runOnUiThread(() -> { mVideoView.setOnViewTypeChangedListener(mockViewTypeListener); mVideoView.setViewType(mVideoView.VIEW_TYPE_TEXTUREVIEW); mController.registerCallback(mockControllerCallback); mVideoView.setVideoPath(mVideoPath); }); verify(mockViewTypeListener, timeout(TIME_OUT)) .onViewTypeChanged(mVideoView, VideoView2.VIEW_TYPE_TEXTUREVIEW); mActivityRule.runOnUiThread(() -> { mController.getTransportControls().play(); }); ArgumentCaptor<PlaybackState> someState = ArgumentCaptor.forClass(PlaybackState.class); verify(mockControllerCallback, timeout(TIME_OUT).atLeast(3)).onPlaybackStateChanged( someState.capture()); List<PlaybackState> states = someState.getAllValues(); assertEquals(PlaybackState.STATE_PAUSED, states.get(0).getState()); assertEquals(PlaybackState.STATE_PLAYING, states.get(1).getState()); assertEquals(PlaybackState.STATE_STOPPED, states.get(2).getState()); } }
[ "dongdong331@163.com" ]
dongdong331@163.com
f64ffae48b5600ef7c911790ff800e220f89fbee
720aa8899dc1c65b01dc0f3ec9dc6844d872826c
/app/src/test/java/com/willyao/android/timepickeralarm/ExampleUnitTest.java
791d7195b7371ed6ae629a636d1b589168df3e9c
[]
no_license
mityao/TimePickerAlarm
22f3c26f1d7dc21bb761f746cd2b018c6b97d229
8044a40ce7760d88c85c40cc748104d016290512
refs/heads/master
2021-01-22T21:58:27.636285
2017-03-19T17:07:18
2017-03-19T17:07:18
85,493,926
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.willyao.android.timepickeralarm; 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); } }
[ "mityaowei@hotmail.com" ]
mityaowei@hotmail.com
e6a814ffb899e64f7845aa76ab4baad051a49d72
0c742eb633c74cc60f8fba65710db6df9c7c2f24
/app/src/main/java/com/example/nedday/Jeu_T_6_21/Views/Learn_Fruits_Screen.java
7dbe119764efa6ff5c986bc3b9c5550adfd439d1
[]
no_license
AsmaeNedday/Android-Game
0626aa7bb21698f02e990df568795cecc0a5b23e
805745ce7f727612623b36a2276a5fe5ccf0a851
refs/heads/master
2023-08-16T23:43:07.992280
2020-01-01T09:00:00
2020-01-01T09:00:00
288,964,913
0
0
null
null
null
null
UTF-8
Java
false
false
8,117
java
package com.example.nedday.Jeu_T_6_21.Views; import android.content.Context; import android.media.AudioManager; import com.example.emobadaragaminglib.Base.Game; import com.example.emobadaragaminglib.Base.Graphics; import com.example.emobadaragaminglib.Base.Screen; import com.example.emobadaragaminglib.Components.Sprite; import com.example.nedday.Jeu_T_6_21.Assets.Learn_Assets; import com.example.nedday.Jeu_T_6_21.Assets.Voice; import com.example.nedday.Jeu_T_6_21.Sprites.Background; import com.example.nedday.Jeu_T_6_21.Sprites.MySprite; import com.example.nedday.Jeu_T_6_21.Sprites.MySprite_learn; import com.example.nedday.Jeu_T_6_21.logic.Mylogic; import com.example.nedday.Jeu_T_6_21.state.First; import com.example.nedday.Jeu_T_6_21.state.MyGameActivity; import com.example.nedday.Jeu_T_6_21.state.PopupActivity; import static com.example.nedday.Jeu_T_6_21.state.First.mp; import static com.example.nedday.Jeu_T_6_21.state.PopupActivity.muet; public class Learn_Fruits_Screen extends Screen { private Mylogic logic; private Background back,teacher; private MySprite_learn sprite0,sprite1,sprite2,sprite3,sprite4,sprite5,sprite6,sprite7,sprite8,home; MyGameActivity game_activity; int w_unit,h_unit; private MySprite ph[][]; public Learn_Fruits_Screen(Game game, Mylogic logic, MyGameActivity game_activity) { super(game); this.game_activity=game_activity; putPlaceHolders(); } private void putPlaceHolders(){ w_unit = game.getScreenWidth() / 11; h_unit = game.getScreenHeight() / 13; System.out.println(h_unit); System.out.println(w_unit); /** J'initialise mes sprites et je les met dans mon interface * * * */ back= new Background(game,Learn_Assets.backmenu,0,0,game.getScreenHeight(),game.getScreenWidth()); addSprite(back); teacher= new Background(game,Learn_Assets.teacher,7*w_unit,(int)(game.getScreenHeight()/1.7),(int)(game.getScreenHeight()/2.5),(int)(game.getScreenWidth()/3)); addSprite(teacher); sprite0=new MySprite_learn(game,Learn_Assets.im_7,1*w_unit,1*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite0); sprite1=new MySprite_learn(game,Learn_Assets.im_8,4*w_unit,1*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite1); sprite2=new MySprite_learn(game,Learn_Assets.im_9,8*w_unit,1*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite2); sprite8=new MySprite_learn(game,Learn_Assets.im_15,8*w_unit,4*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite8); sprite4=new MySprite_learn(game,Learn_Assets.im_11,4*w_unit,4*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/3.5)); addSprite(sprite4); sprite5=new MySprite_learn(game,Learn_Assets.im_12,(int)(game.getScreenWidth()/18),4*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite5); sprite6=new MySprite_learn(game,Learn_Assets.im_13,(int)(game.getScreenWidth()/18),7*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite6); sprite7=new MySprite_learn(game,Learn_Assets.im_14,4*w_unit,7*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite7); sprite3=new MySprite_learn(game,Learn_Assets.im_10,4*w_unit,10*h_unit,(int)(game.getScreenHeight()/5),(int)(game.getScreenWidth()/4.25)); addSprite(sprite3); home=new MySprite_learn(game,Learn_Assets.home,0*w_unit,11*h_unit,(int)(game.getScreenHeight()/8),(int)(game.getScreenWidth()/6)); addSprite(home); } @Override public void handleTouchDown(int x, int y, int pointer) { // In this method I check which Sprite I did touch and act accordingly super.handleTouchDown(x, y, pointer); Sprite s = getDraggedSprite(); AudioManager manager = (AudioManager)game_activity.getSystemService(Context.AUDIO_SERVICE); if ((s == home ) && !(manager.isMusicActive())) { if ((mp.isPlaying() ) && muet==0){ mp.start(); } game_activity.finish(); } if (PopupActivity.langue==1 || PopupActivity.langue==3){ if (s==sprite0 && !(manager.isMusicActive())) { Voice.im_ar_7.play(1); } if (s==sprite1 && !(manager.isMusicActive())) {Voice.im_ar_8.play(1);} if (s==sprite2 && !(manager.isMusicActive())) {Voice.im_ar_9.play(1);} if (s==sprite3 && !(manager.isMusicActive())) {Voice.im_ar_10.play(1);} if (s==sprite4 && !(manager.isMusicActive())) {Voice.im_ar_11.play(1);} if (s==sprite5 && !(manager.isMusicActive())) {Voice.im_ar_12.play(1);} if (s==sprite6 && !(manager.isMusicActive())) {Voice.im_ar_13.play(1);} if (s==sprite6 && !(manager.isMusicActive())) {Voice.im_ar_14.play(1);} if (s==sprite7 && !(manager.isMusicActive())) {Voice.im_ar_14.play(1);} if (s==sprite8 && !(manager.isMusicActive())) {Voice.im_ar_15.play(1);} } if (PopupActivity.langue==0){ if (s==sprite0 && !(manager.isMusicActive())) { Voice.im_fr_7.play(1); } if (s==sprite1 && !(manager.isMusicActive())) {Voice.im_fr_8.play(1);} if (s==sprite2 && !(manager.isMusicActive())) {Voice.im_fr_9.play(1);} if (s==sprite3 && !(manager.isMusicActive())) {Voice.im_fr_10.play(1);} if (s==sprite4 && !(manager.isMusicActive())) {Voice.im_fr_11.play(1);} if (s==sprite5 && !(manager.isMusicActive())) {Voice.im_fr_12.play(1);} if (s==sprite6 && !(manager.isMusicActive())) {Voice.im_fr_13.play(1);} if (s==sprite7 && !(manager.isMusicActive())) {Voice.im_fr_14.play(1);} if (s==sprite8 && !(manager.isMusicActive())) {Voice.im_fr_15.play(1);} } if (PopupActivity.langue==2){ if (s==sprite0 && !(manager.isMusicActive())) { System.out.println("tooooooomates"); Voice.im_ang_7.play(1); } if (s==sprite1 && !(manager.isMusicActive())) {Voice.im_ang_8.play(1);} if (s==sprite2 && !(manager.isMusicActive())) {Voice.im_ang_9.play(1);} if (s==sprite3 && !(manager.isMusicActive())) {Voice.im_ang_10.play(1);} if (s==sprite4 && !(manager.isMusicActive())) {Voice.im_ang_11.play(1);} if (s==sprite5 && !(manager.isMusicActive())) {Voice.im_ang_12.play(1);} if (s==sprite6 && !(manager.isMusicActive())) {Voice.im_ang_13.play(1);} if (s==sprite7 && !(manager.isMusicActive())) {Voice.im_ang_14.play(1);} if (s==sprite8 && !(manager.isMusicActive())) {Voice.im_ang_15.play(1);} } } @Override public void render(float deltaTime) { Graphics g = game.getGraphics(); g.drawARGB(255, 0, 0, 0); } @Override // The handle dragging is activated anytime you drag on your screen. public void handleDragging(int x, int y, int pointer) { super.handleDragging(x, y, pointer); } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { super.dispose(); System.gc(); } @Override public void backButton() { pause(); } public void job() { } }
[ "asmae.nedday1998@gmail.com" ]
asmae.nedday1998@gmail.com
ece6a864784b5520656c5583d299bc3f93fa1c6b
d65fb98a5dc67fb7a038e1bca7c2b7e189aed067
/app/src/main/java/org/androidpn/client/SetTagsIQ.java
33c90d8a5cca9396b62a397b622b727641c54fa2
[]
no_license
CallMeSp/M_Push
480e3f1638b709ef6d8054ee3fc0c3befdb6dbbc
4c7c9ab3339a77afc183b230aea54b5250868f0e
refs/heads/master
2021-01-19T20:12:55.502487
2017-04-06T15:51:49
2017-04-06T15:51:49
83,742,810
0
0
null
null
null
null
UTF-8
Java
false
false
1,670
java
package org.androidpn.client; import org.jivesoftware.smack.packet.IQ; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * Created by Administrator on 2017/3/24. */ public class SetTagsIQ extends IQ { private String username; private List<String> tagList=new ArrayList<String>(); public List<String> getTagList() { return tagList; } public void setTagList(List<String> tagList) { this.tagList = tagList; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @Override public String getChildElementXML() { StringBuilder buf = new StringBuilder(); buf.append("<").append("settags").append(" xmlns=\"").append( "androidpn:iq:settags").append("\">"); if (username != null) { buf.append("<username>").append(username).append("</username>"); } if (tagList!=null&&!tagList.isEmpty()){ buf.append("<tags>"); boolean needSeperate=false; for (String tag:tagList){ if (needSeperate){ buf.append(","); } buf.append(tag); needSeperate=true; } buf.append("</tags>"); } buf.append("</").append("settags").append("> "); return buf.toString(); } void et(){ Scanner sc = new Scanner(System.in); String x=sc.nextLine(); String[] ss=x.split(" "); int[] realnum=new int[10]; int[] copy=realnum.clone(); } }
[ "995199235@qq.com" ]
995199235@qq.com
3965de57f54f4508f160b6398ac1843ac35f4251
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/boot/svg/a/a/azi.java
6dc75191fbe73011db81cb11871039e6cf0082cf
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
3,887
java
package com.tencent.mm.boot.svg.a.a; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.Paint.Join; import android.graphics.Paint.Style; import android.graphics.Path; import android.os.Looper; import com.tencent.mm.svg.WeChatSVGRenderC2Java; import com.tencent.mm.svg.c; public final class azi extends c { private final int height = 96; private final int width = 96; public final int a(int paramInt, Object[] paramArrayOfObject) { switch (paramInt) { default: case 0: case 1: case 2: } while (true) { paramInt = 0; while (true) { return paramInt; paramInt = 96; continue; paramInt = 96; } Canvas localCanvas = (Canvas)paramArrayOfObject[0]; paramArrayOfObject = (Looper)paramArrayOfObject[1]; c.h(paramArrayOfObject); c.g(paramArrayOfObject); Object localObject = c.k(paramArrayOfObject); ((Paint)localObject).setFlags(385); ((Paint)localObject).setStyle(Paint.Style.FILL); Paint localPaint = c.k(paramArrayOfObject); localPaint.setFlags(385); localPaint.setStyle(Paint.Style.STROKE); ((Paint)localObject).setColor(-16777216); localPaint.setStrokeWidth(1.0F); localPaint.setStrokeCap(Paint.Cap.BUTT); localPaint.setStrokeJoin(Paint.Join.MITER); localPaint.setStrokeMiter(4.0F); localPaint.setPathEffect(null); c.a(localPaint, paramArrayOfObject).setStrokeWidth(1.0F); localPaint = c.a((Paint)localObject, paramArrayOfObject); localPaint.setColor(-12799249); localCanvas.save(); localPaint = c.a(localPaint, paramArrayOfObject); localObject = c.l(paramArrayOfObject); ((Path)localObject).moveTo(48.11264F, 11.0F); ((Path)localObject).cubicTo(29.075232F, 11.190086F, 20.986343F, 26.826294F, 20.986343F, 40.877155F); ((Path)localObject).cubicTo(9.261343F, 52.839657F, 12.905231F, 69.573708F, 16.545231F, 69.573708F); ((Path)localObject).cubicTo(18.859121F, 69.951294F, 22.617083F, 63.596981F, 22.617083F, 63.596981F); ((Path)localObject).cubicTo(22.617083F, 63.596981F, 22.733749F, 67.556465F, 25.812454F, 71.138359F); ((Path)localObject).cubicTo(22.417454F, 72.655174F, 20.195602F, 75.137932F, 20.195602F, 77.949135F); ((Path)localObject).cubicTo(20.195602F, 82.570686F, 26.175417F, 86.316811F, 33.553936F, 86.316811F); ((Path)localObject).cubicTo(39.042454F, 86.316811F, 43.753193F, 84.242676F, 45.80912F, 81.278877F); ((Path)localObject).lineTo(50.492638F, 81.278877F); ((Path)localObject).cubicTo(52.547268F, 84.242676F, 57.258011F, 86.316811F, 62.746529F, 86.316811F); ((Path)localObject).cubicTo(70.123749F, 86.316811F, 76.106155F, 82.571983F, 76.106155F, 77.949135F); ((Path)localObject).cubicTo(76.106155F, 75.137932F, 73.884308F, 72.656464F, 70.489304F, 71.138359F); ((Path)localObject).cubicTo(73.568008F, 67.556465F, 73.684677F, 63.596981F, 73.684677F, 63.596981F); ((Path)localObject).cubicTo(73.684677F, 63.596981F, 77.441345F, 69.951294F, 79.756531F, 69.573708F); ((Path)localObject).cubicTo(83.39653F, 69.572411F, 87.039124F, 52.838364F, 75.314117F, 40.875862F); ((Path)localObject).cubicTo(75.314117F, 26.826294F, 67.14875F, 11.181034F, 48.11264F, 11.0F); ((Path)localObject).close(); WeChatSVGRenderC2Java.setFillType((Path)localObject, 2); localCanvas.drawPath((Path)localObject, localPaint); localCanvas.restore(); c.j(paramArrayOfObject); } } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar * Qualified Name: com.tencent.mm.boot.svg.a.a.azi * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
5b050b96faddc2a212605a0069b7da0c0a6e6d02
d3614cde4bdc25a78fea83b510795d2f682f7fb2
/src/main/java/pl/accenture/demo/DemoApplication.java
706aaa290cf53b8bb34262f7f288284e792054a8
[]
no_license
DonutDonkey/Altkom-RestApiExercise
4fab6881773d1035094eb7278723ae6b17fbe1c0
0faa4492d0595ef9a38186821821902cacf681e3
refs/heads/master
2020-09-28T23:34:30.201264
2019-12-09T13:49:56
2019-12-09T13:49:56
226,892,515
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package pl.accenture.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import pl.accenture.demo.model.Person; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "34782950+DonutDonkey@users.noreply.github.com" ]
34782950+DonutDonkey@users.noreply.github.com
71222a01e34530e79f60ce7b14d35515317e05b0
5bb4a4b0364ec05ffb422d8b2e76374e81c8c979
/sdk/storagecache/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsInner.java
5615cee9845a97db704ad91ddf071a979f796851
[ "MIT", "LicenseRef-scancode-generic-cla", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
FabianMeiswinkel/azure-sdk-for-java
bd14579af2f7bc63e5c27c319e2653db990056f1
41d99a9945a527b6d3cc7e1366e1d9696941dbe3
refs/heads/main
2023-08-04T20:38:27.012783
2020-07-15T21:56:57
2020-07-15T21:56:57
251,590,939
3
1
MIT
2023-09-02T00:50:23
2020-03-31T12:05:12
Java
UTF-8
Java
false
false
13,927
java
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Query; import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; /** * An instance of this class provides access to all the operations defined * in Operations. */ public class OperationsInner { /** The Retrofit service to perform REST calls. */ private OperationsService service; /** The service client containing this operation class. */ private StorageCacheMgmtClientImpl client; /** * Initializes an instance of OperationsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ public OperationsInner(Retrofit retrofit, StorageCacheMgmtClientImpl client) { this.service = retrofit.create(OperationsService.class); this.client = client; } /** * The interface defining all the services for Operations to be * used by Retrofit to perform actually REST calls. */ interface OperationsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Operations list" }) @GET("providers/Microsoft.StorageCache/operations") Observable<Response<ResponseBody>> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Operations listNext" }) @GET Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } /** * Lists all of the available RP operations. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList&lt;ApiOperationInner&gt; object if successful. */ public PagedList<ApiOperationInner> list() { ServiceResponse<Page<ApiOperationInner>> response = listSinglePageAsync().toBlocking().single(); return new PagedList<ApiOperationInner>(response.body()) { @Override public Page<ApiOperationInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Lists all of the available RP operations. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<ApiOperationInner>> listAsync(final ListOperationCallback<ApiOperationInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(), new Func1<String, Observable<ServiceResponse<Page<ApiOperationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApiOperationInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Lists all of the available RP operations. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;ApiOperationInner&gt; object */ public Observable<Page<ApiOperationInner>> listAsync() { return listWithServiceResponseAsync() .map(new Func1<ServiceResponse<Page<ApiOperationInner>>, Page<ApiOperationInner>>() { @Override public Page<ApiOperationInner> call(ServiceResponse<Page<ApiOperationInner>> response) { return response.body(); } }); } /** * Lists all of the available RP operations. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;ApiOperationInner&gt; object */ public Observable<ServiceResponse<Page<ApiOperationInner>>> listWithServiceResponseAsync() { return listSinglePageAsync() .concatMap(new Func1<ServiceResponse<Page<ApiOperationInner>>, Observable<ServiceResponse<Page<ApiOperationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApiOperationInner>>> call(ServiceResponse<Page<ApiOperationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Lists all of the available RP operations. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;ApiOperationInner&gt; object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ApiOperationInner>>> listSinglePageAsync() { if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ApiOperationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApiOperationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ApiOperationInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<ApiOperationInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<ApiOperationInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<ApiOperationInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<ApiOperationInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Lists all of the available RP operations. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList&lt;ApiOperationInner&gt; object if successful. */ public PagedList<ApiOperationInner> listNext(final String nextPageLink) { ServiceResponse<Page<ApiOperationInner>> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<ApiOperationInner>(response.body()) { @Override public Page<ApiOperationInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Lists all of the available RP operations. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<ApiOperationInner>> listNextAsync(final String nextPageLink, final ServiceFuture<List<ApiOperationInner>> serviceFuture, final ListOperationCallback<ApiOperationInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<ApiOperationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApiOperationInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Lists all of the available RP operations. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;ApiOperationInner&gt; object */ public Observable<Page<ApiOperationInner>> listNextAsync(final String nextPageLink) { return listNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<ApiOperationInner>>, Page<ApiOperationInner>>() { @Override public Page<ApiOperationInner> call(ServiceResponse<Page<ApiOperationInner>> response) { return response.body(); } }); } /** * Lists all of the available RP operations. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;ApiOperationInner&gt; object */ public Observable<ServiceResponse<Page<ApiOperationInner>>> listNextWithServiceResponseAsync(final String nextPageLink) { return listNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ApiOperationInner>>, Observable<ServiceResponse<Page<ApiOperationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApiOperationInner>>> call(ServiceResponse<Page<ApiOperationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Lists all of the available RP operations. * ServiceResponse<PageImpl<ApiOperationInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;ApiOperationInner&gt; object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ApiOperationInner>>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ApiOperationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApiOperationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ApiOperationInner>> result = listNextDelegate(response); return Observable.just(new ServiceResponse<Page<ApiOperationInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<ApiOperationInner>> listNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<ApiOperationInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<ApiOperationInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } }
[ "yaozheng@microsoft.com" ]
yaozheng@microsoft.com
171921f5cfb99668da94a65dff82699807911ec5
95d308587994b35923ab49abf88737eeb168c1a7
/src/kriptodx/controllers/FXMLLoginController.java
fe7ee4bd8a5ef5d7561a39d31a6134b0331c99df
[]
no_license
dixdragan/ImageSteganography
16203c9b7d73b4fc4d1832006373958758f9c9ce
d1bf0e341a186370de2f5e6ba1c4d8d90750d57d
refs/heads/master
2021-04-09T11:00:06.292334
2018-03-15T20:16:48
2018-03-15T20:16:48
125,420,136
0
0
null
null
null
null
UTF-8
Java
false
false
3,300
java
package kriptodx.controllers; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import kriptodx.CryptoTools; import kriptodx.UserTools; /** * * @author DX */ public class FXMLLoginController implements Initializable { @FXML private Button buttonLogin; @FXML private Label labelErr; @FXML private TextField username; @FXML private PasswordField password; @Override public void initialize(URL url, ResourceBundle rb) { password.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if(event.getCode().equals(KeyCode.ENTER)) { loginAction(new ActionEvent()); } } }); } @FXML private void loginAction(ActionEvent event) { labelErr.setText(""); String user = username.getText(); String pass = password.getText(); /* // First line checks if(user.isEmpty()){ labelErr.setText("Username is empty"); return; } if (pass.isEmpty()) { labelErr.setText("Password is empty"); return; } if(user.length() < 3){ labelErr.setText("Username is too short"); return; }if(pass.length() < 3){ labelErr.setText("Password is too short"); return; } */ //System.out.println("HASH NEW USER: " + CryptoTools.hashPassword(pass)); // Launch the main window if (UserTools.check(user,pass)) { kriptodx.KriptoDX.currentUser = user; try{ // Show main window Parent toot = (Parent) (new FXMLLoader(getClass().getResource("/kriptodx/fxmls/FXMLMain.fxml"))).load(); Stage mainStage = new Stage(); mainStage.setTitle("KRIPTO 2K18"); mainStage.setMinWidth(590); mainStage.setMinHeight(400); mainStage.getIcons().add(new Image("kriptodx/assets/cryptologo.png")); mainStage.setScene(new Scene(toot)); mainStage.show(); // Hide this window ((Stage)(buttonLogin.getScene().getWindow())).close(); // If you want to implement Logout //((Node)(event.getSource())).getScene().getWindow().hide(); }catch(Exception ex){ System.out.println("Error while opening the main window!"); ex.printStackTrace(); } }else{ username.setText(""); password.setText(""); labelErr.setText("Wrong username or password!"); } } }
[ "dragan2dix@gmail.com" ]
dragan2dix@gmail.com
e650cfe7ae4ce269a5c47a65e659c261ccbd5869
88f5ff5d2d151be34a32cb343471d025e8b3347a
/tdhc_cgsys/.svn/pristine/1c/1c493102800c0f0757471074fdb3ae697e10694a.svn-base
1703da15dabcde5dc2fbfeb3cc27cc17bead75ad
[]
no_license
ylh-github/test
872f9caded48b02c60085b087e934294b4f99510
88eb9ab8c726c37e4f98bb37a908ebff656bbb00
refs/heads/master
2022-12-23T21:08:28.490256
2020-03-17T14:55:14
2020-03-17T15:02:39
247,901,336
0
0
null
2022-12-16T00:35:15
2020-03-17T07:02:03
JavaScript
UTF-8
Java
false
false
6,315
package code_fb_cg.service.impl; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import code_fb_cg.entity.ItemEntity; import code_fb_cg.entity.TbItem; import code_fb_cg.mapper.TbItemMapper; import code_fb_cg.service.ItemService; import transfer.EmptyData; import transfer.EmptyTag; import transfer.Errcode; import transfer.RequestObject; import transfer.ResponseObject; import transfer.ResponseObjectBuilder; import vip.toda.piper.auth.web.client.User; @Service public class ItemServiceImp implements ItemService{ @Autowired private TbItemMapper tbItemMapper; @Override public ResponseObject<EmptyTag, List<TbItem>> searchItem(RequestObject<EmptyTag, ItemEntity> requestObject) { // TODO Auto-generated method stub ResponseObjectBuilder builder = ResponseObjectBuilder.create(); List<TbItem> searchItem = tbItemMapper.searchItem(requestObject.getData().getTbItem()); return builder.data(searchItem).msg("查询成功").errcode(Errcode.Success).build(); } @Override @Transactional public ResponseObject<EmptyTag, EmptyData> addItem(User user,RequestObject<EmptyTag, ItemEntity> requestObject) { ResponseObjectBuilder builder = ResponseObjectBuilder.create(); try { List<TbItem> listTbItem = requestObject.getData().getListTbItem(); if(listTbItem.isEmpty()) { return builder.msg("新增传值异常!!!!").errcode(Errcode.FailParameterError).build(); } for (TbItem tbItem : listTbItem) { tbItem.setcCreater(user.getUserName()); tbItem.setcCreatetime(new Date()); } int addItem = tbItemMapper.addItem(requestObject.getData().getListTbItem()); if(addItem>0) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事物回滚 return builder.msg("新增失败!!!!").errcode(Errcode.FailParameterError).build(); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); return builder.msg("异常!!!!").errcode(Errcode.FailParameterError).build(); } return builder.msg("新增成功!!!!").errcode(Errcode.Success).build(); } @Override @Transactional public ResponseObject<EmptyTag, EmptyData> updateItem(User user, RequestObject<EmptyTag, ItemEntity> requestObject) { ResponseObjectBuilder builder = ResponseObjectBuilder.create(); try { List<TbItem> listTbItem = requestObject.getData().getListTbItem(); if(listTbItem.isEmpty()) { return builder.msg("修改传值异常!!!!").errcode(Errcode.FailParameterError).build(); } for (TbItem tbItem : listTbItem) { tbItem.setcModifier(user.getUserName()); tbItem.setcModifydate(new Date()); } int updateItem = tbItemMapper.updateItem(requestObject.getData().getListTbItem()); if(updateItem>0) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事物回滚 return builder.msg("修改失败!!!!").errcode(Errcode.FailParameterError).build(); } } catch (Exception e) { e.printStackTrace(); return builder.msg("异常!!!!").errcode(Errcode.FailParameterError).build(); } return builder.msg("修改成功!!!!").errcode(Errcode.Success).build(); } @Override public ResponseObject<EmptyTag, EmptyData> deleteItem(RequestObject<EmptyTag, ItemEntity> requestObject) { ResponseObjectBuilder builder = ResponseObjectBuilder.create(); try { List<TbItem> listTbItem = requestObject.getData().getListTbItem(); if(listTbItem.isEmpty()) { return builder.msg("删除传值异常!!!!").errcode(Errcode.FailParameterError).build(); } int updateItem = tbItemMapper.deleteItem(requestObject.getData().getListTbItem()); if(updateItem>0) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事物回滚 return builder.msg("删除失败!!!!").errcode(Errcode.FailParameterError).build(); } } catch (Exception e) { e.printStackTrace(); return builder.msg("异常!!!!").errcode(Errcode.FailParameterError).build(); } return builder.msg("删除成功!!!!").errcode(Errcode.Success).build(); } @Override public ResponseObject<EmptyTag, EmptyData> disableItem(RequestObject<EmptyTag, ItemEntity> requestObject) { ResponseObjectBuilder builder = ResponseObjectBuilder.create(); try { List<TbItem> listTbItem = requestObject.getData().getListTbItem(); if(listTbItem.isEmpty()) { return builder.msg("禁用传值异常!!!!").errcode(Errcode.FailParameterError).build(); } for (TbItem tbItem : listTbItem) { tbItem.setcDr("1"); } int updateItem = tbItemMapper.ableItem(listTbItem); if(updateItem>0) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事物回滚 return builder.msg("禁用失败!!!!").errcode(Errcode.FailParameterError).build(); } } catch (Exception e) { e.printStackTrace(); return builder.msg("异常!!!!").errcode(Errcode.FailParameterError).build(); } return builder.msg("禁用成功!!!!").errcode(Errcode.Success).build(); } @Override public ResponseObject<EmptyTag, EmptyData> enableItem(RequestObject<EmptyTag, ItemEntity> requestObject) { ResponseObjectBuilder builder = ResponseObjectBuilder.create(); try { List<TbItem> listTbItem = requestObject.getData().getListTbItem(); if(listTbItem.isEmpty()) { return builder.msg("启用传值异常!!!!").errcode(Errcode.FailParameterError).build(); } for (TbItem tbItem : listTbItem) { tbItem.setcDr("0"); } int updateItem = tbItemMapper.ableItem(requestObject.getData().getListTbItem()); if(updateItem>0) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事物回滚 return builder.msg("启用失败!!!!").errcode(Errcode.FailParameterError).build(); } } catch (Exception e) { e.printStackTrace(); return builder.msg("异常!!!!").errcode(Errcode.FailParameterError).build(); } return builder.msg("启用成功!!!!").errcode(Errcode.Success).build(); } }
[ "yanglong_hui@126.com" ]
yanglong_hui@126.com
8aa48c102c679cea698281bd0c59b11921149c1c
ea251f8091d7e40f8f8287ea843ac070cb2108df
/consumer/src/main/java/com/u4/rabbitmq/consumer/listeners/PictureLogConsumerTwo.java
fc2b1f0d90427213d5964876b0ffd6ce20423ff0
[]
no_license
ChanManChan/producer-consumer-rabbitmq
5d39acda6b7af499f8180106d82886289f1d1c21
930b09bc42304fec824b1be5d55fc122030229e5
refs/heads/master
2023-02-12T19:08:53.467214
2021-01-04T14:33:35
2021-01-04T14:33:35
326,566,388
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package com.u4.rabbitmq.consumer.listeners; import com.fasterxml.jackson.databind.ObjectMapper; import com.u4.rabbitmq.consumer.entity.Picture; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Service; import java.io.IOException; //@Service public class PictureLogConsumerTwo { private ObjectMapper objectMapper = new ObjectMapper(); private static final Logger log = LoggerFactory.getLogger(PictureLogConsumerTwo.class); @RabbitListener(queues = "q.picture.log") public void listen(String message) { try { var p = objectMapper.readValue(message, Picture.class); log.info("On log: {}", p.toString()); } catch (IOException e) { e.printStackTrace(); } } }
[ "ngopal253@gmail.com" ]
ngopal253@gmail.com
076d62fda26268601797bcc4fa64213090e94b05
7720e8d70281f2f387356f004edfed9562add7cf
/src/main/java/com/marlo/java/MyBigDecimal.java
7d95bb5320a81d7502d2b3f2e3952fbc3baeb8f7
[]
no_license
marlorebaza/hacker-rank-java
f5570d78005bd5097c1e3d62c9c3865ef337a3bb
c40051c5d0a5a2997dd531707fdd9338c8869650
refs/heads/master
2021-07-20T10:43:44.338615
2019-11-17T17:47:47
2019-11-17T17:47:47
222,287,291
0
0
null
2020-10-13T17:31:50
2019-11-17T17:41:29
Java
UTF-8
Java
false
false
1,075
java
package com.marlo.java; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Scanner; public class MyBigDecimal { public static void main(String[] args) { //Input Scanner sc= new Scanner(System.in); int n=sc.nextInt(); String[]s=new String[n+2]; for(int i=0;i<n;i++){ s[i]=sc.next(); } sc.close(); for (int i = 0; i < (s.length - 3); i++) { int equalValueIndex = -1; for (int j = (i + 1); j < s.length - 2; j++) { int comparison = new BigDecimal(s[i]).compareTo(new BigDecimal(s[j])); if (comparison < 0) { String temp = s[i]; s[i] = s[j]; if (equalValueIndex == -1) { s[j] = temp; } else { s[j] = s[equalValueIndex]; s[equalValueIndex] = temp; } } else if (comparison == 0) { equalValueIndex = j; } } } //Output for(int i=0;i<n;i++) { System.out.println(s[i]); } } }
[ "marlo_rebaza@hotmail.com" ]
marlo_rebaza@hotmail.com
e9830043fd6518ee7e972eb67df6b67756b25c1e
e75e05d84c7858a323dda7ef302ed7af5d9458ae
/backend/src/main/java/com/guzung/divineshop/entities/HolyProvider.java
d3fc24542a74381373da6185a4e515249eb05344
[ "MIT" ]
permissive
guzung/DivineShop
58156ed362dee2033a19f207499ec191d47d729e
0f6de9ae0d382639b12f0d167245c0ba3df6f6f6
refs/heads/master
2020-04-28T15:34:20.764856
2019-03-25T09:10:29
2019-03-25T09:10:29
175,379,656
2
0
null
null
null
null
UTF-8
Java
false
false
495
java
package com.guzung.divineshop.entities; import lombok.Data; import javax.persistence.*; @Data @Entity @Table(name = "holy_providers") public class HolyProvider { @Id @Column(name = "id") @GeneratedValue( strategy = GenerationType.IDENTITY ) private Integer id; @Basic @Column(name = "name") private String name; @Basic @Column(name = "description") private String description; @Basic @Column(name = "address") private String address; }
[ "guzungeorge@gmail.com" ]
guzungeorge@gmail.com
c0776335d3b19dc92aa6cc05a2c92c5da1f3253c
31dd47702609dac7be540f5c103f8916b0ecbd2e
/NetBeansProjects/practico2/src/practico2/Practico2.java
e609d5ae603951d0913d30ce9877a09fcf7a9498
[]
no_license
EnriqueV/NetbeanasProject2
ecf4c7a47f4c472730c6571ec94c64a946dc378c
857f14619f9c2039e0f5c89306b564754e19d120
refs/heads/master
2020-05-16T22:13:10.819888
2014-09-14T02:35:06
2014-09-14T02:35:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package practico2; import java.util.ArrayList; import java.util.Scanner; /** * * @author eduardo */ public class Practico2 { /** * @param args the command line arguments */ public static void main(String[] args) { ArrayList lst; lst= new ArrayList(); Scanner tx= new Scanner(System.in); String datos; System.out.println("Ingrese sus datos separados por una (,) ejemplo: Eduardo,Valencia,campeon"); datos=tx.nextLine(); String[] recorrer= datos.split(","); String nombre= (recorrer[0].trim()); String apellido= (recorrer[1].trim()); String estado=(recorrer[2].trim()); lst.add(nombre); lst.add(apellido); lst.add(estado); for(int i=0; i<lst.size();i++){ System.out.println("los valores son:"+lst.get(i)); } } }
[ "eduardo@localhost.localdomain" ]
eduardo@localhost.localdomain
793e3fbd1cc5a8fe28bc591c73108ccf3f8e6417
83956191688e0696a586cdc5a83db30fade0291b
/src/main/java/ua/kpi/PatternsTasks/VGAAdapter/DVI.java
0aba67c2eec2ca96fecc670187d5ab15bd6ceeac
[]
no_license
jekafortuna/PatternsTasks
45ca8344e9aa83e68fe8fb0d785529327ddd803e
e1113d9e2098d57a2e9d43ecb76b5a9f587974ff
refs/heads/master
2021-01-12T06:06:11.860266
2017-03-01T21:46:39
2017-03-01T21:46:39
77,301,290
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package ua.kpi.PatternsTasks.VGAAdapter; /** * Created by Evgeniy on 18.01.2017. */ public class DVI implements DVIAdapter { private SVGA svga; public DVI(SVGA svga) { this.svga = svga; } @Override public void connectDigital() { svga.connectAnalog(); System.out.println("Connecting to DVI socket ..."); } }
[ "evgeniy.fortuna@gmail.com" ]
evgeniy.fortuna@gmail.com
be7ae648b21b95c8f4ef8f4c8838ea14f86d3272
1478e836207f763adea7cadd123a6a888fa77c0c
/library/src/main/java/com/just/library/WebPools.java
8830a6ffea053872ddd92200642626364ea28427
[ "Apache-2.0" ]
permissive
AndWong/AgentWeb
047adbe320021967258b785e64b95f4851dccc2e
e06b8734d86887f741b762251a07f80e56ca1cbd
refs/heads/master
2021-01-16T05:28:52.452853
2017-08-10T15:24:25
2017-08-10T15:24:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
103
java
package com.just.library; /** * Created by cenxiaozhong on 2017/8/10. */ public class WebPools { }
[ "xiaozhongcen@gmail.com" ]
xiaozhongcen@gmail.com
f994539a45f66b85757400d5eb1befc3c7af3303
a9d07fdb566c9ae6ffc10af9ba6cadd8a4e20ca8
/app/src/test/java/rodriguez_blanco/com/bakingapp/ExampleUnitTest.java
13b187c4259339504c174973e7a8b1ea9714643c
[]
no_license
GonzaloRodriguezBlanco/BakingApp
48a44c934b3773e0f158d22fcb8fbe6ecea77b20
d4e7ca265d03906e292ccc8b9650d345bb2794f8
refs/heads/master
2020-12-02T10:07:10.238577
2017-07-23T22:31:19
2017-07-23T22:31:19
96,692,594
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package rodriguez_blanco.com.bakingapp; 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); } }
[ "gonzalo@rodriguez-blanco.com" ]
gonzalo@rodriguez-blanco.com
3b9b210aaf6802b5598cb8f06c81facf10fe00f0
0fa192209fca5dbc078920326f717da5a2e45941
/src/main/java/com/toastedbits/uva/programmingchallenges/chapter4/Problem10026.java
3271d9d92ffc3f2572e033f5991659afcfcabe7e
[]
no_license
AlexBarnes86/Algorithms
f3cc97b481f76ccfd69c9c41a057cac331a8ebcb
75de465ddef27e0094a28b0999b9f72ed6e8555c
refs/heads/main
2023-08-13T18:40:41.632904
2021-07-17T03:07:47
2021-07-17T03:07:47
414,337,723
0
0
null
null
null
null
UTF-8
Java
false
false
2,364
java
package com.toastedbits.uva.programmingchallenges.chapter4; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; import java.util.StringTokenizer; public class Problem10026 { public static final boolean DEBUG = false; public static final boolean DEBUG_FILE = false; public static void debug(Object msg) { if(DEBUG) { System.out.print("DEBUG: "); if(msg != null) { System.out.println(msg.toString()); } else { System.out.println(msg); } } } public static final Scanner sc = getScanner(); public static Scanner getScanner() { try { if(DEBUG_FILE) { String fileName = "ProgrammingChallenges/input/chapter4/Problem10026.in"; Scanner sc = new Scanner(new File(fileName)); System.out.println("Reading from: " + fileName); return sc; } else { return new Scanner(System.in); } } catch(Exception e) { return new Scanner(System.in); } } public static class Job implements Comparable<Job> { public int index; public int duration; public int penalty; public Job(String line) { StringTokenizer st = new StringTokenizer(line); duration = Integer.parseInt(st.nextToken()); penalty = Integer.parseInt(st.nextToken()); } public int compareTo(Job other) { if(penalty*other.duration == other.penalty*duration) { return 0; } else if(penalty*other.duration < other.penalty*duration) { return 1; } else { return -1; } } @Override public String toString() { return "I: " + index + " D: " + duration + " P: " + penalty; } } public static void main(String[] args) { int cases = Integer.parseInt(sc.nextLine()); for(int i = 0; i < cases; ++i) { sc.nextLine(); int jobCt = Integer.parseInt(sc.nextLine()); List<Job> jobs = new ArrayList<Job>(); for(int j = 0; j < jobCt; ++j) { Job job = new Job(sc.nextLine()); job.index = j+1; jobs.add(job); } if(i != 0) { System.out.println(); } System.out.println(solve(jobs)); } } private static String solve(List<Job> jobs) { debug("Unsorted:"); debug(jobs); Collections.sort(jobs); StringBuilder sb = new StringBuilder(); for(Job job : jobs) { sb.append(job.index + " "); } sb.deleteCharAt(sb.length()-1); return sb.toString(); } }
[ "AlexBarnes86@gmail.com" ]
AlexBarnes86@gmail.com
ba146f9fd6f4e99a68855de7d021ca8415e1811f
8278faa481caad81a4f21dd802545639dc305c70
/src/main/java/com/xf/util/DateUtils.java
8efc493c2416e6a54892dd70b5c9911e4acd7661
[]
no_license
Legendary998/ddup
b71d271d2b99803efbc389e8f7304cc69346e714
6c1e44c9d0e5973962e084a1164e715a10ab413e
refs/heads/master
2023-05-27T20:34:19.110828
2021-06-15T10:49:17
2021-06-15T10:49:17
356,194,514
0
0
null
null
null
null
UTF-8
Java
false
false
1,525
java
package com.xf.util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateUtils { //Date toDateTime(value, format) //Date toDate8(value)//yyyy-MM-dd //Date toTime6(value)//HH:mm:ss //Date toDateTime12(value)//yyyy-MM-dd HH:mm:ss /** * 字符串转换成日期 * @param value 日期字符串 * @param format 日期格式 * @return * @throws ParseException */ public static Date toDateTime(String value, String format) throws ParseException{ SimpleDateFormat sf = new SimpleDateFormat(format); return sf.parse(value); } /** * 字符串转换成日期 * @param value 日期字符串 * @return * @throws ParseException */ public static Date toDate8(String value) throws ParseException{ //str="yyyy-MM-dd"; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); return format.parse(value); } /** * 字符串转换成日期 * @param value 日期字符串 * @return * @throws ParseException */ public static Date toTime6(String value) throws ParseException{ //str="HH:mm:ss"; SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); return format.parse(value); } /** * 字符串转换成日期 * @param value 日期字符串 * return * @throws ParseException */ public static Date toDateTime12(String value) throws ParseException{ //str="yyyy-MM-dd HH:mm:ss"; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return format.parse(value); } }
[ "243204404@qq.com" ]
243204404@qq.com
a4071321709091e0d8d55b6509285cf155d55589
7c971759e82cd83845ff8d4af173b7a06364137e
/PhotographerTest.java
0fa66ca7aadec0566ab1e818af225695baa8b703
[]
no_license
hatwell/wk6_day2
d443d5cc4c13fdd845b67ea33c234e1737756f85
d9eb5be33ff2c7a079558759bf4d7d96d9e5ee05
refs/heads/master
2021-01-19T11:21:55.587464
2017-04-12T08:22:26
2017-04-12T08:22:26
87,958,161
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
import static org.junit.Assert.*; import org.junit.*; public class PhotographerTest { Photographer photographer; DigitalCamera digitalCamera; AnalogueCamera analogueCamera; @Before public void before() { photographer = new Photographer("Susan"); digitalCamera = new DigitalCamera("Canon D5 big zoom lens I dunno"); analogueCamera = new AnalogueCamera("I have film in me!!"); } @Test public void photographerHasName(){ assertEquals("Susan", photographer.getName()); } @Test public void addCameraToPrintables(){ photographer.addCamera(digitalCamera); assertEquals(1, photographer.printablesLength()); } @Test public void removeCameraFromPrintables(){ photographer.addCamera(digitalCamera); photographer.addCamera(analogueCamera); photographer.removeCamera(digitalCamera); assertEquals(1, photographer.printablesLength()); } @Test public void addPhotosToJournal(){ photographer.addToJournal("Tuesday", 6); assertEquals(photographer.journal.keys[0], "Tuesday"); } }
[ "caroline.hatwell@gmail.com" ]
caroline.hatwell@gmail.com
2904439c6f7d9de82189dc482c3b0ad24fad69ba
aa9c5d10b9415359879956a10bbbf1d30dbc3c48
/app/src/main/java/org/futuroblanquiazul/futuroblaquiazul/Peticiones/RecuperarDisponibles2.java
7a12439cc31f65d912065dd0724e40d13e4f8fd0
[]
no_license
inca2018/FuturoBlaquiazul
d35f921cbe5ff0b66f7b2e82e497d7cda5e5891f
23f4854309fe93918d679020f3d7df145a31568a
refs/heads/master
2021-04-27T19:13:50.011873
2018-04-11T20:51:21
2018-04-11T20:51:21
122,352,833
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package org.futuroblanquiazul.futuroblaquiazul.Peticiones; import com.android.volley.Response; import com.android.volley.toolbox.StringRequest; import org.futuroblanquiazul.futuroblaquiazul.Utils.Conexion; import java.util.HashMap; import java.util.Map; /** * Created by Jesus Inca on 14/02/2018. */ public class RecuperarDisponibles2 extends StringRequest { private static final String LOGIN_REQUEST_URL = Conexion.RUTA_SERVICIO_MANTENIMIENTO; private Map<String, String> params; public RecuperarDisponibles2(Response.Listener<String> listener) { super(Method.POST, LOGIN_REQUEST_URL,listener, null); params = new HashMap<>(); params.put("operacion","Recuperar_Personas_Disponibles_metodologia"); } @Override public Map<String, String> getParams() { return params; } }
[ "jic_d12@hotmail.com" ]
jic_d12@hotmail.com
40812ff0c73fda90d618aaa59020696367c378f6
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/53/src_0.java
a1c18ee1a8c4d1ea0ba477083045bac55dabcf7d
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,609
java
/*BEGIN_COPYRIGHT_BLOCK * * Copyright (c) 2001-2010, JavaPLT group at Rice University (drjava@rice.edu) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software is Open Source Initiative approved Open Source Software. * Open Source Initative Approved is a trademark of the Open Source Initiative. * * This file is part of DrJava. Download the current version of this project * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/ * * END_COPYRIGHT_BLOCK*/ package edu.rice.cs.drjava.model.debug.jpda; import edu.rice.cs.util.Log; import com.sun.jdi.*; import com.sun.jdi.event.*; import com.sun.jdi.request.*; import java.io.*; import javax.swing.SwingUtilities; // used in instead of java.awt.EventQueue because of class name clash import edu.rice.cs.drjava.model.debug.DebugException; import edu.rice.cs.util.UnexpectedException; /** A thread that listens and responds to events from JPDA when the debugger has attached to another JVM. * @version $Id$ */ public class EventHandlerThread extends Thread { /** Debugger to which this class reports events. */ private final JPDADebugger _debugger; /** JPDA reference to the VirtualMachine generating the events. */ private final VirtualMachine _vm; /** Whether this event handler is currently connected to the JPDA VirtualMachine. */ private volatile boolean _connected; /** A log for recording messages in a file. */ private static final Log _log = new Log("GlobalModel.txt", false); /** Creates a new EventHandlerThread to listen to events from the given debugger and virtual machine. Calling * this Thread's start() method causes it to begin listenting. * @param debugger Debugger to which to report events * @param vm JPDA reference to the VirtualMachine generating the events */ EventHandlerThread(JPDADebugger debugger, VirtualMachine vm) { super("DrJava Debug Event Handler"); _debugger = debugger; _vm = vm; _connected = true; } /** Logs any unexpected behavior that occurs (but which should not cause DrJava to abort). * @param message message to print to the log */ private void _log(String message) { _log.log(message); } /** Logs any unexpected behavior that occurs (but which should not cause DrJava to abort). * @param message message to print to the log * @param t Exception or Error being logged */ private void _log(String message, Throwable t) { _log.log(message, t); } /** Continually consumes events from the VM's event queue until it is disconnected.*/ public void run() { _log.log("Debugger starting"); _debugger.notifyDebuggerStarted(); EventQueue queue = _vm.eventQueue(); while (_connected) { try { try { // Remove and consume a set of events from the queue (blocks for an event) EventSet eventSet = queue.remove(); EventIterator it = eventSet.eventIterator(); while (it.hasNext()) handleEvent(it.nextEvent()); } catch (InterruptedException ie) { // Don't need to do anything. If the VM was disconnected, // the loop will terminate. _log("InterruptedException in main loop: " + ie); } catch (VMDisconnectedException de) { // We expect this to happen if the other JVM is reset handleDisconnectedException(); break; } } catch (Exception e) { // Log and report to the debugger _log("Exception in main event handler loop.", e); _debugger.eventHandlerError(e); _debugger.printMessage("An exception occurred in the event handler:\n" + e); _debugger.printMessage("The debugger may have become unstable as a result."); ByteArrayOutputStream baos = new ByteArrayOutputStream(); e.printStackTrace(new PrintWriter(baos, true)); _debugger.printMessage("Stack trace: " + baos.toString()); } } _debugger.notifyDebuggerShutdown(); } /** Processes a given event from JPDA. A visitor approach would be much better for this, but Sun's Event class * doesn't have an appropriate visit() method. */ private void handleEvent(Event e) throws DebugException { // Utilities.showDebug("EventHandler.handleEvent(" + e + ") called"); _log("handling event: " + e); if (e instanceof BreakpointEvent) _handleBreakpointEvent((BreakpointEvent) e); else if (e instanceof StepEvent) _handleStepEvent((StepEvent) e); //else if (e instanceof ModificationWatchpointEvent) { // _handleModificationWatchpointEvent((ModificationWatchpointEvent) e); //} else if (e instanceof ClassPrepareEvent) _handleClassPrepareEvent((ClassPrepareEvent) e); else if (e instanceof ThreadStartEvent) _handleThreadStartEvent((ThreadStartEvent) e); else if (e instanceof ThreadDeathEvent) _handleThreadDeathEvent((ThreadDeathEvent) e); else if (e instanceof VMDeathEvent) _handleVMDeathEvent((VMDeathEvent) e); else if (e instanceof VMDisconnectEvent) _handleVMDisconnectEvent((VMDisconnectEvent) e); else throw new DebugException("Unexpected event type: " + e); } /** Returns whether the given thread is both suspended and has stack frames. */ private boolean _isSuspendedWithFrames(ThreadReference thread) throws DebugException { try { return thread.isSuspended() && thread.frameCount() > 0; } catch (IncompatibleThreadStateException itse) { throw new DebugException("Could not count frames on a suspended thread: " + itse); } } /** Responds to a breakpoint event. * @param e breakpoint event from JPDA */ private void _handleBreakpointEvent(final BreakpointEvent e) /* throws DebugException */ { // synchronized(_debugger) { SwingUtilities.invokeLater(new Runnable() { public void run() { // System.err.println("handleBreakpointEvent(" + e + ") called"); try { if (_isSuspendedWithFrames(e.thread()) && _debugger.setCurrentThread(e.thread())) { // Utilities.showDebug("EventHandlerThread._handleBreakpointEvent(" + e + ") called"); _debugger.currThreadSuspended((BreakpointRequest) e.request()); // _debugger.scrollToSource(e); _debugger.reachedBreakpoint((BreakpointRequest) e.request()); // } } } catch(DebugException e) { throw new UnexpectedException(e); } } }); } /** Responds to a step event. * @param e step event from JPDA */ private void _handleStepEvent(final StepEvent e) /* throws DebugException */ { // preload document without holding _debugger lock to avoid deadlock // in bug [ 1696060 ] Debugger Infinite Loop // if the document is not already open, the event thread may load the document and then call a // synchronized method in the debugger, so we must do this before we hold the _debugger lock SwingUtilities.invokeLater(new Runnable() { public void run() { try { _debugger.preloadDocument(e.location()); // now acquire _debugger lock, the event thread won't need tge _debugger lock anymore // synchronized(_debugger) { if (_isSuspendedWithFrames(e.thread()) && _debugger.setCurrentThread(e.thread())) { _debugger.printMessage("Stepped to " + e.location().declaringType().name() + "." + e.location().method().name() + "(...) [line " + e.location().lineNumber() + "]"); _debugger.currThreadSuspended(); // _debugger.scrollToSource(e); } // Delete the step request so it doesn't happen again _debugger.getEventRequestManager().deleteEventRequest(e.request()); // } } catch(DebugException e) { throw new UnexpectedException(e); } } }); } // /** Responds to an event for a modified watchpoint. // * This event is not currently expected in DrJava. // * @param e modification watchpoint event from JPDA // */ // private void _handleModificationWatchpointEvent(ModificationWatchpointEvent e) { // _debugger.printMessage("ModificationWatchpointEvent occured "); // _debugger.printMessage("Field: " + e.field() + " Value: " + // e.valueToBe() + "]"); // } /** Responds when a class of interest has been prepared. Allows the debugger to set a pending breakpoint before any * code in the class is executed. * @param e class prepare event from JPDA * @throws UnexpectedException wrapping a DebugException if actions performed on the prepared class fail */ private void _handleClassPrepareEvent(final ClassPrepareEvent e) /* throws DebugException */ { // synchronized(_debugger) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { _debugger.getPendingRequestManager().classPrepared(e); // resume this thread which was suspended because its // suspend policy was SUSPEND_EVENT_THREAD e.thread().resume(); } catch(DebugException e) { throw new UnexpectedException(e); } // } } }); } /** Responds to a thread start event. Not run in event thread because threadStarted forces event thread execution. * @param e thread start event from JPDA */ private void _handleThreadStartEvent(ThreadStartEvent e) { // synchronized(_debugger) { _debugger.threadStarted(); // } } /** Reponds to a thread death event. * @param e thread death event from JPDA */ private void _handleThreadDeathEvent(final ThreadDeathEvent e) /* throws DebugException */ { // no need to check if there are suspended threads on the stack // because all that logic should be in the debugger // synchronized(_debugger) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { ThreadReference running = _debugger.getCurrentRunningThread(); if (e.thread().equals(running)) { // Delete any step requests pending on this thread EventRequestManager erm = _vm.eventRequestManager(); for (StepRequest step : erm.stepRequests()) { if (step.thread().equals(e.thread())) { erm.deleteEventRequest(step); // There can only be one step request per thread, // so we can stop looking break; } } _debugger.currThreadDied(); } else _debugger.nonCurrThreadDied(); // } // Thread is suspended on death, so resume it now. e.thread().resume(); } catch(DebugException e) { throw new UnexpectedException(e); } } }); } /** Responds if the virtual machine being debugged dies. * @param e virtual machine death event from JPDA */ private void _handleVMDeathEvent(VMDeathEvent e) throws DebugException { _cleanUp(e); } /** Responds if the virtual machine being debugged disconnects. * @param e virtual machine disconnect event from JPDA */ private void _handleVMDisconnectEvent(VMDisconnectEvent e) throws DebugException { _cleanUp(e); } /** Cleans up the state after the virtual machine being debugged dies or disconnects. * @param e JPDA event indicating the debugging session has ended */ private void _cleanUp(Event e) throws DebugException { // synchronized(_debugger) { SwingUtilities.invokeLater(new Runnable() { public void run() { _connected = false; if (_debugger.isReady()) { // caused crash if "Run Document's Main Method" was invoked while debugging // if (_debugger.hasSuspendedThreads()) _debugger.currThreadDied(); _debugger.shutdown(); } // } } }); } /** Responds when a VMDisconnectedException occurs while dealing with another event. We need to flush the event * queue, dealing only with exit events (VMDeath, VMDisconnect) so that we terminate correctly. */ private void handleDisconnectedException() throws DebugException { EventQueue queue = _vm.eventQueue(); while (_connected) { try { EventSet eventSet = queue.remove(); EventIterator iter = eventSet.eventIterator(); while (iter.hasNext()) { Event event = iter.nextEvent(); if (event instanceof VMDeathEvent) _handleVMDeathEvent((VMDeathEvent)event); else if (event instanceof VMDisconnectEvent) _handleVMDisconnectEvent((VMDisconnectEvent)event); // else ignore the event } eventSet.resume(); // Resume the VM } catch (InterruptedException ie) { // ignore _log("InterruptedException after a disconnected exception.", ie); } catch (VMDisconnectedException de) { // try to continue flushing the event queue anyway _log("A second VMDisconnectedException.", de); } } } }
[ "375833274@qq.com" ]
375833274@qq.com
17fbb6aa00bee063268dfd9879623503cddabe0a
cda3e7a33e76d1f207eb70b9b02b37eea62bc090
/Libreria/app/src/main/java/edu/upc/eetac/dsa/darroyo/libreria/BookReviewsActivity.java
263dbc6b20eff4ff68744a0223f25652705dcd32
[]
no_license
davidarroyorecio/BBDD-Exercices
96559a50ca632c5ded353578a655258d7205f1e4
697bc3deefe3ca397e528494445da02e0f98ad4b
refs/heads/master
2021-01-22T05:20:21.932825
2015-05-12T10:54:17
2015-05-12T10:54:17
31,602,466
0
0
null
null
null
null
UTF-8
Java
false
false
5,480
java
package edu.upc.eetac.dsa.darroyo.libreria; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.google.gson.Gson; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.util.ArrayList; import edu.upc.eetac.dsa.darroyo.libreria.api.AppException; import edu.upc.eetac.dsa.darroyo.libreria.api.Book; import edu.upc.eetac.dsa.darroyo.libreria.api.LibreriaAPI; import edu.upc.eetac.dsa.darroyo.libreria.api.Review; import edu.upc.eetac.dsa.darroyo.libreria.api.ReviewCollection; /** * Created by David W8.1 on 12/05/2015. */ public class BookReviewsActivity extends ListActivity { private final static String TAG = BookReviewsActivity.class.getName(); private ArrayList<Review> reviewsList; private ReviewAdapter adapter; String urlBook = null; Book book = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.book_reviews_layout); reviewsList = new ArrayList<Review>(); adapter = new ReviewAdapter(this, reviewsList); setListAdapter(adapter); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("test", "test" .toCharArray()); } }); urlBook = (String) getIntent().getExtras().get("url_book"); String urlReviews = (String) getIntent().getExtras().get("url"); (new FetchReviewsTask()).execute(urlReviews); } // private void loadBook(Book book) { // TextView tvDetailTitle = (TextView) findViewById(R.id.tvDetailTitle); // TextView tvDetailAuthor = (TextView) findViewById(R.id.tvDetailAuthor); // TextView tvDetailPublisher = (TextView) findViewById(R.id.tvDetailPublisher); // TextView tvDetailDate = (TextView) findViewById(R.id.tvDetailDate); // // tvDetailTitle.setText(book.getTitle()); // tvDetailAuthor.setText(book.getAuthor()); // tvDetailPublisher.setText(book.getPublisher()); // tvDetailDate.setText(book.getPrintingDate()); // } private class FetchReviewsTask extends AsyncTask<String, Void, ReviewCollection> { private ProgressDialog pd; @Override protected ReviewCollection doInBackground(String... params) { ReviewCollection reviews = null; try { reviews = LibreriaAPI.getInstance(BookReviewsActivity.this) .getReviews(params[0]); } catch (AppException e) { e.printStackTrace(); } return reviews; } @Override protected void onPostExecute(ReviewCollection result) { addReviews(result); if (pd != null) { pd.dismiss(); } } @Override protected void onPreExecute() { pd = new ProgressDialog(BookReviewsActivity.this); pd.setTitle("Searching..."); pd.setCancelable(false); pd.setIndeterminate(true); pd.show(); } } private void addReviews(ReviewCollection reviews){ //Log.d(TAG, reviews.getReviews().get(0).getContent().toString()); //ESTA FUNCIÓN FUNCIONA ENTERA reviewsList.addAll(reviews.getReviews()); //reviewsList.add(reviews.getReviews().get(0)); adapter.notifyDataSetChanged(); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_write_review, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.writeReviewMenuItem: Intent intent = new Intent(this, WriteReviewActivity.class); //intent.putExtra("url", book.getLinks().get("reviews").getTarget()); intent.putExtra("url_book", urlBook); //startActivity(intent); startActivityForResult(intent, WRITE_ACTIVITY); //Para que aparezca la nueva review después de postearla return true; default: return super.onOptionsItemSelected(item); } } //Método para que se visualice la nueva review private final static int WRITE_ACTIVITY = 0; //Porque solo hay una actividad, si se lanzan varias se asignan números sucesivos @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case WRITE_ACTIVITY: if (resultCode == RESULT_OK) { Bundle res = data.getExtras(); String jsonReview = res.getString("json-review"); Review review = new Gson().fromJson(jsonReview, Review.class); reviewsList.add(0, review); adapter.notifyDataSetChanged(); } break; } } }
[ "david91ar@gmail.com" ]
david91ar@gmail.com
d8eaacdd84a51a2bf00cb02bbad850f7170ab70c
3927258e502590626dd18034000e7cad5bb46af6
/aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/transform/CreateWebACLRequestMarshaller.java
37dfae3a847dcf529ab744fc2ee8bf0030ef7e01
[ "JSON", "Apache-2.0" ]
permissive
gauravbrills/aws-sdk-java
332f9cf1e357c3d889f753b348eb8d774a30f07c
09d91b14bfd6fbc81a04763d679e0f94377e9007
refs/heads/master
2021-01-21T18:15:06.060014
2016-06-11T18:12:40
2016-06-11T18:12:40
58,072,311
0
0
null
2016-05-04T17:52:28
2016-05-04T17:52:28
null
UTF-8
Java
false
false
3,615
java
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights * Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.waf.model.transform; import java.io.ByteArrayInputStream; import java.util.Collections; import java.util.Map; import java.util.List; import java.util.regex.Pattern; import com.amazonaws.AmazonClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.waf.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.BinaryUtils; import com.amazonaws.util.StringUtils; import com.amazonaws.util.IdempotentUtils; import com.amazonaws.util.StringInputStream; import com.amazonaws.util.json.*; /** * CreateWebACLRequest Marshaller */ public class CreateWebACLRequestMarshaller implements Marshaller<Request<CreateWebACLRequest>, CreateWebACLRequest> { public Request<CreateWebACLRequest> marshall( CreateWebACLRequest createWebACLRequest) { if (createWebACLRequest == null) { throw new AmazonClientException( "Invalid argument passed to marshall(...)"); } Request<CreateWebACLRequest> request = new DefaultRequest<CreateWebACLRequest>( createWebACLRequest, "AWSWAF"); request.addHeader("X-Amz-Target", "AWSWAF_20150824.CreateWebACL"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = SdkJsonProtocolFactory .createWriter(false, "1.1"); jsonGenerator.writeStartObject(); if (createWebACLRequest.getName() != null) { jsonGenerator.writeFieldName("Name").writeValue( createWebACLRequest.getName()); } if (createWebACLRequest.getMetricName() != null) { jsonGenerator.writeFieldName("MetricName").writeValue( createWebACLRequest.getMetricName()); } if (createWebACLRequest.getDefaultAction() != null) { jsonGenerator.writeFieldName("DefaultAction"); WafActionJsonMarshaller.getInstance().marshall( createWebACLRequest.getDefaultAction(), jsonGenerator); } if (createWebACLRequest.getChangeToken() != null) { jsonGenerator.writeFieldName("ChangeToken").writeValue( createWebACLRequest.getChangeToken()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", jsonGenerator.getContentType()); } catch (Throwable t) { throw new AmazonClientException( "Unable to marshall request to JSON: " + t.getMessage(), t); } return request; } }
[ "aws@amazon.com" ]
aws@amazon.com
a283a50ff64fde9521c9c044b125d5c7ff1e0415
5440f80ef80e9bd1217ba18fd549881727391f7f
/zuul-demo/src/main/java/com/xjf/demo/filter/IpFilter.java
34b38536d557e223fa480cfa940e278ab18cf875
[]
no_license
fanrendale/SpringCloud
cd3356791090ee661168da548470329539bb74a9
8b3bc747e2b7e35cfe1b4066d121bb070d3de069
refs/heads/master
2022-05-15T10:47:57.681139
2020-02-19T13:18:34
2020-02-19T13:18:34
234,743,473
0
0
null
2021-04-26T19:55:15
2020-01-18T14:04:15
Java
UTF-8
Java
false
false
2,761
java
package com.xjf.demo.filter; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import com.xjf.demo.base.ResponseCode; import com.xjf.demo.base.ResponseData; import com.xjf.demo.util.IpUtils; import com.xjf.demo.util.JsonUtils; import com.xjf.demo.util.NetworkUtil; import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.util.Arrays; import java.util.List; /** * 自定义过滤器: IP 过滤 * * @author xjf * @date 2020/1/28 22:11 */ public class IpFilter extends ZuulFilter { // IP 黑名单列表 private List<String> blackIpList = Arrays.asList("192.168.43.8"); /** * 过滤器类型: pre, route, post, error * @return */ @Override public String filterType() { //路由前 return "pre"; } /** * 过滤器的执行顺序,数值越小,优先级越高 * @return */ @Override public int filterOrder() { return 1; } /** * 是否执行过滤器:true为执行,false为不执行 * @return */ @Override public boolean shouldFilter() { return false; } @Override public Object run() throws ZuulException { // 模拟异常报错,测试异常过滤器 // System.out.println(2/0); RequestContext ctx = RequestContext.getCurrentContext(); //从请求中获取请求的IP地址 // String ip = IpUtils.getIpAddr(ctx.getRequest()); String ip = null; try { //从请求中获取请求的IP地址 ip = NetworkUtil.getIpAddress(ctx.getRequest()); } catch (IOException e) { e.printStackTrace(); } System.out.println("请求的 IP : " + ip); // 测试 RequestContext 传参,可以在多个过滤器中传值 ctx.set("name", "xjf"); Object name = ctx.get("name"); System.out.println(" RequestContext 中取值: name=" + name); // 在黑名单中禁用 if (StringUtils.isNotBlank(ip) && blackIpList.contains(ip)){ // 告诉 Zuul 不需要将当前请求转发到后端的服务 ctx.setSendZuulResponse(false); // 拦截本地转发请求(即设置了 forward:/local 的路由),上一行设置不能实现本地请求的拦截。 ctx.set("sendForwardFilter.ran", true); ResponseData data = ResponseData.fail(" 非法请求 ", ResponseCode.NO_AUTH_CODE.getCode()); ctx.setResponseBody(JsonUtils.toJson(data)); ctx.getResponse().setContentType("application/json; charset=utf-8"); return null; } return null; } }
[ "1053314919@qq.com" ]
1053314919@qq.com
6102e5538ba18436cb4c034d73705a1f4e7d49f6
eb3cec31fb1b76eb33816ee6227a5f3fdcb157a3
/work/org/apache/jsp/admin/movie_005fupdate_005fview_jsp.java
4c260840a3790229da7446d3d819edfddd40657e
[]
no_license
swathiraja16/Online-Movie-ticket-reservation
4504ce0c794e64d03f7c6b8813b6633bfc021c50
ca0941e5415b1bae5112c54ae822dc35bfc422cf
refs/heads/master
2020-03-17T16:02:14.480620
2018-05-16T23:32:39
2018-05-16T23:32:39
133,733,661
0
0
null
null
null
null
UTF-8
Java
false
false
8,983
java
package org.apache.jsp.admin; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.sql.ResultSet; import java.sql.Statement; import db.DBConnectivity; import java.sql.Connection; public final class movie_005fupdate_005fview_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List _jspx_dependants; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.AnnotationProcessor _jsp_annotationprocessor; public Object getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName()); } public void _jspDestroy() { } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; if(session.getAttribute("session_id")==null){ response.sendRedirect("index.jsp"); } out.write("\r\n"); out.write("<!--\r\n"); out.write("Author: W3layouts\r\n"); out.write("Author URL: http://w3layouts.com\r\n"); out.write("License: Creative Commons Attribution 3.0 Unported\r\n"); out.write("License URL: http://creativecommons.org/licenses/by/3.0/\r\n"); out.write("-->\r\n"); out.write("<!DOCTYPE HTML>\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<title>Admin Pannel</title>\r\n"); out.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n"); out.write("<meta name=\"keywords\" content=\"Minimal Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, \r\n"); out.write("Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design\" />\r\n"); out.write("<script type=\"application/x-javascript\"> addEventListener(\"load\", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>\r\n"); out.write("<link href=\"css/bootstrap.min.css\" rel='stylesheet' type='text/css' />\r\n"); out.write("<!-- Custom Theme files -->\r\n"); out.write("<link href=\"css/style.css\" rel='stylesheet' type='text/css' />\r\n"); out.write("<link href=\"css/font-awesome.css\" rel=\"stylesheet\"> \r\n"); out.write("<script src=\"js/jquery.min.js\"> </script>\r\n"); out.write("<script src=\"js/bootstrap.min.js\"> </script>\r\n"); out.write(" \r\n"); out.write("<!-- Mainly scripts -->\r\n"); out.write("<script src=\"js/jquery.metisMenu.js\"></script>\r\n"); out.write("<script src=\"js/jquery.slimscroll.min.js\"></script>\r\n"); out.write("<!-- Custom and plugin javascript -->\r\n"); out.write("<link href=\"css/custom.css\" rel=\"stylesheet\">\r\n"); out.write("<script src=\"js/custom.js\"></script>\r\n"); out.write("<script src=\"js/screenfull.js\"></script>\r\n"); out.write("\t\t<script>\r\n"); out.write("\t\t$(function () {\r\n"); out.write("\t\t\t$('#supported').text('Supported/allowed: ' + !!screenfull.enabled);\r\n"); out.write("\r\n"); out.write("\t\t\tif (!screenfull.enabled) {\r\n"); out.write("\t\t\t\treturn false;\r\n"); out.write("\t\t\t}\r\n"); out.write("\r\n"); out.write("\t\t\t\r\n"); out.write("\r\n"); out.write("\t\t\t$('#toggle').click(function () {\r\n"); out.write("\t\t\t\tscreenfull.toggle($('#container')[0]);\r\n"); out.write("\t\t\t});\r\n"); out.write("\t\t\t\r\n"); out.write("\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t});\r\n"); out.write("\t\t</script>\r\n"); out.write("\r\n"); out.write("<!----->\r\n"); out.write("\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("<div id=\"wrapper\">\r\n"); out.write(" <!----->\r\n"); out.write(" "); org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "include/nav.jsp", out, false); out.write("\r\n"); out.write(" \r\n"); out.write("\t\t <div id=\"page-wrapper\" class=\"gray-bg dashbard-1\">\r\n"); out.write(" <div class=\"content-main\">\r\n"); out.write(" \r\n"); out.write(" \t<!--banner-->\t\r\n"); out.write("\t\t <div class=\"banner\">\r\n"); out.write("\t\t \t<h2>\r\n"); out.write("\t\t\t\t<a href=\"dashboard.jsp\">Home</a>\r\n"); out.write("\t\t\t\t<i class=\"fa fa-angle-right\"></i>\r\n"); out.write("\t\t\t\t<span>Theaters</span>\r\n"); out.write("\t\t\t\t</h2>\r\n"); out.write("\t\t </div>\r\n"); out.write("\t\t<!--//banner-->\r\n"); out.write(" \t<!--grid-->\r\n"); out.write(" \t<div class=\"grid-form\">\r\n"); out.write(" \t\t<div class=\"grid-form1\">\r\n"); out.write(" \t\t<h3 id=\"forms-example\" class=\"\">View Movies In Theater</h3>\r\n"); out.write(" \t\t"); if(request.getParameter("status")!=null){ out.write("<span style=\"color: red\">"); out.print(request.getParameter("status") ); out.write("</span>"); } out.write("\r\n"); out.write(" \t\t\r\n"); out.write("<table class=\"table table-bordered table-striped\">\r\n"); out.write("<tr><th>SlNo</th><th>Movie Name</th><th>Theater</th><th>Release Date</th></tr>\r\n"); int i=1; Connection con = DBConnectivity.getCon(); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select id, movie_id, theater_id, start_date, movie_status from movie_theater where movie_status='active'"); while(rs.next()) { String movie_name="",theater_name=""; Statement st1 = con.createStatement(); ResultSet rs1 = st1.executeQuery("select movie_name from movies where movie_id='"+rs.getInt("movie_id")+"'"); while(rs1.next()) { movie_name=rs1.getString("movie_name"); } ResultSet rs2 = st1.executeQuery("select theater_name from theater where theater_id='"+rs.getInt("theater_id")+"'"); while(rs2.next()) { theater_name=rs2.getString("theater_name"); } out.write("\r\n"); out.write("<tr><th>"); out.print(i++ ); out.write("</th><th>"); out.print(movie_name); out.write("</th><th>"); out.print(theater_name ); out.write("</th><th>"); out.print(rs.getString("start_date") ); out.write("</th></tr>\r\n"); } out.write("\r\n"); out.write("</table>\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("</div>\r\n"); out.write("<!----->\r\n"); out.write("\r\n"); out.write("\r\n"); out.write(" \r\n"); out.write(" \t</div>\r\n"); out.write(" \t<!--//grid-->\r\n"); out.write("\t\t<!---->\r\n"); out.write("\r\n"); out.write("\t\t</div>\r\n"); out.write("\t\t<div class=\"clearfix\"> </div>\r\n"); out.write(" </div>\r\n"); out.write(" <!--scrolling js-->\r\n"); out.write("\t<script src=\"js/jquery.nicescroll.js\"></script>\r\n"); out.write("\t<script src=\"js/scripts.js\"></script>\r\n"); out.write("\t<!--//scrolling js-->\r\n"); out.write("<!---->\r\n"); out.write("\r\n"); out.write("</body>\r\n"); out.write("</html>\r\n"); out.write("\r\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "sr16e@my.fsu.edu" ]
sr16e@my.fsu.edu
541e89ab039f27b805552a3188e8b8598074217a
228d8fd3566cf1de3622a6752c0f43895a4cbda7
/yufanshop/sso/src/main/java/org/yufan/sso/service/UserService.java
3068f8e157087f3f0e6748ed6eed3b6fc3c5eefe
[]
no_license
Chaoyoushen/shop
da36aaeb6f0731d76fbb9d1c201894dfc465593b
1ac81f194c6520a4826a9bd2744224b0e1a11ac9
refs/heads/master
2022-12-23T01:07:22.489596
2019-08-13T01:03:09
2019-08-13T01:03:09
144,550,199
1
0
null
2022-12-16T04:54:53
2018-08-13T08:22:29
JavaScript
UTF-8
Java
false
false
416
java
package org.yufan.sso.service; import org.yufan.bean.User; import org.yufan.common.Result; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface UserService { public Result register(User user); public Result login(User user); public Result logout(String token); public Result check(String token); }
[ "yo1303512080@qq.com" ]
yo1303512080@qq.com
1c544ae86344da79c073ce8c57d72763e72eee2a
39f24d51aaabdc4c0addfeb0828d6e323656e1ad
/src/domain/Order.java
424480ca2fb117e9b8fc205d3b9a3d8b3ee1ce47
[]
no_license
TaylorDavis16/EKMall
13b795607729c56422b3b1d1e844de35746bc169
7db70e516552556f725330dd5f4dc8221c5cccb6
refs/heads/master
2023-06-04T14:18:10.218409
2021-06-15T03:11:08
2021-06-15T03:11:08
376,737,015
0
0
null
null
null
null
UTF-8
Java
false
false
3,352
java
package domain; import java.io.Serializable; import java.util.Date; public class Order implements Serializable { private Integer orderId; private String name; private String brand; private int number; private double payment; //顾客id private int customer_cusID; //店主id private int merchant_merID; //商品id private int merchandise_mID; private Date generateTime; private int refundable; private String address; private String shippingStatus; private String status; public Integer getOrderId() { return orderId; } public void setOrderId(Integer orderId) { this.orderId = orderId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } public double getPayment() { return payment; } public void setPayment(double payment) { this.payment = payment; } public int getCustomer_cusID() { return customer_cusID; } public void setCustomer_cusID(int customer_cusID) { this.customer_cusID = customer_cusID; } public int getMerchant_merID() { return merchant_merID; } public void setMerchant_merID(int merchant_merID) { this.merchant_merID = merchant_merID; } public int getMerchandise_mID() { return merchandise_mID; } public void setMerchandise_mID(int merchandise_mID) { this.merchandise_mID = merchandise_mID; } public Date getGenerateTime() { return generateTime; } public void setGenerateTime(Date generateTime) { this.generateTime = generateTime; } public int getRefundable() { return refundable; } public void setRefundable(int refundable) { this.refundable = refundable; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getShippingStatus() { return shippingStatus; } public void setShippingStatus(String shippingStatus) { this.shippingStatus = shippingStatus; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Override public String toString() { return "Order{" + "orderId=" + orderId + ", name='" + name + '\'' + ", brand='" + brand + '\'' + ", number=" + number + ", payment=" + payment + ", customer_cusID=" + customer_cusID + ", merchant_merID=" + merchant_merID + ", merchandise_mID=" + merchandise_mID + ", generateTime=" + generateTime + ", refundable=" + refundable + ", address='" + address + '\'' + ", shippingStatus='" + shippingStatus + '\'' + ", status='" + status + '\'' + '}'; } }
[ "631999273@qq.com" ]
631999273@qq.com
6fae34a29999c090f8e23055f0e1deccf59f1ad2
549275146dc8ecdba9144a6aed2796baa1639eb3
/Codes/yore/offer2/Offer016.java
12d2d7c4f3d67ac8ab5f14f1f2a24d16915447a2
[ "Apache-2.0" ]
permissive
asdf2014/algorithm
fdb07986746a3e5c36bfc66f4b6b7cb60850ff84
b0ed7a36f47b66c04b908eb67f2146843a9c71a3
refs/heads/master
2023-09-05T22:35:12.922729
2023-09-01T12:04:03
2023-09-01T12:04:03
108,250,452
270
87
Apache-2.0
2021-09-24T16:12:08
2017-10-25T09:45:27
Java
UTF-8
Java
false
false
825
java
package com.yore.offer2; import java.util.HashMap; import java.util.Map; /** * @author Yore * @date 2022/2/21 10:29 * @description */ public class Offer016 { public static void main(String[] args) { System.out.println(lengthOfLongestSubstring("aa")); } public static int lengthOfLongestSubstring(String s) { int len = s.length(); int begin = 0; int maxLen = 0; Map<Character, Integer> idxMap = new HashMap<>(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (idxMap.containsKey(c) && idxMap.get(c) >= begin) { begin = idxMap.get(c) + 1; } else { maxLen = Math.max(maxLen, i - begin + 1); } idxMap.put(c, i); } return maxLen; } }
[ "dy_yore@126.com" ]
dy_yore@126.com
5982964448f2e9ae7b8e83729f43dd4d9635252d
5a5eee9bb5ae25a7c3cac57c9c06dcc0738f71e6
/src/main/java/com/ysx/leetcode/easy/LeetCode1056.java
742b430da50a5546e670580446732df4d034f13f
[]
no_license
lancechien124/LeetCodeSolution
546581b31ae111d36ad0e12af69c4888c453955b
1e98f4280c4a617497ebec9462758db768a98fcd
refs/heads/master
2023-06-13T23:34:06.764419
2021-06-29T15:04:59
2021-06-29T15:04:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,137
java
/* * Copyright (c) ysx. 2020-2020. All rights reserved. */ package com.ysx.leetcode.easy; import java.util.HashMap; import java.util.Map; /** * @author youngbear * @email youngbear@aliyun.com * @date 2020/2/4 17:15 * @blog https://blog.csdn.net/next_second * @github https://github.com/YoungBear * @description 1056. 易混淆数 * https://leetcode-cn.com/problems/confusing-number/ * <p> * 给定一个数字 N,当它满足以下条件的时候返回 true: * <p> * 原数字旋转 180° 以后可以得到新的数字。 * <p> * 如 0, 1, 6, 8, 9 旋转 180° 以后,得到了新的数字 0, 1, 9, 8, 6 。 * <p> * 2, 3, 4, 5, 7 旋转 180° 后,得到的不是数字。 * <p> * 易混淆数 (confusing number) 在旋转180°以后,可以得到和原来不同的数,且新数字的每一位都是有效的。 * <p> * <p> * <p> * 示例 1: * <p> * <p> * <p> * 输入:6 * 输出:true * 解释: * 把 6 旋转 180° 以后得到 9,9 是有效数字且 9!=6 。 * 示例 2: * <p> * <p> * <p> * 输入:89 * 输出:true * 解释: * 把 89 旋转 180° 以后得到 68,86 是有效数字且 86!=89 。 * 示例 3: * <p> * <p> * <p> * 输入:11 * 输出:false * 解释: * 把 11 旋转 180° 以后得到 11,11 是有效数字但是值保持不变,所以 11 不是易混淆数字。 * 示例 4: * <p> * <p> * <p> * 输入:25 * 输出:false * 解释: * 把 25 旋转 180° 以后得到的不是数字。 * <p> * <p> * 提示: * <p> * 0 <= N <= 10^9 * 可以忽略掉旋转后得到的前导零,例如,如果我们旋转后得到 0008 那么该数字就是 8 。 * <p> * 解题思路 * 先判断N所对应的字符串的所有字符,如果有旋转180度后不为数字,则直接返回false。 * 然后再根据246的方法,246是求中心对称数,即旋转后两个数相同,这里取反即可。 * <p> * 执行结果: * 执行用时 :1 ms, 在所有 Java 提交中击败了69.84%的用户 * 内存消耗 :33.1 MB, 在所有 Java 提交中击败了48.89%的用户 * <p> * 作者:youngbear * 链接:https://leetcode-cn.com/problems/confusing-number/solution/gen-ju-246de-fang-fa-zai-jia-yi-ge-pan-duan-by-you/ */ public class LeetCode1056 { private static final Map<Character, Character> MAP = new HashMap<>(); static { MAP.put('0', '0'); MAP.put('1', '1'); MAP.put('6', '9'); MAP.put('8', '8'); MAP.put('9', '6'); } public boolean confusingNumber(int N) { String s = String.valueOf(N); for (char ch : s.toCharArray()) { if (!MAP.containsKey(ch)) { return false; } } return !isStrobogrammatic(s); } private boolean isStrobogrammatic(String num) { for (int i = 0; i < num.length() / 2 + 1; i++) { if (!MAP.containsKey(num.charAt(i))) { return false; } if (MAP.get(num.charAt(i)) != num.charAt(num.length() - i - 1)) { return false; } } return true; } }
[ "youngbear@aliyun.com" ]
youngbear@aliyun.com
04a2651c2ebc2118436e10c12607e5a0180eca65
6759390f341a9e370ac3f8a1b96a27c18d653acc
/controller-dji-new/src/main/java/eyesatop/controller/djinew/components/DroneFlightTasksDji.java
f12f41530d7ef1b8fd8d0926988d13fbe1ec3ee9
[]
no_license
idani301/Dronefleet-PreSigma
defceaae763fb828c00e1a6d0c4cc09650534c57
1940332788a39bc3b8e4b50e4130255f4225ad3a
refs/heads/master
2020-04-24T19:47:45.482612
2019-02-23T22:05:04
2019-02-23T22:05:04
172,223,464
0
0
null
null
null
null
UTF-8
Java
false
false
40,045
java
package eyesatop.controller.djinew.components; import com.example.abstractcontroller.components.AbstractDroneFlightTasks; import com.example.abstractcontroller.components.LocationFix; import com.example.abstractcontroller.tasks.flight.FlyInCircleAbstract; import com.example.abstractcontroller.tasks.flight.FlyToAbstract; import com.example.abstractcontroller.tasks.flight.FlyToSafeAndFastAbstract; import com.example.abstractcontroller.tasks.flight.FlyToUsingDTMAbstract; import com.example.abstractcontroller.tasks.flight.FollowNavPlanAbstract; import com.example.abstractcontroller.tasks.flight.HoverAbstract; import com.example.abstractcontroller.tasks.flight.RotateHeadingAbstract; import com.example.abstractcontroller.tasks.flight.TakeOffAbstract; import java.util.concurrent.CountDownLatch; import dji.common.error.DJIError; import dji.common.flightcontroller.FlightControllerState; import dji.common.flightcontroller.GPSSignalLevel; import dji.common.flightcontroller.LocationCoordinate3D; import dji.common.flightcontroller.ReceiverInfo; import dji.common.flightcontroller.virtualstick.FlightControlData; import dji.common.util.CommonCallbacks; import dji.sdk.flightcontroller.Compass; import dji.sdk.flightcontroller.FlightController; import eyesatop.util.drone.DroneModel; import eyesatop.controller.beans.FlightMode; import eyesatop.controller.beans.GpsSignalLevel; import eyesatop.controller.beans.GpsState; import eyesatop.controller.djinew.ControllerDjiNew; import eyesatop.controller.djinew.tasks.flight.DjiGoHome; import eyesatop.controller.djinew.tasks.flight.DjiLandAtLandingPad; import eyesatop.controller.djinew.tasks.flight.DjiLandInPlace; import eyesatop.controller.tasks.RunnableDroneTask; import eyesatop.controller.tasks.exceptions.DroneTaskException; import eyesatop.controller.tasks.flight.FlightTaskType; import eyesatop.controller.tasks.flight.FlyInCircle; import eyesatop.controller.tasks.flight.FlyTo; import eyesatop.controller.tasks.flight.FlyToSafeAndFast; import eyesatop.controller.tasks.flight.FlyToUsingDTM; import eyesatop.controller.tasks.flight.FollowNavPlan; import eyesatop.controller.tasks.flight.Hover; import eyesatop.controller.tasks.flight.LandAtLandingPad; import eyesatop.controller.tasks.flight.RotateHeading; import eyesatop.controller.tasks.stabs.StubDroneTask; import eyesatop.controller.tasks.takeoff.TakeOff; import eyesatop.util.Function; import eyesatop.util.android.logs.MainLogger; import eyesatop.util.geo.GimbalState; import eyesatop.util.geo.Location; import eyesatop.util.geo.Telemetry; import eyesatop.util.geo.Velocities; import eyesatop.util.model.Property; import logs.LoggerTypes; //import com.example.abstractcontroller.components.RtkFixes; /** * Created by Idan on 09/09/2017. */ public class DroneFlightTasksDji extends AbstractDroneFlightTasks { private final ControllerDjiNew controller; private Compass djiCompass; private boolean everStartedCallbacks = false; private final Property<Location> gpsBarometerLocation = new Property<>(); private final Property<Double> heading = new Property<>(); private final Property<Velocities> velocities = new Property<>(); public DroneFlightTasksDji(final ControllerDjiNew controller) { this.controller = controller; telemetry().bind(gpsBarometerLocation.transform(new Function<Location, Telemetry>() { @Override public Telemetry apply(Location input) { // MainLoggerJava.logger.write_message(LoggerTypes.DEBUG,"inside gps barometer transform, with input : " + (input == null ? "Null" : input.toString())); if(input == null){ return null; } // RtkFixes currentFixes = getRtkFixes().value(); // if(currentFixes != null && currentFixes.isRelevant()){ // Location newLocation = input.getLocationFromAzAndDistance(currentFixes.getDistance(),currentFixes.getAz(),0); // return new Telemetry(newLocation,velocities.value(),heading.value()); // } // else{ // LocationFix locationFix = getLocationFix().value(); // // Location finalDroneLocation; // // if(locationFix != null){ // Location newLocation = input.getLocationFromAzAndDistance(locationFix.getDistance(),locationFix.getAz(),0); // finalDroneLocation = newLocation; //// return new Telemetry(newLocation,velocities.value(),heading.value()); // } // else { // finalDroneLocation = input; //// return new Telemetry(input, velocities.value(), heading.value()); // } // Double ultrasonic = getUltrasonicHeight().value(); // // if(ultrasonic != null){ // try { // if(!(controller.getDtmProvider() instanceof DtmProviderWrapper)){ // throw new TerrainNotFoundException("Not provider wrapper"); // } // DtmProviderWrapper wrapper = (DtmProviderWrapper) controller.getDtmProvider(); // // double actualASL = wrapper.getSemiProvider().terrainAltitude(finalDroneLocation) + ultrasonic; // double asl = wrapper.getSemiProvider().terrainAltitude(controller.droneHome().homeLocation().value()) + finalDroneLocation.getAltitude(); // barometerFix.set(actualASL - asl); //// finalDroneLocation = finalDroneLocation.altitude(finalDroneLocation.getAltitude() + barometerFix); // } catch (TerrainNotFoundException e) { // e.printStackTrace(); // } // } // Double barometerFixValue = barometerFix.value(); // if(barometerFixValue != null){ // finalDroneLocation = finalDroneLocation.altitude(finalDroneLocation.getAltitude() + barometerFixValue); // } return new Telemetry(input,velocities.value(),heading.value()); // } } })); // if(MainLogger.logger.is_log_exists(LoggerTypes.YOSSI)) { // // controller.aboveGroundAltitude().observe(new Observer<Double>() { // @Override // public void observe(Double oldValue, Double newValue, Observation<Double> observation) { // // DroneTask<FlightTaskType> currentFlightTask = current().value(); // // Telemetry currentTelemetry = telemetry().value(); // Location currentLocation = Telemetry.telemetryToLocation(controller.telemetry().value()); // // Velocities velocities = currentTelemetry == null ? null : currentTelemetry.velocities(); // // if (currentLocation == null) { // MainLogger.logger.write_message(LoggerTypes.YOSSI, "No Location, skipping"); // return; // } // // Location homeLocation = controller.droneHome().homeLocation().value(); // // if (homeLocation == null) { // MainLogger.logger.write_message(LoggerTypes.YOSSI, "No Home Location, skipping"); // return; // } // // Boolean isFlying = controller.flying().value(); // // if(isFlying == null){ // MainLogger.logger.write_message(LoggerTypes.YOSSI, "Unknown Flying State, skipping"); // return; // } // // if(!isFlying){ // MainLogger.logger.write_message(LoggerTypes.YOSSI, "Drone is not flying, skipping"); // return; // } // // Location originalLocation = gpsBarometerLocation.value(); // if(originalLocation == null){ // MainLogger.logger.write_message(LoggerTypes.YOSSI, "No Original Location, skipping"); // return; // } // // String taskString; // // if(currentFlightTask == null || currentFlightTask.status().value().isTaskDone()){ // taskString = "N/A"; // } // else{ // taskString = currentFlightTask.taskType().getName(); // if(currentFlightTask.taskType() == FlightTaskType.FLY_TO_USING_DTM){ // taskString += ", Target AGL : " + ((FlyToUsingDTM)currentFlightTask).agl(); // } // } // // LocationFix locationFix = getLocationFix().value(); // Double ultrasonicHeight = getUltrasonicHeight().value(); // String ultrasonicString = ultrasonicHeight == null ? "N/A" : ultrasonicHeight + "(m)"; // // String velocityString = velocities == null ? "N/A" : velocities.getVelocity() + "(m/s)"; // // Location gpsBarometer = gpsBarometerLocation.value(); // Double barometerFixValue = barometerFix.value(); // String barometerBeforeFixString = gpsBarometer == null ? "N/A" : gpsBarometer.getAltitude() + "(m)"; // // String barometerFixString = barometerFixValue == null ? "N/A" : (barometerFixValue + "(m)"); // // if(locationFix == null){ // // try { // MainLogger.logger.write_message(LoggerTypes.YOSSI, "Got new Telemetry : " + // MainLogger.TAB + "Lat : " + currentLocation.getLatitude() + // MainLogger.TAB + "Lon : " + currentLocation.getLongitude() + // MainLogger.TAB + "Home Lat : " + homeLocation.getLatitude() + // MainLogger.TAB + "Home Lon : " + homeLocation.getLongitude() + // MainLogger.TAB + "Barometer before Fix : " + barometerBeforeFixString + // MainLogger.TAB + "Barometer after Fix : " + currentLocation.getAltitude() + // MainLogger.TAB + "Barometer Fix : " + barometerFixString + // MainLogger.TAB + "Dtm At Home : " + controller.getDtmProvider().terrainAltitude(homeLocation) + // MainLogger.TAB + "Dtm At Drone Location : " + controller.getDtmProvider().terrainAltitude(currentLocation) + // MainLogger.TAB + "AGL : " + newValue + // MainLogger.TAB + "Ultrasonic Value : " + ultrasonicString + // MainLogger.TAB + "Velocity : " + velocityString + // MainLogger.TAB + "Active Task : " + taskString // ); // } catch (TerrainNotFoundException e) { // MainLogger.logger.write_message(LoggerTypes.YOSSI, "Dtm Error, Skipping"); // } // } // else{ // try { // MainLogger.logger.write_message(LoggerTypes.YOSSI, "Got new Telemetry : " + // MainLogger.TAB + "Original Lat : " + originalLocation.getLatitude() + // MainLogger.TAB + "Original Lon : " + originalLocation.getLongitude() + // MainLogger.TAB + "Lat : " + currentLocation.getLatitude() + // MainLogger.TAB + "Lon : " + currentLocation.getLongitude() + // MainLogger.TAB + "Location Fix : " + locationFix.toString() + // MainLogger.TAB + "Home Lat : " + homeLocation.getLatitude() + // MainLogger.TAB + "Home Lon : " + homeLocation.getLongitude() + // MainLogger.TAB + "Barometer before Fix : " + barometerBeforeFixString + // MainLogger.TAB + "Barometer after Fix : " + currentLocation.getAltitude() + // MainLogger.TAB + "Barometer Fix : " + barometerFixString + // MainLogger.TAB + "Dtm At Home : " + controller.getDtmProvider().terrainAltitude(homeLocation) + // MainLogger.TAB + "Dtm At Drone Location : " + controller.getDtmProvider().terrainAltitude(currentLocation) + // MainLogger.TAB + "AGL : " + newValue + // MainLogger.TAB + "Ultrasonic Value : " + ultrasonicString + // MainLogger.TAB + "Velocity : " + velocityString + // MainLogger.TAB + "Active Task : " + taskString // ); // } catch (TerrainNotFoundException e) { // MainLogger.logger.write_message(LoggerTypes.YOSSI, "Dtm Error, Skipping"); // } // } // } // }); // } } @Override protected RunnableDroneTask<FlightTaskType> stubToRunnable(StubDroneTask<FlightTaskType> stubDroneTask) throws DroneTaskException { switch (stubDroneTask.taskType()){ case FLY_SAFE_TO: FlyToSafeAndFast flyToSafeAndFast = (FlyToSafeAndFast)stubDroneTask; return new FlyToSafeAndFastAbstract(controller,flyToSafeAndFast.targetLocation(),flyToSafeAndFast.altitudeInfo()); case FLY_IN_CIRCLE: FlyInCircle flyInCircle = (FlyInCircle)stubDroneTask; return new FlyInCircleAbstract( controller, flyInCircle.center(), flyInCircle.radius(), flyInCircle.rotationType(), flyInCircle.degreesToCover(), flyInCircle.startingDegree(), flyInCircle.altitudeInfo(), flyInCircle.velocity()); case TAKE_OFF: TakeOff takeOff = (TakeOff)stubDroneTask; return new TakeOffAbstract(controller,takeOff.altitude()); case GOTO_POINT: FlyTo flyTo = (FlyTo)stubDroneTask; return new FlyToAbstract(controller,flyTo.location(), flyTo.altitudeInfo(), flyTo.az(), flyTo.maxVelocity(), flyTo.radiusReached()); case GO_HOME: return new DjiGoHome(controller); case FLY_TO_USING_DTM: FlyToUsingDTM flyToUsingDTM = (FlyToUsingDTM)stubDroneTask; return new FlyToUsingDTMAbstract(controller, flyToUsingDTM.location(), flyToUsingDTM.az(), flyToUsingDTM.agl(), flyToUsingDTM.underGapInMeter(), flyToUsingDTM.upperGapInMeter(), flyToUsingDTM.maxVelocity(), flyToUsingDTM.radiusReached()); case LAND_IN_LANDING_PAD: LandAtLandingPad landAtLandingPad = (LandAtLandingPad)stubDroneTask; return new DjiLandAtLandingPad(controller,landAtLandingPad.landingPad()); case ROTATE_HEADING: RotateHeading rotateHeading = (RotateHeading)stubDroneTask; return new RotateHeadingAbstract(controller,rotateHeading.angle()); case LAND_IN_PLACE: return new DjiLandInPlace(controller); // case LAND_AT_LOCATION: // LandAtLocation landAtLocation = (LandAtLocation)stubDroneTask; // break; // case LAND_IN_PLACE: // break; case HOVER: Hover hoverTask = (Hover)stubDroneTask; return new HoverAbstract(hoverTask.hoverTime()); case FOLLOW_NAV_PLAN: FollowNavPlan navPlan = (FollowNavPlan)stubDroneTask; return new FollowNavPlanAbstract(controller,navPlan.navPlanPoints()); default: throw new DroneTaskException("Not implemented :" + stubDroneTask.taskType()); } } @Override public void onComponentAvailable() { FlightController djiController = controller.getHardwareManager().getDjiFlightController(); // final RTK droneRTK = djiController == null ? null : djiController.getRTK(); // if(djiController != null) { // // if(droneRTK != null && droneRTK.isConnected()){ // // djiController.getRTK().setRtkEnabled(true, new CommonCallbacks.CompletionCallback() { // @Override // public void onResult(DJIError djiError) { // MainLoggerJava.logger.write_message(LoggerTypes.RTK_FULL,"RTK Enable : " + djiError == null ? "Success" : djiError.getDescription()); // } // }); // } // } if(everStartedCallbacks == true){ MainLogger.logger.write_message(LoggerTypes.CALLBACKS,"Flight Controller : aborting start since already started"); return; } everStartedCallbacks = true; djiCompass = controller.getHardwareManager().getDjiFlightController().getCompass(); controller.getHardwareManager().getDjiFlightController().setStateCallback(new FlightControllerState.Callback() { @Override public void onUpdate(FlightControllerState flightControllerState) { DroneModel model = controller.model().value(); if(model != null && model == DroneModel.MAVIC) { confirmLandRequire().setIfNew(flightControllerState.isLandingConfirmationNeeded()); } // MainLogger.logger.write_message(LoggerTypes.DEBUG,"Got new State callback data"); LocationCoordinate3D locationCoordinate3D = flightControllerState.getAircraftLocation(); // Setting Telemetry float barometerAltitude = locationCoordinate3D.getAltitude(); if(flightControllerState.isUltrasonicBeingUsed() && flightControllerState.getUltrasonicHeightInMeters() <= 4 ){ controller.flightTasks().getUltrasonicHeight().set((double) flightControllerState.getUltrasonicHeightInMeters()); } else{ controller.flightTasks().getUltrasonicHeight().set(null); } // MainLoggerJava.logger.write_message(LoggerTypes.ALTITUDE_CALCS,"Got Data From Dji : " + // MainLoggerJava.TAB + "Barometer : " + barometerAltitude + // MainLoggerJava.TAB + "Ultrasonic Being Used : " + flightControllerState.isUltrasonicBeingUsed() + // MainLoggerJava.TAB + "Ultrasonic Height : " + flightControllerState.getUltrasonicHeightInMeters()); Location newLocation = new Location(locationCoordinate3D.getLatitude(),locationCoordinate3D.getLongitude(),barometerAltitude); velocities.set(new Velocities(flightControllerState.getVelocityX(),flightControllerState.getVelocityY(),flightControllerState.getVelocityZ())); heading.set((double) djiCompass.getHeading()); Boolean isFullGimbal = controller.gimbal().fullGimbalSupported().value(); if(isFullGimbal == null || !isFullGimbal){ try { controller.gimbal().gimbalState().setIfNew(controller.gimbal().gimbalState().value().yaw(djiCompass.getHeading())); } catch (Exception e){ controller.gimbal().gimbalState().setIfNew(new GimbalState(0,0,djiCompass.getHeading())); } } getPreheating().setIfNew(flightControllerState.isIMUPreheating()); hasCompassError().setIfNew(djiCompass.hasError()); motorsOn().setIfNew(flightControllerState.areMotorsOn()); flying().setIfNew(flightControllerState.isFlying()); GpsState newGpsState = new GpsState((int) flightControllerState.getSatelliteCount(),signalLevelFromDji(flightControllerState.getGPSSignalLevel())); gps().setIfNew(newGpsState); Location newHomeLocation; if(Double.isNaN(flightControllerState.getHomeLocation().getLatitude()) || Double.isNaN(flightControllerState.getHomeLocation().getLongitude())){ newHomeLocation = null; } else{ newHomeLocation = new Location(flightControllerState.getHomeLocation().getLatitude(),flightControllerState.getHomeLocation().getLongitude()); } LocationFix locationFix = getLocationFix().value(); if(locationFix == null) { controller.droneHome().homeLocation().setIfNew(newHomeLocation); } else{ controller.droneHome().homeLocation().setIfNew(newHomeLocation.getLocationFromAzAndDistance(locationFix.getDistance(),locationFix.getAz())); } flightMode().setIfNew(flightModeFromDji(flightControllerState.getFlightMode())); // MainLogger.logger.write_message(LoggerTypes.DEBUG,"Setting gps barometer location with : " + newLocation.toString()); gpsBarometerLocation.set(newLocation.isValid() ? newLocation : null); } }); // if(droneRTK != null && droneRTK.isConnected()) { // // controller.getHardwareManager().getDjiFlightController().getRTK().setStateCallback(new RTKState.Callback() { // @Override // public void onUpdate(RTKState rtkState) { // // if(rtkState == null){ // return; // } // // LocationCoordinate2D baseStationDjiLocation = rtkState.getBaseStationLocation(); // Location baseStationNewLocation = null; // if(baseStationDjiLocation != null){ // baseStationNewLocation = new Location(baseStationDjiLocation.getLatitude(),baseStationDjiLocation.getLongitude(),rtkState.getBaseStationAltitude()); // } // // LocationCoordinate2D droneDjiRTKLocation = rtkState.getMobileStationLocation(); // Location droneNewRTKLocation = null; // // if(droneDjiRTKLocation != null){ // droneNewRTKLocation = new Location(droneDjiRTKLocation.getLatitude(),droneDjiRTKLocation.getLongitude(),rtkState.getMobileStationAltitude()); // } // // Location currentGpsBarometer = gpsBarometerLocation.value(); // // Location currentDroneGPSLocation = currentGpsBarometer; // String distanceBetweenRTKAndGPS = "N/A"; // if(currentDroneGPSLocation != null && droneNewRTKLocation != null){ // distanceBetweenRTKAndGPS = "" + currentDroneGPSLocation.distance(droneNewRTKLocation); // } // // Double baseStationAboveSeaLevel = null; // try { // baseStationAboveSeaLevel = controller.getDtmProvider().terrainAltitude(baseStationNewLocation); // } catch (TerrainNotFoundException e) { // e.printStackTrace(); // } // // MainLoggerJava.logger.write_message(LoggerTypes.RTK_YOSSI,"New RTK Data : " + // MainLoggerJava.TAB + "Drone Lat : " + (droneNewRTKLocation == null ? "N/A" : droneNewRTKLocation.getLatitude()) + // MainLoggerJava.TAB + "Drone Lon : " + (droneNewRTKLocation == null ? "N/A" : droneNewRTKLocation.getLongitude()) + // MainLoggerJava.TAB + "Drone ASL : " + (droneNewRTKLocation == null ? "N/A" : droneNewRTKLocation.getAltitude()) + // MainLoggerJava.TAB + "Station Lat : " + (baseStationNewLocation == null ? "N/A" : baseStationNewLocation.getLatitude()) + // MainLoggerJava.TAB + "Station Lon : " + (baseStationNewLocation == null ? "N/A" : baseStationNewLocation.getLongitude()) + // MainLoggerJava.TAB + "Station ASL : " + (baseStationNewLocation == null ? "N/A" : baseStationNewLocation.getAltitude()) // ); // // MainLoggerJava.logger.write_message(LoggerTypes.RTK_BASIC, "Got RTK Data : " + // MainLoggerJava.TAB + "DJI Base Station Above Sea Level : " + rtkState.getBaseStationAltitude() + // MainLoggerJava.TAB + "Internal Base Station Ground Above Sea Level : " + baseStationAboveSeaLevel + // // MainLoggerJava.TAB + "RTK Drone Above Sea Level : " + rtkState.getMobileStationAltitude() + // MainLoggerJava.TAB + "Internal Drone Above Sea Level : " + controller.aboveSeaAltitude().value() + // // MainLoggerJava.TAB + "Distance Between RTK and Gps Location : " + distanceBetweenRTKAndGPS // ); //// //// MainLoggerJava.logger.write_message(LoggerTypes.RTK_BUZAGLO,"Drone RTK Location : " + //// MainLoggerJava.TAB + "Latitude : " + (droneNewRTKLocation == null ? "N/A" : droneNewRTKLocation.getLatitude()) + //// MainLoggerJava.TAB + "Longitude : " + (droneNewRTKLocation == null ? "N/A" : droneNewRTKLocation.getLongitude()) + //// MainLoggerJava.TAB + "Above Sea Level : " + (rtkState == null ? "N/A" : rtkState.getMobileStationAltitude()) //// ); // // MainLoggerJava.logger.write_message(LoggerTypes.RTK_FULL, "Got RTK Data : " + // MainLoggerJava.TAB + "" + rtkState.getBaseStationAltitude() + // MainLoggerJava.TAB + "" + rtkState.getBaseStationLocation() + // MainLoggerJava.TAB + "" + rtkState.getHeading() + // MainLoggerJava.TAB + "" + rtkState.getMobileStationAltitude() + // MainLoggerJava.TAB + "" + rtkState.getMobileStationLocation() + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getBaseStationReceiverBeiDouInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getBaseStationReceiverGLONASSInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getBaseStationReceiverGPSInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getMobileStationReceiver1BeiDouInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getMobileStationReceiver2BeiDouInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getMobileStationReceiver1GLONASSInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getMobileStationReceiver2GLONASSInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getMobileStationReceiver1GPSInfo()) + // MainLoggerJava.TAB + "" + receiverInfoString(rtkState.getMobileStationReceiver2GPSInfo()) // ); // // RtkFixes newFixes = calcRTKFixes(currentDroneGPSLocation,droneNewRTKLocation,baseStationNewLocation,controller.droneHome().homeLocation().value()); // MainLoggerJava.logger.write_message(LoggerTypes.RTK_FIXES,"Setting the RTK Fixes : " + (newFixes == null ? "N/A" : newFixes.toString())); // getRtkFixes().set(newFixes); // // try { // printBuzagloLog(droneNewRTKLocation.getLatitude(), droneNewRTKLocation.getLongitude(), rtkState.getMobileStationAltitude()); // } // catch (Exception e){ // MainLoggerJava.logger.writeError(LoggerTypes.ERROR,e); // } // } // }); // } // else{ // if(droneRTK == null){ // MainLoggerJava.logger.write_message(LoggerTypes.RTK_BASIC,"RTK IS NULL"); // } // else if(droneRTK != null && !droneRTK.isConnected()){ // MainLoggerJava.logger.write_message(LoggerTypes.RTK_BASIC,"RTK is not connected"); // } // } MainLogger.logger.write_message(LoggerTypes.PRODUCT_CHANGES,"onComponentAvailable flight controller done"); } // private RtkFixes calcRTKFixes(Location currentGPSLocation, // Location currentRTKLocation, // Location baseStationRTKLocation, // Location homeLocation){ // // if(currentGPSLocation == null || currentRTKLocation == null || baseStationRTKLocation == null || homeLocation == null){ // return null; // } // // try { // // Double distanceFromGPSToRTK = currentGPSLocation.distance(currentRTKLocation); // Double azFromGPSToRTK = currentGPSLocation.az(currentRTKLocation); // //// Location fixedLocation = currentGPSLocation.getLocationFromAzAndDistance(distanceFromGPSToRTK,azFromGPSToRTK); // // Double currentAboveSeaLevel = currentGPSLocation.getAltitude() + controller.getDtmProvider().terrainAltitude(homeLocation); // // Double shiftBetweenYossiAndRTK = baseStationRTKLocation.getAltitude() - (1 + controller.getDtmProvider().terrainAltitude(baseStationRTKLocation)); // Double barometerFix = currentRTKLocation.getAltitude() - (currentAboveSeaLevel + shiftBetweenYossiAndRTK); //// Double barometerFix = 0D; // return new RtkFixes(distanceFromGPSToRTK,azFromGPSToRTK,barometerFix,System.currentTimeMillis()); // } catch (TerrainNotFoundException e) { // e.printStackTrace(); // return null; // } // } private String receiverInfoString(ReceiverInfo info){ if(info == null){ return "N/A"; } return "Sat Count : " + info.getSatelliteCount() + ", isConstellationSupported : " + info.isConstellationSupported(); } @Override public void onComponentConnected() { } public GpsSignalLevel signalLevelFromDji(GPSSignalLevel djigpsSignalStatus){ switch (djigpsSignalStatus){ case LEVEL_0: return GpsSignalLevel.LEVEL0; case LEVEL_1: return GpsSignalLevel.LEVEL1; case LEVEL_2: return GpsSignalLevel.LEVEL2; case LEVEL_3: return GpsSignalLevel.LEVEL3; case LEVEL_4: return GpsSignalLevel.LEVEL4; case LEVEL_5: return GpsSignalLevel.LEVEL5; case NONE: return GpsSignalLevel.NONE; } return GpsSignalLevel.UNKNOWN; } public FlightMode flightModeFromDji(dji.common.flightcontroller.FlightMode djiFlightControllerFlightMode){ MainLogger.logger.write_message(LoggerTypes.FLIGHT_MODES,"Dji Flight Mode : " + djiFlightControllerFlightMode); switch (djiFlightControllerFlightMode){ case ASSISTED_TAKEOFF: return FlightMode.AUTO_TAKE_OFF; case AUTO_TAKEOFF: return FlightMode.AUTO_TAKE_OFF; case CONFIRM_LANDING: return FlightMode.AUTO_GO_HOME; case AUTO_LANDING: return FlightMode.AUTO_GO_HOME; case ATTI_LANDING: return FlightMode.AUTO_GO_HOME; case GO_HOME: return FlightMode.AUTO_GO_HOME; case ATTI: return FlightMode.APP_CONTROL; case CLICK_GO: return FlightMode.AUTO_GO_HOME; case JOYSTICK: return FlightMode.APP_CONTROL; case GPS_ATTI: return FlightMode.APP_CONTROL; } return FlightMode.EXTERNAL; } @Override public void sendSpeedsCommand(double pitch, double roll, double yaw, double vertical) { dji.sdk.flightcontroller.FlightController flightController = controller.getHardwareManager().getDjiFlightController(); if(flightController != null) { flightController.sendVirtualStickFlightControlData(new FlightControlData((float) pitch, (float) roll, (float) yaw, (float) vertical),null); } } // private void printBuzagloLog(double rtkLat,double rtkLon,double rtkASL){ // // DroneTask<FlightTaskType> currentFlightTask = controller.flightTasks().current().value(); // // String currentFlightTaskString = "N/A"; // if(currentFlightTask != null){ // currentFlightTaskString = currentFlightTask.taskType() + " , "; // switch (currentFlightTask.taskType()){ // // case TAKE_OFF: // TakeOff takeOff = (TakeOff)currentFlightTask; // currentFlightTaskString += "Altitude : " + takeOff.altitude(); // break; // case FLY_IN_CIRCLE: // break; // case GOTO_POINT: // break; // case FLY_TO_USING_DTM: // FlyToUsingDTM flyToUsingDTM = (FlyToUsingDTM)currentFlightTask; // currentFlightTaskString += "AGL : " + flyToUsingDTM.agl(); // break; // case GO_HOME: // break; // case LAND_IN_LANDING_PAD: // break; // case LAND_AT_LOCATION: // break; // case ROTATE_HEADING: // break; // case FLY_SAFE_TO: // FlyToSafeAndFast flyToSafeAndFast = (FlyToSafeAndFast)currentFlightTask; // currentFlightTaskString += "Altitude Info : " + flyToSafeAndFast.altitudeInfo().toString(); // break; // case HOVER: // break; // case LAND_IN_PLACE: // break; // } // } // // Double currentDTMRaiseValue = controller.getDtmProvider().dtmRaiseValue().value(); // // Location gpsLocation = gpsBarometerLocation.value(); // RtkFixes currentRTKFix = getRtkFixes().value(); // Location currentCalculatedLocation = Telemetry.telemetryToLocation(telemetry().value()); // Double terrainUnderCalculatedLocation = null; // Double takeOffDTM = controller.droneHome().takeOffDTM().value(); // Location takeOffLocation = controller.droneHome().homeLocation().value(); // Double asl = controller.aboveSeaAltitude().value(); // Double agl = controller.aboveGroundAltitude().value(); // // try { // terrainUnderCalculatedLocation = controller.getDtmProvider().terrainAltitude(currentCalculatedLocation); // } catch (TerrainNotFoundException e) { // e.printStackTrace(); // } // // MainLoggerJava.logger.write_message(LoggerTypes.RTK_BUZAGLO,"New Data : " + // MainLoggerJava.TAB + "Gps Lat : " + (gpsLocation == null ? "N/A" : gpsLocation.getLatitude()) + // MainLoggerJava.TAB + "Gps Lon : " + (gpsLocation == null ? "N/A" : gpsLocation.getLongitude()) + // MainLoggerJava.TAB + "Rtk Lat : " + rtkLat + // MainLoggerJava.TAB + "Rtk Lon : " + rtkLon + // MainLoggerJava.TAB + "Rtk Distance Fix : " + (currentRTKFix == null ? "N/A" : currentRTKFix.getDistance()) + // MainLoggerJava.TAB + "Rtk Az Fix : " + (currentRTKFix == null ? "N/A" : currentRTKFix.getAz()) + // MainLoggerJava.TAB + "Rtk Fix Valid : " + (currentRTKFix == null ? "N/A" : currentRTKFix.isRelevant()) + // MainLoggerJava.TAB + "Rtk Fix Valid : " + (currentRTKFix == null ? "N/A" : currentRTKFix.isRelevant()) + // MainLoggerJava.TAB + "Calculated Lat : " + (currentCalculatedLocation == null ? "N/A" : currentCalculatedLocation.getLatitude()) + // MainLoggerJava.TAB + "Calculated Lon : " + (currentCalculatedLocation == null ? "N/A" : currentCalculatedLocation.getLongitude()) + // MainLoggerJava.TAB + "Terrain Under Calculated Location : " + (terrainUnderCalculatedLocation == null ? "N/A" : terrainUnderCalculatedLocation) + // MainLoggerJava.TAB + "Barometer : " + (gpsLocation == null ? "N/A" : gpsLocation.getAltitude()) + // MainLoggerJava.TAB + "Take off Location Terrain : " + (takeOffDTM == null ? "N/A" : takeOffDTM) + // MainLoggerJava.TAB + "Take off Location : " + (takeOffLocation == null ? "N/A" : takeOffLocation.toString()) + // MainLoggerJava.TAB + "ASL(Should be like Take off terrain + barometer) : " + (asl == null ? "N/A" : asl) + // MainLoggerJava.TAB + "AGL(Should be like Take off terrain + barometer - terrain under calc location) : " + (agl == null ? "N/A" : agl) + // MainLoggerJava.TAB + "DTM Delta : " + (currentDTMRaiseValue == null ? "N/A" : currentDTMRaiseValue) + // MainLoggerJava.TAB + "Current Task Info : " + currentFlightTaskString // ); // } @Override public void internalTakeOff() throws DroneTaskException { dji.sdk.flightcontroller.FlightController flightController = controller.getHardwareManager().getDjiFlightController(); if(flightController == null){ throw new DroneTaskException("No Flight Controller"); } final CountDownLatch taskLatch = new CountDownLatch(1); final Property<DJIError> djiErrorProperty = new Property<>(); flightController.startTakeoff(new CommonCallbacks.CompletionCallback() { @Override public void onResult(DJIError djiError) { djiErrorProperty.set(djiError); taskLatch.countDown(); } }); try { taskLatch.await(); } catch (InterruptedException e) { throw new DroneTaskException("Cancelled"); } if(djiErrorProperty.value() != null){ throw new DroneTaskException("Dji Take-off internal Error : " + djiErrorProperty.value().getDescription()); } } @Override public void confirmLand() throws DroneTaskException { try { controller.getHardwareManager().getDjiFlightController().confirmLanding(null); } catch (Exception e){ e.printStackTrace(); } } public Property<Double> getHeading() { return heading; } }
[ "idany@eyesatop.com" ]
idany@eyesatop.com
167f40050d5215237b6e1f2ad450f7f5e83e1fbb
b479b9235ea3d55d0a6fc2fcc02125a24be84530
/mongodb-guide-chapter1/src/test/java/com/murdock/books/mongodbguide/InsertTableTest.java
c657de10fe2a9f450a177c36f4e50fa90079f5bb
[]
no_license
weipeng2k/mongodb-guide
1db9c94c331852e8e2befbcceafd770ce50a2557
8f6338089b3d771691189e188398bec26cfcb925
refs/heads/master
2022-06-27T07:42:56.120856
2021-06-11T03:36:24
2021-06-11T03:36:24
163,726,854
2
1
null
2022-06-17T02:06:47
2019-01-01T09:44:01
Java
UTF-8
Java
false
false
1,953
java
package com.murdock.books.mongodbguide; import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; import com.mongodb.DBObject; import com.mongodb.WriteResult; import com.murdock.books.mongodbguide.common.config.MongoConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import java.util.Random; /** * @author weipeng2k 2019年01月01日 下午19:25:20 */ @SpringBootTest(classes = InsertTableTest.Config.class) @RunWith(SpringRunner.class) @TestPropertySource("classpath:application-test.properties") public class InsertTableTest { @Autowired private MongoTemplate mongoTemplate; @Test public void insert_collection() { if (!mongoTemplate.collectionExists("mongo_test_collection")) { mongoTemplate.createCollection("mongo_test_collection"); } DBCollection mongoTestCollection = mongoTemplate.getCollection("mongo_test_collection"); // author String[] jobs = new String[]{"developer", "teacher", "driver", "police", "officer"}; Random random = new Random(); for (int i = 0; i < 1000; i++) { DBObject dbObject = new BasicDBObject(); dbObject.put("name", "liu" + i); dbObject.put("age", random.nextInt(40)); dbObject.put("job", jobs[random.nextInt(4)]); WriteResult writeResult = mongoTestCollection.insert(dbObject); System.out.println(writeResult); } } @Configuration @Import(MongoConfig.class) static class Config { } }
[ "weipeng2k@126.com" ]
weipeng2k@126.com
a76db04c7c05a4de305f9cdbd468d5d9c1233f24
724f50a21420daa92c29ddde02955ad9c89a3bf0
/WebSite/src/main/java/main/model/GlobalSetting.java
019b3359483e83e72a3bc80ce5c1d029ca5a05d9
[]
no_license
Jaguar8992/webProject
fb1df26e98478a1309bfe21a85c446544689a830
bc67083ca016721bab565472a3f7602425dca8b8
refs/heads/master
2023-07-14T06:13:18.163157
2021-08-11T06:54:54
2021-08-11T06:54:54
337,350,512
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package main.model; import javax.persistence.*; @Entity @Table (name = "global_settings") public class GlobalSetting { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column (nullable = false) private String code; @Column (nullable = false) private String name; @Column (nullable = false) private String value; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
[ "jaguar8992@ya.ru" ]
jaguar8992@ya.ru
55d7e153d816beaf708f4d289b824cfa19d8a1d9
6a7f07642d2405542facfe0f84716e06ea0ab275
/demo/upload/webupload/serverDubbox/src/main/java/me/kazaff/wu/entity/FileUploadForm.java
d22cdcf1d5d5fb0538792e3810ed1fc62353f80b
[]
no_license
joql/practice
5a3dc2a72eefc9c4d3c24a02a08185858fbb5447
1a888d69b074745fd4a86d23d26e3c5c9b763804
refs/heads/master
2021-05-05T15:04:26.793272
2019-04-04T07:46:20
2019-04-04T07:46:20
103,154,956
1
0
null
null
null
null
UTF-8
Java
false
false
3,039
java
package me.kazaff.wu.entity; import org.jboss.resteasy.annotations.providers.multipart.PartType; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; import javax.ws.rs.Encoded; import javax.ws.rs.FormParam; import javax.ws.rs.core.MediaType; import java.util.Arrays; /** * Created by kazaff on 2015/3/18. */ public class FileUploadForm { private byte[] fileData; private String userId; private String md5; private String id; private String name; private String type; private String lastModifiedDate; private String size; private int chunks; private int chunk; public int getChunks() { return chunks; } @FormParam("chunks") @DefaultValue("-1") public void setChunks(int chunks) { this.chunks = chunks; } public int getChunk() { return chunk; } @FormParam("chunk") @DefaultValue("-1") public void setChunk(int chunk) { this.chunk = chunk; } public String getUserId() { return userId; } @FormParam("userId") @DefaultValue("-1") public void setUserId(String userId) { this.userId = userId; } public String getMd5() { return md5; } @FormParam("md5") @DefaultValue("-1") public void setMd5(String md5) { this.md5 = md5; } public String getId() { return id; } @FormParam("id") @DefaultValue("-1") public void setId(String id) { this.id = id; } public String getName() { return name; } @FormParam("name") @DefaultValue("") public void setName(String name) { this.name = name; } public String getType() { return type; } @FormParam("type") @DefaultValue("") public void setType(String type) { this.type = type; } public String getLastModifiedDate() { return lastModifiedDate; } @FormParam("lastModifiedDate") @DefaultValue("") public void setLastModifiedDate(String lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } public String getSize() { return size; } @FormParam("size") @DefaultValue("-1") public void setSize(String size) { this.size = size; } public byte[] getFileData() { return fileData; } @FormParam("file") @DefaultValue("") @PartType("application/octet-stream") public void setFileData(byte[] fileData) { this.fileData = fileData; } @Override public String toString() { return "FileUploadForm{" + ", userId='" + userId + '\'' + ", md5='" + md5 + '\'' + ", id='" + id + '\'' + ", name='" + name + '\'' + ", type='" + type + '\'' + ", lastModifiedDate='" + lastModifiedDate + '\'' + ", size='" + size + '\'' + ", chunks=" + chunks + ", chunk=" + chunk + '}'; } }
[ "981037735@qq.com" ]
981037735@qq.com
927cfc394a888a47729eac0723d9044cb40c493a
d4d9d2aecde567230bc61b521e35d6e3c44527df
/app/src/main/java/com/example/doctorapp/ui/maps/MapsFragment.java
a48c74298e3c38174438d3a0e69ab94caf70c4dc
[]
no_license
tulasireddytulasi/Testing
830cbc46119ed9b3248dfe066f413d29f005e9aa
0028c8b25d6991e4ffea9481ac93d6759f666c61
refs/heads/master
2023-02-16T15:25:56.507811
2021-01-11T09:39:33
2021-01-11T09:39:33
316,704,861
1
0
null
null
null
null
UTF-8
Java
false
false
14,341
java
package com.example.doctorapp.ui.maps; import android.Manifest; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.location.Location; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageButton; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.doctorapp.R; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptor; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.android.material.chip.ChipGroup; import java.util.ArrayList; public class MapsFragment extends Fragment implements MapInteface{ private GoogleMap mMap; Location currentLocation; FusedLocationProviderClient fusedLocationProviderClient; private static final int Code = 101; private ImageButton current_location; private ArrayList<MapDataModel> dataModel; // private ViewPager viewPager; private ChipGroup chipGroup; // private ViewPagerAdapter viewPagerAdapter; private EditText editText; private RecyclerView recyclerView; private LinearLayoutManager linearLayoutManager; private MyAdapter2 myAdapter2; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment setHasOptionsMenu(true); View view = inflater.inflate(R.layout.fragment_maps, container, false); current_location = view.findViewById(R.id.current_location); editText = view.findViewById(R.id.searchbar); // viewPager = view.findViewById(R.id.viewpager); chipGroup = view.findViewById(R.id.chipGroup); dataModel = new ArrayList<>(); recyclerView = view.findViewById(R.id.recyclerview); linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setHasFixedSize(true); // viewPager.setPadding(0, 0, 300, 0); fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(getActivity()); GetLocation(); current_location.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { GetLocation(); } }); editText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (s.length() != 0){ // viewPagerAdapter.getFilter().filter(s.toString().toLowerCase()); myAdapter2.getFilter().filter(s.toString().toLowerCase()); }else { DoctorsList(); } } }); // viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){ // @Override // public void onPageSelected(int position) { // MapDataModel mapDataModel = dataModel.get(position); // double lat = mapDataModel.getLat(); // double log = mapDataModel.getLag(); // String name1 = mapDataModel.getDoctorname(); // LatLng latLng = new LatLng(lat, log); // CurrentLocation(latLng, name1); // } // }); chipGroup.setOnCheckedChangeListener(new ChipGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(ChipGroup chipGroup, int i) { switch (i){ case R.id.chip : DoctorsList(); break; case R.id.chip2: HospitalsLit(); break; case R.id.chip3: LabsList(); break; case R.id.chip4: dataModel.clear(); break; case R.id.chip5: dataModel.clear(); break; default: DoctorsList(); break; } } }); DoctorsList(); return view; } private void DoctorsList() { dataModel.clear(); dataModel.add(new MapDataModel("https://cdn.sanity.io/images/0vv8moc6/hcplive/0ebb6a8f0c2850697532805d09d4ff10e838a74b-200x200.jpg","Dr B Murali Krishna", "MBBS, MD (MRCP) (FRCP) Raditaion oncologist", "Address: Flat 204, Rajapushpam Palace, Shirdi Sai Road, Seethammadhara," + " Seethammadhara, Visakhapatnam, Andhra Pradesh 530013",17.746224, 83.320373)); dataModel.add(new MapDataModel("https://st2.depositphotos.com/3889193/7657/i/950/depositphotos_76570869-stock-photo-confident-female-doctor-posing-in.jpg", "Dr. A. Gopal Rao", "MBBS, MD (MRCP) (FRCP) Raditaion oncologist", "Address: HB Colony Rd, Seethammadhara Junction, KRM Colony, Seethammadara, Visakhapatnam, Andhra Pradesh 530013", 17.744947, 83.318719)); dataModel.add(new MapDataModel("https://images.theconversation.com/files/304957/original/file-20191203-66986-im7o5.jpg", "Dr Chandra Kala Devi", "MBBS, MD (MRCP) (FRCP) Raditaion oncologist", "Address: 50-52-15/21, Seethammadhara, Seethammadhara, Visakhapatnam, Andhra Pradesh 530013", 17.745969, 83.327179)); dataModel.add(new MapDataModel("https://st2.depositphotos.com/3889193/7657/i/950/depositphotos_76570869-stock-photo-confident-female-doctor-posing-in.jpg", "Dr. P. Sudha Malini", "MBBS, MD (MRCP) (FRCP) Raditaion oncologist", "Address: D.No.55-14-101, HB Colony Rd, Hill View Doctors Colony, Seethammadara, Visakhapatnam, Andhra Pradesh 530013\n", 17.7437817, 83.3211354)); // viewPagerAdapter = new ViewPagerAdapter(getContext(), dataModel); // viewPager.setAdapter(viewPagerAdapter); myAdapter2 = new MyAdapter2(getContext(), dataModel, this); recyclerView.setAdapter(myAdapter2); } private void HospitalsLit() { dataModel.clear(); dataModel.add(new MapDataModel("https://lh5.googleusercontent.com/p/AF1QipO517GTzGpogdIbcSiTLOqNHSO53COhlhUjf3QW=s1031-k-no","Apollo Hospitals Ramnagar Vizag", "", "Address: Door No 10, Executive Court, 50-80, Waltair Main Rd, opp. Daspalla, Ram Nagar, Visakhapatnam, Andhra Pradesh 530002",17.746224, 83.320373)); dataModel.add(new MapDataModel("https://www.medicoverhospitals.in/wp-content/uploads/2019/09/simhapuri-hospitals.jpg", "Medicover Hospitals Vizag | Best Hospitals in Vizag", "", "Address: 15-2-9, Gokhale Rd, Krishna Nagar, Maharani Peta, Visakhapatnam, Andhra Pradesh 530002", 17.744947, 83.318719)); dataModel.add(new MapDataModel("https://content.jdmagicbox.com/comp/visakhapatnam/dc/0891p8924.8924.090807100027.w3b3dc/catalogue/mgr-hospitals-pedawaltair-visakhapatnam-hospitals-tn4s8jgvhl.jpg", "MGR Hospital", "", "Address: 8-4-32, Doctors Colony, Near Visakha Eye Hospital, Pedawaltair, Visakhapatnam, Andhra Pradesh 530017", 17.745969, 83.327179)); dataModel.add(new MapDataModel("https://www.medicoverhospitals.in/wp-content/uploads/2019/09/simhapuri-hospitals.jpg", "M.V.P. Hospital", "", "Address: Plot No 6, Sector 7, Near MVP Rythu Bazaar, MVP Colony, Visakhapatnam, Andhra Pradesh 530017", 17.746817,83.330776)); // viewPagerAdapter = new ViewPagerAdapter(getContext(), dataModel); // viewPager.setAdapter(viewPagerAdapter); myAdapter2 = new MyAdapter2(getContext(), dataModel, this); recyclerView.setAdapter(myAdapter2); } private void LabsList() { dataModel.clear(); dataModel.add(new MapDataModel("https://marvelwallpapers.000webhostapp.com/upload/lab1.jpg", "Sri Sadguru Medical Lab", "", "Address: Shop No: 43-35-28/1, Akkayyapalem Main Rd, Near Baroda Bank, Akkayyapalem," + " Visakhapatnam, Andhra Pradesh 530016",17.746224, 83.320373)); dataModel.add(new MapDataModel("https://marvelwallpapers.000webhostapp.com/upload/lab2.jpg", "Sri Sai Clinical Lab", "", "Address: Shop No.55-14-102, HB Colony Rd, Near Venkateswara Swamy Temple,Near P & T Colony, Hill View Doctors Colony, Seethammadara, Visakhapatnam, Andhra Pradesh 530013\n", 17.744947, 83.318719)); dataModel.add(new MapDataModel("https://marvelwallpapers.000webhostapp.com/upload/lab3.jpg", "Mamata Laboratory", "", "Address: Rajeev Nagar, Shivaji Nagar, Rajiv Palem, Maddilapalem, Visakhapatnam, Andhra Pradesh 530003", 17.745969, 83.327179)); dataModel.add(new MapDataModel("https://marvelwallpapers.000webhostapp.com/upload/lab3.jpg", "TRIMS NANDI", "", "Address: 9-7-8/1, Sivajipalem Rd, Shivaji Palem, Pithapuram Colony, Maddilapalem, Visakhapatnam, Andhra Pradesh 530017", 17.7437817, 83.3211354)); myAdapter2 = new MyAdapter2(getContext(), dataModel, this); recyclerView.setAdapter(myAdapter2); } private void GetLocation() { Toast.makeText(getContext(), "Lat: " ,Toast.LENGTH_LONG).show(); if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, Code); return; } Task<Location> task = fusedLocationProviderClient.getLastLocation(); task.addOnSuccessListener(new OnSuccessListener<Location>() { @Override public void onSuccess(Location location) { if (location !=null){ currentLocation = location; LatLng latLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()); CurrentLocation(latLng, "I am here..."); } } }); } private void CurrentLocation(final LatLng latLngs, final String name) { SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.animateCamera(CameraUpdateFactory.newLatLng(latLngs)); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLngs, 18)); int height = 100; int width = 100; Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.marker); Bitmap smallMarker = Bitmap.createScaledBitmap(b, width, height, false); BitmapDescriptor smallMarkerIcon = BitmapDescriptorFactory.fromBitmap(smallMarker); mMap.addMarker(new MarkerOptions().position(latLngs).title(name).icon(smallMarkerIcon)); } }); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { MenuItem item=menu.findItem(R.id.notification); if(item!=null) item.setVisible(false); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode){ case Code : if (grantResults.length>0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){ GetLocation(); } break; } } @Override public void MapInterface(final MapDataModel dataModel, MyAdapter2.MyViewHolder holder, int position) { Glide.with(getContext()) .load(dataModel.getPic()) .circleCrop() .into(holder.imageView); holder.name.setText(dataModel.getDoctorname()); holder.address.setText(dataModel.getAddress()); holder.designation.setText(dataModel.getDesignation()); holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LatLng latLng = new LatLng(dataModel.getLat(), dataModel.getLag()); CurrentLocation(latLng, dataModel.getDoctorname()); } }); } }
[ "tulasireddykagithala@gmail.com" ]
tulasireddykagithala@gmail.com
ddf3256134075021fdba8c9131881471690030b7
7504b94d0480e43f210e98f74056e0309ed52398
/src/main/java/com/academic/as/demo/controllers/RegisterController.java
748ca5fd9ead5f949e079c33f61e2fc82129a2ea
[]
no_license
omar1890/academic_as
2eba037881a6f30d7f53543e979ea95f6a7c5962
bcfba336a09723971a796d493a26b93f29b94391
refs/heads/master
2022-01-17T17:13:07.400692
2018-12-03T22:20:02
2018-12-03T22:20:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,544
java
package com.academic.as.demo.controllers; import com.academic.as.demo.api.responses.RegisterResponse; import com.academic.as.demo.models.*; import com.academic.as.demo.services.RegisterService; import com.google.firebase.auth.FirebaseAuthException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RequestMapping("/register") @RestController public class RegisterController { @Autowired RegisterService registerService; @PostMapping(value = "/admin") public RegisterResponse registerAdmin(@RequestBody Admin admin) { return registerService.addAdmin(admin); } @PostMapping(value = "/student") public RegisterResponse registerStudent(@RequestBody Student student) { return registerService.addStudent(student); } @PostMapping(value = "/supervisor") public RegisterResponse registerSupervisor(@RequestBody Supervisor supervisor) { return registerService.addSupervisor(supervisor); } @PostMapping(value = "/assistant") public RegisterResponse registerAssistant(@RequestBody Assistant assistant) { return registerService.addAssistant(assistant); } @PostMapping(value = "/professor") public RegisterResponse registerProfessor(@RequestBody Professor professor) { return registerService.addProfessor(professor); } @PostMapping(value = "/user") public RegisterResponse registerUser(@RequestBody User user) { return registerService.addUser(user); } }
[ "maxmya@outlook.com" ]
maxmya@outlook.com
ec1b10632f4103565a4172ce5f867cd16a15336c
7a2d05f88d64e9d3cd4a6ceeb7e3b95afa30f99c
/src/cc/casually/main/pojo/PayInfo.java
704256a92a227cdbdedb0948e8e63be68af036d6
[]
no_license
Casually/PayTest
79c0c6bb4c85af5738898c4c811be9bc23cb47e1
60c7fd2b25fb18828e3dcafa12eff1f7e973e369
refs/heads/master
2021-01-24T18:57:40.910890
2018-02-28T06:15:44
2018-02-28T06:15:44
123,238,774
0
0
null
null
null
null
UTF-8
Java
false
false
2,681
java
package cc.casually.main.pojo; /** * 支付参数 * * @author * @create 2018-02-27 16:15 **/ public class PayInfo { private String appkey; private String method; private String sign; private String timestamp; private String version; private String outTradeNo; private String payType; private String tradeName; private String amount; private String notifyUrl; private String synNotifyUrl; private String payuserid; private String channel; private String backparams; public String getAppkey() { return appkey; } public void setAppkey(String appkey) { this.appkey = appkey; } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } public String getTimestamp() { return timestamp; } public void setTimestamp(String timestamp) { this.timestamp = timestamp; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getOutTradeNo() { return outTradeNo; } public void setOutTradeNo(String outTradeNo) { this.outTradeNo = outTradeNo; } public String getPayType() { return payType; } public void setPayType(String payType) { this.payType = payType; } public String getTradeName() { return tradeName; } public void setTradeName(String tradeName) { this.tradeName = tradeName; } public String getAmount() { return amount; } public void setAmount(String amount) { this.amount = amount; } public String getNotifyUrl() { return notifyUrl; } public void setNotifyUrl(String notifyUrl) { this.notifyUrl = notifyUrl; } public String getSynNotifyUrl() { return synNotifyUrl; } public void setSynNotifyUrl(String synNotifyUrl) { this.synNotifyUrl = synNotifyUrl; } public String getPayuserid() { return payuserid; } public void setPayuserid(String payuserid) { this.payuserid = payuserid; } public String getChannel() { return channel; } public void setChannel(String channel) { this.channel = channel; } public String getBackparams() { return backparams; } public void setBackparams(String backparams) { this.backparams = backparams; } }
[ "294321259@qq.com" ]
294321259@qq.com
50df9c84813bce2db83b8b9af5e61cc969bfb955
1084feda8796f30413e02e1b523ea12579f1210c
/app/src/main/java/comdemo/example/dell/homepagedemo/beans/Platformarticlealbum.java
869c188fb88ccf3325952ee4391df291a3383935
[]
no_license
767200412/HomePage
a5544e234f5f5780d4be1773d1d904e3381c21a1
06cdb09502b02c0e20de56d584b50a96d3e30af5
refs/heads/master
2020-06-30T20:31:59.281780
2019-08-21T07:15:57
2019-08-21T07:15:57
200,945,035
0
0
null
2019-08-19T13:39:36
2019-08-07T00:53:02
Java
UTF-8
Java
false
false
745
java
package comdemo.example.dell.homepagedemo.beans; public class Platformarticlealbum { private String Id; private String Imgurl; private String Remark; private String CreateTime; public String getId() { return Id; } public void setId(String id) { Id = id; } public String getImgurl() { return Imgurl; } public void setImgurl(String imgurl) { Imgurl = imgurl; } public String getRemark() { return Remark; } public void setRemark(String remark) { Remark = remark; } public String getCreateTime() { return CreateTime; } public void setCreateTime(String createTime) { CreateTime = createTime; } }
[ "51736946+767200412@users.noreply.github.com" ]
51736946+767200412@users.noreply.github.com
5554fbc445f9ef2939f9e4ca92968b87525c4137
5da6e6cc655421038efc1e4fcb4bd28b36055a11
/Reto5.java
344f274e0986fcf9cd23d6b45a00f022d5900cd1
[]
no_license
rmlu20xx/MiPrimerRepositorio
2ea8b408f927fbb9fa4e97d07d50b8b9a1d68214
9512e8211fb8d47b1da6c022553e5218184b1ab0
refs/heads/master
2023-07-20T05:47:53.120660
2021-09-07T01:31:28
2021-09-07T01:31:28
403,801,718
0
0
null
null
null
null
UTF-8
Java
false
false
7,162
java
package reto.pkg2; import java.time.LocalDate; import java.util.Scanner; public class Reto5 { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); String Placa; int DiasDesdeUltimoMantenimiento; boolean TieneSeguro; String Cedula; int Edad; String Nombre; String Fecha; int HorasAlquiler; boolean aplicaDescuento; //**************************************************************************************************************************** //**************************************************************************************************************************** Cliente cliente1 = new Cliente("1015143634",23,"Juan"); Cliente cliente2 = new Cliente("1364726437",33,"Mateo"); Cliente cliente3 = new Cliente("9685432432",43,"Ana"); Cliente cliente4 = new Cliente("1015143634",23,"Juan"); Cliente cliente5 = new Cliente("4567987652",50,"Alfredo"); Cliente cliente6 = new Cliente("5468978655",58,"Gloria"); Cliente cliente7 = new Cliente("1015143634",23,"Juan"); Alquiler historial0 = new Alquiler(cliente1); Alquiler historial1 = new Alquiler(cliente2); Alquiler historial2 = new Alquiler(cliente3); Alquiler historial3 = new Alquiler(cliente4); Alquiler historial4 = new Alquiler(cliente5); Alquiler historial5 = new Alquiler(cliente6); Alquiler historial6 = new Alquiler(cliente7); Alquiler[] historial_1 = new Alquiler[7]; historial_1[0]=historial0; historial_1[1]=historial1; historial_1[2]=historial2; historial_1[3]=historial3; historial_1[4]=historial4; historial_1[5]=historial5; historial_1[6]=historial6; //**************************************************************************************************************************** //**************************************************************************************************************************** Cliente cliente8 = new Cliente("9078968512",58,"Camila"); Cliente cliente9 = new Cliente("1364726437",33,"Mateo"); Cliente cliente10 = new Cliente("9685432432",43,"Ana"); Cliente cliente11 = new Cliente("847534654",38,"Liliana"); Cliente cliente12 = new Cliente("4567987652",50,"Alfredo"); Cliente cliente13 = new Cliente("5468978655",58,"Gloria"); Cliente cliente14 = new Cliente("0896756443",23,"Mario"); Alquiler historial7 = new Alquiler(cliente8); Alquiler historial8 = new Alquiler(cliente9); Alquiler historial9 = new Alquiler(cliente10); Alquiler historial10 = new Alquiler(cliente11); Alquiler historial11 = new Alquiler(cliente12); Alquiler historial12 = new Alquiler(cliente13); Alquiler historial13 = new Alquiler(cliente14); Alquiler[] historial_2 = new Alquiler[7]; historial_2[0]=historial7; historial_2[1]=historial8; historial_2[2]=historial9; historial_2[3]=historial10; historial_2[4]=historial11; historial_2[5]=historial12; historial_2[6]=historial13; //**************************************************************************************************************************** //**************************************************************************************************************************** Auto auto1 = new Auto("DST196",2,true); Alquiler alquiler0 = new Alquiler(cliente1, auto1, LocalDate.parse("2021-06-12"),48); Alquiler alquiler1 = new Alquiler(cliente2, auto1, LocalDate.parse("2021-07-12"),30); Alquiler alquiler2 = new Alquiler(cliente1, auto1, LocalDate.parse("2021-07-14"),25); Alquiler alquiler3 = new Alquiler(cliente3, auto1, LocalDate.parse("2021-07-14"),12); Alquiler alquiler4 = new Alquiler(cliente1, auto1, LocalDate.parse("2021-07-16"),8); Alquiler[] alquileres = new Alquiler[5]; alquileres[0]=alquiler0; alquileres[1]=alquiler1; alquileres[2]=alquiler2; alquileres[3]=alquiler3; alquileres[4]=alquiler4; //**************************************************************************************************************************** //**************************************************************************************************************************** System.out.print("Digite la Cedula del cliente = "); Cedula = entrada.nextLine(); System.out.print("Digite la Edad del cliente = "); Edad = entrada.nextInt(); System.out.print("Digite el Nombre del cliente = "); entrada.nextLine(); Nombre = entrada.nextLine(); System.out.print("Digite el Número de la Placa del Vehiculo = "); Placa = entrada.nextLine(); System.out.print("Digite los dias que lleva desde el último mantenimiento = "); DiasDesdeUltimoMantenimiento = entrada.nextInt(); System.out.print("Indique si el Vehiculo tiene seguro o no = "); TieneSeguro = entrada.nextBoolean(); System.out.print("Indique la Fecha (Año-Mes-Dia) del Alquiler = "); Fecha = entrada.next(); System.out.print("Indique la cantidad de horas de alquiler = "); HorasAlquiler=entrada.nextInt(); System.out.print("Indique si tiene (true) o no (false) descueento = "); aplicaDescuento = entrada.nextBoolean(); Cliente cliente = new Cliente(Cedula,Edad,Nombre); Auto Vehiculo = new Auto(Placa,DiasDesdeUltimoMantenimiento,TieneSeguro); Alquiler alquiler = new Alquiler(cliente, Vehiculo, LocalDate.parse(Fecha),HorasAlquiler); Alquiler historial = new Alquiler(cliente); System.out.println("El vehiculo de placas "+Vehiculo.getPlaca()); System.out.println("Requiere mantenimiento ? = "+Vehiculo.NecesitaMantenimiento()); System.out.println("Se puede rentar ? = "+Vehiculo.SePuedeRentar()); System.out.println("Nombre del Cliente = "+cliente.getNombre()); System.out.println("La edad de Cliente = "+cliente.getEdad()); System.out.println("la cedula del Cliente = "+cliente.getCedula()); System.out.println("El valor de descuento es = "+alquiler.ObtenerDescuento(alquileres)); System.out.println("El costo del alquiler es = "+alquiler.CalcularCosto(aplicaDescuento)); System.out.println("Se le puede alquilar al Cliente = "+historial.PuedeAlquilar(historial_1,cliente)); System.out.println("Se le puede alquilar al Cliente = "+historial.PuedeAlquilar(historial_2,cliente)); /* if (alquiler.ObtenerDescuento(alquileres)==2||alquiler.ObtenerDescuento(alquileres)==5){ aplicaDescuento = true; System.out.println("El costo total con descuento es = "+alquiler.CalcularCosto(aplicaDescuento)); }else{ aplicaDescuento = false; System.out.println("El costo total sin descuento es = "+alquiler.CalcularCosto(aplicaDescuento)); } */ } }
[ "rmlu20xx@gmail.com" ]
rmlu20xx@gmail.com
f28adc22621b6cec40bbe336ae96a223a98a7014
5c15b1ba7ce003771d3a7f44b0c9929c5a187dfa
/src/main/java/runner/Main.java
b3720973855e7fd2b5c4d5e192215df6ed4ffc22
[]
no_license
Pivansm/JAPIVK
b98d1412c71c95defae7e88ebf1a635c3cf54038
f2d2486c794359c3ddccee303a324036c08ac995
refs/heads/master
2022-11-23T01:51:53.633962
2020-07-31T10:50:04
2020-07-31T10:50:04
282,930,028
0
0
null
null
null
null
UTF-8
Java
false
false
2,308
java
package main.java.runner; import main.java.setting.DBConnector; import main.java.sqlitejdbc.SQLiteDAO; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.time.LocalDate; import java.util.logging.FileHandler; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; public class Main { public static final Logger LOGGER; static { LOGGER = Logger.getLogger("VK API Groups"); try { File logDir = new File("./logs/"); if(!logDir.exists()) logDir.mkdir(); String logPattern = String.format("%s%clog%s.log", logDir.getAbsolutePath(), File.separatorChar, LocalDate.now()); FileHandler fileHandler = new FileHandler(logPattern, true); SimpleFormatter formatter = new SimpleFormatter(); fileHandler.setFormatter(formatter); LOGGER.addHandler(fileHandler); } catch (IOException e) { e.printStackTrace(); } } private static SQLiteDAO sqLiteDAO; private static DBConnector connectorSqlite; private static final String CONN_IRL = "jdbc:sqlite:dbsqlrb.sqlite"; private static final String CONN_DRIVER = "org.sqlite.JDBC"; public static void main(String[] args) { System.out.println("========Start========"); File currSqlite = new File("dbsqlrb.sqlite"); if(!currSqlite.exists()) { System.out.println("Нет БД dbsqlrb.sqlite"); try { connectorSqlite = new DBConnector(CONN_DRIVER, CONN_IRL, null, null); sqLiteDAO = new SQLiteDAO(connectorSqlite.getConnection()); sqLiteDAO.createTable(); sqLiteDAO.closeConnection(); } catch (SQLException throwables) { throwables.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } else { System.out.println("БД dbsqlrb.sqlite OK!"); } try { MainLaunch mainLaunch = new MainLaunch(); //mainLaunch.postToFileTxt(); mainLaunch.processingFoundation(); } catch (Exception e) { e.printStackTrace(); } } }
[ "pivansm@outlook.com" ]
pivansm@outlook.com
057472702f37292c5730d9f70ac2bf2052e118d2
449cc92656d1f55bd7e58692657cd24792847353
/ad/src/main/java/com/ye/business/ad/service/impl/CarouselServiceImpl.java
7b47f4f323f8be49969d9d1f90669563bc309fb8
[]
no_license
cansou/HLM
f80ae1c71d0ce8ead95c00044a318796820a8c1e
69d859700bfc074b5948b6f2c11734ea2e030327
refs/heads/master
2022-08-27T16:40:17.206566
2019-12-18T06:48:10
2019-12-18T06:48:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,488
java
package com.ye.business.ad.service.impl; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Calendar; import java.util.Date; /** * Copyright &copy; 2018-2021 All rights reserved. * * Licensed under the 深圳市扬恩科技 License, Version 1.0 (the "License"); * */ import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import com.lj.base.core.pagination.Page; import com.lj.base.core.util.AssertUtils; import com.lj.base.core.util.GUID; import com.lj.base.core.util.StringUtils; import com.lj.base.exception.TsfaServiceException; import com.lj.base.mvc.base.json.JsonUtils; import com.lj.cc.clientintf.LocalCacheSystemParamsFromCC; import com.lj.cc.domain.JobCenter; import com.lj.cc.service.IJobMgrService; import com.ye.business.ad.constant.ErrorCodeCarousel; import com.ye.business.ad.dao.ICarouselDao; import com.ye.business.ad.domain.Carousel; import com.ye.business.ad.dto.AdvertiseTaskDto; import com.ye.business.ad.dto.CarouselDto; import com.ye.business.ad.dto.CarouselViewDto; import com.ye.business.ad.dto.FindCarouselPage; import com.ye.business.ad.enums.AdvStatus; import com.ye.business.ad.service.ICarouselService; import com.ye.business.ad.service.ICarouselShowService; import com.ye.business.ad.service.ICarouselViewService; /** * 类说明:实现类 * * * <p> * 详细描述:. * * @author sjiying * * * CreateDate: 2019.04.18 */ @Service public class CarouselServiceImpl implements ICarouselService { /** Logger for this class. */ private static final Logger logger = LoggerFactory.getLogger(CarouselServiceImpl.class); @Resource private ICarouselDao carouselDao; @Autowired private ICarouselShowService carouselShowService; @Autowired private ICarouselViewService carouselViewService; @Resource private IJobMgrService jobMgrService; @Resource private LocalCacheSystemParamsFromCC localCacheSystemParams; @Override public String addCarousel(CarouselDto carouselDto) throws TsfaServiceException { logger.debug("addCarousel(AddCarousel addCarousel={}) - start", carouselDto); AssertUtils.notNull(carouselDto); try { Carousel carousel = new Carousel(); // add数据录入 carousel.setCode(GUID.getPreUUID()); carousel.setMemberNoGuid(carouselDto.getMemberNoGuid()); carousel.setMemberNameGuid(carouselDto.getMemberNameGuid()); carousel.setShopNo(carouselDto.getShopNo()); carousel.setShopName(carouselDto.getShopName()); carousel.setMerchantNo(carouselDto.getMerchantNo()); carousel.setMerchantName(carouselDto.getMerchantName()); carousel.setMemberNo(carouselDto.getMemberNo()); carousel.setState(carouselDto.getState()); carousel.setLink(carouselDto.getLink()); carousel.setAdvLink(carouselDto.getAdvLink()); carousel.setAdvTypeCode(carouselDto.getAdvTypeCode()); carousel.setAdvType(carouselDto.getAdvType()); carousel.setSource(carouselDto.getSource()); carousel.setNumOrder(carouselDto.getNumOrder()); carousel.setRemark(carouselDto.getRemark()); carousel.setCreateId(carouselDto.getCreateId()); carousel.setCreateDate(carouselDto.getCreateDate()); carousel.setUpdateId(carouselDto.getUpdateId()); carousel.setUpdateDate(carouselDto.getUpdateDate()); carousel.setPriceSum(carouselDto.getPriceSum()); carousel.setPriceClick(carouselDto.getPriceClick()); carousel.setPriceView(carouselDto.getPriceView()); carousel.setReleaseDate(carouselDto.getReleaseDate()); carousel.setUpDate(carouselDto.getUpDate()); carousel.setDownDate(carouselDto.getDownDate()); carousel.setAdvStatus(carouselDto.getAdvStatus()); carouselDao.insertSelective(carousel); // 任务调度上架,下架 saveParamJob(carousel.getCode(), carousel.getUpDate(), AdvertiseTaskDto.STATUS_UP); saveParamJob(carousel.getCode(), carousel.getDownDate(), AdvertiseTaskDto.STATUS_DOWN); logger.debug("addCarousel(CarouselDto) - end - return"); return carousel.getCode(); } catch (TsfaServiceException e) { logger.error(e.getMessage(), e); throw e; } catch (Exception e) { logger.error("新增轮播广告记录信息错误!", e); throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_ADD_ERROR, "新增轮播广告记录信息错误!", e); } } /** * * * 方法说明:不分页查询轮播广告记录信息 * * @param findCarouselPage * @return * @throws TsfaServiceException * * @author sjiying CreateDate: 2019年04月18日 * */ public List<CarouselDto> findCarousels(FindCarouselPage findCarouselPage) throws TsfaServiceException { AssertUtils.notNull(findCarouselPage); List<CarouselDto> returnList = null; try { returnList = carouselDao.findCarousels(findCarouselPage); // 插入广告显示信息 if (findCarouselPage.getParam() != null && findCarouselPage.getParam().getHasTrack() != null && findCarouselPage.getParam().getHasTrack()) { String updateId = findCarouselPage.getParam().getUpdateId(); String ip = findCarouselPage.getParam().getRemark(); List<String> carouselCodeList = returnList.stream().map(CarouselDto::getCode).collect(Collectors.toList()); if (StringUtils.isNotEmpty(updateId)) { carouselShowService.saveCarouselShowForTrack(carouselCodeList, updateId, new Date(), ip); } } } catch (Exception e) { logger.error("查找轮播广告记录信息信息错误!", e); throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_NOT_EXIST_ERROR, "轮播广告记录信息不存在"); } return returnList; } @Override public void updateCarousel(CarouselDto carouselDto) throws TsfaServiceException { logger.debug("updateCarousel(CarouselDto carouselDto={}) - start", carouselDto); AssertUtils.notNull(carouselDto); AssertUtils.notNullAndEmpty(carouselDto.getCode(), "Code不能为空"); try { Carousel carousel = new Carousel(); // update数据录入 carousel.setCode(carouselDto.getCode()); carousel.setMemberNoGuid(carouselDto.getMemberNoGuid()); carousel.setMemberNameGuid(carouselDto.getMemberNameGuid()); carousel.setShopNo(carouselDto.getShopNo()); carousel.setShopName(carouselDto.getShopName()); carousel.setMerchantNo(carouselDto.getMerchantNo()); carousel.setMerchantName(carouselDto.getMerchantName()); carousel.setMemberNo(carouselDto.getMemberNo()); carousel.setState(carouselDto.getState()); carousel.setLink(carouselDto.getLink()); carousel.setAdvLink(carouselDto.getAdvLink()); carousel.setAdvTypeCode(carouselDto.getAdvTypeCode()); carousel.setAdvType(carouselDto.getAdvType()); carousel.setSource(carouselDto.getSource()); carousel.setNumOrder(carouselDto.getNumOrder()); carousel.setRemark(carouselDto.getRemark()); carousel.setCreateId(carouselDto.getCreateId()); carousel.setCreateDate(carouselDto.getCreateDate()); carousel.setUpdateId(carouselDto.getUpdateId()); carousel.setUpdateDate(carouselDto.getUpdateDate()); carousel.setPriceSum(carouselDto.getPriceSum()); carousel.setPriceClick(carouselDto.getPriceClick()); carousel.setPriceView(carouselDto.getPriceView()); carousel.setReleaseDate(carouselDto.getReleaseDate()); carousel.setUpDate(carouselDto.getUpDate()); carousel.setDownDate(carouselDto.getDownDate()); carousel.setAdvStatus(carouselDto.getAdvStatus()); AssertUtils.notUpdateMoreThanOne(carouselDao.updateByPrimaryKeySelective(carousel)); // 任务调度上架,下架 saveParamJob(carousel.getCode(), carousel.getUpDate(), AdvertiseTaskDto.STATUS_UP); saveParamJob(carousel.getCode(), carousel.getDownDate(), AdvertiseTaskDto.STATUS_DOWN); logger.debug("updateCarousel(CarouselDto) - end - return"); } catch (TsfaServiceException e) { logger.error(e.getMessage(), e); throw e; } catch (Exception e) { logger.error("轮播广告记录信息更新信息错误!", e); throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_UPDATE_ERROR, "轮播广告记录信息更新信息错误!", e); } } @Override public CarouselDto findCarousel(CarouselDto carouselDto) throws TsfaServiceException { logger.debug("findCarousel(FindCarousel findCarousel={}) - start", carouselDto); AssertUtils.notNull(carouselDto); AssertUtils.notAllNull(carouselDto.getCode(), "Code不能为空"); try { Carousel carousel = carouselDao.selectByPrimaryKey(carouselDto.getCode()); if (carousel == null) { return null; // throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_NOT_EXIST_ERROR,"轮播广告记录信息不存在"); } CarouselDto findCarouselReturn = new CarouselDto(); // find数据录入 findCarouselReturn.setCode(carousel.getCode()); findCarouselReturn.setMemberNoGuid(carousel.getMemberNoGuid()); findCarouselReturn.setMemberNameGuid(carousel.getMemberNameGuid()); findCarouselReturn.setShopNo(carousel.getShopNo()); findCarouselReturn.setShopName(carousel.getShopName()); findCarouselReturn.setMerchantNo(carousel.getMerchantNo()); findCarouselReturn.setMerchantName(carousel.getMerchantName()); findCarouselReturn.setMemberNo(carousel.getMemberNo()); findCarouselReturn.setState(carousel.getState()); findCarouselReturn.setLink(carousel.getLink()); findCarouselReturn.setAdvLink(carousel.getAdvLink()); findCarouselReturn.setAdvTypeCode(carousel.getAdvTypeCode()); findCarouselReturn.setAdvType(carousel.getAdvType()); findCarouselReturn.setSource(carousel.getSource()); findCarouselReturn.setNumOrder(carousel.getNumOrder()); findCarouselReturn.setRemark(carousel.getRemark()); findCarouselReturn.setCreateId(carousel.getCreateId()); findCarouselReturn.setCreateDate(carousel.getCreateDate()); findCarouselReturn.setUpdateId(carousel.getUpdateId()); findCarouselReturn.setUpdateDate(carousel.getUpdateDate()); findCarouselReturn.setPriceSum(carousel.getPriceSum()); findCarouselReturn.setPriceClick(carousel.getPriceClick()); findCarouselReturn.setPriceView(carousel.getPriceView()); findCarouselReturn.setReleaseDate(carousel.getReleaseDate()); findCarouselReturn.setUpDate(carousel.getUpDate()); findCarouselReturn.setDownDate(carousel.getDownDate()); findCarouselReturn.setAdvStatus(carousel.getAdvStatus()); if (carouselDto.getHasTrack() != null && carouselDto.getHasTrack()) { // 记录查看广告信息 CarouselViewDto carouselViewDto = new CarouselViewDto(); Date now = new Date(); carouselViewDto.setCreateDate(now); carouselViewDto.setCarouselCode(carousel.getCode()); carouselViewDto.setUpdateTime(now); carouselViewDto.setCreateId(carouselDto.getUpdateId()); carouselViewDto.setRemark(carouselDto.getRemark()); carouselViewService.addCarouselView(carouselViewDto); } logger.debug("findCarousel(CarouselDto) - end - return value={}", findCarouselReturn); return findCarouselReturn; } catch (TsfaServiceException e) { logger.error(e.getMessage(), e); throw e; } catch (Exception e) { logger.error("查找轮播广告记录信息信息错误!", e); throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_FIND_ERROR, "查找轮播广告记录信息信息错误!", e); } } @Override public Page<CarouselDto> findCarouselPage(FindCarouselPage findCarouselPage) throws TsfaServiceException { logger.debug("findCarouselPage(FindCarouselPage findCarouselPage={}) - start", findCarouselPage); AssertUtils.notNull(findCarouselPage); List<CarouselDto> returnList = null; int count = 0; try { returnList = carouselDao.findCarouselPage(findCarouselPage); count = carouselDao.findCarouselPageCount(findCarouselPage); if (findCarouselPage.getParam() != null && returnList != null && !returnList.isEmpty() && findCarouselPage.getParam().getHasTrack() != null && findCarouselPage.getParam().getHasTrack()) { List<String> carouselCodeList = returnList.stream().map(CarouselDto::getCode).collect(Collectors.toList()); // 统计展示次数 Map<String, Integer> numShowMap = this.carouselShowService.findCarouselShowPageCountForGroupCarouselCode(carouselCodeList); // 统计查看点击次数 Map<String, Integer> numViewMap = this.carouselViewService.findCarouselViewPageCountForGroupCarouselCode(carouselCodeList); returnList.forEach(action -> { if (numShowMap.containsKey(action.getCode())) { action.setNumShow(numShowMap.getOrDefault(action.getCode(), 0)); } if (numViewMap.containsKey(action.getCode())) { action.setNumView(numViewMap.getOrDefault(action.getCode(), 0)); } }); } } catch (Exception e) { logger.error("轮播广告记录信息不存在错误", e); throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_FIND_PAGE_ERROR, "轮播广告记录信息不存在错误.!", e); } Page<CarouselDto> returnPage = new Page<CarouselDto>(returnList, count, findCarouselPage); logger.debug("findCarouselPage(FindCarouselPage) - end - return value={}", returnPage); return returnPage; } @Override public void removeByPrimaryKey(String code) throws TsfaServiceException { logger.debug("removeByPrimaryKey(String code={}) - start", code); AssertUtils.notNullAndEmpty(code, "Code不能为空"); try { AssertUtils.notUpdateMoreThanOne(carouselDao.deleteByPrimaryKey(code)); logger.debug("removeByPrimaryKey(code) - end - return"); } catch (TsfaServiceException e) { logger.error(e.getMessage(), e); throw e; } catch (Exception e) { logger.error("轮播广告记录信息刪除信息错误!", e); throw new TsfaServiceException(ErrorCodeCarousel.CAROUSEL_UPDATE_ERROR, "轮播广告记录信息刪除信息错误!", e); } } @Override public void batchUpdateCarouselForUpOrDown(String batchNum) throws TsfaServiceException { logger.info("批次{},1.开始记录正常轮播广告信息....", batchNum); FindCarouselPage findCarouselPage = new FindCarouselPage(); CarouselDto param = new CarouselDto(); // param.setState(RwState.normal.toString()); // param.setAdvStatus(AdvStatus.up.toString()); // 已上架广告 findCarouselPage.setParam(param); List<CarouselDto> recordList = carouselDao.findCarousels(findCarouselPage); if (CollectionUtils.isEmpty(recordList)) { logger.info("批次{},2.无需要上下架轮播广告记录....", batchNum); return; } LocalDateTime sysNow = LocalDateTime.now(); // 筛选需要下架的广告记录;此处使用并行处理 List<String> codeList = recordList.parallelStream().filter(pre -> { // 下架时间小于当前时间 if (pre.getDownDate() != null && pre.getDownDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().isBefore(sysNow)) { return true; } return false; }).map(CarouselDto::getCode).collect(Collectors.toList()); if (CollectionUtils.isEmpty(codeList)) { logger.info("批次{},2.无需要下架轮播广告记录....", batchNum); return; } logger.info("批次{},2.筛选出下架轮播广告信息.... {}", batchNum, codeList); Date now = new Date(); CarouselDto updateRecord = new CarouselDto(); updateRecord.setAdvStatus(AdvStatus.down.toString()); updateRecord.setCodeList(codeList); updateRecord.setUpDate(now); updateRecord.setUpdateId(batchNum); int count = carouselDao.updateByPrimaryKeyBatchSelective(updateRecord); logger.info("批次{},3.下架轮播广告信息成功{},总计:{}条....", batchNum, codeList, count); // 筛选需要下架的广告记录;此处使用并行处理 List<String> codeUpList = recordList.parallelStream().filter(pre -> { // 下架时间小于当前时间 if (pre.getUpDate() != null && pre.getUpDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().isBefore(sysNow)) { return true; } return false; }).map(CarouselDto::getCode).collect(Collectors.toList()); if (CollectionUtils.isEmpty(codeList)) { logger.info("批次{},4.无需要上架轮播广告记录....", batchNum); return; } logger.info("批次{},4.筛选出上架轮播广告信息.... {}", batchNum, codeUpList); CarouselDto updateUpRecord = new CarouselDto(); updateUpRecord.setAdvStatus(AdvStatus.up.toString()); updateUpRecord.setCodeList(codeUpList); updateUpRecord.setUpDate(now); updateUpRecord.setUpdateId(batchNum); int countUp = carouselDao.updateByPrimaryKeyBatchSelective(updateUpRecord); logger.info("批次{},5.上架轮播广告信息成功{},总计:{}条....", batchNum, codeUpList, countUp); } /** * * *方法说明:新增临时任务调度 * * @param code * @param executeTime * @param status * @author sjiying * @CreateDate 2019年7月18日 */ private void saveParamJob(String code, Date executeTime, String status) { // 为空,不执行 if (StringUtils.isEmpty(code) || StringUtils.isEmpty(status) || executeTime == null) { return; } // 执行时间小于当前时间,不执行 if (executeTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().isBefore(LocalDateTime.now())) { return; } JobCenter jc = new JobCenter(); jc.setIsEnable("1"); // 构造corn表达式 StringBuilder jobCalender = new StringBuilder(""); Calendar calendar = Calendar.getInstance(); calendar.setTime(executeTime);// 设置日历时间 jobCalender.append(calendar.get(Calendar.SECOND)).append(" ").append(calendar.get(Calendar.MINUTE)).append(" ").append(calendar.get(Calendar.HOUR_OF_DAY)).append(" ") .append(calendar.get(Calendar.DATE)).append(" ").append(calendar.get(Calendar.MONTH) + 1).append(" ?").append(" ").append(calendar.get(Calendar.YEAR)); jc.setJobCalender(jobCalender.toString());// 0 47 11 25 12 ? 2017 // String callbackUrl = localCacheSystemParams.getSystemParam("ad", "advertiseJob", "advertiseJobTaskCallbackUrl"); jc.setJobIntf(callbackUrl); jc.setJobName("添加广告上下架任务回调地址"); jc.setSystemAliasName("ad"); String jobEnglishName = String.format("AddAdvertiseJob:%s:%s:%s:%d", code, status, AdvertiseTaskDto.TYPE_CAROUSEL, executeTime.getTime()); jc.setJobEnglishName(jobEnglishName); AdvertiseTaskDto task = new AdvertiseTaskDto(); task.setCode(code); task.setExecuteTime(executeTime); task.setStatus(status); task.setType(AdvertiseTaskDto.TYPE_CAROUSEL); jc.setJobParam(JsonUtils.jsonFromObject(task)); jobMgrService.addTempJob(jc); logger.debug("AddAdvertiseJob: " + jc); } @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class) public void updateForTask(AdvertiseTaskDto record) throws TsfaServiceException { AssertUtils.notNullAndEmpty(record); AssertUtils.notNullAndEmpty(record.getCode()); AssertUtils.notNullAndEmpty(record.getStatus()); AssertUtils.notNullAndEmpty(record.getExecuteTime()); Carousel adRecord = carouselDao.selectByPrimaryKey(record.getCode()); AssertUtils.notNullAndEmpty(adRecord); String batchNum = "" + System.currentTimeMillis(); Date now = new Date(); // 上架 if (AdvertiseTaskDto.STATUS_UP.equals(record.getStatus())) { if (!record.getExecuteTime().equals(adRecord.getUpDate())) { return; // 上架时间不正确 } if (AdvStatus.up.toString().equals(adRecord.getAdvStatus())) { return; // 已上架 } Carousel updateRecord = new Carousel(); updateRecord.setAdvStatus(AdvStatus.up.toString()); updateRecord.setCode(record.getCode()); updateRecord.setUpDate(now); updateRecord.setUpdateId(batchNum); carouselDao.updateByPrimaryKeySelective(updateRecord); } // 下架 if (AdvertiseTaskDto.STATUS_DOWN.equals(record.getStatus())) { if (!record.getExecuteTime().equals(adRecord.getDownDate())) { return; // 下架时间不正确 } Carousel updateRecord = new Carousel(); updateRecord.setAdvStatus(AdvStatus.down.toString()); updateRecord.setCode(record.getCode()); updateRecord.setUpDate(now); updateRecord.setUpdateId(batchNum); carouselDao.updateByPrimaryKeySelective(updateRecord); } } }
[ "37724558+wo510751575@users.noreply.github.com" ]
37724558+wo510751575@users.noreply.github.com
5d8f447036f0d84231946a3c538b74694ed0aa42
aeea751a0ca7fcbc00f524b8814cfd84e6ac317c
/src/test/java/com/rafaello/WojappApplicationTests.java
e30cd71968b18cb3f2ce2c0fde99a59c1e6c5360
[]
no_license
Plusz7/projEx
5d6122213322d7c23753fa61a464b16b26fd9606
eae92256005032f030593faac84c52652cdf4766
refs/heads/master
2020-03-23T00:41:22.579081
2018-07-13T18:15:10
2018-07-13T18:15:10
140,879,146
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package com.rafaello; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class WojappApplicationTests { @Test public void contextLoads() { } }
[ "darek.pluszczynski@gmail.com" ]
darek.pluszczynski@gmail.com
e266c35ca3176f7ccc92b81a1da46bf25730b5f1
d69f44db7a8e0dfc84163cb51196444277d97b59
/ReviewJavaSE/day01_继承_抽象类/src/com/itheima/demo01_类和对象/Student.java
0a036cc7393186d447c464f4e7f7ee690f0ed623
[]
no_license
eternally0813/repository1
e3e38e359befa284824fa37ceda0e53be721d5ee
b7121d619c5dbc183e765a324004d6ea250608de
refs/heads/master
2022-08-25T06:21:16.393937
2020-05-24T14:12:39
2020-05-24T14:12:39
266,555,940
0
0
null
null
null
null
UTF-8
Java
false
false
727
java
package com.itheima.demo01_类和对象; public class Student { private String name; private int age; private String sex; //构造方法 public Student() { } //全参的 public Student(String name, int age, String sex) { this.name = name; this.age = age; this.sex = sex; } //get 和 set public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } }
[ "eternally0813@163.com" ]
eternally0813@163.com
c20b9ff60edcc6d0ad16ec9fbd973e7b1b553521
0011841c2fb086e4db80813e454a366450f96f6b
/app/src/main/java/com/teamtreehouse/musicmachine/DownloadThread.java
779406259ace77a6907dad68f037328da37262cc
[]
no_license
Rikharthu/Music_Machine-Threads_and_Services
b20f061334e716f8312955d07ab413b40bedb179
20a501b0435bb90e3f765ff35c8f8255d529314e
refs/heads/master
2020-12-04T22:24:08.087817
2016-09-25T18:10:12
2016-09-25T18:10:12
67,045,059
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package com.teamtreehouse.musicmachine; import android.os.Looper; import android.util.Log; public class DownloadThread extends Thread { private static final String TAG = DownloadThread.class.getSimpleName(); public DownloadHandler mHandler; @Override public void run() { Log.d(TAG,"run()"); // Initialize the current thread as a looper Looper.prepare(); // By default a Handler is associated with a looper of the current thread mHandler=new DownloadHandler(); // Start looping over the message queue Looper.loop(); } }
[ "uberviolence@gmail.com" ]
uberviolence@gmail.com
a37a1d6b0e629495e471a91fd4c09313d33ffac1
331da454c9cfe8d366d4879ac91c1d2d9f8178c9
/src/com/hanzo/register/rules/BirthdayRule.java
4709bb082144a8b5446b5279cff4b81535db0b27
[]
no_license
JeffersonAlmeida/Register
9c8e98e95414e71c7e8255641fe2ce54415ea7c8
ef1edd25d59004da08ca83f913bd83a2676ef655
refs/heads/master
2021-01-21T05:05:16.292928
2015-09-17T23:08:59
2015-09-17T23:08:59
42,589,430
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.hanzo.register.rules; import android.content.Context; import android.view.View; import com.hanzo.register.R; import com.mobsandgeeks.saripaar.QuickRule; public class BirthdayRule extends QuickRule<View> { @Override public boolean isValid(View view) { return true; } @Override public String getMessage(Context context) { return context.getResources().getString(R.string.invalid); } }
[ "jefferson.almeida.comp@gmail.com" ]
jefferson.almeida.comp@gmail.com
520336f52bd2c4c52f1ecae3977118994bc918b7
8b3837e8a3c8ac731d888407c0424996f977b4a0
/ChukkarSignupWeb/com.defenestrate.chukkars/src/com/defenestrate/chukkars/client/PlayerService.java
3996727fbc36d1ae7ee9bf635bde9ad4fb7ee4ea
[]
no_license
blah1234/chukkar-signup
083a6d5778beddccdf0b9440814db2c8ec1631f4
3204952d7dfdb6141c34458174cbe0889528e96a
refs/heads/master
2020-04-07T04:59:48.890917
2014-11-15T04:15:58
2014-11-15T04:15:58
32,494,084
1
0
null
null
null
null
UTF-8
Java
false
false
926
java
package com.defenestrate.chukkars.client; import java.util.List; import com.defenestrate.chukkars.shared.Day; import com.defenestrate.chukkars.shared.Player; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath("player") public interface PlayerService extends RemoteService { /** * Adds a player * @param name name of the player * @param numChukkars number of chukkars the player is requesting * @return persisted Player object */ Player addPlayer(String name, Integer numChukkars, Day requestDay); /** * Edits the number of chukkars for a player * @param playerId persistence store Id of the player * @param numChukkars new number of chukkars for the player */ void editChukkars(Long playerId, Integer numChukkars); void removePlayer(Long id); List<Player> getPlayers(); }
[ "hwang.shawn@18fa5fbb-a5e2-92bc-02b7-a8c536cd345a" ]
hwang.shawn@18fa5fbb-a5e2-92bc-02b7-a8c536cd345a
323d5a07ff7b34728fa9bdee95c998b6774ace82
9a846f3c4d48656fd2a5f2b847071916b4b5969d
/NoDaArvore/src/com/atividade/Principal.java
ce4c24ac0c0bb4766d6aab32a4cc56b149ea060b
[]
no_license
JessicaPortilio/Estrutura_De_Dados_1
9777310c2f31fe63aeaa2babedcc9b4cba6016b9
abe8aaffcae2fe4574c9879ccfb5b684721c1dc5
refs/heads/master
2022-11-05T00:59:23.928758
2020-07-04T18:05:44
2020-07-04T18:05:44
277,161,500
0
0
null
null
null
null
UTF-8
Java
false
false
137
java
package com.atividade; public class Principal { public static void main (String[] args) { NodaArvore T1 = new NodaArvore(); } }
[ "jessicaket91@gmail.com" ]
jessicaket91@gmail.com
50836b89abcf98fa3c53dd3e2e9dfcc437458b33
324d1a2cd2f0dd4f77597debda98b12c31e23022
/behavior/src/main/java/org/behavior/template_method/ConcreteClass1.java
621fcf8af3f2455ab2c86db474e8c639d3e29662
[]
no_license
zlyITGod/pattern-learning
dd464a63d3c7de952ebef3519e747f5021c3218c
7e22ea939ab566e8e1a4c76dbb10aef1813c4292
refs/heads/master
2021-07-20T04:29:21.777197
2019-11-07T09:08:54
2019-11-07T09:08:54
220,194,052
0
0
null
2020-10-13T17:17:00
2019-11-07T09:04:08
Java
UTF-8
Java
false
false
397
java
package org.behavior.template_method; public class ConcreteClass1 extends AbstractPerson { @Override protected void takeThings() { System.out.println("美国对象打架"); } @Override protected void eatBreakfast() { System.out.println("美国队长吃三明治"); } @Override protected void dressUp() { System.out.println("美国队长带盾牌"); } }
[ "2734786712@qq.com" ]
2734786712@qq.com
140d51dcd9ed00e98560c8ce4548f2821940928e
14d1761194f628c945b4a5adf2c367ead50f3260
/search-core/src/main/java/pt/maisis/search/web/taglib/OrderTypeTag.java
19e6a315ab5c1a817c1d821ec6b7fe9ea10e0c0a
[ "Apache-2.0" ]
permissive
MaisisPt/search-framework
896d8d2064f9c02ce3970e1ee498689f9523ca1f
6197485a8445f0a5d7a2c59bd37aea846c398701
refs/heads/master
2021-01-18T05:59:20.576639
2016-02-01T17:25:20
2016-02-01T17:25:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,484
java
/* * %W% %E% Marco Amador * * Copyright (c) 1994-2011 Maisis - Information Systems. All Rights Reserved. * * This software is the confidential and proprietary information of Maisis * Information Systems, Lda. ("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 Maisis. * * MAISIS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. MAISIS SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ package pt.maisis.search.web.taglib; import pt.maisis.search.web.SearchForm; import javax.servlet.jsp.JspException; public class OrderTypeTag extends SearchBaseTag { /** Atributo que colocado no contexto da tag e que identifica o tipo de ordenacao seleccionado. */ public static final String ORDER = "order"; public int doStartTag() throws JspException { SearchForm form = getSearchForm(); if (form == null) { return SKIP_BODY; } int orderType = form.getOrderType(); setAttribute(ORDER, orderType); return EVAL_BODY_INCLUDE; } }
[ "marco.amador@maisis.pt" ]
marco.amador@maisis.pt
f2cdd20247dfe655239428b12007aa51f2808687
2c90356fea84150492d7c40bb38ede768ff2f58c
/lubinwidget/src/main/java/com/lubin/widget/tabbar/TabItemLayout.java
56d8946d3f958010fe230307dd8f21e5d2be8a5a
[]
no_license
robin-lk/LubinWidget
4b5cbabca59be137bdda7ed7f9937c67376c2fce
90fef9916bf1edb075506eda44f307b9f3a076da
refs/heads/master
2023-05-07T14:53:12.294810
2021-05-27T01:25:35
2021-05-27T01:25:35
153,973,905
0
0
null
null
null
null
UTF-8
Java
false
false
3,086
java
package com.lubin.widget.tabbar; import android.content.Context; import android.support.v4.content.ContextCompat; import android.util.AttributeSet; import android.view.Gravity; import android.view.LayoutInflater; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.lubin.widget.R; /** * @author lubin * @version 1.0 ·2018/10/10 */ public class TabItemLayout extends LinearLayout { private ImageView mIcon; private TextView mTxt; private TabItem mItem; private int position; private int tarbarWidth; private int tarbarHeight; private LinearLayout.LayoutParams params; public TabItemLayout(Context context) { super(context); initTabItemLayout(context); } public TabItemLayout(Context context, AttributeSet attrs) { super(context, attrs); initTabItemLayout(context); } public TabItemLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initTabItemLayout(context); } void initTabItemLayout(Context context) { setOrientation(VERTICAL); setGravity(Gravity.CENTER); LayoutInflater.from(context).inflate(R.layout.tabbar_item_layout, this, true); mIcon = findViewById(R.id.tat_icon); mTxt = findViewById(R.id.tab_txt); } public void initData(TabItem item) { this.mItem = item; if (item.getIcItem() == 0) { mIcon.setVisibility(GONE); } else { mIcon.setVisibility(VISIBLE); if (tarbarWidth > 0 && tarbarHeight > 0) { params = (LayoutParams) mIcon.getLayoutParams(); params.height = tarbarHeight; params.width = tarbarWidth; params.gravity = Gravity.CENTER; mIcon.setLayoutParams(params); } mIcon.setImageResource(item.getIcItem()); mIcon.setScaleType(ImageView.ScaleType.FIT_CENTER); } if (!getResources().getString(item.getTxtItem()).equals(getResources().getString(R.string.txt_null))) { mTxt.setText(item.getTxtItem()); mTxt.setTextSize(item.getTxtSize()); mTxt.setVisibility(VISIBLE); reTextColor(); } else { mTxt.setVisibility(GONE); } } public void reTextColor() { if (this.isSelected()) { mTxt.setTextColor(ContextCompat.getColor(getContext(), mItem.getTxtColor()[0])); } else { if (mItem.getTxtColor().length > 1) mTxt.setTextColor(ContextCompat.getColor(getContext(), mItem.getTxtColor()[1])); } } public int getPosition() { return position; } public void setPosition(int position) { this.position = position; } public ImageView getmIcon() { return mIcon; } public void setIconParams(int tarbarWidth, int tarbarHeight) { this.tarbarHeight = tarbarHeight; this.tarbarWidth = tarbarWidth; } }
[ "wang_junjie007@163.com" ]
wang_junjie007@163.com
113865508af986429e53c9068076aab00e181eab
671432a6ad5b6d2b8052e8fc0ed5b09bea57dcd9
/SimpleApp3/app/src/main/java/com/subziro/simpleapp3/ui/notifications/NotificationsViewModel.java
0fc19fdf355b4c6793f5bcf3ada56df5eb596757
[]
no_license
alp2003/TestJenkinsGit
4e4b1f9d8e1455d063cb2781ffc402080cca15d9
eca1557e65b5b46c7f30f76bb4b99b64587f0a64
refs/heads/master
2020-12-20T21:31:43.703473
2020-02-01T15:02:18
2020-02-01T15:02:18
236,215,120
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package com.subziro.simpleapp3.ui.notifications; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class NotificationsViewModel extends ViewModel { private MutableLiveData<String> mText; public NotificationsViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is notifications fragment"); } public LiveData<String> getText() { return mText; } }
[ "alp2003@gmail.com" ]
alp2003@gmail.com
f4cabcf32a87e5941da7888d6682d3e9bf9ecb94
d0bed323cd4e427a7b9eacb298fc8b0f9baa3baa
/launcher/src/main/java/com/launcher/concurrency/ObservableFuture.java
e757bda73f0bb8c895149c3296d169c1c0c537ff
[]
no_license
iocraft-org/IO-Launcher
3a973f19792e05a4b42dd8eff5cc0db948c01dfc
6c4b0a7109a5d49437a4ae37e811d44d159dbde4
refs/heads/master
2020-05-02T09:43:21.659302
2019-04-02T10:27:38
2019-04-02T10:27:38
177,879,018
0
1
null
null
null
null
UTF-8
Java
false
false
2,002
java
/* * IO-Launcher Launcher * Based off of sk89q's Source * https://www.iocraft.org */ package com.launcher.concurrency; import com.google.common.util.concurrent.ListenableFuture; import lombok.NonNull; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * A pair of ProgressObservable and ListenableFuture. * * @param <V> the result type */ public class ObservableFuture<V> implements ListenableFuture<V>, ProgressObservable { private final ListenableFuture<V> future; private final ProgressObservable observable; /** * Construct a new ObservableFuture. * * @param future the delegate future * @param observable the observable */ public ObservableFuture(@NonNull ListenableFuture<V> future, @NonNull ProgressObservable observable) { this.future = future; this.observable = observable; } @Override public boolean cancel(boolean mayInterruptIfRunning) { return future.cancel(mayInterruptIfRunning); } @Override public boolean isCancelled() { return future.isCancelled(); } @Override public void addListener(Runnable listener, Executor executor) { future.addListener(listener, executor); } @Override public boolean isDone() { return future.isDone(); } @Override public V get() throws InterruptedException, ExecutionException { return future.get(); } @Override public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return future.get(timeout, unit); } @Override public String toString() { return observable.toString(); } @Override public double getProgress() { return observable.getProgress(); } @Override public String getStatus() { return observable.getStatus(); } }
[ "io_craft@protonmail.com" ]
io_craft@protonmail.com
1d498fc112cf27c68533672ab43db45c3c1f62a6
6274a4f5fea37c57524f90d61bab79db779c58f3
/src/com/sforce/soap/enterprise/DescribeRelatedContentItem.java
caf79d8e57775e95993289592d0a0b14fa24513f
[]
no_license
khowling/sfdc-dice-point
6e59827977b5c3b29b76860e70dde5dd1e806d8f
889a48221063cb5e21e60ffe0132b8cd7417d378
refs/heads/master
2020-04-06T04:40:53.300757
2014-03-18T16:19:21
2014-03-18T16:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,121
java
package com.sforce.soap.enterprise; /** * Generated by ComplexTypeCodeGenerator.java. Please do not edit. */ public class DescribeRelatedContentItem implements com.sforce.ws.bind.XMLizable { /** * Constructor */ public DescribeRelatedContentItem() {} /** * element : describeLayoutItem of type {urn:enterprise.soap.sforce.com}DescribeLayoutItem * java type: com.sforce.soap.enterprise.DescribeLayoutItem */ private static final com.sforce.ws.bind.TypeInfo describeLayoutItem__typeInfo = new com.sforce.ws.bind.TypeInfo("urn:enterprise.soap.sforce.com","describeLayoutItem","urn:enterprise.soap.sforce.com","DescribeLayoutItem",1,1,true); private boolean describeLayoutItem__is_set = false; private com.sforce.soap.enterprise.DescribeLayoutItem describeLayoutItem; public com.sforce.soap.enterprise.DescribeLayoutItem getDescribeLayoutItem() { return describeLayoutItem; } public void setDescribeLayoutItem(com.sforce.soap.enterprise.DescribeLayoutItem describeLayoutItem) { this.describeLayoutItem = describeLayoutItem; describeLayoutItem__is_set = true; } /** */ @Override public void write(javax.xml.namespace.QName __element, com.sforce.ws.parser.XmlOutputStream __out, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException { __out.writeStartTag(__element.getNamespaceURI(), __element.getLocalPart()); writeFields(__out, __typeMapper); __out.writeEndTag(__element.getNamespaceURI(), __element.getLocalPart()); } protected void writeFields(com.sforce.ws.parser.XmlOutputStream __out, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException { __typeMapper.writeObject(__out, describeLayoutItem__typeInfo, describeLayoutItem, describeLayoutItem__is_set); } @Override public void load(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __typeMapper.consumeStartTag(__in); loadFields(__in, __typeMapper); __typeMapper.consumeEndTag(__in); } protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, describeLayoutItem__typeInfo)) { setDescribeLayoutItem((com.sforce.soap.enterprise.DescribeLayoutItem)__typeMapper.readObject(__in, describeLayoutItem__typeInfo, com.sforce.soap.enterprise.DescribeLayoutItem.class)); } } @Override public String toString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("[DescribeRelatedContentItem "); sb.append(" describeLayoutItem="); sb.append("'"+com.sforce.ws.util.Verbose.toString(describeLayoutItem)+"'\n"); sb.append("]\n"); return sb.toString(); } }
[ "khowling@gmail.com" ]
khowling@gmail.com
5c4049b227fca1764b1620dfebfcd5858429aee0
b0ae04f631f3488a61afaad96da7fecef7946529
/src/main/java/com/www/javapractice/concurrentprograming/executors/ScheduledThreadPoolDemo.java
4b5698656eda462f8f42315c9f10c23e2b2dacee
[]
no_license
yf6155/JavaPractice
1afaa70e349f6a67ef07f24b69430cad972ce600
e02a12edf69e90bb127b28b81c0f3ae041741ae6
refs/heads/master
2021-03-31T09:26:01.393029
2020-04-11T10:42:44
2020-04-11T10:42:44
248,096,728
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
package com.www.javapractice.concurrentprograming.executors; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; /** * <p>Application Name : ScheduledThreadPoolDemo </p> * <p>Application Description : </p> * <p>Company : WWW </p> * (C) Copyright WWW Corporation 2020 All Rights Reserved. * * @Author : HandsGoing * @Date : 2020.03.28 10:32 * @Version : v1.0 */ public class ScheduledThreadPoolDemo { public static void main(String[] args) { ScheduledExecutorService pool = Executors.newScheduledThreadPool(5); //创建线程 for (int i = 0; i < 10; i++) { //创建任务 Runnable task = new TaskDemo(); //把任务交给线程池 pool.execute(task); } } }
[ "yf6155@hotmail.com" ]
yf6155@hotmail.com
ce3b02ef487016e46909ebc8849ad2a01a09f2fe
e2bc5d889c94883facdea3d8bacc9aa4451c1c22
/springboot-security/src/main/java/com/gf/company/security/mapper/UserRoleResourceDao.java
661ea866091ca12513289b0b00ae3b2f1667ea80
[]
no_license
radish0416/spring
66601734ae9cdaa2cb656e4cde230cf0d123ab58
f04134200c5c01e4149a1e3c07a9ac3e1eae97fe
refs/heads/master
2023-08-11T15:19:07.527858
2020-01-17T09:23:13
2020-01-17T09:23:13
217,436,419
0
0
null
2023-07-22T19:43:54
2019-10-25T02:39:48
Java
UTF-8
Java
false
false
3,652
java
package com.gf.company.security.mapper; import com.gf.api.entity.RoleResourceInfo; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Component; import java.util.List; /** * @author Li Xianjiang * @version 1.0 * @Date Created in 2019/7/26 */ @Mapper @Component public interface UserRoleResourceDao { /** * 根据res code获取资源角色信息 * @params [resCode] * @return com.shule.springcloud.entities.security.RoleResourceInfo * @version 1.0 */ @Select("select * from t_role_resource where res_code = #{resCode} and app_type = #{appType}") RoleResourceInfo getRoleResourceInfo(String resCode, String appType); @Delete("delete from t_role_resource where app_type = #{appType}") int removeAllResource(String appType); @Insert("insert into t_role_resource (res_code,\n" + "res_type,\n" + "res_name,\n" + "res_value,\n" + "auth_code,\n" + "auth_name,\n" + "role_code,\n" + "role_name,\n" + "app_type,\n" + "create_time\n) values(#{res_code},\n" + "#{res_type},\n" + "#{res_name},\n" + "#{res_value},\n" + "#{auth_code},\n" + "#{auth_name},\n" + "#{role_code},\n" + "#{role_name},\n" + "#{app_type},\n" + "now()\n)") int insertRoleResource(RoleResourceInfo info); @Update("update t_role_resource set res_type = #{res_type},res_name = #{res_name},res_value = #{res_value}" + ",role_code = #{role_code},auth_code = #{auth_code},auth_name = #{auth_name}" + ",role_name = #{role_name} where res_code = #{res_code}") void updateRoleResource(RoleResourceInfo info); /** * 根据应用名称查询应用所有的角色列表 * * @return java.util.List<java.lang.String> * @params [] * @version 1.0 */ @Select("select distinct role_code from t_role_resource where app_type = #{appType}") List<String> getAllRoles(String appType); /** * 根据应用名称查询应用所有的角色资源列表 * * @return java.util.List<com.shule.springcloud.entities.security.RoleResourceInfo> * @params [appType] * @version 1.0 */ @Select("select * from t_role_resource where app_type = #{appType} limit 200") List<RoleResourceInfo> getAllResource(String appType); /** * 根据权限code获取资源列表 * @params [appType, roleCode] * @return java.util.List<com.shule.springcloud.entities.security.RoleResourceInfo> * @version 1.0 */ @Select("<script> select * from t_role_resource where app_type = #{appType} and auth_code in " + "<foreach collection=\"auths\" item=\"auth\" open=\"(\" close=\")\" separator=\",\">\n" + " #{auth}\n" + "</foreach></script> ") List<RoleResourceInfo> getResourcesByAuthCode(@Param("appType") String appType, @Param("auths") List<String> auths); /** * 根据用户ID获取角色列表 * @params [userID] * @return java.util.List<java.lang.String> * @version 1.0 */ @Select("select distinct role_code from t_role_dep_user where user_id = #{userID} and rec_sts = '0' ") List<String> getUserRoles(int userID); /** * 根据用户ID获取权限列表 * @params [userID] * @return java.util.List<java.lang.String> * @version 1.0 */ @Select("select auth_code from t_role_dep_user where user_id = #{userID} and rec_sts = '0' ") List<String> getUserAuths(int userID); }
[ "gingersl@163.com" ]
gingersl@163.com
46e1cd64a2a55a87646bcd0a1736cba9fe547275
b59fb34dbf7b8f98e3560143b95ca6494da1ec9f
/components/org.wso2.carbon.identity.oauth.uma.permission.service/src/main/java/org/wso2/carbon/identity/oauth/uma/permission/service/impl/PermissionServiceImpl.java
dc82d1f946cb3509626281b7af4d4c03c146c799
[ "Apache-2.0" ]
permissive
isuri97/identity-oauth-uma
7f8556668cec421a95c4110dd340b07dacaa1a22
05180879fc0d180fd433b9e21289b349d1c966e5
refs/heads/master
2021-04-30T15:20:28.052223
2018-04-09T10:25:41
2018-04-09T10:25:41
121,237,304
0
0
null
2018-02-12T11:14:54
2018-02-12T11:14:54
null
UTF-8
Java
false
false
2,477
java
/* * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.carbon.identity.oauth.uma.permission.service.impl; import org.wso2.carbon.identity.oauth.uma.permission.service.PermissionService; import org.wso2.carbon.identity.oauth.uma.permission.service.ReadPropertiesFile; import org.wso2.carbon.identity.oauth.uma.permission.service.dao.PermissionTicketDAO; import org.wso2.carbon.identity.oauth.uma.permission.service.exception.PermissionDAOException; import org.wso2.carbon.identity.oauth.uma.permission.service.exception.UMAResourceException; import org.wso2.carbon.identity.oauth.uma.permission.service.model.PermissionTicketModel; import org.wso2.carbon.identity.oauth.uma.permission.service.model.Resource; import java.util.Calendar; import java.util.List; import java.util.TimeZone; import java.util.UUID; /** * PermissionServiceImpl service is used for permission registration. */ public class PermissionServiceImpl implements PermissionService { private static final String UTC = "UTC"; @Override public PermissionTicketModel issuePermissionTicket(List<Resource> resourceList, int tenantId) throws UMAResourceException, PermissionDAOException { PermissionTicketModel permissionTicketModel = new PermissionTicketModel(); ReadPropertiesFile.readFileConfigValues(permissionTicketModel); //TODO: Make this an extension point. String ticketString = UUID.randomUUID().toString(); permissionTicketModel.setTicket(ticketString); permissionTicketModel.setCreatedTime(Calendar.getInstance(TimeZone.getTimeZone(UTC))); permissionTicketModel.setStatus("ACTIVE"); permissionTicketModel.setTenantId(tenantId); PermissionTicketDAO.persistPTandRequestedPermissions(resourceList, permissionTicketModel); return permissionTicketModel; } }
[ "dewni.matheesha@gmail.com" ]
dewni.matheesha@gmail.com
3e2ab3267c87be75018b628a0b351d114cd3d940
bfe6f1af8ff278f7a77931358cd8d6b0a94e2644
/src/main/java/com/tarena/service/impl/TradeServiceImpl.java
6dbb65b6740ddd4a941e238ad6fa29b7fd84591a
[]
no_license
huangguoguang/myDemo
45cc4a389a6fb50d4e4da9e2583de3487e73d5cd
b8471140d20799f8d5968cdc85e81f803bb8b2ba
refs/heads/master
2021-01-18T17:24:04.344189
2017-03-31T08:06:31
2017-03-31T08:06:31
86,793,563
0
0
null
null
null
null
UTF-8
Java
false
false
4,897
java
package com.tarena.service.impl; import java.text.ParseException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.aggregation.Aggregation; import org.springframework.data.mongodb.core.aggregation.AggregationResults; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSONArray; import com.tarena.common.component.session.SessionProvider; import com.tarena.entity.AggregationContent; import com.tarena.entity.UserInfo; import com.tarena.mongo.service.MongodbBaseDao; import com.tarena.service.ITradeService; import com.tarena.trade.utils.TradeUtil; import com.tarena.util.NumberUtil; import com.tarena.util.Pagination; @Service public class TradeServiceImpl implements ITradeService { @Autowired private MongoTemplate mongoTemplate; @Autowired private StringRedisTemplate redisTemplate; @SuppressWarnings("rawtypes") @Autowired private MongodbBaseDao<Map> mongodbBaseDao; @Override public Object queryUserLot(SessionProvider session) { UserInfo userInfo = (UserInfo) session.getAttribute(UserInfo.sessionKey); Aggregation agg = Aggregation.newAggregation( Aggregation.match(Criteria.where("user_id").is(userInfo.getUser_id()).and("confirm").ne("0")), Aggregation.group("trading_rule","buy_number","buy_type").sum("buy_amount").as("holder_lot")); AggregationResults<AggregationContent> resultLot = mongoTemplate.aggregate(agg, "TradeBuyOrderMongodb", AggregationContent.class); List<AggregationContent> listOne = resultLot.getMappedResults(); String listMutiSTR = redisTemplate.opsForValue().get("trade_volume"); JSONArray listMuti = (JSONArray) JSONArray.parse(listMutiSTR); Map<String, Object> reMap = new HashMap<String, Object>(); reMap.put("total", listMuti); reMap.put("holder", listOne); return reMap; } /* * * 用户订单总数量 */ @Override public Object totalOrder(SessionProvider session) { UserInfo userInfo = (UserInfo) session.getAttribute(UserInfo.sessionKey); return mongoTemplate.count(new Query(Criteria.where("user_id").is(userInfo.getUser_id()).and("confirm").ne("0")), "TradeBuyOrderMongodb"); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List<Map> queryBuyOrder(String user_id) { Query query = new Query(Criteria.where("user_id").is(user_id).and("confirm").ne("0").and("trading_rule").ne("04")); query.with(new Sort(Direction.DESC, "buy_time")); //建仓表 List<Map> orderList = mongoTemplate.find(query, Map.class, TradeUtil.Mongodb_Table_TradeBuyOrder); //止盈止损表 List<Map> spslList = mongoTemplate.find(query, Map.class,TradeUtil.Mongodb_Table_StopProfitStopLoss); //日期转换 for(Map orderMap:orderList){ if(orderMap.get("trading_rule").toString().equals("02")){ orderMap.put("now_date", new Date()); } } for(Map orderMap:orderList){ for(Map spslMap:spslList){ if(orderMap.get("order_id").equals(spslMap.get("order_id"))){ orderMap.put("zyzs_confirm", spslMap.get("confirm")); orderMap.put("sell_point", spslMap.get("sell_point")); } } } return orderList; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Pagination<Map> querySellOrder(String user_id, String firstDate, String lastDate, String column, int page, int pageSize, String collection) throws ParseException { Pagination<Map> sellOrder = mongodbBaseDao.queryOrder(user_id,firstDate,lastDate,column,page,pageSize,Map.class,collection); List<Map> list = sellOrder.getRows(); for(Map tradeSellOrderMongodb : list) { tradeSellOrderMongodb.put("sell_point", NumberUtil.fotmatNum((Double)tradeSellOrderMongodb.get("sell_point"), 3)); } return sellOrder; } @SuppressWarnings("rawtypes") @Override public List<Map> queryCrowdfundingBuyOrder(String user_id) throws ParseException { //查询建仓成功和建仓中的订单 Query query = new Query(); query.addCriteria(Criteria.where("user_id").is(user_id).and("confirm").ne("0").and("trading_rule").is("04")); query.with(new Sort(Direction.DESC, "buy_time")); return mongoTemplate.find(query, Map.class,TradeUtil.Mongodb_Table_TradeBuyOrder); } }
[ "huangguang@anchol.com" ]
huangguang@anchol.com
556703344e6695ea04335bdf42ad03d7051c3a25
44e2ada5b8e428f3074c6ddb078a59fe02f230b1
/book-MongoDB/src/web1/BorrowselectBybooknameServlet.java
4de7fa2af73e7cf5744d94cf5aa42fcbec900abe
[]
no_license
haishaoa/mybook-MongoDB
e33d7ea15e67511952987d318b46bf1a353767d8
58619619a315d39cf3657acf5c35214bf731e52c
refs/heads/master
2022-11-22T20:55:58.967948
2020-08-01T05:54:04
2020-08-01T05:54:04
284,193,669
0
0
null
null
null
null
UTF-8
Java
false
false
788
java
package web1; import pojo.Borrow; import pojo.Reader; import service.BorrowService; import service.impl.BorrowServiceImpl; import javax.servlet.ServletContext; 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 java.io.IOException; /** * @author haishao * @create 2020-05-20 11:44 * @discript : */ @WebServlet(name = "BorrowselectBybooknameServlet") public class BorrowselectBybooknameServlet extends HttpServlet { private BorrowService borrowService = new BorrowServiceImpl(); public Borrow selectByReadername(String readername){ return borrowService.selectByreadername(readername); } }
[ "haishaoa@foxmail.com" ]
haishaoa@foxmail.com
1095db6dc573f5e2f8da0b62f3a2f8ba3cb62415
1e4cc34adef98e5543492e750a1af5ea8257d38a
/app/src/main/java/com/example/admin/androidutils/net/DecodeConverterFactory.java
2df4768a1f90e628dc2af41ece557a43a6a61fe6
[]
no_license
HelloWmz/AndroidUtils
c72fc33183bab8665e676077ea337085a14ef3a5
72b59eb6bda08a7f0f69c6a5199a4456d42a9ed1
refs/heads/master
2023-02-19T05:00:03.323337
2021-01-19T03:54:00
2021-01-19T03:54:00
313,479,631
0
0
null
null
null
null
UTF-8
Java
false
false
1,446
java
package com.example.admin.androidutils.net; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.reflect.TypeToken; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.Converter; import retrofit2.Retrofit; /** * Created by Admin on 2018/6/22. */ public class DecodeConverterFactory extends Converter.Factory { public static DecodeConverterFactory create() { return create(new Gson()); } public static DecodeConverterFactory create(Gson gson) { return new DecodeConverterFactory(gson); } private final Gson gson; private DecodeConverterFactory(Gson gson) { if (gson == null) throw new NullPointerException("gson == null"); this.gson = gson; } //响应 @Override public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type)); return new DecodeResponseBodyConverter<>(adapter); } //请求 @Override public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type)); return new DecodeRequestBodyConverter<>(gson, adapter); } }
[ "1170155848@qq.com" ]
1170155848@qq.com
2bdf0c15d67f39a6adb340e603c433279aa37fc7
f6fbdce73add749bb8b9b63c6ebbfb4dfb3c1914
/hu.aronfabian.petrinet/src/petrinet/Box.java
5b195e476df0481c8d80e1d3b8a5a9d1fb8ebc64
[]
no_license
aronfabian/onlab_kodgen
c5b4ec057e131fbbf2d242bcedff352fe2bd36dd
af1cc3005e0e10b74f26125bcfd1c4169a5b6d37
refs/heads/master
2021-01-23T00:39:28.577491
2017-04-20T11:50:00
2017-04-20T11:50:00
85,753,026
0
0
null
null
null
null
UTF-8
Java
false
false
2,595
java
/** */ package petrinet; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Box</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link petrinet.Box#getId <em>Id</em>}</li> * <li>{@link petrinet.Box#getName <em>Name</em>}</li> * <li>{@link petrinet.Box#getPlace <em>Place</em>}</li> * </ul> * * @see petrinet.PetrinetPackage#getBox() * @model * @generated */ public interface Box extends EObject { /** * Returns the value of the '<em><b>Id</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Id</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Id</em>' attribute. * @see #setId(int) * @see petrinet.PetrinetPackage#getBox_Id() * @model * @generated */ int getId(); /** * Sets the value of the '{@link petrinet.Box#getId <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Id</em>' attribute. * @see #getId() * @generated */ void setId(int value); /** * Returns the value of the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Name</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Name</em>' attribute. * @see #setName(String) * @see petrinet.PetrinetPackage#getBox_Name() * @model * @generated */ String getName(); /** * Sets the value of the '{@link petrinet.Box#getName <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Name</em>' attribute. * @see #getName() * @generated */ void setName(String value); /** * Returns the value of the '<em><b>Place</b></em>' reference list. * The list contents are of type {@link petrinet.Place}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Place</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Place</em>' reference list. * @see petrinet.PetrinetPackage#getBox_Place() * @model * @generated */ EList<Place> getPlace(); } // Box
[ "aron.sajt@gmail.com" ]
aron.sajt@gmail.com
d88994b43cc640f3e15690deddc87f4e467e4e6d
8ce4211d72af07839b16281a32b7cab57d35af09
/Google ドライブ/java-practice/Encapsulation/src/academy/learnprograming/Main.java
5ea11d48fb868bd091e17eb1d58801224aba93f6
[]
no_license
yusuke-hub/Java-practice
6242ef2d619450edf0b476956c2fc64fce022d69
c0d6942b9b47c88ae17493873c05497b25413f0a
refs/heads/master
2022-11-24T09:55:17.792192
2020-07-28T08:33:50
2020-07-28T08:33:50
258,111,561
0
0
null
null
null
null
UTF-8
Java
false
false
711
java
package academy.learnprograming; public class Main { public static void main(String[] args) { // Player player = new Player(); // player.name = "Tim"; // player.health = 20; // player.weapon = "Sword"; // // int damage = 10; // player.loseHealth(damage); // System.out.println("Remaining health = " + player.healthRemaining()); // // damage = 11; // player.health = 200; // player.loseHealth(damage); // System.out.println("Remaining health = " + player.healthRemaining()); EnhancedPlayer player = new EnhancedPlayer("Tim", 50, "Sword"); System.out.println("Initial health is " + player.getHitPoints()); } }
[ "yk1210140408@gmail.com" ]
yk1210140408@gmail.com
a0a4d8793089cacf86e4db741c385b2bae7d7f5d
5730ee6290adf34325443b69dae8f0b78bf10084
/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/StateTrackingClassVisitor.java
270234ffe9f88ddd029db5ea28726932027e71f6
[ "MIT" ]
permissive
tlaiamz/scott
4ece4b8db007978718d7d039e2d79fbda602cddf
fa852f2ed8d652e93132ee2befd753130a4ca4a5
refs/heads/master
2023-08-25T05:47:19.700581
2021-09-29T20:06:52
2021-09-29T20:06:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,858
java
package hu.advancedweb.scott.instrumentation.transformation; import org.junit.Rule; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import hu.advancedweb.scott.instrumentation.transformation.param.InstrumentationActions; import hu.advancedweb.scott.runtime.ScottReportingRule; /** * Manitpulates the class through the appropriate MethodVisitors. * * @see ConstructorTransformerMethodVisitor * @see ScopeExtractorMethodVisitor * @see StateTrackingMethodVisitor * @author David Csakvari */ public class StateTrackingClassVisitor extends ClassVisitor { private String className; private InstrumentationActions instrumentationActions; public StateTrackingClassVisitor(ClassVisitor cv, InstrumentationActions instrumentationActions) { super(Opcodes.ASM9, cv); this.instrumentationActions = instrumentationActions; } @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, name, signature, superName, interfaces); } @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); if (name.equals("<init>")) { if (instrumentationActions.isJUnit4RuleInjectionRequired) { return new ConstructorTransformerMethodVisitor(methodVisitor, access, name, desc, signature, exceptions, className); } else { return methodVisitor; } } else if (instrumentationActions.isMethodTrackingRequired(name, desc, signature)) { StateTrackingMethodVisitor variableMutationEventEmitter = new StateTrackingMethodVisitor(methodVisitor, instrumentationActions, className, name, desc); return new ScopeExtractorMethodVisitor(variableMutationEventEmitter, access, name, desc, signature, exceptions); } else { return methodVisitor; } } @Override public void visitEnd() { if (instrumentationActions.isJUnit4RuleInjectionRequired) { FieldVisitor fv = super.visitField(Opcodes.ACC_PUBLIC, "scottReportingRule", Type.getDescriptor(ScottReportingRule.class), null, null); fv.visitAnnotation(Type.getDescriptor(Rule.class), true).visitEnd(); } if (instrumentationActions.isJUnit5ExtensionInjectionRequired) { AnnotationVisitor av0 = super.visitAnnotation("Lorg/junit/jupiter/api/extension/ExtendWith;", true); AnnotationVisitor av1 = av0.visitArray("value"); av1.visit(null, Type.getType("Lhu/advancedweb/scott/runtime/ScottJUnit5Extension;")); av1.visitEnd(); av0.visitEnd(); } super.visitEnd(); } }
[ "dodiehun@gmail.com" ]
dodiehun@gmail.com
e3893d7f3f8fe18df742ba23bd908d79da26e6b2
a0e4f155a7b594f78a56958bca2cadedced8ffcd
/sdk/src/main/java/org/zstack/sdk/UpdateVpcHaGroupResult.java
e79d2b7920894986b0157a15303249f8d4a9ae8d
[ "Apache-2.0" ]
permissive
zhao-qc/zstack
e67533eabbbabd5ae9118d256f560107f9331be0
b38cd2324e272d736f291c836f01966f412653fa
refs/heads/master
2020-08-14T15:03:52.102504
2019-10-14T03:51:12
2019-10-14T03:51:12
215,187,833
3
0
Apache-2.0
2019-10-15T02:27:17
2019-10-15T02:27:16
null
UTF-8
Java
false
false
341
java
package org.zstack.sdk; import org.zstack.sdk.VpcHaGroupInventory; public class UpdateVpcHaGroupResult { public VpcHaGroupInventory inventory; public void setInventory(VpcHaGroupInventory inventory) { this.inventory = inventory; } public VpcHaGroupInventory getInventory() { return this.inventory; } }
[ "shixin.ruan@zstack.io" ]
shixin.ruan@zstack.io
c2217356ec2c7119e80405bebc70029daf0dd692
e72e04ece46978b3b979647cadd0cc63ea7b1980
/033-device-resource-manager-microservice/src/main/java/com/accenture/avs/device/util/validation/JsonSchema.java
ede4fe3bfc3270e0bc08f29fda12e1573af2a852
[]
no_license
vinaymcu/service2
d2ab936d91a7fbd5ea7237890771b9864e77f63d
96ac6575a964dcfb914affdce8032ae09d31c6e2
refs/heads/master
2020-03-28T10:19:16.313085
2018-09-10T04:43:38
2018-09-10T04:43:38
148,100,062
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
/*************************************************************************** * Copyright (C) Accenture * * The reproduction, transmission or use of this document or its contents is not permitted without * prior express written consent of Accenture. Offenders will be liable for damages. All rights, * including but not limited to rights created by patent grant or registration of a utility model or * design, are reserved. * * Accenture reserves the right to modify technical specifications and features. * * Technical specifications and features are binding only insofar as they are specifically and * expressly agreed upon in a written contract. * **************************************************************************/ package com.accenture.avs.device.util.validation; /** * @author surendra.kumar * */ public enum JsonSchema { CREATEDEVICEMODEL("CreateDeviceModelRequest.json"), UPDATEDEVICEMODEL("UpdateDeviceModelRequest.json"), SUBSCRIBERS("Subscribers.json"), UPDATESUBSCRIBER("UpdateSubscriber.json"), DELETESUBSCRIBER("SubscriberDelete.json"), UPDATEGLOBALDATA("UpdateGlobalData.json"), CREATEDEVICE("CreateDeviceRequest.json"), SETUSER("SetUserRequest.json"), ASSIGNSTB("AssignSetTopBox.json"), UNASSIGNDEVICE("UnAssignDeviceRequest.json"), CREATEANDASSIGNSTB("CreateAndAssignSTB.json"), REGISTERDEVICE("RegisterDeviceRequest.json"), SETTOPBOXDELETE("SetTopBoxDelete.json"), UPDATEDEVICE("UpdateDeviceRequest.json"), CREATEVQEGROUPSDEFAULTATTRIBUTESREQUEST("CreateVQEGroupsDefaultAttributesRequest.json"), DEVICEPROPERTIES("SetDevicePropertiesRequest.json"), STBPORTMAPPINGS("STBPortMappings.json"), CREATEOVERRIDEVQEGROUPSCONDITIONS("CreateOverrideVQEGroupsConditionsRequest.json"), CREATEVQEGROUP("CreateVQEGroupsRequest.json"); /** * The schemaName. */ private String schemaName; /** * @return the schemaPath */ public String getFileName() { return schemaName; } /** * @param schemaPath */ private JsonSchema(String schemaPath) { this.schemaName = schemaPath; } /** * Fully qualified resource path start with public . * * @return String */ public static String getSchemaFolderPath() { return "/public/schema/devicemanager/"; } }
[ "vinaymcu@gmail.com" ]
vinaymcu@gmail.com
b34e09366c389bd89965c1c13524895bb787d452
7cddf98e4b5177c27ca74fc4466677419ce67cf5
/src/holagithub/HolaGitHub.java
50a85e6f0f514a8bbb4a5b6208b6c863f85cfe75
[]
no_license
adrivp7/HolaGitHub
a74a63236cf4c844a5dd9240407b7487bb3cf1ae
1d66c211225067e350dd4fa6c3c6086838a80c9f
refs/heads/master
2021-02-15T03:05:38.284972
2020-03-04T09:53:46
2020-03-04T09:53:46
244,857,958
0
0
null
null
null
null
UTF-8
Java
false
false
510
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 holagithub; /** * * @author daw1 */ public class HolaGitHub { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here System.out.println("Hola Mundo"); //COMENTARIO } }
[ "daw1@IS31WX21" ]
daw1@IS31WX21
ddf169b0bf835555035deea0098e48c06d4a3432
f05a0ac68e73c2d6f37b9e2fe89a58458bb9ffbb
/aspect/src/main/java/com/springboot/demo/aspect/AspectApplication.java
668468c977339685c944b761bd4250f988c974d8
[ "MIT" ]
permissive
idream68/spring-demo
a126cecc2bdae26042c7649649818b7d50c1f543
e5da6d8d266445c61cfe20f4ef7494ae5f0d400c
refs/heads/master
2023-06-26T08:44:31.190528
2021-07-23T06:42:22
2021-07-23T06:42:22
360,522,907
2
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.springboot.demo.aspect; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AspectApplication { public static void main(String[] args) { SpringApplication.run(AspectApplication.class, args); } }
[ "zjhan@abcft.com" ]
zjhan@abcft.com
fa4ed2f75e9f1235cda60bd4ca58974a8fd79066
99bd7f7ecfe5b92fe9d03d7c5e9228f54c006a05
/src/main/java/com/kim9fe/test4/domain/BoardDTO.java
53a95ad3675f6434ac0d7b7d3c40e5c1e3c944ed
[]
no_license
kim9fe/test4
0f412ec09ba2eff8b04d6f26582e953769c2c11f
7553fc17436227b7aab430e9013cdb39c019427d
refs/heads/master
2023-04-05T20:01:38.260687
2021-04-26T07:32:39
2021-04-26T07:32:39
361,642,266
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.kim9fe.test4.domain; import com.google.gson.Gson; import lombok.Getter; import lombok.Setter; @Setter @Getter public class BoardDTO { private long id; private String title; private String content; public String toString(){ return (new Gson()).toJson(this); } }
[ "kim9fe@gmail.com" ]
kim9fe@gmail.com
12424b4c9e2b0832dd500e9c2557113a5adaedb6
8a0405555549baf7452145ceb3822a04f1842f25
/Biblioteca/app/src/main/java/com/example/biblioteca/ListaLivros.java
94659fe53297389cf43a17a8a5db983d81dc6d77
[]
no_license
jessicabpetersen/ProjetoAndroid
4fe288c112aa3473a8e6ddff4eb858c253037578
62b7288cb1be91be82ae4bbb1f555a16634dc490
refs/heads/master
2020-10-02T03:59:52.882977
2019-12-31T13:41:49
2019-12-31T13:41:49
227,695,255
0
0
null
null
null
null
UTF-8
Java
false
false
4,007
java
package com.example.biblioteca; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.view.Menu; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.ArrayList; import static com.example.biblioteca.Database.COL_TITULO; import static com.example.biblioteca.Database.TABLE_ADICIONAR; public class ListaLivros extends AppCompatActivity implements BookEventListener { private RecyclerView recyclerView; private ArrayList<Livro> lista; private LivroAdapter adapter; private Database dao; private FloatingActionButton floatingActionButton; @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu1, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menuOne: startActivity(new Intent(ListaLivros.this, Pesquisa.class)); return true; case R.id.menuTwo: startActivity(new Intent(ListaLivros.this, MainActivity.class)); return true; default: return super.onOptionsItemSelected(item); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_lista_livros); dao = new Database(this); recyclerView = findViewById(R.id.lista_livros); recyclerView.setLayoutManager(new LinearLayoutManager(this)); floatingActionButton = (FloatingActionButton) findViewById(R.id.floatingactionbutton); floatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onAddBook(); } }); } private void onAddBook() { startActivity(new Intent(ListaLivros.this,AdicionarLivro.class)); } @Override protected void onResume() { super.onResume(); onLoadBooks(); } private void onLoadBooks(){ this.lista = new ArrayList<>(); try { Cursor cursor = dao.getBook("Select * from " + TABLE_ADICIONAR+" order by +"+COL_TITULO + " asc"); if (cursor.getCount() > 0) { cursor.moveToFirst(); do { Livro livro = new Livro(); livro.setId(cursor.getInt(0)); livro.setTitulo(cursor.getString(1)); livro.setAutor(cursor.getString(2)); livro.setEditora(cursor.getString(3)); livro.setAno(cursor.getString(4)); livro.setImagem(cursor.getBlob(5)); livro.setQuantidadeTotal(cursor.getInt(6)); livro.setQuantidadeDisponivel(cursor.getInt(7)); livro.setLocalizacao(cursor.getString(8)); this.lista.add(livro); } while (cursor.moveToNext()); } }catch (NullPointerException e){ } this.adapter = new LivroAdapter(this, this.lista); this.adapter.setListener(this); this.recyclerView.setAdapter(adapter); } @Override public void onBookClick(Livro livro) { Intent detalheLivro = new Intent(this, DetalhesLivro.class); detalheLivro.putExtra("titulo", livro.getTitulo().toString()); detalheLivro.putExtra("autor", livro.getAutor().toString()); detalheLivro.putExtra("ano", livro.getAno().toString()); detalheLivro.putExtra("editora", livro.getEditora().toString()); startActivity(detalheLivro); } }
[ "jessica041ster@gmail.com" ]
jessica041ster@gmail.com
0189632762fb53fad78716aa3039fb03ef2a3ee8
4120c6e5dfef7aa4a877568889a2879697741084
/src/br/com/planta/controller/ReportController.java
035393f06193b8a41a14eeec309d8b3b0abc55b8
[]
no_license
fernandoantoniodantas/Projeto_aula_web
6afc1fcdf38e0059ed8d0661c60d147a9ce8e564
c915b56b05b84478c86f08a960bf79f4c4c6f74d
refs/heads/master
2020-03-31T09:38:11.245678
2018-10-17T11:37:53
2018-10-17T11:37:53
152,104,159
1
0
null
2018-10-09T15:16:13
2018-10-08T15:34:47
Java
UTF-8
Java
false
false
3,736
java
package br.com.planta.controller; import java.io.IOException; import java.io.InputStream; import java.io.Serializable; import java.sql.Connection; import java.sql.SQLException; import java.text.ParseException; import java.util.HashMap; import java.util.Map; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.servlet.ServletContext; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperRunManager; import org.primefaces.component.api.UIData; import br.com.planta.factory.ConnectionFactory; import br.com.planta.model.Planta; @ManagedBean @ViewScoped public class ReportController implements Serializable{ private Planta Dados = new Planta(); private UIData linhalistagem; public ReportController() {} public void gerarRelatorioPlantas(ActionEvent action) throws IOException, ParseException { //String caminho = "WEB-INF/relatorios/plantan.jasper"; //Map map = new HashMap(); //map.put("BRASAO", this.getServleContext().getRealPath("/WEB-INF/relatorios/brasao_novo.png")); //map.put("SUBREPORT_DIR", this.getServleContext().getRealPath(caminho) + File.separator); //this.executeReport(caminho, map, "WEB-INF/relatorios/"); String caminho = "/WEB-INF/Relatorios/"; String relatorio = caminho + "plantan.jasper"; this.Dados = (Planta) linhalistagem.getRowData(); // Integer matricula = Dados.getMatricula(); Map map = new HashMap(); // map.put("mat", matricula); // map.put("brasao", // this.getServleContext().getRealPath( // "/WEB-INF/Relatorios/brasao.jpg")); // map.put("SUBREPORT_DIR", this.getServleContext().getRealPath(caminho) // + File.separator); this.executeReport(relatorio, map, "plantan.pdf"); } private void executeReport(String relatorio, Map map, String filename) throws IOException, ParseException { FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); InputStream reportStream = context.getExternalContext().getResourceAsStream(relatorio); response.setContentType("application/pdf"); response.setHeader("Content-disposition", "attachment;filename=" + filename); ServletOutputStream servletOutputStream = response.getOutputStream(); Connection conexao = null; try { conexao = ConnectionFactory.getConnection(); JasperRunManager.runReportToPdfStream(reportStream, response.getOutputStream(), map, conexao); conexao.close(); } catch(JRException | SQLException ex) { throw new RuntimeException(ex); } this.getFacesContext().responseComplete(); servletOutputStream.flush(); servletOutputStream.close(); } private FacesContext getFacesContext() { FacesContext context = FacesContext.getCurrentInstance(); return context; } private ServletContext getServleContext() { ServletContext scontext = (ServletContext) this.getFacesContext() .getExternalContext().getContext(); return scontext; } public Planta getDados() { return Dados; } public void setDados(Planta dados) { Dados = dados; } public UIData getLinhalistagem() { return linhalistagem; } public void setLinhalistagem(UIData linhalistagem) { this.linhalistagem = linhalistagem; } }
[ "fernando@DESKTOP-808O1U6" ]
fernando@DESKTOP-808O1U6
8f8475cb35155ec88be8623ac6018804681b5cf0
5e3f004fdfec54df1295e5cf6a21cf0897764952
/src/main/java/org/glite/authz/pep/pip/provider/authnprofilespip/AuthenticationProfilePolicySetImpl.java
33e353feaab5c662d751b38608c931c2ed07f5f9
[]
no_license
argus-authz/argus-pep-server
ad44750ee6f67f0dd4a202faf0f940c966c76cfb
0a8a04e0168b26c6fdb7e7b3e6ecf27939c44e2d
refs/heads/develop
2023-07-20T22:32:51.292622
2022-09-20T15:01:26
2022-09-20T15:01:26
4,432,539
1
2
null
2023-06-14T22:53:56
2012-05-24T12:30:38
Java
UTF-8
Java
false
false
2,712
java
/* * Copyright (c) Members of the EGEE Collaboration. 2006-2010. * See http://www.eu-egee.org/partners/ for details on the copyright holders. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.glite.authz.pep.pip.provider.authnprofilespip; import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; public class AuthenticationProfilePolicySetImpl implements AuthenticationProfilePolicySet { private final Map<String, AuthenticationProfilePolicy> voProfilePolicies; private final AuthenticationProfilePolicy anyVoProfilePolicy; private final AuthenticationProfilePolicy anyCertificateProfilePolicy; private AuthenticationProfilePolicySetImpl(Builder builder) { voProfilePolicies = builder.voProfilePolicies; anyVoProfilePolicy = builder.anyVoProfilePolicy; anyCertificateProfilePolicy = builder.anyCertificateProfilePolicy; } @Override public Map<String, AuthenticationProfilePolicy> getVoProfilePolicies() { return voProfilePolicies; } @Override public Optional<AuthenticationProfilePolicy> getAnyVoProfilePolicy() { return Optional.ofNullable(anyVoProfilePolicy); } @Override public Optional<AuthenticationProfilePolicy> getAnyCertificateProfilePolicy() { return Optional.ofNullable(anyCertificateProfilePolicy); } public static class Builder { private Map<String, AuthenticationProfilePolicy> voProfilePolicies; private AuthenticationProfilePolicy anyVoProfilePolicy; private AuthenticationProfilePolicy anyCertificateProfilePolicy; public Builder() { voProfilePolicies = new LinkedHashMap<>(); } public Builder addVoPolicy(String voName, AuthenticationProfilePolicy policy) { voProfilePolicies.put(voName, policy); return this; } public Builder anyVoPolicy(AuthenticationProfilePolicy policy) { this.anyVoProfilePolicy = policy; return this; } public Builder anyCertificatePolicy(AuthenticationProfilePolicy policy) { this.anyCertificateProfilePolicy = policy; return this; } public AuthenticationProfilePolicySet build() { return new AuthenticationProfilePolicySetImpl(this); } } }
[ "andrea.ceccanti@gmail.com" ]
andrea.ceccanti@gmail.com
d936373060f7a409a4f1f763fcb51a7cac5d39a9
d690c48500072fff184f1ce39e6c9feb7605a4fa
/core/src/com/perevodchik/forest/entity/ai/AIFollow.java
43aed29136bab0ffed148cdbc27bb29284f72c6e
[]
no_license
perevodchik/forest_game
547bb94d21d4aae0c5efcc2e0399f6533b51c995
198b96ebdb569bb1c2aef54e352bd7c4f31c5976
refs/heads/master
2022-12-10T02:57:08.825022
2020-09-03T18:29:12
2020-09-03T18:29:12
257,358,630
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
package com.perevodchik.forest.entity.ai; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.math.Vector2; import com.perevodchik.forest.entity.EntityMob; import com.perevodchik.forest.entity.Player; import com.perevodchik.forest.utils.Vector; public class AIFollow implements AI { private EntityMob mob; private long tick = 0; public AIFollow(EntityMob mob) { this.mob = mob; } @Override public boolean execute() { Vector2 direction = new Vector2(Player.getPlayer().getBody().getPosition().x, Player.getPlayer().getBody().getPosition().y); direction.sub(mob.getBody().getPosition()); direction.nor(); float speed = mob.getSpeed(); mob.setVelocity(direction.scl(speed)); return true; } @Override public boolean update() { tick++; boolean result = execute(); if(tick % 10 == 0) { mob.setAi(getNewAI()); } return result; } @Override public int getCurrentSteep() { return 0; } @Override public boolean canContinue() { return Vector.distance(Player.getPlayer().getBody().getPosition(), mob.getBody().getPosition()) < 10; } @Override public AI getNewAI() { double distance = Vector.distance(Player.getPlayer().getBody().getPosition(), mob.getBody().getPosition()); if(distance >= 10) return new AIStayUp(mob); else if(distance <= mob.getAttackRange() && !mob.isAttack()) return new AIAttack(mob); return this; } }
[ "Parol547" ]
Parol547
d0bc7fa7d03201bd01f3cc74d6232cba1e4d4204
71e7f993f1fd6e0703b0d761f86a48e82b4a8fbf
/src/main/java/com/perfectchina/bns/model/treenode/TreeNode.java
ba87f3066decb416e8a6a8d0e4ccbd12f0335324
[]
no_license
kobejames88/prs
656eb342b3239587bca5e10573028def893bda16
978c57ae82cf9a06f20b0fcde48b4dcb2c0680f9
refs/heads/master
2020-03-28T16:00:32.237828
2018-09-11T18:00:54
2018-09-11T18:00:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,087
java
package com.perfectchina.bns.model.treenode; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.*; import com.fasterxml.jackson.annotation.JsonIgnore; import com.perfectchina.bns.model.Account; @Entity @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) public abstract class TreeNode implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String snapshotDate; // yyyyMM private long uplinkId; private Integer levelNum; private Boolean hasChild; // separate structure and business data @OneToOne private Account data; @OneToMany(mappedBy = "uplinkId") @JsonIgnore List<TreeNode> childNodes = new ArrayList<TreeNode>(0); public List<TreeNode> getChildNodes() { return childNodes; } public String getSnapshotDate() { return snapshotDate; } public void setSnapshotDate(String snapshotDate) { this.snapshotDate = snapshotDate; } public Integer getLevelNum() { return this.levelNum; } public void setLevelNum(Integer levelNum) { this.levelNum = levelNum; } public Boolean getHasChild() { return this.hasChild; } public void setHasChild(Boolean hasChild) { this.hasChild = hasChild; } public long getUplinkId() { return uplinkId; } public void setUplinkId(long uplinkId) { this.uplinkId = uplinkId; } public long getId() { return id; } public void setId(long id) { this.id = id; } public Account getData() { return data; } public void setData(Account data) { this.data = data; } public void setChildNodes(List<TreeNode> childNodes) { this.childNodes = childNodes; } @Override public String toString() { return "TreeNode [id=" + id + ", snapshotDate=" + snapshotDate + ", uplinkId=" + uplinkId + ", levelNum=" + levelNum + ", hasChild=" + hasChild + ", data=" + data + ", childNodes=" + childNodes + "]"; } }
[ "903626784@qq.com" ]
903626784@qq.com
c47a406d4776bf62a8515a1fa7456b2ace45f574
7986a12fa6b54f0f1c9efa907b9d37fa43f55786
/src/main/java/com/codecool/dungeoncrawl/dao/InventoryDao.java
e625c07e0fdf260b449b148235fcd45a93c9397e
[]
no_license
MateuszRosiek/roguelike
f8656db12e9f66e87a1411396f8c6205a188c8a8
1260900c098611411e9a68d3fe8e8f9956c0417f
refs/heads/main
2023-04-26T07:22:00.464689
2021-05-31T19:18:11
2021-05-31T19:18:11
372,606,537
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package com.codecool.dungeoncrawl.dao; import com.codecool.dungeoncrawl.model.InventoryModel; import java.util.List; public interface InventoryDao { void add(InventoryModel inventory, String hero_name); void update(InventoryModel inventory); InventoryModel get(String hero_name); List<InventoryModel> getAll(); }
[ "65808074+MateuszRosiek@users.noreply.github.com" ]
65808074+MateuszRosiek@users.noreply.github.com
de8237c8f69d62dcafeba32b5063342751794389
cb762d4b0f0ea986d339759ba23327a5b6b67f64
/src/dao/com/joymain/jecs/bd/model/JbdManualCon.java
bc0d4025bba50b5f80df96620ce6be94177a4854
[ "Apache-2.0" ]
permissive
lshowbiz/agnt_ht
c7d68c72a1d5fa7cd0e424eabb9159d3552fe9dc
fd549de35cb12a2e3db1cd9750caf9ce6e93e057
refs/heads/master
2020-08-04T14:24:26.570794
2019-10-02T03:04:13
2019-10-02T03:04:13
212,160,437
0
0
null
null
null
null
UTF-8
Java
false
false
7,346
java
package com.joymain.jecs.bd.model; // Generated 2013-11-26 15:39:19 by Hibernate Tools 3.1.0.beta4 import java.util.Date; /** * @struts.form include-all="true" extends="BaseForm" * @hibernate.class * table="JBD_MANUAL_CON" * */ public class JbdManualCon extends com.joymain.jecs.model.BaseObject implements java.io.Serializable { // Fields private Long id; private String userCode; private Integer startWeek; private Integer endWeek; private Integer salesStatus; private Integer consumerStatus; private String createNo; private Date createTime; // Constructors /** default constructor */ public JbdManualCon() { } /** full constructor */ public JbdManualCon(String userCode, Integer startWeek, Integer endWeek, Integer salesStatus, Integer consumerStatus, String createNo, Date createTime) { this.userCode = userCode; this.startWeek = startWeek; this.endWeek = endWeek; this.salesStatus = salesStatus; this.consumerStatus = consumerStatus; this.createNo = createNo; this.createTime = createTime; } // Property accessors /** * * @hibernate.id * generator-class="sequence" * type="java.lang.Long" * column="ID" *@hibernate.generator-param name="sequence" value="SEQ_BD" * */ public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } /** * * @hibernate.property * column="USER_CODE" * length="50" * */ public String getUserCode() { return this.userCode; } public void setUserCode(String userCode) { this.userCode = userCode; } /** * * @hibernate.property * column="START_WEEK" * length="22" * */ public Integer getStartWeek() { return this.startWeek; } public void setStartWeek(Integer startWeek) { this.startWeek = startWeek; } /** * * @hibernate.property * column="END_WEEK" * length="22" * */ public Integer getEndWeek() { return this.endWeek; } public void setEndWeek(Integer endWeek) { this.endWeek = endWeek; } /** * * @hibernate.property * column="SALES_STATUS" * length="22" * */ public Integer getSalesStatus() { return this.salesStatus; } public void setSalesStatus(Integer salesStatus) { this.salesStatus = salesStatus; } /** * * @hibernate.property * column="CONSUMER_STATUS" * length="22" * */ public Integer getConsumerStatus() { return this.consumerStatus; } public void setConsumerStatus(Integer consumerStatus) { this.consumerStatus = consumerStatus; } /** * * @hibernate.property * column="CREATE_NO" * length="20" * */ public String getCreateNo() { return this.createNo; } public void setCreateNo(String createNo) { this.createNo = createNo; } /** * * @hibernate.property * column="CREATE_TIME" * length="7" * */ public Date getCreateTime() { return this.createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } /** * toString * @return String */ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); buffer.append("userCode").append("='").append(getUserCode()).append("' "); buffer.append("startWeek").append("='").append(getStartWeek()).append("' "); buffer.append("endWeek").append("='").append(getEndWeek()).append("' "); buffer.append("salesStatus").append("='").append(getSalesStatus()).append("' "); buffer.append("consumerStatus").append("='").append(getConsumerStatus()).append("' "); buffer.append("createNo").append("='").append(getCreateNo()).append("' "); buffer.append("createTime").append("='").append(getCreateTime()).append("' "); buffer.append("]"); return buffer.toString(); } public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof JbdManualCon) ) return false; JbdManualCon castOther = ( JbdManualCon ) other; return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) ) && ( (this.getUserCode()==castOther.getUserCode()) || ( this.getUserCode()!=null && castOther.getUserCode()!=null && this.getUserCode().equals(castOther.getUserCode()) ) ) && ( (this.getStartWeek()==castOther.getStartWeek()) || ( this.getStartWeek()!=null && castOther.getStartWeek()!=null && this.getStartWeek().equals(castOther.getStartWeek()) ) ) && ( (this.getEndWeek()==castOther.getEndWeek()) || ( this.getEndWeek()!=null && castOther.getEndWeek()!=null && this.getEndWeek().equals(castOther.getEndWeek()) ) ) && ( (this.getSalesStatus()==castOther.getSalesStatus()) || ( this.getSalesStatus()!=null && castOther.getSalesStatus()!=null && this.getSalesStatus().equals(castOther.getSalesStatus()) ) ) && ( (this.getConsumerStatus()==castOther.getConsumerStatus()) || ( this.getConsumerStatus()!=null && castOther.getConsumerStatus()!=null && this.getConsumerStatus().equals(castOther.getConsumerStatus()) ) ) && ( (this.getCreateNo()==castOther.getCreateNo()) || ( this.getCreateNo()!=null && castOther.getCreateNo()!=null && this.getCreateNo().equals(castOther.getCreateNo()) ) ) && ( (this.getCreateTime()==castOther.getCreateTime()) || ( this.getCreateTime()!=null && castOther.getCreateTime()!=null && this.getCreateTime().equals(castOther.getCreateTime()) ) ); } public int hashCode() { int result = 17; result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() ); result = 37 * result + ( getUserCode() == null ? 0 : this.getUserCode().hashCode() ); result = 37 * result + ( getStartWeek() == null ? 0 : this.getStartWeek().hashCode() ); result = 37 * result + ( getEndWeek() == null ? 0 : this.getEndWeek().hashCode() ); result = 37 * result + ( getSalesStatus() == null ? 0 : this.getSalesStatus().hashCode() ); result = 37 * result + ( getConsumerStatus() == null ? 0 : this.getConsumerStatus().hashCode() ); result = 37 * result + ( getCreateNo() == null ? 0 : this.getCreateNo().hashCode() ); result = 37 * result + ( getCreateTime() == null ? 0 : this.getCreateTime().hashCode() ); return result; } }
[ "727736571@qq.com" ]
727736571@qq.com
427b3a37929bc6793d25ac35bdfaf6d375bfb295
e9bfb4b252881a75062abae495e2fbf32dfb51c0
/etheder-api/src/test/java/se/webinfostudio/game/etheder/api/transformer/player/CityTransformerTest.java
b344672bcfda9401729b0ae15503996e5214725f
[ "MIT" ]
permissive
johan-hanson/etheder
e96d79a43ab4ae59252c64b9a8b817d4884802be
8d2537950bf535a0215cbfada99588a40c765fde
refs/heads/master
2023-08-19T11:16:11.568628
2023-08-15T14:58:29
2023-08-15T14:58:29
175,295,902
0
0
MIT
2023-08-15T14:58:31
2019-03-12T21:03:04
Java
UTF-8
Java
false
false
1,474
java
package se.webinfostudio.game.etheder.api.transformer.player; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.MockitoAnnotations.initMocks; import static se.webinfostudio.game.etheder.util.ModelTestFactory.createCityModel; import static se.webinfostudio.game.etheder.util.ModelTestFactory.createCityModelNew; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import se.webinfostudio.game.etheder.api.model.player.CityModel; import se.webinfostudio.game.etheder.entity.player.City; /** * * @author Johan Hanson * */ public class CityTransformerTest { @InjectMocks private CityTransformer sut; @Test void apply() { final CityModel cityModel = createCityModel(); final City result = sut.apply(cityModel); assertThat(result.getId().toString()).isEqualTo(cityModel.getCityId()); assertThat(result.getName()).isEqualTo(cityModel.getName()); assertThat(result.getPlayer().getId().toString()).isEqualTo(cityModel.getPlayerId()); } @Test void apply_withNoId() { final CityModel cityModel = createCityModelNew(); final City result = sut.apply(cityModel); assertThat(result.getId()).isNotNull(); assertThat(result.getName()).isEqualTo(cityModel.getName()); assertThat(result.getPlayer().getId().toString()).isEqualTo(cityModel.getPlayerId()); } @BeforeEach void setup() { initMocks(this); } }
[ "johan.b.hansson@husqvarnagroup.com" ]
johan.b.hansson@husqvarnagroup.com
ffbae4bf2b97e4e892d1d04998a4d64c88f97add
0f757c7e4d848354d84e803fb30714dc969dd53c
/ref/src/State/A4/State.java
901a59d27a69164a1dde6956e26d6671c9e60157
[]
no_license
FoxerLee/Design-Pattern
401cd5572c1deab04c02238b3d222e910dbac72b
e40f212bed33f27d5f27d821c5a44028ae4fcb57
refs/heads/master
2021-05-15T23:07:19.391958
2017-11-01T05:29:08
2017-11-01T05:29:08
106,888,369
4
5
null
2017-10-30T04:46:17
2017-10-14T01:32:10
Java
EUC-JP
Java
false
false
347
java
public interface State { public abstract void doClock(Context context, int hour); // 時刻設定 public abstract void doUse(Context context); // 金庫使用 public abstract void doAlarm(Context context); // 非常ベル public abstract void doPhone(Context context); // 通常通話 }
[ "foxerlee1@gmail.com" ]
foxerlee1@gmail.com
2c0ec6d0fbdebc2e17e798892acac0d67fb4b937
fc4b97f436c2bbf2cd6ac832ba17bb09b87ad385
/Doannhom/ver_3/DoAnNhom/app/build/generated/source/r/debug/android/support/fragment/R.java
86d9b184e954794a7bcc4302ac8603e2ee23abe1
[]
no_license
laptrinhdidong2/Nhom-3
6cc5e2f6d59e828ff5f24d234c24c4d7e269533f
fc85581ad55489f4600154890c71b6e67f7cdbe5
refs/heads/master
2020-04-23T13:39:01.306620
2019-06-25T05:16:36
2019-06-25T05:16:36
171,204,203
1
1
null
null
null
null
UTF-8
Java
false
false
12,112
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 android.support.fragment; public final class R { public static final class attr { public static final int alpha = 0x7f030027; public static final int coordinatorLayoutStyle = 0x7f0300a4; public static final int font = 0x7f0300d7; public static final int fontProviderAuthority = 0x7f0300d9; public static final int fontProviderCerts = 0x7f0300da; public static final int fontProviderFetchStrategy = 0x7f0300db; public static final int fontProviderFetchTimeout = 0x7f0300dc; public static final int fontProviderPackage = 0x7f0300dd; public static final int fontProviderQuery = 0x7f0300de; public static final int fontStyle = 0x7f0300df; public static final int fontVariationSettings = 0x7f0300e0; public static final int fontWeight = 0x7f0300e1; public static final int keylines = 0x7f03010d; public static final int layout_anchor = 0x7f030112; public static final int layout_anchorGravity = 0x7f030113; public static final int layout_behavior = 0x7f030114; public static final int layout_dodgeInsetEdges = 0x7f030140; public static final int layout_insetEdge = 0x7f030149; public static final int layout_keyline = 0x7f03014a; public static final int statusBarBackground = 0x7f0301a6; public static final int ttcIndex = 0x7f030208; } public static final class color { public static final int notification_action_color_filter = 0x7f050072; public static final int notification_icon_bg_color = 0x7f050073; public static final int ripple_material_light = 0x7f05007d; public static final int secondary_text_default_material_light = 0x7f05007f; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f060051; public static final int compat_button_inset_vertical_material = 0x7f060052; public static final int compat_button_padding_horizontal_material = 0x7f060053; public static final int compat_button_padding_vertical_material = 0x7f060054; public static final int compat_control_corner_material = 0x7f060055; public static final int compat_notification_large_icon_max_height = 0x7f060056; public static final int compat_notification_large_icon_max_width = 0x7f060057; public static final int notification_action_icon_size = 0x7f0600cd; public static final int notification_action_text_size = 0x7f0600ce; public static final int notification_big_circle_margin = 0x7f0600cf; public static final int notification_content_margin_start = 0x7f0600d0; public static final int notification_large_icon_height = 0x7f0600d1; public static final int notification_large_icon_width = 0x7f0600d2; public static final int notification_main_column_padding_top = 0x7f0600d3; public static final int notification_media_narrow_margin = 0x7f0600d4; public static final int notification_right_icon_size = 0x7f0600d5; public static final int notification_right_side_padding_top = 0x7f0600d6; public static final int notification_small_icon_background_padding = 0x7f0600d7; public static final int notification_small_icon_size_as_large = 0x7f0600d8; public static final int notification_subtext_size = 0x7f0600d9; public static final int notification_top_pad = 0x7f0600da; public static final int notification_top_pad_large_text = 0x7f0600db; } public static final class drawable { public static final int notification_action_background = 0x7f070089; public static final int notification_bg = 0x7f07008a; public static final int notification_bg_low = 0x7f07008b; public static final int notification_bg_low_normal = 0x7f07008c; public static final int notification_bg_low_pressed = 0x7f07008d; public static final int notification_bg_normal = 0x7f07008e; public static final int notification_bg_normal_pressed = 0x7f07008f; public static final int notification_icon_background = 0x7f070090; public static final int notification_template_icon_bg = 0x7f070091; public static final int notification_template_icon_low_bg = 0x7f070092; public static final int notification_tile_bg = 0x7f070093; public static final int notify_panel_notification_icon_bg = 0x7f070094; } public static final class id { public static final int action_container = 0x7f08000d; public static final int action_divider = 0x7f08000f; public static final int action_image = 0x7f080010; public static final int action_text = 0x7f080016; public static final int actions = 0x7f080017; public static final int async = 0x7f08001d; public static final int blocking = 0x7f080021; public static final int bottom = 0x7f080022; public static final int chronometer = 0x7f080034; public static final int end = 0x7f08004a; public static final int forever = 0x7f080055; public static final int icon = 0x7f08005f; public static final int icon_group = 0x7f080060; public static final int info = 0x7f080063; public static final int italic = 0x7f080065; public static final int left = 0x7f080078; public static final int line1 = 0x7f080079; public static final int line3 = 0x7f08007a; public static final int none = 0x7f080090; public static final int normal = 0x7f080091; public static final int notification_background = 0x7f080092; public static final int notification_main_column = 0x7f080093; public static final int notification_main_column_container = 0x7f080094; public static final int right = 0x7f0800a2; public static final int right_icon = 0x7f0800a3; public static final int right_side = 0x7f0800a4; public static final int start = 0x7f0800cc; public static final int tag_transition_group = 0x7f0800d1; public static final int tag_unhandled_key_event_manager = 0x7f0800d2; public static final int tag_unhandled_key_listeners = 0x7f0800d3; public static final int text = 0x7f0800d4; public static final int text2 = 0x7f0800d5; public static final int time = 0x7f0800dd; public static final int title = 0x7f0800de; public static final int top = 0x7f0800e1; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f09000e; } public static final class layout { public static final int notification_action = 0x7f0b003a; public static final int notification_action_tombstone = 0x7f0b003b; public static final int notification_template_custom_big = 0x7f0b003c; public static final int notification_template_icon_group = 0x7f0b003d; public static final int notification_template_part_chronometer = 0x7f0b003e; public static final int notification_template_part_time = 0x7f0b003f; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0e003e; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0f0115; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0116; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0117; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0118; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0119; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01bf; public static final int Widget_Compat_NotificationActionText = 0x7f0f01c0; public static final int Widget_Support_CoordinatorLayout = 0x7f0f01ef; } public static final class styleable { public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f030027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] CoordinatorLayout = { 0x7f03010d, 0x7f0301a6 }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x010100b3, 0x7f030112, 0x7f030113, 0x7f030114, 0x7f030140, 0x7f030149, 0x7f03014a }; public static final int CoordinatorLayout_Layout_android_layout_gravity = 0; public static final int CoordinatorLayout_Layout_layout_anchor = 1; public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static final int CoordinatorLayout_Layout_layout_behavior = 3; public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static final int CoordinatorLayout_Layout_layout_insetEdge = 5; public static final int CoordinatorLayout_Layout_layout_keyline = 6; public static final int[] FontFamily = { 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd, 0x7f0300de }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f0300d7, 0x7f0300df, 0x7f0300e0, 0x7f0300e1, 0x7f030208 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x010101a5, 0x01010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "47729927+laptrinhdidong2@users.noreply.github.com" ]
47729927+laptrinhdidong2@users.noreply.github.com
5d7723beada99fd48a487fa53893b09654a33af0
9e0a8c024c233e93a19b0027b5d4ba5ed753406a
/rzd-tests/src/test/java/ru/stqa/pft/rzd/appmanager/SessionHelper.java
74e6f1290c84670f9cc7b575633ca6ba9a032794
[ "Apache-2.0" ]
permissive
nastyada/manuhin_repo
c0109722eb8957aa406b14b9c2eeb87e3e8da909
f0325baa6e741e0b8959d76ffbb97e2c67319b7a
refs/heads/master
2023-01-23T06:16:54.814615
2017-01-17T16:51:38
2017-01-17T16:51:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package ru.stqa.pft.rzd.appmanager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; /** * Created by Юрий on 05.03.2016. */ public class SessionHelper extends HelperBase { public SessionHelper(WebDriver wd) { super(wd); } public void login(String username, String password) { click(By.id("LoginForm")); type(By.name("user"), username); type(By.name("pass"), password); click(By.xpath("//form[@id='LoginForm']/input[3]")); } }
[ "manyurij@yandex.ru" ]
manyurij@yandex.ru
31d575aa783c38c0b431ee6a107dde437a2a29b7
93a0fa49fb952e7f0468febe304f4b09df0722b3
/factura.master.service.subsystem/src/main/java/co/edu/uniandes/csw/factura/master/persistence/entity/FacturaOrdenDeFabricacionEntityId.java
aaa8926dd36d7a367875cdb7eba9f8207e975359
[]
no_license
cristianABC/facturacion
315681e6e6bcaa9575fa4711826b38b9377efbcc
071af0dae2af2dde1afff8e1c7687b19389b3534
refs/heads/master
2021-01-18T14:10:50.126107
2014-04-10T05:34:18
2014-04-10T05:34:18
18,372,217
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package co.edu.uniandes.csw.factura.master.persistence.entity; import java.io.Serializable; /** * * @author cadmilo */ public class FacturaOrdenDeFabricacionEntityId implements Serializable{ private Long facturaId; private Long ordenDeFabricacionId; @Override public int hashCode() { return (int) (facturaId + ordenDeFabricacionId); } @Override public boolean equals(Object object) { if (object instanceof FacturaOrdenDeFabricacionEntityId) { FacturaOrdenDeFabricacionEntityId otherId = (FacturaOrdenDeFabricacionEntityId) object; return (otherId.facturaId == this.facturaId) && (otherId.ordenDeFabricacionId == this.ordenDeFabricacionId); } return false; } }
[ "admin@ISIS2603-21" ]
admin@ISIS2603-21
aadb3f7dfba4612171e36510f36dec32efa6aaf2
51a27a589439d35ebcd36ef9ab196107d3e0c942
/SpringAPIUse/src/main/java/com/wk/config/ScopeAndLazyConfig.java
02b62e45bd4dbdb1a110bf10c4a8f2c774d32198
[]
no_license
emperwang/JavaBase
a9d9a43c782288ed8d18f4773b105e82b53320cb
0a0423f85a022f9664e44ab852170fa6e09960ed
refs/heads/master
2023-02-08T07:40:02.418247
2023-02-03T14:49:40
2023-02-03T14:49:40
185,725,768
1
0
null
2022-12-06T00:32:25
2019-05-09T04:23:51
Java
UTF-8
Java
false
false
811
java
package com.wk.config; import com.wk.beans.Person; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Scope; @Configuration public class ScopeAndLazyConfig { /** * SCOPE_PROTOTYPE 多实例 * SCOPE_SINGLETON 单实例 * SCOPE_REQUEST 请求域 * SCOPE_SESSION session域 */ //@Scope(value = "prototype") @Lazy //在初始化的时候不注册bean,只有在第一次使用的时候才会取注册bean @Bean("person") public Person person(){ System.out.println("注册bean"); return new Person("wwww",20); } }
[ "544094478@qq.com" ]
544094478@qq.com
19bf5cccbc65858192924fb2e6552d206d780025
19e003cfecf2eb7413900cc78a0dc3934009fe4f
/src/binswarm/comm/MessageListener.java
e1ee03d603d36ee5cdded4b1911f83dbbd781fda
[]
no_license
firefly2442/binswarm
33732893ad51aef9e51c3fa2c091ec8363f4f96f
3322b1d220b7b84649ffee3d680f499f36e08db4
refs/heads/master
2020-05-16T07:41:47.992753
2012-06-18T04:35:47
2012-06-18T04:44:03
1,185,728
1
1
null
null
null
null
UTF-8
Java
false
false
198
java
package binswarm.comm; import org.w3c.dom.NodeList; public interface MessageListener { public void messageRecieved(MessageHeader header, String messageType, NodeList innerNodes, String ip); }
[ "firefly2442@gmail.com" ]
firefly2442@gmail.com
ad7c8a37684209374b043d92e4d73f51b2194c37
da64d766c9f773fcdba2011db2d906eb878c27c2
/src/main/java/Resources/calendar.java
b54b664caf65fa308e4b9991e7c3c45dcce59f85
[]
no_license
sofi2225/Ejercicio2Selenium
0ac7fff2bab1c36caf9b6ee395bbeeb65e8f2058
84d449596b8370f5c4c89b91e3ed9208b607c830
refs/heads/main
2023-06-28T23:51:45.324266
2021-07-30T20:12:45
2021-07-30T20:12:45
389,676,904
0
0
null
null
null
null
UTF-8
Java
false
false
2,036
java
package Resources; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class calendar extends base { WebDriver driver; public void Calendario(String day, String month, String year,WebElement webElement, WebDriver driver) throws InterruptedException{ JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].scrollIntoView();", webElement); Utilities.jsClick(webElement); WebElement yearValue= driver.findElement(By.xpath("//select[@class='slds-select']")); WebElement yearOption = driver.findElement(By.xpath("//select[@class='slds-select']/option[@value='"+year+"']")); WebElement mesValue= driver.findElement(By.xpath("//div[@class=\"slds-datepicker__filter slds-grid\"]/div/h2")); //WebElement mesValue= driver.findElement(By.cssSelector("[id*='month-title']")); //System.out.println(mesValue); //String value = mesValue.getText(); //System.out.println(value); //Month while (!mesValue.getText().contains(month)) { driver.findElement(By.xpath("//button[@title='Next Month']")).click(); } if (yearOption.getText() != year) { yearValue.click(); // System.out.println(year); Utilities.GetInView(yearOption); yearOption.click(); } List<WebElement> dates = driver.findElements(By.xpath("//span[@class='slds-day']")); //System.out.println(dates); for (int i=0;i<dates.size(); i++) { String text= driver.findElements(By.xpath("//span[@class='slds-day']")).get(i).getText(); //System.out.println(text); if (text.equalsIgnoreCase(day)) { driver.findElements(By.xpath("//span[@class='slds-day']")).get(i).click(); break; } } } }
[ "soffii_25@hotmail.com" ]
soffii_25@hotmail.com
0abebb4fd8cf8720f84fdc053f40d0ba95cafb83
b2ccbde3ac71a09d6adbdfc794bc7884fce62aea
/app/src/main/java/chiya/lolmates/requetes/Mastery.java
c325dee6949bc84a1fc5d0246fb1f6e9a2ebbf8f
[]
no_license
chiyanoyuuki/LolMates
953afde91c1d0daad9df83341a5686820d4ac0bb
8e4b84e1105d211f92229f7fced8d87c57639499
refs/heads/master
2023-02-23T19:44:17.106628
2021-02-01T17:03:21
2021-02-01T17:03:21
222,415,017
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package chiya.lolmates.requetes; import java.util.HashMap; public class Mastery { private HashMap<String,String> mastery; public Mastery(HashMap<String,String> mastery) { this.mastery = mastery; } public String championPointsUntilNextLevel(){return mastery.get("championPointsUntilNextLevel");} public String chestGranted(){return mastery.get("chestGranted");} public String tokensEarned(){return mastery.get("tokensEarned");} public String championId(){return mastery.get("championId");} public String lastPlayTime(){return mastery.get("lastPlayTime");} public String summonerId(){return mastery.get("summonerId");} public String championLevel(){return mastery.get("championLevel");} public String championPoints(){return mastery.get("championPoints");} public String championPointsSinceLastLevel(){return mastery.get("championPointsSinceLastLevel");} }
[ "charles.poure@hotmail.com" ]
charles.poure@hotmail.com
906ae268150f61398249d8385c3cb1dccd5787b9
5d307fe5dd0a23d166df76f8623c204eb510591d
/src/main/java/com/smscaster/SMS/Caster/exception/MyFileNotFoundException.java
39d9bde068d8c1007def9b487f9d78498c207d3e
[]
no_license
MSU-Students/SMS-Server
8e95ed99b21491173108aa9a862bb36b8ff604a1
c20e3ab727802a501a7be01bbac0d5fce5321100
refs/heads/main
2023-06-21T04:12:54.264163
2021-07-26T19:01:04
2021-07-26T19:01:04
371,596,110
1
2
null
2022-03-10T01:03:25
2021-05-28T06:00:34
Java
UTF-8
Java
false
false
433
java
package com.smscaster.SMS.Caster.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class MyFileNotFoundException extends RuntimeException { public MyFileNotFoundException(String message) { super(message); } public MyFileNotFoundException(String message, Throwable cause) { super(message, cause); } }
[ "ruzlicali24@gmail.com" ]
ruzlicali24@gmail.com