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
33716643f6eea5672d2243e12c755bbf9026d3f3
111550a96ca4ee00cc6f9e4ea741bbca660d3241
/src/main/java/com/expleo/turistmo/turistmo/exception/PasswordMismatchException.java
2a6233e10f90a73a097bc0436617136c7279ca65
[]
no_license
TuristMO/turistmo
31146bc1aaf054763da9785ab2b9bd793708b7ba
49e5debe115ade0d6c12a4db1ea77b9494e2a348
refs/heads/master
2023-01-16T01:22:40.279010
2020-11-25T10:18:02
2020-11-25T10:18:02
296,027,503
0
2
null
2020-09-23T09:11:31
2020-09-16T12:35:27
Java
UTF-8
Java
false
false
196
java
package com.expleo.turistmo.turistmo.exception; public class PasswordMismatchException extends Throwable { public PasswordMismatchException(String message) { super(message); } }
1e1cb374b9278b20d3571f9e7e8957449554452a
9fad8e9b3cae1dbccf6482c4f5011f45ce3fad3c
/src/main/java/com/bootdemo/common/controller/BaseController.java
e057482e0ed29f5c15f6c474c389842432852b4e
[]
no_license
suzhicheng/bootdemo
792f6a5fb7eaac7e264f76775eb82482e389fd99
3ccf6384b394bd6c283486b7b1d1360b0f5d80d1
refs/heads/master
2020-04-13T13:29:05.057991
2018-12-27T09:52:31
2018-12-27T09:52:31
163,232,046
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package com.bootdemo.common.controller; import org.springframework.stereotype.Controller; import com.bootdemo.common.utils.ShiroUtils; import com.bootdemo.system.system.user.entity.UserEntity; @Controller public class BaseController { public UserEntity getUser() { return ShiroUtils.getUser(); } public String getUserId() { return getUser().getId(); } public String getUserName() { return getUser().getUserName(); } }
954421547e7e433f4010c3552709cc44227990be
836652f79b6fd26cfd7d9161490b2e8d4702cdb8
/app/src/main/java/com/baiyi/watch/dialog/DateTimePickerDialog.java
43d3406e11578102c27f86b96298fa6551a4c9a8
[]
no_license
a3chenwensheng/BaiyiWatch
95a5b2bbeac8bf3dc47a75e794dc9f2bc4a4c21d
5ce7a2257eba6c425c893b4b15b40f64ef6ca13f
refs/heads/master
2021-01-18T18:59:59.135782
2017-05-17T07:05:11
2017-05-17T07:05:11
86,880,002
0
0
null
null
null
null
UTF-8
Java
false
false
2,354
java
package com.baiyi.watch.dialog; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import com.baiyi.watch.aqgs2.R; import com.baiyi.watch.widget.wheelview.ScreenInfo; import com.baiyi.watch.widget.wheelview.WheelDateTimePicker; import java.util.Calendar; public class DateTimePickerDialog extends BaseDialog { private WheelDateTimePicker wheelDateTimePicker; public DateTimePickerDialog(Context context, Calendar calendar2, boolean hasSelectTime) { super(context); LayoutInflater inflater = LayoutInflater.from(context); View timepickerview = inflater.inflate(R.layout.include_dialog_datetimepicker, null); setDialogContentView(timepickerview); ScreenInfo screenInfo = new ScreenInfo((Activity)context); wheelDateTimePicker = new WheelDateTimePicker(timepickerview, hasSelectTime); wheelDateTimePicker.screenheight = screenInfo.getHeight(); Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH); int hour = calendar.get(Calendar.HOUR_OF_DAY); int min = calendar.get(Calendar.MINUTE); if (calendar2 != null) { year = calendar2.get(Calendar.YEAR); month = calendar2.get(Calendar.MONTH); day = calendar2.get(Calendar.DAY_OF_MONTH); hour = calendar2.get(Calendar.HOUR_OF_DAY); min = calendar2.get(Calendar.MINUTE); } wheelDateTimePicker.initDateTimePicker(year, month, day, hour, min); } @Override public void setTitle(CharSequence text) { super.setTitle(text); } public void setButton(CharSequence text, OnClickListener listener) { super.setButton1(text, listener); } public void setButton(CharSequence text1, OnClickListener listener1, CharSequence text2, OnClickListener listener2) { super.setButton1(text1, listener1); super.setButton2(text2, listener2); } public String getDateTime() { return wheelDateTimePicker.getTime(); } public int getYear() { return wheelDateTimePicker.getYear(); } public int getMonth() { return wheelDateTimePicker.getMonth(); } public int getDay() { return wheelDateTimePicker.getDay(); } public int getHour() { return wheelDateTimePicker.getHour(); } public int getMinute() { return wheelDateTimePicker.getMinute(); } }
a58a5c4ea630b751043ebf02edc1a8bf04d17023
d23811c861d00d61b1caed4583fce0071e3eacb2
/app/src/main/java/com/example/mentalhealth/Login_SignUp/OnBoardingScreen.java
348cc9fac5bd18b3d6f994cc721ce2be95119d58
[]
no_license
SyedAtifAli/MentalHealth
0b281f99b10adf686a11c969499018c583c12e6e
5540a659dfc611de1834ae0d7a47cc35d0be557d
refs/heads/master
2023-06-30T14:43:12.255520
2021-07-30T09:26:47
2021-07-30T09:26:47
380,760,287
3
0
null
null
null
null
UTF-8
Java
false
false
3,973
java
package com.example.mentalhealth.Login_SignUp; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; import androidx.viewpager.widget.ViewPager; import com.example.mentalhealth.MainActivity; import com.example.mentalhealth.R; import com.example.mentalhealth.SaveSharedPreference; import com.tbuonomo.viewpagerdotsindicator.WormDotsIndicator; public class OnBoardingScreen extends AppCompatActivity { /* access modifiers changed from: private */ public Button back; /* access modifiers changed from: private */ public int currentPage; /* access modifiers changed from: private */ public int[] layouts = {R.layout.first_slide, R.layout.second_slide, R.layout.third_slide}; /* access modifiers changed from: private */ public Button next; private WormDotsIndicator wormDotsIndicator; /* access modifiers changed from: protected */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (SaveSharedPreference.getRef(this)) { startActivity(new Intent(this, MainActivity.class)); finish(); } setContentView((int) R.layout.activity_on_boarding_screenm); final ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new ViewPagerAdapter(this.layouts, this)); pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } public void onPageSelected(int position) { int unused = OnBoardingScreen.this.currentPage = position; if (OnBoardingScreen.this.currentPage == 0) { OnBoardingScreen.this.back.setEnabled(false); OnBoardingScreen.this.next.setEnabled(true); OnBoardingScreen.this.back.setVisibility(View.INVISIBLE); } else if (OnBoardingScreen.this.currentPage == OnBoardingScreen.this.layouts.length - 1) { OnBoardingScreen.this.back.setEnabled(true); OnBoardingScreen.this.next.setEnabled(true); OnBoardingScreen.this.back.setVisibility(View.VISIBLE); OnBoardingScreen.this.next.setText("FINISH"); } else { OnBoardingScreen.this.back.setEnabled(true); OnBoardingScreen.this.next.setEnabled(true); OnBoardingScreen.this.back.setVisibility(View.VISIBLE); OnBoardingScreen.this.next.setText("NEXT"); } } public void onPageScrollStateChanged(int state) { } }); this.wormDotsIndicator = (WormDotsIndicator) findViewById(R.id.worm_dots_indicator); Button button = (Button) findViewById(R.id.buttonBack); this.back = button; button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pager.setCurrentItem(OnBoardingScreen.this.currentPage - 1); } }); Button button2 = (Button) findViewById(R.id.buttonNext); this.next = button2; button2.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (OnBoardingScreen.this.currentPage == OnBoardingScreen.this.layouts.length - 1) { SaveSharedPreference.setRef(OnBoardingScreen.this, true); OnBoardingScreen.this.startActivity(new Intent(OnBoardingScreen.this, SignUp.class)); OnBoardingScreen.this.finish(); return; } pager.setCurrentItem(OnBoardingScreen.this.currentPage + 1); } }); this.wormDotsIndicator.setViewPager(pager); } }
bddf223c63bb989d81e5ca3c3ecf63d543d10c13
5144f38e1736fcaa69429a783dbe606318a896bd
/ItemBlocks/BlockRedstoneMachine.java
ebe2c7e7a321dafe2961392f93813d142b392fcf
[]
no_license
sb023612/ExpandedRedstone
a66d1a7fc633589dccd0f5fc1c9cfce241fc05eb
bf9bafcf3c1a508c2d8ef424242a40b335a4d54f
refs/heads/master
2020-12-27T13:13:32.616220
2014-10-03T07:48:07
2014-10-03T07:48:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,177
java
/******************************************************************************* * @author Reika Kalseki * * Copyright 2014 * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. ******************************************************************************/ package Reika.ExpandedRedstone.ItemBlocks; import net.minecraft.block.material.Material; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import Reika.DragonAPI.Libraries.ReikaAABBHelper; import Reika.ExpandedRedstone.Base.BlockRedstoneBase; public class BlockRedstoneMachine extends BlockRedstoneBase { public BlockRedstoneMachine(Material mat) { super(mat); } @Override public void setBlockBoundsBasedOnState(IBlockAccess iba, int x, int y, int z) { this.setBlockBounds(0, 0, 0, 1, 1, 1); } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return ReikaAABBHelper.getBlockAABB(x, y, z); } @Override public int getLightOpacity(IBlockAccess iba, int x, int y, int z) { return 255; } }
ddeff1379ff81e9a31e1c2554473557ad5eb8cac
44d3f9b302f15b6439c6290a12be8f30fb8faadb
/src/java/hoaitq/cart/CartDTO.java
c27977a6b31e0b06102d1802d854131ff5f7131f
[]
no_license
ThaiQuocHoai/Car-Rental
7c2f84eaff523f0a313d8928836bd739494f89cc
cf5d370279614609c718ecd03b6d8f4d28e3beb2
refs/heads/main
2023-03-23T15:13:18.660286
2021-03-11T05:48:31
2021-03-11T05:48:31
346,252,355
0
0
null
null
null
null
UTF-8
Java
false
false
3,451
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 hoaitq.cart; import java.io.Serializable; /** * * @author QH */ public class CartDTO implements Serializable{ private int id; private String carName; private String image; private String color; private int year; private float price; private int quantity; private float rate; private String rentalDate; private String returnDate; public CartDTO() { } public CartDTO(int id, String carName, String image, String color, int year, float price, int quantity, float rate, String rentalDate, String returnDate) { this.id = id; this.carName = carName; this.image = image; this.color = color; this.year = year; this.price = price; this.quantity = quantity; this.rate = rate; this.rentalDate = rentalDate; this.returnDate = returnDate; } /** * @return the id */ public int getId() { return id; } /** * @param id the id to set */ public void setId(int id) { this.id = id; } /** * @return the carName */ public String getCarName() { return carName; } /** * @param carName the carName to set */ public void setCarName(String carName) { this.carName = carName; } /** * @return the image */ public String getImage() { return image; } /** * @param image the image to set */ public void setImage(String image) { this.image = image; } /** * @return the color */ public String getColor() { return color; } /** * @param color the color to set */ public void setColor(String color) { this.color = color; } /** * @return the year */ public int getYear() { return year; } /** * @param year the year to set */ public void setYear(int year) { this.year = year; } /** * @return the price */ public float getPrice() { return price; } /** * @param price the price to set */ public void setPrice(float price) { this.price = price; } /** * @return the quantity */ public int getQuantity() { return quantity; } /** * @param quantity the quantity to set */ public void setQuantity(int quantity) { this.quantity = quantity; } /** * @return the rate */ public float getRate() { return rate; } /** * @param rate the rate to set */ public void setRate(float rate) { this.rate = rate; } /** * @return the rentalDate */ public String getRentalDate() { return rentalDate; } /** * @param rentalDate the rentalDate to set */ public void setRentalDate(String rentalDate) { this.rentalDate = rentalDate; } /** * @return the returnDate */ public String getReturnDate() { return returnDate; } /** * @param returnDate the returnDate to set */ public void setReturnDate(String returnDate) { this.returnDate = returnDate; } }
840463b59572c33a34597d8dddc9e696637ba579
653deec31f06368df9c1d3fbb93e20e513ad635f
/app/src/main/java/download/test/control/DownloadManager.java
ac73e15172ce1dce6a94107a2b95b81785b297b5
[]
no_license
shenbibo/AndroidFirstTest
057969b07393f9fed933b558e96fff422d537587
2d10602c630e08f02537ba0889a4f588d71e2396
refs/heads/master
2020-12-03T15:04:53.550198
2018-08-22T06:55:33
2018-08-22T06:55:33
66,331,416
0
0
null
null
null
null
UTF-8
Java
false
false
9,363
java
package download.test.control; import java.io.File; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import com.example.androidfirsttest.MyApplication; import android.content.Intent; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.widget.Toast; import download.test.bean.DownloadFileInfo; import download.test.bean.DownloadFileInfo.DownloadStatus; import download.test.bean.DownloadFileInfo.InterruptReason; import download.test.utils.BroadcastConstants.DownloadAirConstants; import download.test.utils.NetworkUtils; /** * * 下载管理类,单例模式 * @author sWX284798 * @date 2015年11月28日 上午11:04:33 * @version * @since */ public class DownloadManager { private static final String TAG = "DownloadManager"; private volatile static DownloadManager manager; private List<DownloadFileInfo> taskList = new LinkedList<DownloadFileInfo>(); /** * 执行下载任务的线程池 * */ private ThreadPoolExecutor executor = NetworkUtils.FILE_DOWNLOAD_EXECUTOR; private DownloadManager() {} private Handler handler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(android.os.Message msg) { int status = msg.what; switch(status) { case DownloadStatus.DOWNLOADING: Log.d(TAG, "downloadStatus = downloading" ); //刷新下载进度 sendBroadcast(status); break; default: sendBroadcast(status); break; } }; }; private void sendBroadcast(int downloadStatus) { Intent i = new Intent(); String action; if(downloadStatus == DownloadStatus.DOWNLOADING) { action = DownloadAirConstants.PROGRESS_ACTION; } else { action = DownloadAirConstants.STATUS_ACTION; } i.setAction(action); MyApplication.getInstance().sendBroadcast(i); } /** * 获取下载管理的的单例 * */ public static DownloadManager getInstance() { if(manager == null) { synchronized(DownloadManager.class) { if(manager == null) { manager = new DownloadManager(); } } } return manager; } /** * 开启新的下载任务 * */ public boolean startNewDownloadTask(DownloadFileInfo info) { if(info.getInterruptReason() != InterruptReason.DOWNLOAD_END) { info.setInterrupt(false); info.setStatus(DownloadStatus.DOWNLOAD_WAIT); addTask(info); handler.sendMessage(handler.obtainMessage(info.getStatus(), info)); Future<?> future = executor.submit(new DownloadRunnable(info, handler)); info.setFuture(future); } else { Toast.makeText(MyApplication.getInstance(), info.appName + " is download finished", Toast.LENGTH_SHORT).show(); } return false; } public boolean addTask(DownloadFileInfo info) { synchronized(taskList) { if(!isTaskRepeat(info)) { taskList.add(info); return true; } } return false; } public boolean removeTask(DownloadFileInfo info) { synchronized (taskList) { return taskList.remove(info); } } public void clearTaskList() { synchronized(taskList) { taskList.clear(); } } /** * 全部下载 * */ public void startAllTask(List<DownloadFileInfo> infoList) { for (DownloadFileInfo info : infoList) { //当认为的状态不为下载完成、下载中、等待下载、准备下载时,才作为新任务启动 if(info.getStatus() != DownloadStatus.DOWNLOADED && info.getStatus() != DownloadStatus.DOWNLOADING && info.getStatus() != DownloadStatus.DOWNLOAD_READY && info.getStatus() != DownloadStatus.DOWNLOAD_WAIT) { startNewDownloadTask(info); } } } /** * 取消全部下载任务 * */ public void cancelAllTask(List<DownloadFileInfo> infoList) { for (DownloadFileInfo info : infoList) { //当认为的状态为下载中、等待下载、准备下载、暂停下载才取消下载 if(info.getStatus() == DownloadStatus.DOWNLOADING || info.getStatus() == DownloadStatus.DOWNLOAD_READY || info.getStatus() == DownloadStatus.DOWNLOAD_WAIT || info.getStatus() == DownloadStatus.DOWMLOAD_PAUSE) { //startNewDownloadTask(info); cancelDownloadTask(info); } } } /** * 恢复所有暂停下载的任务 * */ public void resumeAllPauseTask(List<DownloadFileInfo> infoList) { for (DownloadFileInfo info : infoList) { if(info.getStatus() == DownloadStatus.DOWMLOAD_PAUSE) { resumeDownloadTask(info); } } } /** * 暂停所有正在下载的任务 * */ public void pauseAllDownloadingTask(List<DownloadFileInfo> infoList) { for (DownloadFileInfo info : infoList) { //当认为的状态为下载中、等待下载、准备下载、暂停下载才停止下载 if(info.getStatus() == DownloadStatus.DOWNLOADING || info.getStatus() == DownloadStatus.DOWNLOAD_READY || info.getStatus() == DownloadStatus.DOWNLOAD_WAIT) { //startNewDownloadTask(info); pauseDownloadTask(info); } } } /** * 判断新加入的任务是否已经存在。 * */ private boolean isTaskRepeat(DownloadFileInfo info) { //synchronized(taskList) { for (DownloadFileInfo task : taskList) { if(task.urlMD5HexStr.equalsIgnoreCase(info.urlMD5HexStr)) { return true; } } } return false; } /** * 取消下载 * */ public boolean cancelDownloadTask(DownloadFileInfo info) { boolean isNeedSendMessage = false; if(info.getStatus() == DownloadStatus.DOWNLOAD_WAIT || info.getStatus() == DownloadStatus.DOWMLOAD_PAUSE) { if(info.getFuture() != null) { info.getFuture().cancel(true); info.setFuture(null); } removeTask(info); isNeedSendMessage = true; } info.setInterruptByReason(true, InterruptReason.USER_CANCEL); info.setStatus(DownloadStatus.DOWNLOAD_CANCEL); if(isNeedSendMessage) { info.setProgress(0); info.setAlreadyDownloadCount(0); File f = new File(info.getTempDownloadFile()); if(f.exists()) { f.delete(); } handler.sendMessage(handler.obtainMessage(info.getStatus(), info)); } return false; } /** * 暂停下载任务 * */ public boolean pauseDownloadTask(DownloadFileInfo info) { boolean isNeedSendMessage = false; if(info.getStatus() == DownloadStatus.DOWNLOAD_WAIT) { if(info.getFuture() != null) { info.getFuture().cancel(true); info.setFuture(null); } //removeTask(info); isNeedSendMessage = true; } info.setInterruptByReason(true, InterruptReason.USER_PAUSED); info.setStatus(DownloadStatus.DOWMLOAD_PAUSE); if(isNeedSendMessage) { handler.sendMessage(handler.obtainMessage(info.getStatus(), info)); } return false; } /** * 继续下载 * */ public boolean resumeDownloadTask(DownloadFileInfo info) { if(info.getInterruptReason() != InterruptReason.DOWNLOAD_END || info.getStatus() != DownloadStatus.DOWNLOADED) { info.setInterrupt(false); info.setStatus(DownloadStatus.DOWNLOAD_WAIT); addTask(info); handler.sendMessage(handler.obtainMessage(info.getStatus(), info)); Future<?> future = executor.submit(new DownloadRunnable(info, handler)); info.setFuture(future); } else { Toast.makeText(MyApplication.getInstance(), info.appName + " is download finished", Toast.LENGTH_SHORT).show(); } return false; } }
7f74fe7c48687c236722dc075e21b6a8cd73e4b0
4fc41d98a3cd533a71cf161041ea02a706ae1ea9
/src/project/src/miniJava/SyntacticAnalyzer/TokenType.java
fae1c0ea48f1b10e77c8ff243a6ddd056c442ce9
[]
no_license
banga/miniJava-compiler
76488882aacd0a4ac800982bb809140955b9cf37
4e2169f69f9f7a39edc57cc99018d578c5621ddb
refs/heads/master
2018-07-16T05:09:34.651216
2012-04-20T04:40:22
2012-04-20T04:40:22
3,150,784
6
3
null
null
null
null
UTF-8
Java
false
false
930
java
package miniJava.SyntacticAnalyzer; public enum TokenType { SEMICOLON(";"), COMMA(","), LPAREN("("), RPAREN(")"), LSQUARE("["), RSQUARE("]"), LCURL("{"), RCURL("}"), LANGLE("<"), RANGLE(">"), EQUALTO("="), EQUALTO_EQUALTO("=="), LANGLE_EQUALTO("<="), RANGLE_EQUALTO(">="), BANG_EQUALTO("!="), PLUS("+"), MINUS("-"), ASTERISK("*"), SLASH("/"), PIPE_PIPE("||"), AMPERSAND_AMPERSAND("&&"), BANG("!"), DOT("."), // Keywords CLASS("class"), PUBLIC("public"), PRIVATE("private"), RETURN("return"), STATIC("static"), INT("int"), BOOLEAN("boolean"), VOID("void"), THIS("this"), IF("if"), ELSE("else"), WHILE("while"), NEW("new"), TRUE("true"), FALSE("false"), NUMBER, IDENTIFIER, STRING, EOT; public final String spelling; TokenType() { this.spelling = null; } TokenType(String spelling) { this.spelling = spelling; } }
fc8c71c3b9ac8f4b9d92cd0eb0680782cbbc1271
1faeca6f6ae6f9606118a2ab62f62a6f99e01d98
/app/src/main/java/com/app/dantel/mobile/AnyAgentAllocation/AgentSearchPage.java
a949cb932856ec59cd56fd6c367a151e39707bc8
[]
no_license
priyankagiri14/dantel_mobile
74cf9eafef365fd74f688843a895e5c731ae498e
02740664c892951322eabc4004810000e9c46de1
refs/heads/master
2020-09-24T17:06:28.730322
2020-02-18T11:59:06
2020-02-18T11:59:06
225,799,237
0
0
null
null
null
null
UTF-8
Java
false
false
1,495
java
package com.app.dantel.mobile.AnyAgentAllocation; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class AgentSearchPage { @SerializedName("numberOfElements") @Expose private Integer numberOfElements; @SerializedName("totalElements") @Expose private Integer totalElements; @SerializedName("totalPages") @Expose private Integer totalPages; @SerializedName("size") @Expose private Integer size; @SerializedName("pageNumber") @Expose private Integer pageNumber; public Integer getNumberOfElements() { return numberOfElements; } public void setNumberOfElements(Integer numberOfElements) { this.numberOfElements = numberOfElements; } public Integer getTotalElements() { return totalElements; } public void setTotalElements(Integer totalElements) { this.totalElements = totalElements; } public Integer getTotalPages() { return totalPages; } public void setTotalPages(Integer totalPages) { this.totalPages = totalPages; } public Integer getSize() { return size; } public void setSize(Integer size) { this.size = size; } public Integer getPageNumber() { return pageNumber; } public void setPageNumber(Integer pageNumber) { this.pageNumber = pageNumber; } }
beb5c859c2b5a79e4862381232cc17a42cca8ef3
3291a6e8222a3b16a2d8ab08e1d412aeb56bb2b5
/app/src/main/java/com/fmapp/test01/utils/DensityUtil.java
7de3d5fbbd3ccab3c24023230fd1e77d57dbc785
[]
no_license
sengeiou/Test01
fa53b9753fe0714e8a726e51633b7b7743a8c7cb
8e98fa540868cf664f4885a60013a3ddd7909693
refs/heads/master
2022-11-27T00:33:26.061733
2020-08-06T09:45:40
2020-08-06T09:45:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package com.fmapp.test01.utils; import android.content.Context; public class DensityUtil { private static float scale; /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context context, float dpValue) { if (scale == 0) { scale = context.getResources().getDisplayMetrics().density; } return (int) (dpValue * scale + 0.5f); } /** * 根据手机的分辨率从 px(像素) 的单位 转成为 dp */ public static int px2dip(Context context, float pxValue) { if (scale == 0) { scale = context.getResources().getDisplayMetrics().density; } return (int) (pxValue / scale + 0.5f); } }
[ "@mirage@1314" ]
@mirage@1314
055a07d94644011604955c1defbdd775958f1512
738e0d93d9d9dab4348d812acd98e4f15d7dbfd2
/HuBei/src/main/java/com/szboanda/epsm/workbench/datatransmit/controller/SuperviseOneselfController.java
bef40c05224d84c961f8458ba1d6767af5fc860a
[]
no_license
chiclau/powerdata
4ab92c29f9ebe1e67c310027e0c8e76c5f07bef0
bce8cdc9f71b78763d2468e7ad42402ba952ce92
refs/heads/master
2020-03-11T09:56:52.342577
2018-04-17T15:43:54
2018-04-17T15:43:54
129,927,341
1
0
null
null
null
null
UTF-8
Java
false
false
1,259
java
/****************************************************************************** * Copyright (C) 2017 ShenZhen Powerdata Information Technology Co.,Ltd * All Rights Reserved. * 本软件为深圳博安达开发研制。未经本公司正式书面同意,其他任何个人、团体不得使用、 * 复制、修改或发布本软件. *****************************************************************************/ package com.szboanda.epsm.workbench.datatransmit.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.szboanda.epsm.workbench.datatransmit.exception.SuperviseOneselfException; import com.szboanda.platform.common.base.BaseController; /** * @Title: 企业自行监测信息 * @author 陈鹏 * @since JDK1.6 * @history 2017年10月12日 新建 */ @Controller("/superviseOneselfController") @RequestMapping("/epsm/workbench/datatransmit/controller/superviseoneselfcontroller") public class SuperviseOneselfController extends BaseController { @RequestMapping("/superviseoneselfpage") public String superviseOneselfPage() throws SuperviseOneselfException { this.setToken(); return "epsm/workbench/datatransmit/superviseoneself"; } }
16b413bff75f2ae6ff2e1753d8cfdc02a3c400d8
680e8e94cf6a3de379e6562c46b9384db3d8be3b
/template_0709/src/main/java/com/mylibrary/book/admin/service/AdmDirInsert/AdmDirInsService.java
93c50ad492077eb98cb43a87950e7e70160a2fa3
[]
no_license
bjm1244/Library-Project
1b406ecb31b1f61d3f68f58baa6772d753e08365
ceb9cfb8a4b562ff0805e283ca8a2fa42d820d10
refs/heads/master
2023-08-16T22:39:31.558063
2021-09-24T02:12:53
2021-09-24T02:12:53
284,569,708
0
0
null
2020-08-04T05:07:40
2020-08-03T00:50:20
null
UTF-8
Java
false
false
199
java
package com.mylibrary.book.admin.service.AdmDirInsert; public interface AdmDirInsService { public boolean AdmDirIns(String title, String author, String publisher, String isbn13) throws Exception; }
266f32cf12dece30836a29dc8357a4056e5adc30
bc1b35bdbd8a375ab599a4063fba1a686bb0f308
/ParentWorkspace/SpringModule/src/main/java/com/miniproject/repository/VerificationRepository.java
4c8275a1f239c02c8e58697d6972629018919d6f
[]
no_license
muhilkennedy/Learning-App
7a985e65944e9a37c85cf793e2a020fa8b38c4f6
b5fe19089447c25c0fdadf46639f35a35abc350e
refs/heads/master
2023-01-18T22:45:06.348828
2020-06-03T14:42:15
2020-06-03T14:42:15
222,980,787
1
2
null
2023-01-07T16:59:01
2019-11-20T16:29:32
Java
UTF-8
Java
false
false
235
java
package com.miniproject.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.miniproject.model.Verification;; public interface VerificationRepository extends JpaRepository<Verification, Integer> { }
9ea3a6f8ea6b78a90fc184e55d3543d50dadd5bc
39b49d355249f5807007b9415b875afe881674db
/oop/Overrinding/4.java
84a1f6a3fbb330d2d9621efb3286179aa035e039
[]
no_license
Chanakacds/Java_example-
7a3aac8d916d74bd279a24c8043d09f43ff5b695
a8ec7cd92bca1a6450af84eba3a967adb9dd7536
refs/heads/master
2022-11-25T00:20:30.825146
2020-07-30T07:49:09
2020-07-30T07:49:09
281,550,703
1
0
null
null
null
null
UTF-8
Java
false
false
78
java
class A{ public void m1(){ } } class C extends A{ void m1(){ } }
ebb73ff88eb91dd12001785d3b6d1fc201940543
f2709952a110ef6a83e4bdbd3030f499b39769b3
/swift-idl-parser/src/main/java/com/facebook/swift/parser/model/ContainerType.java
a5933812d8d1abf80b7fd486aded0fa30049fe6b
[ "Apache-2.0" ]
permissive
thaingo/swift
1e1077d346b7b3144336542bc391234b4b838340
143fe768ebed3609b66b24fca04e27bd0c80713c
refs/heads/master
2021-01-21T01:16:46.666057
2012-11-02T19:18:22
2012-11-02T19:18:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,389
java
/** * Copyright 2012 Facebook, 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.facebook.swift.parser.model; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import java.util.List; import static com.google.common.base.Preconditions.checkNotNull; public abstract class ContainerType extends ThriftType { protected final Optional<String> cppType; protected final List<TypeAnnotation> annotations; public ContainerType(String cppType, List<TypeAnnotation> annotations) { this.cppType = Optional.fromNullable(cppType); this.annotations = ImmutableList.copyOf(checkNotNull(annotations, "annotations")); } public Optional<String> getCppType() { return cppType; } public List<TypeAnnotation> getAnnotations() { return annotations; } }
2925ed8bfdf78b6f711675e5c8552bb1fcab14ed
5d9128606e288f4a8ede1f39bf0909a97247dbb8
/src/main/old-java/org/arbonaut/android/jooq/util/h2/H2Factory.java
4dc3733b838f509d0de17ca3af11e10e3d98fd61
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
Arbonaut/jOOQ
ec62a03a6541444b251ed7f3cdefc22eadf2a03d
21fbf50ca6129f1bc20cc6c553d99ba92865d192
refs/heads/master
2021-01-16T20:32:00.437982
2012-11-26T13:28:19
2012-11-26T13:28:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,782
java
/** * Copyright (c) 2009-2012, Lukas Eder, [email protected] * All rights reserved. * * This software is licensed to you under the Apache License, Version 2.0 * (the "License"); You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * . Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * . Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * . Neither the name "jOOQ" nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.jooq.util.h2; import java.sql.Connection; import javax.sql.DataSource; import org.jooq.SQLDialect; import org.jooq.SchemaMapping; import org.jooq.conf.Settings; import org.jooq.impl.Factory; /** * A {@link SQLDialect#H2} specific factory * * @author Lukas Eder */ @SuppressWarnings("deprecation") public class H2Factory extends Factory { /** * Generated UID */ private static final long serialVersionUID = -9107771365147317008L; /** * Create a factory with connection and a schema mapping configured * * @param connection The connection to use with objects created from this * factory * @param mapping The schema mapping to use with objects created from this * factory * @deprecated - 2.0.5 - Use {@link #H2Factory(Connection, Settings)} * instead */ @Deprecated public H2Factory(Connection connection, SchemaMapping mapping) { super(connection, SQLDialect.H2, mapping); } /** * Create a factory with connection and a settings configured * * @param connection The connection to use with objects created from this * factory * @param settings The runtime settings to apply to objects created from * this factory */ public H2Factory(Connection connection, Settings settings) { super(connection, SQLDialect.H2, settings); } /** * Create a factory with a data source and a settings configured * * @param dataSource The data source to use with objects created from this * factory * @param settings The runtime settings to apply to objects created from * this factory */ public H2Factory(DataSource dataSource, Settings settings) { super(dataSource, SQLDialect.H2, settings); } /** * Create a factory with connection * * @param connection The connection to use with objects created from this * factory */ public H2Factory(Connection connection) { super(connection, SQLDialect.H2); } /** * Create a factory with a data source * * @param dataSource The data source to use with objects created from this * factory */ public H2Factory(DataSource dataSource) { super(dataSource, SQLDialect.H2); } /** * Create a factory with settings configured * <p> * Without a connection, this factory cannot execute queries. Use it to * render SQL only. * * @param settings The runtime settings to apply to objects created from * this factory */ public H2Factory(Settings settings) { super(SQLDialect.H2, settings); } /** * Create a connection-less factory * <p> * Without a connection, this factory cannot execute queries. Use it to * render SQL only. */ public H2Factory() { super(SQLDialect.H2); } }
dfb2bd37080ef6e18652976e891b5a4259b233a2
df37a7d2e6b12c8c47d39ddf3da48edc28df00c7
/src/main/java/com/amazonaws/mws/samples/RequestReport.java
1ed998e2d1519e9625fb5a13c69e51ad5072dcdf
[]
no_license
Dorisliy/ssmpro
6b6a26279a042eaae05535ce2000ea8ae8f8c4e7
7f50762e4477f32d92a0f4a95871044330c6b7b7
refs/heads/master
2021-01-23T09:10:20.875103
2017-12-15T06:13:43
2017-12-15T06:13:43
102,560,438
0
0
null
null
null
null
UTF-8
Java
false
false
13,338
java
/******************************************************************************* * Copyright 2009 Amazon Services. * 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://aws.amazon.com/apache2.0 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * ***************************************************************************** * * Marketplace Web Service Java Library * API Version: 2009-01-01 * Generated: Wed Feb 18 13:28:48 PST 2009 * */ package com.amazonaws.mws.samples; import java.util.Arrays; import java.util.GregorianCalendar; import java.util.List; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import cn.ssm.project.utils.AmazonUtil; import com.amazonaws.mws.*; import com.amazonaws.mws.model.*; import com.amazonaws.mws.mock.MarketplaceWebServiceMock; /** * * Request Report Samples * * */ public class RequestReport { /** * Just add a few required parameters, and try the service * Request Report functionality * * @param args unused */ // public static void main(String... args) { // requestReport(null, null, null); // } /** * Just add a few required parameters, and try the service * Request Report functionality * */ public static RequestReportResponse requestReport(String updatedAfter, String updatedBefore, String reportType,String accessKeyId,String secretAccessKey,String merchantId,String marketplaceId,String url) { /************************************************************************ * Access Key ID and Secret Access Key ID, obtained from: * http://aws.amazon.com ***********************************************************************/ // final String accessKeyId = AmazonUtil.MWS_ACCESS_KEY; // final String secretAccessKey = AmazonUtil.MWS_SECRET_KEY; final String appName = AmazonUtil.MWS_APP_NAME; final String appVersion = AmazonUtil.MWS_APP_VERSION; MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); /************************************************************************ * Uncomment to set the appropriate MWS endpoint. ************************************************************************/ config.setServiceURL(url); // US // config.setServiceURL("https://mws.amazonservices.com"); // UK // config.setServiceURL("https://mws.amazonservices.co.uk"); // Germany // config.setServiceURL("https://mws.amazonservices.de"); // France // config.setServiceURL("https://mws.amazonservices.fr"); // Italy // config.setServiceURL("https://mws.amazonservices.it"); // Japan // config.setServiceURL("https://mws.amazonservices.jp"); // China // config.setServiceURL("https://mws.amazonservices.com.cn"); // Canada // config.setServiceURL("https://mws.amazonservices.ca"); // India // config.setServiceURL("https://mws.amazonservices.in"); /************************************************************************ * You can also try advanced configuration options. Available options are: * * - Signature Version * - Proxy Host and Proxy Port * - User Agent String to be sent to Marketplace Web Service * ***********************************************************************/ /************************************************************************ * Instantiate Http Client Implementation of Marketplace Web Service ***********************************************************************/ MarketplaceWebService service = new MarketplaceWebServiceClient( accessKeyId, secretAccessKey, appName, appVersion, config); /************************************************************************ * Uncomment to try out Mock Service that simulates Marketplace Web Service * responses without calling Marketplace Web Service service. * * Responses are loaded from local XML files. You can tweak XML files to * experiment with various outputs during development * * XML files available under com/amazonaws/mws/mock tree * ***********************************************************************/ // MarketplaceWebService service = new MarketplaceWebServiceMock(); /************************************************************************ * Setup request parameters and uncomment invoke to try out * sample for Request Report ***********************************************************************/ /************************************************************************ * Marketplace and Merchant IDs are required parameters for all * Marketplace Web Service calls. ***********************************************************************/ // final String merchantId = AmazonUtil.MWS_SELLER_ID; // final String sellerDevAuthToken = "<Merchant Developer MWS Auth Token>"; // marketplaces from which data should be included in the report; look at the // API reference document on the MWS website to see which marketplaces are // included if you do not specify the list yourself final IdList marketplaces = new IdList(Arrays.asList(marketplaceId)); //US; //US RequestReportRequest request = new RequestReportRequest() .withMerchant(merchantId) .withMarketplaceIdList(marketplaces) .withReportType(reportType) .withReportOptions("ShowSalesChannel=true"); //request = request.withMWSAuthToken(sellerDevAuthToken); // demonstrates how to set the date range DatatypeFactory df = null; try { df = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { e.printStackTrace(); throw new RuntimeException(e); } //set the date duration request.setStartDate(AmazonUtil.long2Gregorian(AmazonUtil.str2Date(updatedAfter))); request.setEndDate(AmazonUtil.long2Gregorian(AmazonUtil.str2Date(updatedBefore))); // @TODO: set additional request parameters here return invokeRequestReport(service, request); } public static RequestReportResponse requestReport(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate, String reportType,String accessKeyId,String secretAccessKey,String merchantId,String marketplaceId,String url) { final String appName = AmazonUtil.MWS_APP_NAME; final String appVersion = AmazonUtil.MWS_APP_VERSION; MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); config.setServiceURL(url); MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, appName, appVersion, config); final IdList marketplaces = new IdList(Arrays.asList(marketplaceId)); //US; //US RequestReportRequest request = new RequestReportRequest() .withMerchant(merchantId) .withMarketplaceIdList(marketplaces) .withReportType(reportType) .withReportOptions("ShowSalesChannel=true"); //request = request.withMWSAuthToken(sellerDevAuthToken); // demonstrates how to set the date range DatatypeFactory df = null; try { df = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { e.printStackTrace(); throw new RuntimeException(e); } //set the date duration request.setStartDate(startDate); request.setEndDate(endDate); // @TODO: set additional request parameters here return invokeRequestReport(service, request); } /** * Request Report request sample * requests the generation of a report * * @param service instance of MarketplaceWebService service * @param request Action to invoke */ public static RequestReportResponse invokeRequestReport(MarketplaceWebService service, RequestReportRequest request) { RequestReportResponse response = null; try { response = service.requestReport(request); System.out.println ("RequestReport Action Response"); System.out.println ("============================================================================="); System.out.println (); System.out.print(" RequestReportResponse"); System.out.println(); if (response.isSetRequestReportResult()) { System.out.print(" RequestReportResult"); System.out.println(); RequestReportResult requestReportResult = response.getRequestReportResult(); if (requestReportResult.isSetReportRequestInfo()) { System.out.print(" ReportRequestInfo"); System.out.println(); ReportRequestInfo reportRequestInfo = requestReportResult.getReportRequestInfo(); if (reportRequestInfo.isSetReportRequestId()) { System.out.print(" ReportRequestId"); System.out.println(); System.out.print(" " + reportRequestInfo.getReportRequestId()); System.out.println(); } if (reportRequestInfo.isSetReportType()) { System.out.print(" ReportType"); System.out.println(); System.out.print(" " + reportRequestInfo.getReportType()); System.out.println(); } if (reportRequestInfo.isSetStartDate()) { System.out.print(" StartDate"); System.out.println(); System.out.print(" " + reportRequestInfo.getStartDate()); System.out.println(); } if (reportRequestInfo.isSetEndDate()) { System.out.print(" EndDate"); System.out.println(); System.out.print(" " + reportRequestInfo.getEndDate()); System.out.println(); } if (reportRequestInfo.isSetSubmittedDate()) { System.out.print(" SubmittedDate"); System.out.println(); System.out.print(" " + reportRequestInfo.getSubmittedDate()); System.out.println(); } if (reportRequestInfo.isSetReportProcessingStatus()) { System.out.print(" ReportProcessingStatus"); System.out.println(); System.out.print(" " + reportRequestInfo.getReportProcessingStatus()); System.out.println(); } } } if (response.isSetResponseMetadata()) { System.out.print(" ResponseMetadata"); System.out.println(); ResponseMetadata responseMetadata = response.getResponseMetadata(); if (responseMetadata.isSetRequestId()) { System.out.print(" RequestId"); System.out.println(); System.out.print(" " + responseMetadata.getRequestId()); System.out.println(); } } System.out.println(); System.out.println(response.getResponseHeaderMetadata()); System.out.println(); } catch (MarketplaceWebServiceException ex) { System.out.println("Caught Exception: " + ex.getMessage()); System.out.println("Response Status Code: " + ex.getStatusCode()); System.out.println("Error Code: " + ex.getErrorCode()); System.out.println("Error Type: " + ex.getErrorType()); System.out.println("Request ID: " + ex.getRequestId()); System.out.print("XML: " + ex.getXML()); System.out.println("ResponseHeaderMetadata: " + ex.getResponseHeaderMetadata()); } return response; } }
39455f7f8c6b78b1782ef99a09ddbecc6446797f
9058631379df783219e76467a8ec7c415a20f6b8
/src/main/java/com/manyTomany/api/model/Customer.java
34e1f5b619784d06cfeaeefe3bfc6d8362bae984
[]
no_license
CodeAndCollaborait/Springboot_ManyToMany
009f5961cd28faa428562650bf2ef743e245c24c
20839fe5d6d26a54c1fb69625cb073198fe0f6e7
refs/heads/master
2022-11-11T02:06:04.198966
2020-06-29T18:46:41
2020-06-29T18:46:41
275,898,666
0
0
null
null
null
null
UTF-8
Java
false
false
1,717
java
package com.manyTomany.api.model; import javax.persistence.*; import java.util.HashSet; import java.util.Set; @Entity @Table(name = "customers") public class Customer extends AuditModel { @Id @Column(name = "customer_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long customerId; @Column(name = "full_name", nullable = false) private String fullName; @Column(name = "address", nullable = false) private String address; //Many to Many.. One customer can have multiple account ? // Each account types must be unique ... set .. @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "customer_bankaccount", joinColumns = {@JoinColumn(name = "customer_id")}, inverseJoinColumns = {@JoinColumn(name = "bankaccount_id", referencedColumnName = "bankaccount_id")}) Set<BankAccount> bankAccounts = new HashSet<>(); public Customer() { } public Long getCustomerId() { return customerId; } public void setCustomerId(Long customerId) { this.customerId = customerId; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Set<BankAccount> getBankAccounts() { return bankAccounts; } public void setBankAccounts(Set<BankAccount> bankAccounts) { this.bankAccounts = bankAccounts; } @Override public String toString() { return "Customer{" + "customerId=" + customerId + ", fullName='" + fullName + '\'' + ", address='" + address + '\'' + ", bankAccounts=" + bankAccounts + '}'; } }
d335ba025dc312d34108f0a7342159ea824bdbd2
83f1420d1d03f0657e9ab7e13330a5a8322ef445
/Ecommerce/src/main/java/net/codejava/controllers/admin/CategoryAdminController.java
69fd6b7e509ada456bb098ecc1f05fec863a4550
[]
no_license
minhvip1997/Ecomerce
293514b0531c565830c53e21224909ab1003cbd6
80f1606d9c2de96c7c1a4d784a14067663aa7218
refs/heads/main
2023-02-19T06:49:11.071350
2021-01-10T14:34:45
2021-01-10T14:34:45
312,195,121
0
0
null
null
null
null
UTF-8
Java
false
false
4,086
java
package net.codejava.controllers.admin; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import net.codejava.models.Category; import net.codejava.services.CategoryService; @Controller @RequestMapping("/admin/category") public class CategoryAdminController { @Autowired private CategoryService categoryService; @RequestMapping(method = RequestMethod.GET) public String index(ModelMap modelMap) { modelMap.put("categories", categoryService.findParentCategories()); return "admin.category.index"; } @RequestMapping(value="add",method = RequestMethod.GET) public String add(ModelMap modelMap) { Category category=new Category(); category.setStatus(true); modelMap.put("category", category); return "admin.category.add"; } @RequestMapping(value="add",method = RequestMethod.POST) public String add(@ModelAttribute("category") Category category) { category.setCategory(null); categoryService.save(category); return "redirect:/admin/category"; } @RequestMapping(value="delete/{id}",method = RequestMethod.GET) public String delete(@PathVariable("id") int id,RedirectAttributes redirectAttributes) { try { categoryService.delete(id); } catch (Exception e) { redirectAttributes.addFlashAttribute("error", "Deleted Failed"); } return "redirect:/admin/category"; } @RequestMapping(value="edit/{id}",method = RequestMethod.GET) public String edit(@PathVariable("id") int id,ModelMap modelMap) { modelMap.put("category", categoryService.findById(id)); return "admin.category.edit"; } @RequestMapping(value="edit",method = RequestMethod.POST) public String edit(@ModelAttribute("category") Category category) { categoryService.save(category); return "redirect:/admin/category"; } @RequestMapping(value="subcategories/{id}",method = RequestMethod.GET) public String subcategories(@PathVariable("id") int id,ModelMap modelMap) { modelMap.put("category", categoryService.findById(id)); return "admin.category.subcategories"; } @RequestMapping(value="addsubcategory/{id}",method = RequestMethod.GET) public String addsubcategory(@PathVariable("id") int id,ModelMap modelMap) { Category category=new Category(); category.setCategory(categoryService.findById(id)); modelMap.put("category", category); return "admin.category.addsubcategory"; } @RequestMapping(value="addsubcategory",method = RequestMethod.POST) public String addsubcategory(@ModelAttribute("category") Category category) { categoryService.save(category); return "redirect:/admin/category/subcategories/"+category.getCategory().getId(); } @RequestMapping(value="deletesubcategory/{id}",method = RequestMethod.GET) public String deletesubcategory(@PathVariable("id") int id,RedirectAttributes redirectAttributes) { Category category=categoryService.findById(id); try { categoryService.delete(id); } catch (Exception e) { redirectAttributes.addFlashAttribute("error", "Deleted Failed"); } return "redirect:/admin/category/subcategories/"+category.getCategory().getId(); } @RequestMapping(value="editsubcategory/{id}",method = RequestMethod.GET) public String editsubcategory(@PathVariable("id") int id,ModelMap modelMap) { modelMap.put("category",categoryService.findById(id)); return "admin.category.editsubcategory"; } @RequestMapping(value="editsubcategory",method = RequestMethod.POST) public String editsubcategory(@ModelAttribute("category") Category category) { categoryService.save(category); return "redirect:/admin/category/subcategories/"+category.getCategory().getId(); } }
[ "Admin@Admin" ]
Admin@Admin
9859ef4ac97ae64afa7826b26efc3e228deba630
43f690ce0dff61c62aee85a32cb47e6bd43f5fc9
/src/main/java/org/sdrc/cpis/domains/Designation.java
9fda2a99dbbfd19a9a08d9dd82c9dc453fcd8cc0
[]
no_license
SDRC-India/CPIS_hindi
55459d8303ce6bb2016488b4589a5da05de15403
285cc8b1980b0b2cbd54088649a80896d727e68e
refs/heads/master
2020-03-26T16:52:00.270838
2018-08-17T14:17:23
2018-08-17T14:17:23
145,128,749
0
0
null
null
null
null
UTF-8
Java
false
false
2,212
java
package org.sdrc.cpis.domains; import java.io.Serializable; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="Designation") public class Designation implements Serializable { /** * */ private static final long serialVersionUID = -9174490689247535376L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="Id") private Integer designationId; @Column(name="Name") private String designationName; @ManyToOne @JoinColumn(name="area_level") private AreaLevel areaLevel; @OneToMany(mappedBy="designation",fetch=FetchType.EAGER) private List<DesignationFeaturePermissionMapping> designationFeaturePermissionMappings; @OneToMany(mappedBy="designation") private List<GridMenuDesignationMapping> gridMenuRoleMappings; public Integer getDesignationId() { return designationId; } public void setDesignationId(Integer designationId) { this.designationId = designationId; } public String getDesignationName() { return designationName; } public void setDesignationName(String designationName) { this.designationName = designationName; } public AreaLevel getAreaLevel() { return areaLevel; } public void setAreaLevel(AreaLevel areaLevel) { this.areaLevel = areaLevel; } public List<DesignationFeaturePermissionMapping> getDesignationFeaturePermissionMappings() { return designationFeaturePermissionMappings; } public void setDesignationFeaturePermissionMappings( List<DesignationFeaturePermissionMapping> designationFeaturePermissionMappings) { this.designationFeaturePermissionMappings = designationFeaturePermissionMappings; } public List<GridMenuDesignationMapping> getGridMenuRoleMappings() { return gridMenuRoleMappings; } public void setGridMenuRoleMappings(List<GridMenuDesignationMapping> gridMenuRoleMappings) { this.gridMenuRoleMappings = gridMenuRoleMappings; } }
ea7cfda364beb2a8e471fb51856de0cffc5abf27
725c00ed9b7608f2e93b14e0da298b1e64ee5601
/app/src/main/java/com/sulong/elecouple/utils/BuildProperties.java
1991059c11dc804f2d0add7f3af7c4ebc2d19e97
[]
no_license
2ndtonone/elecouple
a1d20c325d69729820c9f484c58cb8d0f1cd7b8c
aa74fd4601d58e43efb18b11bc6645ee7207677c
refs/heads/master
2021-01-19T14:18:32.001462
2017-04-20T07:24:31
2017-04-20T07:24:31
88,144,643
1
0
null
null
null
null
UTF-8
Java
false
false
1,652
java
package com.sulong.elecouple.utils; import android.os.Environment; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Collection; import java.util.Enumeration; import java.util.Map; import java.util.Properties; import java.util.Set; /** * Created by ydh on 2015/12/2. */ public class BuildProperties { private final Properties properties; private BuildProperties() throws IOException { properties = new Properties(); properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop"))); } public static BuildProperties newInstance() throws IOException { return new BuildProperties(); } public boolean containsKey(final Object key) { return properties.containsKey(key); } public boolean containsValue(final Object value) { return properties.containsValue(value); } public Set<Map.Entry<Object, Object>> entrySet() { return properties.entrySet(); } public String getProperty(final String name) { return properties.getProperty(name); } public String getProperty(final String name, final String defaultValue) { return properties.getProperty(name, defaultValue); } public boolean isEmpty() { return properties.isEmpty(); } public Enumeration<Object> keys() { return properties.keys(); } public Set<Object> keySet() { return properties.keySet(); } public int size() { return properties.size(); } public Collection<Object> values() { return properties.values(); } }
3b615b19794100c9d1d7be7bc11778e8cabd3b73
f8596dc19ae8a9e16976b2a4917374a151c6a615
/src/customer/Address.java
34c2c3a4c885fcade92a4a0a6f26cc4078d83d20
[]
no_license
RivkieKlein/BankApplication
8ba96fcf12d5fabe2069d95aff284267dd1337d5
81a8f211b43899c791ca09b6ae4f629bba80ac3e
refs/heads/master
2020-04-17T06:54:39.374837
2019-01-21T01:14:41
2019-01-21T01:14:41
166,344,649
1
0
null
null
null
null
UTF-8
Java
false
false
1,159
java
//to do //missing data exception when? //perfect copy constructor package customer; public class Address { private String street; private String city; private USState state; private String zipCode; //constructor public Address(String street, String city, String state, String zip) { this.street=street; this.city=city; int position=state.indexOf(" "); if(position>=0) { state=state.substring(0, position)+state.substring(position+1); } this.state=USState.valueOf(state.toUpperCase()); zipCode=zip; } //copy constructor public Address(Address add) { this(add.getStreet(), add.getCity(), add.getState().toString(), add.getZip()); } //street getter public String getStreet() { return street; }//end getStreet //city getter public String getCity() { return city; }//end getCity //state getter public USState getState() { return state; }//end getState //zip getter public String getZip() { return zipCode; }//end getZip @Override public String toString() { StringBuilder output= new StringBuilder("Address: "); output.append("\n "+ street+ " St."); output.append("\n"+ city+", "+state.getSymbol()+" "+zipCode); return output.toString(); } }
8b840f5ae2a2821b70407d4f67d840c6bb3d7d69
78c5e93e9ece506b2c2f23bd32f00387d43657a5
/src/test/java/Test.java
cbb3685a37eedf69514e669d452d5c4b8cc4b81d
[]
no_license
vivekdhakre/Project-MCA
42d1527d9d5e4d5ad833b63c6f2a914d2bf410d8
8941bcc1d36603cf50967e589afac24d0bf87208
refs/heads/master
2021-01-19T11:22:07.702476
2017-05-19T11:47:53
2017-05-19T11:47:53
87,959,712
0
0
null
null
null
null
UTF-8
Java
false
false
1,265
java
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * Created by vivek on 13/5/17. */ public class Test { public static void main(String[] args) { String fDate = "05/13/2017"; String tDate = "05/18/2017"; try { DateFormat format = new SimpleDateFormat("MM/dd/yyyy"); DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date fd1 = format.parse(fDate); Date td1 = format.parse(tDate); Date nextD = null; int i = 0; do { Calendar c = Calendar.getInstance(); c.setTime(fd1); c.add(Calendar.DATE, i++); nextD = c.getTime(); System.out.println(format2.parse(format2.format(format2.parse(format1.format(nextD) + " 00:00:00")))); System.out.println(new java.sql.Timestamp(format2.parse(format2.format(format2.parse(format1.format(nextD) + " 23:00:00"))).getTime())); System.out.println(nextD); } while (!td1.equals(nextD)); } catch (Exception e) { } } }
8045040f7e4a9a8928ce0e9f472e74a28f930ee3
b0a01ba0fbb84cda9757df5e27ee32feae1d09c7
/app/src/main/java/com/hpr/hus/udacity_baking_app/json/RecipeList.java
9fe473e25fbe16bc739959986cfa7dbc45961686
[]
no_license
huse/Udacity_Baking_App
9a5c2f28e46dee00d2ec308b0a8abe4a44d829f3
d3f2ea00b105b1b8c324aa31d9d9fd9a83087181
refs/heads/master
2021-09-05T11:09:23.532066
2018-01-26T20:11:06
2018-01-26T20:11:06
112,662,240
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package com.hpr.hus.udacity_baking_app.json; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.hpr.hus.udacity_baking_app.json2.ParsingRecipe; import java.util.ArrayList; /** * Created by hk640d on 12/30/2017. */ public class RecipeList { @SerializedName("recipe") @Expose private ArrayList<ParsingRecipe> parsingRecipe = new ArrayList<>(); public void setRecipes(ArrayList<ParsingRecipe> parsingRecipe) { this.parsingRecipe = parsingRecipe; } public ArrayList<ParsingRecipe> getContacts() { return parsingRecipe; } }
26e14800e5d21fe5eb2e106da1d368ea9cd36f70
caab317988ac43fb81ed294ea815a9163e0a7898
/advance/class29_heap/classroom/MagicianAndChoclates.java
fd201757c4e23d88e2addf08d4457bad6be7fabb
[]
no_license
nishchay121/scaler_academy-1
ed5b7cdc14b974394bed2e031e2ca72cb1b58337
8a1e92f5561867779dedab1dc7be7edfb5922b7a
refs/heads/main
2023-08-07T02:35:27.820610
2021-10-12T18:44:04
2021-10-12T18:44:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
979
java
package advance.class29_heap.classroom; import java.util.Collections; import java.util.PriorityQueue; public class MagicianAndChoclates { public int nchoc(int A, int[] B) { int MOD = 1000000007; long ans = 0; PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder()); for(int x: B){ pq.add(x); } for(int i=0; i<A; i++){ if(pq.isEmpty() || pq.peek() == 0){ break; } int c = pq.poll(); ans = (ans %MOD + c%MOD)%MOD; pq.add(c/2); } return (int)ans; } public static void main(String[] args) { System.out.println(new MagicianAndChoclates().nchoc(3, new int[] {6, 5})); System.out.println(new MagicianAndChoclates().nchoc(5, new int[] {2, 4, 6, 8, 10})); System.out.println(new MagicianAndChoclates().nchoc(10, new int[] {2147483647, 2000000014, 2147483647 })); } }
cdf78ffcf4c8544fc81176a89ce5bbb2937ecc54
b77bf23ba60db5794445b8204317ed8b7388a2fd
/net/minecraft/nbt/NBTBase.java
21acc166bb739e14330f412e4dab52fd7aa2b21f
[]
no_license
SulfurClient/Sulfur
f41abb5335ae9617a629ced0cde4703ef7cc5f2c
e54efe14bb52d09752f9a38d7282f0d1cd81e469
refs/heads/main
2022-07-29T03:18:53.078298
2022-02-02T15:09:34
2022-02-02T15:09:34
426,418,356
2
0
null
null
null
null
UTF-8
Java
false
false
2,752
java
package net.minecraft.nbt; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; public abstract class NBTBase { public static final String[] NBT_TYPES = new String[]{"END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"}; // private static final String __OBFID = "CL_00001229"; /** * Write the actual data contents of the tag, implemented in NBT extension classes */ abstract void write(DataOutput var1) throws IOException; abstract void read(DataInput var1, int var2, NBTSizeTracker var3) throws IOException; public abstract String toString(); /** * Gets the type byte for the tag. */ public abstract byte getId(); /** * Creates a new NBTBase object that corresponds with the passed in id. */ protected static NBTBase createNewByType(byte id) { switch (id) { case 0: return new NBTTagEnd(); case 1: return new NBTTagByte(); case 2: return new NBTTagShort(); case 3: return new NBTTagInt(); case 4: return new NBTTagLong(); case 5: return new NBTTagFloat(); case 6: return new NBTTagDouble(); case 7: return new NBTTagByteArray(); case 8: return new NBTTagString(); case 9: return new NBTTagList(); case 10: return new NBTTagCompound(); case 11: return new NBTTagIntArray(); default: return null; } } /** * Creates a clone of the tag. */ public abstract NBTBase copy(); /** * Return whether this compound has no tags. */ public boolean hasNoTags() { return false; } public boolean equals(Object p_equals_1_) { if (!(p_equals_1_ instanceof NBTBase)) { return false; } else { NBTBase var2 = (NBTBase) p_equals_1_; return this.getId() == var2.getId(); } } public int hashCode() { return this.getId(); } protected String getString() { return this.toString(); } public abstract static class NBTPrimitive extends NBTBase { // private static final String __OBFID = "CL_00001230"; public abstract long getLong(); public abstract int getInt(); public abstract short getShort(); public abstract byte getByte(); public abstract double getDouble(); public abstract float getFloat(); } }
2349fbd3ad11a2db76be3d013a034b069a9b2394
35cf0ca60e3ec2087ceaaaf03fea772bffc282d7
/bootique/src/test/java/io/bootique/Bootique_ConfigurationIT.java
c76f99c868b1fb3e2847d0911a50f11393819895
[ "Apache-2.0" ]
permissive
yangsongbai/bootique
7c84237f6a832b8dedd446dc84de7bc0eae0aeaa
63961b8cce9cc9bd0fc75004398b91a6770d6cbd
refs/heads/master
2021-01-20T06:05:06.800683
2017-04-29T16:26:50
2017-04-29T18:31:51
89,840,174
1
0
null
2017-04-30T08:51:51
2017-04-30T08:51:50
null
UTF-8
Java
false
false
6,601
java
package io.bootique; import io.bootique.config.ConfigurationFactory; import io.bootique.type.TypeRef; import io.bootique.unit.BQInternalTestFactory; import org.junit.Rule; import org.junit.Test; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; public class Bootique_ConfigurationIT { @Rule public BQInternalTestFactory runtimeFactory = new BQInternalTestFactory(); @Test public void testEmptyConfig() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/empty.yml").createRuntime(); Map<String, String> config = runtime.getInstance(ConfigurationFactory.class) .config(new TypeRef<Map<String, String>>() { }, ""); assertEquals("{}", config.toString()); } @Test public void testConfigEmptyConfig() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test1.yml", "--config=src/test/resources/io/bootique/empty.yml").createRuntime(); Map<String, String> config = runtime.getInstance(ConfigurationFactory.class) .config(new TypeRef<Map<String, String>>() { }, ""); assertEquals("{a=b}", config.toString()); } @Test public void testConfigConfig() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test1.yml", "--config=src/test/resources/io/bootique/test2.yml").createRuntime(); Map<String, String> config = runtime.getInstance(ConfigurationFactory.class) .config(new TypeRef<Map<String, String>>() { }, ""); assertEquals("{a=e, c=d}", config.toString()); } @Test public void testConfigConfig_Reverse() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test2.yml", "--config=src/test/resources/io/bootique/test1.yml").createRuntime(); Map<String, String> config = runtime.getInstance(ConfigurationFactory.class) .config(new TypeRef<Map<String, String>>() { }, ""); assertEquals("{a=b, c=d}", config.toString()); } @Test public void testConfigEnvOverrides() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test2.yml").var("BQ_A", "F") .createRuntime(); Map<String, String> config = runtime.getInstance(ConfigurationFactory.class) .config(new TypeRef<Map<String, String>>() { }, ""); assertEquals("{a=F, c=d}", config.toString()); } @Test public void testConfigEnvOverrides_Nested() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test3.yml") .var("BQ_A", "F") .var("BQ_C_M_F", "F1") .var("BQ_C_M_K", "3") .createRuntime(); Bean1 b1 = runtime.getInstance(ConfigurationFactory.class).config(Bean1.class, ""); assertEquals("F", b1.a); assertEquals(3, b1.c.m.k); assertEquals("n", b1.c.m.l); assertEquals("F1", b1.c.m.f); } @Test public void testConfigEnvVars_NoYaml() { BQRuntime runtime = runtimeFactory.app() .var("BQ_A", "F") .var("BQ_C_M_F", "F1") .var("BQ_C_M_K", "3") .createRuntime(); Bean1 b1 = runtime.getInstance(ConfigurationFactory.class).config(Bean1.class, ""); assertEquals("F", b1.a); assertEquals(3, b1.c.m.k); assertNull(b1.c.m.l); assertEquals("F1", b1.c.m.f); } @Test public void testConfigEnvVars_NoYaml_Prefix() { BQRuntime runtime = runtimeFactory.app() .var("BQ_P_A", "F") .var("BQ_P_C_M_F", "F1") .var("BQ_P_C_M_K", "3") .createRuntime(); Bean1 b1 = runtime.getInstance(ConfigurationFactory.class).config(Bean1.class, "p"); assertEquals("F", b1.a); assertEquals(3, b1.c.m.k); assertNull(b1.c.m.l); assertEquals("F1", b1.c.m.f); } @Test public void testConfigEnvVars_Map() { BQRuntime runtime = runtimeFactory.app() .var("BQ_M_X", "XXX") .createRuntime(); Bean4 b4 = runtime.getInstance(ConfigurationFactory.class).config(Bean4.class, ""); // this assertion highlights a limitation of the shell var CI approach - we end up stuck with an uppercase // key that may not be what the end users expect assertEquals("XXX", b4.m.get("X")); } @Test public void testConfigEnvVars_MapOverride() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test4.yml") .var("BQ_M_X", "XXX") .createRuntime(); Bean4 b4 = runtime.getInstance(ConfigurationFactory.class).config(Bean4.class, ""); assertEquals("XXX", b4.m.get("x")); assertEquals("b", b4.m.get("y")); } @Test public void testConfigEnvOverrides_Alias() { BQRuntime runtime = runtimeFactory.app("--config=src/test/resources/io/bootique/test3.yml") .varAlias("a", "V1") .varAlias("c.m.f", "V2") .varAlias("c.m.k", "V3") .var("V1", "K") .var("V2", "K1") .var("V3", "4") .createRuntime(); Bean1 b1 = runtime.getInstance(ConfigurationFactory.class).config(Bean1.class, ""); assertEquals("K", b1.a); assertEquals(4, b1.c.m.k); assertEquals("n", b1.c.m.l); assertEquals("K1", b1.c.m.f); } static class Bean1 { private String a; private Bean2 c; public void setA(String a) { this.a = a; } public void setC(Bean2 c) { this.c = c; } } static class Bean2 { private Bean3 m; public void setM(Bean3 m) { this.m = m; } } static class Bean3 { private int k; private String f; private String l; public void setK(int k) { this.k = k; } public void setF(String f) { this.f = f; } public void setL(String l) { this.l = l; } } static class Bean4 { private Map<String, String> m; public void setM(Map<String, String> m) { this.m = m; } } }
c8bce9c462091d4a59a4db54d10aca0a6f5f2d27
355d7c97100c335f3424b7bd3c0b19c44f590916
/app/src/main/java/com/ezz/bakeappudacity/base/datamanager/interfaces/OnRequestCompletedListener.java
36805fb1237d495ca052abbbdc52882e1a581da5
[]
no_license
ezzwalid/NanoDegreeBakeApp
bd600a20c267bbd009267e1811f1b67556b3caa5
4aabe36dd4a224ca1ddc56c2fdf1479896285f30
refs/heads/master
2021-05-07T18:58:04.806930
2017-11-01T10:23:48
2017-11-01T10:23:48
108,876,869
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package com.ezz.bakeappudacity.base.datamanager.interfaces; /** * Created by EzzWalid on 9/21/2017. */ public interface OnRequestCompletedListener { public void onSuccess(Object response); public void onFail(Exception ex); }//end OnRequestCompletedListener
8488d42f1dc2f0fc93fc2b05a5f22b88833757d4
ec1ba29dba8f6bc0cab4dda9867f46ded52479b6
/user/branches/branches1.3.0/basics-user/basics-user-business/src/main/java/com/egeo/basics/user/business/write/impl/CompanyWriteManageImpl.java
289417fbb417e205858e9530b231681bc7ab9ee2
[]
no_license
breakining/egeo
7e92e32c608b16c7a5a90e3cf2a6054bdc764d6e
c5c6333df6e40de9b9538026278d1a37e834392b
refs/heads/master
2023-08-11T18:29:12.900729
2019-09-01T15:10:17
2019-09-01T15:15:35
205,694,154
1
0
null
2023-07-22T15:03:22
2019-09-01T15:15:37
Java
UTF-8
Java
false
false
812
java
package com.egeo.basics.user.business.write.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.egeo.basics.user.business.write.CompanyWriteManage; import com.egeo.basics.user.dao.write.CompanyWriteDAO; import com.egeo.basics.user.po.CompanyPO; @Service public class CompanyWriteManageImpl implements CompanyWriteManage { Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private CompanyWriteDAO companyWriteDAO; @Override public Long saveWithTx(CompanyPO po) { companyWriteDAO.insert(po); return po.getId(); } @Override public Integer deleteById(CompanyPO po) { // TODO Auto-generated method stub return companyWriteDAO.delete(po); } }
2242af6e09c0bd15b28664fe7875e27e1fd9b4cd
d1fa006cc1431ab5bdc8841c23f5251cc6e11fb6
/src/main/java/com/martin/ppmtool/exceptions/UsernameAlreadyExistsResponse.java
88ae4276c76589a03c58f3c122a3dd627b6586ad
[]
no_license
martinmiralles/newproject
16328b1c5fa5546f94b617438a442ed1d1c9c47a
19434cbc738c83cd32b1eb54a3b8e24d26bcb6d5
refs/heads/master
2020-12-09T01:48:14.729886
2020-01-12T23:47:30
2020-01-12T23:47:30
233,156,568
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.martin.ppmtool.exceptions; public class UsernameAlreadyExistsResponse { private String username; public UsernameAlreadyExistsResponse(String username) { this.username = username; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } }
f14c3278272e18d87d6dda2a1fd2ca5c9864031f
b8c93d8e7e9c2c30a4c39d8d03bf6bd0b68dfabe
/app/src/main/java/com/micromap/model/Dijkstra.java
1866c69ae6df4ff70b179c12ec20a79fac914fbc
[]
no_license
parru/MicroMap-master
e96c783b0a14c10f6e1a24ddf3b4fe272c32b5bb
dd34e10e163eb01f2dfeae9b7ccc86ffa4378e7a
refs/heads/master
2021-01-13T01:07:24.575196
2015-04-06T07:20:53
2015-04-06T07:20:53
29,899,599
0
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
package com.micromap.model; //接受一个有向图的权重矩阵,和一个起点编号start(从0编号,顶点存在数组中) public class Dijkstra { private String path[]; // 存放从start到其他各点的最短路径的字符串表示 private int shortPath[]; // 存放从start到其他各点的最短路径 public void getShortestDistance(int[][] map,int start){ int n = map.length; // 顶点个数 shortPath = new int[n]; path = new String[n]; for (int i = 0; i < n; i++) { path[i] = new String(start + "_" + i); } int[] visited = new int[n]; // 标记当前该顶点的最短路径是否已经求出,1表示已求出 for(int i=0;i<n;i++){ visited[i]=0; } //初始化,第一个顶点求出 shortPath[start] = 0; visited[start] = 1; for (int count = 1; count <= n - 1; count++) { // 要加入n-1个顶点 int k = -1; // 选出一个距离初始顶点start最近的未标记顶点 int dmin = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { if (visited[i] == 0 && map[start][i] < dmin) { dmin = map[start][i]; k = i; } } // 将新选出的顶点标记为已求出最短路径,且到start的最短路径就是dmin shortPath[k] = dmin; visited[k] = 1; // 以k为中间点,修正从start到未访问各点的距离 for (int i = 0; i < n; i++) { if (visited[i]==0&&map[start][k]+map[k][i]<map[start][i]) { map[start][i] = map[start][k] + map[k][i]; path[i] = path[k] + "_" + Integer.toString(i); } } } } public String[] getPath() { return path; } public void setPath(String[] path) { this.path = path; } public int[] getShortPath() { return shortPath; } public void setShortPath(int[] shortPath) { this.shortPath = shortPath; } }
ce9ee70a60616efc165500f53b6b326a71527073
6f244e28fca09dc66654c16c64d80eabca3f6e49
/jxjkapp_src/src/main/java/com/jinxin/hospHealth/service/DoctorUserInfoService.java
6b81cd95ec80ab7f28bf09c9793e0cccbfd86df7
[]
no_license
guofengma/jxjkapp
86da244a4902b88d45d6e4cd79660cf5a6368162
83b32ecceda8f5ec2424efe33b1003519c6f51c6
refs/heads/master
2020-04-22T19:07:41.151445
2018-04-28T03:31:40
2018-04-28T03:31:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,316
java
package com.jinxin.hospHealth.service; import com.doraemon.base.controller.bean.PageBean; import com.doraemon.base.guava.DPreconditions; import com.doraemon.base.language.Language; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.github.pagehelper.util.StringUtil; import com.jinxin.hospHealth.controller.protocol.PO.DoctorUserInfoPO; import com.jinxin.hospHealth.dao.mapper.HospDoctorUserInfoMapper; import com.jinxin.hospHealth.dao.models.HospDoctorUserInfo; import com.jinxin.hospHealth.dao.modelsEnum.EnableEnum; import com.jinxin.hospHealth.dao.modelsEnum.SexEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.Date; /** * Created by zbs on 2018/1/12. */ @Service public class DoctorUserInfoService implements BaseService<HospDoctorUserInfo,DoctorUserInfoPO>{ @Autowired HospDoctorUserInfoMapper hospDoctorUserInfoMapper; @Value("${default.userHeadPortrait}") String defaultUserHeadPortrait; @Autowired HospAreaService hospAreaService; @Override public HospDoctorUserInfo add(DoctorUserInfoPO po) throws Exception { DPreconditions.checkState( po.getId() == null, Language.get("doctor-user.id-exist"), true); DPreconditions.checkNotNullAndEmpty( po.getPhone(), Language.get("user.phone-null"), true); DPreconditions.checkState(selectOneByPhone( po.getPhone()) == null, Language.get("user.phone-repeat"), true); DPreconditions.checkState( po.getPassword() != null, Language.get("user.password-null"), true); DPreconditions.checkNotNull( hospAreaService.selectOne(po.getAreaId()), "院区信息没有找到.", true); po.setHeadPortrait( po.getHeadPortrait() != null ? po.getHeadPortrait() : defaultUserHeadPortrait); po.setName( po.getName() != null ? po.getName() : po.getPhone()); po.setSex( po.getSex() != null ? po.getSex() : SexEnum.MAN.getCode()); HospDoctorUserInfo add = po.transform(new Date(),new Date()); add.setEnable(EnableEnum.ENABLE_NORMAL.getCode()); DPreconditions.checkState( hospDoctorUserInfoMapper.insertSelectiveReturnId(add) == 1, Language.get("service.save-failure"), true); return add; } /** * 根据手机号查询信息 * * @param phone * @return */ public HospDoctorUserInfo selectOneByPhone(String phone) { DPreconditions.checkNotNullAndEmpty(phone, Language.get("user.phone-null"), true); HospDoctorUserInfo select = new HospDoctorUserInfo(); select.setPhone(phone); select.setEnable(EnableEnum.ENABLE_NORMAL.getCode()); return hospDoctorUserInfoMapper.selectOne(select); } @Override public void update(DoctorUserInfoPO po) throws Exception { HospDoctorUserInfo hospDoctorUserInfo = po.transform(null,null); //如果密码不为空的话,代表修改密码,需要做修改密码前提校验,id不能为空 或者 phone不能为空. if (hospDoctorUserInfo.getPassword() != null) { DPreconditions.checkState( hospDoctorUserInfo.getId() != null || hospDoctorUserInfo.getPhone() != null); } DPreconditions.checkState( hospDoctorUserInfoMapper.updateByPrimaryKeySelective(hospDoctorUserInfo) == 1, Language.get("service.update-failure"), true); } @Override public void deleteOne(Long id) throws Exception { } /** * 把doctor user 信息置为软删除 * @param id * @throws Exception */ @Override public void setStateAsInvalid(Long id) throws Exception { DPreconditions.checkNotNull( id, Language.get("doctor-user.id-null"), true); HospDoctorUserInfo hospDoctorUserInfo = new HospDoctorUserInfo(); hospDoctorUserInfo.setId(id); hospDoctorUserInfo.setEnable(EnableEnum.ENABLE_DELETE.getCode()); DPreconditions.checkState( hospDoctorUserInfoMapper.updateByPrimaryKeySelective(hospDoctorUserInfo) == 1, Language.get("service.update-failure"), true); } @Override public HospDoctorUserInfo selectOne(Long id) throws Exception { DPreconditions.checkNotNull( id, Language.get("doctor-user.id-null"), true); HospDoctorUserInfo select = new HospDoctorUserInfo(); select.setId(id); select.setEnable(EnableEnum.ENABLE_NORMAL.getCode()); return hospDoctorUserInfoMapper.selectOne(select); } /** * 查询管理员用户信息 * @param po * @return * @throws Exception */ public HospDoctorUserInfo selectOne(DoctorUserInfoPO po) throws Exception { if (po.getPassword() != null) { DPreconditions.checkState( po.getId() != null || po.getPhone() != null); } HospDoctorUserInfo select = po.transform(null,null); select.setEnable(EnableEnum.ENABLE_NORMAL.getCode()); return hospDoctorUserInfoMapper.selectOne(select); } @Override public PageInfo<HospDoctorUserInfo> select(DoctorUserInfoPO po) throws Exception { if (po == null) return null; PageHelper.startPage(po.getPageNum(), po.getPageSize()); if (StringUtil.isNotEmpty(po.getField())) PageHelper.orderBy(po.getField()); HospDoctorUserInfo select = po.transform(null,null); select.setEnable(EnableEnum.ENABLE_NORMAL.getCode()); return new PageInfo<>(hospDoctorUserInfoMapper.select(select)); } @Override public PageInfo<HospDoctorUserInfo> selectAll(PageBean pageBean) throws Exception { if (pageBean == null) pageBean = new PageBean(); PageHelper.startPage(pageBean.getPageNum(), pageBean.getPageSize()); if (StringUtil.isNotEmpty(pageBean.getField())) PageHelper.orderBy(pageBean.getField()); HospDoctorUserInfo select = new HospDoctorUserInfo(); select.setEnable(EnableEnum.ENABLE_NORMAL.getCode()); return new PageInfo(hospDoctorUserInfoMapper.select(select)); } @Override public HospDoctorUserInfo selectOneAdmin(Long id) throws Exception { return selectOne(id); } @Override public PageInfo<HospDoctorUserInfo> selectAdmin(DoctorUserInfoPO po) throws Exception { return select(po); } @Override public PageInfo<HospDoctorUserInfo> selectAllAdmin(PageBean pageBean) throws Exception { return selectAll(pageBean); } }
100e36c52a3cdacb76d6689c69619adf7f955300
5de708ffedf30b8cadbc7c092dfc7bb02424d4b5
/src/main/java/com/webflux/rest/repository/CursoRepository.java
3ea550dcbab437d2e4b7b2d138ddfade13bb8a90
[]
no_license
Giannelahc/SpringWebFluxRest
b2310ac318e00067b537bc0ce639200c0d9016ed
509a51a071e0030721c426fb2a7501b0cec0eef8
refs/heads/master
2023-01-19T05:03:22.283189
2020-12-03T22:54:40
2020-12-03T22:54:40
317,028,403
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package com.webflux.rest.repository; import org.springframework.data.mongodb.repository.ReactiveMongoRepository; import com.webflux.rest.model.Curso; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public interface CursoRepository extends ReactiveMongoRepository<Curso, String>{ Mono<Curso> findByNombre(String name); Mono<Boolean> existsByNombre(String name); }
3644206fa007189af32fd2d7ead3b6cfa90d3099
0214aadd5265a9a280c73e7e5a0950104e9c5ecb
/mynew/news/app/news-web-home/src/main/java/com/foodoon/news/action/admin/main/CmsMemberAct.java
fde25e8dea0ecd3fa3b0bc6742672a571fea1eaf
[]
no_license
foodoon-guda/guda
d78d7375895cc7e0edfa2496d3f2df986cceaf30
df7fd7eaa50b0d610b050d588455aeb120b85aed
refs/heads/master
2016-09-05T12:25:23.620070
2014-07-28T05:14:00
2014-07-28T05:14:00
21,302,564
0
2
null
null
null
null
UTF-8
Java
false
false
6,764
java
package com.foodoon.news.action.admin.main; import static com.foodoon.common.page.SimplePage.cpn; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import com.foodoon.common.page.Pagination; import com.foodoon.common.web.CookieUtils; import com.foodoon.common.web.RequestUtils; import com.foodoon.common.web.ResponseUtils; import com.foodoon.news.entity.main.CmsGroup; import com.foodoon.news.entity.main.CmsUser; import com.foodoon.news.entity.main.CmsUserExt; import com.foodoon.news.manager.main.CmsGroupMng; import com.foodoon.news.manager.main.CmsLogMng; import com.foodoon.news.manager.main.CmsUserMng; import com.foodoon.news.web.WebErrors; @Controller public class CmsMemberAct { private static final Logger log = LoggerFactory .getLogger(CmsMemberAct.class); @RequestMapping("/member/v_list.do") public String list(String queryUsername, String queryEmail, Integer queryGroupId, Boolean queryDisabled, Integer pageNo, HttpServletRequest request, ModelMap model) { Pagination pagination = manager.getPage(queryUsername, queryEmail, null, queryGroupId, queryDisabled, false, null, cpn(pageNo), CookieUtils.getPageSize(request)); model.addAttribute("pagination", pagination); model.addAttribute("queryUsername", queryUsername); model.addAttribute("queryEmail", queryEmail); model.addAttribute("queryGroupId", queryGroupId); model.addAttribute("queryDisabled", queryDisabled); return "member/list"; } @RequestMapping("/member/v_add.do") public String add(ModelMap model) { List<CmsGroup> groupList = cmsGroupMng.getList(); model.addAttribute("groupList", groupList); return "member/add"; } @RequestMapping("/member/v_edit.do") public String edit(Integer id, Integer queryGroupId, Boolean queryDisabled, HttpServletRequest request, ModelMap model) { String queryUsername = RequestUtils.getQueryParam(request, "queryUsername"); String queryEmail = RequestUtils.getQueryParam(request, "queryEmail"); WebErrors errors = validateEdit(id, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } List<CmsGroup> groupList = cmsGroupMng.getList(); model.addAttribute("queryUsername", queryUsername); model.addAttribute("queryEmail", queryEmail); model.addAttribute("queryGroupId", queryGroupId); model.addAttribute("queryDisabled", queryDisabled); model.addAttribute("groupList", groupList); model.addAttribute("cmsMember", manager.findById(id)); return "member/edit"; } @RequestMapping("/member/o_save.do") public String save(CmsUser bean, CmsUserExt ext, String username, String email, String password, Integer groupId, HttpServletRequest request, ModelMap model) { WebErrors errors = validateSave(bean, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } String ip = RequestUtils.getIpAddr(request); bean = manager.registerMember(username, email, password, ip, groupId, ext); log.info("save CmsMember id={}", bean.getId()); cmsLogMng.operating(request, "cmsMember.log.save", "id=" + bean.getId() + ";username=" + bean.getUsername()); return "redirect:v_list.do"; } @RequestMapping("/member/o_update.do") public String update(Integer id, String email, String password, Boolean disabled, CmsUserExt ext, Integer groupId, String queryUsername, String queryEmail, Integer queryGroupId, Boolean queryDisabled, Integer pageNo, HttpServletRequest request, ModelMap model) { WebErrors errors = validateUpdate(id, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } CmsUser bean = manager.updateMember(id, email, password, disabled, ext, groupId); log.info("update CmsMember id={}.", bean.getId()); cmsLogMng.operating(request, "cmsMember.log.update", "id=" + bean.getId() + ";username=" + bean.getUsername()); return list(queryUsername, queryEmail, queryGroupId, queryDisabled, pageNo, request, model); } @RequestMapping("/member/o_delete.do") public String delete(Integer[] ids, Integer queryGroupId, Boolean queryDisabled, Integer pageNo, HttpServletRequest request, ModelMap model) { String queryUsername = RequestUtils.getQueryParam(request, "queryUsername"); String queryEmail = RequestUtils.getQueryParam(request, "queryEmail"); WebErrors errors = validateDelete(ids, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } CmsUser[] beans = manager.deleteByIds(ids); for (CmsUser bean : beans) { log.info("delete CmsMember id={}", bean.getId()); cmsLogMng.operating(request, "cmsMember.log.delete", "id=" + bean.getId() + ";username=" + bean.getUsername()); } return list(queryUsername, queryEmail, queryGroupId, queryDisabled, pageNo, request, model); } @RequestMapping(value = "/member/v_check_username.do") public void checkUsername(HttpServletRequest request,HttpServletResponse response) { String username=RequestUtils.getQueryParam(request,"username"); String pass; if (StringUtils.isBlank(username)) { pass = "false"; } else { pass = manager.usernameNotExist(username) ? "true" : "false"; } ResponseUtils.renderJson(response, pass); } private WebErrors validateSave(CmsUser bean, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); return errors; } private WebErrors validateEdit(Integer id, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); if (vldExist(id, errors)) { return errors; } return errors; } private WebErrors validateUpdate(Integer id, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); if (vldExist(id, errors)) { return errors; } // TODO 验证是否为管理员,管理员不允许修改。 return errors; } private WebErrors validateDelete(Integer[] ids, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); errors.ifEmpty(ids, "ids"); for (Integer id : ids) { vldExist(id, errors); } return errors; } private boolean vldExist(Integer id, WebErrors errors) { if (errors.ifNull(id, "id")) { return true; } CmsUser entity = manager.findById(id); if (errors.ifNotExist(entity, CmsUser.class, id)) { return true; } return false; } @Autowired private CmsGroupMng cmsGroupMng; @Autowired private CmsLogMng cmsLogMng; @Autowired private CmsUserMng manager; }
990d5bbff797e6ad2607083736f415941b70ed71
093b35fe03e5e26c423542d634dd51834f7ab8a0
/src/main/java/com/cutty_pet/cutty_pet/pet/vo/PetStorageVo.java
8d71b58198b634823da5c5bf63eff6b5b3010e11
[]
no_license
QingYang12/cutty_pet
bcb0c2d00afa9f3245634ecd2f9face9c26d7c9d
8831d7192d5e4d618030e5929fe78dc84c5dde8b
refs/heads/master
2023-07-28T09:07:15.703304
2022-10-12T11:34:16
2022-10-12T11:34:16
355,623,767
1
0
null
null
null
null
UTF-8
Java
false
false
4,059
java
package com.cutty_pet.cutty_pet.pet.vo; import java.io.Serializable; import java.util.Date; /** * 宠物库存表 * 库中现有宠物(PetStorage)实体类 * * @author makejava * @since 2021-04-03 18:35:56 */ public class PetStorageVo implements Serializable { private static final long serialVersionUID = 671496280246757781L; private String id; /** * 宠物code */ private String petCode; /** * 库存数量 */ private Integer petNumber; /** * 创建时间 */ private Date createTime; /** * 创建人编号 */ private String createUser; /** * 更新时间 */ private Date updateTime; /** * 更新人编号 */ private String updateUser; /** * 更新人编号 */ private String petStyle; /** * 更新人编号 */ private String petType; /** * 更新人编号 */ private String petDetails; /** * 更新人编号 */ private String remark; /** * 搜索页主图片jpg */ private String imgSearch; /** * 图片1jpg */ private String imgone; /** * 图片2jpg */ private String imgtwo; /** * 图片3jpg */ private String imgthree; /** * 业务类型 pet宠物信息 */ private String businessType ; /** * 宠物名称 */ private String name ; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPetCode() { return petCode; } public void setPetCode(String petCode) { this.petCode = petCode; } public Integer getPetNumber() { return petNumber; } public void setPetNumber(Integer petNumber) { this.petNumber = petNumber; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getCreateUser() { return createUser; } public void setCreateUser(String createUser) { this.createUser = createUser; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getUpdateUser() { return updateUser; } public void setUpdateUser(String updateUser) { this.updateUser = updateUser; } public String getPetStyle() { return petStyle; } public void setPetStyle(String petStyle) { this.petStyle = petStyle; } public String getPetType() { return petType; } public void setPetType(String petType) { this.petType = petType; } public String getPetDetails() { return petDetails; } public void setPetDetails(String petDetails) { this.petDetails = petDetails; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getImgSearch() { return imgSearch; } public void setImgSearch(String imgSearch) { this.imgSearch = imgSearch; } public String getImgone() { return imgone; } public void setImgone(String imgone) { this.imgone = imgone; } public String getImgtwo() { return imgtwo; } public void setImgtwo(String imgtwo) { this.imgtwo = imgtwo; } public String getImgthree() { return imgthree; } public void setImgthree(String imgthree) { this.imgthree = imgthree; } public String getBusinessType() { return businessType; } public void setBusinessType(String businessType) { this.businessType = businessType; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
b30210f36c1b354ff6c78c8286e12c8ab07b4c3a
0c30bd0250ca6d5a84a7fe86d7567ec78b0cba90
/springboot-project-2/src/main/java/com/demo/springboot/service/UserService.java
ed408927e668c71f64aa4b21e82e668238849f86
[]
no_license
snehal135/StudentsRegistrationApp
59ae5075125dc7c854050a57181249cedac9ffcb
d7d7981b758f4d737a6610122eb81950ec250d4b
refs/heads/master
2023-01-27T11:10:35.204531
2020-11-26T05:39:44
2020-11-26T05:39:44
316,133,020
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.demo.springboot.service; import org.springframework.security.core.userdetails.UserDetailsService; import com.demo.springboot.entity.User; import com.demo.springboot.web.dto.UserRegistration; public interface UserService extends UserDetailsService { User save(UserRegistration registration); }
[ "Snehal@LAPTOP-6PF7V15H" ]
Snehal@LAPTOP-6PF7V15H
1b8e67c4438cdf505f9bf114f335ff9be1952ad9
2f3c04382a66dbf222c8587edd67a5df4bc80422
/src/com/cedar/cp/ejb/api/model/amm/AmmModelEditorSessionHome.java
eea3c6f8da341ba88852655c96fbd673e701188e
[]
no_license
arnoldbendaa/cppro
d3ab6181cc51baad2b80876c65e11e92c569f0cc
f55958b85a74ad685f1360ae33c881b50d6e5814
refs/heads/master
2020-03-23T04:18:00.265742
2018-09-11T08:15:28
2018-09-11T08:15:28
141,074,966
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
// Decompiled by: Fernflower v0.8.6 // Date: 12.08.2012 13:06:19 // Copyright: 2008-2012, Stiver // Home page: http://www.neshkov.com/ac_decompiler.html package com.cedar.cp.ejb.api.model.amm; import com.cedar.cp.ejb.api.model.amm.AmmModelEditorSessionRemote; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; public interface AmmModelEditorSessionHome extends EJBHome { AmmModelEditorSessionRemote create() throws RemoteException, CreateException; }
2a520b39c710dfb321c9ceff37bc5e61ec3ed3d9
5dc596e682ff4b1ef4a351785151aac70a838746
/src/main/java/com/aoshi/domain/AsRobotConsult.java
79896846403b51ce064413da888eba86fe2605f8
[]
no_license
huangxw723/backredRain
075cedac538eaccb9da89d7f2a6b12a5dd90b1aa
3b2c18dfd3556402b5f455818c129890f2a8fa63
refs/heads/master
2021-01-20T23:51:38.192906
2017-08-30T07:57:39
2017-08-30T07:57:39
101,853,386
0
0
null
null
null
null
UTF-8
Java
false
false
3,599
java
package com.aoshi.domain; public class AsRobotConsult { private Integer robotConsultId; private Integer useType; private Integer contactSex; private String contactName; private String contactAge; private String contactPhone; private String companyName; private String companyAddress; private Integer adoptionPeriod; private String requirement; private Integer source; private String unionid; private String openid; private String wecharNickname; private String createTime; public Integer getRobotConsultId() { return robotConsultId; } public void setRobotConsultId(Integer robotConsultId) { this.robotConsultId = robotConsultId; } public Integer getUseType() { return useType; } public void setUseType(Integer useType) { this.useType = useType; } public Integer getContactSex() { return contactSex; } public void setContactSex(Integer contactSex) { this.contactSex = contactSex; } public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName == null ? null : contactName.trim(); } public String getContactAge() { return contactAge; } public void setContactAge(String contactAge) { this.contactAge = contactAge == null ? null : contactAge.trim(); } public String getContactPhone() { return contactPhone; } public void setContactPhone(String contactPhone) { this.contactPhone = contactPhone == null ? null : contactPhone.trim(); } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName == null ? null : companyName.trim(); } public String getCompanyAddress() { return companyAddress; } public void setCompanyAddress(String companyAddress) { this.companyAddress = companyAddress == null ? null : companyAddress.trim(); } public Integer getAdoptionPeriod() { return adoptionPeriod; } public void setAdoptionPeriod(Integer adoptionPeriod) { this.adoptionPeriod = adoptionPeriod; } public String getRequirement() { return requirement; } public void setRequirement(String requirement) { this.requirement = requirement == null ? null : requirement.trim(); } public Integer getSource() { return source; } public void setSource(Integer source) { this.source = source; } public String getUnionid() { return unionid; } public void setUnionid(String unionid) { this.unionid = unionid == null ? null : unionid.trim(); } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid == null ? null : openid.trim(); } public String getWecharNickname() { return wecharNickname; } public void setWecharNickname(String wecharNickname) { this.wecharNickname = wecharNickname == null ? null : wecharNickname.trim(); } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime == null ? null : createTime.trim(); } }
785aff4f1998d842cbb155b00f67de1f1266ac9c
ea110da1bad890c512c96e4bcbb11efcba9233fc
/core/src/kepler/Body.java
6624c7f5389843345190c183e7dbed993543a29c
[]
no_license
pulsar541/spaseship
ada164969b21fb44eb1475e3105d00f99f17b987
8acbbe30b4392105bf1ff0cd2b1a487919320655
refs/heads/master
2023-04-26T00:17:12.084669
2021-05-29T02:55:44
2021-05-29T02:55:44
280,152,248
0
0
null
null
null
null
UTF-8
Java
false
false
3,403
java
package kepler; import java.util.ArrayList; import java.util.List; public abstract class Body { public int uid; public int linkedWithUid = -1; public FVector FMove = new FVector(); public FVector FSh = new FVector(); private float radius = 1.0f; private float massa = Math.PI; public List<Integer> neighboursIndexes = new ArrayList<>(); public boolean isSoundReady = true; public boolean justContact = false; public boolean isTouch = false; public Vec3 getPos() { return pos; } public Vec3 pos = new Vec3(); public Vec3 getOldPos() { return oldPos; } public void setOldPos(Vec3 oldPos) { this.oldPos = oldPos; } public Vec3 getDeltaPos() { return deltaPos; } public void setDeltaPos(Vec3 deltaPos) { this.deltaPos = deltaPos; } public Vec3 oldPos = new Vec3(); public Vec3 deltaPos = new Vec3(); private boolean isKinematic; private boolean allowInertion = true; private boolean allowGravity = false; public boolean isAllowCollision() { return allowCollision; } public void setAllowCollision(boolean allowCollision) { this.allowCollision = allowCollision; } private boolean allowCollision = true; public float getRadius() { return radius; } public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } public void setRadius(float radius) { this.radius = radius; } public boolean isAllowGravity() { return allowGravity; } public void setAllowGravity(boolean allowGravity) { this.allowGravity = allowGravity; } public float getMassa() { return massa; } public void setMassa(float massa) { this.massa = massa; } public boolean isKinematic() { return isKinematic; } public void setKinematic(boolean kinematic) { isKinematic = kinematic; } public boolean isAllowInertion() { return allowInertion; } public void setAllowInertion(boolean allowInertion) { this.allowInertion = allowInertion; } public float getSpeed() { return (float) java.lang.Math.sqrt(this.deltaPos.x * this.deltaPos.x + this.deltaPos.y * this.deltaPos.y); } public boolean isTouch() { return isTouch; } public void setTouch(boolean touch) { isTouch = touch; } public void setPos(Vec3 pos) { this.pos.set(pos); this.oldPos.set(this.pos); } public void updatePos(Vec3 _pos) { oldPos.set(this.pos); this.pos.set(_pos); } public void invertDx(float paramFloat) { deltaPos.x = paramFloat * -deltaPos.x; oldPos.x = pos.x - deltaPos.x; } public void invertDy(float paramFloat) { deltaPos.y = paramFloat * -deltaPos.y; oldPos.y = pos.y - deltaPos.y; } public void Move(float paramFloat) { if(isKinematic) return; oldPos.set(pos); pos.x += paramFloat * deltaPos.x; pos.y += paramFloat * deltaPos.y; } public void setVectorAndSpeed(Vec3 vec, float speed) { Vec3 v = new Vec3(); v.set(vec.normalized()); oldPos.x -= v.x * speed; oldPos.y -= v.y * speed; } }
303f67941a7e77ffe9d8fa3fea038926d9826979
94c11d4ee5ba4dc37ba4242a069d8c1c818ec655
/lego-parent/lego-service/lego-service-user/src/main/java/com/lego/user/config/TokenDecode.java
3d08f0745e99ee3df8edffa632c7f21a4ceeaec4
[ "MIT" ]
permissive
MrShadowalker/lego
25bdc80734d0c0ec1b07e289cfde69286c7941a4
d3ad77c54dab2cbc83c474eaf29ac002ce0eb366
refs/heads/main
2023-01-10T01:31:33.699854
2020-11-02T09:17:45
2020-11-02T09:17:45
308,205,365
2
3
MIT
2020-11-13T07:53:53
2020-10-29T03:18:30
HTML
UTF-8
Java
false
false
2,217
java
package com.lego.user.config; import com.alibaba.fastjson.JSON; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.jwt.Jwt; import org.springframework.security.jwt.JwtHelper; import org.springframework.security.jwt.crypto.sign.RsaVerifier; import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; import org.springframework.stereotype.Component; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map; import java.util.stream.Collectors; /** * 描述 * * @author www.itheima.com * @version 1.0 * @package com.lego.order.config * * @since 1.0 */ @Component public class TokenDecode { private static final String PUBLIC_KEY = "public.key"; // 获取令牌 public String getToken() { OAuth2AuthenticationDetails authentication = (OAuth2AuthenticationDetails) SecurityContextHolder.getContext().getAuthentication().getDetails(); String tokenValue = authentication.getTokenValue();//ejebaldsfjalfjaljflajflajflajfla return tokenValue; } /** * 获取当前的登录的用户的用户信息 * * @return */ public Map<String, String> getUserInfo() { //1.获取令牌 String token = getToken(); //2.解析令牌 公钥 String pubKey = getPubKey(); Jwt jwt = JwtHelper.decodeAndVerify(token, new RsaVerifier(pubKey)); String claims = jwt.getClaims();//{} System.out.println(claims); //3.返回 Map<String,String> map = JSON.parseObject(claims, Map.class); return map; } private String getPubKey() { Resource resource = new ClassPathResource(PUBLIC_KEY); try { InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream()); BufferedReader br = new BufferedReader(inputStreamReader); return br.lines().collect(Collectors.joining("\n")); } catch (IOException ioe) { return null; } } }
7ab397e6b94abd77ef0e6c1a78f311c9b3bd6deb
c92c2cb9ca9c1145c154a3d8b8552378491f2b5a
/2-multithreading/src/test/java/se/tain/PerformanceTesterImplTest.java
3a2b42fd8f1aa42b7e464006a35505bfb56bbbd7
[]
no_license
mackenzy/TainTestAssignment
2486dd62ee953e00fc03a6154aa5ee33e56424d9
b5a5c4a660f37a00e140e93919542a3ddb29c4f7
refs/heads/master
2020-06-16T08:37:26.399288
2016-09-16T09:12:05
2016-11-29T20:50:33
75,121,584
0
0
null
null
null
null
UTF-8
Java
false
false
2,398
java
package se.tain; import org.junit.Test; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class PerformanceTesterImplTest { @Test(expected = IllegalArgumentException.class) public void checkIncomingParams_Ex_Task() { //given Runnable task = null; int executionCount = 1, threadPoolSize = 1; PerformanceTesterImpl target = new PerformanceTesterImpl(); //then target.checkIncomingParams(task, executionCount, threadPoolSize); } @Test(expected = IllegalArgumentException.class) public void checkIncomingParams_Ex_ExecutionCount() { //given Runnable task = ()->{}; int executionCount = 0, threadPoolSize = 1; PerformanceTesterImpl target = new PerformanceTesterImpl(); //then target.checkIncomingParams(task, executionCount, threadPoolSize); } @Test(expected = IllegalArgumentException.class) public void checkIncomingParams_Ex_ThreadPoolSize() { //given Runnable task = ()->{}; int executionCount = 1, threadPoolSize = 0; PerformanceTesterImpl target = new PerformanceTesterImpl(); //then target.checkIncomingParams(task, executionCount, threadPoolSize); } @Test public void checkIncomingParams() { //given Runnable task = ()->{}; int executionCount = 1, threadPoolSize = 1; PerformanceTesterImpl target = new PerformanceTesterImpl(); //then target.checkIncomingParams(task, executionCount, threadPoolSize); } @Test public void processResults() throws ExecutionException, InterruptedException { //given PerformanceTesterImpl target = new PerformanceTesterImpl(); Future<Long> f = mock(Future.class); List<Future<Long>> list = Arrays.asList(f, f, f, f, f, f, f, f, f); //when when(f.get()).thenReturn(2L, 1L, 4L, 0L, 3L, 5L, 6L, 10L, 1L); //then PerformanceTestResult result = target.processResults(list); assertEquals(0L, result.getMinTime()); assertEquals(10L, result.getMaxTime()); assertEquals(32L, result.getTotalTime()); } }
e5875f5d7e512c3722700ccd82a8b73c86044856
2992335726b27b74455e36fe360ba1767e619169
/src/application/UI/AjouterLocation.java
0a877b8309fc9462814d25643123ab127129dd9e
[ "MIT" ]
permissive
mauxnier/panoramix
b5b9e22d8e0e4b34315c371a1acd92125df181bc
a2795e3d5bb43fb48fb610c0ac0d9c622ea2fa8b
refs/heads/master
2023-03-29T13:16:16.301065
2021-04-03T09:17:48
2021-04-03T09:17:48
274,507,099
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,978
java
package application.UI; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import application.Client; import application.Date; import application.ListeClients; import application.ListeLocations; import application.ListePanneaux; import application.Location; import application.Panneau; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Cursor; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.TextField; import javafx.scene.effect.DropShadow; import javafx.scene.image.Image; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class AjouterLocation extends Stage implements Initializable { private final int windowWidth = 450; private final int windowHeight = 200; @FXML private ComboBox<Panneau> comboBoxP; @FXML private ComboBox<Client> comboBoxC; @FXML private Button buttonP; @FXML private Button buttonC; @FXML private TextField textDuree; @FXML private Button valider; @FXML private Button annuler; private static ObservableList<application.Panneau> panneaux = FXCollections.observableArrayList(); private static ObservableList<application.Client> clients = FXCollections.observableArrayList(); public AjouterLocation() { try { // Localisation du fichier FXML. final URL fxmlURL = getClass().getResource("ajouterLocation.fxml"); final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL); fxmlLoader.setController(this); // Chargement du FXML. final BorderPane root = (BorderPane) fxmlLoader.load(); // Création de la scène. final Scene scene = new Scene(root, windowWidth, windowHeight); this.setScene(scene); this.setResizable(false); } catch (IOException ex) { System.err.println("Erreur au chargement: " + ex); } this.setTitle("Panoramix - Ajouter une location"); this.getIcons().add(new Image(MainWindow.class.getResourceAsStream("ressources/img/logo.png"))); } @Override public void initialize(URL location, ResourceBundle resources) { refresh(); // On désative le bouton valider si les champs sont vides. /* valider.disableProperty().bind( Bindings.isEmpty(comboBoxP.getValue()).or(Bindings.isEmpty(comboBoxC.getProperties())) ); */ DropShadow shadow = new DropShadow(); // Ajout de l'ombre quand le curseur de la souris est sur le bouton et changement du curseur. valider.addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { valider.setEffect(shadow); valider.setCursor(Cursor.HAND); } }); valider.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { valider.setEffect(null); } }); // Ajout de l'ombre quand le curseur de la souris est sur le bouton et changement du curseur. annuler.addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { annuler.setEffect(shadow); annuler.setCursor(Cursor.HAND); } }); annuler.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { annuler.setEffect(null); } }); annuler.setOnAction(event -> { System.out.println("Annulation de l'ajout d'une location"); close(); }); buttonP.setOnAction(event -> { Stage window = new AjouterPanneau(); window.show(); }); buttonC.setOnAction(event -> { Stage window = new AjouterClient(); window.show(); }); valider.setOnAction(event -> { Client cli = (Client) comboBoxC.getValue(); Panneau p = (Panneau) comboBoxP.getValue(); String duree = textDuree.getText(); Date dateAujd = Date.dateAujourdhui(); Location loc = new Location(cli, p, Integer.parseInt(duree), dateAujd); ListeLocations.addLocation(loc); System.out.println("ajouté"); Stage window = new AfficherLocations(); window.show(); close(); }); } public void recharger_window() { this.close(); Stage window = new AfficherPanneaux(); window.show(); } public void refresh() { // On ajoute tous les panneaux dans l'observable list. panneaux.clear(); for (Panneau p : ListePanneaux.getListePanneaux()) { panneaux.add(p); } // On ajoute tous les clients. clients.clear(); for (Client c : ListeClients.getListeClients()) { clients.add(c); } comboBoxC.setItems(clients); comboBoxP.setItems(panneaux); } }
707d52086857fb9bc5f3b2ef37cd41ccabab8be7
04a812073108b05899af18cbda24e54614eae0b1
/de.dd.otti21.jkl.mongoloader.msc/src/de/dd/otti21/jkl/mongoloader/msc/mapreduce/AlbumPerYearAndArtist.java
b16204bda7b947a93b0fb08570a54443f6a40718
[]
no_license
Haratsu/Mongo-Loader
25ace7bd561ce5f648dcf34b81a48c0581d66c68
47c956e4ec806817d42d257ab70c6c7dd16124ec
refs/heads/master
2016-09-05T21:30:47.506458
2011-12-20T15:56:56
2011-12-20T15:56:56
3,011,794
0
0
null
null
null
null
UTF-8
Java
false
false
1,596
java
package de.dd.otti21.jkl.mongoloader.msc.mapreduce; import java.net.UnknownHostException; import com.mongodb.DBObject; import com.mongodb.MongoException; /** * AlbumPerYearAndArtist * * @author Hagen Rahn * @version $Revision$ * * $LastChangedDate$ * $LastChangedBy$ */ public class AlbumPerYearAndArtist extends SongsBasedMROperation{ private final String mapFunction = "function () {" + "var artist = this.artist;" + "artist = artist.replace(/^\\s+|\\s+$/g, \"\");" + // trims whitespaces "var mappedArtist = db.artistMappings.findOne({'matches':artist});" + "if (mappedArtist !== null) {" + " artist = mappedArtist.artist;" + "}" + "var key = this.year +'-' + artist;" + "emit(key, 1);" + "}"; // document of artistMappings should be of the following layout: // doc = { artist: "Simon & Garfunkle", matches: ["Simon&Garfunkel","Simon And Garfunkel","Simon and Garfunkel"]} // please ensure index on artistmappings.matches private final String reduceFunction = "function (key, emits) {" + " total = Array.sum(emits);" + " return total;}"; public AlbumPerYearAndArtist() throws UnknownHostException, MongoException { super(); } @Override protected String getMapFunction() { return mapFunction; } @Override protected String getReduceFunction() { return reduceFunction; } @Override protected DBObject getSearchQuery() { return null; } @Override protected String getMapReduceCollectionName() { return "mrAlbumPerYearAndArtist"; } }
48f3902cc232633a3e946bc0e449dd8529c7946d
b75171d1474951d8d2176600a2b823738c55671f
/app/src/test/java/smac/net/familynavigator/ExampleUnitTest.java
8b3967357a9c4311b52ec7bb629068e9448e4f4a
[ "Apache-2.0" ]
permissive
tonysaha/FamilyNavigator
4fafc12e96d4cd652c317739104ab288815d5ab3
092b054065c97a48a5002d9f0ba86b8bc961bbb8
refs/heads/master
2020-03-18T03:08:38.819435
2018-05-21T08:02:31
2018-05-21T08:02:31
134,224,763
0
0
Apache-2.0
2018-05-21T08:02:32
2018-05-21T05:58:50
Java
UTF-8
Java
false
false
402
java
package smac.net.familynavigator; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
d6fdc624a50151360a391b986cd3956db6260b8a
082c8c7dff29f521280c01c3fa3be58106add77a
/hw09/test.java
87238e6dd2bd4a1f69c59c408c2e969d561b155d
[]
no_license
yuangao0118/CSE2
fe7acec91ee564aa1929302f0fcd5891792f7d5b
c5f4bcc43e80dc205a88289cb7a9fda3a4112b54
refs/heads/master
2021-01-21T12:58:18.359934
2016-05-06T01:25:07
2016-05-06T01:25:07
50,674,223
0
0
null
null
null
null
UTF-8
Java
false
false
1,865
java
import java.util.Random; //import random number generator import java.util.Scanner; public class test{ public static String guesstheBox(int input){ Random randomGenerator= new Random(); int random1 = randomGenerator.nextInt(3)+1; if(input==random1){ System.out.println("You win a prize!! You get $100!"); } else{ System.out.println("Sorry, You lost..."); } String result=""; return result; } public static void main(String[] args){ System.out.println("Welcome to Yuan's Game Center"); System.out.println("Choose the game you want to play: type: guesstheBox, spinTheWheel or scrambler"); Scanner myscanner= new Scanner(System.in); System.out.println("Please choose a number from 1,2,3"); boolean validinput=false; while(!validinput){ if(myscanner.hasNextInt()){ int temp1=myscanner.nextInt();//store value if((temp1==1) || (temp1==2) || (temp1==3)){ int input=temp1; guesstheBox(input); validinput=true; } else{ System.out.println("Wrong input, enter again"); temp1=0; } } else{ System.out.println("Wrong inout"); myscanner.next(); } } } }
f5f561e527132e70c647d4e1ded926f917e2a7ce
c7a56dcd958457356d32936be3806746f5269810
/talend-component-maven-plugin/src/it/success-datastore/src/main/java/org/superbiz/MyService.java
8f3c0097d3503aa7a9019e26e8964d9d3ae532cc
[ "Apache-2.0" ]
permissive
rmannibucau/component-runtime
b623542240304999ce1acf620a45f0567d83d853
39261044bdd4217479eaf677fcd039c2d719ab47
refs/heads/master
2023-02-28T18:36:07.228500
2017-11-21T12:28:09
2017-11-21T12:28:09
108,391,830
0
0
null
2017-10-26T09:40:56
2017-10-26T09:40:56
null
UTF-8
Java
false
false
1,051
java
/** * Copyright (C) 2006-2017 Talend Inc. - www.talend.com * * 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.superbiz; import java.io.Serializable; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.api.service.healthcheck.HealthCheck; import org.talend.sdk.component.api.service.healthcheck.HealthCheckStatus; @Service public class MyService implements Serializable { @HealthCheck public HealthCheckStatus test(final MyDataStore datastore) { return null; } }
40cb240a0074f8204325122d97a2d1b05f09be93
70bcdcb4e766b488cc1c5b38e149a3c026583dcd
/src/main/java/lesson1/ex5.java
20f7308db2bd3cffd3a102e7ac56b653fae0b298
[]
no_license
lazarevspb/GeekBrains
562e8a6e09cacc6862511055407c3df489e64ff8
db33a8bfedbfc1b856cdec4bc627c2e038bdfe31
refs/heads/master
2022-11-12T18:54:02.802451
2020-06-26T21:58:45
2020-06-27T10:59:36
275,236,565
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package lesson1; /* 5. Написать метод, которому в качестве параметра передается целое число, метод должен напечатать в консолположительное ли число */ public class ex5 { public static void main(String[] args) { signCheck(0); } private static void signCheck(int i) { if (i >= 0) { System.out.println("Число положительное"); } else System.out.println("Число отрицательное"); } }
8a8295a10d8dec2f70db8ad66f933c3c5ee28f51
de2712b8c4789b5f2043588dc3c8e125b13959bb
/app/src/main/java/halo/com/moneytracker/fragments/dialogs/YearPickerDialog.java
2e67170403792e539a42f9181ddf0a205d6531c2
[]
no_license
tankorbox/MoneyTracker
9a7a47b2b5ba5e2638e235a67d0fc3d6073162bb
65c84fea355c1f7476967066fde8390dff936641
refs/heads/master
2021-08-07T04:13:36.622177
2017-11-07T13:27:31
2017-11-07T13:27:31
109,839,166
0
0
null
null
null
null
UTF-8
Java
false
false
2,676
java
package halo.com.moneytracker.fragments.dialogs; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.NumberPicker; import android.widget.TextView; import org.androidannotations.annotations.EFragment; import java.util.Calendar; import halo.com.moneytracker.R; import halo.com.moneytracker.common.Constant; import halo.com.moneytracker.database.ExchangeManager; import halo.com.moneytracker.evenbus.BusProvider; import halo.com.moneytracker.evenbus.events.OttoExchanges; /** * Created by HoVanLy on 7/28/2016. */ @EFragment public class YearPickerDialog extends DialogFragment { private Calendar mCalendar; private TextView mTextView; private ExchangeManager mExchangeManager; public YearPickerDialog() { mCalendar = Calendar.getInstance(); mExchangeManager = new ExchangeManager(); } public void setListenTextView(TextView textView) { this.mTextView = textView; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialog = inflater.inflate(R.layout.year_picker, null); final NumberPicker mYearPicker = (NumberPicker) dialog.findViewById(R.id.picker_year); // Set value mYear mYearPicker.setMinValue(Constant.MIN_YEAR); mYearPicker.setMaxValue(mCalendar.get(Calendar.YEAR) + Constant.VALUE_PLUS_YEAR); mYearPicker.setValue(mCalendar.get(Calendar.YEAR)); builder.setView(dialog) .setPositiveButton(getString(R.string.dialog_button_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { int year = mYearPicker.getValue(); mTextView.setText(String.valueOf(year)); postOtto(year); } }) .setNegativeButton(getString(R.string.dialog_button_cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dismiss(); } }); return builder.create(); } private void postOtto(int year) { BusProvider.getInstance().post(OttoExchanges.builder().year(year).exchanges(mExchangeManager.getExchangeYears(year)).build()); } }
b9794e404772134718b7101c1d725ee15b630427
0303030ff466939761337bcc4618c8d2944b33a4
/IPK_lib/src/de/muntjak/tinylookandfeel/TinyComboBoxUI.java
ebb04378f1d757299d89ccd633ef4a13a98ee8db
[]
no_license
Gregor-Mendel-Institute/IAP-Phenopipe
b8ae3f6c78220f75057e08accd91f86a862bd069
8072ad873b2de8a9cc33614b96c288b40aaf7aee
refs/heads/master
2021-09-06T02:09:48.216169
2018-02-01T14:16:16
2018-02-01T14:16:16
112,914,968
0
0
null
null
null
null
UTF-8
Java
false
false
9,091
java
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This file is part of the Tiny Look and Feel * * Copyright 2003 - 2008 Hans Bickel * * * * For licensing information and credits, please refer to the * * comment in file de.muntjak.tinylookandfeel.TinyLookAndFeel * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package de.muntjak.tinylookandfeel; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.Rectangle; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.ComboBoxEditor; import javax.swing.ComboBoxModel; import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.ListCellRenderer; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicComboBoxUI; /** * TinyComboBoxUI * * @version 1.3 * @author Hans Bickel */ public class TinyComboBoxUI extends BasicComboBoxUI { static final int COMBO_BUTTON_WIDTH = 18; // Flag for calculating the display size protected boolean isDisplaySizeDirty = true; // Cached the size that the display needs to render the largest item protected Dimension cachedDisplaySize = new Dimension(0, 0); private static final Insets DEFAULT_INSETS = new Insets(0, 0, 0, 0); public static ComponentUI createUI(JComponent c) { return new TinyComboBoxUI(); } public void paint(Graphics g, JComponent c) { } protected ComboBoxEditor createEditor() { return new TinyComboBoxEditor.UIResource(); } protected JButton createArrowButton() { JButton button = new TinyComboBoxButton(comboBox, null, comboBox.isEditable(), currentValuePane, listBox); button.setMargin(DEFAULT_INSETS); button.putClientProperty("isComboBoxButton", Boolean.TRUE); return button; } protected void installComponents() { super.installComponents(); if (arrowButton != null) { arrowButton.setFocusable(false); } } public PropertyChangeListener createPropertyChangeListener() { return new TinyPropertyChangeListener(); } /** * This inner class is marked &quot;public&quot; due to a compiler bug. * This class should be treated as a &quot;protected&quot; inner class. * Instantiate it only within subclasses of <FooUI>. */ public class TinyPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler { public void propertyChange(PropertyChangeEvent e) { super.propertyChange(e); String propertyName = e.getPropertyName(); if (propertyName.equals("editable")) { TinyComboBoxButton button = (TinyComboBoxButton) arrowButton; button.setIconOnly(comboBox.isEditable()); isMinimumSizeDirty = true; isDisplaySizeDirty = true; comboBox.revalidate(); } // else if(propertyName.equals("font")) { // isMinimumSizeDirty = true; // isDisplaySizeDirty = true; // comboBox.revalidate(); // } else if (propertyName.equals("background")) { Color color = (Color) e.getNewValue(); listBox.setBackground(color); } else if (propertyName.equals("foreground")) { Color color = (Color) e.getNewValue(); listBox.setForeground(color); } } } /** * As of Java 2 platform v1.4 this method is no longer used. Do not call or * override. All the functionality of this method is in the * MetalPropertyChangeListener. * * @deprecated As of Java 2 platform v1.4. */ protected void editablePropertyChanged(PropertyChangeEvent e) { } protected LayoutManager createLayoutManager() { return new TinyComboBoxLayoutManager(); } /** * This inner class is marked &quot;public&quot; due to a compiler bug. * This class should be treated as a &quot;protected&quot; inner class. * Instantiate it only within subclasses of <FooUI>. */ public class TinyComboBoxLayoutManager implements LayoutManager { public void addLayoutComponent(String name, Component comp) { } public void removeLayoutComponent(Component comp) { } public Dimension preferredLayoutSize(Container parent) { JComboBox cb = (JComboBox) parent; return parent.getPreferredSize(); } public Dimension minimumLayoutSize(Container parent) { JComboBox cb = (JComboBox) parent; return parent.getMinimumSize(); } public void layoutContainer(Container parent) { JComboBox cb = (JComboBox) parent; int width = cb.getWidth(); int height = cb.getHeight(); Rectangle cvb; if (comboBox.isEditable()) { if (arrowButton != null) { arrowButton.setBounds(width - COMBO_BUTTON_WIDTH, 0, COMBO_BUTTON_WIDTH, height); } if (editor != null) { cvb = rectangleForCurrentValue2(); editor.setBounds(cvb); } } else { arrowButton.setBounds(0, 0, width, height); } } } protected Rectangle rectangleForCurrentValue2() { int width = comboBox.getWidth(); int height = comboBox.getHeight(); Insets insets = getInsets(); int buttonSize = height - (insets.top + insets.bottom); if (arrowButton != null) { buttonSize = COMBO_BUTTON_WIDTH; } if (comboBox.getComponentOrientation().isLeftToRight()) { return new Rectangle(insets.left, insets.top, width - (insets.left + insets.right + buttonSize), height - (insets.top + insets.bottom)); } else { return new Rectangle( insets.left + buttonSize, insets.top, width - (insets.left + insets.right + buttonSize), height - (insets.top + insets.bottom)); } } /** * As of Java 2 platform v1.4 this method is no * longer used. * * @deprecated As of Java 2 platform v1.4. */ protected void removeListeners() { if (propertyChangeListener != null) { comboBox.removePropertyChangeListener(propertyChangeListener); } } /** * @param c * the combo box */ public Dimension getMinimumSize(JComponent c) { if (!isMinimumSizeDirty) { isDisplaySizeDirty = true; // 1.3 return new Dimension(cachedMinimumSize); } // changed in 1.3 Insets insets = Theme.comboInsets; Dimension size = getDisplaySize(); size.width += COMBO_BUTTON_WIDTH; size.width += insets.left + insets.right; size.height += insets.top + insets.bottom; cachedMinimumSize.setSize(size.width, size.height); isMinimumSizeDirty = false; return new Dimension(cachedMinimumSize); } /** * Copied from BasicComboBoxUI, because isDisplaySizeDirty was declared private!? * Returns the calculated size of the display area. The display area is the * portion of the combo box in which the selected item is displayed. This * method will use the prototype display value if it has been set. * <p> * For combo boxes with a non trivial number of items, it is recommended to use a prototype display value to significantly speed up the display size * calculation. * * @return the size of the display area calculated from the combo box items * @see javax.swing.JComboBox#setPrototypeDisplayValue */ protected Dimension getDisplaySize() { if (!isDisplaySizeDirty) { return new Dimension(cachedDisplaySize); } Dimension result = new Dimension(); ListCellRenderer renderer = comboBox.getRenderer(); if (renderer == null) { renderer = new DefaultListCellRenderer(); } Object prototypeValue = comboBox.getPrototypeDisplayValue(); if (prototypeValue != null) { // Calculates the dimension based on the prototype value result = getSizeForComponent(renderer.getListCellRendererComponent( listBox, prototypeValue, -1, false, false)); } else { // Calculate the dimension by iterating over all the elements in the combo // box list. ComboBoxModel model = comboBox.getModel(); int modelSize = model.getSize(); Dimension d; Component cpn; if (modelSize > 0) { for (int i = 0; i < modelSize; i++) { // Calculates the maximum height and width based on the largest // element d = getSizeForComponent(renderer.getListCellRendererComponent( listBox, model.getElementAt(i), -1, false, false)); result.width = Math.max(result.width, d.width); result.height = Math.max(result.height, d.height); } } else { result = getDefaultSize(); if (comboBox.isEditable()) { result.width = 100; } } } if (comboBox.isEditable()) { Dimension d = editor.getPreferredSize(); result.width = Math.max(result.width, d.width); result.height = Math.max(result.height, d.height); } // Set the cached value cachedDisplaySize.setSize(result.width, result.height); isDisplaySizeDirty = false; return result; } /* * Copied from BasicComboBoxUI. */ protected Dimension getSizeForComponent(Component comp) { currentValuePane.add(comp); comp.setFont(comboBox.getFont()); Dimension d = comp.getPreferredSize(); currentValuePane.remove(comp); return d; } }
a35e1294b271ec258a3de11d8b5bfd81a73aa839
b223377674faae3f3698425ca8f96bb6143da655
/MySpringBoot/src/main/java/springbootproject/springboot/initializer/SecondInitializer.java
62ac2b667a6ef13bdb981dbaed2158583e063617
[]
no_license
NanGangHuang/NanGangHuang.github.io
030206a76b73143edd3b2f8d3933ccb599c44f32
0513f7e8b4b6bd8d386acbe4e7b74fec96a27c2a
refs/heads/master
2021-11-23T11:54:36.800291
2021-11-07T09:22:59
2021-11-07T09:22:59
168,640,576
1
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package springbootproject.springboot.initializer; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.annotation.Order; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; import java.util.HashMap; import java.util.Map; @Order(2) public class SecondInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext configurableApplicationContext) { ConfigurableEnvironment environment = configurableApplicationContext.getEnvironment(); Map<String, Object> map = new HashMap<>(); map.put("key2", "value2"); MapPropertySource mapPropertySource = new MapPropertySource("secondInitializer", map); environment.getPropertySources().addLast(mapPropertySource); System.out.println("run secondInitializer"); } }
81044f59b06289ba34c98e281086440aba82caf2
4312a71c36d8a233de2741f51a2a9d28443cd95b
/RawExperiments/DB/Math60/AstorMain-math60/src/variant-154/org/apache/commons/math/special/Erf.java
3829375decfdf4c34d66aa2e95a84812648510b5
[]
no_license
SajjadZaidi/AutoRepair
5c7aa7a689747c143cafd267db64f1e365de4d98
e21eb9384197bae4d9b23af93df73b6e46bb749a
refs/heads/master
2021-05-07T00:07:06.345617
2017-12-02T18:48:14
2017-12-02T18:48:14
112,858,432
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package org.apache.commons.math.special; public class Erf { private Erf() { super(); } public static double erf(double x) throws org.apache.commons.math.MathException { double ret = org.apache.commons.math.special.Gamma.regularizedGammaP(0.5, (x * x), 1.0E-15, 10000); if (x < 0) { ret = -ret; } ret = java.lang.Double.MAX_VALUE; return ret; } }
474bf8edfc48131643ed49862bef19c946b46657
02f64f0e2b1e60e9caed210e57c8a11e7cbf93dd
/src/main/java/com/amihaiemil/eoyaml/RtYamlSequenceBuilder.java
33c61048b68a68458926d7baa05fba7bab7bea3c
[]
no_license
JunoMC/BOTv5
6ac240c82f7da169e3221ba93c9ab199d667ef77
5d2b3314213ff95a85cb113e14f812521ac98ea1
refs/heads/master
2022-11-21T19:30:33.500626
2020-07-30T10:20:28
2020-07-30T10:20:28
283,739,629
0
0
null
null
null
null
UTF-8
Java
false
false
2,855
java
/** * Copyright (c) 2016-2020, Mihai Emil Andronache * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ package main.java.com.amihaiemil.eoyaml; import java.util.LinkedList; import java.util.List; /** * YamlSequenceBuilder implementation. "Rt" stands for "Runtime". * This class is immutable and thread-safe. * @author Salavat.Yalalov ([email protected]) * @version $Id: 79ce93ccc05fe5f26943fae0743bcbb3760d44fd $ * @since 1.0.0 */ final class RtYamlSequenceBuilder implements YamlSequenceBuilder { /** * Added nodes. */ private final List<YamlNode> nodes; /** * Default ctor. */ RtYamlSequenceBuilder() { this(new LinkedList<>()); } /** * Constructor. * @param nodes Nodes used in building the YamlSequence */ RtYamlSequenceBuilder(final List<YamlNode> nodes) { this.nodes = nodes; } @Override public YamlSequenceBuilder add(final String value) { return this.add(new PlainStringScalar(value)); } @Override public YamlSequenceBuilder add(final YamlNode node) { final List<YamlNode> list = new LinkedList<>(); list.addAll(this.nodes); list.add(node); return new RtYamlSequenceBuilder(list); } @Override public YamlSequence build(final String comment) { return new RtYamlSequence(this.nodes, comment); } }
fc911a91d2de7fdf465708feaf285e2d4fe403c6
022c39f662a62ed7f05097673faecfd5ad2af46e
/Java/RandomCode/RemoveDups/RemoveDups.java
c9cce1a006a41b771e3cf56fe73039725e78bc3f
[]
no_license
verse215/projects
5ba3a286deb027d5a4fb177dc450a6056135b050
76b046dd152dc89fbf12f7a9a3629e0f9f63dd25
refs/heads/master
2020-04-12T06:34:26.738837
2017-03-24T13:28:22
2017-03-24T13:28:22
35,249,198
0
0
null
null
null
null
UTF-8
Java
false
false
1,392
java
/** * Write an algorithm to remove duplicate * characters from a string without an additional * buffer. You can use an extra variable or two * * By remove we simply mean to add whitespace **/ class RemoveDups { String word; RemoveDups(String word){ this.word = word; } /** * On^2 **/ void removeDups(){ char[] wordArray = word.toCharArray(); for(int start = 0; start < wordArray.length; start++){ for(int tail = start + 1; tail < wordArray.length; tail++){ if(wordArray[start] == wordArray[tail]){ wordArray[tail] = ' '; } } } word = new String(wordArray); } /** * On **/ void removeDupsFast(){ boolean[] dups = new boolean[256]; char[] wordArray = word.toCharArray(); for(int i = 0; i < wordArray.length; i++){ if(dups[wordArray[i]] == true) wordArray[i] = ' '; else{dups[wordArray[i]] = true;} } word = new String(wordArray); } public static void main(String[] args){ RemoveDups remove = new RemoveDups("helllsss"); System.out.println(remove.word); remove.removeDups(); System.out.println(remove.word); remove = new RemoveDups("helllsss"); System.out.println(remove.word); remove.removeDupsFast(); System.out.println(remove.word); } }
f704773f6595af4d1c67fd61e9ecac364a98865e
fc8014b9c4547fd90c3680d4fb0641cd5445aba1
/CySmart_Android_1.2.0.156_Source_Code/src/com/cypress/cysmart/OTAFirmwareUpdate/OTAFirmwareUpgradeFragment.java
c8c3bed9a092029dc3f8b0206c8a34d893838e5e
[]
no_license
EkoDevices/INTERNAL-Eko-Android-CySmart
3fdf902dae2f0f3b627a23242b883a0268229fc6
c31a221dc02b911ef2d238323816584e0b4537eb
refs/heads/master
2020-09-06T03:49:20.433323
2019-11-07T19:21:16
2019-11-07T19:21:16
220,311,468
0
1
null
null
null
null
UTF-8
Java
false
false
38,427
java
/* * Copyright Cypress Semiconductor Corporation, 2014-2018 All rights reserved. * * This software, associated documentation and materials ("Software") is * owned by Cypress Semiconductor Corporation ("Cypress") and is * protected by and subject to worldwide patent protection (UnitedStates and foreign), United States copyright laws and international * treaty provisions. Therefore, unless otherwise specified in a separate license agreement between you and Cypress, this Software * must be treated like any other copyrighted material. Reproduction, * modification, translation, compilation, or representation of this * Software in any other form (e.g., paper, magnetic, optical, silicon) * is prohibited without Cypress's express written permission. * * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, * NONINFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes * to the Software without notice. Cypress does not assume any liability * arising out of the application or use of Software or any product or * circuit described in the Software. Cypress does not authorize its * products for use as critical components in any products where a * malfunction or failure may reasonably be expected to result in * significant injury or death ("High Risk Product"). By including * Cypress's product in a High Risk Product, the manufacturer of such * system or application assumes all risk of such use and in doing so * indemnifies Cypress against all liability. * * Use of this Software may be limited by and subject to the applicable * Cypress software license agreement. * * */ package com.cypress.cysmart.OTAFirmwareUpdate; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattService; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.cypress.cysmart.BLEConnectionServices.BluetoothLeService; import com.cypress.cysmart.CommonUtils.Constants; import com.cypress.cysmart.CommonUtils.GattAttributes; import com.cypress.cysmart.CommonUtils.Logger; import com.cypress.cysmart.CommonUtils.TextProgressBar; import com.cypress.cysmart.CommonUtils.Utils; import com.cypress.cysmart.DataModelClasses.PairOnConnect; import com.cypress.cysmart.R; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.List; /** * OTA update fragment */ public class OTAFirmwareUpgradeFragment extends Fragment implements View.OnClickListener, OTAFUHandlerCallback { //Option Mapping public static final int APP_ONLY = 101; public static final int APP_AND_STACK_COMBINED = 201; public static final int APP_AND_STACK_SEPARATE = 301; public static final String REGEX_MATCHES_CYACD2 = "(?i).*\\.cyacd2$"; public static final String REGEX_ENDS_WITH_CYACD_OR_CYACD2 = "(?i)\\.cyacd2?$"; public static boolean mFileUpgradeStarted = false; private static OTAFUHandler DUMMY_HANDLER = (OTAFUHandler) Proxy.newProxyInstance(OTAFirmwareUpgradeFragment.class.getClassLoader(), new Class<?>[]{OTAFUHandler.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { new RuntimeException().fillInStackTrace().printStackTrace(pw); } finally { pw.close();//this will close StringWriter as well } Logger.e("DUMMY_HANDLER: " + sw);//This is for developer to track the issue return null; } }); // GATT service and characteristics private static BluetoothGattService mOtaService; private static BluetoothGattCharacteristic mOtaCharacteristic; private OTAFUHandler mOTAFUHandler = DUMMY_HANDLER;//Initializing to DUMMY_HANDLER to avoid NPEs private NotificationHandlerBase mNotificationHandler; //UI Elements private TextView mProgressText; private Button mStopUpgradeButton; private TextProgressBar mProgressTop; private TextProgressBar mProgressBottom; private TextView mFileNameTop; private TextView mFileNameBottom; private Button mAppDownload; private Button mAppStackCombinedDownload; private Button mAppStackSeparateDownload; private RelativeLayout mProgressBarLayoutTop; private RelativeLayout mProgressBarLayoutBottom; private View mView; private ProgressDialog mProgressDialog; private BroadcastReceiver mGattOTAStatusReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { synchronized (this) { processOTAStatus(intent); } } }; private void processOTAStatus(Intent intent) { /** * Shared preference to hold the state of the bootloader */ final String bootloaderState = Utils.getStringSharedPreference(getActivity(), Constants.PREF_BOOTLOADER_STATE); final String action = intent.getAction(); Bundle extras = intent.getExtras(); if (BluetoothLeService.ACTION_OTA_STATUS.equals(action)) { mOTAFUHandler.processOTAStatus(bootloaderState, extras); } else if (BluetoothLeService.ACTION_OTA_STATUS_V1.equals(action)) { mOTAFUHandler.processOTAStatus(bootloaderState, extras); } else if (action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) { final int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR); if (state == BluetoothDevice.BOND_BONDING) { // Bonding... Logger.i("Bonding is in process...."); Utils.showBondingProgressDialog(getActivity(), mProgressDialog); } else if (state == BluetoothDevice.BOND_BONDED) { String dataLog = getResources().getString(R.string.dl_commaseparator) + "[" + BluetoothLeService.getBluetoothDeviceName() + "|" + BluetoothLeService.getBluetoothDeviceAddress() + "]" + getResources().getString(R.string.dl_commaseparator) + getResources().getString(R.string.dl_connection_paired); Logger.dataLog(dataLog); Utils.hideBondingProgressDialog(mProgressDialog); } else if (state == BluetoothDevice.BOND_NONE) { String dataLog = getResources().getString(R.string.dl_commaseparator) + "[" + BluetoothLeService.getBluetoothDeviceName() + "|" + BluetoothLeService.getBluetoothDeviceAddress() + "]" + getResources().getString(R.string.dl_commaseparator) + getResources().getString(R.string.dl_connection_unpaired); Logger.dataLog(dataLog); } } } @Override public void showErrorDialogMessage(String errorMessage, final boolean stayOnPage) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(errorMessage) .setTitle(getActivity().getResources().getString(R.string.app_name)) .setCancelable(false) .setPositiveButton( getActivity().getResources().getString( R.string.alert_message_exit_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (OTAFirmwareUpgradeFragment.mOtaCharacteristic != null) { stopBroadcastDataNotify(OTAFirmwareUpgradeFragment.mOtaCharacteristic); clearDataAndPreferences(); cancelPendingNotification(); final BluetoothDevice device = BluetoothLeService.getRemoteDevice(); OTAFirmwareUpgradeFragment.mFileUpgradeStarted = false; if (!stayOnPage) { BluetoothLeService.disconnect(); BluetoothLeService.unpairDevice(device); Toast.makeText(getActivity(), getResources().getString(R.string.alert_message_bluetooth_disconnect), Toast.LENGTH_SHORT).show(); Intent intent = getActivity().getIntent(); getActivity().finish(); getActivity().overridePendingTransition(R.anim.slide_right, R.anim.push_right); startActivity(intent); getActivity().overridePendingTransition(R.anim.slide_left, R.anim.push_left); } else { mProgressText.setVisibility(View.INVISIBLE); mStopUpgradeButton.setVisibility(View.INVISIBLE); mProgressBarLayoutTop.setVisibility(View.INVISIBLE); mProgressBarLayoutBottom.setVisibility(View.INVISIBLE); mAppDownload.setEnabled(true); mAppDownload.setSelected(false); mAppStackCombinedDownload.setEnabled(true); mAppStackCombinedDownload.setSelected(false); mAppStackSeparateDownload.setEnabled(true); mAppStackSeparateDownload.setSelected(false); } } } }); AlertDialog alert = builder.create(); alert.setCanceledOnTouchOutside(false); if (!getActivity().isDestroyed()) alert.show(); } //Factory public static OTAFirmwareUpgradeFragment create(BluetoothGattService bluetoothGattService) { OTAFirmwareUpgradeFragment.mOtaService = bluetoothGattService; return new OTAFirmwareUpgradeFragment(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mView = inflater.inflate(R.layout.ota_upgrade_type_selection, container, false); initializeGUIElements(); initializeNotification(); /** * Second file Upgrade */ if (isSecondFileUpdateNeeded()) { secondFileUpgrade(); } return mView; } @Override public void onResume() { super.onResume(); BluetoothLeService.registerBroadcastReceiver(getActivity(), mGattOTAStatusReceiver, Utils.makeGattUpdateIntentFilter()); Utils.setUpActionBar(getActivity(), R.string.ota_title); if (PairOnConnect.isPairOnConnect(getActivity())) { // "Pair on connect" option is set initializeBondingIfNotBonded(); } } private void initializeBondingIfNotBonded() { final BluetoothDevice device = BluetoothLeService.mBluetoothAdapter.getRemoteDevice(BluetoothLeService.getBluetoothDeviceAddress()); if (!BluetoothLeService.getBondedState()) { BluetoothLeService.pairDevice(device); } } @Override public void onDestroy() { if (mOTAFUHandler != DUMMY_HANDLER) { mOTAFUHandler.setPrepareFileWriteEnabled(false);//This is expected case. onDestroy might be invoked before the file to upgrade is selected. } BluetoothLeService.unregisterBroadcastReceiver(getActivity(), mGattOTAStatusReceiver); if (OTAFirmwareUpgradeFragment.mOtaCharacteristic != null) { final String sharedPrefStatus = Utils.getStringSharedPreference(getActivity(), Constants.PREF_BOOTLOADER_STATE); if (!sharedPrefStatus.equalsIgnoreCase("" + BootLoaderCommands_v0.EXIT_BOOTLOADER)) { cancelPendingNotification(); clearDataAndPreferences(); } stopBroadcastDataNotify(OTAFirmwareUpgradeFragment.mOtaCharacteristic); } super.onDestroy(); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.ota_app_download: Intent ApplicationUpgrade = new Intent(getActivity(), OTAFilesListingActivity.class); ApplicationUpgrade.putExtra(Constants.REQ_FILE_COUNT, APP_ONLY); startActivityForResult(ApplicationUpgrade, APP_ONLY); break; case R.id.ota_app_stack_comb: Intent ApplicationAndStackCombined = new Intent(getActivity(), OTAFilesListingActivity.class); ApplicationAndStackCombined.putExtra(Constants.REQ_FILE_COUNT, APP_AND_STACK_COMBINED); startActivityForResult(ApplicationAndStackCombined, APP_AND_STACK_COMBINED); break; case R.id.ota_app_stack_seperate: Intent ApplicationAndStackSeparate = new Intent(getActivity(), OTAFilesListingActivity.class); ApplicationAndStackSeparate.putExtra(Constants.REQ_FILE_COUNT, APP_AND_STACK_SEPARATE); startActivityForResult(ApplicationAndStackSeparate, APP_AND_STACK_SEPARATE); break; case R.id.stop_upgrade_button: showOTAStopAlert(); break; default: break; } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { ArrayList<String> selectedFiles = data.getStringArrayListExtra(Constants.ARRAYLIST_SELECTED_FILE_NAMES); ArrayList<String> selectedFilesPaths = data.getStringArrayListExtra(Constants.ARRAYLIST_SELECTED_FILE_PATHS); byte activeApp = data.getByteExtra(Constants.EXTRA_ACTIVE_APP, Constants.ACTIVE_APP_NO_CHANGE); long securityKey = data.getLongExtra(Constants.EXTRA_SECURITY_KEY, Constants.NO_SECURITY_KEY); if (requestCode == APP_ONLY) { //Application upgrade option selected String fileOneName = selectedFiles.get(0); mFileNameTop.setText(fileOneName.replaceAll(REGEX_ENDS_WITH_CYACD_OR_CYACD2, "")); String currentFilePath = selectedFilesPaths.get(0); OTAFirmwareUpgradeFragment.mOtaCharacteristic = getGattData(); mOTAFUHandler = createOTAFUHandler(OTAFirmwareUpgradeFragment.mOtaCharacteristic, activeApp, securityKey, currentFilePath); updateGUI(APP_ONLY); } else if (requestCode == APP_AND_STACK_COMBINED) { //Application and stack upgrade combined option selected String fileOneName = selectedFiles.get(0); mFileNameTop.setText(fileOneName.replaceAll(REGEX_ENDS_WITH_CYACD_OR_CYACD2, "")); String currentFilePath = selectedFilesPaths.get(0); OTAFirmwareUpgradeFragment.mOtaCharacteristic = getGattData(); mOTAFUHandler = createOTAFUHandler(OTAFirmwareUpgradeFragment.mOtaCharacteristic, activeApp, securityKey, currentFilePath); updateGUI(APP_AND_STACK_COMBINED); } else if (requestCode == APP_AND_STACK_SEPARATE) { //Application and stack upgrade separate option selected if (selectedFiles.size() == 2) { String fileOneName = selectedFiles.get(0); mFileNameTop.setText(fileOneName.replaceAll(REGEX_ENDS_WITH_CYACD_OR_CYACD2, "")); String fileTwoName = selectedFiles.get(1); mFileNameBottom.setText(fileTwoName.replaceAll(REGEX_ENDS_WITH_CYACD_OR_CYACD2, "")); String currentFilePath = selectedFilesPaths.get(0); OTAFirmwareUpgradeFragment.mOtaCharacteristic = getGattData(); mOTAFUHandler = createOTAFUHandler(OTAFirmwareUpgradeFragment.mOtaCharacteristic, activeApp, securityKey, currentFilePath); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_ONE_NAME, fileOneName); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_NAME, fileTwoName); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_PATH, selectedFilesPaths.get(1)); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_ACTIVE_APP_ID, Integer.toHexString(activeApp)); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_SECURITY_KEY, Long.toHexString(securityKey)); Logger.e("PREF_OTA_FILE_TWO_PATH-->" + selectedFilesPaths.get(1)); } updateGUI(APP_AND_STACK_SEPARATE); } } else if (resultCode == Activity.RESULT_CANCELED) { Toast.makeText(getActivity(), getResources(). getString(R.string.toast_selection_cancelled), Toast.LENGTH_SHORT).show(); } } @Nullable private OTAFUHandler createOTAFUHandler(BluetoothGattCharacteristic otaCharacteristic, byte activeApp, long securityKey, String filepath) { boolean isCyacd2File = filepath != null && isCyacd2File(filepath); Utils.setBooleanSharedPreference(getActivity(), Constants.PREF_IS_CYACD2_FILE, isCyacd2File); OTAFUHandler handler = DUMMY_HANDLER; if (mNotificationHandler != null && mView != null && otaCharacteristic != null && filepath != null && filepath != "") { handler = isCyacd2File ? new OTAFUHandler_v1(this, mNotificationHandler, mView, otaCharacteristic, filepath, this) : new OTAFUHandler_v0(this, mNotificationHandler, mView, otaCharacteristic, activeApp, securityKey, filepath, this); } return handler; } private void updateGUI(int updateOption) { switch (updateOption) { case APP_ONLY: /** * Disabling the GUI Option select buttons. * Set the selected position as Application Upgrade */ mAppDownload.setSelected(true); mAppDownload.setPressed(true); mAppDownload.setEnabled(false); mAppStackCombinedDownload.setEnabled(false); mAppStackSeparateDownload.setEnabled(false); mProgressText.setVisibility(View.VISIBLE); mProgressText.setEnabled(false); mStopUpgradeButton.setVisibility(View.VISIBLE); mProgressBarLayoutTop.setVisibility(View.VISIBLE); mProgressBarLayoutTop.setEnabled(false); mProgressBarLayoutBottom.setEnabled(false); mProgressText.setText(getActivity().getResources().getText(R.string.ota_file_read)); mOTAFUHandler.setProgressBarPosition(1); try { prepareFileWrite(); } catch (Exception e) { showErrorDialogMessage(getResources().getString(R.string.ota_alert_invalid_file), true); } break; case APP_AND_STACK_COMBINED: /** * Disabling the GUI Option select buttons. * Set the selected position as Application&Stack Upgrade(combined file) */ mAppStackCombinedDownload.setSelected(true); mAppStackCombinedDownload.setPressed(true); mAppDownload.setEnabled(false); mAppStackCombinedDownload.setEnabled(false); mAppStackSeparateDownload.setEnabled(false); mProgressText.setVisibility(View.VISIBLE); mStopUpgradeButton.setVisibility(View.VISIBLE); mProgressBarLayoutTop.setVisibility(View.VISIBLE); mProgressBarLayoutBottom.setVisibility(View.INVISIBLE); mProgressText.setText(getActivity().getResources().getText(R.string.ota_file_read)); mOTAFUHandler.setProgressBarPosition(1); try { prepareFileWrite(); } catch (Exception e) { showErrorDialogMessage(getResources().getString(R.string.ota_alert_invalid_file), true); } break; case APP_AND_STACK_SEPARATE: /** * Disabling the GUI Option select buttons. * Set the selected position as Application&Stack Upgrade(separate file) */ mAppStackSeparateDownload.setSelected(true); mAppStackSeparateDownload.setPressed(true); mAppDownload.setEnabled(false); mAppStackCombinedDownload.setEnabled(false); mAppStackSeparateDownload.setEnabled(false); mProgressText.setVisibility(View.VISIBLE); mStopUpgradeButton.setVisibility(View.VISIBLE); mProgressBarLayoutTop.setVisibility(View.VISIBLE); mProgressBarLayoutBottom.setVisibility(View.VISIBLE); mProgressText.setText(getActivity().getResources().getText(R.string.ota_file_read)); mOTAFUHandler.setProgressBarPosition(1); try { prepareFileWrite(); } catch (Exception e) { showErrorDialogMessage(getResources().getString(R.string.ota_alert_invalid_file), true); } break; } } private void prepareFileWrite() { if (OTAFirmwareUpgradeFragment.mOtaCharacteristic != null) { mOTAFUHandler.prepareFileWrite(); } } private void initializeGUIElements() { LinearLayout parent = (LinearLayout) mView.findViewById(R.id.parent_ota_type); Utils.setUpActionBar(getActivity(), getResources().getString(R.string.ota_title)); setHasOptionsMenu(true); mAppDownload = (Button) mView.findViewById(R.id.ota_app_download); mAppStackCombinedDownload = (Button) mView.findViewById(R.id.ota_app_stack_comb); mAppStackSeparateDownload = (Button) mView.findViewById(R.id.ota_app_stack_seperate); mProgressText = (TextView) mView.findViewById(R.id.file_status); mProgressTop = (TextProgressBar) mView.findViewById(R.id.upgrade_progress_bar_top); mProgressBottom = (TextProgressBar) mView.findViewById(R.id.upgrade_progress_bar_bottom); mFileNameTop = (TextView) mView.findViewById(R.id.upgrade_progress_bar_top_filename); mFileNameBottom = (TextView) mView.findViewById(R.id.upgrade_progress_bar_bottom_filename); mStopUpgradeButton = (Button) mView.findViewById(R.id.stop_upgrade_button); mProgressDialog = new ProgressDialog(getActivity()); mProgressBarLayoutTop = (RelativeLayout) mView.findViewById(R.id.progress_bar_top_rel_lay); mProgressBarLayoutBottom = (RelativeLayout) mView.findViewById(R.id.progress_bar_bottom_rel_lay); mProgressText.setVisibility(View.INVISIBLE); mStopUpgradeButton.setVisibility(View.INVISIBLE); mProgressBarLayoutTop.setVisibility(View.INVISIBLE); mProgressBarLayoutBottom.setVisibility(View.INVISIBLE); mProgressText.setEnabled(false); mProgressText.setClickable(false); mProgressBarLayoutTop.setEnabled(false); mProgressBarLayoutTop.setClickable(false); mProgressBarLayoutBottom.setEnabled(false); mProgressBarLayoutBottom.setClickable(false); parent.setOnClickListener(this); /** *Application Download */ mAppDownload.setOnClickListener(this); /** *Application and Stack Combined Option */ mAppStackCombinedDownload.setOnClickListener(this); /** *Application and Stack Separate Option */ mAppStackSeparateDownload.setOnClickListener(this); /** *Used to stop on going OTA Update service * */ mStopUpgradeButton.setOnClickListener(this); setHasOptionsMenu(true); } private void initializeNotification() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mNotificationHandler = new OreoNotificationHandler(); } else { mNotificationHandler = new PreOreoNotificationHandler(); } mNotificationHandler.initializeNotification(getActivity()); } @Override public void generatePendingNotification(Context context) { mNotificationHandler.generatePendingNotification(context); } public void cancelPendingNotification() { mNotificationHandler.cancelPendingNotification(); } /** * Clears all Shared Preference Data & Resets UI */ public void clearDataAndPreferences() { //Resetting all preferences on Stop Button Logger.e("Data and Prefs cleared>>>>>>>>>"); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_ONE_NAME, "Default"); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_PATH, "Default"); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_NAME, "Default"); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_ACTIVE_APP_ID, "Default"); Utils.setStringSharedPreference(getActivity(), Constants.PREF_OTA_SECURITY_KEY, "Default"); Utils.setStringSharedPreference(getActivity(), Constants.PREF_BOOTLOADER_STATE, "Default"); Utils.setIntSharedPreference(getActivity(), Constants.PREF_PROGRAM_ROW_NO, 0); Utils.setIntSharedPreference(getActivity(), Constants.PREF_PROGRAM_ROW_START_POS, 0); Utils.setIntSharedPreference(getActivity(), Constants.PREF_ARRAY_ID, 0); } @Override public String saveAndReturnDeviceAddress() { String deviceAddress = BluetoothLeService.getBluetoothDeviceAddress(); Utils.setStringSharedPreference(getActivity(), Constants.PREF_DEV_ADDRESS, deviceAddress); return Utils.getStringSharedPreference(getActivity(), Constants.PREF_DEV_ADDRESS); } /** * Method to get required characteristics from service */ BluetoothGattCharacteristic getGattData() { BluetoothGattCharacteristic characteristic = null; List<BluetoothGattCharacteristic> characteristics = OTAFirmwareUpgradeFragment.mOtaService.getCharacteristics(); for (BluetoothGattCharacteristic c : characteristics) { String characteristicUUID = c.getUuid().toString(); if (characteristicUUID.equalsIgnoreCase(GattAttributes.OTA_CHARACTERISTIC)) { characteristic = c; prepareBroadcastDataNotify(c); } } return characteristic; } /** * Preparing Broadcast receiver to broadcast notify characteristics * * @param characteristic */ void prepareBroadcastDataNotify(BluetoothGattCharacteristic characteristic) { final int props = characteristic.getProperties(); if ((props | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) { BluetoothLeService.setCharacteristicNotification(characteristic, true); } } /** * Stopping Broadcast receiver to broadcast notify characteristics * * @param characteristic */ void stopBroadcastDataNotify(BluetoothGattCharacteristic characteristic) { final int props = characteristic.getProperties(); if ((props | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) { BluetoothLeService.setCharacteristicNotification(characteristic, false); } } private void showOTAStopAlert() { AlertDialog alert; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(getActivity().getResources().getString(R.string.alert_message_ota_cancel)) .setTitle(getActivity().getResources().getString(R.string.app_name)) .setCancelable(false) .setPositiveButton( getActivity().getResources().getString(R.string.alert_message_yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (OTAFirmwareUpgradeFragment.mOtaCharacteristic != null) { stopBroadcastDataNotify(OTAFirmwareUpgradeFragment.mOtaCharacteristic); clearDataAndPreferences(); cancelPendingNotification(); final BluetoothDevice device = BluetoothLeService.getRemoteDevice(); OTAFirmwareUpgradeFragment.mFileUpgradeStarted = false; BluetoothLeService.disconnect(); BluetoothLeService.unpairDevice(device); Toast.makeText(getActivity(), getResources().getString(R.string.alert_message_bluetooth_disconnect), Toast.LENGTH_SHORT).show(); Intent intent = getActivity().getIntent(); getActivity().finish(); getActivity().overridePendingTransition(R.anim.slide_right, R.anim.push_right); startActivity(intent); getActivity().overridePendingTransition(R.anim.slide_left, R.anim.push_left); } } }) .setNegativeButton(getActivity().getResources().getString(R.string.alert_message_no), null); alert = builder.create(); alert.setCanceledOnTouchOutside(true); if (!getActivity().isDestroyed()) { alert.show(); } } @Override public boolean isSecondFileUpdateNeeded() { String secondFilePath = Utils.getStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_PATH); Logger.e("secondFilePath-->" + secondFilePath); return BluetoothLeService.getBluetoothDeviceAddress().equalsIgnoreCase(saveAndReturnDeviceAddress()) && (!secondFilePath.equalsIgnoreCase("Default") && (!secondFilePath.equalsIgnoreCase(""))); } /** * Method to write the second file */ private void secondFileUpgrade() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage( getActivity().getResources().getString(R.string.alert_message_ota_resume)) .setTitle(getActivity().getResources().getString(R.string.app_name)) .setCancelable(false) .setPositiveButton( getActivity().getResources().getString(R.string.alert_message_yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Utils.setStringSharedPreference(getActivity(), Constants.PREF_BOOTLOADER_STATE, null); Utils.setIntSharedPreference(getActivity(), Constants.PREF_PROGRAM_ROW_NO, 0); Utils.setIntSharedPreference(getActivity(), Constants.PREF_PROGRAM_ROW_START_POS, 0); generatePendingNotification(getActivity()); OTAFirmwareUpgradeFragment.mOtaCharacteristic = getGattData(); //Updating the file name with progress text if (mProgressTop.getVisibility() != View.VISIBLE) { mProgressTop.setVisibility(View.VISIBLE); } String fileOneName = Utils.getStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_ONE_NAME); mFileNameTop.setText(fileOneName.replaceAll(REGEX_ENDS_WITH_CYACD_OR_CYACD2, "")); if (mProgressBottom.getVisibility() != View.VISIBLE) { mProgressBottom.setVisibility(View.VISIBLE); } String fileTwoName = Utils.getStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_NAME); mFileNameBottom.setText(fileTwoName.replaceAll(REGEX_ENDS_WITH_CYACD_OR_CYACD2, "")); mAppStackSeparateDownload.setSelected(true); mAppStackSeparateDownload.setPressed(true); mAppDownload.setEnabled(false); mAppStackCombinedDownload.setEnabled(false); mAppStackSeparateDownload.setEnabled(false); mProgressText.setVisibility(View.VISIBLE); mStopUpgradeButton.setVisibility(View.VISIBLE); mProgressBarLayoutTop.setVisibility(View.VISIBLE); mProgressBarLayoutBottom.setVisibility(View.VISIBLE); mProgressText.setText(getActivity().getResources().getText(R.string.ota_file_read)); String currentFilePath = Utils.getStringSharedPreference(getActivity(), Constants.PREF_OTA_FILE_TWO_PATH); byte activeApp = Constants.ACTIVE_APP_NO_CHANGE; String activeAppString = Utils.getStringSharedPreference(getActivity(), Constants.PREF_OTA_ACTIVE_APP_ID); try { activeApp = Byte.parseByte(activeAppString, 16); } catch (NumberFormatException e) { e.printStackTrace(); } long securityKey = Constants.NO_SECURITY_KEY; String securityKeyString = Utils.getStringSharedPreference(getActivity(), Constants.PREF_OTA_SECURITY_KEY); try { securityKey = Long.parseLong(securityKeyString, 16); } catch (NumberFormatException e) { e.printStackTrace(); } mOTAFUHandler = createOTAFUHandler(OTAFirmwareUpgradeFragment.mOtaCharacteristic, activeApp, securityKey, currentFilePath); mOTAFUHandler.setProgressBarPosition(2); clearDataAndPreferences(); prepareFileWrite(); } }) .setNegativeButton(getActivity().getResources().getString( R.string.alert_message_no), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { cancelPendingNotification(); clearDataAndPreferences(); } }); AlertDialog alert = builder.create(); alert.setCanceledOnTouchOutside(true); if (!getActivity().isDestroyed()) { alert.show(); } } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.global, menu); MenuItem graph = menu.findItem(R.id.graph); MenuItem log = menu.findItem(R.id.log); MenuItem search = menu.findItem(R.id.search); search.setVisible(false); graph.setVisible(false); log.setVisible(true); super.onCreateOptionsMenu(menu, inflater); } @Override public void setFileUpgradeStarted(boolean status) { OTAFirmwareUpgradeFragment.mFileUpgradeStarted = status; } private boolean isCyacd2File(String file) { return file.matches(REGEX_MATCHES_CYACD2); } }
d585227717fc9db637daa34bcbdddd4a954906ea
f242d5a9bc5afb7f5c63676b56308d37ec1024cc
/microservice/project-microservice/service/src/main/java/com/hyrax/microservice/project/service/exception/team/TeamOperationNotAllowedException.java
66436bf9bcc23fd1ee8497360b075afc6421f724
[ "Apache-2.0" ]
permissive
hyracoidea/hyrax-backend
6ef5dfa2083730b212b1478d0e2718f3cdb3c485
bc4a35e26bf3aa3a79fcee80b1659c3febfc0495
refs/heads/master
2021-01-23T22:30:32.991490
2018-10-25T18:24:06
2018-10-25T18:24:06
102,936,858
1
1
Apache-2.0
2018-04-15T10:14:40
2017-09-09T07:48:01
Java
UTF-8
Java
false
false
238
java
package com.hyrax.microservice.project.service.exception.team; public class TeamOperationNotAllowedException extends RuntimeException { public TeamOperationNotAllowedException(final String message) { super(message); } }
0bed2457e4fd28fd3416bbe41f71d2beda43b29c
20e1155cbf485453a921eaac22b2fd067cd250ae
/Java Project/src/GUITools/Tweakers/TweakedButton.java
29559f3f36210eb2f7ded09c77792104c2bdd658
[]
no_license
RaisingRay/The-Donna
66e01f77ff02224b11752375c9812081547f1c9c
f3493dd74a51c503611b05083f2fdb252af3bce1
refs/heads/master
2020-04-02T10:34:13.602507
2018-10-23T15:13:27
2018-10-23T15:13:27
154,344,409
0
0
null
null
null
null
UTF-8
Java
false
false
3,163
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 GUITools.Tweakers; import java.awt.Color; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JLabel; /** * * @author Raiisa */ public abstract class TweakedButton { private JLabel Button=new JLabel(); private boolean entered=false; private boolean press=false; private boolean danger=false; private int Green; private int Blue; private int Red; private boolean Work=true; public abstract void action(); public TweakedButton(JLabel label,boolean danger){ Button=label; this.danger=danger; Green=Button.getBackground().getGreen(); Blue=Button.getBackground().getBlue(); Red=Button.getBackground().getRed(); initListner(); } private void initListner() { Button.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mevent) { if(Work){ entered=true; if(!press) darker();} } @Override public void mouseExited(MouseEvent mevent) { if(Work){ entered=false; if(!press) reset();} } @Override public void mousePressed(MouseEvent mevent) { if(Work){ press=true; lighter();} } @Override public void mouseReleased(MouseEvent mevent) { if(Work){ press=false; reset(); if(entered) action();} } }); } private void darker(){ if(danger) Button.setBackground(Color.RED); else Button.setBackground(new Color(colorBrightChanger(Red),colorBrightChanger(Green), colorBrightChanger(Blue))); } private void lighter(){ if(danger) Button.setBackground(Color.PINK); else Button.setBackground(new Color(colorDarkChanger(Red), colorDarkChanger(Green),colorDarkChanger(Blue))); } private int colorDarkChanger(int color){ if(color-40<=0) return 0; else return color-40; } private int colorBrightChanger(int color){ if(color+40>=255) return 255; else return color+40; } private void reset(){ Button.setBackground(new Color(Red, Green, Blue)); } private void Grey(){ Button.setBackground(Color.GRAY); } public void disable(){ Work=false; Grey(); } public void enable(){ Work=true; reset(); } public JLabel getButton() { return Button; } public boolean isEntered() { return entered; } }
d96bebd728bf0a45277d6f9022f52e867526fbb6
3579c3d1c54609969ed1d1a26febb08026ed7fa1
/app/src/main/java/com/example/group/teamproject2/activitys/MyApplication.java
830fdad1090c94e3c67afda09483de1ca5f9d65d
[]
no_license
LongyueChang/DongCustomView
12faedad431d0bdf750a7b17a104964981080a15
66c7fd161d8a29534b658f6d72a992e62cb684eb
refs/heads/master
2021-01-11T19:14:23.542910
2017-01-18T13:18:31
2017-01-18T13:18:31
79,340,596
1
0
null
null
null
null
UTF-8
Java
false
false
555
java
package com.example.group.teamproject2.activitys; import android.app.Application; import android.content.Context; import com.example.group.teamproject2.utils.GreenDaoManager; /** * Created by Administrator on 2016/12/30. */ public class MyApplication extends Application { private static Context mContext; @Override public void onCreate() { super.onCreate(); mContext=getApplicationContext(); GreenDaoManager.getInstance(mContext); } public static Context getContext(){ return mContext; } }
d1add854cab984f31e9ed529b54d813be2b7a53f
e81d2bfc27d4e8d212baef512d5b99db17806d79
/model/Idioma.java
d8f6ff6f0ba30799bd6f1c8eb474766fccc92111
[]
no_license
citin/bd2
3d315f70c91cb1dcc1964dc3d826495a820abef8
fa81bbe6aea62bd53668b049e0100ac418f23826
refs/heads/master
2021-01-21T04:41:50.385375
2017-08-04T18:55:03
2017-08-04T18:55:03
55,557,401
0
0
null
null
null
null
UTF-8
Java
false
false
1,372
java
/** * Idioma.java * * BBDD2 - Proyecto Integrador * * Etapa 1 * */ package bd2.model; /** * Esta es la clase Idioma que se utiliza para instanciar a los objetos idiomas * * @author Grupo10 * */ public class Idioma { /** * Variable de instancia nombre */ private String nombre; /** * Variable de instancia diccionario */ private Diccionario diccionario; /** * Este es el constructor por defecto para la clase Idioma. */ public Idioma(){ } /** * Constructor con argumentos para la clase Idioma * * @param nombre */ public Idioma(String nombre){ this.setNombre(nombre); this.setDiccionario(new Diccionario(this, "Edicion 1")); // Por defecto se inicializa en la Edicion 1 } /** * Método para recuperar el nombre del objeto idioma * @return String */ public String getNombre() { return nombre; } /** * Método para setear un nombre al objeto idioma * @param nombre */ public void setNombre(String nombre) { this.nombre = nombre; } /** * Método para recuperar el diccionario del objeto idioma * @return Diccionario */ public Diccionario getDiccionario() { return diccionario; } /** * Método para setear un diccionario al objeto idioma * @param diccionario */ public void setDiccionario(Diccionario diccionario) { this.diccionario = diccionario; } }
70db00a885e2e1ba4b250b3b8e39d309a757430c
3b38547810e569d77eff6b5a4787b44c960649dc
/src/telas/ListMedicamentos.java
0ac5855ad5022563ff9db42b2894912ed5e08183
[]
no_license
LuizIbarra68/ProjetoIntegrador
cd4919916a29e48ed4be7027bdf7748d65144892
496198ef9d4fdf01bbe22febae857a75f86a36ec
refs/heads/master
2020-03-24T21:25:14.803893
2018-07-31T15:04:33
2018-07-31T15:04:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,845
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 telas; import dao.MedicamentoDAO; import java.util.List; import javax.swing.JDesktopPane; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import model.ObjMedicamento; /** * * @author 181710089 */ public class ListMedicamentos extends javax.swing.JInternalFrame { private JDesktopPane painelTelaInicial; /** * Creates new form ListMedicamentos */ public ListMedicamentos(JDesktopPane painelTelaInicial) { initComponents(); this.painelTelaInicial = painelTelaInicial; carregarTabela(); } private void carregarTabela(){ DefaultTableModel modelo = new DefaultTableModel(); String[] colunas = { "Código" , "Nome", "Quantidade", "Cadastro", "Vencimento", "Categoria"}; modelo.setColumnIdentifiers(colunas); List<ObjMedicamento> lista = MedicamentoDAO.getMedicamentos(); for(ObjMedicamento pro : lista ){ Object[] obj = { pro.getCodigo(), pro.getNome(), pro.getData_de_cadastro(), pro.getData_de_vencimento(), pro.getCategoria(), }; modelo.addRow(obj); } tableMedicamentos.setModel(modelo); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); tableMedicamentos = new javax.swing.JTable(); btnExcluir = new javax.swing.JButton(); btnEditar = new javax.swing.JButton(); setClosable(true); setIconifiable(true); setMaximizable(true); setResizable(true); setTitle("Lista de Medicamentos"); jPanel1.setBackground(new java.awt.Color(230, 227, 227)); jLabel1.setFont(new java.awt.Font("Calibri Light", 0, 18)); // NOI18N jLabel1.setText("Medicamentos Cadastrados:"); tableMedicamentos.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {} }, new String [] { } )); jScrollPane1.setViewportView(tableMedicamentos); btnExcluir.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N btnExcluir.setText("EXCLUIR"); btnExcluir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnExcluirActionPerformed(evt); } }); btnEditar.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N btnEditar.setText("EDITAR"); btnEditar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnEditarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnExcluir) .addGap(18, 18, 18) .addComponent(btnEditar))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(40, 40, 40) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnExcluir) .addComponent(btnEditar)) .addContainerGap(38, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed int linha = tableMedicamentos.getSelectedRow(); if ( linha == -1) { JOptionPane.showMessageDialog(this, "Você deve selecionar um medicamento!"); }else{ String nome = (String) tableMedicamentos.getValueAt(linha, 1); int resposta = JOptionPane.showConfirmDialog(this, "Confirma a exclusão do medicamento selecionado" + nome + "?", "Excluir Medicamento", JOptionPane.YES_NO_OPTION); if( resposta == JOptionPane.YES_OPTION) { ObjMedicamento cid = new ObjMedicamento(); int codigo =(int) tableMedicamentos.getModel().getValueAt(linha, 0); cid.setCodigo(codigo); MedicamentoDAO.excluir(cid); carregarTabela(); } } }//GEN-LAST:event_btnExcluirActionPerformed private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed }//GEN-LAST:event_btnEditarActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnEditar; private javax.swing.JButton btnExcluir; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable tableMedicamentos; // End of variables declaration//GEN-END:variables }
78603d6476745034c118df133095f5d8aacc316c
34b713d69bae7d83bb431b8d9152ae7708109e74
/admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/web/form/entity/EntityForm.java
e1832f524e5385c6ac9b41a2e21b0f360670d602
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sinotopia/BroadleafCommerce
d367a22af589b51cc16e2ad094f98ec612df1577
502ff293d2a8d58ba50a640ed03c2847cb6369f6
refs/heads/BroadleafCommerce-4.0.x
2021-01-23T14:14:45.029362
2019-07-26T14:18:05
2019-07-26T14:18:05
93,246,635
0
0
null
2017-06-03T12:27:13
2017-06-03T12:27:13
null
UTF-8
Java
false
false
21,515
java
/* * #%L * BroadleafCommerce Open Admin Platform * %% * Copyright (C) 2009 - 2013 Broadleaf Commerce * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package org.broadleafcommerce.openadmin.web.form.entity; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.broadleafcommerce.common.presentation.client.SupportedFieldType; import org.broadleafcommerce.common.web.BroadleafRequestContext; import org.broadleafcommerce.openadmin.dto.SectionCrumb; import org.broadleafcommerce.openadmin.web.form.component.ListGrid; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; public class EntityForm { protected static final Log LOG = LogFactory.getLog(EntityForm.class); public static final String HIDDEN_GROUP = "hiddenGroup"; public static final String MAP_KEY_GROUP = "keyGroup"; public static final String DEFAULT_GROUP_NAME = "Default"; public static final Integer DEFAULT_GROUP_ORDER = 99999; public static final String DEFAULT_TAB_NAME = "General"; public static final Integer DEFAULT_TAB_ORDER = 100; protected String id; protected String parentId; protected String idProperty = "id"; protected String ceilingEntityClassname; protected String entityType; protected String mainEntityName; protected String sectionKey; protected Boolean readOnly = false; /** * special member used for only for a Translation entity form. Set at the controller, in order to populate a hidden field in the form * indicating that there were errors and the form should not be allowed to submit. */ protected Boolean preventSubmit = false; /** * a string representation of a Javascript object containing a map of fields => errors * Useful when filling a translation form, as the (only) way to determine to which fields error messaging needs to be attached */ protected String jsErrorMap; protected String translationCeilingEntity; protected String translationId; protected Set<Tab> tabs = new TreeSet<Tab>(new Comparator<Tab>() { @Override public int compare(Tab o1, Tab o2) { return new CompareToBuilder() .append(o1.getOrder(), o2.getOrder()) .append(o1.getTitle(), o2.getTitle()) .toComparison(); } }); protected List<SectionCrumb> sectionCrumbs = new ArrayList<SectionCrumb>(); // This is used to data-bind when this entity form is submitted protected Map<String, Field> fields = null; // This is used in cases where there is a sub-form on this page that is dynamically // rendered based on other values on this entity form. It is keyed by the name of the // property that drives the dynamic form. protected Map<String, EntityForm> dynamicForms = new LinkedHashMap<String, EntityForm>(); // These values are used when dynamic forms are in play. They are not rendered to the client, // but they can be used when performing actions on the submit event protected Map<String, DynamicEntityFormInfo> dynamicFormInfos = new LinkedHashMap<String, DynamicEntityFormInfo>(); protected List<EntityFormAction> actions = new ArrayList<EntityFormAction>(); protected Map<String, Object> attributes = new HashMap<String, Object>(); /** * @return a flattened, field name keyed representation of all of * the fields in all of the groups for this form. This set will also includes all of the dynamic form * fields. * * Note that if there collisions between the dynamic form fields and the fields on this form (meaning that they * have the same name), then the dynamic form field will be excluded from the map and the preference will be given * to first-level entities * * @see {@link #getFields(boolean)} */ public Map<String, Field> getFields() { if (fields == null) { Map<String, Field> map = new LinkedHashMap<String, Field>(); for (Tab tab : tabs) { for (FieldGroup group : tab.getFieldGroups()) { for (Field field : group.getFields()) { map.put(field.getName(), field); } } } fields = map; } for (Entry<String, EntityForm> entry : dynamicForms.entrySet()) { Map<String, Field> dynamicFormFields = entry.getValue().getFields(); for (Entry<String, Field> dynamicField : dynamicFormFields.entrySet()) { if (fields.containsKey(dynamicField.getKey())) { LOG.info("Excluding dynamic field " + dynamicField.getKey() + " as there is already an occurrance in" + " this entityForm"); } else { fields.put(dynamicField.getKey(), dynamicField.getValue()); } } } return fields; } /** * Clears out the cached 'fields' variable which is used to render the form on the frontend. Use this method * if you want to force the entityForm to rebuild itself based on the tabs and groups that have been assigned and * populated */ public void clearFieldsMap() { fields = null; } public List<ListGrid> getAllListGrids() { List<ListGrid> list = new ArrayList<ListGrid>(); for (Tab tab : tabs) { for (ListGrid lg : tab.getListGrids()) { list.add(lg); } } return list; } /** * Convenience method for grabbing a grid by its collection field name. This is very similar to {@link #findField(String)} * but differs in that this only searches through the sub collections for the current entity * * @param collectionFieldName the field name of the collection on the top-level entity * @return */ public ListGrid findListGrid(String collectionFieldName) { for (ListGrid grid : getAllListGrids()) { if (grid.getSubCollectionFieldName().equals(collectionFieldName)) { return grid; } } return null; } public Tab findTab(String tabTitle) { for (Tab tab : tabs) { if (tab.getTitle() != null && tab.getTitle().equals(tabTitle)) { return tab; } } return null; } public Tab findTabForField(String fieldName) { fieldName = sanitizeFieldName(fieldName); for (Tab tab : tabs) { for (FieldGroup fieldGroup : tab.getFieldGroups()) { for (Field field : fieldGroup.getFields()) { if (field.getName().equals(fieldName)) { return tab; } } } } return null; } public Field findField(String fieldName) { fieldName = sanitizeFieldName(fieldName); for (Tab tab : tabs) { for (FieldGroup fieldGroup : tab.getFieldGroups()) { for (Field field : fieldGroup.getFields()) { if (field.getName().equals(fieldName)) { return field; } } } } return null; } /** * Since this field name could come from the frontend (where all fields are referenced like fields[name].value, * we need to strip that part out to look up the real field name in this entity * @param fieldName * @return */ public String sanitizeFieldName(String fieldName) { if (fieldName.contains("[")) { fieldName = fieldName.substring(fieldName.indexOf('[') + 1, fieldName.indexOf(']')); } return fieldName; } public Field removeField(String fieldName) { Field fieldToRemove = null; FieldGroup containingGroup = null; findField: { for (Tab tab : tabs) { for (FieldGroup fieldGroup : tab.getFieldGroups()) { for (Field field : fieldGroup.getFields()) { if (field.getName().equals(fieldName)) { fieldToRemove = field; containingGroup = fieldGroup; break findField; } } } } } if (fieldToRemove != null) { containingGroup.removeField(fieldToRemove); } if (fields != null) { fieldToRemove = fields.remove(fieldName); } return fieldToRemove; } public void removeTab(Tab tab) { tabs.remove(tab); } public void removeTab(String tabName) { if (tabs != null) { Iterator<Tab> tabIterator = tabs.iterator(); while (tabIterator.hasNext()) { Tab currentTab = tabIterator.next(); if (tabName.equals(currentTab.getTitle())) { tabIterator.remove(); } } } } public ListGrid removeListGrid(String subCollectionFieldName) { ListGrid lgToRemove = null; Tab containingTab = null; findLg: { for (Tab tab : tabs) { for (ListGrid lg : tab.getListGrids()) { if (subCollectionFieldName.equals(lg.getSubCollectionFieldName())) { lgToRemove = lg; containingTab = tab; break findLg; } } } } if (lgToRemove != null) { containingTab.removeListGrid(lgToRemove); } if (containingTab != null && containingTab.getListGrids().size() == 0 && containingTab.getFields().size() == 0) { removeTab(containingTab); } return lgToRemove; } public void addHiddenField(Field field) { if (StringUtils.isBlank(field.getFieldType())) { field.setFieldType(SupportedFieldType.HIDDEN.toString()); } addField(field, HIDDEN_GROUP, DEFAULT_GROUP_ORDER, DEFAULT_TAB_NAME, DEFAULT_TAB_ORDER); } public void addField(Field field) { addField(field, DEFAULT_GROUP_NAME, DEFAULT_GROUP_ORDER, DEFAULT_TAB_NAME, DEFAULT_TAB_ORDER); } public void addMapKeyField(Field field) { addField(field, MAP_KEY_GROUP, 0, DEFAULT_TAB_NAME, DEFAULT_TAB_ORDER); } public void addField(Field field, String groupName, Integer groupOrder, String tabName, Integer tabOrder) { groupName = groupName == null ? DEFAULT_GROUP_NAME : groupName; groupOrder = groupOrder == null ? DEFAULT_GROUP_ORDER : groupOrder; tabName = tabName == null ? DEFAULT_TAB_NAME : tabName; tabOrder = tabOrder == null ? DEFAULT_TAB_ORDER : tabOrder; // Tabs and groups should be looked up by their display, translated name since 2 unique strings can display the same // thing when they are looked up in message bundles after display // When displayed on the form the duplicate groups and tabs look funny BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext(); if (context != null && context.getMessageSource() != null) { groupName = context.getMessageSource().getMessage(groupName, null, groupName, context.getJavaLocale()); tabName = context.getMessageSource().getMessage(tabName, null, tabName, context.getJavaLocale()); } Tab tab = findTab(tabName); if (tab == null) { tab = new Tab(); tab.setTitle(tabName); tab.setOrder(tabOrder); tabs.add(tab); } FieldGroup fieldGroup = tab.findGroup(groupName); if (fieldGroup == null) { fieldGroup = new FieldGroup(); fieldGroup.setTitle(groupName); fieldGroup.setOrder(groupOrder); tab.getFieldGroups().add(fieldGroup); } fieldGroup.addField(field); } public void addListGrid(ListGrid listGrid, String tabName, Integer tabOrder) { // Tabs should be looked up and referenced by their display name BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext(); if (context != null && context.getMessageSource() != null) { tabName = context.getMessageSource().getMessage(tabName, null, tabName, context.getJavaLocale()); } Tab tab = findTab(tabName); if (tab == null) { tab = new Tab(); tab.setTitle(tabName); tab.setOrder(tabOrder); tabs.add(tab); } tab.getListGrids().add(listGrid); } /** * Uses a zero based position. Use 0 to add to the top of the list. * @param position * @param action */ public void addAction(int position, EntityFormAction action) { if (actions.size() > position) { actions.add(position, action); } else { actions.add(action); } } public void addAction(EntityFormAction action) { actions.add(action); } public void removeAction(EntityFormAction action) { actions.remove(action); } public void removeAllActions() { actions.clear(); } public EntityForm getDynamicForm(String name) { return getDynamicForms().get(name); } public void putDynamicForm(String name, EntityForm ef) { getDynamicForms().put(name, ef); } public DynamicEntityFormInfo getDynamicFormInfo(String name) { return getDynamicFormInfos().get(name); } public void putDynamicFormInfo(String name, DynamicEntityFormInfo info) { getDynamicFormInfos().put(name, info); } public Boolean getReadOnly() { return readOnly; } public Boolean getPreventSubmit() { return preventSubmit; } public void setPreventSubmit() { this.preventSubmit = true; } public void setReadOnly() { setReadOnly(true); } public void setReadOnly(boolean readOnly) { if (getFields() != null) { for (Entry<String, Field> entry : getFields().entrySet()) { entry.getValue().setReadOnly(readOnly); } } if (getAllListGrids() != null) { for (ListGrid lg : getAllListGrids()) { lg.setReadOnly(readOnly); } } if (getDynamicForms() != null) { for (Entry<String, EntityForm> entry : getDynamicForms().entrySet()) { entry.getValue().setReadOnly(readOnly); } } actions.clear(); this.readOnly = readOnly; } public List<EntityFormAction> getActions() { List<EntityFormAction> clonedActions = new ArrayList<EntityFormAction>(actions); Collections.reverse(clonedActions); return Collections.unmodifiableList(clonedActions); } public FieldGroup collapseToOneFieldGroup() { Tab newTab = new Tab(); FieldGroup newFg = new FieldGroup(); newTab.getFieldGroups().add(newFg); for (Tab tab : getTabs()) { for (FieldGroup fg : tab.getFieldGroups()) { for (Field field : fg.getFields()) { newFg.addField(field); } } } getTabs().clear(); getTabs().add(newTab); return newFg; } public String getTranslationCeilingEntity() { return translationCeilingEntity == null ? ceilingEntityClassname : translationCeilingEntity; } public void setTranslationCeilingEntity(String translationCeilingEntity) { this.translationCeilingEntity = translationCeilingEntity; } public String getTranslationId() { return translationId == null ? id : translationId; } public void setTranslationId(String translationId) { this.translationId = translationId; } /* *********************** */ /* GENERIC GETTERS/SETTERS */ /* *********************** */ public String getId() { return id; } public void setId(String id) { this.id = id; } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; } public String getIdProperty() { return idProperty; } public void setIdProperty(String idProperty) { this.idProperty = idProperty; } public String getCeilingEntityClassname() { return ceilingEntityClassname; } public void setCeilingEntityClassname(String ceilingEntityClassname) { this.ceilingEntityClassname = ceilingEntityClassname; } public String getEntityType() { return entityType; } public void setEntityType(String entityType) { this.entityType = entityType; } public String getMainEntityName() { return StringUtils.isBlank(mainEntityName) ? "" : mainEntityName; } public void setMainEntityName(String mainEntityName) { this.mainEntityName = mainEntityName; } public String getSectionKey() { return sectionKey.charAt(0) == '/' ? sectionKey : '/' + sectionKey; } public void setSectionKey(String sectionKey) { this.sectionKey = sectionKey; } public Set<Tab> getTabs() { return tabs; } public void setTabs(Set<Tab> tabs) { this.tabs = tabs; } public Map<String, EntityForm> getDynamicForms() { return dynamicForms; } public void setDynamicForms(Map<String, EntityForm> dynamicForms) { this.dynamicForms = dynamicForms; } public Map<String, DynamicEntityFormInfo> getDynamicFormInfos() { return dynamicFormInfos; } public void setDynamicFormInfos(Map<String, DynamicEntityFormInfo> dynamicFormInfos) { this.dynamicFormInfos = dynamicFormInfos; } public void setActions(List<EntityFormAction> actions) { this.actions = actions; } public List<SectionCrumb> getSectionCrumbsImpl() { return sectionCrumbs; } public void setSectionCrumbsImpl(List<SectionCrumb> sectionCrumbs) { if (sectionCrumbs == null) { this.sectionCrumbs.clear(); return; } this.sectionCrumbs = sectionCrumbs; } public void setSectionCrumbs(String crumbs) { List<SectionCrumb> myCrumbs = new ArrayList<SectionCrumb>(); if (!StringUtils.isEmpty(crumbs)) { String[] crumbParts = crumbs.split(","); for (String part : crumbParts) { SectionCrumb crumb = new SectionCrumb(); String[] crumbPieces = part.split("--"); crumb.setSectionIdentifier(crumbPieces[0]); crumb.setSectionId(crumbPieces[1]); if (!myCrumbs.contains(crumb)) { myCrumbs.add(crumb); } } } sectionCrumbs = myCrumbs; } public String getSectionCrumbs() { StringBuilder sb = new StringBuilder(); int index = 0; for (SectionCrumb section : sectionCrumbs) { sb.append(section.getSectionIdentifier()); sb.append("--"); sb.append(section.getSectionId()); if (index < sectionCrumbs.size() - 1) { sb.append(","); } index++; } return sb.toString(); } public Map<String, Object> getAttributes() { return attributes; } public void setAttributes(Map<String, Object> attributes) { this.attributes = attributes; } public String getJsErrorMap() { return jsErrorMap; } public void setJsErrorMap(String jsErrorMap) { this.jsErrorMap = jsErrorMap; } }
1296fb67d915d26eded0b5148455532c0aa5ac72
3ef9f8cf45b5f2315525c7e38a106574130e8b68
/service-discovery/src/test/java/com/skipthedishes/hackathon/servicediscovery/ServiceDiscoveryApplicationTests.java
9f9d3858baa07776adf285b3b845b64bec2a668f
[]
no_license
LuizParo/hackathon-skip-the-dishes-challenge
88842bb09b0c87cfa8949f3b2f1d9415f3fcf6f0
42a11c44ab4dda42c391e27f81d5f7a0925a1544
refs/heads/master
2021-09-09T18:42:03.087263
2018-03-18T23:25:36
2018-03-18T23:25:36
125,776,614
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.skipthedishes.hackathon.servicediscovery; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ServiceDiscoveryApplicationTests { @Test public void contextLoads() { } }
785d22b2c7676a571fd20408c5fefc3e81412ab2
c8c152a6fc659bc8de25a90dc31b5a60c2679402
/pro08/src/sec02/ex01/SetCookieValue.java
dc77291a87ad3b60de7ccf7f50470e0ac291493c
[]
no_license
Khjnnn/Bitcamp
45fbc8072480016c5096a5c077ddc5c988fb64db
73e79f16ed167cf6cce54bcebe4a455b46772089
refs/heads/master
2022-12-26T16:47:48.826343
2020-03-19T06:19:56
2020-03-19T06:19:56
242,875,737
1
0
null
2022-12-16T04:44:35
2020-02-25T00:42:44
HTML
UTF-8
Java
false
false
957
java
package sec02.ex01; import java.io.IOException; import java.io.PrintWriter; import java.net.URLEncoder; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/set") public class SetCookieValue extends HttpServlet{ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); Date d = new Date(); Cookie c = new Cookie("cookieTest",URLEncoder.encode("JSP 프로그래밍","UTF-8")); c.setMaxAge(24*60*60); response.addCookie(c); out.println("현재시간 "+ d); out.println("문자열 쿠키에 저장"); } }
025e10fe29e2f27b3ee4b50e911093850542e38f
b88868344f6b249399747db5fe83cc174fc1d9e3
/com.ibm.wala.core/src/com/ibm/wala/viz/viewer/WalaViewer.java
6d26c4d12c3c8a9fa9c1cf24e7829f8c2811754f
[]
no_license
panagosg7/Android-NoSleep
fdddfd5e641d70dce4869bdd87300f797d755b8a
764326682e4f5aef1e4e3680fc959e0c081f8012
refs/heads/master
2016-09-06T03:13:41.681077
2014-12-02T22:33:35
2014-12-02T22:33:35
27,431,590
4
0
null
null
null
null
UTF-8
Java
false
false
1,686
java
package com.ibm.wala.viz.viewer; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JTabbedPane; import javax.swing.UIManager; import com.ibm.wala.ipa.callgraph.CallGraph; import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis; /** * Viewer for ClassHeirarcy, CallGraph and Pointer Analysis results. * A driver for example can be found in com.ibm.wala.js.rhino.vis.JsViewer. * @author yinnonh * */ public class WalaViewer extends JFrame { protected static final String DefaultMutableTreeNode = null; public WalaViewer(CallGraph cg, PointerAnalysis pa) { setNativeLookAndFeel(); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("Call Graph", new CgPanel(cg)); tabbedPane.add("Class Hierarchy", new ChaPanel(cg.getClassHierarchy())); PaPanel paPanel = createPaPanel(cg, pa); paPanel.init(); tabbedPane.add("Pointer Analysis", paPanel); setSize(600, 800); setExtendedState(MAXIMIZED_BOTH); addWindowListener(new ExitListener()); this.setTitle("Wala viewer"); add(tabbedPane); setVisible(true); } protected PaPanel createPaPanel(CallGraph cg, PointerAnalysis pa) { return new PaPanel(cg, pa); } public static void setNativeLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } } private static class ExitListener extends WindowAdapter { @Override public void windowClosing(WindowEvent event) { System.exit(0); } } }
31cf632927512bd51ff27d04f907cd5ea8febf13
08158d0f24f39902275273b8fbfe59bf7e0d1251
/src/newLambdas/User.java
6281152a8e9b01abd5a7126fed6eca7d8f727b64
[]
no_license
ilya-JAVA/MyfirstGitProject
77c352716659765e44961fb0a2270f1ef5809349
34c62d52ca90f1c21a6fda653b063995fc6c7514
refs/heads/master
2021-02-16T00:01:43.000089
2020-03-04T16:11:13
2020-03-04T16:11:13
244,947,669
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package newLambdas; public class User { private String login; private String password; public String getLogin() { return login; } public String getPassword() { return password; } public User(String login, String password) { this.login = login; this.password = password; } }
ac3506f408370656214f0fa6902757a01a76367d
b31e60f3e03f9ac86287277b4d7b3438dd51b479
/concepts/src/test/java/org/openmrs/concepts/web/rest/TestUtil.java
f17df3189b0b69ecc198dd0d586750595648e939
[]
no_license
enyachoke/openmrs-microservices
00d4d528c8a3e110d88bd902e9cd17da0bba8575
6029f7537d4f6f469cc2042bb264c73908b057cc
refs/heads/main
2023-01-22T16:48:42.459836
2020-11-22T09:32:11
2020-11-22T09:32:11
315,001,117
0
0
null
null
null
null
UTF-8
Java
false
false
6,032
java
package org.openmrs.concepts.web.rest; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.hamcrest.Description; import org.hamcrest.TypeSafeDiagnosingMatcher; import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.format.support.FormattingConversionService; import java.io.IOException; import java.time.ZonedDateTime; import java.time.format.DateTimeParseException; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import static org.assertj.core.api.Assertions.assertThat; /** * Utility class for testing REST controllers. */ public final class TestUtil { private static final ObjectMapper mapper = createObjectMapper(); private static ObjectMapper createObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false); mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); mapper.registerModule(new JavaTimeModule()); return mapper; } /** * Convert an object to JSON byte array. * * @param object the object to convert. * @return the JSON byte array. * @throws IOException */ public static byte[] convertObjectToJsonBytes(Object object) throws IOException { return mapper.writeValueAsBytes(object); } /** * Create a byte array with a specific size filled with specified data. * * @param size the size of the byte array. * @param data the data to put in the byte array. * @return the JSON byte array. */ public static byte[] createByteArray(int size, String data) { byte[] byteArray = new byte[size]; for (int i = 0; i < size; i++) { byteArray[i] = Byte.parseByte(data, 2); } return byteArray; } /** * A matcher that tests that the examined string represents the same instant as the reference datetime. */ public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher<String> { private final ZonedDateTime date; public ZonedDateTimeMatcher(ZonedDateTime date) { this.date = date; } @Override protected boolean matchesSafely(String item, Description mismatchDescription) { try { if (!date.isEqual(ZonedDateTime.parse(item))) { mismatchDescription.appendText("was ").appendValue(item); return false; } return true; } catch (DateTimeParseException e) { mismatchDescription.appendText("was ").appendValue(item) .appendText(", which could not be parsed as a ZonedDateTime"); return false; } } @Override public void describeTo(Description description) { description.appendText("a String representing the same Instant as ").appendValue(date); } } /** * Creates a matcher that matches when the examined string represents the same instant as the reference datetime. * * @param date the reference datetime against which the examined string is checked. */ public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { return new ZonedDateTimeMatcher(date); } /** * Verifies the equals/hashcode contract on the domain object. */ public static <T> void equalsVerifier(Class<T> clazz) throws Exception { T domainObject1 = clazz.getConstructor().newInstance(); assertThat(domainObject1.toString()).isNotNull(); assertThat(domainObject1).isEqualTo(domainObject1); assertThat(domainObject1.hashCode()).isEqualTo(domainObject1.hashCode()); // Test with an instance of another class Object testOtherObject = new Object(); assertThat(domainObject1).isNotEqualTo(testOtherObject); assertThat(domainObject1).isNotEqualTo(null); // Test with an instance of the same class T domainObject2 = clazz.getConstructor().newInstance(); assertThat(domainObject1).isNotEqualTo(domainObject2); // HashCodes are equals because the objects are not persisted yet assertThat(domainObject1.hashCode()).isEqualTo(domainObject2.hashCode()); } /** * Create a {@link FormattingConversionService} which use ISO date format, instead of the localized one. * @return the {@link FormattingConversionService}. */ public static FormattingConversionService createFormattingConversionService() { DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService (); DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); registrar.setUseIsoFormat(true); registrar.registerFormatters(dfcs); return dfcs; } /** * Makes a an executes a query to the EntityManager finding all stored objects. * @param <T> The type of objects to be searched * @param em The instance of the EntityManager * @param clss The class type to be searched * @return A list of all found objects */ public static <T> List<T> findAll(EntityManager em, Class<T> clss) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<T> cq = cb.createQuery(clss); Root<T> rootEntry = cq.from(clss); CriteriaQuery<T> all = cq.select(rootEntry); TypedQuery<T> allQuery = em.createQuery(all); return allQuery.getResultList(); } private TestUtil() {} }
9d79b25099eac9c42f299469b4a8a0d9f93a0bff
998cb58ac112e43dfac3e5e6540bb4724d7958f1
/src/main/java/abra/SVEvaluator.java
91b8be287a37208dcfb1cfbfcb48f65faa8d69dc
[ "MIT" ]
permissive
exic/abra
ce2c4f7c984845c7171f1e7958994d21c3278cb0
5c8772f510e777265db2e26da8a27255a5915fa5
refs/heads/master
2020-06-16T20:39:52.454265
2017-04-24T16:26:42
2017-04-24T16:26:42
195,697,566
0
0
MIT
2019-07-07T21:13:36
2019-07-07T21:13:36
null
UTF-8
Java
false
false
2,463
java
package abra; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import htsjdk.samtools.SAMFileHeader; public class SVEvaluator { public void evaluateAndOutput(String svContigFasta, ReAligner realigner, String tempDir, int readLength, String[] inputSams, String[] tempDirs, SAMFileHeader[] samHeaders, String structuralVariantFile) throws IOException, InterruptedException { String svContigsSam = tempDir + "/" + "sv_contigs.sam"; realigner.alignStructuralVariantCandidates(svContigFasta, svContigsSam); // Extract Breakpoint candidates SVHandler svHandler = new SVHandler(readLength, realigner.getMinMappingQuality()); String svCandidates = tempDir + "/" + "sv_candidates.fa"; boolean hasCandidates = svHandler.identifySVCandidates(svContigsSam, svCandidates); if (hasCandidates) { Aligner aligner = new Aligner(svCandidates, 1); aligner.index(); String[] svSams = new String[inputSams.length]; List<Map<String, Integer>> svCounts = new ArrayList<Map<String, Integer>>(); Set<String> breakpointIds = new HashSet<String>(); for (int i=0; i<inputSams.length; i++) { svSams[i] = tempDirs[i] + "/" + "sv_aligned_to_contig.sam"; SVReadCounter svReadCounter = realigner.alignToSVContigs(tempDirs[i], svSams[i], svCandidates, null, samHeaders[i]); svCounts.add(svReadCounter.getCounts()); breakpointIds.addAll(svReadCounter.getCounts().keySet()); // realigner.alignToContigs(tempDirs[i], svSams[i], svCandidates, null, null); } /* for (int i=0; i<svSams.length; i++) { SVReadCounter svReadCounter = new SVReadCounter(); Map<String, Integer> counts = svReadCounter.countReadsSupportingBreakpoints(svSams[i], readLength, samHeaders[i]); svCounts.add(counts); breakpointIds.addAll(counts.keySet()); } */ BufferedWriter writer = new BufferedWriter(new FileWriter(structuralVariantFile, false)); for (String breakpointId : breakpointIds) { writer.append(breakpointId.replace("+", "_")); for (Map<String, Integer> counts : svCounts) { writer.append('\t'); if (counts.containsKey(breakpointId)) { writer.append(String.valueOf(counts.get(breakpointId))); } else { writer.append("0"); } } writer.append('\n'); } writer.close(); } } }
0fd06f77fa9f32d181176f21803fd1876345b504
08cc4ec237af20571d5b8b99fe3099a604a4352e
/Mage.Sets/src/mage/sets/alarareborn/EnlistedWurm.java
31504d0902781d2d24bd7ca9b8b7843ced2cdd21
[]
no_license
fireshoes/mage
3f29df51426e3fd2cfcb3f3c9229240c5b27d4a6
ceb7f1f51cb8b7c3dc0215ad7645b80cdcc86b71
refs/heads/master
2020-12-26T00:25:54.832590
2014-12-10T22:45:38
2014-12-10T22:45:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,602
java
/* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ package mage.sets.alarareborn; import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.keyword.CascadeAbility; import mage.cards.CardImpl; /** * * @author North */ public class EnlistedWurm extends CardImpl { public EnlistedWurm(UUID ownerId) { super(ownerId, 68, "Enlisted Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}{W}"); this.expansionSetCode = "ARB"; this.subtype.add("Wurm"); this.color.setGreen(true); this.color.setWhite(true); this.power = new MageInt(5); this.toughness = new MageInt(5); this.addAbility(new CascadeAbility()); } public EnlistedWurm(final EnlistedWurm card) { super(card); } @Override public EnlistedWurm copy() { return new EnlistedWurm(this); } }
[ "robyter@gmail" ]
robyter@gmail
02a013244dd5d00c8247dc95a8981b406b71dd22
ee3230d6b3108ffa81d02d68b6175fe2eff03867
/src/PractiseJava/Color.java
5858556f537b77be7322b7ceeaaedb286e0f6702
[]
no_license
SumedhaSatyanarayana/JavaExercises
09af10b21c0b66589a7fe8335e1c456acb9a0db6
05edb89511c14b13ab0c6be0355388447def46d2
refs/heads/master
2020-03-22T12:34:59.370241
2018-07-07T03:15:38
2018-07-07T03:15:38
140,048,874
0
0
null
null
null
null
UTF-8
Java
false
false
1,478
java
package PractiseJava; import LearnJava.config; public class Color { // declares a class color // Creating a CONSTRUCTOR // Constructor is used to initialize a variable Color(){ // when an object is created this constructor will be called automatically color1= "green"; color2="grey"; color3 = "pink"; } String color1; // declares a variable String color2; String color3; public void brightness(){ // declares a method System.out.println("google has "+ color1 +" "+ color2 +" & not "+color3); } public static void main (String[] args){ Color obj = new Color(); // create an object named obj, call constructor automatically //obj.color1 = "yellow"; // initializing without using constructor //obj.color2 = "red"; // obj referencing a variable //obj.color3 = "orange"; // YOU DONT HAVE TO WRITE ABOVE 3 LINES OF CODE IF VARIABLE VALUES REMAINS THE SAME // IF WRITTEN IT OVERRIDES VARIABLES VALES WRITTEN IN CONSTRUCTOR obj.brightness(); // obj references a method Color obj1 = new Color(); obj1.color1 = "blue"; obj1.color2 = "green"; obj1.color3 = "violet"; obj1.brightness(); // BUFFER STRING StringBuffer stri = new StringBuffer("wolf and dragon"); System.out.println(stri.substring(1, 10 )); } // Object is an instance of class // constructor is used to initialize variable. Constructor name is same as class name // when an object is created the constructor is called automatically }
5512b3bccc5024802032d78fe47260b72cbedf39
a6f2017d1da942d49dafd900ea848fbe7a67f1fd
/test/algo/tree/BinarySearchTreeTest.java
36d9475928c4218f63e615cd0d683c5b0f9afe93
[]
no_license
rohitjain-rj/algorithms
8ad9446e95282a0dc1ccda03606dfad8866c4180
c084b80199d1090cfb81d96e6a7bdb0d7da4e13a
refs/heads/master
2021-01-01T05:30:20.151741
2015-05-08T20:22:42
2015-05-08T20:27:42
35,299,736
0
0
null
null
null
null
UTF-8
Java
false
false
1,302
java
package algo.tree; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; public class BinarySearchTreeTest { private BinarySearchTree<Integer> bst; @Before public void setUp() { bst = new BinarySearchTree<Integer>(); } @After public void tearDown() { bst = null; } @Test public void height() { bst.insert(5); bst.insert(2); bst.insert(1); assertEquals(3, bst.getHeight()); } @Test public void lca() { bst.insert(5); bst.insert(4); bst.insert(56); bst.insert(2); bst.insert(10); int lca = bst.lowestCommonAncestor(4, 56).data; assertEquals(5, lca); } @Test public void balancedBST() { bst.insert(5); bst.insert(3); bst.insert(8); bst.insert(7); bst.insert(2); bst.insert(4); bst.insert(10); bst.insert(9); assertTrue(bst.isBalanced()); } @Test public void unbalancedBST() { bst.insert(5); bst.insert(3); bst.insert(8); bst.insert(10); bst.insert(9); assertFalse(bst.isBalanced()); } @Test public void testShortestPathTT() { bst.insert(5); bst.insert(4); bst.insert(56); bst.insert(2); bst.insert(10); // // List<Node<Integer>> actual = bst.shortestPath(2, 56); // // List<Node<Integer>> expected = new ArrayList<Node<Integer>>(); } }
9cdcaf883dc84add19083d5cb3182666bbd15c3c
ee1631ec53ba907f17c32f23eba5a02a34d869e2
/oopm/eclipse/chrestomathy/structo/processor/visitor/Checker.java
ac20e62207337b2002c676bb28f3cb042244c0c3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
ArthurVard/professor-fish-all
7e6a7dfffc91a267e4f3be67421ad2312adeff79
f1f94cf2853dcd51e563c01178f05b57b3cd0366
refs/heads/master
2021-01-20T21:45:45.818579
2014-11-20T18:03:38
2014-11-20T18:03:38
101,787,878
0
0
null
null
null
null
UTF-8
Java
false
false
2,481
java
// (C) 2009 Ralf Laemmel package structo.processor.visitor; import java.util.HashSet; import structo.types.visitor.*; /** * A static checker for Structo. * Check that a variable is declared before it is ever referenced. * Check that a variable has been (definitely) initialized before it is read. */ public class Checker implements Visitor { // Maintain variables that were declared or initialized private HashSet<String> declared = new HashSet<String>(); private HashSet<String> initialized = new HashSet<String>(); public void visit(Int that) { } public void visit(Id that) { assert initialized.contains(that.getValue()); } public void visit(Binary that) { that.getLeft().accept(this); that.getRight().accept(this); } public void visit(Skip that) { } public void visit(Sequence that) { for (Statement s : that.getStatements()) s.accept(this); } public void visit(Declare that) { assert declared.add(that.getId()); } public void visit(Assign that) { that.getRhs().accept(this); assert declared.contains(that.getLhs()); initialized.add(that.getLhs()); } public void visit(If that) { that.getCond().accept(this); // Prepare collections for the branches HashSet<String> declaredBackup = declared; HashSet<String> initializedBackup = initialized; // Analyze then declared = new HashSet<String>(); declared.addAll(declaredBackup); initialized = new HashSet<String>(); initialized.addAll(initializedBackup); that.getThenBranch().accept(this); HashSet<String> initializedThen = initialized; // Analyze then declared = new HashSet<String>(); declared.addAll(declaredBackup); initialized = new HashSet<String>(); initialized.addAll(initializedBackup); that.getElseBranch().accept(this); // Restore and combine declared = declaredBackup; initialized.retainAll(initializedThen); } public void visit(While that) { that.getCond().accept(this); HashSet<String> declaredBackup = declared; HashSet<String> initializedBackup = initialized; declared = new HashSet<String>(); declared.addAll(declaredBackup); initialized = new HashSet<String>(); initialized.addAll(initializedBackup); that.getBody().accept(this); declared = declaredBackup; initialized = initializedBackup; } public void visit(Read that) { assert declared.contains(that.getId()); initialized.add(that.getId()); } public void visit(Write that) { that.getExpr().accept(this); } }
[ "rlaemmel@80f8bc9e-4d75-439a-9954-e8dd026db917" ]
rlaemmel@80f8bc9e-4d75-439a-9954-e8dd026db917
f0925f2119715cbcd62938695391a544ea357e79
d0ee07e4947ff7e363c46c840f0a4055ca595709
/player/SList.java
b46b3c1c8d33f9245312697cf77eaf06fa6bae64
[]
no_license
lisaqyli/Network-the-game
8f3e6ed8148d9173b9d4173e675b5580cb24bbaa
bdd17fc43d57770cd0b1ed969a822de085e2c68d
refs/heads/master
2021-05-27T19:42:24.438465
2013-08-26T06:58:10
2013-08-26T06:58:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,091
java
/* SList.java */ package player; /** * A SList is a mutable singly-linked list ADT. Its implementation employs * a tail reference. * * DO NOT CHANGE THIS FILE. **/ public class SList extends List { /** * (inherited) size is the number of items in the list. * head references the first node. * tail references the last node. **/ protected SListNode head; protected SListNode tail; /* SList invariants: * 1) Either head == null and tail == null, or tail.next == null and the * SListNode referenced by tail can be reached from the head by a * sequence of zero or more "next" references. This implies that the * list is not circularly linked. * 2) The "size" field is the number of SListNodes that can be accessed * from head (including head itself) by a sequence of "next" references. * 3) For every SListNode x in an SList l, x.myList = l. **/ /** * newNode() calls the SListNode constructor. Use this method to allocate * new SListNodes rather than calling the SListNode constructor directly. * That way, only this method need be overridden if a subclass of SList * wants to use a different kind of node. * * @param item the item to store in the node. * @param next the node following this node. **/ protected SListNode newNode(Object item, SListNode next) { return new SListNode(item, this, next); } /** * SList() constructs for an empty SList. **/ public SList() { head = null; tail = null; size = 0; } /** * insertFront() inserts an item at the front of this SList. * * @param item is the item to be inserted. * * Performance: runs in O(1) time. **/ public void insertFront(Object item) { head = newNode(item, head); if (size == 0) { tail = head; } size++; } /** * insertBack() inserts an item at the back of this SList. * * @param item is the item to be inserted. * * Performance: runs in O(1) time. **/ public void insertBack(Object item) { if (head == null) { head = newNode(item, null); tail = head; } else { tail.next = newNode(item, null); tail = tail.next; } size++; } /** * front() returns the node at the front of this SList. If the SList is * empty, return an "invalid" node--a node with the property that any * attempt to use it will cause an exception. * * @return a ListNode at the front of this SList. * * Performance: runs in O(1) time. */ public ListNode front() { if (head == null) { // Create an invalid node. SListNode node = newNode(null, null); node.myList = null; return node; } else { return head; } } /** * back() returns the node at the back of this SList. If the SList is * empty, return an "invalid" node--a node with the property that any * attempt to use it will cause an exception. * * @return a ListNode at the back of this SList. * * Performance: runs in O(1) time. */ public ListNode back() { if (tail == null) { // Create an invalid node. SListNode node = newNode(null, null); node.myList = null; return node; } else { return tail; } } /** * toString() returns a String representation of this SList. * * @return a String representation of this SList. * * Performance: runs in O(n) time, where n is the length of the list. */ public String toString() { String result = "[ "; SListNode current = head; while (current != null) { result = result + current.item + " "; current = current.next; } return result + "]"; } private static void testInvalidNode(ListNode p) { System.out.println("p.isValidNode() should be false: " + p.isValidNode()); try { p.item(); System.out.println("p.item() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.item() should throw an exception, and did."); } try { p.setItem(new Integer(0)); System.out.println("p.setItem() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.setItem() should throw an exception, and did."); } try { p.next(); System.out.println("p.next() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.next() should throw an exception, and did."); } try { p.prev(); System.out.println("p.prev() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.prev() should throw an exception, and did."); } try { p.insertBefore(new Integer(1)); System.out.println("p.insertBefore() should throw an exception, but " + "didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.insertBefore() should throw an exception, and did." ); } try { p.insertAfter(new Integer(1)); System.out.println("p.insertAfter() should throw an exception, but " + "didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.insertAfter() should throw an exception, and did." ); } try { p.remove(); System.out.println("p.remove() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.remove() should throw an exception, and did."); } } private static void testEmpty() { List l = new SList(); System.out.println("An empty list should be [ ]: " + l); System.out.println("l.isEmpty() should be true: " + l.isEmpty()); System.out.println("l.length() should be 0: " + l.length()); System.out.println("Finding front node p of l."); ListNode p = l.front(); testInvalidNode(p); System.out.println("Finding back node p of l."); p = l.back(); testInvalidNode(p); l.insertFront(new Integer(10)); System.out.println("l after insertFront(10) should be [ 10 ]: " + l); } public static void main(String[] argv) { testEmpty(); List l = new SList(); l.insertFront(new Integer(3)); l.insertFront(new Integer(2)); l.insertFront(new Integer(1)); System.out.println("l is a list of 3 elements: " + l); try { ListNode n; int i = 1; for (n = l.front(); n.isValidNode(); n = n.next()) { System.out.println("n.item() should be " + i + ": " + n.item()); n.setItem(new Integer(((Integer) n.item()).intValue() * 2)); System.out.println("n.item() should be " + 2 * i + ": " + n.item()); i++; } System.out.println("After doubling all elements of l: " + l); testInvalidNode(n); i = 6; for (n = l.back(); n.isValidNode(); n = n.prev()) { System.out.println("n.item() should be " + i + ": " + n.item()); n.setItem(new Integer(((Integer) n.item()).intValue() * 2)); System.out.println("n.item() should be " + 2 * i + ": " + n.item()); i = i - 2; } System.out.println("After doubling all elements of l again: " + l); testInvalidNode(n); n = l.front().next(); System.out.println("Removing middle element (8) of l: " + n.item()); n.remove(); System.out.println("l is now: " + l); testInvalidNode(n); n = l.back(); System.out.println("Removing end element (12) of l: " + n.item()); n.remove(); System.out.println("l is now: " + l); testInvalidNode(n); n = l.front(); System.out.println("Removing first element (4) of l: " + n.item()); n.remove(); System.out.println("l is now: " + l); testInvalidNode(n); } catch (InvalidNodeException lbe) { System.err.println ("Caught InvalidNodeException that should not happen." ); System.err.println ("Aborting the testing code."); } } }
a296f8c14c9a3c3f7fe9ebabed572a9c6340a67a
711d1d123cef17b539cbb41cb703edba3a398433
/org.velzno.cakephp/src/org/velzno/cakephp/codeassist/model/ModelFindSecondParameterContext.java
0f8ce7a7643782eabdfa3f05a7a2a6ff6fb59023
[ "MIT" ]
permissive
yabeken/org.velzno
0ff4dcfd11f3c02e9049720f0485937fd75ba0d2
273bf057f24f2f0d5a8ac15476f303d1aa50ac92
refs/heads/master
2021-01-10T21:39:06.122012
2011-01-10T13:00:00
2011-01-10T13:00:00
992,938
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package org.velzno.cakephp.codeassist.model; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.eclipse.dltk.core.CompletionRequestor; import org.eclipse.dltk.core.ISourceModule; import org.eclipse.php.internal.core.codeassist.contexts.QuotesContext; /** * complete second parameter * $this->model->find('first', '[conditions]'); */ public class ModelFindSecondParameterContext extends QuotesContext{ public boolean isValid(ISourceModule sourceModule, int offset, CompletionRequestor requestor) { if (!super.isValid(sourceModule, offset, requestor)) return false; String statementText = this.getStatementText().toString(); Matcher m = Pattern.compile("(?ms)->[\\s\\r\\n]*find[\\s\\r\\n]*\\([\\s\\r\\n]*([\"\'])\\w*\\1[\\s\\r\\n]*,[\\s\\r\\n]*array[\\s\\r\\n]*\\(.*$").matcher(statementText); return m.find(); } }
fddc11d602ba4ba07c62ac911a2bc91da69c0fd9
10f657d497ac1b4c2e1a749c68d261e4618f3222
/Project3/src/MyStack.java
b779b64c5e2649fe171ec79e3ac5ee892225b5e4
[]
no_license
Cromanelli2120/Project3
b19854fb3a65c30aeac9a6dfc54177d71bc01ef7
e7ea752b2033cb23132b064b4161209aec08d769
refs/heads/master
2021-10-20T07:55:14.366844
2019-02-26T16:21:49
2019-02-26T16:21:49
172,737,278
0
0
null
null
null
null
UTF-8
Java
false
false
1,556
java
import java.util.EmptyStackException; public class MyStack<E> implements StackInterface<E> { public class Node<E> { private E data; private Node<E> next; public Node(E dataPart, Node<E> nextNode) { data = dataPart; next = nextNode; } public Node(E dataPart) { this(dataPart, null); } public E getData() { return data; } public void setData(E newEntry) { data = newEntry; } public Node<E> getNextNode(){ return next; } public void setNextNode(Node<E> nextNode) { next = nextNode; } } private int numOfEntries; private Node<E> topOfStack; @Override public void push(E newEntry) { if(isEmpty()) { Node<E> newNode = new Node(newEntry); topOfStack = newNode; } else { Node<E> newNode = new Node(newEntry, topOfStack); topOfStack = newNode; } numOfEntries++; } @Override public E pop() { if(topOfStack != null) { E result = topOfStack.getData(); topOfStack = topOfStack.getNextNode(); numOfEntries--; return result; } else throw new EmptyStackException(); } @Override public E peek() { if(topOfStack != null) { return topOfStack.getData(); } else throw new EmptyStackException(); } @Override public boolean isEmpty() { if (numOfEntries <= 0) { return true; } else return false; } @Override public void clear() { if(topOfStack != null) { topOfStack.setNextNode(null); topOfStack = null; numOfEntries = 0; } } }
afec60889f1134a121857a1aaa8493615d9a47b3
3cf815c2e9558c54a90f6adb7441bdd2d1c3c437
/Wbaht.java
4c3d89e7b3c41b8eac24890aee0f2644ba9b0303
[]
no_license
tianshubo/HtmlConvert
8dea4331b71d03fcf94c3edbeb85703d662a9a1e
b9e779f7e2be733e949a5f7d8f2d7cce4b5611b2
refs/heads/master
2020-05-16T19:03:15.374104
2019-04-25T06:00:55
2019-04-25T06:00:55
183,247,627
1
1
null
2019-04-25T02:09:43
2019-04-24T14:37:52
Java
UTF-8
Java
false
false
4,764
java
import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Properties; public class Wbaht { private static String rootDirectory; private static String htmlTemplate; private static int occupyingkey; static BufferedWriter log = null; protected static String INDEX_HEADER = "<!DOCTYPE html>\n" + "<html lang=\"en\">\n" + " <head>\n" + " <meta charset=\"GBK\">\n" + " </head>\n" + " <body>\n"; protected static String INDEX_TAIL = " </body>" + "</html>"; public static void convertHtml(String infileName) throws Exception{ HtmlConvert htmlConvert = new HtmlConvert(infileName, htmlTemplate, occupyingkey); String s = "\n" + infileName + "The file is being converted....\n"; if(htmlConvert.wbaht()) s += infileName + "Successful File Conversion\n"; else s += infileName + "File conversion failed\n"; log.write(s); } public static void listDir(String pathName) throws Exception{ BufferedWriter fp = null; File file = new File(pathName); String contentStr = INDEX_HEADER; File indexFile = new File(pathName + "/index.html"); fp = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(indexFile), "gbk")); contentStr += " <h1>Index of /"+ file.getName() + "</h1><hr>\n"; if (pathName.compareTo(rootDirectory) != 0) contentStr += " <a href=\"../index.html\">../</a><br>\n"; if (file.exists()) { File[] files = file.listFiles(); if (null == files || files.length == 0) { return; } else { List<File> fileList = new ArrayList<File>(); for (File file2 : files) fileList.add(file2); Collections.sort(fileList, new Comparator<File>(){ @Override public int compare(File file1, File file2) { // TODO Auto-generated method stub if (file1.isDirectory() && file2.isFile()) return -1; if (file1.isFile() && file2.isDirectory()) return 1; return file1.getName().compareTo(file2.getName()); } }); for (File file2 : fileList) { if (file2.isDirectory()) { contentStr += " <a href=\""+ file2.getName() +"/index.html\">" + file2.getName() +"</a><br>\n"; listDir(file2.getAbsolutePath()); } else { String str = file2.getName().split("\\.")[file2.getName().split("\\.").length - 1].toString(); if(!str.equals("html") && !str.equals("log")){ contentStr += " <a href=\""+ file2.getName().split("\\.")[0].toString() + ".html\">" + file2.getName() +"</a><br>\n"; convertHtml(file2.getAbsolutePath()); } } } } } else System.out.println("Documents do not exist!"); contentStr += INDEX_TAIL; fp.write(contentStr); fp.close(); } public static void useage(){ System.out.println("\nYou must give the program three parameters,"); System.out.println(" -t "); System.out.println(" show how many spaces before indentation"); System.out.println(" -p"); System.out.println(" where the template file is (with html suffix)"); System.out.println(" -d"); System.out.println(" which directory to be converted\n"); System.out.println(" eaxple:"); System.out.println(" java Wbaht -t 4 -p token.html -d C:\\Users\\Administrator\\Desktop\\tian"); } public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); if(args.length != 6){ System.out.println("The parameters must be six"); useage(); return; } else if(!args[0].equals("-t") || !args[2].equals("-p") || !args[4].equals("-d")){ System.out.println("Error in parameter input"); useage(); return; } occupyingkey = Integer.parseInt(args[1]); htmlTemplate = args[3]; rootDirectory = args[5]; File journalFile = new File(rootDirectory + "/journal.log"); log = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(journalFile), "gbk")); listDir(rootDirectory); log.close(); long endTime = System.currentTimeMillis(); long usedTime = (endTime-startTime)/1000; System.out.println("execution time: " + usedTime + "s"); } }
b2cb64187c3f0c1fb5b5119097c2d7c352e90ad3
fe2549cb80cd94008cfcd3cc694e336a7527431f
/NTU-Ex3_2_PolynomicalClass/src/Polynomial.java
3d17f18c31f87916fa4f4b536fd2f443cc0125e4
[]
no_license
shonessy/JAVA-Eclipse-Workspace
557b5bda904196ec73297d8e546c9c369dbb48c0
0bb720c7d1a01f3ae57adbf01843a54897fe35c6
refs/heads/master
2021-07-09T19:15:57.458067
2017-10-08T12:25:08
2017-10-08T12:25:08
106,173,681
0
0
null
null
null
null
UTF-8
Java
false
false
1,767
java
public class Polynomial { private double coeffs[]; //Constructors public Polynomial(double ...coefs){ this.coeffs=invertCoeffs(coefs); } //stepen polinoma public int getDegree(){ return coeffs.length-1; } //toString public String toString(){ String ret=""; for(int i=coeffs.length-1; i>=0; i--){ if(coeffs[i]!=0){ ret+=coeffs[i]; if(i!=0) ret+= "x^" + i + " + "; } } return ret; } //EVALUATE public double evaluate(double x){ double sum=0; for(int i=coeffs.length-1; i>=0; i--) sum+=coeffs[i]*Math.pow(x, i); return sum; } //add public Polynomial add(Polynomial right){ double sum[]=new double[Math.max(coeffs.length, right.coeffs.length)]; for(int i=0; i<Math.min(coeffs.length, right.coeffs.length); i++) sum[i]=coeffs[i]+right.coeffs[i]; if(this.coeffs.length>right.coeffs.length) for(int i=Math.min(coeffs.length, right.coeffs.length); i<this.coeffs.length; i++) sum[i]+=this.coeffs[i]; else if(right.coeffs.length>this.coeffs.length) for(int i=Math.min(coeffs.length, right.coeffs.length); i<right.coeffs.length; i++) sum[i]+=right.coeffs[i]; coeffs=sum; return this; } //multiply public Polynomial multiply(Polynomial right){ double prod[]=new double[this.getDegree()*right.getDegree()+1]; int prodInd=0; for(int i=0; i<right.coeffs.length;i++){ prodInd=i; for(int j=0; j<this.coeffs.length; j++) prod[prodInd++]+=right.coeffs[i]*this.coeffs[j]; } this.coeffs=prod; return this; } //ivertCoeffs private double[] invertCoeffs(double coeffs[]){ double temp; for(int i=0; i<coeffs.length/2; i++){ temp=coeffs[i]; coeffs[i]=coeffs[coeffs.length-1-i]; coeffs[coeffs.length-1-i]=temp; } return coeffs; } }
e3b45319eea34c3f0877e1ac3d247613a1f093e4
1aab3576db9d8293be0c4c812dd66abbe737cc75
/final-project/domain/composite-service/src/main/java/ru/otus/compositeservice/dto/BookDto.java
f364fd2630d9ff48c58860fff6b39c166bf4d385
[]
no_license
shubnikofff/otus_spring_2019_05_homework
fa33ee45fb2de8515a675291ad7cfdc35dae0244
acfe4fad5f8fc38273adb5eb5ef652e472523e1b
refs/heads/master
2022-02-10T21:50:31.287166
2020-06-01T11:37:31
2020-06-01T11:37:31
189,717,719
0
0
null
2022-01-21T23:33:01
2019-06-01T10:05:37
Java
UTF-8
Java
false
false
340
java
package ru.otus.compositeservice.dto; import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Collection; @AllArgsConstructor @Getter public class BookDto { private final String id; private final String title; private final String genre; private final Collection<String> authors; private final String owner; }
76d87d3017118f0043df3b304a72cf0d7e1c26ad
36bf98918aebe18c97381705bbd0998dd67e356f
/projects/castor-1.3.3/cpactf/src/test/java/org/castor/cpa/test/test85/KindJavaEnumSameName.java
d7d807137ec84562ffcb800a9552d4c6a2bf531d
[]
no_license
ESSeRE-Lab/qualitas.class-corpus
cb9513f115f7d9a72410b3f5a72636d14e4853ea
940f5f2cf0b3dc4bd159cbfd49d5c1ee4d06d213
refs/heads/master
2020-12-24T21:22:32.381385
2016-05-17T14:03:21
2016-05-17T14:03:21
59,008,169
2
1
null
null
null
null
UTF-8
Java
false
false
937
java
/* * Copyright 2010 Udai Gupta, Ralf Joachim * * 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.castor.cpa.test.test85; import org.junit.Ignore; @Ignore public enum KindJavaEnumSameName { //------------------------------------------------------------------------ MOUSE, KEYBOARD, COMPUTER, PRINTER, MONITOR; //------------------------------------------------------------------------ }
c235830f07d918d1feb0ce206bc42d2819438607
4a8defe6b16ed957c10c574f53220ffec87d272e
/src/main/java/com/example/demo/controller/RoleController.java
fe1bd46720fe474ae0788ff91342c0a47b8daa81
[]
no_license
19941229xz/pageDemo
02381898d69d3d2dea13626bedaee000db18e2f7
5b5c8153c5e066ed404cf80828c284cf3c82fedd
refs/heads/master
2020-04-14T23:24:45.283238
2019-04-28T01:50:00
2019-04-28T01:50:00
164,201,360
0
2
null
null
null
null
UTF-8
Java
false
false
2,238
java
package com.example.demo.controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.example.demo.common.base.BaseController; import com.example.demo.common.base.BaseReqParam; import com.example.demo.model.Role; import com.example.demo.service.RoleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @Api(value="RoleController相关api",description="角色接口详细描述信息") @RestController @RequestMapping("role") public class RoleController implements BaseController<Role>{ @Autowired private RoleService roleService; @ApiOperation(value = "查询角色的信息",notes = "在searchParam中添加角色的各种属性作为查询条件") @PostMapping("/search") @Override public Object search(@RequestBody BaseReqParam<Role> param){ return roleService.searchWithPage(param); } @ApiOperation(value = "添加角色信息",notes = "需要在addParam中添加完整角色信息") @PostMapping("/addOne") @Override public Object addOne(@RequestBody @Valid BaseReqParam<Role> param) { return roleService.addOne((Role)param.getAddParam()); } @ApiOperation(value = "根据id获取角色",notes = "只需要在searchParam中添加id") @PostMapping("/getOne") @Override public Object getOne(@RequestBody BaseReqParam<Role> param) { return roleService.getOne((Role)param.getSearchParam()); } @ApiOperation(value = "条件逻辑删除角色",notes = "只需要在deleteParam中添加 相关筛选条件") @PostMapping("/delete") @Override public Object delete(@RequestBody BaseReqParam<Role> param) { return roleService.delete((Role)param.getDeleteParam()); } @ApiOperation(value = "条件修改角色",notes = "只需要在updateParam中添加") @PostMapping("/update") @Override public Object update(@RequestBody BaseReqParam<Role> param) { return roleService.update((Role)param.getUpdateParam()); } }
[ "kumashou@xiongzhaodeair" ]
kumashou@xiongzhaodeair
c13678aa74ace6fc891176283f1f2b34830b5a94
3ba374e4c7bc8f0e063e72f548d991d27d16eec9
/src/com/javierbarciela/proyectofin/util/Foto.java
dbc14099a10caa2eeaf6154b009f1615fdc6704b
[]
no_license
javierbarci/proyectoJava
69ad513d585ea0cf5f66e6c3b6e9c764681f5185
f8cc804ee6bd1c03642b09b1a00647a2490f5d8a
refs/heads/master
2020-03-19T02:58:23.282443
2018-06-01T07:15:42
2018-06-01T07:17:16
135,681,313
0
0
null
null
null
null
UTF-8
Java
false
false
3,843
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.javierbarciela.proyectofin.util; import com.javierbarciela.proyectofin.modelo.Categoria; import com.javierbarciela.proyectofin.modelo.Producto; import com.javierbarciela.proyectofin.modelo.Usuario; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JLabel; /** * * @author pc */ public class Foto { public ImageIcon establecerFoto (String img) { ImageIcon imIc = new ImageIcon(img); Image image = imIc.getImage(); image = image.getScaledInstance(50, 50, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoFactor (String img, double factor) { ImageIcon imIc = new ImageIcon(img); Image image = imIc.getImage(); int max = (int) Math.max(imIc.getIconWidth(), imIc.getIconHeight()); double factorEscala = factor/max; int ancho = (int) (imIc.getIconWidth() * factorEscala); int alto = (int) (imIc.getIconHeight() * factorEscala); image = image.getScaledInstance(ancho, alto, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoUsuario (Usuario u) { ImageIcon imIc = new ImageIcon(u.getFoto()); Image image = imIc.getImage(); image = image.getScaledInstance(50, 50, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoUsuarioFactor (Usuario u, double factor) { ImageIcon imIc = new ImageIcon(u.getFoto()); Image image = imIc.getImage(); int max = (int) Math.max(imIc.getIconWidth(), imIc.getIconHeight()); double factorEscala = factor/max; int ancho = (int) (imIc.getIconWidth() * factorEscala); int alto = (int) (imIc.getIconHeight() * factorEscala); image = image.getScaledInstance(ancho, alto, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoProducto (Producto p) { ImageIcon imIc = new ImageIcon(p.getImagen()); Image image = imIc.getImage(); image = image.getScaledInstance(50, 50, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoProductoFactor (Producto p, double factor) { ImageIcon imIc = new ImageIcon(p.getImagen()); Image image = imIc.getImage(); int max = (int) Math.max(imIc.getIconWidth(), imIc.getIconHeight()); double factorEscala = factor/max; int ancho = (int) (imIc.getIconWidth() * factorEscala); int alto = (int) (imIc.getIconHeight() * factorEscala); image = image.getScaledInstance(ancho, alto, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoCategoria (Categoria c) { ImageIcon imIc = new ImageIcon(c.getImagen()); Image image = imIc.getImage(); image = image.getScaledInstance(50, 50, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } public ImageIcon establecerFotoCategoriaFactor (Categoria c, double factor) { ImageIcon imIc = new ImageIcon(c.getImagen()); Image image = imIc.getImage(); int max = (int) Math.max(imIc.getIconWidth(), imIc.getIconHeight()); double factorEscala = factor/max; int ancho = (int) (imIc.getIconWidth() * factorEscala); int alto = (int) (imIc.getIconHeight() * factorEscala); image = image.getScaledInstance(ancho, alto, Image.SCALE_SMOOTH); imIc.setImage(image); return imIc; } }
ca74d25e03e26a686047ee0cf2037a1c432f2384
48ae8e24dfe5a8e099eb1ce2d14c9a24f48975cc
/Product/Production/Adapters/General/CONNECTDirectConfig/src/main/java/gov/hhs/fha/nhinc/directconfig/entity/Address.java
ba74878c14d5efbcb1fd7620583ed55471974e89
[ "BSD-3-Clause" ]
permissive
CONNECT-Continuum/Continuum
f12394db3cc8b794fdfcb2cb3224e4a89f23c9d5
23acf3ea144c939905f82c59ffeff221efd9cc68
refs/heads/master
2022-12-16T15:04:50.675762
2019-09-07T16:14:08
2019-09-07T16:14:08
206,986,335
0
0
NOASSERTION
2022-12-05T23:32:14
2019-09-07T15:18:59
Java
UTF-8
Java
false
false
9,073
java
/* * Copyright (c) 2009-2019, United States Government, as represented by the Secretary of Health and Human Services. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the United States Government nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Copyright (c) 2010, NHIN Direct Project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the The NHIN Direct Project (nhindirect.org) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package gov.hhs.fha.nhinc.directconfig.entity; import gov.hhs.fha.nhinc.directconfig.entity.helpers.EntityStatus; import java.util.Calendar; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlTransient; public class Address { private String emailAddress; private Long id; private Domain domain; private String displayName; private String endpoint; private Calendar createTime; private Calendar updateTime; private EntityStatus status; private String type; /** * Construct an Address. */ public Address() { } /** * Construct an Address. * * @param aDomain The Domain. * @param anAddress The address. */ public Address(Domain aDomain, String anAddress) { setDomain(aDomain); setEmailAddress(anAddress); setDisplayName(""); setCreateTime(Calendar.getInstance()); setUpdateTime(Calendar.getInstance()); setStatus(EntityStatus.NEW); } /** * Construct an Address. * * @param aDomain The Domain. * @param anAddress The address. * @param aName The display name. */ public Address(Domain aDomain, String anAddress, String aName) { setDomain(aDomain); setEmailAddress(anAddress); setDisplayName(aName); setCreateTime(Calendar.getInstance()); setUpdateTime(Calendar.getInstance()); setStatus(EntityStatus.NEW); } /** * Construct an Address. * * @param anAddress The address. */ public Address(Address anAddress) { if (anAddress != null) { setDomain(anAddress.getDomain()); setEmailAddress(anAddress.getEmailAddress()); setDisplayName(anAddress.getDisplayName()); setEndpoint(anAddress.getEndpoint()); setCreateTime(anAddress.getCreateTime()); setUpdateTime(anAddress.getUpdateTime()); setStatus(anAddress.getStatus()); setType(anAddress.getType()); } } /** * Get the value of emailAddress. * * @return the value of emailAddress. */ public String getEmailAddress() { return emailAddress; } /** * Set the value of emailAddress. * * @param anEmail The value of emailAddress. */ public void setEmailAddress(String anEmail) { emailAddress = anEmail; } /** * Get the value of id. * * @return the value of id. */ @XmlAttribute public Long getId() { return id; } /** * Set the value of id. * * @param id The value of id. */ public void setId(Long id) { this.id = id; } /** * Get the value of domain. * * @return the value of domain. */ @XmlTransient public Domain getDomain() { return domain; } /** * Set the value of domain. * * @param anId The value of domain. */ public void setDomain(Domain anId) { domain = anId; } /** * Get the value of displayName. * * @return the value of displayName. */ public String getDisplayName() { return displayName; } /** * Set the value of displayName. * * @param aName The value of displayName. */ public void setDisplayName(String aName) { displayName = aName; } /** * Get the value of endpoint. * * @return the value of entpoint. */ public String getEndpoint() { return endpoint; } /** * Set the value of endpoint. * * @param anEndpoint The value of endpoint. */ public void setEndpoint(String anEndpoint) { endpoint = anEndpoint; } /** * Get the value of createTime. * * @return the value of createTime. */ public Calendar getCreateTime() { return createTime; } /** * Set the value of createTime. * * @param timestamp The value of createTime. */ public void setCreateTime(Calendar timestamp) { createTime = timestamp; } /** * Get the value of updateTime. * * @return the value of updateTime. */ public Calendar getUpdateTime() { return updateTime; } /** * Set the value of updateTime. * * @param timestamp The value of updateTime. */ public void setUpdateTime(Calendar timestamp) { updateTime = timestamp; } /** * Get the value of status. * * @return the value of status. */ public EntityStatus getStatus() { return status; } /** * Set the value of status. * * @param aStatus The value of status. */ public void setStatus(EntityStatus aStatus) { status = aStatus; } /** * Get the value of type. * * @return the value of type. */ public String getType() { return type; } /** * Set the value of type. * * @param aType The value of type. */ public void setType(String aType) { type = aType; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "[ID: " + getId() + " | Address: " + getEmailAddress() + " | For: " + getDisplayName() + " | Domain: " + getDomain().getDomainName() + " | Endpoint: " + getEndpoint() + " | Status: " + getStatus() + " | Type: " + getType() + "]"; } /** * Actions to run after an unmarshal. * * @param u The Unmarshaller. * @param parent The paret. */ public void afterUnmarshal(Unmarshaller u, Object parent) { setDomain((Domain) parent); } }
3096b2d78b77843affd09f4dc5a6009d1cf7dadb
508b6ffbcfd539e846b0bb8db8ffef443013db3b
/HoudahAppServer/src/com/houdah/appserver/components/Element.java
636df8bf8c67781f9299566afeb7388ef3be23b3
[]
no_license
gloubibou/houdah-webobjects-frameworks
4a377337b7dfc8b5d54080bcf531242d9e66bd5b
944428d1248bc37c403d91d1b61ea4a9ffd89ec5
refs/heads/master
2016-09-06T17:08:24.632500
2015-07-03T15:16:05
2015-07-03T15:16:05
38,498,131
0
2
null
null
null
null
UTF-8
Java
false
false
3,380
java
/* * Modified MIT License * * Copyright (c) 2006-2007 Houdah Software s.à r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * Except as contained in this notice, the name(s) of the above copyright holders * shall not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization. * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. **/ package com.houdah.appserver.components; import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WOComponent; import com.webobjects.appserver.WOContext; public abstract class Element extends Component { // Private class constants private static final String CONTROLLER_ACTION_PREFIX = "controllerAction_"; // Constructor /** * @param context * the context in which this component is instantiated */ public Element(WOContext context) { super(context); } // Public instance methods /* * (non-Javadoc) * * @see com.webobjects.appserver.WOComponent#isStateless() */ public boolean isStateless() { return true; } /** * Perform an action declared by the owning controller * * @param actionName * the name of the action to perform * @return result of the action as returned by the controller */ public WOActionResults performControllerAction(String actionName) { WOActionResults actionResults = null; WOComponent parent = parent(); if (parent instanceof Element) { actionResults = performParentAction(CONTROLLER_ACTION_PREFIX + actionName); } else { actionResults = performParentAction(actionName); } return actionResults; } /** * Lookup the owning controller. * * @return the closest parent which may assume the role of controller */ public WOComponent controller() { WOComponent parent = parent(); if (parent instanceof Element) { return ((Element) parent).controller(); } else { return parent; } } /* * (non-Javadoc) * * @see com.webobjects.appserver.WOComponent#handleQueryWithUnboundKey(java.lang.String) */ public Object handleQueryWithUnboundKey(String key) { if (key.startsWith(CONTROLLER_ACTION_PREFIX)) { return performControllerAction(key .substring(CONTROLLER_ACTION_PREFIX.length())); } else { return super.handleQueryWithUnboundKey(key); } } }
[ "houdah.frameworks@ebd34ac4-8535-0410-a6f7-ef3e7fa91fdf" ]
houdah.frameworks@ebd34ac4-8535-0410-a6f7-ef3e7fa91fdf
866673c5c0db56cfef2d56a447439afaa9f2372b
636b28156442d1999352da5d680a0c45c8b02d0f
/common-web/src/main/java/com/mcworkshop/common/web/component/form/button/InfoButtonType.java
c78330402f0a1ae83362d2cad6cb88037d1dd907
[]
no_license
markfredchen/mcworkshop
af703dd53b1a076329dd0e85b91285c8e9941153
6e7af569ed35e20d4561171d1a2d6bc5f2dd3b55
refs/heads/master
2021-01-20T12:16:56.142964
2017-06-04T14:53:17
2017-06-04T14:53:17
28,661,295
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
// Copyright 2014 MCWorkshop Inc. All rights reserved. // $Id$ package com.mcworkshop.common.web.component.form.button; /** * @author $Author$ * */ public class InfoButtonType extends ButtonType { private static final long serialVersionUID = 1L; @Override protected String getButtonType() { return "btn-info"; } }
2a4919246462b59f7a65f4d89f501d22e2508c09
c6ea1cf8e40a28152a5fb99422a7529e5c64339d
/hospitalmanegementsystem/src/interfaces/ViewTest.java
5b6ebfd7729bd45140bb07622ee19f235964b49e
[]
no_license
DarshanaWithanachchi/Hospital-Management-System
6d1424ca9e8af63f2be50596f9890d37c7372a53
52dfbedff641a38bff58b37b80b1636d3c787922
refs/heads/master
2021-05-02T06:08:14.045424
2018-02-09T03:40:32
2018-02-09T03:40:32
120,851,861
0
0
null
null
null
null
UTF-8
Java
false
false
13,320
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package interfaces; import object.TestDetails; import queries.Search_Test; /** * * @author User */ public class ViewTest extends javax.swing.JFrame { /** * Creates new form ViewTest */ public ViewTest() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); txtpatientname = new javax.swing.JTextField(); txtnicno = new javax.swing.JTextField(); txttest = new javax.swing.JTextField(); txttestdate = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); txtresult = new javax.swing.JTextArea(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtdoctorname = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtsubmit = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); txtdesicion = new javax.swing.JTextArea(); jLabel4 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Please Enter NIC No")); txtresult.setColumns(20); txtresult.setRows(5); jScrollPane1.setViewportView(txtresult); jLabel1.setText("Patient Name"); jLabel2.setText("NIC NO"); jLabel3.setText("Test No"); txtsubmit.setText("Search"); txtsubmit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtsubmitActionPerformed(evt); } }); jLabel5.setText("Test Date"); jLabel8.setText("Doctor Decission"); jLabel6.setText("Result"); txtdesicion.setColumns(20); txtdesicion.setRows(5); jScrollPane2.setViewportView(txtdesicion); jLabel4.setText("Doctor Name"); jLabel7.setText("V"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1) .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txttest) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(txttestdate, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 84, Short.MAX_VALUE))) .addComponent(txtpatientname, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtdoctorname, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(txtnicno, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtsubmit))))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtnicno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2) .addComponent(jLabel7)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtpatientname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txttest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txttestdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtdoctorname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel8) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(txtsubmit) .addGap(0, 22, Short.MAX_VALUE)))) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtsubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtsubmitActionPerformed String nic = txtnicno.getText(); Search_Test st = new Search_Test(); TestDetails td = Search_Test.sechDetails(nic); txtpatientname.setText(td.getName()); txttest.setText(td.getTestno()+""); txttestdate.setText(td.getTestdate()+""); txtresult.setText(td.getResult()); txtdoctorname.setText(td.getDocname()); txtdesicion.setText(td.getDecision()); }//GEN-LAST:event_txtsubmitActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ViewTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ViewTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ViewTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ViewTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ViewTest().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextArea txtdesicion; private javax.swing.JTextField txtdoctorname; private javax.swing.JTextField txtnicno; private javax.swing.JTextField txtpatientname; private javax.swing.JTextArea txtresult; private javax.swing.JButton txtsubmit; private javax.swing.JTextField txttest; private javax.swing.JTextField txttestdate; // End of variables declaration//GEN-END:variables }
97c052b0b887fb445fdcd994aedf725c49215bd2
65a073c609893a3f7d3be7c3aa780e1cea5ffd6d
/src/HW1/CyclesTest.java
85f298acc73478c1de8ccd613855d9ad79adda9e
[]
no_license
ShymbrykAnton/HomeworkTasks
076972b3389c57f4188f9673e3c9317d28a610bc
151790ee28b9ca7c0e68c067b7a29f02633d7042
refs/heads/master
2023-02-12T10:26:13.737558
2021-01-13T18:06:34
2021-01-13T18:06:34
321,025,845
0
0
null
null
null
null
UTF-8
Java
false
false
5,182
java
package HW1; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.stream.Stream; import static org.junit.jupiter.params.provider.Arguments.arguments; class CyclesTest { private final Cycles cycles = new Cycles(); static Stream<Arguments> getEvenSumNumberTest_NOMINAL() { return Stream.of( arguments(1, "Колличество четных чисел: " + 0 + "\nСумма четных чисел: " + 0), arguments(2, "Колличество четных чисел: " + 1 + "\nСумма четных чисел: " + 2), arguments(5, "Колличество четных чисел: " + 2 + "\nСумма четных чисел: " + 6), arguments(10, "Колличество четных чисел: " + 5 + "\nСумма четных чисел: " + 30), arguments(0, "Ваше число выходит за рамки допустимого диапазона [1-99]"), arguments(100, "Ваше число выходит за рамки допустимого диапазона [1-99]") ); } static Stream<Arguments> checkNumberIsPrimeTest_NOMINAL() { return Stream.of( arguments(2, true), arguments(7, true), arguments(31, true), arguments(30, false), arguments(0, false), arguments(-5, false) ); } static Stream<Arguments> getSquareRootTest() { return Stream.of( arguments(4, "Корень вашего числа: " + 2), arguments(9, "Корень вашего числа: " + 3), arguments(25, "Корень вашего числа: " + 5), arguments(0, "Корень вашего числа: " + 0), arguments(-4, "Число отрицательное или из него невозможно извлечь целочисленный корень"), arguments(8, "Число отрицательное или из него невозможно извлечь целочисленный корень") ); } static Stream<Arguments> getFactorialTest_NOMINAL() { return Stream.of( arguments(0, "Факториал числа " + 0 + ": " + 1), arguments(3, "Факториал числа " + 3 + ": " + 6), arguments(5, "Факториал числа " + 5 + ": " + 120), arguments(-2, "Невозможно получить факториал отрицательного числа") ); } static Stream<Arguments> getNumeralSumTest_NOMINAL() { return Stream.of( arguments(25, 7), arguments(123, 6), arguments(252550, 19), arguments(-20541, 12), arguments(10, 1), arguments(5, 5) ); } static Stream<Arguments> getReversedNumberTest_NOMINAL() { return Stream.of( arguments(123456, 654321), arguments(42321, 12324), arguments(10, 1), arguments(40, 4), arguments(5, 5), arguments(-5, 5) ); } @ParameterizedTest @MethodSource("getEvenSumNumberTest_NOMINAL") void getEvenSumNumberTest(int count, String expected) { String actual = cycles.getEvenSumNumber(count); Assertions.assertEquals(expected, actual); } @ParameterizedTest @MethodSource("checkNumberIsPrimeTest_NOMINAL") void checkNumberIsPrimeTest(int number, boolean expected) { boolean actual = cycles.checkNumberIsPrime(number); Assertions.assertEquals(expected, actual); } @ParameterizedTest @MethodSource("getSquareRootTest") void getSquareRootSequenceTest(int number, String expected) { String actual = cycles.getSquareRootSequence(number); Assertions.assertEquals(expected, actual); } @ParameterizedTest @MethodSource("getSquareRootTest") void getSquareRootBinaryTest(int number, String expected) { String actual = cycles.getSquareRootBinary(number); Assertions.assertEquals(expected, actual); } @ParameterizedTest @MethodSource("getFactorialTest_NOMINAL") void getFactorialTest(int number, String expected) { String actual = cycles.getFactorial(number); Assertions.assertEquals(expected, actual); } @ParameterizedTest @MethodSource("getNumeralSumTest_NOMINAL") void getNumeralSumTest(int number, int expected) { int actual = cycles.getNumeralSum(number); Assertions.assertEquals(expected, actual); } @ParameterizedTest @MethodSource("getReversedNumberTest_NOMINAL") void getReversedNumberTest(int number, int expected) { int actual = cycles.getReversedNumber(number); Assertions.assertEquals(expected, actual); } }
06627bd6f1140b43e27ab95ef61aea4654c49031
90531afe977d5f9f7427f34c6bd17c777fd20174
/app/src/main/java/com/example/aulalabprogiii/AdminCriarGrupo.java
6208210ba9dc366074ed920ca6890172b63b6ed9
[]
no_license
GabrielBozza/SanhagramAndroid
8585f228dd5c72876852bd9af19544a865cbfedc
2d67c0de4850f8a1db2dbb77ae9f06805c410b09
refs/heads/master
2022-11-06T00:49:52.706203
2020-06-10T19:15:02
2020-06-10T19:15:02
267,184,745
1
0
null
null
null
null
UTF-8
Java
false
false
6,698
java
package com.example.aulalabprogiii; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.util.Log; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Toast; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.JsonHttpResponseHandler; import com.loopj.android.http.RequestParams; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import cz.msebera.android.httpclient.Header; public class AdminCriarGrupo extends AppCompatActivity { List<CheckBox> usuariosGrupoCheck = new ArrayList<>(); String usuariosGrupoString=""; String PrefixoURL,nomeUSU,chaveUSU; EditText nomeNovoGrupo; Button NomeConversa, BotaoCriar; CheckBox cb; RequestParams params; AsyncHttpClient client; JSONObject json; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_admin_criar_grupo); nomeNovoGrupo = findViewById(R.id.NomeNovoGrupo); BotaoCriar = findViewById(R.id.BotaoEnviar); String resultado = getIntent().getStringExtra("ListaUsuarios"); SharedPreferences prefs = this.getSharedPreferences("USUARIO_AUTENTICADO", Context.MODE_PRIVATE); PrefixoURL = prefs.getString("PREFIXO_URL", ""); nomeUSU = prefs.getString("LOGIN", ""); chaveUSU = prefs.getString("CHAVE_USUARIO", ""); try { JSONObject response = new JSONObject(resultado); try { int raio= 35; GradientDrawable CabecalhoChat = new GradientDrawable(); CabecalhoChat.setColor(getResources().getColor(R.color.transparent)); CabecalhoChat.setShape(GradientDrawable.RECTANGLE); CabecalhoChat.setCornerRadii(new float[]{raio, raio, raio, raio, raio, raio, raio, raio}); LinearLayout layoutCabecalho = findViewById(R.id.Cabecalho); NomeConversa = new Button(this); NomeConversa.setText("Criar Grupo"); NomeConversa.setTransformationMethod(null); NomeConversa.setWidth(550); NomeConversa.setPadding(44,16,10,16); NomeConversa.setTextSize(22); NomeConversa.setBackground(CabecalhoChat); NomeConversa.setGravity(Gravity.START); NomeConversa.setClickable(false); layoutCabecalho.addView(NomeConversa); for(int i=0;i<response.getJSONArray("USUARIOS").length();i++) { String nomeUsuario = response.getJSONArray("USUARIOS").getJSONObject(i).get("nome").toString(); LinearLayout layout = findViewById(R.id.UsuariosNovoGrupo); cb = new CheckBox(getApplicationContext()); cb.setText(nomeUsuario); cb.setTextSize(20); cb.setPadding(16,16,10,16); layout.addView(cb); usuariosGrupoCheck.add(cb); } } catch (JSONException e) { e.printStackTrace(); } }catch (JSONException err){ Log.d("Error", err.toString()); } } @Override public void onBackPressed() { String URL = PrefixoURL + "/SanhagramServletsJSP/UsuarioControlador?acao=listarGrupos&dispositivo=android" + "&login=" + nomeUSU+ "&chaveUSU="+chaveUSU; client = new AsyncHttpClient(); client.get(URL, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); json = response; Intent intent = new Intent(getApplicationContext(), AdminListarGrupos.class); intent.putExtra("ListaGrupos", json.toString()); startActivity(intent); } @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); Toast.makeText(AdminCriarGrupo.this, "Erro!", Toast.LENGTH_SHORT).show(); } }); } public void CriarGrupo(View view){ String nomeGrupo = nomeNovoGrupo.getText().toString(); for (CheckBox item : usuariosGrupoCheck){ if(item.isChecked()) usuariosGrupoString+=(item.getText().toString()+"|"); } if (nomeGrupo.matches("")||usuariosGrupoString.matches("")) { Toast.makeText(this, "O Grupo não pode estar vazio e deve ter um nome!", Toast.LENGTH_SHORT).show(); return; } BotaoCriar.setClickable(false); String URLCriarGrupo = PrefixoURL + "/SanhagramServletsJSP/UsuarioControlador?acao=criarGrupo&dispositivo=android"; params = new RequestParams(); params.put("login",nomeUSU); params.put("nomeGrupo",nomeGrupo); params.put("listaNovoGrupo",usuariosGrupoString); params.put("chaveUSU",chaveUSU); client = new AsyncHttpClient(); client.post(URLCriarGrupo,params, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); Toast.makeText(AdminCriarGrupo.this, "Grupo criado com sucesso!", Toast.LENGTH_SHORT).show(); json = response; Intent intent = new Intent(getApplicationContext(), AdminListarGrupos.class); intent.putExtra("ListaGrupos", json.toString()); startActivity(intent); } @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); BotaoCriar.setClickable(true); Toast.makeText(AdminCriarGrupo.this, "Erro - Um grupo com o nome escolhido já existe, escolha outro nome!", Toast.LENGTH_SHORT).show(); } }); } }
06a4fd6c17867c8bd6fbcd06a06ba29c1c841932
b8d41f3f62f5e6d3e3c50968ba1bc753f7a282f6
/app/src/main/java/unit/entity/Evidence.java
4e055ca60e16debd9d383ad3c1d7ee3c77b3d582
[]
no_license
bearLei/5AMaster
7232e17eb6cd6634b77a7ef6cf0652bdf30f1375
cc63c5a66a000506de9590de2732a7f172cf2a74
refs/heads/master
2018-10-05T10:22:00.222284
2018-07-29T09:51:18
2018-07-29T09:51:18
110,547,708
2
1
null
null
null
null
UTF-8
Java
false
false
634
java
package unit.entity; /** * Created by lei on 2018/6/22. */ public class Evidence { private String File; private String CreateTime; private int FileType; public Evidence() { } public String getFile() { return File; } public void setFile(String file) { File = file; } public String getCreateTime() { return CreateTime; } public void setCreateTime(String createTime) { CreateTime = createTime; } public int getFileType() { return FileType; } public void setFileType(int fileType) { FileType = fileType; } }
[ "18850415334.com" ]
18850415334.com
cac8ab67f13cd3e58e617c5441489e5f761aa773
d78c04f2af7f3d25a9204d1acfd4d1dfe3f8ec2f
/src/main/java/com/firstproject/springbootdemo/Impl/schoolmsgServiceImpl.java
b41df07dcac4d46a51b05c6fdc0a1ea35ca88b9c
[]
no_license
wang-qing-lu/StudentWorkSystem
1c3f7de8ef265e7a54b7525335fdc3e30a57b62e
8fb05811afcbf1f6f98098506e4944e0c62e65aa
refs/heads/master
2020-12-01T06:37:45.231500
2020-07-02T09:29:12
2020-07-02T09:29:12
230,576,418
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package com.firstproject.springbootdemo.Impl; import com.firstproject.springbootdemo.dao.schoolmsgMapper; import com.firstproject.springbootdemo.domain.Schoolmsg; import com.firstproject.springbootdemo.service.schoolmsgService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service("schoolmsgService") public class schoolmsgServiceImpl implements schoolmsgService { @Resource private schoolmsgMapper schoolmsgMapper; @Override public List<Schoolmsg> selectAllSchoolmsg() { return schoolmsgMapper.selectAllSchoolmsg(); } @Override public Schoolmsg selectSchoolmsgByStudentname(String student_name) { return schoolmsgMapper.selectSchoolmsgByStudentname(student_name); } @Override public void updateSchoolmsg(Schoolmsg schoolmsg) { schoolmsgMapper.updateSchoolmsg(schoolmsg); } @Override public void delectSchoolmsg(String student_name) { schoolmsgMapper.delectSchoolmsg(student_name); } @Override public void insertSchoolmsg(Schoolmsg schoolmsg) { schoolmsgMapper.insertSchoolmsg(schoolmsg); } }
[ "https://github.com/wang-qing-lu/StudentWorkSystem.git" ]
https://github.com/wang-qing-lu/StudentWorkSystem.git
6b87873a9e524c28c98c253cd4e1b5ce672a3c52
ec499ed75af6a96b81d81de29719683e0cddd040
/MOVIE/src/main/java/mx/com/movie/HelloServlet.java
8015e25f1d5e585e32e12d54af49d337ce3640bb
[]
no_license
20203tn096/CRUD.peliculas
295e8e1c47ff9e7b76a1aa041a443b2304a3f040
ecd69cad6c796431565cd5787a0cdb01205a25d3
refs/heads/master
2023-06-26T16:48:50.316676
2021-07-31T00:57:27
2021-07-31T00:57:27
391,221,189
0
0
null
null
null
null
UTF-8
Java
false
false
690
java
package mx.com.movie; import java.io.*; import javax.servlet.http.*; import javax.servlet.annotation.*; @WebServlet(name = "helloServlet", value = "/hello-servlet") public class HelloServlet extends HttpServlet { private String message; public void init() { message = "Hello World!"; } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html"); // Hello PrintWriter out = response.getWriter(); out.println("<html><body>"); out.println("<h1>" + message + "</h1>"); out.println("</body></html>"); } public void destroy() { } }
a900f81ea92816ac7245918ba3de2a2b9d24b6db
da9b184c80bf896fe1de30bf87b8c69f0a4f565e
/Tasks/PersonalFinance/src/by/jwdc/finences/dao/exception/DaoUtilException.java
8cf89633f79ce83fb4a4260540027044876e85ee
[]
no_license
AlexanderYakovlev-Yassa/23_JavaST_2019
863e1405d15d584140bad68e1bde9a2103d0e3bc
a487e61344ad46ba13b76731251c9b54343a74ee
refs/heads/master
2023-03-05T03:33:17.215486
2020-01-19T21:55:24
2020-01-19T21:55:24
227,053,513
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package by.jwdc.finences.dao.exception; public class DaoUtilException extends Exception{ public DaoUtilException() { } public DaoUtilException(String message) { super(message); } public DaoUtilException(String message, Throwable cause) { super(message, cause); } public DaoUtilException(Throwable cause) { super(cause); } }
64cf792356000d2881957ad5a7ae1090562888da
8b2bfefb1e6ebffd27f7c2640e90b55cd35311d0
/src/main/java/com/bytecode/core/controllers/rest/ModeloRestController.java
4fbfeaa7f0137937a6ff798726e99c4563608c96
[]
no_license
YoooBrayan/APIRestSpringBoot
f29546f3de57738735c5d1d7c005edd61b3dd05b
7caaa73913d87bad52bb2ff9c81784612781c243
refs/heads/master
2023-01-02T12:32:16.155503
2020-10-26T03:39:02
2020-10-26T03:39:02
296,983,934
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
package com.bytecode.core.controllers.rest; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.data.web.SpringDataWebProperties; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.bytecode.core.modelo.Modelo; import com.bytecode.core.modelo.Operacion; import com.bytecode.core.modelo.common.RepBase; import com.bytecode.core.repositorio.ModeloRepositorio; @RestController @RequestMapping("/api/v1/modelo") @CrossOrigin(origins = "*", methods= {RequestMethod.GET,RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT}) public class ModeloRestController { @Autowired private ModeloRepositorio modeloRepositorio; @GetMapping public ResponseEntity<List<Modelo>> getAll(SpringDataWebProperties.Pageable pageable){ return new ResponseEntity(modeloRepositorio.getAll(pageable), HttpStatus.OK); } @GetMapping("/{id}/operaciones") public ResponseEntity<List<Operacion>> operaciones(@PathVariable int id){ return ResponseEntity.ok(modeloRepositorio.operaciones(id)); } @GetMapping("/{id}") public ResponseEntity getById(@PathVariable int id){ return new ResponseEntity<>(modeloRepositorio.getById(id), (modeloRepositorio.getById(id).equals(null)?HttpStatus.NOT_FOUND:HttpStatus.OK)); } @GetMapping("/filter/{filtro}") public ResponseEntity<List<Modelo>> getByFilter(@PathVariable String filtro){ return ResponseEntity.ok(modeloRepositorio.buscarModelos(filtro)); } @PostMapping public ResponseEntity save(@RequestBody Modelo modelo){ boolean status = modeloRepositorio.save(modelo); if(status) { return new ResponseEntity(HttpStatus.CREATED); } return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } @PutMapping public ResponseEntity update(@RequestBody Modelo modelo){ return ResponseEntity.ok(new RepBase(modeloRepositorio.update(modelo))); } @DeleteMapping("/{id}") public ResponseEntity delete(@PathVariable int id) { if(modeloRepositorio.getById(id) != null) { return ResponseEntity.ok(new RepBase(modeloRepositorio.delete(id))); }else { return new ResponseEntity(null, HttpStatus.NOT_FOUND); } } @GetMapping("/params") public ResponseEntity<Modelo> getParams(@RequestParam(name = "id") int idModelo, @RequestParam String modelo){ return ResponseEntity.ok(modeloRepositorio.getByIdAndName(idModelo, modelo)); } }
016a109276255665e1eaa5e66a544ebf922524d9
2a2aa8779211213f29831e5cbbf79b6ccc44d555
/src/main/java/com/mybank/dto/CustomerDTO.java
af06d106316c763dfb2cf9d7bf89b743ad7cac9d
[]
no_license
buna26/mybank
a5232e953a892baa76c05b69d6d20c9231b4328b
244f1468fc8e8bd6fb1116911c9275bdf0781a43
refs/heads/master
2023-01-30T15:14:56.120816
2020-12-10T16:08:55
2020-12-10T16:08:55
319,374,389
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package com.mybank.dto; public class CustomerDTO { private String name; private Integer id; private String email; private Integer age; private AddressDTO address; private AccountDTO account; public void setName(String name) { this.name = name; } public String getName(){ return name; } public void setId(Integer id){ this.id = id; } public Integer getId(){ return id; } public void setEmail(String email){ this.email = email; } public String getEmail(){ return email; } public void setAge(Integer age) { this.age = age; } public Integer getAge(){ return age; } public void setAddress(AddressDTO address){ this.address = address; } public AddressDTO getAddress(){ return address; } public void setAccount(AccountDTO account) { this.account = account; } public AccountDTO getAccount(){ return account; } }
76fcd0deadc73223d95db047120eada222c04bc9
0b5a3c1bf6dbdba599ef2c0f1036680facc25ea0
/LivroSwing/src/HeaderDemo.java
aab93561fb0544a4cbd197503dd5cc81352b8303
[]
no_license
Dantcar/ArduinoSerial
122fe5fa6d310f09127ee257f13054a4f6900a98
8cc3629122b51d1ca36c45ead99eb2170a38675d
refs/heads/master
2020-03-21T11:37:14.902736
2018-06-24T17:48:40
2018-06-24T17:48:40
138,513,180
0
0
null
null
null
null
UTF-8
Java
false
false
3,119
java
import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Rectangle; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Décio */ public class HeaderDemo extends JFrame { public HeaderDemo() { super("JScrollPane Demo"); ImageIcon ii = new ImageIcon("me.jpg"); JScrollPane jsp = new JScrollPane(new JLabel(ii)); JLabel[] corners = new JLabel[4]; for (int i = 0; i < 4; i++) { corners[i] = new JLabel(); corners[i].setBackground(Color.green); corners[i].setOpaque(true); corners[i].setBorder(BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createLineBorder(Color.red, 1))); } JLabel rowheader = new JLabel() { Font f = new Font("Serif", Font.ITALIC | Font.BOLD, 10); public void paintComponent(Graphics g) { super.paintComponent(g); Rectangle r = g.getClipBounds(); g.setFont(f); g.setColor(Color.red); for (int i = 30 - (r.y % 30); i < r.height; i += 30) { g.drawLine(0, r.y + i, 3, r.y + i); g.drawString("" + (r.y + i), 6, r.y + i + 3); } } }; rowheader.setBackground(Color.green); rowheader.setOpaque(true); JLabel columnheader = new JLabel() { Font f = new Font("Serif", Font.ITALIC | Font.BOLD, 10); public void paintComponent(Graphics g) { super.paintComponent(g); Rectangle r = g.getClipBounds(); g.setFont(f); g.setColor(Color.red); for (int i = 30 - (r.x % 30); i < r.width; i += 30) { g.drawLine(r.x + i, 0, r.x + i, 3); g.drawString("" + (r.x + i), r.x + i - 10, 16); } } }; columnheader.setBackground(Color.green); columnheader.setOpaque(true); jsp.setRowHeaderView(rowheader); jsp.setColumnHeaderView(columnheader); jsp.setCorner(JScrollPane.LOWER_LEFT_CORNER, corners[0]); jsp.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corners[1]); jsp.setCorner(JScrollPane.UPPER_LEFT_CORNER, corners[2]); jsp.setCorner(JScrollPane.UPPER_RIGHT_CORNER, corners[3]); getContentPane().add(jsp); setSize(400, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args) { new HeaderDemo(); } }
[ "decio_000@DacPc2013" ]
decio_000@DacPc2013
bfbb70d132df8132af909e19771bc565392a1d54
d8fbac738fb88d010b4046429cabfaed354f1c9b
/Android/app/src/main/java/ds/appname/arengine/arobject/BaseRenderer.java
508d33619fb284e7aecdfa00ed342fbf8e402a22
[]
no_license
dionsaputra/DevCamp2019
0d2aba8a829417a4e6e67c39052180249fa70b66
72a492a2e5a6ae38e459f6384c00b7bba491a863
refs/heads/master
2020-07-14T08:22:15.348252
2019-09-13T02:07:28
2019-09-13T02:07:28
205,282,328
0
0
null
null
null
null
UTF-8
Java
false
false
1,823
java
/* * Copyright 2016 Maxst, Inc. All Rights Reserved. */ package ds.appname.arengine.arobject; import android.opengl.Matrix; import java.nio.FloatBuffer; import java.nio.ShortBuffer; public abstract class BaseRenderer { float[] localMvpMatrix = new float[16]; float [] projectionMatrix = new float[16]; float[] modelMatrix = new float[16]; float[] translation = new float[16]; float[] scale = new float[16]; float[] rotation = new float[16]; float[] transform = new float[16]; int shaderProgramId = 0; int positionHandle; int colorHandle; int textureCoordHandle; int mvpMatrixHandle; int textureHandle; int[] textureNames; int[] textureHandles; FloatBuffer vertexBuffer; ShortBuffer indexBuffer; FloatBuffer colorBuffer; FloatBuffer textureCoordBuff; BaseRenderer() { Matrix.setIdentityM(localMvpMatrix, 0); Matrix.setIdentityM(projectionMatrix, 0); Matrix.setIdentityM(modelMatrix, 0); Matrix.setIdentityM(translation, 0); Matrix.setIdentityM(scale, 0); Matrix.setIdentityM(rotation, 0); Matrix.setIdentityM(transform, 0); } public void setProjectionMatrix(float [] projectionMatrix) { this.projectionMatrix = projectionMatrix; } public void setScale(float x, float y, float z) { Matrix.setIdentityM(scale, 0); Matrix.scaleM(scale, 0, x, y, z); } public void setTranslate(float x, float y, float z) { Matrix.setIdentityM(translation, 0); Matrix.translateM(translation, 0, x, y, z); } public void setRotation(float angle, float x, float y, float z) { Matrix.setIdentityM(rotation, 0); Matrix.rotateM(rotation, 0, angle, x, y, z); } public void setTransform(float[] transform) { System.arraycopy(transform, 0, this.transform, 0, transform.length); } public void draw() { } }
7791f4149e71c60d3ea344ba441c3cd83261241a
58e6158b41e51b39aedc1020a8e3b53624d9aeba
/game/core/src/de/dogedev/ld35/ashley/components/SizeComponent.java
60302df1f6b9c4fdf804d8dc10de8937ea7a7ba2
[]
no_license
TeamDogeDev/LD35
961dfc3136bdbb9a9b41f42c1b5a0826d4bcd066
ce4c00afbb3856d397316c9f2a68ce6a26dfc2c2
refs/heads/master
2016-09-13T06:57:55.057154
2016-04-18T21:02:20
2016-04-18T21:02:20
56,366,770
1
0
null
null
null
null
UTF-8
Java
false
false
379
java
package de.dogedev.ld35.ashley.components; import com.badlogic.ashley.core.Component; import com.badlogic.gdx.utils.Pool; /** * Created by meisterfuu on 16.04.2016. */ public class SizeComponent implements Component, Pool.Poolable { public int width = 1; public int height = 1; @Override public void reset() { width = 1; height = 1; } }
b1df0c09f93910e73628c9bda4f2a8f914b12bb2
9b5eebee1889822b275b329919904b7a87583218
/src/main/java/com/fpt/authenticationwithapi/exception/UserNotFoundException.java
2bbd7bead7aaec162ac7e7a90d50e694d659965b
[]
no_license
thongchuthanh2000/authenticationwithapi
cc4a804bca48d559227012586a0a834ea611c314
9dd0712616c4de7b6ccfd20fe75b337bcd16ade5
refs/heads/master
2023-06-03T08:41:28.345246
2021-06-18T06:15:06
2021-06-18T06:15:06
377,756,696
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.fpt.authenticationwithapi.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.NOT_FOUND) public class UserNotFoundException extends RuntimeException { public UserNotFoundException(String message) { super(message); } }
cb20960a6e54c97062afb3d9b07fdaad5da73c04
e7ad19b061b426e07c137e43f2a10c1049d084ae
/src/main/java/com/google/code/p/keytooliui/ktl/swing/button/BESTool24.java
a95075115897c6272f0af13ef3f7763b4b6ea2bc
[]
no_license
tevjef/keytool-iui
30ebb50de207807ab9458be9ac2419b11d029a24
f67762175af7192fca3a40025e10543220eeabdb
refs/heads/master
2020-03-21T03:26:19.263391
2018-06-20T15:41:52
2018-06-20T15:41:52
138,053,362
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.google.code.p.keytooliui.ktl.swing.button; final public class BESTool24 extends BESToolAbs { // -------------------- // FINAL STATIC PRIVATE final static private String _f_s_strImage = "hammer24.gif"; // ------ // PUBLIC public BESTool24(java.awt.event.ActionListener alr) { super(alr, BESTool24._f_s_strImage); } }
8c8b755c40d1828763adf2dd7f3e0bd5ca838e6d
1f904554e102b5cc393bb8b65703a5ca66dfda8e
/BaseTest/src/main/java/com/bihe0832/android/base/test/reflection/ATest.java
94604ade69bfb95d5f3eca94da2aebbb072a54d7
[ "Apache-2.0" ]
permissive
WuXiaoran/AndroidAppFactory
385e9463ac1c35620f00a0f9dc5e90320c7d40b4
7dbae2b0f3736bd8c978ab368ac64c312e8a6e62
refs/heads/master
2023-07-25T12:05:45.266483
2021-09-03T06:34:58
2021-09-03T06:34:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package com.bihe0832.android.base.test.reflection; import android.util.Log; /** * Description: Description * ATest.test1("test1test1", "", "", "", "", "", ""); * ATestProxy.a("test1test1test1"); * ATestProxy.b("test2btest2b", "test2btest2b"); * ATestProxy.c("test2btest2c", "test2btest2c"); */ public class ATest { public static void test1(final String pv_type, final String gameid, final String video_id, final String list_id, final String view_time, final String error_no, final String info) { Log.d("ATest", pv_type); } public static void test2(final String rp_type, final String gameid, final String video_id, final String list_id, final String view_time, final String first_time, final String video_time, final String error_no) { Log.d("ATest", rp_type); } public static void test3(final String login_type, final String error_no) { Log.d("ATest", login_type); } }
9617bee9c7dd9b7921f9b17ff65ca371b89b9a62
132f16ac0c3cd52046bc1e6cfbebeb911cff292b
/Java/LocateClob.java
ca1f25f74f323a7904bd7275dba095fb83db58bc
[]
no_license
SevenHe/Linux
ec942ece77fb8ca5264231a80e87ac1f09270ed0
3c2f457dc2a658b310f6c752175b7061165423b5
refs/heads/master
2021-05-22T11:24:50.820301
2020-05-29T03:03:58
2020-05-29T03:03:58
45,527,226
1
0
null
null
null
null
UTF-8
Java
false
false
2,564
java
import java.sql.*; import java.io.*; import java.util.*; import java.math.*; public class LocateClob { static { try { /**************************************************/ /* (2) Load the DB2Driver */ /**************************************************/ Class.forName ("com.ibm.db2.jcc.DB2Driver"); } catch (Exception e) { System.exit(1); } } public static void main( String args[]) throws Exception { try { String resume = null; String empnum = "000130"; int startper = 0; int startper1, startdpt = 0; PreparedStatement stmt1, stmt2, stmt3 = null; String sql1, sql2, sql3 = null; String empno, resumefmt = null; Clob resumelob = null; ResultSet rs1, rs2, rs3 = null; sql1 = "SELECT POSSTR(RESUME,'Personal') " + "FROM EMP_RESUME " + "WHERE EMPNO = ? AND RESUME_FORMAT = 'ascii' "; /* connect to the DB2 database */ Connection con = DriverManager.getConnection("jdbc:db2://localhost:9527/SAMPLE", "owner", "hechanghong1001"); stmt1 = con.prepareStatement (sql1); stmt1.setString (1, empnum); rs1 = stmt1.executeQuery(); while (rs1.next()) { startper = rs1.getInt(1); System.out.println("SQL1 Startper:" + startper); } // end while sql2 = "SELECT POSSTR(RESUME,'Department') " + "FROM EMP_RESUME " + "WHERE EMPNO = ? AND RESUME_FORMAT = 'ascii' "; stmt2 = con.prepareStatement (sql2); stmt2.setString (1, empnum); rs2 = stmt2.executeQuery(); while (rs2.next()) { startdpt = rs2.getInt(1); System.out.println("SQL2 Startdpt:" + startdpt); } // end while startper1 = startper - 1; sql3 = "SELECT EMPNO, RESUME_FORMAT, " + "SUBSTR(RESUME,1,?)|| SUBSTR(RESUME,?) AS RESUME " + "FROM EMP_RESUME " + "WHERE EMPNO = ? AND RESUME_FORMAT = 'ascii' "; stmt3 = con.prepareStatement (sql3); stmt3.setInt (1, startper1); stmt3.setInt (2, startdpt); stmt3.setString (3, empnum); rs3 = stmt3.executeQuery(); while (rs3.next()) { empno = rs3.getString(1); resumefmt = rs3.getString(2); resumelob = rs3.getClob(3); long len = resumelob.length(); int len1 = (int)len; String resumeout = resumelob.getSubString(1, len1); System.out.println("SQL3 Empno:" + empno + ", Resumefmt:" + resumefmt + ", resumeout:" + resumeout); } // end while } // End try catch (Exception e) { System.out.println ("\n " + e.getMessage()); e.printStackTrace(); System.exit(1); } } }
cc5d4a0cd99efeb60cf01a57395d0281a9b89043
8bc28620222b954bcecae7a5add97f8b3ece1f0a
/cloud/zuul/src/main/java/com/apps/cloud/zuul/rest/client/OAuth2Client.java
d391706d555195b10697990e1607f8f5bed6a860
[]
no_license
gsaukov/java-machine
0f0ce9f6d64254dea9e5da674d5c596a83a4303f
55338931cb57ed28328410091fdd0370f25c2ffe
refs/heads/master
2023-07-31T17:41:41.758729
2023-07-07T17:45:34
2023-07-07T17:45:34
176,831,520
2
1
null
null
null
null
UTF-8
Java
false
false
1,027
java
package com.apps.cloud.zuul.rest.client; import feign.Headers; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.Map; import static org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.web.bind.annotation.RequestMethod.POST; @FeignClient("justitia") public interface OAuth2Client { @RequestMapping(method = POST, value = "/oauth/token", produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_FORM_URLENCODED_VALUE) @Headers("Content-Type: application/x-www-form-urlencoded") String getToken(@RequestParam("grant_type") String grantType, @RequestParam("client_id") String clientId, @RequestBody Map<String, ?> formParams); }
89d2f26ea75a27a6b0445e20e67892b54d26da5e
5dc4786a0b3f1dd8125fc97bd76248b39352d411
/come/syntax/class07/HomeWork07.java
f715c90acf65515784305408be3c505a60142a79
[]
no_license
Awahab671/JavaBasics
a6eedbea208e79306940bcb4295ea474af6d8cba
8ef5b62ab1bc1c8f26986e7285f19a6d071bd753
refs/heads/main
2023-07-18T12:26:42.324634
2021-08-17T22:28:57
2021-08-17T22:28:57
397,406,601
0
0
null
null
null
null
UTF-8
Java
false
false
137
java
package come.syntax.class07; import java.util.Scanner; public class HomeWork07 { public static void main(String[] args) { } }