blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
b2893feaa5cd38ad0392f4545358da4185f6402f
bc47d5b382230a14d69533f5c3b6026f20791ca2
/src/com/atguigu/java8/FilterEmployeeForSalary.java
9caa17fabc73e18e6522b58ccd3c6f2af7da428a
[]
no_license
fanguoyin/fgy
3ed1c9d9694938683e5478e1cd0e5290351f4fcd
dbb0297b48e2e409607b51401676ddf31a41267e
refs/heads/master
2020-07-11T21:18:39.511814
2019-08-30T09:13:42
2019-08-30T09:13:42
204,645,881
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
package com.atguigu.java8; public class FilterEmployeeForSalary implements MyPredicate<Employee> { public FilterEmployeeForSalary() { } @Override public boolean test(Employee t, Integer b) { return t.getSalary() >= 5000; } }
71fe9c3eb85ea7d617136241f4d471eed7e39d59
b85dd40b58db6e97e9ce580d2457980b213be344
/app/src/main/java/com/example/besedka/MessageAdapter.java
2b72d8595c69c84d095b5a7de677d00a0934d55e
[]
no_license
SerikRakhimov/Android_ChatExzamen
a19cb6c31845fb8bfed0b53d335acc7dd1572193
cfd7bb97a928674c3e13be2fa026f715be4e116f
refs/heads/main
2023-01-22T06:27:33.962326
2020-12-04T16:13:40
2020-12-04T16:13:40
318,569,654
0
0
null
null
null
null
UTF-8
Java
false
false
2,114
java
package com.example.besedka; import android.graphics.Color; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.InfoViewHolder> { private List<Message> messages; private String usernameMain; public MessageAdapter(List<Message> messages, String username) { this.messages = messages; this.usernameMain = username; } @NonNull @Override public InfoViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_message_item, parent, false); return new InfoViewHolder(v); } @Override public void onBindViewHolder(@NonNull InfoViewHolder holder, int position) { Message message = messages.get(position); holder.userName.setText(message.getUsername() + ":"); holder.text.setText(message.getText()); if (message.getUsername().equalsIgnoreCase(usernameMain)) { holder.userName.setGravity(Gravity.RIGHT); holder.text.setGravity(Gravity.RIGHT); holder.text.setTextColor(Color.BLACK); } else{ holder.userName.setGravity(Gravity.LEFT); holder.text.setGravity(Gravity.LEFT); holder.text.setTextColor(Color.DKGRAY); } ; } @Override public int getItemCount() { return messages.size(); } static class InfoViewHolder extends RecyclerView.ViewHolder { public TextView userName, text; public InfoViewHolder(@NonNull View itemView) { super(itemView); userName = itemView.findViewById(R.id.userName); text = itemView.findViewById(R.id.text); } } Message getItem(int id) { return messages.get(id); } }
6a85a5046f9d74cc297e3be0d38cff500cd7ce78
fe80737f354a056bc2e087f259be27e52ab4e09d
/src/org/ecclesiacantic/gui/types/local/LocalFilePropertiesPane.java
ac79aea0fadea9e3bb1a9f6fabf4932995b9382d
[]
no_license
paulcottin/inscription_ecclesia
2022996ebe7d03767cc0c7d3272c62147141e35d
74f59260f3d101ef85e560bcc7267b04e144acde
refs/heads/master
2023-04-27T14:45:52.264953
2020-01-12T12:44:45
2020-01-12T12:44:45
169,984,358
0
0
null
2023-04-14T17:48:48
2019-02-10T14:03:18
Java
UTF-8
Java
false
false
3,067
java
package org.ecclesiacantic.gui.types.local; import javafx.scene.control.TitledPane; import javafx.scene.layout.VBox; import org.ecclesiacantic.config.EnumConfigProperty; import org.ecclesiacantic.gui.properties.FileFieldProperty; import org.ecclesiacantic.gui.properties.TextFieldProperty; public class LocalFilePropertiesPane extends TitledPane { public LocalFilePropertiesPane() { super(); setText("Fichiers locaux"); setExpanded(false); setContent(new VBox(10, initLocalSourceFilesPane(), initLocalExportFilesPane() )); } private final TitledPane initLocalSourceFilesPane() { final TitledPane locTitledPane = new TitledPane(); locTitledPane.setText("Fichiers sources locaux"); locTitledPane.setContent(new VBox(10, new FileFieldProperty("Fichier d'import des participants", EnumConfigProperty.INPUT_F_PARTICIPANT).toHbox(), new FileFieldProperty("Fichier d'import des master classes", EnumConfigProperty.INPUT_F_MC).toHbox(), new FileFieldProperty("Fichier d'import des salles", EnumConfigProperty.INPUT_F_SALLE).toHbox(), new FileFieldProperty("Fichier d'import des chorales", EnumConfigProperty.INPUT_F_CHORALE).toHbox(), new FileFieldProperty("Fichier d'import des solos géographiques", EnumConfigProperty.INPUT_F_SOLO_GEO).toHbox(), new FileFieldProperty("Fichier d'import des groupes de concert", EnumConfigProperty.INPUT_F_GROUP_CONCERT).toHbox() ) ); return locTitledPane; } private final TitledPane initLocalExportFilesPane() { final TitledPane locTitledPane = new TitledPane(); locTitledPane.setText("Fichiers d'export des résultats"); locTitledPane.setContent(new VBox(10, new TextFieldProperty("Fichier d'export des salles par MC", EnumConfigProperty.OUTPUT_F_SALLE).toHbox(), new TextFieldProperty("Fichier d'export des badges", EnumConfigProperty.OUTPUT_F_BADGE).toHbox(), new TextFieldProperty("Fichier d'export des groupes d'évangélisation", EnumConfigProperty.OUTPUT_F_G_EVAN).toHbox(), new TextFieldProperty("Fichier d'export des groupes de concert", EnumConfigProperty.OUTPUT_F_G_CONCERT).toHbox(), new TextFieldProperty("Fichier d'export des mailing list", EnumConfigProperty.OUTPUT_F_MAILING_L).toHbox(), new TextFieldProperty("Fichier d'export des nb de participants par MC", EnumConfigProperty.OUTPUT_F_NB_PART_BY_CRENEAU).toHbox(), new TextFieldProperty("Fichier d'export des participants par groupe d'évangélisation", EnumConfigProperty.OUTPUT_F_G_EVAN_PART_RELATION).toHbox(), new TextFieldProperty("Fichier d'export des feuilles d'appel de MC", EnumConfigProperty.OUTPUT_D_MC_CHECKLIST).toHbox() ) ); return locTitledPane; } }
658729ecf3faffb817a191b2102bbb250f5eee8d
c8c59aafc5811b12fc3f888a75fa62dfc78084d8
/src/main/java/org/valesz/crypt/core/atbas/AtbasOutput.java
5208e7a7731aea7a5462dba1e66ee5b4705e0a54
[]
no_license
Cajova-Houba/BIT-sifry
9f0010cd5d3e14082a7514a6d1c501c2532ca9c9
d7eacf21669ae0d227d91a596fe7ef9ac4fe4afe
refs/heads/master
2021-01-22T20:34:26.903748
2017-05-17T11:32:29
2017-05-17T11:32:29
85,330,974
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package org.valesz.crypt.core.atbas; import org.valesz.crypt.core.EncryptionMethodOutput; /** * Created by Zdenek Vales on 17.4.2017. */ public class AtbasOutput implements EncryptionMethodOutput { private final String openText; public AtbasOutput(String openText) { this.openText = openText; } public String getText() { return openText; } }
00c55aeafe6968d9ea27754ac8d2dc170181e296
64f2bc4cb987c058cb09f3655ac8308d2449c847
/gengzi_spring_security/src/main/java/fun/gengzi/gengzi_spring_security/service/impl/UserDetailsServiceImpl.java
699589849ead1bd687ef6caa6c26d8d0ea8040e8
[]
no_license
Biepingfan/gengzi_spring_security
3df2dc6fcce491fc18af62e47ffd0daee1f68672
a54112302212ccabbee2751e6c91a0b2b9f910ab
refs/heads/master
2023-01-27T14:52:36.223079
2020-12-05T06:14:40
2020-12-05T06:14:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,806
java
package fun.gengzi.gengzi_spring_security.service.impl; import fun.gengzi.gengzi_spring_security.constant.RspCodeEnum; import fun.gengzi.gengzi_spring_security.constant.UserStatusEnum; import fun.gengzi.gengzi_spring_security.exception.RrException; import fun.gengzi.gengzi_spring_security.sys.controller.UsersController; import fun.gengzi.gengzi_spring_security.sys.service.UsersService; import fun.gengzi.gengzi_spring_security.user.UserDetail; import fun.gengzi.gengzi_spring_security.vo.ReturnData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.HashSet; /** * <h1>用户详细服务impl</h1> * <p> * 用于返回根据用户名返回用户详细信息,以便于供 security 使用 * * @author gengzi * @date 2020年11月3日15:24:43 */ @Service public class UserDetailsServiceImpl implements UserDetailsService { @Autowired private UsersService usersService; @Autowired private PasswordEncoder passwordEncoder; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { // ReturnData result = new ReturnData(); // 构造一个简单的 用户信息 // UserDetail userDetailByDb = new UserDetail(); // userDetailByDb.setUsername("user"); // userDetailByDb.setPassword(passwordEncoder.encode("111")); // userDetailByDb.setStatus(1); // HashSet<GrantedAuthority> roleSet = new HashSet<>(); // SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority("ADMIN"); // roleSet.add(simpleGrantedAuthority); // userDetailByDb.setAuthorities(roleSet); // // result.setInfo(userDetailByDb); ReturnData result = usersService.loadUserByUsername(username); if (RspCodeEnum.NOTOKEN.getCode() == result.getStatus()) { throw new RrException(RspCodeEnum.ACCOUNT_NOT_EXIST.getDesc()); } UserDetail userDetail = (UserDetail) result.getInfo(); if (userDetail == null) { throw new RrException(RspCodeEnum.ACCOUNT_NOT_EXIST.getDesc()); } //账号不可用 if (userDetail.getStatus() == UserStatusEnum.DISABLE.getValue()) { userDetail.setEnabled(false); } return userDetail; } }
cc1d3d523d8b046f3aa9b12a140f7e2fbb531add
2322d14dfc8c3cd69ae0c8796da7a8a66c2b856d
/src/main/java/com/divyansh/demo/models/Speaker.java
038e53fd2fd3480e88e94423da708b5cb92ee85a
[]
no_license
andDivyansh/FirstSpringBootApp
c28fb3fcf853d7bc57923fdfab4f7325263f98d2
e9fa8cece568d13bdda3f13a7c3993f8a4b2dfb7
refs/heads/master
2023-08-30T19:35:33.253639
2021-10-16T16:07:10
2021-10-16T16:07:10
291,644,643
0
0
null
null
null
null
UTF-8
Java
false
false
2,114
java
package com.divyansh.demo.models; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.hibernate.annotations.Type; import javax.persistence.*; import java.util.List; @Entity(name = "speakers") @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) public class Speaker { public Speaker() {} @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "speaker_id") private Long speakerId; @Column(name = "first_name") private String firstName; @Column(name = "last_name") private String lastName; private String title; private String company; @Column(name = "speaker_bio") private String speakerBio; @Lob @Type(type = "org.hibernate.type.BinaryType") @Column(name = "speaker_photo") private byte[] speakerPhoto; @ManyToMany(mappedBy = "speakerList") // To ignore the back serialisation to speakers @JsonIgnore private List<Session> sessions; public List<Session> getSessions() { return sessions; } public void setSessions(List<Session> sessions) { this.sessions = sessions; } public Long getSpeakerId() { return speakerId; } public void setSpeakerId(Long speakerId) { this.speakerId = speakerId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } public String getSpeakerBio() { return speakerBio; } public void setSpeakerBio(String speakerBio) { this.speakerBio = speakerBio; } }
eb7250c6f2300fc64b1a52c58e82c916b9cd6014
8e9268bbea492083fc7d6e8a86f6b68ed3460f29
/src/org/project/cims/management/resources/MessageManager.java
48fa3daf1bf385b95ab320893f90a2afa7ef5f8e
[]
no_license
Deepak2478/SmartHospital
bb9076d466a13a635a3b7a03503339b5916e1758
2020a69c255f7eb29945e388280faf5e0b2240bd
refs/heads/master
2020-03-31T08:52:22.647728
2018-10-08T12:23:46
2018-10-08T12:23:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package org.project.cims.management.resources; import java.util.Date; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.project.cims.management.database.messages.dto.MessagesDB; import org.project.cims.management.model.MessageCollection; import org.project.cims.management.service.MessageServices; @Path("/messages") public class MessageManager extends SessionFactoryCreator{ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String addMessage(MessagesDB db){ db.setDate(new Date().toString()); return new MessageServices().addMessage(db, session); } @GET @Path("/{eid}") @Produces(MediaType.APPLICATION_JSON) public MessageCollection getMessages(@PathParam("eid") int eid){ return new MessageServices().getMessageById(eid, session); } @GET @Path("/byId/{mid}") @Produces(MediaType.APPLICATION_JSON) public MessageCollection getMessage(@PathParam("mid") int mid){ return new MessageServices().getMessage(mid, session); } }
976940ed8f2f1141433a92e9ac154d858c3e0491
7b5bd6f75a12e465ec0626c1288ee03d37b9149d
/JavaSyntaxHomework/src/GetFirstOddOrEvenElements.java
0d5c721068664769ce4edc5677d741f37e5ba5ee
[]
no_license
TheRandomTroll/MyHomeworks
a43b3b2fa72c2363e4ff358243ea1959514964cc
a5232986466aee722f6546475df57b5e5e44f654
refs/heads/master
2021-01-10T15:13:34.216857
2016-04-04T12:24:16
2016-04-04T12:24:16
55,396,891
0
0
null
null
null
null
UTF-8
Java
false
false
1,315
java
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class GetFirstOddOrEvenElements { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int[] arr = Arrays.stream(reader.nextLine().split(" ")).map(String::trim).mapToInt(Integer::parseInt).toArray(); String[] command = reader.nextLine().split(" "); System.out.println(getElements(arr, Integer.parseInt(command[1]), command[2])); } public static ArrayList<Integer> getElements(int[] array, int count, String numberType) { ArrayList<Integer> output = new ArrayList<>(); // This integer traces when the number return limit was reached. int a = 0; for (int i : array) { if (a < count){ switch (numberType){ case "odd": if (i % 2 != 0){ output.add(i); } break; case "even": if (i % 2 == 0){ output.add(i); } break; } a++; }else { break; } } return output; } }
[ "Mihail Gerginov" ]
Mihail Gerginov
ddaf2df529ef43c9ca148dc889830c922ddd5380
d95553f04ce6f1383b4646ed7fd63c7d6de6fa1a
/src/main/java/ch/stoeoeoe/demo/config/JacksonConfiguration.java
b1d07910a3b32b5ab49969f6f0ca1239903c151c
[]
no_license
wangxinxx/flowableSimpleDemoApplication
fb7a246d4db230e622080cac4967a52e047693b8
687f5e11d6aa120ff0cb3350230f799d699c134b
refs/heads/master
2020-05-27T05:17:34.286435
2018-06-26T17:07:03
2018-06-26T17:07:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,230
java
package ch.stoeoeoe.demo.config; import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.zalando.problem.ProblemModule; import org.zalando.problem.validation.ConstraintViolationProblemModule; @Configuration public class JacksonConfiguration { /* * Support for Hibernate types in Jackson. */ @Bean public Hibernate5Module hibernate5Module() { return new Hibernate5Module(); } /* * Jackson Afterburner module to speed up serialization/deserialization. */ @Bean public AfterburnerModule afterburnerModule() { return new AfterburnerModule(); } /* * Module for serialization/deserialization of RFC7807 Problem. */ @Bean ProblemModule problemModule() { return new ProblemModule(); } /* * Module for serialization/deserialization of ConstraintViolationProblem. */ @Bean ConstraintViolationProblemModule constraintViolationProblemModule() { return new ConstraintViolationProblemModule(); } }
b78ff5c8444c851ba5b238268688f6493533a55a
55afdb87804d2a7bb3f53baa116351c831c51868
/app/build/generated/source/r/debug/android/support/v7/cardview/R.java
0d756d1492de837070dbbe7729beabcfe39ddde7
[]
no_license
snach/VkShopLIst
670329f1e10724bdf6762501aba87821d29cfac8
2acf74db118deccfec00463a60bc4520e43495b5
refs/heads/master
2021-01-12T18:24:38.447757
2016-11-03T14:56:07
2016-11-03T14:56:07
72,360,088
0
0
null
2016-10-30T16:11:55
2016-10-30T16:11:54
null
UTF-8
Java
false
false
2,725
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 android.support.v7.cardview; public final class R { public static final class attr { public static final int cardBackgroundColor = 0x7f0100a5; public static final int cardCornerRadius = 0x7f0100a6; public static final int cardElevation = 0x7f0100a7; public static final int cardMaxElevation = 0x7f0100a8; public static final int cardPreventCornerOverlap = 0x7f0100aa; public static final int cardUseCompatPadding = 0x7f0100a9; public static final int contentPadding = 0x7f0100ab; public static final int contentPaddingBottom = 0x7f0100af; public static final int contentPaddingLeft = 0x7f0100ac; public static final int contentPaddingRight = 0x7f0100ad; public static final int contentPaddingTop = 0x7f0100ae; } public static final class color { public static final int cardview_dark_background = 0x7f0e0012; public static final int cardview_light_background = 0x7f0e0013; public static final int cardview_shadow_end_color = 0x7f0e0014; public static final int cardview_shadow_start_color = 0x7f0e0015; } public static final class dimen { public static final int cardview_compat_inset_shadow = 0x7f090053; public static final int cardview_default_elevation = 0x7f090054; public static final int cardview_default_radius = 0x7f090055; } public static final class style { public static final int Base_CardView = 0x7f0a009c; public static final int CardView = 0x7f0a008f; public static final int CardView_Dark = 0x7f0a00cb; public static final int CardView_Light = 0x7f0a00cc; } public static final class styleable { public static final int[] CardView = { 0x0101013f, 0x01010140, 0x7f0100a5, 0x7f0100a6, 0x7f0100a7, 0x7f0100a8, 0x7f0100a9, 0x7f0100aa, 0x7f0100ab, 0x7f0100ac, 0x7f0100ad, 0x7f0100ae, 0x7f0100af }; public static final int CardView_android_minHeight = 1; public static final int CardView_android_minWidth = 0; public static final int CardView_cardBackgroundColor = 2; public static final int CardView_cardCornerRadius = 3; public static final int CardView_cardElevation = 4; public static final int CardView_cardMaxElevation = 5; public static final int CardView_cardPreventCornerOverlap = 7; public static final int CardView_cardUseCompatPadding = 6; public static final int CardView_contentPadding = 8; public static final int CardView_contentPaddingBottom = 12; public static final int CardView_contentPaddingLeft = 9; public static final int CardView_contentPaddingRight = 10; public static final int CardView_contentPaddingTop = 11; } }
5a63d21c1f6346d5720b2a444405f8a238300eec
3edcfb40b23dcec04f628563841742547a9a835b
/java-base/ConcurrentCollection/src/com/zhoulesin/javabase/priorityblockingqueuedemo/Task.java
3bfb167e2de6227bd4b54ef1531ca5ddecf7bd07
[]
no_license
zhoulesin/JavaLearn
84d0b22153ecfa606d8c0f8adb04f112bba5cba4
35a7c55674f5fe7146fa33fe44f405b26fd02c92
refs/heads/master
2020-03-31T11:05:02.838392
2018-11-08T09:33:02
2018-11-08T09:33:02
152,162,825
0
1
null
null
null
null
UTF-8
Java
false
false
455
java
package com.zhoulesin.javabase.priorityblockingqueuedemo; import java.util.concurrent.PriorityBlockingQueue; public class Task implements Runnable{ private int id; private PriorityBlockingQueue<Event> queue; public Task(int id, PriorityBlockingQueue<Event> queue) { super(); this.id = id; this.queue = queue; } @Override public void run() { for (int i =0 ;i<100;i++) { Event event = new Event(id, i); queue.add(event); } } }
7798b8bb61bc9ea45683b41b6b683bc979574abf
3cd220e3fe112472d34cc3c8e91148d95108f832
/StockWatcher/src/com/google/gwt/sample/stockwatcher/server/GreetingServiceImpl.java
efb3661be7d4d2fdb4d83100be35480ec7cd3dd3
[]
no_license
willianparige/GWT
ba03abf8b2d29fcecc80f6893b77b541815c7d38
e5a38f21cb6071e0bd2fd9b7ff9308a191ae1ed1
refs/heads/master
2021-01-15T16:16:19.554240
2017-01-12T17:30:31
2017-01-12T17:30:31
78,769,287
0
0
null
null
null
null
ISO-8859-2
Java
false
false
1,599
java
package com.google.gwt.sample.stockwatcher.server; import com.google.gwt.sample.stockwatcher.client.GreetingService; import com.google.gwt.sample.stockwatcher.shared.FieldVerifier; import com.google.gwt.user.server.rpc.RemoteServiceServlet; /** * The server-side implementation of the RPC service. */ @SuppressWarnings("serial") public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService { public String greetServer(String input) throws IllegalArgumentException { // Verify that the input is valid. if (!FieldVerifier.isValidName(input)) { // If the input is not valid, throw an IllegalArgumentException back to // the client. throw new IllegalArgumentException("Name must be at least 4 characters long"); } String serverInfo = getServletContext().getServerInfo(); String userAgent = getThreadLocalRequest().getHeader("User-Agent"); // Escape data from the client to avoid cross-site script vulnerabilities. input = escapeHtml(input); userAgent = escapeHtml(userAgent); return "Olá, " + input + "!<br><br>Executando o " + serverInfo + ".<br><br>Veja também como utilizar:<br>" + userAgent; } /** * Escape an html string. Escaping data received from the client helps to * prevent cross-site script vulnerabilities. * * @param html the html string to escape * @return the escaped string */ private String escapeHtml(String html) { if (html == null) { return null; } return html.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;"); } }
542ec865fa36590c34e4ece626ae356a28b547ba
164eaee76f4c494428e82ec18c3d5099cd78abdf
/Module2/AdvancedObjectOrientedDesign/src/TrienKhaiInterface/SquareTest.java
fcd610bb15126367e2db6e28e4c43cbbe6089288
[]
no_license
Hphuong96/Module_HuynhHoaiPhuong
3d66cc4407ad1e5206c9d03895f8d6aecd6d4c91
4af585c427f4c5814f868056cb1972e6eca4f248
refs/heads/master
2023-01-12T21:01:48.477005
2020-02-24T01:42:19
2020-02-24T01:42:19
215,205,995
0
0
null
2023-01-07T21:26:40
2019-10-15T04:22:23
CSS
UTF-8
Java
false
false
340
java
package TrienKhaiInterface; public class SquareTest { public static void main(String[] args) { Square square = new Square(); System.out.println(square); square = new Square(2.3); System.out.println(square); square = new Square(5.8, "yellow", true); System.out.println(square); } }
ae4706e08256b9f831eefe148482b3b3673b9cb0
c17a0b1900a28d20ae920f2daaea7deb9a3a573c
/src/com/test/annotation/AnnotationTests.java
56597476ac0d06d52a52c15f6922b56bbd4222c5
[]
no_license
zhang13/javatest
16d5f8cd84bd3ca6cb45b865dec486e5621e193c
ac0f3bb31e39a4c7f542f71bb3c0be1480a720a9
refs/heads/master
2021-01-23T03:28:37.431156
2017-06-13T02:07:58
2017-06-13T02:07:58
34,498,857
0
1
null
null
null
null
GB18030
Java
false
false
1,212
java
package com.test.annotation; //显示所有注释类和方法 import java.lang.annotation.*; import java.lang.reflect.*; @Retention(RetentionPolicy.RUNTIME) @interface MyAnno { String str(); int val(); } @Retention(RetentionPolicy.RUNTIME) @interface What { String description(); } @What(description = "An annotation test class") @MyAnno(str = "Meta2", val = 99) class Meta2 { @What(description = "An annotation test method") @MyAnno(str = "Testing", val = 100) public static void myMeth() { Meta2 ob = new Meta2(); try { Annotation annos[] = ob.getClass().getAnnotations(); // Display all annotations for Meta2. System.out.println("All annotations for Meta2:"); for (Annotation a : annos) System.out.println(a); System.out.println(); // Display all annotations for myMeth. Method m = ob.getClass().getMethod("myMeth"); annos = m.getAnnotations(); System.out.println("All annotations for myMeth:"); for (Annotation a : annos) System.out.println(a); } catch (NoSuchMethodException exc) { System.out.println("Method Not Found."); } } public static void main(String args[]) { myMeth(); } }
79b777574098ce842d47c54d1d70e605ba4481ab
321e743d4290067c83daa20cca02a239d1948854
/camomile/src/classes/org/camomile/db/DbExecuteUpdate.java
c490f73f7660991705049f60b437df4cec836a96
[]
no_license
wmwragg/Camomile
8a78fe47b42dc8d1c50ee0f71fa6a68140e86d78
7401339e007af49886bd1fa012d78ad0b0994713
refs/heads/master
2021-01-25T08:54:11.296051
2019-04-16T07:19:00
2019-04-16T07:19:00
1,604,384
2
0
null
null
null
null
UTF-8
Java
false
false
1,813
java
package org.camomile.db; import javax.ws.rs.*; import javax.naming.*; import org.json.*; import javax.sql.*; import java.sql.*; import java.util.*; import org.camomile.exceptions.*; // Immutable query class public final class DbExecuteUpdate { private final JSONObject jobj = new JSONObject(); public DbExecuteUpdate(String connection, String update) { String error; Connection con = null; Statement stmt = null; // Get connection try { con = DriverManager.getConnection("jdbc:apache:commons:dbcp:" + connection); } catch (SQLException cnfe) { error = "SQLException: Could not connect to database - " + cnfe; throw new CamomileInternalServerErrorException(error); } catch (Exception e) { error = "Exception: An unkown error occurred while connecting to database - " + e; throw new CamomileInternalServerErrorException(error); } // Process update try{ stmt = con.createStatement(); int count = stmt.executeUpdate(update); jobj.put("count", count); } catch(SQLException e){ error = "SQLException: Could not exexcute the query - " + e; throw new CamomileInternalServerErrorException(error); } catch(Exception e){ error = "An unknown exception occured while retrieving data - " + e; throw new CamomileInternalServerErrorException(error); } finally { // Close resources try { if ( stmt != null ) { stmt.close(); } if ( con != null ) { con.close(); } } catch (SQLException sqle) { error = "SQLException: Unable to close the database connection - " + sqle; throw new CamomileInternalServerErrorException(error); } } } public final JSONObject getResult() { return jobj; } }
ba371dcc5cce0535dd282d73e2fe2cbeb74a00cf
8ccd1c071b19388f1f2e92c5e5dbedc78fead327
/src/main/java/ohos/com/sun/org/apache/xalan/internal/xsltc/compiler/CastCall.java
ea5927dcbe943781427bfff298bc4bcd6342c4f5
[]
no_license
yearsyan/Harmony-OS-Java-class-library
d6c135b6a672c4c9eebf9d3857016995edeb38c9
902adac4d7dca6fd82bb133c75c64f331b58b390
refs/heads/main
2023-06-11T21:41:32.097483
2021-06-24T05:35:32
2021-06-24T05:35:32
379,816,304
6
3
null
null
null
null
UTF-8
Java
false
false
2,834
java
package ohos.com.sun.org.apache.xalan.internal.xsltc.compiler; import java.util.Vector; import ohos.com.sun.org.apache.bcel.internal.generic.CHECKCAST; import ohos.com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import ohos.com.sun.org.apache.bcel.internal.generic.InstructionList; import ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; import ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType; import ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; import ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError; final class CastCall extends FunctionCall { private String _className; private Expression _right; public CastCall(QName qName, Vector vector) { super(qName, vector); } @Override // ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.FunctionCall, ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.Expression, ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode public Type typeCheck(SymbolTable symbolTable) throws TypeCheckError { if (argumentCount() == 2) { Expression argument = argument(0); if (argument instanceof LiteralExpr) { this._className = ((LiteralExpr) argument).getValue(); this._type = Type.newObjectType(this._className); this._right = argument(1); Type typeCheck = this._right.typeCheck(symbolTable); if (typeCheck == Type.Reference || (typeCheck instanceof ObjectType)) { return this._type; } throw new TypeCheckError(new ErrorMsg("DATA_CONVERSION_ERR", typeCheck, this._type, this)); } throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR, (Object) getName(), (SyntaxTreeNode) this)); } throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, (Object) getName(), (SyntaxTreeNode) this)); } @Override // ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.FunctionCall, ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.Expression, ohos.com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode public void translate(ClassGenerator classGenerator, MethodGenerator methodGenerator) { ConstantPoolGen constantPool = classGenerator.getConstantPool(); InstructionList instructionList = methodGenerator.getInstructionList(); this._right.translate(classGenerator, methodGenerator); instructionList.append(new CHECKCAST(constantPool.addClass(this._className))); } }
7f6b7ce14721efe7bae29a201525723a1cf7b0f0
e1fee52cfbd9a293dbc0ca128cbdfa09b6599b34
/GTD-Android/src/com/jeebook/android/gtd/util/DrawableUtils.java
6d367667ca95f21d841736e5168a8278b1b2e49c
[]
no_license
snaill/jee-android
384b6fdb230131f70c02278be8aa68a585056250
12de0bf2a31b1ddcd331fce35ec7e47919619d2b
refs/heads/master
2020-05-28T13:25:38.353499
2010-05-16T13:34:27
2010-05-16T13:34:27
32,121,729
0
0
null
null
null
null
UTF-8
Java
false
false
1,522
java
/* * Copyright (C) 2009 Android Shuffle Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jeebook.android.gtd.util; import android.graphics.Color; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable.Orientation; public class DrawableUtils { private DrawableUtils() { //deny } public static GradientDrawable createGradient(int colour, Orientation orientation) { return createGradient(colour, orientation, 1.1f, 0.9f); } public static GradientDrawable createGradient(int colour, Orientation orientation, float startOffset, float endOffset) { int[] colours = new int[2]; float[] hsv1 = new float[3]; float[] hsv2 = new float[3]; Color.colorToHSV(colour, hsv1); Color.colorToHSV(colour, hsv2); hsv1[2] *= startOffset; hsv2[2] *= endOffset; colours[0] = Color.HSVToColor(hsv1); colours[1] = Color.HSVToColor(hsv2); return new GradientDrawable(orientation, colours); } }
[ "com.chinaos.snaill@6ac803c6-2dd1-11df-9f25-831aa717a150" ]
com.chinaos.snaill@6ac803c6-2dd1-11df-9f25-831aa717a150
27f2660875e750a44f4e40053cd1c3b1768884a3
922a945f094e88f9dbaa9a7918236c14d7106b6d
/src/test/java/codedash/stacksqueues/MaxiStackTest.java
4e43441da72ea887c6c94887eed0c2eba8a3c5bb
[]
no_license
vsriram77/codedash
d12ad0cf1741b9f2eeb26b4ae023867a88ee7f5d
d7d35d57bd1a0f1e5d84af41d4a7d4f110f7e47a
refs/heads/master
2021-01-22T06:38:15.328996
2014-11-03T13:20:39
2014-11-03T13:20:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package codedash.stacksqueues; import codedash.stacksqueues.MaxiStack; import org.testng.Assert; import org.testng.annotations.Test; /** * Unit tests for MaxiStack */ public class MaxiStackTest { @Test public void testMax() throws Exception { MaxiStack ms = new MaxiStack(); ms.add(10).add(40).add(20).add(39).add(5); Assert.assertEquals(ms.max(), 40); } @Test public void testPop() throws Exception { MaxiStack ms = new MaxiStack(); ms.add(10).add(40).add(20).add(39).add(5); Assert.assertEquals(ms.pop(), 5); Assert.assertEquals(ms.pop(), 39); Assert.assertEquals(ms.pop(), 20); Assert.assertEquals(ms.pop(), 40); Assert.assertEquals(ms.pop(), 10); } }
312b251164934167b75ae9a85a685c5a6e2eb95a
aac396b201ac419a9f5ba3750956996a2863e37e
/app/src/main/java/com/apocalypse/browser/nest/NestHttpRequester/NestHttpRequest.java
07a21d1187f20cba1d787e490b09240052db628a
[]
no_license
CCDave/Nest
107feb04cd713d12719a77c68b1a4ecc8a396a68
c6536c2f4af139648ecb8f4c9cc6a22914caa760
refs/heads/master
2016-09-01T03:37:29.222989
2016-01-21T07:27:37
2016-01-21T07:27:37
49,860,938
0
0
null
null
null
null
UTF-8
Java
false
false
11,040
java
package com.apocalypse.browser.nest.NestHttpRequester; import android.content.Context; import android.os.Environment; import android.os.Message; import android.os.Handler; import android.os.HandlerThread; import com.apocalypse.browser.nest.utils.SimpleLog; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.UUID; /** * http请求 * 模式:post, get * Created by Dave on 2016/1/14. */ public class NestHttpRequest { public interface NestHttpCallback{ void CallBack(NestHttpResultData data); } public static class NestHttpResultData{ public Boolean isSucceed; public String filePath; public int responseCode; NestHttpResultData(){ isSucceed = false; filePath = ""; responseCode = 0; } } private static final int MSG_HTTP_GET_REQUEST = 1; private static final int MSG_HTTP_POST_REQUEST = 2; private static final String QUEUE_TASK_NAME = "NestHttpRequestQueueThread"; private static final String DEBUG_TAG = "NestHttpRequest"; private static NestHttpRequest mInstance; private Handler mHandler; private HandlerThread mTaskThread; public static NestHttpRequest getInstance(){ if (mInstance == null) { mInstance = new NestHttpRequest(); mInstance.initialize(); } return mInstance; } private static NestHttpRequestData getArgs(String url, int connectTimeOut, int downloadTimeOut, String cookies, Object postObject, String outFilePath, NestHttpCallback callBack){ NestHttpRequestData data = new NestHttpRequestData(); data.url = url; data.connectTimeOut = connectTimeOut; data.downloadTimeOut = downloadTimeOut; data.cookies = cookies; data.postObject = postObject; data.filePath = outFilePath; data.callBack = callBack; return data; } public static NestHttpResultData postQueueTask(String url, int connectTimeOut, int downloadTimeOut, String cookies, Object postObject, String filePath) { NestHttpRequestData data = getArgs(url, connectTimeOut, downloadTimeOut, cookies, postObject, filePath, null); try { return getInstance().httpPostRequest(data); } catch (IOException e) { e.printStackTrace(); } return new NestHttpResultData(); } public static boolean postQueueTask(String url, int connectTimeOut, int downloadTimeOut, String cookies, Object postObject, String filePath, NestHttpCallback callBack){ NestHttpRequestData data = getArgs(url, connectTimeOut, downloadTimeOut, cookies, postObject, filePath, callBack); Message msg = Message.obtain(); msg.obj = data; msg.what = MSG_HTTP_POST_REQUEST; return getInstance().mHandler.sendMessage(msg); } public static NestHttpResultData getQueueTask(String url, int connectTimeOut, int downloadTimeOut, String cookies, String filePath) { NestHttpRequestData data = getArgs(url, connectTimeOut, downloadTimeOut, cookies, null, filePath, null); try { return getInstance().httpGetRequest(data); } catch (IOException e) { e.printStackTrace(); } return new NestHttpResultData(); } public static boolean getQueueTask(String url, int connectTimeOut, int downloadTimeOut, String cookies, String filePath, NestHttpCallback callBack){ NestHttpRequestData data = getArgs(url, connectTimeOut, downloadTimeOut, cookies, null, filePath, callBack); Message msg = Message.obtain(); msg.obj = data; msg.what = MSG_HTTP_GET_REQUEST; return getInstance().mHandler.sendMessage(msg); } private static class NestHttpRequestData{ public String url; public int connectTimeOut; public int downloadTimeOut; public String cookies; public String filePath; public NestHttpCallback callBack; public Object postObject; NestHttpRequestData(){ url = ""; connectTimeOut = 0; downloadTimeOut = 0; cookies = ""; filePath = ""; callBack = null; postObject = null; } } protected NestHttpResultData httpGetRequest(NestHttpRequestData data) throws IOException { HttpURLConnection urlConnection = null; InputStream inputStream = null; NestHttpResultData resultData = new NestHttpResultData(); try { URL url = new URL(data.url); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setReadTimeout(data.downloadTimeOut); urlConnection.setConnectTimeout(data.connectTimeOut); urlConnection.setRequestMethod("GET"); urlConnection.setDoInput(true); // set other property if (data.cookies != null){ urlConnection.setRequestProperty("Cookie", data.cookies); } urlConnection.connect(); resultData.responseCode = urlConnection.getResponseCode(); SimpleLog.d(DEBUG_TAG, "The response is: " + resultData.responseCode); resultData.isSucceed = true; resultData.filePath = data.filePath; inputStream = urlConnection.getInputStream(); StreamToFile(inputStream, data.filePath); } catch(Exception e){ SimpleLog.e(e); } finally { if (inputStream != null){ inputStream.close(); } if(urlConnection != null){ urlConnection.disconnect(); } } return resultData; } protected NestHttpResultData httpPostRequest(NestHttpRequestData data) throws IOException { HttpURLConnection urlConnection = null; InputStream inputStream = null; NestHttpResultData resultData = new NestHttpResultData(); try { URL url = new URL(data.url); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setReadTimeout(data.downloadTimeOut); urlConnection.setConnectTimeout(data.connectTimeOut); urlConnection.setRequestMethod("POST"); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); // set other property if (data.cookies != null){ urlConnection.setRequestProperty("Cookie", data.cookies); } urlConnection.connect(); resultData.responseCode = urlConnection.getResponseCode(); //设置post数据 if (data.postObject != null){ OutputStream outputStream = urlConnection.getOutputStream(); if (outputStream != null){ ObjectOutputStream objOutputStrm = new ObjectOutputStream(outputStream); if (outputStream != null){ objOutputStrm.writeObject(data.postObject); objOutputStrm.flush(); objOutputStrm.close(); } outputStream.close(); } } SimpleLog.d(DEBUG_TAG, "The response is: " + resultData.responseCode); resultData.isSucceed = true; resultData.filePath = data.filePath; inputStream = urlConnection.getInputStream(); StreamToFile(inputStream, data.filePath); } catch(Exception e){ SimpleLog.e(e); } finally { if (inputStream != null){ inputStream.close(); } // inputStream must be close somewhere if(urlConnection != null){ urlConnection.disconnect(); } } return resultData; } protected void initialize(){ mTaskThread = new HandlerThread(QUEUE_TASK_NAME); mTaskThread.start(); mHandler = new Handler(mTaskThread.getLooper(), new QueueHandler()); } protected class QueueHandler implements Handler.Callback{ @Override public boolean handleMessage(Message msg) { SimpleLog.d(DEBUG_TAG, "handleMessage"); NestHttpResultData resultData = null; NestHttpRequestData msgData = (NestHttpRequestData)msg.obj; try { switch (msg.what){ case MSG_HTTP_GET_REQUEST:{ resultData = httpGetRequest(msgData); break; } case MSG_HTTP_POST_REQUEST:{ resultData = httpPostRequest(msgData); break; } default: break; } if (resultData != null) { //callback if (msgData.callBack != null){ msgData.callBack.CallBack(resultData); } } }catch (IOException o) { SimpleLog.e(o); } return true; } } protected void StreamToFile(InputStream inputStream, String filePath){ if (inputStream == null) return ; final int READ_BUFF_SIZE = 1024 * 4; OutputStream output = null; try { File file = new File(filePath); if(!file.exists()) { if(!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } file.createNewFile(); } output = new FileOutputStream(file); byte buffer[] = new byte[READ_BUFF_SIZE]; while((inputStream.read(buffer)) != -1) { output.write(buffer); } } catch (Exception e) { e.printStackTrace(); }finally{ try { if (output != null) output.close(); } catch (Exception e){ e.printStackTrace(); } } } }
b9f96fe909684d27ef10139355b5078518762cdd
d9a6a8d92a9979e4c4e82c34b5a91cebbe11b2be
/Dev_Java_Spring_Boot_9/src/main/java/ua/converter/OpenCloseConverter.java
65ca69dca87ed6c900b7dcb10c30469007051342
[]
no_license
RomanSipyak/DzAdvance
93bd127e6d3443a4cf2f698bdd80e5173a92bc68
40c23a4d92eaea5be3f2ee5cf5f759f11923f2d9
refs/heads/master
2021-01-01T16:54:40.299035
2017-09-30T16:29:24
2017-09-30T16:29:24
97,950,852
0
1
null
null
null
null
UTF-8
Java
false
false
765
java
package ua.converter; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.List; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; import ua.entity.OpenClose; import ua.repository.OpenCloseRepository; @Component public class OpenCloseConverter implements Converter<String, OpenClose>{ private final OpenCloseRepository repositopy; public OpenCloseConverter(OpenCloseRepository repositopy) { this.repositopy = repositopy; } @Override public OpenClose convert(String arg0) { // final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss"); // LocalTime dt = LocalTime.parse(arg0, dtf); return repositopy.findByTime(LocalTime.parse(arg0)); } }
d2407bf2e8935b18393d2b80abdf0916284e9a09
51eb977a0fef7df4e2c001d81755f72172c193bf
/src/main/java/com/project/furryfiesta/data/repository/PetRepository.java
d3c2b42935d705097dfe66042d8df4db69262030
[]
no_license
imranhabib/FurryFiesta
1bb9699c9fef9667e7998a12997835560a3490e8
35c491c48157f5734f67ea4084b65d9d69ba6b99
refs/heads/master
2021-01-23T20:57:50.437186
2017-05-10T16:34:43
2017-05-10T16:34:43
90,668,562
1
0
null
2017-05-09T01:50:32
2017-05-08T20:15:49
JavaScript
UTF-8
Java
false
false
421
java
package com.project.furryfiesta.data.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.project.furryfiesta.data.model.Pet; @Repository public interface PetRepository extends JpaRepository<Pet, Integer> { List<Pet> findAllPetsByCategory(String category); List<Pet> findAllPetsByColor(String color); }
00cca27ba84dae91cda20d7717b116814613b0aa
1c67af2f5e80f2ffcf4e80ef7b030d7189384ffb
/src/main/java/com/teammetallurgy/atum/world/gen/structure/mineshaft/AtumMineshaftPieces.java
cf030df976b3ad0eb3a642eb11047393491353d1
[]
no_license
SamuraiShogun1102/Atum2
9059bd028be3616591de9237212fe28077a446b6
af6443d3c751b898d715b1c25db0337d550acf77
refs/heads/master
2022-11-17T10:23:00.929707
2020-07-12T16:19:51
2020-07-12T16:19:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
40,066
java
package com.teammetallurgy.atum.world.gen.structure.mineshaft; import com.google.common.collect.Lists; import com.teammetallurgy.atum.blocks.wood.AtumWallTorchUnlitBlock; import com.teammetallurgy.atum.init.AtumBlocks; import com.teammetallurgy.atum.init.AtumEntities; import com.teammetallurgy.atum.init.AtumLootTables; import com.teammetallurgy.atum.init.AtumStructurePieces; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.RailBlock; import net.minecraft.block.WallTorchBlock; import net.minecraft.entity.item.minecart.ChestMinecartEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.state.properties.RailShape; import net.minecraft.tileentity.MobSpawnerTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.gen.feature.structure.IStructurePieceType; import net.minecraft.world.gen.feature.structure.StructurePiece; import net.minecraft.world.gen.feature.template.TemplateManager; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; import java.util.Random; public class AtumMineshaftPieces { private static Piece createRandomShaftPiece(List<StructurePiece> list, Random rand, int x, int y, int z, @Nullable Direction direction, int componentType, AtumMineshaftStructure.Type type) { int i = rand.nextInt(100); if (i >= 80) { MutableBoundingBox box = Cross.findCrossing(list, rand, x, y, z, direction); if (box != null) { return new Cross(componentType, box, direction, type); } } else if (i >= 70) { MutableBoundingBox box = Stairs.findStairs(list, rand, x, y, z, direction); if (box != null) { return new Stairs(componentType, box, direction, type); } } else { MutableBoundingBox box = Corridor.findCorridorSize(list, rand, x, y, z, direction); if (box != null) { return new Corridor(componentType, rand, box, direction, type); } } return null; } private static Piece generateAndAddPiece(StructurePiece structurePiece, List<StructurePiece> list, Random p_189938_2_, int x, int y, int z, Direction direction, int componentType) { if (componentType > 8) { return null; } else if (Math.abs(x - structurePiece.getBoundingBox().minX) <= 80 && Math.abs(z - structurePiece.getBoundingBox().minZ) <= 80) { AtumMineshaftStructure.Type type = ((Piece) structurePiece).mineShaftType; Piece piece = createRandomShaftPiece(list, p_189938_2_, x, y, z, direction, componentType + 1, type); if (piece != null) { list.add(piece); piece.buildComponent(structurePiece, list, p_189938_2_); } return piece; } else { return null; } } public static class Corridor extends Piece { private final boolean hasRails; private final boolean hasTarantula; private boolean spawnerPlaced; private final int sectionCount; public Corridor(TemplateManager manager, CompoundNBT nbt) { super(AtumStructurePieces.MINESHAFT_CORRIDOR, nbt); this.hasRails = nbt.getBoolean("hr"); this.hasTarantula = nbt.getBoolean("sc"); this.spawnerPlaced = nbt.getBoolean("hps"); this.sectionCount = nbt.getInt("Num"); } @Override protected void readAdditional(CompoundNBT tagCompound) { super.readAdditional(tagCompound); tagCompound.putBoolean("hr", this.hasRails); tagCompound.putBoolean("sc", this.hasTarantula); tagCompound.putBoolean("hps", this.spawnerPlaced); tagCompound.putInt("Num", this.sectionCount); } public Corridor(int componentType, Random rand, MutableBoundingBox box, Direction direction, AtumMineshaftStructure.Type type) { super(AtumStructurePieces.MINESHAFT_CORRIDOR, componentType, type); this.setCoordBaseMode(direction); this.boundingBox = box; this.hasRails = rand.nextInt(3) == 0; this.hasTarantula = !this.hasRails && rand.nextInt(23) == 0; if (this.getCoordBaseMode().getAxis() == Direction.Axis.Z) { this.sectionCount = box.getZSize() / 5; } else { this.sectionCount = box.getXSize() / 5; } } public static MutableBoundingBox findCorridorSize(List<StructurePiece> list, Random rand, int x, int y, int z, Direction facing) { MutableBoundingBox box = new MutableBoundingBox(x, y, z, x, y + 3 - 1, z); int i; for (i = rand.nextInt(3) + 2; i > 0; --i) { int j = i * 5; switch (facing) { case NORTH: default: box.maxX = x + 3 - 1; box.minZ = z - (j - 1); break; case SOUTH: box.maxX = x + 3 - 1; box.maxZ = z + j - 1; break; case WEST: box.minX = x - (j - 1); box.maxZ = z + 3 - 1; break; case EAST: box.maxX = x + j - 1; box.maxZ = z + 3 - 1; } if (StructurePiece.findIntersecting(list, box) == null) { break; } } return i > 0 ? box : null; } @Override public void buildComponent(@Nonnull StructurePiece component, @Nonnull List<StructurePiece> list, Random rand) { int i = this.getComponentType(); int j = rand.nextInt(4); Direction direction = this.getCoordBaseMode(); if (direction != null) { switch (direction) { case NORTH: default: if (j <= 1) { generateAndAddPiece(component, list, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ - 1, direction, i); } else if (j == 2) { generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, Direction.WEST, i); } else { generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, Direction.EAST, i); } break; case SOUTH: if (j <= 1) { generateAndAddPiece(component, list, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ + 1, direction, i); } else if (j == 2) { generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ - 3, Direction.WEST, i); } else { generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ - 3, Direction.EAST, i); } break; case WEST: if (j <= 1) { generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, direction, i); } else if (j == 2) { generateAndAddPiece(component, list, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ - 1, Direction.NORTH, i); } else { generateAndAddPiece(component, list, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ + 1, Direction.SOUTH, i); } break; case EAST: if (j <= 1) { generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, direction, i); } else if (j == 2) { generateAndAddPiece(component, list, rand, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ - 1, Direction.NORTH, i); } else { generateAndAddPiece(component, list, rand, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ + 1, Direction.SOUTH, i); } } } if (i < 8) { if (direction != Direction.NORTH && direction != Direction.SOUTH) { for (int i1 = this.boundingBox.minX + 3; i1 + 3 <= this.boundingBox.maxX; i1 += 5) { int j1 = rand.nextInt(5); if (j1 == 0) { generateAndAddPiece(component, list, rand, i1, this.boundingBox.minY, this.boundingBox.minZ - 1, Direction.NORTH, i + 1); } else if (j1 == 1) { generateAndAddPiece(component, list, rand, i1, this.boundingBox.minY, this.boundingBox.maxZ + 1, Direction.SOUTH, i + 1); } } } else { for (int k = this.boundingBox.minZ + 3; k + 3 <= this.boundingBox.maxZ; k += 5) { int l = rand.nextInt(5); if (l == 0) { generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY, k, Direction.WEST, i + 1); } else if (l == 1) { generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, k, Direction.EAST, i + 1); } } } } } @Override protected boolean generateChest(@Nonnull IWorld world, MutableBoundingBox box, @Nonnull Random rand, int x, int y, int z, @Nonnull ResourceLocation loot) { BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (box.isVecInside(blockpos) && world.getBlockState(blockpos).isAir(world, blockpos) && !world.getBlockState(blockpos.down()).isAir(world, blockpos.down())) { BlockState plankState = Blocks.RAIL.getDefaultState().with(RailBlock.SHAPE, rand.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST); this.setBlockState(world, plankState, x, y, z, box); ChestMinecartEntity chestMinecraftEntity = new ChestMinecartEntity(world.getWorld(), (float) blockpos.getX() + 0.5F, (float) blockpos.getY() + 0.5F, (float) blockpos.getZ() + 0.5F); chestMinecraftEntity.setLootTable(loot, rand.nextLong()); world.addEntity(chestMinecraftEntity); return true; } else { return false; } } @Override public boolean create(@Nonnull IWorld world, @Nonnull ChunkGenerator<?> generator, @Nonnull Random rand, @Nonnull MutableBoundingBox box, @Nonnull ChunkPos chunkPos) { if (this.isLiquidInStructureBoundingBox(world, box)) { return false; } else { int i1 = this.sectionCount * 5 - 1; BlockState plankState = this.getPlanksBlock(); this.fillWithBlocks(world, box, 0, 0, 0, 2, 1, i1, CAVE_AIR, CAVE_AIR, false); this.generateMaybeBox(world, box, rand, 0.8F, 0, 2, 0, 2, 2, i1, CAVE_AIR, CAVE_AIR, false, false); if (this.hasTarantula) { this.generateMaybeBox(world, box, rand, 0.6F, 0, 0, 0, 2, 1, i1, Blocks.COBWEB.getDefaultState(), CAVE_AIR, false, true); } for (int j1 = 0; j1 < this.sectionCount; ++j1) { int k1 = 2 + j1 * 5; this.placeSupport(world, box, 0, 0, k1, 2, 2, rand); this.placeCobWeb(world, box, rand, 0.1F, 0, 2, k1 - 1); this.placeCobWeb(world, box, rand, 0.1F, 2, 2, k1 - 1); this.placeCobWeb(world, box, rand, 0.1F, 0, 2, k1 + 1); this.placeCobWeb(world, box, rand, 0.1F, 2, 2, k1 + 1); this.placeCobWeb(world, box, rand, 0.05F, 0, 2, k1 - 2); this.placeCobWeb(world, box, rand, 0.05F, 2, 2, k1 - 2); this.placeCobWeb(world, box, rand, 0.05F, 0, 2, k1 + 2); this.placeCobWeb(world, box, rand, 0.05F, 2, 2, k1 + 2); if (rand.nextInt(100) == 0) { this.generateChest(world, box, rand, 2, 0, k1 - 1, AtumLootTables.CRATE); } if (rand.nextInt(100) == 0) { this.generateChest(world, box, rand, 0, 0, k1 + 1, AtumLootTables.CRATE); } if (this.hasTarantula && !this.spawnerPlaced) { int l1 = this.getYWithOffset(0); int i2 = k1 - 1 + rand.nextInt(3); int j2 = this.getXWithOffset(1, i2); int k2 = this.getZWithOffset(1, i2); BlockPos blockpos = new BlockPos(j2, l1, k2); if (box.isVecInside(blockpos) && this.getSkyBrightness(world, 1, 0, i2, box)) { this.spawnerPlaced = true; world.setBlockState(blockpos, Blocks.SPAWNER.getDefaultState(), 2); TileEntity tileEntity = world.getTileEntity(blockpos); if (tileEntity instanceof MobSpawnerTileEntity) { AtumMineshaftStructure.Type type = this.mineShaftType; int chance = rand.nextInt(100); if (chance < 40) { if (type == AtumMineshaftStructure.Type.DEADWOOD || type == AtumMineshaftStructure.Type.DEADWOOD_SURFACE) { ((MobSpawnerTileEntity) tileEntity).getSpawnerBaseLogic().setEntityType(AtumEntities.FORSAKEN); } else if (type == AtumMineshaftStructure.Type.LIMESTONE || type == AtumMineshaftStructure.Type.LIMESTONE_SURFACE) { ((MobSpawnerTileEntity) tileEntity).getSpawnerBaseLogic().setEntityType(AtumEntities.STONEGUARD); } } else { ((MobSpawnerTileEntity) tileEntity).getSpawnerBaseLogic().setEntityType(AtumEntities.TARANTULA); } } } } } for (int l2 = 0; l2 <= 2; ++l2) { for (int i3 = 0; i3 <= i1; ++i3) { BlockState blockstate3 = this.getBlockStateFromPos(world, l2, -1, i3, box); if (blockstate3.isAir() && this.getSkyBrightness(world, l2, -1, i3, box)) { this.setBlockState(world, plankState, l2, -1, i3, box); } } } if (this.hasRails) { BlockState railState = Blocks.RAIL.getDefaultState().with(RailBlock.SHAPE, RailShape.NORTH_SOUTH); for (int j3 = 0; j3 <= i1; ++j3) { BlockState blockstate2 = this.getBlockStateFromPos(world, 1, -1, j3, box); if (!blockstate2.isAir() && blockstate2.isOpaqueCube(world, new BlockPos(this.getXWithOffset(1, j3), this.getYWithOffset(-1), this.getZWithOffset(1, j3)))) { float f = this.getSkyBrightness(world, 1, 0, j3, box) ? 0.7F : 0.9F; this.randomlyPlaceBlock(world, box, rand, f, 1, 0, j3, railState); } } } return true; } } private void placeSupport(IWorld world, MutableBoundingBox box, int x, int yMin, int zMin, int yMax, int zMax, Random rand) { if (this.isSupportingBox(world, box, x, zMax, yMax, zMin)) { BlockState plankState = this.getPlanksBlock(); BlockState fenceState = this.getFenceBlock(); BlockState torchState = this.getTorchBlock(); this.fillWithBlocks(world, box, x, yMin, zMin, x, yMax - 1, zMin, fenceState, CAVE_AIR, false); this.fillWithBlocks(world, box, zMax, yMin, zMin, zMax, yMax - 1, zMin, fenceState, CAVE_AIR, false); if (rand.nextInt(4) == 0) { this.fillWithBlocks(world, box, x, yMax, zMin, x, yMax, zMin, plankState, CAVE_AIR, false); this.fillWithBlocks(world, box, zMax, yMax, zMin, zMax, yMax, zMin, plankState, CAVE_AIR, false); } else { this.fillWithBlocks(world, box, x, yMax, zMin, zMax, yMax, zMin, plankState, CAVE_AIR, false); this.randomlyPlaceBlock(world, box, rand, 0.05F, x + 1, yMax, zMin - 1, torchState.with(WallTorchBlock.HORIZONTAL_FACING, Direction.NORTH)); this.randomlyPlaceBlock(world, box, rand, 0.05F, x + 1, yMax, zMin + 1, torchState.with(WallTorchBlock.HORIZONTAL_FACING, Direction.SOUTH)); } } } private void placeCobWeb(IWorld world, MutableBoundingBox box, Random rand, float chance, int x, int y, int z) { if (this.getSkyBrightness(world, x, y, z, box)) { this.randomlyPlaceBlock(world, box, rand, chance, x, y, z, Blocks.COBWEB.getDefaultState()); } } } public static class Cross extends Piece { private final Direction corridorDirection; private final boolean isMultipleFloors; public Cross(TemplateManager manager, CompoundNBT nbt) { super(AtumStructurePieces.MINESHAFT_CROSSING, nbt); this.isMultipleFloors = nbt.getBoolean("tf"); this.corridorDirection = Direction.byHorizontalIndex(nbt.getInt("D")); } @Override protected void readAdditional(CompoundNBT tagCompound) { super.readAdditional(tagCompound); tagCompound.putBoolean("tf", this.isMultipleFloors); tagCompound.putInt("D", this.corridorDirection.getHorizontalIndex()); } public Cross(int componentType, MutableBoundingBox box, @Nullable Direction direction, AtumMineshaftStructure.Type type) { super(AtumStructurePieces.MINESHAFT_CROSSING, componentType, type); this.corridorDirection = direction; this.boundingBox = box; this.isMultipleFloors = box.getYSize() > 3; } public static MutableBoundingBox findCrossing(List<StructurePiece> list, Random rand, int x, int y, int z, Direction facing) { MutableBoundingBox box = new MutableBoundingBox(x, y, z, x, y + 3 - 1, z); if (rand.nextInt(4) == 0) { box.maxY += 4; } switch (facing) { case NORTH: default: box.minX = x - 1; box.maxX = x + 3; box.minZ = z - 4; break; case SOUTH: box.minX = x - 1; box.maxX = x + 3; box.maxZ = z + 3 + 1; break; case WEST: box.minX = x - 4; box.minZ = z - 1; box.maxZ = z + 3; break; case EAST: box.maxX = x + 3 + 1; box.minZ = z - 1; box.maxZ = z + 3; } return StructurePiece.findIntersecting(list, box) != null ? null : box; } @Override public void buildComponent(@Nonnull StructurePiece component, @Nonnull List<StructurePiece> list, @Nonnull Random rand) { int i = this.getComponentType(); switch (this.corridorDirection) { case NORTH: default: generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, Direction.NORTH, i); generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, Direction.WEST, i); generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, Direction.EAST, i); break; case SOUTH: generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, Direction.SOUTH, i); generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, Direction.WEST, i); generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, Direction.EAST, i); break; case WEST: generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, Direction.NORTH, i); generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, Direction.SOUTH, i); generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, Direction.WEST, i); break; case EAST: generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, Direction.NORTH, i); generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, Direction.SOUTH, i); generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, Direction.EAST, i); } if (this.isMultipleFloors) { if (rand.nextBoolean()) { generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ - 1, Direction.NORTH, i); } if (rand.nextBoolean()) { generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, Direction.WEST, i); } if (rand.nextBoolean()) { generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, Direction.EAST, i); } if (rand.nextBoolean()) { generateAndAddPiece(component, list, rand, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.maxZ + 1, Direction.SOUTH, i); } } } @Override public boolean create(@Nonnull IWorld world, @Nonnull ChunkGenerator<?> generator, @Nonnull Random rand, @Nonnull MutableBoundingBox box, @Nonnull ChunkPos chunkPos) { if (this.isLiquidInStructureBoundingBox(world, box)) { return false; } else { BlockState plankState = this.getPlanksBlock(); if (this.isMultipleFloors) { this.fillWithBlocks(world, box, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ, CAVE_AIR, CAVE_AIR, false); this.fillWithBlocks(world, box, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ - 1, CAVE_AIR, CAVE_AIR, false); this.fillWithBlocks(world, box, this.boundingBox.minX + 1, this.boundingBox.maxY - 2, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, CAVE_AIR, CAVE_AIR, false); this.fillWithBlocks(world, box, this.boundingBox.minX, this.boundingBox.maxY - 2, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, CAVE_AIR, CAVE_AIR, false); this.fillWithBlocks(world, box, this.boundingBox.minX + 1, this.boundingBox.minY + 3, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.minY + 3, this.boundingBox.maxZ - 1, CAVE_AIR, CAVE_AIR, false); } else { this.fillWithBlocks(world, box, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, CAVE_AIR, CAVE_AIR, false); this.fillWithBlocks(world, box, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, CAVE_AIR, CAVE_AIR, false); } this.placeSupportPillar(world, box, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxY); this.placeSupportPillar(world, box, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.maxY); this.placeSupportPillar(world, box, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxY); this.placeSupportPillar(world, box, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.maxY); for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i) { for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j) { if (this.getBlockStateFromPos(world, i, this.boundingBox.minY - 1, j, box).isAir() && this.getSkyBrightness(world, i, this.boundingBox.minY - 1, j, box)) { this.setBlockState(world, plankState, i, this.boundingBox.minY - 1, j, box); } } } return true; } } private void placeSupportPillar(IWorld world, MutableBoundingBox box, int x, int y, int z, int yMax) { if (!this.getBlockStateFromPos(world, x, yMax + 1, z, box).isAir()) { this.fillWithBlocks(world, box, x, y, z, x, yMax, z, this.getPlanksBlock(), CAVE_AIR, false); } } } abstract static class Piece extends StructurePiece { protected AtumMineshaftStructure.Type mineShaftType; public Piece(IStructurePieceType structurePieceType, int componentType, AtumMineshaftStructure.Type type) { super(structurePieceType, componentType); this.mineShaftType = type; } public Piece(IStructurePieceType type, CompoundNBT nbt) { super(type, nbt); this.mineShaftType = AtumMineshaftStructure.Type.byId(nbt.getInt("MST")); } @Override protected void readAdditional(CompoundNBT tagCompound) { tagCompound.putInt("MST", this.mineShaftType.ordinal()); } protected BlockState getPlanksBlock() { switch (this.mineShaftType) { case DEADWOOD: case DEADWOOD_SURFACE: default: return AtumBlocks.DEADWOOD_PLANKS.getDefaultState(); case LIMESTONE: case LIMESTONE_SURFACE: return AtumBlocks.LIMESTONE_BRICK_LARGE.getDefaultState(); } } protected BlockState getFenceBlock() { switch (this.mineShaftType) { case DEADWOOD: case DEADWOOD_SURFACE: default: return AtumBlocks.DEADWOOD_FENCE.getDefaultState(); case LIMESTONE: case LIMESTONE_SURFACE: return AtumBlocks.LARGE_WALL.getDefaultState(); } } protected BlockState getTorchBlock() { switch (this.mineShaftType) { case DEADWOOD: case DEADWOOD_SURFACE: default: return AtumWallTorchUnlitBlock.UNLIT.get(AtumBlocks.DEADWOOD_TORCH).getDefaultState(); case LIMESTONE: case LIMESTONE_SURFACE: return AtumWallTorchUnlitBlock.UNLIT.get(AtumBlocks.LIMESTONE_TORCH).getDefaultState(); } } protected boolean isSupportingBox(IBlockReader blockReader, MutableBoundingBox box, int xStart, int xEnd, int x, int z) { for (int i = xStart; i <= xEnd; ++i) { if (this.getBlockStateFromPos(blockReader, i, x + 1, z, box).isAir()) { return false; } } return true; } } public static class Room extends Piece { private final List<MutableBoundingBox> connectedRooms = Lists.newLinkedList(); public Room(int componentType, Random rand, int x, int z, AtumMineshaftStructure.Type type) { super(AtumStructurePieces.MINESHAFT_ROOM, componentType, type); this.mineShaftType = type; this.boundingBox = new MutableBoundingBox(x, 50, z, x + 7 + rand.nextInt(6), 54 + rand.nextInt(6), z + 7 + rand.nextInt(6)); } public Room(TemplateManager manager, CompoundNBT nbt) { super(AtumStructurePieces.MINESHAFT_ROOM, nbt); ListNBT listnbt = nbt.getList("Entrances", 11); for (int i = 0; i < listnbt.size(); ++i) { this.connectedRooms.add(new MutableBoundingBox(listnbt.getIntArray(i))); } } @Override public void buildComponent(@Nonnull StructurePiece component, @Nonnull List<StructurePiece> list, @Nonnull Random rand) { int i = this.getComponentType(); int j = this.boundingBox.getYSize() - 3 - 1; if (j <= 0) { j = 1; } int k; for (k = 0; k < this.boundingBox.getXSize(); k = k + 4) { k = k + rand.nextInt(this.boundingBox.getXSize()); if (k + 3 > this.boundingBox.getXSize()) { break; } Piece piece = generateAndAddPiece(component, list, rand, this.boundingBox.minX + k, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.minZ - 1, Direction.NORTH, i); if (piece != null) { MutableBoundingBox box = piece.getBoundingBox(); this.connectedRooms.add(new MutableBoundingBox(box.minX, box.minY, this.boundingBox.minZ, box.maxX, box.maxY, this.boundingBox.minZ + 1)); } } for (k = 0; k < this.boundingBox.getXSize(); k = k + 4) { k = k + rand.nextInt(this.boundingBox.getXSize()); if (k + 3 > this.boundingBox.getXSize()) { break; } Piece piece = generateAndAddPiece(component, list, rand, this.boundingBox.minX + k, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.maxZ + 1, Direction.SOUTH, i); if (piece != null) { MutableBoundingBox box = piece.getBoundingBox(); this.connectedRooms.add(new MutableBoundingBox(box.minX, box.minY, this.boundingBox.maxZ - 1, box.maxX, box.maxY, this.boundingBox.maxZ)); } } for (k = 0; k < this.boundingBox.getZSize(); k = k + 4) { k = k + rand.nextInt(this.boundingBox.getZSize()); if (k + 3 > this.boundingBox.getZSize()) { break; } Piece piece = generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.minZ + k, Direction.WEST, i); if (piece != null) { MutableBoundingBox box = piece.getBoundingBox(); this.connectedRooms.add(new MutableBoundingBox(this.boundingBox.minX, box.minY, box.minZ, this.boundingBox.minX + 1, box.maxY, box.maxZ)); } } for (k = 0; k < this.boundingBox.getZSize(); k = k + 4) { k = k + rand.nextInt(this.boundingBox.getZSize()); if (k + 3 > this.boundingBox.getZSize()) { break; } StructurePiece piece = generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.minZ + k, Direction.EAST, i); if (piece != null) { MutableBoundingBox box = piece.getBoundingBox(); this.connectedRooms.add(new MutableBoundingBox(this.boundingBox.maxX - 1, box.minY, box.minZ, this.boundingBox.maxX, box.maxY, box.maxZ)); } } } @Override public boolean create(@Nonnull IWorld world, @Nonnull ChunkGenerator<?> generator, @Nonnull Random rand, @Nonnull MutableBoundingBox box, @Nonnull ChunkPos chunkPos) { if (this.isLiquidInStructureBoundingBox(world, box)) { return false; } else { this.fillWithBlocks(world, box, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.minY, this.boundingBox.maxZ, AtumBlocks.SAND.getDefaultState(), CAVE_AIR, true); this.fillWithBlocks(world, box, this.boundingBox.minX, this.boundingBox.minY + 1, this.boundingBox.minZ, this.boundingBox.maxX, Math.min(this.boundingBox.minY + 3, this.boundingBox.maxY), this.boundingBox.maxZ, CAVE_AIR, CAVE_AIR, false); for (MutableBoundingBox connectedRooms : this.connectedRooms) { this.fillWithBlocks(world, box, connectedRooms.minX, connectedRooms.maxY - 2, connectedRooms.minZ, connectedRooms.maxX, connectedRooms.maxY, connectedRooms.maxZ, CAVE_AIR, CAVE_AIR, false); } this.randomlyRareFillWithBlocks(world, box, this.boundingBox.minX, this.boundingBox.minY + 4, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ, CAVE_AIR, false); return true; } } @Override public void offset(int x, int y, int z) { super.offset(x, y, z); for (MutableBoundingBox connectedRooms : this.connectedRooms) { connectedRooms.offset(x, y, z); } } @Override protected void readAdditional(CompoundNBT tagCompound) { super.readAdditional(tagCompound); ListNBT listnbt = new ListNBT(); for (MutableBoundingBox connectedRooms : this.connectedRooms) { listnbt.add(connectedRooms.toNBTTagIntArray()); } tagCompound.put("Entrances", listnbt); } } public static class Stairs extends Piece { public Stairs(int componentType, MutableBoundingBox box, Direction direction, AtumMineshaftStructure.Type type) { super(AtumStructurePieces.MINESHAFT_STAIRS, componentType, type); this.setCoordBaseMode(direction); this.boundingBox = box; } public Stairs(TemplateManager manager, CompoundNBT nbt) { super(AtumStructurePieces.MINESHAFT_STAIRS, nbt); } public static MutableBoundingBox findStairs(List<StructurePiece> list, Random rand, int x, int y, int z, Direction facing) { MutableBoundingBox box = new MutableBoundingBox(x, y - 5, z, x, y + 3 - 1, z); switch (facing) { case NORTH: default: box.maxX = x + 3 - 1; box.minZ = z - 8; break; case SOUTH: box.maxX = x + 3 - 1; box.maxZ = z + 8; break; case WEST: box.minX = x - 8; box.maxZ = z + 3 - 1; break; case EAST: box.maxX = x + 8; box.maxZ = z + 3 - 1; } return StructurePiece.findIntersecting(list, box) != null ? null : box; } @Override public void buildComponent(@Nonnull StructurePiece component, @Nonnull List<StructurePiece> list, @Nonnull Random rand) { int i = this.getComponentType(); Direction direction = this.getCoordBaseMode(); if (direction != null) { switch (direction) { case NORTH: default: generateAndAddPiece(component, list, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, Direction.NORTH, i); break; case SOUTH: generateAndAddPiece(component, list, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, Direction.SOUTH, i); break; case WEST: generateAndAddPiece(component, list, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, Direction.WEST, i); break; case EAST: generateAndAddPiece(component, list, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, Direction.EAST, i); } } } @Override public boolean create(@Nonnull IWorld world, @Nonnull ChunkGenerator<?> generator, @Nonnull Random rand, @Nonnull MutableBoundingBox box, @Nonnull ChunkPos chunkPos) { if (this.isLiquidInStructureBoundingBox(world, box)) { return false; } else { this.fillWithBlocks(world, box, 0, 5, 0, 2, 7, 1, CAVE_AIR, CAVE_AIR, false); this.fillWithBlocks(world, box, 0, 0, 7, 2, 2, 8, CAVE_AIR, CAVE_AIR, false); for (int i = 0; i < 5; ++i) { this.fillWithBlocks(world, box, 0, 5 - i - (i < 4 ? 1 : 0), 2 + i, 2, 7 - i, 2 + i, CAVE_AIR, CAVE_AIR, false); } return true; } } } }
32eeb1f38885b93ef1cfa72df254c51133aa831a
7e86ef8cc2bf925c9e5a57e83c48b18882070c94
/com.mlyncar.dp.prototypes.parser/src/com/mlyncar/dp/prototypes/parser/exception/UmlLoaderException.java
40c47f686f770fe29778d9cec3dad0142ad47547
[]
no_license
andrejmlyncar/dp-prototypes
1a8a7d6c8948dbda81c1ff07031e4b3cafa7eb03
f9bbcf70a341a9d53a362fac8ee696998e3393e6
refs/heads/master
2021-01-12T17:52:42.113818
2016-11-12T19:57:23
2016-11-12T19:57:23
71,283,631
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.mlyncar.dp.prototypes.parser.exception; public class UmlLoaderException extends Exception { public UmlLoaderException(String message, Throwable cause) { super(message, cause); } public UmlLoaderException(String message) { super(message); } }
1237afe48045089d94e218c82ca30a3fc5bfcd59
8539992de8b051a7e33e76ae8b1cb4e06b802e45
/src/main/java/leetcode/editor/cn/LeetCode56MergeIntervals.java
35c491253e2f2223108d9d2929d42c76ac3d33a3
[]
no_license
raychenlei/leetcode
14757457064e5a5b3557971ae1947358526bfe5f
9b5ee93266cec542141b34a3a9b7a56df3ce28f5
refs/heads/master
2022-12-26T21:59:17.140093
2020-10-15T13:32:58
2020-10-15T13:32:58
264,863,049
0
0
null
null
null
null
UTF-8
Java
false
false
2,609
java
//给出一个区间的集合,请合并所有重叠的区间。 // // // // 示例 1: // // 输入: intervals = [[1,3],[2,6],[8,10],[15,18]] //输出: [[1,6],[8,10],[15,18]] //解释: 区间 [1,3] 和 [2,6] 重叠, 将它们合并为 [1,6]. // // // 示例 2: // // 输入: intervals = [[1,4],[4,5]] //输出: [[1,5]] //解释: 区间 [1,4] 和 [4,5] 可被视为重叠区间。 // // 注意:输入类型已于2019年4月15日更改。 请重置默认代码定义以获取新方法签名。 // // // // 提示: // // // intervals[i][0] <= intervals[i][1] // // Related Topics 排序 数组 package leetcode.editor.cn; import java.util.Arrays; public class LeetCode56MergeIntervals { public static void main(String[] args) { Solution solution = new LeetCode56MergeIntervals().new Solution(); solution.merge(new int[][]{{1,3},{2,6},{8,10},{15,18}}); } //leetcode submit region begin(Prohibit modification and deletion) class Solution { public int[][] merge(int[][] intervals) { //数组的排序写法,返回的是当前数组,不是新数组 //使用临时变量来存储最后的结果 //二维数组的定义 //二维数组的下标访问 //数组的拷贝,截取 //先特判 if (intervals == null || intervals.length == 0){ return intervals; } int[][] merged = new int[intervals.length][]; Arrays.sort(intervals, (a, b) -> a[0] - b[0]); //要先排序,后赋merged的初值 merged[0] = intervals[0]; //记录结果集中实际元素个数 int mergedNum = 1; for (int i = 0; i < intervals.length; i++) { //结果集中的最后一个区间和当前区间进行比较,看是否可以合并 //如果当前区间的左边界大于结果集的右边界,则不可以合并,将当前区间加入结果集 if (intervals[i][0] > merged[mergedNum - 1][1]){ mergedNum ++; merged[mergedNum - 1] = intervals[i]; }else { //如果当前区间的左边界小于等于结果集的右边界,则可以合并 //比较结果集的右边界和当前区间的右边界,确定新的结果集的右边界 if (intervals[i][1] >= merged[mergedNum - 1][1]){ merged[mergedNum - 1][1] = intervals[i][1]; } } } return Arrays.copyOfRange(merged, 0, mergedNum); } } //leetcode submit region end(Prohibit modification and deletion) }
782f6ac1b2519ae5fd0b86c77519ed79686b742c
a4ac6d6667571a50f13e2243adbbdd2237dea0ec
/TYJP/Programming/src/com/numbertheory/Q21.java
6e923a1fd1693294bf3e9f91a94a30df7d4c8217
[]
no_license
SHAIKTOUSIF/Test-Repository
2d70ca35c66450cc974780ca0ba343bf867a45a7
c6a7167de05aac31f083bd691b793b839145d6d3
refs/heads/master
2020-07-05T17:55:50.874800
2020-05-15T06:54:44
2020-05-15T06:54:44
202,719,646
1
0
null
null
null
null
UTF-8
Java
false
false
597
java
//21. Develop a program to find out given number is a prime or not? package com.numbertheory; import java.util.Scanner; public class Q21 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the Number To Check It is Prime or Not"); int n=sc.nextInt(); //int n=15; boolean isPrime=true; int i=3; for(int j=2;j<n;j++) { if(n%j==0) { isPrime=false; break; } i++; }if(isPrime==false) { System.out.println("Not a Prime Number"); } else { System.out.println("It is prime number"); } } }
[ "tousif@LAPTOP-P04MERIM" ]
tousif@LAPTOP-P04MERIM
dcddb58014d9e762dd63179abe5b88136fa276bc
345ef7728e5ef7c3cc787790cec2670e74d3093b
/dash/src/dash/managerLogin.java
cbbd0b3cc6bee5ae2c45e8853e9d1a6f0d1f58f5
[]
no_license
boltu11/DashForCash
70b3dbae4be8c9cd65c0c6dcaf43210b417011bf
478fac62e7ba99fe718d0c40964bc8c4ce0879b3
refs/heads/master
2020-04-04T11:54:30.133409
2018-12-09T09:54:16
2018-12-09T09:54:16
155,907,624
0
0
null
null
null
null
UTF-8
Java
false
false
7,676
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 dash; /** * * @author navi */ public class managerLogin extends javax.swing.JDialog { /* *Variables */ int employeeId; String password; /** * Creates new form managerLogin */ public managerLogin(java.awt.Frame parent, boolean modal) { super(parent, modal); 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() { jTextField1 = new javax.swing.JTextField(); jPasswordField1 = new javax.swing.JPasswordField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setAlwaysOnTop(true); jLabel1.setText("Manager Login"); jLabel2.setText("Manager ID"); jLabel3.setText("Password"); jButton1.setText("Login"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Back"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel4.setText("Welcome!"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(48, 48, 48) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(52, 52, 52) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(64, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(125, 125, 125)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(30, 30, 30) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(7, 7, 7) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(38, 38, 38)) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: DatabaseManager auth = new DatabaseManager(); try{ //Get id and password from both fields employeeId = Integer.valueOf(jTextField1.getText()); password = new String(jPasswordField1.getPassword()); }catch(Exception e){ jLabel1.setText("Something went wrong!"); } int check = auth.authenticate(employeeId, password); if(check==2){ RegisterCashier frame = new RegisterCashier(); frame.setVisible(true); dispose(); }else{ jLabel4.setText("ncorrect EmployeeID or password. Please try again."+check); } }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPasswordField jPasswordField1; private javax.swing.JTextField jTextField1; // End of variables declaration//GEN-END:variables }
d7f433882f6c0326f139bc442b7d17315c0babf4
59ce981d11622f6a06c01cd19294e0c28cf7ee32
/src/reflexTest/Reflect.java
882fa328ed6a8a5c6ad9a83cf117a30249b1ee85
[]
no_license
juejiang123/BasicExercises
da1a07232dc900af2b55c588bbc198f656cf7866
273d49da5033423bc98c4cd998b8f69d39c2b8aa
refs/heads/master
2022-12-01T00:59:59.752264
2020-08-18T02:40:11
2020-08-18T02:40:11
285,811,291
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package reflexTest; /* 获取类对象的方式: 1.Class.forName("全类名"); 2.类名.class:通过类名的属性class获取,多用于参数的传递 3.对象.getClass():方法在object类中定义着。 */ import java.lang.reflect.Field; public class Reflect { public static void main(String[] args) throws ClassNotFoundException { Class cls = Class.forName("reflexTest.Person"); Field[] fields = cls.getFields(); String s = fields.toString(); System.out.println(s); Class<Person> personClass = Person.class; System.out.println(personClass); Person p = new Person(); Class<? extends Person> aClass = p.getClass(); System.out.println(aClass); } }
d43bca281eea5e189112325702ccc06c09e79650
51b198e880dca72c3bb27c853513c85feeac47a9
/app/src/main/java/com/practice/facerecognition/stupass.java
852a26b6dea0ff2b31c42d9880480d7f2b942906
[]
no_license
DongCX-LDHSP/FaceRecognition
a375b7a65c5d9f5601f6b4e65d5dc760d8c14ab6
11a962e1bd81f530640ce29492442a2cdded2e8d
refs/heads/master
2022-12-01T21:08:57.028262
2020-08-15T14:18:39
2020-08-15T14:18:39
287,491,658
8
1
null
null
null
null
UTF-8
Java
false
false
3,023
java
package com.practice.facerecognition; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.practice.facerecognition.util.DatabaseHelper; import static android.widget.Toast.LENGTH_LONG; import static android.widget.Toast.makeText; public class stupass extends AppCompatActivity { private Button btnpass; private EditText edtstuID1, edtstuID2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stupass); edtstuID1 = findViewById(R.id.edtstuID1); edtstuID2 = findViewById(R.id.edtstuID2); } public void btnpassClick(View view) { String studentID1 = edtstuID1.getText().toString(); String studentID2 = edtstuID2.getText().toString(); if(TextUtils.isEmpty(studentID1)|| TextUtils.isEmpty(studentID2)){ new AlertDialog.Builder(this).setTitle("提示") .setMessage("密码不能为空") .setPositiveButton("确定",null) .show(); } else if (studentID1.equals(studentID2)) { // 将密码录入数据库 DatabaseHelper helper= new DatabaseHelper(this); SQLiteDatabase db=helper.getWritableDatabase(); Intent receiveData = getIntent(); String username = receiveData.getStringExtra("username"); String insertUserInfoSql = "Insert Into Users(" + "sNum, " + "password, " + "isAdmin) " + "Values(?, ?, ?)"; db.execSQL(insertUserInfoSql, new String[]{username, studentID1,"0" }); db.close(); // 跳转到信息录入 AlertDialog.Builder a = new AlertDialog.Builder(this); a.setTitle("保存成功"); a.setMessage("信息已经保存"); a.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //界面跳转 Intent JumptostuPass = new Intent(); JumptostuPass.setClass(stupass.this, ManagerMainActivity.class); startActivity(JumptostuPass); } }); a.show(); } else { new AlertDialog.Builder(this).setTitle("提示") .setMessage("两次输入密码不一致") .setPositiveButton("确定", null) .show(); } } }
43a11bf44820546fdbd40f12d7536292b08ea369
a769529b129818bca3a3e69683eacea33f5829d4
/starter/critter/src/main/java/com/udacity/jdnd/course3/critter/entity/Customer.java
e72598c1f28e7ee06a25c452eec6c3262707c7dd
[ "MIT" ]
permissive
rucolasalat/critter-chronologer
06e74771f2d70abb0b548d2449580b03e0f3dceb
20416116950b76f5785cb3d4e50bdfd38639d20b
refs/heads/main
2023-03-05T17:21:54.487350
2021-02-21T10:06:39
2021-02-21T10:06:39
340,869,714
0
0
null
null
null
null
UTF-8
Java
false
false
914
java
package com.udacity.jdnd.course3.critter.entity; import org.hibernate.annotations.Nationalized; import javax.persistence.Entity; import javax.persistence.OneToMany; import java.util.ArrayList; import java.util.List; @Entity(name = "customers") public class Customer extends User { private String phoneNumber; @Nationalized private String notes; @OneToMany(mappedBy = "owner") private List<Pet> pets = new ArrayList<>(); //Getters & Setters public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getNotes() { return notes; } public void setNotes(String notes) { this.notes = notes; } public List<Pet> getPets() { return pets; } public void setPets(List<Pet> pets) { this.pets = pets; } }
12ecb74f1db689fc4502c39a19909bf04a8ba1f8
e027e3f29b952219f660595f125afb43091b971d
/MethodOverloading/src/MethodOverloading.java
8ca22d5b8854ede2dff5b511ce5860a0fe408a4a
[]
no_license
RandyZeleznak/Masterclass
6593b6ef910b78a7ca2057a5bead5041989db6a7
b67779f7e70039843090bf90150d2a4c705868a7
refs/heads/main
2023-02-25T23:13:58.152104
2021-01-30T14:01:50
2021-01-30T14:01:50
332,311,627
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
public class MethodOverloading { public static void main(String[] args) { double centimeters = calcFeetAndInchesToCentimeters(6,0); if(centimeters < 0){ System.out.println("Invalid parameters"); } calcFeetAndInchesToCentimeters(100); } public static double calcFeetAndInchesToCentimeters(double feet, double inches){ if((feet < 0) || (inches < 0 || inches > 12)){ return -1; } double centimeters = (feet * 12) * 2.54; centimeters += inches * 2.54; System.out.println(feet + " feet and " +inches+ " inches equals " +centimeters+ " centimeters");; return centimeters; } public static double calcFeetAndInchesToCentimeters(double inches){ if(inches < 0){ return -1; } double feet = (int) inches/12; double remainingInches = inches % 12; System.out.println(inches+ " inches equal to " +feet+ " feet and " +remainingInches+ " inches"); return calcFeetAndInchesToCentimeters(feet, remainingInches); } }
dc860186b125e1dac84152f36e678ed24de72ebf
847e2e8fa1c43eff5dee99c086d8280230b9cabc
/fluorite-aop/src/main/java/org/zy/fluorite/aop/aspectj/annotation/Aspect.java
3dea34d57d3ca370e51a583fb1a15987737852a6
[]
no_license
azurite-Y/Fluorite
fc4baa6a6f89d6efa22c07ed135d00335d06681b
313e5e14d15deeb56575d4a561da1496eb72616f
refs/heads/master
2023-01-24T20:34:59.422279
2020-12-10T04:15:55
2020-12-10T04:15:55
269,019,237
0
0
null
null
null
null
UTF-8
Java
false
false
496
java
package org.zy.fluorite.aop.aspectj.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @DateTime 2020年7月5日 下午10:54:43; * @author zy(azurite-Y); * @Description 标记一个类为切面类。 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Aspect {}
b2915598a288708008cad3ef29a40822e31eb512
d7d7b0c25a923a699ffa579e1bab546435443302
/NGServer/NettyTransfers/src/main/java/net/transfer/client/HeaderExchanger.java
8c8870f2f15e02a4f73d5667107354926d4a3cc5
[]
no_license
github188/test-3
9cd2417319161a014df8b54aa68579843ade8885
92c8b20ba19185fca1e0293fe7208102b338a9ca
refs/heads/master
2020-03-15T09:36:37.329325
2017-12-18T02:40:21
2017-12-18T02:40:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
package net.transfer.client; public class HeaderExchanger implements Exchanger { public ExchangerServer bind(BindTicket ticket,ExchangerHandler handler) throws RemotingException { return new HeaderExchangeServer(Transporters.bind(ticket,handler)); } public ExchangerClient connect(ConnectTicket ticket,ExchangerHandler handler) throws RemotingException { return new HeaderExchangeClient(Transporters.connect(ticket,handler)); } }
f1fe34dd54fc764e03edeccd626d7227681f6fc1
f061c637b3bf0785b728b256efff68dce48bd645
/app/src/main/java/com/github/typingtanuki/batt/scrapper/denchipro/DenchiProLaptopScrapper.java
d9f81c393c8da6ad23fbca6dc84972029a3ba198
[]
no_license
typingtanuki/batt
d006411979af1458e338a58fb1d1255e8413c73a
2d91dcb995a16b4974d3eea5992bb1722d858224
refs/heads/master
2023-04-20T23:03:21.337453
2021-05-06T08:20:54
2021-05-06T08:20:54
311,189,613
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package com.github.typingtanuki.batt.scrapper.denchipro; public class DenchiProLaptopScrapper extends AbstractDenchiProScrapper { public DenchiProLaptopScrapper() { super("http://www.denchipro.com/product-category/%e9%9b%bb%e6%b1%a0%e7%a8%ae%e9%a1%9e/%e3%83%8e%e3%83%bc%e3%83%88%e3%83%91%e3%82%bd%e3%82%b3%e3%83%b3-%e3%83%90%e3%83%83%e3%83%86%e3%83%aa%e3%83%bc/"); } @Override public String name() { return "Denchipro - Laptop"; } }
70df0924feeb3b0a8b97064697ba6024243cf979
2f78662326a50972673a74af2f650df927cbe0fc
/designpattern/src/main/java/com/yuruiyin/designpattern/state/TvController.java
efd93806ee5efd5b0e9a2080d157217923cac780
[]
no_license
MatadorC/AndroidDesignPattern
e8dbca9682d3597b2528902f4aa884bfb8648f47
14f630e445c938d94754f9e7425b6d7922e44f5d
refs/heads/master
2021-09-20T03:21:16.503493
2018-08-02T12:17:56
2018-08-02T12:17:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,221
java
package com.yuruiyin.designpattern.state; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2018</p> * <P>Company: 17173</p> * * @author yuruiyin * @version 2018/7/27 */ public class TvController implements PowerController { private TvState mTvState; public void setTvState(TvState tvState) { this.mTvState = tvState; } @Override public void powerOn() { if (mTvState != null && mTvState instanceof PowerOnState) { System.out.println("已处于开机状态"); return; } setTvState(new PowerOnState()); System.out.println("开机啦!"); } @Override public void powerOff() { if (mTvState != null && mTvState instanceof PowerOffState) { System.out.println("已处于关机状态"); return; } setTvState(new PowerOffState()); System.out.println("关机啦!"); } public void nextChannel() { mTvState.nextChannel(); } public void preChannel() { mTvState.preChannel(); } public void turnUp() { mTvState.turnUp(); } public void turnDown() { mTvState.turnDown(); } }
d7777787b8f536beb5bb8610f38e433b02761e57
be226a4a6e1963bbe7621b62a23546e4730666c2
/app/src/main/java/com/swapon/simplenetworkoperationusingmvvm/utills/URLSettings.java
7a5e901c2e094379b884b78eeaf259011336af5c
[]
no_license
TouhidSwapon/SimpleNetworkOperationUsing-MVVM-LiveData-Retrofit-DataBinding
b255821ed77a8195bd5c7f6d27fc8b742a99692d
8fec790720855109514b1f9b7c8937dd603431a5
refs/heads/master
2022-04-08T07:40:17.370338
2020-03-06T10:07:41
2020-03-06T10:07:41
240,042,907
1
0
null
null
null
null
UTF-8
Java
false
false
214
java
package com.swapon.simplenetworkoperationusingmvvm.utills; /** * Created by metakave-android-PC on 16-Oct-18. */ public class URLSettings { //GET public static final String GET_USERS = "users"; }
f18359a4c2c4c619cb70c40322ae1852a3776ce9
5ea49a0c3c9b1a51a9d29a49a103058fe9ea3576
/src/main/java/com/opensource/dada/problems/design/onlineReaderSystem/Display.java
567b066515b09b5966d32281dcf5163f6f8f2110
[]
no_license
dada1008/DSAProblems
ed7db59b0d8cc51d6d8edd92c40eda9e14217bfd
10d48ba1e9ebbfe8e8bf900f49cbd65d42fcbb67
refs/heads/master
2022-09-01T10:54:13.110402
2022-08-08T10:21:40
2022-08-08T10:21:40
155,482,963
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.opensource.dada.problems.design.onlineReaderSystem; /** * Class to display active user and associated book */ public class Display { }
e0c60959d4693664535960f02a6aecc3657ebc5a
f65d8efd8488c3f26ec272067534453916bb433b
/algorithm-study/src/main/java/org/woodwhale/code/chapter_4_recursionanddp/Problem_05_LIS.java
3cc5f843cec4f4a2467b0be58028563b6d5ce5f3
[ "WTFPL" ]
permissive
woodwhales/woodwhales-study
3c63d08e7aff503484905ea857ba389d5ee972d6
d8b95c559d3223b54211418bce78b9d9d41f9b08
refs/heads/master
2023-03-04T16:04:59.516245
2022-08-21T07:16:20
2022-08-21T07:16:20
184,915,908
2
3
WTFPL
2023-03-01T03:42:52
2019-05-04T16:00:32
Java
UTF-8
Java
false
false
1,882
java
package org.woodwhale.code.chapter_4_recursionanddp; public class Problem_05_LIS { public static int[] lis1(int[] arr) { if (arr == null || arr.length == 0) { return null; } int[] dp = getdp1(arr); return generateLIS(arr, dp); } public static int[] getdp1(int[] arr) { int[] dp = new int[arr.length]; for (int i = 0; i < arr.length; i++) { dp[i] = 1; for (int j = 0; j < i; j++) { if (arr[i] > arr[j]) { dp[i] = Math.max(dp[i], dp[j] + 1); } } } return dp; } public static int[] generateLIS(int[] arr, int[] dp) { int len = 0; int index = 0; for (int i = 0; i < dp.length; i++) { if (dp[i] > len) { len = dp[i]; index = i; } } int[] lis = new int[len]; lis[--len] = arr[index]; for (int i = index; i >= 0; i--) { if (arr[i] < arr[index] && dp[i] == dp[index] - 1) { lis[--len] = arr[i]; index = i; } } return lis; } public static int[] lis2(int[] arr) { if (arr == null || arr.length == 0) { return null; } int[] dp = getdp2(arr); return generateLIS(arr, dp); } public static int[] getdp2(int[] arr) { int[] dp = new int[arr.length]; int[] ends = new int[arr.length]; ends[0] = arr[0]; dp[0] = 1; int right = 0; int l = 0; int r = 0; int m = 0; for (int i = 1; i < arr.length; i++) { l = 0; r = right; while (l <= r) { m = (l + r) / 2; if (arr[i] > ends[m]) { l = m + 1; } else { r = m - 1; } } right = Math.max(right, l); ends[l] = arr[i]; dp[i] = l + 1; } return dp; } // for test public static void printArray(int[] arr) { for (int i = 0; i != arr.length; i++) { System.out.print(arr[i] + " "); } System.out.println(); } public static void main(String[] args) { int[] arr = { 2, 1, 5, 3, 6, 4, 8, 9, 7 }; printArray(arr); printArray(lis1(arr)); printArray(lis2(arr)); } }
845e019ae51d1580777bccaa906418a5ae6525ef
67e0437daf69acbb66b66cc56f9814b6b948155a
/waralaba.java
02283f90455ee583a448e8c89176dcea25e47724
[]
no_license
fabiochristianomalisan/Fabio-Malisan
d7f13e6301ee3009cebbaa3dc5b3382e64e64b1f
91e9169824caae3047a91aa6f7189f827378a7b2
refs/heads/master
2020-12-29T10:40:05.287995
2020-03-12T04:58:06
2020-03-12T04:58:06
238,578,299
0
0
null
null
null
null
UTF-8
Java
false
false
3,703
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 tugassatu; import java.util.Scanner; /** * * @author ACER */ public class waralaba { public static void main(String[] args){ } static Scanner input = new Scanner (System.in); static void menu(){ String [] Paketchiken = new String[100]; String [] Paketoke = new String[100]; int i=0; int [] harga = new int[100]; int [] harga2 =new int[100]; int jumlah = 0; int hargatotal = 0; System.out.print("======================================================"); System.out.print(" WARUNG MAMA "); System.out.print(" SELAMAT PAGI "); System.out.print("======================================================"); System.out.println(""); System.out.println(" SILAHKAN PILIH MENU "); System.out.println("1.Paket chiken "); System.out.println("A.Chiken A |Rp.12.000|"); System.out.println("B. Chiken B |Rp.15.000|"); System.out.println("C. Chiken C |Rp.20.000|"); System.out.println("2.Paket oke"); System.out.println("A.oke A |Rp.10.000|"); System.out.println("B.oke B |Rp.12.000|"); System.out.println("C.oke C |Rp.15.000|"); System.out.println(""); System.out.print("Silahkan pilih makanan yang anda inginkan"); int pil=input.nextInt(); switch (pil){ case 1: Paketchiken [i] = "Chiken A"; harga [i] = 12000; break; case 2: Paketchiken [i] = "Chiken B"; harga [i] = 15000; break; case 3: Paketchiken [i] = "Chiken C"; harga [i] = 20000; break; case 5: default: System.out.println("Pilihan makanan yang anda pesan sudah siap"); break; } for (int k=pil;k<3;k++){ System.out.println("makanan pilihan anda adalah : "+Paketchiken[i]); System.out.print("Jumlah pesanan anda"); int jmlhmakanan = input.nextInt(); harga[i]=harga[i]*jmlhmakanan; System.out.println("Harga makanan : Rp."+harga[i]+";"); break; } System.out.println(""); System.out.print("Silahkan pilih paket makanan : "); int pil2=input.nextInt(); switch (pil2){ case 1: Paketoke [i] = "oke A"; harga [i] = 10000; break; case 2: Paketoke [i] = "oke B"; harga [i] = 12000; break; case 3: Paketoke [i] = "oke C"; harga [i] = 15000; break; default: System.out.println("Maknan yang ada pilih sudah siap"); } for (int j=pil2;j<3;j++){ System.out.println("Makanan yang anda pilih adalah : "+Paketoke[i]); System.out.print("jumlah pesanan :"); int jmlhpesanan = input.nextInt(); harga2[i]=harga2[i]*jmlhpesanan; System.out.println("harga makanan sebesar : Rp. "+harga2[i]+ ";"); break; } System.out.println(""); int totalPaketchiken = 0; int totalPaketoke = 0; int total=harga[i]+harga2[i]; System.out.println("Total belanja sebesar : Rp. "+total+ ";"); } }
c666e9c3a2e80ad7ea5a1b593cef691d7a6209a5
481b0c55a938d864ccdc136771a3c35c4d0bbfce
/src/test/java/GoogleTest.java
b712fad9c94232d65679312062d72017331ed388
[]
no_license
bkabab/ScribeJava
dfacb7ad52c89c86f86744065e82f63d133972ae
146c31364098b34c74fb9286cd4a146b5adf8079
refs/heads/master
2021-01-01T06:10:40.281526
2014-04-29T01:28:45
2014-04-29T01:28:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,982
java
import static org.junit.Assert.*; import java.util.*; import org.junit.Test; import org.scribe.builder.ServiceBuilder; import org.scribe.builder.api.GoogleApi; import org.scribe.model.*; import org.scribe.oauth.OAuthService; public class GoogleTest { public static final String NETWORK_NAME = "Google"; public static final String AUTHORIZE_URL = "https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token="; public static final String PROTECTED_RESOURCE_URL = "https://docs.google.com/feeds/default/private/full/"; public static final String SCOPE = "https://docs.google.com/feeds/"; public static boolean GoogleAuth() { OAuthService service = new ServiceBuilder() .provider(GoogleApi.class) .apiKey("anonymous") .apiSecret("anonymous") .scope(SCOPE) .build(); Scanner in = new Scanner(System.in); System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ==="); System.out.println(); GoogleTest.ReqToken(service, in); return true; } public static boolean ReqToken(OAuthService service, Scanner in ) { // Obtain the Request Token System.out.println("Fetching the Request Token..."); Token requestToken = service.getRequestToken(); System.out.println("Got the Request Token!"); System.out.println("(if your curious it looks like this: " + requestToken + " )"); System.out.println(); System.out.println("Authorize Scribe here:"); System.out.println(AUTHORIZE_URL + requestToken.getToken()); System.out.println("And paste the verifier here"); System.out.print(">>"); Verifier verifier = new Verifier(in.nextLine()); System.out.println(); return true; } public static boolean accessApi(OAuthService service, Token requestToken, Verifier verifier ) { // Trade the Request Token and Verfier for the Access Token System.out.println("Trading the Request Token for an Access Token..."); Token accessToken = service.getAccessToken(requestToken, verifier); System.out.println("Got the Access Token!"); System.out.println("This is the access token " + accessToken); System.out.println(); // Now let's go and ask for a protected resource! System.out.println("Accessing a protected resource..."); OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL); service.signRequest(accessToken, request); request.addHeader("GData-Version", "3.0"); Response response = request.send(); System.out.println("Got it! Lets see what we found..."); System.out.println(); System.out.println(response.getCode()); System.out.println(response.getBody()); System.out.println(); System.out.println("Authentication procedure complete !"); return true; } @Test public void test_runpass(){ assertTrue(GoogleTest.GoogleAuth()); } }
0fca408dcb2f82acbd7ae4f57bb776798a9dd994
8d4c74e4186d7a8b9c84d7729107a39a32d71872
/iTunes Music Search app/app/src/androidTest/java/com/example/musicsearchapp/ExampleInstrumentedTest.java
5c51d13020464f7e99d3c1dad6679724ea6acc8c
[]
no_license
dhanyaramesh06/android-applications
326030e6e9596be04978a52f7db652e8fec56d41
aad8366891a6bf77bb480a9a2b2d3d79e80afc70
refs/heads/master
2022-02-24T07:33:27.055979
2019-07-23T06:43:50
2019-07-23T06:43:50
198,313,063
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package com.example.musicsearchapp; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.musicsearchapp", appContext.getPackageName()); } }
a0bfaae01fb1b56bbbabfdadcc10b24ff8025b7c
44c90d7fbc6952f087c910d4d775215cbdb29970
/src/main/java/Contrroller/Handlers/CRUDvacationHandler.java
9348ebde6aea7c4485c680d98cd34d593515bfb8
[]
no_license
idanovadia/Your_Next_Vacation
8cd5e096ee52b66325c410f809352278295420e1
83145b25ac0b68b5ba185360e9e48818709f6754
refs/heads/master
2021-06-20T04:16:41.941678
2019-01-09T14:24:54
2019-01-09T14:24:54
200,799,804
0
0
null
2021-04-26T19:23:37
2019-08-06T07:29:05
Java
UTF-8
Java
false
false
1,397
java
package Contrroller.Handlers; import javafx.event.Event; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Modality; import javafx.stage.Stage; import java.io.IOException; public class CRUDvacationHandler implements EventHandler { private String s=""; public CRUDvacationHandler(String ss){ this.s = ss; } @Override public void handle(Event event) { final String s1 =s; FXMLLoader fxmlLoader = new FXMLLoader(getClass().getClassLoader().getResource(s1)); Parent root = null; try { root = fxmlLoader.load(); Stage stage = new Stage(); Scene scene=null; if(s1.equals("CreateVacation.fxml")) scene = new Scene(root, 450, 600); else if(s1.equals("showUserVacation.fxml")) scene = new Scene(root, 1200, 509); scene.getStylesheets().add(getClass().getClassLoader().getResource("CreateVacation.css").toExternalForm()); stage.initModality(Modality.APPLICATION_MODAL); stage.setOpacity(1); stage.setTitle("Post your vacation !"); stage.setScene(scene); stage.showAndWait(); event.consume(); } catch (IOException e) { e.printStackTrace(); } } }
faced8b083c8f7492c7f61af9f0e316af278e945
81ded993789508a08072af606bf08ced7a688011
/java-completed/app/src/main/java/com/vonage/tutorial/messaging/User.java
8238f0fd62d0a4873c92d7ba9df4bff8dbb241fc
[ "MIT" ]
permissive
nexmo-community/client-sdk-android-tutorial-messaging
a227868002404be65b8076622eb296e41fd0282a
6379aec4d80bda0068270c039ecf44bca573d44d
refs/heads/master
2021-05-21T01:26:24.677428
2021-01-20T10:05:45
2021-01-20T10:05:45
252,485,732
2
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.vonage.tutorial.messaging; public class User { public String jwt; String name; public User(String name, String jwt) { this.name = name; this.jwt = jwt; } public String getName() { return name; } public String getId() { return jwt; } }
d4a69b786670cd25c42b4dafe7ff4c6fa11d1b1e
80f1c6d8ab185d207dbab1a60c04d058e2f5b8b7
/app/src/main/java/taiwan/questfy/welsenho/questfy_tw/PersonAskQuestionRelated/PersonalAskReplyingActivity.java
b7f975a28ba64162e78702c8c75e58b987f731f6
[]
no_license
TTXD19/QuestfyTW
e5ba5e053083a0abdff70b47c26fcb052a1d57c3
d0c8ecf66d0d6d4bd964dcd6c989a4b297698a1c
refs/heads/master
2022-11-17T23:03:42.920734
2020-07-07T00:17:54
2020-07-07T00:17:54
160,916,758
0
0
null
null
null
null
UTF-8
Java
false
false
9,901
java
package taiwan.questfy.welsenho.questfy_tw.PersonAskQuestionRelated; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.squareup.picasso.Picasso; import java.util.HashMap; import taiwan.questfy.welsenho.questfy_tw.EditActivityRelated.EditRelatedMethod; import taiwan.questfy.welsenho.questfy_tw.R; public class PersonalAskReplyingActivity extends AppCompatActivity { private static final int REQUEST_IMAGE_SELECT = 0; private String questionUid; private String imageUri; private String imageDate; private String questioType; private String AskerUid; private EditRelatedMethod editRelatedMethod; private TextView txtUserName; private TextView txtUploadData; private ImageView imageView; private ImageView imgPreview; private Button btnCancel; private Button btnReply; private EditText editContent; private ProgressDialog progressDialog; private FirebaseAuth firebaseAuth; private FirebaseUser firebaseUser; private FirebaseDatabase firebaseDatabase; private DatabaseReference databaseReference; private FirebaseStorage firebaseStorage; private StorageReference storageReference; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_personal_ask_replying); questionUid = getIntent().getStringExtra("questionUid"); questioType = getIntent().getStringExtra("questioType"); AskerUid = getIntent().getStringExtra("AskerUid"); Toast.makeText(this, AskerUid, Toast.LENGTH_SHORT).show(); InitFirebase(); InitItem(); ItemClick(); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (requestCode == REQUEST_IMAGE_SELECT ){ if (resultCode == RESULT_OK){ Uri photoUri = data.getData(); UploadPhoto(photoUri); } } super.onActivityResult(requestCode, resultCode, data); } private void InitFirebase() { firebaseAuth = FirebaseAuth.getInstance(); firebaseUser = firebaseAuth.getCurrentUser(); firebaseDatabase = FirebaseDatabase.getInstance(); databaseReference = firebaseDatabase.getReference(); firebaseStorage = FirebaseStorage.getInstance(); storageReference = firebaseStorage.getReference(); } private void ItemClick() { btnReply.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { UploadFirebase(); } }); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(PersonalAskReplyingActivity.this, PersonalAskQuestReplyActivity.class); intent.putExtra("questionUid", questionUid); intent.putExtra("questioType", questioType); intent.putExtra("AskerUid", AskerUid); startActivity(intent); finish(); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectPhoto(); } }); imgPreview.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (imageUri != null){ AlertDialog.Builder builder = new AlertDialog.Builder(PersonalAskReplyingActivity.this); builder.setTitle(R.string.delete_photo).setMessage(R.string.click_to_delete_photo).setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ClickToDeletePhoto(); dialog.dismiss(); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); builder.show(); } } }); } private void InitItem() { txtUserName = findViewById(R.id.person_ask_replying_txtUserName); txtUploadData = findViewById(R.id.person_ask_replying_txtUpdateDate); imageView = findViewById(R.id.person_ask_replying_imgBtnAddPicture); imgPreview = findViewById(R.id.person_ask_replying_imgPreview); btnReply = findViewById(R.id.person_ask_replying_btnReply); btnCancel = findViewById(R.id.person_ask_replying_btnCancel); editContent = findViewById(R.id.person_ask_replying_editAnswer); progressDialog = new ProgressDialog(this); editRelatedMethod = new EditRelatedMethod(); txtUserName.setText(firebaseUser.getDisplayName()); txtUploadData.setText(editRelatedMethod.getUploadDate()); } private void UploadFirebase(){ String content = editContent.getText().toString(); String randomUid = databaseReference.child("Personal_Ask_Question_Reply").push().getKey(); if (content.trim().length() >= 15){ HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("AskQuesitonUid", questionUid); hashMap.put("User_Name", firebaseUser.getDisplayName()); hashMap.put("userUid", firebaseUser.getUid()); hashMap.put("Content", content); hashMap.put("AskerUid", AskerUid); long uploadTimeStamp = System.currentTimeMillis(); uploadTimeStamp *= -1; hashMap.put("uploadTimeStamp", uploadTimeStamp); if (imageUri != null){ hashMap.put("QuestionTumbnail", imageUri); } databaseReference.child("Personal_Ask_Question_Reply").child(questionUid).child(randomUid).updateChildren(hashMap).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()){ Intent intent = new Intent(PersonalAskReplyingActivity.this, PersonalAskQuestReplyActivity.class); intent.putExtra("questionUid", questionUid); intent.putExtra("questioType", questioType); intent.putExtra("AskerUid", AskerUid); startActivity(intent); finish(); } } }); }else { Toast.makeText(this, "Answer must be over 15 characters", Toast.LENGTH_SHORT).show(); } } private void selectPhoto(){ Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, REQUEST_IMAGE_SELECT); } private void UploadPhoto(final Uri photoUri){ progressDialog.setTitle("Loading"); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setCancelable(false); progressDialog.show(); EditRelatedMethod editRelatedMethod = new EditRelatedMethod(); String date = editRelatedMethod.getDate(); imageDate = date; storageReference = storageReference.child("Personal_Ask_Request_Images").child(questionUid).child(firebaseUser.getUid()).child(date); storageReference.putFile(photoUri).continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { if (!task.isSuccessful()){ throw task.getException(); }else { return storageReference.getDownloadUrl(); } } }).addOnCompleteListener(new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if (task.isSuccessful()){ imageUri = task.getResult().toString(); Picasso.get().load(task.getResult()).fit().into(imgPreview); progressDialog.dismiss(); }else { progressDialog.dismiss(); Toast.makeText(PersonalAskReplyingActivity.this, "Fail", Toast.LENGTH_SHORT).show(); } } }); } private void ClickToDeletePhoto(){ imageUri = null; imgPreview.setImageResource(0); storageReference.delete(); imageDate = null; } }
11d15e36af8ad23604ffc79596cf13003e72a51f
8e25e486dbcd83a0fe0d41ae5657465f225760a6
/src/main/java/PointAtOffer/Q38_FindPath.java
25a66e3f4b77a0b574cc2ccb1e8b8ca0901d400c
[]
no_license
Maecenas/PointAtOffer
1ec50a5559963ae1b5e3cd7d63035db4343db855
6ed162915646418c4278992021455985c5e6fa1f
refs/heads/master
2020-05-15T03:54:49.425595
2019-08-27T06:50:14
2019-08-27T06:50:14
182,075,387
4
0
null
null
null
null
UTF-8
Java
false
false
947
java
package PointAtOffer; import PointAtOffer.utils.TreeNode; import java.util.ArrayList; import java.util.List; public class Q38_FindPath { public static List<List<Integer>> findPath(TreeNode<Integer> root, int target) { if (root == null) return new ArrayList<>(); List<List<Integer>> res = new ArrayList<>(); backtracking(root, target, res, new ArrayList<>()); return res; } private static void backtracking(final TreeNode<Integer> node, int target, final List<List<Integer>> res, final List<Integer> path) { if (node == null) return; path.add(node.val); target -= node.val; if (target == 0 && node.left == null && node.right == null) { res.add(new ArrayList<>(path)); } else { backtracking(node.left, target, res, path); backtracking(node.right, target, res, path); } path.remove(path.size() - 1); } }
a9c199543260b0ae1b161492b60b937283655961
1799ab7898db90882a097595891e25af305aaea5
/src/main/java/com/black_belt/course/streams/Methods.java
5c607876382c858bfe5fac4292ba2387199053f5
[]
no_license
Alex-Tsi/ZaurCourse---BlackBelt
659a620228ee6fdb508d4f2cc350a9e96e3f625c
fe29be6d5e550b7a8fd1706da25412034350350a
refs/heads/master
2023-03-03T04:38:12.299214
2021-02-07T14:59:46
2021-02-07T14:59:46
330,426,890
0
0
null
null
null
null
UTF-8
Java
false
false
1,689
java
package com.black_belt.course.streams; import java.util.stream.Stream; public class Methods { public static void main(String[] args) { //----------------------------------------------------------------------- System.out.println("Concat result: "); Stream<Integer> concatFirst = Stream.of(1, 2, 3, 4, 5, 6); Stream<Integer> concatSecond = Stream.of(7, 8, 9, 10); Stream<Integer> streamConcat = Stream.concat(concatFirst, concatSecond); //concat - просто склеивает streamConcat.forEach(System.out::println); System.out.println("--------------------------------------------------------------------------------"); //----------------------------------------------------------------------- System.out.println("Distinct result: "); Stream<Integer> distinctStream = Stream.of(1, 2, 3, 1, 2, 3, 1, 2, 3); distinctStream.distinct().forEach(System.out::println); //distinct(i) - уникальные значения System.out.println("--------------------------------------------------------------------------------"); //----------------------------------------------------------------------- System.out.println("Count result: "); Stream<Integer> countStream = Stream.of(1, 2, 3, 4, 5, 0); long countResult = countStream.count(); //count(t) - возвращает количество элементов System.out.println(countResult); System.out.println("--------------------------------------------------------------------------------"); //Стрим можно использовать только 1 раз } }
c078a6135bd9ac48bffc26c2f9755fff05cd2f66
a3e43200532ec5a680ca07a7a31fa4e9fd5c5f36
/app/src/main/java/core2/maz/com/core2/fragments/WebViewFragment.java
fa524ab65bf3a5862a8a556828374e08c38ba106
[]
no_license
ankurinnovationm/L_Core
fde485a7358b83e231a7fba1ed37e2ca779e2d51
6d3c40ff5150bf9801fd61d69dd8f21e773562d1
refs/heads/master
2020-06-22T03:23:58.137236
2016-11-29T07:55:14
2016-11-29T07:55:14
74,756,943
0
0
null
null
null
null
UTF-8
Java
false
false
2,708
java
package core2.maz.com.core2.fragments; import android.content.Intent; import android.graphics.Color; import android.graphics.PorterDuff; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import core2.maz.com.core2.R; import core2.maz.com.core2.model.Menu; /** * Created by Ankur Jain on 29-11-2016. */ public class WebViewFragment extends Fragment { private WebView webView; private ProgressBar progress; private Menu menu; private String url; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.webview_fragment_layout,container,false); menu = (Menu) getArguments().getSerializable("menu"); url = menu.getContentUrl(); initializeView(view); return view; } private void initializeView(View view) { webView = (WebView) view.findViewById(R.id.webView); progress = (ProgressBar) view.findViewById(R.id.progressBar); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WebClient()); webView.setWebChromeClient(new WebViewChromeClient()); progress.getProgressDrawable().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN); progress.setScaleY(1f); progress.setMax(100); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setBuiltInZoomControls(true); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setScrollbarFadingEnabled(false); webView.setVerticalScrollBarEnabled(true); if(url!=null) webView.loadUrl(url); } private class WebClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { { view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } return false; } } private class WebViewChromeClient extends WebChromeClient { @Override public void onProgressChanged(WebView view, int newProgress) { WebViewFragment.this.setValue(newProgress); super.onProgressChanged(view, newProgress); } } public void setValue(int progress) { this.progress.setProgress(progress); } }
903090755b897380aa66c96c3e8002181f5371a3
3d13b7dda0633cdfbf2a8291cd5f898d34f0b373
/src/main/java/org/clm/util/bak/RedisUtil.java
eb8cbf0c66ffbcb1eebbc2de0dd53fcf1a559ecd
[]
no_license
CaiLiMingW/mmall
b078dec862274626abbbbdeeeca8319ac7097901
806a0e69552d059fce98e31378f5d82e1dd439ce
refs/heads/master
2020-03-29T22:14:21.054468
2018-11-12T12:11:04
2018-11-12T12:11:04
150,410,332
0
0
null
2018-10-15T03:51:17
2018-09-26T10:37:59
Java
UTF-8
Java
false
false
4,233
java
package org.clm.util.bak; import org.clm.util.JsonUtil; import org.codehaus.jackson.type.TypeReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; /** * @author Ccc * @date 2018/10/12 0012 下午 10:06 */ public class RedisUtil { private static Logger log = LoggerFactory.getLogger(RedisUtil.class); private static JedisPool jedisPool; @Autowired private static JedisPoolConfig jedisPoolConfig; public static Jedis getJedis(){ return jedisPool.getResource(); } public static <T> String set(String objType,String key,T obj){ Jedis jedis = null; String result = null; String value = null; key = objType+"_"+key; try { jedis = jedisPool.getResource(); value = JsonUtil.objToString(obj); result = jedis.set(key, value); }catch (Exception e){ jedisPool.returnBrokenResource(jedis); return result; } jedisPool.returnResource(jedis); return result; } public static <T> String setEx(String objType,String key,T obj,int exTime){ Jedis jedis = null; String result = null; key = objType+"_"+key; try { jedis = jedisPool.getResource(); String objToString = JsonUtil.objToString(obj); result = jedis.setex(key, exTime,objToString); }catch (Exception e){ jedisPool.returnBrokenResource(jedis); log.info("\n========获取jedis失败=========\n"); return result; } jedisPool.returnResource(jedis); return result; } public static Long expire(String objType,String key,int exTime){ Jedis jedis = null; Long result = null; key = objType+"_"+key; try { jedis = jedisPool.getResource(); result = jedis.expire(key,exTime); }catch (Exception e){ jedisPool.returnBrokenResource(jedis); return result; } jedisPool.returnResource(jedis); return result; } public static <T> T get(String objType,String key,Class<T> clazz){ Jedis jedis = null; key = objType+"_"+key; String objStrng = null; T data = null; log.info("\n=========get==========\n"); try { jedis = jedisPool.getResource(); objStrng = jedis.get(key); log.info("\n=======jedis.get()===========\n{}\n",key); data = JsonUtil.StringToObj(objStrng, clazz); }catch (Exception e){ jedisPool.returnBrokenResource(jedis); log.info("\n=======jedis异常===========\n{}\n",jedis); return null; } jedisPool.returnResource(jedis); return data; } public static <T> T getList(String objType, String key, TypeReference<T> typeReference) { Jedis jedis = null; key = objType + "_" + key; String objStrng = null; T data = null; try { jedis = jedisPool.getResource(); objStrng = jedis.get(key); data = JsonUtil.StringToObj(objStrng, typeReference); } catch (Exception e) { jedisPool.returnBrokenResource(jedis); log.info("\n=======jedis.getList异常===========\n{}\n", e); return null; } jedisPool.returnResource(jedis); return data; } public static Long del(String objType,String key){ Jedis jedis = null; Jedis jedis1= null; RedisTemplate redisTemplate; key = objType+"_"+key; Long result = null; try { jedis = jedisPool.getResource(); result = jedis.del(key); }catch (Exception e){ jedisPool.returnBrokenResource(jedis); return result; } jedisPool.returnResource(jedis); return result; } public static void main(String[] args) { } }
370f36505c0d2c05e81ebf8e7f5648f3da55e251
fb77328196cfce03640b05736d2c613389d62893
/Task15.java
b16e937b1b879a7072338f29eed4701e7967c925
[]
no_license
o000oo799/Java4thCOURSE
619d06a69bde6b433852c90ad436e1815d7511fc
81356a56b8574182c64701ae8787227146119393
refs/heads/master
2020-07-24T07:14:47.253162
2019-10-20T17:08:41
2019-10-20T17:08:41
207,842,250
0
0
null
null
null
null
UTF-8
Java
false
false
1,314
java
package lesson02.part01; /** * taskKey="com.".task.task03.task0316"\n\nЭкранирование символов * <p> * Вывести на экран следующий текст - две строки: * <p> * It's Windows path: "C:\Program Files\Java\jdk1.7.0\bin" * It's Java string: \"C:\\Program Files\\Java\\jdk1.7.0\\bin\" * Подсказка: * \” – экранирование двойной кавычки; * \\ – экранирование обратной косой черты (\). * Больше про экранирование символов и Escape-последовательности в Java читай в статье: * https://"sh.ru/groups/posts/614-----ehkranirovanie-simvolov-v-java * <p> * <p> * Требования: * 1. Программа должна выводить текст. * 2. Должно быть выведено две строки. * 3. Текст первый строки должен быть: It's Windows path: "C:\Program Files\Java\jdk1.7.0\bin" * 4. Текст второй строки должен быть: It's Java string: \"C:\\Program Files\\Java\\jdk1.7.0\\bin\" */ public class Task15 { public static void main(String[] args) { //напишите тут ваш код } }
0e773f29cfa84cd7702b8b5c3bc6f3555bad509f
5e0746274bee86030fb0a9a0259788f54d34b474
/app/src/main/java/com/huatec/edu/mobileshop/http/entity/MemberEntity.java
bf5a064af8d630602ffa0ad8c716e0cc679a0644
[]
no_license
lantern3268/MobileShop2
78e1355c7b7f3f569a821aaebfaf222c0ca54fd6
744419cdd64ca65ace675115d741400783dbfca6
refs/heads/master
2020-09-13T23:12:08.929400
2019-11-20T12:39:09
2019-11-20T12:39:09
222,933,978
0
0
null
null
null
null
UTF-8
Java
false
false
2,377
java
package com.huatec.edu.mobileshop.http.entity; public class MemberEntity { public int member_id; public String uname; public String email; public String password; public int sex; public String mobile; public long regtime; public long lastlogin; public String image; public String memberAddresses; public int getMember_id() { return member_id; } public void setMember_id(int member_id) { this.member_id = member_id; } public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getSex() { return sex; } public void setSex(int sex) { this.sex = sex; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public long getRegtime() { return regtime; } public void setRegtime(long regtime) { this.regtime = regtime; } public long getLastlogin() { return lastlogin; } public void setLastlogin(long lastlogin) { this.lastlogin = lastlogin; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getMemberAddresses() { return memberAddresses; } public void setMemberAddresses(String memberAddresses) { this.memberAddresses = memberAddresses; } @Override public String toString() { return "MemberEntity{" + "member_id=" + member_id + ", uname='" + uname + '\'' + ", password='" + password + '\'' + ", email='" + email + '\'' + ", sex=" + sex + ", mobile='" + mobile + '\'' + ", regtime=" + regtime + ", lastlogin=" + lastlogin + ", image='" + image + '\'' + ", memberAddresses='" + memberAddresses + '\'' + '}'; } }
7dfc3a26e98405cc565cfdf7f5926dd1e21c5086
bbcd1ca59601057feaca183ef534028853d9300e
/lwh-gl/gl-product/src/main/java/com/lwhtarena/glmall/product/exception/GulimallExceptionControllerAdvice.java
57ab07842fd17cd71fe516e41b150e5dc6592863
[]
no_license
hkkkkq/cloud
214f95e1c0a07af99339219119b7200ff6b8056f
ee21c997ed02ec69ff5b97c78851894c5c25301b
refs/heads/master
2023-01-01T05:03:44.237792
2020-10-22T16:32:56
2020-10-22T16:32:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,038
java
package com.lwhtarena.glmall.product.exception; import com.lwhtarena.common.exception.BizCodeEnume; import com.lwhtarena.common.utils.R; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import java.util.HashMap; import java.util.Map; /** * @author liwh * @Title: GulimallExceptionControllerAdvice * @Package com.lwhtarena.glmall.product.exception * @Description: 集中处理所有异常 * @ResponseBody + @ControllerAdvice = @ControllerAdvice * @Version 1.0.0 * @date 2020/7/28 12:47 */ //@ResponseBody //@ControllerAdvice(basePackages = "com.lwhtarena.glmall.product.controller") @Slf4j @RestControllerAdvice(basePackages = "com.lwhtarena.glmall.product.controller") public class GulimallExceptionControllerAdvice { /** * 精确匹配 * @param e * @return */ @ExceptionHandler(value= MethodArgumentNotValidException.class) public R handleVaildException(MethodArgumentNotValidException e){ log.error("数据校验出现问题{},异常类型:{}",e.getMessage(),e.getClass()); BindingResult bindingResult = e.getBindingResult(); Map<String,String> errorMap = new HashMap<>(); bindingResult.getFieldErrors().forEach((fieldError)->{ errorMap.put(fieldError.getField(),fieldError.getDefaultMessage()); }); return R.error(BizCodeEnume.VAILD_EXCEPTION.getCode(),BizCodeEnume.VAILD_EXCEPTION.getMsg()).put("data",errorMap); } /** * 匹配不了的异常,全往这边抛出 * @param throwable * @return */ @ExceptionHandler(value = Throwable.class) public R handleException(Throwable throwable){ log.error("错误:",throwable); return R.error(BizCodeEnume.UNKNOW_EXCEPTION.getCode(),BizCodeEnume.UNKNOW_EXCEPTION.getMsg()); } }
b89ca672f5ea1e4f2b01b8a5ffd5b761a901ca50
dd2c80db5f0032e72dfa0b7cf60d02efe73ad8f8
/app/src/main/java/com/ty/winchat/ui/FaceDialog.java
d969c02ecfda75a27c3b8baf8ded51f7e4921248
[]
no_license
frankjunqi/WinChat1
f3ff164b5ab933396cb88e3d38f0e6563e00db4c
c8f859844f5b91ab36f021424c15c5d2ff1c4886
refs/heads/master
2021-01-11T03:02:21.826127
2016-10-14T01:54:39
2016-10-14T01:54:39
70,863,079
0
0
null
null
null
null
UTF-8
Java
false
false
9,093
java
package com.ty.winchat.ui; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ImageSpan; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import android.widget.ImageView; import android.widget.PopupWindow; import android.widget.SimpleAdapter; import com.ty.winchat.R; /** * 表情选择 * @author wj * @creation 2013-6-6 */ public class FaceDialog { private static PopupWindow popupWindow; public static interface FaceSelect{ /**选中表情后的回调动作*/ void onFaceSelect(SpannableString spannableString); } public static void showFaceDialog(Context context,View parent,int y,FaceSelect faceSelect){ if(popupWindow==null){ popupWindow=new PopupWindow(context); popupWindow.setWidth(LayoutParams.MATCH_PARENT); popupWindow.setHeight(LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.setBackgroundDrawable(new BitmapDrawable());// 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景 LayoutInflater inflater=(LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); View view=inflater.inflate(R.layout.face_dialog, null); int [] dotId={R.id.face_dialog_dot_1,R.id.face_dialog_dot_2,R.id.face_dialog_dot_3,R.id.face_dialog_dot_4,R.id.face_dialog_dot_5,R.id.face_dialog_dot_6}; ViewPager pager=(ViewPager) view.findViewById(R.id.face_dialog_viewpager); final ImageView[] dots=new ImageView[dotId.length]; for(int i=0;i<dotId.length;i++) dots[i]=(ImageView) view.findViewById(dotId[i]); dots[0].setBackgroundResource(R.drawable.dot_selected);//设置第一个原点选中 pager.setAdapter(new MyViewPagerAdapter(getViews(context, inflater,faceSelect))); pager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { for(int i=0;i<dots.length;i++){ if(i==arg0) dots[i].setImageResource(R.drawable.dot_selected); else dots[i].setImageResource(R.drawable.dot_unselected); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); popupWindow.setContentView(view); } popupWindow.showAtLocation(parent, Gravity.BOTTOM, 0, y); } public static void close(){ if(popupWindow!=null) popupWindow.dismiss(); } public final static int[] imageIds={ R.drawable.f000, R.drawable.f001, R.drawable.f002, R.drawable.f003, R.drawable.f004, R.drawable.f005, R.drawable.f006, R.drawable.f007, R.drawable.f008, R.drawable.f009, R.drawable.f010, R.drawable.f011, R.drawable.f012, R.drawable.f013, R.drawable.f014, R.drawable.f015, R.drawable.f016, R.drawable.f017, R.drawable.f018, R.drawable.f019, R.drawable.f020, R.drawable.f021, R.drawable.f022, R.drawable.f023, R.drawable.f024, R.drawable.f025, R.drawable.f026, R.drawable.f027, R.drawable.f028, R.drawable.f029, R.drawable.f030, R.drawable.f031, R.drawable.f032, R.drawable.f033, R.drawable.f034, R.drawable.f035, R.drawable.f036, R.drawable.f037, R.drawable.f038, R.drawable.f039, R.drawable.f040, R.drawable.f041, R.drawable.f042, R.drawable.f043, R.drawable.f044, R.drawable.f045, R.drawable.f046, R.drawable.f047, R.drawable.f048, R.drawable.f049, R.drawable.f050, R.drawable.f051, R.drawable.f052, R.drawable.f053, R.drawable.f054, R.drawable.f055, R.drawable.f056, R.drawable.f057, R.drawable.f058, R.drawable.f059, R.drawable.f060, R.drawable.f061, R.drawable.f062, R.drawable.f063, R.drawable.f064, R.drawable.f065, R.drawable.f066, R.drawable.f067, R.drawable.f068, R.drawable.f069, R.drawable.f070, R.drawable.f071, R.drawable.f072, R.drawable.f073, R.drawable.f074, R.drawable.f075, R.drawable.f076, R.drawable.f077, R.drawable.f078, R.drawable.f079, R.drawable.f080, R.drawable.f081, R.drawable.f082, R.drawable.f083, R.drawable.f084, R.drawable.f085, R.drawable.f086, R.drawable.f087, R.drawable.f088, R.drawable.f089, R.drawable.f090, R.drawable.f091, R.drawable.f092, R.drawable.f093, R.drawable.f094, R.drawable.f095, R.drawable.f096, R.drawable.f097, R.drawable.f098, R.drawable.f099, R.drawable.f100, R.drawable.f101, R.drawable.f102, R.drawable.f103, R.drawable.f104, R.drawable.f105, R.drawable.f106 }; private static List<View> getViews(final Context context,LayoutInflater inflater,final FaceSelect faceSelect){ List<View> views=new ArrayList<View>(); // imageIds = new int[107]; List<Map<String,Object>> listItems = new ArrayList<Map<String,Object>>(); //生成107个表情的id,封装 // for(int i = 0; i < imageIds.length; i++){ // try { // if(i<10){ // Field field = R.drawable.class.getDeclaredField("f00" + i); // int resourceId = Integer.parseInt(field.get(null).toString()); // imageIds[i] = resourceId; // }else if(i<100){ // Field field = R.drawable.class.getDeclaredField("f0" + i); // int resourceId = Integer.parseInt(field.get(null).toString()); // imageIds[i] = resourceId; // }else{ // Field field = R.drawable.class.getDeclaredField("f" + i); // int resourceId = Integer.parseInt(field.get(null).toString()); // imageIds[i] = resourceId; // } // }catch (Exception e) { // e.printStackTrace(); // } // Map<String,Object> listItem = new HashMap<String,Object>(); // listItem.put("image", imageIds[i]); // listItems.add(listItem); // } for(int i = 0; i < imageIds.length; i++){ Map<String,Object> listItem = new HashMap<String,Object>(); listItem.put("image", imageIds[i]); listItems.add(listItem); } for(int i=0;i<6;i++){ GridView view = new GridView(context); SimpleAdapter simpleAdapter; if(i!=5){ simpleAdapter= new SimpleAdapter(context, listItems.subList(i*21, (i+1)*21), R.layout.face_dialog_gridview_item, new String[]{"image"}, new int[]{R.id.image}); }else simpleAdapter= new SimpleAdapter(context, listItems.subList(i*21, listItems.size()), R.layout.face_dialog_gridview_item, new String[]{"image"}, new int[]{R.id.image}); view.setAdapter(simpleAdapter); view.setNumColumns(7); view.setHorizontalSpacing(1); view.setVerticalSpacing(1); view.setSelector(R.drawable.remove_yellow_bg); view.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); final int p=i; view.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Bitmap bitmap = null; int po=position+21*p; bitmap = BitmapFactory.decodeResource(context.getResources(), imageIds[po % imageIds.length]); ImageSpan imageSpan = new ImageSpan(context, bitmap); String str = null; if(po<10){ str = "f00"+po; }else if(po<100){ str = "f0"+po; }else{ str = "f"+po; } SpannableString spannableString = new SpannableString(str); spannableString.setSpan(imageSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); if(faceSelect!=null) faceSelect.onFaceSelect(spannableString); } }); views.add(view); } return views; } /** *释放资源,因为是static的,使用完毕后及时释放资源 */ public static void release(){ popupWindow=null; // imageIds=null; } } class MyViewPagerAdapter extends PagerAdapter{ private List<View> mListViews; public MyViewPagerAdapter(List<View> mListViews) { this.mListViews = mListViews; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(mListViews.get(position));//删除页卡 } @Override public Object instantiateItem(ViewGroup container, int position) { //这个方法用来实例化页卡 container.addView(mListViews.get(position), 0);//添加页卡 return mListViews.get(position); } @Override public int getCount() { return mListViews.size();//返回页卡的数量 } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0==arg1;//官方提示这样写 } }
2a8d8a752c5db0cc5b0f27df620abb098ba3e4ef
40d01267725d29696f2c47ceec42e574ac449124
/academiamvc/src/main/java/es/indra/academia/controller/alumnos/AlumnoForm.java
cacc1b260b0180e4609c9f7b80a77be8fc851539
[]
no_license
cursojava2019/Alumno-3-Antonio
50fdf4b772413ea871493237cfc1f4ce77a44ceb
1e2e878cc9bd76b5ce1c1069896d25e6dc83a11a
refs/heads/master
2020-04-14T18:19:40.493771
2019-02-20T18:29:31
2019-02-20T18:29:31
164,014,756
0
0
null
2019-01-10T15:11:51
2019-01-03T19:32:24
HTML
UTF-8
Java
false
false
5,024
java
package es.indra.academia.controller.alumnos; import java.util.ArrayList; import java.util.Date; import javax.servlet.http.HttpServletRequest; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.validation.constraints.PastOrPresent; import javax.validation.constraints.Positive; import javax.validation.constraints.Size; import es.indra.academia.model.entities.Alumno; public class AlumnoForm { @Positive private Long id; @NotNull @NotEmpty @Size(min = 3, max = 100) private String nombre; @NotNull @NotEmpty @Size(min = 3, max = 100) private String apellido1; private String apellido2; @Size(min = 9, max = 9) private String nif; private String telefono; @Email @NotEmpty private String correo; private Boolean repetidor; @PastOrPresent private Date fechaAlta; private Date fechaBaja; @Size(min = 0, max = 500) private String observaciones; public AlumnoForm() { super(); this.nif = ""; this.nombre = ""; this.apellido1 = ""; this.apellido2 = ""; this.telefono = ""; this.correo = ""; this.observaciones = ""; this.repetidor = false; } public AlumnoForm(Alumno a) { super(); this.id = a.getId(); this.nif = (a.getNif()); this.nombre = (a.getNombre()); this.apellido1 = (a.getApellido1()); this.apellido2 = (a.getApellido2()); this.telefono = (a.getTelefono()); this.correo = (a.getCorreo()); this.observaciones = (a.getObservaciones()); this.repetidor = (a.getRepetidor()); this.fechaAlta = (a.getFechaAlta()); this.fechaBaja = (a.getFechaBaja()); } public Alumno obtenerAlumno() { Alumno a = new Alumno(); a.setId(getId()); a.setNif(getNif()); a.setNombre(getNombre()); a.setApellido1(getApellido1()); a.setApellido2(getApellido2()); a.setTelefono(getTelefono()); a.setCorreo(getCorreo()); a.setObservaciones(getObservaciones()); a.setRepetidor(getRepetidor()); a.setFechaAlta(getFechaAlta()); a.setFechaBaja(getFechaBaja()); return a; } // public void validar(List<String> errores) { // if (nif == null || nif.equals("")) { // errores.add("El nif es obligatorio"); // // } // if (nif.length() != 9) { // errores.add("El formato de NIF no es correcto"); // // } // if (nombre=() == null || getNombre().equals("")) { // errores.add("El Nombre es obligatorio"); // // } // if (getApellido1() == null || getApellido1().equals("")) { // errores.add("El Primero Apellido es obligatorio"); // // } // // } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getNombre() { return this.nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellido1() { return this.apellido1; } public void setApellido1(String apellido1) { this.apellido1 = apellido1; } public String getApellido2() { return this.apellido2; } public void setApellido2(String apellido2) { this.apellido2 = apellido2; } public String getNif() { return this.nif; } public void setNif(String nif) { this.nif = nif; } public String getTelefono() { return this.telefono; } public void setTelefono(String telefono) { this.telefono = telefono; } public String getCorreo() { return this.correo; } public void setCorreo(String correo) { this.correo = correo; } public Boolean getRepetidor() { return this.repetidor; } public void setRepetidor(Boolean repetidor) { this.repetidor = repetidor; } public Date getFechaAlta() { return this.fechaAlta; } public void setFechaAlta(Date fechaAlta) { this.fechaAlta = fechaAlta; } public Date getFechaBaja() { return this.fechaBaja; } public void setFechaBaja(Date fechaBaja) { this.fechaBaja = fechaBaja; } public String getObservaciones() { return this.observaciones; } public void setObservaciones(String observaciones) { this.observaciones = observaciones; } public String getFechaAltaString() { if (this.fechaAlta != null) { return Long.toString(this.fechaAlta.getTime()); } else { return ""; } } public String getFechaBajaString() { if (this.fechaBaja != null) { return Long.toString(this.fechaBaja.getTime()); } else { return ""; } } public void setFechaAltaString(String fechaString) { Long timeStamp = Long.parseLong(fechaString); this.fechaAlta = (new Date(timeStamp)); } public void setFechaBajaString(String fechaString) { Long timeStamp = Long.parseLong(fechaString); this.fechaBaja = (new Date(timeStamp)); } public static AlumnoForm obtenerAlumnoForm(HttpServletRequest request) { // TODO Auto-generated method stub return null; } public void validar(ArrayList<String> errores) { // TODO Auto-generated method stub } }
5daad863d1c22326768c74dd267497fa9af22b2b
605292e47d04b2f661b82f2afb4bd7a5c9c9a554
/todo-db/src/main/java/App.java
d1bfb359f94bdca7fa2fe6f7a659fdecef64668e
[]
no_license
epicodus-lessons/week_3
89b2dbc8a1703288540cbfd4b9f10c57d2c0dba5
a95e6302504417eae9ee6352ac81659110081116
refs/heads/master
2021-01-16T21:37:11.058705
2015-08-25T22:52:45
2015-08-25T22:52:45
41,391,942
1
0
null
2015-08-25T22:52:10
2015-08-25T22:52:10
Java
UTF-8
Java
false
false
2,355
java
import java.util.HashMap; import java.util.List; import spark.ModelAndView; import spark.template.velocity.VelocityTemplateEngine; import static spark.Spark.*; public class App { public static void main(String[] args) { staticFileLocation("/public"); String layout = "templates/layout.vtl"; get("/", (request, response) -> { HashMap<String, Object> model = new HashMap<String, Object>(); model.put("template", "templates/tasks.vtl"); return new ModelAndView(model, layout); }, new VelocityTemplateEngine()); get("/tasks", (request,response) -> { HashMap<String, Object> model = new HashMap<String, Object>(); List<Task> tasks = Task.all(); model.put("tasks", tasks); model.put("template", "templates/tasks.vtl"); return new ModelAndView(model, layout); }, new VelocityTemplateEngine()); get("/tasks/:id", (request,response) -> { HashMap<String, Object> model = new HashMap<String, Object>(); int id = Integer.parseInt(request.params("id")); Task task = Task.find(id); model.put("task", task); model.put("template", "templates/task.vtl"); return new ModelAndView(model, layout); }, new VelocityTemplateEngine()); post("/tasks", (request, response) -> { HashMap<String, Object> model = new HashMap<String, Object>(); String description = request.queryParams("description"); // Task newTask = new Task(description); response.redirect("/tasks"); return null; }); put("/tasks/:id", (request, response) -> { HashMap<String, Object> model = new HashMap<String, Object>(); Task task = Task.find(Integer.parseInt(request.params("id"))); Category category = Category.find(task.getCategoryId()); String description = request.queryParams("description"); task.update("description"); model.put("template", "templates/task.vtl"); return new ModelAndView(model, layout); }, new VelocityTemplateEngine()); delete("/tasks/:id", (request, response) -> { HashMap<String, Object> model = new HashMap<String, Object>(); Task task = Task.find(Integer.parseInt(request.params("id"))); task.delete(); model.put("template", "templates/task.vtl"); return new ModelAndView(model, layout); }, new VelocityTemplateEngine()); } }
b28cc60cb26bb06ba1432948fa61a6fa8273b8d7
5dae210e37b0f0a21c97d8a821b0c6dfbd8293d5
/src/main/java/entity/Schedule.java
ff25f6034d8c17f3670e55722593af0f29cc3026
[]
no_license
LightingX/isdc-ssh
a82c4cbdfe5ef12e91e280b67b628082703f1346
52a0055a084823e9a9b72e5166438f4b3622dc26
refs/heads/master
2021-06-28T17:16:00.150474
2017-09-19T10:29:37
2017-09-19T10:29:37
98,416,318
1
0
null
2017-07-26T11:39:48
2017-07-26T11:39:48
null
UTF-8
Java
false
false
1,321
java
package entity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import javax.persistence.*; import java.util.List; @Entity @Table(name = "cms_schedule") @JsonInclude(JsonInclude.Include.NON_NULL) public class Schedule { @JsonIgnore @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @Column(name = "target") private String target; @OneToMany(cascade = CascadeType.ALL, mappedBy = "schedule", fetch = FetchType.LAZY) private List<Course> course; @JsonIgnore @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Semester.class) @JoinColumn(name = "semester_id") private Semester semester; public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public List<Course> getCourse() { return course; } public void setCourse(List<Course> course) { this.course = course; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Semester getSemester() { return semester; } public void setSemester(Semester semester) { this.semester = semester; } }
866a81433e04e8ad07bfa2fd1c777618b9c86ef9
2e6e3c943a882e23640168a43015ecdd71165ce7
/app/src/main/java/au/com/wallaceit/voicemail/notification/RemoveNotificationResult.java
a72d62ab736a8da73ab1efd4d0fb3cec76a801cd
[ "BSD-3-Clause", "Apache-2.0", "LicenseRef-scancode-philippe-de-muyter" ]
permissive
V18MKhalil32/visualvoicemail
6eff35d4b0ca087ccfc964b6fa6777f5687a77f9
696a710dc6f6b7be861c259ce9520e82c9333013
refs/heads/master
2020-05-20T12:21:06.430514
2019-03-09T08:33:52
2019-03-09T08:33:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,826
java
package au.com.wallaceit.voicemail.notification; class RemoveNotificationResult { private final NotificationHolder notificationHolder; private final int notificationId; private final boolean unknownNotification; private RemoveNotificationResult(NotificationHolder notificationHolder, int notificationId, boolean unknownNotification) { this.notificationHolder = notificationHolder; this.notificationId = notificationId; this.unknownNotification = unknownNotification; } public static RemoveNotificationResult createNotification(NotificationHolder notificationHolder) { return new RemoveNotificationResult(notificationHolder, notificationHolder.notificationId, false); } public static RemoveNotificationResult cancelNotification(int notificationId) { return new RemoveNotificationResult(null, notificationId, false); } public static RemoveNotificationResult unknownNotification() { return new RemoveNotificationResult(null, 0, true); } public boolean shouldCreateNotification() { return notificationHolder != null; } public int getNotificationId() { if (isUnknownNotification()) { throw new IllegalStateException("getNotificationId() can only be called when " + "isUnknownNotification() returns false"); } return notificationId; } public boolean isUnknownNotification() { return unknownNotification; } public NotificationHolder getNotificationHolder() { if (!shouldCreateNotification()) { throw new IllegalStateException("getNotificationHolder() can only be called when " + "shouldCreateNotification() returns true"); } return notificationHolder; } }
ee7aa37c21a449a91eca0c9ac91be08b2810af3c
638076449959ef6d9e11373a4dbce9be78f23b86
/src/com/example/micropowerapp/bean/Result.java
4b97b4f445fc2a8dd7b018eda650d3c8614c4abb
[]
no_license
NSGUF/MicroPowerApp
103bfe30364e48300071b4b54e779977b7d5d87c
b981d95e8bfead9ba5c4669b9580bb9953b99b8b
refs/heads/master
2021-01-19T23:25:24.295746
2017-11-12T05:58:42
2017-11-12T05:58:42
83,784,678
2
0
null
null
null
null
UTF-8
Java
false
false
310
java
package com.example.micropowerapp.bean; public class Result { private int code; private String text; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getText() { return text; } public void setText(String text) { this.text = text; } }
5a3814bedbd8b5b2bcd737e1efe5e0131f4a322e
b255ae97d6dbcdf4cf1ad949ce3b36407a450727
/sapient.spatial.kml-streams/src/main/java/org/geospatial/kml/Folder.java
a985197f7c60d75379c00b20ce4bad4109a0a8fa
[]
no_license
pajoma/sapient
bbb77f451280d196537cbdbb432cbc3a6106dfac
b633bd00e51be83d248e6b9d6b900b05d26383f6
refs/heads/master
2021-07-05T13:16:14.054915
2020-12-03T16:16:31
2020-12-03T16:16:31
219,184
0
0
null
2021-05-18T19:57:25
2009-06-05T07:41:04
HTML
UTF-8
Java
false
false
168
java
package org.geospatial.kml; import com.thoughtworks.xstream.annotations.XStreamAlias; @XStreamAlias("Folder") public class Folder extends KMLContainer { }
5390d9f531283c0483a73fae9f550913b24d4081
d853ce4b474e3adeea5045132f5f45325ce9c119
/src/main/java/com/hillel/fiters/DeleteFilmsFilter.java
1b48b86c760dd0fa5f96ed47fb9acdc52de049a8
[ "MIT" ]
permissive
ekzalt/201905-java_se_hillel
61d7b3a619e428c41937efa2d6ce4721097ea31c
bd5503042e972a87e86fdcae30bccc92762ab6cb
refs/heads/master
2022-07-19T08:55:50.928606
2020-10-13T18:06:44
2020-10-13T18:06:44
186,035,147
0
0
MIT
2022-06-21T01:41:16
2019-05-10T18:14:43
Java
UTF-8
Java
false
false
1,315
java
package com.hillel.fiters; import com.hillel.entity.Role; import com.hillel.entity.User; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; @WebFilter("/films/delete") public class DeleteFilmsFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.getMethod().equals("POST")) { HttpSession session = httpRequest.getSession(); User user = (User) session.getAttribute("user"); if (user != null && user.getRole() == Role.ADMIN) { chain.doFilter(httpRequest, httpResponse); } else { httpResponse.sendRedirect("/login"); } } else { chain.doFilter(httpRequest, httpResponse); } } @Override public void destroy() { } }
f8d3b515d50e12d4ce01234471df169864ff8dad
b81d1d58ef6dfce7c45ab751df1e5da65c0b44c5
/ClientServer/Serverwork/src/test/java/serverSide/Server_test.java
8bc1e235c7750a64f6493f7b0036b293a02c5a3b
[]
no_license
kursogr6/ServerClientApplication
7c92c158ffbf7b0a56391592cbcb6f0a2cf7564c
61c392d9bc563339d75f0ec172c0fff33b1bcd89
refs/heads/master
2020-09-05T23:48:43.296224
2015-03-11T11:04:21
2015-03-11T11:04:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,572
java
package serverSide; import org.junit.Assert; import org.junit.Test; import java.io.*; public class Server_test { ServerProgram serverProgram=new ServerProgram(); ServerWorkerThread serverWorkerThread = new ServerWorkerThread(null,null); @Test public void test1() { String arr[]=new String[]{"123","C:\\Downloads","new.txt"}; boolean result=serverProgram.validteAssignCommandLine(arr); boolean expected=true; Assert.assertEquals(expected,result); } @Test public void test2() { String arr[]=new String[]{}; boolean result=serverProgram.validteAssignCommandLine(arr); boolean expected=false; Assert.assertEquals(expected,result); } @Test public void test3() { try { InputStreamReader in=new InputStreamReader(new ByteArrayInputStream("new.txt".getBytes())); BufferedReader bf=new BufferedReader(in); String folder="C:\\Users\\mgiddaluri"; String fileName="new.txt"; String actual=serverWorkerThread.readValidateFileName(bf,folder); Assert.assertEquals(fileName, actual); } catch(Exception e) { System.out.println("Exception "+e); } } @Test public void test4() { try { InputStreamReader in=new InputStreamReader(new ByteArrayInputStream("hai".getBytes())); BufferedReader bf=new BufferedReader(in); String folder="C:\\Users\\mgiddaluri"; String fileName=null; String actual=serverWorkerThread.readValidateFileName(bf,folder); Assert.assertEquals(fileName, actual); } catch(Exception e) { System.out.println("Exception "+e); } } @Test public void test5() { try { DataOutputStream out=new DataOutputStream(new ByteArrayOutputStream(1024)); String filename="new.txt"; File f=new File("C:\\Users\\mgiddaluri\\"+filename); serverWorkerThread.fileExists(f,filename,out); } catch(Exception e) { System.out.println("Exception "+e); } } @Test public void test6() { try { DataOutputStream out=new DataOutputStream(new ByteArrayOutputStream(1024)); String filename="polycom.jpg"; String f="C:\\Users\\mgiddaluri\\"; serverWorkerThread.sendFileToClient(filename,out,f); } catch(Exception e) { System.out.println("Exception "+e); } } @Test public void test7() { try { DataOutputStream out=new DataOutputStream(new ByteArrayOutputStream(1024)); serverWorkerThread.sendErrorToClient(out); } catch(Exception e) { System.out.println("Exception "+e); } } }
f139a22aae23cc1458e21e64e2369cfa6f00f5c5
d7d2c4e1c7f05cdf8546b195fbfc5ae3f83be452
/src/main/java/com/reservation/config/SpringFoxConfig.java
4cdf72a7aa378fc49e241e2a7df3c645107fdca6
[]
no_license
duttam/reserve-table-service
ea7525c9270afdbcd8bd57c5b370c0fe71f68ee2
840d6d2d8805a6920f056f63036c101975b7035f
refs/heads/master
2020-04-19T22:09:16.864343
2019-01-31T04:57:23
2019-01-31T04:57:23
168,461,468
0
0
null
null
null
null
UTF-8
Java
false
false
2,344
java
package com.reservation.config; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpHeaders; import io.swagger.models.Contact; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiKey; import springfox.documentation.service.SecurityScheme; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger.web.ApiKeyVehicle; import springfox.documentation.swagger.web.SecurityConfiguration; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SpringFoxConfig { @Bean public Docket apiDocket() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .apis(RequestHandlerSelectors.basePackage("com.reservation")) .paths(PathSelectors.any()) .build() .apiInfo(getApiInfo()); // .securitySchemes(apiSecuritySchema()); } private ApiInfo getApiInfo() { return new ApiInfoBuilder() .title("Table reservation app") .description("Api Definition for reserve table application") .version("1.0") .licenseUrl("http://localhost:8080") .contact("P borah") .build(); } // @Bean // public SecurityConfiguration securityInfo() { // return new SecurityConfiguration(null, null, null, null, "", ApiKeyVehicle.HEADER, "Authorization", ""); // } // // private List<SecurityScheme> apiSecuritySchema() { // //return new ApiKey("Authorization", "Authorization", "header"); // List<SecurityScheme> schemeList = new ArrayList<>(); // schemeList.add(new ApiKey(HttpHeaders.AUTHORIZATION, "Authorization", "header")); // return schemeList; // } }
1adff4d7e2162948fa11b42d155879c0c0c6bf23
9ad9723ab7e2b62ab8622ddbbf418aa85e1e0621
/src/composition/BrakeWithoutAbs.java
77926a8520750030f69a76508ad7f74dcc39c232
[]
no_license
Vishal-Joshi/Patterns
72637691b4c93a9c4f1f5f07b50c609a610e978b
f32e310cef82bdacb3429f7631557360de68010b
refs/heads/master
2021-01-10T15:23:28.900133
2015-06-02T22:48:13
2015-06-02T22:48:13
36,766,249
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package composition; /** * Created by vishal on 22/5/15. */ public class BrakeWithoutAbs implements Stopable { @Override public void applyBrakes() { System.out.print("braked without abs"); } }
3d49397571b518d9c3741989de03c38db059fb37
e603f42fb0a1b8dade8c95643704b5d107429989
/src/main/java/br/com/treinelibras/controller/PontoDeArticulacaoController.java
b168effb90e01d730ce42ae6051103489b47da5c
[]
no_license
joaoteodoro/Treine-Libras
b2914e119d8fe780117260356a531f9331a648fa
82c34627c70e40adf56fcc7b3b7a9c4a320c832e
refs/heads/master
2021-10-27T20:19:40.067705
2021-10-08T16:18:08
2021-10-08T16:18:08
55,746,192
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,369
java
package br.com.treinelibras.controller; import java.util.Iterator; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUpload; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import br.com.treinelibras.dao.IArquivoDao; import br.com.treinelibras.dao.IPontoDeArticulacaoDao; import br.com.treinelibras.modelo.ConfiguracaoDeMao; import br.com.treinelibras.modelo.PontoDeArticulacao; import br.com.treinelibras.util.StringUtils; @Controller @Transactional public class PontoDeArticulacaoController { @Autowired IPontoDeArticulacaoDao pontoDeArticulacaoDao; @Autowired IArquivoDao arquivoDao; @RequestMapping("pontosDeArticulacao") public String pontosDeArticulacao(Model model){ List<PontoDeArticulacao> pontosDeArticulacao = pontoDeArticulacaoDao.lista(); for (PontoDeArticulacao pontoDeArticulacao : pontosDeArticulacao) { List listaMaos = pontoDeArticulacaoDao.buscaMaosAssociadas(pontoDeArticulacao.getIdPontoDeArticulacao()); if(listaMaos != null && !listaMaos.isEmpty()){ pontoDeArticulacao.setPodeExcluir(false); } } model.addAttribute("pontosDeArticulacao",pontosDeArticulacao); return "pontosdearticulacao"; } @RequestMapping("cadastrarPontoDeArticulacaoAntes") public String cadastrarPontoDeArticulacaoAntes(Model model, Long id){ //alteracao if(id != null){ PontoDeArticulacao pontoDeArticulacao = pontoDeArticulacaoDao.buscaPorId(id); model.addAttribute("pontoDeArticulacao",pontoDeArticulacao); model.addAttribute("logica",new String[] {"Alterar","a alteração"}); }else{ model.addAttribute("logica",new String[] {"Cadastrar","o cadastro"}); } return "cadastrar-pontodearticulacao"; } @RequestMapping("cadastrarPontoDeArticulacao") public String cadastrarPontoDeArticulacao(Model model, HttpServletRequest request){ PontoDeArticulacao pontoDeArticulacao = new PontoDeArticulacao(); boolean isMultiPart = FileUpload.isMultipartContent(request); if (isMultiPart) { FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); String formulario = ""; try { List items = upload.parseRequest(request); Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (!item.isFormField()) { String nomeArquivo = StringUtils.removerAcentos(pontoDeArticulacao.getNome()) + "-" + (pontoDeArticulacaoDao.buscaUltimoId() + 1L); if (item.getFieldName().equals("imagem")){ if(item.getString() != null && !"".equals(item.getString())) { // salvarFoto System.out.println("nomeArquivo: " + nomeArquivo); item.setFieldName(nomeArquivo); arquivoDao.inserirImagemDiretorio(item, "img"); pontoDeArticulacao.setImagem(item.getFieldName()); }else{ if(pontoDeArticulacao.getImagem() == null || "".equals(pontoDeArticulacao.getImagem())){ pontoDeArticulacao.setImagem("img1.jpg"); } } } }else{ if("id".equals(item.getFieldName()) && !"".equals(item.getString())){ pontoDeArticulacao = pontoDeArticulacaoDao.buscaPorId(Long.parseLong(item.getString())); }else if ("nome".equals(item.getFieldName())) { pontoDeArticulacao.setNome(item.getString()); } } } if(pontoDeArticulacao.getIdPontoDeArticulacao() != null){ pontoDeArticulacaoDao.altera(pontoDeArticulacao); }else{ pontoDeArticulacaoDao.adiciona(pontoDeArticulacao); } }catch (FileUploadException ex) { ex.printStackTrace(); } } return "redirect:pontosDeArticulacao"; } @RequestMapping("removerPontoDeArticulacao") public String removerPontoDeArticulacao(Long id){ pontoDeArticulacaoDao.remove(id); return "redirect:pontosDeArticulacao"; } }
030dddde2b77e8998476d08a3a27e7184087f87f
ddae1bbb966376a586160f6f828663f4137cfc9d
/app/src/main/java/com/example/developer/ServerSide/AppleProjectDB.java
12c7917b28d66b497d864a91fee126e46df2edc6
[]
no_license
DirtRoad69/DB-PROJECT
35c1e77f24c910cc990ce5138d8b9ad60b9ee577
84b7fd40a9ffa70ce8a5be487ec58545e61071ef
refs/heads/master
2020-03-30T23:33:07.506343
2018-10-05T10:00:54
2018-10-05T10:00:54
151,704,331
0
0
null
null
null
null
UTF-8
Java
false
false
8,630
java
package com.example.developer.ServerSide; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.example.developer.fullpatrol.MainActivity; import com.example.developer.objects.PatrolPoint; import com.example.developer.objects.MyPoint; import com.example.developer.objects.PatrolPointConfig; import com.example.developer.services.subroutines.Observer; import com.example.developer.services.subroutines.Subject; import com.google.firebase.firestore.GeoPoint; import java.util.ArrayList; import java.util.List; public class AppleProjectDB extends Subject { private SQLiteDatabase mDatabase; public static List<Observer> observers = new ArrayList<>(); public AppleProjectDB(SQLiteDatabase db){ super(db.toString()); this.mDatabase = db; } public void createTable(String sql){ mDatabase.execSQL(sql); } public void createSitesTable(){ String sqlSite = "CREATE TABLE IF NOT EXISTS Sites (\n" + "\tsiteId varchar(200) PRIMARY KEY,\n" + "\tsiteName varchar(200), \n" + "\tarea varchar(200),\n" + "\tstartEndPoint varchar(200), \n" + "\tstartPatrolTime varchar(200), \n" + "\tendPatrolTime varchar(200), \n" + "\tminTime int, \n" + "\tmaxTime int, \n" + "\tintervalTimer int, \n" + "\tstartDelay int, \n" + "\tsiteIdInt int \n" + ");"; mDatabase.execSQL(sqlSite); } private void createEventsTable(){ String sqlSite = "CREATE TABLE IF NOT EXISTS Events (\n" + "\tsiteId varchar(200) PRIMARY KEY,\n" + "\teventId int, \n" + "\tsiteIdInt int, \n" + "\tpointId varchar(200), \n" + "\tlocation varchar(200) , \n" + "\tmachineId varchar(200), \n" + "\tdescription varchar(200), \n" + "\ttimestamp DATETIME \n" + ");"; mDatabase.execSQL(sqlSite); /* event.put("siteId", MainActivity.siteId); event.put("eventId", eventID); event.put("pointId", pointId); event.put("machineId", MainActivity.deviceId); event.put("description", description); event.put("timeStamp", FieldValue.serverTimestamp()); event.put("location", "N-S"); */ } public void addEvent(ContentValues values){ createEventsTable(); mDatabase.insertWithOnConflict("Events", null, values, SQLiteDatabase.CONFLICT_REPLACE); //"INSERT INTO Events () VALUES ()" } @Override public void stateChanged(int state) { notifyAllObservers(); } @Override public void attach(Observer observer) { observers.add(observer); } @Override public void notifyAllObservers() { for (Observer observer : observers) { observer.update(MainActivity.LOCAL_DB); } } public void addValuesToSite(ContentValues sqlValues){ mDatabase.insertWithOnConflict("Sites",null, sqlValues, SQLiteDatabase.CONFLICT_REPLACE); } public void updateEachRow(String tableName, ContentValues values, String id){ mDatabase.update(tableName, values, "siteId = ?", new String[] {id}); if(tableName.contains("Sites")){ stateChanged(1); }else{ stateChanged(2); } } public void insertSiteValues(ContentValues values){ createSitesTable(); //clearTable("Sites"); // String sql = "INSERT INTO Sites (siteId, siteName, area, startEndPoint, startPatrolTime, endPatrolTime, minTime, maxTime, intervalTimer, startDelay)" // + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; mDatabase.insertWithOnConflict("Sites", null,values, SQLiteDatabase.CONFLICT_REPLACE); stateChanged(1); } public String[] getColumnNames(String tablename){ if(tablename.contains("Sites")){ String[] colNames = {"siteId", "siteName", "area", "startEndPoint", "startPatrolTime", "endPatrolTime", "minTime", "maxTime", "intervalTimer", "startDelay"}; return colNames; }else if(tablename.contains("PatrolPoints")) { String[] colNames = {"pointId", "siteId", "longi", "lati", "pointDescription"}; return colNames; } return new String[]{"none"}; } public void createPointsTable(){ String sqlPoint = "CREATE TABLE IF NOT EXISTS PatrolPoints (\n" + " pointId varchar (200) PRIMARY KEY, \n" + " siteId varchar(200),\n" + " pointDescription varchar(200),\n" + " longi float, \n" + " lati float, \n" + " siteIdInt int, \n" + " FOREIGN KEY (siteId) REFERENCES Sites(siteId)\n" + "); \n"; mDatabase.execSQL(sqlPoint); } private void clearTable(String tableName){ String sql = "DELETE FROM " +tableName; mDatabase.execSQL(sql); } public void updatePointsValues(List<PatrolPointConfig> values){ createPointsTable(); clearTable("PatrolPoints"); // String sqlPointData = "INSERT INTO PatrolPoints (pointId, siteId, longi, lati, pointDescription )\n" + // "VALUES (?, ?, ?, ?, ?)"; stateChanged(2); ContentValues sqlValues = new ContentValues(); List<MyPoint> pointsObjCollection = new ArrayList<>(); for(int i = 0; i < values.size(); i++){ String pointId = values.get(i).pointId; String longi = String.valueOf(values.get(i).location.getLongitude()); String lati = String.valueOf(values.get(i).location.getLatitude()); String pointDescription = values.get(i).pointDescription; sqlValues.put("pointId", pointId); sqlValues.put("siteId", MainActivity.siteId); sqlValues.put("longi", longi); sqlValues.put("lati", lati); sqlValues.put("pointDescription", pointDescription); //push to server GeoPoint location = new GeoPoint(Double.valueOf(lati),Double.valueOf(longi)); // point.put("location", location); // point.put("pointDescription", pointDescription); MyPoint pointConfig = new MyPoint(pointDescription, location, pointId); pointsObjCollection.add(pointConfig); mDatabase.insertWithOnConflict("PatrolPoints",null, sqlValues, SQLiteDatabase.CONFLICT_REPLACE); } FirebaseClientManager.getFirebaseClientManagerInstance().pushPointToServer(pointsObjCollection); } public void updatePointsValuesList(List<PatrolPoint> values){ createPointsTable(); clearTable("PatrolPoints"); // String sqlPointData = "INSERT INTO PatrolPoints (pointId, siteId, longi, lati, pointDescription )\n" + // "VALUES (?, ?, ?, ?, ?)"; stateChanged(2); ContentValues sqlValues = new ContentValues(); List<MyPoint> pointsObjCollection = new ArrayList<>(); Log.i("ZAQ@", "updatePointsValuesList: "+values); for(int i = 0; i < values.size(); i++){ String pointId = values.get(i).pointId; String longi = String.valueOf(values.get(i).location.getLongitude()); String lati = String.valueOf(values.get(i).location.getLatitude()); String pointDescription = values.get(i).pointDescription; sqlValues.put("pointId", pointId); sqlValues.put("siteId", MainActivity.siteId); sqlValues.put("longi", longi); sqlValues.put("lati", lati); sqlValues.put("pointDescription", pointDescription); //push to server GeoPoint location = new GeoPoint(Double.valueOf(lati),Double.valueOf(longi)); // point.put("location", location); // point.put("pointDescription", pointDescription); MyPoint pointConfig = new MyPoint(pointDescription, location, pointId); pointsObjCollection.add(pointConfig); mDatabase.insertWithOnConflict("PatrolPoints",null, sqlValues, SQLiteDatabase.CONFLICT_REPLACE); } } public Cursor getTableData(String tableName){ String select = "SELECT * FROM " + tableName; return mDatabase.rawQuery(select, null); } }
e1977c2d10e4ec2f1f937084796da07383fa8771
755f880331c011a2f3685146cae37d74cdf42f92
/core/applib/src/main/java/org/apache/isis/applib/types/TargetClassType.java
914e1400eb94a6311ca90a0e70d9f9222c854e0f
[ "Apache-2.0" ]
permissive
frankydee/isis
376ea525e9c86f389b6630689291c6b78e0d2e29
84a55cf0e152f304a807bfc125c44a529cab910c
refs/heads/master
2020-03-18T08:28:34.051161
2018-05-22T13:42:21
2018-05-22T13:42:21
108,916,012
0
0
Apache-2.0
2018-05-23T04:04:04
2017-10-30T22:36:59
Java
UTF-8
Java
false
false
1,433
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.isis.applib.types; import java.sql.Timestamp; import java.util.UUID; import org.apache.isis.applib.services.bookmark.Bookmark; import org.apache.isis.applib.services.command.Command; /** * A user-friendly name of a class, as per {@link Command#getTargetClass()}, {@link org.apache.isis.applib.services.audit.AuditerService#audit(UUID, int, String, Bookmark, String, String, String, String, String, Timestamp)}. */ public class TargetClassType { private TargetClassType() {} public static class Meta { public static final int MAX_LEN = 50; private Meta() {} } }
7287ebefdd195a63dfb54a0b49d6b95131fe4a50
2689b6a08ff35dd80ad0af01c74efe39a327f602
/polymorphism/human/Student.java
755c9b5915a0363b4f032fff8e807eaaf29f5898
[]
no_license
naokinabeyama/wcp
b34fd45ce830df911b262cb5278eedd1b9368868
3ef0edd4c0c526f871b2110a97dcf82ac91a6b41
refs/heads/master
2023-03-08T16:44:39.651115
2021-02-24T13:12:13
2021-02-24T13:12:13
329,563,208
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package polymorphism.human; public class Student extends Human { private int score; public Student(String name, int age, int score) { super(name, age); this.score = score; } @Override public String getProfile() { String profile = "年齢は" + super.age + "です。"; profile += "学生で、テストの点数は" + this.score + "点です。"; return profile; } }
9acceb427070bd640b6df5f511bee8cd483803c4
dd63350e0222cae002ec1d16f6554013be57d50c
/src/main/java/com/messiyang/fileutil/service/FileService.java
b6c597c633f1206df3fb8f04b883328bd9893efe
[]
no_license
MessiCY1994/fileUtil
5978d6465acf4f3478ac0a91585bec8fdb00a888
e62910b5b1ffd6784e0965afe3982124df78f29c
refs/heads/master
2020-05-18T11:50:17.528649
2019-05-01T08:52:03
2019-05-01T08:52:03
184,390,394
0
0
null
null
null
null
UTF-8
Java
false
false
2,135
java
package com.messiyang.fileutil.service; import com.messiyang.fileutil.model.FileInfo; import com.messiyang.fileutil.model.FileInfoVO; import java.util.List; public interface FileService { /** * 文件创建方式:用户上传 */ int CREATE_TYPE_UPLOAD = 0; /** * 文件创建方式:系统生成 */ int CREATE_TYPE_SYSTEM_GENERATE = 1; /** * 保存文件 * <p>文件存储后默认为未注册状态,可能会被垃圾清理任务清理,所以各业务调用此方法存储文件后,应及时对正式的文件进行注册。{@link #register(String, String)}</p> * @param fileData 文件数据 * @param filename 文件名,不含后缀 * @param fileExt 文件后缀 * @param createMemo 存储说明。一般可以存储用户的一些基本信息,如id+用户名+姓名等。 * @return 成功时,返回已存储文件的信息。 */ FileInfo save(byte[] fileData, String filename, String fileExt, String createMemo, int createType, String creatorId, String creatorName); /** * 注册文件 * @param id 要注册的文件的id * @param memo 注册说明。一般存储业务相关的一些信息,如业务模块名+业务对象id等。 * @return true 注册成功<br /> * false 注册失败 */ boolean register(String id, String memo); /** * 删除文件 * @param id 要删除的文件id * @return true 删除成功<br /> * false 删除失败 */ boolean delete(String id); /** * 获取文件信息 * @param id 要获取的文件的信息 * @return null:当文件不存在时<br /> */ FileInfo getFileInfo(String id); /** * 查找文件信息 * @param ids 以逗号分隔的文件id * @return */ List<FileInfo> selectFileInfo(String ids); /** * 读取文件 * @param id 要读取的文件的id * @return null:当文件不存在时<br /> * * FileInfoVO:对应文件的信息,包含文件数据 */ FileInfoVO readFile(String id); }
4b6c87cc8fc7fdc21ba9345e7cee7715871c651c
2b198adf21b9bf07f02758132aa499fed950929e
/Game/TTT.java
ccff6dc27827abef6382f55a581f3c0704b0b20f
[]
no_license
shweta4/codeBase
c7ca293b748fbdb1c869f558c96dad6fcedf5d7b
eb27159facf450c4bcf62460c9b212ec7181d552
refs/heads/master
2022-01-27T21:15:24.044978
2019-08-08T19:57:49
2019-08-08T19:57:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,787
java
package Game; import java.awt.Button; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class TTT extends JFrame implements ActionListener { public final int BOARD_SIZE = 3; private final String CROSS_TEXT = "X"; private final String ZERO_TEXT = "0"; private boolean crossTurn; private final int X_WINS=0; private final int ZERO_WINS=1; private final int TIE=2; private final int INCOMPLETE=3; private JButton[][] board = new JButton[BOARD_SIZE][BOARD_SIZE]; public TTT(){ super("Tic-Tac-Toe"); super.setVisible(true); super.setSize(600, 600); super.setResizable(false); GridLayout layout = new GridLayout(BOARD_SIZE, BOARD_SIZE); super.setLayout(layout); for(int row=0; row<BOARD_SIZE; row++){ for(int col=0; col<BOARD_SIZE; col++){ JButton button = new JButton(); button.setFont(new Font("Times New Roman", 1, 225)); super.add(button); this.board[row][col] = button; button.addActionListener(this); } } } public void startGame(){ crossTurn = true; } @Override public void actionPerformed(ActionEvent E) { JButton clickedButton = (JButton) E.getSource(); if(clickedButton.getText().equals("")){ makeMove(clickedButton); int gameStatus = getGameStatus(); if(gameStatus == INCOMPLETE){ crossTurn = !crossTurn; super.setTitle(crossTurn ? "X's turn" : "0's turn"); } else{ declareWinner(gameStatus); dispose(); } } else{ JOptionPane.showMessageDialog(null, "Invalid Move"); } } private void makeMove(JButton button){ String message = crossTurn ? CROSS_TEXT : ZERO_TEXT; button.setText(message); } private int getGameStatus(){ int row = 0, col = 0; String text1="",text2=""; //Row for(row=0;row<BOARD_SIZE;row++){ for(col=0;col<BOARD_SIZE-1;col++){ text1 = this.board[row][col].getText(); text2 = this.board[row][col+1].getText(); if(!text1.equals(text2) || text1.equals("")){ break; } } if(col == BOARD_SIZE-1){ if(text1.equals(CROSS_TEXT)){ return X_WINS; } return ZERO_WINS; } } row =0; col=0; //Col for(col=0;col<BOARD_SIZE;col++){ for(row=0;row<BOARD_SIZE-1;row++){ text1 = this.board[row][col].getText(); text2 = this.board[row + 1][col].getText(); if(!text1.equals(text2) || text1.equals("")){ break; } } if(row == BOARD_SIZE-1){ if(text1.equals(CROSS_TEXT)){ return X_WINS; } return ZERO_WINS; } } row=0; col=0; //Left-Diagonal for(row=0;row<BOARD_SIZE-1;row++,col++){ text1 = this.board[row][col].getText(); text2 = this.board[row+1][col+1].getText(); if(!text1.equals(text2) || text1.equals("")){ break; } } if(row == BOARD_SIZE-1){ if(text1.equals(CROSS_TEXT)){ return X_WINS; } return ZERO_WINS; } row=BOARD_SIZE-1; col=0; //Right-Diagonal for(col=0;col<BOARD_SIZE-1;col++,row--){ text1 = this.board[row][col].getText(); text2 = this.board[row-1][col+1].getText(); if(!text1.equals(text2) || text1.equals("")){ break; } } if(col == BOARD_SIZE-1){ if(text1.equals(CROSS_TEXT)){ return X_WINS; } return ZERO_WINS; } row=0; col=0; //Incomplete for(row=0;row<BOARD_SIZE;row++){ for(col=0;col<BOARD_SIZE;col++){ text1 = this.board[row][col].getText(); if(text1.equals("")){ return INCOMPLETE; } } } return TIE; } private void declareWinner(int status){ if(status == 2){ JOptionPane.showMessageDialog(null, "TIE"); return; } String message = (status==0) ? "X Wins" : "Zero Wins"; JOptionPane.showMessageDialog(null, message); } }
3831b47994ecbf3f7174f00b0587e6d9905081cf
bfb73151566b2337662f1503e9b2b10817b419b5
/java-homework-3-up/src/Task1/Employee.java
0b24e96fc48a3cfae0ba1f148047846cf938225d
[]
no_license
virak0001/up-java
14893f3db95f7c6fe1ffd7aa5160c0747ab6f7c5
5d1ec459f7f694fe8a6174257f1d012118efa4cc
refs/heads/master
2023-07-06T08:54:40.694602
2021-06-27T04:41:27
2021-06-27T04:41:27
380,651,109
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package Task1; public class Employee { private String name; private int numberOfEmployee; private SalariedEmployee salariedEmployee; public Employee(String name, SalariedEmployee salariedEmployee) { this.setName(name); this.setSalariedEmployee(salariedEmployee); } public Employee(int numberOfEmployee) { this.setNumberOfEmployee(numberOfEmployee); } @Override public String toString() { return "Employee [name=" + name + ", numberOfEmployee=" + numberOfEmployee + ", salariedEmployee=" + salariedEmployee + "]"; } public String getName() { return name; } public void setName(String name) { this.name = name; } public SalariedEmployee getSalariedEmployee() { return salariedEmployee; } public void setSalariedEmployee(SalariedEmployee salariedEmployee) { this.salariedEmployee = salariedEmployee; } public int getNumberOfEmployee() { return numberOfEmployee; } public void setNumberOfEmployee(int numberOfEmployee) { if(numberOfEmployee <= 0) { System.out.println("Number should be positive"); } else { this.numberOfEmployee = numberOfEmployee; } } }
af0b990910bd87028aa7286c548c09a230ca32dd
edebf28e4152553ff67a7cfacb73ce8a6e52a63f
/Final_Project/src/main/java/com/ob/biz/service/BoardService.java
40a099f04ac5c2840df6191d23565ba2b93f5b15
[]
no_license
OBCINEMA/FINAL_OB_CINEMA
6afec8aa53efac7c46eedb738a20cb1c994dd215
6afcb2cef3df500810bd0e7a041b110f829fc5e4
refs/heads/master
2020-04-17T07:03:01.698480
2019-01-24T07:32:51
2019-01-24T07:32:51
166,351,361
0
0
null
null
null
null
UTF-8
Java
false
false
984
java
package com.ob.biz.service; import java.util.List; import java.util.Map; import com.ob.biz.vo.BoardVO; import com.ob.biz.vo.PageVO; public interface BoardService { // CRUD 기능 구현 메소드 정의 // 글 입력 void insertBoard(BoardVO vo); // 글 수정 void updateBoard(BoardVO vo); // 글 삭제 void deleteBoard(BoardVO vo); // 글 상세 조회 BoardVO getBoard(BoardVO vo); // 글 목록 전체 조회(게시판별) List<BoardVO> getBoardList(BoardVO vo); // 공지사항 게시물 입력 void insertNotice(BoardVO vo); // 공지사항 게시물 수정 void updateNotice(BoardVO vo); // 공지사항 게시물 삭제 void deleteNotice(BoardVO vo); // 공지사항 게시물 전체리스트 조회 List<BoardVO> getNoticeList(Map<String, Integer> map); // 공지사항 게시물 상세 조회 BoardVO getNotice(BoardVO vo); // 공지사항 조회수 void noticeViewCnt(BoardVO vo); // 공지사항 총 페이지 수 int totalCnt(); }
[ "hanbit@hb5017" ]
hanbit@hb5017
fe228e365f37e46089776335c1f3e3e0586191af
911b98cc85318fa501122fe870583a8043dce1a3
/app/src/main/java/com/example/notepad/db/NotesDB.java
58b84fe1c64394cd99e31bc2985945c8c146b6fd
[]
no_license
ansh422/Notepad
56c59a2ac3cd3fef8cf85518c3ce0814782b4b78
10591d6b27ba1a41eb0db146c663b3d10a4e9441
refs/heads/master
2023-08-21T20:24:50.633697
2021-10-26T06:10:48
2021-10-26T06:10:48
262,280,409
1
0
null
null
null
null
UTF-8
Java
false
false
761
java
package com.example.notepad.db; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import android.content.Context; import com.example.notepad.model.Note; @Database(entities = Note.class, version = 1) public abstract class NotesDB extends RoomDatabase { public abstract NotesDao notesDao(); public static final String DATABASE_NAME="notesDB"; private static NotesDB instance; public static NotesDB getInstance(Context context){ if(instance==null) instance= Room.databaseBuilder(context,NotesDB.class, DATABASE_NAME) .allowMainThreadQueries() .build(); return instance; } }
5699c86d3932f7c8dcb064d625e74eff5ded8762
dccaf61ebcb7f9d85f4ec127439768b9809419ec
/common/src/main/java/x/common/component/network/HttpStatus.java
814559c76e05eb8a5eb97caf775f8d081654115f
[]
no_license
ccolorcat/XArchitecture
9e9f7a4c8dcae5a4f1ae1b402292b5afb163facf
d827e96938454140b88351a9a23d463cb225b4be
refs/heads/master
2023-03-18T15:09:36.846331
2021-03-08T03:52:58
2021-03-08T03:52:58
344,747,305
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package x.common.component.network; /** * Author: cxx * Date: 2020-07-21 * GitHub: https://github.com/ccolorcat */ public final class HttpStatus { public static final int STATUS_UNKNOWN = -70; public static final String MSG_UNKNOWN = "unknown"; public static final int STATUS_EXECUTED = -80; public static final String MSG_EXECUTED = "already executed"; public static final int STATUS_CANCELED = -90; public static final String MSG_CANCELED = "canceled"; public static final int STATUS_CONNECTION_ERROR = -100; public static final String MSG_CONNECTION_ERROR = "connection error"; private HttpStatus() { throw new AssertionError("no instance"); } }
27e805e4af484523f48f7a504c517ac0bf065b2a
9090263d9da6d72c669899112a2cac57838e4f18
/rainbow/rainbow-core/src/main/java/com/eisoo/rainbow/query/SourceQueryHolder.java
e3972b0f340fc04fea8d13b40601a43c31c09de7
[]
no_license
baozengkai/xiaobao-graph
96657fc81df0b679e0cb2c735d297791a57958a8
5be9993d67e49f4bede979be201e8ad23dcc49f3
refs/heads/master
2020-03-21T22:12:21.282943
2018-07-02T05:33:05
2018-07-02T05:33:05
139,111,291
0
1
null
null
null
null
UTF-8
Java
false
false
2,205
java
package com.eisoo.rainbow.query; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.util.AndP; import java.util.*; /** * @author [email protected] * @version 1.0 , Copyright (c) 2014 AnyRobot, EISOO * @date 2018.02.28 */ public final class SourceQueryHolder { /** * 定义两种类型的枚举变量 */ public enum TYPE { And, Or } private final TYPE type; private final Map<String, SourceQueryClause> queryClauses = new HashMap<>(); private final Map<String, SourceQueryHolder> children = new HashMap<>(); public SourceQueryHolder(final SourceQueryHolder.TYPE type) { this.type = type; } public SourceQueryHolder.TYPE getType() { return this.type; } public Collection<SourceQueryClause> getQueryClauses() { return Collections.unmodifiableCollection(this.queryClauses.values()); } public void addQueryClause(final SourceQueryClause clause) { if (clause.getPredicate() instanceof AndP) { for (final P<?> predicate : ((AndP<?>) clause.getPredicate()).getPredicates()) { this.addQueryClause(new SourceQueryClause(clause.getType(), clause.getField(), predicate)); } } else { this.queryClauses.put(clause.toString(), clause); } } public Collection<SourceQueryHolder> getChildren() { return Collections.unmodifiableCollection(this.children.values()); } public void addChild(final SourceQueryHolder holder) { this.children.put(holder.toString(), holder); } @Override public int hashCode() { return (this.type.hashCode() ^ this.queryClauses.hashCode() ^ this.children.hashCode()); } @Override public String toString() { List<String> strings = new ArrayList<String>(); strings.add(this.type.name()); if (!this.queryClauses.isEmpty()) strings.add(this.queryClauses.values().toString()); if (!this.children.isEmpty()) strings.add(this.children.values().toString()); return this.getClass().getSimpleName() + "(" + String.join(", ", strings) + ")"; } }
66b707a7e42d3fa403e1a2dcf003da96ab2cedbe
ca35d26dfdc17be9264a8f0bf994271b8c473681
/account-book-backend/account-book-pojo/src/main/java/com/libi/accountbook/exception/AttrNotLoginUserException.java
30909fc481f977315a0405a2ee46634ea178b1a2
[]
no_license
libi1206/account_book
a3532631d0dad3e92534968c975eeeff3be07149
c0b61536019a184ec142836c741ec13c5bf27ce6
refs/heads/master
2022-06-23T05:44:46.601175
2019-04-17T11:27:02
2019-04-17T11:27:02
192,646,036
0
0
null
2022-06-21T01:18:36
2019-06-19T02:44:06
Java
UTF-8
Java
false
false
269
java
package com.libi.accountbook.exception; import com.libi.accountbook.exception.base.BaseException; /** * @author libi * 若修改的字段不是当前用户的,就会抛出这个异常 */ public class AttrNotLoginUserException extends BaseException { }
4b77cd09aef8071cffff2e78284b2824e1eff645
cb139127f3e1d68ef994039c398868c74cf7d1d5
/src/main/java/com/omicron/sodevrsapp/ui/controller/UserController.java
b427bcdcca6254449ff0c0e7acf71c7ace2af42a
[]
no_license
omicrondev/es-dev-rs-api
47b8f6bbb7d64041e9ac31e5ff98d41a51c688e9
9a685eab4ab7ca8eb878c6f6f92041d645f03467
refs/heads/master
2023-03-09T05:33:43.793596
2019-07-28T14:54:01
2019-07-28T14:54:01
199,299,841
0
0
null
null
null
null
UTF-8
Java
false
false
3,818
java
package com.omicron.sodevrsapp.ui.controller; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import com.omicron.sodevrsapp.service.UserService; import com.omicron.sodevrsapp.shared.dto.ProUserDto; import com.omicron.sodevrsapp.shared.dto.UserDto; import com.omicron.sodevrsapp.ui.model.request.ProUserRequestModel; import com.omicron.sodevrsapp.ui.model.request.UserRequestModel; import com.omicron.sodevrsapp.ui.model.response.ProUserResponseModel; import com.omicron.sodevrsapp.ui.model.response.UserResponseModel; @RestController @RequestMapping("users") public class UserController { @Autowired UserService userService; @GetMapping( path = "/{userId}", produces = {MediaType.APPLICATION_XML_VALUE,MediaType.APPLICATION_JSON_VALUE} ) public UserResponseModel getUser(@PathVariable String userId) { UserDto userDto = userService.getUserByUserId(userId); UserResponseModel userResponseModel = (userDto instanceof ProUserDto)? new ProUserResponseModel():new UserResponseModel(); BeanUtils.copyProperties(userDto,userResponseModel); return userResponseModel; } @PostMapping( path = "/create", consumes = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE} ) public UserResponseModel createUser(@RequestBody UserRequestModel userRequestModel) { UserDto userDto = new UserDto(); BeanUtils.copyProperties(userRequestModel, userDto); UserDto createdUser = userService.createUser(userDto); UserResponseModel userResponseModel = new UserResponseModel(); BeanUtils.copyProperties(createdUser, userResponseModel); return userResponseModel; } @PostMapping( path = "/create/pro", consumes = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE} ) public ProUserResponseModel createProUser(@RequestBody ProUserRequestModel proUserRequestModel) { ProUserDto proUserDto = new ProUserDto(); BeanUtils.copyProperties(proUserRequestModel, proUserDto); ProUserDto createdUser = userService.createUser(proUserDto); ProUserResponseModel proUserResponseModel = new ProUserResponseModel(); BeanUtils.copyProperties(createdUser, proUserResponseModel); return proUserResponseModel; } @PutMapping( path = "/update/{userId}", consumes = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE} ) public UserResponseModel updateUser(@PathVariable String userId,@RequestBody UserRequestModel userRequestModel){ UserDto userDto = new UserDto(); BeanUtils.copyProperties(userRequestModel, userDto); UserDto updatedUser = userService.updateUser(userId,userDto); UserResponseModel userResponseModel = new UserResponseModel(); BeanUtils.copyProperties(updatedUser, userResponseModel); return userResponseModel; } @PutMapping( path = "/update/pro/{userId}", consumes = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE} ) public ProUserResponseModel updateProUser(@PathVariable String userId,@RequestBody ProUserRequestModel proUserRequestModel){ ProUserDto proUserDto = new ProUserDto(); BeanUtils.copyProperties(proUserRequestModel, proUserDto); ProUserDto updatedUser = userService.updateUser(userId,proUserDto); ProUserResponseModel proUserResponseModel = new ProUserResponseModel(); BeanUtils.copyProperties(updatedUser, proUserResponseModel); return proUserResponseModel; } }
d3c1c33cca483df72e9998bad4eda3b872b391a1
21720e3f849baba450140dd6f9fff9331e301040
/Obligatorio/src/vista/InicioJugador.java
126f501e38b72ef4ad32285ada68a1a77b05136d
[]
no_license
polachek/Poker-Java
73d61255835ad99b5d9399a0ebab172a39c922c1
cd7d046737827becc12502b4c13e961e03ee7303
refs/heads/master
2020-03-27T06:45:16.335470
2018-08-25T22:19:32
2018-08-25T22:19:32
146,133,307
0
0
null
null
null
null
UTF-8
Java
false
false
3,377
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 vista; import controlador.ControladorInicioJugador; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JOptionPane; import modelo.AplicationException; import modelo.Participante; /** * * @author leo */ public class InicioJugador extends javax.swing.JFrame implements IVistaInicioJugador{ private ControladorInicioJugador controlador; //private Participante participante; public InicioJugador(Participante p) throws AplicationException { initComponents(); //participante = p; controlador = new ControladorInicioJugador(this, p); //controlador.revisaSiInicia(); // Cuando Participante abandona espera addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { abandonarEspera(); } }); } /** * 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() { jLabel1 = new javax.swing.JLabel(); lblFaltan = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); getContentPane().setLayout(null); jLabel1.setText("Esperando inicio del juego"); getContentPane().add(jLabel1); jLabel1.setBounds(14, 21, 205, 20); getContentPane().add(lblFaltan); lblFaltan.setBounds(32, 53, 110, 16); setBounds(0, 0, 416, 339); }// </editor-fold>//GEN-END:initComponents @Override public void mostrarSaludo(String nombreCompletoDelJugador) { this.setTitle("Bienvenido/a " + nombreCompletoDelJugador); } @Override public void actualizarCuantosFaltan(int cuantosJugadoresFaltan) { this.lblFaltan.setText("Faltan " + String.valueOf(cuantosJugadoresFaltan) + " jugadores."); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel lblFaltan; // End of variables declaration//GEN-END:variables @Override public void iniciarJuego(Participante participante) { //dispose(); VistaJuego vj = new VistaJuego(participante); vj.setVisible(true); dispose(); } @Override public void mostrarMensajeError(String mensaje) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void abandonarEspera() { int confirmed = JOptionPane.showConfirmDialog(this, "Estas seguro que deseas abandonar la espera?", "Abandonar", JOptionPane.YES_NO_OPTION); if (confirmed == JOptionPane.YES_OPTION) { controlador.abandonarEspera(); dispose(); } } }
0835a9e678cb86278e6dba769951bae3ec5c8816
4fa6bf128efda662e894d89a0f441ea615089941
/spring-core/src/main/java/org/springframework/core/task/SyncTaskExecutor.java
50ab985893a4f461a8f561cc017e376abd9230c5
[ "Apache-2.0" ]
permissive
Donaldhan/spring-framework-4.3.x
ac9d9b7258779c409dfb6181bb1effbbba1a2b42
e550e78198916426acba43c3555518bf349c7e49
refs/heads/master
2023-02-20T18:43:19.308759
2021-01-25T06:54:44
2021-01-25T06:54:44
272,670,929
0
0
null
null
null
null
UTF-8
Java
false
false
2,195
java
/* * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.core.task; import java.io.Serializable; import org.springframework.util.Assert; /** * {@link TaskExecutor} implementation that executes each task <i>synchronously</i> * in the calling thread. * 任务执行器在调用线程中同步执行任务的实现。 * <p>Mainly intended for testing scenarios. * 主要用于测试场景。 * <p>Execution in the calling thread does have the advantage of participating * in it's thread context, for example the thread context class loader or the * thread's current transaction association. That said, in many cases, * asynchronous execution will be preferable: choose an asynchronous * {@code TaskExecutor} instead for such scenarios. * 在调用线程中执行的好处,在于可以参与所属线程的上下文,比如线程上下文类加载器,或者 * 线程当前关联事务。也就是说,在大多数场景中,异步执行会更好:这种情况下,选择异步任务执行器。 * @author Juergen Hoeller * @since 2.0 * @see SimpleAsyncTaskExecutor */ @SuppressWarnings("serial") public class SyncTaskExecutor implements TaskExecutor, Serializable { /** * Executes the given {@code task} synchronously, through direct * invocation of it's {@link Runnable#run() run()} method. * 通知直接调用线程的run方法,同步执行给定的任务。 * @throws IllegalArgumentException if the given {@code task} is {@code null} */ @Override public void execute(Runnable task) { Assert.notNull(task, "Runnable must not be null"); task.run(); } }
b07834a3a0f1e8e57bad517130260198b9c5c639
d2fc5a177cea1d94a86949dfb599723f610a25fc
/oop-module/src/main/java/javase02/t02/supplies/Pencil.java
c5561a6704217ad701020a39a801c487783c4fdf
[]
no_license
daddyingrave/java-fundamentals
615b50645d5cecc81ee056ee04e8b91061e59c86
40d6734081e8a01e1081ecd4baeac627d39b4c99
refs/heads/master
2022-07-29T01:07:37.525465
2017-07-27T22:11:10
2017-07-27T22:11:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package javase02.t02.supplies; import javase02.t03.StationeryProduct; /** * Created by daddyingrave on 26/06/2017. */ public class Pencil implements StationeryProduct { private int price; private String name; public Pencil(int price) { this.price = price; } @Override public int getPrice() { return price; } @Override public String getName() { return name; } public void setName(String name) { this.name = name; } }
da8c663abcb0c156ddbc6ba7a23c67fabd2c06f7
8ce046fce4a7afbd8203afa8a0f9656093a1c8a0
/workspace/images/src/images/LazyImg.java
4544df38d749ae2c8592377ade014a4bf5692d75
[]
no_license
jpsember/spredit
c060d574edeace7f7452da59b818b9414c5c2ca7
3e69c3bd08e48d128ff1e465f4bdb817f4854248
refs/heads/master
2021-03-12T20:17:52.278483
2015-02-08T20:15:41
2015-02-08T20:15:41
28,245,629
0
0
null
null
null
null
UTF-8
Java
false
false
928
java
package images; import java.awt.image.*; import java.io.*; public class LazyImg { public static void setArtPath(File dir) { artDir = dir; } private static File artDir; public LazyImg(String path) { this.path = path; } public BufferedImage get() { if (img == null) { File f = null; try { if (artDir != null) f = new File(artDir, path); else f = new File(path); img = ImgUtil.read(f); } catch (IOException e) { throw new RuntimeException("Can't read "+f+": "+e); } } return img; } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Img: "); sb.append(path); get(); sb.append(" ("); sb.append(img.getWidth()); sb.append('x'); sb.append(img.getHeight()); sb.append(")"); return sb.toString(); } private String path; private BufferedImage img; }
1a68e41c91262c086017a9aa5bc1146d5035b443
db6d2bf1a86d3eaa67797ea72000cacdfbaf264c
/Tema4/Ariketa48/src/ariketa48/Ariketa48.java
b602b1436a4ea502489ac7cb5f2ad9a902e9ac1a
[]
no_license
TamaraAlonso/Programacion
234de3b26391875e942934476e9aec650f4284f0
e35cf8405a4797f1751e1bfa4a5f4e7f24823feb
refs/heads/master
2020-04-02T06:02:54.926006
2019-03-10T19:57:07
2019-03-10T19:57:07
154,125,228
0
0
null
null
null
null
UTF-8
Java
false
false
2,249
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 ariketa48; import javax.swing.JOptionPane; /** * * @author 1gdaw04 */ public class Ariketa48 { /** * @param args the command line arguments * @throws java.lang.Exception */ public static void main(String[] args) throws Exception { /* Crear una matriz de dos dimensiones de 10 x 10. Pediremos que introduzcan el n´umero de fila y el de columna que vamos a utilizar y el valor que quieren almacenar. Una vez introducidos los datos. Se escribir´a la suma correspondientes a las filas de la matriz. */ int [][] arrayBidimensional = new int [10][10]; //Para llenar el primer array: arrayBidimensional [0][0]=0; arrayBidimensional [0][1]=0; arrayBidimensional [0][2]=0; arrayBidimensional [0][3]=0; arrayBidimensional [0][4]=0; arrayBidimensional [0][5]=0; arrayBidimensional [0][6]=0; arrayBidimensional [0][7]=0; arrayBidimensional [0][8]=0; arrayBidimensional [0][9]=0; //Para llenar el segundo array: arrayBidimensional [1][0]=0; arrayBidimensional [1][1]=0; arrayBidimensional [1][2]=0; arrayBidimensional [1][3]=0; arrayBidimensional [1][4]=0; arrayBidimensional [1][5]=0; arrayBidimensional [1][6]=0; arrayBidimensional [1][7]=0; arrayBidimensional [1][8]=0; arrayBidimensional [1][9]=0; int fila = Integer.parseInt(JOptionPane.showInputDialog("Introduce el número de la fila")); int columna = Integer.parseInt("Introduce el número de la columna"); int dato = Integer.parseInt("Introduce el dato que deseas almacenar"); for (fila =0; fila <10; fila++){ for (columna=0; columna <10;columna++); int sumaTotal = fila + columna; JOptionPane.showMessageDialog(null, "Los datos sumados son: " + sumaTotal); } } }
d651ed10b14fa07bec2047e55e6a6cce77b2d5e0
3247a1027c18672726d08b4e9870aeae4569adda
/springIOC/src/main/java/com/example/demo/core/bean/impl/Bclass.java
45ee12398b28157c2770b6f95bf5a2512898b535
[]
no_license
houyee/spring-learn
95f39e0cd852fd27679d253f4eecbe626f10b546
4e9ad03a4668a2f5190198b2b769587180927687
refs/heads/master
2023-07-24T07:42:10.205338
2019-07-26T06:30:24
2019-07-26T06:30:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
297
java
package com.example.demo.core.bean.impl; import org.springframework.stereotype.Component; import com.example.demo.core.bean.BClass; @Component public class Bclass implements BClass{ @Override public void listen() { // TODO Auto-generated method stub System.out.println("try listen"); } }
9038339f00d1fe83cd42ecef2a8a24f9842ae979
9a93fe88306aa74aeb203b391e96c15637d03f5d
/integ-web/src/main/java/cl/liberty/prodp/integ/web/utils/StartingLog4j.java
142306c5f5ed3049de3864d585ad2182800dc732
[]
no_license
jlavilave/pentasoap
feb041a10948d28a808c63aa60db81a3f7a989af
cabc9dfae07f0bc80f4ac06b8887c356e31780cf
refs/heads/master
2021-07-16T20:14:07.465439
2017-10-25T20:39:01
2017-10-25T20:39:01
108,305,002
0
0
null
null
null
null
UTF-8
Java
false
false
1,630
java
package cl.liberty.prodp.integ.web.utils; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import javax.servlet.http.HttpServlet; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; public class StartingLog4j extends HttpServlet{ private static final long serialVersionUID = -3278729674357132836L; private static final Logger LOGGER = Logger.getLogger(StartingLog4j.class); private static final String LOG4J_NAME_FILE = "integ-web-log4j.properties"; private static final String PATH_USER_WAS = "user.install.root"; private static final String PATH_PROP = "properties"; public StartingLog4j() { super(); } @Override public void init() { Properties configProps = new Properties(); try { configProps.clear(); String path = System.getProperty(PATH_USER_WAS); String ultimoCaracter = path.substring(path.length()-1); if (!ultimoCaracter.equals(File.separator)){ path = path.concat(File.separator); } path = path.concat(PATH_PROP).concat(File.separator); String file = path.concat(LOG4J_NAME_FILE); FileInputStream fis = new FileInputStream(new File(file)); configProps.load(fis); PropertyConfigurator.configure(configProps); } catch (Exception e) { LOGGER.error(StartingLog4j.class.getSimpleName() + " : " + e, e); } } public static Logger getLogger() { return LOGGER; } }
d6942f66a892f1fd94d0bf00863e0a4f7ebcbfff
523b93dda310d2d5290b1577318989740cee70b1
/bu_file/src/main/java/org/bu/file/dao/BuCliSubscribeRepository.java
95727e81c46ad16f976f41bfa839cdcb7d7bfc8f
[]
no_license
jxsapp/bu_file
92fe7db7bd656fa4c41b78841e4428325c39b8c7
a02cdd98d94ffef74cd477a874e8450c99b187af
refs/heads/master
2020-04-08T18:45:24.582120
2015-09-30T01:58:17
2015-09-30T01:58:17
37,888,316
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
package org.bu.file.dao; import java.util.List; import org.bu.file.model.BuCliSubscribe; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; /** * ShowMessage repository. * * @author Jiang XuSheng */ public interface BuCliSubscribeRepository extends CrudRepository<BuCliSubscribe, String> { @Query("from BuCliSubscribe where pubServer =? AND publishId =? ") List<BuCliSubscribe> buExists(String pubServer, String publishId); }
52e1aae698f972eea048cf07e45bcafe4d24d157
deb3a451da04b11f413425b93dea69d14f777ab2
/src/com/javarush/test/level14/lesson06/home01/UkrainianHen.java
5054f4ada67b67f3097f19f59c8a01238e967410
[]
no_license
kelebro13/JavaRushHomeWork
59d1cd8c9aad715eb518b26d76b4e5a125308caa
5ae4cf7cdeb5bbb97bdbda8832fb41faab370434
refs/heads/master
2020-09-22T08:25:56.755170
2016-08-17T12:26:34
2016-08-17T12:26:34
65,905,504
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
281
java
package com.javarush.test.level14.lesson06.home01; /** * Created by DNS on 22.09.2015. */ public class UkrainianHen extends Hen { public int getCountOfEggsPerMonth(){ return 1200; } public String getDescription(){ return "Я курица."; } }
ab25089490f0ced1b4c54543f1a8a3e6ec4d5cb7
3dc75f4305525a09a2de95badae5721868d8ccf5
/src/main/java/ru/rap/validators/StrValidator.java
75ed2988e987d3072c3be57d0ddebbaf123143af
[ "Apache-2.0" ]
permissive
ifgeny87-innopolis/Riddles-And-Puzzles
03c5c5a0a4be84b946b2a7f0880274abcb15afc4
b097240028e308902b08c81b5f38ec05762fbdc4
refs/heads/master
2021-01-13T03:17:28.937832
2017-01-29T21:39:40
2017-01-29T21:39:40
77,593,774
0
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
package ru.rap.validators; /** * Строковый валидатор * * Created in project RiddlesAndPuzzles in 27.12.2016 */ public class StrValidator implements Validator { private StrValidator() {} private static class LazySingleton { private static StrValidator instance = new StrValidator(); } @Override public boolean validate(Object o) { return (o instanceof String); } /** * Валидация строки * * @param o Объект, а может и строка * @return Результат валидации */ public static boolean validateIt(Object o) { return LazySingleton.instance.validate(o); } /** * Валидация длины строки * * @param o Объект, а может и строка * @param min Минимальная длина * @param max Максимальная длина * @return Результат валидации */ public static boolean validateLength(Object o, int min, int max) { if (!validateIt(o)) return false; int l = o.toString().length(); return l >= min && l <= max; } }
82e1d85bebc8bfff5aa83f510409e7919a13f1c4
13f6652c77abd41d4bc944887e4b94d8dff40dde
/archstudio/src/archstudio/comp/archipelago/AbstractMappingLogic.java
483550156eebe232a2868b5866b3cfd333a80d4a
[]
no_license
isr-uci-edu/ArchStudio3
5bed3be243981d944577787f3a47c7a94c8adbd3
b8aeb7286ea00d4b6c6a229c83b0ee0d1c9b2960
refs/heads/master
2021-01-10T21:01:43.330204
2014-05-31T16:15:53
2014-05-31T16:15:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package archstudio.comp.archipelago; import edu.uci.ics.bna.*; import edu.uci.ics.xarchutils.*; import archstudio.comp.xarchtrans.*; public abstract class AbstractMappingLogic implements MappingLogic{ protected BNAModel[] bnaModels; protected XArchFlatTransactionsInterface xarch; public AbstractMappingLogic(BNAModel[] bnaModels, XArchFlatTransactionsInterface xarch){ this.bnaModels = bnaModels; this.xarch = xarch; } public void handleXArchFlatEvent(XArchFlatEvent evt){ } public void handleXArchFileEvent(XArchFileEvent evt){ } public void bnaModelChanged(BNAModelEvent evt){ } }
8a30391f554b27803462c3005c61ec8a40df144d
aa3ba2ad769e595f64d42d321e3d407c2622e20d
/src/main/java/com/praxar/repository/AuthorityRepository.java
cba72431c3e5a0af6a7d792f859197703c171851
[]
no_license
praxem/sapp
07e6642758b29503744d5215158898ae2d1c7661
e5b83e55ce51f875d54a5a14ca98a3bc8471882e
refs/heads/master
2022-12-25T14:34:42.477584
2020-02-05T21:13:33
2020-02-05T21:13:33
238,546,743
0
0
null
2022-12-16T04:43:50
2020-02-05T20:55:15
Java
UTF-8
Java
false
false
286
java
package com.praxar.repository; import com.praxar.domain.Authority; import org.springframework.data.jpa.repository.JpaRepository; /** * Spring Data JPA repository for the {@link Authority} entity. */ public interface AuthorityRepository extends JpaRepository<Authority, String> { }
00b42cea991e6ece77828dca3ef497b9eb558bee
801057345afc8a33093a44aa2698155b989d522f
/app/src/main/java/app/android/oyb/com/myapp/ui/fragment/NotepadFragment.java
726040d41f425b521dada81b95a4c8648d102bd1
[]
no_license
oybo/MyWeather
c1f0a593753eaa99313c56453e85ca6ada5000ad
66c59848a6f1a9991da14093ede512984eddbfee
refs/heads/master
2021-01-17T07:38:47.630975
2017-09-07T09:39:45
2017-09-07T09:39:45
83,785,055
1
0
null
null
null
null
UTF-8
Java
false
false
637
java
package app.android.oyb.com.myapp.ui.fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import app.android.oyb.com.myapp.R; import app.android.oyb.com.myapp.ui.BaseFragment; /** * Created by O on 2017/3/14. */ public class NotepadFragment extends BaseFragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_pretty_pictures, container, false); } }
3eeab0cf83b2e252b3d410e321d0ae91078b71b4
bcaf346cb544a1947b8007ddc4f9bc41c01625b5
/src/main/java/com/mugua/common/config/MyWebAppConfigurer.java
35e96ac69bf29c287a2a4fced8157d7d8fb6debd
[]
no_license
wangshuangchao/kamang-server
8a8441da25d7b1660128d4bbcbd4898d8fede55d
2ca46170dcf652abbdbdd3631f7057272c622f7a
refs/heads/master
2020-04-05T19:59:44.306582
2018-11-12T05:23:08
2018-11-12T05:23:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.mugua.common.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import com.mugua.common.interceptor.ErrorInterceptor; @Configuration public class MyWebAppConfigurer extends WebMvcConfigurerAdapter { @Override public void addInterceptors(InterceptorRegistry registry) { // 多个拦截器组成一个拦截器链 // addPathPatterns 用于添加拦截规则 // excludePathPatterns 用户排除拦截 registry.addInterceptor(new ErrorInterceptor()).addPathPatterns("/**"); super.addInterceptors(registry); } }
376732f505810d627452649eb385d4fde6728858
e0b11a101c6ef411b5b281d3e6a09242bdef96cc
/day15 秒杀总结&限流&简历&企业中的日常流量数据/代码/qf-big-data-seckill/web/src/main/java/com/qf/bigdata/view/web/ViewWebApplication.java
564e02e29ae934463aaa06d4ced958198cf286ce
[]
no_license
lei720/phase-4
9bf26ef8877eebf1d8fa70998807a087ece73b57
3a9cb4d27a3cc7e1f907b29b941ce1e4e3d9ac3d
refs/heads/main
2023-08-18T17:59:23.504331
2021-10-16T06:08:37
2021-10-16T06:08:37
417,735,056
0
0
null
2021-10-16T06:07:07
2021-10-16T06:07:07
null
UTF-8
Java
false
false
415
java
package com.qf.bigdata.view.web; import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication //@EnableDubbo public class ViewWebApplication { public static void main(String[] args) { SpringApplication.run(ViewWebApplication.class, args); } }
a0c0d2282b5f2bcc173f8b5622744c7f8fee90f2
ba24fe93707a32de6df112550768d0628a6c13e6
/SpringMVC_First/src/com/bean/StudentBean.java
25c7f039e0bc63e2b90d7271140fc1c9966dd823
[]
no_license
JeetKhatri/SpringMVC
a4e6573551e05c8c93d2ef2296355ed1ec8d9c7b
1342e9ceab746ae5a304adaf90b20a922bf6bcaa
refs/heads/master
2020-06-24T03:17:29.716552
2017-09-06T09:19:37
2017-09-06T09:19:37
96,917,404
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package com.bean; public class StudentBean { private String studentName; private String studentHobby; public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public String getStudentHobby() { return studentHobby; } public void setStudentHobby(String studentHobby) { this.studentHobby = studentHobby; } }
a3e2bea35eeb1b110a4d3dc500dcdced6141dc67
723d372f73b84e4df3f664a2a3a08cd694af9dab
/src/org/openrdf/query/algebra/evaluation/federation/ServiceJoinConversionIteration.java
755913d7d5c6d907b571926588f4bfca34b449ff
[]
no_license
Thanx7/bookstore
f0a901d9abc1d203111e0cc866064d4fedd95ba8
53d5b591fceb8b1a28d1426bf1a24da99d81defb
refs/heads/master
2020-06-02T20:48:48.529800
2014-08-26T14:02:39
2014-08-26T14:02:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,030
java
/* * Copyright fluid Operations AG (http://www.fluidops.com/) (c) 2011. * * Licensed under the Aduna BSD-style license. */ package org.openrdf.query.algebra.evaluation.federation; import java.util.Iterator; import java.util.List; import info.aduna.iteration.CloseableIteration; import info.aduna.iteration.ConvertingIteration; import org.openrdf.query.Binding; import org.openrdf.query.BindingSet; import org.openrdf.query.QueryEvaluationException; import org.openrdf.query.algebra.evaluation.QueryBindingSet; /** * Inserts original bindings into the result, uses ?__rowIdx to resolve original * bindings. See {@link ServiceJoinIterator} and {@link SPARQLFederatedService}. * * @author Andreas Schwarte */ public class ServiceJoinConversionIteration extends ConvertingIteration<BindingSet, BindingSet, QueryEvaluationException> { protected final List<BindingSet> bindings; public ServiceJoinConversionIteration( CloseableIteration<BindingSet, QueryEvaluationException> iter, List<BindingSet> bindings) { super(iter); this.bindings = bindings; } @Override protected BindingSet convert(BindingSet bIn) throws QueryEvaluationException { // overestimate the capacity QueryBindingSet res = new QueryBindingSet(bIn.size() + bindings.size()); int bIndex = -1; Iterator<Binding> bIter = bIn.iterator(); while (bIter.hasNext()) { Binding b = bIter.next(); String name = b.getName(); if (name.equals("__rowIdx")) { bIndex = Integer.parseInt(b.getValue().stringValue()); continue; } res.addBinding(b.getName(), b.getValue()); } // should never occur: in such case we would have to create the cross product (which // is dealt with in another place) if (bIndex == -1) throw new QueryEvaluationException("Invalid join. Probably this is due to non-standard behavior of the SPARQL endpoint. " + "Please report to the developers."); res.addAll(bindings.get(bIndex)); return res; } }
75673c68ea081460c1811743e6b0a1c270a510a9
a355888f7e0634ea2324f30aee4af68c587ad3c7
/src/main/java/org/gridgain/spring/SpringWorkshopApplication.java
e1c2a439b15bb4aefd86d92dfff6d09f4811fb0e
[]
no_license
GridGain-Demos/ignite-spring-workshop
519b6b543fa67bf4cf0d390b1f6d04a931674b06
9d9b2c555da4fac2feb8bbe309ff6e7dabf04621
refs/heads/master
2023-03-21T00:48:04.014151
2021-03-21T11:59:55
2021-03-21T11:59:55
349,152,034
2
1
null
null
null
null
UTF-8
Java
false
false
449
java
package org.gridgain.spring; import org.apache.ignite.springdata22.repository.config.EnableIgniteRepositories; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @EnableIgniteRepositories public class SpringWorkshopApplication { public static void main(String[] args) { SpringApplication.run(SpringWorkshopApplication.class, args); } }
d2967e3c1757ce1fc32f3843c30356859d3cb5e2
8dd47243146c972779408cede9738dd6a2035620
/src/main/java/com/prototipo/tcc/services/UserDetailsServiceImpl.java
577e6ee4c91c24fe04e8a1e04ff51e79023c5a4d
[]
no_license
fernandopavan/app-ionic-back
7287e59467862dd9d990c62771a56260013fbdb7
e34df957b8055916d0e92c1414455e7e72d03b78
refs/heads/master
2023-04-17T11:30:29.312432
2020-05-14T18:20:56
2020-05-14T18:20:56
202,041,189
0
0
null
2021-04-26T19:27:11
2019-08-13T01:48:38
Java
UTF-8
Java
false
false
933
java
package com.prototipo.tcc.services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import com.prototipo.tcc.domain.Usuario; import com.prototipo.tcc.repositories.UsuarioRepository; import com.prototipo.tcc.security.UserSS; @Service public class UserDetailsServiceImpl implements UserDetailsService { @Autowired private UsuarioRepository repo; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { Usuario cli = repo.findByEmail(email); if (cli == null) { throw new UsernameNotFoundException(email); } return new UserSS(cli.getId(), cli.getEmail(), cli.getSenha(), cli.getPerfis()); } }
2ac54b446bd0bfdceb85e1230216a51d3d03cf8e
41bac86d728e5f900e3d60b5a384e7f00c966f5b
/communote/persistence/src/main/java/com/communote/server/core/blog/MailBasedPostingManagement.java
ba89f295dcb92391c6f9b72d3e73c548299a8c15
[ "Apache-2.0" ]
permissive
Communote/communote-server
f6698853aa382a53d43513ecc9f7f2c39f527724
e6a3541054baa7ad26a4eccbbdd7fb8937dead0c
refs/heads/master
2021-01-20T19:13:11.466831
2019-02-02T18:29:16
2019-02-02T18:29:16
61,822,650
27
4
Apache-2.0
2018-12-08T19:19:06
2016-06-23T17:06:40
Java
UTF-8
Java
false
false
422
java
package com.communote.server.core.blog; /** * * @author Communote GmbH - <a href="http://www.communote.com/">http://www.communote.com/</a> */ public interface MailBasedPostingManagement { /** * <p> * Creates a UserTaggedPost from an email message. * </p> */ public void createNoteFromMail(javax.mail.Message message, String senderEmail, java.util.Set<String> blogNameIds); }
b8451440069a48b0417e9d26c5ac1176fce5a433
9592248cc9a6a117c35d2ea7a06e01fae966ff68
/src/main/java/com/rowling/spring/dto/LivroDTO.java
a014f719be3c61a038edad01cd8583be036e9afb
[]
no_license
emiliodeoliveira/rowling-lms-backend
669302c578be76664f7b9bd702e626f790d0428c
10a7670ab3345737da33c3c00418854cdbc8d2ba
refs/heads/master
2020-04-11T12:06:49.782732
2018-12-14T10:44:24
2018-12-14T10:44:24
161,769,979
1
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.rowling.spring.dto; import java.io.Serializable; import com.rowling.spring.domain.Livro; public class LivroDTO implements Serializable { private static final long serialVersionUID = 1L; private Integer id; private String nome; public LivroDTO() { } public LivroDTO(Livro obj) { id = obj.getId(); nome = obj.getNome(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
e5e59fcadc64ea724bd82a86b9b3358b439e46ce
28d9dbf070f064396ad57f6671b0b45960bc8cc8
/src/main/java/com/lzx/generator/model/EcsEgoUpvoteExample.java
1149e235213708d134d1bc6bb154e7f6d5f3ab9e
[]
no_license
Black1499/mybatis_study
8dfa01be4e33f5d8b52477596ba6c185b38c8485
e3d3abd019f2f66eb811dd08008596adb2fed68f
refs/heads/master
2020-04-24T01:07:19.909938
2019-02-20T06:21:02
2019-02-20T06:21:02
171,587,491
0
0
null
null
null
null
UTF-8
Java
false
false
18,057
java
package com.lzx.generator.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class EcsEgoUpvoteExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table ecs_ego_upvote * * @mbg.generated */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table ecs_ego_upvote * * @mbg.generated */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table ecs_ego_upvote * * @mbg.generated */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public EcsEgoUpvoteExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table ecs_ego_upvote * * @mbg.generated */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Long value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Long value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Long value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Long value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Long value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Long value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Long> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Long> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Long value1, Long value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Long value1, Long value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andTargetIdIsNull() { addCriterion("target_id is null"); return (Criteria) this; } public Criteria andTargetIdIsNotNull() { addCriterion("target_id is not null"); return (Criteria) this; } public Criteria andTargetIdEqualTo(Long value) { addCriterion("target_id =", value, "targetId"); return (Criteria) this; } public Criteria andTargetIdNotEqualTo(Long value) { addCriterion("target_id <>", value, "targetId"); return (Criteria) this; } public Criteria andTargetIdGreaterThan(Long value) { addCriterion("target_id >", value, "targetId"); return (Criteria) this; } public Criteria andTargetIdGreaterThanOrEqualTo(Long value) { addCriterion("target_id >=", value, "targetId"); return (Criteria) this; } public Criteria andTargetIdLessThan(Long value) { addCriterion("target_id <", value, "targetId"); return (Criteria) this; } public Criteria andTargetIdLessThanOrEqualTo(Long value) { addCriterion("target_id <=", value, "targetId"); return (Criteria) this; } public Criteria andTargetIdIn(List<Long> values) { addCriterion("target_id in", values, "targetId"); return (Criteria) this; } public Criteria andTargetIdNotIn(List<Long> values) { addCriterion("target_id not in", values, "targetId"); return (Criteria) this; } public Criteria andTargetIdBetween(Long value1, Long value2) { addCriterion("target_id between", value1, value2, "targetId"); return (Criteria) this; } public Criteria andTargetIdNotBetween(Long value1, Long value2) { addCriterion("target_id not between", value1, value2, "targetId"); return (Criteria) this; } public Criteria andTargetTypeIsNull() { addCriterion("target_type is null"); return (Criteria) this; } public Criteria andTargetTypeIsNotNull() { addCriterion("target_type is not null"); return (Criteria) this; } public Criteria andTargetTypeEqualTo(Integer value) { addCriterion("target_type =", value, "targetType"); return (Criteria) this; } public Criteria andTargetTypeNotEqualTo(Integer value) { addCriterion("target_type <>", value, "targetType"); return (Criteria) this; } public Criteria andTargetTypeGreaterThan(Integer value) { addCriterion("target_type >", value, "targetType"); return (Criteria) this; } public Criteria andTargetTypeGreaterThanOrEqualTo(Integer value) { addCriterion("target_type >=", value, "targetType"); return (Criteria) this; } public Criteria andTargetTypeLessThan(Integer value) { addCriterion("target_type <", value, "targetType"); return (Criteria) this; } public Criteria andTargetTypeLessThanOrEqualTo(Integer value) { addCriterion("target_type <=", value, "targetType"); return (Criteria) this; } public Criteria andTargetTypeIn(List<Integer> values) { addCriterion("target_type in", values, "targetType"); return (Criteria) this; } public Criteria andTargetTypeNotIn(List<Integer> values) { addCriterion("target_type not in", values, "targetType"); return (Criteria) this; } public Criteria andTargetTypeBetween(Integer value1, Integer value2) { addCriterion("target_type between", value1, value2, "targetType"); return (Criteria) this; } public Criteria andTargetTypeNotBetween(Integer value1, Integer value2) { addCriterion("target_type not between", value1, value2, "targetType"); return (Criteria) this; } public Criteria andCreatedAtIsNull() { addCriterion("created_at is null"); return (Criteria) this; } public Criteria andCreatedAtIsNotNull() { addCriterion("created_at is not null"); return (Criteria) this; } public Criteria andCreatedAtEqualTo(Date value) { addCriterion("created_at =", value, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtNotEqualTo(Date value) { addCriterion("created_at <>", value, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtGreaterThan(Date value) { addCriterion("created_at >", value, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { addCriterion("created_at >=", value, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtLessThan(Date value) { addCriterion("created_at <", value, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtLessThanOrEqualTo(Date value) { addCriterion("created_at <=", value, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtIn(List<Date> values) { addCriterion("created_at in", values, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtNotIn(List<Date> values) { addCriterion("created_at not in", values, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtBetween(Date value1, Date value2) { addCriterion("created_at between", value1, value2, "createdAt"); return (Criteria) this; } public Criteria andCreatedAtNotBetween(Date value1, Date value2) { addCriterion("created_at not between", value1, value2, "createdAt"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table ecs_ego_upvote * * @mbg.generated do_not_delete_during_merge */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table ecs_ego_upvote * * @mbg.generated */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
87de9971af9477678f38170aa3c1cae7975793b1
a3db21988a8ff3c3de1f4f2326acda2e80b20eef
/Vest/src/main/java/me/ckhd/opengame/online/handle/ucHandle.java
b458155ab3faff36e555c3abbcf8534104630642
[]
no_license
lorishui/ckhd
f36205099e89e8b7fa54ed7453686545dfddfb76
130134ed7194fbdffd6e3cbc519d8bb99508e2e8
refs/heads/master
2020-04-05T15:30:02.568144
2017-08-11T07:38:01
2017-08-11T07:38:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,837
java
package me.ckhd.opengame.online.handle; import java.io.UnsupportedEncodingException; import java.text.DecimalFormat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import me.ckhd.opengame.app.entity.PayInfoConfig; import me.ckhd.opengame.common.utils.CoderUtils; import me.ckhd.opengame.common.utils.Encodes; import me.ckhd.opengame.common.utils.MD5Util; import me.ckhd.opengame.common.utils.SignContext; import me.ckhd.opengame.online.entity.OnlinePay; import me.ckhd.opengame.online.entity.OnlineUser; import me.ckhd.opengame.util.HttpClientUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import com.alibaba.fastjson.JSONObject; @Component("uc") @Scope("prototype") public class ucHandle extends BaseHandle{ // private static final String verifyUrl = "http://sdk.g.uc.cn/cp/account.verifySession";//正式接口地址 // private static final String verifyUrl_test = "http://sdk.test4.g.uc.cn/cp/account.verifySession";//测试接口地址 //2017-05-08 private static final String verifyUrl = "http://sdk.9game.cn/cp/account.verifySession";//正式接口地址 private static final String verifyUrl_test = "http://sdk.test4.9game.cn/cp/account.verifySession";//测试接口地址 @Override public String login(OnlineUser onlineUser, JSONObject codeJson, PayInfoConfig payInfo) { JSONObject result = new JSONObject(); result.put("resultCode", -1); String url = verifyUrl; if( codeJson.containsKey("isTest") && codeJson.getInteger("isTest") == 1 ){ url = verifyUrl_test; } JSONObject verifyInfo = codeJson.getJSONObject("verifyInfo"); String sid = verifyInfo.containsKey("sid")?verifyInfo.getString("sid"):""; String gameid = payInfo.getAppid(); //加密规则 :MD5(sid=...+apiKey) //数据格式 {key:value,key;{},key;{}} JSONObject jsonData = new JSONObject(); JSONObject sidJ = new JSONObject(); sidJ.put("sid", sid); JSONObject gameidJ = new JSONObject(); gameidJ.put("gameId", gameid); jsonData.put("id", System.currentTimeMillis()/1000L); jsonData.put("data", sidJ); jsonData.put("game", gameidJ); jsonData.put("sign", MD5Util.string2MD5("sid="+sid+payInfo.getAppkey())); String resposeData = HttpClientUtils.postVivo(url, jsonData.toJSONString(), 2000, 2000); //响应数据格式 if( StringUtils.isNotBlank(resposeData) ){ try { resposeData = new String(resposeData.getBytes("gbk"),"utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } JSONObject resultData = JSONObject.parseObject(resposeData); JSONObject state = JSONObject.parseObject(resultData.getString("state")); if(state.getInteger("code") == 1){ JSONObject data = JSONObject.parseObject(resultData.getString("data")); String uid = data.getString("accountId"); String username = data.getString("nickName"); onlineUser.setSid(uid); onlineUser.setUserName(username); returnLoginSuccess(result, onlineUser); }else{ result.put("errMsg", "登录验证不正确!"); } }else{ result.put("errMsg", "数据为空或者请求失败!"); } return result.toJSONString(); } @Override public String pay(OnlinePay onlinePay, JSONObject codeJson) { JSONObject verifyInfo = codeJson.getJSONObject("verifyInfo"); JSONObject data = new JSONObject(); data.put("callbackInfo", onlinePay.getOrderId()); data.put("amount", getDoubleNumber(onlinePay.getPrices()*0.01d)); data.put("serverId", 0); data.put("notifyUrl", StringUtils.isNotBlank(onlinePay.getNotifyUrl())?onlinePay.getNotifyUrl():onlinePay.getPayInfoConfig().getNotifyUrl()); data.put("cpOrderId", onlinePay.getOrderId()); data.put("accountId", verifyInfo.get("accountId")); String apiKey = onlinePay.getPayInfoConfig().getAppkey(); String md5Str = SignContext.getSignContext(data,apiKey); log.info("uc pay sign context="+md5Str); String sign = CoderUtils.md5(md5Str,"utf-8"); JSONObject result = new JSONObject(); result.put("resultCode",0); result.put("errMsg","SUCCESS"); JSONObject child = new JSONObject(); child.put("orderId", onlinePay.getOrderId()); child.put("sign", sign); child.put("callBackUrl", onlinePay.getPayInfoConfig().getNotifyUrl()); result.put("result", child); return result.toJSONString(); } @Override public void parseParamter(String code, HttpServletRequest request, OnlinePay onlinePay) { JSONObject requestData = JSONObject.parseObject(code); if( requestData.containsKey("data") ){ respData = requestData.getJSONObject("data"); respData.put("sign", requestData.getString("sign")); } if( respData != null && respData.size() > 0){ onlinePay.setOrderId(respData.getString("cpOrderId")); onlinePay.setActualAmount(respData.containsKey("amount")?((int)(respData.getDouble("amount")*100))+"":"0"); onlinePay.setCallBackContent(StringUtils.isNotBlank(code)?code:requestData.toJSONString()); onlinePay.setChannelOrderId(respData.getString("orderId")); } } @Override public String verifyData(OnlinePay onlinePay, JSONObject result, HttpServletResponse response) { if ( respData.containsKey("sign") && StringUtils.isNotBlank(respData.getString("sign")) ) { log.info("uc online sign respData="+respData.toJSONString()); if(respData.containsKey("orderStatus") && "S".equals(respData.getString("orderStatus"))){ String apiKey = onlinePay.getPayInfoConfig().getAppkey(); String md5Str = SignContext.getSignContext(respData,apiKey); log.info("uc online sign context="+md5Str); log.info("uc online sign ="+respData.get("sign")); String sign = Encodes.string2MD5(md5Str).toLowerCase(); String returnSign= respData.getString("sign"); int money = (int)(Double.parseDouble(respData.get("amount").toString())*100); if(sign.equals(returnSign.toLowerCase()) && onlinePay.getPrices() == money){ result.put("code", 2000); return getReturnSuccess(); }else{ result.put("code", 4006); result.put("errMsg", "验证错误!"); return getReturnFailure(); } }else{ result.put("code", 4008); result.put("errMsg", "回掉数据中标识失败订单!"); return getReturnFailure(); } }else{ result.put("code", 4007); result.put("errMsg", "数据为空!"); return getReturnFailure(); } } @Override public String getReturnSuccess() { return "SUCCESS"; } @Override public String getReturnFailure() { return "FAILURE"; } private String getDoubleNumber(Double d){ DecimalFormat df = new DecimalFormat("#0.00"); return df.format(d); } }
ae6212a2255e3b9717b7634c55e23e7af06141e9
858fa26d934d123379724a7dc95d2cd8a0203a3e
/src/cn/edu/nju/schema/部门类型.java
842e85a3789ce7d11b9774f6921a0dec882ab415
[]
no_license
XRiver/JAXBTest
0282c2af95bf0a6634098d386091d22d075cc407
a664856f66ab3c6f6aa67977fb07b0f31b756257
refs/heads/master
2021-01-25T04:49:36.316928
2017-06-08T10:18:07
2017-06-08T10:18:07
93,485,404
0
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
// // 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 // 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // 在重新编译源模式时, 对此文件的所有修改都将丢失。 // 生成时间: 2017.06.06 时间 02:23:42 PM CST // package cn.edu.nju.schema; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>部门类型的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * <p> * <pre> * &lt;simpleType name="部门类型"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="院系"/> * &lt;enumeration value="行政部门"/> * &lt;enumeration value="直属部门"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "\u90e8\u95e8\u7c7b\u578b") @XmlEnum public enum 部门类型 { 院系, 行政部门, 直属部门; public String value() { return name(); } public static 部门类型 fromValue(String v) { return valueOf(v); } }
845c81c2411843981998a8c63f499fc4f87f284d
c445f5c5402ffa9895a622fdb75b8cc4176b66ef
/src/biz/expense/sorter/SortGuiController.java
0a4e8123fa88ee248bed5bcdd5a8e03bee92680e
[]
no_license
lhope7/BizExpenseSorter
1dbe51772ff3e6cc81c3d5c9cbbff7a659dd063b
bf0040efc7055b47b3327db92e01d789782b1948
refs/heads/master
2020-12-30T14:12:45.492908
2017-05-16T05:58:08
2017-05-16T05:58:08
91,288,439
0
0
null
null
null
null
UTF-8
Java
false
false
6,753
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package biz.expense.sorter; import java.io.File; import java.net.URL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.Tab; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.stage.FileChooser; /** * * @author LeesMac */ public class SortGuiController implements Initializable { @FXML private Label outputLabel; @FXML private Button addSite; @FXML private Button browseBtn; @FXML private TextArea addedTF; @FXML private Tab sortTab; @FXML private Tab sitesTab; @FXML private Button rmSiteBtn; @FXML protected TextField addSiteTF; @FXML private Button addToBtn; @FXML public ListView siteToAdd; @FXML protected ListView siteList; @FXML protected ListView listView; @FXML protected TextArea addedTA; @FXML private Button rmFromBt; @FXML private Button sortAndSave; @FXML private Button saveBtn; @FXML private TextField sourceTF; @FXML private TextField destinationTF; private String source; private String destination; private File reportFile; public ArrayList listOfSites = new ArrayList(); private final FileChooser fc = new FileChooser(); @FXML private void handleButtonActionBrowse(ActionEvent event) { FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(".csv files (*.csv)", "*.csv"); fc.getExtensionFilters().add(extFilter); reportFile = fc.showOpenDialog(null); source = reportFile.getAbsolutePath(); sourceTF.setText(source); } @FXML private void handleButtonActionSave(ActionEvent event) { FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(".csv files (*.csv)", "*.csv"); fc.getExtensionFilters().add(extFilter); //Show save file dialog File file = fc.showSaveDialog(null); if (file != null) { destination = file.getAbsolutePath(); destinationTF.setText(destination); } } @FXML private void handleButtonActionSortAndSave(ActionEvent event) { //SortCSV s = new SortCSV(); SortAndSave sas = new SortAndSave(); // s.sortAndSave(getSiteList(), source, destination); sas.sas(getSiteList(), source, destination); } @FXML private void handleButtonActionAddSite(ActionEvent event) { String site = addSiteTF.getText(); siteToAdd.getItems().add(site); try { storeSite(site); } catch (Exception e) { e.printStackTrace(); } } @FXML private void handleButtonActionAddToBtn(ActionEvent event) { Object o = siteToAdd.getFocusModel().getFocusedItem(); if (o == null) { } else { siteList.getItems().add(o); siteToAdd.getItems().remove(o); } } @FXML private void handleButtonActionRmFromBtn(ActionEvent event) { Object o = siteList.getFocusModel().getFocusedItem(); if (o == null) { } else { siteList.getItems().remove(o); siteToAdd.getItems().add(o); } } @FXML private void handleButtonActionRmSiteBtn(ActionEvent event) { Object o = siteToAdd.getFocusModel().getFocusedItem(); siteToAdd.getItems().remove(o); try { removeSite(o.toString()); } catch (Exception e) { outputLabel.setText(e.getCause().toString()); } } // This is what is called when adding a site to the site list. I think this works public void storeSite(String site) throws Exception { Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:/Users/Shared/test.db"); Statement stat = conn.createStatement(); stat.executeUpdate("create table if not exists Location (name);"); PreparedStatement prep = conn.prepareStatement( "insert into Location values (?);"); prep.setString(1, site); prep.addBatch(); conn.setAutoCommit(false); prep.executeBatch(); conn.setAutoCommit(true); conn.close(); } public void removeSite(String site) throws Exception { Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:/Users/Shared/test.db"); Statement stat = conn.createStatement(); PreparedStatement prep = conn.prepareStatement( "delete from Location where name = ?;"); prep.setString(1, site); prep.addBatch(); conn.setAutoCommit(false); prep.executeBatch(); conn.setAutoCommit(true); conn.close(); } // This bit works in the IDE, but not from the .jar on the desktop. I think this is // where the problem is. public void populateSites() throws Exception { File file = new File("/Users/Shared/test.db"); if (file.exists()) { Class.forName("org.sqlite.JDBC"); // I assume the file path here needs some finesse Connection conn = DriverManager.getConnection("jdbc:sqlite:/Users/Shared/test.db"); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from Location;"); while (rs.next()) { siteToAdd.getItems().add(rs.getString("name")); //System.out.println("name = " + rs.getString("name")); } rs.close(); conn.close(); } else{ outputLabel.setText("file doesn't exist"); } } @FXML public ArrayList getSiteList() { for (int i = 0; i < siteList.getItems().size(); i++) { listOfSites.add(siteList.getItems().get(i)); } //System.out.println(listOfSites); return listOfSites; } @Override public void initialize(URL url, ResourceBundle rb) { try { populateSites(); } catch (Exception e) { e.printStackTrace(); } } }
89ba3279dc3258fc53843c01afa815c036e2e9e9
425ac2b3d2ba036202c1dc72c561d3a904df33ad
/api/cas-server-core-api-configuration-model/src/main/java/org/apereo/cas/configuration/model/support/scim/ScimProperties.java
7f875ca40edb9991d30e8d2ab7fa3a06c1694773
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
fogbeam/cas_mirror
fee69b4b1a7bf5cac87da75b209edc3cc3c1d5d6
b7daea814f1238e95a6674663b2553555a5b2eed
refs/heads/master
2023-01-07T08:34:26.200966
2021-08-12T19:14:41
2021-08-12T19:14:41
41,710,765
1
2
Apache-2.0
2022-12-27T15:39:03
2015-09-01T01:53:24
Java
UTF-8
Java
false
false
1,355
java
package org.apereo.cas.configuration.model.support.scim; import org.apereo.cas.configuration.support.RequiredProperty; import org.apereo.cas.configuration.support.RequiresModule; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; import java.io.Serializable; /** * This is {@link ScimProperties}. * * @author Misagh Moayyed * @since 5.1.0 */ @RequiresModule(name = "cas-server-support-scim") @Getter @Setter @Accessors(chain = true) public class ScimProperties implements Serializable { private static final long serialVersionUID = 7943229230342691009L; /** * Decide whether scim should be enabled. */ private boolean enabled = true; /** * Indicate what version of the scim protocol is and should be used. */ private long version = 2; /** * The SCIM provisioning target URI. */ @RequiredProperty private String target; /** * Authenticate into the SCIM server/service via a pre-generated OAuth token. */ @RequiredProperty private String oauthToken; /** * Authenticate into the SCIM server with a pre-defined username. */ @RequiredProperty private String username; /** * Authenticate into the SCIM server with a pre-defined password. */ @RequiredProperty private String password; }