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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f8128e43313b8258a5adb23d95d16eb09fd9fa81 | 82d0501e1232b24cf694b9afcfd477566401b510 | /src/com/dotsarecool/game/command/HelpCommand.java | 2c318176724505b23326a451364418c438aec710 | [] | no_license | deserteagle417/buibuibot | 612c98aa6cbe90d11684b9a11115eb41f39c7a80 | 5e3cf023c9028eeefc8f3739acca5c55beb6a57d | refs/heads/master | 2020-04-28T19:36:56.249728 | 2015-06-23T15:28:55 | 2015-06-23T15:28:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package com.dotsarecool.game.command;
import com.dotsarecool.game.BuiBuiBot;
import com.dotsarecool.game.Command;
public class HelpCommand extends Command {
public HelpCommand(BuiBuiBot bui) {
super(bui);
}
public void execute(String chan, String user, boolean op, String login, String host, String text) {
bui.channelMessage(chan, user, "For more info, go to http://www.dotsarecool.com/twitch/buibuibot.html");
}
} | [
"alex.losego@gmail.com"
] | alex.losego@gmail.com |
0fbff56bd240c921db734783ad38b588156b7192 | 70fe4ce6e9f0412adba90ca150bb94e686db4e2b | /app/src/main/java/com/otapp/net/rest/ApiInterface.java | 0664a3e49a3102c2b11e4e44ce3f20d4ea72dd06 | [] | no_license | vasimkhanp/otapppublic18_05_2020 | 9df63ad888def2d7448fff50b86f04a8b129f855 | e7067af113c1fc61fc2734b52ca0a8358531c538 | refs/heads/master | 2022-07-30T13:19:59.116621 | 2020-05-18T07:11:06 | 2020-05-18T07:11:06 | 264,853,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,331 | java | package com.otapp.net.rest;
import com.google.gson.JsonObject;
import com.otapp.net.model.AddReviewPojo;
import com.otapp.net.model.ApiResponse;
import com.otapp.net.model.ComingSoonPojo;
import com.otapp.net.model.CountryCodePojo;
import com.otapp.net.model.CouponResponsePojo;
import com.otapp.net.model.EventCategoryPojo;
import com.otapp.net.model.EventDetailsPojo;
import com.otapp.net.model.EventListPojo;
import com.otapp.net.model.EventPaymentSummaryPojo;
import com.otapp.net.model.EventSeatBookedPojo;
import com.otapp.net.model.EventSuccessPojo;
import com.otapp.net.model.EventZeroResponse;
import com.otapp.net.model.FlightCityPojo;
import com.otapp.net.model.FlightMultiCityPojo;
import com.otapp.net.model.FlightOneDetailsPojo;
import com.otapp.net.model.FlightOneListPojo;
import com.otapp.net.model.FlightPaymentSummaryPojo;
import com.otapp.net.model.FlightReturnListPojo;
import com.otapp.net.model.FlightSuccessPojo;
import com.otapp.net.model.FoodListPojo;
import com.otapp.net.model.HomeAdsResponse;
import com.otapp.net.model.MovieAdvertiseResponse;
import com.otapp.net.model.MovieDetailsPojo;
import com.otapp.net.model.MovieListPojo;
import com.otapp.net.model.MoviePaymentSummaryPojo;
import com.otapp.net.model.MovieSeatListPojo;
import com.otapp.net.model.MovieSuccessPojo;
import com.otapp.net.model.MovieTheaterListPojo;
import com.otapp.net.model.MovieZeroResponse;
import com.otapp.net.model.ParkPaymentSummaryPojo;
import com.otapp.net.model.ParkZeroResponse;
import com.otapp.net.model.RecomendedMoviePojo;
import com.otapp.net.model.ReviewListPojo;
import com.otapp.net.model.SeatProcessedPojo;
import com.otapp.net.model.ThemeParkCartListPojo;
import com.otapp.net.model.ThemeParkDetailsPojo;
import com.otapp.net.model.ThemeParkPojo;
import com.otapp.net.model.ThemeParkReconfirmResponse;
import com.otapp.net.model.ThemeParkRideListPojo;
import com.otapp.net.model.ThemeParkSuccessPojo;
import com.otapp.net.model.UpcomingTripPojo;
import com.otapp.net.model.UpdatePojo;
import com.otapp.net.model.UpdateRideDateModel;
import com.otapp.net.model.UserEditPojo;
import com.otapp.net.model.UserPojo;
import com.otapp.net.utils.Constants;
import java.util.Map;
import retrofit2.Call;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;
/**
* Created by JITEN-PC on 21-12-2016.
*/
public interface ApiInterface {
@GET("auth/signup.php")
Call<ApiResponse> registerUser(@QueryMap Map<String, String> options);
@GET("auth/login.php")
Call<UserPojo> loginUser(@QueryMap Map<String, String> options);
@GET("auth/forget_password.php")
Call<ApiResponse> forgotPassword(@QueryMap Map<String, String> options);
@GET("auth/logout.php")
Call<ApiResponse> logout(@QueryMap Map<String, String> options);
@GET("auth/social_login.php")
Call<UserPojo> loginUserWithSocial(@QueryMap Map<String, String> options);
@GET("auth/reset_password.php")
Call<ApiResponse> resetPassword(@QueryMap Map<String, String> options);
@GET("auth/delete_profile_image.php")
Call<ApiResponse> removePicture(@QueryMap Map<String, String> options);
@GET("add_movie_reviews.php")
Call<AddReviewPojo> addMovieReview(@QueryMap Map<String, String> options);
@GET("get_movie_reviews.php")
Call<ReviewListPojo> getReviewList(@QueryMap Map<String, String> options);
@GET("auth/getBookings.php")
Call<UpcomingTripPojo> getUpcomingTripList(@QueryMap Map<String, String> options);
@GET("promo/Validate_Promo.php")
Call<CouponResponsePojo> validateCouponCode(@QueryMap Map<String, String> options);
@GET("get_movie_fare_cal.php")
Call<MoviePaymentSummaryPojo> getMoviePaymentSummary(@QueryMap Map<String, String> options);
@GET("movie_zeropay_booking.php")
Call<MovieZeroResponse> getMovieZeroPayment(@QueryMap Map<String, String> options);
@GET("promo/Additional_verify.php")
Call<ApiResponse> verifyCouponCode(@QueryMap Map<String, String> options);
@GET("auth/getCompletedBookings.php")
Call<UpcomingTripPojo> getCompleteTripList(@QueryMap Map<String, String> options);
@GET("auth/getCancelledBookings.php")
Call<UpcomingTripPojo> getCancelledTripList(@QueryMap Map<String, String> options);
@GET("get_country_code_v2.php")
Call<CountryCodePojo> getCountryCodeList(@QueryMap Map<String, String> options);
@FormUrlEncoded
@POST()
Call<UpdatePojo> checkVersion(@Url String api, @FieldMap Map<String, String> params);
@GET("get_event_category.php")
Call<EventCategoryPojo> getEventCategory(@Query("user_token") String user_token);
@GET("get_event_list.php")
Call<EventListPojo> getEventList(@Query("user_token") String user_token);
@GET("get_event_detail_v2.php")
Call<EventDetailsPojo> getEventDetails(@Query("event_id") String event_id, @Query("user_token") String user_token);
@GET("get_event_fare_cal.php")
Call<EventPaymentSummaryPojo> getEventPaymentSummary(@QueryMap Map<String, String> options);
@GET("event_zeropay_booking.php")
Call<EventZeroResponse> getEventZeroPayment(@QueryMap Map<String, String> options);
@GET("event_process_seat_delete.php")
Call<SeatProcessedPojo> deleteProcessedEventSeatsList(@Query("ukey") String mUserKey, @Query("user_token") String user_token);
@GET("event_seats.php")
Call<EventSeatBookedPojo> bookEventSeat(@Query("event_id") String event_id, @Query("ukey") String ukey, @Query("event_date") String event_date,
@Query("event_time") String event_time, @Query("tickets") String tickets, @Query("user_token") String user_token);
@GET("event_payment_success_v3.php")
Call<EventSuccessPojo> getEventPaymentSuccess(@Query("tkt_no") String mBookingID, @Query("user_token") String user_token);
@GET("resend_event_confirmation.php")
Call<ApiResponse> resendEventConfirmation(@Query("tkt_no") String mBookingID, @Query("user_token") String user_token);
@GET("homescreen.php")
Call<HomeAdsResponse> getHomeAds(@Query("user_token") String user_token);
@GET("get_movie_list_v2.php")
Call<MovieListPojo> getMovieList(@Query("user_token") String user_token);
@GET("get_movie_coming_soon.php")
Call<ComingSoonPojo> getComingSoonMovieList(@Query("user_token") String user_token);
@GET("get_recommended_movies.php")
Call<RecomendedMoviePojo> getRecomendedMovieList(@Query("movie_id") String movie_id, @Query("user_token") String user_token);
@GET("get_movie_details_v2.php")
Call<MovieDetailsPojo> getMovieDetails(@QueryMap Map<String, String> options);
@GET("add_movie_like.php")
Call<ApiResponse> likeMovie(@QueryMap Map<String, String> options);
// @GET("get_movie_screen.php")
// Call<MovieScreenListPojo> getMovieScreenList(@Query("movie_id") String movie_id, @Query("dt") String date, @Query("user_token") String user_token);
@GET("adverts.php")
Call<MovieAdvertiseResponse> getMovieAdvertiseList(@Query("user_token") String user_token);
@GET("get_movie_screen_time_v2.php")
Call<MovieTheaterListPojo> getMovieTheaterList(@Query("movie_id") String movie_id, @Query("dt") String date, @Query("user_token") String user_token);
// @GET("get_movie_showtime.php")
// Call<MovieTimeListPojo> getMovieTimeList(@Query("movie_id") String movie_id, @Query("dt") String date, @Query("screen_id") String screen_id, @Query("user_token") String user_token);
@GET("theatre_screen_v2.php")
Call<MovieSeatListPojo> getMovieSeatsList(@Query("mv_screen") String screen_id, @Query("user_token") String user_token);
@GET("get_bk_prcs_sts.php")
Call<SeatProcessedPojo> getProcessedSeatsList(@Query("mtid") String mtid, @Query("ukey") String user_key, @Query("user_token") String user_token);
@GET("process_seats_delete.php")
Call<SeatProcessedPojo> deleteProcessedSeatsList(@Query("ukey") String user_key, @Query("user_token") String user_token);
@GET("process_movie_seats.php")
Call<SeatProcessedPojo> setProcessedSeats(@Query("mtid") String mtid, @Query("seat") String seat, @Query("user_key") String user_key, @Query("user_token") String user_token);
@GET("food_combo_v2.php")
Call<FoodListPojo> getFoodList(@Query("mv_screen") String mv_screen, @Query("dt") String dt, @Query("show_time") String show_time, @Query("movie_id") String movie_id,
@Query("user_token") String user_token);
@GET
Call<String> getPaymentApi(@Url String url);
@GET("movie_booked_details_v3.php")
Call<MovieSuccessPojo> getPaymentSuccess(@Query("tkt_no") String mBookingID, @Query("user_token") String user_token);
@GET("resend_movie_confirmation.php")
Call<ApiResponse> resendMovieConfirmation(@Query("tkt_no") String mBookingID, @Query("user_token") String user_token);
@GET("Resend_TP_Confirmation.php")
Call<ThemeParkReconfirmResponse> resendThemeParkConfirmation(@Query("tkt_no") String mBookingID);
@GET("first_theme_park.php")
Call<ThemeParkPojo> getThemePark(@Query("user_token") String user_token);
@GET("get_theme_park_list.php")
Call<ThemeParkRideListPojo> getThemeParkRideList(@Query("user_token") String user_token);
@GET("get_theme_park_detail_v2.php")
Call<ThemeParkDetailsPojo> getThemeParkDetails(@Query("tp_id") String tp_id, @Query("tp_ukey") String tp_ukey, @Query("user_token") String user_token);
@GET("get_my_cart.php")
Call<ThemeParkCartListPojo> getThemeParkCartList(@Query("tp_ukey") String tp_ukey, @Query("user_token") String user_token);
@GET("insert_tp_process_seats.php")
Call<ApiResponse> bookThemePark(@Query("tp_id") String tp_id, @Query("tp_dt") String tp_dt, @Query("tp_ukey") String tp_ukey, @Query("adult_ticket_count") String adult_ticket_count,
@Query("child_ticket_count") String child_ticket_count, @Query("stud_ticket_count") String stud_ticket_count, @Query("user_token") String user_token);
@GET("remove_ride_from_cart.php")
Call<ApiResponse> removeRideItem(@Query("tp_id") String tp_id, @Query("ukey") String ukey, @Query("user_token") String user_token);
@GET("get_theme_park_fare_cal.php")
Call<ParkPaymentSummaryPojo> getParkPaymentSummary(@QueryMap Map<String, String> options);
@GET("themepark_zeropay_booking.php")
Call<ParkZeroResponse> getParkZeroPayment(@QueryMap Map<String, String> options);
@GET("update_tp_ride_date.php")
Call<JsonObject> getRideDateUpdate(@Query("ukey") String uKey, @Query("ride_dt") String rideDate);
@GET("payment_success_tp_v2.php")
Call<ThemeParkSuccessPojo> getThemeParkPaymentSuccess(@Query("tkt_no") String tkt_no, @Query("user_token") String user_token);
@GET(Constants.API_FLIGHT_TITLE+"/getairportdetails_v2.php")
Call<FlightCityPojo> getAirportList(@Query("user_token") String user_token);
@GET(Constants.API_FLIGHT_TITLE+"/get_flight_fare_cal.php")
Call<FlightPaymentSummaryPojo> getFlightPaymentSummary(@QueryMap Map<String, String> options);
@GET(Constants.API_FLIGHT_TITLE+"/searchonewayflight.php")
Call<FlightOneListPojo> getFlightOneList(@Query("from") String from, @Query("to") String to, @Query("date") String date, @Query("adult_count") String adult_count,
@Query("child_count") String child_count, @Query("infants_count") String infants_count, @Query("class") String className, @Query("currency") String currencyName,
@Query("time") String time, @Query("is_refundable_fare") String is_refundable_fare, @Query("airlines") String airlines,
@Query("user_token") String user_token, @Query("flight_auth_token") String flight_auth_token);
@GET(Constants.API_FLIGHT_TITLE+"/getonewaydetails.php")
Call<FlightOneDetailsPojo> getFlightOneDetails(@Query("uid") String uid, @Query("key") String key, @Query("currency") String currencyName, @Query("user_token") String user_token, @Query("flight_auth_token") String flight_auth_token);
@GET(Constants.API_FLIGHT_TITLE+"/searchreturnflight.php")
Call<FlightReturnListPojo> getReturnFlightList(@Query("from") String from, @Query("to") String to, @Query("dp_date") String dp_date, @Query("re_date") String re_date, @Query("adult_count") String adult_count,
@Query("child_count") String child_count, @Query("infants_count") String infants_count, @Query("class") String className, @Query("currency") String currencyName,
@Query("time") String time, @Query("is_refundable_fare") String is_refundable_fare, @Query("airlines") String airlines, @Query("user_token") String user_token, @Query("flight_auth_token") String flight_auth_token);
@GET(Constants.API_FLIGHT_TITLE+"/getreturntripdetails.php")
Call<FlightOneDetailsPojo> getFlightReturnDetails(@Query("uid") String uid, @Query("key") String key, @Query("currency") String currencyName, @Query("user_token") String user_token, @Query("flight_auth_token") String flight_auth_token);
@GET(Constants.API_FLIGHT_TITLE+"/searchmulticity.php")
Call<FlightMultiCityPojo> getMultiCityFlightList(@Query("journey") String journey, @Query("adult_count") String adult_count,
@Query("child_count") String child_count, @Query("infants_count") String infants_count, @Query("class") String className, @Query("currency") String currencyName,
@Query("time") String time, @Query("airlines") String airlines, @Query("user_token") String user_token);
@GET(Constants.API_FLIGHT_TITLE+"/bookWithAirline.php")
Call<FlightSuccessPojo> getFlightPaymentSuccess(@Query("tkt_no") String mBookingID, @Query("user_token") String user_token, @Query("flight_auth_token") String flight_auth_token);
@GET
Call<ApiResponse> saveFlightDetails(@Url String url);
@FormUrlEncoded
@POST("auth/editProfile.php")
Call<UserEditPojo> saveProfile(@FieldMap Map<String, String> params);
}
| [
"vasimkhan.pathan@smsipl.com"
] | vasimkhan.pathan@smsipl.com |
a60025f4674cb2abe3f74505bb45bbb28f4f1249 | 2c262005ccf0003e3714e332839a06cec7f6a78a | /src/main/java/com/example/demo/registration/RegistrationRequest.java | 6d90799169c89a04a11d68c28b87a5994f862e0e | [] | no_license | raadkasem/Full-User-Login-and-Registration-System-with-Email-Verification | 7c661905acd0f28b88940bac17c2e282648cb736 | a0af1667598df6d0437b03e8a7cf9fe87c799f8e | refs/heads/master | 2023-08-10T16:44:06.807961 | 2021-10-01T18:52:06 | 2021-10-01T18:52:06 | 412,584,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package com.example.demo.registration;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Getter
@AllArgsConstructor
@EqualsAndHashCode
@ToString
public class RegistrationRequest {
// هذا الكلاس تم عمله للسبب التالي
// عندما يمرر البزون طلب request فأننا نحتاج لالتقاط بعض المعلومات
private final String firstName;
private final String lastName;
private final String email;
private final String password;
}
| [
"rkasem0@gmail.com"
] | rkasem0@gmail.com |
96b99fe06a3b7810c4cc31f4505caf86a40ed064 | 14045c924b739295fc71ad876ca4ad3714e74fee | /src/main/java/com/itgm/web/rest/AccountResource.java | 9581e7364b31e4bd075766a80f583a6d4cf5579d | [] | no_license | BulkSecurityGeneratorProject/itgm3 | a21a1237b679bc7c0592edbf87e334adee6f79a0 | 849ec26131eafeda869a5dbd633ba50d13f42ee1 | refs/heads/master | 2022-12-09T12:30:19.173742 | 2017-06-19T04:51:53 | 2017-06-19T04:51:53 | 296,672,377 | 0 | 0 | null | 2020-09-18T16:21:11 | 2020-09-18T16:21:11 | null | UTF-8 | Java | false | false | 9,968 | java | package com.itgm.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.itgm.domain.User;
import com.itgm.repository.UserRepository;
import com.itgm.security.SecurityUtils;
import com.itgm.service.MailService;
import com.itgm.service.UserService;
import com.itgm.service.dto.UserDTO;
import com.itgm.web.rest.vm.KeyAndPasswordVM;
import com.itgm.web.rest.vm.ManagedUserVM;
import com.itgm.web.rest.util.HeaderUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
import org.springframework.web.multipart.MultipartFile;
import com.itgm.service.jriaccess.Itgmrest;
/**
* REST controller for managing the current user's account.
*/
@RestController
@RequestMapping("/api")
public class AccountResource {
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
private final UserRepository userRepository;
private final UserService userService;
private final MailService mailService;
public AccountResource(UserRepository userRepository, UserService userService,
MailService mailService) {
this.userRepository = userRepository;
this.userService = userService;
this.mailService = mailService;
}
/**
* POST /register : register the user.
*
* @param managedUserVM the managed user View Model
* @return the ResponseEntity with status 201 (Created) if the user is registered or 400 (Bad Request) if the login or email is already in use
*/
@PostMapping(path = "/register",
produces={MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE})
@Timed
public ResponseEntity registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) {
HttpHeaders textPlainHeaders = new HttpHeaders();
textPlainHeaders.setContentType(MediaType.TEXT_PLAIN);
return userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase())
.map(user -> new ResponseEntity<>("login already in use", textPlainHeaders, HttpStatus.BAD_REQUEST))
.orElseGet(() -> userRepository.findOneByEmail(managedUserVM.getEmail())
.map(user -> new ResponseEntity<>("email address already in use", textPlainHeaders, HttpStatus.BAD_REQUEST))
.orElseGet(() -> {
User user = userService
.createUser(managedUserVM.getLogin(), managedUserVM.getPassword(),
managedUserVM.getFirstName(), managedUserVM.getLastName(),
managedUserVM.getEmail().toLowerCase(), managedUserVM.getImageUrl(), managedUserVM.getLangKey());
mailService.sendActivationEmail(user);
return new ResponseEntity<>(HttpStatus.CREATED);
})
);
}
/**
* GET /activate : activate the registered user.
*
* @param key the activation key
* @return the ResponseEntity with status 200 (OK) and the activated user in body, or status 500 (Internal Server Error) if the user couldn't be activated
*/
@GetMapping("/activate")
@Timed
public ResponseEntity<String> activateAccount(@RequestParam(value = "key") String key) {
return userService.activateRegistration(key)
.map(user -> new ResponseEntity<String>(HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
}
/**
* GET /authenticate : check if the user is authenticated, and return its login.
*
* @param request the HTTP request
* @return the login if the user is authenticated
*/
@GetMapping("/authenticate")
@Timed
public String isAuthenticated(HttpServletRequest request) {
log.debug("REST request to check if the current user is authenticated");
return request.getRemoteUser();
}
/**
* GET /account : get the current user.
*
* @return the ResponseEntity with status 200 (OK) and the current user in body, or status 500 (Internal Server Error) if the user couldn't be returned
*/
@GetMapping("/account")
@Timed
public ResponseEntity<UserDTO> getAccount() {
return Optional.ofNullable(userService.getUserWithAuthorities())
.map(user -> new ResponseEntity<>(new UserDTO(user), HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
}
/**
* POST /account : update the current user information.
*
* @param userDTO the current user information
* @return the ResponseEntity with status 200 (OK), or status 400 (Bad Request) or 500 (Internal Server Error) if the user couldn't be updated
*/
@PostMapping("/account")
@Timed
public ResponseEntity saveAccount(@Valid @RequestBody UserDTO userDTO) {
Optional<User> existingUser = userRepository.findOneByEmail(userDTO.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userDTO.getLogin()))) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("user-management", "emailexists", "Email already in use")).body(null);
}
return userRepository
.findOneByLogin(SecurityUtils.getCurrentUserLogin())
.map(u -> {
userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(),
userDTO.getLangKey(), userDTO.getImageUrl());
return new ResponseEntity(HttpStatus.OK);
})
.orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
}
/**
* POST /account/change_password : changes the current user's password
*
* @param password the new password
* @return the ResponseEntity with status 200 (OK), or status 400 (Bad Request) if the new password is not strong enough
*/
@PostMapping(path = "/account/change_password",
produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity changePassword(@RequestBody String password) {
if (!checkPasswordLength(password)) {
return new ResponseEntity<>("Incorrect password", HttpStatus.BAD_REQUEST);
}
userService.changePassword(password);
return new ResponseEntity<>(HttpStatus.OK);
}
/**
* POST /account/reset_password/init : Send an email to reset the password of the user
*
* @param mail the mail of the user
* @return the ResponseEntity with status 200 (OK) if the email was sent, or status 400 (Bad Request) if the email address is not registered
*/
@PostMapping(path = "/account/reset_password/init",
produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity requestPasswordReset(@RequestBody String mail) {
return userService.requestPasswordReset(mail)
.map(user -> {
mailService.sendPasswordResetMail(user);
return new ResponseEntity<>("email was sent", HttpStatus.OK);
}).orElse(new ResponseEntity<>("email address not registered", HttpStatus.BAD_REQUEST));
}
/**
* POST /account/reset_password/finish : Finish to reset the password of the user
*
* @param keyAndPassword the generated key and the new password
* @return the ResponseEntity with status 200 (OK) if the password has been reset,
* or status 400 (Bad Request) or 500 (Internal Server Error) if the password could not be reset
*/
@PostMapping(path = "/account/reset_password/finish",
produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<String> finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) {
if (!checkPasswordLength(keyAndPassword.getNewPassword())) {
return new ResponseEntity<>("Incorrect password", HttpStatus.BAD_REQUEST);
}
return userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey())
.map(user -> new ResponseEntity<String>(HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
}
private boolean checkPasswordLength(String password) {
return !StringUtils.isEmpty(password) &&
password.length() >= ManagedUserVM.PASSWORD_MIN_LENGTH &&
password.length() <= ManagedUserVM.PASSWORD_MAX_LENGTH;
}
@PostMapping("/account/image")
public ResponseEntity<String> imageUpload(
@RequestParam("file") MultipartFile file) {
User user = userService.getUserWithAuthorities();
String codName = Itgmrest.getCodNome(user);
String fileN = "foto" + Itgmrest.getFileExt(file.getOriginalFilename());
String dir = "data/";
String res = "";
if (!Itgmrest.sendFile(codName + "/*/*/*/" + fileN, dir, (file))
|| ((res = Itgmrest.publicFile(codName, "*", "*", "*", dir, fileN)) == null)) {
return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
}
return new ResponseEntity<String>("{\"image\":\"" + res + "\"}", HttpStatus.OK);
}
/**
* GET /endereco : get the endereco of public files.
*
* @return the ResponseEntity with status 200 (OK) and the current URL in body, or status 500 (Internal Server Error) if the server couldn't be find
*/
@GetMapping("/endereco")
@Timed
public ResponseEntity<String> getEndereco() {
return new ResponseEntity<String>("{\"endereco\":\"" + Itgmrest.getEndereco()+ "\",\"status\":" + Itgmrest.isServerAlive() + "}", HttpStatus.OK);
}
}
| [
"mfernandes@localhost.localdomain"
] | mfernandes@localhost.localdomain |
5c6a6ff1c1986d3ed63a976a5d86e0222364193d | 4db23693350928ecead170ed1ec59b792533aeff | /tiiimmo/admin/src/main/java/com/linln/admin/produce/domain/ProcessTaskDetail.java | db15f3b30f77159f1fa91225a24875edd3f8e8c5 | [
"Apache-2.0"
] | permissive | ckshe/siui | ca931980ab742f6e63c84c93371617f11e867e2e | 4064cbbc97093f202de44cc925bb0cd57e2a8fde | refs/heads/master | 2022-12-20T09:38:33.940471 | 2020-08-05T01:13:06 | 2020-08-05T01:13:06 | 301,584,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package com.linln.admin.produce.domain;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
@Data
@Entity
@Table(name ="produce_process_task_detail")
public class ProcessTaskDetail {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id ;
private Byte status;
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date plan_day_time;
private String process_task_code;
private Integer plan_count;
private Integer finish_count;
private String detail_type;
private String user_name;
private String process_name;
@Transient
private List<ProcessTaskDetailDevice> detailDeviceList;
}
| [
"123456"
] | 123456 |
63f603390ccfb7edb914377a0ce46f0fc534a485 | f065fcbe55dd24e24560823a40265394b6caf936 | /cloud-stream-rabbitmq-consumer8802/src/main/java/com/atguigu/springcloud/controller/ReceiveMessageListenerController.java | 8021c10cdc36a1c74dfd0c06ea87aadcf324f0d6 | [] | no_license | hujf2017/springcloud | d4c8d74e38c5d22a458f3f01042a5d6f465e4981 | 056b43e8334a5ec66eb686e68c3683fc99265506 | refs/heads/master | 2023-03-19T05:16:30.612934 | 2021-03-13T12:47:59 | 2021-03-13T12:47:59 | 320,744,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package com.atguigu.springcloud.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
/**
* @author Hujf
* @title: ReceiveMessageListenerController
* @date 2021/1/13 0013上午 10:12
* @description: TODO
*/
@Component
@EnableBinding(Sink.class)
public class ReceiveMessageListenerController {
@Value("${server.port}")
private String serverPort;
@StreamListener(Sink.INPUT)
public void getMessage(Message<String> message) {
System.out.print( "我是消费者,收到消息:"+message.getPayload()+" "+serverPort);
}
}
| [
"952405831@qq.com"
] | 952405831@qq.com |
f1b3156f13b2f057d085860f716b0e9045ebb039 | 9924ec37e2eeb8d2e3e6f6858a8bf25bedfc013d | /gwtbootstrap3/src/main/java/com/svenjacobs/gwtbootstrap3/client/ui/base/TextBoxBase.java | 5fd518739a9248f83438c0d63acaebf9be08d7ff | [
"Apache-2.0"
] | permissive | christophwidulle/gwtbootstrap3 | 51bb212c591c9fff61a5ae3b6ace1d54a17fc1a5 | 4aa1a47d49d8abf39ba1ea3e42a65aa7ac5a6131 | refs/heads/master | 2020-05-29T11:41:35.981734 | 2013-12-11T20:51:47 | 2013-12-11T20:51:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package com.svenjacobs.gwtbootstrap3.client.ui.base;
/*
* #%L
* GwtBootstrap3
* %%
* Copyright (C) 2013 Sven Jacobs
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import com.google.gwt.dom.client.Element;
import com.google.gwt.text.shared.testing.PassthroughParser;
import com.google.gwt.text.shared.testing.PassthroughRenderer;
public class TextBoxBase extends ValueBoxBase<String> {
protected TextBoxBase(final Element elem) {
super(elem, PassthroughRenderer.instance(), PassthroughParser.instance());
}
@Override
public String getValue() {
final String raw = super.getValue();
return raw == null ? "" : raw;
}
}
| [
"pontus@wka.se"
] | pontus@wka.se |
9a413f8f35cf1f340bc8a30d137c1c4d35ce5c24 | 930b3994349cbde2de8d6cfb0770ddadd7a16aa5 | /src/test/java/org/ysc/calculator/CalculatorEsportsTest.java | 3a11fb72ff5e2818e2ee001a6c2b9fa7ef3aed0d | [] | no_license | sysfxout/LoLFantasyCalculator | 48ed21f976d4768b0af16aa81841fd6a56e7fd0c | a53790454912920c3de97bb051aabb114df715d8 | refs/heads/master | 2021-01-01T05:14:34.123712 | 2016-05-17T04:58:16 | 2016-05-17T04:58:16 | 58,978,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,796 | java | package org.ysc.calculator;
import static org.junit.Assert.*;
import org.junit.Test;
import org.ysc.calculator.mapping.ConversionMap;
import org.ysc.calculator.mapping.ESportsConversionMap;
import org.ysc.calculator.model.Stats;
public class CalculatorEsportsTest {
private static final double DELTA = .000000001;// For assertEquals delta
// value
private ConversionMap conversionMap = new ESportsConversionMap();
@Test
public void testCalculateEmpty() {
Calculator calculator = new Calculator(conversionMap, new Stats());
assertEquals(0.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateKills() {
Stats stats = new Stats();
stats.setK(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(2.0, calculator.calcluate(), DELTA);
stats.setK(10);
assertEquals(20.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateDeaths() {
Stats stats = new Stats();
stats.setD(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(-.5, calculator.calcluate(), DELTA);
stats.setD(10);
assertEquals(-5.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateAssists() {
Stats stats = new Stats();
stats.setA(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(1.5, calculator.calcluate(), DELTA);
stats.setA(10);
assertEquals(15.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateCs() {
Stats stats = new Stats();
stats.setCs(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(.01, calculator.calcluate(), DELTA);
stats.setCs(10);
assertEquals(.1, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateKa10() {
Stats stats = new Stats();
stats.setKa10(false);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(0, calculator.calcluate(), DELTA);
stats.setKa10(true);
assertEquals(2.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateTriple() {
Stats stats = new Stats();
stats.setTriple(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(2.0, calculator.calcluate(), DELTA);
stats.setTriple(10);
assertEquals(20.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateQuadra() {
Stats stats = new Stats();
stats.setQuadra(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(5.0, calculator.calcluate(), DELTA);
stats.setQuadra(10);
assertEquals(50.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculatePenta() {
Stats stats = new Stats();
stats.setPenta(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(10.0, calculator.calcluate(), DELTA);
stats.setPenta(10);
assertEquals(100.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateTurret() {
Stats stats = new Stats();
stats.setTurret(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(1.0, calculator.calcluate(), DELTA);
stats.setTurret(10);
assertEquals(10.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateDragon() {
Stats stats = new Stats();
stats.setDragon(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(1.0, calculator.calcluate(), DELTA);
stats.setDragon(10);
assertEquals(10.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateBaron() {
Stats stats = new Stats();
stats.setBaron(1);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(2.0, calculator.calcluate(), DELTA);
stats.setBaron(10);
assertEquals(20.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateWin() {
Stats stats = new Stats();
stats.setWin(false);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(0.0, calculator.calcluate(), DELTA);
stats.setWin(true);
assertEquals(2.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateWin30() {
Stats stats = new Stats();
stats.setWin30(false);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(0, calculator.calcluate(), DELTA);
stats.setWin30(true);
assertEquals(2.0, calculator.calcluate(), DELTA);
}
@Test
public void testCalculateFB() {
Stats stats = new Stats();
stats.setFb(false);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(0, calculator.calcluate(), DELTA);
stats.setFb(true);
assertEquals(2.0, calculator.calcluate(), DELTA);
}
/*
* Data from Froggen
* http://matchhistory.na.leagueoflegends.com/en/#match-details/TRLH1/
* 1001520119?gameHash=44d0e53ce9d31537&tab=overview
*/
@Test
public void testCalculatePlayerStats() {
Stats stats = new Stats();
stats.setKDA(3, 2, 7);
stats.setCs(324);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(18.74, calculator.calcluate(), DELTA);
}
/*
* Data from Echo Fox
* http://matchhistory.na.leagueoflegends.com/en/#match-details/TRLH1/
* 1001520119?gameHash=44d0e53ce9d31537&tab=overview
*/
@Test
public void testCalculateTeamStats() {
Stats stats = new Stats();
stats.setTurret(9);
stats.setDragon(2);
stats.setBaron(1);
stats.setWin(true);
stats.setWin30(false);
stats.setFb(true);
Calculator calculator = new Calculator(conversionMap, stats);
assertEquals(17.00, calculator.calcluate(), DELTA);
}
}
| [
"felicianomrg@gmail.com"
] | felicianomrg@gmail.com |
147f9a0d3e870a5440159489fa73e2ed7bee4c99 | f30c4e1373fea7eac19ed58ab812e98be69212e0 | /authentication-service/src/test/java/com/springboot/microservices/authenticationservice/AuthenticationServiceApplicationTests.java | 37b860218de661b2e084347a64ee62c18baba2f5 | [] | no_license | bssathish86/springboottasks | ce58bd9e128aa2b5334e8c5b257e61fa0cfbb55e | 727ec3de0744c064685f900a05c29ea73fff7863 | refs/heads/master | 2022-07-08T11:47:40.114741 | 2019-11-22T12:44:11 | 2019-11-22T12:44:11 | 223,370,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package com.springboot.microservices.authenticationservice;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.springboot.microservices.authenticationservice.utils.AuthenticatorUtils;
import com.springboot.microservices.authenticationservice.utils.EmailProcessor;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = AuthenticationServiceApplication.class)
class AuthenticationServiceApplicationTests {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private EmailProcessor processor;
@Autowired
private AuthenticatorUtils utils;
@Test
void contextLoads() {
long loginId = utils.randomNumberGenerator();
logger.info("Random Number : " + loginId);
String strPwd = utils.randomPasswordGenerator();
logger.info("Random Password : " + strPwd);
processor.sendMail(loginId, "sathishkumar_s@persistent.com", strPwd);
}
}
| [
"sathishkumar_s@persistent.com"
] | sathishkumar_s@persistent.com |
476332c8bf36305db25979871045e18bcb61a5ce | 1065791a5c2a59b478c73aad0a04ce86f92f5577 | /Costestimator/src/costestimatorTest.java | 640cbb200795097301c295bf0b5382c045a1dc78 | [] | no_license | sravyadatla123/task2 | 22430dd56e4f06fb53dc7291049fae43ee8e76c8 | 8abce33fef3872b03dfe63db167c3162f5c13d66 | refs/heads/master | 2020-05-01T13:57:49.551485 | 2019-03-28T14:29:40 | 2019-03-28T14:29:40 | 177,506,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class costestimatorTest {
@Test
void costestimatorTest() {
costestimator c=new costestimator();
assertEquals(2500,c.costestimator(2,true,1));
assertEquals(1800,c.costestimator(2, false, 1));
}
}
| [
"sravya.datla123@gmail.com"
] | sravya.datla123@gmail.com |
b3fb9d79f3ffd9b347300e2d6039333e8695ee87 | 997d49e8e75e6d5d7e89e7f7b76d08d396354653 | /tests/com/dhiva/problems_a/SubsetRecursionTest.java | 3fca64b0965bc36d61b1a533cc0ce36d4c0b0219 | [] | no_license | dhivashini/Interview | d180dd6fd739ebb819aa7da887710d439a32c253 | 3e56f940047f27fff9aa862e013c7666bc835b79 | refs/heads/master | 2020-04-10T22:48:40.568654 | 2017-06-12T01:20:03 | 2017-06-12T01:20:03 | 68,260,177 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.dhiva.problems_a;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
public class SubsetRecursionTest {
@Test
public void test(){
List<String> output = SubsetOfASetRecursion.findSubset("abc");
System.out.println(output);
}
}
| [
"dhivashini.jaganathan@sjsu.edu"
] | dhivashini.jaganathan@sjsu.edu |
936ed3b18704ede61d53a4b4f5f4c4d4e57cd81f | 7ea7bf80672a2b5a249109ef147239c261bde5c0 | /app/src/main/java/com/wong/myvolley/CellPhone.java | 3f6ff38559cdf7ba3204d95520a99d1a0d9e2904 | [] | no_license | wongkyunban/MyVolley | 206481664c9a510832ea4a0a1601ecb069545371 | 8153a612e580394f16004e21737e8871b0dce678 | refs/heads/master | 2021-01-24T02:17:23.836605 | 2018-02-25T14:40:33 | 2018-02-25T14:40:33 | 122,833,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package com.wong.myvolley;
/**
* Created by wong on 18-2-25.
*/
public class CellPhone {
private String province; //省
private String city;//市
private String areacode;//区号
private String zip;//邮编
private String company;//运营商
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAreacode() {
return areacode;
}
public void setAreacode(String areacode) {
this.areacode = areacode;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
}
| [
"wongkyunban@sina.com"
] | wongkyunban@sina.com |
a214819f9a1b83ffd9f8d416ca146f4426cf5c54 | 9e5a48161146d4ca9bc45963be3ed7d1c719ec7b | /src/main/java/sample/ConnectionUtil.java | 81184c1de74bd97b6bb5c31273c9a3e0b1d40ced | [] | no_license | subashchandarA/Java | c18006fb55a141e8955b3910ed28f8a61e11cf14 | 4d3db1f31557f11837210762d50954e9eac640a4 | refs/heads/master | 2020-12-30T14:20:03.770711 | 2017-05-15T11:42:13 | 2017-05-15T11:42:13 | 91,311,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package sample;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionUtil {
public static Connection connectDB() throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.cj.jdbc.Driver");
String url = "jdbc:mysql://35.154.162.204:3337/subash_db";
String username = "subash";
String password = "subash";
Connection con = DriverManager.getConnection(url, username, password);
System.out.println(con);
return (con);
}
}
| [
"subashchandar@gmail.com"
] | subashchandar@gmail.com |
07ca243d0915943ec423d4e1fffcc5919e0a4b37 | 8061df77dffb1f04893c6eb2bbf6e83237f74f42 | /src/main/java/chapter6/dao/PlainSingerDao.java | cc815df866e5febc623b47c8845f2ac552f0c9ca | [] | no_license | janjelonek/ProSpring5Book | 723cf214dcc1f2c2866ffcb2c52e4c679c9d2939 | 8f7ec408d648054a1993ec5b6e9ac71d69ccaf34 | refs/heads/master | 2021-04-30T07:18:38.081662 | 2018-02-13T22:17:58 | 2018-02-13T22:17:58 | 121,391,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,363 | 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 chapter6.dao;
import chapter6.entities.Singer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Janek
*/
public class PlainSingerDao implements SingerDao {
private static Logger logger = LoggerFactory.getLogger(PlainSingerDao.class);
static {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException ex) {
logger.error("Problem loading DB driver", ex);
}
}
private Connection getConnection() throws SQLException {
return DriverManager.getConnection(
"jdbc:mysql://localhost:3306/musicdb?useSSL=true",
"prospring5", "prospring5");
}
private void closeConnection(Connection connection) {
if (connection == null) {
return;
}
try {
connection.close();
} catch (SQLException ex) {
logger.error("Problem closing connection to the database!", ex);
}
}
@Override
public List<Singer> findAll() {
List<Singer> result = new ArrayList<>();
Connection connection = null;
try {
connection = getConnection();
PreparedStatement statement =
connection.prepareStatement("select * from singer");
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
Singer singer = new Singer();
singer.setId(resultSet.getLong("id"));
singer.setFirstName(resultSet.getString("first_name"));
singer.setLastName(resultSet.getString("last_name"));
singer.setBirthDate(resultSet.getDate("birth_date"));
result.add(singer);
}
statement.close();
} catch (SQLException ex) {
logger.error("Problem when executing SELECT", ex);
} finally {
closeConnection(connection);
}
return result;
}
@Override
public List<Singer> findByFirstName(String firstName) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String findLastNameById(Long id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String findFirstNameById(Long id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void insert(Singer singer) {
Connection connection = null;
try {
connection = getConnection();
PreparedStatement statement = connection.prepareStatement(
"insert into Singer (first_name, last_name, birth_date) "
+ "values (?, ?, ?)",
Statement.RETURN_GENERATED_KEYS);
statement.setString(1, singer.getFirstName());
statement.setString(2, singer.getLastName());
statement.setDate(3, singer.getBirthDate());
statement.execute();
ResultSet generatedKeys = statement.getGeneratedKeys();
if (generatedKeys.next()) {
singer.setId(generatedKeys.getLong(1));
}
statement.close();
} catch (SQLException ex) {
logger.error("Problem executing INSERT", ex);
} finally {
closeConnection(connection);
}
}
@Override
public void update(Singer singer) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void delete(Long singerId) {
Connection connection = null;
try {
connection = getConnection();
PreparedStatement statement = connection.prepareStatement(
"delete from singer where id = ?");
statement.setLong(1, singerId);
statement.execute();
statement.close();
} catch (SQLException ex) {
logger.error("Problem executing DELETE", ex);
} finally {
closeConnection(connection);
}
}
@Override
public List<Singer> findAllWithDetail() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void insertWithDetail(Singer singer) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"jelon94@gmail.com"
] | jelon94@gmail.com |
e5335b5b82ed1ed339a008fd5905b16ef39abdc2 | 38ca8e46701da32810670184d6ac211b28ebb952 | /src/com/aquarius/simple/network/Request.java | 009e7c0128248b7ed2dce7666ff390784f513100 | [] | no_license | aquarius520/SimpleNetwork | ad5084505aa0c534f5e9fb853d1d4735c1ec7b81 | bce88f3d662210e4ccf1cda04963e1af81cb7048 | refs/heads/master | 2021-07-22T21:27:51.968541 | 2017-10-30T05:12:10 | 2017-10-30T05:12:10 | 108,714,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,241 | java | package com.aquarius.simple.network;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.Map;
/**
* Created by aquarius on 2017/10/28.
*/
public class Request{
/**
* post和get 默认的参数编码
*/
private static final String DEFAULT_PARAMS_ENCODING = "UTF-8";
private static final long DEFAULT_TIMEOUT_MS = 5000;
/** 请求方法 */
private int mMethod;
/** 参数编码 */
private String mParamEncoding;
/** 超时时间 */
private long mTimeOutMs;
/** 请求url */
private String mUrl;
/** 重定向的url */
private String mRedirectUrl;
/*** 请求头部信息 */
private Map<String, String> mHeaders;
/*** 请求头部信息 */
private Map<String, String> mParams;
private RetryPolicy mRetryPolicy;
public Request(int method, String url) {
this.mMethod = method;
this.mUrl = url;
}
public interface Method {
/* public static final*/ int DEPRECATED_GET_OR_POST = -1 ;
int GET = 0;
int POST = 1;
int PUT = 2;
int DELETE = 3;
int HEAD = 4;
int OPTIONS = 5;
int TRACE = 6;
int PATCH = 7;
}
public int getMethod() {
return mMethod;
}
public String getUrl() {
return mUrl;
}
public String getRedirectUrl() {
return mRedirectUrl;
}
public String getParamEncoding() {
return mParamEncoding == null ? DEFAULT_PARAMS_ENCODING : mParamEncoding;
}
public Map<String, String> getHeaders() {
return mHeaders;
}
public Map<String, String> getParams() {
return mParams;
}
public long getTimeOutMs() {
if (mRetryPolicy != null) {
return mRetryPolicy.getCurrentTimeout();
}
return mTimeOutMs == 0 ? DEFAULT_TIMEOUT_MS : mTimeOutMs;
}
public RetryPolicy getRetryPolicy() {
return mRetryPolicy;
}
public void setUrl(String url) {
this.mUrl = url;
}
public void setRedirectUrl(String url) {
this.mRedirectUrl = url;
}
public Request setTimeOutMs(long mTimeOutMs) {
this.mTimeOutMs = mTimeOutMs;
return this;
}
public Request setRetryPolicy(RetryPolicy mRetryPolicy) {
this.mRetryPolicy = mRetryPolicy;
return this;
}
public Request setHeaders(Map<String, String> header) {
if (header == null || header.size() == 0) {
mHeaders = Collections.emptyMap();
}else {
mHeaders = header;
}
return this;
}
public Request setParams(Map<String, String> params) {
if (params == null || params.size() == 0) {
mParams = Collections.emptyMap();
} else {
mParams = params;
// 如果是GET方法,但是却设置了参数,自动将查询参数拼接到url上
if (mMethod == Method.GET) {
String querySuffix = fillCompleteRequestSuffix(params);
setUrl(mUrl + querySuffix);
}
}
return this;
}
private String fillCompleteRequestSuffix(Map<String, String> params){
if (params == null || params.size() == 0) {
return "";
}
StringBuilder builder = new StringBuilder();
try {
builder.append("?");
for (String key : params.keySet()) {
builder.append(URLEncoder.encode(key, getParamEncoding()))
.append("=")
.append(URLEncoder.encode(params.get(key), getParamEncoding()))
.append("&");
}
String query = builder.toString();
int lastIndex = query.lastIndexOf("&");
return query.substring(0, lastIndex);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public Request setParamEncoding(String encoding) {
if (encoding == null || encoding.length() == 0) {
mParamEncoding = DEFAULT_PARAMS_ENCODING;
} else {
mParamEncoding = encoding;
}
return this;
}
public String getBodyContentType() {
return "application/x-www-form-urlencoded;charset=" + getParamEncoding();
}
public byte[] getBody() {
return getPostBody();
}
public byte[] getPostBody() {
Map<String, String> postParams = getParams();
if (postParams != null && postParams.size() > 0) {
return encodeParameters(postParams, getParamEncoding());
}
return null;
}
private byte[] encodeParameters(Map<String, String> params, String encoding) {
StringBuilder builder = new StringBuilder();
try {
for (Map.Entry<String, String> entry : params.entrySet()) {
builder.append(URLEncoder.encode(entry.getKey(), encoding))
.append("=")
.append(URLEncoder.encode(entry.getValue(), encoding))
.append("&");
}
return builder.toString().getBytes(encoding);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Encoding not supported : " + encoding, e);
}
}
/*
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Request request = (Request) o;
if (mMethod != request.mMethod) return false;
if (!mUrl.equals(request.mUrl)) return false;
if (mHeaders != null ? !mHeaders.equals(request.mHeaders) : request.mHeaders != null) return false;
return mParams != null ? mParams.equals(request.mParams) : request.mParams == null;
}
@Override
public int hashCode() {
int result = mMethod;
result = 31 * result + mUrl.hashCode();
result = 31 * result + (mHeaders != null ? mHeaders.hashCode() : 0);
result = 31 * result + (mParams != null ? mParams.hashCode() : 0);
return result;
}
*/
}
| [
"mengyuan0914@qq.com"
] | mengyuan0914@qq.com |
efd9c75099224a3246c6977813f18fddc5e9caab | 74e53dbe7a821d6e31bbbc6e7394b88b79490c22 | /src/main/java/com/kafka/Application.java | 3685461674bd66be4d450a00a7e4e33607d49713 | [] | no_license | rasel-machette/es.spring.kafka.consumer | 1de8f2ac7712fe804172008f7b79ff8da1709daf | 4a95e330657686b320c6c229ca01fb7ad71d1d93 | refs/heads/main | 2023-08-27T05:50:44.912809 | 2021-09-24T17:35:04 | 2021-09-24T17:35:04 | 410,049,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.kafka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"md.rasel@machette.tech"
] | md.rasel@machette.tech |
4e43798bfa339284b2c851c0123e24b77ed6741c | d3ce9b0350c32ae0c49b7614c0221e7282b4f38c | /src/com/teachers/nsc/TeachersLoginServlet.java | cd21f88c34773bb9f87e8cb25bbf2cc4b258056d | [] | no_license | nandun95/LMS | cdd1fef66540864caf0e7d5eb63ff586a322266a | 2e8dca4751d508aea10b2f6e2490e06c6c49772d | refs/heads/master | 2022-12-14T14:26:01.432224 | 2020-09-20T13:50:39 | 2020-09-20T13:50:39 | 297,086,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,397 | java | package com.teachers.nsc;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@WebServlet("/TeachersLoginServlet")
public class TeachersLoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private TeachersLoginDao teachersLoginDao;
public void init()
{
teachersLoginDao = new TeachersLoginDao();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String username = request.getParameter("username");
String password = request.getParameter("password");
TeachersLoginBean teachersLoginBean = new TeachersLoginBean();
teachersLoginBean.setUsername(username);
teachersLoginBean.setPassword(password);
try {
if (teachersLoginDao.Login(teachersLoginBean))
{
HttpSession session = request.getSession();
session.setAttribute("teacherUsername", username);
session.setAttribute("password", password);
response.sendRedirect("add.jsp");
}
else {
response.sendRedirect("teachers-login.jsp");
}
} catch (ClassNotFoundException|IOException e) {
e.printStackTrace();
}
}
}
| [
"chamodyakumarasinghe@gmail.com"
] | chamodyakumarasinghe@gmail.com |
4347492e9f7e0a8cade78b62a6a4f485d7443a2a | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_JFileChooser_getVetoableChangeListeners.java | c4788249114009a4879b4549e7df84d7f137abde | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | class javax_swing_JFileChooser_getVetoableChangeListeners{ public static void function() {javax.swing.JFileChooser obj = new javax.swing.JFileChooser();obj.getVetoableChangeListeners();}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
2036249289759dbc7da7fc5cbd81da2d27a89c3b | 073e109545bdf44a0c510f2679b75c1f0660f867 | /integration-test/src/test/java/test/pivotal/pal/tracker/support/ApplicationServer.java | 0964cefb9ec113b2f0007f169c9d3767a43f0020 | [] | no_license | WiproRavi/pal-tracker-distributed | baf3b5d1ed43a47b045e4cb452552619a6a2c02b | b752d7a33a51571d79f5810f8f169da2b57680d1 | refs/heads/master | 2020-05-25T22:26:32.374346 | 2019-05-24T11:24:33 | 2019-05-24T11:24:33 | 188,015,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,735 | java | package test.pivotal.pal.tracker.support;
import java.io.IOException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Map;
import static org.assertj.core.api.Assertions.fail;
import static test.pivotal.pal.tracker.support.MapBuilder.envMapBuilder;
public class ApplicationServer {
private final String jarPath;
private final String port;
private Process serverProcess;
public ApplicationServer(String jarPath, String port) {
this.jarPath = jarPath;
this.port = port;
}
public void start(Map<String, String> env) throws IOException, InterruptedException {
ProcessBuilder processBuilder = new ProcessBuilder()
.command("java", "-jar", jarPath)
.inheritIO();
processBuilder.environment().put("SERVER_PORT", port);
env.forEach((key, value) -> processBuilder.environment().put(key, value));
serverProcess = processBuilder.start();
}
public void startWithDatabaseName(String dbName) throws IOException, InterruptedException {
String dbUrl = "jdbc:mysql://localhost:3306/" + dbName + "?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false";
start(envMapBuilder()
.put("SPRING_DATASOURCE_URL", dbUrl)
.put("EUREKA_CLIENT_ENABLED", "false")
.put("RIBBON_EUREKA_ENABLED", "false")
.put("REGISTRATION_SERVER_RIBBON_LISTOFSERVERS", "http://localhost:8883")
.put("APPLICATION_OAUTH_ENABLED", "false")
.put("REGISTRATION_SERVER_ENDPOINT", "http://registration-server")
.build()
);
}
public void stop() {
serverProcess.destroyForcibly();
}
public static void waitOnPorts(String... ports) throws InterruptedException {
for (String port : ports) waitUntilServerIsUp(port);
}
private static void waitUntilServerIsUp(String port) throws InterruptedException {
HttpClient httpClient = new HttpClient();
int timeout = 120;
Instant start = Instant.now();
boolean isUp = false;
System.out.print("Waiting on port " + port + "...");
while (!isUp) {
try {
httpClient.get("http://localhost:" + port);
isUp = true;
System.out.println(" server is up.");
} catch (Throwable e) {
long timeSpent = ChronoUnit.SECONDS.between(start, Instant.now());
if (timeSpent > timeout) {
fail("Timed out waiting for server on port " + port);
}
System.out.print(".");
Thread.sleep(200);
}
}
}
}
| [
"ravi.kiran30@wipro.com"
] | ravi.kiran30@wipro.com |
8c6538483e2144933030557fea143aa7fc43bea7 | 13c0ca6ce52eb6475174e22ca1d687e5d0f03a7c | /25/com/ats/hrmgt/repo/report/LoanStatementRepo.java | 0c4124133faa9cd7592db450fdbb83cef556b28d | [] | no_license | MicroRefact/HrEsayWebApiPuneMs | b950fd802fc971b8aaa626905fd5ed37a4dc1c43 | 76653b5d5c3c58809fe91130d036305d64ffe8d0 | refs/heads/main | 2023-04-28T20:15:43.128701 | 2021-05-26T02:32:30 | 2021-05-26T02:32:30 | 370,884,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,359 | java | import com.ats.hrmgt.model.report.LoanStatementDetailsReport;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface LoanStatementRepo extends JpaRepository<LoanStatementDetailsReport, Integer> {
@Query(value = "SELECT DISTINCT\n" + " te.emp_id,\n" + " te.emp_code,\n" + " CONCAT(\n" + " te.first_name,\n" + " ' ',\n" + " te.middle_name,\n" + " ' ',\n" + " te.surname\n" + " ) AS emp_name,\n" + " tlm.loan_appl_no,\n" + " tlm.loan_amt,\n" + " tlm.loan_add_date,\n" + " tlm.current_outstanding,\n" + " tlm.current_totpaid,\n" + " tlm.loan_emi_intrest,\n" + " tlm.loan_emi,\n" + " tlm.id,\n" + " DATE_FORMAT(tlm.loan_repay_start, '%d-%m-%Y') AS loan_repay_start,\n" + " DATE_FORMAT(tlm.loan_repay_end, '%d-%m-%Y') AS loan_repay_end\n" + "FROM\n" + " m_employees AS te\n" + "INNER JOIN tbl_loan_main AS tlm\n" + "ON\n" + " te.emp_id = tlm.emp_id\n" + "WHERE\n" + " te.emp_id = :empId AND tlm.loan_repay_start BETWEEN :newfromDate AND LAST_DAY(:newToDate)", nativeQuery = true)
public List<LoanStatementDetailsReport> getEmpLoanStateDetailsByEmpId(String newfromDate,String newToDate,int empId)
@Query(value = "SELECT DISTINCT\n" + " te.emp_id,\n" + " te.emp_code,\n" + " CONCAT(\n" + " te.first_name,\n" + " ' ',\n" + " te.middle_name,\n" + " ' ',\n" + " te.surname\n" + " ) AS emp_name,\n" + " tlm.loan_appl_no,\n" + " tlm.loan_amt,\n" + " tlm.loan_add_date,\n" + " tlm.current_outstanding,\n" + " tlm.current_totpaid,\n" + " tlm.loan_emi_intrest,\n" + " tlm.loan_emi,\n" + " tlm.id,\n" + " DATE_FORMAT(tlm.loan_repay_start, '%d-%m-%Y') AS loan_repay_start,\n" + " DATE_FORMAT(tlm.loan_repay_end, '%d-%m-%Y') AS loan_repay_end\n" + "FROM\n" + " m_employees AS te\n" + "INNER JOIN tbl_loan_main AS tlm\n" + "ON\n" + " te.emp_id = tlm.emp_id\n" + "WHERE\n" + " tlm.loan_repay_start BETWEEN :fromDate AND :toDate and te.location_id=:locId", nativeQuery = true)
public List<LoanStatementDetailsReport> getEmpLoanStateDetails(int locId,String fromDate,String toDate)
} | [
"a81580@alunos.uminho.pt"
] | a81580@alunos.uminho.pt |
5730dd3cfe66f710abbf0208b1aec0e524b6e7b5 | 4ab1f1db53ef65b6130fedc25da82ff2ff5d7f9a | /schBusMIS/src/main/java/com/jeecg/basstudent/entity/BasFenceremoteEntity.java | 3dcb6a1747d73ac7931dd04b33e9d09e39aafef4 | [] | no_license | rubymatlab/schBusMIS | f0375fa0b6691b2d8f2427827292a3dfba5c3509 | 5addc8442a3461e67f59136ead21b71169cf793a | refs/heads/master | 2022-12-25T10:02:02.357131 | 2019-09-23T07:33:21 | 2019-09-23T07:33:21 | 152,759,946 | 1 | 0 | null | 2022-12-16T04:24:46 | 2018-10-12T14:08:28 | JavaScript | UTF-8 | Java | false | false | 7,946 | java | package com.jeecg.basstudent.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description: 远程电子围栏信息
* @author onlineGenerator
* @date 2019-06-18 21:56:33
* @version V1.0
*
*/
@Entity
@Table(name = "bas_fenceremote", schema = "")
@SuppressWarnings("serial")
public class BasFenceremoteEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**设备ID*/
@Excel(name="设备ID",width=15)
private java.lang.String deviceid;
/**围栏ID*/
@Excel(name="围栏ID",width=15)
private java.lang.String fenceid;
/**围栏名称*/
@Excel(name="围栏名称",width=15)
private java.lang.String fencename;
/**ID*/
@Excel(name="ID",width=15)
private java.lang.String id1;
/**围栏图片*/
@Excel(name="围栏图片",width=15)
private java.lang.String img;
/**纬度*/
@Excel(name="纬度",width=15)
private java.lang.String la;
/**经度*/
@Excel(name="经度",width=15)
private java.lang.String lo;
/**半径*/
@Excel(name="半径",width=15)
private java.lang.String r;
/**开关*/
@Excel(name="开关",width=15)
private java.lang.String switchtag;
/**创建人名称*/
private java.lang.String createName;
/**创建人登录名称*/
private java.lang.String createBy;
/**创建日期*/
private java.util.Date createDate;
/**更新人名称*/
private java.lang.String updateName;
/**更新人登录名称*/
private java.lang.String updateBy;
/**更新日期*/
private java.util.Date updateDate;
/**
*方法: 取得java.lang.String
*@return: java.lang.String 主键
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 主键
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 设备ID
*/
@Column(name ="DEVICEID",nullable=true,length=50)
public java.lang.String getDeviceid(){
return this.deviceid;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 设备ID
*/
public void setDeviceid(java.lang.String deviceid){
this.deviceid = deviceid;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 围栏ID
*/
@Column(name ="FENCEID",nullable=true,length=32)
public java.lang.String getFenceid(){
return this.fenceid;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 围栏ID
*/
public void setFenceid(java.lang.String fenceid){
this.fenceid = fenceid;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 围栏名称
*/
@Column(name ="FENCENAME",nullable=true,length=32)
public java.lang.String getFencename(){
return this.fencename;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 围栏名称
*/
public void setFencename(java.lang.String fencename){
this.fencename = fencename;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String ID
*/
@Column(name ="ID1",nullable=true,length=32)
public java.lang.String getId1(){
return this.id1;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String ID
*/
public void setId1(java.lang.String id1){
this.id1 = id1;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 围栏图片
*/
@Column(name ="IMG",nullable=true,length=32)
public java.lang.String getImg(){
return this.img;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 围栏图片
*/
public void setImg(java.lang.String img){
this.img = img;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 纬度
*/
@Column(name ="LA",nullable=true,length=32)
public java.lang.String getLa(){
return this.la;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 纬度
*/
public void setLa(java.lang.String la){
this.la = la;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 经度
*/
@Column(name ="LO",nullable=true,length=32)
public java.lang.String getLo(){
return this.lo;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 经度
*/
public void setLo(java.lang.String lo){
this.lo = lo;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 半径
*/
@Column(name ="R",nullable=true,length=32)
public java.lang.String getR(){
return this.r;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 半径
*/
public void setR(java.lang.String r){
this.r = r;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 开关
*/
@Column(name ="SWITCHTAG",nullable=true,length=32)
public java.lang.String getSwitchtag(){
return this.switchtag;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 开关
*/
public void setSwitchtag(java.lang.String switchtag){
this.switchtag = switchtag;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 创建人名称
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public java.lang.String getCreateName(){
return this.createName;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 创建人名称
*/
public void setCreateName(java.lang.String createName){
this.createName = createName;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 创建人登录名称
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public java.lang.String getCreateBy(){
return this.createBy;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 创建人登录名称
*/
public void setCreateBy(java.lang.String createBy){
this.createBy = createBy;
}
/**
*方法: 取得java.util.Date
*@return: java.util.Date 创建日期
*/
@Column(name ="CREATE_DATE",nullable=true,length=20)
public java.util.Date getCreateDate(){
return this.createDate;
}
/**
*方法: 设置java.util.Date
*@param: java.util.Date 创建日期
*/
public void setCreateDate(java.util.Date createDate){
this.createDate = createDate;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 更新人名称
*/
@Column(name ="UPDATE_NAME",nullable=true,length=50)
public java.lang.String getUpdateName(){
return this.updateName;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 更新人名称
*/
public void setUpdateName(java.lang.String updateName){
this.updateName = updateName;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 更新人登录名称
*/
@Column(name ="UPDATE_BY",nullable=true,length=50)
public java.lang.String getUpdateBy(){
return this.updateBy;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 更新人登录名称
*/
public void setUpdateBy(java.lang.String updateBy){
this.updateBy = updateBy;
}
/**
*方法: 取得java.util.Date
*@return: java.util.Date 更新日期
*/
@Column(name ="UPDATE_DATE",nullable=true,length=20)
public java.util.Date getUpdateDate(){
return this.updateDate;
}
/**
*方法: 设置java.util.Date
*@param: java.util.Date 更新日期
*/
public void setUpdateDate(java.util.Date updateDate){
this.updateDate = updateDate;
}
}
| [
"rubymatlab@gmail.com"
] | rubymatlab@gmail.com |
6e87c78c3cd59834733c0b54c7a1050f0e387d6a | 384c09f2374755985852a7bb6d873fe5c7bac6bd | /src/com/technology/po/Unitknowledge.java | cf472a6bc793cfc252ed406f7efbbe7a5d6f27df | [] | no_license | shiliang1027/technology | 75aec52527e6e19a776653d0e6b6b884e3b96c30 | ebbdbf99217917a75dfa80c934d88b78c16d1466 | refs/heads/master | 2021-01-13T05:23:53.315205 | 2017-02-09T04:26:32 | 2017-02-09T04:26:32 | 81,409,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,478 | java | package com.technology.po;
/**
* Unitknowledge entity. @author MyEclipse Persistence Tools
*/
public class Unitknowledge implements java.io.Serializable {
// Fields
private Integer id;
private Integer unitid;
private Integer prepatent;
private Integer realpatent;
private Integer validpatent;
private Integer preinvent;
private Integer realinvent;
private Integer preutility;
private Integer realutility;
private Integer softcopy;
private Integer prepatent3;
private Integer realpatent3;
private Integer preinvent3;
private Integer realinvent3;
private Integer preutility3;
private Integer realutility3;
private Integer softcopy3;
private String knownote;
private Integer papersum;
private Integer scisum;
private Integer magsum;
private Integer patentid;
private String managepatent;
// Constructors
/** default constructor */
public Unitknowledge() {
}
/** minimal constructor */
public Unitknowledge(Integer unitid) {
this.unitid = unitid;
}
/** full constructor */
public Unitknowledge(Integer unitid, Integer prepatent, Integer realpatent,
Integer validpatent, Integer preinvent, Integer realinvent,
Integer preutility, Integer realutility, Integer softcopy,
Integer prepatent3, Integer realpatent3, Integer preinvent3,
Integer realinvent3, Integer preutility3, Integer realutility3,
Integer softcopy3, String knownote, Integer papersum,
Integer scisum, Integer magsum, Integer patentid,
String managepatent) {
this.unitid = unitid;
this.prepatent = prepatent;
this.realpatent = realpatent;
this.validpatent = validpatent;
this.preinvent = preinvent;
this.realinvent = realinvent;
this.preutility = preutility;
this.realutility = realutility;
this.softcopy = softcopy;
this.prepatent3 = prepatent3;
this.realpatent3 = realpatent3;
this.preinvent3 = preinvent3;
this.realinvent3 = realinvent3;
this.preutility3 = preutility3;
this.realutility3 = realutility3;
this.softcopy3 = softcopy3;
this.knownote = knownote;
this.papersum = papersum;
this.scisum = scisum;
this.magsum = magsum;
this.patentid = patentid;
this.managepatent = managepatent;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUnitid() {
return this.unitid;
}
public void setUnitid(Integer unitid) {
this.unitid = unitid;
}
public Integer getPrepatent() {
return this.prepatent;
}
public void setPrepatent(Integer prepatent) {
this.prepatent = prepatent;
}
public Integer getRealpatent() {
return this.realpatent;
}
public void setRealpatent(Integer realpatent) {
this.realpatent = realpatent;
}
public Integer getValidpatent() {
return this.validpatent;
}
public void setValidpatent(Integer validpatent) {
this.validpatent = validpatent;
}
public Integer getPreinvent() {
return this.preinvent;
}
public void setPreinvent(Integer preinvent) {
this.preinvent = preinvent;
}
public Integer getRealinvent() {
return this.realinvent;
}
public void setRealinvent(Integer realinvent) {
this.realinvent = realinvent;
}
public Integer getPreutility() {
return this.preutility;
}
public void setPreutility(Integer preutility) {
this.preutility = preutility;
}
public Integer getRealutility() {
return this.realutility;
}
public void setRealutility(Integer realutility) {
this.realutility = realutility;
}
public Integer getSoftcopy() {
return this.softcopy;
}
public void setSoftcopy(Integer softcopy) {
this.softcopy = softcopy;
}
public Integer getPrepatent3() {
return this.prepatent3;
}
public void setPrepatent3(Integer prepatent3) {
this.prepatent3 = prepatent3;
}
public Integer getRealpatent3() {
return this.realpatent3;
}
public void setRealpatent3(Integer realpatent3) {
this.realpatent3 = realpatent3;
}
public Integer getPreinvent3() {
return this.preinvent3;
}
public void setPreinvent3(Integer preinvent3) {
this.preinvent3 = preinvent3;
}
public Integer getRealinvent3() {
return this.realinvent3;
}
public void setRealinvent3(Integer realinvent3) {
this.realinvent3 = realinvent3;
}
public Integer getPreutility3() {
return this.preutility3;
}
public void setPreutility3(Integer preutility3) {
this.preutility3 = preutility3;
}
public Integer getRealutility3() {
return this.realutility3;
}
public void setRealutility3(Integer realutility3) {
this.realutility3 = realutility3;
}
public Integer getSoftcopy3() {
return this.softcopy3;
}
public void setSoftcopy3(Integer softcopy3) {
this.softcopy3 = softcopy3;
}
public String getKnownote() {
return this.knownote;
}
public void setKnownote(String knownote) {
this.knownote = knownote;
}
public Integer getPapersum() {
return this.papersum;
}
public void setPapersum(Integer papersum) {
this.papersum = papersum;
}
public Integer getScisum() {
return this.scisum;
}
public void setScisum(Integer scisum) {
this.scisum = scisum;
}
public Integer getMagsum() {
return this.magsum;
}
public void setMagsum(Integer magsum) {
this.magsum = magsum;
}
public Integer getPatentid() {
return this.patentid;
}
public void setPatentid(Integer patentid) {
this.patentid = patentid;
}
public String getManagepatent() {
return this.managepatent;
}
public void setManagepatent(String managepatent) {
this.managepatent = managepatent;
}
} | [
"413907040@qq.com"
] | 413907040@qq.com |
57e59ba6ac31abacd3f7488da8e368649d93bc32 | 98d313cf373073d65f14b4870032e16e7d5466f0 | /gradle-open-labs/example/src/main/java/se/molybden/Class5865.java | 7cc80720622f2982c221673be8f8f5cd3be120ce | [] | no_license | Molybden/gradle-in-practice | 30ac1477cc248a90c50949791028bc1cb7104b28 | d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3 | refs/heads/master | 2021-06-26T16:45:54.018388 | 2016-03-06T20:19:43 | 2016-03-06T20:19:43 | 24,554,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java |
public class Class5865{
public void callMe(){
System.out.println("called");
}
}
| [
"jocce.nilsson@gmail.com"
] | jocce.nilsson@gmail.com |
e4bbeb0cdb12781b52c7e36da577f089e3f33222 | 1ac3cac96cb9414b1765d1ac721a8b1efa5c8bd2 | /sdcommons-core/src/main/java/org/sandynz/sdcommons/validation/constraintvalidators/time/future/DailyFutureValidatorForLocalDate.java | 9f1bd7e886457c04bbcb5157aec94ac3309a57ff | [
"Apache-2.0"
] | permissive | sandynz/sdcommons | 158cb1a69f4090a3acc5b2ce987e01b17a179bed | 8b0d922e6b848b6d7beb986dd4ce910a2527fc2a | refs/heads/master | 2021-05-24T07:43:24.604631 | 2020-04-06T10:11:37 | 2020-04-06T10:11:37 | 253,455,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,513 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sandynz.sdcommons.validation.constraintvalidators.time.future;
import java.time.LocalDate;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.sandynz.sdcommons.validation.constraints.DailyFuture;
/**
* Check whether the {@code java.time.LocalDate} passed to be validated is after today.
*
* @author sandynz
*/
public class DailyFutureValidatorForLocalDate implements ConstraintValidator<DailyFuture, LocalDate> {
@Override
public boolean isValid(LocalDate value, ConstraintValidatorContext context) {
if (value == null) {
return true;
}
return DailyFutureUtils.isAfterToday(value);
}
}
| [
"sandynz@126.com"
] | sandynz@126.com |
6bf702d5bdf1bdd2d9802e10ad402063f424e64e | a8af5666c57e4b6efc7efdd428fed92298161ee6 | /order/order-server/src/test/java/com/zxc/order/NormalTest.java | 99b8c0e2e96bb9663e263d66db378ca8b118ed95 | [] | no_license | a46461440/spring-cloud-all | 7e4a3938542b7b84cec91fe4c73a69045389e5bc | 5c3276da2de1f48f4583c8ea226c4c3e679ce3d5 | refs/heads/master | 2020-04-10T18:12:51.300748 | 2019-03-10T09:25:46 | 2019-03-10T09:25:46 | 161,197,525 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package com.zxc.order;
import com.zxc.product.domain.ProductInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @author Zhou RunMing
* @Date 2019-2-14
*/
public class NormalTest {
public static void main(String[] args) {
List<ProductInfo> productInfoList = null;
if (Optional.ofNullable(productInfoList).isPresent())
for (ProductInfo productInfo : productInfoList) {
System.out.println(productInfo);
}
}
}
| [
"496461440@qq.com"
] | 496461440@qq.com |
67c94d556f2ef2a296268e195dfb21dd6c736ef5 | 072d997e46c7d3bb8804d6374c121fbf32a3cba2 | /1.JavaSyntax/src/com/javarush/task/task04/task0408/Solution.java | 2388b353c8a2c961a6d7417d575d55681974c65e | [] | no_license | artncrec/JavaRushTasks | f9be27bf62b6cc9fe5b97fabeeb20f3ca401bddf | c5af3099e5233e6d5eb5f208060fe7a25a552d76 | refs/heads/master | 2021-05-14T12:29:34.257214 | 2019-03-16T17:34:33 | 2019-03-16T17:34:33 | 116,410,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.javarush.task.task04.task0408;
/*
Хорошо или плохо?
*/
public class Solution {
public static void main(String[] args) {
compare(3);
compare(6);
compare(5);
}
public static void compare(int a) {
if (a < 5)
System.out.println("Число меньше 5");
else if (a > 5)
System.out.println("Число больше 5");
else System.out.println("Число равно 5");
}
} | [
"avagyanart@yandex.ru"
] | avagyanart@yandex.ru |
75a374c21ceecf5bd78cf00a7e730935a8fb6914 | 6bc757a5266b854d8ee21fe722517751fe5d8256 | /src/util/JPAUtil.java | bf6682c2d30218c821708bf477dc47d6f2dbd9f5 | [
"Apache-2.0"
] | permissive | KayroBrasil/diario_notas | c4106cac85d1f265d606497366639da9d85df5a8 | 8945dabea065b6da433ac6386c688a5e1a255bd9 | refs/heads/master | 2020-05-27T23:58:17.029718 | 2014-02-20T12:56:37 | 2014-02-20T12:56:37 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 921 | java | package util;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class JPAUtil {
private static final EntityManagerFactory emf = Persistence
.createEntityManagerFactory("jpa-hibernate-mysql");
private static ThreadLocal<EntityManager> ems = new ThreadLocal<EntityManager>();
// Fecha o EntityManager atrelado à Thread atual e retira-o da ThreadLocal.
public static void closeCurrentEntityManager() {
EntityManager em = ems.get();
if (em != null && em.isOpen()){
em.close();
}
ems.set(null);
}
// Obtém o EntityManager vinculado à Thread atual. Se ele ainda
// não existir, é criado e depois, vinculado à Thread atual.
public static EntityManager getCurrentEntityManager() {
EntityManager em = ems.get();
if (em == null) {
em = emf.createEntityManager();
ems.set(em);
}
return em;
}
}
| [
"maximo.henri@gmail.com"
] | maximo.henri@gmail.com |
d8f42f90449344cb48b932d6bd3e423d4fbb68ca | b69e337163d94dfb16e521f288432a9ebbd52b2c | /src/com/zhy/zhy_27/T14_ParallelStream.java | 1f5b66385749a7fbcb68cca119866a051f97c13c | [] | no_license | BruceZhang0828/threads | d42761322333b6eeebf647387358111ea65a5891 | 775e03224a6a39cbcf64add7b7d11643991e4082 | refs/heads/master | 2020-04-04T16:38:43.654851 | 2018-11-20T14:17:28 | 2018-11-20T14:17:28 | 156,086,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | package com.zhy.zhy_27;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class T14_ParallelStream {
public static void main(String[] args) {
List<Integer> nums = new ArrayList<>();
Random r = new Random();
for (int i = 0; i <1000 ; i++) {
nums.add(1000000+r.nextInt(100000));
}
long start = System.currentTimeMillis();
nums.stream().forEach(i -> isPrime(i));
long end = System.currentTimeMillis();
System.out.println(end - start);
long start2 = System.currentTimeMillis();
nums.parallelStream().forEach(i->isPrime(i));
long end2 = System.currentTimeMillis();
System.out.println(end2 - start2);
}
static boolean isPrime(int n){
for (int i = 2;i<n/2;i++){
if(n%i==0){
return false;
}
}
return true;
}
}
| [
"zycool0828@163.com"
] | zycool0828@163.com |
691f215cce398c712725f1283f7b0324361ad0e3 | 1c329a40c49e41f0be47d4053fa855b8e1871fd2 | /otus_2019_06/hw10-maven/src/main/java/ru/deft/homework/hibernate/sessionmanager/DbSessionHibernate.java | e006a07e74cf81893af35b9735cd826ec4b0b555 | [] | no_license | deft1991/otus | 31b97e520b1a356f0d84de9a980b8d8d89dc2842 | 60a9a5100003f7dd996d1aa3be69f4ffac7b9ead | refs/heads/master | 2022-12-26T23:02:59.505005 | 2019-12-25T16:24:39 | 2019-12-25T16:24:39 | 141,480,663 | 0 | 0 | null | 2022-12-16T00:35:23 | 2018-07-18T19:26:46 | Java | UTF-8 | Java | false | false | 697 | java | package ru.deft.homework.hibernate.sessionmanager;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.hibernate.Session;
import org.hibernate.Transaction;
import ru.deft.homework.api.sessionmanager.DataBaseSession;
@RequiredArgsConstructor
@Getter
public class DbSessionHibernate implements DataBaseSession {
private final Session session;
private final Transaction transaction;
public DbSessionHibernate(Session session) {
this.session = session;
this.transaction = session.beginTransaction();
}
public void close() {
if (transaction.isActive()) {
transaction.commit();
}
session.close();
}
}
| [
"pt.sgolitsyn@prosper.com"
] | pt.sgolitsyn@prosper.com |
5ae657dc24ef54ec6752b3af77f01a2c1544c556 | a1cbe2d1dcd19d2d8d823356d8834e8d233081d0 | /gestor-web/src/main/java/br/com/cfc/gestor/service/ContratoServiceImpl.java | 6b0f65d5dad564e4e76749729892a0db93d24b92 | [] | no_license | leopontes/gestor-cfc | 238b34975ecf1622b4423b288c471f0665b20f63 | d8bac78e85a23e647b6f5cae52f74d2670c3f0c4 | refs/heads/master | 2021-07-15T11:02:45.141262 | 2018-11-27T01:26:12 | 2018-11-27T01:26:12 | 148,804,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package br.com.cfc.gestor.service;
import java.util.Optional;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import br.com.cfc.gestor.model.Contrato;
import br.com.cfc.gestor.repository.ContratoRepository;
@Service
public class ContratoServiceImpl implements ContratoService{
@Resource
private ContratoRepository contratoRepository;
@Override
public Iterable<Contrato> findAll() {
return contratoRepository.findAll();
}
@Override
public Optional<Contrato> get(Long id) {
return contratoRepository.findById(id);
}
@Override
public void save(Contrato contrato) {
contratoRepository.save(contrato);
}
}
| [
"lopespontesleonardo@gmail.com"
] | lopespontesleonardo@gmail.com |
112e0d7b7bf192dc5ab92589bf65d9ba168c9d39 | fb7b0eeed4bec5b2ffb51f2dbc5152baa13993a3 | /src/main/java/com/gds/admin/service/dto/CityCriteria.java | 00f7a61fa545b7cfb11ade19ad895e790e1b27bb | [] | no_license | emregozen/gdsadmin | 467b89469066a59abc24edeb67bf5ac25da1e06d | b5133b39c7401b5d6e084bdb631711034282a044 | refs/heads/master | 2020-04-09T19:30:54.059282 | 2018-12-05T20:20:15 | 2018-12-05T20:20:15 | 160,545,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,867 | java | package com.gds.admin.service.dto;
import java.io.Serializable;
import java.util.Objects;
import io.github.jhipster.service.filter.BooleanFilter;
import io.github.jhipster.service.filter.DoubleFilter;
import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.FloatFilter;
import io.github.jhipster.service.filter.IntegerFilter;
import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter;
/**
* Criteria class for the City entity. This class is used in CityResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /cities?id.greaterThan=5&attr1.contains=something&attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class CityCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private LongFilter id;
private LongFilter cityId;
private StringFilter cityCode;
private StringFilter countryCode;
public CityCriteria() {
}
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public LongFilter getCityId() {
return cityId;
}
public void setCityId(LongFilter cityId) {
this.cityId = cityId;
}
public StringFilter getCityCode() {
return cityCode;
}
public void setCityCode(StringFilter cityCode) {
this.cityCode = cityCode;
}
public StringFilter getCountryCode() {
return countryCode;
}
public void setCountryCode(StringFilter countryCode) {
this.countryCode = countryCode;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final CityCriteria that = (CityCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(cityId, that.cityId) &&
Objects.equals(cityCode, that.cityCode) &&
Objects.equals(countryCode, that.countryCode);
}
@Override
public int hashCode() {
return Objects.hash(
id,
cityId,
cityCode,
countryCode
);
}
@Override
public String toString() {
return "CityCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(cityId != null ? "cityId=" + cityId + ", " : "") +
(cityCode != null ? "cityCode=" + cityCode + ", " : "") +
(countryCode != null ? "countryCode=" + countryCode + ", " : "") +
"}";
}
}
| [
"emregozen@gmail.com"
] | emregozen@gmail.com |
f02907b18d5d55093f4fb16379ce43279a60bc61 | 22db738608866887cd7570af8d8af6608a27f35b | /src/main/java/org/apache/coyote/http11/Http11InputBuffer.java | 89c11ba4d75702a77ef9d957aeb33c49045dddc6 | [
"Apache-2.0"
] | permissive | dizhaung/fu-tomcat-embed-rfc7230 | 7982fb042286d6950e43f1a975fc98e9f58e53f6 | 40c0383878f1211118c7499caea8c216ef728daf | refs/heads/main | 2023-06-09T12:30:40.130924 | 2021-06-24T03:21:58 | 2021-06-24T03:21:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,481 | java | package org.apache.coyote.http11;/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.coyote.CloseNowException;
import org.apache.coyote.InputBuffer;
import org.apache.coyote.Request;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.HeaderUtil;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.http.parser.HttpParser;
import org.apache.tomcat.util.net.ApplicationBufferHandler;
import org.apache.tomcat.util.net.SocketWrapperBase;
import org.apache.tomcat.util.res.StringManager;
import java.io.EOFException;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/**
* InputBuffer for HTTP that provides request header parsing as well as transfer
* encoding.
*/
public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler {
// -------------------------------------------------------------- Constants
private static final Log log = LogFactory.getLog(Http11InputBuffer.class);
/**
* The string manager for this package.
*/
private static final StringManager sm = StringManager.getManager(Http11InputBuffer.class);
private static final byte[] CLIENT_PREFACE_START =
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".getBytes(StandardCharsets.ISO_8859_1);
/**
* Associated Coyote request.
*/
private final Request request;
/**
* Headers of the associated request.
*/
private final MimeHeaders headers;
private final boolean rejectIllegalHeader;
/**
* State.
*/
private volatile boolean parsingHeader;
/**
* Swallow input ? (in the case of an expectation)
*/
private boolean swallowInput;
/**
* The read buffer.
*/
private ByteBuffer byteBuffer;
/**
* Pos of the end of the header in the buffer, which is also the
* start of the body.
*/
private int end;
/**
* Wrapper that provides access to the underlying socket.
*/
private SocketWrapperBase<?> wrapper;
/**
* Underlying input buffer.
*/
private InputBuffer inputStreamInputBuffer;
/**
* Filter library.
* Note: Filter[Constants.CHUNKED_FILTER] is always the "chunked" filter.
*/
private InputFilter[] filterLibrary;
/**
* Active filters (in order).
*/
private InputFilter[] activeFilters;
/**
* Index of the last active filter.
*/
private int lastActiveFilter;
/**
* Parsing state - used for non blocking parsing so that
* when more data arrives, we can pick up where we left off.
*/
private byte prevChr = 0;
private byte chr = 0;
private volatile boolean parsingRequestLine;
private int parsingRequestLinePhase = 0;
private boolean parsingRequestLineEol = false;
private int parsingRequestLineStart = 0;
private int parsingRequestLineQPos = -1;
private HeaderParsePosition headerParsePos;
private final HeaderParseData headerData = new HeaderParseData();
private final HttpParser httpParser;
/**
* Maximum allowed size of the HTTP request line plus headers plus any
* leading blank lines.
*/
private final int headerBufferSize;
/**
* Known size of the NioChannel read buffer.
*/
private int socketReadBufferSize;
// ----------------------------------------------------------- Constructors
public Http11InputBuffer(Request request, int headerBufferSize,
boolean rejectIllegalHeader, HttpParser httpParser) {
this.request = request;
headers = request.getMimeHeaders();
this.headerBufferSize = headerBufferSize;
this.rejectIllegalHeader = rejectIllegalHeader;
this.httpParser = httpParser;
filterLibrary = new InputFilter[0];
activeFilters = new InputFilter[0];
lastActiveFilter = -1;
parsingHeader = true;
parsingRequestLine = true;
parsingRequestLinePhase = 0;
parsingRequestLineEol = false;
parsingRequestLineStart = 0;
parsingRequestLineQPos = -1;
headerParsePos = HeaderParsePosition.HEADER_START;
swallowInput = true;
inputStreamInputBuffer = new SocketInputBuffer();
}
// ------------------------------------------------------------- Properties
/**
* Add an input filter to the filter library.
*
* @throws NullPointerException if the supplied filter is null
*/
void addFilter(InputFilter filter) {
if (filter == null) {
throw new NullPointerException(sm.getString("iib.filter.npe"));
}
InputFilter[] newFilterLibrary = Arrays.copyOf(filterLibrary, filterLibrary.length + 1);
newFilterLibrary[filterLibrary.length] = filter;
filterLibrary = newFilterLibrary;
activeFilters = new InputFilter[filterLibrary.length];
}
/**
* Get filters.
*/
InputFilter[] getFilters() {
return filterLibrary;
}
/**
* Add an input filter to the filter library.
*/
void addActiveFilter(InputFilter filter) {
if (lastActiveFilter == -1) {
filter.setBuffer(inputStreamInputBuffer);
} else {
for (int i = 0; i <= lastActiveFilter; i++) {
if (activeFilters[i] == filter)
return;
}
filter.setBuffer(activeFilters[lastActiveFilter]);
}
activeFilters[++lastActiveFilter] = filter;
filter.setRequest(request);
}
/**
* Set the swallow input flag.
*/
void setSwallowInput(boolean swallowInput) {
this.swallowInput = swallowInput;
}
// ---------------------------------------------------- InputBuffer Methods
@Override
public int doRead(ApplicationBufferHandler handler) throws IOException {
if (lastActiveFilter == -1) {
return inputStreamInputBuffer.doRead(handler);
} else {
return activeFilters[lastActiveFilter].doRead(handler);
}
}
// ------------------------------------------------------- Protected Methods
/**
* Recycle the input buffer. This should be called when closing the
* connection.
*/
void recycle() {
wrapper = null;
request.recycle();
for (int i = 0; i <= lastActiveFilter; i++) {
activeFilters[i].recycle();
}
byteBuffer.limit(0).position(0);
lastActiveFilter = -1;
swallowInput = true;
chr = 0;
prevChr = 0;
headerParsePos = HeaderParsePosition.HEADER_START;
parsingRequestLinePhase = 0;
parsingRequestLineEol = false;
parsingRequestLineStart = 0;
parsingRequestLineQPos = -1;
headerData.recycle();
// Recycled last because they are volatile
// All variables visible to this thread are guaranteed to be visible to
// any other thread once that thread reads the same volatile. The first
// action when parsing input data is to read one of these volatiles.
parsingRequestLine = true;
parsingHeader = true;
}
/**
* End processing of current HTTP request.
* Note: All bytes of the current request should have been already
* consumed. This method only resets all the pointers so that we are ready
* to parse the next HTTP request.
*/
void nextRequest() {
request.recycle();
if (byteBuffer.position() > 0) {
if (byteBuffer.remaining() > 0) {
// Copy leftover bytes to the beginning of the buffer
byteBuffer.compact();
byteBuffer.flip();
} else {
// Reset position and limit to 0
byteBuffer.position(0).limit(0);
}
}
// Recycle filters
for (int i = 0; i <= lastActiveFilter; i++) {
activeFilters[i].recycle();
}
// Reset pointers
lastActiveFilter = -1;
parsingHeader = true;
swallowInput = true;
headerParsePos = HeaderParsePosition.HEADER_START;
parsingRequestLine = true;
parsingRequestLinePhase = 0;
parsingRequestLineEol = false;
parsingRequestLineStart = 0;
parsingRequestLineQPos = -1;
headerData.recycle();
}
/**
* Read the request line. This function is meant to be used during the
* HTTP request header parsing. Do NOT attempt to read the request body
* using it.
*
* @throws IOException If an exception occurs during the underlying socket
* read operations, or if the given buffer is not big enough to accommodate
* the whole line.
*
* @return true if data is properly fed; false if no data is available
* immediately and thread should be freed
*/
boolean parseRequestLine(boolean keptAlive, int connectionTimeout, int keepAliveTimeout)
throws IOException {
// check state
if (!parsingRequestLine) {
return true;
}
//
// Skipping blank lines
//
if (parsingRequestLinePhase < 2) {
do {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (keptAlive) {
// Haven't read any request data yet so use the keep-alive
// timeout.
wrapper.setReadTimeout(keepAliveTimeout);
}
if (!fill(false)) {
// A read is pending, so no longer in initial state
parsingRequestLinePhase = 1;
return false;
}
// At least one byte of the request has been received.
// Switch to the socket timeout.
wrapper.setReadTimeout(connectionTimeout);
}
if (!keptAlive && byteBuffer.position() == 0 && byteBuffer.limit() >= CLIENT_PREFACE_START.length - 1) {
boolean prefaceMatch = true;
for (int i = 0; i < CLIENT_PREFACE_START.length && prefaceMatch; i++) {
if (CLIENT_PREFACE_START[i] != byteBuffer.get(i)) {
prefaceMatch = false;
}
}
if (prefaceMatch) {
// HTTP/2 preface matched
parsingRequestLinePhase = -1;
return false;
}
}
// Set the start time once we start reading data (even if it is
// just skipping blank lines)
if (request.getStartTime() < 0) {
request.setStartTime(System.currentTimeMillis());
}
chr = byteBuffer.get();
} while ((chr == Constants.CR) || (chr == Constants.LF));
byteBuffer.position(byteBuffer.position() - 1);
parsingRequestLineStart = byteBuffer.position();
parsingRequestLinePhase = 2;
}
if (parsingRequestLinePhase == 2) {
//
// Reading the method name
// Method name is a token
//
boolean space = false;
while (!space) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) // request line parsing
return false;
}
// Spec says method name is a token followed by a single SP but
// also be tolerant of multiple SP and/or HT.
int pos = byteBuffer.position();
chr = byteBuffer.get();
if (chr == Constants.SP || chr == Constants.HT) {
space = true;
request.method().setBytes(byteBuffer.array(), parsingRequestLineStart,
pos - parsingRequestLineStart);
} else if (!HttpParser.isToken(chr)) {
// Avoid unknown protocol triggering an additional error
request.protocol().setString(Constants.HTTP_11);
String invalidMethodValue = parseInvalid(parsingRequestLineStart, byteBuffer);
throw new IllegalArgumentException(sm.getString("iib.invalidmethod", invalidMethodValue));
}
}
parsingRequestLinePhase = 3;
}
if (parsingRequestLinePhase == 3) {
// Spec says single SP but also be tolerant of multiple SP and/or HT
boolean space = true;
while (space) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) // request line parsing
return false;
}
chr = byteBuffer.get();
if (!(chr == Constants.SP || chr == Constants.HT)) {
space = false;
byteBuffer.position(byteBuffer.position() - 1);
}
}
parsingRequestLineStart = byteBuffer.position();
parsingRequestLinePhase = 4;
}
if (parsingRequestLinePhase == 4) {
// Mark the current buffer position
int end = 0;
//
// Reading the URI
//
boolean space = false;
while (!space) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) // request line parsing
return false;
}
int pos = byteBuffer.position();
prevChr = chr;
chr = byteBuffer.get();
if (prevChr == Constants.CR && chr != Constants.LF) {
// CR not followed by LF so not an HTTP/0.9 request and
// therefore invalid. Trigger error handling.
// Avoid unknown protocol triggering an additional error
request.protocol().setString(Constants.HTTP_11);
String invalidRequestTarget = parseInvalid(parsingRequestLineStart, byteBuffer);
throw new IllegalArgumentException(sm.getString("iib.invalidRequestTarget", invalidRequestTarget));
}
if (chr == Constants.SP || chr == Constants.HT) {
space = true;
end = pos;
} else if (chr == Constants.CR) {
// HTTP/0.9 style request. CR is optional. LF is not.
} else if (chr == Constants.LF) {
// HTTP/0.9 style request
// Stop this processing loop
space = true;
// Set blank protocol (indicates HTTP/0.9)
request.protocol().setString("");
// Skip the protocol processing
parsingRequestLinePhase = 7;
if (prevChr == Constants.CR) {
end = pos - 1;
} else {
end = pos;
}
} else if (chr == Constants.QUESTION && parsingRequestLineQPos == -1) {
parsingRequestLineQPos = pos;
/*
} else if (parsingRequestLineQPos != -1 && !httpParser.isQueryRelaxed(chr)) {
// Avoid unknown protocol triggering an additional error
request.protocol().setString(Constants.HTTP_11);
// %nn decoding will be checked at the point of decoding
String invalidRequestTarget = parseInvalid(parsingRequestLineStart, byteBuffer);
throw new IllegalArgumentException(sm.getString("iib.invalidRequestTarget", invalidRequestTarget));
*/
} else if (httpParser.isNotRequestTargetRelaxed(chr)) {
// Avoid unknown protocol triggering an additional error
request.protocol().setString(Constants.HTTP_11);
// This is a general check that aims to catch problems early
// Detailed checking of each part of the request target will
// happen in Http11Processor#prepareRequest()
String invalidRequestTarget = parseInvalid(parsingRequestLineStart, byteBuffer);
throw new IllegalArgumentException(sm.getString("iib.invalidRequestTarget", invalidRequestTarget));
}
}
if (parsingRequestLineQPos >= 0) {
request.queryString().setBytes(byteBuffer.array(), parsingRequestLineQPos + 1,
end - parsingRequestLineQPos - 1);
request.requestURI().setBytes(byteBuffer.array(), parsingRequestLineStart,
parsingRequestLineQPos - parsingRequestLineStart);
} else {
request.requestURI().setBytes(byteBuffer.array(), parsingRequestLineStart,
end - parsingRequestLineStart);
}
// HTTP/0.9 processing jumps to stage 7.
// Don't want to overwrite that here.
if (parsingRequestLinePhase == 4) {
parsingRequestLinePhase = 5;
}
}
if (parsingRequestLinePhase == 5) {
// Spec says single SP but also be tolerant of multiple and/or HT
boolean space = true;
while (space) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) // request line parsing
return false;
}
byte chr = byteBuffer.get();
if (!(chr == Constants.SP || chr == Constants.HT)) {
space = false;
byteBuffer.position(byteBuffer.position() - 1);
}
}
parsingRequestLineStart = byteBuffer.position();
parsingRequestLinePhase = 6;
// Mark the current buffer position
end = 0;
}
if (parsingRequestLinePhase == 6) {
//
// Reading the protocol
// Protocol is always "HTTP/" DIGIT "." DIGIT
//
while (!parsingRequestLineEol) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) // request line parsing
return false;
}
int pos = byteBuffer.position();
prevChr = chr;
chr = byteBuffer.get();
if (chr == Constants.CR) {
// Possible end of request line. Need LF next.
} else if (prevChr == Constants.CR && chr == Constants.LF) {
end = pos - 1;
parsingRequestLineEol = true;
} else if (!HttpParser.isHttpProtocol(chr)) {
String invalidProtocol = parseInvalid(parsingRequestLineStart, byteBuffer);
throw new IllegalArgumentException(sm.getString("iib.invalidHttpProtocol", invalidProtocol));
}
}
if ((end - parsingRequestLineStart) > 0) {
request.protocol().setBytes(byteBuffer.array(), parsingRequestLineStart,
end - parsingRequestLineStart);
parsingRequestLinePhase = 7;
}
// If no protocol is found, the ISE below will be triggered.
}
if (parsingRequestLinePhase == 7) {
// Parsing is complete. Return and clean-up.
parsingRequestLine = false;
parsingRequestLinePhase = 0;
parsingRequestLineEol = false;
parsingRequestLineStart = 0;
return true;
}
throw new IllegalStateException(sm.getString("iib.invalidPhase", Integer.valueOf(parsingRequestLinePhase)));
}
/**
* Parse the HTTP headers.
*/
boolean parseHeaders() throws IOException {
if (!parsingHeader) {
throw new IllegalStateException(sm.getString("iib.parseheaders.ise.error"));
}
HeaderParseStatus status = HeaderParseStatus.HAVE_MORE_HEADERS;
do {
status = parseHeader();
// Checking that
// (1) Headers plus request line size does not exceed its limit
// (2) There are enough bytes to avoid expanding the buffer when
// reading body
// Technically, (2) is technical limitation, (1) is logical
// limitation to enforce the meaning of headerBufferSize
// From the way how buf is allocated and how blank lines are being
// read, it should be enough to check (1) only.
if (byteBuffer.position() > headerBufferSize || byteBuffer.capacity() - byteBuffer.position() < socketReadBufferSize) {
throw new IllegalArgumentException(sm.getString("iib.requestheadertoolarge.error"));
}
} while (status == HeaderParseStatus.HAVE_MORE_HEADERS);
if (status == HeaderParseStatus.DONE) {
parsingHeader = false;
end = byteBuffer.position();
return true;
} else {
return false;
}
}
int getParsingRequestLinePhase() {
return parsingRequestLinePhase;
}
private String parseInvalid(int startPos, ByteBuffer buffer) {
// Look for the next space
byte b = 0;
while (buffer.hasRemaining() && b != 0x20) {
b = buffer.get();
}
String result = HeaderUtil.toPrintableString(buffer.array(), buffer.arrayOffset() + startPos, buffer.position() - startPos - 1);
if (b != 0x20) {
// Ran out of buffer rather than found a space
result = result + "...";
}
return result;
}
/**
* End request (consumes leftover bytes).
*
* @throws IOException an underlying I/O error occurred
*/
void endRequest() throws IOException {
if (swallowInput && (lastActiveFilter != -1)) {
int extraBytes = (int) activeFilters[lastActiveFilter].end();
byteBuffer.position(byteBuffer.position() - extraBytes);
}
}
@Override
public int available() {
return available(false);
}
/**
* Available bytes in the buffers (note that due to encoding, this may not
* correspond).
*/
int available(boolean read) {
int available;
if (lastActiveFilter == -1) {
available = inputStreamInputBuffer.available();
} else {
available = activeFilters[lastActiveFilter].available();
}
if (available > 0 || !read) {
return available;
}
try {
if (wrapper.hasDataToRead()) {
fill(false);
available = byteBuffer.remaining();
}
} catch (IOException ioe) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("iib.available.readFail"), ioe);
}
// Not ideal. This will indicate that data is available which should
// trigger a read which in turn will trigger another IOException and
// that one can be thrown.
available = 1;
}
return available;
}
/**
* Has all of the request body been read? There are subtle differences
* between this and available() > 0 primarily because of having to handle
* faking non-blocking reads with the blocking IO connector.
*/
boolean isFinished() {
if (byteBuffer.limit() > byteBuffer.position()) {
// Data to read in the buffer so not finished
return false;
}
/*
* Don't use fill(false) here because in the following circumstances
* BIO will block - possibly indefinitely
* - client is using keep-alive and connection is still open
* - client has sent the complete request
* - client has not sent any of the next request (i.e. no pipelining)
* - application has read the complete request
*/
// Check the InputFilters
if (lastActiveFilter >= 0) {
return activeFilters[lastActiveFilter].isFinished();
} else {
// No filters. Assume request is not finished. EOF will signal end of
// request.
return false;
}
}
ByteBuffer getLeftover() {
int available = byteBuffer.remaining();
if (available > 0) {
return ByteBuffer.wrap(byteBuffer.array(), byteBuffer.position(), available);
} else {
return null;
}
}
boolean isChunking() {
for (int i = 0; i < lastActiveFilter; i++) {
if (activeFilters[i] == filterLibrary[Constants.CHUNKED_FILTER]) {
return true;
}
}
return false;
}
void init(SocketWrapperBase<?> socketWrapper) {
wrapper = socketWrapper;
wrapper.setAppReadBufHandler(this);
int bufLength = headerBufferSize +
wrapper.getSocketBufferHandler().getReadBuffer().capacity();
if (byteBuffer == null || byteBuffer.capacity() < bufLength) {
byteBuffer = ByteBuffer.allocate(bufLength);
byteBuffer.position(0).limit(0);
}
}
// --------------------------------------------------------- Private Methods
/**
* Attempts to read some data into the input buffer.
*
* @return <code>true</code> if more data was added to the input buffer
* otherwise <code>false</code>
*/
private boolean fill(boolean block) throws IOException {
if (log.isDebugEnabled()) {
log.debug("Before fill(): [" + parsingHeader +
"], parsingRequestLine: [" + parsingRequestLine +
"], parsingRequestLinePhase: [" + parsingRequestLinePhase +
"], parsingRequestLineStart: [" + parsingRequestLineStart +
"], byteBuffer.position() [" + byteBuffer.position() + "]");
}
if (parsingHeader) {
if (byteBuffer.limit() >= headerBufferSize) {
if (parsingRequestLine) {
// Avoid unknown protocol triggering an additional error
request.protocol().setString(Constants.HTTP_11);
}
throw new IllegalArgumentException(sm.getString("iib.requestheadertoolarge.error"));
}
} else {
byteBuffer.limit(end).position(end);
}
byteBuffer.mark();
if (byteBuffer.position() < byteBuffer.limit()) {
byteBuffer.position(byteBuffer.limit());
}
byteBuffer.limit(byteBuffer.capacity());
SocketWrapperBase<?> socketWrapper = this.wrapper;
int nRead = -1;
if (socketWrapper != null) {
nRead = socketWrapper.read(block, byteBuffer);
} else {
throw new CloseNowException(sm.getString("iib.eof.error"));
}
byteBuffer.limit(byteBuffer.position()).reset();
if (log.isDebugEnabled()) {
log.debug("Received ["
+ new String(byteBuffer.array(), byteBuffer.position(), byteBuffer.remaining(), StandardCharsets.ISO_8859_1) + "]");
}
if (nRead > 0) {
return true;
} else if (nRead == -1) {
throw new EOFException(sm.getString("iib.eof.error"));
} else {
return false;
}
}
/**
* Parse an HTTP header.
*
* @return false after reading a blank line (which indicates that the
* HTTP header parsing is done
*/
private HeaderParseStatus parseHeader() throws IOException {
while (headerParsePos == HeaderParsePosition.HEADER_START) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
headerParsePos = HeaderParsePosition.HEADER_START;
return HeaderParseStatus.NEED_MORE_DATA;
}
}
prevChr = chr;
chr = byteBuffer.get();
if (chr == Constants.CR && prevChr != Constants.CR) {
// Possible start of CRLF - process the next byte.
} else if (prevChr == Constants.CR && chr == Constants.LF) {
return HeaderParseStatus.DONE;
} else {
if (prevChr == Constants.CR) {
// Must have read two bytes (first was CR, second was not LF)
byteBuffer.position(byteBuffer.position() - 2);
} else {
// Must have only read one byte
byteBuffer.position(byteBuffer.position() - 1);
}
break;
}
}
if (headerParsePos == HeaderParsePosition.HEADER_START) {
// Mark the current buffer position
headerData.start = byteBuffer.position();
headerData.lineStart = headerData.start;
headerParsePos = HeaderParsePosition.HEADER_NAME;
}
//
// Reading the header name
// Header name is always US-ASCII
//
while (headerParsePos == HeaderParsePosition.HEADER_NAME) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) { // parse header
return HeaderParseStatus.NEED_MORE_DATA;
}
}
int pos = byteBuffer.position();
chr = byteBuffer.get();
if (chr == Constants.COLON) {
headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
headerData.headerValue = headers.addValue(byteBuffer.array(), headerData.start,
pos - headerData.start);
pos = byteBuffer.position();
// Mark the current buffer position
headerData.start = pos;
headerData.realPos = pos;
headerData.lastSignificantChar = pos;
break;
} else if (!HttpParser.isToken(chr)) {
// Non-token characters are illegal in header names
// Parsing continues so the error can be reported in context
headerData.lastSignificantChar = pos;
byteBuffer.position(byteBuffer.position() - 1);
// skipLine() will handle the error
return skipLine();
}
// chr is next byte of header name. Convert to lowercase.
if ((chr >= Constants.A) && (chr <= Constants.Z)) {
byteBuffer.put(pos, (byte) (chr - Constants.LC_OFFSET));
}
}
// Skip the line and ignore the header
if (headerParsePos == HeaderParsePosition.HEADER_SKIPLINE) {
return skipLine();
}
//
// Reading the header value (which can be spanned over multiple lines)
//
while (headerParsePos == HeaderParsePosition.HEADER_VALUE_START ||
headerParsePos == HeaderParsePosition.HEADER_VALUE ||
headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
if (headerParsePos == HeaderParsePosition.HEADER_VALUE_START) {
// Skipping spaces
while (true) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
// HEADER_VALUE_START
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (!(chr == Constants.SP || chr == Constants.HT)) {
headerParsePos = HeaderParsePosition.HEADER_VALUE;
byteBuffer.position(byteBuffer.position() - 1);
break;
}
}
}
if (headerParsePos == HeaderParsePosition.HEADER_VALUE) {
// Reading bytes until the end of the line
boolean eol = false;
while (!eol) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
// HEADER_VALUE
return HeaderParseStatus.NEED_MORE_DATA;
}
}
prevChr = chr;
chr = byteBuffer.get();
if (chr == Constants.CR) {
// Possible start of CRLF - process the next byte.
} else if (prevChr == Constants.CR && chr == Constants.LF) {
eol = true;
} else if (prevChr == Constants.CR) {
// Invalid value
// Delete the header (it will be the most recent one)
headers.removeHeader(headers.size() - 1);
return skipLine();
} else if (chr != Constants.HT && HttpParser.isControl(chr)) {
// Invalid value
// Delete the header (it will be the most recent one)
headers.removeHeader(headers.size() - 1);
return skipLine();
} else if (chr == Constants.SP || chr == Constants.HT) {
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
} else {
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
headerData.lastSignificantChar = headerData.realPos;
}
}
// Ignore whitespaces at the end of the line
headerData.realPos = headerData.lastSignificantChar;
// Checking the first character of the new line. If the character
// is a LWS, then it's a multiline header
headerParsePos = HeaderParsePosition.HEADER_MULTI_LINE;
}
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
// HEADER_MULTI_LINE
return HeaderParseStatus.NEED_MORE_DATA;
}
}
byte peek = byteBuffer.get(byteBuffer.position());
if (headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
if ((peek != Constants.SP) && (peek != Constants.HT)) {
headerParsePos = HeaderParsePosition.HEADER_START;
break;
} else {
// Copying one extra space in the buffer (since there must
// be at least one space inserted between the lines)
byteBuffer.put(headerData.realPos, peek);
headerData.realPos++;
headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
}
}
}
// Set the header value
headerData.headerValue.setBytes(byteBuffer.array(), headerData.start,
headerData.lastSignificantChar - headerData.start);
headerData.recycle();
return HeaderParseStatus.HAVE_MORE_HEADERS;
}
private HeaderParseStatus skipLine() throws IOException {
headerParsePos = HeaderParsePosition.HEADER_SKIPLINE;
boolean eol = false;
// Reading bytes until the end of the line
while (!eol) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {
return HeaderParseStatus.NEED_MORE_DATA;
}
}
int pos = byteBuffer.position();
prevChr = chr;
chr = byteBuffer.get();
if (chr == Constants.CR) {
// Skip
} else if (prevChr == Constants.CR && chr == Constants.LF) {
eol = true;
} else {
headerData.lastSignificantChar = pos;
}
}
if (rejectIllegalHeader || log.isDebugEnabled()) {
String message = sm.getString("iib.invalidheader",
HeaderUtil.toPrintableString(byteBuffer.array(), headerData.lineStart,
headerData.lastSignificantChar - headerData.lineStart + 1));
if (rejectIllegalHeader) {
throw new IllegalArgumentException(message);
}
log.debug(message);
}
headerParsePos = HeaderParsePosition.HEADER_START;
return HeaderParseStatus.HAVE_MORE_HEADERS;
}
// ----------------------------------------------------------- Inner classes
private enum HeaderParseStatus {
DONE, HAVE_MORE_HEADERS, NEED_MORE_DATA
}
private enum HeaderParsePosition {
/**
* Start of a new header. A CRLF here means that there are no more
* headers. Any other character starts a header name.
*/
HEADER_START,
/**
* Reading a header name. All characters of header are HTTP_TOKEN_CHAR.
* Header name is followed by ':'. No whitespace is allowed.<br>
* Any non-HTTP_TOKEN_CHAR (this includes any whitespace) encountered
* before ':' will result in the whole line being ignored.
*/
HEADER_NAME,
/**
* Skipping whitespace before text of header value starts, either on the
* first line of header value (just after ':') or on subsequent lines
* when it is known that subsequent line starts with SP or HT.
*/
HEADER_VALUE_START,
/**
* Reading the header value. We are inside the value. Either on the
* first line or on any subsequent line. We come into this state from
* HEADER_VALUE_START after the first non-SP/non-HT byte is encountered
* on the line.
*/
HEADER_VALUE,
/**
* Before reading a new line of a header. Once the next byte is peeked,
* the state changes without advancing our position. The state becomes
* either HEADER_VALUE_START (if that first byte is SP or HT), or
* HEADER_START (otherwise).
*/
HEADER_MULTI_LINE,
/**
* Reading all bytes until the next CRLF. The line is being ignored.
*/
HEADER_SKIPLINE
}
private static class HeaderParseData {
/**
* The first character of the header line.
*/
int lineStart = 0;
/**
* When parsing header name: first character of the header.<br>
* When skipping broken header line: first character of the header.<br>
* When parsing header value: first character after ':'.
*/
int start = 0;
/**
* When parsing header name: not used (stays as 0).<br>
* When skipping broken header line: not used (stays as 0).<br>
* When parsing header value: starts as the first character after ':'.
* Then is increased as far as more bytes of the header are harvested.
* Bytes from buf[pos] are copied to buf[realPos]. Thus the string from
* [start] to [realPos-1] is the prepared value of the header, with
* whitespaces removed as needed.<br>
*/
int realPos = 0;
/**
* When parsing header name: not used (stays as 0).<br>
* When skipping broken header line: last non-CR/non-LF character.<br>
* When parsing header value: position after the last not-LWS character.<br>
*/
int lastSignificantChar = 0;
/**
* MB that will store the value of the header. It is null while parsing
* header name and is created after the name has been parsed.
*/
MessageBytes headerValue = null;
public void recycle() {
lineStart = 0;
start = 0;
realPos = 0;
lastSignificantChar = 0;
headerValue = null;
}
}
// ------------------------------------- InputStreamInputBuffer Inner Class
/**
* This class is an input buffer which will read its data from an input
* stream.
*/
private class SocketInputBuffer implements InputBuffer {
@Override
public int doRead(ApplicationBufferHandler handler) throws IOException {
if (byteBuffer.position() >= byteBuffer.limit()) {
// The application is reading the HTTP request body which is
// always a blocking operation.
if (!fill(true))
return -1;
}
int length = byteBuffer.remaining();
handler.setByteBuffer(byteBuffer.duplicate());
byteBuffer.position(byteBuffer.limit());
return length;
}
@Override
public int available() {
return byteBuffer.remaining();
}
}
@Override
public void setByteBuffer(ByteBuffer buffer) {
byteBuffer = buffer;
}
@Override
public ByteBuffer getByteBuffer() {
return byteBuffer;
}
@Override
public void expand(int size) {
if (byteBuffer.capacity() >= size) {
byteBuffer.limit(size);
}
ByteBuffer temp = ByteBuffer.allocate(size);
temp.put(byteBuffer);
byteBuffer = temp;
byteBuffer.mark();
temp = null;
}
}
| [
"justin.zhu"
] | justin.zhu |
6d0555f31dc3bdaf18c9699833427276bedb2902 | faeac99b8391b181784168a8cfea764e4cb62f83 | /src/binary_tree/SumOfLeftLeaves.java | 63d5f53c1fa255e4966ca644d24baa27ec979d63 | [
"MIT"
] | permissive | chenwenhang/AlgorithmPractice | 123f9987c7b1621e4bb38d10f583e01c5c92220d | e35b18094d4bf25d4e4065d5bc9a611009aff233 | refs/heads/master | 2021-10-03T02:22:36.397972 | 2021-09-26T12:20:25 | 2021-09-26T12:20:25 | 217,215,897 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,116 | java | package binary_tree;
/**
* @Author: Wenhang Chen
* @Description:计算给定二叉树的所有左叶子之和。 示例:
* <p>
* 3
* / \
* 9 20
* / \
* 15 7
* <p>
* 在这个二叉树中,有两个左叶子,分别是 9 和 15,所以返回 24
* @Date: Created in 10:16 3/2/2020
* @Modified by:
*/
public class SumOfLeftLeaves {
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
public int sumOfLeftLeaves(TreeNode root) {
return sumOfLeftLeavesHelper(root, false);
}
// 先序遍历求所有左叶子节点值之和
public int sumOfLeftLeavesHelper(TreeNode root, boolean flag) {
if (root == null) {
return 0;
}
int leave = 0;
// 左叶子节点
if (flag && root.left == null && root.right == null) {
leave = root.val;
}
int left = sumOfLeftLeavesHelper(root.left, true);
int right = sumOfLeftLeavesHelper(root.right, false);
return left + right + leave;
}
}
| [
"cwh736@qq.com"
] | cwh736@qq.com |
f0f7dc12524658eb329efe9e2bb1176886f939f4 | 6fdb56486a0012650657804d35f694ba104e35ee | /src/fireworks/FireworkParticle.java | 487bf1bd37b3378d019c7a3921debd3db0fda298 | [
"MIT"
] | permissive | HelloPoogle/Minesweeper-1 | e47a51bf66799e5749e0eec26f97f23d88fbcd20 | 7efe63292f73c6d335d25379728afc9833702665 | refs/heads/master | 2020-03-19T03:23:20.381008 | 2017-10-29T19:35:33 | 2017-10-29T19:35:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,465 | java | package fireworks;
import java.awt.Color;
public class FireworkParticle implements Particle {
private double x;
private double y;
private int width;
private int height;
private double xVelocity;
private double yVelocity;
private Color color;
public FireworkParticle(double x, double y, int width, int height, double xVelocity, double yVelocity,
Color color) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.xVelocity = xVelocity;
this.yVelocity = yVelocity;
this.color = color;
}
@Override
public void setX(double x) {
this.x = x;
}
@Override
public double getX() {
return x;
}
@Override
public void setY(double y) {
this.y = y;
}
@Override
public double getY() {
return y;
}
@Override
public void setWidth(int width) {
this.width = width;
}
@Override
public int getWidth() {
return width;
}
@Override
public void setHeight(int height) {
this.height = height;
}
@Override
public int getHeight() {
return height;
}
@Override
public void setxVelocity(double xVelocity) {
this.xVelocity = xVelocity;
}
@Override
public double getxVelocity() {
return xVelocity;
}
@Override
public void setyVelocity(double yVelocity) {
this.yVelocity = yVelocity;
}
@Override
public double getyVelocity() {
return yVelocity;
}
@Override
public void setColor(Color color) {
this.color = color;
}
@Override
public Color getColor() {
return color;
}
}
| [
"tziporaziegler@gmail.com"
] | tziporaziegler@gmail.com |
b85e1dc383ed3e8c43b1d52f10ca6ca1a32475e5 | 5e823680d9dc10cf5f865d5eaa84e1f87be0102b | /src/java/Operaciones/Premios_Modificar_GIETRB.java | 9886cbdd20e7de599457fda0c65457fa8bdc90f0 | [] | no_license | iam-alito/Sisphel-Web | 056cf70d1cfee8ffa7c84f404997086294f64593 | 70bd42515aed310c548ef1b004572a74a199ca56 | refs/heads/master | 2020-05-02T17:00:07.132984 | 2019-03-27T23:04:11 | 2019-03-27T23:04:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,333 | java | package Operaciones;
import java.util.Vector;
import java.sql.*;
public class Premios_Modificar_GIETRB {
private String ID;
private String Evento;
private String Nombre_Pre_GIETRB;
private String Trabajo;
private String Categoria;
private String Grupo;
public static synchronized Vector DatosGIETRB(String Pre) throws SQLException {
Vector Produccion = null;
DBManager dbm = new DBManager();
Connection con = dbm.getConnection();
PreparedStatement st = con.prepareStatement("SELECT * FROM premios WHERE Grupo='02' AND ID= ?");
st.setString(1, Pre);
ResultSet rs = st.executeQuery();
Produccion = new Vector();
if (rs.next()) {
Produccion.add(new Premios_Modificar_GIETRB(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6)));
}
rs.close();
st.close();
dbm.closeConnection(con);
return Produccion;
}
public Premios_Modificar_GIETRB(String ID, String Evento, String Nombre_Pre_GIETRB, String Trabajo, String Categoria, String Grupo) {
this.ID = ID;
this.Evento = Evento.toUpperCase();
this.Nombre_Pre_GIETRB = Nombre_Pre_GIETRB.toUpperCase();
this.Trabajo = Trabajo.toUpperCase();
this.Categoria = Categoria.toUpperCase();
this.Grupo = Grupo.toUpperCase();
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getEvento() {
return Evento;
}
public void setEvento(String Evento) {
this.Evento = Evento;
}
public String getNombre_Pre_GIETRB() {
return Nombre_Pre_GIETRB;
}
public void setNombre_Pre_GIETRB(String Nombre_Pre_GIETRB) {
this.Nombre_Pre_GIETRB = Nombre_Pre_GIETRB;
}
public String getTrabajo() {
return Trabajo;
}
public void setTrabajo(String Trabajo) {
this.Trabajo = Trabajo;
}
public String getCategoria() {
return Categoria;
}
public void setCategoria(String Categoria) {
this.Categoria = Categoria;
}
public String getGrupo() {
return Grupo;
}
public void setGrupo(String Grupo) {
this.Grupo = Grupo;
}
}
| [
"alepa12@hotmail.es"
] | alepa12@hotmail.es |
fdfa9998ee2dc72a94d3ef892dda44cee7875176 | a2ce46ba253416979ba1b86d36bb9dd969ddd713 | /java/MalwareVis/src/gatech/edu/geometry/Cell.java | 14a7717cc7b864ca1dd4028ce5369af2c15a3136 | [] | no_license | sanikuz/malware-vis | f83263f4d52d9a222241afd255f8c40a719f06f9 | d8158e6d79ffc1d0b5e1fd45ad727422833b5798 | refs/heads/master | 2020-05-18T20:17:14.931513 | 2012-09-06T02:42:21 | 2012-09-06T02:42:21 | 37,592,956 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,464 | java | package gatech.edu.geometry;
import gatech.edu.pcap.DNSStream;
import gatech.edu.pcap.Pcap;
import gatech.edu.pcap.Stream;
import gatech.edu.pcap.TCPStream;
import gatech.edu.util.Mapping;
import java.util.ArrayList;
import processing.core.*;
public class Cell {
pt center = new pt(0,0);
float radius=100;
float leng = 60;
int cid = -1;
int num;
Cilium[] cilium;
float[] stime;
PImage img = null;
String name;
String text;
String country;
Pcap pcap;
String flagDir = "data/flags/";
public Cell(pt c){
center.setTo(c);
}
public void setRadius(float r){
radius =r;
}
public void setLeng(float l){
leng=l;
}
public void selectCilium(PApplet pa){
float dis = 20;
int si = -1;
pt m = pt.mouse(pa);
for (int i=0; i<num; i++){
float temp = cilium[i].disTo(m);
if (temp <dis){
dis = temp;
si = i;
}
}
cid = si;
if (cid >=0){
text = cilium[cid].text;
String imgpath = cilium[cid].imgpath;
if (imgpath !=null){
img = pa.loadImage(imgpath);
country = imgpath.substring(11, 13).toUpperCase();
}
else {
img =null;
}
}
}
public void showCilium(PApplet pa){
for (int i=0; i<num; i++){
if (i==cid) cilium[i].drawSelected(pa);
else cilium[i].draw(pa);
}
}
public void showBody(PApplet pa){
pa.noFill();
color.stroke(color.darkBlue, pa);
pa.strokeWeight(4);
pa.bezier(center.x, center.y+radius+leng, center.x, center.y+radius+leng/2,
center.x, center.y+radius,center.x-0.258f*radius, center.y+0.967f*radius
);
pa.arc(center.x, center.y, radius*2, radius*2, 0.2618f+3.1416f/2, 6.021f+3.1416f/2);
pa.fill(250,120,0);
pa.triangle(center.x+0.258f*radius, center.y+radius,
center.x+0.23f*radius, center.y+0.93f*radius,
center.x+0.1f*radius, center.y+radius);
pa.triangle(center.x+0.03f*radius, center.y+radius+leng,
center.x, center.y+0.8f*radius+leng,
center.x-0.03f*radius, center.y+radius+leng);
int offsety = (int)(radius*0.2f);
if (cid <0) {//show name
pa.text(name.substring(0, 8), center.x, center.y-offsety);
pa.text(name.substring(8, 16), center.x, center.y );
pa.text(name.substring(16, 24), center.x, center.y+offsety );
pa.text(name.substring(24, 32), center.x, center.y+offsety*2);
}
else if (img == null){ //show text
pa.text(text, center.x, center.y);
}
else { // show img and text
pa.text("country: "+country, center.x-15, center.y);
pa.image(img, center.x+30, center.y-5);
pa.text(text, center.x, center.y+offsety+2);
}
}
public void setMappingAngle(float alpha){
if (stime==null) return;
Mapping mapping = new Mapping(stime, PConstants.PI/6, PConstants.TWO_PI-PConstants.PI/6, alpha);
mapping.generateOutput();
float[] angle = mapping.getOutput();
for (int i=0 ;i<angle.length; i++ ){
cilium[i].computeContact(angle[i], this);
}
}
public void load(Pcap input){
if (input==null){System.out.println("load pcap failed");return;}
System.out.println("load pcap: ");
name = input.getDigest().getName();
ArrayList<Stream> streams = input.getStreams();
cilium = new Cilium[streams.size()];
num=0;
double duration = input.getDuration();
stime = new float[streams.size()];
int ns=0;
for (Stream s : streams) {
Cilium cur = cilium[num++] = new Cilium();
String text;
if (s instanceof DNSStream) {
text = ((DNSStream)s).getDomainName();
cur.setType(true);
}
else if (s instanceof TCPStream) {
text = ((TCPStream)s).getDstIP();
// String country = CountryLookup.getInstance().getCountryFromIP(text);
// String imgpath = flagDir +country+".gif";
cur.setType(false);
//cur.setImagePath(imgpath);
}
else {text=""; System.out.println("invalid steam");}
cur.setText(text);
double start = s.getStartTime();
double end = s.getEndTime();
// cur.computeAngleAndContact(start, end, duration, this); //linear mapping
stime[ns++] = (float)start; //(float)(start+end)/2.0f;
cur.setSpan(start, end, this);
long num = s.getNumPackets();
cur.setLeng(num, leng/10, leng);
long size = s.getSize();
cur.setWidth(size, this);
boolean mask = s.getFinished() & s.getFinished();
cur.setMask(mask);
}
}
}
| [
"opmiss@gmail.com"
] | opmiss@gmail.com |
edb192065480619a0c157d9f8ed6a03faeaec795 | 797ff06f53ff709fb0ba6e9d6a40032fd7790678 | /src/main/java/com/qq/face/util/MapConvertUtil.java | a1636b4a31310b6c6a72f85163bffe5c96cfe624 | [] | no_license | kunwong90/spring-boot | cbbf43e02162813719cb81c536036bcad43a8c56 | 63a5a2a73acca0ae1b409441b85e58728e1f8b7f | refs/heads/master | 2021-09-23T03:20:12.941388 | 2018-09-20T06:52:42 | 2018-09-20T06:52:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,414 | java | package com.qq.face.util;
import com.alibaba.fastjson.annotation.JSONField;
import com.qq.face.entity.FaceRequestVo;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.util.Map;
import java.util.TreeMap;
public class MapConvertUtil {
public static Map<String, String> convertObject2Map(Object object) throws Exception {
return convertObject2Map(object, false);
}
/**
* @param object
* @param parent 是否获取父类字段属性
* @return
*/
public static Map<String, String> convertObject2Map(Object object, boolean parent) throws Exception {
Map<String, String> map = new TreeMap<>();
Field[] fields = object.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
JSONField jsonField = field.getAnnotation(JSONField.class);
String value = (String) field.get(object);
if (StringUtils.isNotBlank(value)) {
if (jsonField != null) {
//如果不为空,说明该字段上使用了JSONField注解
String fieldName = jsonField.name();
map.put(fieldName, value);
} else {
map.put(field.getName(), value);
}
}
}
Class<?> superClazz = object.getClass().getSuperclass();
if (parent && superClazz != null && superClazz != Object.class) {
convertObject2Map(superClazz.newInstance(), true);
}
return map;
}
public static String convertMap2Str(Map<String, String> map) throws Exception {
StringBuilder builder = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet()) {
String value = entry.getValue();
if (StringUtils.isNotBlank(value)) {
builder.append(entry.getKey()).append("=").append(URLEncoder.encode(value, "utf-8")).append("&");
}
}
return builder.subSequence(0, builder.length() - 1).toString();
}
public static void main(String[] args) throws Exception {
FaceRequestVo faceRequestVo = new FaceRequestVo();
Map<String, String> map = convertObject2Map(faceRequestVo, false);
System.out.println(map);
System.out.println(convertMap2Str(map));
}
}
| [
"kun.wang@yoho.cn"
] | kun.wang@yoho.cn |
46e50ca85ab7d5dbd0f14161c05e4e10ef8b5d2d | ae4769319b2f1b7592f73d0e0a91ab5a42d654a2 | /hms-plugin/src/test/java/com/batch/android/plugin/hms/TestUtils.java | c7715d3432178d7cdd9af97baa366a52cea78236 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | BatchLabs/Batch-Android-HMS-Plugin | fe7a9677674a37f419335856780eb5304441f290 | f831dda381d7ec1dbe13e9d36efcf7c30e196a7f | refs/heads/dev | 2023-06-28T23:15:08.455592 | 2021-07-28T08:28:52 | 2021-07-28T08:28:52 | 284,689,269 | 0 | 0 | NOASSERTION | 2021-07-27T09:48:59 | 2020-08-03T12:05:47 | Java | UTF-8 | Java | false | false | 1,387 | java | package com.batch.android.plugin.hms;
import android.os.Bundle;
import androidx.annotation.NonNull;
import org.junit.Assert;
import java.util.Set;
public class TestUtils {
public static boolean equalBundles(@NonNull Bundle first, @NonNull Bundle second) {
Assert.assertNotNull(first);
Assert.assertNotNull(second);
if (first == second) {
return true;
}
if (first.size() != second.size()) {
return false;
}
Set<String> firstKeySet = first.keySet();
if (!firstKeySet.containsAll(second.keySet())) {
// No need to compare the other way around thanks to the size check
return false;
}
for (String key : firstKeySet) {
Object firstObject = first.get(key);
Object secondObject = second.get(key);
Assert.assertNotNull(firstObject);
Assert.assertNotNull(secondObject);
if (firstObject instanceof Bundle) {
if (!(secondObject instanceof Bundle)) {
return false;
}
if (!equalBundles((Bundle) firstObject, (Bundle) secondObject)) {
return false;
}
} else if (!firstObject.equals(secondObject)) {
return false;
}
}
return true;
}
}
| [
"abarisain@gmail.com"
] | abarisain@gmail.com |
d321514241a28b9f3b7bf3e0cbc90881c82fa11b | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_2430_aWL.java | f91900bb7683cebd269246be3ce45e2987d0662d | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | public class aWL
{
public static final int fbS = 1;
public static final int fbT = 1970;
public static final int fbU = 1000;
public static final int fbV = 86400;
public static final cds fbW = new kb(0, 0, 4, 0);
public static final cds fbX = new kb(30, 12, 0, 0);
public static final boolean fbY = true;
public static final int fbZ = 83;
public static final int fca = 17;
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
f0b0d90356f714c544eed3157c7f27299137161d | 1740cb5574e62bbc03df0a1231356e4c1a40ec48 | /src/main/java/com/sample/common/config/Config.java | 91052bb6f43014d9f19da8f3b093422b412922ac | [] | no_license | liuxiufeng/jetty-jersey-mybaits | d6f6cbae5d4794367fc28cf83e02430acba99545 | b3a7d5d005e615cb2f5e02d5239a547b1e7ef040 | refs/heads/master | 2021-01-20T20:02:52.056010 | 2016-06-01T06:16:44 | 2016-06-01T06:16:44 | 59,822,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | package com.sample.common.config;
public class Config {
public static final String KEY = "www.sample.com.token.key";
}
| [
"glxfeng@gmail.com"
] | glxfeng@gmail.com |
4a61fd88521e9521686682d22926adcacf1106fd | ec6a7b42544a584a68598874736f6a4ccbf91c18 | /maratonaDev/src/main/java/br/com/maratona/dev/resource/InscricaoHelper.java | 003e04c3467e8b06a2b653b43d30c4c3a7060307 | [] | no_license | Debiason/Debiason-maratonaStefanini-semana2_Java | 3625f2997783c92d48e840f9ab8b769d80c817ca | c8aa18fdfb0ab99cc854925df1ccb328264b1ea3 | refs/heads/main | 2023-01-03T04:11:22.866253 | 2020-10-20T02:44:38 | 2020-10-20T02:44:38 | 304,495,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package br.com.maratona.dev.resource;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
public class InscricaoHelper {
List<Pessoa> pessoas = new ArrayList<Pessoa>();
public void init() {
pessoas.add(new Pessoa("Douglas",1));
pessoas.add(new Pessoa("Jones",2));
pessoas.add(new Pessoa("Rose",3));
}
public List<Pessoa> getPessoas() {
return pessoas;
}
public Pessoa findPessoa(Integer id) {
init();
for(Pessoa indice : pessoas) {
if(indice.getMatricula().equals(id)) {
return indice;
}
}
return null;
}
}
| [
"debiasonw@gmail.com"
] | debiasonw@gmail.com |
76620f608d5cc8102032f823f248c521ee250393 | bdc2662d0b3e671d50b3eb5393a3c9b3d68dbb86 | /thain-core/src/main/java/com/xiaomi/thain/core/scheduler/job/FlowJob.java | 6fc8f0238d6795804e564b4814afe08cad872ed3 | [
"Apache-2.0"
] | permissive | Ridefishcat/thain | 55f9c97d99cb48461e6943488b7fec45ff54ef6b | 4011b4727c7a1a00592fc92725ffc84411d03719 | refs/heads/master | 2020-09-21T16:19:45.990466 | 2019-11-29T07:29:03 | 2019-11-29T07:29:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,568 | java | /*
* Copyright (c) 2019, Xiaomi, Inc. All rights reserved.
* This source code is licensed under the Apache License Version 2.0, which
* can be found in the LICENSE file in the root directory of this source tree.
*/
package com.xiaomi.thain.core.scheduler.job;
import com.xiaomi.thain.common.constant.FlowExecutionStatus;
import com.xiaomi.thain.common.exception.ThainCreateFlowExecutionException;
import com.xiaomi.thain.common.exception.ThainRuntimeException;
import com.xiaomi.thain.common.model.dp.AddFlowExecutionDp;
import com.xiaomi.thain.core.constant.FlowExecutionTriggerType;
import com.xiaomi.thain.core.process.ProcessEngine;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static com.xiaomi.thain.common.utils.HostUtils.getHostInfo;
/**
* @author liangyongrui
*/
@Slf4j
public class FlowJob implements Job {
@NonNull
private ProcessEngine processEngine;
private static final Map<String, FlowJob> FLOW_JOB_MAP = new ConcurrentHashMap<>();
private FlowJob(@NonNull ProcessEngine processEngine) {
this.processEngine = processEngine;
}
public static FlowJob getInstance(@NonNull ProcessEngine processEngine) {
return FLOW_JOB_MAP.computeIfAbsent(processEngine.processEngineId,
t -> new FlowJob(processEngine));
}
@Override
public void execute(@NonNull JobExecutionContext context) {
try {
long flowId = context.getJobDetail().getJobDataMap().getLong("flowId");
val addFlowExecutionDp = AddFlowExecutionDp.builder()
.flowId(flowId)
.hostInfo(getHostInfo())
.status(FlowExecutionStatus.WAITING.code)
.triggerType(FlowExecutionTriggerType.AUTOMATIC.code)
.build();
processEngine.processEngineStorage.flowExecutionDao.addFlowExecution(addFlowExecutionDp);
if (addFlowExecutionDp.id == null) {
throw new ThainCreateFlowExecutionException();
}
val flowExecutionDr = processEngine.processEngineStorage.flowExecutionDao
.getFlowExecution(addFlowExecutionDp.id).orElseThrow(ThainRuntimeException::new);
processEngine.processEngineStorage.flowExecutionWaitingQueue.put(flowExecutionDr);
} catch (Exception e) {
log.error("Failed to add queue:", e);
}
}
}
| [
"leungyongrui@gmail.com"
] | leungyongrui@gmail.com |
87b81a7caa91cb1b593a31428a2f6a260af7f6a6 | afc78da3b287ae2a44866fe0a99b1bd174a9311b | /a-sept-jars/src/com/a/drop/drop/pbf3/source/AccessDriver.java | afd5ae4915b37422cb8b2bd7734c85d988f0978c | [] | no_license | zchar007/sept | f9139cffa67c693c43183bb16d5904e06e46b15d | 645596f5d3004767241b9b647ed9b21877615399 | refs/heads/master | 2020-04-05T15:09:34.405734 | 2018-12-25T07:43:04 | 2018-12-25T07:43:04 | 156,955,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package com.sept.db.pdf.source;
import java.sql.Connection;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Logger;
import com.sept.db.pdf.SecRW;
public class AccessDriver extends SecRW {
@Override
public Connection connect(String url, Properties info) throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean acceptsURL(String url) throws SQLException {
// TODO Auto-generated method stub
return false;
}
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public int getMajorVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getMinorVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean jdbcCompliant() {
// TODO Auto-generated method stub
return false;
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
// TODO Auto-generated method stub
return null;
}
}
| [
"zchar007@users.noreply.github.com"
] | zchar007@users.noreply.github.com |
3e8cd2a0804f2d245a8801682fabfbb06639b63d | 18b18c1e3704caffc5f017ee89ff34b555d016f3 | /ejercicio2/ejercicio8/Ejercicio8/src/app/MenuJugadores.java | ae96c0f0295cf3edd982bdda19edf4ce3033b7f0 | [] | no_license | JorgeLuisG/EjerciciosUtn | b9599f76340ae032346f4efc0bbb86f8a485f4a0 | 1a85c6a90f887a6e55f5edb13766f23963e33c87 | refs/heads/master | 2022-07-28T04:35:21.149687 | 2020-03-02T22:23:58 | 2020-03-02T22:23:58 | 222,166,561 | 0 | 0 | null | 2022-06-21T02:54:05 | 2019-11-16T22:22:01 | Java | UTF-8 | Java | false | false | 2,365 | java | package app;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
public class MenuJugadores {
private static int cantidadDeJugadores;
private static Scanner scan;
private static Jugador[] jugadores=new Jugador[0];
public void mostrarMenuJugadores() {
int categoria=0;
do {
System.out.println("Ingrese 1 para nuevo jugador.\nIngrese 2 para mostrar jugadores.\nIngrese 3 para salir.");
categoria=obtenerCategoria();
if (categoria==1) {
System.out.println("Ingrese nombre del jugador "+(cantidadDeJugadores+1));
cargarEquipo();
}else if (categoria==2) {
System.out.println("Los jugadores son: ");
for (int i = 0; i < jugadores.length; i++) {
System.out.println(jugadores[i].getNombre()+" "+jugadores[i].getScore());
}
}
} while (categoria!=3);
}
public int obtenerCategoria(){
int desicion=0;
do {
try {
scan= new Scanner(System.in);
desicion=scan.nextInt();
} catch (InputMismatchException ex) {
System.out.println("ingrese un número");
}
} while (desicion!=1&&desicion!=2&&desicion!=3);
return desicion;
}
public Jugador[] cargarEquipo(){
Jugador jugador;
if (jugadores.length<5) {
jugador=cargarJugador();
jugadores=Arrays.copyOf(jugadores, cantidadDeJugadores);
jugadores[cantidadDeJugadores-1]=jugador;
} else {
System.out.println("No se admiten mas jugadores");
}
return jugadores;
}
public Jugador cargarJugador(){
Jugador jugador=new Jugador(cargarNombre());
cantidadDeJugadores++;
return jugador;
}
public String cargarNombre(){
String nombre;
do {
scan=new Scanner(System.in);
nombre=scan.nextLine();
} while (nombre.length()==0);
return nombre;
}
public static int getCantidadDeJugadores() {
return cantidadDeJugadores;
}
public static Jugador[] getJugadores() {
return jugadores;
}
} | [
"jorgeluisgarciajlg@gmail.com"
] | jorgeluisgarciajlg@gmail.com |
6f4822339b66e740483007f25085a33d8f3cd9bb | a1f215b93fd5957bac4435081a9f56041fb03902 | /src/ar/edu/unlp/info/missilecommand/gui/VentanaPrejuego.java | 7d2ccc0bfd6423f1c9a6b3d8952aea16be3b8ada | [] | no_license | aesanchez/missilecommand | 46725fe736f1e32b610b3f1e48304a2b825b67df | f5fd4f615616268180fa806ac4e3dc7fc645147a | refs/heads/master | 2021-06-11T07:52:57.238251 | 2016-12-15T03:41:57 | 2016-12-15T03:41:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,253 | java | package ar.edu.unlp.info.missilecommand.gui;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import ar.edu.unlp.info.missilecommand.Juego;
public class VentanaPrejuego extends VentanaAbstracta {
private static final long serialVersionUID = 1L;
private JTextField campoNombre;
private JSpinner selectorNivel;
public VentanaPrejuego(JFrame padre) {
super(padre, "Jugar");
inicializarUI();
}
private void inicializarUI() {
// Instanciacion de componentes
JButton botonJugar = new JButton("Jugar ahora");
botonJugar.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (campoNombre.getText().isEmpty()) {
JOptionPane.showMessageDialog(VentanaPrejuego.this,
"Ingrese un nombre para jugar.");
return;
}
Juego.getInstancia()
.setNivelPorDefecto(
(Integer) VentanaPrejuego.this.selectorNivel
.getValue());
new VentanaJuego(VentanaPrejuego.this.padre,
new EntradaPuntaje(campoNombre.getText()));
VentanaPrejuego.this.setVisible(false);
VentanaPrejuego.this.dispose();
}
});
this.getRootPane().setDefaultButton(botonJugar);
campoNombre = new JTextField();
selectorNivel = new JSpinner(new SpinnerNumberModel(1, 1, 25, 1));
// Configuracion del container con los controles
Container contenedor = new Container();
contenedor.setLayout(new GridBagLayout());
contenedor.setSize(300, 300);
GridBagConstraints c;
Insets s = new Insets(10, 10, 10, 10);
// Label nombre
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 1;
c.gridheight = 1;
c.ipadx = 0;
c.ipady = 5;
c.insets = s;
contenedor.add(new JLabel("Nombre"), c);
// Campo de nombre
c = new GridBagConstraints();
c.gridx = 1;
c.gridy = 0;
c.gridwidth = 2;
c.gridheight = 1;
c.ipadx = 200;
c.ipady = 5;
c.insets = s;
contenedor.add(campoNombre, c);
// Label nivel
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 2;
c.gridwidth = 1;
c.gridheight = 1;
c.fill = 2;
c.ipadx = 0;
c.ipady = 5;
c.insets = s;
contenedor.add(new JLabel("Nivel"), c);
// Selector de nivel
c = new GridBagConstraints();
c.gridx = 1;
c.gridy = 2;
c.gridwidth = 1;
c.gridheight = 1;
c.fill = 2;
c.ipadx = 0;
c.ipady = 5;
c.insets = s;
contenedor.add(selectorNivel, c);
// Boton jugar ahora
c = new GridBagConstraints();
c.gridx = 2;
c.gridy = 2;
c.gridwidth = 1;
c.gridheight = 1;
// c.fill=2;
c.ipadx = 0;
c.ipady = 5;
c.insets = s;
contenedor.add(botonJugar, c);
// Configuracion de la ventana
this.setLayout(null);
this.setContentPane(contenedor);
this.pack();
this.setResizable(false);
this.centrarVentana();
this.setVisible(true);
}
}
| [
"trorik23@gmail.com"
] | trorik23@gmail.com |
4f9d9b514fe6683d49fd0bfafa92eeac0b495503 | 79c69fc1bf75f83ad2eeee9376bbfc15166d4b25 | /src/main/java/com/invensoft/util/ThemeSwitcherBean.java | 1a3193691c7cc266c7f90d061be6bf39f09de572 | [] | no_license | danamo89/invensoft | f222942c95189f9069ae5c6a0ae94d84907b6954 | b9c80aff3566ea90fbf4f44ab81b47f9c59f5172 | refs/heads/master | 2020-04-12T05:40:12.491795 | 2016-09-05T22:59:37 | 2016-09-05T22:59:37 | 65,638,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,195 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.invensoft.util;
import java.io.Serializable;
import java.util.Map;
import java.util.TreeMap;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
/**
*
* @author David Navarro M
*/
@ManagedBean
@SessionScoped
public class ThemeSwitcherBean implements Serializable {
private String theme;
private String defaultTheme;
private Map<String, String> themes;
private Map<String, String> requestContextParams;
public ThemeSwitcherBean() {
this.defaultTheme = "redmond";
this.theme = defaultTheme;
}
@PostConstruct
public void init() {
requestContextParams = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
themes = new TreeMap<String, String>();
themes.put("Aristo", "aristo");
themes.put("Black-Tie", "black-tie");
themes.put("Blitzer", "blitzer");
themes.put("Bluesky", "bluesky");
themes.put("Casablanca", "casablanca");
themes.put("Cupertino", "cupertino");
themes.put("Dark-Hive", "dark-hive");
themes.put("Dot-Luv", "dot-luv");
themes.put("Eggplant", "eggplant");
themes.put("Excite-Bike", "excite-bike");
themes.put("Flick", "flick");
themes.put("Glass-X", "glass-x");
themes.put("Hot-Sneaks", "hot-sneaks");
themes.put("Humanity", "humanity");
themes.put("Le-Frog", "le-frog");
themes.put("Midnight", "midnight");
themes.put("Mint-Choc", "mint-choc");
themes.put("Overcast", "overcast");
themes.put("Pepper-Grinder", "pepper-grinder");
themes.put("Redmond", "redmond");
themes.put("Rocket", "rocket");
themes.put("Sam", "sam");
themes.put("Smoothness", "smoothness");
themes.put("South-Street", "south-street");
themes.put("Start", "start");
themes.put("Sunny", "sunny");
themes.put("Swanky-Purse", "swanky-purse");
themes.put("Trontastic", "trontastic");
themes.put("UI-Darkness", "ui-darkness");
themes.put("UI-Lightness", "ui-lightness");
themes.put("Vader", "vader");
}
public void saveTheme() {
defaultTheme = theme;
if(requestContextParams.containsKey("theme")) {
requestContextParams.remove("theme");
requestContextParams.put("theme", defaultTheme);
}
}
//<editor-fold defaultstate="collapsed" desc="Getter && Setter">
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public String getDefaultTheme() {
return defaultTheme;
}
public void setDefaultTheme(String defaultTheme) {
this.defaultTheme = defaultTheme;
}
public Map<String, String> getThemes() {
return themes;
}
public void setThemes(Map<String, String> themes) {
this.themes = themes;
}
//</editor-fold>
}
| [
"David@David"
] | David@David |
b4eeb512365285682e9451cd4998802c7f65311a | a68575a7db157e9bdb5cde5417b5214daed1e5fb | /emb-decision/src/test/java/rule/AutoApprovalTest.java | 9339f0dc89edc6d605fb037290fa1421be3b55dd | [
"Apache-2.0"
] | permissive | llecorps/rhpam7-order-management-demo-collaterals | 9ddc62595f5b50d87ee218788db614cae664ce13 | 55db9af0807daabdcf4044a5572da3f8ccd2bf21 | refs/heads/master | 2020-04-05T00:47:59.471358 | 2018-07-04T14:03:26 | 2018-07-04T14:03:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,417 | java | package rule;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.FactHandle;
import com.example.OrderInfo;
public class AutoApprovalTest {
private KieSession kieSession;
private void initFromClasspath() {
KieServices kieServices = KieServices.Factory.get();
KieContainer kieContainer = kieServices.getKieClasspathContainer();
kieSession = kieContainer.newKieSession();
}
private void initFromMaven() {
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId("com.example", "order-management", "1.0-SNAPSHOT");
KieContainer kieContainer = kieServices.newKieContainer(releaseId);
kieSession = kieContainer.newKieSession();
}
@Before
public void before() {
System.setProperty("jbpm.enable.multi.con", "true");
initFromClasspath();
}
@After
public void after() {
kieSession.dispose();
}
@Test
public void test() {
OrderInfo orderInfo = new OrderInfo(0, "Item1", "basic", "low", 500, null, null);
FactHandle fact = kieSession.insert(orderInfo);
kieSession.getAgenda().getAgendaGroup("approval").setFocus();
int firedRules = kieSession.fireAllRules();
System.out.println(firedRules + " " + orderInfo);
assertTrue("at least 1 rule", firedRules>0);
assertTrue("approved", orderInfo.getManagerApproval());
//----------------------------------------------------------------------
orderInfo.setPrice(501);
kieSession.update(fact, orderInfo);
kieSession.getAgenda().getAgendaGroup("approval").setFocus();
firedRules = kieSession.fireAllRules();
System.out.println(firedRules + " " + orderInfo);
assertTrue("at least 1 rule", firedRules>0);
assertTrue("not approved", false == orderInfo.getManagerApproval());
//----------------------------------------------------------------------
orderInfo.setCategory("optional");
orderInfo.setPrice(100);
kieSession.update(fact, orderInfo);
kieSession.getAgenda().getAgendaGroup("approval").setFocus();
firedRules = kieSession.fireAllRules();
System.out.println(firedRules + " " + orderInfo);
assertTrue("at least 1 rule", firedRules>0);
assertTrue("approved", orderInfo.getManagerApproval());
}
}
| [
"donato.marrazzo@gmail.com"
] | donato.marrazzo@gmail.com |
e4da5258948ca9d07c7861c3956a522584710f60 | db6e498dd76a6ce78d83e1e7801674783230a90d | /thirdlib/base-protocol/protocol/src/main/java/pb4client/AllianceQuit.java | f54fce75e2d834215e987dd176aea9a2006d2666 | [] | no_license | daxingyou/game-4 | 3d78fb460c4b18f711be0bb9b9520d3e8baf8349 | 2baef6cebf5eb0991b1f5c632c500b522c41ab20 | refs/heads/master | 2023-03-19T15:57:56.834881 | 2018-10-10T06:35:57 | 2018-10-10T06:35:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 13,218 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: client2server.proto
package pb4client;
/**
* <pre>
* msgType = 811
* 客户端 -> 服务器
* 玩家主动退出联盟
* </pre>
*
* Protobuf type {@code client2server.AllianceQuit}
*/
public final class AllianceQuit extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:client2server.AllianceQuit)
AllianceQuitOrBuilder {
// Use AllianceQuit.newBuilder() to construct.
private AllianceQuit(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private AllianceQuit() {
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private AllianceQuit(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return pb4client.War2GamePkt.internal_static_client2server_AllianceQuit_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return pb4client.War2GamePkt.internal_static_client2server_AllianceQuit_fieldAccessorTable
.ensureFieldAccessorsInitialized(
pb4client.AllianceQuit.class, pb4client.AllianceQuit.Builder.class);
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof pb4client.AllianceQuit)) {
return super.equals(obj);
}
pb4client.AllianceQuit other = (pb4client.AllianceQuit) obj;
boolean result = true;
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static pb4client.AllianceQuit parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static pb4client.AllianceQuit parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static pb4client.AllianceQuit parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static pb4client.AllianceQuit parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static pb4client.AllianceQuit parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static pb4client.AllianceQuit parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static pb4client.AllianceQuit parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static pb4client.AllianceQuit parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static pb4client.AllianceQuit parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static pb4client.AllianceQuit parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static pb4client.AllianceQuit parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static pb4client.AllianceQuit parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(pb4client.AllianceQuit prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* msgType = 811
* 客户端 -> 服务器
* 玩家主动退出联盟
* </pre>
*
* Protobuf type {@code client2server.AllianceQuit}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:client2server.AllianceQuit)
pb4client.AllianceQuitOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return pb4client.War2GamePkt.internal_static_client2server_AllianceQuit_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return pb4client.War2GamePkt.internal_static_client2server_AllianceQuit_fieldAccessorTable
.ensureFieldAccessorsInitialized(
pb4client.AllianceQuit.class, pb4client.AllianceQuit.Builder.class);
}
// Construct using pb4client.AllianceQuit.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return pb4client.War2GamePkt.internal_static_client2server_AllianceQuit_descriptor;
}
public pb4client.AllianceQuit getDefaultInstanceForType() {
return pb4client.AllianceQuit.getDefaultInstance();
}
public pb4client.AllianceQuit build() {
pb4client.AllianceQuit result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public pb4client.AllianceQuit buildPartial() {
pb4client.AllianceQuit result = new pb4client.AllianceQuit(this);
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof pb4client.AllianceQuit) {
return mergeFrom((pb4client.AllianceQuit)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(pb4client.AllianceQuit other) {
if (other == pb4client.AllianceQuit.getDefaultInstance()) return this;
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
pb4client.AllianceQuit parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (pb4client.AllianceQuit) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:client2server.AllianceQuit)
}
// @@protoc_insertion_point(class_scope:client2server.AllianceQuit)
private static final pb4client.AllianceQuit DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new pb4client.AllianceQuit();
}
public static pb4client.AllianceQuit getDefaultInstance() {
return DEFAULT_INSTANCE;
}
@java.lang.Deprecated public static final com.google.protobuf.Parser<AllianceQuit>
PARSER = new com.google.protobuf.AbstractParser<AllianceQuit>() {
public AllianceQuit parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new AllianceQuit(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<AllianceQuit> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<AllianceQuit> getParserForType() {
return PARSER;
}
public pb4client.AllianceQuit getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"weiwei.witch@gmail.com"
] | weiwei.witch@gmail.com |
c2101fbc2c068795a2d1b8b20de2652f577f6e4f | d095b245e0f4fbb3a9536c967d8dcb01b35ebf0f | /src/LogsPack/TestClass.java | 6f85a11f64d46eb0b1020641eba1301ec50a1a51 | [] | no_license | Deepak9292J/Log4J2Demo | 68f5b525b752110c2d92e94d72bf346eb60aabbe | 897ddde67626be3eacc904c62a35289ed2a3281a | refs/heads/master | 2020-04-04T17:29:49.424456 | 2018-11-04T20:41:11 | 2018-11-04T20:41:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java | package LogsPack;
import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.android.AndroidDriver;
public class TestClass extends Baseclass {
public static void main(String[] args) throws MalformedURLException {
try
{
AndroidDriver driver=capabilities();
Log.startTestCase("Appium_Test_Case_001");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
log.info("Implicit wait applied on the driver for 10 seconds");
driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click();
log.info("Preferences Button clicked on Home Page");
driver.findElementByXPath("//android.widget.TextView[@text='3. Preference dependencies']").click();
log.info("Prefernces Dependencies Clicked");
driver.findElementById("android:id/checkbox").click();
log.info("Checkbox clicked.");
driver.findElementByXPath("(//android.widget.RelativeLayout)[2]").click();
log.info("Button clicked");
driver.findElementByClassName("android.widget.EditText").sendKeys("First Input");
log.info("Text entered in the popup");
driver.findElementById("android:id/button1").click();
log.info("OK button clicked in the popup");
Log.endTestCase("Appium_Test_Case_001");
}catch(Exception e){
log.error("Exception occured! Element not found", e);
throw(e);
}
}
}
| [
"deepak1001jindal@gmail,com"
] | deepak1001jindal@gmail,com |
9cb310e13cc572adda2898b60a9e77c61ff63b32 | f7150dba3895b0c05e91a80a2784361a73cb035e | /src/main/java/com/zhangshuo/autotest/service/impl/UserServiceImpl.java | 11cb94eafd8a6a7332a53efcb35e778d1c2542eb | [] | no_license | T-zhangshuo/autotest | ddc3e4fa1720b07912f4876ead57824bb8002a6f | 57db7243c3eb3f7c80f12093907fe0b0f3d63c82 | refs/heads/master | 2022-06-29T21:42:35.573555 | 2019-11-18T10:15:16 | 2019-11-18T10:15:16 | 221,399,202 | 0 | 0 | null | 2022-06-17T02:37:14 | 2019-11-13T07:33:11 | Java | UTF-8 | Java | false | false | 2,097 | java | package com.zhangshuo.autotest.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhangshuo.autotest.service.UserService;
import com.zhangshuo.autotest.utils.AutoIdUtils;
import com.zhangshuo.basebus.mapper.BaseUserMapper;
import com.zhangshuo.basebus.model.BaseUser;
import com.zhangshuo.basebus.service.BaseUserService;
import com.zhangshuo.basebus.service.impl.BaseUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import sun.security.provider.MD5;
@Service
public class UserServiceImpl extends BaseUserServiceImpl implements UserService {
@Autowired
private BaseUserMapper baseUserMapper;
@Override
public BaseUser login(String username, String password) {
QueryWrapper<BaseUser> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username", username);
queryWrapper.eq("password", DigestUtils.md5DigestAsHex(password.getBytes()).toUpperCase());
queryWrapper.eq("status", 1);
return baseUserMapper.selectOne(queryWrapper);
}
@Override
public BaseUser register(String username, String password, String nickname, String realname, String avatar, Integer gender) {
//检测是否已经有相同用户名的用户
QueryWrapper<BaseUser> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username", username);
queryWrapper.eq("status", 1);
Integer integer = baseUserMapper.selectCount(queryWrapper);
if (integer > 0) {
return null;
}
BaseUser baseUser = new BaseUser();
baseUser.setId(AutoIdUtils.get().nextId());
baseUser.setUsername(username);
baseUser.setPassword(DigestUtils.md5DigestAsHex(password.getBytes()).toUpperCase());
baseUser.setNickname(nickname);
baseUser.setRealname(realname);
baseUser.setAvatar(avatar);
baseUser.setGender(gender);
return baseUserMapper.insert(baseUser) > 0?baseUser:null;
}
}
| [
"streett@qq.com"
] | streett@qq.com |
cf85db33a67af72eb55775e22e881445c4b19263 | 86cf61187d22b867d1e5d3c8a23d97e806636020 | /src/main/java/base/operators/h2o/model/custom/deeplearning/DeepLearningTask.java | 7e0c7cd9cf1c8b8782ed4fb4be15552bf5d9751c | [] | no_license | hitaitengteng/abc-pipeline-engine | f94bb3b1888ad809541c83d6923a64c39fef9b19 | 165a620b94fb91ae97647135cc15a66d212a39e8 | refs/heads/master | 2022-02-22T18:49:28.915809 | 2019-10-27T13:40:58 | 2019-10-27T13:40:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,842 | java | package base.operators.h2o.model.custom.deeplearning;
import base.operators.h2o.model.custom.deeplearning.DeepLearningModel.DeepLearningParameters;
import base.operators.h2o.model.custom.deeplearning.Neurons.ExpRectifier;
import base.operators.h2o.model.custom.deeplearning.Neurons.ExpRectifierDropout;
import base.operators.h2o.model.custom.deeplearning.Neurons.Input;
import base.operators.h2o.model.custom.deeplearning.Neurons.Linear;
import base.operators.h2o.model.custom.deeplearning.Neurons.Maxout;
import base.operators.h2o.model.custom.deeplearning.Neurons.MaxoutDropout;
import base.operators.h2o.model.custom.deeplearning.Neurons.Rectifier;
import base.operators.h2o.model.custom.deeplearning.Neurons.RectifierDropout;
import base.operators.h2o.model.custom.deeplearning.Neurons.Softmax;
import base.operators.h2o.model.custom.deeplearning.Neurons.Tanh;
import base.operators.h2o.model.custom.deeplearning.Neurons.TanhDropout;
public class DeepLearningTask {
public DeepLearningTask() {
}
public static void fpropMiniBatch(long seed, Neurons[] neurons, DeepLearningModelInfo minfo, DeepLearningModelInfo consensus_minfo, boolean training, double[] responses, double[] offset, int n) {
int mb;
for(mb = 1; mb < neurons.length; ++mb) {
neurons[mb].fprop(seed, training, n);
}
for(mb = 0; mb < n; ++mb) {
if (offset != null && offset[mb] > 0.0D) {
assert !minfo._classification;
double[] m = minfo.data_info()._normRespMul;
double[] s = minfo.data_info()._normRespSub;
double mul = m == null ? 1.0D : m[0];
double sub = s == null ? 0.0D : s[0];
neurons[neurons.length - 1]._a[mb].add(0, (offset[mb] - sub) * mul);
}
if (training) {
neurons[neurons.length - 1].setOutputLayerGradient(responses[mb], mb, n);
if (consensus_minfo != null) {
for(int i = 1; i < neurons.length; ++i) {
neurons[i]._wEA = consensus_minfo.get_weights(i - 1);
neurons[i]._bEA = consensus_minfo.get_biases(i - 1);
}
}
}
}
}
public static Neurons[] makeNeuronsForTraining(DeepLearningModelInfo minfo) {
return makeNeurons(minfo, true);
}
public static Neurons[] makeNeuronsForTesting(DeepLearningModelInfo minfo) {
return makeNeurons(minfo, false);
}
private static Neurons[] makeNeurons(DeepLearningModelInfo minfo, boolean training) {
DataInfo dinfo = minfo.data_info();
DeepLearningParameters params = minfo.get_params();
int[] h = params._hidden;
Neurons[] neurons = new Neurons[h.length + 2];
neurons[0] = new Input(params, minfo.units[0], dinfo);
int i;
for(i = 0; i < h.length + (params._autoencoder ? 1 : 0); ++i) {
int n = params._autoencoder && i == h.length ? minfo.units[0] : h[i];
switch(params._activation) {
case Tanh:
neurons[i + 1] = new Tanh(n);
break;
case TanhWithDropout:
neurons[i + 1] = (Neurons)(params._autoencoder && i == h.length ? new Tanh(n) : new TanhDropout(n));
break;
case Rectifier:
neurons[i + 1] = new Rectifier(n);
break;
case RectifierWithDropout:
neurons[i + 1] = (Neurons)(params._autoencoder && i == h.length ? new Rectifier(n) : new RectifierDropout(n));
break;
case Maxout:
neurons[i + 1] = new Maxout(params, (short)2, n);
break;
case MaxoutWithDropout:
neurons[i + 1] = (Neurons)(params._autoencoder && i == h.length ? new Maxout(params, (short)2, n) : new MaxoutDropout(params, (short)2, n));
break;
case ExpRectifier:
neurons[i + 1] = new ExpRectifier(n);
break;
case ExpRectifierWithDropout:
neurons[i + 1] = (Neurons)(params._autoencoder && i == h.length ? new ExpRectifier(n) : new ExpRectifierDropout(n));
}
}
if (!params._autoencoder) {
if (minfo._classification) {
neurons[neurons.length - 1] = new Softmax(minfo.units[minfo.units.length - 1]);
} else {
neurons[neurons.length - 1] = new Linear();
}
}
for(i = 0; i < neurons.length; ++i) {
neurons[i].init(neurons, i, params, minfo, training);
neurons[i]._input = neurons[0];
}
return neurons;
}
}
| [
"wangj_lc@inspur.com"
] | wangj_lc@inspur.com |
ae0d377715d539de675f6e662e55c7bd75175d2c | 9da74af37d03294d0693f05b732e7f417550e6a3 | /module-core/src/main/java/com/github/andyglow/ratefeed/http/sax/SaxHandlerBase.java | 3c5e3f2517428cf0c251b2b2d0c82fbbec667084 | [] | no_license | andyglow/ratefeed | 86bdcba3f9e4733e56889fc94148e80929e40afe | f92f03cb2417a992444595c15536521958279269 | refs/heads/master | 2021-01-19T12:36:42.232939 | 2015-03-13T00:32:49 | 2015-03-13T00:32:49 | 32,110,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package com.github.andyglow.ratefeed.http.sax;
import com.github.andyglow.ratefeed.util.IConsumer;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import java.util.Optional;
public abstract class SaxHandlerBase<U> extends DefaultHandler {
private IConsumer<U> collector;
public SaxHandlerBase(IConsumer<U> collector) {
this.collector = collector;
}
protected final void handleItem(U item) {
collector.item(item);
}
@Override
public final void endDocument() throws SAXException {
collector.done(Optional.empty());
}
}
| [
"andyglow@gmail.com"
] | andyglow@gmail.com |
f399ba0d9483cceb020cd732407772d379137417 | 719ced66bebae9f8bf17467af2e43a96cf1aa902 | /Interface/app/src/main/java/com/example/sanji/aninterface/ObjectToUpdateInterface.java | a26ccfcb9782b404dd90c0c77dc84255f302606b | [] | no_license | togoumino/Rocketapp | 7800daac42057eeb0581f0fc20662cbdb55837e3 | 75173d1665164efe2b2675a4b0fadf398906930a | refs/heads/master | 2020-04-22T01:51:36.214898 | 2019-02-10T21:04:54 | 2019-02-10T21:04:54 | 169,794,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package com.example.sanji.aninterface;
import com.example.sanji.aninterface.messageFormat.CANMessage;
/**
* Created by leandre on 18-03-23.
*/
public interface ObjectToUpdateInterface {
public void update(String data);
}
| [
"papa-magueye.samb@polymtl.ca"
] | papa-magueye.samb@polymtl.ca |
5d37d3427b88c508b88b411ede9e50a24ff20a4a | af80c0f4c2ba2df39604c300c90031e82fb3aba0 | /src/main/java/com/example/demo/common/support/MappingMatch.java | ab5f88facde7aa95ce8f7c7f622b7120681a65f6 | [] | no_license | Interests-Driven/dataProcess | 9c2bc83b8335f59cd7d9306a1d23bdaeb9bf89c0 | fc2237cb93ccee6369aabc00b10c8f1980e4aaed | refs/heads/master | 2021-09-11T15:10:16.988481 | 2018-04-09T03:04:57 | 2018-04-09T03:04:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,068 | java | package com.example.demo.common.support;
import com.alibaba.fastjson.JSONObject;
import com.example.demo.entity.Mapping;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import java.util.*;
/**
* 类型映射支持类
*
* @author aron
*/
public class MappingMatch {
public static void addMappingRule(MongoTemplate mongoTemplate) {
List<JSONObject> mapping = new ArrayList<>();
JSONObject other = new JSONObject();
List<JSONObject> otherList = new ArrayList<>();
other.put("type", "其他记录");
other.put("level", 1);
other.put("rank", 1);
other.put("subType", otherList);
//其他记录
String[] containArray = new String[]{"宣教", "清单", "报告卡", "计划", "护理记录", "告知", "计划", "通知书", "评分", "健康教育", "全院通用", "责任书", "心电图、TCD、脑电图", "病历名称",
"输血反应报告", "体检封面", "检测表", "自费", "知情", "饮食-低脂普食", "入院介绍表", "入院护理评估", "同意书", "协议书", "告知书", "承诺书", "记录单", "志愿书", "知情书", "知情同意书",
"申请单", "审批表", "评估单", "评估表", "登记表", "报告单", "观察表", "监控表", "指肠切除术", "胰腺癌化疗", "胰腺肿瘤手术", "输血", "镇痛记录", "高危患者", "冠脉造影", "病史摘要",
"专用单", "评价表", "调查表", "拒绝书","讨论记录"};
/*JSONObject assay = new JSONObject();
assay.put("_id", "化验的ID");
改进成Object类型 然后通过哦按段类型做不同的处理方式
*/
otherList.add(generateItem(containArray, new String[]{"查房", "病程", "EUS+FNA", "EUS引导下FNA术", "穿刺置管记录", "操作记录", "历史摘要", "股静脉置管", "穿刺记录", "透析记录", "超声内镜+穿刺术", "超声胃镜+FNA术", "切除术", "引流术"}, "其他", null, 2, 1));
otherList.add(generateItem(new String[]{"会诊单", "会诊记录"}, null, "会诊单", null, 2, 1));
otherList.add(generateItem(new String[]{"体温单"}, null, "体温单", null, 2, 1));
//入院
JSONObject ruyuan = new JSONObject();
List<JSONObject> hospitalList = new ArrayList<>();
ruyuan.put("type", "入院记录");
ruyuan.put("level", 1);
ruyuan.put("rank", 8);
ruyuan.put("subType", hospitalList);
hospitalList.add(generateItem(new String[]{"病案首页"}, null, "病案首页", null, 2, 1));
hospitalList.add(generateItem(new String[]{"小时内入出院","24小时"}, null, "24小时内入出院", null, 2, 2));
hospitalList.add(generateItem(new String[]{"入院", "入出院", "甲状腺腺癌"}, new String[]{"护理评估", "介绍表", "入院模板", "病情告知", "死亡"}, "入院记录", null, 2, 3));
//治疗方案
JSONObject bingcheng = new JSONObject();
List<JSONObject> subList = new ArrayList<>();
bingcheng.put("type", "治疗方案");
bingcheng.put("level", 1);
bingcheng.put("rank", 6);
bingcheng.put("subType", subList);
subList.add(generateItem(new String[]{"ICU出室记录"}, null, "ICU入室记录", null, 2, 1));
subList.add(generateItem(new String[]{"ICU入室记录"}, null, "ICU入室记录", null, 2, 2));
subList.add(generateItem(new String[]{"病程", "查房", "转出", "转入", "危急值记录", "危急值报告", "抢救", "拔管记录", "阶段小结", "术后记录"}, null, "病程", null, 2, 3));
//出院
JSONObject chuyuan = new JSONObject();
subList = new ArrayList<>();
chuyuan.put("type", "出院记录");
chuyuan.put("level", 1);
chuyuan.put("rank", 7);
chuyuan.put("subType", subList);
subList.add(generateItem(new String[]{"死亡小结"}, null, "死亡小结", null, 2, 1));
subList.add(generateItem(new String[]{"死亡"}, new String[]{"讨论"}, "死亡记录", null, 2, 2));
subList.add(generateItem(new String[]{"出院小结", "出院小节"}, null, "出院小结", null, 2, 3));
subList.add(generateItem(new String[]{"出院", "经超声胃镜超声造影记录"}, new String[]{"病程", "查房", "入出院","出院指导"}, "出院记录", null, 2, 4));
//检查记录
JSONObject inspection = new JSONObject();
subList = new ArrayList<>();
inspection.put("type", "检查记录");
inspection.put("level", 1);
inspection.put("rank", 5);
inspection.put("subType", subList);
subList.add(generateItem(new String[]{"检查记录", "胃镜诊疗记录", "胃镜检查", "胃镜下介入治疗记录", "超声内镜"}, null, "检查", null, 2, 1));
//化验记录
JSONObject assay = new JSONObject();
subList = new ArrayList<>();
assay.put("type", "化验记录");
assay.put("level", 1);
assay.put("rank", 4);
assay.put("subType", subList);
subList.add(generateItem(new String[]{"微生物"}, null, "微生物", null, 2, 1));
subList.add(generateItem(new String[]{"化验记录"}, null, "化验", null, 2, 2));
//手术操作记录
JSONObject operate = new JSONObject();
subList = new ArrayList<>();
operate.put("type", "手术操作记录");
operate.put("level", 1);
operate.put("rank", 3);
operate.put("subType", subList);
subList.add(generateItem(new String[]{"术前讨论"}, null, "术前讨论", null, 2, 1));
subList.add(generateItem(new String[]{"术前小结"}, null, "术前小结", null, 2, 2));
subList.add(generateItem(new String[]{"手术记录", "手术过程", "EUS+FNA", "EUS引导下FNA术", "穿刺置管记录", "操作记录", "历史摘要", "股静脉置管", "穿刺记录", "透析记录", "超声内镜+穿刺术", "超声胃镜+FNA术", "切除术", "引流术"}, null, "手术", null, 2, 3));
//门诊记录
JSONObject menzhen = new JSONObject();
subList = new ArrayList<>();
menzhen.put("type", "门诊记录");
menzhen.put("level", 1);
menzhen.put("rank", 2);
menzhen.put("subType", subList);
subList.add(generateItem(new String[]{"门诊记录"}, null, "门诊", null, 2, 1));
//病理
JSONObject bingli = new JSONObject();
subList = new ArrayList<>();
bingli.put("type", "病理");
bingli.put("level", 1);
bingli.put("rank", 9);
bingli.put("subType", subList);
subList.add(generateItem(new String[]{"病理", "TNM分期"}, null, "病理", null, 2, 1));
mapping.add(other);
mapping.add(ruyuan);
mapping.add(bingcheng);
mapping.add(chuyuan);
mapping.add(inspection);
mapping.add(assay);
mapping.add(operate);
mapping.add(menzhen);
mapping.add(bingli);
mongoTemplate.insert(mapping, "Mapping");
}
private static JSONObject generateItem(Object[] include, Object[] exclude, String typeValue, List<JSONObject> subType, Integer level, Integer rank) {
/*
rule :1 代表 包含key对应的值的规则,例如 include=宣教 exclude=清单 则rule为 包含'宣教' and 不包含'清单' 的取值mappedValue
rule :2 待定
*/
JSONObject item = new JSONObject();
item.put("include", include);
item.put("exclude", exclude);
Map<String, String> rule = new HashMap<>();
rule.put("include", "OR");
rule.put("exclude", "AND");
item.put("rule", rule);
item.put("level", level);
item.put("rank", rank);
item.put("type", typeValue);
item.put("subType", subType);
return item;
}
public static String getMappedValue(List<Mapping> mappings, String content) {
Collections.sort(mappings);
for (Mapping mapping : mappings) {
String mappedValue = executeMapping(mapping, content, mapping.getType());
if (StringUtils.isNotBlank(mappedValue)) {
return mappedValue;
}
}
return "其他记录-其他";
}
private static String executeMapping(Mapping mapping, String content, String parentType) {
String mappedValue = null;
if (mapping == null || StringUtils.isBlank(content)) {
return null;
}
List<Mapping> subType = mapping.getSubType();
if (subType != null && !subType.isEmpty()) {
//按照rank大小排序
Collections.sort(subType);
for (Mapping subMapping : subType) {
mappedValue = executeMapping(subMapping, content, StringUtils.isBlank(parentType) ? subMapping.getType() : parentType);
if (StringUtils.isNotBlank(mappedValue)) {
return mappedValue;
}
}
return null;
}
String currentType = mapping.getType();
String[] includes = mapping.getInclude();
if (includes == null || includes.length == 0) {
return null;
}
for (String includeKey : includes) {
if (content.contains(includeKey)) {
String[] exclude = mapping.getExclude();
//如果沒有需要去除的字段匹配,就直接返回
if (exclude == null || exclude.length == 0) {
return StringUtils.isBlank(parentType) ? currentType : parentType + "-" + currentType;
}
for (String excludeKey : exclude) {
if (content.contains(excludeKey)) {
return null;
}
}
return StringUtils.isBlank(parentType) ? currentType : parentType + "-" + currentType;
}
}
return null;
}
}
| [
"aron.xu@hitales.com.cn"
] | aron.xu@hitales.com.cn |
b67738ea9f87bd551aabe7a07b2cb91629e7bcbd | 4f1a305084c056e21c7b282783e511bad73d43d2 | /TinyPiE/antlr-generated/parser/TinyPiEParser.java | 91372d8ed4608b7f23437488c296c4293e38d8ba | [] | no_license | Ikenoue1190294/ugawa-compiler2017 | 1c99a3dca7b2152f4861bf5c24ae96f471b4f41b | 4283e882db1e48a15f55471b5be1a5f8278cfa61 | refs/heads/master | 2021-09-06T21:48:27.990137 | 2018-02-12T05:22:23 | 2018-02-12T05:22:23 | 109,633,529 | 0 | 0 | null | 2017-11-06T01:39:08 | 2017-11-06T01:39:08 | null | UTF-8 | Java | false | false | 17,580 | java | // Generated from parser/TinyPiE.g4 by ANTLR 4.6
package parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class TinyPiEParser extends Parser {
static { RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, ADDOP=3, SUBOP=4, NOTOP=5, MULOP=6, OROP=7, ANDOP=8, IDENTIFIER=9,
VALUE=10, WS=11;
public static final int
RULE_expr = 0, RULE_orExpr = 1, RULE_andExpr = 2, RULE_addExpr = 3, RULE_mulExpr = 4,
RULE_unaryExpr = 5;
public static final String[] ruleNames = {
"expr", "orExpr", "andExpr", "addExpr", "mulExpr", "unaryExpr"
};
private static final String[] _LITERAL_NAMES = {
null, "'('", "')'", "'+'", "'-'", "'~'", null, "'|'", "'&'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, "ADDOP", "SUBOP", "NOTOP", "MULOP", "OROP", "ANDOP",
"IDENTIFIER", "VALUE", "WS"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "TinyPiE.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public TinyPiEParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class ExprContext extends ParserRuleContext {
public OrExprContext orExpr() {
return getRuleContext(OrExprContext.class,0);
}
public ExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expr; }
}
public final ExprContext expr() throws RecognitionException {
ExprContext _localctx = new ExprContext(_ctx, getState());
enterRule(_localctx, 0, RULE_expr);
try {
enterOuterAlt(_localctx, 1);
{
setState(12);
orExpr(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class OrExprContext extends ParserRuleContext {
public AndExprContext andExpr() {
return getRuleContext(AndExprContext.class,0);
}
public OrExprContext orExpr() {
return getRuleContext(OrExprContext.class,0);
}
public TerminalNode OROP() { return getToken(TinyPiEParser.OROP, 0); }
public OrExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_orExpr; }
}
public final OrExprContext orExpr() throws RecognitionException {
return orExpr(0);
}
private OrExprContext orExpr(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
OrExprContext _localctx = new OrExprContext(_ctx, _parentState);
OrExprContext _prevctx = _localctx;
int _startState = 2;
enterRecursionRule(_localctx, 2, RULE_orExpr, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(15);
andExpr(0);
}
_ctx.stop = _input.LT(-1);
setState(22);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,0,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new OrExprContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_orExpr);
setState(17);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(18);
match(OROP);
setState(19);
andExpr(0);
}
}
}
setState(24);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,0,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class AndExprContext extends ParserRuleContext {
public AddExprContext addExpr() {
return getRuleContext(AddExprContext.class,0);
}
public AndExprContext andExpr() {
return getRuleContext(AndExprContext.class,0);
}
public TerminalNode ANDOP() { return getToken(TinyPiEParser.ANDOP, 0); }
public AndExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_andExpr; }
}
public final AndExprContext andExpr() throws RecognitionException {
return andExpr(0);
}
private AndExprContext andExpr(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
AndExprContext _localctx = new AndExprContext(_ctx, _parentState);
AndExprContext _prevctx = _localctx;
int _startState = 4;
enterRecursionRule(_localctx, 4, RULE_andExpr, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(26);
addExpr(0);
}
_ctx.stop = _input.LT(-1);
setState(33);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,1,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new AndExprContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_andExpr);
setState(28);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(29);
match(ANDOP);
setState(30);
addExpr(0);
}
}
}
setState(35);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,1,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class AddExprContext extends ParserRuleContext {
public MulExprContext mulExpr() {
return getRuleContext(MulExprContext.class,0);
}
public AddExprContext addExpr() {
return getRuleContext(AddExprContext.class,0);
}
public TerminalNode ADDOP() { return getToken(TinyPiEParser.ADDOP, 0); }
public TerminalNode SUBOP() { return getToken(TinyPiEParser.SUBOP, 0); }
public AddExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_addExpr; }
}
public final AddExprContext addExpr() throws RecognitionException {
return addExpr(0);
}
private AddExprContext addExpr(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
AddExprContext _localctx = new AddExprContext(_ctx, _parentState);
AddExprContext _prevctx = _localctx;
int _startState = 6;
enterRecursionRule(_localctx, 6, RULE_addExpr, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(37);
mulExpr(0);
}
_ctx.stop = _input.LT(-1);
setState(47);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(45);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
case 1:
{
_localctx = new AddExprContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_addExpr);
setState(39);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(40);
match(ADDOP);
setState(41);
mulExpr(0);
}
break;
case 2:
{
_localctx = new AddExprContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_addExpr);
setState(42);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(43);
match(SUBOP);
setState(44);
mulExpr(0);
}
break;
}
}
}
setState(49);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class MulExprContext extends ParserRuleContext {
public UnaryExprContext unaryExpr() {
return getRuleContext(UnaryExprContext.class,0);
}
public MulExprContext mulExpr() {
return getRuleContext(MulExprContext.class,0);
}
public TerminalNode MULOP() { return getToken(TinyPiEParser.MULOP, 0); }
public MulExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_mulExpr; }
}
public final MulExprContext mulExpr() throws RecognitionException {
return mulExpr(0);
}
private MulExprContext mulExpr(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
MulExprContext _localctx = new MulExprContext(_ctx, _parentState);
MulExprContext _prevctx = _localctx;
int _startState = 8;
enterRecursionRule(_localctx, 8, RULE_mulExpr, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(51);
unaryExpr();
}
_ctx.stop = _input.LT(-1);
setState(58);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,4,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new MulExprContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_mulExpr);
setState(53);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(54);
match(MULOP);
setState(55);
unaryExpr();
}
}
}
setState(60);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,4,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class UnaryExprContext extends ParserRuleContext {
public UnaryExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_unaryExpr; }
public UnaryExprContext() { }
public void copyFrom(UnaryExprContext ctx) {
super.copyFrom(ctx);
}
}
public static class VarExprContext extends UnaryExprContext {
public TerminalNode IDENTIFIER() { return getToken(TinyPiEParser.IDENTIFIER, 0); }
public VarExprContext(UnaryExprContext ctx) { copyFrom(ctx); }
}
public static class LiteralExprContext extends UnaryExprContext {
public TerminalNode VALUE() { return getToken(TinyPiEParser.VALUE, 0); }
public LiteralExprContext(UnaryExprContext ctx) { copyFrom(ctx); }
}
public static class SubExprContext extends UnaryExprContext {
public UnaryExprContext unaryExpr() {
return getRuleContext(UnaryExprContext.class,0);
}
public TerminalNode SUBOP() { return getToken(TinyPiEParser.SUBOP, 0); }
public TerminalNode NOTOP() { return getToken(TinyPiEParser.NOTOP, 0); }
public SubExprContext(UnaryExprContext ctx) { copyFrom(ctx); }
}
public static class ParenExprContext extends UnaryExprContext {
public ExprContext expr() {
return getRuleContext(ExprContext.class,0);
}
public ParenExprContext(UnaryExprContext ctx) { copyFrom(ctx); }
}
public final UnaryExprContext unaryExpr() throws RecognitionException {
UnaryExprContext _localctx = new UnaryExprContext(_ctx, getState());
enterRule(_localctx, 10, RULE_unaryExpr);
int _la;
try {
setState(69);
_errHandler.sync(this);
switch (_input.LA(1)) {
case VALUE:
_localctx = new LiteralExprContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(61);
match(VALUE);
}
break;
case IDENTIFIER:
_localctx = new VarExprContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(62);
match(IDENTIFIER);
}
break;
case T__0:
_localctx = new ParenExprContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(63);
match(T__0);
setState(64);
expr();
setState(65);
match(T__1);
}
break;
case SUBOP:
case NOTOP:
_localctx = new SubExprContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(67);
_la = _input.LA(1);
if ( !(_la==SUBOP || _la==NOTOP) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(68);
unaryExpr();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 1:
return orExpr_sempred((OrExprContext)_localctx, predIndex);
case 2:
return andExpr_sempred((AndExprContext)_localctx, predIndex);
case 3:
return addExpr_sempred((AddExprContext)_localctx, predIndex);
case 4:
return mulExpr_sempred((MulExprContext)_localctx, predIndex);
}
return true;
}
private boolean orExpr_sempred(OrExprContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 2);
}
return true;
}
private boolean andExpr_sempred(AndExprContext _localctx, int predIndex) {
switch (predIndex) {
case 1:
return precpred(_ctx, 2);
}
return true;
}
private boolean addExpr_sempred(AddExprContext _localctx, int predIndex) {
switch (predIndex) {
case 2:
return precpred(_ctx, 3);
case 3:
return precpred(_ctx, 2);
}
return true;
}
private boolean mulExpr_sempred(MulExprContext _localctx, int predIndex) {
switch (predIndex) {
case 4:
return precpred(_ctx, 2);
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\rJ\4\2\t\2\4\3\t"+
"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\7\3"+
"\27\n\3\f\3\16\3\32\13\3\3\4\3\4\3\4\3\4\3\4\3\4\7\4\"\n\4\f\4\16\4%\13"+
"\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\7\5\60\n\5\f\5\16\5\63\13\5\3\6"+
"\3\6\3\6\3\6\3\6\3\6\7\6;\n\6\f\6\16\6>\13\6\3\7\3\7\3\7\3\7\3\7\3\7\3"+
"\7\3\7\5\7H\n\7\3\7\2\6\4\6\b\n\b\2\4\6\b\n\f\2\3\3\2\6\7K\2\16\3\2\2"+
"\2\4\20\3\2\2\2\6\33\3\2\2\2\b&\3\2\2\2\n\64\3\2\2\2\fG\3\2\2\2\16\17"+
"\5\4\3\2\17\3\3\2\2\2\20\21\b\3\1\2\21\22\5\6\4\2\22\30\3\2\2\2\23\24"+
"\f\4\2\2\24\25\7\t\2\2\25\27\5\6\4\2\26\23\3\2\2\2\27\32\3\2\2\2\30\26"+
"\3\2\2\2\30\31\3\2\2\2\31\5\3\2\2\2\32\30\3\2\2\2\33\34\b\4\1\2\34\35"+
"\5\b\5\2\35#\3\2\2\2\36\37\f\4\2\2\37 \7\n\2\2 \"\5\b\5\2!\36\3\2\2\2"+
"\"%\3\2\2\2#!\3\2\2\2#$\3\2\2\2$\7\3\2\2\2%#\3\2\2\2&\'\b\5\1\2\'(\5\n"+
"\6\2(\61\3\2\2\2)*\f\5\2\2*+\7\5\2\2+\60\5\n\6\2,-\f\4\2\2-.\7\6\2\2."+
"\60\5\n\6\2/)\3\2\2\2/,\3\2\2\2\60\63\3\2\2\2\61/\3\2\2\2\61\62\3\2\2"+
"\2\62\t\3\2\2\2\63\61\3\2\2\2\64\65\b\6\1\2\65\66\5\f\7\2\66<\3\2\2\2"+
"\678\f\4\2\289\7\b\2\29;\5\f\7\2:\67\3\2\2\2;>\3\2\2\2<:\3\2\2\2<=\3\2"+
"\2\2=\13\3\2\2\2><\3\2\2\2?H\7\f\2\2@H\7\13\2\2AB\7\3\2\2BC\5\2\2\2CD"+
"\7\4\2\2DH\3\2\2\2EF\t\2\2\2FH\5\f\7\2G?\3\2\2\2G@\3\2\2\2GA\3\2\2\2G"+
"E\3\2\2\2H\r\3\2\2\2\b\30#/\61<G";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
} | [
"kazuma-.-v@ezweb.ne.jp"
] | kazuma-.-v@ezweb.ne.jp |
0323417925856722a038c4b0bb370a2ccbfc9da1 | c8b42092213fd74da2f7a1d57de8cc9b65f3ee3d | /app/src/main/java/com/example/administrator/multifile/FileAdapter.java | c63c179fe6146c8e62f399a2e797e9dc7020bb95 | [] | no_license | Chasen2017/MultiFile | 40ce29c3b9d2eab44db5e5feac0bc6685f77f709 | 701f69954d92e2ed50524a278f36a5b2b21d4aa0 | refs/heads/master | 2021-08-28T04:09:08.509162 | 2017-12-11T06:20:54 | 2017-12-11T06:20:54 | 113,820,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,037 | java | package com.example.administrator.multifile;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
/**
* Created by 东 on 2016/12/11.
* 文件列表的Adapter
*/
public class FileAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static int ITEM_TYPE_DIRECTORY = 1;
private static int ITEM_TYPE_DATA = 2;
private OnItemClickListener mOnItemClickListener;
//传递一个文件列表作为参数
private ArrayList<FileEntity> fileList;
public FileAdapter(ArrayList<FileEntity> fileList) {
this.fileList = fileList;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == ITEM_TYPE_DIRECTORY) {
return new DirectoryViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_directory, parent,false));
} else if (viewType == ITEM_TYPE_DATA) {
return new DataViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_data, parent,false));
}
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
final FileEntity fileEntity=fileList.get(position);
if (getItemViewType(position) == ITEM_TYPE_DIRECTORY) {
//如果是目录文件
DirectoryViewHolder directoryViewHolder= (DirectoryViewHolder) holder;
directoryViewHolder.tvFileName.setText(fileEntity.getName());
//目录文件多了一个点击的按钮
directoryViewHolder.btGoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventBus.getDefault().post(fileEntity);
}
});
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mOnItemClickListener.onDirectoryItemClick(fileEntity,position);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
mOnItemClickListener.onDirectoryItemLongClick(fileEntity,position);
return false;
}
});
} else if (getItemViewType(position) == ITEM_TYPE_DATA) {
//如果是数据文件
DataViewHolder dataViewHolder= (DataViewHolder) holder;
dataViewHolder.tvFileName.setText(fileEntity.getName());
dataViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mOnItemClickListener.onDataItemClick(fileEntity,position);
}
});
dataViewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
mOnItemClickListener.onDataItemLongClick(fileEntity,position);
return false;
}
});
}
}
@Override
public int getItemCount() {
return fileList.size();
}
@Override
public int getItemViewType(int position) {
FileEntity fileEntity = fileList.get(position);
if (fileEntity.isDirectory()) {
return ITEM_TYPE_DIRECTORY;
} else {
return ITEM_TYPE_DATA;
}
}
public void setOnItemClickListener(OnItemClickListener onItemClickListener){
this.mOnItemClickListener=onItemClickListener;
}
//目录文件的ViewHolder
public static class DirectoryViewHolder extends RecyclerView.ViewHolder {
TextView tvFileName;
Button btGoto;
public DirectoryViewHolder(View itemView) {
super(itemView);
tvFileName= (TextView) itemView.findViewById(R.id.directory_tv_fileName);
btGoto= (Button) itemView.findViewById(R.id.directory_bt_goto);
}
}
//数据文件的ViewHodler
public static class DataViewHolder extends RecyclerView.ViewHolder {
TextView tvFileName;
public DataViewHolder(View itemView) {
super(itemView);
tvFileName= (TextView) itemView.findViewById(R.id.data_tv_fileName);
}
}
public interface OnItemClickListener{
void onDirectoryItemClick(FileEntity fileEntity,int position);
void onDirectoryItemLongClick(FileEntity fileEntity,int position);
void onDataItemClick(FileEntity fileEntity,int position);
void onDataItemLongClick(FileEntity fileEntity,int position);
}
}
| [
"450468291@qq.com"
] | 450468291@qq.com |
7d709235c8f602df4956feb8b851627a3161a673 | eafc430ee1c05b0948031bf0dbf32a9881df6044 | /src/main/java/com/ponto/inteligente/PontoInteligenteApplication.java | 5d6f31fb99126fef82cdcb65db6295901a53e20d | [] | no_license | AdsonDevSuperior/api-ponto-inteligente | 5968b007328349e79bcceb91bb579b5a62a0dafc | 672a95800e884560971621a8a3236ae9e84c2c25 | refs/heads/master | 2023-07-16T11:16:36.582685 | 2021-09-02T21:00:25 | 2021-09-02T21:00:25 | 402,534,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.ponto.inteligente;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class PontoInteligenteApplication {
public static void main(String[] args) {
SpringApplication.run(PontoInteligenteApplication.class, args);
}
}
| [
"adsonplaygg@gmail.com"
] | adsonplaygg@gmail.com |
529e6d64f6db90db4fcdc97cfbe32933c2700cab | 14f75e28af33bc41ca9b79b7faa68fbf98cbb08a | /src/main/java/com/wzy/wzy_shop/filter/CharsetFilter.java | bc1de3bf1d61b0574762a888878915817d7ab75f | [] | no_license | WzyPaopao/Servlet-Wzy | b7c350160f376aab865d4b44e4f4e5292517b8ed | 0ad402acb4d2c42dfa8cf2bfc764d7faf55c5ac1 | refs/heads/main | 2023-05-01T22:07:20.500453 | 2021-05-24T09:21:31 | 2021-05-24T09:21:31 | 369,570,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package com.wzy.wzy_shop.filter;
import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebFilter(filterName = "CharsetFilter")
public class CharsetFilter implements Filter {
public void init(FilterConfig config) throws ServletException {
}
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
HttpServletResponse r = (HttpServletResponse) response;
r.addHeader("content-type", "text/html; charset=UTF-8");
chain.doFilter(request, r);
// HttpServletResponse r = (HttpServletResponse) response;
// if (r.getHeader("content-type") == null) {
// r.addHeader("content-type", "text/html;charset=utf-8");
// }
}
}
| [
"wzypaopao@outlook.com"
] | wzypaopao@outlook.com |
c8d532bdadf77e1f94da20754b3af41865e0436d | 6803fb0e3c8ffc064be9102f02511b754bd862a2 | /account-manager-core/src/test/java/mz/co/geekframeworks/core/framework/fixturefactory/templates/RoleTemplate.java | 05db6032749a3f04d30c50a0d4ec07e7b66281be | [] | no_license | steliomo/account-manager | 7cfaa3786b6fd4c7cec0c0322f299ccef77387e8 | 22350703a358fa7a3b7a6e21d9f8bbbad448b6de | refs/heads/master | 2022-06-25T19:09:21.165641 | 2020-08-27T00:33:59 | 2020-08-27T00:33:59 | 250,598,823 | 0 | 0 | null | 2022-06-21T03:04:55 | 2020-03-27T17:24:08 | Java | UTF-8 | Java | false | false | 824 | java | /**
*
*/
package mz.co.geekframeworks.core.framework.fixturefactory.templates;
import mz.co.geekframeworks.core.framework.fixturefactory.util.FixtureFactoryConstants;
import mz.co.geekframeworks.core.role.model.Role;
import mz.co.mozview.frameworks.core.fixtureFactory.TemplateLoader;
import br.com.six2six.fixturefactory.Fixture;
import br.com.six2six.fixturefactory.Rule;
/**
* @author Stélio Moiane
*
*/
public class RoleTemplate implements TemplateLoader
{
@Override
public void load()
{
Fixture.of(Role.class).addTemplate(
FixtureFactoryConstants.VALID_OBJECT, new Rule()
{
{
this.add("name",
this.random("Administrador", "Operador"));
this.add("description", this.random(
"Administrador do Sistema",
"Operador Contabilistico"));
}
});
}
}
| [
"steliomo@gmail.com"
] | steliomo@gmail.com |
0b099fc66b98d9ecc77c306c4668cf9d27bc85de | 0e761a71df906d6d2e667c45a1b33c3971608591 | /core/src/main/java/com/github/dieterdepaepe/jsearch/search/constructive/StateSearchNode.java | f35cca93cd2861b83446e731512e1efa91839445 | [
"MIT"
] | permissive | DieterDePaepe/JSearch | fa9a4978987aa774ac4aadbdc06b3485f77ff601 | fb55976d181bdae0332905d834e5c6c9d739820f | refs/heads/master | 2023-08-19T07:22:45.848114 | 2017-11-19T19:15:45 | 2017-11-19T19:47:42 | 14,043,770 | 2 | 2 | null | 2017-11-19T18:57:14 | 2013-11-01T13:32:56 | Java | UTF-8 | Java | false | false | 1,495 | java | package com.github.dieterdepaepe.jsearch.search.constructive;
/**
* A node, encountered in the search graph while solving a problem, that has a search space state identifier.
*
* <p>There is a subtle but important difference between a {@code SearchNode} and a search space state. A search space
* state represents the result from a set of chosen actions. A {@code SearchNode} represents a result, but also
* information regarding the path found to that search space state (most notably the cost needed to reach that state).
* While the state space for a certain problem can be either a tree or a graph, the search graph is always a tree.</p>
*
* <p>Search nodes with an {@code equal} search space state represent the same (possibly incomplete) solution. This
* means nodes may be safely dropped by a {@link com.github.dieterdepaepe.jsearch.search.constructive.Solver}
* when a cheaper search node with an {@code equal} space state is known. This mechanism can be used by a {@code Solver}
* to reduce the search graph.</p>
*
* @author Dieter De Paepe
*/
public interface StateSearchNode extends SearchNode {
/**
* Returns a (lightweight) object that represents the search space state that has been reached by this node.
*
* <p>When 2 {@code SearchNode}s have an {@code equal} search space state, the most expensive node can be dropped
* from the search by a solver.</p>
* @return a non-null object
*/
public Object getSearchSpaceState();
}
| [
"dieter.depaepe@gmail.com"
] | dieter.depaepe@gmail.com |
7bc0c4507b7711ba28e3897b62d6413d5b3c653c | 9d6a6975d77daac8e8478284f97f839ab5ab7f23 | /app/src/androidTest/java/lc/fn/cubewm/ApplicationTest.java | fb1af8d88371f2fc00da9155d3482942a3f84ca7 | [] | no_license | Kamil1/cubewm-client | 48ed0f1e919d2da9beed437caf2559bdc118d9f6 | d848e86c6d933df89cb1f3741d9fdd85d18304b0 | refs/heads/master | 2020-12-25T16:36:24.479045 | 2015-03-14T04:09:33 | 2015-03-14T04:09:33 | 32,195,318 | 1 | 0 | null | 2015-03-14T04:09:12 | 2015-03-14T04:09:12 | null | UTF-8 | Java | false | false | 343 | java | package lc.fn.cubewm;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"rice@fn.lc"
] | rice@fn.lc |
d6ad60fa2c62cea75d2210ef4e21327133d75ee7 | dc198e134d08c8f66dad8519818ab5c44682de06 | /SOAP Assessment/Student.java | 0c0528e71f6e15e45a3e324c48992a01244361b6 | [] | no_license | gb1916/DXCJava | f9dc5dd0c93e6e3f6417eb6ec1eda935567086b9 | 6985996ed8935f14ac0eade7f751e3f92120efb5 | refs/heads/master | 2023-04-14T03:13:19.894100 | 2021-05-06T19:01:25 | 2021-05-06T19:01:25 | 358,244,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.soap;
public class Student {
private int id;
private String name;
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String toString() {
return "Student [id=" + id + ", name=" + name + ", email=" + email + "]";
}
}
| [
"guntupallibabitha@gmail.com"
] | guntupallibabitha@gmail.com |
22c93cef95c5cc2f2b1c528764a886c5cd245e00 | 9049bd3ccba150b3509eb1ea89d834253aa02059 | /src/com/buptmap/util/AddSession.java | 6e03bc3781999156bee01fe6af8d2df00a97f634 | [] | no_license | etc1208/beacon | c95cb6465276d46f9e0bb6fc47aef51eaf97a5a6 | d60a3439bd21207ed1d55c4d897edea8250fe04e | refs/heads/master | 2020-12-24T15:50:10.293461 | 2016-03-18T09:46:38 | 2016-03-18T09:46:38 | 54,190,774 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,852 | java | package com.buptmap.util;
import net.sf.json.JSONArray;
public class AddSession implements Runnable{
private String url;
private String user;
private String pwd;
private JSONArray resultArray;
public AddSession(String url,String user, String pwd, JSONArray resultArray){
this.url = url;
this.user = user;
this.pwd = pwd;
this.resultArray = resultArray;
}
@Override
public void run(){/*
Connection conn = null;
PreparedStatement pst = null;
PreparedStatement updatepst = null;
Statement st = null;
ResultSet rsResultSet = null;
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
try {
conn = DriverManager.getConnection(url, user, pwd);
conn.setAutoCommit(false);
pst = conn.prepareStatement("insert into vdev_staff_bind(uuid,major,minor,status,staff_id,time) value(?,?,?,?,?,?)");
st = conn.createStatement();
System.out.println("insert into vdev_staff_bind(uuid,major,minor,status,staff_id,time) value(?,?,?,?,?,?)");
for (int l = 0; l <= resultArray.size(); l++) {
rsResultSet = st.executeQuery("select status from Vdev_staff_bind where uuid='" + uuid + "'and major='" + major + "' and minor='" +String.valueOf(l)+"' and staff_id = '" + parent_id + "'");
if (rsResultSet.next()) {
String total = String.valueOf(Integer.valueOf(rsResultSet.getString("status")) + 1);//String total = String.valueOf(Integer.valueOf(rsResultSet.getString("status")) + 1);
updatepst.setString(1,total);
updatepst.setString(2,uuid);
updatepst.setString(3,major);
updatepst.setString(4,String.valueOf(l));
updatepst.addBatch();
pst.setString(1, uuid);
pst.setString(2, major);
pst.setString(3, String.valueOf(l));
pst.setString(4, "0");
pst.setString(5, staff_id);
pst.setString(6, time);
pst.addBatch();
}
else {
pst.setString(1, uuid);
pst.setString(2, major);
pst.setString(3, String.valueOf(l));
pst.setString(4, "0");
pst.setString(5, staff_id);
pst.setString(6, time);
pst.addBatch();
pst.setString(1, uuid);
pst.setString(2, major);
pst.setString(3, String.valueOf(l));
pst.setString(4, "1");
pst.setString(5, parent_id);
pst.setString(6, time);
pst.addBatch();
}
}
updatepst.executeBatch();
pst.executeBatch();
conn.commit();
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
finally{
try{
if (pst != null) {
pst.close();
}
if (updatepst != null) {
updatepst.close();
}
if (rsResultSet != null) {
rsResultSet.close();
}
if (st != null) {
st.close();
}
if (conn != null) {
conn.close();
}
}catch (SQLException e) {
// TODO: handle exception
}
}
*/}
}
| [
"599068284@qq.com"
] | 599068284@qq.com |
cfce0fed7852ab87b37b2605f83e30b75c2aff18 | 204582012ba05908e933c9a5d68e8df6f9d06c78 | /junit4/example-junit-springboot-systemtest/src/test/java/examples/resource/UpdateGreetingResourceST.java | 22d9ddeb4061f60df48638f5a39efb7a305d8ea9 | [
"Apache-2.0"
] | permissive | testify-project/examples | df813b1187132f3ccbdf513fc03dc638f96df269 | eab4deba2bb9f68e43c1d022021f0a406122ffb2 | refs/heads/develop | 2023-07-19T20:55:55.687858 | 2018-01-04T15:43:11 | 2018-01-04T15:43:11 | 78,854,649 | 0 | 1 | Apache-2.0 | 2023-07-17T16:38:35 | 2017-01-13T14:07:57 | Java | UTF-8 | Java | false | false | 2,430 | java | /*
* Copyright 2016-2017 Testify 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 examples.resource;
import static javax.ws.rs.core.Response.Status.ACCEPTED;
import static org.assertj.core.api.Assertions.assertThat;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.testifyproject.ClientInstance;
import org.testifyproject.annotation.Application;
import org.testifyproject.annotation.ConfigHandler;
import org.testifyproject.annotation.Module;
import org.testifyproject.annotation.Sut;
import org.testifyproject.annotation.VirtualResource;
import org.testifyproject.junit4.SystemTest;
import examples.GreetingApplication;
import examples.resource.model.GreetingModel;
import fixture.TestModule;
/**
*
* @author saden
*/
@Application(GreetingApplication.class)
@Module(TestModule.class)
@VirtualResource(value = "postgres", version = "9.4")
@RunWith(SystemTest.class)
public class UpdateGreetingResourceST {
@Sut
ClientInstance<WebTarget, Client> sut;
@ConfigHandler
void configureClient(ClientBuilder clientBuilder) {
clientBuilder.register(JacksonFeature.class);
}
@Test
public void givenGreetingEntityPutGreetingShouldUpdateGreeting() {
//Arrange
GreetingModel model = new GreetingModel("caio");
Entity<GreetingModel> entity = Entity.json(model);
//Act
Response response = sut.getClient().getValue()
.path("greetings")
.path("0d216415-1b8e-4ab9-8531-fcbd25d5966f")
.request()
.put(entity);
//Assert
assertThat(response.getStatus()).isEqualTo(ACCEPTED.getStatusCode());
}
}
| [
"sharmarke.aden@gmail.com"
] | sharmarke.aden@gmail.com |
3a6fffedfb6a98534947ad237602ba955bda6ffd | 7a3a2a55411c4e3a0ea603f3256a9096898c84d8 | /src/main/java/com/mes/mesQms/Shipment/QmsShipmentRestController.java | aa6615d215687544214e9535453104693baf669f | [] | no_license | w8230/springboot_sound_bak | 5d17d39510fca267b6f82c3e934e5d3b4d9943fa | dc4704f5a2a00c7fa735005098874bc24b1ca1ec | refs/heads/master | 2023-06-30T04:14:20.577027 | 2020-03-25T01:57:23 | 2020-03-25T01:57:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,631 | java | package com.mes.mesQms.Shipment;
import lombok.extern.slf4j.Slf4j;
import com.mes.Common.DataTransferObject.Message;
import com.mes.Common.DataTransferObject.Page;
import com.mes.Common.DataTransferObject.RESTful;
import com.mes.Common.File.DTO.Files;
import com.mes.Common.File.Function.UploadFunction;
import com.mes.mesQms.Shipment.DTO.QMS_PROD_NG_SUM;
import com.mes.mesQms.Shipment.DTO.QMS_PROD_RPT;
import com.mes.mesQms.Shipment.DTO.QMS_PROD_SUB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@Slf4j
public class QmsShipmentRestController extends UploadFunction {
@Autowired
private QmsShipmentService qmsShipmentService;
@RequestMapping(value ="/qmsProdErrorManGet", method = RequestMethod.POST)
public RESTful qmsProdErrorManGet(Page p, HttpServletRequest req) { return qmsShipmentService.qmsProdErrorManGet(p, req); }
@RequestMapping(value = "/qmsProdGet", method = RequestMethod.POST)
public RESTful qmsProdGet(Page p, HttpServletRequest req) {
return qmsShipmentService.qmsProdGet(p, req);
}
@RequestMapping(value = "/qmsProdSubGet", method = RequestMethod.POST)
public RESTful qmsProdSubGet(Page p, HttpServletRequest req) {
return qmsShipmentService.qmsProdSubGet(p, req);
}
@RequestMapping(value = "/qmsProdSubAllGet", method = RequestMethod.POST)
public List<QMS_PROD_SUB> qmsProdSubAllGet(Page p, HttpServletRequest req) {
return qmsShipmentService.qmsProdSubAllGet(p, req);
}
@RequestMapping(value = "/qmsProdAdd", method = RequestMethod.POST)
public Message qmsProdAdd(HttpServletRequest req, QMS_PROD_SUB qps) {
return qmsShipmentService.qmsProdAdd(req, qps);
}
@RequestMapping(value = "/qmsProdListGet", method = RequestMethod.POST)
public RESTful qmsProdListGet(Page p, HttpServletRequest req) { return qmsShipmentService.qmsProdListGet(p, req); }
@RequestMapping(value = "/qmsProdListRPTGet", method = RequestMethod.POST)
public List<QMS_PROD_RPT> qmsProdListRPTGet(Page p, HttpServletRequest req) { return qmsShipmentService.qmsProdListRPTGet(p, req); }
@RequestMapping(value ="/qmsProdErrorManOneGet", method = RequestMethod.POST)
public QMS_PROD_SUB qmsProdErrorManOneGet(QMS_PROD_SUB qmsProdSub, HttpServletRequest req){
return qmsShipmentService.qmsProdErrorManOneGet(qmsProdSub, req);
}
@RequestMapping(value = "/qmsProdMRBGet", method = RequestMethod.POST)
public RESTful qmsProdMRBGet(Page p, HttpServletRequest req){ return qmsShipmentService.qmsProdMRBGet(p, req); }
@RequestMapping(value = "/qmsProdMRBAdd", method = RequestMethod.POST)
public Message qmsProdMRBAdd(HttpServletRequest req, QMS_PROD_SUB qps) {
return qmsShipmentService.qmsProdMRBAdd(req, qps);
}
@RequestMapping(value = "/qmsProdMRBCancel", method = RequestMethod.POST)
public Message qmsProdMRBCancel(HttpServletRequest req, QMS_PROD_SUB qps) {
return qmsShipmentService.qmsProdMRBCancel(req, qps);
}
@RequestMapping(value = "/qmsProdErrorManAdd", method = RequestMethod.POST)
public String qmsProdErrorManAdd(MultipartHttpServletRequest req){
Files files = new Files();
files.setKey1(req.getParameter("in_no"));
files.setKey2(req.getParameter("part_code"));
files.setKey3(req.getParameter("act_type"));
int check1 = Integer.parseInt(req.getParameter("check1"));
int check2 = Integer.parseInt(req.getParameter("check2"));
if(check1+check2 == 0)
{
qmsShipmentService.qmsProdErrorManAdd_NoneFile(files, req);
}
if(check1 == 0 && check2 == 1)
{
qmsShipmentService.qmsProdErrorManAdd_File3(files, req);
}
if(check2 == 0 && check1 == 1)
{
qmsShipmentService.qmsProdErrorManAdd_File2(files, req);
}
if(check1+check2 == 2)
{
qmsShipmentService.qmsProdErrorManAdd_AllFile(files, req);
}
return "수정되었습니다.";
}
@RequestMapping(value = "/qmsProdErrorListSumGet", method = RequestMethod.POST)
public List<QMS_PROD_NG_SUM> qmsProdErrorListSumGet(Page p, HttpServletRequest req) {
return qmsShipmentService.qmsProdErrorListSumGet(p, req);
}
}
| [
"whdgy7@naver.com"
] | whdgy7@naver.com |
2d5c4c4386b756f48c21d2c581cb8abcf50bd3c4 | 17dc0c4fc350dd37b8f54791c47f822a6f16a7e3 | /Search/src/com/yubin/easy/part1/IsSymmetric.java | 7f714c31a799c866388a930c4e0f5516d78d1315 | [] | no_license | MIIAMOR/LeetCode | 00c095225838f37f870edd80ec38868785b87957 | fca2cf54c538dcd14a8bbdca32844058926d8465 | refs/heads/master | 2023-06-30T13:25:22.016942 | 2021-07-14T04:57:15 | 2021-07-14T04:57:15 | 366,361,794 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,928 | java | package com.yubin.easy.part1;
import com.yubin.basic.TreeNode;
public class IsSymmetric {
/**
* 假设有两棵一模一样的数,分别前序遍历和后序遍历
*/
public boolean isSymmetric1(TreeNode root) {
return dfs(root, root);
}
private boolean dfs(TreeNode root1, TreeNode root2) {
if (root1 == null && root2 == null) return true;
if (root1 == null || root2 == null) return false;
if (root1.val != root2.val) return false;
if (!dfs(root1.left, root2.right)) return false;
return dfs(root1.right, root2.left);
}
/**
* 记录遍历得到的数
*/
private StringBuilder sbPre = new StringBuilder();
private StringBuilder sbPost = new StringBuilder();
public boolean isSymmetric(TreeNode root) {
dfs(root, 0);
dfs(root, 1);
String pre = sbPre.toString();
String post = sbPost.toString();
return pre.equals(post);
}
/**
* 对称树前序和后序遍历结果一样
*/
private void dfs(TreeNode root, int flag) {
if (root == null) {
if (flag == 0) sbPre.append('n');
else sbPost.append('n');
return;
}
if (flag == 0) {
sbPre.append(root.val);
dfs(root.left, flag);
dfs(root.right, flag);
} else {
sbPost.append(root.val);
dfs(root.right, flag);
dfs(root.left, flag);
}
}
public void test() {
TreeNode right2 = new TreeNode(3);
TreeNode left1 = new TreeNode(2, null, right2);
TreeNode right22 = new TreeNode(3);
TreeNode right1 = new TreeNode(2, null, right22);
TreeNode root = new TreeNode(1, left1, right1);
System.out.println(isSymmetric1(root));
}
public static void main(String[] args) {
new IsSymmetric().test();
}
}
| [
"67416178+MIIAMOR@users.noreply.github.com"
] | 67416178+MIIAMOR@users.noreply.github.com |
8d2f04d22e83fd43e1f89fc7cafeb688eee94859 | 3a3a91e1ba95134c67c6bf6d84dd450d4fffd430 | /app/src/main/java/com/iqbal/mymoviecatalogue2/MoviesData.java | 39362e12c9b217928084f6b01223ebed6e1280bd | [] | no_license | dibaliqaja/MyMovieCatalogue2 | 6a94cdf737831c121c8e9f56c8a863f652ff5e01 | e4335c9252d405ae4cf021662f0ccde77197ce7d | refs/heads/master | 2020-09-11T11:46:11.326713 | 2019-11-16T05:53:16 | 2019-11-16T05:53:16 | 222,053,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,432 | java | package com.iqbal.mymoviecatalogue2;
import java.util.ArrayList;
public class MoviesData {
public static String[][] data = new String[][]{
{
"Spider-Man: Into the Spider-Verse",
"Miles Morales is juggling his life between being a high school student and being a spider-man. When Wilson \"Kingpin\" Fisk uses a \t\t\tsuper collider, others from across the Spider-Verse are transported to this dimension.",
"84%",
"English",
"1h 57m",
"$90,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/iiZZdoQBEYBv6id8su7ImL0oCbD.jpg",
"December 6, 2018",
"Action, Adventure, Animation, Science Fiction, Comedy"
},
{ "Ralph Breaks the Internet",
"Video game bad guy Ralph and fellow misfit Vanellope von Schweetz must risk it all by traveling to the World Wide Web in search of a replacement part to save Vanellope's video game, \"Sugar Rush.\" In way over their heads, Ralph and Vanellope rely on the citizens of the internet -- the netizens -- to help navigate their way, including an entrepreneur named Yesss, who is the head algorithm and the heart and soul of trend-making site BuzzzTube.",
"72%",
"English",
"1h 52m",
"$175,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/qEnH5meR381iMpmCumAIMswcQw2.jpg",
"November 20, 2018",
"Family, Animation, Comedy, Adventure"
},
{ "Fantastic Beasts: The Crimes of Grindelwald",
"Gellert Grindelwald has escaped imprisonment and has begun gathering followers to his cause—elevating wizards above all non-magical beings. The only one capable of putting a stop to him is the wizard he once called his closest friend, Albus Dumbledore. However, Dumbledore will need to seek help from the wizard who had thwarted Grindelwald once before, his former student Newt Scamander, who agrees to help, unaware of the dangers that lie ahead. Lines are drawn as love and loyalty are tested, even among the truest friends and family, in an increasingly divided wizarding world.",
"69%",
"English",
"2h 14m",
"$200,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/fMMrl8fD9gRCFJvsx0SuFwkEOop.jpg",
"November 14, 2018",
"Adventure"
},
{ "Robin Hood",
"A war-hardened Crusader and his Moorish commander mount an audacious revolt against the corrupt English crown.",
"58%",
"English",
"1h 56m",
"$100,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/AiRfixFcfTkNbn2A73qVJPlpkUo.jpg",
"November 20, 2018",
"Action, Adventure, Thriller"
},
{ "A Star Is Born",
"Seasoned musician Jackson Maine discovers — and falls in love with — struggling artist Ally. She has just about given up on her dream to make it big as a singer — until Jack coaxes her into the spotlight. But even as Ally's career takes off, the personal side of their relationship is breaking down, as Jack fights an ongoing battle with his own internal demons.",
"75%",
"English",
"2h 15m",
"$36,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/wrFpXMNBRj2PBiN4Z5kix51XaIZ.jpg",
"October 3, 2018",
"Drama , Romance, Music"
},
{ "Aquaman",
"Once home to the most advanced civilization on Earth, Atlantis is now an underwater kingdom ruled by the power-hungry King Orm. With a vast army at his disposal, Orm plans to conquer the remaining oceanic people and then the surface world. Standing in his way is Arthur Curry, Orm's half-human, half-Atlantean brother and true heir to the throne.",
"68%",
"English",
"2h 24m",
"$160,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/5Kg76ldv7VxeX9YlcQXiowHgdX6.jpg",
"December 7, 2018",
"Action, Adventure, Fantasy"
},
{ "Avengers: Infinity War",
"As the Avengers and their allies have continued to protect the world from threats too large for any one hero to handle, a new \t\t\tdanger has emerged from the cosmic shadows: Thanos. A despot of intergalactic infamy, his goal is to collect all six Infinity \t\t\tStones, artifacts of unimaginable power, and use them to inflict his twisted will on all of reality. Everything the Avengers have \t\t\tfought for has led up to this moment - the fate of Earth and existence itself has never been more uncertain.",
"83%",
"English",
"2h 29m",
"$300,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg",
"April 25, 2018",
"Adventure, Action, Fantasy"
},
{ "Creed II",
"Between personal obligations and training for his next big fight against an opponent with ties to his family's past, Adonis Creed is up against the challenge of his life.",
"67%",
"English",
"2h 10m",
"$50,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/v3QyboWRoA4O9RbcsqH8tJMe8EB.jpg",
"November 21, 2018",
"Drama"
},
{ "How to Train Your Dragon: The Hidden World",
"As Hiccup fulfills his dream of creating a peaceful dragon utopia, Toothless’ discovery of an untamed, elusive mate draws the Night Fury away. When danger mounts at home and Hiccup’s reign as village chief is tested, both dragon and rider must make impossible decisions to save their kind",
"76%",
"English",
"1h 44m",
"$129,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/xvx4Yhf0DVH8G4LzNISpMfFBDy2.jpg",
"January 3, 2019",
"Animation, Family, Adventure"
},
{ "Glass",
"In a series of escalating encounters, former security guard David Dunn uses his supernatural abilities to track Kevin Wendell Crumb, a disturbed man who has twenty-four personalities. Meanwhile, the shadowy presence of Elijah Price emerges as an orchestrator who holds secrets critical to both men.",
"65%",
"English",
"2h 9m",
"$20,000,000",
"https://image.tmdb.org/t/p/w600_and_h900_bestv2/svIDTNUoajS8dLEo7EosxvyAsgJ.jpg",
"January 16, 2019",
"Thriller, Mystery, Drama"
},
{ "Mortal Engines",
"Many thousands of years in the future, Earth’s cities roam the globe on huge wheels, devouring each other in a struggle for ever diminishing resources. On one of these massive traction cities, the old London, Tom Natsworthy has an unexpected encounter with a mysterious young woman from the wastelands who will change the course of his life forever.",
"60%",
"English",
"2h 9m",
"$100,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/iteUvQKCW0EqNQrIVzZGJntYq9s.jpg",
"November 27, 2018",
"Adventure, Fantasy"
},
{ "Alita: Battle Angel",
"When Alita awakens with no memory of who she is in a future world she does not recognize, she is taken in by Ido, a compassionate doctor who realizes that somewhere in this abandoned cyborg shell is the heart and soul of a young woman with an extraordinary past.",
"67%",
"English",
"2h 2m",
"$170,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/xRWht48C2V8XNfzvPehyClOvDni.jpg",
"January 31, 2019",
"Action, Science Fiction, Thriller, Adventure"
},
{ "Bohemian Rhapsody",
"Singer Freddie Mercury, guitarist Brian May, drummer Roger Taylor and bass guitarist John Deacon take the music world by \t\t\t\tstorm when they form the rock 'n' roll band Queen in 1970. Hit songs become instant classics. When Mercury's increasingly \t\t\t\twild lifestyle starts to spiral out of control, Queen soon faces its greatest challenge yet – finding a way to keep the \t\t\tband together amid the success and excess.",
"81%",
"English",
"2h 15m",
"$52,000,000",
"https://image.tmdb.org/t/p/w300_and_h450_bestv2/lHu1wtNaczFPGFDTrjCSzeLPTKN.jpg",
"October 24, 2018",
"Drama, Music"
},
{ "Cold Pursuit",
"The quiet family life of Nels Coxman, a snowplow driver, is upended after his son's murder. Nels begins a vengeful hunt for Viking, the drug lord he holds responsible for the killing, eliminating Viking's associates one by one. As Nels draws closer to Viking, his actions bring even more unexpected and violent consequences, as he proves that revenge is all in the execution.",
"53%",
"English",
"1h 59m",
"$60,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/hXgmWPd1SuujRZ4QnKLzrj79PAw.jpg",
"February 7, 2019",
"Action, Drama, Thriller, Crime"
},
{ "Mary Queen of Scots",
"In 1561, Mary Stuart, widow of the King of France, returns to Scotland, reclaims her rightful throne and menaces the future of Queen Elizabeth I as ruler of England, because she has a legitimate claim to the English throne. Betrayals, rebellions, conspiracies and their own life choices imperil both Queens. They experience the bitter cost of power, until their tragic fate is finally fulfilled.",
"66%",
"English",
"2h 4m",
"$25,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/b5RMzLAyq5QW6GtN9sIeAEMLlBI.jpg",
"December 7, 2018",
"Drama, History"
},
{ "Master Z: Ip Man Legacy",
"After being defeated by Ip Man, Cheung Tin Chi is attempting to keep a low profile. While going about his business, he gets into a fight with a foreigner by the name of Davidson, who is a big boss behind the bar district. Tin Chi fights hard with Wing Chun and earns respect.",
"52%",
"English",
"1h 47m",
"-",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/6VxEvOF7QDovsG6ro9OVyjH07LF.jpg",
"December 20, 2018",
"Action"
},
{ "Serenity",
"Baker Dill is a fishing boat captain leading tours off a tranquil, tropical enclave called Plymouth Island. His quiet life is shattered, however, when his ex-wife Karen tracks him down with a desperate plea for help.",
"51%",
"English",
"1h 46m",
"$25,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/hgWAcic93phg4DOuQ8NrsgQWiqu.jpg",
"January 24, 2019",
"Thriller"
},
{ "T-34",
"In 1944, a courageous group of Russian soldiers managed to escape from German captivity in a half-destroyed legendary T-34 tank. Those were the times of unforgettable bravery, fierce fighting, unbreakable love, and legendary miracles.",
"49%",
"Russian",
"1h 46m",
"$10,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/jqBIHiSglRfNxjh1zodHLa9E7zW.jpg",
"December 27, 2018",
"War, Drama, Adventure, Action"
},
{ "Overlord",
"France, June 1944. On the eve of D-Day, some American paratroopers fall behind enemy lines after their aircraft crashes while on a mission to destroy a radio tower in a small village near the beaches of Normandy. After reaching their target, the surviving paratroopers realise that, in addition to fighting the Nazi troops that patrol the village, they also must fight against something else.",
"66%",
"Russian",
"1h 50m",
"$38,000,000",
"https://image.tmdb.org/t/p/w185_and_h278_bestv2/l76Rgp32z2UxjULApxGXAPpYdAP.jpg",
"November 1, 2018",
"Horror, War, Science Fiction"
}
};
public static ArrayList<Movies> getListData(){
ArrayList<Movies> list = new ArrayList<>();
for (String[] aData : data) {
Movies movie = new Movies();
movie.setTitle(aData[0]);
movie.setOverview(aData[1]);
movie.setScore(aData[2]);
movie.setLanguage(aData[3]);
movie.setRuntime(aData[4]);
movie.setBudget(aData[5]);
movie.setPhoto(aData[6]);
movie.setDate(aData[7]);
movie.setGenre(aData[8]);
list.add(movie);
}
return list;
}
}
| [
"dibaliqaja@gmail.com"
] | dibaliqaja@gmail.com |
8f839b444ccf68a8769cd8a63c67e7aa8b830cbc | 8bc743e9c1653af98885536b3ce0c71b1bfd99c3 | /Biblioteka/src/bean/Knjiga.java | 5d5c151072d3975e991b971a39fbd008fd274be6 | [] | no_license | jjovanovic/Generator | ac31d7f16303bd9c60123dc894fe14aed01461ee | ba2ad252e800578d2e547767234660f4194ff401 | refs/heads/master | 2020-12-25T15:08:15.054621 | 2016-07-08T10:56:46 | 2016-07-08T10:56:46 | 62,067,780 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,823 | java | /*****************************************************************/
/* Generisano na osnovu templejta: javaBean.ftl */
/*****************************************************************/
package bean;
import javax.persistence.*;
import java.util.*;
import enumeration.*;
import java.io.Serializable;
@Entity
@Table(name = "Knjiga")
public class Knjiga implements Serializable{
@Id
@GeneratedValue
@Column(name = "idKnjiga")
private Integer idKnjiga;
@Column(name = "naslov", unique = false, nullable = false)
private String naslov;
@OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, mappedBy = "knjiga")
private Set<KnjigaOgranka> knjigaogranka;
@ManyToOne
private Zanr zanr;
@ManyToOne
private Autor autor;
@ManyToOne
private Jezik jezik;
public Knjiga() {
super();
}
public Integer getIdKnjiga(){
return idKnjiga;
}
public void setIdKnjiga(Integer idKnjiga){
this.idKnjiga = idKnjiga;
}
public String getNaslov(){
return naslov;
}
public void setNaslov(String naslov){
this.naslov = naslov;
}
public Set<KnjigaOgranka> getKnjigaogranka(){
return knjigaogranka;
}
public void setKnjigaogranka(Set<KnjigaOgranka> knjigaogranka){
this.knjigaogranka = knjigaogranka;
}
public Zanr getZanr(){
return zanr;
}
public void setZanr(Zanr zanr){
this.zanr = zanr;
}
public Autor getAutor(){
return autor;
}
public void setAutor(Autor autor){
this.autor = autor;
}
public Jezik getJezik(){
return jezik;
}
public void setJezik(Jezik jezik){
this.jezik = jezik;
}
@Override
public String toString() {
return "" + " " + idKnjiga.toString() + " " + naslov.toString();
}
} | [
"jovan_ns_92@hotmail.com"
] | jovan_ns_92@hotmail.com |
291cd1532026322316ded761e006d2ebe3411abc | d1bd1246f161b77efb418a9c24ee544d59fd1d20 | /android/frameworkUI/trunk/src/org/javenstudio/cocoka/opengl/OrientationSource.java | 7a9dd0949843d1e27af802b740313c7eb1eba97f | [] | no_license | navychen2003/javen | f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a | a3c2312bc24356b1c58b1664543364bfc80e816d | refs/heads/master | 2021-01-20T12:12:46.040953 | 2015-03-03T06:14:46 | 2015-03-03T06:14:46 | 30,912,222 | 0 | 1 | null | 2023-03-20T11:55:50 | 2015-02-17T10:24:28 | Java | UTF-8 | Java | false | false | 150 | java | package org.javenstudio.cocoka.opengl;
public interface OrientationSource {
public int getDisplayRotation();
public int getCompensation();
}
| [
"navychen2003@hotmail.com"
] | navychen2003@hotmail.com |
36b010e88910ce52b142748789e997aec14a6839 | ea224bcd2ad5c41743036d04f46f73327075820e | /app/src/main/java/com/deepanshu/whatsappdemo/ChatsFragment.java | f87243935bbde2b8f369319bbf11399f4359d3a2 | [] | no_license | deepanshu01399/W1Appdemo | 1ff2797d54849527c1102ac17d83a97107d0d6e9 | d402dd838eff7bd758c51d23c6be97eff7582d6a | refs/heads/master | 2021-05-17T21:53:18.571359 | 2020-04-13T10:48:02 | 2020-04-13T10:48:02 | 250,967,933 | 0 | 0 | null | 2020-04-13T10:48:04 | 2020-03-29T06:21:46 | Java | UTF-8 | Java | false | false | 7,405 | java | package com.deepanshu.whatsappdemo;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import de.hdodenhof.circleimageview.CircleImageView;
public class ChatsFragment extends Fragment {
private View privateChat_View;
private RecyclerView chatsList;
private DatabaseReference chatReference,UserRef;//to create query we need chatref;
private FirebaseAuth mAuth;
private String CurrentUserId;
public ChatsFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
privateChat_View= inflater.inflate(R.layout.fragment_chats, container, false);
mAuth=FirebaseAuth.getInstance();
CurrentUserId=mAuth.getCurrentUser().getUid();
chatsList=(RecyclerView)privateChat_View.findViewById(R.id.chats_list);
chatsList.setLayoutManager(new LinearLayoutManager(getContext()));
chatReference= FirebaseDatabase.getInstance().getReference().child("Contacts").child(CurrentUserId);
UserRef= FirebaseDatabase.getInstance().getReference().child("Users");
return privateChat_View;
}
@Override
public void onStart() {
super.onStart();
FirebaseRecyclerOptions<Contacts> options = new FirebaseRecyclerOptions.Builder<Contacts>()
.setQuery(chatReference, Contacts.class).build();
FirebaseRecyclerAdapter<Contacts, ChatsViewHolder> adapter = new FirebaseRecyclerAdapter<Contacts, ChatsViewHolder>(options) {
@NonNull
@Override
public ChatsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.user_display_layout, parent, false);
return new ChatsViewHolder(view);
}
@Override
protected void onBindViewHolder(@NonNull final ChatsViewHolder holder, int position, @NonNull Contacts model) {
final String userId = getRef(position).getKey();//get id from the db
final String[] profileImage = {"default_image"};
UserRef.child(userId).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.hasChild("image")) {
profileImage[0] = dataSnapshot.child("image").getValue().toString();
final String profileName = dataSnapshot.child("name").getValue().toString();
String profileStatus = dataSnapshot.child("status").getValue().toString();
final String userState=dataSnapshot.child("userState").child("state").getValue().toString();
final String userLastSeenDate=dataSnapshot.child("userState").child("date").getValue().toString();
final String userLastSeenTime=dataSnapshot.child("userState").child("time").getValue().toString();
holder.userName.setText(profileName);
if(userState.equalsIgnoreCase("online")){
holder.online_staus.setVisibility(View.VISIBLE);
holder.UserStatus.setText(profileStatus);
}
else {
holder.online_staus.setVisibility(View.INVISIBLE);
holder.UserStatus.setText("Last seen:"+userLastSeenTime+"\n"+userLastSeenDate);
}
// holder.UserStatus.setText(profileStatus);
Picasso.get().load(profileImage[0]).placeholder(R.drawable.profile_image).into(holder.user_profileImage);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent chatIntent=new Intent(getContext(),ChatActivity.class);
chatIntent.putExtra("Visit_user_id",userId);
chatIntent.putExtra("User_name",profileName);
chatIntent.putExtra("user_profile_image", profileImage[0]);
chatIntent.putExtra("state",userState);
chatIntent.putExtra("time",userLastSeenTime);
chatIntent.putExtra("date",userLastSeenDate);
startActivity(chatIntent);
}
});
} else {
String profileName = dataSnapshot.child("name").getValue().toString();
String profileStatus = dataSnapshot.child("status").getValue().toString();
holder.userName.setText(profileName);
holder.UserStatus.setText(profileStatus);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
};
chatsList.setAdapter(adapter);
adapter.startListening();
};
public static class ChatsViewHolder extends RecyclerView.ViewHolder{
TextView userName,UserStatus;
CircleImageView user_profileImage;
ImageView online_staus;
public ChatsViewHolder(@NonNull View itemView) {
super(itemView);
userName=itemView.findViewById(R.id.user_profile_name);
UserStatus=itemView.findViewById(R.id.user_status);
online_staus=itemView.findViewById(R.id.user_online_icon);
user_profileImage=itemView.findViewById(R.id.user_profile_image);
}
}
}
| [
"deepanshu@novoinvent.com"
] | deepanshu@novoinvent.com |
336fc631b0a91ef186943b4cc9a78a3f47be5f93 | 852f873d9df36f002336e5e0aabd55bc0751f98c | /src/com/wrathOfLoD/Models/Dialog/SpeechDialogContainer.java | ccc9070e285a6e107a85030861ea246cd12a1b67 | [] | no_license | WrathOfLoD/Iteration3 | 826cfc8a21ed88ecbca971b03edb58e5718503fc | 2e4301ed658d0134d4b4c85167337772f3e4dc2b | refs/heads/master | 2016-08-12T09:24:15.952161 | 2016-04-29T21:42:10 | 2016-04-29T21:42:10 | 55,711,564 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.wrathOfLoD.Models.Dialog;
import java.util.List;
/**
* Created by matthewdiaz on 4/16/16.
*/
public class SpeechDialogContainer extends DialogContainer {
public SpeechDialogContainer(List<String> dialog) {
super(dialog);
}
public void terminalAction(){
//just close the dialogView
}
}
| [
"matthewdiaz10@ufl.edu"
] | matthewdiaz10@ufl.edu |
1803bd48fa1045da659ebbabb533d4f8dced747c | 7847a793ed44e34255301a51879122d02f74bd20 | /src/main/java/com/web/blog/repositoriesImpl/DiaryImpl.java | 9607b349dd095fd0666249dfd650f2d58b2eadc4 | [] | no_license | Bananiys202024/blog | 5c67a8317784672eb267ca5c7a407bee3f53b456 | 7a00cdc0add48f3f71530595764cde1b2435bbb3 | refs/heads/master | 2021-06-14T14:00:14.401532 | 2020-11-24T19:14:32 | 2020-11-24T19:14:32 | 197,534,196 | 1 | 1 | null | 2021-04-26T20:40:37 | 2019-07-18T07:21:29 | Java | UTF-8 | Java | false | false | 4,473 | java | package com.web.blog.repositoriesImpl;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.validation.Valid;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.datastax.driver.core.utils.UUIDs;
import com.web.blog.controllers.crudDiaryController;
import com.web.blog.entity.Diary;
import com.web.blog.model.AddValuesToDiary;
import com.web.blog.repositories.DiaryRepository;
import com.web.blog.util.Financial360DayCalendar;
import com.web.blog.util.Sorts;
public class DiaryImpl {
private static final Logger logger = LogManager.getLogger(DiaryImpl.class);
public static void generate(DiaryRepository diaryrepository) {
List<LocalDate> list = Financial360DayCalendar.getListDays();
save(list,diaryrepository);
}
private static void save(List<LocalDate> list, DiaryRepository diaryrepository) {
//generate
for(LocalDate date :list) {
if(checkIfNotExistInDataBase(date, diaryrepository))
{
Diary diary = new Diary(UUIDs.timeBased(), convertLocalDateToDate(date));
diaryrepository.save(diary);
}
}
}
private static Date convertLocalDateToDate(LocalDate date) {
return java.util.Date.from(date.atStartOfDay()
.atZone(ZoneId.systemDefault())
.toInstant());
}
private static boolean checkIfNotExistInDataBase(LocalDate date, DiaryRepository diaryrepository) {
int result = diaryrepository.existsByDate(convertLocalDateToDate(date));
if(result==0) {return true;}
return false;
}
public static List<Diary> getDiary(DiaryRepository diaryrepository) {
List<Diary> diary = new ArrayList<>();
diaryrepository.findAll().forEach(diary::add);
diary = Sorts.listByDateDiary(diary);
return diary;
}
public static void update(@Valid AddValuesToDiary addvaluestodiary, DiaryRepository diaryrepository) {
Diary diary = new Diary();
List<Diary> list = getDiary(diaryrepository);
for(Diary lst:list)
{
DoYouShouldUpdateItThatsQuestion(addvaluestodiary, lst,diaryrepository );
}
}
private static void DoYouShouldUpdateItThatsQuestion(AddValuesToDiary addvaluestodiary,Diary lst, DiaryRepository diaryrepository) {
try
{
diaryrepository.save(checkingvalueoffalse(addvaluestodiary,lst));
}
catch(Exception e)
{
logger.info("Ops",e);
}
}
// this method for add values to diary table
// cheching if added values;
private static Diary checkingvalueoffalse(AddValuesToDiary addvaluestodiary, Diary lst) {
if(lst.isJava())
{
}
else
{
if(addvaluestodiary.getJava()>0)
{
addvaluestodiary.setJava(addvaluestodiary.getJava()-1);
lst.setJava(true);
}
}
if(lst.isElectro())
{
}
else
{
if(addvaluestodiary.getElectro()>0)
{
addvaluestodiary.setElectro(addvaluestodiary.getElectro()-1);
lst.setElectro(true);
}
}
if(lst.isSport())
{
}
else
{
if(addvaluestodiary.getSport()>0)
{
addvaluestodiary.setSport(addvaluestodiary.getSport()-1);
lst.setSport(true);
}
}
if(lst.isUniversity())
{
}
else
{
if(addvaluestodiary.getUniversity()>0)
{
addvaluestodiary.setUniversity(addvaluestodiary.getUniversity()-1);
lst.setUniversity(true);
}
}
if(lst.isEnglish())
{
}
else
{
if(addvaluestodiary.getEnglish()>0)
{
addvaluestodiary.setEnglish(addvaluestodiary.getEnglish()-1);
lst.setEnglish(true);
}
}
if(lst.isGerman())
{
}
else
{
if(addvaluestodiary.getGerman()>0)
{
addvaluestodiary.setGerman(addvaluestodiary.getGerman()-1);
lst.setGerman(true);
}
}
if(lst.isInterviewElectro())
{
}
else
{
if(addvaluestodiary.getInterviewElectro()>0)
{
addvaluestodiary.setInterviewElectro(addvaluestodiary.getInterviewElectro()-1);
lst.setInterviewElectro(true);
}
}
if(lst.isInterviewJava())
{
}
else
{
if(addvaluestodiary.getInterviewJava()>0)
{
addvaluestodiary.setInterviewJava(addvaluestodiary.getInterviewJava()-1);
lst.setInterviewJava(true);
}
}
if(lst.isXaXa())
{
}
else
{
if(addvaluestodiary.getXaXa()>0)
{
addvaluestodiary.setXaXa(addvaluestodiary.getXaXa()-1);
lst.setXaXa(true);
}
}
return lst;
}
}
| [
"BestJavaDeveloper24@gmail.com"
] | BestJavaDeveloper24@gmail.com |
03bc466c0552bb819221294b9761acb8bcaaf239 | fa76fd95998f3f27d779a8d22da4b86ea6ba78fd | /src/test/java/com/testrunner/Testrunner.java | 1962ed42586dc661cc64fee8b731615e249aba86 | [] | no_license | JULYJOSEPH01/maven | ab9798304baf30b7ae84115fb53cdc8672c59ef8 | 89ae1ece508b87e1ae07a78f8c32120e06117ba8 | refs/heads/master | 2022-12-15T11:22:43.334978 | 2020-09-18T14:09:55 | 2020-09-18T14:09:55 | 296,614,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.testrunner;
import org.junit.runner.RunWith;
import com.intuit.karate.junit4.Karate;
import cucumber.api.CucumberOptions;
@RunWith(Karate.class)
@CucumberOptions(features = "src\\test\\java\\com\\feature\\Test.features"
)
public class Testrunner {
}
| [
"julycjosef@gmail.com"
] | julycjosef@gmail.com |
1cf84c58c585e04498796ef0063cd5f2dc37f7b6 | ae4247b1e4324f249c018dcbfb049c96e29ce604 | /src/main/java/com/report/dbSql/Update.java | 7f67828954f349262fb933dde1e0f35d30cd943c | [] | no_license | wzqTarro/mybatis-service | 6b99f2290af46d7dde5a02c5879eb08027d8eaee | 69e61c1cf2c831570cc7005880330414d062c026 | refs/heads/master | 2020-04-30T06:22:54.463801 | 2019-03-20T06:13:39 | 2019-03-20T06:13:39 | 176,650,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package com.report.dbSql;
public class Update {
}
| [
"sa@DESKTOP-5CSB6H6"
] | sa@DESKTOP-5CSB6H6 |
744cc509aeae79b2a57a278afc0edc9c5c7fe093 | 16f97180f39e52e7ca614c5880d0b30d7df07c01 | /FunctionTest.java | 967eaf27bba79d44b9cea5e6833ad52947089a70 | [] | no_license | amerolla/JavaLambdaBasics | ffe22485558702b2488274eddf4e776b61bec933 | c1e91a6b6247e85403c7dd744c34b775aca3c3ef | refs/heads/master | 2020-09-10T20:45:29.783733 | 2019-11-18T02:41:59 | 2019-11-18T02:41:59 | 221,828,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,854 | java | package lambdabasics;
import java.math.*;
public class FunctionTest {
/*
* This method takes as an argument an implementation of our FunctionalInterface, as well as
* an int arg. It calls the implementation's function() method passing the int arg to it
*/
public int invokeFunction(FunctionalInterface intf, int n) {
return intf.function(n);
}
public static void main(String[] args) {
FunctionTest functionTest = new FunctionTest();
/*
* Prior to lambda expressions
* - only way to do this was to create an instance of an implementation of
* Create instance and pass this to the invokeFunction method
*/
FunctionalInterfaceImpl impl = new FunctionalInterfaceImpl();
System.out.print("Using implementation = ");
System.out.println(functionTest.invokeFunction(impl, 4));
/*
* Using lambdas
* - create a lambda expression and pass it as an argument in place of
* an implementation of the interface
*/
FunctionalInterface f1 = (int n) -> 3 * (n * n) + (2 * n) + 4;
System.out.print("Using lambda f1 = ");
System.out.println(functionTest.invokeFunction(f1, 4));
/*
* Can create additional lambdas just as we could create multiple implementations
* of the interface and pass these to the method expecting it
*/
FunctionalInterface f2 = (int n) -> (2 * (n * n * n)) + (4 * n * n) + (5 * n) + 3;
System.out.print("Using lambda f2 = ");
System.out.println(functionTest.invokeFunction(f2, 4));
// Re-writing f2 using pow() instead
FunctionalInterface f3 = (int n) -> (int)(2 * Math.pow((double)n, 3) +
(int)(4 * Math.pow((double)n, 2))) +
5 * n +
3;
System.out.print("Using lambda f3 = ");
System.out.println(functionTest.invokeFunction(f3, 4));
}
}
| [
"amerolla@gmail.com"
] | amerolla@gmail.com |
cde2f666c08f5168415244228b636bbc06adff68 | ad0fb31f854acdb66d85156c6d80bb472d0dc20b | /src/main/java/screenplay/tasks/Logout.java | 5a218af1c262cdc01f3b17f740cdd302e554732f | [] | no_license | suleymanatmaca/SeleniumTestOtomasyonu-N11 | 842898c9db364944645b2d88dd654d63954961ce | b752c60f7339c8251feab36a67ff62e0ef4dbe2e | refs/heads/master | 2020-05-05T08:07:42.010916 | 2019-04-08T15:21:25 | 2019-04-08T15:21:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package screenplay.tasks;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.actions.Click;
import net.serenitybdd.screenplay.actions.Hover;
import net.serenitybdd.screenplay.waits.WaitUntil;
import screenplay.view.HomePage;
import static net.serenitybdd.screenplay.Tasks.instrumented;
import static net.serenitybdd.screenplay.matchers.WebElementStateMatchers.isPresent;
public class Logout implements Task {
public <T extends Actor> void performAs(T actor) {
actor.attemptsTo(
Hover.over(HomePage.MY_ACCOUNT),
WaitUntil.the(HomePage.SIGNOUT_BUTTON, isPresent()),
Click.on(HomePage.SIGNOUT_BUTTON)
);
}
public static Logout logout() {
return instrumented(Logout.class);
}
}
| [
"suleymanatmaca.027@gmail.com"
] | suleymanatmaca.027@gmail.com |
6684c9c8096bb7ca1871a26fb8a5d439927c56fd | a8151f97125f0b11a2ed193848f5340612e3b69d | /src/main/java/com/bio/cip/indexer/util/DataCollectionType.java | 51fa718449a8e33f47945ce05722d752c141a986 | [] | no_license | rajanim/mongo-orient-connector | 3ef21e71cb9aa5cdaccb96658dcddf9d9eb86a5a | 242b1d09a05e8f2d7ee17fb2b09189234cbc3ce3 | refs/heads/master | 2021-01-19T19:17:12.105379 | 2017-03-02T20:10:53 | 2017-03-02T20:10:53 | 83,719,625 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.bio.cip.indexer.util;
/**
* <p>
* </p>
*
* @version 1.0
*
*/
public class DataCollectionType {
private static final String CRAWLER_SOLR_URL = "";
private static final String FEED_SOLR_URL = "";
private DataCollectionType() {
}
public enum DATACOLLECTIONTYPE {
WEBCRAWL(CRAWLER_SOLR_URL), FEED(FEED_SOLR_URL);
String solrUrl;
DATACOLLECTIONTYPE(String solrUrl) {
this.solrUrl = solrUrl;
}
String getFileNm() {
return solrUrl;
}
}
} | [
"rajani.maski@gmail.com"
] | rajani.maski@gmail.com |
335979de93166072cc63fc633a16ac337aa0acb4 | cdd8cf6479e519ff18c71ccba529c0875e49169a | /src/main/java/top/dianmu/ccompiler/learn/day91/backend/CodeTreeBuilder.java | 9b488a81e96537fbbab265afdcaa3e34ff1b140e | [] | no_license | hungry-game/CCompiler_for_learn | af3611bd636978d72df3e09399f144f1ac482c84 | 3f1d3c48dd229ce1eb265ae0d3c8f2051051418b | refs/heads/master | 2022-05-26T18:33:01.230199 | 2020-05-02T12:57:33 | 2020-05-02T12:57:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,582 | java | package top.dianmu.ccompiler.learn.day91.backend;
import java.util.HashMap;
import java.util.Stack;
import top.dianmu.ccompiler.learn.day91.frontend.*;
public class CodeTreeBuilder {
private Stack<ICodeNode> codeNodeStack = new Stack<ICodeNode>();
private LRStateTableParser parser = null;
private TypeSystem typeSystem = null;
private Stack<Object> valueStack = null;
private String functionName;
private HashMap<String, ICodeNode> funcMap = new HashMap<String , ICodeNode>();
private static CodeTreeBuilder treeBuilder = null;
public static CodeTreeBuilder getCodeTreeBuilder() {
if (treeBuilder == null) {
treeBuilder = new CodeTreeBuilder();
}
return treeBuilder;
}
public ICodeNode getFunctionNodeByName(String name) {
return funcMap.get(name);
}
public void setParser(LRStateTableParser parser) {
this.parser = parser;
typeSystem = parser.getTypeSystem();
valueStack = parser.getValueStack();
}
public ICodeNode buildCodeTree(int production, String text) {
ICodeNode node = null;
Symbol symbol = null;
switch (production) {
case CGrammarInitializer.Number_TO_Unary:
case CGrammarInitializer.Name_TO_Unary:
case CGrammarInitializer.String_TO_Unary:
node = ICodeFactory.createICodeNode(CTokenType.UNARY);
if (production == CGrammarInitializer.Name_TO_Unary) {
assignSymbolToNode(node, text);
}
node.setAttribute(ICodeKey.TEXT, text);
break;
case CGrammarInitializer.Unary_LP_RP_TO_Unary:
node = ICodeFactory.createICodeNode(CTokenType.UNARY);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Unary_LP_ARGS_RP_TO_Unary:
node = ICodeFactory.createICodeNode(CTokenType.UNARY);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Unary_Incop_TO_Unary:
case CGrammarInitializer.Unary_DecOp_TO_Unary:
case CGrammarInitializer.LP_Expr_RP_TO_Unary:
case CGrammarInitializer.Start_Unary_TO_Unary:
node = ICodeFactory.createICodeNode(CTokenType.UNARY);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Unary_LB_Expr_RB_TO_Unary:
//访问或更改数组元素
node = ICodeFactory.createICodeNode(CTokenType.UNARY);
node.addChild(codeNodeStack.pop()); //EXPR
node.addChild(codeNodeStack.pop()); //UNARY
break;
case CGrammarInitializer.Uanry_TO_Binary:
node = ICodeFactory.createICodeNode(CTokenType.BINARY);
ICodeNode child = codeNodeStack.pop();
node.setAttribute(ICodeKey.TEXT, child.getAttribute(ICodeKey.TEXT));
node.addChild(child);
break;
case CGrammarInitializer.Binary_TO_NoCommaExpr:
case CGrammarInitializer.NoCommaExpr_Equal_NoCommaExpr_TO_NoCommaExpr:
node = ICodeFactory.createICodeNode(CTokenType.NO_COMMA_EXPR);
child = codeNodeStack.pop();
String t = (String)child.getAttribute(ICodeKey.TEXT);
node.addChild(child);
if (production == CGrammarInitializer.NoCommaExpr_Equal_NoCommaExpr_TO_NoCommaExpr) {
child = codeNodeStack.pop();
t = (String)child.getAttribute(ICodeKey.TEXT);
node.addChild(child);
}
break;
case CGrammarInitializer.Binary_Plus_Binary_TO_Binary:
case CGrammarInitializer.Binary_DivOp_Binary_TO_Binary:
case CGrammarInitializer.Binary_Minus_Binary_TO_Binary:
node = ICodeFactory.createICodeNode(CTokenType.BINARY);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Binary_RelOP_Binary_TO_Binray:
node = ICodeFactory.createICodeNode(CTokenType.BINARY);
node.addChild(codeNodeStack.pop());
ICodeNode operator = ICodeFactory.createICodeNode(CTokenType.RELOP);
operator.setAttribute(ICodeKey.TEXT, parser.getRelOperatorText());
node.addChild(operator);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.NoCommaExpr_TO_Expr:
node = ICodeFactory.createICodeNode(CTokenType.EXPR);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Expr_Semi_TO_Statement:
case CGrammarInitializer.CompountStmt_TO_Statement:
node = ICodeFactory.createICodeNode(CTokenType.STATEMENT);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.LocalDefs_TO_Statement:
node = ICodeFactory.createICodeNode(CTokenType.STATEMENT);
break;
case CGrammarInitializer.Statement_TO_StmtList:
node = ICodeFactory.createICodeNode(CTokenType.STMT_LIST);
if (codeNodeStack.size() > 0) {
node.addChild(codeNodeStack.pop());
}
break;
case CGrammarInitializer.FOR_OptExpr_Test_EndOptExpr_Statement_TO_Statement:
node = ICodeFactory.createICodeNode(CTokenType.STATEMENT);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.StmtList_Statement_TO_StmtList:
node = ICodeFactory.createICodeNode(CTokenType.STMT_LIST);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Expr_TO_Test:
node = ICodeFactory.createICodeNode(CTokenType.TEST);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.If_Test_Statement_TO_IFStatement:
node = ICodeFactory.createICodeNode(CTokenType.IF_STATEMENT);
node.addChild(codeNodeStack.pop()); //Test
node.addChild(codeNodeStack.pop()); //Statement
break;
case CGrammarInitializer.IfElseStatemnt_Else_Statemenet_TO_IfElseStatement:
node = ICodeFactory.createICodeNode(CTokenType.IF_ELSE_STATEMENT);
node.addChild(codeNodeStack.pop()); //IfStatement
node.addChild(codeNodeStack.pop()); // statement
break;
case CGrammarInitializer.While_LP_Test_Rp_TO_Statement:
case CGrammarInitializer.Do_Statement_While_Test_To_Statement:
node = ICodeFactory.createICodeNode(CTokenType.STATEMENT);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Expr_Semi_TO_OptExpr:
case CGrammarInitializer.Semi_TO_OptExpr:
node = ICodeFactory.createICodeNode(CTokenType.OPT_EXPR);
if (production == CGrammarInitializer.Expr_Semi_TO_OptExpr) {
node.addChild(codeNodeStack.pop());
}
break;
case CGrammarInitializer.Expr_TO_EndOpt:
node = ICodeFactory.createICodeNode(CTokenType.END_OPT_EXPR);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.LocalDefs_StmtList_TO_CompoundStmt:
node = ICodeFactory.createICodeNode(CTokenType.COMPOUND_STMT);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.NewName_LP_RP_TO_FunctDecl:
case CGrammarInitializer.NewName_LP_VarList_RP_TO_FunctDecl:
node = ICodeFactory.createICodeNode(CTokenType.FUNCT_DECL);
node.addChild(codeNodeStack.pop());
child = node.getChildren().get(0);
functionName = (String)child.getAttribute(ICodeKey.TEXT);
symbol = assignSymbolToNode(node, functionName);
break;
case CGrammarInitializer.NewName_TO_VarDecl:
//我们暂时不处理变量声明语句
codeNodeStack.pop();
break;
case CGrammarInitializer.NAME_TO_NewName:
node = ICodeFactory.createICodeNode(CTokenType.NEW_NAME);
node.setAttribute(ICodeKey.TEXT, text);
break;
case CGrammarInitializer.OptSpecifiers_FunctDecl_CompoundStmt_TO_ExtDef:
node = ICodeFactory.createICodeNode(CTokenType.EXT_DEF);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
funcMap.put(functionName, node);
break;
case CGrammarInitializer.NoCommaExpr_TO_Args:
node = ICodeFactory.createICodeNode(CTokenType.ARGS);
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.NoCommaExpr_Comma_Args_TO_Args:
node = ICodeFactory.createICodeNode(CTokenType.ARGS);
node.addChild(codeNodeStack.pop());
node.addChild(codeNodeStack.pop());
break;
case CGrammarInitializer.Return_Semi_TO_Statement:
node = ICodeFactory.createICodeNode(CTokenType.STATEMENT);
break;
case CGrammarInitializer.Return_Expr_Semi_TO_Statement:
node = ICodeFactory.createICodeNode(CTokenType.STATEMENT);
node.addChild(codeNodeStack.pop());
break;
}
if (node != null) {
node.setAttribute(ICodeKey.PRODUCTION, production);
codeNodeStack.push(node);
}
return node;
}
private Symbol assignSymbolToNode(ICodeNode node, String text) {
Symbol symbol = typeSystem.getSymbolByText(text, parser.getCurrentLevel(), parser.symbolScope);
node.setAttribute(ICodeKey.SYMBOL, symbol);
node.setAttribute(ICodeKey.TEXT, text);
return symbol;
}
public ICodeNode getCodeTreeRoot() {
ICodeNode mainNode = funcMap.get("main");
return mainNode;
}
}
| [
"2673077461@qq.com"
] | 2673077461@qq.com |
a075759add2495e79bae73e873c551d4ff6ffce3 | d8c8b2ca7773865982188ffe44a26c47ba589a48 | /src/main/java/de/achimonline/kickassembler/acbg/module/KickAssemblerModuleType.java | ccbcc518831128f940716cc4b14a3219e5d7e0fe | [
"MIT"
] | permissive | christo/kick-assembler-acbg | ab40eb4ef9e491537de2289912e80a9f46967faa | 59a406175b06bb25c9488e660d0381b6dc80d819 | refs/heads/master | 2023-03-28T13:00:00.230727 | 2020-07-28T18:24:33 | 2020-07-28T18:24:33 | 275,495,726 | 2 | 0 | MIT | 2020-06-28T03:03:44 | 2020-06-28T03:03:43 | null | UTF-8 | Java | false | false | 1,318 | java | package de.achimonline.kickassembler.acbg.module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.ModuleTypeManager;
import com.intellij.openapi.util.IconLoader;
import de.achimonline.kickassembler.acbg.properties.KickAssemblerProperties;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class KickAssemblerModuleType extends ModuleType<KickAssemblerModuleBuilder> {
private static final String KICK_ASSEMBLER_MODULE = "KickAssemblerModule";
public KickAssemblerModuleType() {
super(KICK_ASSEMBLER_MODULE);
}
@NotNull
public static KickAssemblerModuleType getInstance() {
return (KickAssemblerModuleType) ModuleTypeManager.getInstance().findByID(KICK_ASSEMBLER_MODULE);
}
@NotNull
@Override
public KickAssemblerModuleBuilder createModuleBuilder() {
return new KickAssemblerModuleBuilder();
}
@NotNull
@Override
public String getName() {
return KickAssemblerProperties.message("module.name");
}
@NotNull
@Override
public String getDescription() {
return KickAssemblerProperties.message("module.description");
}
@Override
public Icon getNodeIcon(boolean isOpened) {
return IconLoader.findIcon("/icons/icon_16x16.png");
}
}
| [
"git@achimonline.de"
] | git@achimonline.de |
e2707f9f5059c0b2719d5ea579620f8dbe8b77c5 | 9ed90abaaa32c8b418b474a57af52a19cbeabb7b | /app/src/main/java/com/example/covid_19apps/Chart/ChartResponse.java | 203453eb8e61b5885c375261524a3a0c971b3d9a | [] | no_license | farhanmzr/Covid19-Apps | 5b00b10538b74e4194c774d661a3fd173c06e617 | 91f4b11069d1efbe2e5cfc5fcdb6d5e5beb340fa | refs/heads/master | 2023-07-18T19:55:44.733759 | 2021-09-13T10:10:36 | 2021-09-13T10:10:36 | 273,629,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package com.example.covid_19apps.Chart;
import com.google.gson.annotations.SerializedName;
public class ChartResponse {
@SerializedName("sales")
private Object salesResponse = null;
@SerializedName("products")
private Object productsResponse = null;
@SerializedName("months")
private Object monthsResponse = null;
public Object getSalesResponse() {
return salesResponse;
}
public Object getProductsResponse() {
return productsResponse;
}
public Object getMonthsResponse() {
return monthsResponse;
}
}
| [
"farhanrio2805@gmail.com"
] | farhanrio2805@gmail.com |
35690219bea4e2b109b804227b4e25c76c00d4b8 | ecd7b87d712595e824c011422ec708de81a21d44 | /psychometrics-nirt/src/test/java/com/itemanalysis/psychometrics/kernel/LeastSquaresCrossValidationTest.java | ff523b76389cbf6507c7cf3a4cf42936a96d15d6 | [
"Apache-2.0"
] | permissive | meyerjp3/psychometrics | c30744f588452ed26485269af8ef9d7427160a39 | 1fac2d7053ae17acb0b9bedc13c52c41874e8a77 | refs/heads/master | 2022-02-19T11:55:24.140572 | 2022-02-15T17:24:05 | 2022-02-15T17:24:05 | 16,204,287 | 91 | 46 | null | 2021-06-30T19:26:45 | 2014-01-24T12:50:40 | Java | UTF-8 | Java | false | false | 2,620 | java | /*
* Copyright 2012 J. Patrick Meyer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.itemanalysis.psychometrics.kernel;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class LeastSquaresCrossValidationTest {
/**
* True values obtained from R function bw.ucv(x)
*
* @throws Exception
*/
@Test
public void testValue() throws Exception {
System.out.println("Least squares cross validation test 1");
double[] x = {103.36,86.85,96.57,100.06,127.03,
105.2,109.78,121.87,94.71,101.17,
93.93,110.45,103.3,88.52,119.2,
108.45,90.39,118.2,117.28,88.95,
88.97,105.29,118.8,107.22,101.47,
95.92,105.33,119.37,98.37,127.59,
102.69,91.83,90.93,106.3,100.18,
102.22,103.14,102.18,96.12,127.27,
98.67,108.68,84.45,89.31,87.09,
134.82,117.41,93.35,95.36,82.95};
ScottsBandwidth scott = new ScottsBandwidth(x);
System.out.println(" Scott: " + scott.value());
LeastSquaresCrossValidation lscv = new LeastSquaresCrossValidation(x);
System.out.println(" LSCV: " + lscv.value());
// assertEquals("LSCV test 1", 6.431987000748, lscv.evaluate(), 1e-5);
}
/**
* True values obtained from R function bw.ucv(x)
*
* @throws Exception
*/
@Test
public void testValue2()throws Exception{
System.out.println("Least squares cross validation test 2");
double[] x = {0.65, 0.89, -0.20, 2.33, -0.67, 0.28, 1.06, 1.53, 0.32, -0.18, -1.16, 0.15,
0.95, -0.88, 0.65, -1.03, 0.26, 0.42, 0.40, 0.25, -0.43, 0.00, 0.07, 0.84,
0.42, 0.72, -0.73, -1.98, 0.88, -1.60};
ScottsBandwidth scott = new ScottsBandwidth(x);
System.out.println(" Scott: " + scott.value());
LeastSquaresCrossValidation lscv = new LeastSquaresCrossValidation(x);
System.out.println(" LSCV: " + lscv.value());
// assertEquals("LSCV test 2", 0.487795421968898, lscv.evaluate(), 1e-5);
}
}
| [
"meyerjp3@gmail.com"
] | meyerjp3@gmail.com |
357b9c72678b9c9dce12abb3f48ab7c034ecd84e | 811249478469c428f2c4e1e6468da4163b06ceaf | /zero/01EightQueens/OneQueen.java | 7eeb7f0563aa080cc857806366f680267cdaafc3 | [] | no_license | zerosunyata/learningJava | c93f7ef97a2127f661892e2fe7dc1682fdb49d4b | 180aee306a73545fa7c47dd6780e0d00e84ccc58 | refs/heads/master | 2022-02-20T22:29:43.825455 | 2019-10-11T03:02:45 | 2019-10-11T03:02:45 | 198,062,227 | 0 | 1 | null | 2019-08-17T22:17:16 | 2019-07-21T13:51:06 | Java | UTF-8 | Java | false | false | 1,939 | java |
public class OneQueen {
public static int num = 0;
public static final int MAXQUEEN = 16;
public static int[] cols = new int[MAXQUEEN];
public OneQueen() {
for(int i = 0; i < MAXQUEEN; i ++)
cols[i] = -1;
getArrangement(0);
System.out.print("\n");
System.out.println(MAXQUEEN + " queen(s) has " + num + " solution(s)");
}
public void getArrangement(int n) {
for(int i = n; i < MAXQUEEN; i ++)
cols[i] = -1;
// set rows to false, means we can put queen on this row
boolean[] rows = new boolean[MAXQUEEN];
// set non available position
for (int i = 0; i < n; i++) {
rows[cols[i]] = true;
int d = n - i;
if (cols[i] - d >= 0)
rows[cols[i] - d] = true;
if (cols[i] + d <= MAXQUEEN - 1)
rows[cols[i] + d] = true;
}
System.out.print("\nCol "+ n + " Status"+"\n");
for(int i = 0; i < MAXQUEEN; i ++) {
for(int j = 0; j < n; j ++)
System.out.print(" ");
if(rows[i])
System.out.println("* ");
else
System.out.println("+ ");
}
System.out.println();
// go deep
for (int i = 0; i < MAXQUEEN; i++) {
if (rows[i])
continue;
cols[n] = i;
if (n < MAXQUEEN - 1) {
printStep(n);
getArrangement(n + 1);
} else {
num++;
printChessBoard();
}
}
}
public void printStep(int n) {
System.out.print("Try step "+ n +"\n");
for (int i = 0; i < MAXQUEEN; i++) {
for (int j = 0; j <= n; j++) {
if (i == cols[j]) {
System.out.print(i+" ");
} else
System.out.print("+ ");
}
System.out.print("\n");
}
}
public void printChessBoard() {
System.out.print("NO." + num + " solution\n");
for (int i = 0; i < MAXQUEEN; i++) {
for (int j = 0; j < MAXQUEEN; j++) {
if (i == cols[j]) {
System.out.print(i+" ");
} else
System.out.print("+ ");
}
System.out.print("\n");
}
}
public static void main(String args[]) {
OneQueen queen = new OneQueen();
}
}
| [
"yinxueyu@hotmail.com"
] | yinxueyu@hotmail.com |
783a4aa3c00a5a53cb9153a86aec2cb8a9249fc6 | a3f3c412fbdf66b8489501a43c8b077d87e39848 | /source/src/main/java/cn/vlabs/umt/services/account/CoreMailAuthenticateResult.java | 8c8d931fc0e106e78b082a88a5324dc159a39d4c | [] | no_license | shmilyday/umt | 25fc9d9251ddec864119d032516e314435b113bc | d499cc65b8c1808a936cfa344b5091b28baf9a51 | refs/heads/master | 2020-04-01T21:22:37.594965 | 2014-01-03T09:47:06 | 2014-01-03T09:47:06 | 59,024,653 | 0 | 1 | null | 2016-05-17T13:25:04 | 2016-05-17T13:25:03 | null | UTF-8 | Java | false | false | 1,307 | java | /*
* Copyright (c) 2008-2013 Computer Network Information Center (CNIC), Chinese Academy of Sciences.
*
* 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 cn.vlabs.umt.services.account;
/**
* @author lvly
* @since 2013-9-17
*/
public class CoreMailAuthenticateResult {
private boolean isSuccess;
private boolean isValidUserName;
public CoreMailAuthenticateResult(boolean isSuccess,boolean isValidUserName){
this.isSuccess=isSuccess;
this.isValidUserName=isValidUserName;
}
public boolean isSuccess() {
return isSuccess;
}
public void setSuccess(boolean isSuccess) {
this.isSuccess = isSuccess;
}
public boolean isValidUserName() {
return isValidUserName;
}
public void setValidUserName(boolean isValidUserName) {
this.isValidUserName = isValidUserName;
}
} | [
"fufyddns999@gmail.com"
] | fufyddns999@gmail.com |
115aba575d71b20bde8249724da29641e1522abc | 45f47e61438055936b3d8ddb9530e71a4ce991a9 | /Organizer/Drive.java | c7d17e7aa43c35cbe8571d659570e3854b69422a | [
"Apache-2.0"
] | permissive | TimJSwan89/Java-Programs | b50a6cd3fa6e3a1300ad94639a2bbce05a5260f2 | e9fae7fc87d362d94c5fd45363505f0e69ceb0c0 | refs/heads/master | 2021-01-10T15:18:20.133607 | 2015-10-23T04:48:27 | 2015-10-23T04:48:27 | 44,790,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | public class Drive {
public static void main() {
System.out.println("Memory Test:");
for(int i = 0; i < 1000000; i++) {
MemoryTest mem = new MemoryTest(null);
MemoryTest mum = new MemoryTest(mem);
mem.changeMother(mum);
}
}
} | [
"timothyswan@host-13-166.iluruco.urbana.il.us.clients.pavlovmedia.com"
] | timothyswan@host-13-166.iluruco.urbana.il.us.clients.pavlovmedia.com |
8ab4d51ae3621428c8bb7f1ef99cbfc753c72646 | 0638fc626d47bbc28c45774eb48780bbfbe35e95 | /core/src/com/secondgame/weapon/Bullet.java | 87b5f1c849dd3b282147b90fa9ed2e54da067a98 | [
"MIT"
] | permissive | mattbolles/thetrip | bcc19d8e3cc4a0e507a5c8c77f1e8047e3e97c0f | e1fc2c0506ce09c45dff0b8d8ce1d843ba2ee479 | refs/heads/master | 2022-11-06T17:00:00.245832 | 2020-06-21T01:24:59 | 2020-06-21T01:24:59 | 270,143,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,438 | java | package com.secondgame.weapon;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.secondgame.map.GameMap;
import com.secondgame.resource.Hitbox;
public class Bullet {
public static final int SPEED = 500;
private static Texture bulletTexture;
public boolean needToRemove = false;
protected GameMap gameMap;
float x;
float y;
String direction;
OrthographicCamera camera;
Vector3 bulletPos;
float relativeBulletSpawnX;
float relativeBulletSpawnY;
float absBulletSpawnX;
float absBulletSpawnY;
int height;
int width;
float newXPosition;
Hitbox hitbox;
public Bullet(float x, float y, String direction, OrthographicCamera camera, GameMap gameMap) {
this.x = x;
this.y = y;
this.height = 12;
this.width = 12;
this.hitbox = new Hitbox(x, y, width, height);
this.newXPosition = x;
this.absBulletSpawnX = x;
this.absBulletSpawnY = y;
this.direction = direction;
this.camera = camera;
this.gameMap = gameMap;
bulletPos = new Vector3(x, y, 0);
camera.unproject(bulletPos);
relativeBulletSpawnX = bulletPos.x;
relativeBulletSpawnY = bulletPos.y;
if (bulletTexture == null) {
bulletTexture = new Texture("images/bullet.png");
}
}
public void update(float deltaTime, float gravity) {
if ("right".equals(direction)) {
newXPosition = x + SPEED * deltaTime;
}
if ("left".equals(direction)) {
newXPosition = x - SPEED * deltaTime;
}
// if does not collide, move to new position
if (gameMap.checkIfCollidesWithTiles(newXPosition, y, width, height) != 1) {
x = newXPosition;
}
//update hitbox
this.hitbox.move(x, y);
// if collides, remove it
if (gameMap.checkIfCollidesWithTiles(newXPosition, y, width, height) == 1) {
needToRemove = true;
}
}
public void render(SpriteBatch spriteBatch) {
spriteBatch.draw(bulletTexture, x, y, 12, 12);
}
public Hitbox getHitbox() {
return hitbox;
}
public void setNeedToRemove(boolean needToRemove) {
this.needToRemove = needToRemove;
}
}
| [
"matt@mattrbolles.com"
] | matt@mattrbolles.com |
b4ebba34485ed72174446ea75dfdfc8e76b779b3 | f7a1727fbe4ebd1da38bc396c335afbeeaec128f | /src/main/java/com/example/demo/_50_shop/_53_shopRegister/service/impl/NightMarketServiceImpl.java | be2e02ce19e0b054cd4243ddcc5f6bbff03c049c | [] | no_license | Is-Yi-Feng/SpringBoot_Yachi | 18e83ba17ee714864dc69cb6edbae4ed6752ca03 | 2fedc761cbe78f30f973eac43b7bb55c851ae803 | refs/heads/main | 2023-04-05T13:03:11.455155 | 2021-04-13T07:42:17 | 2021-04-13T07:42:17 | 353,603,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.example.demo._50_shop._53_shopRegister.service.impl;
import java.io.Serializable;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.example.demo._02_model.entity.NightMarketBean;
import com.example.demo._50_shop._53_shopRegister.dao.NightMarketDao;
import com.example.demo._50_shop._53_shopRegister.service.NightMarketService;
@Transactional
@Service
public class NightMarketServiceImpl implements NightMarketService{
@Autowired
NightMarketDao nightMarketDao;
@Override
public List<NightMarketBean> getAllMarkets() {
return nightMarketDao.getAllMarkets();
}
@Override
public NightMarketBean getNightMarketById(int nightMarketId) {
return nightMarketDao.getNightMarketById(nightMarketId);
}
}
| [
"os24702258car@gmail.com"
] | os24702258car@gmail.com |
385bfb977ec79725a87dac1050bc9869d2928c06 | df5d4f0dd973c0fe1c711d2c6e051b478aaaf693 | /app/src/main/java/cn/fundview/app/fragment/SlideImgFragment.java | 5ab22b227a48bd2253130218ea53ad2d20c33aef | [] | no_license | seasky100/Agr-join-v1-raw | ccd5f1e7a745dd8374410a9115ea722550d5c49d | 7d5f2e02bcf2645217db9e53aeebe794617ff6ab | refs/heads/master | 2020-04-28T01:39:56.239938 | 2015-12-20T09:21:05 | 2015-12-20T09:21:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,455 | java | package cn.fundview.app.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import cn.fundview.R;
import cn.fundview.app.tool.Constants;
import cn.fundview.app.tool.bitmap.XUtilsImageLoader;
/**
* Created by Administrator on 2015/10/13 0013.
* <p/>
* 滑动 fragment
*/
public class SlideImgFragment extends Fragment {
private String url;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getArguments();
url = bundle.getString(Constants.IMG_URL_KEY);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
ImageView imageView = new ImageView(this.getContext());
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 80);
imageView.setLayoutParams(params);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
XUtilsImageLoader xUtilsImageLoader = new XUtilsImageLoader(this.getContext(),R.mipmap.banner_default);
xUtilsImageLoader.display(imageView, this.url);
return imageView;
}
}
| [
"zhuotianxiao@126.com"
] | zhuotianxiao@126.com |
5c562810f2736ac77b11dd36b5e44045f48352a3 | 5d90811f14b036833251feacf5cac7e6847cb13c | /app/src/main/java/com/zl/rxbindingexample/LoginActivity.java | fa21cc33c4f2c0518fd9fadecdc708638ae08e75 | [] | no_license | suyimin/RxBindingExample | 91c424394286d4dbd4d254e0cda949b0b66a5639 | ff80beac8ecbe18a1eda21629b4cef4be1775e9c | refs/heads/master | 2020-03-08T02:47:16.795006 | 2018-04-03T07:57:51 | 2018-04-03T07:57:51 | 127,870,794 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,382 | java | package com.zl.rxbindingexample;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.jakewharton.rxbinding.view.RxView;
import com.jakewharton.rxbinding.widget.RxTextView;
import java.util.concurrent.TimeUnit;
import butterknife.BindView;
import butterknife.ButterKnife;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func2;
public class LoginActivity extends AppCompatActivity {
private static String TAG = "LoginActivity";
@BindView(R.id.et_phone)
EditText mEtPhone;
@BindView(R.id.et_password)
EditText mEtPassword;
@BindView(R.id.bt_login)
Button mBtLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.bind(this);
initViews();
}
private void initViews() {
Observable<CharSequence> ObservableName = RxTextView.textChanges(mEtPhone);
Observable<CharSequence> ObservablePassword = RxTextView.textChanges(mEtPassword);
Observable.combineLatest(ObservableName, ObservablePassword, new Func2<CharSequence, CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence phone, CharSequence password) {
return isPhoneValid(phone.toString()) && isPasswordValid(password.toString());
}
}).subscribe(new Action1<Boolean>() {
@Override
public void call(Boolean aBoolean) {
RxView.enabled(mBtLogin).call(aBoolean);
}
});
RxView.clicks(mBtLogin)
.throttleFirst(1, TimeUnit.SECONDS)
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
Toast.makeText(LoginActivity.this, "登录成功!" ,Toast.LENGTH_SHORT).show();
}
});
}
private boolean isPhoneValid(String phone) {
return phone.length() == 11;
}
private boolean isPasswordValid(String password) {
return password.length() >= 6;
}
}
| [
"suyimin2001@163.com"
] | suyimin2001@163.com |
7111ad183be75241b315c1b8b571a395bc38e8a4 | 0375397f19709044c6b56082269e60bd37c1d897 | /jindouyun-db/src/main/java/com/jindouyun/db/service/JindouyunBrandOrderService.java | 988e876db53eab43a5a41b3bf849fc4fb7491189 | [] | no_license | zhangshengze0412/JinDouYun | 9e1f8d6b0c9e7330a60baead765d895b51cca57c | 01d5e49b8f1336b8a15d82b9332c5138d2bc3106 | refs/heads/master | 2022-12-05T03:30:37.506542 | 2020-08-24T14:27:33 | 2020-08-24T14:27:33 | 281,149,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,409 | java | package com.jindouyun.db.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jindouyun.db.dao.JindouyunBrandOrderMapper;
import com.jindouyun.db.domain.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @className: JindouyunBrandOrderService
* @description:
* @author: ZSZ
* @date: 2020/8/13 14:48
*/
@Service
public class JindouyunBrandOrderService {
@Resource
private JindouyunBrandOrderMapper brandOrderMapper;
@Autowired
private JindouyunMergeOrderService mergeOrderService;
public int updateStatusByMergeId(Integer mergeId,Short status){
JindouyunBrandOrder brandOrder = new JindouyunBrandOrder();
brandOrder.setStatus(status);
brandOrder.setUpdateTime(LocalDateTime.now());
JindouyunBrandOrderExample example = new JindouyunBrandOrderExample();
example.or().andOrderIdEqualTo(mergeId).andDeletedEqualTo(false);
return brandOrderMapper.updateByExampleSelective(brandOrder,example);
}
/**
* 查询合单信息
* @param orderStatusList
* @param brandId
* @param mergeId
* @param date
* @param page
* @param limit
* @param sort
* @param order
* @return
*/
public Map<String, Object> queryMergeInfoList(List<Short> orderStatusList, Integer brandId, Integer mergeId, LocalDateTime date, Integer page, Integer limit, String sort, String order){
List<JindouyunBrandOrder> brandOrders = queryBrandOrder(orderStatusList,brandId,mergeId, date, page, limit, sort, order);
PageInfo pageInfo = new PageInfo(brandOrders);
List<MergeInfo> mergeList = new ArrayList<>();
for (JindouyunBrandOrder brandOrder:brandOrders) {
MergeInfo mergeInfo = mergeOrderService.queryMergeInfoById(brandOrder.getOrderId());
mergeInfo.setBrandOrder(brandOrder);
mergeList.add(mergeInfo);
}
Map<String,Object> map = new HashMap<>();
map.put("page",pageInfo.getPageNum());
map.put("limit",pageInfo.getPageSize());
map.put("total",pageInfo.getTotal());
map.put("pages",pageInfo.getPages());
map.put("mergeInfo",mergeList);
return map;
}
public List<JindouyunBrandOrder> queryBrandOrder(List<Short> orderStatusArray,Integer brandId, Integer mergeId, LocalDateTime date, Integer page, Integer limit, String sort, String order){
JindouyunBrandOrderExample example = new JindouyunBrandOrderExample();
JindouyunBrandOrderExample.Criteria criteria = example.createCriteria();
if(orderStatusArray != null){
criteria.andStatusIn(orderStatusArray);
}
if (brandId != null){
criteria.andBrandIdEqualTo(brandId);
}
if (date != null){
LocalDateTime startTime = LocalDateTime.of(date.getYear(),date.getMonth(),date.getDayOfMonth(),0,0,0);
LocalDateTime endTime = startTime.plusDays(1);
criteria.andAddTimeBetween(startTime,endTime);
}
if (mergeId != null){
criteria.andOrderIdEqualTo(mergeId);
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page,limit);
return brandOrderMapper.selectByExample(example);
}
/**
* 根据mergeId查询
* @param mergeId
* @return
*/
public JindouyunBrandOrder queryByMergeId(Integer mergeId){
JindouyunBrandOrderExample example = new JindouyunBrandOrderExample();
example.or().andOrderIdEqualTo(mergeId).andDeletedEqualTo(false);
return brandOrderMapper.selectOneByExample(example);
}
/**
* 添加 brandOrder
* @param brandOrder
*/
public void add(JindouyunBrandOrder brandOrder){
brandOrder.setAddTime(LocalDateTime.now());
brandOrder.setUpdateTime(LocalDateTime.now());
brandOrder.setDeleted(false);
brandOrderMapper.insertSelective(brandOrder);
}
}
| [
"2955324023@qq.com"
] | 2955324023@qq.com |
477af82c0f6fb2f0691e27fa795dcf62ed54b182 | 27fae8ec9a35f90c404191e9ba0f00eeb4fd1ee6 | /src/com/rs/game/WorldObject.java | 2b7e11256062321d71f29c5953000d2bada7befa | [] | no_license | Log-nx/Open718 | 996230b00ba653908d9f03b324d5118ffd6e4b7a | 2a3a90d7e31d74035bb0a0c8a5cacf15f8b10644 | refs/heads/master | 2023-07-18T17:15:16.133957 | 2021-08-28T17:20:51 | 2021-08-28T17:20:51 | 400,848,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,889 | java | package com.rs.game;
import com.rs.cache.loaders.ObjectDefinitions;
import com.rs.game.player.Player;
@SuppressWarnings("serial")
public class WorldObject extends WorldTile {
private int id;
private int type;
private int rotation;
private int life;
public Player owner;
public WorldObject(int id, int type, int rotation, WorldTile tile) {
super(tile.getX(), tile.getY(), tile.getPlane());
this.id = id;
this.type = type;
this.rotation = rotation;
this.life = 1;
}
public WorldObject(int id, int type, int rotation, int x, int y, int plane) {
super(x, y, plane);
this.id = id;
this.type = type;
this.rotation = rotation;
this.life = 1;
}
public WorldObject(int id, int type, int rotation, int x, int y, int plane, int life) {
super(x, y, plane);
this.id = id;
this.type = type;
this.rotation = rotation;
this.life = life;
}
public WorldObject(WorldObject object) {
super(object.getX(), object.getY(), object.getPlane());
this.id = object.id;
this.type = object.type;
this.rotation = object.rotation;
this.life = object.life;
}
public WorldObject(int id, int type, int rotation, int x, int y, int plane, Player owner) {
super(x, y, plane);
this.owner = owner;
this.id = id;
this.type = type;
this.rotation = rotation;
this.life = 1;
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getRotation() {
return rotation;
}
public void setRotation(int rotation) {
this.rotation = rotation;
}
public int getLife() {
return life;
}
public void setLife(int life) {
this.life = life;
}
public void decrementObjectLife() {
this.life--;
}
public Player getOwner() {
return owner;
}
public ObjectDefinitions getDefinitions() {
return ObjectDefinitions.getObjectDefinitions(id);
}
public void setId(int id) {
this.id = id;
}
}
| [
"Logiikofficial@gmail.com"
] | Logiikofficial@gmail.com |
d39051bb4abe68fa97fdcd60feb894d226f90170 | 81516c9bf07cd66a9972f1f2a5499e44ed4a3e79 | /src/test/java/com/desafiospring/challenge/fixtures/ProductoCompraDTOFixture.java | 99e8595b0ee6297a08babb896f84218081c3e47f | [] | no_license | alejandrocurci/java-csv-shopping-cart-challenge | 7dde9db6ec71709534428943cb37ad8ff5d1835c | 2bd15b58750a581134e34ff75ecdbda28bfe8098 | refs/heads/main | 2023-07-11T08:32:17.248499 | 2021-07-30T16:16:03 | 2021-07-30T16:16:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,975 | java | package com.desafiospring.challenge.fixtures;
import com.desafiospring.challenge.dtos.ProductPurchaseDTO;
import java.util.ArrayList;
import java.util.List;
public class ProductoCompraDTOFixture {
// wrong purchase
public static List<ProductPurchaseDTO> defaultWrongList() {
List<ProductPurchaseDTO> productos = new ArrayList<>();
productos.add(ProductoCompraDTOFixture.default2());
productos.add(ProductoCompraDTOFixture.default3());
return productos;
}
// successful purchase
public static List<ProductPurchaseDTO> defaultSuccessfulList() {
List<ProductPurchaseDTO> productos = new ArrayList<>();
productos.add(ProductoCompraDTOFixture.default1());
productos.add(ProductoCompraDTOFixture.default4());
return productos;
}
public static ProductPurchaseDTO default1() {
ProductPurchaseDTO producto = new ProductPurchaseDTO();
producto.setProductId(1);
producto.setName("Pelota");
producto.setBrand("Adidas");
producto.setQuantity(6);
return producto;
}
public static ProductPurchaseDTO default2() {
ProductPurchaseDTO producto = new ProductPurchaseDTO();
producto.setProductId(2);
producto.setName("Martillo");
producto.setBrand("Acindar");
producto.setQuantity(25);
return producto;
}
public static ProductPurchaseDTO default3() {
ProductPurchaseDTO producto = new ProductPurchaseDTO();
producto.setProductId(3);
producto.setName("Contenedor");
producto.setBrand("Tenaris");
producto.setQuantity(7);
return producto;
}
public static ProductPurchaseDTO default4() {
ProductPurchaseDTO producto = new ProductPurchaseDTO();
producto.setProductId(4);
producto.setName("Autito");
producto.setBrand("Hot Wheels");
producto.setQuantity(3);
return producto;
}
}
| [
"alejandrocurci@hotmail.com"
] | alejandrocurci@hotmail.com |
f6e6b22444f1af39e0e0c8b37ae65825c79ae892 | 9b5510f58efbd00946a2945fa2fedb2e3b55817d | /lowestest/src/main/java/com/lowes/coding/dto/LowesDownstreamResponseDto.java | 5a11a659a343f6f3c8220eff724999522b88db9e | [] | no_license | Mdrcoder/Lowes | 95eff57805747f4bbf64b991310bb04cf4b37277 | 96a94cc56089c48479fda020f2d627ff355af7a4 | refs/heads/main | 2023-03-09T14:49:13.007239 | 2021-02-27T20:27:28 | 2021-02-27T20:27:28 | 342,947,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package com.lowes.coding.dto;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
* @author manan
*
*/
@Getter
@Setter
public class LowesDownstreamResponseDto {
private int response_code;
private List<LowesDownstreamResponse1Results> results;
}
| [
"Abhishek.Manandhar101@gmail.com"
] | Abhishek.Manandhar101@gmail.com |
2e61a03932cfff7fd166e73abe86a736cc5875ca | 77210ce4eb26ed9b9ab606b061c5c187941a3d3f | /src/test/jp/salesmessage/impl/MessageReadAndParserDetails.java | c48877c6a77a5394dfbb93c9aebd119b51f39f2c | [] | no_license | senthilvelan76/SalesNotificationMessageProject | f633303315470966e1d28bd062a9d0de885c5dc0 | 6344be99d3015443f1785e93dc27f0b8918bc5f1 | refs/heads/master | 2021-01-21T11:30:36.879883 | 2017-05-19T16:57:18 | 2017-05-19T16:57:18 | 91,745,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,222 | java | package test.jp.salesmessage.impl;
/**
* Parses a sales message and obtains product details. Ignores parsing of any invalid string and returns
* false.
*/
public class MessageReadAndParserDetails {
private String productType;
private double productPrice;
private int productQuantity;
// product operatorType - Add, Subtract and Multiply
private String operatorType;
public MessageReadAndParserDetails(String message) {
this.productType = "";
this.productPrice = 0.0;
this.productQuantity = 0;
this.operatorType = "";
parseMessage(message);
}
// Validates the message and identifies the message type to get it
// parsed properly to obtain product details.
// @return[Boolean] false on wrong message else returns true
public boolean parseMessage(String message) {
if (message == null || message.isEmpty()) {
return false;
}
String[] messageArray = message.trim().split("\\s+");
String firstWord = messageArray[0];
if (firstWord.matches("Add|Subtract|Multiply")) {
return parseMessageType3(messageArray);
} else if (firstWord.matches("^\\d+")) {
return parseMessageType2(messageArray);
} else if (messageArray.length == 3 && messageArray[1].contains("at")) {
return parseMessageType1(messageArray);
} else {
System.out.println("Wrong sales notice");
return false;
}
//return true;
}
// Parse message type 1
private boolean parseMessageType1(String[] messageArray) {
if(messageArray.length > 3 || messageArray.length < 3) return false;
productType = parseType(messageArray[0]);
productPrice = parsePrice(messageArray[2]);
productQuantity = 1; //Will always be 1
return true;
}
// Parse message type 2
private boolean parseMessageType2(String[] messageArray) {
if(messageArray.length > 7 || messageArray.length < 7) return false;
productType = parseType(messageArray[3]);
productPrice = parsePrice(messageArray[5]);
productQuantity = Integer.parseInt(messageArray[0]);
return true;
}
// Parse message type 3
private boolean parseMessageType3(String[] messageArray) {
if(messageArray.length > 3 || messageArray.length < 3) return false;
operatorType = messageArray[0];
productType = parseType(messageArray[2]);
productQuantity = 0;
productPrice = parsePrice(messageArray[1]);
return true;
}
// handle the plural cases of the fruit products
// @return[String] parsed string e.g 'mango' will become 'mangoes'
public String parseType(String rawType) {
String parsedType = "";
String typeWithoutLastChar = rawType.substring(0, rawType.length() - 1);
//enum DEPREC
if (rawType.endsWith("o")) {
parsedType = String.format("%soes", typeWithoutLastChar);
} else if (rawType.endsWith("y")) {
parsedType = String.format("%sies", typeWithoutLastChar);
} else if (rawType.endsWith("h")) {
parsedType = String.format("%shes", typeWithoutLastChar);
} else if (!rawType.endsWith("s")) {
parsedType = String.format("%ss", rawType);
} else {
parsedType = String.format("%s", rawType);
}
return parsedType.toLowerCase();
}
// Parse the price and get only the value
// @return[double] e.g "20p" will become 0.20
public double parsePrice(String rawPrice) {
double price = Double.parseDouble(rawPrice.replaceAll("£|p", ""));
if (!rawPrice.contains(".")) {
price = Double.valueOf(Double.valueOf(price) / Double.valueOf("100"));
}
return price;
}
public String getProductType() {
return productType;
}
public double getProductPrice() {
return productPrice;
}
public String getOperatorType() {
return operatorType;
}
public int getProductQuantity() {
return productQuantity;
}
} | [
"senthilvelan.m76@gmail.com"
] | senthilvelan.m76@gmail.com |
f7ad84452c7615f151885ccac323c19b356e505d | 0915ae161c2f55bf040126cc34dcc06ea14cf4d5 | /jdbc/basics/examples/JDBCTutorial/src/com/oracle/tutorial/jdbc/RSSFeedsTable.java | 8d9c8cacb950a2f0bff5b5af9b7f940ffa74a000 | [] | no_license | EnixCoda/java-se-tutorial-bundle | 72f131553d2b74efcee21dd584e439651fcd5d9a | 934b63ae8aadf57fe011f26f6b6b39417e40813e | refs/heads/master | 2023-03-31T00:13:17.294064 | 2021-03-29T10:09:16 | 2021-03-29T10:13:08 | 352,598,674 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,534 | java | /*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. 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 name of Oracle or 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.
*/
package com.oracle.tutorial.jdbc;
import java.io.IOException;
import java.io.StringReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.sql.Statement;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class RSSFeedsTable {
private String dbName;
private Connection con;
private String dbms;
public RSSFeedsTable(Connection connArg, String dbNameArg, String dbmsArg) {
super();
this.con = connArg;
this.dbName = dbNameArg;
this.dbms = dbmsArg;
}
public void createTable() throws SQLException {
try (Statement stmt = con.createStatement()){
if (this.dbms.equals("derby")) {
String createString =
"create table RSS_FEEDS (RSS_NAME varchar(32) NOT NULL," +
" RSS_FEED_XML xml NOT NULL, PRIMARY KEY (RSS_NAME))";
stmt.executeUpdate(createString);
} else if (this.dbms.equals("mysql")) {
String createString =
"create table RSS_FEEDS (RSS_NAME varchar(32) NOT NULL," +
" RSS_FEED_XML longtext NOT NULL, PRIMARY KEY (RSS_NAME))";
stmt.executeUpdate(createString);
}
} catch (SQLException e) {
JDBCTutorialUtilities.printSQLException(e);
}
}
public void dropTable() throws SQLException {
try (Statement stmt = con.createStatement()){
if (this.dbms.equals("mysql")) {
stmt.executeUpdate("DROP TABLE IF EXISTS RSS_FEEDS");
} else if (this.dbms.equals("derby")) {
stmt.executeUpdate("DROP TABLE RSS_FEEDS");
}
} catch (SQLException e) {
JDBCTutorialUtilities.printSQLException(e);
}
}
public void addRSSFeed(String fileName) throws ParserConfigurationException,
SAXException, IOException,
XPathExpressionException,
TransformerConfigurationException,
TransformerException,
SQLException {
// Parse the document and retrieve the name of the RSS feed
String titleString = null;
javax.xml.parsers.DocumentBuilderFactory factory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(fileName);
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xPath = xPathfactory.newXPath();
Node titleElement =
(Node)xPath.evaluate("/rss/channel/title[1]", doc, XPathConstants.NODE);
if (titleElement == null) {
System.out.println("Unable to retrieve title element");
return;
} else {
titleString =
titleElement.getTextContent().trim().toLowerCase().replaceAll("\\s+",
"_");
System.out.println("title element: [" + titleString + "]");
}
System.out.println(JDBCTutorialUtilities.convertDocumentToString(doc));
PreparedStatement insertRow = null;
SQLXML rssData = null;
System.out.println("Current DBMS: " + this.dbms);
try {
if (this.dbms.equals("mysql")) {
// For databases that support the SQLXML data type, this creates a
// SQLXML object from org.w3c.dom.Document.
System.out.println("Adding XML file " + fileName);
String insertRowQuery =
"insert into RSS_FEEDS (RSS_NAME, RSS_FEED_XML) values" + " (?, ?)";
insertRow = con.prepareStatement(insertRowQuery);
insertRow.setString(1, titleString);
System.out.println("Creating SQLXML object with MySQL");
rssData = con.createSQLXML();
System.out.println("Creating DOMResult object");
DOMResult dom = (DOMResult)rssData.setResult(DOMResult.class);
dom.setNode(doc);
insertRow.setSQLXML(2, rssData);
System.out.println("Running executeUpdate()");
insertRow.executeUpdate();
}
else if (this.dbms.equals("derby")) {
System.out.println("Adding XML file " + fileName);
String insertRowQuery =
"insert into RSS_FEEDS (RSS_NAME, RSS_FEED_XML) values" +
" (?, xmlparse(document cast (? as clob) preserve whitespace))";
insertRow = con.prepareStatement(insertRowQuery);
insertRow.setString(1, titleString);
String convertedDoc =
JDBCTutorialUtilities.convertDocumentToString(doc);
insertRow.setClob(2, new StringReader(convertedDoc));
System.out.println("Running executeUpdate()");
insertRow.executeUpdate();
}
} catch (SQLException e) {
JDBCTutorialUtilities.printSQLException(e);
} catch (Exception ex) {
System.out.println("Another exception caught:");
ex.printStackTrace();
}
finally {
if (insertRow != null) { insertRow.close(); }
}
}
public void viewTable(Connection con) throws SQLException,
ParserConfigurationException,
SAXException, IOException,
TransformerConfigurationException,
TransformerException {
try (Statement stmt = con.createStatement()) {
if (this.dbms.equals("derby")) {
String query =
"select RSS_NAME, xmlserialize (RSS_FEED_XML as clob) from RSS_FEEDS";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String rssName = rs.getString(1);
String rssFeedXML = rs.getString(2);
javax.xml.parsers.DocumentBuilderFactory factory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc =
builder.parse(new InputSource(new StringReader(rssFeedXML)));
System.out.println("RSS identifier: " + rssName);
System.out.println(JDBCTutorialUtilities.convertDocumentToString(doc));
}
}
else if (this.dbms.equals("mysql")) {
String query = "select RSS_NAME, RSS_FEED_XML from RSS_FEEDS";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String rssName = rs.getString(1);
SQLXML rssFeedXML = rs.getSQLXML(2);
javax.xml.parsers.DocumentBuilderFactory factory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(rssFeedXML.getBinaryStream());
System.out.println("RSS identifier: " + rssName);
System.out.println(JDBCTutorialUtilities.convertDocumentToString(doc));
}
}
} catch (SQLException e) {
JDBCTutorialUtilities.printSQLException(e);
}
}
public static void main(String[] args) {
JDBCTutorialUtilities myJDBCTutorialUtilities;
Connection myConnection = null;
if (args[0] == null) {
System.err.println("Properties file not specified at command line");
return;
} else {
try {
myJDBCTutorialUtilities = new JDBCTutorialUtilities(args[0]);
} catch (Exception e) {
System.err.println("Problem reading properties file " + args[0]);
e.printStackTrace();
return;
}
}
try {
myConnection = myJDBCTutorialUtilities.getConnection();
RSSFeedsTable myRSSFeedsTable =
new RSSFeedsTable(myConnection, myJDBCTutorialUtilities.dbName,
myJDBCTutorialUtilities.dbms);
myRSSFeedsTable.addRSSFeed("xml/rss-coffee-industry-news.xml");
myRSSFeedsTable.addRSSFeed("xml/rss-the-coffee-break-blog.xml");
myRSSFeedsTable.viewTable(myConnection);
} catch (Exception e) {
e.printStackTrace();
} finally {
JDBCTutorialUtilities.closeConnection(myConnection);
}
}
} | [
"enixcoda@gmail.com"
] | enixcoda@gmail.com |
bb3ee29321d4e92d2abe0496b205a62b81574f7d | aaa9649c3e52b2bd8e472a526785f09e55a33840 | /EquationDesktop/src/com/misys/equation/ui/helpers/EqMsgFile.java | cf979f5e6e8f84762a2ffcf74071fa3b24191320 | [] | no_license | jcmartin2889/Repo | dbfd02f000e65c96056d4e6bcc540e536516d775 | 259c51703a2a50061ad3c99b8849477130cde2f4 | refs/heads/master | 2021-01-10T19:34:17.555112 | 2014-04-29T06:01:01 | 2014-04-29T06:01:01 | 19,265,367 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,813 | java | package com.misys.equation.ui.helpers;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400Message;
import com.ibm.as400.access.MessageFile;
import com.ibm.as400.access.ObjectDescription;
import com.misys.equation.common.access.EquationCommonContext;
import com.misys.equation.ui.tools.EqDesktopToolBox;
public class EqMsgFile
{
// This attribute is used to store cvs version information.
public static final String _revision = "$Id: EqMsgFile.java 9962 2010-11-18 17:31:39Z MACDONP1 $";
private final MessageFile msgFile;
private AS400Message msgD;
private String eqMsgStr;
boolean rtl = false;
/**
* Construct a message file based on the specified parameter
*
* @param msgf
* - the message file
*/
public EqMsgFile(MessageFile msgf)
{
msgFile = msgf;
msgD = null;
}
/**
* Determine whether the KSMMSGF exists in the specified path
*
* @param eqAS400
* - the AS400 system
* @param path
* - the path
* @return true if KSMMSGF exists
*/
public boolean existsKSM(AS400 eqAS400, String path)
{
ObjectDescription objd;
objd = new ObjectDescription(eqAS400, path, "KSMMSGF", "MSGF");
try
{
return (objd.exists());
}
catch (Exception e)
{
EquationCommonContext.getContext().getLOG().error(e);
}
return false;
}
/**
* Retrieve an entry from the message file
*
* @param msg
* - the message to retrieve
* @param rtl
* - right to left?
*
* @throws Exception
*/
public void getEqMsgD(String msg, boolean rtl) throws Exception
{
int startIndex = 0;
// msg contains the standard KSM message - "KSMxxxx Description ..."
this.rtl = false;
eqMsgStr = msg;
// get starting position of the message id
while (msg.charAt(startIndex) == ' ')
{
startIndex++;
}
String msgID = msg.substring(startIndex, startIndex + 7);
// String msgTxt = msg.substring(startIndex + 7, msg.length());
// if the message starts with KAP, then in KAPMSG
if (msgID.startsWith("KAP"))
{
msgFile.setPath("/QSYS.LIB/*LIBL.LIB/KAPMSG.MSGF");
}
// get the message
try
{
msgD = msgFile.getMessage(msgID);
}
// catch any exception and see if there are still processing needed
catch (Exception e)
{
// during RTL, then check if the KSM id is at the end!
if (rtl)
{
// get starting position of the message id
msg = msg.trim();
startIndex = msg.length() - 1;
while (msg.charAt(startIndex) == ' ')
{
startIndex--;
}
msgID = msg.substring(startIndex - 6, msg.length());
// msgTxt = msg.substring(0, startIndex - 5);
msgD = msgFile.getMessage(msgID);
this.rtl = rtl;
}
// otherwise, just pass the exception to the calling program
else
{
EquationCommonContext.getContext().getLOG().error(e);
throw e;
}
}
}
/**
* Set the message id
*
* @param msgid
* - the message id
* @param msg
* - the message
*
* @throws Exception
*/
public void setMsgId(String msgid, String msg) throws Exception
{
// this contain the actual message displayed
eqMsgStr = msg;
msgD = msgFile.getMessage(msgid);
}
/**
* Return the message id
*
* @return the message id
*/
public String getId()
{
// message description not setup
if (msgD == null)
{
return ("");
}
// return Id
return (msgD.getID());
}
/**
* Return the message text
*
* @return the message text
*/
public String getText()
{
// message description not setup
if (msgD == null)
{
return ("");
}
// return Id
return (msgD.getText());
}
/**
* Return the actual message displayed
*
* @return the actual message displayed
*/
public String getEqMsgStr()
{
return eqMsgStr;
}
/**
* Return the message severity
*
* @return the message severity
*/
public int getSeverity()
{
// message description not setup
if (msgD == null)
{
return -1;
}
// return severity
return (msgD.getSeverity());
}
/**
* Return the message type
*
* @return the message type
*/
public int getType()
{
// message description not setup
if (msgD == null)
{
return -1;
}
// return severity
return (msgD.getType());
}
/**
* Return the second level text
*
* @return the second level text
*/
public String getHelp()
{
String str;
// message description not setup
if (msgD == null)
{
return ("");
}
// check if 2nd level text has any substitution text
str = msgD.getHelp();
if (!isSubstExists(str))
{
return str;
}
// rtl, the control character is in a different position!
str = EqDesktopToolBox.stripCtrlChar(msgD.getText());
if (rtl)
{
str = str.substring(0, str.length() - 8) + " " + str.substring(str.length() - 7);
}
// since the message is retrieved from the message file, it has the substitution parameter
// (e.g. &1, &2, etc) in it, instead of the actual message (which exists in joblog but
// we dont know where). Do best guess to determine the substitution text based on the
// text available
String[] subsText = getSubstText(eqMsgStr, str);
// replace the text
str = msgD.getHelp();
for (int i = 0; i < subsText.length; i++)
{
String field = "&" + String.valueOf(i + 1);
if (subsText[i] == null)
{
subsText[i] = "";
}
str = str.replaceAll(field, subsText[i]);
}
return str;
}
/**
* Predict the substitution text based on the original message received
*
* @param strFormatted
* - the full message
* @param strUnformatted
* - the message from the message file
*
* @return the list of substitution text
*/
public String[] getSubstText(String strFormatted, String strUnformatted)
{
// initialise the subst text with empty spaces
String strSubst;
String[] arrSubst = new String[9];
for (int i = 1; i < 9; i++)
{
arrSubst[i] = "";
}
// search for all substitution field (&x)
int start = 0;
int pos;
try
{
while ((pos = strUnformatted.indexOf("&", start)) >= 0)
{
// end of string, then out
if (pos >= strUnformatted.length() - 1)
{
break;
}
// substitution field?
if (isSubstField(strUnformatted.substring(pos, pos + 2)))
{
strSubst = processSubstField(strFormatted, strUnformatted, pos);
strUnformatted = addSubst(arrSubst, strSubst, strUnformatted.substring(pos, pos + 2), strUnformatted);
}
// next
start = pos + 1;
}
}
catch (Exception e)
{
EquationCommonContext.getContext().getLOG().error(e);
}
// return array of substitution string
return arrSubst;
}
/**
* Process substitution field
*
* @param strFormatted
* - formatted text
* @param strUnformatted
* - unformmated text
* @param pos
* - starting position within the text
*
* @return the substitution string for the next substitution control
*/
public String processSubstField(String strFormatted, String strUnformatted, int pos)
{
// search for next substitution field
int next = pos + 1;
int xpos = pos;
while ((next = strUnformatted.indexOf("&", next)) >= 0)
{
if (isSubstField(strUnformatted.substring(next, next + 2)))
{
// ensure it is not immediately after the substitution text
if (next > xpos + 2)
{
break;
}
else
{
xpos = next;
next++;
}
}
else
{
break;
}
}
// no more substitution text
if (next == -1)
{
next = strUnformatted.length();
}
// get the left side of the string (relative to the original substitution field in POS)
String strLeft = strUnformatted.substring(0, pos);
// get the right side of the string (relative to the original substitution field in POS)
String strRight;
if (strUnformatted.length() > pos + 2)
{
strRight = strUnformatted.substring(xpos + 2, next);
}
else
{
strRight = "";
}
// search in formatted text
int n1 = strFormatted.indexOf(strLeft);
int n2 = strFormatted.indexOf(strRight);
if (strRight.equals(""))
{
n2 = strFormatted.length();
}
// must be found!
if (n1 == -1)
{
return "";
}
if (n2 == -1)
{
return "";
}
// get the text
String str = strFormatted.substring(n1 + strLeft.length(), n2);
return str;
}
/**
* Add the substitution text to the list and return the updated string
*
* @param str
* - the list of substitution text
* @param subst
* - the substitution text to be added
* @param field
* - the substitution control (e.g. &1, &2, etc)
* @param strUnformatted
* - the unformatted text
*
* @return the updated text
*/
public String addSubst(String[] str, String subst, String field, String strUnformatted)
{
// add to the array
int n = field.charAt(1) - '1';
str[n] = subst;
// reformat the unformatted text
return (strUnformatted.replaceAll(field, subst));
}
/**
* Determine whether substitution control (e.g. &1, &2, etc)
*
* @param str
* - the text
*
* @return true if substitution control (e.g. &1, &2, etc)
*/
public boolean isSubstExists(String str)
{
// search for &1
if (str.indexOf("&1") >= 0)
{
return true;
}
return false;
}
/**
* Determine whether the text is a substitution control (e.g. &1, &2, etc)
*
* @param str
* - the text
*
* @return true if it is a substitution control
*/
public boolean isSubstField(String str)
{
// must be 2 character only
if (str.length() != 2)
{
return false;
}
// start with &
if (str.charAt(0) != '&')
{
return false;
}
// end with 1..9
if (str.charAt(1) >= '0' && str.charAt(1) <= '9')
{
return true;
}
// otherwise, invalid
return false;
}
}
| [
"jomartin@MAN-D7R8ZYY1.misys.global.ad"
] | jomartin@MAN-D7R8ZYY1.misys.global.ad |
a19fdda35840ab5f1e82be63025892b4ca11860a | 097df92ce1bfc8a354680725c7d10f0d109b5b7d | /com/amazon/ws/emr/hadoop/fs/shaded/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java | 77b2d9be4e50ecb48ab6b89bc94de66108e99041 | [] | no_license | cozos/emrfs-hadoop | 7a1a1221ffc3aa8c25b1067cf07d3b46e39ab47f | ba5dfa631029cb5baac2f2972d2fdaca18dac422 | refs/heads/master | 2022-10-14T15:03:51.500050 | 2022-10-06T05:38:49 | 2022-10-06T05:38:49 | 233,979,996 | 2 | 2 | null | 2022-10-06T05:41:46 | 2020-01-15T02:24:16 | Java | UTF-8 | Java | false | false | 7,789 | java | package com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.model;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.annotation.SdkInternalApi;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.protocol.ProtocolMarshaller;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.protocol.StructuredPojo;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.model.transform.KeysAndAttributesMarshaller;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class KeysAndAttributes
implements Serializable, Cloneable, StructuredPojo
{
private List<Map<String, AttributeValue>> keys;
private List<String> attributesToGet;
private Boolean consistentRead;
private String projectionExpression;
private Map<String, String> expressionAttributeNames;
public List<Map<String, AttributeValue>> getKeys()
{
return keys;
}
public void setKeys(Collection<Map<String, AttributeValue>> keys)
{
if (keys == null)
{
this.keys = null;
return;
}
this.keys = new ArrayList(keys);
}
public KeysAndAttributes withKeys(Map<String, AttributeValue>... keys)
{
if (this.keys == null) {
setKeys(new ArrayList(keys.length));
}
for (Map<String, AttributeValue> ele : keys) {
this.keys.add(ele);
}
return this;
}
public KeysAndAttributes withKeys(Collection<Map<String, AttributeValue>> keys)
{
setKeys(keys);
return this;
}
public List<String> getAttributesToGet()
{
return attributesToGet;
}
public void setAttributesToGet(Collection<String> attributesToGet)
{
if (attributesToGet == null)
{
this.attributesToGet = null;
return;
}
this.attributesToGet = new ArrayList(attributesToGet);
}
public KeysAndAttributes withAttributesToGet(String... attributesToGet)
{
if (this.attributesToGet == null) {
setAttributesToGet(new ArrayList(attributesToGet.length));
}
for (String ele : attributesToGet) {
this.attributesToGet.add(ele);
}
return this;
}
public KeysAndAttributes withAttributesToGet(Collection<String> attributesToGet)
{
setAttributesToGet(attributesToGet);
return this;
}
public void setConsistentRead(Boolean consistentRead)
{
this.consistentRead = consistentRead;
}
public Boolean getConsistentRead()
{
return consistentRead;
}
public KeysAndAttributes withConsistentRead(Boolean consistentRead)
{
setConsistentRead(consistentRead);
return this;
}
public Boolean isConsistentRead()
{
return consistentRead;
}
public void setProjectionExpression(String projectionExpression)
{
this.projectionExpression = projectionExpression;
}
public String getProjectionExpression()
{
return projectionExpression;
}
public KeysAndAttributes withProjectionExpression(String projectionExpression)
{
setProjectionExpression(projectionExpression);
return this;
}
public Map<String, String> getExpressionAttributeNames()
{
return expressionAttributeNames;
}
public void setExpressionAttributeNames(Map<String, String> expressionAttributeNames)
{
this.expressionAttributeNames = expressionAttributeNames;
}
public KeysAndAttributes withExpressionAttributeNames(Map<String, String> expressionAttributeNames)
{
setExpressionAttributeNames(expressionAttributeNames);
return this;
}
public KeysAndAttributes addExpressionAttributeNamesEntry(String key, String value)
{
if (null == expressionAttributeNames) {
expressionAttributeNames = new HashMap();
}
if (expressionAttributeNames.containsKey(key)) {
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
}
expressionAttributeNames.put(key, value);
return this;
}
public KeysAndAttributes clearExpressionAttributeNamesEntries()
{
expressionAttributeNames = null;
return this;
}
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getKeys() != null) {
sb.append("Keys: ").append(getKeys()).append(",");
}
if (getAttributesToGet() != null) {
sb.append("AttributesToGet: ").append(getAttributesToGet()).append(",");
}
if (getConsistentRead() != null) {
sb.append("ConsistentRead: ").append(getConsistentRead()).append(",");
}
if (getProjectionExpression() != null) {
sb.append("ProjectionExpression: ").append(getProjectionExpression()).append(",");
}
if (getExpressionAttributeNames() != null) {
sb.append("ExpressionAttributeNames: ").append(getExpressionAttributeNames());
}
sb.append("}");
return sb.toString();
}
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof KeysAndAttributes)) {
return false;
}
KeysAndAttributes other = (KeysAndAttributes)obj;
if (((other.getKeys() == null ? 1 : 0) ^ (getKeys() == null ? 1 : 0)) != 0) {
return false;
}
if ((other.getKeys() != null) && (!other.getKeys().equals(getKeys()))) {
return false;
}
if (((other.getAttributesToGet() == null ? 1 : 0) ^ (getAttributesToGet() == null ? 1 : 0)) != 0) {
return false;
}
if ((other.getAttributesToGet() != null) && (!other.getAttributesToGet().equals(getAttributesToGet()))) {
return false;
}
if (((other.getConsistentRead() == null ? 1 : 0) ^ (getConsistentRead() == null ? 1 : 0)) != 0) {
return false;
}
if ((other.getConsistentRead() != null) && (!other.getConsistentRead().equals(getConsistentRead()))) {
return false;
}
if (((other.getProjectionExpression() == null ? 1 : 0) ^ (getProjectionExpression() == null ? 1 : 0)) != 0) {
return false;
}
if ((other.getProjectionExpression() != null) && (!other.getProjectionExpression().equals(getProjectionExpression()))) {
return false;
}
if (((other.getExpressionAttributeNames() == null ? 1 : 0) ^ (getExpressionAttributeNames() == null ? 1 : 0)) != 0) {
return false;
}
if ((other.getExpressionAttributeNames() != null) && (!other.getExpressionAttributeNames().equals(getExpressionAttributeNames()))) {
return false;
}
return true;
}
public int hashCode()
{
int prime = 31;
int hashCode = 1;
hashCode = 31 * hashCode + (getKeys() == null ? 0 : getKeys().hashCode());
hashCode = 31 * hashCode + (getAttributesToGet() == null ? 0 : getAttributesToGet().hashCode());
hashCode = 31 * hashCode + (getConsistentRead() == null ? 0 : getConsistentRead().hashCode());
hashCode = 31 * hashCode + (getProjectionExpression() == null ? 0 : getProjectionExpression().hashCode());
hashCode = 31 * hashCode + (getExpressionAttributeNames() == null ? 0 : getExpressionAttributeNames().hashCode());
return hashCode;
}
public KeysAndAttributes clone()
{
try
{
return (KeysAndAttributes)super.clone();
}
catch (CloneNotSupportedException e)
{
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() even though we're Cloneable!", e);
}
}
@SdkInternalApi
public void marshall(ProtocolMarshaller protocolMarshaller)
{
KeysAndAttributesMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
/* Location:
* Qualified Name: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.model.KeysAndAttributes
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"Arwin.tio@adroll.com"
] | Arwin.tio@adroll.com |
f6c9393e6577800c7ca45397be6f105f727bd6e1 | 2e3acb2caab1fe0094c24f40314b6e1843ea8ec5 | /app/src/androidTest/java/com/leebros/stuyschedule/ExampleInstrumentedTest.java | 7236690eb6bf368c5aa5edc94ea2b8334c27b9cf | [] | no_license | peterdjlee/StuySchedule | 693c105dd3ea12e489785987f05263dda729be25 | 60e3db6aea6c16e908b560bed44fdc3ff742ed4a | refs/heads/master | 2020-03-19T09:16:39.390402 | 2018-09-06T13:38:27 | 2018-09-06T13:38:27 | 136,274,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.leebros.stuyschedule;
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.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.leebros.stuyschedule", appContext.getPackageName());
}
}
| [
"peterdjlee@gmail.com"
] | peterdjlee@gmail.com |
3f4ec0cec172c91910de6dd4576a7c7d35f91e34 | 365dd8ebb72f54cedeed37272d4db23d139522f4 | /src/main/java/com/kentington/thaumichorizons/client/renderer/block/BlockJarTHRenderer.java | f69369e5cde73049d979b1cbd393afa0ec9031b9 | [] | no_license | Bogdan-G/ThaumicHorizons | c05b1fdeda0bdda6d427a39b74cac659661c4cbe | 83caf754f51091c6b7297c0c68fe8df309d7d7f9 | refs/heads/master | 2021-09-10T14:13:54.532269 | 2018-03-27T16:58:15 | 2018-03-27T16:58:15 | 122,425,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,435 | java | package com.kentington.thaumichorizons.client.renderer.block;
import com.kentington.thaumichorizons.common.ThaumicHorizons;
import com.kentington.thaumichorizons.common.blocks.BlockSoulJar;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import thaumcraft.client.renderers.block.BlockRenderer;
public class BlockJarTHRenderer extends BlockRenderer implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
IIcon i1 = ((BlockSoulJar)block).iconJarTop;
IIcon i2 = ((BlockSoulJar)block).iconJarSide;
block.setBlockBounds(W3, 0.0F, W3, W13, W12, W13);
renderer.setRenderBoundsFromBlock(block);
drawFaces(renderer, block, ((BlockSoulJar)block).iconJarBottom, i1, i2, i2, i2, i2, true);
block.setBlockBounds(W5, W12, W5, W11, W14, W11);
renderer.setRenderBoundsFromBlock(block);
drawFaces(renderer, block, ((BlockSoulJar)block).iconJarBottom, i1, i2, i2, i2, i2, true);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
setBrightness(world, x, y, z, block);
world.getBlockMetadata(x, y, z);
block.setBlockBounds(W3, 0.0F, W3, W13, W12, W13);
renderer.setRenderBoundsFromBlock(block);
renderer.renderStandardBlock(block, x, y, z);
block.setBlockBounds(W5, W12, W5, W11, W14, W11);
renderer.setRenderBoundsFromBlock(block);
renderer.renderStandardBlock(block, x, y, z);
renderer.clearOverrideBlockTexture();
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.setRenderBoundsFromBlock(block);
return true;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
public int getRenderId() {
return ThaumicHorizons.blockJarRI;
}
}
| [
"bogdangtt@gmail.com"
] | bogdangtt@gmail.com |
5a1a49ad7206ac21e0d89fbef1c52d9f8f9549a5 | 7d53c777706ad8b950f5c7c483a8430657d5288b | /DecoratorMode/src/cn/sx/xa/bqq/hqz/yjg/start/HouseBlend.java | 1512dfe6b7a786e0ded798d3235ac7c112950367 | [] | no_license | endloops/ceshi | 9d2181eadc793eafb7749b6908333a5778ee07be | 4618960b4817e114c9bbc9bd6f9c35ba834ec157 | refs/heads/master | 2021-05-01T04:08:58.141984 | 2019-04-24T02:18:52 | 2019-04-24T02:18:52 | 121,200,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package cn.sx.xa.bqq.hqz.yjg.start;
import java.math.BigDecimal;
public class HouseBlend extends Beverage{
public HouseBlend(String size) {
description = "House Blend Coffee";
this.size = size;
}
@Override
public BigDecimal coust() throws Exception {
// TODO Auto-generated method stub
return getSize().add(new BigDecimal("0.89"));
}
}
| [
"wangzhezhao@chinasofti.com"
] | wangzhezhao@chinasofti.com |
04a2b5bce096ab6ad1a15537eb06493955d15d11 | ddd4505533ce3e7e2c4c413a7fe8c16e97c01d30 | /lab3/src/main/java/view/backing/LineChartBean.java | 67c3cbeadc14d0ba2caff74c6ebac6867a94f563 | [] | no_license | grazik/TAKE | 884a7e8d4eadda46ae24080adf6e53ca56c64e70 | 8e71818951e935f5366f9e1e6d52202e276a5192 | refs/heads/master | 2023-05-11T22:54:38.132916 | 2020-05-31T18:30:02 | 2020-05-31T18:30:02 | 249,222,372 | 0 | 0 | null | 2023-05-09T03:27:30 | 2020-03-22T16:17:28 | C# | UTF-8 | Java | false | false | 1,459 | java | package main.java.view.backing;
import org.primefaces.model.chart.Axis;
import org.primefaces.model.chart.AxisType;
import org.primefaces.model.chart.LineChartModel;
import org.primefaces.model.chart.LineChartSeries;
import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import java.io.Serializable;
@Named("lineChartBean")
@ViewScoped
public class LineChartBean implements Serializable {
private LineChartModel lineModel;
@PostConstruct
public void init() {
lineModel = new LineChartModel();
LineChartSeries sin = new LineChartSeries();
LineChartSeries cos = new LineChartSeries();
sin.setLabel("Sin");
cos.setLabel("Cos");
for(int i = 0 ; i < 36 ; i++) {
sin.set(i * 10, Math.sin(Math.toRadians(i * 10)));
cos.set(i * 10, Math.cos(Math.toRadians(i * 10)));
}
lineModel.addSeries(sin);
lineModel.addSeries(cos);
lineModel.setLegendPosition("e");
Axis y = lineModel.getAxis(AxisType.Y);
y.setMin(-1);
y.setMax(1);
y.setLabel("Value");
Axis x = lineModel.getAxis(AxisType.X);
x.setMin(0);
x.setMax(360);
x.setTickInterval("10");
x.setLabel("Degrees");
lineModel.setTitle("Zoom for Details");
lineModel.setZoom(true);
}
public LineChartModel getLineModel() {
return lineModel;
}
} | [
"30260979+grazik@users.noreply.github.com"
] | 30260979+grazik@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.