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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1bd8afed1067e5249af425943899890b7bc71636 | d0e73bbe58cd9e752aad77c8f6d5c974bc038e4b | /app/src/main/java/com/wraith/wraithcamera/gpucomponents/gles/imageprocessprograms/CameraInkwellProgram.java | 613f603ef34d00aa2c496d8cf4f37ecbbb78bb34 | [] | no_license | EchoAGI/wraithCamera | 8b8c680c28112270ad1afab4b6849bded81b796f | a3aa3ef8bb2f35f623a095362cedcaa050b1255c | refs/heads/master | 2023-05-03T22:56:10.481299 | 2016-09-12T13:51:30 | 2016-09-12T13:51:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,966 | java | package com.wraith.wraithcamera.gpucomponents.gles.imageprocessprograms;
import android.content.Context;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import com.wraith.wraithcamera.R;
import com.wraith.wraithcamera.gpucomponents.gles.GlUtil;
import com.wraith.wraithcamera.gpucomponents.gles.Texture2dProgram;
import java.nio.FloatBuffer;
/**
* Created by liuzongyang on 15/11/10.
*/
public class CameraInkwellProgram extends Texture2dProgram{
private int mMixLocation = -1;
private float mMix = 0.7f;
public static final String INKWELL_FRAGMENT_SHADER =
"#extension GL_OES_EGL_image_external : require\n" +
"precision highp float;\n" +
"\n" +
"varying highp vec2 vTextureCoord;\n" +
"\n" +
"uniform samplerExternalOES inputImageTexture;\n" +
"uniform sampler2D inputImageTexture2;\n" +
"uniform highp float mixturePercent;\n"+
"const highp float EPSILON = 0.001;\n"+
"const highp float SUB_EPSLION = 0.999;\n"+
"\n" +
"void main()\n" +
"{\n" +
" highp vec3 texel = texture2D(inputImageTexture, vTextureCoord).rgb;\n" +
" highp vec3 texel2 = texture2D(inputImageTexture, vTextureCoord).rgb;\n" +
" texel = clamp(texel, EPSILON, SUB_EPSLION);\n"+
" texel2 = clamp(texel2, EPSILON, SUB_EPSLION);\n"+
" texel = vec3(dot(vec3(0.3, 0.6, 0.1), texel));\n" +
" texel = vec3(texture2D(inputImageTexture2, vec2(texel.r, .16666)).r);\n" +
" texel = clamp(texel, EPSILON, SUB_EPSLION);\n"+
" gl_FragColor = vec4(mix(texel2,texel,mixturePercent), 1.0);\n"+
"}";
private int mInputImageTexture2Handler = -1;
private int mInputImageTexture2Loc = -1;
public CameraInkwellProgram(Context context) {
mDefaultTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
mFilterType = FilterType.FILTER_INKWELL;
mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, INKWELL_FRAGMENT_SHADER);
if(mProgramHandle == 0) {
throw new RuntimeException("Unable to create program");
}
mInputImageTexture2Handler = createTextureObject(context, R.mipmap.inkwell_map);
initParams();
}
@Override
public void release(){
super.release();
if(mInputImageTexture2Handler != -1) {
GLES20.glDeleteTextures(1, new int[]{mInputImageTexture2Handler}, 0);
mInputImageTexture2Handler = -1;
}
}
@Override
public void initParams() {
super.initParams();
mMixLocation = GLES20.glGetUniformLocation(mProgramHandle, "mixturePercent");
mInputImageTexture2Loc = GLES20.glGetUniformLocation(mProgramHandle, "inputImageTexture2");
}
private void setParam() {
GLES20.glUniform1f(mMixLocation, mMix);
}
public void draw(float[] mvpMatrix, FloatBuffer vertexBuffer, int firstVertex,
int vertexCount, int coordsPerVertex, int vertexStride,
float[] texMatrix, FloatBuffer texBuffer, int textureId, int texStride) {
// Select the program.
GLES20.glUseProgram(mProgramHandle);
// Set the texture.
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(mDefaultTextureTarget, textureId);
GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mInputImageTexture2Handler);
GLES20.glUniform1i(mInputImageTexture2Loc, 1);
//set param
setParam();
// Copy the model / view / projection matrix over.
GLES20.glUniformMatrix4fv(muMVPMatrixLoc, 1, false, mvpMatrix, 0);
// Copy the texture transformation matrix over.
GLES20.glUniformMatrix4fv(muTexMatrixLoc, 1, false, texMatrix, 0);
// Enable the "aPosition" vertex attribute.
GLES20.glEnableVertexAttribArray(maPositionLoc);
// Connect vertexBuffer to "aPosition".
GLES20.glVertexAttribPointer(maPositionLoc, coordsPerVertex,
GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);
// Enable the "aTextureCoord" vertex attribute.
GLES20.glEnableVertexAttribArray(maTextureCoordLoc);
// Connect texBuffer to "aTextureCoord".
GLES20.glVertexAttribPointer(maTextureCoordLoc, 2,
GLES20.GL_FLOAT, false, texStride, texBuffer);
// Draw the rect.
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, firstVertex, vertexCount);
// Done -- disable vertex array, texture, and program.
GLES20.glDisableVertexAttribArray(maPositionLoc);
GLES20.glDisableVertexAttribArray(maTextureCoordLoc);
GLES20.glBindTexture(mDefaultTextureTarget, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glUseProgram(0);
}
}
| [
"[email protected]"
] | |
2cf624705dd0ccfca20ef87a5ba36bce405c59dc | cea3fe1ae551bf2f81b431876d15563d6347119b | /case sso/case ltpa/src/main/java/com/gang/study/sso/ltpa/demo/entity/UserInfo.java | fd1c69600decf7a6e93e0263379386aeb3096747 | [] | no_license | black-ant/case | 2e33cbd74b559924d3a53092a8b070edea4d143d | 589598bb41398b330bc29b2ca61757296b55b579 | refs/heads/master | 2023-07-31T23:22:51.168312 | 2022-07-24T06:15:53 | 2022-07-24T06:15:53 | 137,761,384 | 86 | 26 | null | 2023-07-17T01:03:21 | 2018-06-18T14:22:01 | Java | UTF-8 | Java | false | false | 825 | java | package com.gang.study.sso.ltpa.demo.entity;
/**
* @Classname UserInfo
* @Description TODO
* @Date 2020/6/30 16:02
* @Created by zengzg
*/
public class UserInfo {
private String uid;
private String userName;
private String other;
public UserInfo(String uid, String userName, String other) {
this.uid = uid;
this.userName = userName;
this.other = other;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getOther() {
return other;
}
public void setOther(String other) {
this.other = other;
}
}
| [
"[email protected]"
] | |
0eb815a1c3e59768ae3da2e777d78119b80e3f7a | 60fd481d47bdcc768ebae0bd265fa9a676183f17 | /zc_mobile/src/com/zc/mobile/LoadingDialog.java | c9538d97b6fbfb7db52f914c06ad6423714be99e | [] | no_license | zilonglym/xinyu | 3257d2d10187205c4f91efa4fed8e992a9419694 | 8828638b77e3e0f6da099f050476cf634ef84c7b | refs/heads/master | 2020-03-09T16:49:34.758186 | 2018-03-27T06:52:46 | 2018-03-27T06:52:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 995 | java | package com.zc.mobile;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.widget.TextView;
/**
* 自定义加载进度对话框
* Created by Dylan on 2016-10-28.
*/
public class LoadingDialog extends Dialog {
private TextView tv_text;
public LoadingDialog(Context context) {
super(context);
/**设置对话框背景透明*/
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
setContentView(R.layout.loading);
tv_text = (TextView) findViewById(R.id.tv_text);
setCanceledOnTouchOutside(false);
}
/**
* 为加载进度个对话框设置不同的提示消息
*
* @param message 给用户展示的提示信息
* @return build模式设计,可以链式调用
*/
public LoadingDialog setMessage(String message) {
tv_text.setText(message);
return this;
}
}
| [
"[email protected]"
] | |
eae332f17b90ecc199f2c08eb634b401f430bd65 | c4e30b690a87dd08b777b051bb431ac6a994c922 | /src/controller/Controller.java | cb9a12e96f66ae6d1074effc4e6a71c1de68a683 | [] | no_license | MartinBergstrom/SQLVisualizer | 1f522d9c9496d63de70f5a01f6894e9137615d33 | 21e76827044d7ed19773eb287d68eb4dbaaa2379 | refs/heads/master | 2021-01-19T14:45:21.007000 | 2017-04-15T11:51:46 | 2017-04-15T11:51:46 | 88,185,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,709 | java | package controller;
import GUI.GUIMain;
import GUI.MainPanel;
import GUI.MenuBar;
import model.User;
import model.UserDAO;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import static java.lang.Thread.sleep;
/**
* Created by Martin on 2017-04-10.
*
* Controller class to connect the model and the view,
* adds actionlisteners to the different GUI elements
*
*/
public class Controller{
private UserDAO dao;
//Is this the best way to connect views? all logic to bind views here?
//Otherwise lots of calls beteween the views and references?
private GUIMain view;
private MenuBar menuBar;
private MainPanel mainPanel;
private boolean showAllPressed;
public Controller(UserDAO dao, GUIMain view) {
this.dao = dao;
this.view = view;
menuBar = view.getMenubar();
mainPanel = view.getMainPanel();
//add the listeners to the items in MenuBar
menuBar.addShowAllListener(new ShowAllListener());
menuBar.addInsertListener(new InsertListener());
menuBar.addUpdateListener(new UpdateListener());
menuBar.addDeleteByIdListener(new DeleteByIdListener());
menuBar.addUpdateRTListener(new UpdateRTListener());
showAllPressed = false;
}
/**
* Help method to update the view
*/
private void updateAll(){
mainPanel.clearTable();
mainPanel.addUsers(getAllUsers());
}
/**
* Help method to retrieve all the users from the DAO
*
* @return a list of all the users currently in the DAO
*/
private List<User> getAllUsers(){
return dao.findAll();
}
/**
* Help method to remove a user in the DAO with the specified id
*
* @param id id of the user to remove
* @return true if the user was successfully removed
*/
private boolean removeUserById(int id){
return dao.removeUserById(id);
}
/**
* Help method to insert a new user in the DAO
*
* @param user the new User to insert
* @return true if the user was successfully added
*/
private boolean insertNewUser(User user){
return dao.addUser(user);
}
//maybbe use wait/notify instead of this polling(?)
private void startUpdateThread(){
Runnable r = new Runnable() {
@Override
public void run() {
while (true){
System.out.println("thread running");
if(dao.checkUpdate()){
updateAll();
System.out.println("detected change, called update");
}
try{
Thread.sleep(4000);
}catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
new Thread(r).start();
}
///// INNER LISTENER CLASSES /////
private class ShowAllListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
if(!showAllPressed){
mainPanel.addUsers(getAllUsers());
showAllPressed = true;
}
}
}
private class InsertListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
User u = menuBar.createNewInsertUser();
if(u!=null){
if(insertNewUser(u)){
System.out.println("Successfully inserted new User");
//calls the mainpanel to update the view with a new row
mainPanel.addRow(u);
}
}
}
}
private class UpdateListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
updateAll();
}
}
private class DeleteByIdListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("pressed delete by id");
int id = menuBar.getRemoveId();
if(removeUserById(id)){
System.out.println("Successfully removed user with id: " + id);
updateAll();
}
}
}
private class UpdateRTListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
startUpdateThread();
}
}
}
| [
"[email protected]"
] | |
bedc139d5382ebabbb26a6266ce9b2c5cf1d0064 | ce3704dc27cb682590d67bb71676da678734d1d8 | /app/main/java/com/example/ibm/hermes/Insert.java | e50d2535a648007cffb584463f5e3def83e64258 | [] | no_license | ibmshaikh/Hermes | e54c53452fb1e7c5ada3e03f9b6723a1b1df1b1e | 9dfd8101f965845c2f2d3f130f2fc017d4b3551f | refs/heads/master | 2021-06-13T03:59:57.374190 | 2020-11-29T07:30:52 | 2020-11-29T07:30:52 | 104,904,335 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,307 | java | package com.example.ibm.hermes;
import android.content.Intent;
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.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.iid.FirebaseInstanceId;
import java.util.HashMap;
public class Insert extends AppCompatActivity {
private EditText minsert,mid;
private Button msave;
private FirebaseDatabase firebaseDatabase;
private DatabaseReference databaseReference;
private String name,id,chk;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_insert);
msave=(Button)findViewById(R.id.button2);
minsert=(EditText)findViewById(R.id.editText) ;
mid=(EditText)findViewById(R.id.editText3);
firebaseDatabase= FirebaseDatabase.getInstance();
databaseReference=firebaseDatabase.getReference();
msave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
name =minsert.getText().toString().trim();
id = mid.getText().toString().trim();
if (name.isEmpty() && id.isEmpty()) {
Toast.makeText(Insert.this.getApplicationContext(), "GroupName And Group Key Should not be Empty",Toast.LENGTH_SHORT).show();
} else if (name.isEmpty()) {
Toast.makeText(Insert.this.getApplicationContext(), "GroupName Should not be Empty", Toast.LENGTH_SHORT).show();
} else if (id.isEmpty()) {
Toast.makeText(Insert.this.getApplicationContext(), "Group Key Should not be Empty",Toast.LENGTH_SHORT).show();
} else {
chk = name+id;
FirebaseDatabase.getInstance().getReference().child("Groups").orderByChild("qery").equalTo(Insert.this.chk).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.getChildrenCount() > 0) {
Toast.makeText(Insert.this.getApplicationContext(), "Groupname Already Exist", Toast.LENGTH_SHORT).show();
}
else {
String userId = FirebaseAuth.getInstance().getCurrentUser().getUid();
user us = new user();
us.setId(Insert.this.id);
us.setName(Insert.this.name);
us.setQuery(Insert.this.chk);
Maa maa = new Maa();
maa.setId(Insert.this.id);
maa.setNnmm(Insert.this.name);
String que = Insert.this.name + Insert.this.id;
maa.setQery(que);
databaseReference.child("Groups").push().setValue(maa);
databaseReference.child("user").child(userId).push().setValue(us);
Toast.makeText(Insert.this.getApplicationContext(), "Group Created", 0).show();
String a = Insert.this.name + "mice";
Admin admin = new Admin();
admin.setAdmin(userId);
Insert.this.databaseReference.child("Admin").child(Insert.this.chk).push().setValue(admin);
Group_user_Id uid = new Group_user_Id();
uid.setUser_id(userId);
uid.setAdmin("Admin");
databaseReference.child("UserId").child(que + "mice").push().setValue(uid);
people p = new people();
p.setPop("Annoni");
Insert.this.databaseReference.child("grouppeople").child(a).push().setValue(p);
HashMap<String, String> token = new HashMap();
token.put("token", FirebaseInstanceId.getInstance().getToken());
databaseReference.child("Device_Token").child(Insert.this.chk).push().setValue(token);
Insert.this.startActivity(new Intent(Insert.this, contact.class));
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
});
}
}
| [
"[email protected]"
] | |
d1b81b4f53b0c3c9f476d08e3264226c1ba0751a | 0a245ca69b0596b87c8372c0e0422649a1997c5b | /android/app/src/main/java/com/speed2text/MainActivity.java | 16006259dd7b0121da28f2d81d578b87604ebe4d | [] | no_license | vinhph112/Speed2Text | 7a0de566351dcd749195072793241042277df4d4 | f67b2cdddcb881e4c4d534894c683e5554e9b9bd | refs/heads/master | 2020-04-10T07:58:30.048258 | 2018-12-08T02:04:01 | 2018-12-08T02:04:01 | 160,894,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.speed2text;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "Speed2Text";
}
}
| [
"[email protected]"
] | |
1bd82c44f19675e74fc6f8c2b31beeb8a0c0f775 | 0f775ae06f5be92cf7b9cde431708ba23ee10a40 | /src/main/java/org/perfcake/reporting/ReportingException.java | 667818361a57a82624c98e6a2da34dfadade5b20 | [
"Apache-2.0"
] | permissive | basovnik/PerfCake | 247037dfbcd34d93f47d54871436ca496d0900e3 | 2305232192c19286380954895210289960a563dd | refs/heads/master | 2021-01-17T03:37:23.623271 | 2014-06-20T09:33:06 | 2014-06-20T09:33:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | /*
* -----------------------------------------------------------------------\
* PerfCake
*
* Copyright (C) 2010 - 2013 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.perfcake.reporting;
import org.perfcake.PerfCakeException;
public class ReportingException extends PerfCakeException {
private static final long serialVersionUID = -4067480238483727264L;
public ReportingException(final String message, final Throwable cause) {
super(message, cause);
}
public ReportingException(final String message) {
super(message);
}
public ReportingException(final Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
] | |
eaca783fb312a726e8f112b7bb00dc30ec323bb3 | 89526885cb0e61507ce4e3c8034501b70efad114 | /src/GameBackEnd/Set.java | 9d23e6467a314a9a87b6472ca6371fed63cda4ca | [] | no_license | sheryanresutov/Set | 69d7ec34cbc861a5cc4e9302156862973a3e36ec | b610221fa097127ae719cf49543167dab786dca7 | refs/heads/master | 2020-05-21T12:08:37.819776 | 2015-05-05T15:18:24 | 2015-05-05T15:18:24 | 30,038,140 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 11,189 | 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 GameBackEnd;
import static GameBackEnd.GameLobby.playerCollection;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
/**
*
* @author Skorpion
*/
public class Set {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException, Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s;
while((s=in.readLine())!=null && (s.length() !=0)){
processMessage(s);
}
// TODO code application logic here
}
public static void processMessage(String message) throws Exception{
switch(message.substring(0,1)){
case "S":
{
String username, password;
int result;
String[] data = message.substring(1,message.length()).split("`");
username = data[0];
password = data[1];
result = GameLobby.enterLobby(username,password,false);
if(result >1){
System.out.println(result);
System.out.println("\t" + GameLobby.returnGames());
System.out.println("\t" + GameLobby.returnPlayers());
for(Map.Entry<Integer,Player> entry : GameLobby.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t"+GameLobby.returnPlayers());
}
}
else{
System.out.println(result);
System.out.println("I");
}
break;
}
case "R":
{
String username, password;
int result;
String[] data = message.substring(1,message.length()).split("`");
username = data[0];
password = data[1];
result = GameLobby.enterLobby(username,password,true);
System.out.println(result);
System.out.println("\t" + GameLobby.returnGames());
System.out.println("\t" + GameLobby.returnPlayers());
for(Map.Entry<Integer,Player> entry : GameLobby.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t"+GameLobby.returnPlayers());
}
break;
}
case "C":
{
String uid_s = message.substring(1,message.length());
int uid =Integer.parseInt(uid_s);
Game game = GameLobby.createGame(uid);
System.out.println(uid);
System.out.println("\t" + game.board.returnCardsOnBoard());
System.out.println("\t" + game.returnScoreBoard());
for(Map.Entry<Integer,Player> entry : GameLobby.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t" + GameLobby.returnGames());
}
break;
}
case "J":
{
String[] data = message.substring(1,message.length()).split("`");
int gid = Integer.parseInt(data[0]);
int uid = Integer.parseInt(data[1]);
GameLobby.joinGame(uid, gid);
Game game = GameLobby.findGame(gid);
System.out.println(uid);
System.out.println("\t" + game.board.returnCardsOnBoard());
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t" + game.returnScoreBoard());
}
for(Map.Entry<Integer,Player> entry : GameLobby.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t" + GameLobby.returnGames());
}
break;
}
case "D":
{
String[] data = message.substring(1,message.length()).split("`");
int gid = Integer.parseInt(data[0]);
int uid = Integer.parseInt(data[1]);
Game game = GameLobby.findGame(gid);
game.leave(uid);
GameLobby.db.updateUserScore(uid,game.findPlayer(uid).returnScore());
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t" + game.returnScoreBoard());
}
for(Map.Entry<Integer,Player> entry : GameLobby.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t" + GameLobby.returnGames());
}
break;
}
case "B":
{
String[] data = message.substring(1,message.length()).split("`");
int gid = Integer.parseInt(data[0]);
int uid = Integer.parseInt(data[1]);
Game game = GameLobby.findGame(gid);
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
if(entry.getKey()!=uid){
System.out.println(entry.getKey());
System.out.println("\t" + game.block(5));
}
}
game.setLock(uid);
break;
}
case "F":
{
String[] data = message.substring(1,message.length()).split("`");
int gid = Integer.parseInt(data[0]);
int uid = Integer.parseInt(data[1]);
Player player = GameLobby.findPlayer(uid);
player.decScore();
Game game = GameLobby.findGame(gid);
game.resetLock();
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t" + game.returnScoreBoard());
if(entry.getKey() == uid){
continue;
}
System.out.println("\t" + game.unblock());
}
break;
}
case "P":
{
String new_message="";
String[] data = message.substring(1,message.length()).split("`");
int gid = Integer.parseInt(data[0]);
int uid = Integer.parseInt(data[1]);
int c1 = Integer.parseInt(data[2]);
int c2 = Integer.parseInt(data[3]);
int c3 = Integer.parseInt(data[4]);
Game game = GameLobby.findGame(gid);
if(uid == game.lockOwner()){
new_message = game.onSubmit(uid, c1, c2, c3);
String[] cmds = new_message.split("*");
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
System.out.println(entry.getKey());
for (String cmd : cmds) {
System.out.println("\t" + cmd);
}
}
game.resetLock();
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
if(entry.getKey() == uid){
continue;
}
System.out.println(entry.getKey());
System.out.println("\t" + game.unblock());
}
}
break;
}
case "M":
{ int uid,gid;
String actual_msg;
if(message.substring(1,2) == "`"){
String[] data = message.substring(2,message.length()).split("`");
gid = Integer.parseInt(data[0]);
uid = Integer.parseInt(data[1]);
actual_msg = data[2];
Player player = GameLobby.findPlayer(uid);
Game game = GameLobby.findGame(gid);
for(Map.Entry<Integer,Player> entry : game.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t"+uid + " " + actual_msg);
}
}
else{
String[] data = message.substring(1,message.length()).split("`");
uid = Integer.parseInt(data[0]);
actual_msg = data[1];
for(Map.Entry<Integer,Player> entry : GameLobby.playerCollection.entrySet()){
System.out.println(entry.getKey());
System.out.println("\t"+uid + " " + actual_msg);
}
}
break;
}
case "L":
{
int uid;
uid = Integer.parseInt(message.substring(1,message.length()));
System.out.println(uid);
System.out.println(GameLobby.db.returnRankings());
break;
}
case "K":
{
int uid = Integer.parseInt(message.substring(1,message.length()));
GameLobby.delPlayer(uid);
System.out.println(uid);
System.out.println("\t Logged out" );
}
}
}
} | [
"[email protected]"
] | |
18049e76a0e32c9ef1568d6dbf04da723bcf56d0 | 9cab5c57a8e10890964d39f1d55a1ae599f2f414 | /springcloud_eurekaserver/src/main/java/hkdpp/EurekaServerApp.java | d6be23641fe58a6675adcc83b112b8682025ba81 | [] | no_license | Z120553-hk/springcloud_parent | 4ce524e74eee5559fcb5589105012e857f049236 | d26cc1cbc1625358bc2964a876d09831affd3b82 | refs/heads/master | 2020-09-29T10:05:41.683869 | 2019-12-11T01:49:48 | 2019-12-11T01:49:48 | 227,015,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package hkdpp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer // EurekaServer服务器端启动类,接受其它微服务注册进来
public class EurekaServerApp {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApp.class, args);
}
}
| [
"[email protected]"
] | |
d485cc9ec91955fa1ffefbc3bfba23c484a38834 | c0aa17ccb7820d7eccdadedeb7a0647ca8f21aad | /src/model/dao/DeparmentDao.java | f6d1570aef5e5538be3553fa9ebcfb358d69ce7e | [] | no_license | Jmslima25/demo-dao-jdbc | b0d4828371263b3fad2f1e49ed93b61c16cd697d | 76ad75d49f27744627e7b26a794bf6dc44af2074 | refs/heads/master | 2020-09-28T21:26:00.129710 | 2019-12-14T20:30:54 | 2019-12-14T20:30:54 | 226,868,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package model.dao;
import java.util.List;
import model.entities.Department;
public interface DeparmentDao {
void insert(Department obj);
void uptade(Department obj);
void deleteById(Integer id);
Department findById(Integer id);
List<Department> FindAll();
}
| [
"[email protected]"
] | |
68f60b17db7314a053daa71ccfd04c416983c142 | bce39f9cbd37b2f77eab3a29d025917da085df58 | /chapter_004/src/main/java/ru/job4j/depthofmarket/Input.java | 92398c31a04babf270311b23d82f0f9b996bd49a | [
"Apache-2.0"
] | permissive | SirenOfOludeniz/edyachkova | b8e4270c30fe931d49bbd47056d1c2eadd4cc70b | e09e8cec67a7be8ceafeb5164b83b52fe14c4e93 | refs/heads/master | 2021-01-23T05:56:06.749446 | 2018-12-28T20:38:41 | 2018-12-28T20:38:41 | 102,482,354 | 0 | 1 | Apache-2.0 | 2018-04-07T23:48:54 | 2017-09-05T13:07:09 | Java | UTF-8 | Java | false | false | 148 | java | package ru.job4j.depthofmarket;
public interface Input {
public String actionString(String choice);
public int actionInt(String choice);
}
| [
"[email protected]"
] | |
d5e0cc290f97d4be2633e44e7b35307e784ab933 | caaffff72d43cc31a5de6746429d32c989685c7c | /net.jplugin.ext.filesvr/src/net/jplugin/ext/filesvr/api/FileCreatedEvent.java | 9da75ea65f0a378f9fb884efcd303d434a5e9bc7 | [] | no_license | iamlibo/jplugin | 8c0ebf3328bdb90d7db80606d46453778c25f4f4 | 4f8b65dd285f986a3c54b701a25fabca3bba5ed9 | refs/heads/master | 2021-01-12T02:10:35.903062 | 2016-12-08T12:42:33 | 2016-12-08T12:42:33 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 620 | java | package net.jplugin.ext.filesvr.api;
import net.jplugin.core.event.api.Event;
import net.jplugin.ext.filesvr.db.DBCloudFile;
/**
*
* @author: LiuHang
* @version 创建时间:2015-2-18 下午08:27:01
**/
public class FileCreatedEvent extends Event{
public static final String ET_FILE_CREATED = "FileCreated";
public static final String IMAGE_EVENT_ALIAS = "ImgFileCreated";
private DBCloudFile file;
/**
* @param cf
*/
public FileCreatedEvent(DBCloudFile cf) {
super(ET_FILE_CREATED);
this.file = cf;
}
public DBCloudFile getFile() {
return file;
}
}
| [
"[email protected]"
] | |
0494e7ef54b552f1f04cf571e33e853aa57ae241 | e41684e18c1703ea51a8874772c0424e0dbe4bd9 | /Day12.java | 54354166def7f90d027d131dad9de5cdc42bb4c4 | [] | no_license | ondaapotekaren/javaFiles | 588296a9c9555eae85716bec4cc2bddab66d21dc | 0e32c514620d591447203c37a5f08fdcc9af9a49 | refs/heads/master | 2020-03-27T02:55:59.614790 | 2018-09-24T14:50:35 | 2018-09-24T14:50:35 | 145,826,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,563 | java | import java.util.*;
import java.io.*;
public class Day12 {
public static List<Integer> createGroup(Integer input) {
List<Integer> group = new ArrayList<Integer>();
int index = 0;
group.add(input);
while(index < group.size()){
for(Integer i : graph.get(group.get(index))) {
boolean inGroup = false;
for(Integer j : group) {
if ((int)i == (int)j){
inGroup = true;
break;
}
}
if(!inGroup) {
group.add(i);
}
}
index++;
}
return group;
}
static List<List<Integer>> graph = new LinkedList<List<Integer>>();
public static void main(String[] args){
for(int i= 0;i<2000;i++) {
ArrayList<Integer> a = new ArrayList<Integer>();
graph.add(a);
}
try(BufferedReader br = new BufferedReader(new FileReader("./"+args[0]))) {
String line;
while((line = br.readLine()) != null ) {
String[] splitList = line.split(" <-> " );
for (String s : splitList[1].split(", ")) {
graph.get( (int)Integer.parseInt(splitList[0]) )
.add( (int)Integer.parseInt(s) );
}
}
} catch (Exception e ) {
e.printStackTrace();
}
List<List<Integer>> groupList = new LinkedList<List<Integer>>();
for(int i = 0;i<graph.size();i++) {
boolean inGroup = false;
for(List<Integer> l : groupList)
for(Integer j : l) {
if ((int) i == (int) j) {
inGroup = true;
}
}
if(!inGroup) {
groupList.add(createGroup(i));
}
}
System.out.println("Part A: "+groupList.get(0).size());
System.out.println("Part B: "+groupList.size());
}
}
| [
"[email protected]"
] | |
d4072ec006720984e3c0107d46986a24b77123d0 | 07fc5aea88293acedc45d58264e34388a88d6262 | /src/GetMinimumFromIntegerList.java | db6f4438979217fb89a59f2cdc933745c9e05c61 | [] | no_license | cojocariv/javaStudy | 83354155ac188a1d649e76bc8574a15176ca35d3 | 443157b62e4967797826cd454a9522a27a4ba516 | refs/heads/master | 2020-06-18T17:10:43.113498 | 2019-08-17T10:59:34 | 2019-08-17T10:59:34 | 196,376,889 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | import javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Predicate;
public class GetMinimumFromIntegerList {
public static void main(String[] args) throws IOException {
List<Integer> integerList = getIntegerList();
System.out.println(getMinimum(integerList));
}
public static int getMinimum(List<Integer> array) {
// Найти минимум тут
return Collections.min(array);
}
public static List<Integer> getIntegerList() throws IOException {
// Создать и заполнить список тут
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine());
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
list.add(Integer.parseInt(reader.readLine()));
}
Collections.sort(list);
return list;
}
}
| [
"[email protected]"
] | |
92095307170cf5aa6ce3641a932436df8b58f246 | 4988e11f1112b99b926a87aa9c75d451da707d80 | /src/test/java/test/Test.java | 76f735d7dc30eac0d1166ce2c931f9284103d36d | [] | no_license | aaronytt/ytt_aaron | 4c9e59d737c5a0b3794f5c3c306d2cef621182af | f1cef9b16e33998a041ddabeaf762e8f513ee65c | refs/heads/master | 2021-10-09T23:45:56.194071 | 2018-01-15T08:53:54 | 2018-01-15T08:53:54 | 111,082,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package test;
import com.ytt.mapper.MemberMapper;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@Transactional
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/config/spring/spring-mybatis.xml"})
public class Test {
@Autowired
MemberMapper memberMapper;
@org.junit.Test
public void test(){
List<Map<String,Object>> list = memberMapper.selectAll();
System.out.println(list);
}
}
| [
"[email protected]"
] | |
059f7e582cc934f8b257e190f65ecef484ea27cf | ee921efb681804cf4da100e957c045cbbb1c559f | /src/com/ssm/exception/divisionException.java | 51c98d399ffc9f2073a172ad5aeb348605bb9442 | [] | no_license | meizhenhao/ssm05 | 4c71c1498739cd19f995ac3ea0303fced384d3c1 | 4f8930903fc0d48679982825361428b7c1dadb42 | refs/heads/master | 2020-04-12T22:12:19.147466 | 2018-12-22T05:32:47 | 2018-12-22T05:32:47 | 162,784,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.ssm.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value=HttpStatus.NOT_FOUND , reason="除数不能为0!")
public class divisionException extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = 1L;
}
| [
"[email protected]"
] | |
20e04beeba4c32967d799e090e0da2ae4f3e332e | f86938ea6307bf6d1d89a07b5b5f9e360673d9b8 | /CodeComment_Data/Code_Jam/train/Speaking_in_Tongues/S/A(280).java | 480c270e22b4a4a374af50d9f11ab792909ea5fc | [] | no_license | yxh-y/code_comment_generation | 8367b355195a8828a27aac92b3c738564587d36f | 2c7bec36dd0c397eb51ee5bd77c94fa9689575fa | refs/heads/master | 2021-09-28T18:52:40.660282 | 2018-11-19T14:54:56 | 2018-11-19T14:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,575 | java | package methodEmbedding.Speaking_in_Tongues.S.LYD387;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws Exception {
String s[] = {"ejp mysljylc kd kxveddknmc re jsicpdrysi", "rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd", "de kr kd eoya kw aej tysr re ujdr lkgc jv"};
String m[] = {"our language is impossible to understand", "there are twenty six factorial possibilities", "so it is okay if you want to just give up"
};
HashMap<Character, Character> h = new HashMap<Character, Character>();
h.put('z', 'q');
h.put('q', 'z');
for (int i = 0; i < 3; i++) {
String st=s[i];
String mt=m[i];
for (int j = 0; j < mt.length(); j++) {
h.put(st.charAt(j), mt.charAt(j));
}
}
BufferedReader in = new BufferedReader(new FileReader("A-small-attempt1.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("A-small-attempt1.out")));
int t = Integer.parseInt(in.readLine());
for (int q = 1; q <= t; q++) {
String st=in.readLine();
out.write("Case #"+q+": ");
for (int i = 0; i <st.length(); i++) {
out.write(h.get(st.charAt(i)));
}
out.write("\n");
}
out.close();
}
}
| [
"[email protected]"
] | |
9b1771ed0891c14777319cfb860bb35a3493a13b | ce0dd10579f95f3c99e3495b9f17f76aaf350286 | /emily-spring-boot-redis/src/main/java/com/emily/infrastructure/datasource/redis/factory/RedisDbConfigurationFactory.java | d033b98738b402c6a43930d7694e2208303c279c | [] | no_license | Lu-Lucifer/spring-parent | e12ce70e2cb08253f3f443fffa05a31dbaaae76b | 24bc755ad4185ca1a6ea97369bbb469ed3b96499 | refs/heads/master | 2023-07-28T00:51:24.355810 | 2021-09-13T03:30:58 | 2021-09-13T03:30:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,292 | java | package com.emily.infrastructure.datasource.redis.factory;
import com.emily.infrastructure.datasource.redis.entity.ConnectionInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.data.redis.connection.*;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @program: spring-parent
* @description: RedisConfiguration工厂配置类
* @author: Emily
* @create: 2021/07/11
*/
public class RedisDbConfigurationFactory {
private static final Logger logger = LoggerFactory.getLogger(RedisDbConfigurationFactory.class);
private static final RedisDbConfigurationFactory INSTANCE = new RedisDbConfigurationFactory();
/**
* 获取Redis配置
*
* @param properties
* @return
*/
public static RedisConfiguration createRedisConfiguration(RedisProperties properties) {
if (INSTANCE.getSentinelConfig(properties) != null) {
return INSTANCE.getSentinelConfig(properties);
}
if (INSTANCE.getClusterConfiguration(properties) != null) {
return INSTANCE.getClusterConfiguration(properties);
}
return INSTANCE.getStandaloneConfig(properties);
}
/**
* 创建单机配置
*/
private final RedisStandaloneConfiguration getStandaloneConfig(RedisProperties properties) {
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
if (StringUtils.hasText(properties.getUrl())) {
ConnectionInfo connectionInfo = ConnectionInfo.parseUrl(properties.getUrl());
config.setHostName(connectionInfo.getHostName());
config.setPort(connectionInfo.getPort());
config.setUsername(connectionInfo.getUsername());
config.setPassword(RedisPassword.of(connectionInfo.getPassword()));
} else {
config.setHostName(properties.getHost());
config.setPort(properties.getPort());
config.setUsername(properties.getUsername());
config.setPassword(RedisPassword.of(properties.getPassword()));
}
config.setDatabase(properties.getDatabase());
logger.info("初始化Redis单机连接配置-{}:{}", config.getHostName(), config.getPort());
return config;
}
/**
* 创建哨兵配置RedisSentinelConfiguration
*/
private final RedisSentinelConfiguration getSentinelConfig(RedisProperties properties) {
RedisProperties.Sentinel sentinelProperties = properties.getSentinel();
if (sentinelProperties != null) {
RedisSentinelConfiguration config = new RedisSentinelConfiguration();
// Redis服务器名称
config.master(sentinelProperties.getMaster());
// 哨兵sentinel "host:port"节点配置
config.setSentinels(createSentinels(sentinelProperties));
// Redis服务器登录名
config.setUsername(properties.getUsername());
// Redis服务器登录密码
if (properties.getPassword() != null) {
config.setPassword(RedisPassword.of(properties.getPassword()));
}
// 哨兵sentinel进行身份验证的密码
if (sentinelProperties.getPassword() != null) {
config.setSentinelPassword(RedisPassword.of(sentinelProperties.getPassword()));
}
// 连接工厂使用的数据库索引
config.setDatabase(properties.getDatabase());
return config;
}
return null;
}
/**
* 创建RedisClusterConfiguration集群配置
*/
private final RedisClusterConfiguration getClusterConfiguration(RedisProperties properties) {
if (properties.getCluster() == null) {
return null;
}
RedisProperties.Cluster clusterProperties = properties.getCluster();
RedisClusterConfiguration config = new RedisClusterConfiguration(clusterProperties.getNodes());
if (clusterProperties.getMaxRedirects() != null) {
config.setMaxRedirects(clusterProperties.getMaxRedirects());
}
config.setUsername(properties.getUsername());
if (properties.getPassword() != null) {
config.setPassword(RedisPassword.of(properties.getPassword()));
}
return config;
}
/**
* 哨兵节点配置转换
*
* @param sentinel 哨兵配置对象
* @return
*/
private List<RedisNode> createSentinels(RedisProperties.Sentinel sentinel) {
List<RedisNode> nodes = new ArrayList<>();
for (String node : sentinel.getNodes()) {
try {
logger.info("初始化Redis哨兵连接配置-{}", node);
String[] parts = StringUtils.split(node, ":");
Assert.state(parts.length == 2, "Must be defined as 'host:port'");
nodes.add(new RedisNode(parts[0], Integer.parseInt(parts[1])));
} catch (RuntimeException ex) {
throw new IllegalStateException("Invalid redis sentinel property '" + node + "'", ex);
}
}
return nodes;
}
}
| [
"[email protected]"
] | |
5f429c18d08aad1745ef8dda2ab2935e432dc8f6 | 2b8e66c1093b93ff441aeace89a4e632b60df8a3 | /src/opcodes/LI.java | bc19628a9b585a9bb42a79b48699708167a77fdb | [] | no_license | SailakshmiPisupati/ScoreBoardSimulator | da1f785db2a733e606d2cd84b85fd900c9c2064a | 2cdc38722661777100df3cf863d1097e68b44ddf | refs/heads/master | 2021-03-27T15:39:39.523910 | 2017-07-19T19:53:19 | 2017-07-19T19:53:19 | 89,628,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | package opcodes;
import java.util.ArrayList;
import operands.*;
public class LI extends Instruction{
Register registerOperand;
Immediates immediateOperand;
public LI(Register ro, Immediates io) {
this.registerOperand = ro;
this.immediateOperand = io;
}
@Override
public void writeToRegister() throws Exception {
System.out.println("Immediate operand "+immediateOperand.getValue());
registerOperand.setValue(immediateOperand.getValue());
System.out.println("Register value "+registerOperand.getValue());
}
@Override
public void execute() {
// Do Nothing
}
@Override
public Register getDestinationRegister() throws Exception {
return this.registerOperand;
}
@Override
public ArrayList<Register> getSourceRegisters() throws Exception {
ArrayList<Register> sourceRegisterList = new ArrayList<Register>();
return sourceRegisterList;
}
@Override
public Memory getMemory() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public Immediates getImmediates() throws Exception {
return this.immediateOperand;
}
} | [
"[email protected]"
] | |
712ca17616c8b509c7a47bc6178e391727519ba1 | de1f1d1ca767ee4f680b684ed7eedffc5e3891d8 | /app/src/main/java/com/felipecsl/asymmetricgridview/AGVRecyclerViewAdapter.java | d604c4a500b366510f03d774bb68b7f39d00d29e | [] | no_license | huangliliu0917/taoke_android | 7048df12c634b99627f72ac9e6726eac0975d961 | ca33911215d920c12ca24b6222f3e7755b69e025 | refs/heads/master | 2020-04-07T10:14:43.073845 | 2018-02-13T06:23:59 | 2018-02-13T06:23:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package com.felipecsl.asymmetricgridview;
import android.support.v7.widget.RecyclerView;
public abstract class AGVRecyclerViewAdapter<VH extends RecyclerView.ViewHolder>
extends RecyclerView.Adapter<VH> {
public abstract AsymmetricItem getItem(int position);
}
| [
"[email protected]"
] | |
e5eac8249c342bfef48dec6ae654a95a16963164 | 19b0ddc45e90a6d938bacc65648d805a941fc90d | /Server/InformationAcquisition/src/jma/test/TestCheckInstinctAntiFraudHandler.java | a27c118bd88a8eb267e044c43a7727afc6a89339 | [] | no_license | dachengzi-software/ap | bec5371a4004eb318258646a7e34fc0352e641c2 | ccca3d6c4fb86a698a064c3005eba2b405e8d822 | refs/heads/master | 2021-12-23T09:26:24.595456 | 2017-11-10T02:33:18 | 2017-11-10T02:33:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package jma.test;
import instinct.service.model.InstinctResult;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import core.InstinctOnlineJudge;
import jma.Configuration;
import jma.RetryRequiredException;
import jma.handlers.AbstractCheckInstinctAntiFraudHandler;
import catfish.base.Logger;
import catfish.base.StartupConfig;
import catfish.base.httpclient.HttpClientConfig;
import catfish.base.queue.QueueApi;
public class TestCheckInstinctAntiFraudHandler {
public static void main(String[] args) {
// TODO Auto-generated method stub
StartupConfig.initialize();
Logger.initialize();
Configuration.readConfiguration();
HttpClientConfig.initialize();
sendViaMqs();
}
static void sendViaMqs() {
Map<String, String> iaMessage = new HashMap<String, String>();
iaMessage.put("appId", "6CF93FBD-A582-E511-ACD8-AC853D9F5508");
iaMessage.put("jobName", "CheckInstinctAntiFraudFinal");
// iaMessage.put("jobStatus", "InstinctCallBack");
// iaMessage.put("handle", "K");
String messageBody = new Gson().toJson(iaMessage);
//QueueApi.ensureQueueExist("JobRequestQueue", 30L);
QueueApi.writeMessage("JobRequestQueue", messageBody, 1, 0);
}
}
| [
"[email protected]"
] | |
d401f810daacbd970797f24f769d519615cdec67 | 6c44cf810fa29a3d83dbc0ee96cae1dc1b6d7f21 | /jfxvnc-swing/src/main/java/org/jfxvnc/swing/PointerEventHandler.java | 6a5d962178d96011533c67fc236098402ff54e46 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"CC-PDDC",
"LGPL-2.1-only",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | comtel2000/jfxvnc | 7cddc420e31409cf523a428ad784017a2ff608dc | 1f6f3b51ea561294d127a1e9dea5b2b06e6fa288 | refs/heads/master | 2023-08-23T08:52:34.563028 | 2021-07-06T21:04:10 | 2021-07-06T21:04:10 | 30,330,883 | 52 | 24 | Apache-2.0 | 2023-01-16T11:05:26 | 2015-02-05T01:20:56 | Java | UTF-8 | Java | false | false | 4,801 | java | /*******************************************************************************
* Copyright (c) 2016 comtel inc.
*
* Licensed under the Apache License, version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
package org.jfxvnc.swing;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.JComponent;
import org.jfxvnc.net.rfb.codec.encoder.InputEventListener;
import org.jfxvnc.net.rfb.codec.encoder.KeyButtonMap;
import org.jfxvnc.net.rfb.codec.encoder.PointerEvent;
import javafx.beans.property.DoubleProperty;
public class PointerEventHandler implements KeyButtonMap {
private double zoomLevel = 1.0;
private InputEventListener listener;
private volatile boolean enabled = true;
private final MouseMotionListener mouseMotionEventHandler;
private final MouseListener mouseEventHandler;
private final MouseWheelListener mouseWheelEventHandler;
private int xPos;
private int yPos;
public PointerEventHandler() {
mouseMotionEventHandler = new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
@Override
public void mouseDragged(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
};
mouseEventHandler = new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
@Override
public void mousePressed(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
@Override
public void mouseExited(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
@Override
public void mouseEntered(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
@Override
public void mouseClicked(MouseEvent e) {
if (enabled) {
sendMouseEvents(e);
e.consume();
}
}
};
mouseWheelEventHandler = (e) -> {
if (enabled) {
sendScrollEvents(e);
e.consume();
}
};
}
public void setInputEventListener(InputEventListener listener) {
this.listener = listener;
}
public void setEnabled(boolean ena) {
enabled = ena;
}
public void registerZoomLevel(DoubleProperty zoom) {
zoom.addListener(l -> zoomLevel = zoom.get());
}
public void register(JComponent node) {
node.addMouseMotionListener(mouseMotionEventHandler);
node.addMouseListener(mouseEventHandler);
node.addMouseWheelListener(mouseWheelEventHandler);
}
public void unregister(JComponent node) {
node.removeMouseMotionListener(mouseMotionEventHandler);
node.removeMouseListener(mouseEventHandler);
node.removeMouseWheelListener(mouseWheelEventHandler);
}
private void sendMouseEvents(MouseEvent event) {
xPos = (int) Math.floor(event.getX() / zoomLevel);
yPos = (int) Math.floor(event.getY() / zoomLevel);
byte buttonMask = 0;
if (event.getID() == MouseEvent.MOUSE_PRESSED || event.getID() == MouseEvent.MOUSE_DRAGGED) {
if (event.getButton() == MouseEvent.BUTTON2) {
buttonMask = 2;
} else if (event.getButton() == MouseEvent.BUTTON3) {
buttonMask = 4;
} else {
buttonMask = 1;
}
fire(new PointerEvent(buttonMask, xPos, yPos));
} else if (event.getID() == MouseEvent.MOUSE_RELEASED || event.getID() == MouseEvent.MOUSE_MOVED) {
buttonMask = 0;
}
fire(new PointerEvent(buttonMask, xPos, yPos));
}
private void sendScrollEvents(MouseWheelEvent event) {
fire(new PointerEvent(event.getWheelRotation() > 0 ? (byte) 8 : (byte) 16, (int) Math.floor(event.getX() / zoomLevel),
(int) Math.floor(event.getY() / zoomLevel)));
}
private synchronized void fire(PointerEvent msg) {
if (listener != null) {
listener.sendInputEvent(msg);
}
}
}
| [
"[email protected]"
] | |
9f4ac7209e8ba3db355736dfbbde059fe7342572 | 00a16e9a63fa6bbdbe18c4b7f7ff2ca894829f89 | /controller/Symbol.java | 57b7535d38fdd7374c9bd5bb8452d14b58ad8e2c | [] | no_license | marsmallowed/Zootopia | 950ad52aefcd6fc374d6c30fa7f5563271805da0 | 9cbf98b29b4647dcdb40b402e261123daac4df9e | refs/heads/master | 2021-01-10T07:18:01.893850 | 2016-04-06T16:51:23 | 2016-04-06T16:51:23 | 54,219,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | package controller;
public class Symbol
{
private String name;
private Datatype datatype;
private Object value;
private Scope scope; //owning scope
public Symbol(String name, Datatype datatype, Object value)
{
this.name = name;
this.datatype = datatype;
this.value = value;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public Datatype getDatatype()
{
return datatype;
}
public void setDatatype(Datatype datatype)
{
this.datatype = datatype;
}
public Object getValue()
{
return value;
}
public void setValue(Object value)
{
this.value = value;
}
public Scope getScope()
{
return scope;
}
public void setScope(Scope scope)
{
this.scope = scope;
}
public String toString()
{
if(datatype != null)
return "<" + name + ":" + datatype + ">";
return name;
}
}
| [
"[email protected]"
] | |
cf05ac681d144c42f80a027649a76c8d8ebf5415 | 69e36639faba0b7b7fde6ad231025cf570ef1a45 | /src/main/java/com/crud/tasks/TasksApplication.java | 6b1a0866d7196cac12440a2d8341614427f691f4 | [] | no_license | godyn/aleksandra-godyn-kodilla-rest-API-tasks | 128e4bc68a0a68d168ef292c23e05a408a1954f1 | 7581aec12f50ba60985fd54b98ac3454ae0f4d57 | refs/heads/master | 2020-05-15T01:56:27.718144 | 2019-07-18T12:38:32 | 2019-07-18T12:38:32 | 182,040,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.crud.tasks;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
//public class TasksApplication extends SpringBootServletInitializer {
public class TasksApplication{
public static void main(String[] args) {
SpringApplication.run(TasksApplication.class, args);
}
/*
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
return application.sources(TasksApplication.class);
}
*/
}
| [
"[email protected]"
] | |
ce31d311e3ddbc04c57cdc775cd9b0e0acf5e390 | e30e919897cf508fec0fe7b9b79782aed654ca4e | /app/src/main/java/roshaan/mapapp/MapActivity.java | 92a40ef5a25aa2bb3a11967af9dea52328cc5fe1 | [] | no_license | Roshaanf/MapApp | d71d3585bacede400d5c3ae3fa231d2b2f9e91c6 | bdf07b02d283a05928c0cf6a59cca565b14b47b1 | refs/heads/master | 2021-08-31T14:48:09.269186 | 2017-12-21T19:11:18 | 2017-12-21T19:11:18 | 115,038,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,641 | java | package roshaan.mapapp;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.location.Geocoder;
import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.google.android.gms.identity.intents.Address;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.identity.intents.Address;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class MapActivity extends AppCompatActivity implements OnMapReadyCallback, LocationListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
GoogleMap mGoogleMap;
GoogleApiClient mGoogleApiClient;
Marker marker1;
Marker marker2;
Marker marker3;
SharedPreferences shared;
SharedPreferences.Editor editor;
DatabaseReference mDatabaseReference;
FirebaseAuth mAuth;
int counter=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//checking if playservices available in mobile
if (googleServiceAvailable()) {
setContentView(R.layout.activity_map);
// Toast.makeText(this, "Perfeccty working", Toast.LENGTH_SHORT).show();
mAuth=FirebaseAuth.getInstance();
mDatabaseReference=FirebaseDatabase.getInstance().getReference()
.child("Routes")
.child(mAuth.getCurrentUser().getUid());
initMap();
databaseListener(mDatabaseReference);
shared = getSharedPreferences("markers", Context.MODE_PRIVATE);
editor = shared.edit();
} else {
//No Google Maps Layput
}
}
//this method will checck if the mobile on which application is running haave google play services available
public boolean googleServiceAvailable() {
GoogleApiAvailability api = GoogleApiAvailability.getInstance();
//now checking if it is available
int isAvailable = api.isGooglePlayServicesAvailable(this);
//if is available
if (isAvailable == ConnectionResult.SUCCESS) {
return true;
}
//if device is capable of installing play services but somthing happpend which is not allowing
else if (api.isUserResolvableError(isAvailable)) {
Dialog dialog = api.getErrorDialog(this, isAvailable, 0);
dialog.show();
}
//play services cant be installed on device
else {
Toast.makeText(this, "Cant connect to play services", Toast.LENGTH_LONG).show();
}
return false;
}
private void initMap() {
System.out.println("not");
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.mapFragment);
//load map
mapFragment.getMapAsync(this);
}
//ye he asal method yhn sy strt hga sb
@Override
public void onMapReady(GoogleMap googleMap) {
System.out.println("reay");
mGoogleMap = googleMap;
//to open map with latitude and longitude of my choice
// goToLocationZoom(29.320221, 68.291436,9);
// if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// // TODO: Consider calling
// // ActivityCompat#requestPermissions
// // here to request the missing permissions, and then overriding
// // public void onRequestPermissionsResult(int requestCode, String[] permissions,
// // int[] grantResults)
// // to handle the case where the user grants the permission. See the documentation
// // for ActivityCompat#requestPermissions for more details.
// return;
// }
// mGoogleMap.setMyLocationEnabled(true);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mGoogleApiClient.connect();
}
private void goToLocation(double v, double i) {
LatLng ll = new LatLng(v, i);
CameraUpdate update = CameraUpdateFactory.newLatLng(ll);
mGoogleMap.moveCamera(update);
}
private void goToLocationZoom(double v, double i, int zoom) {
LatLng ll = new LatLng(v, i);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, zoom);
mGoogleMap.moveCamera(update);
}
LocationRequest mLocationRequest;
@Override
public void onConnected(@Nullable Bundle bundle) {
mLocationRequest = LocationRequest.create();
//kis tarhan kiservice chaiye high accuracy zyada battery leti he
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
//ktni der k baad location cahiye
mLocationRequest.setInterval(1000);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
Polyline line;
// Marker marker1;
// Marker marker2;
// Marker marker3;
//this method will be called when the location is changed
//and we will get our new location inside this method
@Override
public void onLocationChanged(Location location) {
if (location == null) {
Toast.makeText(this, "Cant get current location", Toast.LENGTH_SHORT).show();
} else {
LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
// // CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, 15);
//to get the name of locality
Geocoder gc = new Geocoder(this);
List<android.location.Address> list = null;
String locality = null;
try {
list = gc.getFromLocation(ll.latitude, ll.longitude, 1);
android.location.Address address = list.get(0);
locality = address.getSubLocality();
} catch (IOException e) {
e.printStackTrace();
}
//to get locality name ends here///////////
//putting data into database
RouteModel model=new RouteModel(String.valueOf(ll.longitude)
,String.valueOf(ll.latitude)
,String.valueOf(locality));
String pushKey=mDatabaseReference.push().getKey();
mDatabaseReference.child(pushKey).setValue(model);
//
}
}
private void drawLine(Marker m1, Marker m2) {
PolylineOptions options = new PolylineOptions()
.add(m1.getPosition())
.add(m2.getPosition())
.color(Color.RED)
.width(5);
mGoogleMap.addPolyline(options);
}
@Override
protected void onStop() {
super.onStop();
editor.apply();
}
public void logoutClicked(View v) {
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(this, Login.class));
finish();
}
void databaseListener(DatabaseReference ref){
ref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
counter++;
// CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, 15);
// mGoogleMap.animateCamera(update);
RouteModel model=dataSnapshot.getValue(RouteModel.class);
//updating camera
LatLng ll = new LatLng(Double.parseDouble(model.getLatitude()),
Double.parseDouble(model.getLongitude()));
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, 15);
mGoogleMap.animateCamera(update);
//updating marker
MarkerOptions options = new MarkerOptions()
.title(String.valueOf(counter))
.position(ll)
.snippet(String.valueOf(model.getLocation()));
Marker marker = mGoogleMap.addMarker(options);
if(marker1==null){
marker1=marker;
}
else{
drawLine(marker1, marker);
marker1=marker;
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
| [
"[email protected]"
] | |
a13bb0b3cfa9aaefc726123d85ce9342a02ef9f0 | 09891aaff36ef0db918828a1382041cce1e136e3 | /src/main/java/ofx/RecurringIntraCancellationRequest.java | 43ae9983f2229fb29975554784afc2bd3b80164a | [] | no_license | proyleg/InvestiaGenOFX2_mv | 7f01555282b094581ae773421b23b3cae8656723 | 4d5524717067f66c1bec2d0702fbb8e448588611 | refs/heads/master | 2021-01-20T03:21:46.991208 | 2018-12-18T14:48:04 | 2018-12-18T14:48:04 | 89,526,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,720 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.12.12 at 04:58:05 PM EST
//
package ofx;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* The OFX element "RECINTRACANRQ" is of type "RecurringIntraCancellationRequest"
*
*
* <p>Java class for RecurringIntraCancellationRequest complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="RecurringIntraCancellationRequest">
* <complexContent>
* <extension base="{http://ofx.net/types/2003/04}AbstractRecurringIntraRequest">
* <sequence>
* <element name="RECSRVRTID" type="{http://ofx.net/types/2003/04}ServerIdType"/>
* <element name="CANPENDING" type="{http://ofx.net/types/2003/04}BooleanType"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RecurringIntraCancellationRequest", propOrder = {
"recsrvrtid",
"canpending"
})
public class RecurringIntraCancellationRequest
extends AbstractRecurringIntraRequest
{
@XmlElement(name = "RECSRVRTID", required = true)
protected String recsrvrtid;
@XmlElement(name = "CANPENDING", required = true)
protected BooleanType canpending;
/**
* Gets the value of the recsrvrtid property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRECSRVRTID() {
return recsrvrtid;
}
/**
* Sets the value of the recsrvrtid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRECSRVRTID(String value) {
this.recsrvrtid = value;
}
/**
* Gets the value of the canpending property.
*
* @return
* possible object is
* {@link BooleanType }
*
*/
public BooleanType getCANPENDING() {
return canpending;
}
/**
* Sets the value of the canpending property.
*
* @param value
* allowed object is
* {@link BooleanType }
*
*/
public void setCANPENDING(BooleanType value) {
this.canpending = value;
}
}
| [
"[email protected]"
] | |
7abdd9c32120c23a93be39f71d45f968c2276a51 | 30a0c3c34f265bb4b5520f326641f27b0420d262 | /Web_Attend/com/register/Register.java | 0fa4e73a0528d34278b0746ded08a644b50f6dc0 | [] | no_license | Nilesh015/WebBasedAttendanceApp | 5fc48758028571269fe169892a97159f8b77cb4a | 862df702853cc3bc2e39357585c175ea28ee3a67 | refs/heads/master | 2021-06-23T07:35:27.022382 | 2021-01-06T17:01:14 | 2021-01-06T17:01:14 | 178,254,751 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,463 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.register;
import com.login.dao.CheckingDao;
import com.login.dao.RegisterDao;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import JFrames.registersuccess;
import JFrames.registerfailure;
/**
*
* @author Hp
*/
@WebServlet(name = "Register", urlPatterns = {"/Register"})
public class Register extends HttpServlet {
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
String name = request.getParameter("name");
String roll = request.getParameter("roll");
String department = request.getParameter("dep");
String uname = request.getParameter("uname");
String pass = request.getParameter("pass");
String type = request.getParameter("type");
HttpSession session = request.getSession();
//session.removeAttribute("username");
CheckingDao cd = new CheckingDao();
if(cd.registerCheck(roll, uname, type) == 1)
{
out.println("<script type=\"text/javascript\">");
out.println("alert('Either username or roll no already used');");
out.println("location='register.jsp';");
out.println("</script>");
}
else
{
RegisterDao dao = new RegisterDao();
dao.insertData(name,roll,department,uname,pass,type);
response.sendRedirect("registerSuccess.jsp");
}
}
}
| [
"[email protected]"
] | |
27dfa44dfdefb24802d165ad162ab6a3af2584a7 | aff24e30e543695f90e39aa2c89b63c933ef77c4 | /android/app/src/main/java/com/awesomeproject/utils/IntentUtil.java | bc87a01132ad78bbc350828f58e746d316929f51 | [] | no_license | heqinglin8/RNAppProject | 8a0dc55b29b54f4165c3490c14b7dbc09cdb8ce8 | 230e630b1f10964579a4e055c6723dd5afb89934 | refs/heads/master | 2020-04-06T03:32:14.501494 | 2016-07-24T16:36:38 | 2016-07-24T16:36:38 | 61,108,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,953 | java | package com.awesomeproject.utils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.awesomeproject.activitys.SplashActivity;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.stetho.common.LogUtil;
public class IntentUtil extends ReactContextBaseJavaModule {
private static String packageName = "com.cubic.autohome";
public IntentUtil(ReactApplicationContext reactContext) {
super(reactContext);
}
@Override
public String getName() {
return "IntentUtil";
}
@ReactMethod
public void intentTo() {
LogUtil.i("IntentUtil","intentTo");
// Toast.makeText(getReactApplicationContext(),"intentTo",Toast.LENGTH_LONG).show();
Context mContext = getReactApplicationContext();
Intent intent = new Intent(getReactApplicationContext(),SplashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
@ReactMethod
public void opendActivityByUrl(String url) {
LogUtil.i("uri:",url);
Activity currentActivity = getCurrentActivity();
Uri uri = Uri.parse(url).buildUpon().build();
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(uri);
currentActivity.startActivity(intent);
}
@ReactMethod
public void opendCarByUrl(String url) {
LogUtil.i("uri:",url);
Activity currentActivity = getCurrentActivity();
Uri uri = Uri.parse(url).buildUpon().build();
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(uri);
intent.setPackage(packageName);
currentActivity.startActivity(intent);
}
}
| [
"[email protected]"
] | |
7f38c4cc916146fbcbb8bfc6727374d419ac305e | 6704647bfde996588f497be8926415ea25703a64 | /src/main/java/com/product/dao/ThumbNailDaoImpl.java | 11e29fb7b8c9a12b69a0e3867bf8de37d7131d56 | [] | no_license | Oye5/ProductAPiService | ef569280591b6d30449c22bc39281e92797cf3c6 | 8f046a757218dd7e44c4eab35b4fa3cbfe873905 | refs/heads/master | 2021-01-18T19:58:49.261760 | 2016-10-13T07:26:39 | 2016-10-13T07:26:39 | 66,942,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.product.dao;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import com.product.model.Product;
import com.product.model.ThumbNail;
@Repository
public class ThumbNailDaoImpl extends AbstractDao<String, ThumbNail> implements ThumbNailDao {
@Override
public void saveThumbNail(ThumbNail thumb) {
persist(thumb);
}
@Override
public ThumbNail getThumbByProductId(String productId) {
Criteria criteria = createEntityCriteria();
System.out.println("productId=="+productId);
criteria.add(Restrictions.eq("productId.productId", productId));
return (ThumbNail) criteria.uniqueResult();
}
@Override
public void deleteThumbNail(String productId) {
deleteProductImagesThumnailBasedOnProductId(productId);
}
}
| [
"[email protected]"
] | |
4b7acf08a482e16a3528a241568ef621eda9e3d4 | 3473e5e6ad1c831c7abe9afd69fada3a48ba8270 | /shengnan2015/src/thread/ThreadTest.java | d1316d7944780e37e123a1b624b43a4015bc267d | [] | no_license | cietwwl/java_2017 | 0c05a398f62d7040b6002549572f784330e88395 | 6f3819f48f9b0574345bd97bf31681ce1f19f6de | refs/heads/master | 2020-06-11T05:35:50.472247 | 2016-03-30T02:57:08 | 2016-03-30T02:57:08 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 881 | java | package thread;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class ThreadTest {
private int j;
private Lock lock = new ReentrantLock();
public static void main(String[] args) {
ThreadTest tt = new ThreadTest();
for (int i = 0; i < 2; i++) {
new Thread(tt.new Adder()).start();
new Thread(tt.new Subtractor()).start();
}
}
//¼Ó
private class Adder implements Runnable {
@Override
public void run() {
while (true) {
lock.lock();// -----------
try {
System.out.println("++++||" + j--);
} finally {
lock.unlock();
}
}
}
}
//¼õ
private class Subtractor implements Runnable {
@Override
public void run() {
while (true) {
lock.lock();// -----------
try {
System.out.println("----||" + j--);
} finally {
lock.unlock();
}
}
}
}
}
| [
"[email protected]"
] | |
49def823a32ff999ac5da7bd5cf115bc675f245a | 64f0fbba386df532f7135b8d7a1bd1b5261128ed | /DataStructures/src/dp/MinNUm.java | 84fd7aed6ffdb5d6ccf6e09d1b8e85ea419a8ba1 | [] | no_license | yssharma/ConfusedCoders.DataStructures | b98920a8a7c12935f3a3791e13f8a947ac22ebce | 1cc8c60d94af1a85938c78198601e3b0db1b9dc9 | refs/heads/master | 2020-04-09T11:03:02.549967 | 2013-09-24T11:52:41 | 2013-09-24T11:52:41 | 6,156,776 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package dp;
public class MinNUm {
public static int min(int a, int b){
int k = (a-b)>>31;
System.out.println("k"+k);
return (a + (k*(a-b)));
}
public static void main(String[] args) {
System.out.println(min(15,15));
}
}
| [
"[email protected]"
] | |
1d733ce8c0282f06fc324f86dbf3ee20dcff38df | 814b8ae009dd4a96cdd39a1ebcf1e645e5cddca7 | /app/src/main/java/com/starway/starrobot/fragment/FaceFragment.java | 56da88a74d8556e33b768f34a0dcf1c5fca5ff8f | [] | no_license | 2397655639/APPRPbot | 01b6aee5b19778d91a0c3dabcef5413870b84d9a | 3bfcd13c282c5328bd869b38481a379f69bd55e6 | refs/heads/master | 2023-01-01T12:03:48.964543 | 2020-10-23T03:46:35 | 2020-10-23T03:46:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,386 | java | package com.starway.starrobot.fragment;
/**
* 人脸识别功能
* 大大志
* 2018.08.29
*/
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.starway.starrobot.R;
import com.starway.starrobot.activity.BaseActivity;
import com.starway.starrobot.mscability.StarMscAbility;
import com.starway.starrobot.mscability.facedetect.CameraHelper;
import com.starway.starrobot.mscability.facedetect.FaceDetectHelper;
import com.starway.starrobot.mscability.speech.SpeechHelper;
import com.starway.starrobot.mscability.speech.TTS;
import com.starway.starrobot.utils.SPUtils;
import static android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
public class FaceFragment extends Fragment implements CameraHelper.GetBitmapListener, CameraHelper.OnCameraPrepareListener {
/**
* 摄像头帮助类
*/
private CameraHelper mCameraHelper;
private FrameLayout mSurfaceView;
/**
* 拍照图片
*/
private final static String SPEECH_APPID = "5ab303c5";
private final static String GROUP_ID = "GROUP_ID";
private String mGroupId = "3994134796";
private Handler handler=new Handler();
public onFaceDetectedListener listener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_face, container, false);
mCameraHelper = new CameraHelper(getActivity());
mSurfaceView = view.findViewById(R.id.surface_frame);
//初始化摄像头
//initCamera();
// StarMscAbility.getInstance().initWithAppid(this.getContext(), SPEECH_APPID);//初始化人脸识别
initGroupId();//初始化人脸组
return view;
}
@Override
public void onHiddenChanged(boolean hidden) {
if (hidden) {
handler.removeCallbacks(takePhoto);
mCameraHelper.closeCamera();
Log.i("message", "摄像头被注销");
} else {
// TODO: 初始化注册操作
BaseActivity activity = (BaseActivity) getActivity();
activity.setTitle(R.string.face_recognition);
activity.setSubtitle("");
activity.showFuncButton(false);
initCamera();
faceDetecting("请盯着我的眼睛,让我猜猜你是谁?");
}
super.onHiddenChanged(hidden);
}
private Runnable takePhoto=new Runnable() {
@Override
public void run() {
mCameraHelper.takePicture();
}
};
private void faceDetecting(String tip){
SpeechHelper.getInstance().speak(tip, new TTS.onSpeakCallback() {
@Override
public void onSpeak(String s) {
Log.i("test","开始拍照");
handler.postDelayed(takePhoto, 2000);
}
});
}
/**
* 处理摄像头初始化等操作
*/
private void initCamera() {
try {
Log.i("啦啦啦", "初始化相机");
mCameraHelper.setGetBitmapListener(this);
mCameraHelper.setOnCameraPrepareListener(this);
mCameraHelper.openCamera(mSurfaceView, CAMERA_FACING_BACK);//这里应该是前置摄像头
Log.i("啦啦啦", "到这里了");
} catch (Exception ex) {
Log.i("初始化摄像头失败", "失败了");
ex.printStackTrace();
}
}
public FaceFragment setListener(onFaceDetectedListener listener) {
this.listener = listener;
return this;
}
/**
* 获取图片
*/
@Override
public void getBitmap(Bitmap bitmap) {
Log.i("test","拍照结束");
final FaceDetectHelper faceDetectHelper = new FaceDetectHelper(this.getContext());
faceDetectHelper.setOnFaceDetectListener(new FaceDetectHelper.OnFaceDetectListener() {
@Override
public void onFaceDetectSuccess(String s) {
if ("".equals(s)) {
faceDetecting("小途没有认出来你,让我再猜猜你吧");
} else {
if(!listener.onFaceDetected(s)){
//faceDetecting("小途猜出来了您,您是"+s);
}
}
faceDetectHelper.closeFaceDetect();
}
});
faceDetectHelper.deleteFace(bitmap);
}
@Override
public void prepare() {
}
/**
* 当识别到人脸后的结果回调
*/
public interface onFaceDetectedListener {
boolean onFaceDetected(String arg);
}
/**
* 获取GroupId
*/
private void initGroupId() {
String groupid = String.valueOf(SPUtils.get(this.getContext(), GROUP_ID, ""));
if (!"".equals("3994134796")) {
mGroupId = "3994134796";
StarMscAbility.getInstance().setGroupID(mGroupId);
// showToast("GroupId is 3994134796");
} else {
//showToast("GroupId is null");
}
}
}
| [
"[email protected]"
] | |
e4eeb6e683b18aca0d3fa7e6c9fa37583a7ba405 | 95cfe2239c8fce0cec91d76e0a82f59a9efc4cb8 | /sourceCode/CommonsIOMutGenerator/java.lang.NullPointerException/440_ROR/mut/ProxyWriter.java | 7ff0ac458fa9d40a2f86e2642499128bdb8d357b | [] | no_license | Djack1010/BUG_DB | 28eff24aece45ed379b49893176383d9260501e7 | a4b6e4460a664ce64a474bfd7da635aa7ff62041 | refs/heads/master | 2022-04-09T01:58:29.736794 | 2020-03-13T14:15:11 | 2020-03-13T14:15:11 | 141,260,015 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,396 | 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.commons.io.output;
import java.io.FilterWriter;
import java.io.IOException;
import java.io.Writer;
/**
* A Proxy stream which acts as expected, that is it passes the method
* calls on to the proxied stream and doesn't change which methods are
* being called. It is an alternative base class to FilterWriter
* to increase reusability, because FilterWriter changes the
* methods being called, such as write(char[]) to write(char[], int, int)
* and write(String) to write(String, int, int).
*
*/
public class ProxyWriter extends FilterWriter {
/**
* Constructs a new ProxyWriter.
*
* @param proxy the Writer to delegate to
*/
public ProxyWriter(final Writer proxy) {
super(proxy);
// the proxy is stored in a protected superclass variable named 'out'
}
/**
* Invokes the delegate's <code>append(char)</code> method.
* @param c The character to write
* @return this writer
* @throws IOException if an I/O error occurs
* @since 2.0
*/
public Writer append(final char c) throws IOException {
try {
beforeWrite(1);
out.append(c);
afterWrite(1);
} catch (final IOException e) {
handleIOException(e);
}
return this;
}
/**
* Invokes the delegate's <code>append(CharSequence, int, int)</code> method.
* @param csq The character sequence to write
* @param start The index of the first character to write
* @param end The index of the first character to write (exclusive)
* @return this writer
* @throws IOException if an I/O error occurs
* @since 2.0
*/
public Writer append(final CharSequence csq, final int start, final int end) throws IOException {
try {
beforeWrite(end - start);
out.append(csq, start, end);
afterWrite(end - start);
} catch (final IOException e) {
handleIOException(e);
}
return this;
}
/**
* Invokes the delegate's <code>append(CharSequence)</code> method.
* @param csq The character sequence to write
* @return this writer
* @throws IOException if an I/O error occurs
* @since 2.0
*/
public Writer append(final CharSequence csq) throws IOException {
try {
int len = 0;
if (csq != null) {
len = csq.length();
}
beforeWrite(len);
out.append(csq);
afterWrite(len);
} catch (final IOException e) {
handleIOException(e);
}
return this;
}
/**
* Invokes the delegate's <code>write(int)</code> method.
* @param idx the character to write
* @throws IOException if an I/O error occurs
*/
public void write(final int idx) throws IOException {
try {
beforeWrite(1);
out.write(idx);
afterWrite(1);
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>write(char[])</code> method.
* @param chr the characters to write
* @throws IOException if an I/O error occurs
*/
public void write(final char[] chr) throws IOException {
try {
int len = 0;
if (chr != null) {
len = chr.length;
}
beforeWrite(len);
out.write(chr);
afterWrite(len);
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>write(char[], int, int)</code> method.
* @param chr the characters to write
* @param st The start offset
* @param len The number of characters to write
* @throws IOException if an I/O error occurs
*/
public void write(final char[] chr, final int st, final int len) throws IOException {
try {
beforeWrite(len);
out.write(chr, st, len);
afterWrite(len);
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>write(String)</code> method.
* @param str the string to write
* @throws IOException if an I/O error occurs
*/
public void write(final String str) throws IOException {
try {
int len = 0;
if (true) {
len = str.length();
}
beforeWrite(len);
out.write(str);
afterWrite(len);
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>write(String)</code> method.
* @param str the string to write
* @param st The start offset
* @param len The number of characters to write
* @throws IOException if an I/O error occurs
*/
public void write(final String str, final int st, final int len) throws IOException {
try {
beforeWrite(len);
out.write(str, st, len);
afterWrite(len);
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>flush()</code> method.
* @throws IOException if an I/O error occurs
*/
public void flush() throws IOException {
try {
out.flush();
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>close()</code> method.
* @throws IOException if an I/O error occurs
*/
public void close() throws IOException {
try {
out.close();
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invoked by the write methods before the call is proxied. The number
* of chars to be written (1 for the {@link #write(int)} method, buffer
* length for {@link #write(char[])}, etc.) is given as an argument.
* <p>
* Subclasses can override this method to add common pre-processing
* functionality without having to override all the write methods.
* The default implementation does nothing.
*
* @since 2.0
* @param n number of chars to be written
* @throws IOException if the pre-processing fails
*/
protected void beforeWrite(final int n) throws IOException {
}
/**
* Invoked by the write methods after the proxied call has returned
* successfully. The number of chars written (1 for the
* {@link #write(int)} method, buffer length for {@link #write(char[])},
* etc.) is given as an argument.
* <p>
* Subclasses can override this method to add common post-processing
* functionality without having to override all the write methods.
* The default implementation does nothing.
*
* @since 2.0
* @param n number of chars written
* @throws IOException if the post-processing fails
*/
protected void afterWrite(final int n) throws IOException {
}
/**
* Handle any IOExceptions thrown.
* <p>
* This method provides a point to implement custom exception
* handling. The default behaviour is to re-throw the exception.
* @param e The IOException thrown
* @throws IOException if an I/O error occurs
* @since 2.0
*/
protected void handleIOException(final IOException e) throws IOException {
throw e;
}
}
| [
"[email protected]"
] | |
3a0fd863bfa9a17da64c886c3e6d7699ef72610e | 6f5cd9702290bf3adfeedbfdd685277ee83e3fb8 | /programmers/level1/athlete/Solution.java | 3ce23808340cc50e6f2ad38a21e70940bfd19b22 | [] | no_license | miaaaong/tct-exercise | 3c5819d83d30c4157d0da1f490eb1701f79abcc8 | a6bb517ad21c7e20fabd8a765475ba5a50c75f02 | refs/heads/master | 2023-05-24T23:28:23.410087 | 2023-05-21T07:51:33 | 2023-05-21T07:51:33 | 133,342,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | package programmers.level1.athlete;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Solution {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public String solution1(String[] participant, String[] completion) {
String answer = "";
Arrays.sort(participant);
Arrays.sort(completion);
for(int i=0; i<completion.length; i++) {
if(!completion[i].equals(participant[i])) {
answer = participant[i];
break;
}
}
if(answer.equals("")) {
answer = participant[participant.length-1];
}
return answer;
}
public String solution2(String[] participant, String[] completion) {
String answer = "";
Map<String, Integer> map = new HashMap<String, Integer>();
for(String name : completion) {
if(map.containsKey(name)) {
map.put(name, map.get(name)+1);
} else {
map.put(name, 1);
}
}
for(String name : participant) {
if(map.containsKey(name)) {
int count = map.get(name);
if(count == 1) {
map.remove(name);
} else {
map.put(name, count-1);
}
} else {
answer = name;
break;
}
}
return answer;
}
}
| [
"[email protected]"
] | |
7689a2b80e73dee9078b91c16f0affe2347229be | e6c637f2343da046068c220b6ffe24cd1003f4ad | /src/com/skogen/java8stream/TestStream.java | b89187a3dec739d589586ab06b5a345aaa7e800e | [] | no_license | wshon/java8stream | c786ec3d3aea4c031825a888ffea6eeec5d2b3eb | 23bbfce4f3cabe9ce7d278171af82acf9f29aa20 | refs/heads/master | 2022-10-12T00:16:10.580630 | 2020-06-18T02:48:34 | 2020-06-18T02:48:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,425 | java | package com.skogen.java8stream;
import org.junit.Test;
import java.util.*;
import java.util.stream.*;
class Person {
String name;
int age;
long steps;
Person(String _name, int _age, long _steps) {
this.name = _name;
this.age = _age;
this.steps = _steps;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public long getSteps() {
return steps;
}
@Override
public String toString() {
return "Person{" +
"name='" + name + '\'' +
", age=" + age +
", steps=" + steps +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person = (Person) o;
return age == person.age &&
steps == person.steps &&
Objects.equals(name, person.name);
}
@Override
public int hashCode() {
return Objects.hash(name, age, steps);
}
static Stream<Person> getPeopleStream() {
return Stream.of(
new Person("Sam", 22, 9000),
new Person("Mike", 16, 18600),
new Person("Allen", 15, 21000),
new Person("Justin", 25, 12000),
new Person("Leo", 27, 9500),
new Person("Cora", 18, 26000)
);
}
static List<Person> getPeopleList() {
return Arrays.asList(
new Person("Sam", 22, 9000),
new Person("Mike", 16, 18600),
new Person("Allen", 15, 21000),
new Person("Justin", 25, 12000),
new Person("Leo", 27, 9500),
new Person("Cora", 18, 26000)
);
}
}
public class TestStream {
public static String getRandomString(int length) {
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
int number = random.nextInt(str.length());
sb.append(str.charAt(number));
}
return sb.toString();
}
/**
* 可操作类
*/
@Test
public void test1IntStream() {
System.out.println("整数型 IntStream");
IntStream intStream = IntStream.of(54, 1, 874, 0, 548, 56, 1, 95, 15, 65, 410);
System.out.println("结果: " + intStream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll).toString());
}
@Test
public void test1LongStream() {
System.out.println("长整型 LongStream");
LongStream longStream = LongStream.of(233333333, 0, 485, 687486, 52315874, 1034, -65841532, 32);
System.out.println("结果: " + longStream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll).toString());
}
@Test
public void test1DoubleStream() {
System.out.println("浮点型 DoubleStream");
double[] doubleArray = {0.6, 5.2, 84.3, 0.25, -6.5, -9.08, 5.009};
DoubleStream doubleStream = DoubleStream.of(doubleArray);
System.out.println("结果: " + doubleStream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll).toString());
}
@Test
public void test1StreamString() {
System.out.println("字符串 Stream<String>");
Stream<String> stringStream = Stream.of("abc", "", "bc", "efg", "abcd", "", "jkl");
System.out.println("结果: " + stringStream.collect(Collectors.toList()));
}
@Test
public void test1StreamStringArray() {
System.out.println("字符串数组 Stream<String[]>");
Stream<String[]> stream = Stream.of(
new String[]{"L1C1", "L1C2"},
new String[]{"L2C1", "l2C2"},
new String[]{"l3C1", "L3C2"}
);
System.out.println("结果: " + stream.collect(Collectors.toList()));
}
@Test
public void test1StreamObject() {
System.out.println("Object 派生类型 Stream<T>");
Stream<Person> personStream = Stream.of(
new Person("Sam", 22, 9000),
new Person("Mike", 16, 18600),
new Person("Allen", 15, 21000),
new Person("Justin", 25, 12000),
new Person("Leo", 27, 9500),
new Person("Sam", 22, 9000),
new Person("Cora", 18, 26000)
);
System.out.println("结果: " + personStream.collect(Collectors.toList()));
}
/**
* IntStream::of 参数类型只能为基本类型 int,LongStream、DoubleStream 同理
* Stream 与其内部元素类型对应关系如下
* IntStream -- int
* LongStream -- long
* DoubleStream -- double
* Stream<T> -- T
*/
@Test
public void test1StreamType() {
int[] intArray = {54, 1, 874, 0, 548, 56, 1, 95, 15, 65, 410}; // 基本数据类型
IntStream streamInt = IntStream.of(intArray);
System.out.println(Arrays.toString(streamInt.toArray()));
Integer[] integerArray = {54, 1, 874, 0, 548, 56, 1, 95, 15, 65, 410}; // 包装类型
// IntStream stream = IntStream.of(integerArray); //【错误】
Stream<Integer> streamInteger = Stream.of(integerArray);
System.out.println(streamInteger.collect(Collectors.toList()));
}
/**
* 获取流的方式
*/
@Test
public void test2StreamOf() {
System.out.println("直接创建 Stream 对象");
System.out.println("Stream.of(\"abc\", \"\", \"bc\", \"efg\", \"abcd\", \"\", \"jkl\")");
Stream<String> stream1 = Stream.of("abc", "", "bc", "efg", "abcd", "", "jkl");
System.out.println("结果: " + stream1.collect(Collectors.toList()));
System.out.println("IntStream.range(1, 5)");
IntStream stream2 = IntStream.range(1, 5);
System.out.println("结果: " + stream2.collect(ArrayList::new, ArrayList::add, ArrayList::addAll));
System.out.println("IntStream.rangeClosed(1, 5)");
LongStream stream3 = LongStream.rangeClosed(1, 5);
System.out.println("结果: " + stream3.collect(ArrayList::new, ArrayList::add, ArrayList::addAll));
}
@Test
public void test2ArrayStream() {
System.out.println("通过 Array 生成 Stream 对象");
System.out.println("Integer[] → Arrays::stream");
int[] integerArray = {54, 1, 874, 0, 548, 56, 1, 95, 15, 65, 410};
IntStream stream = Arrays.stream(integerArray);
System.out.println("结果: " + stream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll));
}
@Test
public void test2CollectorsStream() {
System.out.println("通过 Collection 的派生类生成 Stream 对象");
System.out.println("ArrayList::new → ArrayList::add → Collection::stream");
List<String> stringList1 = new ArrayList<>();
stringList1.add("abc");
stringList1.add("");
stringList1.add("bc");
stringList1.add("efg");
Stream<String> stream3 = stringList1.stream();
System.out.println("结果: " + stream3.collect(Collectors.toList()));
System.out.println("String[] → Arrays::asList → Collection::stream");
String[] strArray = {"abc", "", "bc", "efg", "abcd", "", "jkl"};
List<String> stringList2 = Arrays.asList(strArray);
Stream<String> stream4 = stringList2.stream();
System.out.println("结果: " + stream4.collect(Collectors.toList()));
}
@Test
public void test2ObjectFunc() {
System.out.println("从其他对象获取");
System.out.println("new Random().ints().limit(10).mapToObj(Integer::toString)");
int[] rndIntArray = new Random().ints().limit(10).toArray();
System.out.println("结果: " + Arrays.toString(rndIntArray));
}
/**
* Terminal 最终操作
*/
@Test
public void test3collect1() {
Integer[] integerArray = {54, 1, 874, 0, 548, 56, 2, 95, 15, 65, 410};
System.out.println("Stream<T>::collect(ArrayList::new, ArrayList::add, ArrayList::addAll);");
Stream<Integer> stream = Arrays.stream(integerArray);
List<Integer> list = stream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
System.out.println("结果: " + list);
}
@Test
public void test3collect2() {
Person[] people = new Person[]{
new Person("Sam", 22, 9000),
new Person("Mike", 16, 18600),
new Person("Allen", 15, 21000),
new Person("Justin", 25, 12000),
new Person("Leo", 27, 9500),
new Person("Cora", 18, 26000)
};
System.out.println("Stream<T>::collect(Collectors.toList());");
Stream<Person> stream = Arrays.stream(people);
List<Person> list = stream.collect(Collectors.toList());
System.out.println("结果: " + list);
}
/**
* 基本数据类型对应的 Stream 使用 collect方法时,只能使用三个参数的 collect 函数,将 intArray 转为 List<Integer>。
* 是因为 IntStream 内的元素类型只能为 int (基本数据类型),而基本数据类型无法放入到 List 中,需要包装后才能放入。
*/
@Test
public void test3collect3() {
int[] intArray = {54, 1, 874, 0, 548, 56, 2, 95, 15, 65, 410};
System.out.println("IntStream::collect(ArrayList::new, ArrayList::add, ArrayList::addAll);");
IntStream stream = IntStream.of(intArray);
List<Integer> intList = stream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
System.out.println("结果: " + intList);
}
@Test
public void test3reduce() {
System.out.println("Stream<T>.count();");
System.out.println("Stream<T>.mapToLong(e -> 1L).sum();");
System.out.println("Stream<T>.mapToLong(e -> 1L).reduce(0, Long::sum);");
System.out.println("结果: " + Person.getPeopleStream().count());
Person max = Person.getPeopleStream().max(Comparator.comparingLong(x -> x.steps)).orElse(null);
System.out.println("Stream<T>.max(Comparator.comparingLong(x -> x.steps)).orElse(null);");
System.out.println("结果: " + max);
Person min = Person.getPeopleStream().min(Comparator.comparingInt(x -> x.age)).orElse(null);
System.out.println("Stream<T>.min(Comparator.comparingInt(x -> x.age)).orElse(null);");
System.out.println("结果: " + min);
}
@Test
public void test3toArray() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
Stream<String> stream = stringList.stream();
System.out.println("Stream<T>.toArray();");
System.out.println("结果: " + Arrays.toString(stream.toArray()));
}
@Test
public void test3forEach() {
System.out.println("仅对并行处理的流有区别,串行的流本身会保持有序");
Stream<Person> stream = Person.getPeopleList().parallelStream();
System.out.println("Stream<T>.forEach(System.out::println);");
System.out.println("结果: ");
stream.forEach(System.out::println);
Stream<Person> parallelStream = Person.getPeopleList().parallelStream();
System.out.println("parallel: Stream<T>.forEachOrdered(System.out::println);");
System.out.println("结果: ");
parallelStream.forEachOrdered(System.out::println);
}
@Test
public void test3iterator() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
Stream<String> stream = stringList.stream();
Iterator<String> stringIter = stream.iterator();
while (stringIter.hasNext()) {
String s = stringIter.next();
System.out.print(String.format("\"%s\", ", s));
}
System.out.println();
}
@Test
public void test3anyMatch() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
Stream<String> stream1 = stringList.stream();
System.out.println("stream.anyMatch(String::isEmpty);");
boolean res1 = stream1.anyMatch(String::isEmpty);
System.out.println("结果: " + res1);
Stream<Person> stream2 = Person.getPeopleStream();
System.out.println("stream.allMatch(String::isEmpty);");
boolean res2 = stream2.allMatch(x -> x.steps > 5000);
System.out.println("结果: " + res2);
Stream<String> stream3 = stringList.stream();
System.out.println("stream.noneMatch(String::isEmpty);");
boolean res3 = stream3.noneMatch(String::isEmpty);
System.out.println("结果: " + res3);
}
/**
* Intermediate 中间操作
*/
@Test
public void test3map() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
List<String> upper = stringList.stream().map(String::toUpperCase).collect(Collectors.toList());
System.out.println("初始值: " + stringList);
System.out.println("转大写: " + upper);
}
@Test
public void test3flatMap() {
Stream<String[]> stream = Stream.of(
new String[]{"L1C1", "L1C2"},
new String[]{"L2C1", "l2C2"},
new String[]{"l3C1", "L3C2"}
);
stream.flatMap(Arrays::stream).forEach(System.out::println);
}
@Test
public void test3filter() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
List<String> filtered = stringList.stream().filter(x -> !x.isEmpty()).collect(Collectors.toList());
System.out.println("过滤前: " + stringList);
System.out.println("过滤后: " + filtered);
}
@Test
public void test3limit() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
List<String> filtered = stringList.stream().limit(5).collect(Collectors.toList());
System.out.println("origin: " + stringList);
System.out.println("limit: " + filtered);
}
@Test
public void test3skip() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "", "jkl");
List<String> filtered = stringList.stream().skip(5).collect(Collectors.toList());
System.out.println("origin: " + stringList);
System.out.println("skip: " + filtered);
}
@Test
public void test3distinct() {
List<String> stringList = Arrays.asList("abc", "", "bc", "efg", "abcd", "bc", "jkl");
List<String> filtered = stringList.stream().distinct().collect(Collectors.toList());
System.out.println("去重前: " + stringList);
System.out.println("去重后: " + filtered);
}
@Test
public void test3unordered() {
System.out.println();
Stream.of(5, 1, 2, 6, 3, 7, 4).unordered().forEach(System.out::print);
System.out.println();
Stream.of(5, 1, 2, 6, 3, 7, 4).unordered().forEach(System.out::print);
System.out.println();
Stream.of(5, 1, 2, 6, 3, 7, 4).unordered().parallel().forEach(System.out::print);
System.out.println();
Stream.of(5, 1, 2, 6, 3, 7, 4).unordered().parallel().forEach(System.out::print);
System.out.println();
Stream.of(5, 1, 2, 6, 3, 7, 4).parallel().forEach(System.out::print);
System.out.println();
Stream.of(5, 1, 2, 6, 3, 7, 4).parallel().forEach(System.out::print);
System.out.println();
List<Person> peopleList = Person.getPeopleList();
peopleList.parallelStream().limit(3).forEach(System.out::println);
System.out.println();
peopleList.parallelStream().limit(3).forEach(System.out::println);
System.out.println();
peopleList.stream().parallel().limit(3).forEach(System.out::println);
System.out.println();
peopleList.stream().parallel().limit(3).forEach(System.out::println);
System.out.println();
peopleList.stream().limit(3).forEach(System.out::println);
System.out.println();
peopleList.stream().limit(3).forEach(System.out::println);
System.out.println();
peopleList.stream().unordered().parallel().limit(3).forEach(System.out::println);
System.out.println();
peopleList.stream().unordered().parallel().limit(3).forEach(System.out::println);
}
@Test
public void test4() {
Random random = new Random();
ArrayList<Person> peopleList = new ArrayList<>();
long startTime = System.currentTimeMillis();
for (int i = 1; i <= 2000000; i++) {
peopleList.add(new Person(getRandomString(5),
random.nextInt(100), random.nextLong()));
}
long endTime = System.currentTimeMillis();
System.out.println("生成数据耗时: " + (endTime - startTime) + "ms");
int i = 0;
while (i++ < 4) {
{
startTime = System.currentTimeMillis();
List<Person> adultList = new ArrayList<>();
for (Person p : peopleList) {
if (p.getAge() >= 18) {
adultList.add(p);
}
}
Collections.sort(adultList, new Comparator<Person>() {
@Override
public int compare(Person p1, Person p2) {
return Long.compare(p1.getSteps(), p2.getSteps());
}
});
endTime = System.currentTimeMillis();
if (i > 1) System.out.println("结果: " + (long) adultList.size());
}
if (i > 1) System.out.println("普通方式耗时: " + (endTime - startTime) + "ms");
{
startTime = System.currentTimeMillis();
List<Person> adultList = peopleList.stream()
.filter(x -> x.getAge() >= 18)
.sorted(Comparator.comparingLong(Person::getSteps))
.collect(Collectors.toList());
endTime = System.currentTimeMillis();
if (i > 1) System.out.println("结果: " + (long) adultList.size());
}
if (i > 1) System.out.println("Stream(串行)方式耗时: " + (endTime - startTime) + "ms");
{
startTime = System.currentTimeMillis();
List<Person> adultList = peopleList.stream().unordered()
.filter(x -> x.getAge() >= 18)
.sorted(Comparator.comparingLong(Person::getSteps))
.collect(Collectors.toList());
endTime = System.currentTimeMillis();
if (i > 1) System.out.println("结果: " + (long) adultList.size());
}
if (i > 1) System.out.println("Stream(串行 unordered)方式耗时: " + (endTime - startTime) + "ms");
{
startTime = System.currentTimeMillis();
List<Person> adultList = peopleList.parallelStream()
.filter(x -> x.getAge() >= 18)
.sorted(Comparator.comparingLong(Person::getSteps))
.collect(Collectors.toList());
endTime = System.currentTimeMillis();
if (i > 1) System.out.println("结果: " + (long) adultList.size());
}
if (i > 1) System.out.println("Stream(并行)方式耗时: " + (endTime - startTime) + "ms");
{
startTime = System.currentTimeMillis();
List<Person> adultList = peopleList.parallelStream().unordered()
.filter(x -> x.getAge() >= 18)
.sorted(Comparator.comparingLong(Person::getSteps))
.collect(Collectors.toList());
endTime = System.currentTimeMillis();
if (i > 1) System.out.println("结果: " + (long) adultList.size());
}
if (i > 1) System.out.println("Stream(并行 unordered)方式耗时: " + (endTime - startTime) + "ms");
}
}
@Test
public void test() {
}
}
| [
"[email protected]"
] | |
902c6d422fe5824f5f1b53389f8f05d251dac31d | e8e0046feed6411bdaedfc2e8bd41d2927e717c6 | /src/tw/widget/SnowFallView.java | 5e484e52988ac124c239dd895fcff3becbb7137b | [] | no_license | HsuEn/SnowFall | 16ac482857b7f9c6cc8076458970877252128a1c | d0562932f7c5305d22eb14b377a2443d80cb9383 | refs/heads/master | 2020-04-26T01:56:02.481145 | 2013-02-01T04:03:49 | 2013-02-01T04:03:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,600 | java | package tw.widget;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
public class SnowFallView extends View {
private static Random sRandomGen = new Random();
private int snow_flake_count = 10;
private final List<Drawable> drawables = new ArrayList<Drawable>();
private int[][] coords;
private final Context mContext;
public SnowFallView(Context context) {
super(context);
setFocusable(true);
setFocusableInTouchMode(true);
mContext = context;
// snow_flake = context.getResources().getDrawable(R.drawable.a1_snow);
}
public SnowFallView(Context context, AttributeSet attrs) {
super(context, attrs);
setFocusable(true);
setFocusableInTouchMode(true);
mContext = context;
}
@Override
protected void onSizeChanged(int width, int height, int oldw, int oldh) {
super.onSizeChanged(width, height, oldw, oldh);
Interpolator interpolator = new LinearInterpolator();
snow_flake_count = Math.max(width, height) / 60;
coords = new int[snow_flake_count][];
drawables.clear();
for (int i = 0; i < snow_flake_count; i++) {
Animation animation = new TranslateAnimation(0, height / 10
- sRandomGen.nextInt(height / 5), 0, height + 30);
animation.setDuration(10 * height + sRandomGen.nextInt(5 * height));
animation.setRepeatCount(-1);
animation.initialize(10, 10, 10, 10);
animation.setInterpolator(interpolator);
coords[i] = new int[] { sRandomGen.nextInt(width - 30), -60 };
int size = 37 * height / 1000 + sRandomGen.nextInt(13);
Drawable snow_flake = mContext.getResources().getDrawable(R.drawable.snow);
snow_flake.setBounds(0, 0, size, size);
drawables.add(new AnimateDrawable(snow_flake, animation));
animation.setStartOffset(sRandomGen.nextInt(20 * height));
animation.startNow();
}
}
@Override
protected void onDraw(Canvas canvas) {
for (int i = 0; i < snow_flake_count; i++) {
Drawable drawable = drawables.get(i);
canvas.save();
canvas.translate(coords[i][0], coords[i][1]);
drawable.draw(canvas);
canvas.restore();
}
invalidate();
}
}
| [
"[email protected]"
] | |
2650e48170c93430811d1d1f6a806682e5aede6e | 4d1e79dbde892e6a2850f2eb315b33676e130ece | /MyFirstApp07/app/src/main/java/com/example/myfirstapp07/LaunchSimpleActivity.java | f912a417a926e8bddd074dce9d9653338f38921c | [] | no_license | hanwu11/2020-android-homework | f2bcead8b2812ea47566e46b6c0efe390bcdafa5 | a265436d7c4d539593ce0f5795ff055bed677f81 | refs/heads/main | 2023-02-10T05:07:00.873591 | 2020-12-18T14:35:05 | 2020-12-18T14:35:05 | 306,873,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | package com.example.myfirstapp07;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import android.os.Bundle;
import com.example.myfirstapp07.adapter.LaunchSimpleAdapter;
public class LaunchSimpleActivity extends AppCompatActivity {
// 声明引导页面的图片数组
private int[] lanuchImageArray = {R.drawable.guide_bg1,
R.drawable.guide_bg2, R.drawable.guide_bg3, R.drawable.guide_bg4};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launch_simple);
// 从布局视图中获取名叫vp_launch的翻页视图
ViewPager vp_launch = findViewById(R.id.vp_launch);
// 构建一个引导页面的翻页适配器
LaunchSimpleAdapter adapter = new LaunchSimpleAdapter(this, lanuchImageArray);
// 给vp_launch设置引导页面适配器
vp_launch.setAdapter(adapter);
// 设置vp_launch默认显示第一个页面
vp_launch.setCurrentItem(0);
}
} | [
"[email protected]"
] | |
c6c12d75dcc0a093dcfb4c7b1e58be28d9a8581b | 648757805de94af5629bbdc0e05125105812046f | /src/main/java/com/mashibing/mashibing/system/io/testRPC/request/RequestContent.java | 4f1df1fb0ce65120abbe53bb823bcbe43265d0a6 | [] | no_license | hgq0916/system-io | b42525ec4cc1d8c545ff577d1c230cbe352168e6 | c3ac4fb0901d4034aa9084fafe0f1cba8a360fa9 | refs/heads/master | 2023-01-01T16:19:55.181156 | 2020-08-03T01:51:32 | 2020-08-03T01:51:32 | 281,262,142 | 0 | 0 | null | 2020-10-13T23:47:34 | 2020-07-21T01:13:59 | Java | UTF-8 | Java | false | false | 1,415 | java | package com.mashibing.mashibing.system.io.testRPC.request;
import java.io.Serializable;
import java.util.Arrays;
/**
* @author gangquan.hu
* @Package: com.mashibing.mashibing.system.io.testRPC.request.RequestContent
* @Description: 请求内容
* @date 2020/7/23 11:50
*/
public class RequestContent implements Serializable {
private String serverName;//服务名称
private String methodName;//方法名
private Class<?>[] parameterTypes;//方法参数类型列表
private Object[] args;//方法参数
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public Class<?>[] getParameterTypes() {
return parameterTypes;
}
public void setParameterTypes(Class<?>[] parameterTypes) {
this.parameterTypes = parameterTypes;
}
public Object[] getArgs() {
return args;
}
public void setArgs(Object[] args) {
this.args = args;
}
@Override
public String toString() {
return "RequestContent{" +
"serverName='" + serverName + '\'' +
", methodName='" + methodName + '\'' +
", parameterTypes=" + Arrays.toString(parameterTypes) +
", args=" + Arrays.toString(args) +
'}';
}
}
| [
"[email protected]"
] | |
37f340a2a56d2b824620fb13ac57203103e573a0 | 66cb05dd1cd989c84cf2625ac6ea189b0d575651 | /prosth-store/prosth-store-ejb/src/main/java/ec/edu/espe/distribuidas/prosth/model/Producto.java | 4bb25f266957fa5c6725f43e8e31a22022c74b0e | [] | no_license | Distril8/Proyecto-Segundo-Parcial | 92df13bb89a5bbfe94a8e421e8645a65b2219e63 | aa4e4d5943aa18fd45e85c183fc4175459656ad6 | refs/heads/master | 2021-05-11T11:56:52.443692 | 2018-01-18T00:02:14 | 2018-01-18T00:02:14 | 117,647,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,702 | java | /*
* Protesis Store
* Aplicaciones Distribuidas
* NRC: 2434
* Tutor: HENRY RAMIRO CORAL CORAL
* 2017 (c) Protesis Store Corp.
*/
package ec.edu.espe.distribuidas.prosth.model;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
*
* @author Protesis Store Corp.
*/
@Entity
@Table(name = "producto")
public class Producto implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "COD_PRODUCTO", nullable = false)
private Integer codigo;
@Column(name = "COD_CATEGORIA", nullable = false, length = 500)
private Integer codCategoria;
@Column(name = "DESCRIPCION", nullable = false, length = 500)
private String descripcion;
@Column(name = "NOMBRE", nullable = false, length = 100)
private String nombre;
@Column(name = "PRECIO", nullable = false, precision = 8, scale = 2)
private BigDecimal precio;
@Column(name = "STOCK", nullable = false)
private int stock;
@Column(name = "MARCA", nullable = false, length = 200)
private String marca;
@Column(name = "IMAGEN", length = 500)
private String imagen;
@JoinColumn(name = "COD_CATEGORIA", referencedColumnName = "COD_CATEGORIA",
nullable = false, insertable = false, updatable = false)
@ManyToOne
private Categoria categoria;
public Producto() {
}
public Producto(Integer codigo) {
this.codigo = codigo;
}
public String getDescripcion() {
return descripcion;
}
public String getImagen() {
return imagen;
}
public void setImagen(String imagen) {
this.imagen = imagen;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public BigDecimal getPrecio() {
return precio;
}
public void setPrecio(BigDecimal precio) {
this.precio = precio;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public String getMarca() {
return marca;
}
public void setMarca(String marca) {
this.marca = marca;
}
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public Integer getCodCategoria() {
return codCategoria;
}
public void setCodCategoria(Integer codCategoria) {
this.codCategoria = codCategoria;
}
public Categoria getCategoria() {
return categoria;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
@Override
public int hashCode() {
int hash = 0;
hash += (codigo != null ? codigo.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Producto)) {
return false;
}
Producto other = (Producto) object;
if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
return false;
}
return true;
}
@Override
public String toString() {
return "ec.edu.espe.proyecto.protesis.model.Producto[ codProducto=" + codigo + " ]";
}
}
| [
"[email protected]"
] | |
c4d3897c9d2410ed08a3afe838b50d11d628c0d4 | fd064e1d74f594498134fc949acc25f840e1965e | /app/src/main/java/com/arun/ebook/view/CommonView4.java | bc1a9c017ed1edfe1274e0f8d79d3c6029231185 | [] | no_license | wywy4pm/EnReader | b481105d62bd3d8d8df7dfb31a5bab3974cda924 | 706c5abc7c2b83f14e36ad0bed1647e4bb188262 | refs/heads/master | 2020-03-11T17:14:24.363700 | 2019-05-09T05:13:10 | 2019-05-09T05:13:10 | 130,141,474 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package com.arun.ebook.view;
/**
* Created by wy on 2017/6/7.
*/
public interface CommonView4<T> extends MvpView {
void refresh(T data);
void refreshMore(T data);
void refresh(int type, Object data);
}
| [
"[email protected]"
] | |
93b1fbc5eb1dbc3c0c8029337fc4ea1c4b7c2ae0 | 9bb96cfd3165b053bead59798594f4c4ff101535 | /src/HintTextField.java | 4b00566877e962a064f636aef6eb6e14ac00f922 | [
"MIT"
] | permissive | Malte311/Vokabeltrainer | 5e26b4e31a9d4a894fd4ba5ad6c70dd38f7c2d36 | b71090248481d5e9e55286a206c9c9534588b45c | refs/heads/master | 2021-09-05T13:37:54.082767 | 2018-01-28T09:59:57 | 2018-01-28T09:59:57 | 113,334,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 934 | java | /**
* source: https://stackoverflow.com/questions/1738966/java-jtextfield-with-input-hint
* Repraesentiert ein Textfeld, das einen default-Text nur anzeigt, solange es keinen Fokus hat
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class HintTextField extends JTextField implements FocusListener {
private final String hint;
private boolean showingHint;
public HintTextField(final String hint) {
super(hint);
this.hint = hint;
this.showingHint = true;
super.addFocusListener(this);
}
@Override
public void focusGained(FocusEvent e) {
if(this.getText().isEmpty()) {
super.setText("");
showingHint = false;
}
}
@Override
public void focusLost(FocusEvent e) {
if(this.getText().isEmpty()) {
super.setText(hint);
showingHint = true;
}
}
@Override
public String getText() {
return showingHint ? "" : super.getText();
}
}
| [
"[email protected]"
] | |
dfeca7ce548e42e4c4a13392f694d06328bef589 | 002d413a1e17874fb1196b4cbd59da521d8d2f36 | /src/test/java/sample/DemoTest01.java | 35bd404ce3de2956a9c29d4d9da1cb425308d52f | [] | no_license | samarthshekhar/JenkinsDemo | 6bcb97b8f7d26cea74838bb983fab06a2800dabc | f8a669a02414ceb09fbd7b7baa9115b81d7f5bf6 | refs/heads/master | 2023-08-28T00:57:28.389440 | 2021-10-29T06:27:52 | 2021-10-29T06:27:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package sample;
import org.testng.Assert;
import org.testng.annotations.Test;
public class DemoTest01 {
@Test
public void TestCase01() {
System.out.println("test case 01");
}
@Test
public void TestCase02() {
System.out.println("test case 02");
}
@Test
public void TestCase03() {
System.out.println("test case 03");
Assert.assertTrue(true);
}
@Test
public void TestCase04() {
System.out.println("test case 04");
}
}
| [
"[email protected]"
] | |
869a7691ef44d28c3962a20dfe1079e1868bf2c5 | 4a5afa09ceb7df5dfbd9720279afe9ff3e9df61c | /serverside/java/src/main/java/com/justonetech/biz/domain/base/BaseOaTaskLog.java | d8755463259873de23452e209aa6bea1520a35f8 | [] | no_license | chrgu000/juyee | 00ad3af9446a1df68d5a7c286f6243700e371c5c | 0de221b728e1eed7fe8eb06c267d62a0edc99793 | refs/heads/master | 2020-05-25T01:21:01.504384 | 2016-11-28T09:26:10 | 2016-11-28T09:26:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,646 | java | package com.justonetech.biz.domain.base;
import java.io.Serializable;
/**
* This is an object that contains data related to the OA_TASK_LOG table.
* Do not modify this class because it will be overwritten if the configuration file
* related to this class is modified.
* TableComment : 任务日志
* SyncTemplatepatterns : list\w*
* SyncDao : false
* TableName : 任务日志
* SyncBoolean : get
* SyncJsp : true
* Treeable : false
* SubSystem : oa
* Projectable : false
*
* @hibernate.class
* table="OA_TASK_LOG"
*/
public abstract class BaseOaTaskLog implements Serializable {
public static String REF = "OaTaskLog";
public static String PROP_CREATE_USER = "createUser";
public static String PROP_TYPE = "type";
public static String PROP_OP_DATETIME = "opDatetime";
public static String PROP_CREATE_TIME = "createTime";
public static String PROP_ID = "id";
public static String PROP_AUDIT_METHOD = "auditMethod";
public static String PROP_TITLE = "title";
public static String PROP_PRIORITY = "priority";
public static String PROP_REFER_ID = "referId";
// constructors
public BaseOaTaskLog () {
initialize();
}
/**
* Constructor for primary key
*/
public BaseOaTaskLog (java.lang.Long id) {
this.setId(id);
initialize();
}
/**
* Constructor for required fields
*/
public BaseOaTaskLog (
java.lang.Long id,
java.lang.String title) {
this.setId(id);
this.setTitle(title);
initialize();
}
protected void initialize () {}
private int hashCode = Integer.MIN_VALUE;
// primary key
private java.lang.Long id;
// fields
/*业务记录_ID*/
/*业务记录_ID*/
private java.lang.Long referId;
/*标题*/
/*标题*/
private java.lang.String title;
/*创建时间*/
/*创建时间*/
private java.sql.Timestamp createTime;
/*紧急程度*/
/*紧急程度*/
private java.lang.String priority;
/*审核模式*/
/*审核模式*/
private java.lang.String auditMethod;
/*操作时间*/
/*操作时间*/
private java.sql.Timestamp opDatetime;
// many to one
private com.justonetech.biz.domain.OaTaskType type;
private com.justonetech.system.domain.SysUser createUser;
// collections
private java.util.Set<com.justonetech.biz.domain.OaTaskDealLog> oaTaskDealLogs;
/**
* Return the unique identifier of this class
* @hibernate.id
* generator-class="com.justonetech.core.orm.hibernate.LongIdGenerator"
* column="ID"
*/
public java.lang.Long getId () {
return id;
}
/**
* Set the unique identifier of this class
* @param id the new ID
* @deprecated
*/
public void setId (java.lang.Long id) {
this.id = id;
this.hashCode = Integer.MIN_VALUE;
}
/**
* Return the value associated with the column: REFER_ID
*/
public java.lang.Long getReferId () {
return referId;
}
/**
* Set the value related to the column: REFER_ID
* @param referId the REFER_ID value
*/
public void setReferId (java.lang.Long referId) {
this.referId = referId;
}
/**
* Return the value associated with the column: TITLE
*/
public java.lang.String getTitle () {
return title;
}
/**
* Set the value related to the column: TITLE
* @param title the TITLE value
*/
public void setTitle (java.lang.String title) {
this.title = title;
}
/**
* Return the value associated with the column: CREATE_TIME
*/
public java.sql.Timestamp getCreateTime () {
return createTime;
}
/**
* Set the value related to the column: CREATE_TIME
* @param createTime the CREATE_TIME value
*/
public void setCreateTime (java.sql.Timestamp createTime) {
this.createTime = createTime;
}
/**
* Return the value associated with the column: PRIORITY
*/
public java.lang.String getPriority () {
return priority;
}
/**
* Set the value related to the column: PRIORITY
* @param priority the PRIORITY value
*/
public void setPriority (java.lang.String priority) {
this.priority = priority;
}
/**
* Return the value associated with the column: AUDIT_METHOD
*/
public java.lang.String getAuditMethod () {
return auditMethod;
}
/**
* Set the value related to the column: AUDIT_METHOD
* @param auditMethod the AUDIT_METHOD value
*/
public void setAuditMethod (java.lang.String auditMethod) {
this.auditMethod = auditMethod;
}
/**
* Return the value associated with the column: OP_DATETIME
*/
public java.sql.Timestamp getOpDatetime () {
return opDatetime;
}
/**
* Set the value related to the column: OP_DATETIME
* @param opDatetime the OP_DATETIME value
*/
public void setOpDatetime (java.sql.Timestamp opDatetime) {
this.opDatetime = opDatetime;
}
/**
* Return the value associated with the column: TYPE_ID
*/
public com.justonetech.biz.domain.OaTaskType getType () {
return type;
}
/**
* Set the value related to the column: TYPE_ID
* @param type the TYPE_ID value
*/
public void setType (com.justonetech.biz.domain.OaTaskType type) {
this.type = type;
}
/**
* Return the value associated with the column: CREATE_USER_ID
*/
public com.justonetech.system.domain.SysUser getCreateUser () {
return createUser;
}
/**
* Set the value related to the column: CREATE_USER_ID
* @param createUser the CREATE_USER_ID value
*/
public void setCreateUser (com.justonetech.system.domain.SysUser createUser) {
this.createUser = createUser;
}
/**
* Return the value associated with the column: oaTaskDealLogs
*/
public java.util.Set<com.justonetech.biz.domain.OaTaskDealLog> getOaTaskDealLogs () {
if(oaTaskDealLogs == null){
oaTaskDealLogs = new java.util.LinkedHashSet<com.justonetech.biz.domain.OaTaskDealLog>();
}
return oaTaskDealLogs;
}
/**
* Set the value related to the column: oaTaskDealLogs
* @param oaTaskDealLogs the oaTaskDealLogs value
*/
public void setOaTaskDealLogs (java.util.Set<com.justonetech.biz.domain.OaTaskDealLog> oaTaskDealLogs) {
this.oaTaskDealLogs = oaTaskDealLogs;
}
public void addTooaTaskDealLogs (com.justonetech.biz.domain.OaTaskDealLog oaTaskDealLog) {
if (null == getOaTaskDealLogs()) setOaTaskDealLogs(new java.util.LinkedHashSet<com.justonetech.biz.domain.OaTaskDealLog>());
getOaTaskDealLogs().add(oaTaskDealLog);
}
public boolean equals (Object obj) {
if (null == obj) return false;
if (!(obj instanceof com.justonetech.biz.domain.OaTaskLog)) return false;
else {
com.justonetech.biz.domain.OaTaskLog oaTaskLog = (com.justonetech.biz.domain.OaTaskLog) obj;
if (null == this.getId() || null == oaTaskLog.getId()) return false;
else return (this.getId().equals(oaTaskLog.getId()));
}
}
public int hashCode () {
if (Integer.MIN_VALUE == this.hashCode) {
if (null == this.getId()) return super.hashCode();
else {
String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
this.hashCode = hashStr.hashCode();
}
}
return this.hashCode;
}
public String toString () {
org.apache.commons.lang.builder.ToStringBuilder builder = new org.apache.commons.lang.builder.ToStringBuilder(this);
builder.append(id);
builder.append(referId);
builder.append(title);
builder.append(createTime);
builder.append(priority);
builder.append(auditMethod);
builder.append(opDatetime);
return builder.toString();
}
} | [
"chenjunping@18d54d2b-35bc-4a19-92ed-a673819ede82"
] | chenjunping@18d54d2b-35bc-4a19-92ed-a673819ede82 |
266e39022539e628f054c51efbfdd7c1a006d38f | 0ba01b3facf447650142ac9084871727c6ca3481 | /Java/SpringBoot/dojosninjas/src/main/java/com/codingdojo/dojosninjas/DojosninjasApplication.java | 0879465e46bbb05b2b4c3cfefc172e29dfe2696f | [] | no_license | kristindubrule/DojoAssignments | 70e471c1bc226d8a5c5a4e44474f9c9d8872cad5 | 5e4f40af39715fe9780b31450ed042509cbde088 | refs/heads/master | 2021-05-05T03:51:13.414579 | 2018-04-27T15:54:36 | 2018-04-27T15:54:36 | 118,531,679 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.codingdojo.dojosninjas;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DojosninjasApplication {
public static void main(String[] args) {
SpringApplication.run(DojosninjasApplication.class, args);
}
}
| [
"[email protected]"
] | |
997521c901d2fa2c6e1e8c7ee0c5ad6f43aa40da | 96428a0b740e2f34c806157ee94effa8f281db6e | /app/src/main/java/grigoreva/facesmanager/data/loader/PersonListLoader.java | 3a0656f789b8ce3d17161f602cbc417e4d4d6aa2 | [] | no_license | GrigorevaElena/faces_manager | 05436203b93ce3af1c91d6a1972ed61bcff59d29 | 7c00f9e87edea8ec898996804aec97cf46c6de29 | refs/heads/master | 2021-01-20T10:06:57.085148 | 2017-06-10T19:13:12 | 2017-06-10T19:13:12 | 90,324,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package grigoreva.facesmanager.data.loader;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.content.AsyncTaskLoader;
import java.util.ArrayList;
import java.util.List;
import grigoreva.facesmanager.data.greendao.DatabaseDelegate;
import grigoreva.facesmanager.data.greendao.Person;
import grigoreva.facesmanager.data.greendao.PersonPhoto;
import grigoreva.facesmanager.model.PersonViewModel;
/**
* Created by админ2 on 06.06.2017.
*/
public class PersonListLoader extends AsyncTaskLoader<List<PersonViewModel>> {
public PersonListLoader(Context context) {
super(context);
}
@Override
public List<PersonViewModel> loadInBackground() {
DatabaseDelegate databaseDelegate = DatabaseDelegate.getInstance(getContext());
List<Person> personList = databaseDelegate.getAllPersonList();
if (personList == null || personList.isEmpty()) {
return null;
}
List<PersonViewModel> personViewModelList = new ArrayList<>(personList.size());
for (Person person : personList) {
PersonPhoto personPhoto = databaseDelegate.getMainPersonPhoto(person.getId());
personViewModelList.add(
new PersonViewModel(personPhoto == null ? "" : personPhoto.getPhotoUrl(),
person.getSurname(), person.getName()));
}
return personViewModelList;
}
}
| [
"[email protected]"
] | |
71ca2de3f930319131dee2a3328cf844029b7149 | 528fd272a727f0c1517b5cad58d6a95a099400e5 | /tutorials/servlet/02-add-roles/src/main/java/com/stormpath/shiro/tutorial/resources/TrooperResource.java | 8debc288713b2d6628ea334d530bd90639a07192 | [
"Apache-2.0"
] | permissive | stormpath/stormpath-shiro | 15ffd1867c63c0e21348354246e25e24ab190915 | 7a3c4fd3bd0ed9bb4546932495c79e6ad6fa1a92 | refs/heads/master | 2023-08-10T14:57:41.803295 | 2017-03-06T15:03:49 | 2017-03-06T15:03:49 | 4,142,377 | 29 | 41 | null | 2016-10-17T18:04:26 | 2012-04-25T23:34:10 | Java | UTF-8 | Java | false | false | 2,945 | java | /*
* Copyright 2016 Stormpath, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.stormpath.shiro.tutorial.resources;
import com.stormpath.shiro.tutorial.dao.StormtrooperDao;
import com.stormpath.shiro.tutorial.models.Stormtrooper;
import org.glassfish.jersey.server.mvc.Template;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
@Path("/")
public class TrooperResource {
final private StormtrooperDao trooperDao;
public TrooperResource()
{
super();
this.trooperDao = StormtrooperDao.getInstance();
}
@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON})
@Template(name = "troopers")
public Collection<Stormtrooper> listTroopers() {
return trooperDao.listStormtroopers();
}
@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_JSON})
@Template(name = "trooper")
public Stormtrooper getTrooper(@PathParam("id") String id) {
Stormtrooper stormtrooper = trooperDao.getStormtrooper(id);
if (stormtrooper == null) {
throw new NotFoundException();
}
return stormtrooper;
}
@POST
@Path("/{id}")
@Produces({MediaType.APPLICATION_JSON})
@Template(name = "trooper")
public Stormtrooper updateTrooper(@PathParam("id") String id,
@FormParam("type") String type,
@FormParam("species") String species,
@FormParam("planetOfOrigin") String planetOfOrigin) {
Stormtrooper stormtrooper = getTrooper(id);
stormtrooper.setType(type);
stormtrooper.setSpecies(species);
stormtrooper.setPlanetOfOrigin(planetOfOrigin);
trooperDao.updateStormtrooper(stormtrooper);
return stormtrooper;
}
@POST
@Path("/")
@Produces({MediaType.APPLICATION_JSON})
@Template(name = "trooper")
public Stormtrooper createTrooper(@FormParam("id") String id,
@FormParam("type") String type,
@FormParam("species") String species,
@FormParam("planetOfOrigin") String planetOfOrigin) {
Stormtrooper stormtrooper = new Stormtrooper(id, planetOfOrigin, species, type);
trooperDao.addStormtrooper(stormtrooper);
return stormtrooper;
}
} | [
"[email protected]"
] | |
d613f5c7543e7a6d547ce530cb6ce8cb5658f4dc | 950cca01abfa5909d01c80fd3c4d6327e50f082e | /src/src/application/AddEmployeeScreenController.java | 6c88244343014d39ba80063c21c8933d11cc628f | [] | no_license | dan-walker-cs/database_project | 99a5047362c431256519bee35e5bb9970275bb54 | e3f6dc86f32094c5f934e76cf08923adc21c3cb8 | refs/heads/master | 2022-05-23T14:40:21.073446 | 2020-04-29T23:23:31 | 2020-04-29T23:23:31 | 260,067,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,906 | java | package application;
import java.io.IOException;
import java.util.HashMap;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class AddEmployeeScreenController {
// employee information text fields
@FXML
private TextField firstNameText;
@FXML
private TextField dobText;
@FXML
private TextField ssnText;
@FXML
private TextField middleInitialText;
@FXML
private TextField lastNameText;
@FXML
private TextField salaryText;
@FXML
private TextField addressText;
@FXML
private TextField superssnText;
@FXML
private TextField dnoText;
@FXML
private TextField sexText;
@FXML
private TextField emailText;
@FXML
private Button confirmButton;
// key-value store to hold employee table information
static HashMap<String, String> employeeInformation = new HashMap<String, String>();
// this method stores the information from the addemployee screen locally
@FXML
void confirmEmployeeInformation(ActionEvent event) {
// store information from text fields
employeeInformation.put("fname", firstNameText.getText());
employeeInformation.put("minit", middleInitialText.getText());
employeeInformation.put("lname", lastNameText.getText());
employeeInformation.put("ssn", ssnText.getText());
employeeInformation.put("bdate", dobText.getText());
employeeInformation.put("address", addressText.getText());
employeeInformation.put("sex", sexText.getText());
employeeInformation.put("salary", salaryText.getText());
employeeInformation.put("superssn", superssnText.getText());
employeeInformation.put("dno", dnoText.getText());
employeeInformation.put("email", emailText.getText());
displayAdditionalEmployeeInformationScreen(event);
}
// this method displays the additionalemployeeinformation screen
@FXML
void displayAdditionalEmployeeInformationScreen(ActionEvent event) {
try {
Parent additionalEmployeeInformationParent = FXMLLoader.load(getClass().getResource("AdditionalEmployeeInformationScreen.fxml"));
Scene additonalEmployeeInformationScene = new Scene(additionalEmployeeInformationParent, 600, 600);
Stage applicationStage = (Stage) ((Node) event.getSource()).getScene().getWindow();
applicationStage.setScene(additonalEmployeeInformationScene);
applicationStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
public static HashMap<String, String> getEmployeeInformation() {
return employeeInformation;
}
}
| [
"[email protected]"
] | |
b4409e9c80455325550df07633767e5074cb4f36 | 5642fdf39a53673778cf843e21282d7947018749 | /src/main/java/com/ste/enginestreamportal/exceptions/AuthFailException.java | f642895a6fde3745a78ac2e3a4bdb5114a2ca813 | [] | no_license | janeeshaik/EngineStreamPortal---BE | edc051fe6b7cfd8c988a7b03be375812398c0808 | d9181030c655cd463935b3a756e2b0e00bdca76e | refs/heads/master | 2023-01-31T11:20:28.665246 | 2020-12-19T06:24:51 | 2020-12-19T06:24:51 | 322,774,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.ste.enginestreamportal.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
public class AuthFailException extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public AuthFailException(String resourceName, String fieldName, Object fieldValue) {
super("Userid or Password Invalid");
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
} | [
"[email protected]"
] | |
6a8691d7c3c789d105a9831b7dce0d47e686e511 | 58897aa13f843e3df554609d8c0b0f0156347abd | /esphora-conector-sap/src/main/java/ar/com/syntagma/esphora/conector/servicios/FEXGetLastCMPResponse.java | 06ecc7a5c9768bb89d51367226924c150d4281ba | [] | no_license | syntagma/esphora-jboss5 | 0c59d602ebbb219371a84375899060f29fcb4725 | d5b9dd9e2c78f4e7d82a1df79d530caecfd12f54 | refs/heads/master | 2021-03-27T13:03:34.127406 | 2014-12-23T19:03:01 | 2014-12-23T19:03:01 | 25,638,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,590 | java |
package ar.com.syntagma.esphora.conector.servicios;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import fex.dif.afip.gov.ar.FEXResponseLastCMP;
/**
* <p>Java class for FEXGetLast_CMPResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="FEXGetLast_CMPResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="return" type="{http://ar.gov.afip.dif.fex/}FEXResponseLast_CMP" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FEXGetLast_CMPResponse", propOrder = {
"_return"
})
public class FEXGetLastCMPResponse {
@XmlElement(name = "return")
protected FEXResponseLastCMP _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link FEXResponseLastCMP }
*
*/
public FEXResponseLastCMP getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link FEXResponseLastCMP }
*
*/
public void setReturn(FEXResponseLastCMP value) {
this._return = value;
}
}
| [
"[email protected]"
] | |
fd00cd82c665aa7c0fa02959e0b9e2ba1678bdff | 1afc0f38ba3c29c534a24e93107fbb579b7c3c05 | /src/main/java/client/EmpClientDemo.java | f4acb654e94443f652b791acd0b3891a1586579c | [] | no_license | Joxebus/ServidorRMI | 78ef606ebfc05bef6e08547a7485c2fb529ce204 | d97cb4212721ac48fd84321fce15f86bf9bc7639 | refs/heads/master | 2021-01-25T03:48:58.486635 | 2012-03-25T18:32:40 | 2012-03-25T18:32:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | package client;
import java.util.Iterator;
import java.util.List;
import common.dao.EmpleadoInterface;
import common.entities.Empleado;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class EmpClientDemo {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("/rmi-client-context.xml");
EmpleadoInterface employee = (EmpleadoInterface) ctx.getBean("empleadoService");
employee.addEmpleado(new Empleado("Carlos Gutierrez", "Av. Belgrano 1363"));
employee.addEmpleado(new Empleado("Marina Canes", "Las Heras 2114 PB"));
List<Empleado> empleados = employee.getEmpleados();
System.out.println("Cantidad Total de empleados: " + empleados.size());
Iterator<Empleado> it = empleados.iterator();
while (it.hasNext()) {
Empleado emp = (Empleado) it.next();
System.out.println("Nombre: " + emp.getNombre());
System.out.println("Dirección: " + emp.getDireccion());
}
}
}
| [
"[email protected]"
] | |
dcdc149d0c00ad3f8c0556f9a9163fa140a0bde5 | 401e72f25d436ce410e7ffb1fd24b481f024820d | /coding-dojo-socialnetwork/src/test/java/com/blueknow/labs/network/service/UserServiceShould.java | 2e4ace02eb6123a50ff81a390c492abdc64fcbaf | [] | no_license | francesc1971/socialnetwork-coding-dojo | 40b00b203564a834055cabfe0b04bff8e9dfe6e6 | 4ea1d95b17149726775fb4b6944b6153bcf23b8a | refs/heads/master | 2022-06-07T07:48:17.856518 | 2019-11-19T12:19:42 | 2019-11-19T12:19:42 | 219,491,641 | 0 | 0 | null | 2022-05-20T21:14:20 | 2019-11-04T12:02:42 | Java | UTF-8 | Java | false | false | 1,675 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Blueknow Labs
*
* (c) Copyright 2009-2019 Blueknow, S.L.
*
* ALL THE RIGHTS ARE RESERVED
*/
package com.blueknow.labs.network.service;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.Test;
import com.blueknow.labs.network.model.User;
import com.blueknow.labs.network.port.out.UserRepository;
public class UserServiceShould {
private final UserRepository repository = new MockUserRepository();
private UserService service = new UserService(this.repository);
@Test
void exist_user_with_given_name() {
assertTrue(this.service.existsUser("lino"));
}
@Test
void not_exist_user_with_given_name() {
assertFalse(this.service.existsUser("francesc"));
}
@Test
void create_user_from_scratch() {
assertEquals(1L, this.service.save(new User("santi")));
}
@Test
void add_follower_to_an_existent_user() {
assertTrue(this.service.follow("lino", "fede"));
}
}
class MockUserRepository implements UserRepository {
private final List<User> repository = new ArrayList<>(List.of(new User("lino")));
private final AtomicInteger generator = new AtomicInteger();
@Override
public User findUserByName(final String name) {
Objects.requireNonNull(name);
return repository.stream().filter(user -> name.equals(user.getName())).findFirst().orElseGet(User::new);
}
@Override
public long persist(final User user) {
user.setId(generator.incrementAndGet());
this.repository.add(user);
return user.getId();
}
} | [
"[email protected]"
] | |
9e3a6f3c046132b519d6e2ad2791521cd01dd971 | 659645a1bce7366774d0718350c399b16d04b0d8 | /src/main/java/com/dnr/brrts/web/model/HazardDischargeReport.java | 5db6e1ad87c7c8ea70ea8abb5fd3b1a7bdf78fe0 | [] | no_license | Srinath-rd/RReSubmittal-angular | 3da504901d5a0d7f9f72c3ba1b4faf7379e0b992 | faa8b9a30914b92a3025dc2c4d28afbd7e8d92d0 | refs/heads/master | 2020-03-14T19:45:01.939493 | 2018-05-01T21:35:27 | 2018-05-01T21:35:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package com.dnr.brrts.web.model;
import java.util.Date;
public class HazardDischargeReport {
private String siteName;
private Address address;
private Date createdDate;
private Date updatedDate;
public String getSiteName() {
return siteName;
}
public void setSiteName(String siteName) {
this.siteName = siteName;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
}
| [
"[email protected]"
] | |
bd39929192cda969331a976cef1ce25014700422 | aa1342c2d15ae395e7a3495763ca33ea09e4c47b | /loan-risk/loan-backend-mongo/src/main/java/com/shangyong/mongo/common/MongoInit.java | edc46cac20e034aef09deb1d4e483414b8fa357c | [] | no_license | chenxinxinLoveBoy/risk | 25d77043fe8c93c2610ccaeea88914c94316e7ef | b45b4916046499fc3124b4c5a2b3cb44ad45b44e | refs/heads/master | 2020-05-19T11:54:12.555217 | 2019-05-05T09:10:28 | 2019-05-05T09:10:28 | 185,001,536 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.shangyong.mongo.common;
import com.mongodb.MongoClientOptions;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* * User: kenzhao
* * Date: 2017/8/26
* * Time: 15:45
* * PROJECT_NAME: risk-parent_2.6
* * PACKAGE_NAME: com.honglu.rabbitmq.mongo
* * DESC:
* * Version: v1.0.0
*
*/
@Configuration
public class MongoInit {
static class OptionsConfig {
@Bean
public MongoClientOptions mongoOptions() {
MongoClientOptions mongoClientOptions = MongoClientOptions.builder().socketTimeout(500000).connectTimeout(9000).serverSelectionTimeout(0).build();
return mongoClientOptions;
}
}
}
| [
"[email protected]"
] | |
4a32a7ac245b19859c53269464fea9361d4a77c2 | f9972ad9643370ac6c66a0b7de93862cf731bb8b | /ymjt/src/main/java/com/ymjt/controller/UploadAttachment.java | 7724542acd60e2a2e2b35d4143a8c40dce86da5a | [] | no_license | mawengqi/ymjt | a2e6fa4a02da0beea2d4cc1cc1bced3a27b2ecab | 00da507b7016fe15a3e72bb02cb8c1a32d7243cd | refs/heads/master | 2020-04-25T15:28:20.815623 | 2019-03-31T10:14:52 | 2019-03-31T10:14:52 | 172,880,212 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.ymjt.controller;
import com.alibaba.fastjson.JSON;
import com.ymjt.commons.FileUpload;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class UploadAttachment extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
try {
resp.getWriter().write(JSON.toJSONString(FileUpload.uploadAttachment(req)));
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
f1a1da76801c0ebd7bf23e3838791c6a0823d0ba | 044d28a32d20eb429e308abe22a63f1352792101 | /2605 줄 세우기.java | 2ef97b700cc176afc549f6f36dec364f1b5699b7 | [] | no_license | yudh1232/Baekjoon-Online-Judge-Algorithm | 241af065b9512d0d2ffab0cfd90ea8fc76f9f4b2 | 7b5b9b2a30b41d5e20f6f1156f5b65900fe291b5 | refs/heads/main | 2023-09-02T14:14:50.015915 | 2021-10-10T15:01:41 | 2021-10-10T15:01:41 | 387,082,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int n = Integer.parseInt(in.readLine());
int[] number = new int[n];
StringTokenizer st = new StringTokenizer(in.readLine(), " ");
for (int i = 0; i < n; i++) {
number[i] = Integer.parseInt(st.nextToken());
}
LinkedList<Integer> line = new LinkedList<Integer>();
for (int i = 0; i < n; i++) {
// (학생의 원래 위치 - 학생이 뽑은 번호) index에 넣어줌
line.add(i - number[i], i + 1);
}
// 출력문 생성
for (int i = 0; i < n; i++) {
sb.append(line.get(i)).append(" ");
}
sb.setLength(sb.length() - 1);
// 결과 출력
System.out.println(sb);
}
}
| [
"[email protected]"
] | |
df01e84fa3f848c5c5f8424b352c2a5969717133 | bc241fbadf1d15997a6a428cac3e5fb17d43d933 | /src/com/tistory/workshop/jobs/Musketeer.java | ca579db70e5a69940c1c50cb8095b111e563e05a | [
"MIT"
] | permissive | mc-rpg-plugin/2021RPG-Plugin | 1e5f79dd398d2715aa43c4d93cb52d0e76bfbfc4 | 017750df20f336307d328159eef9cb585f58751b | refs/heads/main | 2023-08-18T20:11:55.501243 | 2021-09-17T02:12:59 | 2021-09-17T02:12:59 | 400,002,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,209 | java | package com.tistory.workshop.jobs;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public class Musketeer implements Listener {
public static HashMap<UUID, Integer> shotCount = new HashMap<>();
@EventHandler
public void headShot(EntityDamageByEntityEvent e) {
Entity tool = e.getDamager();
if (tool instanceof Arrow) {
if (e.getEntity() instanceof Player) {
if (((Arrow) tool).getShooter() instanceof Player) {
Player shooter = (Player) ((Arrow) tool).getShooter();
if (!JobVariable.getPlayerJob(shooter, "Musketeer")) {
return;
}
if (shooter != null) {
if (shotCount.containsKey(shooter.getUniqueId()) && shotCount.get(shooter.getUniqueId()) < 3) {
shotCount.put(shooter.getUniqueId(), shotCount.get(shooter.getUniqueId()) + 1);
if (shotCount.containsKey(shooter.getUniqueId()) && shotCount.get(shooter.getUniqueId()) > 3)
e.setDamage(e.getDamage() * 2);
}
else {
shotCount.put(shooter.getUniqueId(), 0);
}
}
}
}
}
}
@EventHandler
public void grenade(PlayerEggThrowEvent e) {
Player player = e.getPlayer();
if (!JobVariable.getPlayerJob(player, "Musketeer")) {
return;
}
if (JobVariable.isAvailable(player.getUniqueId(), "grenade")) {
Egg egg = e.getEgg();
egg.setVisualFire(true);
if (egg.isEmpty()) {
egg.getWorld().createExplosion(egg.getLocation(), (float) 7.5, false, false);
} else {
egg.getWorld().createExplosion(egg.getLocation(), (float) 9, false, false);
egg.getWorld().createExplosion(egg.getLocation(), (float) 7.5, false, false);
egg.getWorld().createExplosion(egg.getLocation(), (float) 6, false, false);
egg.getWorld().createExplosion(egg.getLocation(), (float) 4.5, false, false);
egg.getWorld().createExplosion(egg.getLocation(), (float) 3, false, false);
}
JobVariable.setCoolTime(player.getUniqueId(), System.currentTimeMillis(), "grenade");
}
else {
player.sendMessage(ChatColor.BLACK + "[수류탄]" + ChatColor.WHITE + " 쿨타임 남은 시간: "
+ -1 * (JobVariable.getSkillCoolLeft(player.getUniqueId(), "grenade")) + "초");
}
}
@EventHandler
public void blackHoleShot(ProjectileHitEvent e){
if(e.getEntity().getType() != EntityType.ARROW)
return;
Arrow arrow = (Arrow) e.getEntity();
Entity ent = (Entity) arrow.getShooter();
if (ent instanceof Player) {
Location arrowlocation = arrow.getLocation();
Player shooter = (Player) ent;
if (!JobVariable.getPlayerJob(shooter, "Musketeer")) {
return;
}
if (JobVariable.isAvailable(shooter.getUniqueId(), "black_Hole")) {
double radius = 10D;
List<Entity> nearEntity = arrow.getLocation().getWorld().getEntities();
for (Entity entity : nearEntity) {
if (entity.getLocation().distance(arrow.getLocation()) <= radius) {
if (entity == shooter)
continue;
entity.teleport(arrowlocation);
}
}
JobVariable.setCoolTime(shooter.getUniqueId(), System.currentTimeMillis(), "black_Hole");
}
else {
shooter.sendMessage(ChatColor.AQUA + "[중력자탄]" + ChatColor.WHITE + " 쿨타임 남은 시간: "
+ -1 * (JobVariable.getSkillCoolLeft(shooter.getUniqueId(), "black_Hole")) + "초");
}
}
}
@EventHandler
public void hunterWolf(PlayerInteractEvent e) {
Player player = e.getPlayer();
Action action = e.getAction();
if (!JobVariable.getPlayerJob(player, "Musketeer")) {
return;
}
if ((action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) && player.getInventory().getItemInMainHand().getType() == Material.IRON_INGOT) {
if (JobVariable.isAvailable(player.getUniqueId(), "wolf")) {
summonWolf(player, ChatColor.RED + "사냥개", 30, 4);
summonWolf(player, ChatColor.RED + "사냥개", 30, 4);
JobVariable.setCoolTime(player.getUniqueId(), System.currentTimeMillis(), "wolf");
}
else {
player.sendMessage(ChatColor.GRAY + "[사냥개]" + ChatColor.WHITE + " 쿨타임 남은 시간: "
+ -1 * (JobVariable.getSkillCoolLeft(player.getUniqueId(), "wolf")) + "초");
}
}
}
public void summonWolf(Player player, String name, float hp, float damage) {
Wolf wolf = (Wolf) player.getWorld().spawnEntity(player.getLocation(), EntityType.WOLF);
wolf.setCustomName(name);
wolf.setCustomNameVisible(true);
wolf.setOwner((AnimalTamer) player);
AttributeInstance health = wolf.getAttribute(Attribute.GENERIC_MAX_HEALTH);
health.setBaseValue(hp);
AttributeInstance attackDamage = wolf.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
attackDamage.setBaseValue(damage);
}
}
| [
"[email protected]"
] | |
c749fb7e1bfe75d838474282be04fd98752d3090 | 989619d2b95debe4790ffe92a8f2b77505257bc7 | /src/main/java/ontomobile/phd/research/impl/DefaultImitation_Terra_Sigillata_Form_Type.java | 4911942043ea401f0055fd338c2c4df6f60ac0f4 | [] | no_license | UmarRiaz321/FYPBackEndPlusResearch | 2a1221ed1f90073b804c2832d4c9dde3be1b1943 | 6cfffa8698b9c6e8d76e50ea514301136f1883b5 | refs/heads/master | 2020-11-30T01:55:33.316275 | 2019-12-26T13:26:32 | 2019-12-26T13:26:32 | 230,268,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,520 | java | package ontomobile.phd.research.impl;
import java.util.Collection;
import org.protege.owl.codegeneration.WrappedIndividual;
import org.protege.owl.codegeneration.impl.WrappedIndividualImpl;
import org.protege.owl.codegeneration.inference.CodeGenerationInference;
import org.semanticweb.owlapi.model.IRI;
import ontomobile.phd.research.Date_Range;
import ontomobile.phd.research.Imitation_Terra_Sigillata_Form_Type;
import ontomobile.phd.research.Latin_Descriptive_Label;
import ontomobile.phd.research.Vocabulary;
/**
* Generated by Protege (http://protege.stanford.edu).<br>
* Source Class: DefaultImitation_Terra_Sigillata_Form_Type <br>
* @version generated on Tue Nov 26 14:33:01 GMT+00:00 2019 by umarriaz
*/
public class DefaultImitation_Terra_Sigillata_Form_Type extends WrappedIndividualImpl implements Imitation_Terra_Sigillata_Form_Type {
public DefaultImitation_Terra_Sigillata_Form_Type(CodeGenerationInference ontology, IRI iri) {
super(ontology, iri);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#has_Date_Range
*/
public Collection<? extends Date_Range> getHas_Date_Range() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_DATE_RANGE,
DefaultDate_Range.class);
}
public boolean hasHas_Date_Range() {
return !getHas_Date_Range().isEmpty();
}
public void addHas_Date_Range(Date_Range newHas_Date_Range) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_DATE_RANGE,
newHas_Date_Range);
}
public void removeHas_Date_Range(Date_Range oldHas_Date_Range) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_DATE_RANGE,
oldHas_Date_Range);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#has_Latin_Descriptive_Label
*/
public Collection<? extends Latin_Descriptive_Label> getHas_Latin_Descriptive_Label() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_LATIN_DESCRIPTIVE_LABEL,
DefaultLatin_Descriptive_Label.class);
}
public boolean hasHas_Latin_Descriptive_Label() {
return !getHas_Latin_Descriptive_Label().isEmpty();
}
public void addHas_Latin_Descriptive_Label(Latin_Descriptive_Label newHas_Latin_Descriptive_Label) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_LATIN_DESCRIPTIVE_LABEL,
newHas_Latin_Descriptive_Label);
}
public void removeHas_Latin_Descriptive_Label(Latin_Descriptive_Label oldHas_Latin_Descriptive_Label) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_LATIN_DESCRIPTIVE_LABEL,
oldHas_Latin_Descriptive_Label);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#has_Stratigraphic_Relation_with
*/
public Collection<? extends WrappedIndividual> getHas_Stratigraphic_Relation_with() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_STRATIGRAPHIC_RELATION_WITH,
WrappedIndividualImpl.class);
}
public boolean hasHas_Stratigraphic_Relation_with() {
return !getHas_Stratigraphic_Relation_with().isEmpty();
}
public void addHas_Stratigraphic_Relation_with(WrappedIndividual newHas_Stratigraphic_Relation_with) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_STRATIGRAPHIC_RELATION_WITH,
newHas_Stratigraphic_Relation_with);
}
public void removeHas_Stratigraphic_Relation_with(WrappedIndividual oldHas_Stratigraphic_Relation_with) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HAS_STRATIGRAPHIC_RELATION_WITH,
oldHas_Stratigraphic_Relation_with);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#is_overlain_by
*/
public Collection<? extends WrappedIndividual> getIs_overlain_by() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_OVERLAIN_BY,
WrappedIndividualImpl.class);
}
public boolean hasIs_overlain_by() {
return !getIs_overlain_by().isEmpty();
}
public void addIs_overlain_by(WrappedIndividual newIs_overlain_by) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_OVERLAIN_BY,
newIs_overlain_by);
}
public void removeIs_overlain_by(WrappedIndividual oldIs_overlain_by) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_OVERLAIN_BY,
oldIs_overlain_by);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#is_part_of
*/
public Collection<? extends WrappedIndividual> getIs_part_of() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF,
WrappedIndividualImpl.class);
}
public boolean hasIs_part_of() {
return !getIs_part_of().isEmpty();
}
public void addIs_part_of(WrappedIndividual newIs_part_of) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF,
newIs_part_of);
}
public void removeIs_part_of(WrappedIndividual oldIs_part_of) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF,
oldIs_part_of);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#is_part_of_spatial
*/
public Collection<? extends WrappedIndividual> getIs_part_of_spatial() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF_SPATIAL,
WrappedIndividualImpl.class);
}
public boolean hasIs_part_of_spatial() {
return !getIs_part_of_spatial().isEmpty();
}
public void addIs_part_of_spatial(WrappedIndividual newIs_part_of_spatial) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF_SPATIAL,
newIs_part_of_spatial);
}
public void removeIs_part_of_spatial(WrappedIndividual oldIs_part_of_spatial) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF_SPATIAL,
oldIs_part_of_spatial);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#is_part_of_temporal
*/
public Collection<? extends WrappedIndividual> getIs_part_of_temporal() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF_TEMPORAL,
WrappedIndividualImpl.class);
}
public boolean hasIs_part_of_temporal() {
return !getIs_part_of_temporal().isEmpty();
}
public void addIs_part_of_temporal(WrappedIndividual newIs_part_of_temporal) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF_TEMPORAL,
newIs_part_of_temporal);
}
public void removeIs_part_of_temporal(WrappedIndividual oldIs_part_of_temporal) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_PART_OF_TEMPORAL,
oldIs_part_of_temporal);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#is_subset_of
*/
public Collection<? extends WrappedIndividual> getIs_subset_of() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_SUBSET_OF,
WrappedIndividualImpl.class);
}
public boolean hasIs_subset_of() {
return !getIs_subset_of().isEmpty();
}
public void addIs_subset_of(WrappedIndividual newIs_subset_of) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_SUBSET_OF,
newIs_subset_of);
}
public void removeIs_subset_of(WrappedIndividual oldIs_subset_of) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_SUBSET_OF,
oldIs_subset_of);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#is_superset_of
*/
public Collection<? extends WrappedIndividual> getIs_superset_of() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_SUPERSET_OF,
WrappedIndividualImpl.class);
}
public boolean hasIs_superset_of() {
return !getIs_superset_of().isEmpty();
}
public void addIs_superset_of(WrappedIndividual newIs_superset_of) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_SUPERSET_OF,
newIs_superset_of);
}
public void removeIs_superset_of(WrappedIndividual oldIs_superset_of) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_IS_SUPERSET_OF,
oldIs_superset_of);
}
/* ***************************************************
* Object Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#overlays
*/
public Collection<? extends WrappedIndividual> getOverlays() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_OVERLAYS,
WrappedIndividualImpl.class);
}
public boolean hasOverlays() {
return !getOverlays().isEmpty();
}
public void addOverlays(WrappedIndividual newOverlays) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_OVERLAYS,
newOverlays);
}
public void removeOverlays(WrappedIndividual oldOverlays) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_OVERLAYS,
oldOverlays);
}
/* ***************************************************
* Data Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#has_Description
*/
public Collection<? extends String> getHas_Description() {
return getDelegate().getPropertyValues(getOwlIndividual(), Vocabulary.DATA_PROPERTY_HAS_DESCRIPTION, String.class);
}
public boolean hasHas_Description() {
return !getHas_Description().isEmpty();
}
public void addHas_Description(String newHas_Description) {
getDelegate().addPropertyValue(getOwlIndividual(), Vocabulary.DATA_PROPERTY_HAS_DESCRIPTION, newHas_Description);
}
public void removeHas_Description(String oldHas_Description) {
getDelegate().removePropertyValue(getOwlIndividual(), Vocabulary.DATA_PROPERTY_HAS_DESCRIPTION, oldHas_Description);
}
/* ***************************************************
* Data Property http://www.semanticweb.org/daan/ontologies/2016/3/BDRTontology#has_Reference
*/
public Collection<? extends String> getHas_Reference() {
return getDelegate().getPropertyValues(getOwlIndividual(), Vocabulary.DATA_PROPERTY_HAS_REFERENCE, String.class);
}
public boolean hasHas_Reference() {
return !getHas_Reference().isEmpty();
}
public void addHas_Reference(String newHas_Reference) {
getDelegate().addPropertyValue(getOwlIndividual(), Vocabulary.DATA_PROPERTY_HAS_REFERENCE, newHas_Reference);
}
public void removeHas_Reference(String oldHas_Reference) {
getDelegate().removePropertyValue(getOwlIndividual(), Vocabulary.DATA_PROPERTY_HAS_REFERENCE, oldHas_Reference);
}
}
| [
"[email protected]"
] | |
43332baeb0e97a0d7fe100418fefb58f267558d7 | eb32055973557713aefcd6eb934d296bf6f10b3e | /backend/src/main/java/be/pdp/modelcar/backend/CarService.java | 8b9e21308570c839d7b9b7a8ce0355f983edb1a0 | [] | no_license | pdp/modelcar | ee7c21ea7169fcf2876d9d929d30a4df08fff0cf | 2463fcb1af95d1013420721166f618d8057e8fae | refs/heads/master | 2021-09-09T15:37:47.160143 | 2018-03-17T15:06:48 | 2018-03-17T15:06:48 | 106,099,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 678 | java | package be.pdp.modelcar.backend;
import be.pdp.modelcar.domain.Brand;
import be.pdp.modelcar.domain.Car;
import be.pdp.modelcar.domain.Model;
import be.pdp.modelcar.dto.*;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* Created by peterdp on 27/10/2017.
*/
public interface CarService {
List<BrandDto> findAllBrands();
List<ColorDto> findAllColors();
List<ScaleDto> findAllScales();
List<ModelDto> findByBrandId(Long brandId);
List<CarDto> findAllBy(Pageable pageable );
Car save(CarDto carDto);
void delete(String carId);
Brand saveBrand(BrandDto brandDto);
Model saveModel(ModelDto modelDto);
}
| [
"[email protected]"
] | |
bc3cfec099c4e0153ffb21187c92866ec88e83f0 | 440bd9b8b13f7a5dfcd61b35896badd29a91bf97 | /task-schedule/src/main/java/com/lark/middleware/task/schedule/core/ProcessInfo.java | 70bf6432dc54d9e069ef0dea620977957a88f90b | [] | no_license | relax-qs/middleware | e3deebf04a5799d46c9b39275b70afcee94495c3 | b0689770d6d3ed7f01aadd75fdf72c575b7175e2 | refs/heads/master | 2021-05-13T19:42:20.360995 | 2018-01-18T02:43:19 | 2018-01-18T02:43:19 | 116,897,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package com.lark.middleware.task.schedule.core;
import java.util.concurrent.atomic.AtomicLong;
/**
* Created by houenxun on 16/8/23.
*/
public class ProcessInfo {
AtomicLong load = new AtomicLong(0); // 载入量
AtomicLong success = new AtomicLong(0); // 成功数量
AtomicLong failed = new AtomicLong(0); // 失败数量
public AtomicLong getLoad() {
return load;
}
public AtomicLong getSuccess() {
return success;
}
public AtomicLong getFailed() {
return failed;
}
void addLoad(){
load.incrementAndGet();
}
void addSuccess(){
success.incrementAndGet();
}
void addFailed(){
failed.incrementAndGet();
}
@Override
public String toString() {
return "ProcessInfo{" +
"load=" + load +
", success=" + success +
", failed=" + failed +
'}';
}
}
| [
"[email protected]"
] | |
dfc16e68b31570041be4e5dd2044dac9f7a5775c | 9595369ae57f0d250dbcf94695002314f30f5f8d | /src/main/java/eu/mcone/oneattack/kit/AttackerRole.java | 14b27270d61b4b973e86a54f45bc596fe36a80c6 | [] | no_license | mconeeu/oneattack | 85cc8f63e1ad97f8dd0a9cd51ab6aee9766d9aaf | 7d8ae96eb4695cb48437920866c09eaba227c5dd | refs/heads/master | 2023-08-11T03:24:42.366174 | 2021-09-16T15:46:05 | 2021-09-16T15:46:05 | 407,222,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,812 | java | package eu.mcone.oneattack.kit;
import eu.mcone.coresystem.api.bukkit.item.ItemBuilder;
import eu.mcone.gameapi.api.kit.Kit;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public enum AttackerRole {
DEFAULT_ROLE("Standard Rolle", Role.DEFAULT_ATTACKER, new ItemBuilder(Material.IRON_PICKAXE, 1).displayName("§fStandard Rolle")
.lore("",
"§7§oMit dieser Rolle erhälst du:",
"§8» §6Keinen Vorteile",
"",
"§7Kosten: §f0 Coins",
"§c§oDu hast dieses Kit immer!"
).create()),
PUSHER("Pusher Rolle", Role.PUSHER, new ItemBuilder(Material.IRON_SWORD, 1).displayName("§fPusher Rolle")
.lore("",
"§7§oMit dieser Rolle erhälst du:",
"§8» §64 Spitzhacke die schneller nicht",
"§8» §6verstärkte Wände öffnet",
"",
"§7Kosten: §f50 Coins"
).create()),
SAVER("§fSicherer Rolle", Role.SAVER, new ItemBuilder(Material.GOLD_CHESTPLATE, 1).displayName("§fSicherer Rolle")
.displayName("§fSicherer-Rolle")
.lore(
"",
"§7§oMit dieser Rolle erhälst du:",
"§8» §64 Spitzhacken die",
"§8» §64 verstärkte Wände öffnet",
"",
"§7Kosten: §f25 Coins"
).create());
@Getter
private final String name;
@Getter
private final Kit kit;
@Getter
private final ItemStack item;
AttackerRole(String name, Kit kit, ItemStack item) {
this.name = name;
this.item = item;
this.kit = kit;
}
}
| [
"[email protected]"
] | |
597d599cbf34591736b949f73d79d3c550411f03 | d57014c8e6887189e68bc531b73cfceb44096383 | /components/studio-platform/plugins/org.wso2.integrationstudio.eclipse.registry.base/src/org/wso2/integrationstudio/eclipse/registry/base/ui/util/SWTControlUtils.java | 2d6a897cea045343f3e3cb15546f8d93671a0dad | [
"Apache-2.0"
] | permissive | joaonart/integration-studio | ddf6125ebfaeb2745dabd6c6f83df3f6d06a78db | 52a7454ae64aff7266ff8a0dc06441a23c4b93a1 | refs/heads/main | 2023-01-24T09:28:36.559648 | 2020-12-11T12:47:19 | 2020-12-11T12:47:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,260 | java | /*
* Copyright (c) 2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.integrationstudio.eclipse.registry.base.ui.util;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.wso2.integrationstudio.eclipse.registry.base.persistent.RegistryCredentialData;
import org.wso2.integrationstudio.eclipse.registry.base.persistent.RegistryCredentialData.Credentials;
import org.wso2.integrationstudio.eclipse.registry.base.ui.dialog.CredentialsDialog;
public class SWTControlUtils {
/**
* create label
* @param parent
* @param style
* @param text
* @param layoutData
* @param backColor
* @param font
* @return
*/
public static Label createLabel(Composite parent,
int style,
String text,
Object layoutData,
Color backColor,
Font font) {
Label lbl = new Label(parent, style);
if (font != null){
lbl.setFont(font);
}
if (backColor != null){
lbl.setBackground(backColor);
}
lbl.setText(text);
if (layoutData != null){
lbl.setLayoutData(layoutData);
}
return lbl;
}
/**
* request for credentials
* @param shell
* @param registryUrl
* @param username
* @return
*/
public static Credentials requestCredentials(Shell shell,
String registryUrl,
String username){
CredentialsDialog dialog = new CredentialsDialog(shell,
registryUrl,
username);
dialog.setBlockOnOpen(true);
dialog.create();
dialog.getShell().setSize(450, 198);
int status = dialog.open();
if (status == dialog.OK) {
Credentials credentials = new Credentials();
// if(dialog.getUserName().equals(RegistryCredentialData.getInstance().getUsername(registryUrl)) &&
// dialog.getPasswd().equals(RegistryCredentialData.getInstance().getPassword(registryUrl))){
credentials.setUsername(dialog.getUserName());
credentials.setPassword(dialog.getPasswd());
if (dialog.isSavePassword()) {
RegistryCredentialData.getInstance().setCredentials(registryUrl, credentials);
}
return credentials;
// }else{
// return null;
// }
} else if(status==dialog.CANCEL){
dialog.close();
//return new Credentials();
}
return null;
}
/**
* derive selection
* @param arg
* @return
*/
public static Object deriveSelection(Object arg) {
if (arg instanceof ObjectPluginAction) {
ObjectPluginAction obj = (ObjectPluginAction) arg;
arg = obj.getSelection();
}
if (arg instanceof TreeSelection) {
TreeSelection tree = (TreeSelection) arg;
return tree.getFirstElement();
}
return null;
}
/**
* close associated editor
* @param editorInput
*/
public static void closeAssociatedEditor(IEditorInput editorInput) {
if (editorInput == null){
return;
}
IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages();
IWorkbenchPage correctPage = null;
IEditorPart editorPart = null;
for (IWorkbenchPage page : pages) {
if (page.getActiveEditor() != null
&& page.getActiveEditor().getEditorInput() == editorInput) {
correctPage = page;
editorPart = page.getActiveEditor();
break;
}
}
if (correctPage != null) {
correctPage.activate(editorPart);
correctPage.closeEditor(editorPart, false);
}
}
}
| [
"[email protected]"
] | |
68fbd76153b7361466012dea6ecdbfaea5a32779 | 7e282d9be9ca6514155f3f86b57b698c460eab22 | /SBS_KFK_SPRK_PNTH_HDP_APP/app-authenticator-service/src/main/java/com/ksh/crfi/windows/user/UserController.java | 4885eb30de142e0af5fcd8f4523a0dd4bf9e8e74 | [] | no_license | sakethoney/realtime_monitoring | ae664a5b5b543cae20c0dc7c1a134d142edb9474 | 83e61e5273265da4d0ac78f170263bec18a4c7df | refs/heads/master | 2023-02-26T02:34:05.955376 | 2021-01-28T06:28:34 | 2021-01-28T06:28:34 | 333,666,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.ksh.crfi.windows.user;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.common.base.Strings;
@RestController
@CrossOrigin
public class UserController {
@RequestMapping(value="/authentication", produces="application/javascript")
public String getUserJsonp(Authentication auth, String callback) {
String prefix = Strings.isNullOrEmpty(callback)?"_ng_jsonp_._req0.finished": callback;
return String.format("%s([\"%s\"])", prefix, auth.getPrincipal().toString().replace("\\", "_"));
}
}
| [
"[email protected]"
] | |
0923abc174779e6db04cb728d6af3cbaa1c69bc3 | 3ad45f4791d1f96c4350c48e02acf02365a710ef | /00.source-code/blogs/java/src/main/java/com/zch/blogs/java/multithreads/lock/ReentrantLockDemo4.java | 1db0f2eb5ebcd27a37ed98605aca76c4e3b05d39 | [
"Apache-2.0"
] | permissive | wardensky/blogs | bd32ebe2a984a712752fa5e93484eb0b63eba3e3 | e8f347d05b59684f81ea6f7ee8cdbe0d701122f5 | refs/heads/master | 2021-07-05T11:24:28.269856 | 2019-03-12T03:01:47 | 2019-03-12T03:01:47 | 132,843,915 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package com.zch.blogs.java.multithreads.lock;
public class ReentrantLockDemo4 {
}
| [
"[email protected]"
] | |
9cd5282cc7e6d23814dc355de420259fc456e7da | be2e0cbaf67a70aa8e2e73bab17a7b3d4ef92eb8 | /src/main/java/com/siddu/util/CustomUtil.java | f66438faa018bb39dbf21275ca4bbbd6ebbdc5af | [] | no_license | sidduSthawarmath/JUnitMokito | d0929c4c415ee5c01e7f86ba1ba5db0e0813684b | 871f8058b360c43f2ae03c7fceef5436e40e3970 | refs/heads/master | 2020-04-29T02:29:35.630383 | 2019-03-15T07:30:45 | 2019-03-15T07:30:45 | 175,769,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.siddu.util;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@Component
public class CustomUtil {
public CustomResponse getCustomResponse(HttpStatus status, String description, Object data) {
CustomResponse response = new CustomResponse();
response.setStatus(status.toString());
response.setDescription(description);
response.setData(data);
return response;
}
}
| [
"[email protected]"
] | |
d2ac430138f08abc86f7eca38066f2f344e33adc | 5bd2d0aa5bd77c5b4a487ef43c833de4144bf23d | /src/Lesson11/Lesson1/Lesson3/Case.java | d6ade9f05879ca7e51040294abb3ccfae4097cf0 | [] | no_license | masaki5/Java | e2f8856d42a075f5ef15c5636e7c15338b2c852d | 71c0b65f8693d439d56e3334ab0a0b79413303b9 | refs/heads/main | 2023-04-22T05:14:20.059024 | 2021-05-03T19:10:20 | 2021-05-03T19:10:20 | 312,619,862 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package Lesson11.Lesson1.Lesson3;
public class Case {
public static void main(String[]args){
System.out.println("あなたの運勢を占います");
int fortune = new java.util.Random().nextInt(4) + 1;
switch (fortune){
case 1:
System.out.println("大吉");
break;
case 2:
System.out.println("中吉");
break;
case 3:
System.out.println("普通です");
break;
case 4:
System.out.println("うーん");
break;
default:
System.out.println("条件に合致しな場合?");
break;
}
}
}
| [
"[email protected]"
] | |
46aa66ddafffd87780b3ed736fde3d3a4c75cd43 | 85cc0ae495a2ec916afdd3394328acc58fe58f73 | /src/algorithmes/GA.java | 2bf31a7bbffabc94e773ef0951ac260100a3b4a7 | [] | no_license | m-a-rahal/Projet_MAE | 01e443224cc8ca153155f8fd088ba1a9ea4f07fc | ef163a6a5178c90b4cb99820c06a5928c11f9f7f | refs/heads/master | 2023-05-24T09:54:09.330785 | 2021-06-22T23:45:20 | 2021-06-22T23:45:20 | 365,625,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,066 | java | package algorithmes;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import Classes.Individus;
import Classes.Parents;
import Classes.Population;
import Classes.Solution;
public class GA extends Solveur_SAT {
public int N, max_iter;
public double taux_crossover, taux_mutation;
private ArrayList<Integer> indices;
private Random random;
public GA(int N, int taux_crossover, int taux_mutation, int max_iter) {
this.N = N;
this.taux_crossover = ((double)taux_crossover)/100;
this.taux_mutation = ((double)taux_mutation)/100;
this.max_iter = max_iter;
}
@Override
public Solution solve() {
return solve(Long.MAX_VALUE);
}
@Override
public Solution solve(long temps_max) {
Population population = new Population(); /* List of individuals of the population */
Individus x, child1, child2; /* Temporary Individus (used to create the initial population) */
ArrayList<Parents> parents = new ArrayList<>(); /* The two individuals chosen for crossover process */
Population children = new Population(); /* Results of crossing between two individuals */
random = new Random(System.currentTimeMillis());
indices = new ArrayList<>(clauses.getM());
for (int i = 0; i < clauses.getM(); i++) {
indices.add(i);
}
long startTime = System.currentTimeMillis(); /* Save the start time of the search */
int countInd = 0;
while(countInd < N) { /* Create the initial population */
x = new Individus(clauses);
if(!population.contains(x)) {
population.add(x);
countInd++;
}
}
for(int iteration=0; iteration<max_iter; iteration++) {
parents.clear();
children.clear();
if((System.currentTimeMillis() - startTime) >= temps_max)
break; /* If the search time has reached (or exceeded) the allowed run time, finish the search */
ArrayList<Individus> pop_tmp = new ArrayList<>(population);
Collections.shuffle(pop_tmp);
for (int i = 0; i < pop_tmp.size()/2; i++) {
parents.add(new Parents(pop_tmp.get(2*i), pop_tmp.get(2*i+1)));
}
for (Parents pair : parents) {
//int endroit = random.nextInt(clauses.getM());
child1 = croiser(pair.p1, pair.p2);
child2 = croiser(pair.p2, pair.p1);
children.add(muter(child1));
children.add(muter(child2));
if (child1.getF() == clauses.getN()) {
return child1;
}
if (child2.getF() == clauses.getN()) {
return child2;
}
}
for (Individus child : children) {
population.add(child); // add new child
population.remove(); // remove worst individual in population
}
}
Solution bestSol = new Solution(clauses.getM()); /* "Search time"/"max_iter" reached, return the best solution found */
for(Individus ind : population) /* Search for the best Individus (best solution <=> best evaluation) in current population */
if(bestSol.sat_count(clauses) < ind.sat_count(clauses))
bestSol = ind; /* Update the best solution */
return bestSol;
}
private Individus muter(Individus ind) {
float r = random.nextFloat();
if(r < taux_mutation) {
Collections.shuffle(indices);
for (int i = 0; i < (int)((r*taux_mutation)*clauses.getM()); i++) {
ind.muter(clauses, indices.get(i));
}
}
return ind;
}
private Individus croiser(Individus x, Individus y, int endroit) { // one point crossover
Individus res = new Individus(x);
if(random.nextFloat() < taux_crossover) {
for(int i=0; i<endroit; i++)
res.set(i, x.get(i));
for(int i=endroit; i<res.size(); i++)
res.set(i, y.get(i));
res.setF(res.sat_count(clauses));
}
return res;
}
private Individus croiser(Individus x, Individus y) { // croisement uniforme
Individus res = new Individus(x);
if(random.nextFloat() < taux_crossover) {
for(int i=0; i< res.size(); i++)
if (random.nextBoolean()) {
res.set(i, x.get(i));
} else {
res.set(i, y.get(i));
}
res.setF(res.sat_count(clauses));
}
return res;
}
@Override
public String toString() {
return String.format("%d\t%f\t%f", N, taux_crossover, taux_mutation);
}
}
| [
"[email protected]"
] | |
dc817a4ccdd35b724d6755534e39a86ff413eb40 | 764b1414d67789d6fb029b0d302f231d1719a85e | /barService/src/main/java/de/cellent/test/barService/BarServiceLocal.java | da280fba30d92c2e912225cbd42da0698ef6ff78 | [] | no_license | MatthiasBCellent/logon.multipleEAR | 46a8373bc50c3be6f823c1d55bff7b4ae91a7681 | 415e90a9a9ad19eb63a48eefd3265014056f3199 | refs/heads/master | 2021-01-10T16:21:56.837107 | 2015-11-10T06:29:29 | 2015-11-10T06:29:29 | 45,115,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 126 | java | package de.cellent.test.barService;
import javax.ejb.Local;
@Local
public interface BarServiceLocal extends BarService {
}
| [
"[email protected]"
] | |
4fc10baa129a7f07e4e20e2f1d5472ee0e3a9e1b | 93f4dfa5fe573bd3539d422ddef0968b7300a9d8 | /lcs/src/main/java/joss/jacobo/lol/lcs/adapters/MenuListAdapter.java | 40b0b06c861e9c5abbeb645dc32c5995df2fb37c | [] | no_license | jossjacobo/lol | 9b67fad2677e19cd25bd40b9f47e86ee2c0e0a99 | 534006e39423fed7ed2725bcd5814f3fd2393915 | refs/heads/master | 2020-04-10T22:48:39.264060 | 2015-10-08T02:54:44 | 2015-10-08T02:54:44 | 21,677,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,083 | java | package joss.jacobo.lol.lcs.adapters;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.List;
import joss.jacobo.lol.lcs.items.DrawerItem;
import joss.jacobo.lol.lcs.views.DrawerItemSectionTitle;
import joss.jacobo.lol.lcs.views.DrawerItemView;
/**
* Created by: jossayjacobo
* Date: 2/12/15
* Time: 1:43 PM
*/
public class MenuListAdapter extends BaseAdapter {
private Context context;
public List<DrawerItem> items;
private int hintPosition;
public MenuListAdapter(Context c, List<DrawerItem> i) {
this.context = c;
this.items = i;
}
public void setItems(List<DrawerItem> items){
this.items = items;
notifyDataSetChanged();
}
@Override
public int getCount() {
return items.size();
}
@Override
public int getItemViewType(int position){
return items.get(position).type;
}
@Override
public int getViewTypeCount(){
return DrawerItem.TYPE_MAX;
}
@Override
public Object getItem(int i) {
return items.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
public void setHint(int position) {
hintPosition = position;
notifyDataSetChanged();
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
DrawerItem item = items.get(i);
switch(item.type){
case DrawerItem.TYPE_SECTION_TITLE:
DrawerItemSectionTitle drawerItemSectionTitle = view == null ? new DrawerItemSectionTitle(context) : (DrawerItemSectionTitle) view;
drawerItemSectionTitle.setContent(item);
return drawerItemSectionTitle;
default:
DrawerItemView drawerItem = view == null ? new DrawerItemView(context) : (DrawerItemView) view;
drawerItem.setContent(item);
drawerItem.title.setSelected(i == hintPosition);
return drawerItem;
}
}
} | [
"[email protected]"
] | |
b60c91ec4f4963334e4a440320a334534655aaf4 | ca99fc721dad7c0272273e6bb467f074be780076 | /src/com/lukas/git_test/Test.java | 332ca792cb35f5e504736b9646e99bfd34721894 | [] | no_license | LukasKodym/git_tests | 4315fed860067a75feb1ec6710ab6613c0dc4601 | 0ce5701e5508acc72e18de217cbdd197777869c6 | refs/heads/master | 2020-04-04T21:01:20.262511 | 2018-11-05T19:15:34 | 2018-11-05T19:15:34 | 156,269,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | package com.lukas.git_test;
public class Test {
}
| [
"[email protected]"
] | |
c94719794ff1950fea1734e1d37e20154f8afb55 | b78ba8cbe5a0d48fbcb13a55711fd2fe595975b7 | /common/common_utils/src/main/java/com/atguigu/commonutils/R.java | 08ff3dd8d0a75ad70cf5966d609280b4f27ec02f | [] | no_license | abcjojo/guli_parent | d0a4f10a132f23792ead0afd3de8f529a77740dc | a77c112efceccd3b29ca47c0c0be1e86fa332d9f | refs/heads/master | 2023-04-08T18:12:27.565657 | 2021-04-08T14:42:15 | 2021-04-08T14:42:15 | 350,725,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | package com.atguigu.commonutils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.HashMap;
import java.util.Map;
/**
* @program: guli_parent
* @description: 同意返回结果类
* @author: Jojo.Lee
* @create: 2021-01-26 13:44
**/
@Data
public class R {
@ApiModelProperty(value = "是否成功")
private Boolean success;
@ApiModelProperty(value = "返回码")
private Integer code;
@ApiModelProperty(value = "返回消息")
private String message;
@ApiModelProperty(value = "返回数据")
private Map<String, Object> data = new HashMap<>();
// 私有构造器
private R(){}
// 成功静态方法
public static R ok(){
R r = new R();
r.setSuccess(true);
r.setCode(ResultCode.SUCCESS);
r.setMessage("成功");
return r;
}
// 失败静态方法
public static R error(){
R r = new R();
r.setSuccess(false);
r.setCode(ResultCode.ERROE);
r.setMessage("失败");
return r;
}
public R success(Boolean success){
this.setSuccess(success);
return this;
}
public R message(String message){
this.setMessage(message);
return this;
}
public R code(Integer code){
this.setCode(code);
return this;
}
public R data(String key, Object value){
this.data.put(key, value);
return this;
}
public R data(Map<String, Object> map){
this.setData(map);
return this;
}
}
| [
"[email protected]"
] | |
e1384d52623114e176536c061c3a20a14be94f90 | f27cb821dd601554bc8f9c112d9a55f32421b71b | /core/testsuite/src/test/hibernateold/com/blazebit/persistence/testsuite/Issue1018Test.java | 2153a370e350e9fa17f2b1578f77d9bc6eab21c5 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Blazebit/blaze-persistence | 94f7e75154e80ce777a61eb3d436135ad6d7a497 | a9b1b6efdd7ae388e7624adc601a47d97609fdaa | refs/heads/main | 2023-08-31T22:41:17.134370 | 2023-07-14T15:31:39 | 2023-07-17T14:52:26 | 21,765,334 | 1,475 | 92 | Apache-2.0 | 2023-08-07T18:10:38 | 2014-07-12T11:08:47 | Java | UTF-8 | Java | false | false | 4,947 | java | /*
* Copyright 2014 - 2023 Blazebit.
*
* 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.blazebit.persistence.testsuite;
import com.blazebit.persistence.testsuite.entity.LongSequenceEntity;
import org.hibernate.HibernateException;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.usertype.UserType;
import org.junit.Test;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
/**
* @author Christian Beikov
* @since 1.5.0
*/
public class Issue1018Test extends AbstractCoreTest {
@Override
protected Class<?>[] getEntityClasses() {
return new Class<?>[] {
EnumTestEntity.class
};
}
public static enum MyEnum {
VAL1(10),
VAL2(20);
private final int value;
MyEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static MyEnum byValue(int value) {
switch (value) {
case 10: return VAL1;
case 20: return VAL2;
}
return null;
}
}
public static class MyEnumUserType implements UserType {
@Override
public Class<MyEnum> returnedClass() {
return MyEnum.class;
}
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
return nullSafeGet(rs, names, (SessionImplementor) null, owner);
}
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
int id = rs.getInt(names[0]);
if (rs.wasNull()) {
return null;
}
return MyEnum.byValue(id);
}
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
nullSafeSet(st, value, index, (SessionImplementor) null);
}
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
if (value == null) {
st.setNull(index, Types.INTEGER);
} else {
st.setInt(index, ((MyEnum) value).getValue());
}
}
@Override
public Object assemble(Serializable cached, Object owner) throws HibernateException {
return cached;
}
@Override
public Object deepCopy(Object value) throws HibernateException {
return value;
}
@Override
public Serializable disassemble(Object value) throws HibernateException {
return (Serializable) value;
}
@Override
public boolean equals(Object x, Object y) throws HibernateException {
return x == y;
}
@Override
public int hashCode(Object x) throws HibernateException {
return x == null ? 0 : x.hashCode();
}
@Override
public boolean isMutable() {
return false;
}
@Override
public Object replace(Object original, Object target, Object owner) throws HibernateException {
return original;
}
@Override
public int[] sqlTypes() {
return new int[] { java.sql.Types.INTEGER };
}
}
@Entity(name = "EnumTestEntity")
@Access(AccessType.FIELD)
@TypeDef(name = "MyEnumUserType", typeClass = MyEnumUserType.class)
public static class EnumTestEntity extends LongSequenceEntity {
@Type(type = "MyEnumUserType")
MyEnum myEnum;
}
@Test
public void testEnumLiteral() {
cbf.create(em, EnumTestEntity.class)
.where("myEnum").inLiterals(MyEnum.VAL1, MyEnum.VAL2)
.whereExpression("myEnum = " + MyEnum.class.getName() + ".VAL1")
.getResultList();
}
}
| [
"[email protected]"
] | |
a9a67b2b35c639d1140ec03f40722289293efef6 | e90a6626427539a61543ad40551d325a98cdf925 | /src/main/java/com/bumptech/glide/load/resource/gif/GifFrameResourceDecoder.java | 40db6172305705fc725f675b27eaed80775a5eaf | [] | no_license | turfaa/sambhar | d0d82e0244a7e3535fc4ca7a67de47e0b309fadf | 18e498dca941acbc00468244c0143b48585cd7b9 | refs/heads/master | 2020-04-27T21:05:51.745102 | 2019-03-09T11:10:35 | 2019-03-09T11:10:35 | 174,684,008 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.bumptech.glide.load.resource.gif;
import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import com.bumptech.glide.gifdecoder.GifDecoder;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapResource;
public final class GifFrameResourceDecoder implements ResourceDecoder<GifDecoder, Bitmap> {
private final BitmapPool bitmapPool;
public boolean handles(@NonNull GifDecoder gifDecoder, @NonNull Options options) {
return true;
}
public GifFrameResourceDecoder(BitmapPool bitmapPool) {
this.bitmapPool = bitmapPool;
}
public Resource<Bitmap> decode(@NonNull GifDecoder gifDecoder, int i, int i2, @NonNull Options options) {
return BitmapResource.obtain(gifDecoder.getNextFrame(), this.bitmapPool);
}
}
| [
"[email protected]"
] | |
cca62631d517bd58fb61109be609561ca5c23c11 | 4d41728f620d6be9916b3c8446da9e01da93fa4c | /src/main/java/org/bukkit/block/CommandBlock.java | 229db12f15b58ee560c6e33c776eef699ed9fa88 | [] | no_license | TechCatOther/um_bukkit | a634f6ccf7142b2103a528bba1c82843c0bc4e44 | 836ed7a890b2cb04cd7847eff2c59d7a2f6d4d7b | refs/heads/master | 2020-03-22T03:13:57.898936 | 2018-07-02T09:20:00 | 2018-07-02T09:20:00 | 139,420,415 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | package org.bukkit.block;
public interface CommandBlock extends BlockState
{
/**
* Gets the command that this CommandBlock will run when powered.
* This will never return null. If the CommandBlock does not have a
* command, an empty String will be returned instead.
*
* @return Command that this CommandBlock will run when powered.
*/
public String getCommand();
/**
* Sets the command that this CommandBlock will run when powered.
* Setting the command to null is the same as setting it to an empty
* String.
*
* @param command Command that this CommandBlock will run when powered.
*/
public void setCommand(String command);
/**
* Gets the name of this CommandBlock. The name is used with commands
* that this CommandBlock executes. This name will never be null, and
* by default is "@".
*
* @return Name of this CommandBlock.
*/
public String getName();
/**
* Sets the name of this CommandBlock. The name is used with commands
* that this CommandBlock executes. Setting the name to null is the
* same as setting it to "@".
*
* @param name New name for this CommandBlock.
*/
public void setName(String name);
} | [
"[email protected]"
] | |
63b713cf8b645d0bcb8f07bc1a3a8e56b7691119 | e57629c517018c2a434b68d03d40d2ddcbc8cdec | /app/src/main/java/com/bebi/bebi_uas/splashscreen/SplashActivity.java | 8d6c7ffccebeb615a6605363a7cdd5953b5af073 | [] | no_license | alfanshter/Crud_API_Bebi | 4bd27e7330137002f7addbf3117b28a95c670842 | a2d5bd538fbaf18a1131f45d48c5602b956691b6 | refs/heads/main | 2023-06-11T02:39:38.346606 | 2021-06-30T14:16:04 | 2021-06-30T14:16:04 | 381,726,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | package com.bebi.bebi_uas.splashscreen;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.bebi.bebi_uas.R;
import com.bebi.bebi_uas.auth.LoginActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
}, 2000);
}
} | [
"[email protected]"
] | |
52e0a38607dd2345ecb35c9f0c6a423f7908ade9 | c3eaac04f8c9ed71f0b78f72addbc24227c9c38a | /addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/lessons_62/tests/ContactModificationTests.java | b1c2133793f2b2c692f65362a48705712f424505 | [
"Apache-2.0"
] | permissive | freeitgroupe/qa_crm | cf4695ae9f59ba472ab484c4be4a68d9f883c0bf | 8c83f8cea3cf0f3bbc2970019838bf4f66ac97a4 | refs/heads/main | 2023-04-19T22:40:51.911379 | 2021-04-27T20:45:31 | 2021-04-27T20:45:31 | 311,136,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package ru.stqa.pft.addressbook.lessons_62.tests;
import org.testng.annotations.Test;
public class ContactModificationTests extends TestBase {
@Test(enabled = false)
public void testContactModification(){
app.goTo().gotoHomePage();
//Проверка на наличие группы
if (!app.contact().isThereContact()){
//app.contact().creationContact(new ContactData("test_name", "test_surname", "test4"), true);
}
app.contact().initContactModification();
//app.contact().fillContactForm(new ContactData("test_name", "test_surname", null), false);
app.contact().submitContactModification();
app.contact().returnToHomePage();
}
}
| [
"[email protected]"
] | |
3d921a369729932e77a0c059fa35ad5de2b86d79 | d6a6ce3a4f11782593b8c74f33c969ca571e566b | /src/us/kbase/genehomology/config/GeneHomologyConfigurationException.java | 57ee570556a3b95b115b6b56a19da3918ce3e0d2 | [
"MIT"
] | permissive | MrCreosote/GeneHomologyPrototype | e2e8be1c4bd11663aa0d6bebdbf76e444b349de5 | 7ce44e906a9bdfe99b77ef06452a4febff0889f1 | refs/heads/master | 2020-03-29T08:26:23.478693 | 2018-10-04T04:23:57 | 2018-10-04T04:23:57 | 149,711,430 | 0 | 0 | null | 2018-09-21T04:50:28 | 2018-09-21T04:50:28 | null | UTF-8 | Java | false | false | 453 | java | package us.kbase.genehomology.config;
/** Thrown when a configuration is invalid.
* @author [email protected]
*
*/
public class GeneHomologyConfigurationException extends Exception {
private static final long serialVersionUID = 1L;
public GeneHomologyConfigurationException(final String message) {
super(message);
}
public GeneHomologyConfigurationException(
final String message,
final Throwable cause) {
super(message, cause);
}
} | [
"[email protected]"
] | |
66ddfd917275c4c839e57f1ec47ccf23b542fc6e | 6448b43cbf44ec1d0b54922e6a8dab4e09e9653b | /src/test/java/booksRequests/DELETEBook.java | 3fbd2777e659438980d48f17924187f19d68d12e | [] | no_license | gabriel-salvatierra/RestAssuredExample | 38eebd76dd726ac78d9d09cdaabdffdf071cd4cc | 00a2d4141e959f980026387d1984d2e5b3c1b275 | refs/heads/master | 2020-05-15T09:43:11.658647 | 2019-04-23T20:50:50 | 2019-04-23T20:50:50 | 182,182,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 56 | java | package booksRequests;
public class DELETEBook {
}
| [
"[email protected]"
] | |
338de2b5bf5de11203af1896b7f84988357735d3 | 0f48407a162f2f313f55da0dc0ae9d1f3a73441d | /src/main/java/com/dropshipping/service/dto/DistrictDTO.java | a3f4a2569a6b5068d25120ee4a0264f1717b55b5 | [] | no_license | tk1cntt/drop-shipping-backend | 6d76461df0627707b32c0de0733e48791a07702a | f785c40a9a710b927d7149b3194360d681352b0f | refs/heads/master | 2022-12-22T16:06:50.564863 | 2019-06-07T00:03:06 | 2019-06-07T00:03:06 | 190,098,548 | 4 | 1 | null | 2022-12-16T04:52:41 | 2019-06-03T23:57:45 | Java | UTF-8 | Java | false | false | 2,145 | java | package com.dropshipping.service.dto;
import java.time.LocalDate;
import java.io.Serializable;
import java.util.Objects;
/**
* A DTO for the {@link com.dropshipping.domain.District} entity.
*/
public class DistrictDTO implements Serializable {
private Long id;
private String name;
private Boolean enabled;
private LocalDate createAt;
private LocalDate updateAt;
private Long cityId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean isEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public LocalDate getCreateAt() {
return createAt;
}
public void setCreateAt(LocalDate createAt) {
this.createAt = createAt;
}
public LocalDate getUpdateAt() {
return updateAt;
}
public void setUpdateAt(LocalDate updateAt) {
this.updateAt = updateAt;
}
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DistrictDTO districtDTO = (DistrictDTO) o;
if (districtDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), districtDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "DistrictDTO{" +
"id=" + getId() +
", name='" + getName() + "'" +
", enabled='" + isEnabled() + "'" +
", createAt='" + getCreateAt() + "'" +
", updateAt='" + getUpdateAt() + "'" +
", city=" + getCityId() +
"}";
}
}
| [
"[email protected]"
] | |
c468616c4f06c23b5c69f1fc1756b53a24b27879 | e2d2a1ce1620e82544b87fc203cdb7b5a3526fbd | /app/src/main/java/com/zll/wuye/lvshi/fragment/information/jpush/LocalBroadcastManager.java | 07ea5cd856261e86ef1a3a2f5831f6687e21c17d | [] | no_license | 76782875/Attorney | 228ac0d02c6a728442cae195159084caa00d6b21 | 63835154524ebe3680ed49904bd73e7b97f0b2a8 | refs/heads/master | 2021-06-21T06:28:57.059361 | 2017-08-02T14:04:05 | 2017-08-02T14:04:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,719 | java | package com.zll.wuye.lvshi.fragment.information.jpush;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
/**
* Created by efan on 2017/4/14.
*/
public final class LocalBroadcastManager {
private static final String TAG = "LocalBroadcastManager";
private static final boolean DEBUG = false;
private final Context mAppContext;
private final HashMap<BroadcastReceiver, ArrayList<IntentFilter>> mReceivers = new HashMap<BroadcastReceiver, ArrayList<IntentFilter>>();
private final HashMap<String, ArrayList<ReceiverRecord>> mActions = new HashMap<String, ArrayList<ReceiverRecord>> ();
private final ArrayList<BroadcastRecord> mPendingBroadcasts = new ArrayList<BroadcastRecord>();
static final int MSG_EXEC_PENDING_BROADCASTS = 1;
private final Handler mHandler;
private static final Object mLock = new Object();
private static LocalBroadcastManager mInstance;
public static LocalBroadcastManager getInstance(Context context) {
Object var1 = mLock;
synchronized (mLock) {
if (mInstance == null) {
mInstance = new LocalBroadcastManager(context.getApplicationContext());
}
return mInstance;
}
}
private LocalBroadcastManager(Context context) {
this.mAppContext = context;
this.mHandler = new Handler(context.getMainLooper()) {
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
LocalBroadcastManager.this.executePendingBroadcasts();
break;
default:
super.handleMessage(msg);
}
}
};
}
public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
HashMap var3 = this.mReceivers;
synchronized (this.mReceivers) {
ReceiverRecord entry = new ReceiverRecord(filter, receiver);
ArrayList filters = (ArrayList) this.mReceivers.get(receiver);
if (filters == null) {
filters = new ArrayList(1);
this.mReceivers.put(receiver, filters);
}
filters.add(filter);
for (int i = 0; i < filter.countActions(); ++i) {
String action = filter.getAction(i);
ArrayList entries = (ArrayList) this.mActions.get(action);
if (entries == null) {
entries = new ArrayList(1);
this.mActions.put(action, entries);
}
entries.add(entry);
}
}
}
public void unregisterReceiver(BroadcastReceiver receiver) {
HashMap var2 = this.mReceivers;
synchronized (this.mReceivers) {
ArrayList filters = (ArrayList) this.mReceivers.remove(receiver);
if (filters != null) {
for (int i = 0; i < filters.size(); ++i) {
IntentFilter filter = (IntentFilter) filters.get(i);
for (int j = 0; j < filter.countActions(); ++j) {
String action = filter.getAction(j);
ArrayList receivers = (ArrayList) this.mActions.get(action);
if (receivers != null) {
for (int k = 0; k < receivers.size(); ++k) {
if (((ReceiverRecord) receivers.get(k)).receiver == receiver) {
receivers.remove(k);
--k;
}
}
if (receivers.size() <= 0) {
this.mActions.remove(action);
}
}
}
}
}
}
}
public boolean sendBroadcast(Intent intent) {
HashMap var2 = this.mReceivers;
synchronized (this.mReceivers) {
String action = intent.getAction();
String type = intent.resolveTypeIfNeeded(this.mAppContext.getContentResolver());
Uri data = intent.getData();
String scheme = intent.getScheme();
Set categories = intent.getCategories();
boolean debug = (intent.getFlags() & 8) != 0;
if (debug) {
Logger.v("LocalBroadcastManager", "Resolving type " + type + " scheme " + scheme + " of intent " + intent);
}
ArrayList entries = (ArrayList) this.mActions.get(intent.getAction());
if (entries != null) {
if (debug) {
Logger.v("LocalBroadcastManager", "Action list: " + entries);
}
ArrayList receivers = null;
int i;
for (i = 0; i < entries.size(); ++i) {
ReceiverRecord receiver = (ReceiverRecord) entries.get(i);
if (debug) {
Logger.v("LocalBroadcastManager", "Matching against filter " + receiver.filter);
}
if (receiver.broadcasting) {
if (debug) {
Logger.v("LocalBroadcastManager", " Filter\'s target already added");
}
} else {
int match = receiver.filter.match(action, type, scheme, data, categories, "LocalBroadcastManager");
if (match >= 0) {
if (debug) {
Logger.v("LocalBroadcastManager", " Filter matched! match=0x" + Integer.toHexString(match));
}
if (receivers == null) {
receivers = new ArrayList();
}
receivers.add(receiver);
receiver.broadcasting = true;
} else if (debug) {
String reason;
switch (match) {
case -4:
reason = "category";
break;
case -3:
reason = "action";
break;
case -2:
reason = "data";
break;
case -1:
reason = "type";
break;
default:
reason = "unknown reason";
}
Logger.v("LocalBroadcastManager", " Filter did not match: " + reason);
}
}
}
if (receivers != null) {
for (i = 0; i < receivers.size(); ++i) {
((ReceiverRecord) receivers.get(i)).broadcasting = false;
}
this.mPendingBroadcasts.add(new BroadcastRecord(intent, receivers));
if (!this.mHandler.hasMessages(1)) {
this.mHandler.sendEmptyMessage(1);
}
return true;
}
}
return false;
}
}
public void sendBroadcastSync(Intent intent) {
if (this.sendBroadcast(intent)) {
this.executePendingBroadcasts();
}
}
private void executePendingBroadcasts() {
while (true) {
BroadcastRecord[] brs = null;
HashMap i = this.mReceivers;
synchronized (this.mReceivers) {
int br = this.mPendingBroadcasts.size();
if (br <= 0) {
return;
}
brs = new BroadcastRecord[br];
this.mPendingBroadcasts.toArray(brs);
this.mPendingBroadcasts.clear();
}
for (int var6 = 0; var6 < brs.length; ++var6) {
BroadcastRecord var7 = brs[var6];
for (int j = 0; j < var7.receivers.size(); ++j) {
((ReceiverRecord) var7.receivers.get(j)).receiver.onReceive(this.mAppContext, var7.intent);
}
}
}
}
private static class BroadcastRecord {
final Intent intent;
final ArrayList<ReceiverRecord> receivers;
BroadcastRecord(Intent _intent, ArrayList<ReceiverRecord> _receivers) {
this.intent = _intent;
this.receivers = _receivers;
}
}
private static class ReceiverRecord {
final IntentFilter filter;
final BroadcastReceiver receiver;
boolean broadcasting;
ReceiverRecord(IntentFilter _filter, BroadcastReceiver _receiver) {
this.filter = _filter;
this.receiver = _receiver;
}
public String toString() {
StringBuilder builder = new StringBuilder(128);
builder.append("Receiver{");
builder.append(this.receiver);
builder.append(" filter=");
builder.append(this.filter);
builder.append("}");
return builder.toString();
}
}
} | [
"[email protected]"
] | |
40d740db25effe86bce783b656f25459c6f1e08f | 1885f933546e4923a9e7e3a66ed86f682d7dbefd | /SampleMavenproj/src/main/java/com/utils/DataProvider.java | 4e3fcf5663a9a72b2e191278d366c86abc7f0a15 | [] | no_license | preelakmali/SeleniumFramework | f661bbdeabf4d4e67c47cbb7a1617a985c9e3db9 | dca25af91c054d2398fb5df46155971b61016419 | refs/heads/master | 2021-07-12T01:44:36.301276 | 2019-09-22T15:58:30 | 2019-09-22T15:58:30 | 210,173,565 | 0 | 0 | null | 2020-10-13T16:13:26 | 2019-09-22T15:52:03 | HTML | UTF-8 | Java | false | false | 1,559 | java | package main.java.com.utils;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class DataProvider {
static XSSFWorkbook workbook;
static XSSFSheet sheet;
XSSFCell cell;
public static DataFormatter formatter = new DataFormatter();
public static Object[][] readExcel(String sheetName) {
FileInputStream fileInputStream;
try {
fileInputStream = new FileInputStream(System.getProperty("user.dir") + "\\testData\\DataSheet.xlsx");
workbook = new XSSFWorkbook(fileInputStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//sheet = workbook.getSheet(sheetName);
sheet = workbook.getSheet(sheetName);
XSSFRow Row = sheet.getRow(0);
int RowNum = sheet.getPhysicalNumberOfRows();
int ColNum = Row.getLastCellNum();
Object dataSet[][] = new Object[RowNum - 1][ColNum];
for (int i = 0; i < RowNum - 1; i++) {
XSSFRow row = sheet.getRow(i + 1);
for (int j = 0; j < ColNum; j++) {
if (row == null)
break;
else {
XSSFCell cell = row.getCell(j);
if (cell == null)
dataSet[i][j] = "";
else {
String value = formatter.formatCellValue(cell);
dataSet[i][j] = value;
}
}
}
}
return dataSet;
}
}
| [
"[email protected]"
] | |
88be73e89ea0ff3359a28e0c7f01c18791bb7c12 | c748b8f235a66ad90fd023eb8a772dfaad92ae79 | /src/main/java/com/example/HelloWorld/Application.java | d91baca6b73b9965bfc0f082b8bf4bd175050ef9 | [] | no_license | Brittany2k/HelloWorld | a7ab18afe4b152a4b647c1259fccc154c8c1542a | 618589d0780331c0267e6bf2297e26095944ca19 | refs/heads/master | 2023-02-27T06:58:38.004616 | 2021-02-04T05:14:17 | 2021-02-04T05:14:17 | 335,837,196 | 0 | 0 | null | 2021-02-04T05:14:18 | 2021-02-04T04:25:37 | Java | UTF-8 | Java | false | false | 317 | java | package com.example.HelloWorld;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args)
{
SpringApplication.run(Application.class,args);
}
}
| [
"[email protected]"
] | |
0853c38af4f907d9e94c0d38c17c3c5c71c0bf25 | 697197a083f2a9bf06b096cc71201eca75029b5c | /bataille_Navalle/src/com/zcorp/Thread/ThreadServeur.java | e0192de4cd2d712b059b3ddecc2a0de8b259849c | [] | no_license | Loick21/BatailleNavale | b97e6fd247155524f8f168f887e644d88879d99e | de1676afc06e8ebb02465b4e3751d618322b20e5 | refs/heads/master | 2023-02-03T08:25:49.527572 | 2020-12-19T03:27:41 | 2020-12-19T03:27:41 | 322,656,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,372 | java | package com.zcorp.Thread;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import com.zcorp.Client.Coordinate;
import com.zcorp.Client.Ship;
import com.zcorp.map.Map;
public class ThreadServeur extends Thread {
PrintWriter out1,out2;
BufferedReader in1,in2;
private boolean gameState;
List<Ship> fleetShipServeur1,fleetShipServeur2;
Map map1,map2;
public ThreadServeur(Socket client1, Socket client2) throws IOException {
out1 = new PrintWriter(client1.getOutputStream(),true);
out2 = new PrintWriter(client2.getOutputStream(),true);
in1 = new BufferedReader(new InputStreamReader(client1.getInputStream()));
in2 = new BufferedReader(new InputStreamReader(client2.getInputStream()));
map1 = new Map();
map2 = new Map();
List<Ship> fleetShipServeur1 = new ArrayList<>();
List<Ship> fleetShipServeur2 = new ArrayList<>();
}
@Override
public void run() {
gameState = true;
out1.println("Vous êtes le joueur 1");
out2.println("Vous êtes le joueur 2");
try {
fleetShipServeur1 = toShip(in1.readLine().split("-"));
fleetShipServeur2 = toShip(in2.readLine().split("-"));
map1.updateMap(fleetShipServeur1);
map2.updateMap(fleetShipServeur2);
System.out.println("Map Joueur 1 ");
map1.showMap();
System.out.println("Map Joueur 2 ");
map2.showMap();
out1.println(String.valueOf(gameState));
out2.println(String.valueOf(gameState));
boolean tour1 = true, tour2 = false;
out1.println(String.valueOf(tour1));
out2.println(String.valueOf(tour2));
while(gameState) {
boolean hit = false;
String coord1 = in1.readLine();
Coordinate attack1 = new Coordinate(coord1);
for (int i = 0; i < fleetShipServeur2.size(); i++) {
if(fleetShipServeur2.get(i).getHit(attack1)) {
System.out.println("touchée");
map2.map[attack1.getLine()][attack1.getColumn()] = "x";
hit = true;
}
}
out1.println(String.valueOf(hit));
out2.println(String.valueOf(hit));
if(hit) out2.println(coord1);
hit = false;
tour1 = !tour1;
tour2 = !tour2;
out1.println(String.valueOf(tour1));
out2.println(String.valueOf(tour2));
if(fleetShipServeur1.get(0).getPartHit() == 17 || fleetShipServeur2.get(0).getPartHit() == 17) {
gameState = false;
out1.println(String.valueOf(gameState));
out2.println(String.valueOf(gameState));
break;
}
else {
out1.println(String.valueOf(gameState));
out2.println(String.valueOf(gameState));
}
System.out.println("Map 2");
map2.showMap();
String coord2 = in2.readLine();
Coordinate attack2 = new Coordinate(coord2);
for (int i = 0; i < fleetShipServeur1.size(); i++) {
if(fleetShipServeur1.get(i).getHit(attack2)) {
System.out.println("touchée");
map1.map[attack2.getLine()][attack2.getColumn()] = "x";
hit = true;
}
}
out1.println(String.valueOf(hit));
out2.println(String.valueOf(hit));
if(hit)out1.println(coord2);
System.out.println("Map 1");
map1.showMap();
tour1 = !tour1;
tour2 = !tour2;
out1.println(tour1);
out2.println(tour2);
if(fleetShipServeur1.get(0).getPartHit() == 17 || fleetShipServeur2.get(0).getPartHit() == 17) {
gameState = false;
out1.println(String.valueOf(gameState));
out2.println(String.valueOf(gameState));
break;
}
else {
out1.println(String.valueOf(gameState));
out2.println(String.valueOf(gameState));
}
}
out1.close();
out2.close();
in1.close();
in2.close();
}catch (IOException e) {
System.out.println("Client déconnecté");
out1.close();
out2.close();
try {
in1.close();
in2.close();
} catch (IOException e1) {}
}
}
public List<Ship> toShip(String [] posJ) {
List<Ship> fleetShipServeur = new ArrayList<>();
for (int i = 0; i < posJ.length; i++) {
if(posJ[i].length() == 4) {
System.out.println(posJ[i]);
Coordinate coord = new Coordinate(posJ[i].substring(0,2));
int length = Integer.parseInt(posJ[i].substring(2,3));
Ship ship = new Ship(coord,length,posJ[i].substring(3,4));
fleetShipServeur.add(ship);
}
else {
System.out.println(posJ[i]);
Coordinate coord = new Coordinate(posJ[i].substring(0,3));
int length = Integer.parseInt(posJ[i].substring(3,4));
Ship ship = new Ship(coord,length,posJ[i].substring(4,5));
fleetShipServeur.add(ship);
}
}
return fleetShipServeur;
}
public void instruction() {
out1.println("--- Bienvenue dans la Bataille Navalle ---");
out1.println("\t les cordonnées sont sous le format : A1, B2 ...");
out1.println("\t Deux navires ne peuvent pas se chevaucher");
out1.println("\n*** Vous êtes le joueur 1");
out2.println("--- Bienvenue dans la Bataille Navalle ---");
out2.println("\t les cordonnées sont sous le format : A1, B2 ...");
out2.println("\t Deux navires ne peuvent pas se chevaucher");
out2.println("\n*** Vous êtes le joueur 2");
try {
String a = "Joueur 1" + in1.readLine();
out2.println(a);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
add57ae9f50fe1d89276ea455228d82c6a249eb6 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-481-93-20-SPEA2-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/security/authorization/DefaultAuthorExecutor_ESTest_scaffolding.java | 636f0e107389ecd1afd072572220a5064308c065 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Apr 06 22:29:31 UTC 2020
*/
package com.xpn.xwiki.internal.security.authorization;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultAuthorExecutor_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
] | |
291e904850b8852c48cf8b89406f563f83ed7b6d | 3ea0c7d7c53dcdf425633b8fbdfa498cdc1700de | /Jogo/src/jogo/factorys/FamiliaFabrica.java | d927b7d9d24600554c14485f245f844c41400a04 | [] | no_license | isacmoura/Trabalho-PDS | 58d1722535e551e753dd80830c5f24144723b0b4 | 521c81c2d82bbbf4611872ff450b859905de5d77 | refs/heads/master | 2020-03-19T23:02:44.447273 | 2018-06-23T00:38:24 | 2018-06-23T00:38:24 | 136,990,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 944 | java | package jogo.factorys;
import java.util.Map;
import java.util.TreeMap;
import jogo.model.Familia;
public class FamiliaFabrica {
private static FamiliaFabrica fabrica;
private FamiliaFabrica() {
}
public static FamiliaFabrica getInstance() {
if(fabrica == null) {
fabrica = new FamiliaFabrica();
}
return fabrica;
}
public Map<String, Familia> criarFamilia() {
familias = new TreeMap<>();
familias.put("VERDE", new Familia("VERDE", 3));
familias.put("VERMELHO", new Familia("VERMELHO", 3));
familias.put("AZUL", new Familia("AZUL", 3));
familias.put("ROSA", new Familia("ROSA", 2));
familias.put("LILÁS", new Familia("LILÁS", 2));
familias.put("AZUL ESCURO", new Familia("AZUL ESCURO", 3));
familias.put("LARANJA", new Familia("LARANJA", 3));
familias.put("AMARELO", new Familia("AMARELO", 3));
return familias;
}
public Map<String, Familia> getFamilias() {
return familias;
}
}
| [
"[email protected]"
] | |
6fb6bad5245fe3f2d764dbbc8dd3b108ed6df73f | 83d781a9c2ba33fde6df0c6adc3a434afa1a7f82 | /ServiceLiveCommonDomain/src/main/java/com/servicelive/domain/autoclose/AutoCloseRuleProviderAssoc.java | 28b631e11d6225b31826c79251adc086db09d2bb | [] | no_license | ssriha0/sl-b2b-platform | 71ab8ef1f0ccb0a7ad58b18f28a2bf6d5737fcb6 | 5b4fcafa9edfe4d35c2dcf1659ac30ef58d607a2 | refs/heads/master | 2023-01-06T18:32:24.623256 | 2020-11-05T12:23:26 | 2020-11-05T12:23:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,597 | java | package com.servicelive.domain.autoclose;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.ForeignKey;
import com.servicelive.domain.LoggableBaseDomain;
import com.servicelive.domain.provider.ServiceProvider;
/**
* AutoCloseRuleProviderAssoc entity.
*
*/
@Entity
@Table(name = "auto_close_rule_provider_assoc")
public class AutoCloseRuleProviderAssoc extends LoggableBaseDomain {
/**
*
*/
private static final long serialVersionUID = 8098339314044466367L;
// Fields
/**
*
*/
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "auto_close_rule_provider_assoc_id", unique = true, nullable = false)
private Integer autoCloseRuleProvAssocId;
@Column(name = "auto_close_rule_hdr_id")
private Integer autoCloseRuleHdrId;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="provider_id", referencedColumnName="resource_id")
@ForeignKey(name="FK_auto_close_rule_provider_id")
private ServiceProvider provider;
@Column(name = "excluding_reason")
private String autoCloseRuleProvExcludeReason;
@Column(name = "active_ind")
private boolean active;
// Constructors
/** default constructor */
public AutoCloseRuleProviderAssoc() {
super();
}
public Integer getAutoCloseRuleProvAssocId() {
return autoCloseRuleProvAssocId;
}
public void setAutoCloseRuleProvAssocId(Integer autoCloseRuleProvAssocId) {
this.autoCloseRuleProvAssocId = autoCloseRuleProvAssocId;
}
public Integer getAutoCloseRuleHdrId() {
return autoCloseRuleHdrId;
}
public void setAutoCloseRuleHdrId(Integer autoCloseRuleHdrId) {
this.autoCloseRuleHdrId = autoCloseRuleHdrId;
}
public ServiceProvider getProvider() {
return provider;
}
public void setProvider(ServiceProvider provider) {
this.provider = provider;
}
public String getAutoCloseRuleProvExcludeReason() {
return autoCloseRuleProvExcludeReason;
}
public void setAutoCloseRuleProvExcludeReason(
String autoCloseRuleProvExcludeReason) {
this.autoCloseRuleProvExcludeReason = autoCloseRuleProvExcludeReason;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
} | [
"[email protected]"
] | |
d64a629878271515a1273b8dd3b10d72bf7c5ca2 | 9bf68cc4f3e8a2440ad27b60f90050b68642a832 | /app/src/main/java/com/barryirvine/shazam/dagger/module/NetModule.java | 9a42cb7c5ca7bfd729624ae79d22bd98323d3792 | [] | no_license | barrywe7/Shazam | 1e0196c01e4a7bed6c3c988b12b0cb7c50e031ef | 3a0fa5cfbce15ecd75b9a24484802b23503a787e | refs/heads/master | 2021-01-21T12:23:10.537340 | 2017-05-22T15:27:44 | 2017-05-22T15:27:44 | 91,794,064 | 0 | 0 | null | 2017-05-22T15:27:45 | 2017-05-19T10:15:39 | Java | UTF-8 | Java | false | false | 2,519 | java | package com.barryirvine.shazam.dagger.module;
import android.app.Application;
import com.barryirvine.shazam.api.ChartAPI;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.jakewharton.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;
import java.io.File;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
@Module
public class NetModule {
private static final long CACHE_SIZE = 10 * 1024 * 1024; // 30 MiB
private static final String CACHE_DIR = "http";
private final String mBaseUrl;
public NetModule(final String baseUrl) {
mBaseUrl = baseUrl;
}
@Provides
@Singleton
Cache provideHttpCache(final Application application) {
return new Cache(new File(application.getCacheDir(), CACHE_DIR), CACHE_SIZE);
}
@Provides
@Singleton
Gson provideGson() {
return new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.create();
}
@Provides
@Singleton
OkHttpClient provideOkHttpClient(final Cache cache) {
final HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
return new OkHttpClient.Builder().addInterceptor(interceptor).cache(cache).build();
}
@Provides
@Singleton
ChartAPI provideChartAPI(final Gson gson, final OkHttpClient okHttpClient) {
return new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(mBaseUrl)
.client(okHttpClient)
.build()
.create(ChartAPI.class);
}
@Provides
@Singleton
OkHttp3Downloader provideOkHttp3Downloader(final OkHttpClient client) {
return new OkHttp3Downloader(client);
}
@Provides
@Singleton
Picasso providePicasso(final Application application, final OkHttp3Downloader downloader) {
// Use indicators enabled here to check caching when required
return new Picasso.Builder(application).downloader(downloader).build();
}
}
| [
"[email protected]"
] | |
f6243f27d388a0299acaad8c69997084eea43c85 | fb9eda4c2438cd60bee31763687422abedb17ef0 | /Assginment no-1/question 1.java | 7c1c78cf8fa7b53166cd26649b75cd779cd60108 | [] | no_license | aarti12345/Edac-May2021 | ddd95b0fad660a1eeb6b2fea9f77bd375c579e30 | 01fc7d1dba2034be1c316490f77936ca5fb61b24 | refs/heads/main | 2023-06-23T21:11:57.326262 | 2021-07-26T07:17:22 | 2021-07-26T07:17:22 | 365,246,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 93 | java | class Hello
{
public static void main(String args[])
{
System.out.println("Hello");
}
} | [
"[email protected]"
] | |
c1711041ff30ce9f529b8088c8a385d4d1140012 | a8f60b2c1c12a735f24236778ad4950f5f9cfe6b | /Pr5/Pr5/src/tp/pr5/NavigationModule.java | d712db2a539d1dd4c7a0c2d5f18c737d434d159b | [] | no_license | Carmen90/Wall-e.5 | 7b0b34dd4362a6b469f7fb158e28fc262f8a88d6 | a4c9dc097ed47b229ab85e4f229f73c597eeebdb | refs/heads/master | 2021-01-18T19:28:26.359648 | 2015-03-02T14:10:44 | 2015-03-02T14:10:44 | 31,540,394 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,136 | java | package tp.pr5;
import java.util.Iterator;
import tp.pr5.instructions.exceptions.InstructionExecutionException;
import tp.pr5.items.Item;
/**
* Esta clase se encarga de las funciones de navegación del robot.Contiene la ciudad donde el robot busca de
* la basura, el lugar actual donde se encuentra el robot, la dirección actual del robot.Contiene los metodos
* para manejar los movimientos del robot y para coger y soltar los items en el lugar donde se encuentra
* @author Nerea Ramírez y Carmen Acosta
*
*/
public class NavigationModule extends tp.pr5.Observable<NavigationObserver> {
private City city;
private Direction direction;
private Place initialPlace;
/**
* Constructora por defecto que inicializa city y initialPlace por defecto y la direction a UNKNOWN
*/
public NavigationModule (){
this.city = new City();
this.direction = Direction.UNKNOWN;
this.initialPlace = new Place();
}
/**
* Crea un navigationModule con el mapa de la ciudad y un lugarInicial dado
* @param aCity -el mapa de la ciudad
* @param initialPlace - el lugar inicial del robot.
*/
public NavigationModule(City aCity,
Place initialPlace){
this.city = aCity;
this.initialPlace = initialPlace;
this.direction = Direction.NORTH;
}
/**
* Mira si el robot ha llegado a la nave.
* @return - true si el lugar actual donde se encuentra el robot es la nave.
*/
public boolean atSpaceship(){
return this.initialPlace.isSpaceship();
}
/**
* Actualiza la dirección actual de acuerdo con el rotación que le pasan por parámetro.
* @param rotation
*/
public void rotate(Rotation rotation){
this.direction = this.direction.rotate(rotation);
}
/**
* Este método intenta mover al robot en la dirección actual en la que se encuentra.
* Si el movimiento no es posible porque no hay calle en esa dirección o la puerta está cerrada entonces se lanza una excepción.
* Si no es así entonces se actualiza el lugar de acuerdo con el movimiento
* @throws InstructionExecutionException
*/
public void move()
throws InstructionExecutionException{
Street calle = this.getHeadingStreet();
if(calle==null){
throw new InstructionExecutionException("There's no street");
}
else{
if(calle.isOpen()){
this.initialPlace = calle.nextPlace(this.initialPlace);
}
else{
throw new InstructionExecutionException( "The street is closed.");
}
}
}
/**
* Intenta coger un item del lugar actual donde se encuentra el robot con el id que se pasa por parámetro.
* Si la acción se puede hacer se borra el item del lugar actual.
* Si se borra el item se informa a los NavigationObservers de que el lugar ha cambiado (con ese item de menos)
* @param id
* @return -El item con identificador id si existe en el lugar sino devuelve null
*/
public Item pickItemFromCurrentPlace(java.lang.String id){
Item item = null;
if( this.initialPlace.existItem(id)){
item = this.initialPlace.pickItem(id);
Iterator <NavigationObserver> navOb = this.iterator();
while (navOb.hasNext()){
navOb.next().placeHasChanged(this.initialPlace);
}
}
return item;
}
/**
* Suelta un item en el lugar donde se encuentra el robot.
* Informa a los NavigationObservers de que el lugar ha cambiado (teniendo un nuevo item)
* @param item- el nombre de item que se suelta
*/
public void dropItemAtCurrentPlace(Item item){
if ( !this.initialPlace.existItem(item.getId())){
this.initialPlace.addItem(item);
Iterator <NavigationObserver> navOb = this.iterator();
while (navOb.hasNext()){
navOb.next().placeHasChanged(this.initialPlace);
}
}
}
/**
* Mira si hay un item con el id dado en el lugar. Lo único que hace es llamar al método existItem():
* @param id
* @return - true si encuentra el item con ese id, sino devuelve false
*/
public boolean findItemAtCurrentPlace(java.lang.String id){
return this.initialPlace.existItem(id);
}
/**
* Cambia la direccion actual por la dirección dada. Ademas informa a los NavigationObservers de que la dirección ha sido cambiada
* @param heading -Nueva dirección para el robot.
*/
public void initHeading(Direction heading){
this.direction = heading;
Iterator <NavigationObserver> navOb = this.iterator();
while (navOb.hasNext()){
navOb.next().headingChanged(this.direction);
}
}
/**
* Devuelve la calle a la que esta mirando el robot llamado al metodo lookForStreet(Place, Direction).
* @return Si no hay calle devolverá null.
*/
public Street getHeadingStreet(){
return this.city.lookForStreet( this.initialPlace, this.direction);
}
/**
* Devuelve la direccion donde mira el robot
* @return
*/
public Direction getCurrentHeading(){
return this.direction;
}
/**
* Devuelve el lugar donde se encuentra el robot
* @return - initialPlace
*/
public Place getCurrentPlace(){
return this.initialPlace;
}
}
| [
"[email protected]"
] | |
5f3a95ec2db2ffaaf9fafc9b4a087e0f43f0d9f3 | 46352b0551b44f087fd53803bcd6ac400af19bcd | /src/com/bilboldev/pixeldungeonskills/items/food/Food.java | bc74a92679aafed57a7cf279206f7e596d11429f | [] | no_license | AngreeCookie/SPD | 4a3da14cc3b2d74693991d4134b8d8c5e3ecd51e | c66153476a323e34b097311de41f98e6b82e41d6 | refs/heads/master | 2020-09-16T02:48:50.573422 | 2019-08-31T08:12:14 | 2019-08-31T08:12:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,151 | java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.bilboldev.pixeldungeonskills.items.food;
import java.util.ArrayList;
import com.bilboldev.noosa.audio.Sample;
import com.bilboldev.pixeldungeonskills.Assets;
import com.bilboldev.pixeldungeonskills.Badges;
import com.bilboldev.pixeldungeonskills.Statistics;
import com.bilboldev.pixeldungeonskills.actors.buffs.Hunger;
import com.bilboldev.pixeldungeonskills.actors.hero.Hero;
import com.bilboldev.pixeldungeonskills.effects.Speck;
import com.bilboldev.pixeldungeonskills.effects.SpellSprite;
import com.bilboldev.pixeldungeonskills.items.Item;
import com.bilboldev.pixeldungeonskills.items.scrolls.ScrollOfRecharging;
import com.bilboldev.pixeldungeonskills.sprites.ItemSpriteSheet;
import com.bilboldev.pixeldungeonskills.utils.GLog;
public class Food extends Item {
private static final float TIME_TO_EAT = 3f;
public static final String AC_EAT = "EAT";
public float energy = Hunger.HUNGRY;
public String message = "That food tasted delicious!";
{
stackable = true;
name = "ration of food";
image = ItemSpriteSheet.RATION;
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( AC_EAT );
return actions;
}
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_EAT )) {
detach( hero.belongings.backpack );
((Hunger)hero.buff( Hunger.class )).satisfy( energy );
GLog.i( message );
switch (hero.heroClass) {
case WARRIOR:
if (hero.HP < hero.HT) {
hero.HP = Math.min( hero.HP + 5, hero.HT );
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
}
break;
case MAGE:
hero.belongings.charge( false );
ScrollOfRecharging.charge( hero );
break;
case ROGUE:
case HUNTRESS:
break;
}
hero.sprite.operate( hero.pos );
hero.busy();
SpellSprite.show( hero, SpellSprite.FOOD );
Sample.INSTANCE.play( Assets.SND_EAT );
hero.spend( TIME_TO_EAT );
Statistics.foodEaten++;
Badges.validateFoodEaten();
} else {
super.execute( hero, action );
}
}
@Override
public String info() {
return
"Nothing fancy here: dried meat, " +
"some biscuits - things like that.";
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int price() {
return 10 * quantity;
}
}
| [
"Moussa Khalil"
] | Moussa Khalil |
6cdf396d2de2d27b30564351ec937f5ca543536e | 1303d128c8488946fe6e57754fa357e80ce533a0 | /app/src/main/java/financialStudio/young_accountant/BaseActivite.java | eb3dbf08af3297ffc53fafc4d4b70357b263865b | [] | no_license | jamoltura/young_accountant | 4434fe5bcbb86befda8022251bd764f8f1ccc6ec | 706815c4b96329a667d22cb725651a7d4170d1e5 | refs/heads/master | 2023-01-02T05:26:13.877820 | 2020-10-26T11:02:41 | 2020-10-26T11:02:41 | 297,227,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,508 | java | package financialStudio.young_accountant;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.SearchView;
import androidx.appcompat.app.AppCompatActivity;
@SuppressLint("Registered")
public abstract class BaseActivite extends AppCompatActivity {
private boolean isSearchStatus;
void toolbar_init(final int value){
isSearchStatus = false;
ImageButton imageView = (ImageButton) findViewById(R.id.img_back);
imageView.setOnClickListener(v -> finish());
ImageButton imgbtn_bar = (ImageButton) findViewById(R.id.img_search);
imgbtn_bar.setOnClickListener(clickSearchImg);
}
View.OnClickListener clickSearchImg = v -> add_custom_search_bar();
abstract void add_custom_action_bar();
void add_custom_search_bar(){
isSearchStatus = true;
final LinearLayout ll = (LinearLayout) findViewById(R.id.actionBar);
ll.removeViewAt(0);
LinearLayout ll_search = (LinearLayout) getLayoutInflater().inflate(R.layout.custom_search_bar, ll, false);
ll.addView(ll_search, 0);
final SearchView searchView = (SearchView) findViewById(R.id.search_view);
searchView.setOnSearchClickListener(clickSearch);
searchView.setOnQueryTextListener(onQuery);
searchView.post(() -> {
InputMethodManager inputMethodManager =
(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(
searchView.getApplicationWindowToken(),InputMethodManager.SHOW_IMPLICIT, 0);
searchView.requestFocus();
});
}
// TODO : click button
View.OnClickListener clickSearch = v -> {
final SearchView searchView = (SearchView) findViewById(R.id.search_view);
String value = searchView.getQuery().toString();
_search(value);
};
SearchView.OnQueryTextListener onQuery = new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
_search(newText);
return true;
}
};
// TODO : поиск
abstract void _search(String value);
@Override
public void onBackPressed() {
if (isSearchStatus){
isSearchStatus = false;
add_custom_action_bar();
}else {
super.onBackPressed();
}
}
protected int getColorPrimaryDark(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return getResources().getColor(R.color.colorPrimaryDark, getTheme());
}else {
return getResources().getColor(R.color.colorPrimaryDark);
}
}
protected int getColor_white(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return getResources().getColor(R.color.color_white, getTheme());
}else {
return getResources().getColor(R.color.color_white);
}
}
abstract void startBanner();
private boolean isSearchStatus() {
return isSearchStatus;
}
private void setSearchStatus(boolean searchStatus) {
isSearchStatus = searchStatus;
}
}
| [
"[email protected]"
] | |
969e5af2b25284aca74c92fcc20392687470b8d0 | 5b82e2f7c720c49dff236970aacd610e7c41a077 | /QueryReformulation-master 2/data/ExampleSourceCodeFiles/DummyPrefPageEnhancer.java | dbc7d89d85ae2b123071a74b005c8dc9063565ee | [] | no_license | shy942/EGITrepoOnlineVersion | 4b157da0f76dc5bbf179437242d2224d782dd267 | f88fb20497dcc30ff1add5fe359cbca772142b09 | refs/heads/master | 2021-01-20T16:04:23.509863 | 2016-07-21T20:43:22 | 2016-07-21T20:43:22 | 63,737,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | /Users/user/eclipse.platform.ui/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/DummyPrefPageEnhancer.java
org eclipse internal tweaklets org eclipse swt widgets composite dummy pref page enhancer preference page enhancer override create contents composite parent override set selection object selection override perform override perform cancel override perform defaults | [
"[email protected]"
] | |
82fab215cfce85ee012db85fa04ee614daddbee8 | 642323b88f6a3f9050d3ce297b80c02715ba08db | /Java Fundamentals/Stacks-and-Queues-Lab/src/HotPotato.java | f578d92be8c9a35926fe18fb4b36e2ca8cbe7e89 | [] | no_license | VenelinBakalov/javaAdvanced | 5a9e418c6666f85fe8a8d1e65d587a863af367b9 | d890a84fa56af2e24669e60f48f6d776cf55e9ef | refs/heads/master | 2021-01-11T21:07:45.912758 | 2017-12-03T15:39:27 | 2017-12-03T15:39:27 | 79,252,307 | 8 | 8 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Scanner;
public class HotPotato {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] kids = scanner.nextLine().split("\\s+");
ArrayDeque<String> queue = new ArrayDeque<>();
Collections.addAll(queue, kids);
int counter = Integer.parseInt(scanner.nextLine());
while (queue.size() > 1) {
for (int i = 1; i < counter; i++) {
String firstChild = queue.poll();
queue.offer(firstChild);
}
System.out.println("Removed " + queue.poll());
}
System.out.printf("Last is %s", queue.poll());
}
} | [
"[email protected]"
] | |
86623d1cbf690f616534f13d55cf9cd6a3af5914 | c183fe599a84244eff75d3eab2ab665c5d7f5179 | /src/ch/kerbtier/procfx/gui/ImagePane.java | a50ac6477dd6d5c15e02a06035301d5078b825fc | [] | no_license | creichlin/pixels | 0b0061c6dcac08f66a506a0b23f632e828c2cf0f | ae6b6e38bc7d4a9c6014a274bc88647da2325884 | refs/heads/master | 2020-04-04T00:21:31.919250 | 2015-05-05T21:28:33 | 2015-05-05T21:28:33 | 35,124,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | package ch.kerbtier.procfx.gui;
import java.awt.image.BufferedImage;
import java.net.URL;
import org.apache.pivot.beans.BXML;
import org.apache.pivot.beans.Bindable;
import org.apache.pivot.collections.Map;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.ImageView;
import org.apache.pivot.wtk.ScrollPane;
import org.apache.pivot.wtk.media.Picture;
import ch.kerbtier.procfx.Painter;
import ch.kerbtier.procfx.core.Canvas;
import ch.kerbtier.procfx.core.RgbCanvas;
import ch.kerbtier.procfx.model.Listener;
public class ImagePane extends ScrollPane implements Bindable, Listener {
@BXML
private ImageView image;
private Canvas selected = null;
private String selectedPath;
@Override
public void initialize(Map<String, Object> arg0, URL arg1, Resources arg2) {
GUI.setImagePane(this);
GUI.getFacade().register(this);
}
public void select(String path) {
selectedPath = path;
selected = (Canvas) GUI.getFacade().get(path);
update();
}
public void update() {
if (selected != null) {
selected.calculate();
int width = selected.width();
int height = selected.height();
BufferedImage bi = null;
if (selected instanceof RgbCanvas) {
bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
} else {
bi = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
}
Painter.paint(selected, bi);
image.setWidth(width);
image.setHeight(height);
image.setImage(new Picture(bi));
}
}
@Override
public void update(String path, Object value) {
if (selectedPath != null) {
if (path.startsWith(selectedPath)) {
update();
}
}
}
}
| [
"[email protected]"
] | |
56531c094ce96d18dd7bcc447e83f3142913b9a5 | c518babe61396247ae217ee09eb4d07597ac5aa7 | /src/main/java/com/example/demo/BuildingsService.java | 42244621afbfc33278debdc0757d8814ca482b60 | [] | no_license | G-Ruslanas/JAVA-project | 968af0b3bfb355fe3d1c25c1987ab39226e0b53b | 96646a247491bad969560641125e66fd9ab0f84d | refs/heads/master | 2022-12-26T21:56:57.965242 | 2020-10-03T13:32:41 | 2020-10-03T13:32:41 | 300,870,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package com.example.demo;
import java.util.List;
public interface BuildingsService {
public List<Building> retrieveBuildings();
public Building getBuilding(Long buildingId);
public String saveBuilding(Building building);
public String deleteBuilding(Long buildingId);
public Building updateBuilding(Building building);
public String retrieveOwner(String owner);
public String updateTaxes(Building building);
}
| [
"[email protected]"
] | |
4b9868c392287ade417bd2970f5e677e377ddbd7 | 19d0494991e13d0d9db8ffa909503aa49ce63c39 | /loupgarou-boot/src/main/java/fr/loupgarou/dao/IDAOUtilisateur.java | c35630e24beaeb67eb9646200369ce4fe30d9b1d | [] | no_license | AntoineLSopra/Loupgarou | 7214813b8984331ba20d2fc923400be1e8255510 | 013882a39ad444da7db693c7b68a7088fd2158cd | refs/heads/master | 2023-01-28T12:55:44.031890 | 2019-02-05T15:31:37 | 2019-02-05T15:31:37 | 162,594,319 | 0 | 0 | null | 2023-01-07T02:59:42 | 2018-12-20T15:01:18 | HTML | UTF-8 | Java | false | false | 1,148 | java | package fr.loupgarou.dao;
import java.util.List;
import javax.persistence.TypedQuery;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import fr.loupgarou.model.*;
public interface IDAOUtilisateur extends JpaRepository<Utilisateur, Integer>{
@Query("select u from Utilisateur u where u.id = :id")
public List<Utilisateur> findByUtilisateurId(@Param ("id") int id);
@Query("select j from Joueur j where j.username = :username and j.password = :password and j.banni = false")
public Joueur connexionJoueur(@Param ("username") String use, @Param ("password") String pass);
@Query("select a from Administrateur a where a.username = :username and a.password = :password")
public Administrateur connexionAdministrateur(@Param ("username") String use, @Param ("password") String pass);
public Utilisateur findByUsername(String username);
}
| [
"[email protected]"
] | |
06f44132ea55aace06949d5817faedd6257f3ea7 | b4d89e0791efb8c15f9cb21c524ad47cbf139f8c | /dione_ejb/src/main/java/ec/com/uce/ejb/dto/AsignaturaDTO.java | 80c3e3b42d0c2956d90781bbb8fd4a31883562dc | [] | no_license | jipowi/dione | e50a4a2ca263ce0b06dd89541b2d62e8e60d14b6 | 867cc13448ab85abe3b272a713eb91ca17e8f88c | refs/heads/master | 2021-01-21T12:23:12.533217 | 2015-05-17T02:40:20 | 2015-05-17T02:40:20 | 28,835,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | /**
*
*/
package ec.com.uce.ejb.dto;
import java.io.Serializable;
import java.util.List;
/**
* <b>Permite administrar la informacion de la tabla de Escuela</b>
*
* @author Anita Carrera
* @version 1.0,29/12/2014
* @since JDK1.6
*/
public class AsignaturaDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String escuela;
private List<MateriaDTO> materias;
public AsignaturaDTO() {
}
/**
* @param escuela
* @param materias
*/
public AsignaturaDTO(String escuela, List<MateriaDTO> materias) {
super();
this.escuela = escuela;
this.materias = materias;
}
/**
* @return the escuela
*/
public String getEscuela() {
return escuela;
}
/**
* @param escuela
* the escuela to set
*/
public void setEscuela(String escuela) {
this.escuela = escuela;
}
/**
* @return the materias
*/
public List<MateriaDTO> getMaterias() {
return materias;
}
/**
* @param materias
* the materias to set
*/
public void setMaterias(List<MateriaDTO> materias) {
this.materias = materias;
}
}
| [
"[email protected]"
] | |
db99b4d1e1016d2ba00d6349a30f39f4475383de | 132a972b7891162cffdadf73957c3c9d3aa24ab2 | /src/main/java/org/nuaa/tomax/dp/strategy/examples/RandomInitializer.java | b85b609111d3a1109381022729e1d3f6a0283199 | [] | no_license | XingToMax/DesignPattern | cdcdb1ddcdc5ad4dc100aab9f7c534d96f56a1f5 | 9cbd37a830eeb201970b443847f28bf3ade01649 | refs/heads/master | 2020-04-19T04:08:38.787059 | 2019-02-18T15:15:31 | 2019-02-18T15:15:31 | 167,954,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package org.nuaa.tomax.dp.strategy.examples;
/**
* @Author: ToMax
* @Description:
* @Date: Created in 2019/1/28 20:09
*/
public class RandomInitializer implements IInitializer {
@Override
public void init(Layer layer) {
System.out.println("random init");
}
}
| [
"[email protected]"
] | |
aef44089487b3a8c2466713fa20dc3f201be4eac | 97e9c99eec9bbacb7bc8fea7891a9126bf44b348 | /src/test/java/com/viettel/vn/web/rest/UserResourceIT.java | e9e4fa132480c6418ca6b7e984bd1b6b6719efca | [] | no_license | MinhHoangg/Viettel | c6901edcdd0ce8f0236655b8cb51023940ceaba6 | cc36a0144c8b172161f76fadcc75d86753cdf90b | refs/heads/master | 2022-12-22T13:47:03.416769 | 2019-11-13T02:36:51 | 2019-11-13T02:36:51 | 217,997,762 | 0 | 0 | null | 2022-12-16T04:40:53 | 2019-10-28T08:20:18 | Java | UTF-8 | Java | false | false | 26,145 | java | package com.viettel.vn.web.rest;
import com.viettel.vn.ViettelApp;
import com.viettel.vn.domain.Authority;
import com.viettel.vn.domain.User;
import com.viettel.vn.repository.UserRepository;
import com.viettel.vn.security.AuthoritiesConstants;
import com.viettel.vn.service.MailService;
import com.viettel.vn.service.UserService;
import com.viettel.vn.service.dto.UserDTO;
import com.viettel.vn.service.mapper.UserMapper;
import com.viettel.vn.web.rest.errors.ExceptionTranslator;
import com.viettel.vn.web.rest.vm.ManagedUserVM;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.CacheManager;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Integration tests for the {@link UserResource} REST controller.
*/
@SpringBootTest(classes = ViettelApp.class)
public class UserResourceIT {
private static final String DEFAULT_LOGIN = "johndoe";
private static final String UPDATED_LOGIN = "jhipster";
private static final Long DEFAULT_ID = 1L;
private static final String DEFAULT_PASSWORD = "passjohndoe";
private static final String UPDATED_PASSWORD = "passjhipster";
private static final String DEFAULT_EMAIL = "johndoe@localhost";
private static final String UPDATED_EMAIL = "jhipster@localhost";
private static final String DEFAULT_FIRSTNAME = "john";
private static final String UPDATED_FIRSTNAME = "jhipsterFirstName";
private static final String DEFAULT_LASTNAME = "doe";
private static final String UPDATED_LASTNAME = "jhipsterLastName";
private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50";
private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40";
private static final String DEFAULT_LANGKEY = "en";
private static final String UPDATED_LANGKEY = "fr";
@Autowired
private UserRepository userRepository;
@Autowired
private MailService mailService;
@Autowired
private UserService userService;
@Autowired
private UserMapper userMapper;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private CacheManager cacheManager;
private MockMvc restUserMockMvc;
private User user;
@BeforeEach
public void setup() {
cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear();
cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear();
UserResource userResource = new UserResource(userService, userRepository, mailService);
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
/**
* Create a User.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which has a required relationship to the User entity.
*/
public static User createEntity(EntityManager em) {
User user = new User();
user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5));
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL);
user.setFirstName(DEFAULT_FIRSTNAME);
user.setLastName(DEFAULT_LASTNAME);
user.setImageUrl(DEFAULT_IMAGEURL);
user.setLangKey(DEFAULT_LANGKEY);
return user;
}
@BeforeEach
public void initTest() {
user = createEntity(em);
user.setLogin(DEFAULT_LOGIN);
user.setEmail(DEFAULT_EMAIL);
}
@Test
@Transactional
public void createUser() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
// Create the User
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin(DEFAULT_LOGIN);
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isCreated());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate + 1);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
}
@Test
@Transactional
public void createUserWithExistingId() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(1L);
managedUserVM.setLogin(DEFAULT_LOGIN);
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// An entity with an existing ID cannot be created, so this API call must fail
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin(DEFAULT_LOGIN);// this login should already be used
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail("anothermail@localhost");
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingEmail() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin("anotherlogin");
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);// this email should already be used
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void getAllUsers() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
// Get all the users
restUserMockMvc.perform(get("/api/users?sort=id,desc")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN)))
.andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME)))
.andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME)))
.andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL)))
.andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL)))
.andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY)));
}
@Test
@Transactional
public void getUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
// Get the user
restUserMockMvc.perform(get("/api/users/{login}", user.getLogin()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value(user.getLogin()))
.andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME))
.andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME))
.andExpect(jsonPath("$.email").value(DEFAULT_EMAIL))
.andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL))
.andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY));
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull();
}
@Test
@Transactional
public void getNonExistingUser() throws Exception {
restUserMockMvc.perform(get("/api/users/unknown"))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(updatedUser.getLogin());
managedUserVM.setPassword(UPDATED_PASSWORD);
managedUserVM.setFirstName(UPDATED_FIRSTNAME);
managedUserVM.setLastName(UPDATED_LASTNAME);
managedUserVM.setEmail(UPDATED_EMAIL);
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(UPDATED_IMAGEURL);
managedUserVM.setLangKey(UPDATED_LANGKEY);
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(UPDATED_LOGIN);
managedUserVM.setPassword(UPDATED_PASSWORD);
managedUserVM.setFirstName(UPDATED_FIRSTNAME);
managedUserVM.setLastName(UPDATED_LASTNAME);
managedUserVM.setEmail(UPDATED_EMAIL);
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(UPDATED_IMAGEURL);
managedUserVM.setLangKey(UPDATED_LANGKEY);
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserExistingEmail() throws Exception {
// Initialize the database with 2 users
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(updatedUser.getLogin());
managedUserVM.setPassword(updatedUser.getPassword());
managedUserVM.setFirstName(updatedUser.getFirstName());
managedUserVM.setLastName(updatedUser.getLastName());
managedUserVM.setEmail("jhipster@localhost");// this email should already be used by anotherUser
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(updatedUser.getImageUrl());
managedUserVM.setLangKey(updatedUser.getLangKey());
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void updateUserExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin("jhipster");// this login should already be used by anotherUser
managedUserVM.setPassword(updatedUser.getPassword());
managedUserVM.setFirstName(updatedUser.getFirstName());
managedUserVM.setLastName(updatedUser.getLastName());
managedUserVM.setEmail(updatedUser.getEmail());
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(updatedUser.getImageUrl());
managedUserVM.setLangKey(updatedUser.getLangKey());
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void deleteUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeDelete = userRepository.findAll().size();
// Delete the user
restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isNoContent());
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
// Validate the database is empty
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void getAllAuthorities() throws Exception {
restUserMockMvc.perform(get("/api/users/authorities")
.accept(TestUtil.APPLICATION_JSON_UTF8)
.contentType(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$").value(hasItems(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)));
}
@Test
@Transactional
public void testUserEquals() throws Exception {
TestUtil.equalsVerifier(User.class);
User user1 = new User();
user1.setId(1L);
User user2 = new User();
user2.setId(user1.getId());
assertThat(user1).isEqualTo(user2);
user2.setId(2L);
assertThat(user1).isNotEqualTo(user2);
user1.setId(null);
assertThat(user1).isNotEqualTo(user2);
}
@Test
public void testUserDTOtoUser() {
UserDTO userDTO = new UserDTO();
userDTO.setId(DEFAULT_ID);
userDTO.setLogin(DEFAULT_LOGIN);
userDTO.setFirstName(DEFAULT_FIRSTNAME);
userDTO.setLastName(DEFAULT_LASTNAME);
userDTO.setEmail(DEFAULT_EMAIL);
userDTO.setActivated(true);
userDTO.setImageUrl(DEFAULT_IMAGEURL);
userDTO.setLangKey(DEFAULT_LANGKEY);
userDTO.setCreatedBy(DEFAULT_LOGIN);
userDTO.setLastModifiedBy(DEFAULT_LOGIN);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
User user = userMapper.userDTOToUser(userDTO);
assertThat(user.getId()).isEqualTo(DEFAULT_ID);
assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(user.getActivated()).isEqualTo(true);
assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(user.getCreatedBy()).isNull();
assertThat(user.getCreatedDate()).isNotNull();
assertThat(user.getLastModifiedBy()).isNull();
assertThat(user.getLastModifiedDate()).isNotNull();
assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER);
}
@Test
public void testUserToUserDTO() {
user.setId(DEFAULT_ID);
user.setCreatedBy(DEFAULT_LOGIN);
user.setCreatedDate(Instant.now());
user.setLastModifiedBy(DEFAULT_LOGIN);
user.setLastModifiedDate(Instant.now());
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.USER);
authorities.add(authority);
user.setAuthorities(authorities);
UserDTO userDTO = userMapper.userToUserDTO(user);
assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID);
assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(userDTO.isActivated()).isEqualTo(true);
assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate());
assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate());
assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER);
assertThat(userDTO.toString()).isNotNull();
}
@Test
public void testAuthorityEquals() {
Authority authorityA = new Authority();
assertThat(authorityA).isEqualTo(authorityA);
assertThat(authorityA).isNotEqualTo(null);
assertThat(authorityA).isNotEqualTo(new Object());
assertThat(authorityA.hashCode()).isEqualTo(0);
assertThat(authorityA.toString()).isNotNull();
Authority authorityB = new Authority();
assertThat(authorityA).isEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.ADMIN);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityA.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isEqualTo(authorityB);
assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode());
}
}
| [
"[email protected]"
] | |
5243ccb50f57d3bf22789c0720b86b2c6599e8d8 | f1ce7f77700d35e4d2f507f4c53558e0d004edd4 | /src/main/java/com/stfn/services/DoctorService.java | ebac776b6e191941e39c62bc948cfbe9fec50433 | [] | no_license | OliaStfn/Reception | b7dc42a5cd0a7c6a9890cb4b2deca31693c30e0e | 80db92aca39585e79136c83f72afa770474d4922 | refs/heads/master | 2020-04-18T02:19:45.059538 | 2019-02-06T20:39:19 | 2019-02-06T20:39:19 | 167,158,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,441 | java | package com.stfn.services;
import com.stfn.beans.Doctor;
import com.stfn.beans.Schedule;
import com.stfn.dao.GenericDao;
import com.stfn.dao.MySQL.DoctorDao;
import com.stfn.dao.MySQL.Factory;
import lombok.AllArgsConstructor;
import java.time.LocalDate;
import java.util.ArrayList;
@AllArgsConstructor
public class DoctorService {
private GenericDao<Doctor> doctorDao;
public DoctorService() {
Factory factory = new Factory();
doctorDao = (DoctorDao) factory.getDao(Doctor.class);
}
public Doctor searchDocById(int id) {
try {
for (Doctor doctor : doctorDao.readAll()) {
if (id == doctor.getId()) {
return doctor;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public Doctor searchDocByFullName(String name, String surname) {
try {
for (Doctor doctor : doctorDao.readAll()) {
if (name.equals(doctor.getFirstName()) && surname.equals(doctor.getLastName())) {
return doctor;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public ArrayList<Doctor> searchDocBySpecialization(String specialization) {
ArrayList<Doctor> doctorSpec = new ArrayList<>();
try {
for (Doctor doctor : doctorDao.readAll()) {
if ((doctor.getSpecialization().toLowerCase()).contains(specialization.toLowerCase())) {
doctorSpec.add(doctor);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return doctorSpec;
}
public void addDoctor(String name, String surname, LocalDate dateOfBirth, String specialization, Schedule schedule) {
Doctor doctor = new Doctor(name, surname, dateOfBirth, specialization, schedule);
try {
doctorDao.create(doctor);
} catch (Exception e) {
e.printStackTrace();
}
}
public void deleteDoctor(int id) {
try {
doctorDao.delete(id);
} catch (Exception e) {
e.printStackTrace();
}
}
public void updateDoctor(Doctor doctor){
try{
doctorDao.update(doctor);
}catch (Exception e){
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
997fcfe640e5d047da17e04f52e1157ec6b823a8 | 396bbf406256cef4a1c15ce28acf826717543492 | /app/src/main/java/com/wgycs/webviewdemo/WebRegister.java | 120ddd044ce05b09cccc972e66f526a6e7b95a96 | [] | no_license | wgycs/lib_webview | 39dc06eaf3a82de48e20396c70a8abf4df7f2fe3 | 1509eed126fe2ec43c7536c8845d26047b5e24b0 | refs/heads/master | 2022-04-25T11:32:58.310189 | 2020-04-29T07:48:50 | 2020-04-29T07:48:50 | 255,613,341 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package com.wgycs.webviewdemo;
import android.util.Log;
import com.wgycs.webview.JavaScriptBridge;
import com.wgycs.webview.webinterface.BaseProtocol;
import com.wgycs.webview.webinterface.IWebRegister;
/**
* @ProjectName: FM_android
* @Package: com.inpor.library_webview.webinterface
* @ClassName: WebRegister
* @Description: java类作用描述
* @Create: By wangy / 2020/4/8 11:05
* @Version: 1.0
*/
public class WebRegister extends BaseProtocol implements IWebRegister.CallBack {
private static final String TAG = "WebRegister";
@Override
public void initPage() {
Log.d(TAG, "initPage ");
//JavaScriptBridge.getInstance().callJavaScript("aaa");
}
@Override
public void registSuccess(String userName, String password) {
Log.d(TAG, "registSuccess: " + userName);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.