blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
553f956d81ae2c4ccf5764cdea97c94288e561db | b9bd2b584202101c97109dc217e03cf3db16137d | /java_base/src/main/java/json/wnn/bean/T_MALL_ATTR.java | 4daf866e71741ade111ae5c7fac57b41154666e9 | [] | no_license | VincentJavaLufan/demo | a394eeb12708468868a49f2ba131415af3f58c37 | 1d85fdd302e6492fb548f6225a45d5b095abd4c1 | refs/heads/master | 2022-12-21T22:05:44.152956 | 2020-04-03T15:58:54 | 2020-04-03T15:58:54 | 207,910,485 | 1 | 0 | null | 2022-12-16T04:37:28 | 2019-09-11T21:31:50 | CSS | UTF-8 | Java | false | false | 870 | java | package json.wnn.bean;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class T_MALL_ATTR implements Serializable{
private int id;
private String shxm_mch;
private String shfqy;
private int flbh2;
private Date chjshj;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getShxm_mch() {
return shxm_mch;
}
public void setShxm_mch(String shxm_mch) {
this.shxm_mch = shxm_mch;
}
public String getShfqy() {
return shfqy;
}
public void setShfqy(String shfqy) {
this.shfqy = shfqy;
}
public int getFlbh2() {
return flbh2;
}
public void setFlbh2(int flbh2) {
this.flbh2 = flbh2;
}
public Date getChjshj() {
return chjshj;
}
public void setChjshj(Date chjshj) {
this.chjshj = chjshj;
}
}
| [
"13027193761@163.com"
] | 13027193761@163.com |
311b5c3415c4d95c2c2dd711edfe18b95f6848d4 | 2d89eaac234844f42dae92f2829b1d48729569b7 | /src/main/java/org/mapdb/ser/ByteSerializer.java | 9ff7b63642116ad0fa4eab3696a2e0d20ad2e6a6 | [
"Apache-2.0"
] | permissive | Mu-L/mapdb | 618da8cf24a4c6ec8c988ee7e3212c0eaa8059ce | 8721c0e824d8d546ecc76639c05ccbc618279511 | refs/heads/master | 2023-04-08T01:37:41.632503 | 2023-03-19T16:53:58 | 2023-03-19T16:53:58 | 270,608,441 | 0 | 0 | Apache-2.0 | 2023-03-20T01:53:10 | 2020-06-08T09:29:51 | Java | UTF-8 | Java | false | false | 790 | java | package org.mapdb.ser;
import org.jetbrains.annotations.Nullable;
import org.mapdb.io.DataInput2;
import org.mapdb.io.DataOutput2;
import java.io.IOException;
/**
* Created by jan on 2/28/16.
*/
public class ByteSerializer extends DefaultGroupSerializer<Byte> {
//TODO use byte[] group serializer
@Override
public void serialize(DataOutput2 out, Byte value) {
out.writeByte(value);
}
@Override
public Byte deserialize(DataInput2 in) {
return in.readByte();
}
@Nullable
@Override
public Class serializedType() {
return Byte.class;
}
//TODO value array operations
@Override
public int fixedSize() {
return 1;
}
@Override
public boolean isTrusted() {
return true;
}
}
| [
"jan@kotek.net"
] | jan@kotek.net |
789a345a0a0fab8e4cbbe085bd1326466afb7b7b | 9d3e069fc4ba109fbce80f9a02cd8f6bcce000aa | /app/src/main/java/com/example/jocke/projekt/FilterActivity.java | aaa25664e4324e0ca502dda2084deb7c42f1e6cf | [] | no_license | a17joaap/Projekt | 35a05a2c7edad440b97888bcc743b4dcaff5efa1 | 4a273b24f0584a5fc39c86550a8c729756d4997f | refs/heads/master | 2020-03-16T20:16:10.721887 | 2018-05-23T21:47:08 | 2018-05-23T21:47:08 | 132,952,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,685 | java | package com.example.jocke.projekt;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.ToggleButton;
public class FilterActivity extends AppCompatActivity {
private Button submitButton;
private RadioGroup typeRadioGroup;
private RadioGroup orientationRadioGroup;
private ToggleButton safesearchToggle;
private int checkedType;
private int checkedOrientation;
private Boolean safesearch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_filter);
Intent intent = getIntent();
typeRadioGroup = findViewById(R.id.typeGroup);
orientationRadioGroup = findViewById(R.id.orientationGroup);
safesearchToggle = findViewById(R.id.safesearchToggle);
submitButton = findViewById(R.id.button);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int checkedType = typeRadioGroup.getCheckedRadioButtonId();
int checkedOrientation = orientationRadioGroup.getCheckedRadioButtonId();
Boolean safesearch = safesearchToggle.isChecked();
MainActivity.changeFilter(checkedType, checkedOrientation, safesearch);
FilterActivity.super.onBackPressed();
}
});
}
@Override
protected void onSaveInstanceState(Bundle outState) {
checkedType = typeRadioGroup.getCheckedRadioButtonId();
outState.putInt("type", checkedType);
checkedOrientation = orientationRadioGroup.getCheckedRadioButtonId();
outState.putInt("orientation", checkedOrientation);
safesearch = safesearchToggle.isChecked();
outState.putBoolean("safesearch", safesearch);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
int type = savedInstanceState.getInt("type");
int orientation = savedInstanceState.getInt("orientation");
boolean safesearch = savedInstanceState.getBoolean("safesearch");
typeRadioGroup.check(type);
orientationRadioGroup.check(orientation);
if (safesearch) {
if (!safesearchToggle.isChecked()) {
safesearchToggle.toggle();
}
}
super.onRestoreInstanceState(savedInstanceState);
}
}
| [
"37792198+a17joaap@users.noreply.github.com"
] | 37792198+a17joaap@users.noreply.github.com |
378f0d6c97392cd30372199bb69d12e47c3445cf | 5bc9d8f92f38967cc9ecc03000c0606dbbb38f74 | /sca4j/modules/tags/sca4j-modules-parent-pom-0.1.3/kernel/api/sca4j-scdl/src/main/java/org/sca4j/scdl/validation/MissingResource.java | 595519bbb99e82566f856cb23c48fab18ebab31d | [] | no_license | codehaus/service-conduit | 795332fad474e12463db22c5e57ddd7cd6e2956e | 4687d4cfc16f7a863ced69ce9ca81c6db3adb6d2 | refs/heads/master | 2023-07-20T00:35:11.240347 | 2011-08-24T22:13:28 | 2011-08-24T22:13:28 | 36,342,601 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | /*
* SCA4J
* Copyright (c) 2008-2012 Service Symphony Limited
*
* This proprietary software may be used only in connection with the SCA4J license
* (the ?License?), a copy of which is included in the software or may be obtained
* at: http://www.servicesymphony.com/licenses/license.html.
*
* Software distributed under the License is distributed on an as is basis, without
* warranties or conditions of any kind. See the License for the specific language
* governing permissions and limitations of use of the software. This software is
* distributed in conjunction with other software licensed under different terms.
* See the separate licenses for those programs included in the distribution for the
* permitted and restricted uses of such software.
*
*/
package org.sca4j.scdl.validation;
import org.sca4j.host.contribution.ValidationFailure;
/**
* Denotes a missing resource such as a class file.
*
* @version $Revision$ $Date$
*/
public class MissingResource extends ValidationFailure<String> {
private String description;
public MissingResource(String description, String name) {
super(name);
this.description = description;
}
public String getMessage() {
return description + ": " + getValidatable();
}
}
| [
"meerajk@15bcc2b3-4398-4609-aa7c-97eea3cd106e"
] | meerajk@15bcc2b3-4398-4609-aa7c-97eea3cd106e |
6ebf71ba8920045544d7448b3ac216e57dab376f | 6e83255c8111e8647e0dd9bebfed8e718f7e88ce | /김차원/181002 2차합본/src/main/java/teamcoma/repository/mapper/ChefMapper.java | 42550e6a3adec423733b5547d43bb658140852ed | [] | no_license | kchaw1/git_teamcoma | 70946ee1f9f2c3b2fd99e86738cb2d2c522e47a0 | 7c0f46e2d03992bf41de190971adf0978b22cb59 | refs/heads/master | 2020-03-28T10:44:05.991370 | 2018-10-09T14:07:55 | 2018-10-09T14:07:55 | 148,139,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 70 | java | package teamcoma.repository.mapper;
public interface ChefMapper {
}
| [
"heatarin@gmail.com"
] | heatarin@gmail.com |
ac34031798c3c828b2d85f1138f6f0947d6e9d62 | 5c63dbb24c47c0ef3c194fac8c720e2253425013 | /src/main/java/com/example/flywayexample/controller/HelloController.java | e3c6476090ebcef275a8f3c97570d8cf755b8b7b | [] | no_license | muzyka-almu/flyway-example | fa8da21e786f9d1a8a987650b1faa5bdfe35f586 | e6e0147186900722ef75fc6bbdb9df61df024905 | refs/heads/master | 2021-04-26T22:41:09.058392 | 2018-03-06T20:00:59 | 2018-03-06T20:00:59 | 124,131,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.example.flywayexample.controller;
import com.example.flywayexample.model.Product;
import com.example.flywayexample.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String hello() {
return "Hello world)!";
}
}
| [
"muzyka_aleksandr.n@mail.ru"
] | muzyka_aleksandr.n@mail.ru |
ecf86e74ac866766eb2f1819ee96222d2dac3fcc | 79c2bcb18fa946b2ffac2ad0859e03997d590157 | /app/src/main/java/com/kinetic/sh/Effects/TileEffects/Tile83.java | cb6a9d84ac9eaccd4a81a48061ef991bba1028ab | [] | no_license | WafaaHarbJame/Intromaker | 353a9003c126a78961ae4115b0eda0d5d1d984fe | 575820149bf4f5a21ada971da99d0bd75a2f751b | refs/heads/master | 2023-06-13T01:59:13.428626 | 2021-06-27T18:53:10 | 2021-06-27T18:53:10 | 380,801,019 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.kinetic.sh.Effects.TileEffects;
import android.content.Context;
import android.graphics.Color;
import android.widget.LinearLayout;
import com.airbnb.lottie.LottieAnimationView;
import com.kinetic.sh.R;
public class Tile83 extends BaseTile {
private final LottieAnimationView animationView;
private final Context context;
private final LinearLayout linearLayout;
public Tile83(Context context2, LottieAnimationView lottieAnimationView, LinearLayout linearLayout2) {
super(context2, lottieAnimationView, linearLayout2);
this.context = context2;
this.animationView = lottieAnimationView;
this.linearLayout = linearLayout2;
}
public void init() {
init(R.raw.tile83);
addTextDelegateField("CREATIVE", "**");
addTextDelegateField("INSPIRATION", "**");
addTextDelegateField("YOU NEED", "**");
addTextDelegateField("100", "**");
addTextDelegateField("MODERN", "**");
addTextDelegateField("TITLES", "**");
addTextDelegateField("www.busyboxx.com", "**");
//changeFont("comforta_regular.ttf");
changePathColor(Color.parseColor("#327897"), "**");
_load();
}
}
| [
"wafaajame@gmail.com"
] | wafaajame@gmail.com |
972b75c59751562c7f65abf24e0100c63440acdf | b5a0058b012eb9e83a84c0c466d4da9de25daf71 | /labs/jdbc/start/src/main/java/no/arktekk/training/spring/repository/impl/SpringJdbcAuctionRepository.java | 155e3c293bb268004da3f4aa4a40784541bac8dd | [] | no_license | hansogj/spring-exercises | 5c7bc19bdd225ad9cbf0de036f273f76f2d8532f | 6ccef513830e9473cf987b369f5c615b90599959 | refs/heads/master | 2020-12-25T02:02:04.830960 | 2014-06-27T12:05:24 | 2014-06-27T12:05:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package no.arktekk.training.spring.repository.impl;
import no.arktekk.training.spring.domain.Auction;
import no.arktekk.training.spring.repository.AuctionRepository;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.PreparedStatementCreatorFactory;
import org.springframework.stereotype.Repository;
import javax.annotation.PreDestroy;
import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static no.arktekk.training.spring.util.DatabaseUtils.no_NO;
import static no.arktekk.training.spring.util.DatabaseUtils.timeStampFormatter;
/**
* Created by IntelliJ IDEA.
* User: ProgramUtvikling
* Date: 26.06.14
* Time: 08:58
* To change this template use File | Settings | File Templates.
*/
@Repository
@Qualifier("fasion")
public class SpringJdbcAuctionRepository implements AuctionRepository{
private JdbcTemplate jdbcTemplate;
@Autowired
public SpringJdbcAuctionRepository (DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
public List<Auction> listAllRunningAuctions() {
String sql = "select * from Auctions where ? between starts and expires";
return jdbcTemplate.query(sql, new AuctionRowMapper(),
timeStampFormatter.print(new DateTime().toDate(), no_NO));
}
@Override
public Auction findById(Double auctionId) {
String sql = "select * from Auctions where id = ?";
List<Auction> auctions = jdbcTemplate.query(sql, new AuctionRowMapper(), auctionId);
if(! auctions.isEmpty()) {
return auctions.get(0);
} else return null;
}
@Override
public List<Auction> getAuctions(Map parameters) {
String sql = "select * from Auctions where mimimumPrice > :mimimumPrice and description like :description";
return jdbcTemplate.query(sql, new AuctionRowMapper(), parameters);
}
}
| [
"hansogj@gmail.com"
] | hansogj@gmail.com |
bc53af31d30de082a8d457d143af758e698af1a6 | 120689961c79aefd6d36d3d228f472e3480c26d2 | /SimpleCar/CarBuilder.java | d50dc9a83631cb3cd7c7ef48201eb1f1026a398b | [] | no_license | SupeDeDupe/Builder-Pattern-Example | acf6ac57fbb063fb72cc2b34d42ead23f7ac96dc | 5dae48503af79394768ae35b169c4fc597574918 | refs/heads/master | 2021-04-15T13:29:58.466848 | 2018-03-26T15:09:48 | 2018-03-26T15:09:48 | 126,487,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java |
public class CarBuilder
{
String wheels;
String engine;
String seats;
String doors;
public CarBuilder()
{
}
public Car build()
{
if (wheels == null)
throw new IllegalStateException("No wheels!");
if (engine == null)
throw new IllegalStateException("No engine!");
if (seats == null)
throw new IllegalStateException("No seats!");
if (doors == null)
throw new IllegalStateException("No doors!");
return new Car(this);
}
public CarBuilder addWheels(String wheels)
{
this.wheels = wheels;
return this;
}
public CarBuilder addEngine(String engine)
{
this.engine = engine;
return this;
}
public CarBuilder addSeats(String seats)
{
this.seats = seats;
return this;
}
public CarBuilder addDoors(String doors)
{
this.doors = doors;
return this;
}
}
| [
"sethompson@upei.ca"
] | sethompson@upei.ca |
6699701e173c1b32db4d4b0b0141d3988e2a09f4 | e06eb57fbc5c2057010f2cdf82c7917a8a7bc50c | /OnLineStudy6/src/com/sist/json/MovieVO.java | aac447dc0f3e35c946a0ad09e7e6f73146b67514 | [] | no_license | Heejineee/OnLineStudy | e70ba4becda64ea584606bb5270b78c06c2f1c2f | 9ea2f41038746576a9a7e9c274b0ea79a7053b56 | refs/heads/master | 2022-12-28T02:54:36.221931 | 2020-10-16T09:06:45 | 2020-10-16T09:06:45 | 304,570,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,566 | java | package com.sist.json;
public class MovieVO {
private String movieCd; // 영화번호
private String thumbUrl; // 포스터
private String movieNm; // 한글 제목
private String movieNmEn; // 영문 제목
private String synop; // 스토리
private String director; // 감독
private String genre; // 장르
private String watchGradeNm; // 등급
private long rank; // 순위
public String getMovieCd() {
return movieCd;
}
public void setMovieCd(String movieCd) {
this.movieCd = movieCd;
}
public String getThumbUrl() {
return thumbUrl;
}
public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
}
public String getMovieNm() {
return movieNm;
}
public void setMovieNm(String movieNm) {
this.movieNm = movieNm;
}
public String getMovieNmEn() {
return movieNmEn;
}
public void setMovieNmEn(String movieNmEn) {
this.movieNmEn = movieNmEn;
}
public String getSynop() {
return synop;
}
public void setSynop(String synop) {
this.synop = synop;
}
public String getDirector() {
return director;
}
public void setDirector(String director) {
this.director = director;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public String getWatchGradeNm() {
return watchGradeNm;
}
public void setWatchGradeNm(String watchGradeNm) {
this.watchGradeNm = watchGradeNm;
}
public long getRank() {
return rank;
}
public void setRank(long rank) {
this.rank = rank;
}
}
| [
"user@DESKTOP-71GHNF9"
] | user@DESKTOP-71GHNF9 |
edef74506b925bb583dfc92d7727674134d2b116 | a42e4e19bc3947cc588f824585c0ae6e207820ee | /src/main/java/com/guo/sps/enums/PlatformType.java | 0fe287a8281ad872a91cdb468c807d34e1f66542 | [] | no_license | wayhe-huangluojun/PayMap | 839459243435536a6590c8748ab1d9037e7ca9a8 | 9a5fabc204dffad4b50a5a873363bed0c6960cfb | refs/heads/master | 2021-04-26T11:47:30.912252 | 2018-03-03T12:27:35 | 2018-03-03T12:27:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,296 | java | package com.guo.sps.enums;
/**
* Created by guo on 3/2/2018.
*/
public enum PlatformType {
DD("DD", "当当"),
TB("TB", "淘宝"),
JD("JD", "京东"),
ICBC("ICBC", "工行"),
UNIONPAY("UNIONPAY", "银联支付"),
CEB("CEB", "光大银行"),
PSBC("PSBC", "邮政储蓄"),
CCB("CCB", "建行"),
HZBSQ("HZBSQ", "杭州保税区"),
NBBSQ("NBBSQ", "宁波保税区"),
WECHAT("WECHAT", "微信支付"),
YHD("YHD", "一号店");
private String value;
private String desc;
PlatformType(String value, String desc) {
this.value = value;
this.desc = desc;
}
public static PlatformType getPlatform(Integer value) {
if (1 == value || 2 == value || 6 == value) {
return PlatformType.TB;
} else if (3 == value || 4 == value || 5 == value) {
return PlatformType.UNIONPAY;
} else if (7 == value || 8 == value) {
return PlatformType.PSBC;
} else if (9 == value || 10 == value || 12 == value) {
return PlatformType.CEB;
} else if (11 == value) {
return PlatformType.WECHAT;
}
return null;
}
public String value() {
return value;
}
public String desc() {
return desc;
}
}
| [
"gxx632364@gmail.com"
] | gxx632364@gmail.com |
e290655eb4fe6bb34a253fd3739c273168816436 | 88f904aa7275a0b5f7ff7ce48684265867b92894 | /mobile/src/main/java/com/nnightknights/sharedlists/list_creation/event_handlers/ImageChooserDialogOpenerClickEventHandler.java | 743b248ee417dd7459ae2ff9f1c9b7f11c7c5ada | [] | no_license | NoiKioN/SharedLists | 2b1a4dfbb0d441d596590f45d0e5f42729c3c526 | 2b581714dabfea856f77eacf2e3770a1b7cee951 | refs/heads/master | 2021-04-28T15:51:35.520448 | 2018-06-20T11:18:16 | 2018-06-20T11:18:16 | 121,999,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,114 | java | package com.nnightknights.sharedlists.list_creation.event_handlers;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.ImageView;
import com.nnightknights.sharedlists.list_creation.click_listeners.ImageChooserDialog;
import com.nnightknights.sharedlists.list_creation.click_listeners.ImageChooserDialogOpener;
public class ImageChooserDialogOpenerClickEventHandler implements ImageChooserDialogOpener.ClickEventHandler {
private ImageView coverImageView, iconImageView;
private Fragment createListFragment;
public ImageChooserDialogOpenerClickEventHandler(ImageView coverImageView, ImageView iconImageView, Fragment createListFragment) {
this.coverImageView = coverImageView;
this.iconImageView = iconImageView;
this.createListFragment = createListFragment;
}
@Override
public void openCoverImageChooserDialog() {
ImageChooserDialog coverImageChooserDialog = new ImageChooserDialog();
Bundle coverArgs = new Bundle();
coverArgs.putString(ImageChooserDialog.ArgumentNames.ImageType.name(), ImageChooserDialog.ImageType.COVER.name());
coverImageChooserDialog.setArguments(coverArgs);
coverImageChooserDialog.setImageChooserEventHandler(new ImageChooserDialogClickEventHandler(coverImageView, iconImageView, coverImageView, createListFragment));
coverImageChooserDialog.show(createListFragment.getFragmentManager(), "cover_chooser_dialog");
}
@Override
public void openIconImageChooserDialog() {
ImageChooserDialog iconImageChooserDialog = new ImageChooserDialog();
Bundle iconArgs = new Bundle();
iconArgs.putString(ImageChooserDialog.ArgumentNames.ImageType.name(), ImageChooserDialog.ImageType.ICON.name());
iconImageChooserDialog.setArguments(iconArgs);
iconImageChooserDialog.setImageChooserEventHandler(new ImageChooserDialogClickEventHandler(iconImageView, iconImageView, coverImageView, createListFragment));
iconImageChooserDialog.show(createListFragment.getFragmentManager(), "icon_chooser_dialog");
}
}
| [
"nnightknight@gmail.com"
] | nnightknight@gmail.com |
a7298a6be21ab19ab1a2dff837eec150386407e0 | 84f9dcebe765255d5ee8da27209d16a21dc26491 | /blogs-server/src/main/java/org/johnny/blogsserver/utils/QiniuAccessUtils.java | 50bfc4dd77bbc19bf0f427ba6c680cd7de0e8bcd | [] | no_license | AskaJohnny/blogs-admin | 4a1f6312e9ef0b0c8597328df27507a17b7bac80 | 6c494a120a10ef1d936b46de9c5200bc7d022d54 | refs/heads/master | 2023-07-20T06:58:46.424892 | 2021-08-24T07:37:12 | 2021-08-24T07:37:12 | 294,566,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,384 | java | package org.johnny.blogsserver.utils;
import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
/**
* 七牛云 访问工具
*
* @author johnny
* @create 2019-12-03 下午2:17
**/
public class QiniuAccessUtils {
/**
* 七牛AK
*/
public static final String accessKey = "e1C2jGSQsaTBNGr7RhnXEMbueJ-hfkX2uhTPKdq7";
/**
* 七牛SK
*/
public static final String secretKey = "23pb5PmhN9j4KDvAsBkS7nQ-is-TLIQ4QFZDrb0z";
/**
* 七牛存储空间名
*/
public static final String bucket = "johnny-blogs";
/**
* 七牛默认域名 -> 切换为了 正式域名 http://cdn.askajohnny.com/
*/
public static final String domain = "http://cdn.askajohnny.com/";
//设置好账号的ACCESS_KEY和SECRET_KEY
private static String ACCESS_KEY = accessKey;
private static String SECRET_KEY = secretKey;
//要上传的空间 //对应要上传到七牛上 你的那个路径(自己建文件夹 注意设置公开)
private static String bucketname = bucket;
//密钥配置
private static Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
private static Configuration cfg = new Configuration(Zone.huanan());
//创建上传对象
private static UploadManager uploadManager = new UploadManager(cfg);
//简单上传,使用默认策略,只需要设置上传的空间名就可以了
public static String getUpToken() {
return auth.uploadToken(bucketname);
}
public static String UploadPic(String FilePath, String FileName) {
Configuration cfg = new Configuration(Zone.huanan());
UploadManager uploadManager = new UploadManager(cfg);
//AccessKey的值
String accessKey = ACCESS_KEY;
//SecretKey的值
String secretKey = SECRET_KEY;
//存储空间名
String bucket = bucketname;
Auth auth = Auth.create(accessKey, secretKey);
String upToken = auth.uploadToken(bucket);
try {
Response response = uploadManager.put(FilePath, FileName, upToken);
//解析上传成功的结果
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
System.out.println(putRet.key);
System.out.println(putRet.hash);
return domain + FileName;
} catch (QiniuException ex) {
Response r = ex.response;
System.err.println(r.toString());
try {
System.err.println(r.bodyString());
} catch (QiniuException ex2) {
//ignore
}
}
return null;
}
public static String updateFile(MultipartFile file, String filename) throws Exception {
//默认不指定key的情况下,以文件内容的hash值作为文件名
try {
InputStream inputStream = file.getInputStream();
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[600]; //buff用于存放循环读取的临时数据
int rc = 0;
while ((rc = inputStream.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] uploadBytes = swapStream.toByteArray();
try {
Response response = uploadManager.put(uploadBytes, filename, getUpToken());
//解析上传成功的结果
DefaultPutRet putRet;
putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
return domain + putRet.key;
} catch (QiniuException ex) {
Response r = ex.response;
System.err.println(r.toString());
try {
System.err.println(r.bodyString());
} catch (QiniuException ex2) {
}
}
} catch (UnsupportedEncodingException ex) {
}
return null;
}
} | [
"626142589@qq.com"
] | 626142589@qq.com |
ac89764d0a1b428aaf32d62f1c2638caa917347d | 555b52c2787ca6022553d43a1094bcd5acd1d63d | /sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/implementation/WebAppDiagnosticLogsImpl.java | 34518cb3d0a637e4205eca8929e6f4f94cfdeca8 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | openapi-env-ppe/azure-sdk-for-java | c1abfe15e61bdb857dfb8c0821ea86ea2b297c6a | a4f6f4da8187c22db021421b331fe3bba019880f | refs/heads/master | 2020-09-12T10:05:08.376052 | 2020-06-08T07:44:30 | 2020-06-08T07:44:30 | 222,384,930 | 0 | 0 | MIT | 2019-11-18T07:09:37 | 2019-11-18T07:09:36 | null | UTF-8 | Java | false | false | 11,402 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.resourcemanager.appservice.implementation;
import com.azure.resourcemanager.appservice.ApplicationLogsConfig;
import com.azure.resourcemanager.appservice.AzureBlobStorageApplicationLogsConfig;
import com.azure.resourcemanager.appservice.AzureBlobStorageHttpLogsConfig;
import com.azure.resourcemanager.appservice.EnabledConfig;
import com.azure.resourcemanager.appservice.FileSystemApplicationLogsConfig;
import com.azure.resourcemanager.appservice.FileSystemHttpLogsConfig;
import com.azure.resourcemanager.appservice.HttpLogsConfig;
import com.azure.resourcemanager.appservice.LogLevel;
import com.azure.resourcemanager.appservice.WebAppBase;
import com.azure.resourcemanager.appservice.WebAppDiagnosticLogs;
import com.azure.resourcemanager.appservice.models.SiteLogsConfigInner;
import com.azure.resourcemanager.resources.fluentcore.model.implementation.IndexableWrapperImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.Utils;
/**
* Implementation for WebAppDiagnosticLogs and its create and update interfaces.
*
* @param <FluentT> the fluent interface of the parent web app
* @param <FluentImplT> the fluent implementation of the parent web app
*/
class WebAppDiagnosticLogsImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>>
extends IndexableWrapperImpl<SiteLogsConfigInner>
implements WebAppDiagnosticLogs,
WebAppDiagnosticLogs.Definition<WebAppBase.DefinitionStages.WithCreate<FluentT>>,
WebAppDiagnosticLogs.UpdateDefinition<WebAppBase.Update<FluentT>> {
private final WebAppBaseImpl<FluentT, FluentImplT> parent;
private LogLevel applicationLogLevel = null;
WebAppDiagnosticLogsImpl(SiteLogsConfigInner inner, WebAppBaseImpl<FluentT, FluentImplT> parent) {
super(inner);
if (inner.applicationLogs() != null) {
inner.applicationLogs().withAzureTableStorage(null);
}
this.parent = parent;
}
@Override
public LogLevel applicationLoggingFileSystemLogLevel() {
if (inner().applicationLogs() == null
|| inner().applicationLogs().fileSystem() == null
|| inner().applicationLogs().fileSystem().level() == null) {
return LogLevel.OFF;
} else {
return inner().applicationLogs().fileSystem().level();
}
}
@Override
public String applicationLoggingStorageBlobContainer() {
if (inner().applicationLogs() == null || inner().applicationLogs().azureBlobStorage() == null) {
return null;
} else {
return inner().applicationLogs().azureBlobStorage().sasUrl();
}
}
@Override
public LogLevel applicationLoggingStorageBlobLogLevel() {
if (inner().applicationLogs() == null
|| inner().applicationLogs().azureBlobStorage() == null
|| inner().applicationLogs().azureBlobStorage().level() == null) {
return LogLevel.OFF;
} else {
return inner().applicationLogs().azureBlobStorage().level();
}
}
@Override
public int applicationLoggingStorageBlobRetentionDays() {
if (inner().applicationLogs() == null || inner().applicationLogs().azureBlobStorage() == null) {
return 0;
} else {
return Utils.toPrimitiveInt(inner().applicationLogs().azureBlobStorage().retentionInDays());
}
}
@Override
public int webServerLoggingFileSystemQuotaInMB() {
if (inner().httpLogs() == null || inner().httpLogs().fileSystem() == null) {
return 0;
} else {
return Utils.toPrimitiveInt(inner().httpLogs().fileSystem().retentionInMb());
}
}
@Override
public int webServerLoggingFileSystemRetentionDays() {
if (inner().httpLogs() == null || inner().httpLogs().fileSystem() == null) {
return 0;
} else {
return Utils.toPrimitiveInt(inner().httpLogs().fileSystem().retentionInDays());
}
}
@Override
public int webServerLoggingStorageBlobRetentionDays() {
if (inner().httpLogs() == null || inner().httpLogs().azureBlobStorage() == null) {
return 0;
} else {
return Utils.toPrimitiveInt(inner().httpLogs().azureBlobStorage().retentionInDays());
}
}
@Override
public String webServerLoggingStorageBlobContainer() {
if (inner().httpLogs() == null || inner().httpLogs().azureBlobStorage() == null) {
return null;
} else {
return inner().httpLogs().azureBlobStorage().sasUrl();
}
}
@Override
public boolean failedRequestsTracing() {
return inner().failedRequestsTracing() != null
&& Utils.toPrimitiveBoolean(inner().failedRequestsTracing().enabled());
}
@Override
public boolean detailedErrorMessages() {
return inner().detailedErrorMessages() != null
&& Utils.toPrimitiveBoolean(inner().detailedErrorMessages().enabled());
}
@Override
public FluentImplT attach() {
parent.withDiagnosticLogs(this);
return parent();
}
@Override
@SuppressWarnings("unchecked")
public FluentImplT parent() {
parent.withDiagnosticLogs(this);
return (FluentImplT) this.parent;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withApplicationLogging() {
inner().withApplicationLogs(new ApplicationLogsConfig());
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withoutApplicationLogging() {
withoutApplicationLogsStoredOnFileSystem();
withoutApplicationLogsStoredOnStorageBlob();
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withWebServerLogging() {
inner().withHttpLogs(new HttpLogsConfig());
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withoutWebServerLogging() {
withoutWebServerLogsStoredOnFileSystem();
withoutWebServerLogsStoredOnStorageBlob();
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withDetailedErrorMessages(boolean enabled) {
inner().withDetailedErrorMessages(new EnabledConfig().withEnabled(enabled));
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withFailedRequestTracing(boolean enabled) {
inner().withFailedRequestsTracing(new EnabledConfig().withEnabled(enabled));
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withApplicationLogsStoredOnFileSystem() {
if (inner().applicationLogs() != null) {
inner()
.applicationLogs()
.withFileSystem(new FileSystemApplicationLogsConfig().withLevel(applicationLogLevel));
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withApplicationLogsStoredOnStorageBlob(
String containerSasUrl) {
if (inner().applicationLogs() != null) {
inner()
.applicationLogs()
.withAzureBlobStorage(
new AzureBlobStorageApplicationLogsConfig()
.withLevel(applicationLogLevel)
.withSasUrl(containerSasUrl));
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withWebServerLogsStoredOnFileSystem() {
if (inner().httpLogs() != null) {
inner().httpLogs().withFileSystem(new FileSystemHttpLogsConfig().withEnabled(true));
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withWebServerLogsStoredOnStorageBlob(String containerSasUrl) {
if (inner().httpLogs() != null) {
inner()
.httpLogs()
.withAzureBlobStorage(
new AzureBlobStorageHttpLogsConfig().withEnabled(true).withSasUrl(containerSasUrl));
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withoutWebServerLogsStoredOnFileSystem() {
if (inner().httpLogs() != null && inner().httpLogs().fileSystem() != null) {
inner().httpLogs().fileSystem().withEnabled(false);
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withoutWebServerLogsStoredOnStorageBlob() {
if (inner().httpLogs() != null && inner().httpLogs().azureBlobStorage() != null) {
inner().httpLogs().azureBlobStorage().withEnabled(false);
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withLogLevel(LogLevel logLevel) {
this.applicationLogLevel = logLevel;
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withWebServerFileSystemQuotaInMB(int quotaInMB) {
if (inner().httpLogs() != null
&& inner().httpLogs().fileSystem() != null
&& inner().httpLogs().fileSystem().enabled()) {
inner().httpLogs().fileSystem().withRetentionInMb(quotaInMB);
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withLogRetentionDays(int retentionDays) {
if (inner().httpLogs() != null
&& inner().httpLogs().fileSystem() != null
&& inner().httpLogs().fileSystem().enabled()) {
inner().httpLogs().fileSystem().withRetentionInDays(retentionDays);
}
if (inner().httpLogs() != null
&& inner().httpLogs().azureBlobStorage() != null
&& inner().httpLogs().azureBlobStorage().enabled()) {
inner().httpLogs().azureBlobStorage().withRetentionInDays(retentionDays);
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withUnlimitedLogRetentionDays() {
if (inner().httpLogs() != null
&& inner().httpLogs().fileSystem() != null
&& inner().httpLogs().fileSystem().enabled()) {
inner().httpLogs().fileSystem().withRetentionInDays(0);
}
if (inner().httpLogs() != null
&& inner().httpLogs().azureBlobStorage() != null
&& inner().httpLogs().fileSystem().enabled()) {
inner().httpLogs().azureBlobStorage().withRetentionInDays(0);
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withoutApplicationLogsStoredOnFileSystem() {
if (inner().applicationLogs() != null && inner().applicationLogs().fileSystem() != null) {
inner().applicationLogs().fileSystem().withLevel(LogLevel.OFF);
}
return this;
}
@Override
public WebAppDiagnosticLogsImpl<FluentT, FluentImplT> withoutApplicationLogsStoredOnStorageBlob() {
if (inner().applicationLogs() != null && inner().applicationLogs().azureBlobStorage() != null) {
inner().applicationLogs().azureBlobStorage().withLevel(LogLevel.OFF);
}
return this;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
aef44bd386f73b1579dba04b8c64b01bd1677a98 | 93562ee42eb0bf967a472a2694000b2604a94475 | /src/main/java/minecraftschurli/mcstech/datagen/MCSTechRecipeProvider.java | 5bb9198e0786132c70c770c6e3e1bc026c81ed5d | [
"MIT"
] | permissive | Minecraftschurli/MCSTech | e333a932b9607a67b9c478aa7e4888eebf252292 | b45506ed731c24951fcdbc38518be0a91e7d2995 | refs/heads/master | 2020-08-24T18:53:18.838891 | 2019-10-25T16:35:21 | 2019-10-25T16:35:21 | 216,885,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,036 | java | package minecraftschurli.mcstech.datagen;
import minecraftschurli.mcslib.data.RecipeHelper;
import minecraftschurli.mcslib.data.TagHelper;
import minecraftschurli.mcstech.MCSTech;
import minecraftschurli.mcstech.init.Materials;
import net.minecraft.data.*;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import javax.annotation.Nonnull;
import java.util.function.Consumer;
/**
* @author Minecraftschurli
* @version 2019-10-22
*/
public class MCSTechRecipeProvider extends RecipeProvider {
public MCSTechRecipeProvider(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
Materials.STEEL.registerRecipes(consumer, MCSTech.MODID);
RecipeHelper.addSmeltingRecipe(Items.GOLD_INGOT, TagHelper.getTag(TagHelper.TagType.DUST, "gold"), 0)
.build(consumer, new ResourceLocation(MCSTech.MODID, "gold_ingot_from_gold_dust_smelt"));
RecipeHelper.addBlastingRecipe(Items.GOLD_INGOT, TagHelper.getTag(TagHelper.TagType.DUST, "gold"), 0)
.build(consumer, new ResourceLocation(MCSTech.MODID, "gold_ingot_from_gold_dust_blast"));
RecipeHelper.addSmeltingRecipe(Items.IRON_INGOT, TagHelper.getTag(TagHelper.TagType.DUST, "iron"), 0)
.build(consumer, new ResourceLocation(MCSTech.MODID, "iron_ingot_from_iron_dust_smelt"));
RecipeHelper.addBlastingRecipe(Items.IRON_INGOT, TagHelper.getTag(TagHelper.TagType.DUST, "iron"), 0)
.build(consumer, new ResourceLocation(MCSTech.MODID, "iron_ingot_from_iron_dust_blast"));
RecipeHelper.addBlastingRecipe(Materials.STEEL.get("ingot"), Tags.Items.INGOTS_IRON, 0f, 1600)
.build(consumer, new ResourceLocation(MCSTech.MODID, "steel_ingot_from_iron_ingot"));
}
@Override
@Nonnull
public String getName() {
return "MCSTech Recipes";
}
}
| [
"minecraftschurli@gmail.com"
] | minecraftschurli@gmail.com |
f2f2bbf4fb3a9feab245585eac694360a979faf3 | eccd5656c9fbd5a134734d3e7b1df08e618376db | /ArtemisCore/src/main/java/com/fnix/artemis/core/repository/SystemTaskDao.java | c0867ebbb2828e0824c2a1b97abe63a2186ec614 | [] | no_license | Fnix0508/Artemis | 9d788ed54399cc988f8c1dba094231c2b8b69994 | 9753e3a26791066032dad48f22a76801f3b3ea4a | refs/heads/master | 2020-03-23T17:49:19.076456 | 2018-08-18T05:42:52 | 2018-08-18T05:42:52 | 141,876,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package com.fnix.artemis.core.repository;
import java.time.LocalDateTime;
import java.util.List;
import javax.persistence.LockModeType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.transaction.annotation.Transactional;
import com.fnix.artemis.core.dto.SystemTaskType;
import com.fnix.artemis.core.dto.TaskStatus;
import com.fnix.artemis.core.model.SystemTask;
public interface SystemTaskDao extends JpaRepository<SystemTask, Long> {
List<SystemTask> findTop10ByStatusAndRunAtBeforeOrderByRunAt(TaskStatus status, LocalDateTime runAt);
@Transactional
@Lock(value = LockModeType.PESSIMISTIC_WRITE)
SystemTask findAndLockById(long id);
@Transactional
@Lock(value = LockModeType.PESSIMISTIC_WRITE)
SystemTask findAndLockByTypeAndTargetId(SystemTaskType type, long id);
}
| [
"feng.chengxiang@darcytech.com"
] | feng.chengxiang@darcytech.com |
a07bb21f09fb81abf35d11e0f9500d1567c835ee | ca78a23d60d1b571c541c026fd1d0e10d2b5ee05 | /src/by/academy/worker/entities/Worker.java | 22377fe7ad90067e5eaf0445d1e18abfb05367bc | [] | no_license | DmitryBobkov/MyWebProject_Workers | ad7469fefc724dc6a0ecd161d917f7d7e2bdc4c2 | 9f6d59c76e1a0663bacfde7fdba0d488b7e40722 | refs/heads/master | 2020-06-03T11:00:55.380287 | 2019-06-12T09:50:29 | 2019-06-12T09:50:29 | 191,543,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,219 | java | package by.academy.worker.entities;
/**
* Class Worker describes the entity worker
*
*/
public class Worker implements Cloneable {
private int id;
private String type;
private String name;
private Address address;
private final static double INDEX = 1.1;
private static int pension = 500;
public Worker(int id, String type, String name, Address address) {
this.id = id;
this.type = type;
this.name = name;
this.address = address;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public static double getPension() {
return pension;
}
public static void setPension(int pension) {
Worker.pension = pension;
}
@Override
public String toString() {
return "Worker [id= " + id + ", name= " + name + ", address= " + address.getCity() + ", " + address.getCountry()
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Worker other = (Worker) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (id != other.id)
return false;
return true;
}
public Worker clone() throws CloneNotSupportedException {
Worker workerClone = (Worker) super.clone();
workerClone.address = this.address.clone();
return workerClone;
}
public double pension() {
return pension * INDEX;
}
}
| [
"1234_qwer@tut.by"
] | 1234_qwer@tut.by |
1d490ff86d4cdca93097fa03a98cc31b9e88175f | 8995dd69feb4f26c35503878166baabf7704e877 | /JavaCouches/src/calculatrice/ihm/Exec.java | fe7d22cd14583de2abe0035e6df0435d0c737c18 | [] | no_license | teobryer/ENI-JavaCouches | b6297c5b284d7cdae2d1f07a4599bba87da6a0ef | 1fea63d639b38a724705001d815d11eb88521aff | refs/heads/master | 2023-03-05T09:50:56.007317 | 2021-02-17T13:21:08 | 2021-02-17T13:21:08 | 337,021,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package calculatrice.ihm;
import calculatrice.bll.CalculManagerFact;
import calculatrice.bll.CalculatriceManager;
public class Exec {
public static void main(String[] args) {
CalculatriceManager calculatrice = CalculManagerFact.getInstance();
System.out.println(calculatrice.plus(2, 3));
}
}
| [
"teocalme@gmail.com"
] | teocalme@gmail.com |
66dd53c29e96311fcdf7cd3616e9a70482f77056 | 83062838f3c0003f8f4c0339f283dd52a5c707ff | /malls/PYG-MALL/pinyougou-parent/pinyougou-order-service/src/main/java/com/pinyougou/order/service/impl/OrderServiceImpl.java | 440d34c2485c3c8b7f35f1584b6024901cabce64 | [
"MIT"
] | permissive | zhaoq0103/zhaoq0103.github.io | b337a0919310823f5c2e58a39eb47b3fd50176f1 | d1247b05ccc379891710971a6e0ce962e7de6971 | refs/heads/master | 2023-06-09T01:07:31.911726 | 2023-05-27T09:11:12 | 2023-05-27T09:11:12 | 143,267,165 | 0 | 0 | MIT | 2022-12-16T07:18:42 | 2018-08-02T08:42:57 | JavaScript | UTF-8 | Java | false | false | 8,229 | java | package com.pinyougou.order.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.pinyougou.mapper.TbOrderItemMapper;
import com.pinyougou.mapper.TbOrderMapper;
import com.pinyougou.mapper.TbPayLogMapper;
import com.pinyougou.pojo.TbOrder;
import com.pinyougou.pojo.TbOrderExample;
import com.pinyougou.pojo.TbOrderExample.Criteria;
import com.pinyougou.pojo.TbOrderItem;
import com.pinyougou.pojo.TbPayLog;
import com.pinyougou.pojo.group.Cart;
import com.pinyougou.order.service.OrderService;
import entity.PageResult;
import util.IdWorker;
/**
* 服务实现层
* @author Administrator
*
*/
@Service
@Transactional
public class OrderServiceImpl implements OrderService {
@Autowired
private TbOrderMapper orderMapper;
@Autowired
private TbPayLogMapper payLogMapper;
/**
* 查询全部
*/
@Override
public List<TbOrder> findAll() {
return orderMapper.selectByExample(null);
}
/**
* 按分页查询
*/
@Override
public PageResult findPage(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
Page<TbOrder> page= (Page<TbOrder>) orderMapper.selectByExample(null);
return new PageResult(page.getTotal(), page.getResult());
}
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private IdWorker idWorker;
@Autowired
private TbOrderItemMapper orderItemMapper;
/**
* 增加
*/
@Override
public void add(TbOrder order) {
//1.从redis中提取购物车列表
List<Cart> cartList= (List<Cart>) redisTemplate.boundHashOps("cartList").get(order.getUserId());
List<String> orderIdList=new ArrayList();//订单ID集合
double total_money=0;//总金额
//2.循环购物车列表添加订单
for(Cart cart:cartList){
TbOrder tbOrder=new TbOrder();
long orderId = idWorker.nextId(); //获取ID
tbOrder.setOrderId(orderId);
tbOrder.setPaymentType(order.getPaymentType());//支付类型
tbOrder.setStatus("1");//未付款
tbOrder.setCreateTime(new Date());//下单时间
tbOrder.setUpdateTime(new Date());//更新时间
tbOrder.setUserId(order.getUserId());//当前用户
tbOrder.setReceiverAreaName(order.getReceiverAreaName());//收货人地址
tbOrder.setReceiverMobile(order.getReceiverMobile());//收货人电话
tbOrder.setReceiver(order.getReceiver());//收货人
tbOrder.setSourceType(order.getSourceType());//订单来源
tbOrder.setSellerId(order.getSellerId());//商家ID
double money=0;//合计数
//循环购物车中每条明细记录
for(TbOrderItem orderItem:cart.getOrderItemList() ){
orderItem.setId(idWorker.nextId());//主键
orderItem.setOrderId(orderId);//订单编号
orderItem.setSellerId(cart.getSellerId());//商家ID
orderItemMapper.insert(orderItem);
money+=orderItem.getTotalFee().doubleValue();
}
tbOrder.setPayment(new BigDecimal(money));//合计
orderMapper.insert(tbOrder);
orderIdList.add(orderId+"");
total_money+=money;
}
//添加支付日志
if("1".equals(order.getPaymentType())){
TbPayLog payLog=new TbPayLog();
payLog.setOutTradeNo(idWorker.nextId()+"");//支付订单号
payLog.setCreateTime(new Date());
payLog.setUserId(order.getUserId());//用户ID
payLog.setOrderList(orderIdList.toString().replace("[", "").replace("]", ""));//订单ID串
payLog.setTotalFee( (long)( total_money*100) );//金额(分)
payLog.setTradeState("0");//交易状态
payLog.setPayType("1");//微信
payLogMapper.insert(payLog);
redisTemplate.boundHashOps("payLog").put(order.getUserId(), payLog);//放入缓存
}
//3.清除redis中的购物车
redisTemplate.boundHashOps("cartList").delete(order.getUserId());
}
/**
* 修改
*/
@Override
public void update(TbOrder order){
orderMapper.updateByPrimaryKey(order);
}
/**
* 根据ID获取实体
* @param id
* @return
*/
@Override
public TbOrder findOne(Long id){
return orderMapper.selectByPrimaryKey(id);
}
/**
* 批量删除
*/
@Override
public void delete(Long[] ids) {
for(Long id:ids){
orderMapper.deleteByPrimaryKey(id);
}
}
@Override
public PageResult findPage(TbOrder order, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
TbOrderExample example=new TbOrderExample();
Criteria criteria = example.createCriteria();
if(order!=null){
if(order.getPaymentType()!=null && order.getPaymentType().length()>0){
criteria.andPaymentTypeLike("%"+order.getPaymentType()+"%");
}
if(order.getPostFee()!=null && order.getPostFee().length()>0){
criteria.andPostFeeLike("%"+order.getPostFee()+"%");
}
if(order.getStatus()!=null && order.getStatus().length()>0){
criteria.andStatusLike("%"+order.getStatus()+"%");
}
if(order.getShippingName()!=null && order.getShippingName().length()>0){
criteria.andShippingNameLike("%"+order.getShippingName()+"%");
}
if(order.getShippingCode()!=null && order.getShippingCode().length()>0){
criteria.andShippingCodeLike("%"+order.getShippingCode()+"%");
}
if(order.getUserId()!=null && order.getUserId().length()>0){
criteria.andUserIdLike("%"+order.getUserId()+"%");
}
if(order.getBuyerMessage()!=null && order.getBuyerMessage().length()>0){
criteria.andBuyerMessageLike("%"+order.getBuyerMessage()+"%");
}
if(order.getBuyerNick()!=null && order.getBuyerNick().length()>0){
criteria.andBuyerNickLike("%"+order.getBuyerNick()+"%");
}
if(order.getBuyerRate()!=null && order.getBuyerRate().length()>0){
criteria.andBuyerRateLike("%"+order.getBuyerRate()+"%");
}
if(order.getReceiverAreaName()!=null && order.getReceiverAreaName().length()>0){
criteria.andReceiverAreaNameLike("%"+order.getReceiverAreaName()+"%");
}
if(order.getReceiverMobile()!=null && order.getReceiverMobile().length()>0){
criteria.andReceiverMobileLike("%"+order.getReceiverMobile()+"%");
}
if(order.getReceiverZipCode()!=null && order.getReceiverZipCode().length()>0){
criteria.andReceiverZipCodeLike("%"+order.getReceiverZipCode()+"%");
}
if(order.getReceiver()!=null && order.getReceiver().length()>0){
criteria.andReceiverLike("%"+order.getReceiver()+"%");
}
if(order.getInvoiceType()!=null && order.getInvoiceType().length()>0){
criteria.andInvoiceTypeLike("%"+order.getInvoiceType()+"%");
}
if(order.getSourceType()!=null && order.getSourceType().length()>0){
criteria.andSourceTypeLike("%"+order.getSourceType()+"%");
}
if(order.getSellerId()!=null && order.getSellerId().length()>0){
criteria.andSellerIdLike("%"+order.getSellerId()+"%");
}
}
Page<TbOrder> page= (Page<TbOrder>)orderMapper.selectByExample(example);
return new PageResult(page.getTotal(), page.getResult());
}
@Override
public TbPayLog searchPayLogFromRedis(String userId) {
return (TbPayLog) redisTemplate.boundHashOps("payLog").get(userId);
}
@Override
public void updateOrderStatus(String out_trade_no, String transaction_id) {
//1.修改支付日志的状态及相关字段
TbPayLog payLog = payLogMapper.selectByPrimaryKey(out_trade_no);
payLog.setPayTime(new Date());//支付时间
payLog.setTradeState("1");//交易成功
payLog.setTransactionId(transaction_id);//微信的交易流水号
payLogMapper.updateByPrimaryKey(payLog);//修改
//2.修改订单表的状态
String orderList = payLog.getOrderList();// 订单ID 串
String[] orderIds = orderList.split(",");
for(String orderId:orderIds){
TbOrder order = orderMapper.selectByPrimaryKey(Long.valueOf(orderId));
order.setStatus("2");//已付款状态
order.setPaymentTime(new Date());//支付时间
orderMapper.updateByPrimaryKey(order);
}
//3.清除缓存中的payLog
redisTemplate.boundHashOps("payLog").delete(payLog.getUserId());
}
}
| [
"zhaoq0103@163.com"
] | zhaoq0103@163.com |
c77249f1ac128cbf208f922c05b208efc2060dc5 | 2d95236478ef2bfed9fa38945cde9e31d200ffb4 | /ProyectoMA-Eclispse/src/view/FrmBar.java | e3206644bd09497432abe24e243468f05c656b07 | [] | no_license | Jesu0108/ProyectoMA | 4d932c5b3507b3e191adf2605b0a4d8f8c3a414b | dc72664f2da7375e32edd70eac745a7815e4178a | refs/heads/master | 2023-03-05T00:00:21.366860 | 2021-02-18T12:04:37 | 2021-02-18T12:04:37 | 326,023,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | package view;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import controller.ListaPerfilesCtrl;
import model.Perfil;
import utils.Data;
public class FrmBar extends JDialog {
private static final long serialVersionUID = 1L;
private final JPanel contentPanel = new JPanel();
public FrmBar() {
createForm();
}
public void createForm() {
setBounds(100, 100, 320, 270);
setTitle("Grafica por localidades");
getContentPane().setLayout(new BorderLayout());
contentPanel.setLayout(new FlowLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
setVisible(true);
setResizable(false);
setIconImage(Toolkit.getDefaultToolkit().getImage(Data.icono));
int iSevilla = 0;
int iHuelva = 0;
int iOtros = 0;
// Fuente de datos - Bar
DefaultCategoryDataset data2 = new DefaultCategoryDataset();
// Hacemos recuento de tipos
for (Perfil p : ListaPerfilesCtrl.resultado) {
if (p.getsLocalidad().equals("Sevilla")) {
iSevilla++;
data2.setValue(iSevilla, "Sevilla", "Sevilla");
} else if (p.getsLocalidad().equals("Huelva")) {
iHuelva++;
data2.setValue(iHuelva, "Huelva", "Huelva");
} else {
iOtros++;
data2.setValue(iOtros, "Otros", "Otros");
}
}
// Creando grafico - Bar
JFreeChart gra = ChartFactory.createBarChart("Localidades mas usadas", "Localidades", "Veces usadas", data2,
PlotOrientation.VERTICAL, true, true, false);
// Personalizar el grafico
gra.setBackgroundPaint(Data.colorFondo);
gra.getTitle().setPaint(Color.BLACK);
// Mostrar Grafico
ChartPanel frameG2 = new ChartPanel(gra);
frameG2.setBounds(0, 0, 300, 250);
contentPanel.add(frameG2);
}
}
| [
"jartiguez2@gmail.com"
] | jartiguez2@gmail.com |
5e872541f6fc667b2c2143ee3537d60cf946902f | 28c80e168ee2c514d4ac7e4e79eecf7623691ca9 | /OOP1/Ejercicio15_cambiova.java | dd3023fa19229421f60dfa5c19365f4a60599398 | [] | no_license | programmingII/oop-practice-1-150204KalebChavira | 6a4df36693bdd249af1162efba08abc4ab9395f5 | 3e9cfc8636b6eb4161b48953c6f6cdc536fdfe50 | refs/heads/master | 2020-04-21T03:56:21.324123 | 2019-03-07T16:49:46 | 2019-03-07T16:49:46 | 169,298,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | /*Name: Joaquin Kaleb Chavira Gonzalez
Dia: 08/02/2019
Hora: 4:20*/
public class Ejercicio15_cambiova { //inicio de clase
public static void main(String[] args) { //main
int a, b, cambio;
a = 1;
b = 2;
System.out.println("Antes del cambio: a, b = "+a+", "+ + b);
cambio = a;
a = b;
b = cambio;
System.out.println("Despues del cambio : a, b = "+a+", "+ + b);
} //salida main
} | [
"noreply@github.com"
] | noreply@github.com |
5f6b48079426bb1f86732cea2004937c15b423d1 | 5c96efe670e8f2478ea1e2d38714ea2a13ff89c6 | /spring-services/src/test/java/com/accenture/spring/ServiceContextTest.java | 6a4bf93c24c54bc040e5418e026d1ed237a33288 | [] | no_license | GTORRESM/spring-project | ea58665509f5b0a3ab796349662849dce1d9a28a | 143b85852a466ecbaabad382234f9dfdcf5822b0 | refs/heads/master | 2021-01-09T05:20:06.491717 | 2017-02-21T21:50:43 | 2017-02-21T21:50:43 | 80,740,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package com.accenture.spring;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.accenture.spring.service.BookService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = ServiceContext.class)
public class ServiceContextTest {
@Autowired
protected BookService bookService;
@Test
public void instanceTest() {
Assert.assertNotNull(bookService);
}
}
| [
"g.torres.melchor@accenture.com"
] | g.torres.melchor@accenture.com |
ec250a80bafbc2e090c71c5759519aaabb13f39f | a6556cd434376bf2eb604fcb3618fdac64d936f0 | /src/MDI/JIFSalida.java | 8e0b8fe696bff56c2b873e3a4b7e1ee74f1de2d1 | [] | no_license | jarteaga77/SISTEMA_ALMACEN | 1543dd68cde898ac8cec9a6332e25b3c2152b803 | cc282f0cf843e4a7cec436f49764ffc8c1f1fbff | refs/heads/master | 2021-08-28T09:17:06.544489 | 2017-12-11T20:17:36 | 2017-12-11T20:17:36 | 113,904,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,513 | 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 MDI;
import MDI.Reportes.ReportesSalidas;
import MDI.Reportes.sistemas.ReportesSalidaSistemas;
import MDI.Reportes.electrico.ReportesSalidaElectrico;
import MDI.Reportes.mecanica.ReportesSalidaMecanica;
import java.util.Date;
import javax.swing.JOptionPane;
/**
*
* @author Jonathan
*/
public class JIFSalida extends javax.swing.JInternalFrame {
private ReportesSalidas reporte;
private ReportesSalidaSistemas reporteSistemas;
private ReportesSalidaElectrico reporteElectrico;
private ReportesSalidaMecanica reporteMecanica;
public JIFSalida() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
dc_fechaInicio = new com.toedter.calendar.JDateChooser();
dc_fechafin = new com.toedter.calendar.JDateChooser();
bt_generar = new javax.swing.JButton();
chb_salida_general = new javax.swing.JCheckBox();
jLabel4 = new javax.swing.JLabel();
chb_salida_sistemas = new javax.swing.JCheckBox();
chb_salida_elect = new javax.swing.JCheckBox();
chb_mecanica = new javax.swing.JCheckBox();
setClosable(true);
setIconifiable(true);
setTitle("Reportes Ordenes de Salida");
jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel1.setText("Fecha Inicio");
jLabel2.setText("Fecha Fin");
bt_generar.setText("Generar");
bt_generar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
bt_generar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_generarActionPerformed(evt);
}
});
buttonGroup1.add(chb_salida_general);
chb_salida_general.setText("Orden de salida General");
jLabel4.setText("REPORTES");
buttonGroup1.add(chb_salida_sistemas);
chb_salida_sistemas.setText("Orden de salida Sistemas");
buttonGroup1.add(chb_salida_elect);
chb_salida_elect.setText("Orden de Salida Eléctricos");
buttonGroup1.add(chb_mecanica);
chb_mecanica.setText("Hoja Mto. Mecánica");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(chb_salida_elect)
.addComponent(chb_salida_sistemas)
.addComponent(jLabel4)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(chb_salida_general)
.addGap(18, 18, 18)
.addComponent(chb_mecanica))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(dc_fechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(dc_fechafin, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(bt_generar)))
.addGap(33, 33, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(dc_fechafin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(dc_fechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel1)))
.addComponent(bt_generar))
.addGap(26, 26, 26)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(chb_salida_general)
.addComponent(chb_mecanica))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chb_salida_sistemas)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chb_salida_elect)
.addContainerGap(15, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void bt_generarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_generarActionPerformed
Date fecha_ini=dc_fechaInicio.getDate();
Date fecha_fin=dc_fechafin.getDate();
if(dc_fechaInicio.getDate() == null && dc_fechafin.getDate()== null)
{
JOptionPane.showMessageDialog(this, "Seleccione el rango de fecha","Error", JOptionPane.ERROR_MESSAGE);
}
else if(fecha_fin.before(fecha_ini) )
{
JOptionPane.showMessageDialog(this, "La fecha Final debe ser mayor que la inicial", "Error", JOptionPane.ERROR_MESSAGE);
}
if(chb_salida_general.isSelected()==true)
{
reporte=new ReportesSalidas();
reporte.ejecutarReporte(fecha_ini, fecha_fin);
}
else if(chb_salida_elect.isSelected()==true)
{
reporteElectrico=new ReportesSalidaElectrico();
reporteElectrico.ejecutarReporte(fecha_ini, fecha_fin);
}
else if(chb_salida_sistemas.isSelected()==true)
{
reporteSistemas=new ReportesSalidaSistemas();
reporteSistemas.ejecutarReporte(fecha_ini, fecha_fin);
}
else if(chb_mecanica.isSelected()==true)
{
reporteMecanica=new ReportesSalidaMecanica();
reporteMecanica.ejecutarReporte(fecha_ini, fecha_fin);
}
else
{
JOptionPane.showMessageDialog(this, "Seleccione un Reporte", "Error", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_bt_generarActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bt_generar;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JCheckBox chb_mecanica;
private javax.swing.JCheckBox chb_salida_elect;
private javax.swing.JCheckBox chb_salida_general;
private javax.swing.JCheckBox chb_salida_sistemas;
private com.toedter.calendar.JDateChooser dc_fechaInicio;
private com.toedter.calendar.JDateChooser dc_fechafin;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}
| [
"jarteaga@arteaga_jonathan@hotmail.com"
] | jarteaga@arteaga_jonathan@hotmail.com |
15bcf1c89853baeed513edce6042dc46de3c6b4e | 9d43ab148d348e8cc3c95402de58ca7b642f7f89 | /hello/Say.java | cd771b7205d0582a2320fc3a0747ea28ada537e7 | [] | no_license | Francesco-Sarra-Peano-4A/MultiThreading | 217dfafb6660b468c415c0abe4b22752d4681e69 | c8aebd761afcaffa7f75abb8d6e8ee633b85b8a6 | refs/heads/master | 2020-09-07T01:29:37.155268 | 2019-12-21T08:45:31 | 2019-12-21T08:45:31 | 220,616,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package hi.hello;
/*
* 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.
*/
/**
*
* @author sarra.francesco
*/
public class Say extends Thread{
String cosaDire;
public Say ( String parola){
this.cosaDire=parola;
}
public void run(){
System.out.println(cosaDire);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3b69b0c56c886e27e1173ed9fbbf8563f7b98f57 | 1c0e98b385c47e5dfc38c58a7456c53d0d342edf | /src/desmoj/extensions/visualization2d/animation/core/simulator/EntityAnimation.java | a57407e437b021ef44a8a7b90693eaff755f51b1 | [
"Apache-2.0"
] | permissive | muhd7rosli/desmoj | cfdac66ed5be6bc7633036a6f46a0b52806162a4 | e3fe078ce2808024c1f5358d78191ca38b2e2afb | refs/heads/master | 2021-01-23T08:34:54.347003 | 2014-08-07T04:59:26 | 2014-08-07T04:59:26 | 22,013,712 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,680 | java | package desmoj.extensions.visualization2d.animation.core.simulator;
import java.awt.Point;
import java.util.Hashtable;
import desmoj.core.simulator.Entity;
import desmoj.core.simulator.TimeInstant;
import desmoj.extensions.visualization2d.animation.CmdGeneration;
import desmoj.extensions.visualization2d.animation.PositionExt;
import desmoj.extensions.visualization2d.engine.command.Command;
import desmoj.extensions.visualization2d.engine.command.CommandException;
import desmoj.extensions.visualization2d.engine.command.Parameter;
/**
* Animation of an Entity.
* Free and static entities are supported.
* Free Entities can be included in Containers, as Queues, Processes, ect.
* and have no fixed location.
* Static Entities have a fixed location and can not be included in
* Containers, as Queues, Processes, ect.
*
* @version DESMO-J, Ver. 2.4.1 copyright (c) 2014
* @author christian.mueller@th-wildau.de
* For information about subproject: desmoj.extensions.visualization2d
* please have a look at:
* http://www.th-wildau.de/cmueller/Desmo-J/Visualization2d/
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
*/
public class EntityAnimation extends Entity implements EntityBasicAnimation{
private CmdGeneration cmdGen = null;
private boolean showInAnimation;
private String state = null;
private Hashtable<String, String> attribute = null;
/**
* constructor with same parameters as in Entity
* @param owner
* @param name
* @param showInTrace
*/
public EntityAnimation(ModelAnimation owner, String name,
boolean showInTrace) {
super(owner, name, showInTrace);
this.cmdGen = owner.getCmdGen();
this.showInAnimation = false;
}
/**
* createAnimation method of free entities, with initial state "active".
* @param entityTypeId entitType of Entity
* @param showInAnimation is shown in animation
*/
public void createAnimation(String entityTypeId, boolean showInAnimation) {
this.createAnimation(entityTypeId, "active", null, showInAnimation);
}
/**
* createAnimation method of free entities. These are non static entities
* and can be included in Containers, such as Queues, Processes, ect.
* @param entityTypeId entitType of Entity
* @param state initial state
* @param showInAnimation is shown in animation
*/
public void createAnimation(String entityTypeId, String state,
boolean showInAnimation) {
this.createAnimation(entityTypeId, state, null, showInAnimation);
}
/**
* createAnimation method of static entities. These entities have a fixed location,
* and can not be part of a Container.
* @param entityTypeId entitType of Entity
* @param state initial state
* @param pos extended position (middle point, angle, direction)
* @param showInAnimation is shown in animation
*/
public void createAnimation(String entityTypeId, String state,
PositionExt pos, boolean showInAnimation) {
this.showInAnimation = showInAnimation;
TimeInstant simTime = this.getModel().presentTime();
boolean init = this.cmdGen.isInitPhase();
this.state = state != null ? state : "";
this.attribute = new Hashtable<String, String>();
Command c;
if(this.showInAnimation){
try {
if(init) c = Command.getCommandInit("createEntity", this.cmdGen.getAnimationTime(simTime));
else c = Command.getCommandTime("createEntity", this.cmdGen.getAnimationTime(simTime));
c.addParameter("EntityId", this.getName());
c.addParameter("EntityTypeId", entityTypeId);
if(state != null)
c.addParameter("State", state);
if(pos != null){
Point point = pos.getPoint();
String[] position = {pos.getView(), Integer.toString(point.x), Integer.toString(point.y),
Double.toString(pos.getAngle()), Boolean.toString(pos.getDirection())};
c.addParameter("Position", Parameter.cat(position));
}
c.setRemark(this.getGeneratedBy(EntityAnimation.class.getSimpleName()));
cmdGen.checkAndLog(c);
cmdGen.write(c);
} catch (CommandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.setAttribute("name", this.getName());
}
}
/**
* Dispose the animation of this entity
*/
public void disposeAnimation(){
TimeInstant simTime = this.getModel().presentTime();
boolean init = this.cmdGen.isInitPhase();
Command c;
if(this.showInAnimation){
try {
if(init) c = Command.getCommandInit("disposeEntity", this.cmdGen.getAnimationTime(simTime));
else c = Command.getCommandTime("disposeEntity", this.cmdGen.getAnimationTime(simTime));
c.addParameter("EntityId", this.getName());
c.setRemark(this.getGeneratedBy(EntityAnimation.class.getSimpleName()));
cmdGen.checkAndLog(c);
cmdGen.write(c);
} catch (CommandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* Set attributes
* Following signs in the key are not valid :,:| they are changed to _
* @param key Attribute-key, possible keys are def in EntityType
* @param value Attribute-value
*/
public void setAttribute(String key, String value){
TimeInstant simTime = this.getModel().presentTime();
boolean init = this.cmdGen.isInitPhase();
// replace unvalid signs in cmd syntax
key.replace(';', '_');
key.replace(',', '_');
key.replace(':', '_');
key.replace('|', '_');
this.attribute.put(key, value);
Command c;
if(this.showInAnimation){
try {
if(init) c = Command.getCommandInit("setEntity", this.cmdGen.getAnimationTime(simTime));
else c = Command.getCommandTime("setEntity", this.cmdGen.getAnimationTime(simTime));
c.addParameter("EntityId", this.getName());
c.addParameter("Attribute", key+"|"+value);
c.setRemark(this.getGeneratedBy(EntityAnimation.class.getSimpleName()));
cmdGen.checkAndLog(c);
cmdGen.write(c);
} catch (CommandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* Set state
* @param state , possible states are def in EntityType
*/
public void setState(String state){
TimeInstant simTime = this.getModel().presentTime();
boolean init = this.cmdGen.isInitPhase();
this.state = state;
Command c;
if(this.showInAnimation){
try {
if(init) c = Command.getCommandInit("setEntity", this.cmdGen.getAnimationTime(simTime));
else c = Command.getCommandTime("setEntity", this.cmdGen.getAnimationTime(simTime));
c.addParameter("EntityId", this.getName());
c.addParameter("State", state);
c.setRemark(this.getGeneratedBy(EntityAnimation.class.getSimpleName()));
cmdGen.checkAndLog(c);
cmdGen.write(c);
} catch (CommandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* Set an attribute key as velocity attribute.
* when a entity moves on a route, velocity attribute describes the speed.
* Default attribute is velocity.
* @param attributeKey
*/
public void setVelocity(String attributeKey){
TimeInstant simTime = this.getModel().presentTime();
boolean init = this.cmdGen.isInitPhase();
Command c;
if(this.showInAnimation){
try {
if(init) c = Command.getCommandInit("setEntity", this.cmdGen.getAnimationTime(simTime));
else c = Command.getCommandTime("setEntity", this.cmdGen.getAnimationTime(simTime));
c.addParameter("EntityId", this.getName());
c.addParameter("Velocity", attributeKey);
c.setRemark(this.getGeneratedBy(EntityAnimation.class.getSimpleName()));
cmdGen.checkAndLog(c);
cmdGen.write(c);
} catch (CommandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public String getState(){
return this.state;
}
public String getAttribute(String key){
return this.attribute.get(key);
}
private String getGeneratedBy(String name){
String out = "generated by "+name+" and called by ";
if(this.currentSimProcess() != null)
out += this.currentSimProcess().getName();
else
out += this.currentModel().getName();
return out;
}
}
| [
"muhd7rosli@live.com"
] | muhd7rosli@live.com |
263e1e0232a46565e5b6840a808c64a6e71c9002 | b71eb79ba7d90f35c8e52090a60745e951364fe0 | /src/main/java/at/molindo/utils/collections/ClassMap.java | 587fdff87b1f22c4c195223ce73e52fe7229da61 | [
"Apache-2.0"
] | permissive | molindo/molindo-utils | ccfadbbdf0d96d7feb02074e43fb01757d5a7209 | 59c2ea4f6dbed8bb9ddea16f721466fb61a385ab | refs/heads/master | 2021-07-12T09:33:49.836866 | 2021-04-22T08:39:21 | 2021-04-22T08:39:21 | 990,264 | 6 | 3 | NOASSERTION | 2021-04-22T08:39:22 | 2010-10-15T15:49:12 | Java | UTF-8 | Java | false | false | 2,701 | java | /**
* Copyright 2016 Molindo GmbH
*
* 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 at.molindo.utils.collections;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A specialized {@link WeakHashMap} that ads the {@link #find(Class)} method to
* find mappings for superclasses.
*
* @param <V>
* value type
*
* @author stf
*/
public class ClassMap<V> extends WeakHashMap<Class<?>, V> {
/**
* @see #ClassMap()
*/
public static <V> ClassMap<V> create() {
return new ClassMap<V>();
}
/**
* @see #ClassMap(int, float)
*/
public static <V> ClassMap<V> create(int initialCapacity, float loadFactor) {
return new ClassMap<V>(initialCapacity, loadFactor);
}
/**
* @see #ClassMap(int)
*/
public static <V> ClassMap<V> create(int initialCapacity) {
return new ClassMap<V>(initialCapacity);
}
/**
* @see #ClassMap(Map)
*/
public static <V> ClassMap<V> create(Map<? extends Class<?>, ? extends V> m) {
return new ClassMap<V>(m);
}
/**
* @see WeakHashMap#WeakHashMap()
*/
public ClassMap() {
super();
}
/**
* @see WeakHashMap#WeakHashMap(int, float)
*/
public ClassMap(int initialCapacity, float loadFactor) {
super(initialCapacity, loadFactor);
}
/**
* @see WeakHashMap#WeakHashMap(int)
*/
public ClassMap(int initialCapacity) {
super(initialCapacity);
}
/**
* @see WeakHashMap#WeakHashMap(Map)
*/
public ClassMap(Map<? extends Class<?>, ? extends V> m) {
super(m);
}
/**
* @return first mapping for <code>cls</code> or one of its superclasses.
*/
public V find(Class<?> cls) {
if (cls == null) {
throw new NullPointerException("cls");
}
V v;
do {
v = get(cls);
cls = cls.getSuperclass();
} while (v == null && cls != null);
return v;
}
/**
* @return a new map containing all keys that are assignabel from cls
*/
public Map<Class<?>, V> findAssignable(Class<?> cls) {
if (cls == null) {
throw new NullPointerException("cls");
}
Map<Class<?>, V> map = new WeakHashMap<Class<?>, V>();
for (Map.Entry<Class<?>, V> e : entrySet()) {
if (cls.isAssignableFrom(e.getKey())) {
map.put(e.getKey(), e.getValue());
}
}
return map;
}
}
| [
"stf+git@molindo.at"
] | stf+git@molindo.at |
67258e86348440f1b456d7eb7e36e7c9824bfc41 | 29109a9b4b68bd996313a167e7c671a23aea8acf | /src/main/java/org/launchcode/models/data/MenuDao.java | a392f4f90fc81195b0ff48fc90c81fdd3a004607 | [] | no_license | noshuman/cheese-mvc-persistent | b725ecb7bbabc9a6953a621b3452917eb99577bf | e53d26924c7860964c0b9a8c0a5768d41d4db365 | refs/heads/master | 2020-06-04T02:29:33.270005 | 2019-06-26T02:35:10 | 2019-06-26T02:35:10 | 191,835,515 | 0 | 0 | null | 2019-06-13T21:27:35 | 2019-06-13T21:27:35 | null | UTF-8 | Java | false | false | 316 | java |
package org.launchcode.models.data;
import org.launchcode.models.Menu;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
@Repository
@Transactional
public interface MenuDao extends CrudRepository<Menu, Integer>{
} | [
"noshuman@gmail.com"
] | noshuman@gmail.com |
a11f0c639b086cc8950033f14d236aab0cd38c2a | d0b74c102c799df66b9dc0f0d5b34064e8cf51f9 | /src/main/java/hu/webuni/hr/lilla/web/HolidayRequestController.java | c73d95764befdb10711d7edf41b4e62ef1533abb | [] | no_license | KmecsLilla/spring-hr | 0ff22441e6cc02b6e327741fda6ba10f394ee32b | ba8ad14810f2593f0f5728d5b896a8ea8136037a | refs/heads/master | 2023-05-30T19:59:00.792335 | 2021-06-05T19:55:32 | 2021-06-05T19:55:32 | 351,923,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,158 | java | package hu.webuni.hr.lilla.web;
import java.security.InvalidParameterException;
import java.util.List;
import java.util.NoSuchElementException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.server.ResponseStatusException;
import hu.webuni.hr.lilla.dto.HolidayRequestDto;
import hu.webuni.hr.lilla.dto.HolidayRequestFilterDto;
import hu.webuni.hr.lilla.mapper.EmployeeMapper;
import hu.webuni.hr.lilla.mapper.HolidayRequestMapper;
import hu.webuni.hr.lilla.model.HolidayRequest;
import hu.webuni.hr.lilla.service.HolidayRequestService;
public class HolidayRequestController {
@Autowired
HolidayRequestService holidayRequestService;
@Autowired
EmployeeMapper employeeMapper;
@Autowired
HolidayRequestMapper holidayRequestMapper;
@GetMapping
public List<HolidayRequestDto> getAll() {
return holidayRequestMapper.holidayRequestsToDtos(holidayRequestService.findAll());
}
@GetMapping("/{id}")
public HolidayRequestDto getById(@PathVariable long id) {
HolidayRequest holidayRequest = holidayRequestService.findById(id).orElseThrow(()-> new ResponseStatusException(HttpStatus.NOT_FOUND));
return holidayRequestMapper.holidayRequestToDto(holidayRequest);
}
@PostMapping
public HolidayRequestDto addHolidayRequest(@PathVariable long id, @RequestBody HolidayRequestDto newHolidayRequest) {
HolidayRequest holidayRequest;
try {
holidayRequest = holidayRequestService.addHolidayRequest(holidayRequestMapper.dtoToHolidayRequest(newHolidayRequest), id);
} catch (NoSuchElementException e) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
return holidayRequestMapper.holidayRequestToDto(holidayRequest);
}
@PostMapping(value = "/search")
public List<HolidayRequestDto> findByExample(@RequestBody HolidayRequestFilterDto example, Pageable pageable) {
Page<HolidayRequest> page = holidayRequestService.findHolidayRequestByExample(example, pageable);
return holidayRequestMapper.holidayRequestsToDtos(page.getContent());
}
@PutMapping("/{id}")
public HolidayRequestDto modifyHolidayRequest(@PathVariable long id, @RequestBody HolidayRequestDto modifiedHolidayRequest) {
modifiedHolidayRequest.setId(id);
HolidayRequest holidayRequest;
try {
holidayRequest = holidayRequestService.modifyHolidayRequest(id, holidayRequestMapper.dtoToHolidayRequest(modifiedHolidayRequest), modifiedHolidayRequest);
} catch (InvalidParameterException e) {
throw new ResponseStatusException(HttpStatus.METHOD_NOT_ALLOWED);
} catch (NoSuchElementException e) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
return holidayRequestMapper.holidayRequestToDto(holidayRequest);
}
@DeleteMapping("/{id}")
public void deleteHolidayRequest(@PathVariable long id) {
try {
holidayRequestService.deleteHolidayRequest(id);
} catch (InvalidParameterException e) {
throw new ResponseStatusException(HttpStatus.METHOD_NOT_ALLOWED);
} catch (NoSuchElementException e) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
}
@PutMapping(value = "/{id}/approval", params = {"statusOfApproving", "approverId" })
public HolidayRequestDto approveHolidayRequest(@PathVariable long id, @RequestParam long approverId, @RequestParam Boolean statusOfApproving) {
HolidayRequest holidayRequest;
try {
holidayRequest = holidayRequestService.approveHolidayRequest(id, approverId, statusOfApproving);
} catch (NoSuchElementException e) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
return holidayRequestMapper.holidayRequestToDto(holidayRequest);
}
}
| [
"kmecs.lilla@gmail.com"
] | kmecs.lilla@gmail.com |
9fc2760158451354430473498053b4f3892aa97d | c645527244124321791e05a20e6cfffc5bc91b64 | /sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibExternalUri.java | 471c6cdb71a9e63bd0abfa7e787cc8ed0afce7af | [
"MIT"
] | permissive | set321go/composum | a8c33e1efe1fdac08956ff7d8141d077484fb4a1 | 2e5b63ad55d51b8a0673d0315e0def1d10f2372f | refs/heads/master | 2020-04-28T11:35:52.025529 | 2018-08-16T08:39:49 | 2018-08-16T08:39:49 | 175,247,724 | 0 | 0 | MIT | 2019-03-12T15:54:06 | 2019-03-12T15:54:06 | null | UTF-8 | Java | false | false | 1,469 | java | package com.composum.sling.clientlibs.handle;
import javax.jcr.RepositoryException;
import java.io.IOException;
import java.util.Map;
/**
* Models a reference to external URLs - as links, js or css.
*/
public class ClientlibExternalUri implements ClientlibElement {
protected final ClientlibLink link;
/**
* Creates the element.
*
* @param type the type of the link
* @param uri the URL (HTTP/HTTPS/protocol omitted)
* @param properties optionally, additional properties
*/
public ClientlibExternalUri(Clientlib.Type type, String uri, Map<String, String> properties) {
link = new ClientlibLink(type, ClientlibLink.Kind.EXTERNALURI, uri, properties);
}
/**
* Calls the visitor with mode {@link com.composum.sling.clientlibs.handle.ClientlibVisitor.VisitorMode#DEPENDS},
* since external references are never embedded.
*/
@Override
public void accept(ClientlibVisitor visitor, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent) throws IOException, RepositoryException {
visitor.visit(this, ClientlibVisitor.VisitorMode.DEPENDS, parent);
}
@Override
public Clientlib.Type getType() {
return link.type;
}
@Override
public ClientlibLink makeLink() {
return link;
}
@Override
public ClientlibRef getRef() {
return new ClientlibRef(link.type, link.path, false, link.properties);
}
}
| [
"hp.stoerr@ist-software.com"
] | hp.stoerr@ist-software.com |
0c097d17760d9b3edefd3637652faccfe336184a | 3108764d0bd8f62ce4cc68af7dcaca4e3e93a6db | /src/Uczelnia/Student.java | 50c44d42731ee720e8bf7cf19fedb0511d1080d4 | [] | no_license | KacperczykKinga/Projekt | f9a422e38a8cf939d85d132e689c2418161e2ad5 | b09868bed92018a0f5bb52a2e51874e958b2b408 | refs/heads/master | 2020-05-01T19:23:05.437168 | 2019-04-04T21:24:55 | 2019-04-04T21:24:55 | 177,647,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,758 | java | package Uczelnia;
import Uczelnia.Osoba;
//import Uczelnia.Uczelnia2;
import Uczelnia.PracownikNaukowo_Dydaktyczny;
//import Uczelnia.Pracownik_Administracji;
import java.io.*;
import java.util.*;
public class Student extends Osoba implements Serializable {
private int rokstudiow;
private String kierunek;
private PracownikNaukowo_Dydaktyczny[] wykladowcy=new PracownikNaukowo_Dydaktyczny[10];
private Object[] konsultacje=new Object[7];
private Object[] konsultacje3=new Object[3];
public Student(String imie,String nazwisko,int rokurodzenia,String plec, String PESEL,int rokstudiow,String kierunek){
super(imie,nazwisko,rokurodzenia,plec,PESEL);
this.rokstudiow=rokstudiow;
this.kierunek=kierunek;
}
//gettery
public int getrokstudiow(){
return rokstudiow;
}
public String getkieunek(){
return kierunek;
}
//settery
public void setrokstudiow(int rokstudiow){
this.rokstudiow=rokstudiow;
}
public void setkierunek(String kierunek){
this.kierunek=kierunek;
}
//tworzy liste wykładowców, którzy uczą tego studenta
public void losujwykladowcow(){
PracownikUczelni[] wszyscy=new PracownikUczelni[10000000];
ZapisOdczyt nowy=new ZapisOdczyt();
wszyscy=nowy.odczytaj();
int lwykladowcow=0;
while(wszyscy[lwykladowcow]!=null) lwykladowcow++;
System.out.println(lwykladowcow);
int j=0;
for(int i=0;i<10;i++){
int a=(int)(Math.random()*lwykladowcow);
if(wszyscy[a] instanceof PracownikNaukowo_Dydaktyczny){
wykladowcy[j]=(PracownikNaukowo_Dydaktyczny)wszyscy[a];
System.out.println(wykladowcy[j]);
j++;
}
}
}
//losowo dobiera parametry konultacji
public void potrzebakonsultacji(){
int lwykladowcow=1;
while(wykladowcy[lwykladowcow-1]!=null && lwykladowcow<wykladowcy.length) {lwykladowcow++; }
lwykladowcow--;
int a=(int)(Math.random()*lwykladowcow);
System.out.println(a);
System.out.println(wykladowcy[a]);
konsultacje[0]=wykladowcy[a];
int czasmin=(int)(Math.random()*5)+10;
System.out.println(czasmin);
konsultacje[1]=czasmin;
int czasmax=(int)(Math.random()*20)+czasmin;
System.out.println(czasmax);
konsultacje[2]=czasmax;
int b=(int)(Math.random()*4);
if(b==0) {System.out.println("Małe"); konsultacje[3]="Małe";}
if(b==1) {System.out.println("Średnie"); konsultacje[3]="Średnie";}
if(b==2) {System.out.println("Duże"); konsultacje[3]="Duże";}
if(b==3) {System.out.println("Bardzo duże");konsultacje[3]="Bardzo duże";}
konsultacje[4]=0;
konsultacje[5]=0;
konsultacje[6]=null;
}
//settery parametrów konsultacji
public void setczasmin(int czas){
this.konsultacje[1]=czas;
}
public void setczasmax(int czas){
this.konsultacje[2]=czas;
}
public void setpriorytet(String prio){
this.konsultacje[3]=prio;
}
public void setczasdany(int czas){
this.konsultacje[4]=czas;
}
public void setdziendany(Object a){
this.konsultacje[5]=((Calendar)a).getTime();
this.konsultacje[6]=(Calendar)a;
}
//gettery parametrów konsultacji
public int getczasmin(){
return (int)konsultacje[1];
}
public int getczasmax(){
return (int)konsultacje[2];
}
public String getpriorytet(){
return (String)konsultacje[3];
}
public PracownikNaukowo_Dydaktyczny getwykladowca0(){
return ((PracownikNaukowo_Dydaktyczny)konsultacje[0]);
}
public PracownikNaukowo_Dydaktyczny getwykladowca(){
//if((((PracownikNaukowo_Dydaktyczny)konsultacje[0]).getPESEL())!=null)
//{
return (PracownikNaukowo_Dydaktyczny)konsultacje[0];}
////if((((PracownikNaukowo_Dydaktyczny)konsultacje[0]).getPESEL())==null)
//{return null;}
// }
public int getczasdany(){
return (int)konsultacje[4];
}
/* public int getroznica(){
konsultacje[6]=getczasmax()-getczasdany();
return (int)konsultacje[6];
}*/
public long getdziendany(){
if(konsultacje[6]!=null)
return (long)(((Calendar)konsultacje[6]).getTimeInMillis());
return 0;
}
//gettery całych konsultacji
public String getKons(){
for(int i=0;i<6;i++){
System.out.println(konsultacje[i]);
}
if(konsultacje[0]==null) return "Nie masz konsultacji";
return " Czas minimalny "+
Integer.toString((Integer)konsultacje[1])+
" czas maksymalny "+ Integer.toString((Integer)konsultacje[2])+
" priorytet "+konsultacje[3]+" czas przyznany "+
Integer.toString((Integer)konsultacje[4])+" dzien przyznany "+konsultacje[5];
}
public void getTab(){
for(int i=0;i<6;i++){
System.out.println(konsultacje[i]);
}
}
public static void main(String[] args) {
Student a= new Student("Karol","Misiek",1997,"m","97081543753",1,"inzynieria środowiska");
a.losujwykladowcow();
a.potrzebakonsultacji();
}
}
| [
"agnikkac@gmail.com"
] | agnikkac@gmail.com |
21471fe62a751ec5757766b2441ffad3d7c7e133 | 8018ce0a6cc362bb82b89fdd420516de853941c7 | /04-spring-boot-mybatis-xml/src/main/java/com/gzz/sys/user/UserController.java | 2c702c7279183b80f65ee2cf42483c31f6fe567b | [] | no_license | user3614/spring-boot-examples | da8ddf4507f166631f20965c519e6824d60790d5 | f61e2f446901dcab95d14c830824adceb215ae15 | refs/heads/master | 2023-04-15T08:51:37.062215 | 2021-04-09T10:50:23 | 2021-04-09T10:50:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package com.gzz.sys.user;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserMapper userMapper;
@RequestMapping("/getUsers")
public List<UserEntity> getUsers() {
List<UserEntity> users=userMapper.getAll();
return users;
}
@RequestMapping("/getUser")
public UserEntity getUser(Long id) {
UserEntity user=userMapper.getOne(id);
return user;
}
@RequestMapping("/add")
public void save(UserEntity user) {
userMapper.insert(user);
}
@RequestMapping(value="update")
public void update(UserEntity user) {
userMapper.update(user);
}
@RequestMapping(value="/delete/{id}")
public void delete(@PathVariable("id") Long id) {
userMapper.delete(id);
}
} | [
"2570613257@qq.com"
] | 2570613257@qq.com |
7dcd077407c880ccff5535ab1b06c597f785afd5 | 08d2189e9cea2d588f2c985099c013fcc237f1c1 | /src/main/java/io/github/zgjai/Greedy/BurstBalloons452.java | 4e5d1292aebb59257197d1faf6ab3ad4f020d60d | [
"MIT"
] | permissive | zgjai/LeetCodeByJava | 04ae13633c663dd65e725c9a6dce5d15e13ad721 | 819f0bf86ccc5771127d129ebec1eaec2e41c5e2 | refs/heads/master | 2021-07-08T17:06:10.246838 | 2020-07-11T12:12:54 | 2020-07-11T12:12:54 | 145,865,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package io.github.zgjai.Greedy;
/**
* Created by zhangguijiang on 2017/10/20.
*/
/**
*
*/
public class BurstBalloons452 {
}
| [
"18710057269@163.com"
] | 18710057269@163.com |
5362917665f36c1cb01456dd7a8c1579cfef74cc | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /emr-20160408/src/main/java/com/aliyun/emr20160408/models/DescribeScalingRuleResponseBody.java | bbe94d3f0cbbe3c483b8ed473c090cd3c38cbff9 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 10,047 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.emr20160408.models;
import com.aliyun.tea.*;
public class DescribeScalingRuleResponseBody extends TeaModel {
@NameInMap("Status")
public String status;
@NameInMap("TimeoutWithGrace")
public Long timeoutWithGrace;
@NameInMap("RequestId")
public String requestId;
@NameInMap("Cooldown")
public Integer cooldown;
@NameInMap("CloudWatchTrigger")
public DescribeScalingRuleResponseBodyCloudWatchTrigger cloudWatchTrigger;
@NameInMap("GmtModified")
public String gmtModified;
@NameInMap("AdjustmentType")
public String adjustmentType;
@NameInMap("GmtCreate")
public String gmtCreate;
@NameInMap("AdjustmentValue")
public Integer adjustmentValue;
@NameInMap("SchedulerTrigger")
public DescribeScalingRuleResponseBodySchedulerTrigger schedulerTrigger;
@NameInMap("WithGrace")
public Boolean withGrace;
@NameInMap("Id")
public String id;
@NameInMap("RuleName")
public String ruleName;
@NameInMap("RuleCategory")
public String ruleCategory;
public static DescribeScalingRuleResponseBody build(java.util.Map<String, ?> map) throws Exception {
DescribeScalingRuleResponseBody self = new DescribeScalingRuleResponseBody();
return TeaModel.build(map, self);
}
public DescribeScalingRuleResponseBody setStatus(String status) {
this.status = status;
return this;
}
public String getStatus() {
return this.status;
}
public DescribeScalingRuleResponseBody setTimeoutWithGrace(Long timeoutWithGrace) {
this.timeoutWithGrace = timeoutWithGrace;
return this;
}
public Long getTimeoutWithGrace() {
return this.timeoutWithGrace;
}
public DescribeScalingRuleResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public DescribeScalingRuleResponseBody setCooldown(Integer cooldown) {
this.cooldown = cooldown;
return this;
}
public Integer getCooldown() {
return this.cooldown;
}
public DescribeScalingRuleResponseBody setCloudWatchTrigger(DescribeScalingRuleResponseBodyCloudWatchTrigger cloudWatchTrigger) {
this.cloudWatchTrigger = cloudWatchTrigger;
return this;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger getCloudWatchTrigger() {
return this.cloudWatchTrigger;
}
public DescribeScalingRuleResponseBody setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
return this;
}
public String getGmtModified() {
return this.gmtModified;
}
public DescribeScalingRuleResponseBody setAdjustmentType(String adjustmentType) {
this.adjustmentType = adjustmentType;
return this;
}
public String getAdjustmentType() {
return this.adjustmentType;
}
public DescribeScalingRuleResponseBody setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
return this;
}
public String getGmtCreate() {
return this.gmtCreate;
}
public DescribeScalingRuleResponseBody setAdjustmentValue(Integer adjustmentValue) {
this.adjustmentValue = adjustmentValue;
return this;
}
public Integer getAdjustmentValue() {
return this.adjustmentValue;
}
public DescribeScalingRuleResponseBody setSchedulerTrigger(DescribeScalingRuleResponseBodySchedulerTrigger schedulerTrigger) {
this.schedulerTrigger = schedulerTrigger;
return this;
}
public DescribeScalingRuleResponseBodySchedulerTrigger getSchedulerTrigger() {
return this.schedulerTrigger;
}
public DescribeScalingRuleResponseBody setWithGrace(Boolean withGrace) {
this.withGrace = withGrace;
return this;
}
public Boolean getWithGrace() {
return this.withGrace;
}
public DescribeScalingRuleResponseBody setId(String id) {
this.id = id;
return this;
}
public String getId() {
return this.id;
}
public DescribeScalingRuleResponseBody setRuleName(String ruleName) {
this.ruleName = ruleName;
return this;
}
public String getRuleName() {
return this.ruleName;
}
public DescribeScalingRuleResponseBody setRuleCategory(String ruleCategory) {
this.ruleCategory = ruleCategory;
return this;
}
public String getRuleCategory() {
return this.ruleCategory;
}
public static class DescribeScalingRuleResponseBodyCloudWatchTrigger extends TeaModel {
@NameInMap("ComparisonOperator")
public String comparisonOperator;
@NameInMap("MetricName")
public String metricName;
@NameInMap("EvaluationCount")
public String evaluationCount;
@NameInMap("Unit")
public String unit;
@NameInMap("MetricDisplayName")
public String metricDisplayName;
@NameInMap("Threshold")
public String threshold;
@NameInMap("Period")
public Integer period;
@NameInMap("Statistics")
public String statistics;
public static DescribeScalingRuleResponseBodyCloudWatchTrigger build(java.util.Map<String, ?> map) throws Exception {
DescribeScalingRuleResponseBodyCloudWatchTrigger self = new DescribeScalingRuleResponseBodyCloudWatchTrigger();
return TeaModel.build(map, self);
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
return this;
}
public String getComparisonOperator() {
return this.comparisonOperator;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setMetricName(String metricName) {
this.metricName = metricName;
return this;
}
public String getMetricName() {
return this.metricName;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setEvaluationCount(String evaluationCount) {
this.evaluationCount = evaluationCount;
return this;
}
public String getEvaluationCount() {
return this.evaluationCount;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setUnit(String unit) {
this.unit = unit;
return this;
}
public String getUnit() {
return this.unit;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setMetricDisplayName(String metricDisplayName) {
this.metricDisplayName = metricDisplayName;
return this;
}
public String getMetricDisplayName() {
return this.metricDisplayName;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setThreshold(String threshold) {
this.threshold = threshold;
return this;
}
public String getThreshold() {
return this.threshold;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setPeriod(Integer period) {
this.period = period;
return this;
}
public Integer getPeriod() {
return this.period;
}
public DescribeScalingRuleResponseBodyCloudWatchTrigger setStatistics(String statistics) {
this.statistics = statistics;
return this;
}
public String getStatistics() {
return this.statistics;
}
}
public static class DescribeScalingRuleResponseBodySchedulerTrigger extends TeaModel {
@NameInMap("LaunchExpirationTime")
public Integer launchExpirationTime;
@NameInMap("RecurrenceValue")
public String recurrenceValue;
@NameInMap("RecurrenceType")
public String recurrenceType;
@NameInMap("RecurrenceEndTime")
public Long recurrenceEndTime;
@NameInMap("LaunchTime")
public Long launchTime;
public static DescribeScalingRuleResponseBodySchedulerTrigger build(java.util.Map<String, ?> map) throws Exception {
DescribeScalingRuleResponseBodySchedulerTrigger self = new DescribeScalingRuleResponseBodySchedulerTrigger();
return TeaModel.build(map, self);
}
public DescribeScalingRuleResponseBodySchedulerTrigger setLaunchExpirationTime(Integer launchExpirationTime) {
this.launchExpirationTime = launchExpirationTime;
return this;
}
public Integer getLaunchExpirationTime() {
return this.launchExpirationTime;
}
public DescribeScalingRuleResponseBodySchedulerTrigger setRecurrenceValue(String recurrenceValue) {
this.recurrenceValue = recurrenceValue;
return this;
}
public String getRecurrenceValue() {
return this.recurrenceValue;
}
public DescribeScalingRuleResponseBodySchedulerTrigger setRecurrenceType(String recurrenceType) {
this.recurrenceType = recurrenceType;
return this;
}
public String getRecurrenceType() {
return this.recurrenceType;
}
public DescribeScalingRuleResponseBodySchedulerTrigger setRecurrenceEndTime(Long recurrenceEndTime) {
this.recurrenceEndTime = recurrenceEndTime;
return this;
}
public Long getRecurrenceEndTime() {
return this.recurrenceEndTime;
}
public DescribeScalingRuleResponseBodySchedulerTrigger setLaunchTime(Long launchTime) {
this.launchTime = launchTime;
return this;
}
public Long getLaunchTime() {
return this.launchTime;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
8ecf7384edd87b2b80dcdabb0dca98b5b5126d75 | abcd2f180907c62fdc454a18a915fd935aacb725 | /src/test/java/runners/ParallelRunner.java | c85424576dfca736325190edd22beb61dfcf97d9 | [] | no_license | exelenterGNC/GNCProject | 6bfe6dd1acbe6395e970161a3bb47bda959d0e84 | efdd936eb221015c351f9a331b8dbc4fafe27cf2 | refs/heads/master | 2023-05-31T00:35:21.951855 | 2021-06-08T01:57:26 | 2021-06-08T01:57:26 | 343,002,043 | 1 | 3 | null | 2021-06-08T01:57:26 | 2021-02-28T02:15:24 | HTML | UTF-8 | Java | false | false | 715 | java | package runners;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import steps.Hooks;
@CucumberOptions(
features = {"src/test/java/featureFiles/LoginFunctionalityNegative.feature"},
glue = {"steps"},
dryRun = false,
plugin = {"pretty", "html:target/report/index.html"}
)
public class ParallelRunner extends AbstractTestNGCucumberTests {
@BeforeClass
@Parameters ("browser")
public void beforeMethod (@Optional("chrome") String browser){
Hooks.browserName.set(browser);
}
}
| [
"furkat.khalilov@gmail.com"
] | furkat.khalilov@gmail.com |
026c0d338eedb34cfbc4b649c4f214463ca48329 | f18e03a201961e311bc0bed3d128dbc98e879b8a | /0-1 Knapsack Problem/Recursive/App.java | da8539d92bd18082ad6946062e5858aa1c7e224d | [
"MIT"
] | permissive | iamsomraj/Dynamic-Programming-using-Java | 2ac7efe3f30b531da5880bbd624e4f5494b725e1 | 0d7a56dfa16bfe674f2cdab51f514de845bbb2b0 | refs/heads/master | 2022-12-21T23:46:46.333232 | 2020-09-28T11:50:50 | 2020-09-28T11:50:50 | 240,947,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | class App {
public static int knapsack(int wt[], int val[], int w, int n) {
if (n == 0 || w == 0) {
return 0;
}
if (wt[n - 1] <= w) {
return Math.max(val[n - 1] + knapsack(wt, val, w - wt[n - 1], n - 1), knapsack(wt, val, w, n - 1));
} else {
return knapsack(wt, val, w, n - 1);
}
}
public static void main(String[] args) {
// weight array
int wt[] = { 10, 20, 30 };
// value array
int val[] = { 60, 100, 120 };
// capacity of the knapsack
int w = 50;
// number of the items
int n = wt.length;
System.out.println(knapsack(wt, val, w, n));
}
} | [
"iamsomraj@gmail.com"
] | iamsomraj@gmail.com |
a4673496b183f5d5afede65683efe6dfd3d091f1 | e697225a359c408a4f17f18b137f9a526498ab58 | /calci/src/main/java/simple/calci/Division.java | e50b9c691cdf7ade3c9c775f25ea1b9c1610551f | [] | no_license | GrandhiSriRam/Calculator.SriRamGrandhi | 43c70e4fa1dcdea7e8b411326c9d23e9a837ecab | 794f6fa59b8ffab1dd4fb84fa4e8d3687787bb3e | refs/heads/master | 2021-01-02T07:20:53.160574 | 2020-02-10T17:20:53 | 2020-02-10T17:20:53 | 239,545,741 | 0 | 0 | null | 2020-10-13T19:26:07 | 2020-02-10T15:32:29 | Java | UTF-8 | Java | false | false | 238 | java | package simple.calci;
public class Division {
double x,y;
public Division(double x,double y) {
// TODO Auto-generated constructor stub
this.x=x;
this.y=y;
}
void div() {
System.out.println(this.x/this.y);
}
}
| [
"siva.kaddala1998@gmail.com"
] | siva.kaddala1998@gmail.com |
e861931a4c43dc3cdedc09ebc4fcb8e3a10aec91 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/java-design-patterns/validation/232/FactoryKitTest.java | 96ddb63cfb24df7215fd326e27e91df63842d61a | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,067 | java | /**
* The MIT License
* Copyright (c) 2014-2016 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.factorykit.factorykit;
import com.iluwatar.factorykit.Axe;
import com.iluwatar.factorykit.Spear;
import com.iluwatar.factorykit.Sword;
import com.iluwatar.factorykit.Weapon;
import com.iluwatar.factorykit.WeaponFactory;
import com.iluwatar.factorykit.WeaponType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api. Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test Factory Kit Pattern
*/
public class FactoryKitTest {
private WeaponFactory factory;
@BeforeEach
public void init() {
factory = WeaponFactory.factory(builder -> {
builder.add(WeaponType.SPEAR, Spear::new);
builder.add(WeaponType.AXE, Axe::new);
builder.add(WeaponType.SWORD, Sword::new);
});
}
/**
* Testing {@link WeaponFactory} to produce a SPEAR asserting that the Weapon is an instance of {@link Spear}
*/
@Test
public void testSpearWeapon() {
Weapon weapon = factory.create(WeaponType.SPEAR);
verifyWeapon(weapon, Spear.class);
}
/**
* Testing {@link WeaponFactory} to produce a AXE asserting that the Weapon is an instance of {@link Axe}
*/
@Test
public void testAxeWeapon() {
Weapon weapon = factory.create(WeaponType.AXE);
verifyWeapon(weapon, Axe.class);
}
/**
* Testing {@link WeaponFactory} to produce a SWORD asserting that the Weapon is an instance of {@link Sword}
*/
@Test
public void testWeapon() {
Weapon weapon = factory.create(WeaponType.SWORD);
verifyWeapon(weapon, Sword.class);
}
/**
* This method asserts that the weapon object that is passed is an instance of the clazz
*
* @param weapon weapon object which is to be verified
* @param clazz expected class of the weapon
*/
private void verifyWeapon(Weapon weapon, Class<?> clazz) {
assertTrue(clazz.isInstance(weapon), "Weapon must be an object of: " + clazz.getName());
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
5f6a4a158439a9e92e04251542c77a907b5426dd | d2308dfe6be409d2f6808ae0f1a4e69c1acd0eac | /src/poppaw/FactRepository.java | b65128ebd2ff549d2b4ca84b8df6eacbfbce1140 | [] | no_license | poppaw/ExpertSystem | 4ddf4b3192f11e882fa5f95d51fd6def5320502d | 3f681352756e9b29048797b9c9c6e8673bd11bd3 | refs/heads/master | 2020-03-22T14:48:35.877094 | 2018-07-14T22:53:37 | 2018-07-14T22:53:37 | 140,207,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | package poppaw;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
public class FactRepository {
List<Fact> facts;
public FactRepository() {
this.facts = new ArrayList<>();
}
public void addFact(Fact fact) {
this.facts.add(fact);
}
public Iterator<Fact> getIterator() {
return new FactIterator();
}
private class FactIterator implements Iterator<Fact>{
int index = 0;
public boolean hasNext(){
return index < facts.size();
}
public Fact next()throws NoSuchElementException{
if (!this.hasNext())
throw new NoSuchElementException();
return facts.get(index++);
}
}
} | [
"p.p.popowicz@gmail.com"
] | p.p.popowicz@gmail.com |
aaa54b6b1b12b1f9ed5fa03239da0144c9a87527 | e6c0049b0471be6da9c992c3bbfff8f58a4d6c99 | /android/app/src/main/java/com/dumbtickmobile/MainApplication.java | 0a7eed3fc288a14124cfc6891c56175ddc8f7483 | [] | no_license | rizalin/Dumbtick_Mobile | 348d90b822dfd37ef04d8256e2dc661fdec3c4e9 | 7695909cad1aad214091e58c65bb6b169782b5b8 | refs/heads/Beta | 2023-01-12T22:48:19.000130 | 2020-01-06T19:10:44 | 2020-01-06T19:10:44 | 232,166,099 | 0 | 0 | null | 2023-01-05T04:54:14 | 2020-01-06T19:02:05 | JavaScript | UTF-8 | Java | false | false | 2,509 | java | package com.dumbtickmobile;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.th3rdwave.safeareacontext.SafeAreaContextPackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.swmansion.reanimated.ReanimatedPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
}
/**
* Loads Flipper in React Native templates.
*
* @param context
*/
private static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"rizal.imamnugraha@gmail.com"
] | rizal.imamnugraha@gmail.com |
21493b4938d57ab735862055b061d6c2a28a1085 | 3cc04461ad31d9ea587e083f952b7287f895cdd2 | /app/src/main/java/com/armstring/daggerandroidinjector/application/ApplicationComponent.java | 11282bc0d7c155e2b387b8b811c473b6dd4cd943 | [] | no_license | KingArmstring/dagger-android-injector | b6fee72ad40e545f4b66e7ffcd439f0c9e1fa358 | e269f6bea00b1256d74d1629d8d5d6ece00cf888 | refs/heads/master | 2020-03-19T09:22:10.251992 | 2018-06-06T06:26:36 | 2018-06-06T06:26:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.armstring.daggerandroidinjector.application;
import dagger.BindsInstance;
import dagger.Component;
import dagger.android.support.AndroidSupportInjectionModule;
@Component(modules = {
ApplicationModule.class,
BindingModule.class,
AndroidSupportInjectionModule.class
})
public interface ApplicationComponent {
@Component.Builder
interface Builder {
@BindsInstance
Builder applicationComponent(MyApplication application);
ApplicationComponent build();
}
void inject(MyApplication application);
}
| [
"mohammad.elsayed@microdoers.com"
] | mohammad.elsayed@microdoers.com |
73fd825655ed9c42d04ca54c82f03ea877044bd7 | 888177bd9f9e227510d276cb7f76097ac2e845fb | /1010/advance/src/demo/genericDemo/GenericDemo.java | 9ce69a1fbbed5dd66e71077ec221bc4f13fadc47 | [] | no_license | ShaoShuo17/BasicJavaPractice | a9d2bfe3d85b05a4dfae85431efba0f8828990d2 | 70bdcd3f1a7553493a3c8895079b169a1b8ce33d | refs/heads/master | 2023-02-24T06:22:04.562429 | 2021-02-03T03:54:14 | 2021-02-03T03:54:14 | 307,610,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package demo.genericDemo;
import java.util.ArrayList;
import java.util.Iterator;
public class GenericDemo {
public static void main(String[] args) {
//withoutGeneric();//不使用泛型存在弊端
withGeneric();
//泛型通配符的使用
ArrayList<Integer> list1 = new ArrayList<>();
list1.add(1);
list1.add(2);
ArrayList<String> list2 = new ArrayList<>();
list2.add("a");
list2.add("b");
printArray(list1);
printArray(list2);
}
private static void printArray(ArrayList<?> list) {
Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
private static void withGeneric() {
ArrayList<String> list = new ArrayList<>();
list.add("hjk");
list.add("12");
Iterator<String> iterator = list.iterator();
while (iterator.hasNext()) {
String next = iterator.next();
System.out.println(next);
System.out.println(next.length());
}
}
private static void withoutGeneric() {
ArrayList list = new ArrayList();
list.add("hjk");
list.add(12);
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Object next = iterator.next();
System.out.println(next);
String s = (String) next;
System.out.println(s.length());
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6f9c331daab2a20fabc1ed01f24c38ddb8cd6b55 | 60c87e28ffb644c45501a20c779077000c77b640 | /src/main/java/org/jeecgframework/web/demo/controller/test/JeecgNoteController.java | e897d32bc22c524f95f2622db24c289fb4413e78 | [] | no_license | chenzhenguo/nx | 3fa76e5e05f7425882382cdfbb1816e2e485f38b | cf19205ea35a7718bc0b71b370b330353df5d956 | refs/heads/master | 2021-07-22T02:23:45.199383 | 2017-11-01T13:21:51 | 2017-11-01T13:21:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,999 | java | /* */ package org.jeecgframework.web.demo.controller.test;
/* */
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.apache.log4j.Logger;
/* */ import org.jeecgframework.core.common.controller.BaseController;
/* */ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
/* */ import org.jeecgframework.core.common.model.json.AjaxJson;
/* */ import org.jeecgframework.core.common.model.json.DataGrid;
/* */ import org.jeecgframework.core.constant.Globals;
/* */ import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
/* */ import org.jeecgframework.core.util.StringUtil;
/* */ import org.jeecgframework.tag.core.easyui.TagUtil;
/* */ import org.jeecgframework.web.demo.entity.test.JeecgNoteEntity;
/* */ import org.jeecgframework.web.demo.service.test.JeecgNoteServiceI;
/* */ import org.jeecgframework.web.system.service.SystemService;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.web.bind.annotation.RequestMapping;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */ import org.springframework.web.servlet.ModelAndView;
/* */
/* */ @Controller
/* */ @RequestMapping({"/jeecgNoteController"})
/* */ public class JeecgNoteController extends BaseController
/* */ {
/* 37 */ private static final Logger logger = Logger.getLogger(JeecgNoteController.class);
/* */
/* */ @Autowired
/* */ private JeecgNoteServiceI jeecgNoteService;
/* */
/* */ @Autowired
/* */ private SystemService systemService;
/* */
/* */ @RequestMapping(params={"jeecgNote"})
/* */ public ModelAndView jeecgNote(HttpServletRequest request)
/* */ {
/* 52 */ return new ModelAndView("jeecg/demo/test/jeecgNoteList");
/* */ }
/* */
/* */ @RequestMapping(params={"jeecgNote2"})
/* */ public ModelAndView jeecgNote2(HttpServletRequest request)
/* */ {
/* 64 */ return new ModelAndView("jeecg/demo/test/jeecgNoteList2");
/* */ }
/* */
/* */ @RequestMapping(params={"datagrid"})
/* */ public void datagrid(JeecgNoteEntity jeecgNote, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid)
/* */ {
/* 79 */ CriteriaQuery cq = new CriteriaQuery(JeecgNoteEntity.class, dataGrid);
/* */
/* 81 */ HqlGenerateUtil.installHql(cq, jeecgNote);
/* 82 */ this.jeecgNoteService.getDataGridReturn(cq, true);
/* 83 */ TagUtil.datagrid(response, dataGrid);
/* */ }
/* */
/* */ @RequestMapping(params={"del"})
/* */ @ResponseBody
/* */ public AjaxJson del(JeecgNoteEntity jeecgNote, HttpServletRequest request)
/* */ {
/* 94 */ String message = null;
/* 95 */ AjaxJson j = new AjaxJson();
/* 96 */ jeecgNote = (JeecgNoteEntity)this.systemService.getEntity(JeecgNoteEntity.class, jeecgNote.getId());
/* 97 */ message = "删除成功";
/* 98 */ this.jeecgNoteService.delete(jeecgNote);
/* 99 */ this.systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
/* */
/* 101 */ j.setMsg(message);
/* 102 */ return j;
/* */ }
/* */
/* */ @RequestMapping(params={"save"})
/* */ @ResponseBody
/* */ public AjaxJson save(JeecgNoteEntity jeecgNote, HttpServletRequest request)
/* */ {
/* 115 */ String message = null;
/* 116 */ AjaxJson j = new AjaxJson();
/* 117 */ if (StringUtil.isNotEmpty(jeecgNote.getId())) {
/* 118 */ message = "更新成功";
/* 119 */ this.jeecgNoteService.saveOrUpdate(jeecgNote);
/* 120 */ this.systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
/* */ } else {
/* 122 */ message = "添加成功";
/* 123 */ this.jeecgNoteService.save(jeecgNote);
/* 124 */ this.systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
/* */ }
/* */
/* 127 */ return j;
/* */ }
/* */
/* */ @RequestMapping(params={"addorupdate"})
/* */ public ModelAndView addorupdate(JeecgNoteEntity jeecgNote, HttpServletRequest req)
/* */ {
/* 137 */ if (StringUtil.isNotEmpty(jeecgNote.getId())) {
/* 138 */ jeecgNote = (JeecgNoteEntity)this.jeecgNoteService.getEntity(JeecgNoteEntity.class, jeecgNote.getId());
/* 139 */ req.setAttribute("jeecgNotePage", jeecgNote);
/* */ }
/* 141 */ return new ModelAndView("jeecg/demo/test/jeecgNote");
/* */ }
/* */
/* */ @RequestMapping(params={"addorupdate2"})
/* */ public ModelAndView addorupdate2(JeecgNoteEntity jeecgNote, HttpServletRequest req)
/* */ {
/* 152 */ if (StringUtil.isNotEmpty(jeecgNote.getId())) {
/* 153 */ jeecgNote = (JeecgNoteEntity)this.jeecgNoteService.getEntity(JeecgNoteEntity.class, jeecgNote.getId());
/* 154 */ req.setAttribute("jeecgNotePage", jeecgNote);
/* */ }
/* 156 */ return new ModelAndView("jeecg/demo/test/jeecgNote2");
/* */ }
/* */
/* */ @RequestMapping(params={"addorupdateNoBtn"})
/* */ public ModelAndView addorupdateNoBtn(JeecgNoteEntity jeecgNote, HttpServletRequest req)
/* */ {
/* 166 */ if (StringUtil.isNotEmpty(jeecgNote.getId())) {
/* 167 */ jeecgNote = (JeecgNoteEntity)this.jeecgNoteService.getEntity(JeecgNoteEntity.class, jeecgNote.getId());
/* 168 */ req.setAttribute("jeecgNotePage", jeecgNote);
/* */ }
/* 170 */ return new ModelAndView("jeecg/demo/test/jeecgNoteNoBtn");
/* */ }
/* */ }
/* Location: D:\用户目录\我的文档\Tencent Files\863916185\FileRecv\nx.zip
* Qualified Name: ROOT.WEB-INF.classes.org.jeecgframework.web.demo.controller.test.JeecgNoteController
* JD-Core Version: 0.6.2
*/ | [
"liufeng45gh@163.com"
] | liufeng45gh@163.com |
ff57fd4ce3ff3de1b16a2f0ce302eac40501fa9b | e30b772879e9996fc9d0bc791834517bafdcb904 | /Coding-Interview-Patterns/08 Tree DFS/PathWithGivenSequence.java | e7b15ecf7d5cbd96df766e7db7b1a69360224a74 | [] | no_license | RiversHyioh/coding-interview | 3921af48f43f319aeed21a8807de7460ac7195ed | 3e0e81889fdf46ba8cc7291d0317e1af3b9b189b | refs/heads/master | 2023-06-29T09:49:40.180603 | 2019-09-07T06:26:43 | 2019-09-07T06:26:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java |
/*
Pattern: Tree DFS
04 Path With Given Sequence (medium)
Given a binary tree and a number sequence,
find if the sequence is present as a root-to-leaf path in the given tree.
*/
import java.util.*;
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int val){
this.val = val;
}
};
class PathWithGivenSequence {
public static boolean findPath(TreeNode root, int[] sequence){
if(root==null) return sequence.length == 0;
return recursivePath(root,0,sequence);
}
private static boolean recursivePath(TreeNode root, int level, int[] sequence){
if(root==null) return false;
if(level > sequence.length-1 || root.val != sequence[level]) return false;
if(root.left == null && root.right == null && level == sequence.length-1){
return true;
}
return recursivePath(root.left, level+1, sequence) || recursivePath(root.right, level+1, sequence);
}/*
Time Complexity: O(N) where N is the total number of nodes in the tree
Space Complexity: O(N) ; recursion stack
*/
public static void main(String[] args) {
TreeNode root = new TreeNode(1);
root.left = new TreeNode(0);
root.right = new TreeNode(1);
root.left.left = new TreeNode(1);
root.right.left = new TreeNode(6);
root.right.right = new TreeNode(5);
System.out.println("Tree has path sequence: " + PathWithGivenSequence.findPath(root, new int[] { 1, 0, 7 }));
System.out.println("Tree has path sequence: " + PathWithGivenSequence.findPath(root, new int[] { 1, 1, 6 }));
}
}
| [
"juncr1719@gmail.com"
] | juncr1719@gmail.com |
45dd9208a5282eb5df9003038762c2778c5562c6 | 58da62dfc6e145a3c836a6be8ee11e4b69ff1878 | /src/main/java/com/alipay/api/domain/MarketResult.java | c0075ce48f954e2d678cdcb71dd00b69866e90f1 | [
"Apache-2.0"
] | permissive | zhoujiangzi/alipay-sdk-java-all | 00ef60ed9501c74d337eb582cdc9606159a49837 | 560d30b6817a590fd9d2c53c3cecac0dca4449b3 | refs/heads/master | 2022-12-26T00:27:31.553428 | 2020-09-07T03:39:05 | 2020-09-07T03:39:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,030 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 营销结果类型
*
* @author auto create
* @since 1.0, 2020-08-18 14:29:56
*/
public class MarketResult extends AlipayObject {
private static final long serialVersionUID = 7225861517686998798L;
/**
* 营销信息列表
*/
@ApiListField("price_detail_list")
@ApiField("price_detail_d_t_o")
private List<PriceDetailDTO> priceDetailList;
/**
* 用于区分营销场景,例如打车星巴克
*/
@ApiField("scene")
private String scene;
public List<PriceDetailDTO> getPriceDetailList() {
return this.priceDetailList;
}
public void setPriceDetailList(List<PriceDetailDTO> priceDetailList) {
this.priceDetailList = priceDetailList;
}
public String getScene() {
return this.scene;
}
public void setScene(String scene) {
this.scene = scene;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
090c4ee7303b5b262a19ede7843fd4b4e0676368 | 2f5041e5971fd9b860bbb6c8a53498cc3a16e3c3 | /src/main/java/com/twitchbot/commandadapter/config/MyResourceConfig.java | 1d78e375baaa032a546a8e8ecde0181230283944 | [] | no_license | amstevenson/command-adapter | 220815f6c3b1f1b525a8a412e08669cf01654f66 | c919e95b7ae8db21c701dfda365a37f3c0a472f5 | refs/heads/master | 2023-01-12T19:50:18.672292 | 2020-11-19T17:47:08 | 2020-11-19T17:47:08 | 263,117,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.twitchbot.commandadapter.config;
import com.fasterxml.jackson.jaxrs.xml.JacksonXMLProvider;
import com.twitchbot.commandadapter.endpoints.CommandAdapterResource;
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.stereotype.Component;
@Component
public class MyResourceConfig extends ResourceConfig {
public MyResourceConfig() {
registerEndpoints();
}
private void registerEndpoints() {
// Register all endpoint classes.
register(CommandAdapterResource.class);
// Register the Jackson XML serializer class.
register(JacksonXMLProvider.class);
// Register the CORS filter, to permit cross-origin requests.
register(MyCorsFilter.class);
}
}
| [
"addstevenson@hotmail.com"
] | addstevenson@hotmail.com |
86a67df1bebabad9dd633c0138dcad4e57e38c08 | a666408d5cf72e838b1a1f6ce757e3f9cee48b94 | /spring-boot-train/src/main/java/luxe/chaos/train/springboottrain/config/ShutdownConfig.java | 8284246bae18a18fc1eb10c185ed48c3d30e7e9b | [] | no_license | chengchaos/spring-cloud-demo | d3b8b612882d3dc51819735c60866bdd9dd71689 | 375d7ea4089afab6c26963ba4c51a46a74b9dd8f | refs/heads/master | 2022-10-10T18:10:31.426007 | 2021-01-09T13:09:12 | 2021-01-09T13:09:12 | 157,049,490 | 1 | 0 | null | 2022-07-01T17:41:05 | 2018-11-11T05:11:29 | Java | UTF-8 | Java | false | false | 829 | java | package luxe.chaos.train.springboottrain.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Configuration
public class ShutdownConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(ShutdownConfig.class);
@Bean
public TerminateBean terminateBean() {
return new TerminateBean();
}
public static class TerminateBean {
@PostConstruct
public void postConstruct() {
LOGGER.warn("TerminateBean is Construct! ");
}
@PreDestroy
public void preDestroy() {
LOGGER.warn("TerminateBean is Destroyed! ");
}
}
}
| [
"chengchaos@outlook.com"
] | chengchaos@outlook.com |
c3a5acf5cec836e27caaabb6a0795ce23721daff | 8d69a58bd9f94be9a52b80a9ddbe104e60d172eb | /Android/SaigonBus/src/cse/it/StationBus.java | 691ab28d178390cfb3018e133c460a43ab5988fa | [] | no_license | qknguyen29/nothing | 5b12167f12e2edaaa734b9da29ac101915ec1de9 | 527d4225959749744c3d7d43653814b7f613b20c | refs/heads/master | 2021-05-29T05:54:15.350528 | 2011-12-21T12:14:49 | 2011-12-21T12:14:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,454 | java | package cse.it;
import cse.it.parse.ParsedData;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
public class StationBus extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.currenttrip);
TuyenXeAdapter tripAdapter = new TuyenXeAdapter(this);
setListAdapter(tripAdapter);
}
private static class TuyenXeAdapter extends BaseAdapter {
private LayoutInflater mInflater;
public TuyenXeAdapter(Context mContext){
mInflater = LayoutInflater.from(mContext);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
if (ParsedData.tuyenXe != null) {
return ParsedData.tuyenXe.size();
}
return 0;
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
if (ParsedData.tuyenXe != null) {
return ParsedData.tuyenXe.get(arg0);
}
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if (convertView == null) {
convertView = mInflater.inflate(R.layout.trip_item, parent, false);
}
ImageView imageTrip = (ImageView)convertView.findViewById(R.id.IconList);
imageTrip.setBackgroundResource(R.drawable.iconcurrenttrip);
((TextView) convertView.findViewById(R.id.TextList2)).setText((ParsedData.tuyenXe.get(position)).ten_tuyen);
return convertView;
}
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
Intent intent = new Intent(StationBus.this, Lotrinh.class);
if (!ParsedData.tuyenXe.get(position).huong_di.equals("") ) {
intent.putExtra("POS_LOTRINH", position);
startActivity(intent);
}
else{
ToastUtil.show(this, "No Imformation");
}
}
}
| [
"huan.nguyen.playsoft@gmail.com@2bc8c6d5-3856-c8d3-fefc-b7de2eff6da5"
] | huan.nguyen.playsoft@gmail.com@2bc8c6d5-3856-c8d3-fefc-b7de2eff6da5 |
ff90a7198cfe9323cbc1462f0d07d31e6013fc26 | bf183f87af9b961075883d1f1b67328910c00b24 | /src/SerializableText.java | edfc16fd33797f6b41ab6224f88afa487d285cdf | [] | no_license | varunm100/P2P-Network | b45f0c8c7388bff6a525ab980157c628a5149485 | 6a546afcf5569e93600574aa87918fb212d3be65 | refs/heads/master | 2021-09-19T02:33:53.718648 | 2018-06-24T11:04:27 | 2018-06-24T11:04:27 | 136,718,870 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | /*
* @author Varun on 6/17/2018
* @project P2P-Network
*/
import java.io.Serializable;
import java.time.Clock;
import java.time.LocalTime;
class SerializableText implements Serializable {
private static final long serialVersionUID = 3304191093637654272L;
String source;
LocalTime timeStamp;
String text;
/**
* Object used to send String data.
*
* @param _text String data.
* @param _source IP address of source peer.
*/
SerializableText(String _text, String _source) {
text = _text;
source = _source;
timeStamp = LocalTime.now(Clock.systemUTC());
}
}
| [
"varunm100@gmail.com"
] | varunm100@gmail.com |
af3c51260a415d6e18a542342976bc166416de92 | 85d9a090e2f6a8bb8cc769a3b599c5bff4f8937c | /src/com/inori/everyday/$365_MeasureWater.java | 5f887ad4618711e1c869472ef702ce3408f64965 | [] | no_license | yinjk/leetcode | fa2d752aad9e6f32ccd5a78e0782caad050f2c52 | 8855887de16c5d6d136e341446778f84d6c929ac | refs/heads/master | 2023-02-07T11:55:43.942397 | 2021-01-05T07:56:46 | 2021-01-05T07:56:46 | 326,925,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,551 | java | package com.inori.everyday;
/**
* $365_MeasureWater [Medium]
* <p>
* 有两个容量分别为 x升 和 y升 的水壶以及无限多的水。请判断能否通过使用这两个水壶,从而可以得到恰好 z升 的水?
* <p>
* 如果可以,最后请用以上水壶中的一或两个来盛放取得的 z升 水。
* <p>
* 你允许:
* <p>
* 装满任意一个水壶
* 清空任意一个水壶
* 从一个水壶向另外一个水壶倒水,直到装满或者倒空
* 示例 1: (From the famous "Die Hard" example)
* <p>
* 输入: x = 3, y = 5, z = 4
* 输出: True
* 示例 2:
* <p>
* 输入: x = 2, y = 6, z = 5
* 输出: False
*
* @author inori
* @date 2020/3/21
*/
public class $365_MeasureWater {
/**
* 数学解法,感觉智商被按在了地上摩擦
* 官方题解:https://leetcode-cn.com/problems/water-and-jug-problem/solution/shui-hu-wen-ti-by-leetcode-solution/
*
* @param x 水壶1
* @param y 水壶2
* @param z 预期值
* @return 是否能得到预期值
*/
public boolean canMeasureWater(int x, int y, int z) {
if (x + y < z) return false;
if (x == 0 || y == 0) return z == 0 || z == x + y;
return z % gcd(x, y) == 0;
}
public long gcd(long a, long b) {
return (b == 0) ? a : gcd(b, a % b);
}
public static void main(String[] args) {
System.out.println(new $365_MeasureWater().canMeasureWater(3, 5, 4));
System.out.println(new $365_MeasureWater().canMeasureWater(2, 6, 5));
}
}
| [
"inori.yinjk@gmail.com"
] | inori.yinjk@gmail.com |
7019f5edc7fd9ed628a358e739f390f4a5052d68 | abf36d6182712a1be4f8cda5e7267faf3049257f | /test.java | 5b9db09deb589dcaf5daf00cabaaa8dc91b55fed | [] | no_license | kushraj1204/Face-recognition | debe8d4ede5bc450c19fdb0d2c37013f1ce39168 | b0c87269a68bfa33dfe2f4bee2e74bde3b0fd3a0 | refs/heads/master | 2021-04-15T09:50:25.939335 | 2018-03-25T04:56:36 | 2018-03-25T04:56:36 | 126,665,742 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,672 | 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 frcopy;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import static java.lang.System.exit;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
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.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import static javax.swing.JOptionPane.showMessageDialog;
/**
*
* @author Kush
*/
public class test{
private Connection con;//to connect to mysql database
private Statement st;//to execute queries
private ResultSet rs;//to hold returned results
public test() throws SQLException{
int i,j,gray;
try{
Class.forName("com.mysql.jdbc.driver");
}
catch(Exception e){
System.out.println("abc");
System.out.println(e);
//exit(0);
System.out.println("abc");
}
try {
con= DriverManager.getConnection("jdbc:mysql://localhost:3306/face","root","");
st=con.createStatement();
} catch (SQLException ex) {
Logger.getLogger(connection.class.getName()).log(Level.SEVERE, null, ex);
showMessageDialog(null,"Please ensure your database connection first");
exit(0);
}
DatabaseMetaData dbm = con.getMetaData();
// check if "employee" table is there
ResultSet tables = dbm.getTables(null, null, "average", null);
if (tables.next()) {
// Table exists
System.out.println("hello baby");
}
else {
String query="create table if not exists average( averageimage longblob, number INT(6) )";
PreparedStatement pstmt = con.prepareStatement(query);
// set parameter;
//pstmt.setInt(1, candidateId);
boolean t= pstmt.execute();
float[][] avg=new float[250][250];
try {
BufferedImage theImage = new BufferedImage(250, 250, BufferedImage.TYPE_BYTE_GRAY);
for( i=0; i<250; i++) {
for( j=0; j<250; j++) {
gray=0;//System.out.println(avg[i][j]);
avg[i][j] = ((gray<<16) |(gray<<8) | gray );
theImage.setRGB(i,j, (int) avg[i][j]);
}
}
File output = new File("GrayScale.jpg");
ImageIO.write(theImage, "jpg", output);
System.out.println("banaiyo");
File imgfile = new File("GrayScale.jpg");
//BufferedImage image = ImageIO.read(imgfile);
FileInputStream fin = new FileInputStream(imgfile);
String query1="insert into average (averageimage, number) values(?,?)";
pstmt = con.prepareStatement(query1);
pstmt.setBinaryStream(1,(InputStream)fin,(int)imgfile.length());
pstmt.setInt(2,0);
pstmt.executeUpdate();
// System.out.println(a);
System.out.println("Successfully operated into the database!");
// set parameter;
//pstmt.setInt(1, candidateId);
// boolean t= pstmt.execute();
}
catch(Exception e) {}
// Table does not exist
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e1791b3728c9c9e6fc8bbe8f3f9dc69d6cd0ed0a | 8d168a2fec57864941753ae90d7303520d44f17c | /src/main/java/com/lewyon/template/controller/UserController.java | 143bf85f33ab0ae65154345ddb6da43fd4d23c93 | [] | no_license | akari16/springboot-template-lewyon | 781f2e8f3c169d653036c7efb31cccf0808006f2 | ddaee734955a6588d769774d6dbed21425b52c97 | refs/heads/main | 2023-09-03T18:00:23.467734 | 2021-10-10T14:11:50 | 2021-10-10T14:11:50 | 409,116,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,156 | java | package com.lewyon.template.controller;
import com.lewyon.template.entity.User;
import com.lewyon.template.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@Api(tags = "用户管理")
@RestController
@RequestMapping(value = "/user") // 通过这里配置使下面的映射都在/users下
public class UserController {
// 创建线程安全的Map,模拟users信息的存储
@Autowired
private UserService userService;
@ApiOperation(value = "查询所有用户")
@GetMapping(value = "/allUser")
public List<User> getAllUser() {
List<User> users = userService.getAllUser();
return users;
}
//
// /**
// * 处理"/users/"的POST请求,用来创建User
// *
// * @param user
// * @return
// */
// @PostMapping("/")
// @ApiOperation(value = "创建用户", notes = "根据User对象创建用户")
// public String postUser(@RequestBody User user) {
// // @RequestBody注解用来绑定通过http请求中application/json类型上传的数据
// users.put(user.getId(), user);
// return "success";
// }
//
// /**
// * 处理"/users/{id}"的GET请求,用来获取url中id值的User信息
// *
// * @param id
// * @return
// */
// @GetMapping("/{id}")
// @ApiOperation(value = "获取用户详细信息", notes = "根据url的id来获取用户详细信息")
// public User getUser(@PathVariable Long id) {
// // url中的id可通过@PathVariable绑定到函数的参数中
// return users.get(id);
// }
//
// /**
// * 处理"/users/{id}"的PUT请求,用来更新User信息
// *
// * @param id
// * @param user
// * @return
// */
// @PutMapping("/{id}")
// @ApiImplicitParam(paramType = "path", dataType = "Long", name = "id", value = "用户编号", required = true, example = "1")
// @ApiOperation(value = "更新用户详细信息", notes = "根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息")
// public String putUser(@PathVariable Long id, @RequestBody User user) {
// User u = users.get(id);
// u.setName(user.getName());
// u.setAge(user.getAge());
// users.put(id, u);
// return "success";
// }
//
// /**
// * 处理"/users/{id}"的DELETE请求,用来删除User
// *
// * @param id
// * @return
// */
// @DeleteMapping("/{id}")
// @ApiOperation(value = "删除用户", notes = "根据url的id来指定删除对象")
// public String deleteUser(@PathVariable Long id) {
// users.remove(id);
// return "success";
// }
//使用另外一个路径处理user相关接口
//
// private UserService userService;
//
// @GetMapping("/getUser")
// @ApiOperation(value = "获取用户列表")
// public List<User> getAllUser() {
// List<User> users = userService.getAllUser();
// return users;
// }
}
| [
"akari16@163.com"
] | akari16@163.com |
c5b4f17b755af98c5c9aa1deb0537f3c0ceaac81 | 932bd0d41f21f74d453f7237583daf3565ba5b1c | /src/main/java/com/bizhibihui/ordermeal/annotation/Cache.java | 9f27aa7e4cf52615992955ceb55d6716399ae0af | [] | no_license | chengrongkai/ordermeal | be60177e1e5596dba19ca40b49e0b09371c002f7 | 0b079b2f8a0d9fc534b6597a1290f4326df23301 | refs/heads/master | 2022-11-29T16:28:12.298272 | 2020-08-11T01:26:07 | 2020-08-11T01:26:07 | 286,615,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package com.bizhibihui.ordermeal.annotation;
import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;
/**
* Redis缓存自定义注解
*
* @author LinZhaoguan
* @version V1.0
* @date 2019年9月11日
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Cache {
/**
* 业务的名称
*/
String value() default "";
/**
* redis缓存的Key(默认类名-方法名-自定义key)
*/
String key() default "";
/**
* 是否刷新缓存,默认false
*/
boolean flush() default false;
/**
* 缓存失效时间,默认30
*/
long expire() default 30L;
/**
* 缓存时间单位,默认天
*/
TimeUnit unit() default TimeUnit.DAYS;
}
| [
"crk@jianzhimao.com"
] | crk@jianzhimao.com |
c37f0f8c98c1810988049ca6b0eef42aec720c4f | f76f1f306c7f68c34e8edc0225a1d404a0aa3897 | /app/src/main/java/com/google/android/gms/games/leaderboard/OnLeaderboardMetadataLoadedListener.java | bbb27d17266b520831bacf5b16b829ea46a756fc | [] | no_license | Bingle-labake/Vine15 | b8a2852bf43e295a63c976d2fa263b301036807d | b75665ff848df0d526ec0f26d64516629c150b33 | refs/heads/master | 2016-09-01T05:59:05.804172 | 2015-10-31T07:40:04 | 2015-10-31T07:40:04 | 45,291,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package com.google.android.gms.games.leaderboard;
public abstract interface OnLeaderboardMetadataLoadedListener
{
public abstract void onLeaderboardMetadataLoaded(int paramInt, LeaderboardBuffer paramLeaderboardBuffer);
}
/* Location: /Users/dantheman/src/android/decompiled/vine-decompiled/dex2jar/classes-dex2jar.jar
* Qualified Name: com.google.android.gms.games.leaderboard.OnLeaderboardMetadataLoadedListener
* JD-Core Version: 0.6.2
*/ | [
"coollive@labake.cn"
] | coollive@labake.cn |
d158e93ae11abe5bb4b8c0cb9f932ce89d51a118 | e7e12a2a6fdc2eeec9bc5bef0b80bb60265435d0 | /src/main/java/com/risk/model/Employee.java | 117dc4b097d88e3e6e0af9e4b4a8f4c4ca90bb5a | [] | no_license | anshumanthakur/SpringMVC_sample | 638dae7a576cf548ce37cb9a0e785697d454aeb9 | 3e68d889bc4f31d7e3c89b7273eb2c2d40c44a26 | refs/heads/master | 2022-12-22T20:08:27.541710 | 2020-03-18T18:48:32 | 2020-03-18T18:48:32 | 201,968,473 | 0 | 1 | null | 2022-12-16T04:24:13 | 2019-08-12T16:30:20 | Java | UTF-8 | Java | false | false | 2,201 | java | package com.risk.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotEmpty;
import com.risk.validator.IsEmailValid;
import com.risk.validator.IsPasswordValid;
import com.risk.validator.IsPhoneNumberValid;
@Entity
@Table(name = "EmployeeDetails")
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int employeeId;
@NotEmpty
@Pattern(regexp = "^[A-Za-z][^0-9,@#$%&(!)]+")
@Size(min = 5, max = 50)
private String name;
@Min(value = 18)
@Max(value = 100)
@NotNull
private Integer age;
@IsEmailValid /* @UniqueEmail */
private String email;
@IsPhoneNumberValid
private String phone;
@NotEmpty
@IsPasswordValid
private String password;
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Employee(int employeeId, String name, Integer age, String email, String phone, String password) {
super();
this.employeeId = employeeId;
this.name = name;
this.age = age;
this.email = email;
this.phone = phone;
this.password = password;
}
public Employee() {
}
/*
*
* @NotEmpty
*
*
*
* private String confirm_password;
*
*/
} | [
"Anshuman.Thakur@thomsonreuters.com"
] | Anshuman.Thakur@thomsonreuters.com |
b070a5baf77c595ae6548cfa543817afd45d0ae3 | 15dbef9c49e805ed1dc2ff7c21f3650a43e98694 | /app/src/main/java/kmutnb/yuwadee/srisawat/carpool/MyOpenHelper.java | 746ca7737eefd18d5f1695b4423d0fee1d643f2c | [] | no_license | YuwadeeSrisawat/CarPool | 5e2202162a19d3fe49c36a2c297b239b14c37585 | 49dbf0bd1828df9bb34362de6c0fbf7ec17a31c3 | refs/heads/master | 2021-03-12T22:23:29.108528 | 2015-10-13T04:11:42 | 2015-10-13T04:11:42 | 40,469,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package kmutnb.yuwadee.srisawat.carpool;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Adminn on 10/8/2558.
*/
public class MyOpenHelper extends SQLiteOpenHelper{
private static final String DATABASE_NAME = "CarPool.db";
private static final int DATABASE_VERSION = 1;
private static final String CREATE_USER_CAR = "create table carUserTABLE (_id integer primary key, User text, Password text, Name text, Surname text, CarID text, Picture text, id_office text);";
private static final String CREATE_USER_PASSENGER = "create table passengerUserTABLE (_id integer primary key, User text, Password text,Name text, Surname text,Address text, Phone text);";
private static final String CREATE_MAPS = "create table mapsTABLE (_id integer primary key,Name text, Surname text, Icon text, Lat text, Lng text ,Date text);";
public MyOpenHelper(Context context) {
super(context, DATABASE_NAME, null,DATABASE_VERSION);
} //Constructor
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_USER_CAR);
db.execSQL(CREATE_USER_PASSENGER);
db.execSQL(CREATE_MAPS);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
} //Main Class
| [
"myfriendjoyjoy@gmail.com"
] | myfriendjoyjoy@gmail.com |
7b981da16e4c3a5dda33318ae107161f936cd418 | ec41f0808dd173d0658dd879dfe03a8720ae35e4 | /javaworkshop/src/main/java/org/workshop1/database/DatabaseConnector.java | ae91ef4c7b46d422415a89a5893aa02dfdba6020 | [] | no_license | javaworkshop/workshop1 | 6f56ab67574b6546a7845d61177bdc5bc73eec03 | a3288faceb992d1a8f77355d91cfa92716f76116 | refs/heads/master | 2020-06-08T10:24:23.259577 | 2015-09-08T16:58:21 | 2015-09-08T16:58:21 | 40,079,970 | 0 | 2 | null | 2015-09-10T06:47:36 | 2015-08-02T13:20:53 | Java | UTF-8 | Java | false | false | 39,385 | java | package org.workshop1.database;
import com.mchange.v2.c3p0.DataSources;
import com.sun.rowset.JdbcRowSetImpl;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.sql.DataSource;
import javax.sql.RowSet;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.workshop1.dao.BestellingDao;
import org.workshop1.dao.DaoConfigurationException;
import org.workshop1.dao.DaoException;
import org.workshop1.dao.DaoFactory;
import org.workshop1.dao.KlantDao;
import org.workshop1.model.Artikel;
import org.workshop1.model.Bestelling;
import org.workshop1.model.Data;
import org.workshop1.model.Klant;
import org.workshop1.model.QueryResult;
import org.workshop1.model.QueryResultRow;
/**
* Class that establishes and maintains a connection with the database and through which all sql
* operations are processed.
*/
public class DatabaseConnector {
public static final byte C3P0_DATASOURCE = 2;
public static final String C3P0_DRIVER_FIREBIRD = "org.firebirdsql.jdbc.FBDriver";
public static final String C3P0_DRIVER_MYSQL = "com.mysql.jdbc.Driver";
public static final byte STORAGE_MYSQL = 1;
public static final byte STORAGE_FIREBIRD = 2;
public static final byte STORAGE_XML = 3; // nodig in deze klasse?
public static final byte STORAGE_JSON = 4;// nodig in deze klasse?
public static final byte HIKARI_CP_DATASOURCE = 1;
public static final String HIKARI_CP_DRIVER_FIREBIRD =
"org.firebirdsql.pool.FBSimpleDataSource";
public static final String HIKARI_CP_DRIVER_MYSQL =
"com.mysql.jdbc.jdbc2.optional.MysqlDataSource";
private DataSource dataSource = null;
private SessionFactory sessionFactory;
private byte storageType;
private byte dataSourceType;
private String driver;
private boolean isInitialized;
private final Logger logger = LoggerFactory.getLogger(DatabaseConnector.class);
private String password;
private String url;
private String username;
private boolean hibernate;
/**
* Adds the given artikel to the database. It is stored as part of the bestelling that has the
* same value for bestelling id as the Artikel object.
* @param a the artikel to be added
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void addArtikel(Artikel a) throws SQLException, DatabaseException {
String artikelUpdateCode = SqlCodeGenerator.generateArtikelUpdateCode(a);
logger.debug(artikelUpdateCode);
executeCommand(artikelUpdateCode);
}
/**
* Adds the given bestelling to the database. The bestellling id (primary key) is generated
* automatically by the database.
* @param b the bestelling to be added
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void addBestelling(Bestelling b) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
Connection connection = null;
if(dataSource != null)
connection = dataSource.getConnection();
try(BestellingDao bDao = createBestellingDao(connection)) {
bDao.add(b);
}
catch(DaoException | DaoConfigurationException ex) {
throw new DatabaseException("Bestelling toevoegen mislukt.", ex);
}
}
/**
* Adds the given klant to the database. The klant id (primary key) is generated automatically
* by the database.
* @param k the klant to be added
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void addKlant(Klant k) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
Connection connection = null;
if(dataSource != null)
connection = dataSource.getConnection();
try(KlantDao kDao = createKlantDao(connection)) {
kDao.add(k);
}
catch(DaoException | DaoConfigurationException ex) {
throw new DatabaseException("Klant toevoegen mislukt.", ex);
}
}
/**
* Inserts an array of klanten into the database using a batch statement.
* @param klanten the array of klanten to be inserted
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void batchInsertion(Klant[] klanten) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
try(Connection con = dataSource.getConnection();
Statement statement = con.createStatement()
) {
for(Klant klant : klanten)
statement.addBatch(SqlCodeGenerator.generateKlantInsertionCode(klant));
statement.executeBatch();
}
}
/**
* Updates the database tables with the values contained in the Data objects in the given
* ArrayList using a batch statement.
* @param data the ArrayList containing the new values
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void batchUpdate(ArrayList<Data> data) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
try(Connection con = dataSource.getConnection();
Statement statement = con.createStatement()
) {
for(Data d : data) {
if(d instanceof Klant) {
if(((Klant)d).getKlant_id() != 0)
statement.addBatch(SqlCodeGenerator.
generateKlantUpdateCode(((Klant)d)));
}
else //if(d instanceof Bestelling)
if(((Bestelling)d).getBestelling_id() != 0)
statement.addBatch(SqlCodeGenerator.
generateBestellingUpdateCode(((Bestelling)d)));
}
statement.executeBatch();
}
}
/**
* Removes all data from the database. Tables still exist afterwards, except now they're empty.
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void clearDatabase() throws SQLException,
DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
executeCommand("DELETE FROM bestelling");
executeCommand("DELETE FROM klant");
executeCommand("ALTER TABLE klant AUTO_INCREMENT = 1");
executeCommand("ALTER TABLE bestelling AUTO_INCREMENT = 1;");
logger.info("database tabellen leeggemaakt");
}
/**
* Initializes connection to database. Before this method is run driver, url, username, and
* password should be set using the appropriate setter methods.
* @throws DatabaseException thrown if driver could not be loaded
* @throws SQLException
*/
public void connectToDatabase() throws DatabaseException, SQLException {
if(dataSourceType == HIKARI_CP_DATASOURCE) {
if(hibernate) {
Configuration cfg = new Configuration()
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect")
.setProperty("hibernate.connection.driver_class", HIKARI_CP_DRIVER_MYSQL) // Misschien moet dit de driver zijn en niet de datasource
.setProperty("hibernate.connection.url", url)
.setProperty("hibernate.connection.username", username)
.setProperty("hibernate.connection.password", password)
.setProperty("hibernate.connection.provider_class",
"org.hibernate.hikaricp.internal.HikariCPConnectionProvider"); // Alternatief: com.zaxxer.hikari.hibernate.HikariConnectionProvider
SessionManager.initialize(cfg);
}
else
setUpHikariCPDataSource();
}
else/*if(dataSourceType == C3P0_DATASOURCE)*/
setUpC3p0DataSource();
logger.info("Database setup data: driver = " + driver + ", url = " + url
+ ", data source = " + (dataSourceType == HIKARI_CP_DATASOURCE ? "Hikari CP" :
"C3P0") + ", username = " + username + ", password = " + password);
isInitialized = true;
}
// De switch in deze methode is niet zo mooi (erg lang). Misschien is er een betere manier?
/**
* Retrieves results from the last executed query from rowSet and stores them in a QueryResult
* object.
* @return the QueryResult object containing retrieved data
* @throws SQLException
*/
private QueryResult createQueryResult(RowSet rowSet) throws SQLException {
int columnCount = rowSet.getMetaData().getColumnCount();
String[] columnNames = new String[columnCount];
for(int i = 0; i < columnNames.length; i ++)
columnNames[i] = rowSet.getMetaData().getColumnName(i + 1).toLowerCase();
QueryResult queryResult = new QueryResult();
while(rowSet.next()) {
QueryResultRow row = new QueryResultRow();
for(int i = 1; i <= columnCount; i++) {
switch (columnNames[i-1]) {
// klant kolommen
case "klant_id":
row.getKlant().setKlant_id(rowSet.getInt(i));
row.getBestelling().setKlant_id(rowSet.getInt(i));
queryResult.addColumnName("klant_id");
break;
case "voornaam":
row.getKlant().setVoornaam(rowSet.getString(i));
queryResult.addColumnName("voornaam");
break;
case "tussenvoegsel":
row.getKlant().setTussenvoegsel(rowSet.getString(i));
queryResult.addColumnName("tussenvoegsel");
break;
case "achternaam":
row.getKlant().setAchternaam(rowSet.getString(i));
queryResult.addColumnName("achternaam");
break;
case "email":
row.getKlant().setEmail(rowSet.getString(i));
queryResult.addColumnName("email");
break;
case "straatnaam":
row.getKlant().setStraatnaam(rowSet.getString(i));
queryResult.addColumnName("straatnaam");
break;
case "huisnummer":
row.getKlant().setHuisnummer(rowSet.getInt(i));
queryResult.addColumnName("huisnummer");
break;
case "toevoeging":
row.getKlant().setToevoeging(rowSet.getString(i));
queryResult.addColumnName("toevoeging");
break;
case "postcode":
row.getKlant().setPostcode(rowSet.getString(i));
queryResult.addColumnName("postcode");
break;
case "woonplaats":
row.getKlant().setWoonplaats(rowSet.getString(i));
queryResult.addColumnName("woonplaats");
break;
// bestelling kolommen
case "bestelling_id":
row.getBestelling().setBestelling_id(rowSet.getInt(i));
queryResult.addColumnName("bestelling_id");
break;
case "artikel_id1":
row.getBestelling().setArtikel_id1(rowSet.getInt(i));
queryResult.addColumnName("artikel_id1");
break;
case "artikel_id2":
row.getBestelling().setArtikel_id2(rowSet.getInt(i));
queryResult.addColumnName("artikel_id2");
break;
case "artikel_id3":
row.getBestelling().setArtikel_id3(rowSet.getInt(i));
queryResult.addColumnName("artikel_id3");
break;
case "artikel_naam1":
row.getBestelling().setArtikel_naam1(rowSet.getString(i));
queryResult.addColumnName("artikel_naam1");
break;
case "artikel_naam2":
row.getBestelling().setArtikel_naam2(rowSet.getString(i));
queryResult.addColumnName("artikel_naam2");
break;
case "artikel_naam3":
row.getBestelling().setArtikel_naam3(rowSet.getString(i));
queryResult.addColumnName("artikel_naam3");
break;
case "artikel_aantal1":
row.getBestelling().setArtikel_aantal1(rowSet.getInt(i));
queryResult.addColumnName("artikel_aantal1");
break;
case "artikel_aantal2":
row.getBestelling().setArtikel_aantal2(rowSet.getInt(i));
queryResult.addColumnName("artikel_aantal2");
break;
case "artikel_aantal3":
row.getBestelling().setArtikel_aantal3(rowSet.getInt(i));
queryResult.addColumnName("artikel_aantal3");
break;
case "artikel_prijs1":
row.getBestelling().setArtikel_prijs1(rowSet.getDouble(i));
queryResult.addColumnName("artikel_prijs1");
break;
case "artikel_prijs2":
row.getBestelling().setArtikel_prijs2(rowSet.getDouble(i));
queryResult.addColumnName("artikel_prijs2");
break;
case "artikel_prijs3":
row.getBestelling().setArtikel_prijs3(rowSet.getDouble(i));
queryResult.addColumnName("artikel_prijs3");
break;
}
}
queryResult.addRow(row);
}
return queryResult;
}
private RowSet createRowSet(String query) throws SQLException {
//RowSetFactory rowSetFactory = RowSetProvider.newFactory(); Hoe te combineren met DataSource?
//JdbcRowSet rowSet = rowSetFactory.createJdbcRowSet(); Met deze methode krijg je geen warning.
RowSet rowSet = new JdbcRowSetImpl(dataSource.getConnection());
rowSet.setCommand(query);
rowSet.execute();
return rowSet;
}
/**
* Deletes the bestelling from the database with the given bestelling id.
* @param bestelling_id the id of the bestelling that is to be deleted
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void deleteBestelling(int bestelling_id) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
executeCommand("DELETE FROM bestelling WHERE bestelling_id = " + bestelling_id);
}
/**
* Deletes the given klant from the database based on voornaam, achternaam, and tussenvoegsel.
* @param k klant to be deleted
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void deleteKlant(Klant k) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
// Get information from klant object.
String voornaam = k.getVoornaam();
String achternaam = k.getAchternaam();
String tussenvoegsel = k.getTussenvoegsel();
// Retrieve all klant_ids from the database that have the specified voornaam, achternaam,
// and tussenvoegsel.
ArrayList<Integer> klant_ids = new ArrayList<>();
try(RowSet rowSet = createRowSet("SELECT klant_id FROM klant WHERE "
+ "voornaam = '" + voornaam + "' AND "
+ "achternaam = '" + achternaam + "' AND "
+ "tussenvoegsel = '" + tussenvoegsel + "'")
) {
while(rowSet.next())
klant_ids.add(rowSet.getInt(1));
}
// Declare connection object and prepare String for klant deletion.
try(Connection con = dataSource.getConnection()) {
boolean initialAutoCommit = con.getAutoCommit();
con.setAutoCommit(false);
String klantSQL = "DELETE FROM klant WHERE "
+ "voornaam = ? AND "
+ "achternaam = ? AND "
+ "tussenvoegsel = ?";
// Prepare String for deletion of all bestellingen that have the klant_ids of klanten
// that will also be deleted.
String bestellingSQL = "DELETE FROM bestelling WHERE klant_id = ?";;
// Declare PreparedStatements.
PreparedStatement[] deleteBestellingen = new PreparedStatement[klant_ids.size()];
try(PreparedStatement deleteKlant = con.prepareStatement(klantSQL)) {
// delete bestelling(en)
for(int i = 0; i < deleteBestellingen.length; i++) {
deleteBestellingen[i] = con.prepareStatement(bestellingSQL);
deleteBestellingen[i].setInt(1, klant_ids.get(i));
deleteBestellingen[i].executeUpdate();
}
// delete klant(en)
deleteKlant.setString(1, voornaam);
deleteKlant.setString(2, achternaam);
deleteKlant.setString(3, tussenvoegsel);
deleteKlant.executeUpdate();
con.commit();
}
catch(SQLException ex) {
con.rollback();
throw ex;
}
finally {
for(int i = 0; i < deleteBestellingen.length; i++)
deleteBestellingen[i].close();
con.setAutoCommit(initialAutoCommit);
}
}
}
/**
* Deletes the klant from the database with the given klant id.
* @param klant_id the id of the klant that is to be deleted
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void deleteKlant(int klant_id) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
String klantSQL = "DELETE FROM klant WHERE klant_id = ?";
String bestellingSQL = "DELETE FROM bestelling WHERE klant_id = ?";
try(Connection con = dataSource.getConnection()) {
boolean initialAutoCommit = con.getAutoCommit();
con.setAutoCommit(false);
try(PreparedStatement deleteKlant = con.prepareStatement(klantSQL);
PreparedStatement deleteBestelling = con.prepareStatement(bestellingSQL)
) {
deleteBestelling.setInt(1, klant_id);
deleteBestelling.executeUpdate();
deleteKlant.setInt(1, klant_id);
deleteKlant.executeUpdate();
con.commit();
}
catch(SQLException ex) {
con.rollback();
throw ex;
}
finally {
con.setAutoCommit(initialAutoCommit);
}
}
}
/**
* Executes the given command. Results are stored in rowSet if the command is a query.
* @param command the command to be executed
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void executeCommand(String command) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
try(Connection con = dataSource.getConnection();
Statement statement = con.createStatement()
) {
statement.execute(command);
}
}
/**
* Executes the given query. The contents of the resulting ResultSet are transferred to a
* QueryResult object, which is returned to the caller.
* @param query the query to be executed
* @return a QueryResult object containining query results
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public QueryResult executeQuery(String query) throws SQLException, DatabaseException {
executeCommand(query);
QueryResult queryResult = null;
try(RowSet rowSet = createRowSet(query);) {
queryResult = createQueryResult(rowSet);
}
return queryResult;
}
/**
* Returns the type of DataSource this DatabaseConnector is using, or is set to use when
* connecting to a database. The codes for DataSource types are defined by the constants
* contained in this class.
* @return the code for the type of DataSource
*/
public byte getDataSourceType() {
return dataSourceType;
}
/**
* Returns the type of Database this DatabaseConnector is using, or is set to use when
* connecting to a database. The codes for Database types are defined by the constants
* contained in this class.
* @return the code for the type of Database
*/
public byte getStorageType() {
return storageType;
}
/**
* Return a String with the driver name currently stored in this DatabaseConnector instance.
* @return driver name
*/
public String getDriver() {
return driver;
}
/**
* Return a String with the password currently stored in this DatabaseConnector instance.
* @return password
*/
public String getPassword() {
return password;
}
/**
* Return a String with the database url currently stored in this DatabaseConnector instance.
* @return database url
*/
public String getUrl() {
return url;
}
/**
* Return a String with the username currently stored in this DatabaseConnector instance.
* @return username
*/
public String getUsername() {
return username;
}
/**
* Returns true when this DatabaseConnector instance is currently connected to a database.
* Returns false when this is not the case.
* @return true when connected, false when not connected
*/
public boolean isInitialized() {
return isInitialized;
}
/**
* Returns all klanten stored in the database of whom the attribute values correspond to
* attribute values of the given klant object. Only the attributes that have been specifically
* set in the klant object are used for the query. Klanten are returned in an arraylist object.
* @param k the klant object that contains query conditions
* @return klanten that have the same attribute values as the given klant
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public ArrayList<Klant> read(Klant k) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
String sqlcode = SqlCodeGenerator.generateKlantSelectionCode(k);
ArrayList<Klant> klanten = new ArrayList<>();
try(RowSet rowSet = createRowSet(sqlcode)) {
while(rowSet.next())
klanten.add(retrieveKlant(rowSet));
}
return klanten;
}
/**
* Reads all customer data currently present in the database and stores them in an arraylist
* object.
* @return an arraylist object containing klant objects for all customers
* stored in the database
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public ArrayList<Klant> readAll() throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
ArrayList<Klant> klanten = new ArrayList<>();
try(RowSet rowSet = createRowSet("SELECT * FROM klant")) {
while(rowSet.next())
klanten.add(retrieveKlant(rowSet));
}
return klanten;
}
/**
* Returns the bestelling stored in the database with the given bestelling id. Bestelling data
* is returned in a Bestelling object.
* @param bestelling_id the id of the bestelling that is to be retrieved
* @return the bestelling with the given id or null when there is no
* bestelling in the database with the given id
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public Bestelling readBestelling(int bestelling_id) throws SQLException, DatabaseException{
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
Connection connection = null;
if(dataSource != null)
connection = dataSource.getConnection();
try(BestellingDao bDao = createBestellingDao(connection)) {
return bDao.read(bestelling_id);
}
catch(DaoException | DaoConfigurationException ex) {
throw new DatabaseException("Bestelling lezen mislukt.", ex);
}
}
/**
* Returns the klant stored in the database with the given klant id. Klant data is returned in a
* klant object.
* @param klant_id the id of the klant that is to be retrieved
* @return the klant with the given id
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public Klant readKlant(int klant_id) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
Connection connection = null;
if(dataSource != null)
connection = dataSource.getConnection();
try(KlantDao kDao = createKlantDao(connection)) {
return kDao.read(klant_id);
}
catch(DaoException | DaoConfigurationException ex) {
throw new DatabaseException("Klant lezen mislukt.", ex);
}
}
/**
* Retrieves bestelling data from rowSet and stores them in a Bestelling object. The bestelling
* data that is retrieved comes from the row to which the cursor in rowSet is currently
* pointing. The method assumes rowSet contains data from all columns in the bestelling table.
* @return the Bestelling object with data from the currently selected row in
* rowSet
* @throws SQLException
*/
private Bestelling retrieveBestelling(RowSet rowSet) throws SQLException {
Bestelling bestelling = new Bestelling();
bestelling.setBestelling_id(rowSet.getInt(1));
bestelling.setKlant_id(rowSet.getInt(2));
bestelling.setArtikel_id1(rowSet.getInt(3));
bestelling.setArtikel_naam1(rowSet.getString(4));
bestelling.setArtikel_aantal1(rowSet.getInt(5));
bestelling.setArtikel_prijs1(rowSet.getDouble(6));
bestelling.setArtikel_id2(rowSet.getInt(7));
bestelling.setArtikel_naam2(rowSet.getString(8));
bestelling.setArtikel_aantal2(rowSet.getInt(9));
bestelling.setArtikel_prijs2(rowSet.getDouble(10));
bestelling.setArtikel_id3(rowSet.getInt(11));
bestelling.setArtikel_naam3(rowSet.getString(12));
bestelling.setArtikel_aantal3(rowSet.getInt(13));
bestelling.setArtikel_prijs3(rowSet.getDouble(14));
return bestelling;
}
/**
* Retrieves klant data from rowSet and stores them in a Klant object. The klant data that is
* retrieved comes from the row to which the cursor in rowSet is currently pointing. The method
* assumes rowSet contains data from all columns in the klant table.
* @return the Klant object with data from the currently selected row in rowSet
* @throws SQLException
*/
private Klant retrieveKlant(RowSet rowSet) throws SQLException {
Klant klant = new Klant();
klant.setKlant_id(rowSet.getInt(1));
klant.setVoornaam(rowSet.getString(2));
klant.setTussenvoegsel(rowSet.getString(3));
klant.setAchternaam(rowSet.getString(4));
klant.setEmail(rowSet.getString(5));
klant.setStraatnaam(rowSet.getString(6));
klant.setHuisnummer(rowSet.getInt(7));
klant.setToevoeging(rowSet.getString(8));
klant.setPostcode(rowSet.getString(9));
klant.setWoonplaats(rowSet.getString(10));
return klant;
}
private void setUpC3p0DataSource() throws DatabaseException, SQLException {
if(storageType == STORAGE_MYSQL)
driver = C3P0_DRIVER_MYSQL;
else
driver = C3P0_DRIVER_FIREBIRD;
try {
Class.forName(driver);
} catch (Exception ex) {
throw new DatabaseException("Driver laden mislukt.", ex);
}
try {
DataSource unpooledDS = DataSources.unpooledDataSource(url, username, password);
dataSource = DataSources.pooledDataSource(unpooledDS);
testConnection();
}
catch(SQLException ex) {
throw new DatabaseException("Verbinden mislukt.\n"
+ "Controleer gebruikersnaam en wachtwoord.", ex);
}
}
private void setUpHikariCPDataSource() throws DatabaseException, SQLException {
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(5);
config.setInitializationFailFast(true);
config.setLeakDetectionThreshold(5000);
if (storageType == STORAGE_MYSQL) {
driver = HIKARI_CP_DRIVER_MYSQL;
config.setDataSourceClassName(driver);
/*config.addDataSourceProperty("serverName", "localhost"); // voor deze attributen moet
config.addDataSourceProperty("port", "3306"); // eigenlijk info uit de gui
config.addDataSourceProperty("databaseName", "mydb");*/ // gebruikt worden
config.addDataSourceProperty("url", url);
config.addDataSourceProperty("user", username);
config.addDataSourceProperty("password", password);
}
else /*if (storageType == STORAGE_FIREBIRD)*/ {
driver = HIKARI_CP_DRIVER_FIREBIRD;
config.setDataSourceClassName(driver);
/*config.addDataSourceProperty("serverName", "localhost"); // voor deze attributen moet
config.addDataSourceProperty("port", "3050"); // eigenlijk info uit de gui
config.addDataSourceProperty("databaseName", "klantdatabase"); */ // gebruikt worden
config.addDataSourceProperty("database", url);
config.addDataSourceProperty("userName", username);
config.addDataSourceProperty("password", password);
}
dataSource = new HikariDataSource(config);
logger.info("HikariConfig object is ingesteld en HikariDataSource is aangemaakt.");
testConnection();
logger.info("HikariDatasource is getest en gaf geen foutmeldingen.");
}
private void testConnection() throws DatabaseException {
try(Connection con = dataSource.getConnection();
Statement statement = con.createStatement()
) {
statement.execute("SELECT klant_id FROM klant WHERE klant_id = 1");
}
catch(SQLException ex) {
throw new DatabaseException("Verbinden mislukt.\n"
+ "Controleer gebruikersnaam en wachtwoord.", ex);
}
}
/**
* Updates the given klant in the database based on the klant id contained in the Klant object.
* If the klant id of the given klant is equal to 0, this method will not do anything.
* @param k klant data to be updated
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void update(Klant k) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
Connection connection = null;
if(dataSource != null)
connection = dataSource.getConnection();
try(KlantDao kDao = createKlantDao(connection)) {
kDao.update(k);
}
catch(DaoException | DaoConfigurationException ex) {
throw new DatabaseException("Bestelling updaten mislukt.", ex);
}
}
/**
* Updates the given bestelling in the database based on the bestelling id contained in the
* Bestelling object. If the Bestelling id of the given bestelling is equal to 0, this method
* will not do anything.
* @param b bestelling data to be updated
* @throws SQLException
* @throws DatabaseException thrown if database connection has not been initialized yet
*/
public void update(Bestelling b) throws SQLException, DatabaseException {
if(!isInitialized)
throw new DatabaseException("Geen verbinding met database.");
Connection connection = null;
if(dataSource != null)
connection = dataSource.getConnection();
try(BestellingDao bDao = createBestellingDao(connection)) {
bDao.update(b);
}
catch(DaoException | DaoConfigurationException ex) {
throw new DatabaseException("Bestelling updaten mislukt.", ex);
}
}
private KlantDao createKlantDao(Connection con) {
if(hibernate)
return DaoFactory.getKlantDao(DaoFactory.HIBERNATE);
else if(storageType == STORAGE_MYSQL)
return DaoFactory.getKlantDao(DaoFactory.MY_SQL, con);
else if(storageType == STORAGE_FIREBIRD)
return DaoFactory.getKlantDao(DaoFactory.FIREBIRD, con);
else if(storageType == STORAGE_XML)
return DaoFactory.getKlantDao(DaoFactory.XML);
else/*if(storageType == STORAGE_JSON)*/
return DaoFactory.getKlantDao(DaoFactory.JSON);
}
private BestellingDao createBestellingDao(Connection con) {
if(hibernate)
return DaoFactory.getBestellingDao(DaoFactory.HIBERNATE);
else if(storageType == STORAGE_MYSQL)
return DaoFactory.getBestellingDao(DaoFactory.MY_SQL, con);
else if(storageType == STORAGE_FIREBIRD)
return DaoFactory.getBestellingDao(DaoFactory.FIREBIRD, con);
else if(storageType == STORAGE_XML)
return DaoFactory.getBestellingDao(DaoFactory.XML);
else/*if(storageType == STORAGE_JSON)*/
return DaoFactory.getBestellingDao(DaoFactory.JSON);
}
public static class Builder {
private byte dataSourceType;
private byte storageType;
private String url;
private String username;
private String password;
private boolean hibernate;
public Builder dataSourceType(byte dataSourceType) throws DatabaseException {
if (dataSourceType < HIKARI_CP_DATASOURCE && dataSourceType > C3P0_DATASOURCE)
throw new DatabaseException("Instellen data source mislukt.");
else {
this.dataSourceType = dataSourceType;
}
return this;
}
public Builder storageType(byte storageType) throws DatabaseException {
if (storageType < STORAGE_MYSQL && dataSourceType > STORAGE_JSON)
throw new DatabaseException("Instellen storage type mislukt.");
else {
this.storageType = storageType;
}
return this;
}
public Builder url(String url) {
this.url = url;
return this;
}
public Builder username(String username) {
this.username = username;
return this;
}
public Builder password(String password) {
this.password = password;
return this;
}
public Builder hibernate(boolean hibernate) {
this.hibernate = hibernate;
return this;
}
public DatabaseConnector build() {
return new DatabaseConnector(this);
}
}
private DatabaseConnector(Builder builder) {
this.dataSourceType = builder.dataSourceType;
this.storageType = builder.storageType;
this.url = builder.url;
this.username = builder.username;
this.password = builder.password;
this.hibernate = builder.hibernate;
}
}
| [
"mwraaphorst@gmail.com"
] | mwraaphorst@gmail.com |
135c57a871ab7bfda47e355ff31a12f86703496c | dd74a186e5c89cb1226687495a2ac671086069d5 | /app/src/main/java/com/application/wowwao1/Models/InfoItem.java | 227b22aaa02e76ab54731e239534678ce6e1d85a | [] | no_license | websitedesignanddeveloper/WOW-WAO1 | ec84b76c5a225526510b86f41f8a4bebe070d61c | 1668461b5934999bc4dae2e3d7e98de23afd6c02 | refs/heads/master | 2020-03-26T21:22:07.784499 | 2018-08-20T07:43:48 | 2018-08-20T07:43:48 | 145,383,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.application.wowwao1.Models;
import com.google.gson.annotations.SerializedName;
public class InfoItem {
@SerializedName("name")
private String name;
@SerializedName("id")
private String id;
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setId(String id){
this.id = id;
}
public String getId(){
return id;
}
} | [
"websitedesignanddevloper@gmail.com"
] | websitedesignanddevloper@gmail.com |
842eba59d4859ec505f11694c826e5e988b20dc0 | b9566b4e40694d992e95e60dda515194a4f2a350 | /design-patterns/src/main/java/me/powerarc/designpatterns/structural_patterns/bridge_pattern/_01_before/정복자아리.java | 472a3b7e381896d8387769640efea0a8976df325 | [] | no_license | jjh5887/TIL | e3fc5c09e1bebbe71d3e4ad326efeae07c5244e3 | e23215c32d63bb6e2cee2257482a2e4f0b35a8c3 | refs/heads/main | 2023-08-08T03:18:23.289366 | 2023-07-08T16:37:22 | 2023-07-08T16:37:22 | 62,218,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | package me.powerarc.designpatterns.structural_patterns.bridge_pattern._01_before;
public class 정복자아리 implements Champion {
@Override
public void move() {
System.out.println("정복자 아리 move");
}
@Override
public void skillQ() {
System.out.println("정복자 아리 Q");
}
@Override
public void skillW() {
System.out.println("정복자 아리 W");
}
@Override
public void skillE() {
System.out.println("정복자 아리 E");
}
@Override
public void skillR() {
System.out.println("정복자 아리 R");
}
}
| [
"wjdrnjsgh159@naver.com"
] | wjdrnjsgh159@naver.com |
1a3ecf22981c78f91e9928c31d5aa278f285cb7d | 42b9d3280b448d5d230157dea9442f91eebe7707 | /testtest1/src/main/java/com/cn/dao/SystemConfigDao.java | d2c3d67d2b7dfae8867c3ae6ec6f5f3ca7b3e733 | [] | no_license | mazhiqianguser/test | fd790cd1a2cfb997b264bdf5e39e2310c19a2a02 | fa65ee7c272d1ba8038bc44e5aac4764f219f54a | refs/heads/master | 2020-04-18T02:00:08.580274 | 2019-01-28T09:40:00 | 2019-01-28T09:40:00 | 167,142,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | package com.cn.dao;
import com.cn.entity.SystemConfig;
import com.cn.entity.SystemConfigExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Auther: mazhiqiang
* @Date: 2019\1\25 0025 11:18
* @Description:
*/
public interface SystemConfigDao {
int countByExample(SystemConfigExample var1);
int deleteByExample(SystemConfigExample var1);
int deleteByPrimaryKey(Integer var1);
int insert(SystemConfig var1);
int insertSelective(SystemConfig var1);
List<SystemConfig> selectByExample(SystemConfigExample var1);
SystemConfig selectByPrimaryKey(Integer var1);
int updateByExampleSelective(@Param("record") SystemConfig var1, @Param("example") SystemConfigExample var2);
int updateByExample(@Param("record") SystemConfig var1, @Param("example") SystemConfigExample var2);
int updateByPrimaryKeySelective(SystemConfig var1);
int updateByPrimaryKey(SystemConfig var1);
}
| [
"zhiqiang.ma@cintel.com.cn"
] | zhiqiang.ma@cintel.com.cn |
3fd654902f3f320edc1ddc221d862c2471e11d63 | 002ee9df6c1e508be8f1aabecd1cbfa2c845d09c | /Find Largest Value in Each Tree Row/src/Main.java | 4c7c97b045f2ac9ac0e32e4ff48a7dcb4168e0fe | [] | no_license | mian4work/Algorithm | d9011d9800dd84aed1f31e84e120e47f9323b081 | e69d185ef2ee640f9d074cb06d7e83ee82aa2d73 | refs/heads/master | 2021-03-24T16:57:45.322012 | 2020-07-14T21:19:30 | 2020-07-14T21:19:30 | 247,550,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | public class Main {
public static void main(String[] args) {
Solution solution = new Solution();
solution.largestValues(new TreeNode(1, new TreeNode(3, new TreeNode(5), new TreeNode(3)),
new TreeNode(2, null, new TreeNode(9))));
solution.largestValues(new TreeNode());
return;
}
}
| [
"mian4work@yahoo.com"
] | mian4work@yahoo.com |
e9588ec9009c44755dae4b617d856533bfd8ad2e | 10beafb30001b99f76fce71974c07cddbd5523c2 | /Yomiage002/Yomiage/src/org/DataBase/Temp/SQLite.java | f7bb77e8f0a13ecf1b41b2a86a07c6fdf5e89615 | [
"MIT"
] | permissive | max3584/Yomiage | d88c5167d089e00f0bb2f3e13b8c75ae63d683e9 | ce392d24519faa2c8dc97f2df10a028ab133e8f7 | refs/heads/master | 2023-02-22T05:22:08.284428 | 2021-01-25T05:18:23 | 2021-01-25T05:18:23 | 271,119,570 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package org.DataBase.Temp;
//import org.sqlite.JDBC;
/**
* SQLiteのインタフェース
* 主に、JDBC接続で使用する固有の設定を入れているインタフェース
* @author max
*
*/
public interface SQLite {
/**
* SQLiteの固有設定フィールド
*/
public static final String url = "JDBC:sqlite:";
}
| [
"max09204649@gmail.com"
] | max09204649@gmail.com |
cdf70d7d344c4f882c2cfebc62a59cff14bae08d | 8b0d1aa6f2177ad8bb82b042e302b87fa115e674 | /src/main/java/com/xebia/fs101/writerpad/service/ArticleService.java | bf697b59f19b41b8b02fe9816d3482c45ead2cf9 | [] | no_license | supr8sung/writerpad | bd2505d3a67b34b863deb25d0f1c4e8440c6127e | bea5810c206ed730a5d4e461b35b231858edec73 | refs/heads/master | 2022-09-23T01:03:45.637133 | 2020-08-22T09:40:06 | 2020-08-22T09:40:06 | 223,870,899 | 1 | 1 | null | 2022-02-16T01:06:19 | 2019-11-25T05:47:03 | Java | UTF-8 | Java | false | false | 5,641 | java | package com.xebia.fs101.writerpad.service;
import com.xebia.fs101.writerpad.entity.Article;
import com.xebia.fs101.writerpad.entity.User;
import com.xebia.fs101.writerpad.entity.WriterPadRole;
import com.xebia.fs101.writerpad.exception.ArticleAlreadyCreatedException;
import com.xebia.fs101.writerpad.exception.ArticleNotFoundException;
import com.xebia.fs101.writerpad.exception.UserNotAuthorizedException;
import com.xebia.fs101.writerpad.model.ArticleStatus;
import com.xebia.fs101.writerpad.model.ReadingTime;
import com.xebia.fs101.writerpad.repository.ArticleRepository;
import com.xebia.fs101.writerpad.repository.UserRepository;
import com.xebia.fs101.writerpad.response.ReadingTimeResponse;
import com.xebia.fs101.writerpad.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.xebia.fs101.writerpad.model.ArticleStatus.PUBLISHED;
@Service
public class ArticleService {
@Value("${average.words.per.minute}")
int averageTime;
@Autowired
private ArticleRepository articleRepository;
@Autowired
private UserRepository userRepository;
@Autowired
private PlagiarismFinderService plagiarismFinderService;
public Article add(Article article, User user) {
List<String> target = articleRepository.findAll().parallelStream().map(
Article::getBody).collect(
Collectors.toList());
if (plagiarismFinderService.isPlagiarism(article.getBody(), target))
throw new ArticleAlreadyCreatedException("Same article found");
User foundUser = userRepository.getOne(user.getId());
article.setUser(foundUser);
return this.articleRepository.save(article);
}
public Page<Article> findAll(Pageable pageable) {
return articleRepository.findAll(pageable);
}
public Page<Article> findAllByStatus(String status, Pageable pageable) {
return articleRepository.findAllByStatus(
ArticleStatus.valueOf(status.toUpperCase()), pageable);
}
public Article findOne(String slugId) {
return articleRepository.findById(StringUtils.extractUuid(slugId)).orElseThrow(
ArticleNotFoundException::new);
}
public void delete(String slugId, User user) {
UUID id = StringUtils.extractUuid(slugId);
Article article = articleRepository.findById(id).orElseThrow(
ArticleNotFoundException::new);
if (!(article.getUser().equals(userRepository.getOne(
user.getId()))) || !user.getRole().equals(
WriterPadRole.ADMIN))
throw new UserNotAuthorizedException(
"User not athorized to delte the article");
articleRepository.deleteById(id);
}
public Article update(String slugId, Article copyFrom, User user) {
Article article = this.findOne(slugId);
List<String> target = articleRepository.findAll().parallelStream()
.filter(e -> e != article)
.map(Article::getBody)
.collect(Collectors.toList());
if (plagiarismFinderService.isPlagiarism(copyFrom.getBody(), target))
throw new ArticleAlreadyCreatedException("Same article found");
if (!article.getUser().equals(userRepository.getOne(user.getId())))
throw new UserNotAuthorizedException(
"User not authorized to update the article");
Article articleToBeUpdated = article.update(copyFrom);
return articleRepository.save(articleToBeUpdated);
}
public ReadingTimeResponse calculateReadingTime(Article article) {
ReadingTime readingTime = ReadingTime.calculate(article.getBody(), averageTime);
String slugId = article.getSlug() + "_" + article.getId();
return new ReadingTimeResponse(slugId, readingTime);
}
public Optional<Article> publish(Article article) {
if (article.getStatus() == PUBLISHED)
return Optional.empty();
else {
article.publish();
return Optional.of(articleRepository.save(article));
}
}
@Transactional
public Map<String, Long> getAllTags() {
Stream<String> tags = articleRepository.findTags();
return tags.collect(
Collectors.groupingBy(e -> e, Collectors.counting()));
}
public Article markFavourite(String slugId) {
Article article = articleRepository.findById(StringUtils.extractUuid(slugId))
.orElseThrow(ArticleNotFoundException::new);
article.setFavorited(true);
article.setFavoritesCount(article.getFavoritesCount() + 1);
return articleRepository.save(article);
}
public Article deleteFavourite(String slugId) {
Article article = articleRepository.findById(StringUtils.extractUuid(slugId))
.orElseThrow(ArticleNotFoundException::new);
if (article.getFavoritesCount() <= 1) {
article.setFavorited(false);
article.setFavoritesCount(0);
return articleRepository.save(article);
}
article.setFavoritesCount(article.getFavoritesCount() - 1);
return articleRepository.save(article);
}
}
| [
"supreetsingh106@gmail.com"
] | supreetsingh106@gmail.com |
fcf6b35dd273fdb755ca68de194eb41691a0537a | 6ec94e511c097e0f7d5ebb76a775633f008f354c | /src/com/leetcode/java/Utils/PrintUtils.java | 44aad034594a854da04997def704826d94374115 | [] | no_license | qiuwenxiang/leetcodeAlgorithms | 27fe57415e7bfd1031679938702b088d6daa2b6d | c9aff06b7b6a09709759451b91775068c3f7dadc | refs/heads/master | 2021-04-26T23:30:29.591386 | 2018-06-26T23:59:06 | 2018-06-26T23:59:06 | 124,006,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.leetcode.java.Utils;
public class PrintUtils {
public static void printArray(int[] arr){
for (int i : arr) {
System.out.println(i);
}
}
public static void main(String[] args) {
String s = "191. Number of 1 Bits";
String title= "_"+s.replace(" ","").replace(".","");
String md= s.replace("."," ");
System.out.println(title);
System.out.println(md);
}
}
| [
"274235712@qq.com"
] | 274235712@qq.com |
ca7b2251d0ff045c6091e3fbfdae5959dae90c6d | 55dca62e858f1a44c2186774339823a301b48dc7 | /code/my-app/functions/3/stopPlaying_SoundPlayer.java | 41b15aa7c955665c16de0edff9e415dd26c19ef7 | [] | no_license | jwiszowata/code_reaper | 4fff256250299225879d1412eb1f70b136d7a174 | 17dde61138cec117047a6ebb412ee1972886f143 | refs/heads/master | 2022-12-15T14:46:30.640628 | 2022-02-10T14:02:45 | 2022-02-10T14:02:45 | 84,747,455 | 0 | 0 | null | 2022-12-07T23:48:18 | 2017-03-12T18:26:11 | Java | UTF-8 | Java | false | false | 63 | java | public synchronized void stopPlaying() {
playDone = true;
} | [
"wiszowata.joanna@gmail.com"
] | wiszowata.joanna@gmail.com |
9bbb742261f02ad4e1e3b54300464afaf9c322a8 | 1eccac1442d88b009fa331297d955006ef95cf73 | /src/main/java/com/fullstackremote/app/security/DomainUserDetailsService.java | 63bd66ed46b362d3075e729b6dab3861b0f7c52f | [] | no_license | chrisamcelveen/fsr | 8addac21b92cbc75a820e719b8b143db46123b02 | f8692c662527613ccbd376f5d7a8708d39a92191 | refs/heads/master | 2022-08-29T00:02:57.965071 | 2019-08-07T01:28:21 | 2019-08-07T01:28:21 | 200,949,710 | 0 | 0 | null | 2022-07-07T11:15:42 | 2019-08-07T01:32:18 | Java | UTF-8 | Java | false | false | 2,695 | java | package com.fullstackremote.app.security;
import com.fullstackremote.app.domain.User;
import com.fullstackremote.app.repository.UserRepository;
import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* Authenticate a user from the database.
*/
@Component("userDetailsService")
public class DomainUserDetailsService implements UserDetailsService {
private final Logger log = LoggerFactory.getLogger(DomainUserDetailsService.class);
private final UserRepository userRepository;
public DomainUserDetailsService(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
@Transactional
public UserDetails loadUserByUsername(final String login) {
log.debug("Authenticating {}", login);
if (new EmailValidator().isValid(login, null)) {
return userRepository.findOneWithAuthoritiesByEmailIgnoreCase(login)
.map(user -> createSpringSecurityUser(login, user))
.orElseThrow(() -> new UsernameNotFoundException("User with email " + login + " was not found in the database"));
}
String lowercaseLogin = login.toLowerCase(Locale.ENGLISH);
return userRepository.findOneWithAuthoritiesByLogin(lowercaseLogin)
.map(user -> createSpringSecurityUser(lowercaseLogin, user))
.orElseThrow(() -> new UsernameNotFoundException("User " + lowercaseLogin + " was not found in the database"));
}
private org.springframework.security.core.userdetails.User createSpringSecurityUser(String lowercaseLogin, User user) {
if (!user.getActivated()) {
throw new UserNotActivatedException("User " + lowercaseLogin + " was not activated");
}
List<GrantedAuthority> grantedAuthorities = user.getAuthorities().stream()
.map(authority -> new SimpleGrantedAuthority(authority.getName()))
.collect(Collectors.toList());
return new org.springframework.security.core.userdetails.User(user.getLogin(),
user.getPassword(),
grantedAuthorities);
}
}
| [
"camcelve@Christophers-MacBook.local"
] | camcelve@Christophers-MacBook.local |
fcc69fc91c6c9565f01a0e4f388813502b7fb5dc | 4ad17f7216a2838f6cfecf77e216a8a882ad7093 | /clbs/src/main/java/com/zw/platform/util/response/ContentType.java | 4137b6125847ee6762bcd82835306e453f03c148 | [
"MIT"
] | permissive | djingwu/hybrid-development | b3c5eed36331fe1f404042b1e1900a3c6a6948e5 | 784c5227a73d1e6609b701a42ef4cdfd6400d2b7 | refs/heads/main | 2023-08-06T22:34:07.359495 | 2021-09-29T02:10:11 | 2021-09-29T02:10:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.zw.platform.util.response;
public enum ContentType {
ZIP("application/zip"), WORD("application/msword"), EXCEL("application/ms-excel"),
JPEG("image/jpeg"), JPG("image/jpg"), PNG("image/png"), MP3("audio/mp3"), MP4("video/mpeg4"),
TIF("image/tiff");
ContentType(String value) {
this.value = value;
}
private String value;
@Override
public String toString() {
return this.value;
}
}
| [
"wuxuetao@zwlbs.com"
] | wuxuetao@zwlbs.com |
f39b0f66ba8100e4cff39279a6333df7653144ca | 1652afdb9889d7b0a5deb861c2642dabbcbf335a | /desktop/src/main/java/com/ladinc/playscape/java/PlayScapeDesktop.java | d8744b3135e782fbf2111bda619ce08cb44bc269 | [] | no_license | witnessmenow/Playscape | 84f0a7dd76d6370e94b9b8ddaa03b6961a4b9365 | 979f02fd543f53bb279d5c7f6b6e099053220f74 | refs/heads/master | 2016-09-05T16:14:32.600808 | 2014-07-28T22:12:47 | 2014-07-28T22:12:47 | 12,817,986 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package com.ladinc.playscape.java;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.ladinc.playscape.core.PlayScape;
public class PlayScapeDesktop {
public static void main (String[] args) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 1920;
config.height = 1080;
new LwjglApplication(new PlayScape(), config);
}
}
| [
"ecenuig@gmail.com"
] | ecenuig@gmail.com |
65e859ba78acb29b3dd1b1bbdf362b64ecfc4b62 | d03f5d834d56c41c0e3c5b72b7c3568ad81b53c3 | /src/main/java/com/happysolutions/surveyappbackend/model/JwtRequest.java | 8e58bb23f906c8c1f72535d51c941748deb2e7a9 | [] | no_license | HarshGundecha/survey-app-backend | 279a89dd1f3a6e464e319ce41eeb0a6dea9b8011 | c827d233e0dd232b0995f3a9a31ac281273b9df9 | refs/heads/master | 2020-12-04T17:02:26.477062 | 2020-01-08T12:58:33 | 2020-01-08T12:58:33 | 231,847,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.happysolutions.surveyappbackend.model;
import java.io.Serializable;
public class JwtRequest implements Serializable {
private static final long serialVersionUID = 5926468583005150707L;
private String email;
private String password;
//need default constructor for JSON Parsing
public JwtRequest()
{
}
public JwtRequest(String email, String password) {
this.setEmail(email);
this.setPassword(password);
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
} | [
"harsh.gundecha@gmail.com"
] | harsh.gundecha@gmail.com |
a6d34be8d7d749607b29630692655b87ca5e6733 | 8055f5950709f7070d17791d167ebaa0d18689ed | /back/java/testApp/src/testapp/Payment.java | c5e59260417b9f868e6f652b7e65a06bc017a283 | [] | no_license | merry-llama/test2 | 182e0cdc5b5ad8e997c50cc4885934e4f8fd20be | 9f609998f0e77d9982ad9349e9c581187ee9daf3 | refs/heads/main | 2023-05-23T09:41:13.166441 | 2021-06-11T14:56:07 | 2021-06-11T14:56:07 | 376,046,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | 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 testapp;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Платежное поручение
*
* @author ili4
*/
public class Payment {
private SimpleDateFormat dateFormatter = new SimpleDateFormat("dd.MM.yyyy");
/**
* Дата платежа
*/
public Date date;
/**
* Сумма
*/
public BigDecimal summa;
/**
* Номер платежки
*/
public String number;
/**
* Назначение платежа
*/
public String description;
/**
* Плательщик
*/
public Counterparty payer;
/**
* Получатель
*/
public Counterparty payee;
@Override
public String toString() {
return "Платёжное поручение\n" +
"Дата: " + dateFormatter.format(date) +
"\nСумма: " + summa +
"\nНомер: " + number +
"\nНазначение платежа: " + description +
"\nПлательщик:\n" + payer +
"\nПолучатель:\n" + payee;
}
}
| [
"80395946+merry-llama@users.noreply.github.com"
] | 80395946+merry-llama@users.noreply.github.com |
213733d6a9e8e6d487ed5e17ca3eae937c8e643c | 826d544c69b7b2b3c0df5a6cf6391eee7c505fc9 | /src/com/example/githubtest/MainActivity.java | 401803a165db238ebc91bb2731bc74a6a8740cef | [
"Apache-2.0"
] | permissive | sunkun201216008/githubTest | 40fe31f33f0fadfccf688de055cc5c64469e8e59 | a7310f219ab3402123a01a82bc057a3f4ed0ce7b | refs/heads/master | 2021-01-22T17:29:01.867739 | 2017-03-15T02:32:42 | 2017-03-15T02:32:42 | 85,019,486 | 0 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 703 | java | package com.example.githubtest;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
private Button bt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bt=(Button) findViewById(R.id.bt);
bt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "github≤‚ ‘", 0).show();
}
});
}
}
| [
"1029570787@qq.com"
] | 1029570787@qq.com |
148b77960d4e27dad7e0537d3ac7531b1c945a94 | aaa9649c3e52b2bd8e472a526785f09e55a33840 | /EquationFunctionStubs/src/com/misys/equation/function/test/run/FunctionHandlerStub04HCX4SAdd.java | b67082526a4c21b462a0d053fc21efa0376c74f6 | [] | 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 | 3,060 | java | package com.misys.equation.function.test.run;
import com.misys.equation.common.dao.beans.WERecordDataModel;
import com.misys.equation.common.files.JournalHeader;
import com.misys.equation.function.beans.FunctionData;
import com.misys.equation.function.runtime.FunctionHandler;
import com.misys.equation.function.runtime.FunctionSession;
import com.misys.equation.function.runtime.ScreenSetHandler;
import com.misys.equation.function.tools.SupervisorToolbox;
// Via API
public class FunctionHandlerStub04HCX4SAdd extends FunctionHandlerStubTestCase
{
// This attribute is used to store cvs version information.
public static final String _revision = "$Id: FunctionHandlerStub04HCX4SAdd.java 6793 2010-03-31 12:10:20Z deroset $";
public FunctionHandlerStub04HCX4SAdd()
{
try
{
setUp();
}
catch (Exception e)
{
System.out.println(e);
e.printStackTrace();
}
}
public static void main(String[] inputParameters)
{
FunctionHandlerStub04HCX4SAdd test = new FunctionHandlerStub04HCX4SAdd();
test.test();
}
public boolean test()
{
// Have a bash...
FunctionHandler functionHandler = null;
try
{
// Add XX4
System.out.println("--------------------------- 1");
functionHandler = FunctionToolboxStub.getFunctionHandler(user, "SESSIONID", "");
functionHandler.doNewTransaction("HCX", "");
FunctionData functionData = functionHandler.getFhd().getScreenSetHandler().rtvScrnSetCurrent().getFunctionData();
functionData.chgFieldInputValue("HLD", "XX4");
functionHandler.applyRetrieveTransaction();
// save it
functionHandler.save(WERecordDataModel.STAT_WIP, "STUB04HCX4Save");
// NOW RESTORE IT
FunctionHandler fh = FunctionToolboxStub.getFunctionHandler(user, "SESSIONID", "");
FunctionSession fs = functionHandler.getFhd().getFunctionSession();
fh.restore(fs.getOptionId(), fs.getSessionId(), fs.getUserId(), fs.getTransactionId(), null,
ScreenSetHandler.SCREENSET_DEFAULT);
fh.getFhd().getScreenSetHandler().rtvScrnSetCurrent().getFunctionData().chgFieldInputValue("DSC",
"XX4 Add Save Restore");
fh.applyTransaction();
FunctionToolboxStub.printMessages(fh.rtvFunctionMessages().getMessages());
// retrieve journal header
JournalHeader journalHeader1 = fh.getFhd().getJournalHeader();
if (journalHeader1 != null)
{
System.out.println("Journal 1=" + journalHeader1);
}
else
{
System.out.println("Journal 1=" + "ERROR");
}
return (journalHeader1 != null);
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
finally
{
if (functionHandler != null)
{
if (functionHandler.getFhd().getFunctionSession() != null)
{
SupervisorToolbox.removeSession(functionHandler.getFhd().getFunctionSession(), functionHandler.getFhd()
.getEquationUser().getEquationUnit());
}
}
cleanUp();
}
}
public void testStub04HCX4SAdd_001()
{
FunctionHandlerStub04HCX4SAdd stub = new FunctionHandlerStub04HCX4SAdd();
boolean success = stub.test();
assertEquals(true, success);
}
}
| [
"jomartin@MAN-D7R8ZYY1.misys.global.ad"
] | jomartin@MAN-D7R8ZYY1.misys.global.ad |
99fdfb23706809bf0efdd51ede91ca5bcca41d91 | f6eb1de6b34e82a781c70b7d89f141cbe379a828 | /src/main/java/com/bi/xrpd/repository/DiffractionPatternRepository.java | cf42ec3ba50bb37085683d52a0b791643e2334a8 | [] | no_license | SandipChakraborty/BIXRPD | 42b590ad3fca55baecef0eb4c59b979eddce7b26 | 498ff47eb523287e2f8338c5c4c0645b008b21e3 | refs/heads/master | 2022-12-10T02:24:59.568885 | 2020-09-23T04:41:15 | 2020-09-23T04:41:15 | 297,853,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.bi.xrpd.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.bi.xrpd.entity.DiffractionPattern;
@Repository
public interface DiffractionPatternRepository extends CrudRepository<DiffractionPattern, Long> {
}
| [
"catch2sandy007@gmail.com"
] | catch2sandy007@gmail.com |
650adbbe985b7e2bdfc38c9ecaa0adc5ef987b66 | f1ad958a3398c2ffece6e7b7ddad73a77e4d8483 | /thinking-in-spring/src/main/java/cn/chaseshu/data/redis/cluster/JedisClusterTest.java | 531febea4fce36f8ebb2ee3f9b080e895b3f6036 | [] | no_license | skjme/csf-pro | 46b824f99ad8ebf7a5d241b1bda5b13801c4a679 | 6271ea2e8bdd72f43c1575bdbfa1d8c52b6e3b56 | refs/heads/master | 2023-01-23T18:26:19.666611 | 2022-04-12T06:47:31 | 2022-04-12T06:47:31 | 146,056,071 | 2 | 0 | null | 2023-01-04T19:46:07 | 2018-08-25T01:54:51 | JavaScript | UTF-8 | Java | false | false | 1,698 | java | package cn.chaseshu.data.redis.cluster;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
/**
* 访问redis集群
*
*/
public class JedisClusterTest {
public static void main(String[] args) throws IOException {
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(20);
config.setMaxIdle(10);
config.setMinIdle(5);
Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
jedisClusterNode.add(new HostAndPort("127.0.0.1", 30001));
jedisClusterNode.add(new HostAndPort("127.0.0.1", 30002));
jedisClusterNode.add(new HostAndPort("127.0.0.1", 30003));
jedisClusterNode.add(new HostAndPort("127.0.0.1", 30004));
jedisClusterNode.add(new HostAndPort("127.0.0.1", 30005));
jedisClusterNode.add(new HostAndPort("127.0.0.1", 30006));
JedisCluster jedisCluster = null;
try {
//connectionTimeout:指的是连接一个url的连接等待时间
//soTimeout:指的是连接上一个url,获取response的返回等待时间
jedisCluster = new JedisCluster(jedisClusterNode, 6000, 5000, 10, config);
System.out.println(jedisCluster.set("cluster", "haha"));
System.out.println(jedisCluster.get("cluster"));
System.out.println(jedisCluster.get("thing2"));
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedisCluster != null) {
jedisCluster.close();
}
}
}
}
| [
"chase.shu@asia.training"
] | chase.shu@asia.training |
5f6983299f984b2a49f2116e378030bc2412593c | 6572cceab4bb96e04ba01c5cdd72c48a601c139a | /halisaha/src/main/java/tr/gen/usp/mac/session/AbstractFacade.java | d30cb76c7e5b04e3a6833113163fb4c678591f04 | [] | no_license | poyrazus/javaee | 38cc8d081a7bad381d10fa55f44236092bb3d996 | 641cebe52bc577574f69772203eea9033e640d96 | refs/heads/master | 2021-01-17T16:19:03.759574 | 2016-07-25T10:01:56 | 2016-07-25T10:01:56 | 64,118,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,150 | 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 tr.gen.usp.mac.session;
import java.util.List;
import javax.persistence.EntityManager;
/**
*
* @author sitki.poyraz
*/
public abstract class AbstractFacade<T> {
private Class<T> entityClass;
public AbstractFacade(Class<T> entityClass) {
this.entityClass = entityClass;
}
protected abstract EntityManager getEntityManager();
public void create(T entity) {
getEntityManager().persist(entity);
}
public void refresh(T entity) {
getEntityManager().refresh(entity);
}
public void edit(T entity) {
getEntityManager().merge(entity);
}
public void remove(T entity) {
getEntityManager().remove(getEntityManager().merge(entity));
}
public T find(Object id) {
return getEntityManager().find(entityClass, id);
}
public List<T> findAll() {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
return getEntityManager().createQuery(cq).getResultList();
}
public List<T> findRange(int[] range) {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
javax.persistence.Query q = getEntityManager().createQuery(cq);
q.setMaxResults(range[1] - range[0] + 1);
q.setFirstResult(range[0]);
return q.getResultList();
}
public int count() {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
javax.persistence.criteria.Root<T> rt = cq.from(entityClass);
cq.select(getEntityManager().getCriteriaBuilder().count(rt));
javax.persistence.Query q = getEntityManager().createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
af5ee3a07b1b53f6f6c97a60a38a8281eafe1d34 | 7c8e373455e582b92f6c57a9a4f03cad33c7f471 | /ftc/Android/2013-2014/FTCScout/gen/com/example/ftcscout/R.java | 10d69d5a28bf1c194f7d424c015f1b807cc3a9d8 | [] | no_license | lmrobotics/linn-mar-robotics | 10f207328ea3080c3d48af80b2934c1fce3364d4 | 8b9be27f12f8d28873729feb59ee5c3a234a1e16 | refs/heads/master | 2021-01-19T00:16:14.451318 | 2014-01-13T13:44:44 | 2014-01-13T13:44:44 | 32,746,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,173 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.ftcscout;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_action_save=0x7f020000;
public static final int ic_action_search=0x7f020001;
public static final int ic_action_send=0x7f020002;
public static final int ic_launcher=0x7f020003;
}
public static final class id {
public static final int AutoBlock=0x7f080005;
public static final int AutoBlockScore=0x7f08000b;
public static final int AutoBridge=0x7f08000d;
public static final int AutoBridgeScore=0x7f08000c;
public static final int Autonomous=0x7f080004;
public static final int Driver=0x7f080011;
public static final int Driver1pt=0x7f080013;
public static final int Driver2pt=0x7f080014;
public static final int Driver3pt=0x7f080016;
public static final int Flag=0x7f08001c;
public static final int FullBridge=0x7f08000e;
public static final int NoBridge=0x7f080010;
public static final int Notes=0x7f080029;
public static final int PartialBridge=0x7f08000f;
public static final int Penalties=0x7f080020;
public static final int action_save=0x7f08002e;
public static final int action_send=0x7f08002d;
public static final int action_settings=0x7f08002c;
public static final int bridgeScore=0x7f08001a;
public static final int button=0x7f080001;
public static final int editText1=0x7f08002b;
public static final int endGame=0x7f080018;
public static final int fivept=0x7f080007;
public static final int flagHeight=0x7f08001b;
public static final int flagHigh=0x7f08001d;
public static final int flagLow=0x7f08001e;
public static final int fourtypt=0x7f080009;
public static final int hangingBridge=0x7f080019;
public static final int majorNo=0x7f080027;
public static final int majorPenalties=0x7f080028;
public static final int majorPenaltiesbutton=0x7f080025;
public static final int majorYes=0x7f080026;
public static final int matchNumber=0x7f080003;
public static final int minorNo=0x7f080023;
public static final int minorPenalties=0x7f080024;
public static final int minorPenaltiesbutton=0x7f080021;
public static final int minorYes=0x7f080022;
public static final int noFLag=0x7f08001f;
public static final int noScore=0x7f08000a;
public static final int notesField=0x7f08002a;
public static final int oneptCounter=0x7f080012;
public static final int teamName=0x7f080000;
public static final int teamNumber=0x7f080002;
public static final int textView1=0x7f080006;
public static final int threeptcounter=0x7f080017;
public static final int twentypt=0x7f080008;
public static final int twoptcounter=0x7f080015;
}
public static final class layout {
public static final int activity_display_message=0x7f030000;
public static final int activity_main=0x7f030001;
}
public static final class menu {
public static final int display_message=0x7f070000;
public static final int main=0x7f070001;
public static final int main_activity_actions=0x7f070002;
}
public static final class string {
public static final int action_save=0x7f05000c;
public static final int action_search=0x7f050007;
public static final int action_send=0x7f05000b;
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int bt_share_picker_label=0x7f05000e;
public static final int button_send=0x7f050004;
public static final int competition_name=0x7f05000d;
public static final int hello_world=0x7f050006;
public static final int match_number_prompt=0x7f050008;
public static final int notes=0x7f05000a;
public static final int process=0x7f050009;
public static final int team_name_prompt=0x7f050002;
public static final int team_number_prompt=0x7f050003;
public static final int title_activity_display_message=0x7f050005;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| [
"raflood61@8aa245d1-972c-41d0-c14e-e24111e5e9b2"
] | raflood61@8aa245d1-972c-41d0-c14e-e24111e5e9b2 |
832cecd494710df8b2ea263a576c716fbfdac368 | 7870124a739aeed54737b4bda8bc0a4ce302358e | /SemJSF/src/main/java/com/jsilvamoises/conversores/CidadeConverter.java | f65b735af2a220480c4d8c44a7ff615429aaaeea | [] | no_license | jsilvamoises/SemJSF | 9e1635cdabec6ccfb03dedd607edd550303157b8 | 35662af33e5a7094033cc336789403db16dbc4ed | refs/heads/master | 2021-01-01T18:29:43.600946 | 2015-01-05T00:47:04 | 2015-01-05T00:47:04 | 28,726,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.jsilvamoises.conversores;
import com.jsilvamoises.controller.MBCidade;
import com.jsilvamoises.model.entities.Cidade;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
/**
*
* @author Moises
*/
@FacesConverter(forClass = Cidade.class)
public class CidadeConverter implements Converter{
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
if(!string.isEmpty()){
return new MBCidade().getCidadeById(Long.valueOf(string));
}else{
return null;
}
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
if(o!=null){
return String.valueOf(((Cidade)o).getId());
}else{
return null;
}
}
}
| [
"Moises@Moises-PC"
] | Moises@Moises-PC |
a902f6e50b6de52498c69a5c2a052139f09919c7 | eeec703afaa97bd7c7e97d37d8824e58d0a8e336 | /storm-kestrel/src/main/java/com/ss/kestrel/KestrelMessageBuilder.java | e91b4b3cd3293bb222ee65eaa20270d74bc6f191 | [] | no_license | gluegl/storm-broker-connectors | e9db2d820f39fb922866dffea0f59ea32002dbc5 | 87b3f7f8f32967ed83eae049fe2597879935c69d | refs/heads/master | 2021-01-16T19:28:39.561865 | 2015-01-21T04:14:10 | 2015-01-21T04:14:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.ss.kestrel;
import backtype.storm.tuple.Tuple;
import java.util.List;
public interface KestrelMessageBuilder {
List<Object> deSerialize(KestrelMessage message);
KestrelMessage serialize(Tuple tuple);
}
| [
"supun06@gmail.com"
] | supun06@gmail.com |
242200b177d268e2ab8f4f45f5153e1789da9c3d | 823e7cf19ee5f2c079405b60c13715a598d48aa4 | /src/org/marketsuite/test/ballon/CompleteExample.java | 54151659378d23c6812b52506772abe5fc609a1d | [] | no_license | shorebird2016/market-suite | 2836ba54944ce915c045f5d06389d5ac1749ccde | ecb245b917c725464a8cde160e1e94af05291fd1 | refs/heads/master | 2020-12-30T16:45:46.504672 | 2017-05-11T20:51:28 | 2017-05-11T20:51:28 | 91,022,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,795 | java | package org.marketsuite.test.ballon;
import de.javasoft.plaf.synthetica.SyntheticaLookAndFeel;
import org.marketsuite.component.UI.CapLookAndFeel;
import org.marketsuite.test.ballon.panels.MainPanel;
import javax.swing.*;
/**
* Main class for the Balloontip example application
* @author Tim Molderez
*/
public class CompleteExample {
/**
* Main method
* @param args command-line arguments (unused)
*/
public static void main(String[] args) {
// Switch to the OS default look & feel
// try {
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// } catch (Exception e) {}
try {
SyntheticaLookAndFeel.setWindowsDecorated(false);
//this is necessary to allow silver theme to show up if windows desktop already has silver theme
UIManager.setLookAndFeel(new CapLookAndFeel());
UIManager.put("TabbedPane.tabsOpaque", Boolean.TRUE);
//NOTE: this will remove title bar and thus not moveable or resize
// JFrame.setDefaultLookAndFeelDecorated(true);//use swing components to build this frame
}
catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
// Now create the GUI
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("BalloonTip example");
frame.setIconImage(new ImageIcon(CompleteExample.class.getResource("/org/marketsuite/test/ballon/resource/frameIcon.png")).getImage());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new MainPanel());
frame.pack();
frame.setSize(480, 640);
frame.setLocationRelativeTo(null); // Centers the frame on the screen
frame.setVisible(true);
}
});
}
}
| [
"chenat2006@gmail.com"
] | chenat2006@gmail.com |
91bd07c842565798570c1cdbad5a35121b41b869 | c183fe599a84244eff75d3eab2ab665c5d7f5179 | /src/ch/kerbtier/procfx/operation/InvertRgb.java | e1a9037752ccd6dbff47f9f04fdcec284751d7ae | [] | no_license | creichlin/pixels | 0b0061c6dcac08f66a506a0b23f632e828c2cf0f | ae6b6e38bc7d4a9c6014a274bc88647da2325884 | refs/heads/master | 2020-04-04T00:21:31.919250 | 2015-05-05T21:28:33 | 2015-05-05T21:28:33 | 35,124,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package ch.kerbtier.procfx.operation;
import ch.kerbtier.procfx.core.DefaultRgbCanvasOperation;
public class InvertRgb extends DefaultRgbCanvasOperation {
@Override
public void calculate() {
super.calculate();
for (int cnt = 0; cnt < red.length; cnt++) {
red[cnt] = 1 - source.red()[cnt];
green[cnt] = 1 - source.green()[cnt];
blue[cnt] = 1 - source.blue()[cnt];
}
}
}
| [
"chrigi@kerbtier.ch"
] | chrigi@kerbtier.ch |
0b5a0475f716698d7c54b52e5694546dcb0e8f6a | d3aa66c53cbb8436a4ad9c5ac8bdda480274af09 | /src/com/alpha/practicalwork26/work3/Runner.java | 67a13935ab6671dfc170add51e4874e0086e85b1 | [] | no_license | Senat77/CodeSpace | 1aaff2c6f8e085ab329ffb8f77f5162def46517a | 92b6af8d50d2da281ca92d2c77046f5edb328e63 | refs/heads/master | 2023-04-25T11:49:16.899343 | 2021-05-20T12:42:52 | 2021-05-20T12:42:52 | 348,309,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package com.alpha.practicalwork26.work3;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Runner {
public void run() throws IOException {
System.out.println(Shape.parseShape("Rectangle:RED:10,20"));
System.out.println(Shape.parseShape("Circle:BLACK:10"));
System.out.println(Shape.parseShape("Triangle:GREEN:9,7,12"));
System.out.println(Shape.parseShape("Tri:GREEN:9,7,12"));
System.out.println(Shape.parseShapeV2("Rectangle:RED:10,20"));
System.out.println(Shape.parseShapeV2("Circle:BLACK:10"));
System.out.println(Shape.parseShapeV2("Triangle:GREEN:9,7,12"));
System.out.println(Shape.parseShapeV2("Tri:GREEN:9,7,12"));
List<Shape> shapes = new ArrayList<>();
while(true) {
System.out.println("\nCreate figure ? (y/n)");
int b = System.in.read();
if((char)b == 'n')
break;
if((char)b == 'y') {
System.out.println("Input figure signature :");
Scanner sc = new Scanner(System.in);
sc.nextLine();
Shape shape = Shape.parseShapeV2(sc.nextLine());
if(shape != null)
shapes.add(shape);
}
}
printShapes(shapes);
}
private void printShapes(List<Shape> shapes) {
shapes.forEach(System.out::println);
}
}
| [
"xcorex77@gmail.com"
] | xcorex77@gmail.com |
05f6e81e5bd7312c52a0ea60f7c9c511d33a46b4 | 983be94f423bfe023017118651872adb5b0a88c8 | /src/main/java/com/openuniversity/springjwt/payload/response/ProductDetailsResponse.java | 7d0a850a0f45840776b4c32052d353a364d10512 | [] | no_license | Chathura941010890/shanuki-seeds | bcb911e97bc88f4e667189c40fe9f396e3aae022 | 1e800c6cf918cc6adc39b5019c658442ae68fc0b | refs/heads/master | 2022-12-28T03:48:11.384798 | 2020-10-12T05:42:04 | 2020-10-12T05:42:04 | 303,286,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package com.openuniversity.springjwt.payload.response;
public class ProductDetailsResponse {
private String code;
private String name;
public ProductDetailsResponse(String code, String name){
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"nwjay@ou.ac.lk"
] | nwjay@ou.ac.lk |
7ccbf552817dc32f9f5afbea0aa0049cbe5c31f0 | 6ceff5785906d3ccf8ca57b5f40e080d982ccffb | /week-04/day-02/Instruments/src/com/greenfox/music/ElectricGuitar.java | 2a0fbe7530c4a592019d4e34dd716e40da305662 | [] | no_license | green-fox-academy/Dorkadodo | 62e4ee0d34a52fa997dc74bc1cf506d7993f39ba | 482d5767825176adf92fb28fd4e652a20b21340d | refs/heads/master | 2023-03-03T09:52:16.103242 | 2021-02-19T16:07:49 | 2021-02-19T16:07:49 | 313,962,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.greenfox.music;
public class ElectricGuitar extends StringedInstrument{
public ElectricGuitar (){
this (6);
}
public ElectricGuitar (int numberOfStrings){
super(numberOfStrings, "Electric Guitar");
this.numberOfStrings = numberOfStrings;
}
@Override
protected String sound() {
return "Twang";
}
}
| [
"pal.dorka.91@gmail.com"
] | pal.dorka.91@gmail.com |
8601300c86201d2bbe1064a4979677bf86982568 | 0a1b2a9dce325b5926cde04bd2e5c8bccb4682c5 | /src/main/java/com/jashepherd/studies/java/ocajavase8/ch05_class_design/s03_interfaces/e01/E1CanBurrow.java | e77e76e91f55f7658ca6d42d308d17ac2c4b6963 | [] | no_license | Mijaco/oca-java-standar-edition-8-v1 | 4d9b8fb826091926db7fc130661dc6b068e2164d | 428601bc38eef1ab07344f65244ae7d66ace3e36 | refs/heads/master | 2020-04-01T18:53:07.229361 | 2019-05-08T03:48:47 | 2019-05-08T03:48:47 | 153,521,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.jashepherd.studies.java.ocajavase8.ch05_class_design.s03_interfaces.e01;
/**
* Chapter 5: Class Design<br>
* Implementing Interfaces<br>
* pages 266-267
*/
public interface E1CanBurrow {
public static final int MINIMUM_DEPTH = 2;
public abstract int getMaximumDepth();
}
| [
"jeremy.shepherd@outlook.com"
] | jeremy.shepherd@outlook.com |
83a91d2e43b87b8d706a3adae6e13dcaf8512976 | 4120f8e68d2882724dbf46d5f6b62781f2d5454e | /app/src/androidTest/java/com/example/dex/mvpexample/ExampleInstrumentedTest.java | 693f71a9080aa89f6d79b2e9acfbfe29817a03ba | [] | no_license | Dex1019/mvp-practice-app | 1667b8ba38890051708631f2abaec3e522c8c2f2 | 169e84bd6eb3afcb4b71aaed61f32d3e256a9e82 | refs/heads/master | 2020-03-07T07:15:42.514248 | 2018-03-29T20:48:05 | 2018-03-29T20:55:15 | 127,344,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.example.dex.mvpexample;
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.assertEquals;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.dex.mvpexample", appContext.getPackageName());
}
}
| [
"ranjan.praful@gmail.com"
] | ranjan.praful@gmail.com |
5d3ad01a2c5c0cee5f32f7851a4be9868bdfa8bc | 4987a3f8af6a131df07fecf6ac27c119e245a237 | /app/src/main/java/es/pjd/ui/slideshow/SlideshowFragment.java | 8beabfee379a2a450cd2c8fd5fda8304f65bf885 | [] | no_license | paris1984/join_ong | 8dc4670d32d2d8af7e5e899920ab6a294e2f548a | 32ae2815ae548d25b55be7f2cb95a5430f204fa4 | refs/heads/master | 2021-04-20T11:29:19.697144 | 2020-04-07T15:14:39 | 2020-04-07T15:14:39 | 249,679,516 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package es.pjd.ui.slideshow;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import es.pjd.R;
public class SlideshowFragment extends Fragment {
private SlideshowViewModel slideshowViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
slideshowViewModel =
ViewModelProviders.of(this).get(SlideshowViewModel.class);
View root = inflater.inflate(R.layout.fragment_slideshow, container, false);
final TextView textView = root.findViewById(R.id.text_slideshow);
slideshowViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
}
| [
"jlmartinr1984@gmail.com"
] | jlmartinr1984@gmail.com |
bfa9d2eb0e5cb53bff5c7fb7f23c577b2f3cff0d | 3100ea40e252dee31d1f3bafe6cc71805948a088 | /src/main/java/ru/pfo/controller/HomeController.java | 113a44f4f248d3372f1c520e179b8b8a4a00d991 | [] | no_license | eugenscobich/PFO | ae1605ac640c368226a7d2e85337ecb9b7d01297 | 29983b00f387fd6f5991e2d514cf03476f203d39 | refs/heads/master | 2021-01-19T21:37:18.248417 | 2012-07-05T19:29:31 | 2012-07-05T19:29:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package ru.pfo.controller;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import ru.pfo.model.VideoNews;
@Controller
public class HomeController extends BaseController {
private static final Logger LOG = Logger.getLogger(HomeController.class);
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Model model, HttpServletRequest request) {
LOG.debug("Home Controler");
LOG.debug(request.getServerName());
List<VideoNews> videoNewses = videoNewsService.getVideoNewses(1);
int totalPages = videoNewsService.getTotalPage();
OutputStreamWriter writer = new OutputStreamWriter(new ByteArrayOutputStream());
String enc = writer.getEncoding();
model.addAttribute("enc", enc);
model.addAttribute("videoNewses", videoNewses);
model.addAttribute("page", 1);
model.addAttribute("totalPages", totalPages);
return "home";
}
}
| [
"eugen.scobich@mail.ru"
] | eugen.scobich@mail.ru |
b386d241ff82a73ca792a9287cb61ccbff789477 | 7a4d7f51b0a1a436818f8fa0b0fc710b26ea5041 | /session3Assignment3_3JP/src/session3Assignment3_3PKG/TVSetMapper3_3.java | 46c9aa419bd726f02ace172f236f7e4ce1f6c22e | [] | no_license | SujitMK/ACD_BigData-Hadoop_Session3_Assignment3 | 69d578bc18ff8553c7b6a0c0103faa0fda639929 | b79e6e220c876c76b27b9137d10bbab743369331 | refs/heads/master | 2021-08-08T17:31:09.801962 | 2017-11-10T19:15:37 | 2017-11-10T19:15:37 | 110,282,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package session3Assignment3_3PKG;
import org.apache.hadoop.io.*;
import java.io.IOException;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;
public class TVSetMapper3_3 extends Mapper<LongWritable, Text, Text, IntWritable>{
public void map(LongWritable key, Text values, Context context) throws IOException, InterruptedException
{
String strArray[] = values.toString().split("\\|");
if(strArray[0].equals("Onida"))
{
context.write(new Text(strArray[3]), new IntWritable(1));
}
}
}
| [
"sujit@hadoopsn"
] | sujit@hadoopsn |
603239b858c50e0542ff7f7ca93cc4a719303a1f | 7f235718d5b8d57e4b990b82db57dd9b3e6c01d7 | /src/handleFile/FileHandler.java | 018ff10d21116afe5498686fe949fb133da105bc | [] | no_license | waynewae/CurrentConsumptionAutoTest | 069f6803700cb40b92c08bca43308805268b03cb | 9544eec2054b240a70007c7da854cf1101cd35ef | refs/heads/master | 2021-01-10T18:46:01.898525 | 2015-06-29T12:15:11 | 2015-06-29T12:15:11 | 38,230,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,109 | java | package handleFile;
import javax.swing.*;
import java.io.*;
public class FileHandler {
String fileName;
String prefix;
String name;
String durationStr;
String configPath;
String dirPath;
int duration = 0;
public FileHandler() {}
public void exportBatchfile (ListModel<String> listModel, int CurrMeas) throws IOException {
FileWriter bat = new FileWriter("AutoTest.bat");
for(int i = 0 ; i < listModel.getSize() ; i++) {
fileName = listModel.getElementAt(i);
if(fileName.contains(".")) {
prefix = fileName.substring(0, fileName.indexOf('.'));
} else {
prefix = fileName;
}
name = prefix.substring(0, prefix.indexOf('_'));
durationStr = prefix.substring(prefix.indexOf('_') + 1);
// if not 1st script, wait 10s
if(i != 0) {
if(CurrMeas == 1) {
bat.write("ping 127.0.0.1 -n 10 -w 1000 > nul" + "\n");
} else {
duration = Integer.parseInt(durationStr) + 10;
bat.write("ping 127.0.0.1 -n "
+ duration
+ " -w 1000 > nul" + "\n");
}
}
// write AutoTest cmd
bat.write("adb shell am start -a com.fihtdc.autotesting.autoaction "
+ "-n com.fihtdc.autotesting/.AutoTestingMain -e path /sdcard/AutoTesting/"
+ prefix
+ "/" + "\n");
if(CurrMeas == 1) {
// wait 5s between AutoTest and Current record
bat.write("ping 127.0.0.1 -n 5 -w 1000 > nul" + "\n");
// write PowerTool cmd
bat.write("PowerToolCmd /savefile=" + name + ".pt4"
+ " /trigger=DTYD" + duration + "A "
+ "/vout=3.8 /USB=AUTO /keeppower /noexitwait" + "\n");
}
}
bat.flush();
bat.close();
}
public void exportScript (ListModel<String> listModel, int CurrMeas) {
for(int i = 0 ; i < listModel.getSize() ; i++) {
fileName = listModel.getElementAt(i);
if(fileName.contains(".")) {
prefix = fileName.substring(0, listModel.getElementAt(i).indexOf('.'));
// create config.xml
dirPath = "./" + prefix;
configPath = dirPath + "/config.xml";
File config = new File(dirPath);
config.mkdirs();
// write it
try {
createConfig(configPath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// move script into dir
moveScript(fileName , dirPath + "/" + fileName + ".txt");
}
}
if(CurrMeas == 0){
// create config.xml in <Tool_Home>/AutotestScripts/
dirPath = "./AutotestScripts/";
configPath = dirPath + "config.xml";
File config = new File(dirPath);
config.mkdirs();
// write it
try {
createConfig(configPath, listModel);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// copy script to <Tool_Home>/AutotestScripts/
for(int i = 0 ; i < listModel.getSize() ; i++) {
fileName = listModel.getElementAt(i);
copyScript(fileName , dirPath + "/" + fileName + ".txt");
}
}
}
// export scripts and config file without current measurement
private void createConfig(String configPath, ListModel<String> listModel) throws IOException {
FileWriter configWriter = new FileWriter(configPath);
configWriter.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "\n");
configWriter.write("<AutoTest>" + "\n");
configWriter.write("<Prefs>" + "\n");
configWriter.write("<LogReport>" + "\n");
configWriter.write("<LogPathName>/sdcard/AutoTesting/.report/" + fileName + ".txt</LogPathName>" + "\n");
configWriter.write("</LogReport>" + "\n");
configWriter.write("</Prefs>" + "\n");
configWriter.write("<LoopCount>1</LoopCount>" + "\n");
// write test cases
for(int i = 0 ; i < listModel.getSize() ; i++) {
fileName = listModel.getElementAt(i);
configWriter.write("<TestCase>" + "\n");
configWriter.write("<check>true</check>" + "\n");
configWriter.write("<name>" + fileName + ".txt</name>" + "\n");
configWriter.write("<loop>1</loop> " + "\n");
configWriter.write("</TestCase>" + "\n");
}
configWriter.write("</AutoTest>" + "\n");
configWriter.flush();
configWriter.close();
}
// export scripts and config files for current measurement
private void createConfig(String configPath) throws IOException {
FileWriter configWriter = new FileWriter(configPath);
configWriter.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "\n");
configWriter.write("<AutoTest>" + "\n");
configWriter.write("<Prefs>" + "\n");
configWriter.write("<LogReport>" + "\n");
configWriter.write("<LogPathName>/sdcard/AutoTesting/.report/" + fileName + ".txt</LogPathName>" + "\n");
configWriter.write("</LogReport>" + "\n");
configWriter.write("</Prefs>" + "\n");
configWriter.write("<LoopCount>1</LoopCount>" + "\n");
configWriter.write("<TestCase>" + "\n");
configWriter.write("<check>true</check>" + "\n");
configWriter.write("<name>" + fileName + ".txt</name>" + "\n");
configWriter.write("<loop>1</loop> " + "\n");
configWriter.write("</TestCase>" + "\n");
configWriter.write("</AutoTest>" + "\n");
configWriter.flush();
configWriter.close();
}
private void moveScript(String OriFilePath, String NewFilePath) {
File source = new File(OriFilePath);
File dst = new File(NewFilePath);
source.renameTo(dst);
}
private void copyScript(String OriFilePath, String NewFilePath) {
File source = new File(OriFilePath);
File dst = new File(NewFilePath);
try {
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(dst);
// For creating a byte type buffer
byte[] buf = new byte[1024];
int len;
// For writing to another specified file from buffer buf
while ((len = in.read(buf)) > 0){
out.write(buf, 0, len);
}
in.close();
out.close();
} catch(IOException e) {
e.printStackTrace();
}
}
}
| [
"waynewae@gmail.com"
] | waynewae@gmail.com |
34de655abbe1fe472c219c858b0a8ab356d21406 | 170af6ed27f7292e63b217109d4869eacd4a53e6 | /iobswitch/src/main/java/de/fehngarten/iobswitch/data/ConfigLightsceneRow.java | ba497c85ca1090ad1a0955d275c79c9e567d853f | [] | no_license | winne27/IOBswitch | 0bfd6944c421eaca5025154877c3f9cba83a9066 | cac35bbab6eaaf1340c342c38afa6b2bd482a086 | refs/heads/master | 2022-12-15T02:39:54.706491 | 2020-09-12T15:30:43 | 2020-09-12T15:30:43 | 294,993,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package de.fehngarten.iobswitch.data;
public class ConfigLightsceneRow implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
public String unit;
public String name;
public Boolean enabled;
public Boolean isHeader;
public Boolean showHeader;
public ConfigLightsceneRow(String unit, String name, Boolean enabled, Boolean isHeader, Boolean showHeader)
{
this.unit = unit;
this.name = name;
this.enabled = enabled;
this.isHeader = isHeader;
this.showHeader = showHeader;
}
} | [
"werner@schaeffer.net"
] | werner@schaeffer.net |
29038500b1a8fad23c994a8b291792c32f672881 | 8742cb30489e31ba700cd49d95f6a73d7ef040dd | /selenide-tutorial/src/test/java/org/kd/lot/PO_Lot_FlightSearch.java | 77504fb5d512738e459d9bb53bdd343bba04462a | [] | no_license | kdrzazga/webautomation-tutorial | 2293e8b26b02a678340881d8fce3ef0bf1187f9f | 1c70cb1778e3bf4acbdf12f60eb977f48f3af5ed | refs/heads/main | 2023-01-31T06:59:23.176857 | 2020-12-07T19:54:07 | 2020-12-07T19:54:07 | 306,806,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,242 | java | package org.kd.lot;
import com.codeborne.selenide.SelenideElement;
import io.qameta.allure.Description;
import io.qameta.allure.Severity;
import io.qameta.allure.SeverityLevel;
import io.qameta.allure.Story;
import org.kd.common.BasePage;
import org.kd.common.Lib;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.junit.Test;
import java.util.Objects;
import static com.codeborne.selenide.Selenide.*;
public class PO_Lot_FlightSearch extends BasePage {
private final Lib lib = new Lib();
public PO_Lot_FlightSearch() {
super("https://www.lot.com/pl/en/");
}
@Severity(SeverityLevel.NORMAL)
@Story("{empty}")
@Description("")
@Test
public void searchFlight(LotFlight testData) {
open(url);
enterAirports(testData.getDepartureAirport(), testData.getArrivalAirport());
enterDepartureDate(lib.convertDate(testData.getDepartureDate()));
enterReturnDate(lib.convertDate(testData.getReturnDate()));
enterPassengerCount(testData.getPassengerNumber());
enterTicketClass(testData.getCabinClass());
clickSearchButton();
System.out.println("Navigated to " + title());
//TODO assert title()
sleep(3000);
}
public void clickSearchButton() {
$x("//button[@type='submit' and span/text()='Search' and not(contains(@style,'displayed:false'))]")
.click();
}
public void enterTicketClass(String cabinClass) {
$("#select2-ticketClass-container").click();
Objects.requireNonNull(getFocusedElement()).sendKeys(cabinClass);
getFocusedElement().sendKeys(Keys.ENTER);
}
public void enterPassengerCount(int count) {
$(By.id("passenger-switch")).click();
Objects.requireNonNull(getFocusedElement()).sendKeys(Integer.valueOf(count).toString());
getFocusedElement().sendKeys(Keys.ENTER);
}
public void enterReturnDate(String dateAsText) {
$("#returnDate-display").click();
Objects.requireNonNull(getFocusedElement()).sendKeys(dateAsText);
getFocusedElement().sendKeys(Keys.ENTER);
}
public void enterDepartureDate(String dateAsText) {
$(By.id("departureDate-display")).click();
Objects.requireNonNull(getFocusedElement()).sendKeys(dateAsText);
getFocusedElement().sendKeys(Keys.ENTER);
}
public void enterAirports(String departureAirport, String arrivalAirport) {
sleep(1000);
SelenideElement arrivalAirportTextbox = $x("//span/span[text()='Choose or enter arrival airport']");
//SelenideElement arrivalAirportTextbox = $(withText("Choose or enter arrival airport"));
arrivalAirportTextbox.click();
Objects.requireNonNull(getFocusedElement()).click();
getFocusedElement().sendKeys(arrivalAirport);
getFocusedElement().sendKeys(Keys.ENTER);
SelenideElement departureAirportElement = $("#departureAirport-label");
departureAirportElement.click();
getFocusedElement().sendKeys(departureAirport);
getFocusedElement().sendKeys(Keys.ENTER);
sleep(1000);
}
@Override
public void navigate() {
System.err.println("No URL");
}
} | [
"krzysztof.drzazga@op.pl"
] | krzysztof.drzazga@op.pl |
15dfadb1cf27f99339d47b364231bab1d7e63b45 | 4ea504039b46a2d92922cc2745b2246993859da7 | /gulimall-product/src/main/java/com/lis2/gulimall/product/service/CommentReplayService.java | 063dfa52d23496875f73c8eae2b895cb12d12094 | [
"Apache-2.0"
] | permissive | winslis2/gulimall | 379c836195666f2bd04691e4c2f93fa4b4ba3e21 | 5a85c84142fa94ce912a2a5022aeeb9e87824bac | refs/heads/main | 2023-02-15T15:37:58.939714 | 2021-01-04T02:28:36 | 2021-01-04T02:28:36 | 318,439,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.lis2.gulimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lis2.common.utils.PageUtils;
import com.lis2.gulimall.product.entity.CommentReplayEntity;
import java.util.Map;
/**
* 商品评价回复关系
*
* @author lis2
* @email rekunming@gmail.com
* @date 2020-12-08 11:22:34
*/
public interface CommentReplayService extends IService<CommentReplayEntity> {
PageUtils queryPage(Map<String, Object> params);
}
| [
"kunmingqaq@163.com"
] | kunmingqaq@163.com |
e56031853a14c5fabee9466a18e909fca412b0cb | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /cdn-20180510/src/main/java/com/aliyun/cdn20180510/models/SetCdnDomainSSLCertificateResponseBody.java | 400b5336fb35e421c20e7c15f40a4c8e2388525e | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 785 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.cdn20180510.models;
import com.aliyun.tea.*;
public class SetCdnDomainSSLCertificateResponseBody extends TeaModel {
/**
* <p>The ID of the request.</p>
*/
@NameInMap("RequestId")
public String requestId;
public static SetCdnDomainSSLCertificateResponseBody build(java.util.Map<String, ?> map) throws Exception {
SetCdnDomainSSLCertificateResponseBody self = new SetCdnDomainSSLCertificateResponseBody();
return TeaModel.build(map, self);
}
public SetCdnDomainSSLCertificateResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
f981da5492346f6f84bbbdbbb0c735135f36dfa5 | 73091e849efce3eb0d962650afcd32f838d91bcd | /app/src/main/java/com/example/demomusicplay/Album.java | a951e9015028f90978143148fcfd163427a60ddb | [] | no_license | prakhar2002/Demo-Play-Music-App | 9a594c4ace83a12fbc442e48fb051a998ba516fb | 3beb55d48f55afa87bbd9827daf3d171e705e540 | refs/heads/master | 2020-04-24T16:28:23.403346 | 2019-02-22T17:46:35 | 2019-02-22T17:46:35 | 172,108,286 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.example.demomusicplay;
public class Album {
private String album;
private String location;
public Album(String musicalbum,String locationimg){
album=musicalbum;
location=locationimg;
}
public String getAlbum(){return album;}
public String getAlbumart(){return location;}
}
| [
"prakharsingh2002@gmail.com"
] | prakharsingh2002@gmail.com |
5ad1402ddbe1345816c7b2e1094dcf3ef7e431a6 | 8443088d086bc7fac0558254d3d8e138247ab432 | /src/main/java/kodlamaio/hrms/entities/concretes/Candidate.java | 18f408d302b7081e71092f25680b005e54d9f25e | [] | no_license | hasancifci/HRMS | 2e922389e455229d5ea62bb49f01483cad05a59d | 7e4798055ed6bdc65537ec9c3273b299d36c2b7e | refs/heads/master | 2023-05-29T00:31:01.989692 | 2021-06-01T22:44:31 | 2021-06-01T22:44:31 | 371,142,936 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package kodlamaio.hrms.entities.concretes;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = false)
@Data
@Entity
@Table(name="candidates")
@AllArgsConstructor
@NoArgsConstructor
public class Candidate extends User{
@Column(name="first_name")
private String firstName;
@Column(name="last_name")
private String lastName;
@Column(name="identity_number")
private String identityNumber;
@Column(name="birth_year")
private Date birthYear;
}
| [
"hasancifcii@outlook.com"
] | hasancifcii@outlook.com |
1bdf03d17ade8f1eb8e87cfeb0d4908e1d470a84 | 43a27b80ce1a8cf422142f5a43044917ff17a7cf | /src/leetcode/SurroundedRegions.java | f52a15615b702715472908d4193db66ae2cfa10b | [] | no_license | bignamehyp/interview | 321cbe4c5763b2fc6d2ba31354d627af649fe4ed | 73c3a3e94c96994afdbc4236888456c8c08b6ee4 | refs/heads/master | 2021-01-25T08:49:30.249961 | 2015-03-07T07:34:00 | 2015-03-07T07:34:00 | 23,125,534 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | package leetcode;
import java.util.ArrayList;
import java.util.LinkedList;
public class SurroundedRegions {
public void solve(char[][] board) {
if(board == null || board.length == 0)
return;
int numRows = board.length;
int numCols = board[0].length;
if(numRows <= 2 || numCols <= 2)
return;
for(int col = 0; col < numCols; col++){
if(board[0][col] == 'O'){
bfs(0, col, numRows, numCols, board);
}
}
for(int row = 1; row < numRows; row++){
if(board[row][numCols - 1] == 'O'){
bfs(row, numCols - 1, numRows, numCols, board);
}
}
for(int col = 0; col < numCols - 1; col++){
if(board[numRows - 1][col] == 'O'){
bfs(numRows - 1, col, numRows, numCols, board);
}
}
for(int row = 1; row < numRows - 1; row++){
if(board[row][0] == 'O'){
bfs(row, 0, numRows, numCols, board);
}
}
for(int row = 1; row < numRows - 1; row++){
for(int col = 1; col < numCols - 1; col++){
if(board[row][col] == 'O')
board[row][col] = 'X';
if(board[row][col] == 'Y')
board[row][col] = 'O';
}
}
}
void bfs( int row, int col,int numRows, int numCols, char [][] board){
boolean [][] visited = new boolean[numRows][numCols];
LinkedList<Integer> queue = new LinkedList<Integer>();
queue.add(row * numCols + col);
visited[row][col] = true;
while(queue.size() > 0){
int idx1D = queue.removeFirst();
int parent_c = idx1D % numCols;
int parent_r = (idx1D - parent_c ) /numCols;
ArrayList<Integer> children = getChildren(parent_r, parent_c, numRows, numCols, board);
for(int child : children){
int child_c = child % numCols;
int child_r = (child - child_c)/numCols;
if(visited[child_r][child_c] == false){
board[child_r][child_c] = 'Y';
queue.add(child);
visited[child_r][child_c] = true;
}
}
}
}
ArrayList<Integer> getChildren(int r, int c, int numRows, int numCols, char [][] board){
ArrayList<Integer> children = new ArrayList<Integer>();
if( r + 1 < numRows - 1 && c!= 0 && c != numCols -1 && board[r+1][c] == 'O'){
children.add( ( r + 1) * numCols + c);
}
if( r - 1 > 0 && c!= 0 && c != numCols -1 && board[r - 1][c] == 'O'){
children.add( ( r - 1) * numCols + c);
}
if( c + 1 < numCols - 1 && r != 0 && r != numRows - 1 && board[r][c+1] == 'O'){
children.add( r * numCols + c + 1);
}
if( c - 1 > 0 && r != 0 && r != numRows - 1 && board[r][c-1] == 'O'){
children.add( r * numCols + c - 1);
}
return children;
}
public static void main(String [] args){
SurroundedRegions s = new SurroundedRegions();
char[][] board = new char[3][3];
for(int r = 0; r < board.length; r++)
for(int c = 0; c < board[0].length; c++)
board[r][c] = 'X';
board[1][1] = 'O';
s.solve(board);
}
}
| [
"huangyp@kalman.(none)"
] | huangyp@kalman.(none) |
7526a6357da28c15735e07b0934fc55a1240d4f1 | 098cc825e4abf3126de66ac13a0b4be133d04da9 | /netty-hello-server/src/main/java/com/imtzp/nio/OptionSupport.java | aba30795fb95823c06733483a76a7b2cfae6ab0d | [] | no_license | logan2013/tutorials | 00abcba2aa0fb5f87d0a349f4a53196bb4f5ebff | 20a6f266b52d0487514ca9abd4b567e78a08e090 | refs/heads/master | 2020-12-08T04:11:01.887708 | 2017-05-18T10:18:45 | 2017-05-18T10:18:45 | 67,680,275 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package com.imtzp.nio;
import java.net.SocketOption;
import java.nio.channels.AsynchronousServerSocketChannel;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.DatagramChannel;
import java.nio.channels.NetworkChannel;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
public class OptionSupport {
public static void main(String[] args) throws Exception {
printOptions(SocketChannel.open());
printOptions(ServerSocketChannel.open());
printOptions(AsynchronousSocketChannel.open());
printOptions(AsynchronousServerSocketChannel.open());
printOptions(DatagramChannel.open());
}
private static void printOptions(NetworkChannel channel) throws Exception {
System.out.println(channel.getClass().getSimpleName() + " supports:");
for (SocketOption<?> option : channel.supportedOptions()) {
Object optValue = null;
try {
optValue = channel.getOption(option);
} catch (Error e) {
e.printStackTrace();
}
System.out.println(option.name() + ": " + optValue);
}
System.out.println();
channel.close();
}
}
| [
"laogang@imtzp.com"
] | laogang@imtzp.com |
e1658371bb50dffbd555e32d65c683c4b20bbd9b | f4e685f5666d63e60ece749898e9c523fe0e263f | /app/src/main/java/com/yellfun/demo/ui/map/MapLoadClickMapActivity.java | 0c141c4ba04f3fc1e8608c7e8e16ecc7bf481af8 | [] | no_license | YellFunGit/IndoorunSDKAndroidDemo | d732d79bd2d6edd52bf6d09d78daae1a5c47ed92 | 68458201e63ec807a70bb905e5f58ed2c3529a28 | refs/heads/master | 2020-04-03T00:51:25.480985 | 2017-03-24T03:39:41 | 2017-03-24T03:39:41 | 70,447,338 | 7 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,775 | java | package com.yellfun.demo.ui.map;
import android.os.Bundle;
import android.widget.TextView;
import com.indoorun.mapapi.control.Idr;
import com.indoorun.mapapi.map.gl.IdrMapView;
import com.yellfun.demo.R;
import com.yellfun.demo.ui.BaseActionbarActivity;
import java.util.Locale;
import butterknife.BindView;
public class MapLoadClickMapActivity extends BaseActionbarActivity {
@BindView(R.id.map_click_view)
IdrMapView mapView;
@BindView(R.id.tipsView)
TextView tipsView;
Idr idr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_load_map_click);
setTitleTxt("地图点击事件");
idr = Idr.with(mapView);
idr.loadRegion("14428254382730015")// 加载region
.onMapClick((mapLoader, pointF) -> {// 这里返回的pointF是地图坐标,而不是屏幕坐标,也就是说可能为负数
tipsView.setText(String.format(Locale.CHINA, "点击的坐标: x-> %.2f y-> %.2f", pointF.x, pointF.y));
return true;//返回一个boolean, 用来拦截点击事件,如果返回true,则不响应其他的unit或者marker的点击事件,返回false则继续响应其他的点击事件
})
.loadFloor("14557583851000004");//加载指定楼层
}
@Override
protected void onResume() {
super.onResume();
idr.begin();// 调用此方法,用来resume MapView,以此来初始化地磁传感器
}
@Override
protected void onPause() {
idr.end();
super.onPause();
}
@Override
protected void onDestroy() {
idr.destory();
super.onDestroy();
}
}
| [
"363564023@qq.com"
] | 363564023@qq.com |
cc76b8cebc03b6f1894ac4626d1e6aab78579f25 | 64b0c9cb6905ecbdbdfdd100ee8c8ed4c389364b | /src/main/java/org/bian/dto/CRATMNetworkOperatingSessionExchangeInputModel.java | 7b479ec5e49efb0d9d34f169a72fccf71d7267a0 | [
"Apache-2.0"
] | permissive | bianapis/sd-atm-network-operations-v3 | 23705a2be61032e2aaf872734ef42fdd97993c18 | 84e0854c7575def373d4a348edaaa8c9b1f48299 | refs/heads/master | 2022-12-24T13:17:51.052211 | 2020-09-26T07:15:12 | 2020-09-26T07:15:12 | 297,950,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,344 | java | package org.bian.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.bian.dto.CRATMNetworkOperatingSessionExchangeInputModelATMNetworkOperatingSessionExchangeActionRequest;
import javax.validation.Valid;
/**
* CRATMNetworkOperatingSessionExchangeInputModel
*/
public class CRATMNetworkOperatingSessionExchangeInputModel {
private String atMNetworkOperationsServicingSessionReference = null;
private String atMNetworkOperatingSessionInstanceReference = null;
private String atMNetworkOperatingSessionSchedule = null;
private String atMNetworkOperatingSessionStatus = null;
private String atMNetworkOperatingSessionUsageLog = null;
private String atMNetworkOperatingSessionReference = null;
private String atMNetworkOperatingSessionServiceProviderReference = null;
private String atMNetworkOperatingSessionType = null;
private String atMNetworkOperatingSessionServiceProviderSchedule = null;
private String atMNetworkOperatingSessionServiceType = null;
private String atMNetworkOperatingSessionServiceConfiguration = null;
private Object atMNetworkOperatingSessionExchangeActionTaskRecord = null;
private CRATMNetworkOperatingSessionExchangeInputModelATMNetworkOperatingSessionExchangeActionRequest atMNetworkOperatingSessionExchangeActionRequest = null;
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the active servicing session
* @return atMNetworkOperationsServicingSessionReference
**/
public String getAtMNetworkOperationsServicingSessionReference() {
return atMNetworkOperationsServicingSessionReference;
}
public void setAtMNetworkOperationsServicingSessionReference(String atMNetworkOperationsServicingSessionReference) {
this.atMNetworkOperationsServicingSessionReference = atMNetworkOperationsServicingSessionReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the ATM Network Operating Session instance
* @return atMNetworkOperatingSessionInstanceReference
**/
public String getAtMNetworkOperatingSessionInstanceReference() {
return atMNetworkOperatingSessionInstanceReference;
}
public void setAtMNetworkOperatingSessionInstanceReference(String atMNetworkOperatingSessionInstanceReference) {
this.atMNetworkOperatingSessionInstanceReference = atMNetworkOperatingSessionInstanceReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The timetable of ATMNetwork Operating Session
* @return atMNetworkOperatingSessionSchedule
**/
public String getAtMNetworkOperatingSessionSchedule() {
return atMNetworkOperatingSessionSchedule;
}
public void setAtMNetworkOperatingSessionSchedule(String atMNetworkOperatingSessionSchedule) {
this.atMNetworkOperatingSessionSchedule = atMNetworkOperatingSessionSchedule;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The status of ATMNetwork Operating Session
* @return atMNetworkOperatingSessionStatus
**/
public String getAtMNetworkOperatingSessionStatus() {
return atMNetworkOperatingSessionStatus;
}
public void setAtMNetworkOperatingSessionStatus(String atMNetworkOperatingSessionStatus) {
this.atMNetworkOperatingSessionStatus = atMNetworkOperatingSessionStatus;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Reference to the log of (usage) ativities/events of ATMNetwork Operating Session
* @return atMNetworkOperatingSessionUsageLog
**/
public String getAtMNetworkOperatingSessionUsageLog() {
return atMNetworkOperatingSessionUsageLog;
}
public void setAtMNetworkOperatingSessionUsageLog(String atMNetworkOperatingSessionUsageLog) {
this.atMNetworkOperatingSessionUsageLog = atMNetworkOperatingSessionUsageLog;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the party who is involved in ATMNetwork Operating Session
* @return atMNetworkOperatingSessionReference
**/
public String getAtMNetworkOperatingSessionReference() {
return atMNetworkOperatingSessionReference;
}
public void setAtMNetworkOperatingSessionReference(String atMNetworkOperatingSessionReference) {
this.atMNetworkOperatingSessionReference = atMNetworkOperatingSessionReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the party who provides the services of ATMNetwork Operating Session
* @return atMNetworkOperatingSessionServiceProviderReference
**/
public String getAtMNetworkOperatingSessionServiceProviderReference() {
return atMNetworkOperatingSessionServiceProviderReference;
}
public void setAtMNetworkOperatingSessionServiceProviderReference(String atMNetworkOperatingSessionServiceProviderReference) {
this.atMNetworkOperatingSessionServiceProviderReference = atMNetworkOperatingSessionServiceProviderReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: A Classification value that distinguishes between the type of operations within ATMNetwork Operating Session
* @return atMNetworkOperatingSessionType
**/
public String getAtMNetworkOperatingSessionType() {
return atMNetworkOperatingSessionType;
}
public void setAtMNetworkOperatingSessionType(String atMNetworkOperatingSessionType) {
this.atMNetworkOperatingSessionType = atMNetworkOperatingSessionType;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The schedule according to which the service provider will operate the ATMNetwork Operating Session
* @return atMNetworkOperatingSessionServiceProviderSchedule
**/
public String getAtMNetworkOperatingSessionServiceProviderSchedule() {
return atMNetworkOperatingSessionServiceProviderSchedule;
}
public void setAtMNetworkOperatingSessionServiceProviderSchedule(String atMNetworkOperatingSessionServiceProviderSchedule) {
this.atMNetworkOperatingSessionServiceProviderSchedule = atMNetworkOperatingSessionServiceProviderSchedule;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: A Classification value that distinguishes between the type of services within ATMNetwork Operating Session
* @return atMNetworkOperatingSessionServiceType
**/
public String getAtMNetworkOperatingSessionServiceType() {
return atMNetworkOperatingSessionServiceType;
}
public void setAtMNetworkOperatingSessionServiceType(String atMNetworkOperatingSessionServiceType) {
this.atMNetworkOperatingSessionServiceType = atMNetworkOperatingSessionServiceType;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The configuration of ATMNetwork Operating Session
* @return atMNetworkOperatingSessionServiceConfiguration
**/
public String getAtMNetworkOperatingSessionServiceConfiguration() {
return atMNetworkOperatingSessionServiceConfiguration;
}
public void setAtMNetworkOperatingSessionServiceConfiguration(String atMNetworkOperatingSessionServiceConfiguration) {
this.atMNetworkOperatingSessionServiceConfiguration = atMNetworkOperatingSessionServiceConfiguration;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Binary general-info: The exchange service call consolidated processing record
* @return atMNetworkOperatingSessionExchangeActionTaskRecord
**/
public Object getAtMNetworkOperatingSessionExchangeActionTaskRecord() {
return atMNetworkOperatingSessionExchangeActionTaskRecord;
}
public void setAtMNetworkOperatingSessionExchangeActionTaskRecord(Object atMNetworkOperatingSessionExchangeActionTaskRecord) {
this.atMNetworkOperatingSessionExchangeActionTaskRecord = atMNetworkOperatingSessionExchangeActionTaskRecord;
}
/**
* Get atMNetworkOperatingSessionExchangeActionRequest
* @return atMNetworkOperatingSessionExchangeActionRequest
**/
public CRATMNetworkOperatingSessionExchangeInputModelATMNetworkOperatingSessionExchangeActionRequest getAtMNetworkOperatingSessionExchangeActionRequest() {
return atMNetworkOperatingSessionExchangeActionRequest;
}
public void setAtMNetworkOperatingSessionExchangeActionRequest(CRATMNetworkOperatingSessionExchangeInputModelATMNetworkOperatingSessionExchangeActionRequest atMNetworkOperatingSessionExchangeActionRequest) {
this.atMNetworkOperatingSessionExchangeActionRequest = atMNetworkOperatingSessionExchangeActionRequest;
}
}
| [
"spabandara@Virtusa.com"
] | spabandara@Virtusa.com |
9f7256cf321358b4c7dc495d46114c9e4007c525 | 103ca90ab8c96bd84e6a9a536150015f7d4c522d | /app/src/main/java/com/example/eumesmo/listatarefas2/MainActivity.java | fe7d3d44fdbc07ed4589d7768649556a8702226e | [] | no_license | jorgemtoledo/ListaTarefas2 | 09cc1b751d8ddb322c761be2d1c9221019a9f780 | c22215098749539ce8fd4f3d2ae78ac928c8d173 | refs/heads/master | 2021-01-17T19:11:22.763955 | 2016-06-03T04:04:25 | 2016-06-03T04:04:25 | 59,977,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,730 | java | package com.example.eumesmo.listatarefas2;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
public class MainActivity extends AppCompatActivity {
private String data_compromisso;
private ListView lista_de_compromissos;
private Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Banco_de_dados banco_de_dados = new Banco_de_dados(getBaseContext());
cursor = banco_de_dados.carregaDados();
String[] nomeCampos = new String[] {Manter_bd.data_inicio,Manter_bd.hora_inicio, Manter_bd.descricao,Manter_bd.tipo_de_evento,Manter_bd.ocorrencias,Manter_bd.qntd_ocorrencias,Manter_bd.participantes,Manter_bd.temp};
int[] idViews = new int[] {R.id.v_data_inicio,R.id.v_horario_inicial, R.id.v_descricao,R.id.v_tipo_do_evento,R.id.spinner2,R.id.spinner3,R.id.participantes,R.id.radio};
SimpleCursorAdapter adaptador = new SimpleCursorAdapter(this,R.layout.activity_grid_layout,cursor,nomeCampos,idViews, 0);
lista_de_compromissos = (ListView)findViewById(R.id.lista_de_compromissos);
lista_de_compromissos.setAdapter(adaptador);
lista_de_compromissos.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String codigo;
cursor.moveToPosition(position);
codigo = cursor.getString(cursor.getColumnIndexOrThrow(Manter_bd.Id));
Intent intent = new Intent(MainActivity.this, Tela_de_alteracao.class);
intent.putExtra("codigo", codigo);
startActivity(intent);
finish();
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, Calendario.class);
startActivity(intent);
}
});
}
}
| [
"jorge.toledo@gmail.com"
] | jorge.toledo@gmail.com |
6e76aff62f784b6a3a833de46cec0e1aad6dfcd9 | 841b39d8938af096dcd39c33382525abb428884f | /intellij/play/src/GuiObjectDisplayMinimized.java | 9ca51f8a8c91fb4c7129e7c018a17b5e175fb732 | [] | no_license | YanWittmann/rpgengine | 4201ce5986818bc503e754c682db546536098859 | d76fcacf0371beb331dc5a37ac56a019725dde5d | refs/heads/master | 2023-03-22T21:21:06.116466 | 2021-03-11T18:59:22 | 2021-03-11T18:59:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,763 | java |
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
public class GuiObjectDisplayMinimized extends JFrame {
private JLabel l_objectName;
private JLabel l_variable;
private int x_size = 2, y_size = 2;
private int currentY = 5;
private String desc;
private BufferedImage image;
private boolean imageActive = false;
private GuiObjectDisplayMinimized self = this;
private Entity entity;
public GuiObjectDisplayMinimized(Entity entity) {
if (entity == null) return;
this.entity = entity;
try {
this.setTitle(entity.name);
int textWidth = StaticStuff.getLongestLineWidth(entity.name.split("<br>"), StaticStuff.getPixelatedFont());
int textHeight = StaticStuff.getTextHeightWithFont(entity.name, StaticStuff.getPixelatedFont());
x_size = Interpreter.getScaledValue(textWidth + 100);
y_size = Interpreter.getScaledValue(textHeight + 32);
JPanel contentPane = new JPanel(null) {
public void paintComponent(Graphics g) {
g.setColor(StaticStuff.getColor("white_border"));
g.fillRoundRect(0, 0, x_size, y_size, 20, 20);
if (entity.type.equals("Color"))
g.setColor(StaticStuff.getColor(entity.name));
else g.setColor(StaticStuff.getColor("background"));
g.fillRoundRect(Interpreter.getScaledValue(3), Interpreter.getScaledValue(3), x_size - Interpreter.getScaledValue(6), y_size - Interpreter.getScaledValue(6), 20, 20);
}
};
setUndecorated(true);
setAlwaysOnTop(true);
contentPane.setBackground(new Color(0, 0, 0, 0));
setBackground(new Color(0, 0, 0, 0));
setIconImage(new ImageIcon("res/img/icongreen.png").getImage());
this.setSize(x_size, y_size);
contentPane.setPreferredSize(new Dimension(x_size, y_size));
l_objectName = new JLabel("<html><center><b>" + StaticStuff.prepareString(entity.name), SwingConstants.CENTER);
l_objectName.setBounds(Interpreter.getScaledValue(4), Interpreter.getScaledValue(-2), x_size, textHeight);
l_objectName.setBackground(new Color(214, 217, 223));
l_objectName.setForeground(new Color(255, 255, 255));
l_objectName.setEnabled(true);
l_objectName.setFont(StaticStuff.getPixelatedFont());
l_objectName.setVisible(true);
contentPane.add(l_objectName);
l_variable = new JLabel("test", SwingConstants.CENTER);
Log.add(textHeight);
l_variable.setBounds(Interpreter.getScaledValue(4), textHeight - Interpreter.getScaledValue(15), x_size, textHeight);
l_variable.setBackground(new Color(214, 217, 223));
l_variable.setForeground(new Color(255, 255, 255));
l_variable.setEnabled(true);
l_variable.setFont(StaticStuff.getPixelatedFont(10f));
l_variable.setVisible(true);
contentPane.add(l_variable);
containsValidVariables = getAvailableVariables();
nextVariable();
this.add(contentPane);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
setLocation(getX() + StaticStuff.randomNumber(Interpreter.getScaledValue(-200), Interpreter.getScaledValue(200)), getY() + StaticStuff.randomNumber(Interpreter.getScaledValue(-200), Interpreter.getScaledValue(200)));
this.pack();
this.setVisible(true);
addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
nextVariable();
}
});
addListener(this);
addListener(l_objectName);
Log.add("Opened minimized object " + entity.uid);
} catch (Exception e) {
Log.add("Unable to open minimized object: " + e);
}
}
private int variableIndex = -1;
private ArrayList<String> containsValidVariables;
private void nextVariable() {
if (containsValidVariables == null)
l_variable.setText("<html>" + StaticStuff.prepareString(Interpreter.lang("popupObjectNoVariables")));
variableIndex = (variableIndex + 1) % containsValidVariables.size();
if (Interpreter.lang("varNames" + containsValidVariables.get(variableIndex)).equals("missingString"))
l_variable.setText("<html>" + StaticStuff.prepareString("[[aqua:" + containsValidVariables.get(variableIndex) + "]] = [[blue:" + entity.getVariableValueSilent(containsValidVariables.get(variableIndex)) + "]]"));
else
l_variable.setText("<html>" + StaticStuff.prepareString("[[aqua:" + Interpreter.lang("varNames" + containsValidVariables.get(variableIndex)) + "]] = [[blue:" + entity.getVariableValueSilent(containsValidVariables.get(variableIndex)) + "]]"));
}
private ArrayList<String> getAvailableVariables() {
ArrayList<String> vars = new ArrayList<>();
for (String s : Interpreter.getObjectFrameVariables())
if (entity.variableExists(s))
vars.add(s);
if (vars.size() == 0)
return null;
return vars;
}
public void updateFrameObject(Entity entity) {
if (containsValidVariables == null)
l_variable.setText("<html>" + StaticStuff.prepareString(Interpreter.lang("popupObjectNoVariables")));
if (Interpreter.lang("varNames" + containsValidVariables.get(variableIndex)).equals("missingString"))
l_variable.setText("<html>" + StaticStuff.prepareString("[[aqua:" + containsValidVariables.get(variableIndex) + "]] = [[blue:" + entity.getVariableValueSilent(containsValidVariables.get(variableIndex)) + "]]"));
else
l_variable.setText("<html>" + StaticStuff.prepareString("[[aqua:" + Interpreter.lang("varNames" + containsValidVariables.get(variableIndex)) + "]] = [[blue:" + entity.getVariableValueSilent(containsValidVariables.get(variableIndex)) + "]]"));
}
int pX, pY;
private boolean dragActive = false;
private void addListener(Component c) {
c.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
if (me.getButton() == MouseEvent.BUTTON2) {
for (int currentOpacity = 100; currentOpacity > 0; currentOpacity -= 3) {
try {
Thread.sleep(2);
} catch (Exception e) {
}
setOpacity(currentOpacity * 0.01f);
}
dispose();
GuiObjectDisplay.close(entity);
}
dragActive = true;
pX = me.getX();
pY = me.getY();
toFront();
repaint();
}
public void mouseReleased(MouseEvent me) {
dragActive = false;
}
public void mouseDragged(MouseEvent me) {
if (dragActive) setLocation(getLocation().x + me.getX() - pX, getLocation().y + me.getY() - pY);
}
});
c.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent me) {
if (dragActive) setLocation(getLocation().x + me.getX() - pX, getLocation().y + me.getY() - pY);
}
});
}
}
| [
"order@yanwittmann.de"
] | order@yanwittmann.de |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.