blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
listlengths
1
1
author_id
stringlengths
0
313
b1ac11c872310789e8e479daeda8dcd76cb7afef
d83c90d55c2a47158601f040a91b1913c699d7b6
/pact/server/src/main/java/com/sainsburys/pd/App.java
c1363adfe3bd4f26d56c9a6ad29cdf55914c7df3
[]
no_license
andrewflowers-sainsburys/sainsburys-pd
be2ad0b4f30b8f82a5483c08a70c583ded8886ef
daa8b164e8831c166a2739046e48a113c2ace4a3
refs/heads/master
2021-07-21T11:14:30.571503
2021-07-13T15:36:51
2021-07-13T15:36:51
252,103,344
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package com.sainsburys.pd; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } }
a2dac970da3d1d7d4a547a1e5b10996ee3ed78e9
431743556e294038f24f588251bcc5bad4896382
/src/main/java/ads_tracking/Controller/UrlController.java
477bbeca4bc10b4bcd464a437357c0b49533183d
[]
no_license
fizikovnet/ads-tracking
adae17118d37d688c5ef539f235c85d13387c786
d10d9bf06849486d82b3d9368dccf6f5c37aa6a0
refs/heads/master
2021-01-20T02:13:23.785958
2017-06-25T17:02:19
2017-06-25T17:02:19
89,393,646
1
0
null
null
null
null
UTF-8
Java
false
false
5,139
java
package ads_tracking.Controller; import ads_tracking.DAO.PostgreDAO.DAOFactory; import ads_tracking.Entity.Ad; import ads_tracking.Entity.Url; import ads_tracking.Entity.User; import ads_tracking.Exception.DAOException; import ads_tracking.Services.UrlService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; 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.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.validation.Valid; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller public class UrlController { @Autowired private DAOFactory daoFactory; @Autowired private UrlService urlService; @RequestMapping(value = "/url", method = RequestMethod.GET) public ModelAndView url(HttpSession session) { Map<String, Object> model = new HashMap<>(); User user = (User) session.getAttribute("user"); Url url = null; List<Ad> ads = new ArrayList<>(); url = daoFactory.getUrlDAO().getUrlByUserId(user.getId()); if (url != null) { ads = daoFactory.getAdsDAO().getAdsByUrlId(url.getId()); } model.put("adsCount", ads.size()); model.put("url", url); return new ModelAndView("url-info", "model", model); } @RequestMapping(value = "/validate-url", method = RequestMethod.GET) public String validateUrl(@RequestParam(value = "urlId") int urlId, HttpServletRequest request) { try { Url url = daoFactory.getUrlDAO().getById(urlId); HttpSession session = request.getSession(); session.setAttribute("validateUrl", urlService.validateUrl(url)); } catch (DAOException e) { e.printStackTrace(); } return "redirect:/url"; } @RequestMapping(value = "/redact-url", method = RequestMethod.GET) public ModelAndView showRedactUrlForm(@RequestParam(value = "id") int id) { Url url = null; try { url = daoFactory.getUrlDAO().getById(id); } catch (DAOException e) { e.printStackTrace(); } return new ModelAndView("redactUrl", "url", url); } @RequestMapping(value = "/redact-url", method = RequestMethod.POST) public String redactUrlForm(HttpSession session, @Valid Url url, BindingResult bindingResult, Model model) { if (bindingResult.hasErrors()) { return "/redact-url?id=" + url.getId(); } User user = null; try { user = daoFactory.getUserDAO().getUserByUrl(url); daoFactory.getUrlDAO().update(url); session.removeAttribute("validateUrl"); } catch (DAOException e) { e.printStackTrace(); } return "redirect:/url"; } @RequestMapping(value = "/add-url", method = RequestMethod.GET) public ModelAndView showFormForAddUrl() { Url url = new Url(); return new ModelAndView("addUrl", "url", url); } @RequestMapping(value = "/add-url", method = RequestMethod.POST) public String addUrl(HttpSession session, @Valid Url url, BindingResult bindingResult, Model model) { if (bindingResult.hasErrors()) { return "/add-url"; } try { User user = (User) session.getAttribute("user"); url.setUserId(user.getId()); daoFactory.getUrlDAO().create(url); } catch (DAOException e) { e.printStackTrace(); } return "redirect:/url"; } @RequestMapping(value = "/clean-ads", method = RequestMethod.GET) public String cleanAdsByUrl(@RequestParam(value = "id") int id) { User user = null; try { Url url = daoFactory.getUrlDAO().getById(id); user = daoFactory.getUserDAO().getUserByUrl(url); daoFactory.getAdsDAO().deleteAdsByUrl(url); } catch (DAOException e) { e.printStackTrace(); } return "redirect:/url"; } @RequestMapping(value = "/delete-url", method = RequestMethod.GET) public String deleteURL(@RequestParam(value = "id") int id) { User user = null; try { final Url url = daoFactory.getUrlDAO().getById(id); user = daoFactory.getUserDAO().getUserByUrl(url); if (url != null) { daoFactory.getUrlDAO().delete(url); new Thread(new Runnable() { @Override public void run() { daoFactory.getAdsDAO().deleteAdsByUrl(url); } }).start(); } } catch (DAOException e) { e.printStackTrace(); } return "redirect:/url"; } }
b4cb78db3c12b2c7506af33048f8bfb39db1db89
b3d727b443ee7f465f060c70cbcb1ea535d127fd
/swagger2/src/main/java/com/ydy/swagger2/config/RestTemplateConfig.java
fe798252a3a9028229dfee221d1140e8eabede4b
[]
no_license
mikeyangdy/modules
fec9e01c425c674629e8763dc768c7e89d1f232a
542a5959eb879a446b83d972eadc1562827fc58c
refs/heads/master
2023-02-01T06:36:20.899778
2020-12-14T07:46:09
2020-12-14T07:46:09
288,448,661
1
0
null
2020-08-20T08:34:37
2020-08-18T12:25:25
Java
UTF-8
Java
false
false
633
java
package com.ydy.swagger2.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.web.client.RestTemplate; import java.nio.charset.StandardCharsets; @Configuration public class RestTemplateConfig { @Bean public RestTemplate restTemplate(){ RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); return restTemplate; } }
800e5ad3e50a6b7e6a5fbf619f1a2be77244f3b3
a9de22590675be8ee38163127a2c24a20c248a0b
/src/com/iremote/infraredcode/stb/codequery/AndTian.java
411b2f154a2d1aa1a4756a7f141b9dab6236c37b
[]
no_license
jessicaallen777/iremote2
0943622300286f8d16e9bb4dca349613ffc23bb1
b27aa81785fc8bf5467a1ffcacd49a04e41f6966
refs/heads/master
2023-03-16T03:20:00.746888
2019-12-12T04:02:30
2019-12-12T04:02:30
null
0
0
null
null
null
null
GB18030
Java
false
false
1,127
java
package com.iremote.infraredcode.stb.codequery; import com.iremote.infraredcode.tv.codequery.CodeQueryBase; public class AndTian extends CodeQueryBase { @Override public String getProductor() { return "AndTian"; } @Override public String[] getQueryCodeLiberay() { return querycode; } private static String[] querycode = new String[] { //机顶盒 和田(And Tian) 1 "00e047003382358110291f291f28652821282028202865291f2a65296529202865296528202820286628652965291f29652820281f292028202820281f2965291f296529662966286528899c823b8086280000000000000000000000000000000000000000000000000000000000", //机顶盒 和田(And Tian) 2 "00e047003582338111291f281f2966281f281f29202866281f28652965291f286628662820281f296529652865291f2965291f281f281f28202820291f28652a1f2a6529652866296628899b823c8087280000000000000000000000000000000000000000000000000000000000", //机顶盒 和田(And Tian) 3 "00e047003382348110291f291f281f2966281f282028662820286529652965281f296629662865282028202866281f2865291f291f291f2820286728202866291f296629652865296529899b823c8086290000000000000000000000000000000000000000000000000000000000", }; }
6ee564392ed853c3e6acf653ea3257a980f0a0ae
42c0a019cacfe1762675da1b8aadbadbdfae548b
/src/main/java/net/jmecn/scene/Scene2D.java
26fa8cb3cf13b7c5835973b75b7cf3ea4728ba1d
[]
no_license
jmecn/JLight2d
b08063642d396570a0afbc206bafa8a8058e6a7b
b50aaa68cc8fc67ed77986868ec52b4ff975317b
refs/heads/master
2021-08-31T00:53:00.639623
2017-12-20T02:30:20
2017-12-20T02:30:20
114,624,323
1
1
null
null
null
null
UTF-8
Java
false
false
617
java
package net.jmecn.scene; public abstract class Scene2D { protected Result unionOp(Result a, Result b) { return a.sd < b.sd ? a : b; } protected Result intersectOp(Result a, Result b) { Result r = a.sd > b.sd ? b : a; r.sd = a.sd > b.sd ? a.sd : b.sd; return r; } protected Result subtractOp(Result a, Result b) { Result r = a; r.sd = (a.sd > -b.sd) ? a.sd : -b.sd; return r; } protected Result complementOp(Result a) { a.sd = -a.sd; return a; } public abstract Result scene(float x, float y); }
4621f683ff25f1e4111d11181640d2f4194acef0
39696c6d38240f0062724609bd85df2a99fe8661
/ogmissue-fixed/src/main/java/sample/data2/Module2.java
a5090d9d3ff9e83c860619226657418dfbded929
[]
no_license
takouaayari/Neo4JPOC
5741542d5c56b663653b62d7852d19ca7b6ae573
fac1e75ee4bf0cc8c501097af3061051f2b4a2cd
refs/heads/master
2021-10-24T03:25:35.973088
2019-03-21T14:20:19
2019-03-21T14:20:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package sample.data2; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.NodeEntity; /** * Created by buchgeher on 05.09.2016. */ @NodeEntity public class Module2 { @GraphId private Long id; private String name; private String version; private String guid; private String status; public Module2() { } public Module2(String name, String version) { this(); this.name = name; this.version = version; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public Long getId() { return id; } public String getGuid() { return guid; } public void setGuid(String guid) { this.guid = guid; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
2f55e0cf059980aff3156abc893c36ca56109e15
16917d6d633c9d7c9b006bb4128a5146f61b65e6
/src/main/java/org/zwobble/couscous/interpreter/values/UnitInterpreterValue.java
59792c6225121e1c359b3031a2a06aae63577ac9
[]
no_license
mwilliamson/java-couscous
c3e70e296f03263ee2210d3b6e11c6be5480427d
6d423939b255f42a3334925d7c82e81b0865b318
refs/heads/master
2020-04-12T09:06:08.503582
2018-01-28T12:06:58
2018-01-28T12:06:58
43,388,866
5
1
null
null
null
null
UTF-8
Java
false
false
1,290
java
package org.zwobble.couscous.interpreter.values; import org.zwobble.couscous.interpreter.errors.NoSuchField; import org.zwobble.couscous.interpreter.types.InterpreterType; import org.zwobble.couscous.interpreter.types.IntrinsicInterpreterType; import org.zwobble.couscous.values.PrimitiveValue; import org.zwobble.couscous.values.PrimitiveValues; import java.util.Optional; public class UnitInterpreterValue implements InterpreterValue { private static final InterpreterType TYPE = IntrinsicInterpreterType.builder(UnitInterpreterValue.class, "Unit").build(); public static final UnitInterpreterValue UNIT = new UnitInterpreterValue(); private UnitInterpreterValue() { } @Override public InterpreterType getType() { return TYPE; } @Override public Optional<PrimitiveValue> toPrimitiveValue() { return Optional.of(PrimitiveValues.UNIT); } @Override public InterpreterValue getField(String fieldName) { throw new NoSuchField(fieldName); } @Override public void setField(String fieldName, InterpreterValue value) { throw new NoSuchField(fieldName); } @java.lang.Override public java.lang.String toString() { return "UnitInterpreterValue()"; } }
0881b317fdcbc035d39570b6d339cdd5011ae7a8
3a86eef9ac6477dc0fbc4ba263f567549214ce9b
/transaction-demo/src/main/java/com/springboot/transacltional/dao/UserMapper.java
ae03d458524d42b6339179b3b0f9613186673c99
[]
no_license
Hurdmmmer/spring-boot-demo
d5da283c0ae50dfbf8eecbe0d92e20d66b00c0b1
8a9790e6155993bd8b58a9bc7b7625fc0989e635
refs/heads/master
2020-04-24T13:15:05.222399
2019-02-22T02:55:38
2019-02-22T02:55:38
171,981,133
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.springboot.transacltional.dao; import com.springboot.transacltional.entity.User; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @Repository public interface UserMapper { int insertUser(User user); User getUser(@Param("id") int id); }
fb2925c0b07b78df93bbbebdba409ec89382cc61
c2be9db873af1bcdbbc3948dc39d669463cb51dd
/banco/src/main/java/es/cedei/plexus/models/User.java
75304118dbfaf048e8007a51c9158bec95a9003a
[]
no_license
NoeSie7/Java-Plexus
561bc465c72bbc29fd36eadc3f8a348f31247a94
2612f29d8dbc9c1ef97b07c71a7082f983d67a28
refs/heads/master
2020-04-20T00:18:47.897075
2019-01-31T12:15:34
2019-01-31T12:15:34
168,519,247
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package es.cedei.plexus.models; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity // This tells Hibernate to make a table out of this class public class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; private String name; private String email; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
437ee3d3df071f5e595b40aaf936f8d1ad59d506
ec99bf182017125322c6ea40c564ba047cc90a70
/app/src/main/java/com/eric/cookbook/ui/menudetail/viewholder/TypeTitleViewHolder.java
d160297dcb2d32bfe15e94cd2a23e54dcee2cc07
[]
no_license
hcqeric/CookBook
5cd3a2b9f34fc132c6a74ff7220f9aa81c6aba1e
6965d64a8cf6eb2deb1d9e91b873516f54858813
refs/heads/master
2021-01-23T23:13:08.283577
2017-09-10T08:48:15
2017-09-10T08:48:15
102,958,944
2
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.eric.cookbook.ui.menudetail.viewholder; import android.view.View; import android.widget.TextView; import com.eric.cookbook.R; import com.eric.cookbook.bean.TitleBean; import butterknife.Bind; import butterknife.ButterKnife; /** * Created by Administrator on 2017/4/7. */ public class TypeTitleViewHolder extends TypeAbsViewHolder<TitleBean> { @Bind(R.id.rv_title_tv) TextView rv_title_tv; public TypeTitleViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } @Override public void bindViewHolder(TitleBean titleBean) { rv_title_tv.setText(titleBean.getTitle()); } }
8ef58e2c39dc547273a8e645c4722a9b7dc52721
de25bc5b567a42dde8218b295537579daa51f534
/imagepickerview/build/generated/source/buildConfig/debug/ru/vvdev/imagepickerview/BuildConfig.java
7c85581f7811a2963135e2720155662223dd21fb
[]
no_license
jorzj/ImagePickerView
8aa40832c2ebcf127303e071cdc1f4589ba7ed69
e070e80b7e44e018a1e42b990da50e106b349445
refs/heads/master
2022-04-04T01:22:32.556732
2020-02-20T11:56:30
2020-02-20T11:56:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
/** * Automatically generated file. DO NOT MODIFY */ package ru.vvdev.imagepickerview; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String LIBRARY_PACKAGE_NAME = "ru.vvdev.imagepickerview"; /** * @deprecated APPLICATION_ID is misleading in libraries. For the library package name use LIBRARY_PACKAGE_NAME */ @Deprecated public static final String APPLICATION_ID = "ru.vvdev.imagepickerview"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
12c3b7fd45daeddd652fdb4926c408b8cbfdd670
37f24afbf92e4760f5dfceedcb5289a3514179f7
/src/leetcode/easy/MergeSortedArray.java
035d0d9c9fdcc14cd6b6e48f259a265f8056c65c
[]
no_license
GY15/arithmetic
9f51b8ff4c6c8e7a040783d65f146b3d3ed333c9
c49da30b52803e03630325df000125889ef33ab9
refs/heads/master
2022-02-23T09:40:31.510870
2019-10-02T04:02:09
2019-10-02T04:02:09
109,135,702
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package leetcode.easy; public class MergeSortedArray { public void merge(int[] nums1, int m, int[] nums2, int n) { /*nums1的空间在后面,就要考虑从后往前排*/ int nums[] =new int[m+n]; int k = 0; int i=0,j=0; while(i<m&&j<n){ if (nums1[i] < nums2[j]){ nums[k++] = nums1[i++]; }else { nums[k++] = nums2[j++]; } } while(i<m){ nums[k++] = nums1[i++]; } while(j<n){ nums[k++] = nums2[j++]; } nums1 = nums; } }
e6ec8a8d70d5a1e593449fc81d62733e64e62157
60fe78bb64c3d6038972acd0652ea4fe02791bb5
/app/src/main/java/com/hc/hcppjoke/view/RecordView.java
2fb28bcc2106609da883269ba84f346823c22761
[]
no_license
hcgrady2/hcjoke
95c9c3d0f39c88905ddbf08bff6e7f4fcb6b9f1e
a65f9dfde789782ec44862dcafb1db468da06160
refs/heads/master
2023-07-03T03:06:35.289488
2021-08-06T06:31:44
2021-08-06T06:31:44
267,067,312
0
0
null
null
null
null
UTF-8
Java
false
false
5,589
java
package com.hc.hcppjoke.view; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import androidx.annotation.Nullable; import com.hc.hcppjoke.R; import com.hc.libcommon.utils.PixUtils; public class RecordView extends View implements View.OnLongClickListener, View.OnClickListener { private static final int PROGRESS_INTERVAL = 100; private final Paint fillPaint; private final Paint progressPaint; private int progressMaxValue; private final int radius; private final int progressWidth; private final int progressColor; private final int fillColor; private final int maxDuration; private int progressValue; private boolean isRecording; private long startRecordTime; private onRecordListener mListener; public RecordView(Context context) { this(context, null); } public RecordView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public RecordView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { this(context, attrs, defStyleAttr, 0); } public RecordView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RecordView, defStyleAttr, defStyleRes); radius = typedArray.getDimensionPixelOffset(R.styleable.RecordView_radius, 0); progressWidth = typedArray.getDimensionPixelOffset(R.styleable.RecordView_progress_width, PixUtils.dp2px(3)); progressColor = typedArray.getColor(R.styleable.RecordView_progress_color, Color.RED); fillColor = typedArray.getColor(R.styleable.RecordView_fill_color, Color.WHITE); maxDuration = typedArray.getInteger(R.styleable.RecordView_duration, 10); setMaxDuration(maxDuration); typedArray.recycle(); fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG); fillPaint.setColor(fillColor); fillPaint.setStyle(Paint.Style.FILL); progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG); progressPaint.setColor(progressColor); progressPaint.setStyle(Paint.Style.STROKE); progressPaint.setStrokeWidth(progressWidth); Handler handler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { super.handleMessage(msg); progressValue++; postInvalidate(); if (progressValue <= progressMaxValue) { sendEmptyMessageDelayed(0, PROGRESS_INTERVAL); } else { finishRecord(); } } }; setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { isRecording = true; startRecordTime = System.currentTimeMillis(); handler.sendEmptyMessage(0); } else if (event.getAction() == MotionEvent.ACTION_UP) { long now = System.currentTimeMillis(); if (now - startRecordTime > ViewConfiguration.getLongPressTimeout()) { finishRecord(); } handler.removeCallbacksAndMessages(null); isRecording = false; startRecordTime = 0; progressValue = 0; postInvalidate(); } return false; } }); setOnClickListener(this); setOnLongClickListener(this); } private void finishRecord() { if (mListener != null) { mListener.onFinish(); } } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int width = getWidth(); int height = getHeight(); if (isRecording) { canvas.drawCircle(width / 2, height / 2, width / 2, fillPaint); int left = progressWidth / 2; int top = progressWidth / 2; int right = width - progressWidth / 2; int bottom = height - progressWidth / 2; float sweepAngle = (progressValue * 1.0f / progressMaxValue) * 360; canvas.drawArc(left, top, right, bottom, -90, sweepAngle, false, progressPaint); } else { canvas.drawCircle(width / 2, height / 2, radius, fillPaint); } } public void setMaxDuration(int maxDuration) { this.progressMaxValue = maxDuration * 1000 / PROGRESS_INTERVAL; } public void setOnRecordListener(onRecordListener listener) { mListener = listener; } @Override public boolean onLongClick(View v) { if (mListener != null) { mListener.onLongClick(); } return true; } @Override public void onClick(View v) { if (mListener != null) { mListener.onClick(); } } public interface onRecordListener { void onClick(); void onLongClick(); void onFinish(); } }
4497535aa0349cf427f4d27f3e571bac5a807797
41788688ad1ff974cc3ab52019a829e2bab0b560
/src/main/java/projet/Customer.java
cb82e26c01d3871ff1fff25ad463127c7d6ef285
[]
no_license
nsgln/Projet_BD_M1_S2
10f471da680a6ffd1edc76ca4974836df93eab8f
9e84cddb6d8f5acd05421cde0132227fdb836872
refs/heads/master
2022-09-23T17:20:38.009307
2020-06-01T21:16:26
2020-06-01T21:16:26
263,624,271
0
0
null
null
null
null
UTF-8
Java
false
false
4,983
java
package projet; import com.arangodb.ArangoDB; import com.arangodb.ArangoDBException; import com.arangodb.entity.BaseDocument; import com.arangodb.entity.CollectionEntity; import java.io.*; import org.json.JSONException; public class Customer { public static void main(final String[] args) { ArangoDB arangoDB = new ArangoDB.Builder().build(); //Create database, if is not existing String dbName = "projet"; String collectionName = "customer"; try { arangoDB.createDatabase(dbName); System.out.println("Database created: " + dbName); } catch (ArangoDBException e) { System.err.println("Failed to create database: " + dbName + "; " + e.getMessage()); } //Create the collection if is not existing try { CollectionEntity customerCollection = arangoDB.db(dbName).createCollection(collectionName); System.out.println("Collection created: " + customerCollection.getName()); } catch (ArangoDBException arangoDBException) { System.err.println("Failed to create collection: " + collectionName + "; " + arangoDBException.getMessage()); } File customersFile = new File("Data/Customer/person_0_0.csv"); File customerFileJSON = new File("Data/Customer/customer.json"); if(!customerFileJSON.exists()) { try { BufferedReader reader = new BufferedReader(new FileReader(customersFile)); String attribute = reader.readLine(); String line = reader.readLine(); System.out.println("**********CONVERSION EN COURS**********"); while (line != null) { TransformFalseCSVToJSON.writeJSON(TransformFalseCSVToJSON.jsonTransformation(attribute, line), customerFileJSON); line = reader.readLine(); } reader.close(); } catch (FileNotFoundException notFoundException) { notFoundException.printStackTrace(); } catch (IOException ioException) { ioException.printStackTrace(); } catch (JSONException jsonException) { jsonException.printStackTrace(); } } try { ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.directory(new File("Data/Customer")); processBuilder.command("cmd.exe", "/c", "arangoimport --file \"customer.json\" --type json --collection \"customer\" --server.database \"projet\" --server.password \"\""); Process process = processBuilder.start(); StringBuilder output = new StringBuilder(); BufferedReader readerProcess = new BufferedReader( new InputStreamReader(process.getInputStream())); String line; while ((line = readerProcess.readLine()) != null) { output.append(line + "\n"); } readerProcess.close(); int exitVal = process.waitFor(); if (exitVal == 0) { System.out.println(output); System.out.println("Success!"); } else { System.out.println("Trouble"); } //Mise à jour des données en Java. //Insertion d'un nouveau document! BaseDocument toAdd = new BaseDocument(); toAdd.addAttribute("id", "789098"); toAdd.setKey("789098"); toAdd.addAttribute("firstName", "Nina"); toAdd.addAttribute("lastName", "Singlan"); toAdd.addAttribute("gender", "female"); toAdd.addAttribute("birthday", "1998-02-09"); toAdd.addAttribute("creationDate", "2020-05-31T22:43:26.134+0000"); toAdd.addAttribute("locationIP", "192.160.128.234"); toAdd.addAttribute("browserUsed", "Chrome"); toAdd.addAttribute("place", 611); arangoDB.db(dbName).collection(collectionName).insertDocument(toAdd); System.out.println("Document inserted"); String keyOfObject = toAdd.getKey(); //Modification BaseDocument toUpdate = arangoDB.db(dbName).collection(collectionName).getDocument(keyOfObject, BaseDocument.class); toUpdate.updateAttribute("firstName", "Renée"); System.out.println("Document modified"); //Suppression. arangoDB.db(dbName).collection(collectionName).deleteDocument(keyOfObject); //Insertion d'un nouveau document! BaseDocument otherToAdd = new BaseDocument(); toAdd.addAttribute("id", "789078"); toAdd.setKey("789078"); toAdd.addAttribute("firstName", "Romain"); toAdd.addAttribute("lastName", "Michelucci"); toAdd.addAttribute("gender", "male"); toAdd.addAttribute("birthday", "1997-08-01"); toAdd.addAttribute("creationDate", "2020-05-29T22:43:22.134+0000"); toAdd.addAttribute("locationIP", "192.160.121.234"); toAdd.addAttribute("browserUsed", "Firefox"); toAdd.addAttribute("place", 802); arangoDB.db(dbName).collection(collectionName).insertDocument(toAdd); System.out.println("Document inserted"); String otherKeyOfObject = toAdd.getKey(); //Modification BaseDocument otherToUpdate = arangoDB.db(dbName).collection(collectionName).getDocument(otherKeyOfObject, BaseDocument.class); toUpdate.updateAttribute("place", 301); System.out.println("Document modified"); System.exit(0); } catch (InterruptedException interruptedException) { interruptedException.printStackTrace(); } catch (IOException ioException) { ioException.printStackTrace(); } } }
fcab5334cb8c3df26f67f387122e2da68e4b2ac9
eadba1fff7a4e4820bf032fc6a76fd3aeb116977
/jasync-core/src/main/java/io/github/vipcxj/jasync/core/javac/visitor/ExtractMethodScanner.java
7e359c1bb601fdbe187ff033e3f05da47c5295dd
[ "Apache-2.0" ]
permissive
iCodeIN/jasync
abc5496ca6636cb9f92cc5d65b4ecde5a3b59c85
c7729f032a84ad62e212dba34208599edd4b8ea1
refs/heads/master
2023-08-07T07:27:56.247069
2021-09-20T19:49:41
2021-09-20T19:49:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,610
java
package io.github.vipcxj.jasync.core.javac.visitor; import com.sun.source.tree.LineMap; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.util.List; import io.github.vipcxj.jasync.core.javac.model.VarKey; import javax.lang.model.element.ElementKind; import java.util.HashMap; import java.util.Map; public class ExtractMethodScanner extends TreeScanner { private final ExtractMethodContext extractMethodContext; public ExtractMethodScanner(LineMap lineMap) { this.extractMethodContext = new ExtractMethodContext(lineMap); } public ExtractMethodScanner(ExtractMethodContext extractMethodContext) { this.extractMethodContext = extractMethodContext; } @Override public void visitVarDef(JCTree.JCVariableDecl tree) { extractMethodContext.localDeclMap.put(new VarKey(tree.sym), tree); super.visitVarDef(tree); } @Override public void visitIdent(JCTree.JCIdent tree) { if (tree.sym instanceof Symbol.VarSymbol) { Symbol.VarSymbol varSymbol = (Symbol.VarSymbol) tree.sym; if (!extractMethodContext.localDeclMap.containsKey(new VarKey(varSymbol))) { if (varSymbol.getKind() == ElementKind.LOCAL_VARIABLE || varSymbol.getKind() == ElementKind.PARAMETER || varSymbol.getKind() == ElementKind.EXCEPTION_PARAMETER || varSymbol.getKind() == ElementKind.RESOURCE_VARIABLE ) { extractMethodContext.addCapturedVar(tree); } } } } public static ExtractMethodContext scanStatements(LineMap lineMap, List<JCTree.JCStatement> statements) { ExtractMethodContext extractMethodContext = new ExtractMethodContext(lineMap); for (JCTree.JCStatement statement : statements) { statement.accept(new ExtractMethodScanner(extractMethodContext)); } return extractMethodContext; } public static class ExtractMethodContext { private final LineMap lineMap; private final Map<VarKey, JCTree.JCVariableDecl> localDeclMap; private final Map<VarKey, List<JCTree.JCIdent>>capturedVarMap; public ExtractMethodContext(LineMap lineMap) { this.lineMap = lineMap; this.localDeclMap = new HashMap<>(); this.capturedVarMap = new HashMap<>(); } private void addCapturedVar(JCTree.JCIdent ident) { Symbol.VarSymbol sym = (Symbol.VarSymbol) ident.sym; VarKey key = new VarKey(sym); List<JCTree.JCIdent> idents = capturedVarMap.get(key); if (idents == null) { idents = List.of(ident); } else { idents = idents.prepend(ident); } capturedVarMap.put(key, idents); } public void printCaptured() { for (Map.Entry<VarKey, List<JCTree.JCIdent>> entry : capturedVarMap.entrySet()) { System.out.print("Captured " + entry.getKey().getName() + " at "); int i = 0; for (JCTree.JCIdent ident : entry.getValue()) { System.out.print("[" + lineMap.getLineNumber(ident.pos) + ", " + lineMap.getColumnNumber(ident.pos) + "]"); if (++i != entry.getValue().size()) { System.out.print(", "); } } System.out.println("."); } } } }
4047ceb8988ef552d88b3628b7cf4b2a9936759a
0ca0c6b888de09e20ad2f2fc0ca24b4ddeef7dab
/AppleJump/src/at/shaderapfel/AppleJump/Utils/LobbyCountdown.java
7db0621bfec93e8e7ca04a93d4bb35ca15cd9fb7
[]
no_license
ShaderApfel/AppleJump
b8a325b800c256f4eeb837cc4f70ef08eaac56ad
6d0502ab31def8fed9c49c4d22bb3441de81fdb3
refs/heads/master
2020-12-03T08:50:43.395371
2016-08-28T22:25:49
2016-08-28T22:25:49
66,793,613
0
0
null
null
null
null
UTF-8
Java
false
false
2,116
java
package at.shaderapfel.AppleJump.Utils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Player; import at.shaderapfel.AppleJump.main.Main; public class LobbyCountdown { private static int sched; public static void start() { if (Bukkit.getOnlinePlayers().size() == 2) { Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() { int count = 30; @Override public void run() { if (count <= 0) { int playerno = 1; for (Player all : Bukkit.getOnlinePlayers()) { all.sendMessage(Main.prefix + "§aDas Spiel startet nun!"); all.playSound(all.getLocation(), Sound.NOTE_PLING, 3, 1); all.teleport((Location)Main.getInstance().getConfig().get("location.spawn."+playerno)); playerno++; Main.inJump = true; ActionBar.sendActionBar(all, "§aDas Spiel startet nun!"); Bukkit.getScheduler().cancelAllTasks(); } } else if (count == 60 || count == 50 || count == 40 || count == 30 || count == 20 || count == 10 || count == 5 || count == 4 || count == 3 || count == 2) { for (Player all : Bukkit.getOnlinePlayers()) { all.sendMessage(Main.prefix + "Das Spiel startet in §6" + count + " §7Sekunden!"); ActionBar.sendActionBar(all, "§7Das Spiel startet in §6" + count + " §7Sekunden!"); all.playSound(all.getLocation(), Sound.NOTE_PLING, 3, 1); } } else if (count == 1) { for (Player all : Bukkit.getOnlinePlayers()) { all.sendMessage(Main.prefix + "Das Spiel startet in §6" + count + " §7Sekunde!"); ActionBar.sendActionBar(all, "§7Das Spiel startet in §6" + count + " §7Sekunde!"); all.playSound(all.getLocation(), Sound.NOTE_PLING, 3, 1); } } count--; } }, 20, 20); } } public static void stop() { if (Bukkit.getOnlinePlayers().size() == 1) { Bukkit.broadcastMessage(Main.prefix+"§cDer Countdown wurde abgebrochen!"); Bukkit.getScheduler().cancelTask(sched); } } }
6df14ad52f6ddafd3fbe371b29482e4718fceea5
41a51ae9ea655fbf6397457133fc4c4c95f0d5f0
/SrpingMVCJPADemo/src/main/java/com/fullstack/employee/entity/Employee.java
7126e6db73565c73708b417df14c69388a3c6214
[]
no_license
gudurugiri/FullstackDeveloper_practice
24df2e5160f9786257f355e993be78e2ffe50be2
d2d522a6e0eccb8d545ecf93dca3a96a4c197f14
refs/heads/master
2021-08-23T11:51:09.586025
2017-12-04T19:56:34
2017-12-04T19:56:34
113,081,425
0
0
null
null
null
null
UTF-8
Java
false
false
2,006
java
/** * */ package com.fullstack.employee.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * *@author BUJAIR * */ @Entity @Table(name = "EMPLOYEE") public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "NAME") private String name; @Column(name = "EMAIL") private String email; @Column(name = "ADDRESS") private String address; @Column(name = "TELEPHONE") private String telephone; public Employee() { } public Employee(String name, String email, String address, String telephone) { this.name = name; this.email = email; this.address = address; this.telephone = telephone; } /** * @return the id */ public Long getId() { return id; } /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name * the name to set */ public void setName(String name) { this.name = name; } /** * @return the email */ public String getEmail() { return email; } /** * @param email * the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the address */ public String getAddress() { return address; } /** * @param address * the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the telephone */ public String getTelephone() { return telephone; } /** * @param telephone * the telephone to set */ public void setTelephone(String telephone) { this.telephone = telephone; } @Override public String toString() { return "[" + id + ", " + name + ", " + email + " ," + address + ", " + telephone + "]"; } }
83485833712e83ff1b12a77db21992b0079ce593
0e58001e71910b319be8edec757c18c25560db5f
/app/src/main/java/com/will/androidfeeds/droidyue/list/DroidYueAdapter.java
86b1adae430fa8e6bf7f3aa475d8c8530a96b2ca
[]
no_license
YuanWenHai/AndroidFeeds
179d74c711767bd4658a691fed045012c22c4630
e60fa5b8acb3d99fc8903f8ab39d4a33de6f3e2b
refs/heads/master
2021-01-20T17:53:42.206804
2016-08-11T13:53:44
2016-08-11T13:53:44
63,119,281
0
0
null
null
null
null
UTF-8
Java
false
false
3,557
java
package com.will.androidfeeds.droidyue.list; import android.content.Context; import android.content.Intent; import android.text.Html; import com.will.androidfeeds.R; import com.will.androidfeeds.bean.DroidYueItem; import com.will.androidfeeds.common.ErrorCode; import com.will.androidfeeds.customAdapter.BaseRecyclerViewHolder; import com.will.androidfeeds.customAdapter.CustomRecyclerAdapter; import com.will.androidfeeds.droidyue.content.DroidYueContentActivity; import com.will.androidfeeds.util.JsoupHelper; import com.will.androidfeeds.util.NetworkHelper; import java.util.List; /** * Created by Will on 2016/7/20. */ public class DroidYueAdapter extends CustomRecyclerAdapter<DroidYueItem> { private static final String HOST = "http://droidyue.com"; private static final String SURFFIX = "/blog/page/"; private boolean hasMoreItem = true; private NetworkHelper networkHelper = NetworkHelper.getInstance(); public DroidYueAdapter(){ super(R.layout.hukai_list_item,R.layout.list_loading_view,R.layout.list_loading_failed_view); setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClicked(Object item) { DroidYueItem droidYueItem = (DroidYueItem) item; Context mContext = getRecyclerView().getContext(); Intent intent = new Intent(mContext, DroidYueContentActivity.class); intent.putExtra("url",droidYueItem.getLink()); intent.putExtra("title",droidYueItem.getTitle()); mContext.startActivity(intent); } }); } public void onRefresh(final OnRefreshCallback callback){ networkHelper.loadWebSource(HOST, false, true, new NetworkHelper.LoadWebSourceCallback() { @Override public void onSuccess(String source) { List<DroidYueItem> list = JsoupHelper.getDroidYueItemFromSource(source); hasMoreItem = list.size() == 9; refreshData(list); callback.onSuccess(); } @Override public void onFailure(ErrorCode code) { callback.onFailure(code); } }); } @Override public void convert(BaseRecyclerViewHolder holder, DroidYueItem item) { holder.setText(R.id.hukai_item_time,item.getTime()) .setText(R.id.hukai_item_title,item.getTitle()) .setText(R.id.hukai_item_preview, Html.fromHtml(item.getPreview())); } @Override public void loadData(int page) { String url = HOST; boolean cachePolicy = false; if(page == 1){ cachePolicy = true; }else{ url = HOST + SURFFIX + page; } networkHelper.loadWebSource(url, cachePolicy, cachePolicy, new NetworkHelper.LoadWebSourceCallback() { @Override public void onSuccess(String source) { List<DroidYueItem> list = JsoupHelper.getDroidYueItemFromSource(source); hasMoreItem = list.size() == 9; update(true,list); } @Override public void onFailure(ErrorCode code) { getRecyclerView().postDelayed(new Runnable() { @Override public void run() { update(false); } },500); } }); } @Override public boolean hasMoreData() { return hasMoreItem; } }
2eed0342781d69a2d390558cc123857fe19c46ee
3f9867f0e4f85c683366863e6d09d4f8198ae6cc
/src/main/java/org/hibernatespatial/mgeom/MCoordinate.java
aa60b53d29d4c358abba8abdfc5a4e9c33da065e
[]
no_license
igoraguiar/hibernate-spatial
9a9f02dce1da1272f20f0f412a7cf070575ba22d
a874e8e4955f9f819a95230437204a7c42f5bfd1
refs/heads/master
2021-01-19T15:01:41.108414
2011-06-22T09:49:33
2011-06-22T09:49:33
1,995,873
1
0
null
null
null
null
UTF-8
Java
false
false
8,277
java
/** * $Id$ * * This file is part of Hibernate Spatial, an extension to the * hibernate ORM solution for geographic data. * * Copyright © 2007 Geovise BVBA * Copyright © 2007 K.U. Leuven LRD, Spatial Applications Division, Belgium * * This work was partially supported by the European Commission, * under the 6th Framework Programme, contract IST-2-004688-STP. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * For more information, visit: http://www.hibernatespatial.org/ */ package org.hibernatespatial.mgeom; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; /** * This coordinate class supports 4D coordinates, where the first 3 measures * (x,y,z) are coordinates in a 3 dimensional space (cartesian for example), and * the fourth is a measure value used for linear referencing. Note that the * measure value is independent of whether the (x,y,z) values are used. For * example, the z value can not be used while the measure value is used. <p/> * While this class extends the Coordinate class, it can be used seamlessly as a * substitute in the event that the Measure value is not used. In these cases * the Measure value shall simply be Double.NaN * * @see com.vividsolutions.jts.geom.Coordinate */ public class MCoordinate extends Coordinate { /** * */ private static final long serialVersionUID = 1L; public double m; /** * Default constructor */ public MCoordinate() { super(); this.m = Double.NaN; } public MCoordinate(double x, double y, double z, double m) { super(x, y, z); this.m = m; } public MCoordinate(double x, double y) { super(x, y); m = Double.NaN; } public MCoordinate(Coordinate coord) { super(coord); if (coord instanceof MCoordinate) m = ((MCoordinate) coord).m; else m = Double.NaN; } public MCoordinate(MCoordinate coord) { super(coord); m = coord.m; } /** * TODO: I'd like to see this method added to the base Coordinate class * Returns the ordinate value specified in this Coordinate instance. The * index of the desired ordinates are specified in the CoordinateSequence * class; hence CoodinateSequence.X returns the x ordinate, * CoodinateSequence.Y the y ordinate, CoodinateSequence.Z the z ordinate, * and CoodinateSequence.M the m ordinate. Note that the dimension may not * imply the desired ordinate in the case where one is using a 2 dimensional * geometry with a measure value. Therefore, these constants are highly * recommended. * * @param ordinateIndex * the desired ordinate index. * @return the value of stored in the ordinate index. Incorrect or unused * indexes shall return Double.NaN */ public double getOrdinate(int ordinateIndex) { switch (ordinateIndex) { case CoordinateSequence.X: return this.x; case CoordinateSequence.Y: return this.y; case CoordinateSequence.Z: return this.z; case CoordinateSequence.M: return this.m; } return Double.NaN; } /** * TODO: I'd like to see this method added to the base Coordinate class Sets * the value for a given ordinate. This should be specified using the * CoordinateSequence ordinate index constants. * * @param ordinateIndex * the desired ordinate index. * @param value * the new ordinate value * @throws IllegalArgumentException * if the ordinateIndex value is incorrect * @see #getOrdinate(int) */ public void setOrdinate(int ordinateIndex, double value) { switch (ordinateIndex) { case CoordinateSequence.X: this.x = value; break; case CoordinateSequence.Y: this.y = value; break; case CoordinateSequence.Z: this.z = value; break; case CoordinateSequence.M: this.m = value; break; default: throw new IllegalArgumentException("invalid ordinateIndex"); } } public boolean equals2DWithMeasure(Coordinate other) { boolean result = this.equals2D(other); if (result) { MCoordinate mc = convertCoordinate(other); result = (Double.compare(this.m, mc.m) == 0); } return result; } public boolean equals3DWithMeasure(Coordinate other) { boolean result = this.equals3D(other); if (result) { MCoordinate mc = convertCoordinate(other); result = (Double.compare(this.m, mc.m) == 0); } return result; } /* * Default equality is now equality in 2D-plane. This is required to remain * consistent with JTS. * * TODO:check whether this method is still needed. * * (non-Javadoc) * * @see com.vividsolutions.jts.geom.Coordinate#equals(java.lang.Object) */ public boolean equals(Object other) { if (other instanceof Coordinate) { return equals2D((Coordinate) other); } else { return false; } } public String toString() { return "(" + x + "," + y + "," + z + "," + " m=" + m + ")"; } /** * Converts a standard Coordinate instance to an MCoordinate instance. If * coordinate is already an instance of an MCoordinate, then it is simply * returned. In cases where it is converted, the measure value of the * coordinate is initialized to Double.NaN. * * @param coordinate * The coordinate to be converted * @return an instance of MCoordinate corresponding to the * <code>coordinate</code> parameter */ public static MCoordinate convertCoordinate(Coordinate coordinate) { if (coordinate == null) return null; if (coordinate instanceof MCoordinate) return (MCoordinate) coordinate; return new MCoordinate(coordinate); } /** * A convenience method for creating a MCoordinate instance where there are * only 2 coordinates and an lrs measure value. The z value of the * coordinate shall be set to Double.NaN * * @param x * the x coordinate value * @param y * the y coordinate value * @param m * the lrs measure value * @return The constructed MCoordinate value */ public static MCoordinate create2dWithMeasure(double x, double y, double m) { return new MCoordinate(x, y, Double.NaN, m); } /** * A convenience method for creating a MCoordinate instance where there are * only 2 coordinates and an lrs measure value. The z and m value of the * coordinate shall be set to Double.NaN * * @param x * the x coordinate value * @param y * the y coordinate value * @return The constructed MCoordinate value */ public static MCoordinate create2d(double x, double y) { return new MCoordinate(x, y, Double.NaN, Double.NaN); } /** * A convenience method for creating a MCoordinate instance where there are * 3 coordinates and an lrs measure value. * * @param x * the x coordinate value * @param y * the y coordinate value * @param z * the z coordinate value * @param m * the lrs measure value * @return The constructed MCoordinate value */ public static MCoordinate create3dWithMeasure(double x, double y, double z, double m) { return new MCoordinate(x, y, z, m); } /** * A convenience method for creating a MCoordinate instance where there are * 3 coordinates but no lrs measure value. The m value of the coordinate * shall be set to Double.NaN * * @param x * the x coordinate value * @param y * the y coordinate value * @param z * the z coordinate value * @return The constructed MCoordinate value */ public static MCoordinate create3d(double x, double y, double z) { return new MCoordinate(x, y, z, Double.NaN); } }
a72de9349187e3dfd4cf4754507b58d2bf4f05fd
27077cefd8d98a51ffa91d2085e3a389d22c77d9
/src/main/java/com/sanvi/dto/Employee.java
1100d2885af602990c2e2ee5526388724f766d4c
[]
no_license
JagapathiRaju/Spring-boots
4d3c1b1d44eb8d0e91090239cd3ffbabbd34aa78
073de8822f9b2fce79f4c6b495ce2cb3a96f751a
refs/heads/master
2021-01-01T15:42:14.550629
2017-07-19T10:07:42
2017-07-19T10:07:42
97,676,563
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package com.sanvi.dto; /** * Created by jagapathiraju on 19/07/17. */ public class Employee { private Integer age; private String name; private String gender; public Employee() { } public Employee(Integer age, String name, String gender) { this.age=age; this.name=name; this.gender=gender; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
ab091b29d4087607155490349b71cdd33632d927
60339d6cbfd3cb9b049df5ee3591bc82e533fa05
/LeetcodeJava/src/strings/RotateString.java
e83474767cfe72e1d690a9b5a01a5f816fe5cf5e
[]
no_license
xuetingandyang/leetcode
09551e0c53599679df42e2915309aec482c962ae
e1a4c1bc5d01b4e2ba51a5255deed6426557dcb0
refs/heads/master
2020-12-02T10:47:21.234742
2020-10-07T01:14:05
2020-10-07T01:14:05
230,986,809
3
1
null
null
null
null
UTF-8
Java
false
false
1,131
java
package strings; //Rotate String //Given a string and an offset, rotate string by offset. (rotate from left to right) //Given "abcdefg". //offset=0 => "abcdefg" //offset=1 => "gabcdef" //offset=2 => "fgabcde" //offset=3 => "efgabcd" // //Challenge //Rotate in-place with O(1) extra memory. // 3-step rotate public class RotateString { private static void reverse(char[] chars, int start, int end) { // reverse string '12345' -> '54321' while (start < end) { char c = chars[start]; chars[start] = chars[end]; chars[end] = c; start ++; end --; } } static void rotate(char[] chars, int offset) { if (chars == null || chars.length == 0) return; int n = chars.length; offset %= n; reverse(chars, 0, n - 1 - offset); reverse(chars, n - offset, n - 1); reverse(chars, 0, n - 1); } public static void main(String[] args) { String s = "abcdefg"; int offset = 2; char[] chars = s.toCharArray(); rotate(chars, offset); System.out.println(chars); } }
dc067c977926cc05f537f33ab0b7dff85c4e2f66
394852aa7b695bf2dbf513d06276fed910765657
/src/Office_Hours/Practice_07_28_2020/Method_Practice_Mrt.java
d9d3321f6ef6cbbdf88f2d9b2ec09bbc69c05f15
[]
no_license
Mrtdu25/Summer2020_B20_Mrt
a862e6453251e0873923263e9eae11a983ffd780
24887a544e77bed03dacc5d3e8a4d475a212f5c6
refs/heads/master
2023-06-22T04:01:18.982906
2021-07-09T03:58:00
2021-07-09T03:58:00
288,579,588
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package Office_Hours.Practice_07_28_2020; public class Method_Practice_Mrt { public static void main(String[] args) { String myName="Murat"; String result= reverseStr(myName); System.out.println(result); System.out.println("==============================="); String str="LeVeL"; String reversed= reverseStr(str); //Single if statement if (str.equalsIgnoreCase(reversed)){ System.out.println("Palindrome"); }else { System.out.println("Not Palindrome"); } //Ternary String result2=(str.equalsIgnoreCase(reversed))? "Palindrome": "Not Palindrome"; System.out.println(result2); } public static String reverseStr(String str){ String result=""; for (int i=str.length()-1; i>=0; i--){ result+=str.charAt(i); } return result; } }
3050942a48835bba176e9c4c0ebb6da634f68323
b9d73db452f8fca09c698dafbbd1de35be5716af
/erp-core/src/main/java/cn/fastmc/core/pagination/PropertyFilter.java
73ef171a073af035b0f6617e8f7c4b7f921ea004
[]
no_license
michao66/fastmc
8cd8624f0c9ce14b0ba6592b7592629b49452018
e96d1e8acfd1247a1ba7af2aca2bb4752f3a209a
refs/heads/master
2021-01-23T22:10:27.110841
2014-10-21T14:45:52
2014-10-21T14:45:52
25,458,186
0
1
null
null
null
null
UTF-8
Java
false
false
17,069
java
package cn.fastmc.core.pagination; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import ognl.OgnlRuntime; import org.apache.commons.beanutils.converters.DateConverter; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.record.formula.functions.T; import org.joda.time.DateTime; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.util.Assert; import cn.fastmc.core.utils.ConvertUtils; import cn.fastmc.core.utils.RequestUtils; /** * 与具体ORM实现无关的属性过滤条件封装类, 主要记录页面中简单的搜索过滤条件. 用于页面表单传入字符串形式条件,然后转换处理为DAO层面识别的SQL条件 * 页面表单元素示例: * <ul> * <li>search['CN_a_OR_b']</li> * <li>search['EQ_id']</li> * <li>search['CN_user.name']</li> * </ul> * <p> * FORM传递表单参数规则: <br/> * 1, 第一部分:以"search[]"作为查询参数标识 <br/> * 2, 第二部分:查询类型,@see #MatchType <br/> * 3, 第三部分:id_OR_email,category,state, user.userprofile为属性名称,一般对应于Hibernate * Entity对应属性,可以以_OR_分隔多个属性进行OR查询 * </p> * <p> * 上述拼装字符串形式主要用于JSP页面form表单元素name属性值,如果是Java代码层面追加过滤条件,一般直接用构造函数: * PropertyFilter(final MatchType matchType, final String propertyName, final * Object matchValue) * </p> */ public class PropertyFilter { private static DateConverter dateConverter = new DateConverter(); /** 多个属性间OR关系的分隔符. */ public static final String OR_SEPARATOR = "_OR_"; /** 属性匹配比较类型. */ public enum MatchType { /** "name": "bk", "description": "is blank", "operator":"IS NULL OR ==''" */ BK, /** "name": "nb", "description": "is not blank", "operator":"IS NOT NULL AND !=''" */ NB, /** "name": "nu", "description": "is null", "operator":"IS NULL" */ NU, /** "name": "nn", "description": "is not null", "operator":"IS NOT NULL" */ NN, /** "name": "in", "description": "in", "operator":"IN" */ IN, /** "name": "ni", "description": "not in", "operator":"NOT IN" */ NI, /** "name": "ne", "description": "not equal", "operator":"<>" */ NE, /** "name": "eq", "description": "equal", "operator":"=" */ EQ, /** "name": "cn", "description": "contains", "operator":"LIKE %abc%" */ CN, /** * "name": "nc", "description": "does not contain", * "operator":"NOT LIKE %abc%" */ NC, /** "name": "bw", "description": "begins with", "operator":"LIKE abc%" */ BW, /** * "name": "bn", "description": "does not begin with", * "operator":"NOT LIKE abc%" */ BN, /** "name": "ew", "description": "ends with", "operator":"LIKE %abc" */ EW, /** * "name": "en", "description": "does not end with", * "operator":"NOT LIKE %abc" */ EN, /** "name": "bt", "description": "between", "operator":"BETWEEN 1 AND 2" */ BT, /** "name": "lt", "description": "less", "operator":"小于" */ LT, /** "name": "gt", "description": "greater", "operator":"大于" */ GT, /** "name": "le", "description": "less or equal","operator":"<=" */ LE, /** "name": "ge", "description": "greater or equal", "operator":">=" */ GE, /** @see javax.persistence.criteria.Fetch */ FETCH, /** Property Less Equal: >= */ PLE, /** Property Less Than: > */ PLT, ACLPREFIXS; } /** 匹配类型 */ private MatchType matchType = null; /** 匹配值 */ private Object matchValue = null; /** * 匹配属性类型 * 限制说明:如果是多个属性则取第一个,因此需要确保_OR_定义多个属性属于同一类型 */ private Class propertyClass = null; /** 属性名称数组, 一般是单个属性,如果有_OR_则为多个 */ private String[] propertyNames = null; /** * 集合类型子查询,如查询包含某个商品的所有订单列表,如order上面有个List集合products对象,则可以类似这样:search['EQ_products.code'] * 限制说明:框架只支持当前主对象直接定义的集合对象集合查询,不支持再多层嵌套 */ private Class subQueryCollectionPropetyType; public PropertyFilter() { } /** * @param filterName * 比较属性字符串,含待比较的比较类型、属性值类型及属性列表. * @param values * 待比较的值. */ public PropertyFilter(Class<?> entityClass, String filterName, String... values) { String matchTypeCode = StringUtils.substringBefore(filterName, "_"); try { matchType = Enum.valueOf(MatchType.class, matchTypeCode); } catch (RuntimeException e) { throw new IllegalArgumentException("filter名称" + filterName + "没有按规则编写,无法得到属性比较类型.", e); } String propertyNameStr = StringUtils.substringAfter(filterName, "_"); Assert.isTrue(StringUtils.isNotBlank(propertyNameStr), "filter名称" + filterName + "没有按规则编写,无法得到属性名称."); propertyNames = StringUtils.splitByWholeSeparator(propertyNameStr, PropertyFilter.OR_SEPARATOR); try { if (propertyNameStr.indexOf("count(") > -1) { propertyClass = Integer.class; } else if (propertyNameStr.indexOf("(") > -1) { propertyClass = BigDecimal.class; } else { Method method = null; String[] namesSplits = StringUtils.split(propertyNames[0], "."); if (namesSplits.length == 1) { method = OgnlRuntime.getGetMethod(null, entityClass, propertyNames[0]); } else { Class<?> retClass = entityClass; for (String nameSplit : namesSplits) { method = OgnlRuntime.getGetMethod(null, retClass, nameSplit); retClass = method.getReturnType(); if (Collection.class.isAssignableFrom(retClass)) { Type genericReturnType = method.getGenericReturnType(); if (genericReturnType instanceof ParameterizedType) { retClass = (Class<T>) ((ParameterizedType) genericReturnType).getActualTypeArguments()[0]; subQueryCollectionPropetyType = retClass; } } } } propertyClass = method.getReturnType(); } } catch (Exception e) { throw new IllegalArgumentException("无效对象属性定义:" + entityClass + ":" + propertyNames[0], e); } if (values.length == 1) { if (matchType.equals(MatchType.IN) || matchType.equals(MatchType.NI)) { String value = values[0]; values = value.split(","); } else if (propertyClass.equals(Date.class) || propertyClass.equals(DateTime.class)) { String value = values[0]; value = value.replace("~", " "); if (value.indexOf(" ") > -1) { values = StringUtils.split(value, " "); if (matchType.equals(MatchType.BT)) { values[0] = values[0].trim(); values[1] = values[1].trim(); } else { values = new String[] { values[0].trim() }; } } } } if (values.length == 1) { this.matchValue = parseMatchValueByClassType(propertyClass, values[0]); } else { Object[] matchValues = new Object[values.length]; for (int i = 0; i < values.length; i++) { matchValues[i] = parseMatchValueByClassType(propertyClass, values[i]); } this.matchValue = matchValues; } } private Object parseMatchValueByClassType(Class propertyClass, String value) { if ("NULL".equalsIgnoreCase(value)) { return value; } if (Enum.class.isAssignableFrom(propertyClass)) { return Enum.valueOf(propertyClass, value); } else if (propertyClass.equals(Boolean.class) || matchType.equals(MatchType.NN) || matchType.equals(MatchType.NU)) { return new Boolean(BooleanUtils.toBoolean(value)); } else if (propertyClass.equals(Date.class) || propertyClass.equals(DateTime.class)) { return dateConverter.convert(Date.class, value); } else { return ConvertUtils.convertStringToObject(value, propertyClass); } } /** * Java程序层直接构造过滤器对象, 如filters.add(new PropertyFilter(MatchType.EQ, "code", * code)); * * @param matchType * @param propertyName * @param matchValue */ public PropertyFilter(final MatchType matchType, final String propertyName, final Object matchValue) { this.matchType = matchType; this.propertyNames = StringUtils.splitByWholeSeparator(propertyName, PropertyFilter.OR_SEPARATOR); this.matchValue = matchValue; } /** * Java程序层直接构造过滤器对象, 如filters.add(new PropertyFilter(MatchType.LIKE, new * String[]{"code","name"}, value)); * * @param matchType * @param propertyName * @param matchValue */ public PropertyFilter(final MatchType matchType, final String[] propertyNames, final Object matchValue) { this.matchType = matchType; this.propertyNames = propertyNames; this.matchValue = matchValue; } /** * 从HttpRequest中创建PropertyFilter列表 * PropertyFilter命名规则为Filter属性前缀_比较类型属性类型_属性名. */ public static List<PropertyFilter> buildFiltersFromHttpRequest(Class<?> entityClass, ServletRequest request) { List<PropertyFilter> filterList = new ArrayList<PropertyFilter>(); // 从request中获取含属性前缀名的参数,构造去除前缀名后的参数Map. Map<String, String[]> filterParamMap = RequestUtils.getParametersStartingWith(request, "search['", "']"); // 分析参数Map,构造PropertyFilter列表 for (Map.Entry<String, String[]> entry : filterParamMap.entrySet()) { String filterName = entry.getKey(); String[] values = entry.getValue(); if (values == null || values.length == 0) { continue; } if (values.length == 1) { String value = values[0]; // 如果value值为空,则忽略此filter. if (StringUtils.isNotBlank(value)) { PropertyFilter filter = new PropertyFilter(entityClass, filterName, value); filterList.add(filter); } } else { String[] valuesArr = values; // 如果value值为空,则忽略此filter. if (valuesArr.length > 0) { Set<String> valueSet = new HashSet<String>(); for (String value : valuesArr) { if (StringUtils.isNotBlank(value)) { valueSet.add(value); } } if (valueSet.size() > 0) { String[] realValues = new String[valueSet.size()]; int cnt = 0; for (String v : valueSet) { realValues[cnt++] = v; } PropertyFilter filter = new PropertyFilter(entityClass, filterName, realValues); filterList.add(filter); } } } } return filterList; } public static Pageable buildPageableFromHttpRequest(HttpServletRequest request) { String rows = StringUtils.isBlank(request.getParameter("rows")) ? "10" : request.getParameter("rows"); if (Integer.valueOf(rows) < 0) { return null; } String page = StringUtils.isBlank(request.getParameter("page")) ? "1" : request.getParameter("page"); Sort sort = buildSortFromHttpRequest(request); return new PageRequest(Integer.valueOf(page) - 1, Integer.valueOf(rows), sort); } public static Sort buildSortFromHttpRequest(HttpServletRequest request) { String sidx = StringUtils.isBlank(request.getParameter("sidx")) ? "id" : request.getParameter("sidx"); Direction sord = "desc".equalsIgnoreCase(request.getParameter("sord")) ? Direction.DESC : Direction.ASC; Sort sort = null; //按照逗号切分支持多属性排序 for (String sidxItem : sidx.split(",")) { if (StringUtils.isNotBlank(sidxItem)) { //再按空格切分获取排序属性和排序方向 String[] sidxItemWithOrder = sidxItem.trim().split(" "); String sortname = sidxItemWithOrder[0]; //如果查询属性包含_OR_则取第一个作为排序属性 //因此在写OR多属性查询时注意把排序属性写在最前面 if (sortname.indexOf(OR_SEPARATOR) > -1) { sortname = StringUtils.substringBefore(sortname, OR_SEPARATOR); } //如果单个属性没有跟随排序方向,则取Grid组件传入的sord参数定义 if (sidxItemWithOrder.length == 1) { if (sort == null) { //初始化排序对象 sort = new Sort(sord, sortname); } else { //and追加多个排序 sort = sort.and(new Sort(sord, sortname)); } } else { //排序属性后面空格跟随排序方向定义 String sortorder = sidxItemWithOrder[1]; if (sort == null) { sort = new Sort("desc".equalsIgnoreCase(sortorder) ? Direction.DESC : Direction.ASC, sortname); } else { sort = sort.and(new Sort("desc".equalsIgnoreCase(sortorder) ? Direction.DESC : Direction.ASC, sortname)); } } } } return sort; } /** * 获取比较方式. */ public MatchType getMatchType() { return matchType; } /** * 获取比较值. */ public Object getMatchValue() { return matchValue; } /** * 获取比较属性名称列表. */ public String[] getPropertyNames() { return propertyNames; } /** * 获取唯一的比较属性名称. */ public String getPropertyName() { Assert.isTrue(propertyNames.length == 1, "There are not only one property in this filter."); return propertyNames[0]; } /** * 是否比较多个属性. */ public boolean hasMultiProperties() { return (propertyNames.length > 1); } /** * 构造一个缺省过滤集合. */ public static List<PropertyFilter> buildDefaultFilterList() { return new ArrayList<PropertyFilter>(); } public Class getPropertyClass() { return propertyClass; } public Class getSubQueryCollectionPropetyType() { return subQueryCollectionPropetyType; } }
c7dc49d4bfa4f4694906a1b60e0d61d467af39cc
26d459097a814cf68985748dded27ec0ad17e6e9
/cdst-business/conferenza/src/main/java/conferenza/DTO/RispostaBoolean.java
f85bae52dafb2d668224b42408b5120c36322050
[]
no_license
christiandeangelis/meetpad-public
096af0f7d058a1dd78ce3ca667e8077302f4b20a
d7bac39cc93056859ac34cda2aa1e85cec3f73ea
refs/heads/main
2023-07-13T20:34:52.657949
2021-09-01T12:19:32
2021-09-01T12:19:32
402,055,182
0
0
null
2021-09-01T12:37:26
2021-09-01T12:37:26
null
UTF-8
Java
false
false
197
java
package conferenza.DTO; import conferenza.DTO.bean.Risposta; import io.swagger.annotations.ApiModel; @ApiModel(value="BooleanResponse") public class RispostaBoolean extends Risposta<Boolean>{ }
ec73e33aa6440e911d0d370334ca05c3c8b81582
081538de994b9ad2a615d30c10ea17f0e684bb72
/src/com/certicom/ittsa/services/EmbarqueService.java
299f16f30fe4974e1eff27cf6f9cac8b8e6fabd6
[]
no_license
evelynespinozat/aladin
28148189725c478662c0c169a5ecbf7a5a2d9ff0
c8408f66a7435385cee995f008e9dc1ef1a35a62
refs/heads/master
2020-12-02T09:12:12.816379
2017-07-09T21:37:02
2017-07-09T21:37:02
53,199,418
0
0
null
null
null
null
UTF-8
Java
false
false
1,126
java
package com.certicom.ittsa.services; import java.util.List; import com.certicom.ittsa.domain.Embarque; import com.certicom.ittsa.mapper.EmbarqueMapper; import com.pe.certicom.ittsa.commons.ServiceFinder; public class EmbarqueService implements EmbarqueMapper{ EmbarqueMapper embarqueMapper = (EmbarqueMapper)ServiceFinder.findBean("embarqueMapper"); @Override public List<Embarque> findAll() throws Exception { return embarqueMapper.findAll(); } @Override public Embarque findById(Integer embarqueId) throws Exception { // TODO Auto-generated method stub return embarqueMapper.findById(embarqueId); } @Override public void eliminarEmbarque(Integer embarqueId) throws Exception { // TODO Auto-generated method stub embarqueMapper.eliminarEmbarque(embarqueId); } @Override public void crearEmbarque(Embarque embarque) throws Exception { // TODO Auto-generated method stub embarqueMapper.crearEmbarque(embarque); } @Override public void actualizarEmbarque(Embarque embarque) throws Exception { // TODO Auto-generated method stub embarqueMapper.actualizarEmbarque(embarque); } }
f5d4dddb5e6efa392db8dd24a7588a8131daafbd
b8ef3edd99bae433b6a7cee2fa9792a5780ec20c
/server/src/main/java/com/fluig/identity/swagger/api/model/exception/ErrorCode.java
e9bc94765f1f40ea8501078b36b8a41f33722a47
[]
no_license
fluigidentity/swagger-management
de42b33f7a3ef6f2042615ba290768390bf96ca7
c113cddd5ed16af38d65b0932c2720aefd1ef67c
refs/heads/master
2020-12-31T06:47:49.415242
2017-03-31T12:58:34
2017-03-31T12:58:34
86,614,210
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.fluig.identity.swagger.api.model.exception; public final class ErrorCode { private final String code; private final String description; public ErrorCode(String code, String description) { this.code = code; this.description = description; } public String getCode() { return code; } public String getDescription() { return description; } }
809cd90848ba925c5495e80d6682b8569267c771
a94503718e5b517e0d85227c75232b7a238ef24f
/src/main/java/net/dryuf/comp/gallery/dao/GallerySourceDao.java
f23f6ee73dff62624dceedd89571fd4139764258
[]
no_license
kvr000/dryuf-old-comp
795c457e6131bb0b08f538290ff96f8043933c9f
ebb4a10b107159032dd49b956d439e1994fc320a
refs/heads/master
2023-03-02T20:44:19.336992
2022-04-04T21:51:59
2022-04-04T21:51:59
229,681,213
0
0
null
2023-02-22T02:52:16
2019-12-23T05:14:49
Java
UTF-8
Java
false
false
2,139
java
package net.dryuf.comp.gallery.dao; import java.util.Map; import java.util.List; import net.dryuf.comp.gallery.GallerySource; import net.dryuf.core.EntityHolder; import net.dryuf.core.CallerContext; import net.dryuf.transaction.TransactionHandler; public interface GallerySourceDao extends net.dryuf.dao.DynamicDao<GallerySource, net.dryuf.comp.gallery.GallerySource.Pk> { public GallerySource refresh(GallerySource obj); public GallerySource loadByPk(net.dryuf.comp.gallery.GallerySource.Pk pk); public List<GallerySource> listAll(); public void insert(GallerySource obj); public void insertTxNew(GallerySource obj); public GallerySource update(GallerySource obj); public void remove(GallerySource obj); public boolean removeByPk(net.dryuf.comp.gallery.GallerySource.Pk pk); public List<GallerySource> listByCompos(net.dryuf.comp.gallery.GalleryRecord.Pk compos); public long removeByCompos(net.dryuf.comp.gallery.GalleryRecord.Pk compos); public net.dryuf.comp.gallery.GallerySource.Pk importDynamicKey(Map<String, Object> data); public Map<String, Object> exportDynamicData(EntityHolder<GallerySource> holder); public Map<String, Object> exportEntityData(EntityHolder<GallerySource> holder); public GallerySource createDynamic(EntityHolder<?> composition, Map<String, Object> data); public EntityHolder<GallerySource> retrieveDynamic(EntityHolder<?> composition, net.dryuf.comp.gallery.GallerySource.Pk pk); public GallerySource updateDynamic(EntityHolder<GallerySource> roleObject, net.dryuf.comp.gallery.GallerySource.Pk pk, Map<String, Object> updates); public boolean deleteDynamic(EntityHolder<?> composition, net.dryuf.comp.gallery.GallerySource.Pk pk); public long listDynamic(List<EntityHolder<GallerySource>> results, EntityHolder<?> composition, Map<String, Object> filter, List<String> sorts, Long start, Long limit); public TransactionHandler keepContextTransaction(CallerContext callerContext); public <R> R runTransactioned(java.util.concurrent.Callable<R> code) throws Exception; public <R> R runTransactionedNew(java.util.concurrent.Callable<R> code) throws Exception; }
de7c98f892a9f1a85d7464c55b9836411621fd49
2f3eeb0ac5ea7d0279838bb8aef2aeb26629dbdf
/src/tiles/GrassTile.java
4b84077bf7a90f83898d1274abd9b65528db0c9f
[]
no_license
LiannevW/Game2D
79c1b61648965c0d0659ac06c93881a690ca6887
4850b824a242878f0ebc967f8f037359e3a1fba8
refs/heads/master
2020-03-07T04:17:26.866367
2018-03-30T13:37:12
2018-03-30T13:37:12
127,262,170
0
0
null
2018-03-29T13:07:49
2018-03-29T08:35:33
Java
UTF-8
Java
false
false
148
java
package tiles; import gfx.Assets; public class GrassTile extends Tile { public GrassTile(int id) { super(Assets.grass, id); } }
d8fbbc2706c285f985ac244ebc0d6928d0878511
25427654e8be6adbce42030f6410db9622a97b02
/org.commonreality.net/test/org/commonreality/net/SimpleNetProviderTest.java
7097b0d6c3fabca19fd8c44161257310b804de34
[]
no_license
amharrison/commonreality
a6240e94167e6fd62aeab2e2d5ef0d9dc5b8a969
c6362fdf28c1d3c13ded7b3e31a74c06365a4aae
refs/heads/master
2021-01-13T02:08:30.534500
2018-08-31T13:49:28
2018-08-31T13:49:28
9,752,928
0
0
null
null
null
null
UTF-8
Java
false
false
3,663
java
package org.commonreality.net; /* * default logging */ import java.net.SocketAddress; import java.util.Collections; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.commonreality.net.handler.IMessageHandler; import org.commonreality.net.impl.DefaultSessionListener; import org.commonreality.net.protocol.IProtocolConfiguration; import org.commonreality.net.provider.INetworkingProvider; import org.commonreality.net.service.IClientService; import org.commonreality.net.service.IServerService; import org.commonreality.net.session.ISessionInfo; import org.commonreality.net.session.ISessionListener; import org.commonreality.net.transport.ITransportProvider; import org.junit.Assert; public class SimpleNetProviderTest { /** * Logger definition */ static private final transient Log LOGGER = LogFactory .getLog(SimpleNetProviderTest.class); public void testNIOSerializer(String providerName) throws Exception { LOGGER .warn("Not strictly a proper test. This will not fail short of an exception"); INetworkingProvider provider = INetworkingProvider .getProvider(providerName); IServerService server = provider.newServer(); IClientService client = provider.newClient(); ITransportProvider transport = provider .getTransport(INetworkingProvider.NIO_TRANSPORT); IProtocolConfiguration protocol = provider .getProtocol(INetworkingProvider.SERIALIZED_PROTOCOL); SocketAddress address = transport.createAddress("localhost", "0"); AtomicInteger messageCount = new AtomicInteger(0); IMessageHandler<String> handler = (s, m) -> { LOGGER.debug(String.format("got %s", m)); messageCount.incrementAndGet(); }; ISessionListener serverListener = new DefaultSessionListener() { @Override public void opened(ISessionInfo<?> session) { super.opened(session); try { session.write("test from server"); session.flush(); } catch (Exception e) { // TODO Auto-generated catch block LOGGER.error(".opened threw Exception : ", e); } } }; ISessionListener clientListener = new DefaultSessionListener() { @Override public void opened(ISessionInfo<?> session) { super.opened(session); try { session.write("test from client"); session.write("test from client2"); session.flush(); } catch (Exception e) { // TODO Auto-generated catch block LOGGER.error(".opened threw Exception : ", e); } } }; server.configure(transport, protocol, Collections.singletonMap(String.class, handler), serverListener, Executors.defaultThreadFactory()); client.configure(transport, protocol, Collections.singletonMap(String.class, handler), clientListener, Executors.defaultThreadFactory()); SocketAddress hostingAddress = server.start(address); // where we are // actually listening // too if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("Server listening on %s", hostingAddress)); client.start(hostingAddress); /* * the listeners will do the sending and listening.. */ Thread.sleep(1000); Assert.assertEquals(messageCount.get(), 3); } }
d43be13c96d16d15b0e3975f37dc15de12c7d714
eac9da28dab4965af48700c8179cc90489b1ce10
/src/main/java/com/song/system/controller/IndexController.java
7e8ae977c3f40ceecf09a0af0d5dc1f2f1f924d2
[]
no_license
wang200507/cms1
7629514025d122a167d3f72204dbf722172f0dde
761849f85723761bc0c5b21510c44411c00ebaeb
refs/heads/master
2021-05-06T13:18:12.116144
2017-12-08T06:32:24
2017-12-08T06:32:24
113,259,942
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package com.song.system.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * ${DESCRIPTION} * * @author wangzy * @date 2017-11-20 */ @Controller @RequestMapping("/") public class IndexController { @RequestMapping("index") public String index(){ return "login"; } }
91168016b296affcfa8c31240c33fdc0d065bc4a
c22374f024154db2ac4bed76a597ed9833eda6f0
/app/src/main/java/sanchez/daniel/dint04_pruebaslayouts2/MyCustomAdapter.java
68f040109b999360163151cd5b11e737e053c203
[]
no_license
danisr/Interfaces_Android_05_PruebasLayout2
6d4dd8667ce903b5dfd8ab7de10061a3c5d586c4
c6d85609077c61dbd5241b267174904bf04ed854
refs/heads/master
2021-06-10T07:01:23.302466
2017-02-02T10:36:30
2017-02-02T10:36:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,271
java
package sanchez.daniel.dint04_pruebaslayouts2; import android.content.Context; import android.provider.ContactsContract; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; /** * Created by daniel.rodriguez on 21/12/2016. */ public class MyCustomAdapter extends ArrayAdapter<Country>{ private Context context; private List<Country> countries; public MyCustomAdapter(Context context, List<Country> countries) { super(context, 0, countries); this.context = context; this.countries = countries; } public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.custom_item, parent, false); } Country country = countries.get(position); TextView tv = (TextView) convertView.findViewById(R.id.tv_text_list); tv.setText(country.getName()); ImageView imageView = (ImageView) convertView.findViewById(R.id.iv_image); imageView.setImageResource(country.getFlag()); return convertView; } }
c78f96af54cd558ea3e094f053cd8d1ea95e8b80
4ff3d61c76ebd766c3dd6afb9bb0e487e5f1c04b
/src/com/my/bk/views/AuthorityView.java
23b8d7fdacd40305debdeb6b08ad19d695b245a0
[]
no_license
overflow-lie/BookStore
17260e04ee26b07fe561efee9e80812db5d56017
b8f8a5d5cbb7970bdb2976c38b860fc0aa3243c6
refs/heads/master
2021-01-10T05:21:58.035775
2016-04-14T11:02:09
2016-04-14T11:02:09
55,901,842
1
0
null
null
null
null
UTF-8
Java
false
false
979
java
package com.my.bk.views; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Component; import org.springframework.web.servlet.View; import com.my.bk.entities.User; @Component public class AuthorityView implements View{ @Override public String getContentType() { return "text/html; charset=UTF-8"; } @Override public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); User user =(User)session.getAttribute("loginUser"); String state = user.getRole().getState(); boolean equals = "MANAGER".equals(state); if (equals) { response.sendRedirect(request.getContextPath()+"/manager/home"); }else{ response.sendRedirect(request.getContextPath()+"/book/list/0"); } } }
[ "y_y@y_y-PC" ]
y_y@y_y-PC
2e96f56c178fee9dbacab9cc62dddb830dea7f68
a14392d5ea27fb0cbde915acedc70da653a5698a
/src/implementation/GradingStudents.java
7085dad0fdacb8e6fae1c681b241c41324b3a659
[]
no_license
botao-zhang/hackerrank
d70edab8767ace7a6a343322e6080c6cce19322d
ebf28c040773fa488182bb631955249a1acbbc24
refs/heads/master
2021-05-06T18:16:32.266217
2017-12-05T12:56:06
2017-12-05T12:56:06
111,960,488
0
0
null
null
null
null
UTF-8
Java
false
false
902
java
package implementation; import java.util.Scanner; public class GradingStudents { static int[] solve(int[] grades){ int[] ret = new int[grades.length]; for(int i = 0;i<grades.length;i++){ int r = grades[i] % 5; if(grades[i] < 38 || r < 3) ret[i] = grades[i]; else{ ret[i] = grades[i] + 5 - r; } } return ret; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] grades = new int[n]; for(int grades_i=0; grades_i < n; grades_i++){ grades[grades_i] = in.nextInt(); } int[] result = solve(grades); for (int i = 0; i < result.length; i++) { System.out.print(result[i] + (i != result.length - 1 ? "\n" : "")); } System.out.println(""); } }
4d83e7f3c211d36faec1ba5ad5dc2974b2aeaee8
6ac02620fdfb3b9f28ad454893660cbaa9c62aee
/src/main/java/com/example/keycloak2/controller/LogoutController.java
4a87615b8d5ff30f37dcc01baf2434d434fa66fb
[]
no_license
MaciejDebskiLd/KeycloakSpringSecurity
83809c8e7f5d5550128cdd6b3c1f7ce3a6c58956
7cf0c0aaee86d401b6fd8700148871c7c3a85f0b
refs/heads/master
2020-09-22T03:35:20.771742
2019-12-01T08:22:37
2019-12-01T08:22:37
225,033,565
0
0
null
2019-12-01T08:10:30
2019-11-30T15:41:41
Java
UTF-8
Java
false
false
727
java
package com.example.keycloak2.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @RestController public class LogoutController { @RequestMapping(value = "/logout", method = RequestMethod.GET) public String logout (HttpServletRequest request) throws ServletException { request.logout(); String link = "<a href='http://localhost:8082/users'>Kliknij, żeby ponownie się zalogować</a>"; return "Zostałeś prawidłowo wylogowany" + "<br>" + link; } }
3bcea2b531caff526bfd489ab61b6a698223b2eb
4312a71c36d8a233de2741f51a2a9d28443cd95b
/RawExperiments/TB/Math95/AstorMain-math_95/src/variant-872/org/apache/commons/math/distribution/FDistributionImpl.java
1f3307b2b7462fb4679e2593c4990ab5806896c1
[]
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
2,722
java
package org.apache.commons.math.distribution; public class FDistributionImpl extends org.apache.commons.math.distribution.AbstractContinuousDistribution implements java.io.Serializable , org.apache.commons.math.distribution.FDistribution { private static final long serialVersionUID = -8516354193418641566L; private double numeratorDegreesOfFreedom; private double denominatorDegreesOfFreedom; public FDistributionImpl(double numeratorDegreesOfFreedom ,double denominatorDegreesOfFreedom) { super(); setNumeratorDegreesOfFreedom(numeratorDegreesOfFreedom); setDenominatorDegreesOfFreedom(denominatorDegreesOfFreedom); } public double cumulativeProbability(double x) throws org.apache.commons.math.MathException { double ret; if (x <= 0.0) { ret = 0.0; } else { double n = getNumeratorDegreesOfFreedom(); double m = getDenominatorDegreesOfFreedom(); ret = org.apache.commons.math.special.Beta.regularizedBeta(((n * x) / (m + (n * x))), (0.5 * n), (0.5 * m)); } return ret; } public double inverseCumulativeProbability(final double p) throws org.apache.commons.math.MathException { if (p == 1) { return java.lang.Double.POSITIVE_INFINITY; } if (p == 1) { return java.lang.Double.POSITIVE_INFINITY; } return super.inverseCumulativeProbability(p); } protected double getDomainLowerBound(double p) { return 0.0; } protected double getDomainUpperBound(double p) { return java.lang.Double.MAX_VALUE; } protected double getInitialDomain(double p) { double ret; double d = getDenominatorDegreesOfFreedom(); ret = d / (d - 2.0); return ret; } public void setNumeratorDegreesOfFreedom(double degreesOfFreedom) { if (degreesOfFreedom <= 0.0) { throw new java.lang.IllegalArgumentException("degrees of freedom must be positive."); } org.apache.commons.math.distribution.FDistributionImpl.this.numeratorDegreesOfFreedom = degreesOfFreedom; } public double getNumeratorDegreesOfFreedom() { return numeratorDegreesOfFreedom; } public void setDenominatorDegreesOfFreedom(double degreesOfFreedom) { if (degreesOfFreedom <= 0.0) { throw new java.lang.IllegalArgumentException("degrees of freedom must be positive."); } org.apache.commons.math.distribution.FDistributionImpl.this.denominatorDegreesOfFreedom = degreesOfFreedom; } public double getDenominatorDegreesOfFreedom() { return denominatorDegreesOfFreedom; } }
ff2b00a6d8f6cfea9172ccfe44ce5ba7f9926606
c7530163f47e9657799d78f485b0ccee7643f122
/app/src/main/java/picodiploma/dicoding/aplikasimoviecatalogue/Movie.java
b2fca9c6b01b6fca479b7e2a3e4c9d08844ea6de
[]
no_license
fikibrahim/listMovie
81ce19a6c4f46cdf7310f834767a256877fe8882
fa19a620fbdaf168e8b85b8b02184bc1090ed937
refs/heads/master
2020-07-04T22:00:09.155309
2019-08-14T22:14:29
2019-08-14T22:14:29
202,432,676
0
0
null
null
null
null
UTF-8
Java
false
false
1,642
java
package picodiploma.dicoding.aplikasimoviecatalogue; import android.os.Parcel; import android.os.Parcelable; public class Movie implements Parcelable { private int image; private String judul; private String rilis; private String description; protected Movie(Parcel in) { image = in.readInt(); judul = in.readString(); rilis = in.readString(); description = in.readString(); } public static final Creator<Movie> CREATOR = new Creator<Movie>() { @Override public Movie createFromParcel(Parcel in) { return new Movie( in ); } @Override public Movie[] newArray(int size) { return new Movie[size]; } }; public Movie() { } public int getImage() { return image; } public void setImage(int image) { this.image = image; } public String getJudul() { return judul; } public void setJudul(String judul) { this.judul = judul; } public String getRilis() { return rilis; } public void setRilis(String rilis) { this.rilis = rilis; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt( image ); dest.writeString( judul ); dest.writeString( rilis ); dest.writeString( description ); } }
[ "taufikibrahim0521@gmail" ]
taufikibrahim0521@gmail
3101f9b09fc4ec143ddef706103c9109a2c34da3
a96a1085105579dde2e8344c6cf40b2952ba2550
/src/Chapter1/_7ClassAndObject/_8Practice/Test1/Main.java
615fcc5e0089f65270c6915afca53d036f651b57
[]
no_license
billgoo/Learn_Java_From_Beginning
54544ba770c3bebd7f490f17362495408f60220d
9f3e3ae72cfda2afc36d23770862409d88a9ca41
refs/heads/master
2020-09-15T16:19:22.460940
2020-05-09T08:11:49
2020-05-09T08:11:49
223,501,312
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package Chapter1._7ClassAndObject._8Practice.Test1; public class Main extends Test1 { public static void main(String[] args) { Test1 t = new Test1(); t.setTest("Java"); System.out.println(t.getTest()); } }
d71e4da375dc3de957f50755b07353d5af0d7699
4312a71c36d8a233de2741f51a2a9d28443cd95b
/RawExperiments/DB/Math70/AstorMain-math70/src/variant-656/org/apache/commons/math/analysis/solvers/BisectionSolver.java
5b9f48ab992c094253056f2432730385261ec1b8
[]
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
2,231
java
package org.apache.commons.math.analysis.solvers; public class BisectionSolver extends org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl { @java.lang.Deprecated public BisectionSolver(org.apache.commons.math.analysis.UnivariateRealFunction f) { super(f, 100, 1.0E-6); } public BisectionSolver() { super(100, 1.0E-6); } @java.lang.Deprecated public double solve(double min, double max, double initial) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { return solve(f, min, max); } @java.lang.Deprecated public double solve(double min, double max) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { return solve(f, min, max); } public double solve(final org.apache.commons.math.analysis.UnivariateRealFunction f, double min, double max, double initial) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { return super.getMinImpl(); } public double solve(final org.apache.commons.math.analysis.UnivariateRealFunction f, double min, double max) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { clearResult(); verifyInterval(min, max); double m; double fm; double fmin; int i = 0; while (i < (maximalIterationCount)) { m = org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils.midpoint(min, max); fmin = f.value(min); fm = f.value(m); if ((fm * fmin) > 0.0) { min = m; } else { max = m; } if ((java.lang.Math.abs((max - min))) <= (absoluteAccuracy)) { m = org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils.midpoint(min, max); setResult(m, i); return m; } ++i; } throw new org.apache.commons.math.MaxIterationsExceededException(maximalIterationCount); } }
c27b330c687de3887e91f89cd47186cda6d56d0a
623f7f8810952e2de51ba598b4114e18696614be
/Lucas_Tonolli/Desafio_Orien_Obj/src/Candidato.java
7624e3ac585f2c9be5eb47cb55d2e729dfd882e2
[]
no_license
LucasTonolli/mais-pra-ti
9e7cb7408ef728ab4c036f605ef3d79f9ff2a51e
880300983bca2c9d286efecf9aebe75f50b08b55
refs/heads/main
2023-03-18T13:49:26.207791
2021-03-09T20:15:08
2021-03-09T20:15:08
336,549,522
1
0
null
2021-03-09T20:15:08
2021-02-06T13:55:48
Java
UTF-8
Java
false
false
861
java
public abstract class Candidato { private String nome; public int codCandidato; public int numVotos; public Candidato(String nome,int codCandidato){ this.nome = nome; this.codCandidato = codCandidato; this.numVotos = 0; } public abstract String Info(); public String getNome() { return nome; } private void setNome(String nome) { this.nome = nome; } public int getCodCandidato() { return codCandidato; } public void setCodCandidato(int codCandidato) { this.codCandidato = codCandidato; } private void setNumVotos(int numVotos){ this.numVotos=numVotos; } public void recebendoVotos(){ this.numVotos ++; } public int getNumVotos(){ return numVotos; } }
131913d0e172d3d2bd80d9702d201541147cfdaa
f61f785d4a9262fc4d268b376d5a554d0bdb6103
/src/main/java/course/config/model/User.java
6f0dbc958bb3bc1b429c4309500d472411f20e71
[]
no_license
srikanth152/MySrpingBoot
32c7872cfef7fa1e11d8c8de823b2aab27b2571d
dc3918edfb161c1b5b11458a073168134dec39e3
refs/heads/master
2020-03-23T21:33:00.297656
2018-07-24T06:36:58
2018-07-24T06:36:58
142,115,014
0
0
null
null
null
null
UTF-8
Java
false
false
2,503
java
package course.config.model; import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.ElementCollection; 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.JoinTable; import javax.persistence.Table; import org.hibernate.annotations.CollectionId; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Type; @Entity @Table(name="USER_DETAILS") public class User { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int userId; private String firstName; private String lastName; private String email; private String password; // @EmbeddedId // @JoinTable(name="ADDRESS",joinColumns=@JoinColumn(referencedColumnName="userId")) @ElementCollection(fetch=FetchType.EAGER) // by default it fetches the sub class data in LAZY way. @JoinTable(name="USER_ADDRESS", joinColumns=@JoinColumn(name="userId")) // creates the join table with specified name, if not provide hibernate creates name using parent_child class name @GenericGenerator(name="hilo-gen", strategy="increment") @CollectionId(columns={@Column(name="ADDRESS_ID")},generator = "hilo-gen", type = @Type(type="long") ) // generates a primary key with the name ADDREES_ID and uses the hilo-gen //startegy for the value private List<Address> address = new ArrayList<>(); public List<Address> getAddress() { return address; } public void setAddress(List<Address> address) { this.address = address; } public User() { } public User(String firstName,String lastName,String email, String password) { this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstname) { this.firstName = firstname; } public String getLastName() { return lastName; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
b00d863142ef50450331a3145240fa8384939d5d
b6d59cbd5a9be88da8b3e9a7be669134ef07f094
/180619Spring4/src/com/hr/spring/tx/xml/UserAccountException.java
a18a72ad87e9773d2151e9bb5491465e1d2f6366
[]
no_license
lemon-carl/Spring
bb75e9e9efa44e0c0570d7e9ebd64ec978a86bb6
27a78e4f52f779f85d4091c4d947d7591e6f67d0
refs/heads/master
2021-09-19T02:33:20.708659
2018-07-22T10:08:01
2018-07-22T10:08:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
988
java
package com.hr.spring.tx.xml; /** * * @Name : UserAccountException * @Author : LH * @Date : 2018年6月28日 下午10:57:43 * @Version : V1.0 * * @Description : */ public class UserAccountException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; public UserAccountException() { super(); // TODO Auto-generated constructor stub } public UserAccountException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } public UserAccountException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } public UserAccountException(String message) { super(message); // TODO Auto-generated constructor stub } public UserAccountException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } }
9648d4cc0a3f2ce6af8911ecde4d6b095864a3bb
c436498a73a71c608e418cba9906bca62ced3ac3
/src/Comparable/Rectangle.java
443e3dc278f0c3171b2d2e01189574e2d6eee3e4
[]
no_license
TUANVUCG/Java_AbstractClass_Interface
984735f0aa5ba2c9ba5c7063b3425303235a530f
b0fd761738cf2bc930555f8ffff22632aeb96c51
refs/heads/master
2023-04-02T11:58:05.961708
2021-04-12T09:55:53
2021-04-12T09:55:53
357,095,449
0
0
null
null
null
null
UTF-8
Java
false
false
1,154
java
package Comparable; public class Rectangle extends Shape { private double width = 1.0; private double length = 1.0; public Rectangle() { } public Rectangle(double width, double length) { this.width = width; this.length = length; } public Rectangle(double width, double length, String color, boolean filled) { super(color, filled); this.width = width; this.length = length; } public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public double getLength() { return length; } public void setLength(double length) { this.length = length; } public double getArea() { return width * this.length; } public double getPerimeter() { return 2 * (width + this.length); } @Override public String toString() { return "A Rectangle with width=" + getWidth() + " and length=" + getLength() + ", which is a subclass of " + super.toString(); } }
6151851d65698e2eba2afafafd513ee3f8f98b84
d192fa57ee655146b8c73491e2ec6230e5b07d4a
/src/branch/BranchManager.java
a0478c95c60b5d122445397bf242257b8e5e0769
[]
no_license
funball99/meidi
cc78c3f016723fde1c78d8d6d97f8928c43379aa
ad67fd846c94bf71bfb1ee31ede8e98ad4af99f2
refs/heads/master
2021-01-21T15:18:04.109527
2014-09-18T07:53:45
2014-09-18T07:53:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,729
java
package branch; import group.Group; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import order.OrderManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import category.Category; import category.CategoryManager; import user.User; import user.UserManager; import database.DB; public class BranchManager { protected static Log logger = LogFactory.getLog(BranchManager.class); public static boolean save(Branch branch ){ Connection conn = DB.getConn(); String sql = ""; if(branch.getId() == 0){ sql = "insert into mdbranch(id,bname,pid,bmessage) values (null, '"+branch.getLocateName()+"','"+branch.getPid()+"','"+branch.getMessage()+"')"; }else{ sql = "update mdbranch set bname = '"+branch.getLocateName()+"' , bmessage = '"+branch.getMessage()+"' where id = "+ branch.getId(); } PreparedStatement pstmt = DB.prepare(conn, sql); try { //pstmt.setString(1, branch.getLocateName()); //pstmt.setInt(2,Integer.valueOf(branch.getPid())); //pstmt.setString(3, branch.getMessage()); System.out.println(pstmt); pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(pstmt); DB.close(conn); } return true; } public static List<Branch> getLocate(String id ) { List<Branch> users = new ArrayList<Branch>(); Connection conn = DB.getConn(); String sql = "select * from mdbranch where pid = "+ id ; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { Branch g = getBranchFromRs(rs); users.add(g); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return users; } public static List<String> getLocateAll( ) { List<String> users = new ArrayList<String>(); Connection conn = DB.getConn(); String sql = "select * from mdbranch " ; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { Branch g = getBranchFromRs(rs); users.add(g.getLocateName()); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return users; } public static Branch getLocatebyname(String name ) { Branch branch = new Branch(); Connection conn = DB.getConn(); String sql = "select * from mdbranch where bname = '"+ name + "'" ; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { branch = getBranchFromRs(rs); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return branch; } public static int getBranchID(String name ) { int id = 0 ; Connection conn = DB.getConn(); String sql = "select * from mdbranch where bname = '"+ name + "'" ; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { Branch branch = getBranchFromRs(rs); id = branch.getId(); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return id; } public static Branch getLocatebyid(String id ) { Branch branch = new Branch(); Connection conn = DB.getConn(); String sql = "select * from mdbranch where id = "+ id + "" ; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { branch = getBranchFromRs(rs); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return branch; } public static Map<String,List<String>> getLocateMap() { Map<String,List<String>> map = new HashMap<String,List<String>>(); Connection conn = DB.getConn(); String sql = "select * from mdbranch "; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { int id = rs.getInt("pid"); List<String> list = map.get(id+""); if(list == null){ list = new ArrayList<String>(); map.put(id+"", list); } list.add(rs.getString("bname")); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return map; } public static Map<Integer,Branch> getNameMap() { Map<Integer,Branch> map = new HashMap<Integer,Branch>(); Connection conn = DB.getConn(); String sql = "select * from mdbranch "; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { Branch branch = getBranchFromRs(rs); map.put(branch.getId(),branch); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return map; } public static Map<String,List<Branch>> getLocateMapBranch() { Map<String,List<Branch>> map = new HashMap<String,List<Branch>>(); Connection conn = DB.getConn(); String sql = "select * from mdbranch "; Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { int id = rs.getInt("pid"); List<Branch> list = map.get(id+""); if(list == null){ list = new ArrayList<Branch>(); map.put(id+"", list); } list.add(getBranchFromRs(rs)); } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return map; } public static boolean delete(String str ) { String ids = "(" + str + ")"; boolean b = false; Connection conn = DB.getConn(); String sql = "delete from mdbranch where id in " + ids; logger.info(sql); Statement stmt = DB.getStatement(conn); try { DB.executeUpdate(stmt, sql); b = true; } finally { DB.close(stmt); DB.close(conn); } return b; } public static boolean isname(String name){ boolean flag = false ; Connection conn = DB.getConn(); String sql = "select * from mdbranch where bname = '"+ name +"'"; logger.info(sql); Statement stmt = DB.getStatement(conn); ResultSet rs = DB.getResultSet(stmt, sql); try { while (rs.next()) { flag = true ; } } catch (SQLException e) { e.printStackTrace(); } finally { DB.close(rs); DB.close(stmt); DB.close(conn); } return flag; } private static Branch getBranchFromRs(ResultSet rs){ Branch branch= new Branch(); try { branch.setId(rs.getInt("id")); branch.setLocateName(rs.getString("bname")); branch.setPid(rs.getInt("pid")); branch.setMessage(rs.getString("bmessage")); } catch (SQLException e) { e.printStackTrace(); } return branch ; } }
[ "think@Lenovo-PC" ]
think@Lenovo-PC
9570ede05373a4ebcbddc6051754901602f7207f
870fcba8bf92ff6d9047940fed22f307768e5292
/src/sanmiguel/Estimacion.java
08be25b66272d0019a194a2c62552b0b9b6c2d22
[]
no_license
luchogonzalez/sanMiguelBackend
368ce9f99fce25cd2310ada0d685378b1d015d48
eb8853942824a4564f36ec5c3cf8362bac16c233
refs/heads/master
2021-01-01T06:43:24.751646
2017-07-17T16:37:32
2017-07-17T16:37:32
97,496,585
0
0
null
null
null
null
ISO-8859-10
Java
false
false
2,796
java
package sanmiguel; import java.io.Serializable; import javax.persistence.*; import java.util.Date; /** * The persistent class for the estimacion database table. * */ @Entity @Table(name="estimacion") @NamedQuery(name="Estimacion.findAll", query="SELECT e FROM Estimacion e") public class Estimacion implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="estim_id", unique=true, nullable=false) private int estimId; @Column(name="bjas_x_pta_mes") private float bjasXPtaMes; @Column(name="bjas_x_pta_temp") private float bjasXPtaTemp; @Column(name="calidad_prct") private float calidadPrct; @Column(length=10) private String fecha; @Column(length=25) private String finca; @Column(name="limones_x_bdja") private float limonesXBdja; @Column(length=25) private String lote; @Column(length=140) private String observaciones; @Column(length=10) private String tamaņo; //bi-directional many-to-one association to Usuario @ManyToOne @JoinColumn(name="usuario_id")//, referencedColumnName="usuario_id") private Usuario usuario; public Estimacion() { } public int getEstimId() { return this.estimId; } public void setEstimId(int estimId) { this.estimId = estimId; } public float getBjasXPtaMes() { return this.bjasXPtaMes; } public void setBjasXPtaMes(float bjasXPtaMes) { this.bjasXPtaMes = bjasXPtaMes; } public float getBjasXPtaTemp() { return this.bjasXPtaTemp; } public void setBjasXPtaTemp(float bjasXPtaTemp) { this.bjasXPtaTemp = bjasXPtaTemp; } public float getCalidadPrct() { return this.calidadPrct; } public void setCalidadPrct(float calidadPrct) { this.calidadPrct = calidadPrct; } public String getFecha() { return this.fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public String getFinca() { return this.finca; } public void setFinca(String finca) { this.finca = finca; } public float getLimonesXBdja() { return this.limonesXBdja; } public void setLimonesXBdja(float limonesXBdja) { this.limonesXBdja = limonesXBdja; } public String getLote() { return this.lote; } public void setLote(String lote) { this.lote = lote; } public String getObservaciones() { return this.observaciones; } public void setObservaciones(String observaciones) { this.observaciones = observaciones; } public String getTamaņo() { return this.tamaņo; } public void setTamaņo(String tamaņo) { this.tamaņo = tamaņo; } public Usuario getUsuario() { return this.usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } }
16065181a2605a852937ce79e35ee4d9cf7259d5
2a985a74214487a77cfe2d8fcbbc1de885edc987
/app/src/main/java/com/example/admin/calandburn/SevenAdapter.java
4515820fef7168b334f1bb94c5ea2202db31a92d
[]
no_license
masterUNG/Cal-and-Burn-from-Gun2
0e90c8b8d8dfc7b10371a253f33d9b7b07bb4cee
dd2131cb0570da96a4f28ccdf5a2f3dbc49d8346
refs/heads/master
2021-01-01T05:26:20.185193
2016-05-21T10:39:40
2016-05-21T10:39:40
59,281,386
0
0
null
null
null
null
UTF-8
Java
false
false
2,013
java
package com.example.admin.calandburn; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class SevenAdapter extends BaseAdapter{ //Explicit private Context objContext; private String[] nameCalStrings, dateStrings, numCalString, CalString; private int[] iconInts; public SevenAdapter(Context objContext, String[] nameCalStrings, String[] dateStrings, String[] numCalString, String[] CalString) { this.objContext = objContext; this.nameCalStrings = nameCalStrings; this.dateStrings = dateStrings; this.numCalString = numCalString; this.CalString = CalString; } // Constructor @Override public int getCount() { return nameCalStrings.length; } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } @Override public View getView(int i, View view, ViewGroup viewGroup) { LayoutInflater objLayoutInflater = (LayoutInflater) objContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View objView1 = objLayoutInflater.inflate(R.layout.seven_listview, viewGroup, false); //Setup Title TextView dateTextView = (TextView) objView1.findViewById(R.id.textView95); dateTextView.setText(dateStrings[i]); TextView nameTextView = (TextView) objView1.findViewById(R.id.namelist1); nameTextView.setText(nameCalStrings[i]); TextView numTextView = (TextView) objView1.findViewById(R.id.numlist1); numTextView.setText(numCalString[i]); TextView calTextView = (TextView) objView1.findViewById(R.id.callist1); calTextView.setText(CalString[i]); return objView1; } } // Main Class
8a643ea9752ac9ba285d9b3a70d703e3e82a40c2
4c127b63ff867a1dac299163bbadc2dbf8b66ed5
/src/main/java/com/epam/izh/rd/online/JavaBasics.java
9752bddaf4a60f65679e8ba81d57499f06dd3255
[]
no_license
PetrovKirillDev/java-basics-template
9706ea5a581ed60ad3053fb5725b2f8491a6685b
9dc89fb3da3871e9976adf8dc5f2a4d6d3a1fc0c
refs/heads/master
2023-08-03T12:09:31.292723
2021-09-28T11:31:25
2021-09-28T11:31:25
381,332,317
0
0
null
2021-09-28T11:31:26
2021-06-29T10:55:26
null
UTF-8
Java
false
false
113
java
package com.epam.izh.rd.online; public class JavaBasics { public static void main(String[] args) { } }
61a8cc97566f8dc26de3dbbdc0d07bb726299130
cf598c31f13ff81549da54f3b0305e1895e3eb01
/src/main/java/br/com/alura/forum/controllers/dto/ResponseDTO.java
2619bf42217c68631aee07b5a1365fcf69b0d5ce
[]
no_license
ghisiluizgustavo/alura-spring-boot
5343258a92dfe25086318943d81abc41517be6f7
98c8dca17f2d4cb5dab4a5aa16761cd7dfeb94c3
refs/heads/master
2023-07-21T12:01:20.665182
2021-09-03T18:06:11
2021-09-03T18:06:11
321,526,838
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package br.com.alura.forum.controllers.dto; import br.com.alura.forum.models.Resposta; import java.time.LocalDateTime; public class ResponseDTO { private final Long id; private final String message; private final LocalDateTime createdAt; private final String authorName; public ResponseDTO(Resposta resposta){ this.id = resposta.getId(); this.message = resposta.getMensagem(); this.createdAt = resposta.getDataCriacao(); this.authorName = resposta.getAutor().getNome(); } public Long getId() { return id; } public String getMessage() { return message; } public LocalDateTime getCreatedAt() { return createdAt; } public String getAuthorName() { return authorName; } }
0e280acc14db48b265a8530395aac10511936eae
2fac44767b0b9c1c8a77548e0bd1ab899f0ed408
/InnovationEE/src/BrideBillComparator/Formatter.java
a929de8a37fecf0fd1b061002df9c0fada112977
[]
no_license
loudrascal/innovationjava
91ca08c195ecbd93fc7b2047369c8684b762c988
9b405ee4f1780d508a653b0e3abeca548a77d43a
refs/heads/master
2020-04-17T00:38:41.029676
2019-01-23T14:07:34
2019-01-23T14:07:34
166,057,183
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package BrideBillComparator; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Iterator; import java.util.Map; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; /** * * @author HAGRAWA */ public class Formatter { public static String getTimeStamp(){ String timestamp = (new SimpleDateFormat("yyyyMMddhhmmss")).format(new Date()); return timestamp; } static JTable createTable(File eEDir,File bBDir,JTable ResultTable ){ FileOperations filename = new FileOperations(eEDir, bBDir); Map result = filename.startComparison(); DefaultTableModel model = (DefaultTableModel) ResultTable.getModel(); Iterator iterator = result.keySet().iterator(); int counter = 0; while (iterator.hasNext()) { Object key = iterator.next(); Object value = result.get(key); Object[] row = {counter + 1, key, value}; model.addRow(row); ++counter; } return ResultTable; } }
7046a83d286ed7db2afdd33f520dd47b83a4421d
40abcc4b6409cda83c2f84512ad7be81dfc5ab00
/src/main/java/com/sample/project/algorithm/leetcode/LongestPalindromeSubstring.java
65d9f43323d542866afa14f60e48e349c1f60bf1
[]
no_license
imteyaz-khan/algorithm
6f9eb27ca972197847ed19e1b523462a2297c732
8db13a63d482303be5083970124e93b28cd4bb1d
refs/heads/master
2021-01-11T14:30:50.419146
2017-10-08T19:23:44
2017-10-08T19:23:44
80,147,841
0
0
null
null
null
null
UTF-8
Java
false
false
1,870
java
package com.sample.project.algorithm.leetcode; /** * Created by imteyaz.khan on 07/08/17. */ public class LongestPalindromeSubstring { public String longestPalindrome(String s) { if(s==null) { return null; } int start=0; int end=0; for(int i=0;i<s.length();i++) { for(int j=s.length();j>i;j--) { if((j-i)<(end-start)) break; if(isPalindrome(s.substring(i,j))) { start=i; end=j; break; } } } System.out.println(start+":"+end); return s.substring(start,end); } private boolean isPalindrome(String s) { int start=0; int end=s.length()-1; while(end>=start) { if(s.charAt(start)!=s.charAt(end)) { return false; } end--; start++; } return true; } public String longestPalindromeCenter(String str) { int start=0; int end=0; for(int i=0;i<str.length();i++) { int len1=expandAroundCenter(str, i, i); int len2=expandAroundCenter(str, i, i + 1); int len=Math.max(len1,len2); if(len>(end-start)) { start=i-(len-1)/2; end=i+len/2; } } return str.substring(start,end+1); } private int expandAroundCenter(String str,int left,int right) { while(left>=0 && right<str.length() && str.charAt(left)==str.charAt(right)) { left--; right++; } return right-left-1; } public static void main(String[] args) { LongestPalindromeSubstring lpss=new LongestPalindromeSubstring(); System.out.println(lpss.longestPalindromeCenter("cmbbd")); } }
fe53580a5e59c908bab0058f4c0abe1d731100a9
33dce6b41dad39a7651d68b8b45943a2d8fac797
/app/src/main/java/com/cdio/ss3000/HelpActivity.java
988f1558f46b2df9779ba9beb04985e8ab6cc582
[]
no_license
alexnorgaard/ss3000
4b05d7cba08cfa839c335ee90bdeaa7faf86597f
7fe3605013b34d499a98101a75b76efb1a9673c6
refs/heads/main
2022-11-06T19:00:16.191775
2020-06-25T15:19:08
2020-06-25T15:19:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package com.cdio.ss3000; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.widget.TextView; public class HelpActivity extends AppCompatActivity { TextView helptext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); helptext = findViewById(R.id.brodtextTV); helptext.setMovementMethod(new ScrollingMovementMethod()); } }
b4aeb94af59ec63c26becd121f5ec765c7a86c99
41fda93dd5b89f480d67cd27c84204425c76946d
/target/tomcat/work/Tomcat/localhost/QuanLybanDienThoai/org/apache/jsp/pages/DT/addDT_jsp.java
0268d767dfb4fa6669ffd2e64335b4602d134fb2
[]
no_license
NguyenHoang1996/JeeProject-ManageCellPhones
daf1d0c418ac7959e5d4a4207e7141735325e97f
a53d13d2fcca3f21337bac5dff2219870c53b52f
refs/heads/master
2020-03-24T09:48:34.930865
2018-07-28T02:02:56
2018-07-28T02:02:56
142,638,072
0
0
null
null
null
null
UTF-8
Java
false
false
41,892
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.47 * Generated at: 2018-06-17 08:38:17 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.pages.DT; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class addDT_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005furl_0026_005fvar_005fvalue_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcommandName_005faction; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005fselect_0026_005fpath_005fitems_005fitemValue_005fitemLabel_005fclass; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _005fjspx_005ftagPool_005fc_005furl_0026_005fvar_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcommandName_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fform_005fselect_0026_005fpath_005fitems_005fitemValue_005fitemLabel_005fclass = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { _005fjspx_005ftagPool_005fc_005furl_0026_005fvar_005fvalue_005fnobody.release(); _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcommandName_005faction.release(); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.release(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.release(); _005fjspx_005ftagPool_005fform_005fselect_0026_005fpath_005fitems_005fitemValue_005fitemLabel_005fclass.release(); } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<h3>Thêm điện thoại</h3>\r\n"); out.write("<div class=\"xs\">\r\n"); out.write("\t"); if (_jspx_meth_c_005furl_005f0(_jspx_page_context)) return; out.write('\r'); out.write('\n'); out.write(' '); // form:form org.springframework.web.servlet.tags.form.FormTag _jspx_th_form_005fform_005f0 = (org.springframework.web.servlet.tags.form.FormTag) _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcommandName_005faction.get(org.springframework.web.servlet.tags.form.FormTag.class); _jspx_th_form_005fform_005f0.setPageContext(_jspx_page_context); _jspx_th_form_005fform_005f0.setParent(null); // /pages/DT/addDT.jsp(8,1) name = action type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fform_005f0.setAction((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${url}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); // /pages/DT/addDT.jsp(8,1) name = commandName type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fform_005f0.setCommandName("addDTForm"); // /pages/DT/addDT.jsp(8,1) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fform_005f0.setMethod("post"); int[] _jspx_push_body_count_form_005fform_005f0 = new int[] { 0 }; try { int _jspx_eval_form_005fform_005f0 = _jspx_th_form_005fform_005f0.doStartTag(); if (_jspx_eval_form_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n"); out.write("\t\t<fieldset>\r\n"); out.write("\t\t\t<div class=\"form-group "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${status.error ? 'has-error' : ''}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">\r\n"); out.write("\t\t\t\t<label class=\"control-label\" for=\"ten\">Tên(*)</label>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_form_005finput_005f0(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0)) return; out.write("\r\n"); out.write("\t\t\t\t<p class=\"help-block\">\r\n"); out.write("\t\t\t\t\t"); // form:errors org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f0 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class); _jspx_th_form_005ferrors_005f0.setPageContext(_jspx_page_context); _jspx_th_form_005ferrors_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(15,5) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005ferrors_005f0.setPath("ten"); // /pages/DT/addDT.jsp(15,5) null _jspx_th_form_005ferrors_005f0.setDynamicAttribute(null, "class", "control-label"); int[] _jspx_push_body_count_form_005ferrors_005f0 = new int[] { 0 }; try { int _jspx_eval_form_005ferrors_005f0 = _jspx_th_form_005ferrors_005f0.doStartTag(); if (_jspx_th_form_005ferrors_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005ferrors_005f0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005ferrors_005f0.doCatch(_jspx_exception); } finally { _jspx_th_form_005ferrors_005f0.doFinally(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.reuse(_jspx_th_form_005ferrors_005f0); } out.write("\r\n"); out.write("\t\t\t\t</p>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t<div class=\"form-group "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${status.error ? 'has-error' : ''}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">\r\n"); out.write("\t\t\t\t<label class=\"control-label\" for=\"soLuong\">Số lượng(*)</label>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_form_005finput_005f1(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0)) return; out.write("\r\n"); out.write("\t\t\t\t<p class=\"help-block\">\r\n"); out.write("\t\t\t\t\t"); // form:errors org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f1 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class); _jspx_th_form_005ferrors_005f1.setPageContext(_jspx_page_context); _jspx_th_form_005ferrors_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(23,5) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005ferrors_005f1.setPath("soLuong"); // /pages/DT/addDT.jsp(23,5) null _jspx_th_form_005ferrors_005f1.setDynamicAttribute(null, "class", "control-label"); int[] _jspx_push_body_count_form_005ferrors_005f1 = new int[] { 0 }; try { int _jspx_eval_form_005ferrors_005f1 = _jspx_th_form_005ferrors_005f1.doStartTag(); if (_jspx_th_form_005ferrors_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005ferrors_005f1[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005ferrors_005f1.doCatch(_jspx_exception); } finally { _jspx_th_form_005ferrors_005f1.doFinally(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.reuse(_jspx_th_form_005ferrors_005f1); } out.write("\r\n"); out.write("\t\t\t\t</p>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t<div class=\"form-group "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${status.error ? 'has-error' : ''}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">\r\n"); out.write("\t\t\t\t<label class=\"control-label\" for=\"giaNhap\">Giá nhập(*)</label>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_form_005finput_005f2(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0)) return; out.write("\r\n"); out.write("\t\t\t\t<p class=\"help-block\">\r\n"); out.write("\t\t\t\t\t"); // form:errors org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f2 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class); _jspx_th_form_005ferrors_005f2.setPageContext(_jspx_page_context); _jspx_th_form_005ferrors_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(31,5) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005ferrors_005f2.setPath("giaNhap"); // /pages/DT/addDT.jsp(31,5) null _jspx_th_form_005ferrors_005f2.setDynamicAttribute(null, "class", "control-label"); int[] _jspx_push_body_count_form_005ferrors_005f2 = new int[] { 0 }; try { int _jspx_eval_form_005ferrors_005f2 = _jspx_th_form_005ferrors_005f2.doStartTag(); if (_jspx_th_form_005ferrors_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005ferrors_005f2[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005ferrors_005f2.doCatch(_jspx_exception); } finally { _jspx_th_form_005ferrors_005f2.doFinally(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.reuse(_jspx_th_form_005ferrors_005f2); } out.write("\r\n"); out.write("\t\t\t\t</p>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t<div class=\"form-group "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${status.error ? 'has-error' : ''}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">\r\n"); out.write("\t\t\t\t<label class=\"control-label\" for=\"giaBan\">Giá bán(*)</label>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_form_005finput_005f3(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0)) return; out.write("\r\n"); out.write("\t\t\t\t<p class=\"help-block\">\r\n"); out.write("\t\t\t\t\t"); // form:errors org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f3 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class); _jspx_th_form_005ferrors_005f3.setPageContext(_jspx_page_context); _jspx_th_form_005ferrors_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(39,5) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005ferrors_005f3.setPath("giaBan"); // /pages/DT/addDT.jsp(39,5) null _jspx_th_form_005ferrors_005f3.setDynamicAttribute(null, "class", "control-label"); int[] _jspx_push_body_count_form_005ferrors_005f3 = new int[] { 0 }; try { int _jspx_eval_form_005ferrors_005f3 = _jspx_th_form_005ferrors_005f3.doStartTag(); if (_jspx_th_form_005ferrors_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005ferrors_005f3[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005ferrors_005f3.doCatch(_jspx_exception); } finally { _jspx_th_form_005ferrors_005f3.doFinally(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.reuse(_jspx_th_form_005ferrors_005f3); } out.write("\r\n"); out.write("\t\t\t\t</p>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t<div class=\"form-group "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${status.error ? 'has-error' : ''}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">\r\n"); out.write("\t\t\t\t<label class=\"control-label\" for=\"bh\">Bảo hành (năm)(*)</label>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_form_005finput_005f4(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0)) return; out.write("\r\n"); out.write("\t\t\t\t<p class=\"help-block\">\r\n"); out.write("\t\t\t\t\t"); // form:errors org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f4 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class); _jspx_th_form_005ferrors_005f4.setPageContext(_jspx_page_context); _jspx_th_form_005ferrors_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(47,5) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005ferrors_005f4.setPath("bh"); // /pages/DT/addDT.jsp(47,5) null _jspx_th_form_005ferrors_005f4.setDynamicAttribute(null, "class", "control-label"); int[] _jspx_push_body_count_form_005ferrors_005f4 = new int[] { 0 }; try { int _jspx_eval_form_005ferrors_005f4 = _jspx_th_form_005ferrors_005f4.doStartTag(); if (_jspx_th_form_005ferrors_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005ferrors_005f4[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005ferrors_005f4.doCatch(_jspx_exception); } finally { _jspx_th_form_005ferrors_005f4.doFinally(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.reuse(_jspx_th_form_005ferrors_005f4); } out.write("\r\n"); out.write("\t\t\t\t</p>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t<div class=\"form-group "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${status.error ? 'has-error' : ''}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">\r\n"); out.write("\t\t\t\t<label class=\"control-label\" for=\"hdhID\">Hệ điều hành(*) </label>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_form_005fselect_005f0(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0)) return; out.write("\r\n"); out.write("\t\t\t\t<p class=\"help-block\">\r\n"); out.write("\t\t\t\t\t"); // form:errors org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f5 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class); _jspx_th_form_005ferrors_005f5.setPageContext(_jspx_page_context); _jspx_th_form_005ferrors_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(56,5) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005ferrors_005f5.setPath("hdhID"); // /pages/DT/addDT.jsp(56,5) null _jspx_th_form_005ferrors_005f5.setDynamicAttribute(null, "class", "control-label"); int[] _jspx_push_body_count_form_005ferrors_005f5 = new int[] { 0 }; try { int _jspx_eval_form_005ferrors_005f5 = _jspx_th_form_005ferrors_005f5.doStartTag(); if (_jspx_th_form_005ferrors_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005ferrors_005f5[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005ferrors_005f5.doCatch(_jspx_exception); } finally { _jspx_th_form_005ferrors_005f5.doFinally(); _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fclass_005fnobody.reuse(_jspx_th_form_005ferrors_005f5); } out.write("\r\n"); out.write("\t\t\t\t</p>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t<div class=\"form-group\">\r\n"); out.write("\t\t\t\t<button type=\"submit\" class=\"btn btn-success\">Thêm</button>\r\n"); out.write("\t\t\t\t<button type=\"reset\" class=\"btn btn-danger\">Hủy</button>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t</fieldset>\r\n"); out.write("\t"); int evalDoAfterBody = _jspx_th_form_005fform_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_form_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005fform_005f0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005fform_005f0.doCatch(_jspx_exception); } finally { _jspx_th_form_005fform_005f0.doFinally(); _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcommandName_005faction.reuse(_jspx_th_form_005fform_005f0); } out.write("\r\n"); out.write("</div>\r\n"); out.write("<script type=\"text/javascript\">\r\n"); out.write("\tfunction removeCss(t) {\r\n"); out.write("\t\t$(t).parent().removeClass('has-error');\r\n"); out.write("\t\t$(t).parent().find('.help-block').remove();\r\n"); out.write("\t}\r\n"); out.write("</script>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_c_005furl_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:url org.apache.taglibs.standard.tag.rt.core.UrlTag _jspx_th_c_005furl_005f0 = (org.apache.taglibs.standard.tag.rt.core.UrlTag) _005fjspx_005ftagPool_005fc_005furl_0026_005fvar_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.UrlTag.class); _jspx_th_c_005furl_005f0.setPageContext(_jspx_page_context); _jspx_th_c_005furl_005f0.setParent(null); // /pages/DT/addDT.jsp(7,1) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005furl_005f0.setValue("/dt/them"); // /pages/DT/addDT.jsp(7,1) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005furl_005f0.setVar("url"); int _jspx_eval_c_005furl_005f0 = _jspx_th_c_005furl_005f0.doStartTag(); if (_jspx_th_c_005furl_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005furl_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005furl_005f0); return true; } _005fjspx_005ftagPool_005fc_005furl_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005furl_005f0); return false; } private boolean _jspx_meth_form_005finput_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // form:input org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f0 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class); _jspx_th_form_005finput_005f0.setPageContext(_jspx_page_context); _jspx_th_form_005finput_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(12,4) null _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "type", "text"); // /pages/DT/addDT.jsp(12,4) null _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "class", "form-control1"); // /pages/DT/addDT.jsp(12,4) null _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "required", "required"); // /pages/DT/addDT.jsp(12,4) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f0.setPath("ten"); // /pages/DT/addDT.jsp(12,4) name = onfocus type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f0.setOnfocus("removeCss(this);"); int[] _jspx_push_body_count_form_005finput_005f0 = new int[] { 0 }; try { int _jspx_eval_form_005finput_005f0 = _jspx_th_form_005finput_005f0.doStartTag(); if (_jspx_th_form_005finput_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005finput_005f0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005finput_005f0.doCatch(_jspx_exception); } finally { _jspx_th_form_005finput_005f0.doFinally(); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f0); } return false; } private boolean _jspx_meth_form_005finput_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // form:input org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f1 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class); _jspx_th_form_005finput_005f1.setPageContext(_jspx_page_context); _jspx_th_form_005finput_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(20,4) null _jspx_th_form_005finput_005f1.setDynamicAttribute(null, "type", "text"); // /pages/DT/addDT.jsp(20,4) null _jspx_th_form_005finput_005f1.setDynamicAttribute(null, "class", "form-control1"); // /pages/DT/addDT.jsp(20,4) null _jspx_th_form_005finput_005f1.setDynamicAttribute(null, "required", "required"); // /pages/DT/addDT.jsp(20,4) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f1.setPath("soLuong"); // /pages/DT/addDT.jsp(20,4) name = onfocus type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f1.setOnfocus("removeCss(this);"); int[] _jspx_push_body_count_form_005finput_005f1 = new int[] { 0 }; try { int _jspx_eval_form_005finput_005f1 = _jspx_th_form_005finput_005f1.doStartTag(); if (_jspx_th_form_005finput_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005finput_005f1[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005finput_005f1.doCatch(_jspx_exception); } finally { _jspx_th_form_005finput_005f1.doFinally(); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f1); } return false; } private boolean _jspx_meth_form_005finput_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // form:input org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f2 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class); _jspx_th_form_005finput_005f2.setPageContext(_jspx_page_context); _jspx_th_form_005finput_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(28,4) null _jspx_th_form_005finput_005f2.setDynamicAttribute(null, "type", "text"); // /pages/DT/addDT.jsp(28,4) null _jspx_th_form_005finput_005f2.setDynamicAttribute(null, "class", "form-control1"); // /pages/DT/addDT.jsp(28,4) null _jspx_th_form_005finput_005f2.setDynamicAttribute(null, "required", "required"); // /pages/DT/addDT.jsp(28,4) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f2.setPath("giaNhap"); // /pages/DT/addDT.jsp(28,4) name = onfocus type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f2.setOnfocus("removeCss(this);"); int[] _jspx_push_body_count_form_005finput_005f2 = new int[] { 0 }; try { int _jspx_eval_form_005finput_005f2 = _jspx_th_form_005finput_005f2.doStartTag(); if (_jspx_th_form_005finput_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005finput_005f2[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005finput_005f2.doCatch(_jspx_exception); } finally { _jspx_th_form_005finput_005f2.doFinally(); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f2); } return false; } private boolean _jspx_meth_form_005finput_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // form:input org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f3 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class); _jspx_th_form_005finput_005f3.setPageContext(_jspx_page_context); _jspx_th_form_005finput_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(36,4) null _jspx_th_form_005finput_005f3.setDynamicAttribute(null, "type", "text"); // /pages/DT/addDT.jsp(36,4) null _jspx_th_form_005finput_005f3.setDynamicAttribute(null, "class", "form-control1"); // /pages/DT/addDT.jsp(36,4) null _jspx_th_form_005finput_005f3.setDynamicAttribute(null, "required", "required"); // /pages/DT/addDT.jsp(36,4) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f3.setPath("giaBan"); // /pages/DT/addDT.jsp(36,4) name = onfocus type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f3.setOnfocus("removeCss(this);"); int[] _jspx_push_body_count_form_005finput_005f3 = new int[] { 0 }; try { int _jspx_eval_form_005finput_005f3 = _jspx_th_form_005finput_005f3.doStartTag(); if (_jspx_th_form_005finput_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005finput_005f3[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005finput_005f3.doCatch(_jspx_exception); } finally { _jspx_th_form_005finput_005f3.doFinally(); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f3); } return false; } private boolean _jspx_meth_form_005finput_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // form:input org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f4 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class); _jspx_th_form_005finput_005f4.setPageContext(_jspx_page_context); _jspx_th_form_005finput_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(44,4) null _jspx_th_form_005finput_005f4.setDynamicAttribute(null, "type", "text"); // /pages/DT/addDT.jsp(44,4) null _jspx_th_form_005finput_005f4.setDynamicAttribute(null, "class", "form-control1"); // /pages/DT/addDT.jsp(44,4) null _jspx_th_form_005finput_005f4.setDynamicAttribute(null, "required", "required"); // /pages/DT/addDT.jsp(44,4) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f4.setPath("bh"); // /pages/DT/addDT.jsp(44,4) name = onfocus type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005finput_005f4.setOnfocus("removeCss(this);"); int[] _jspx_push_body_count_form_005finput_005f4 = new int[] { 0 }; try { int _jspx_eval_form_005finput_005f4 = _jspx_th_form_005finput_005f4.doStartTag(); if (_jspx_th_form_005finput_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005finput_005f4[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005finput_005f4.doCatch(_jspx_exception); } finally { _jspx_th_form_005finput_005f4.doFinally(); _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005frequired_005fpath_005fonfocus_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f4); } return false; } private boolean _jspx_meth_form_005fselect_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // form:select org.springframework.web.servlet.tags.form.SelectTag _jspx_th_form_005fselect_005f0 = (org.springframework.web.servlet.tags.form.SelectTag) _005fjspx_005ftagPool_005fform_005fselect_0026_005fpath_005fitems_005fitemValue_005fitemLabel_005fclass.get(org.springframework.web.servlet.tags.form.SelectTag.class); _jspx_th_form_005fselect_005f0.setPageContext(_jspx_page_context); _jspx_th_form_005fselect_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0); // /pages/DT/addDT.jsp(52,4) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fselect_005f0.setPath("hdhID"); // /pages/DT/addDT.jsp(52,4) null _jspx_th_form_005fselect_005f0.setDynamicAttribute(null, "class", "form-control1"); // /pages/DT/addDT.jsp(52,4) name = items type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fselect_005f0.setItems((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${listHDH}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); // /pages/DT/addDT.jsp(52,4) name = itemValue type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fselect_005f0.setItemValue("id"); // /pages/DT/addDT.jsp(52,4) name = itemLabel type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_form_005fselect_005f0.setItemLabel("ten"); int[] _jspx_push_body_count_form_005fselect_005f0 = new int[] { 0 }; try { int _jspx_eval_form_005fselect_005f0 = _jspx_th_form_005fselect_005f0.doStartTag(); if (_jspx_eval_form_005fselect_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n"); out.write("\t\t\t\t"); int evalDoAfterBody = _jspx_th_form_005fselect_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_form_005fselect_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_form_005fselect_005f0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_form_005fselect_005f0.doCatch(_jspx_exception); } finally { _jspx_th_form_005fselect_005f0.doFinally(); _005fjspx_005ftagPool_005fform_005fselect_0026_005fpath_005fitems_005fitemValue_005fitemLabel_005fclass.reuse(_jspx_th_form_005fselect_005f0); } return false; } }
01afeb0b7ddf655c3aec9e4da135578c9c4aaeb2
3a5985651d77a31437cfdac25e594087c27e93d6
/driver-tests/performance/JMSBased/jmsBasedBenchmarkDriver/src/com/sun/jbi/performance/jmsbd/EventCollector.java
1b2e5f8237f2b3220de74c2926cc8a5ec87a0865
[]
no_license
vitalif/openesb-components
a37d62133d81edb3fdc091abd5c1d72dbe2fc736
560910d2a1fdf31879e3d76825edf079f76812c7
refs/heads/master
2023-09-04T14:40:55.665415
2016-01-25T13:12:22
2016-01-25T13:12:33
48,222,841
0
5
null
null
null
null
UTF-8
Java
false
false
6,255
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.sun.jbi.performance.jmsbd; import com.sun.jbi.engine.iep.core.runtime.operator.Inserter; import com.sun.jbi.engine.iep.core.runtime.operator.Operator; import com.sun.jbi.engine.iep.core.runtime.util.Util; import java.sql.Connection; import java.sql.PreparedStatement; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Properties; import java.util.StringTokenizer; import javax.jms.JMSException; import javax.jms.QueueReceiver; import javax.jms.QueueSession; import javax.jms.TextMessage; /** * * @author Bing Lu */ public class EventCollector implements Runnable { static final int mServerConnectionRetries = 10; static final int mServerConectionRetryInterval = 2000; private static int mRetryCount = 0; private Operator mOperator; private String mJmsServerHostName; private String mJmsServerPort; private String mQueueName; private Properties mProperties; private Thread mThread; private boolean mRunning; private boolean mStopped; private Object mStoppedMonitor = new Object(); private List<Object[]> mRowList = new LinkedList<Object[]>(); public EventCollector(Operator operator, String queueName, Properties properties) { mOperator = operator; mQueueName = queueName; mProperties = properties; mJmsServerHostName = mProperties.getProperty("JmsServerHostName"); mJmsServerPort = mProperties.getProperty("JmsServerPort"); } public void start() { mThread = new Thread(this, "Event collector"); mThread.start(); } public void run() { HashMap hashMap = null; Connection con = null; PreparedStatement insertStmt = null; try { con = Util.getConnection(mProperties); con.setAutoCommit(false); insertStmt = ((Inserter) mOperator).getInsertStatement(con, true); hashMap = JMSHelper.createQueueReceiver(mJmsServerHostName, mJmsServerPort, mQueueName); QueueReceiver queueReceiver = (QueueReceiver)hashMap.get("QueueReceiver"); QueueSession queueSession = (QueueSession)hashMap.get("QueueSession"); TextMessage receivedTextMessage = null; mRunning = true; mStopped = false; while (mRunning) { try { receivedTextMessage = (TextMessage) queueReceiver.receive(1000); if (receivedTextMessage == null) { continue; } } catch (JMSException e) { hashMap = retryConnection(); if (hashMap != null) { // reset retry count mRetryCount = 0; queueReceiver = (QueueReceiver)hashMap.get("QueueReceiver"); queueSession = (QueueSession)hashMap.get("QueueSession"); continue; } else { throw e; } } try { while (mRunning) { process(receivedTextMessage); // 1 millisecond is the smallest time period to specify receivedTextMessage = (TextMessage) queueReceiver.receive(1); if (receivedTextMessage == null) { // time is expired break; } } batchProcess(con, insertStmt); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { if (mRunning) { e.printStackTrace(); } } finally { Util.close(insertStmt); Util.close(con); JMSHelper.closeConnectionAndSession(hashMap); mStopped = true; synchronized (mStoppedMonitor) { mStoppedMonitor.notifyAll(); } System.out.println("Event collector is stopped successfully"); } } public void stopAndWait() { mRunning = false; while (!mStopped) { synchronized (mStoppedMonitor) { try { mStoppedMonitor.wait(); } catch (InterruptedException e) { } } } } private void process(TextMessage msg) { try { String txt = msg.getText(); StringTokenizer st = new StringTokenizer(txt, ","); ArrayList list = new ArrayList(); while (st.hasMoreTokens()) { list.add(st.nextToken()); } mRowList.add(list.toArray()); } catch (Exception e) { e.printStackTrace(); } } private void batchProcess(Connection con, PreparedStatement insertStmt) throws Exception { insertStmt.clearBatch(); for (Object[] row : mRowList) { for (int i = 0; i < row.length; i++) { insertStmt.setObject(i+1, row[i]); } insertStmt.addBatch(); } insertStmt.executeBatch(); con.commit(); mRowList.clear(); } private HashMap retryConnection() { try { if (mRetryCount++ < mServerConnectionRetries) { System.out.println("Waiting " + mServerConectionRetryInterval + " secs before restarting JMS server"); try { Thread.sleep(mServerConectionRetryInterval * 1000); } catch(InterruptedException e) { System.out.println("Exception occurred while the thread was sleeping."); } return JMSHelper.createQueueReceiver(mJmsServerHostName, mJmsServerPort, mQueueName); } } catch (Exception e) { if (mRetryCount < mServerConnectionRetries) { return retryConnection(); } } return null; } }
c3f263680730f058566ad197f3063bd3cc7909e2
6a479406b9113f57fa8508a520e438eac8305bea
/项目/myseacher/src/main/java/com/peixinchen/demo/GetClassPath.java
a2b51362b9026289e4ff611abe60ea281ec7e2c0
[]
no_license
wah369/web
3025384bdee4fa6d459ae658c8db9b238e676710
1b65c3c90dc6363241fc70e8515d7c2fff7e954f
refs/heads/master
2023-03-20T11:36:08.274456
2021-03-17T15:40:49
2021-03-17T15:40:49
316,527,751
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.peixinchen.demo; import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLDecoder; public class GetClassPath { public static void main(String[] args) throws UnsupportedEncodingException { String classesPath = GetClassPath.class.getProtectionDomain() .getCodeSource().getLocation().getFile(); System.out.println(classesPath); String decode = URLDecoder.decode(classesPath, "UTF-8"); System.out.println(decode); File classesDir = new File(decode); System.out.println(classesDir.getAbsoluteFile()); } }
50b4bd609053585631727b8cac5d6db654810d04
0d430563d908de7cda867380b6fe85e77be11c3d
/workspace/spring-security-demo-02-basic-security/src/main/java/com/luv2code/springsecurity/demo/config/DemoSecurityConfig.java
8bf140b2e5d3ebb96c8a44cd585a1928e4b9fa62
[]
no_license
hshar89/MyCodes
e2eec3b9a2649fec04e5b391d0ca3d4d9d5ae6dc
e388f005353c9606873b6cafdfce1e92d13273e7
refs/heads/master
2022-12-23T00:36:01.951137
2020-04-03T13:39:22
2020-04-03T13:39:22
252,720,397
1
0
null
2022-12-16T00:35:41
2020-04-03T12:04:10
Java
UTF-8
Java
false
false
1,536
java
package com.luv2code.springsecurity.demo.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User.UserBuilder; @Configuration @EnableWebSecurity public class DemoSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { //add our users for in memory authentication UserBuilder users = User.withDefaultPasswordEncoder(); auth.inMemoryAuthentication() .withUser(users.username("john").password("test123").roles("EMPLOYEE")) .withUser(users.username("susan").password("test123").roles("ADMIN")) .withUser(users.username("mary").password("test123").roles("MANAGER")); super.configure(auth); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .anyRequest().authenticated() .and() .formLogin() .loginPage("/showMyLoginPage") .loginProcessingUrl("/authenticateTheUser") .permitAll(); super.configure(http); } }
b8f60f7e787c2f2ad4c2a862b828b5cec2c3d166
c5ea815d9a200dd990878f2c3a2bb47f79903664
/src/DAOS/AgregarPuntosAtencionDAO.java
3a66c0f5b9860a08aaaf62accc8b22eadc4593cc
[]
no_license
aczuleta/SistemasTransaccionales
3a805065f373da747f3cc6e0c1bc91d10380c66a
86225178891ad5c09bdf742e0630bce8dd2e69a8
refs/heads/master
2021-05-29T22:47:42.864113
2015-11-26T14:16:53
2015-11-26T14:16:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,090
java
package DAOS; import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import java.util.Random; import _ASTools.UsaRandom; public class AgregarPuntosAtencionDAO { private static final String ARCHIVO_CONEXION = "/../conexion.properties"; UsaRandom usaRandom; int maxPuntosAtencion; public Connection conexion; private String usuario; private String clave; private String cadenaConexion; public AgregarPuntosAtencionDAO() { inicializar("./Conexion/conexion.properties"); usaRandom = new UsaRandom(); } public void inicializar(String path) { try { File arch = new File(path+ARCHIVO_CONEXION); Properties prop = new Properties(); FileInputStream in = new FileInputStream ("C:/Users/Sergio/git/PROJECT_Sistrans/SistemasTransaccionales/WebContent/conexion.properties"); prop.load(in); in.close(); cadenaConexion = prop.getProperty("url"); usuario = prop.getProperty("usuario"); clave = prop.getProperty("clave"); @SuppressWarnings ("unused") final String driver = prop.getProperty("driver"); } catch (Exception e) { e.printStackTrace(); } } private void establecerConexion (String url, String usuario, String clave) throws SQLException { System.out.println("------- Oracle Connection Testing ------- "); try{ Class.forName("oracle.jdbc.OracleDriver"); } catch (ClassNotFoundException e) { System.out.println("Oracle JDBC driver is missing"); e.printStackTrace(); return; } System.out.println("Oracle JDBC Driver is Registered"); try { conexion = DriverManager.getConnection( "jdbc:oracle:thin:@fn3.oracle.virtual.uniandes.edu.co:1521:prod", "ISIS2304211520", "fyJEyG3u7wXA"); } catch (SQLException e) { System.out.println("Connection Failed"); e.printStackTrace(); return; } if(conexion != null) { System.out.println("You access to your dataBase"); } else { System.out.println("Connection Fail"); } } public void closeConnection (Connection connection) throws Exception { try { connection.close(); connection = null; } catch (SQLException exception) { throw new Exception("ERROR: ConsultaDAO: closeConnection() = cerrando una conexión."); } } public void agregarPuntosAtencion(int cantidadAgregar) throws SQLException { establecerConexion(cadenaConexion, usuario, clave); conexion.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); Random random = new Random(); for (int i = 0; i < cantidadAgregar; i++) { try { agregarPuntoAtencion(random); } catch (Exception e) { continue; } } } public void agregarPuntoAtencion(Random random) throws SQLException { String id = generarIdPuntoAtencion(); String tipo = "ATM"; String direccion = usaRandom.generarDireccionRandom(random); String[] ubicacion = usaRandom.generarUbicacionRandom(random); String ciudad = ubicacion[0]; String departamento = ubicacion[1]; Statement s = conexion.createStatement(); String sql = "INSERT INTO PUNTOS_ATENCION(ID, TIPO, DIRECCION, CIUDAD, DEPARTAMENTO) " + "VALUES(" + id + ", '" + tipo + "', '" + direccion + "', '" + ciudad + "', '" + departamento + "')"; s.executeUpdate(sql); s.close(); System.out.println(sql); System.out.println("------------------------------------------------------"); maxPuntosAtencion++; } public String generarIdPuntoAtencion() throws SQLException { if (maxPuntosAtencion == 0) { Statement s = conexion.createStatement(); ResultSet rs = s.executeQuery("SELECT MAX(ID) FROM PUNTOS_ATENCION"); while (rs.next()) { maxPuntosAtencion = rs.getInt(1) + 1 ; } s.close(); rs.close(); } return String.valueOf(maxPuntosAtencion); } }
8c8a5b2df040b2efa64641e5fbc0621a8959d5ee
1c9bac38deccf17d10b4c90196f9a4832fc10f26
/src/main/java/com/book/store/dao/CategoryDao.java
c72b7e0581d33267ee5ffbdc211914aabcf319d9
[]
no_license
Imdrmas/book-store-spring
bc3c731261d2c657f95fbdf7a72a70895388a417
d0ff504716e67a2173b4af9e6e173981efa9d789
refs/heads/main
2023-02-11T17:04:00.013851
2021-01-09T19:35:37
2021-01-09T19:35:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package com.book.store.dao; import org.springframework.data.jpa.repository.JpaRepository; import com.book.store.modal.Category; public interface CategoryDao extends JpaRepository<Category, Long>{ }
60a7a1b2ea230d550cbc02be3dbc766f17c7aedb
e86b6a5c635da579f6117dab34f8144b9756fed4
/Code/FreshDirect/src/main/java/com/yearjane/enums/ResultResponseEnum.java
2a8956b9433ab26b06318faa0ec089cb17724f52
[]
no_license
CFDreamer/fresh_direct
9ebdad9797acd6c51be1f1b6f961165a67f6a122
61b34200a6aa36c3c996e14da5408d597cb2e1d3
refs/heads/master
2022-01-10T06:25:51.744228
2019-05-30T05:05:14
2019-05-30T05:05:14
189,348,803
0
0
null
null
null
null
UTF-8
Java
false
false
2,162
java
package com.yearjane.enums; public enum ResultResponseEnum { //成功返回 RESULTSUCCESS(0, "成功!"), RESULTOK(200, "操作成功!"), USER_INSERT_ERROR(1001,"注册失败!"), USERNAME_EXIT(1002,"用户名已经存在!"), LOGIN_SUCCESS(1003,"登录成功!"), LOGIN_FAIL(1004,"登录失败!"), PHONE_NOTREGISTER(1005,"手机号未注册"), PHONE_REGISTERED(1006,"手机号已经被注册"), CODE_SEND_SUCCESS(1007,"验证码发送成功"), NO_POWER(1008,"没有操作权限"), RESULT_FAIL(1009,"操作失败"), USER_NOLOGIN(10010,"用户尚未登录"), USER_UPDATE_FAIL(1011,"更新失败"), USER_UPDATE_SUCCESS(1012,"更新成功"), BIRTHDAY_ERROR(1013,"生日格式错误"), PHONE_CAPTCHA_INPUT_ERROR(1014,"手机验证码输入错误"), PICTURE_CAPTCHA_INPUT_ERROR(1015,"图片验证码输入错误"), GOODSTYPE_ADD_FAIL(1016,"商品类型添加失败"), GOODSTYPE_ADD_SUCCESS(1017,"商品类型添加成功"), GOODSTYPE_UPDATE_FAIL(1018,"商品类型更新失败"), GOODSTYPE_UPDATE_SUCCESS(1019,"商品类型更新成功"), GOODSTYPE_TYPENAME_EXITED(1020,"商品类型已经存在"), GOODS_NAME_EXIST(1021,"商品名称已经存在"), COLLECTION_EXIST(1022,"已经收藏该商品"), ORDER_ADD_FAIL(1023,"已经收藏该商品"), ORDER_DATIAL_ADD_FAIL(1024,"已经收藏该商品"), USER_NOT_ALLOW_LOGIN(1025,"由于您的违规操作,你的账号被封!"), SYSTEM_INNER_ERROR(-1001,"系统内部错误!"); private Integer resultCode; private String resultMessge; private ResultResponseEnum(Integer resultCode, String resultMessge) { this.resultCode = resultCode; this.resultMessge = resultMessge; } public Integer getResultCode() { return resultCode; } public String getResultMessge() { return resultMessge; } /** * 根据返回的状态码,获取返回值 * @param resultCode * @return */ public static String getResultMessageByCode(Integer resultCode) { String messge=null; for(ResultResponseEnum responseEnum:ResultResponseEnum.values()) { if(resultCode.equals(responseEnum.getResultCode())) { messge=responseEnum.getResultMessge(); } } return messge; } }
7f8bc6c5bd35e89e6beebafbdd6629ac76dcd6d1
b0f4d88bd9ff18e9c01703f04a1fad0fd95a775a
/src/beacons/logic/BeaconsController.java
2f5ba8113411669631b368b4382d3503ea08f188
[ "MIT" ]
permissive
mrumka/pip-templates-microservice-java
749c198c5354a592023fa86d49e002bd2115550d
f0d416329974693fa33fb272a98ee17f98081e14
refs/heads/master
2020-05-02T11:00:05.624115
2019-03-20T06:11:15
2019-03-20T06:11:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,169
java
package beacons.logic; import java.util.List; import org.pipservices3.commons.commands.*; import org.pipservices3.commons.config.ConfigParams; import org.pipservices3.commons.config.IConfigurable; import org.pipservices3.commons.data.*; import org.pipservices3.commons.errors.ApplicationException; import org.pipservices3.commons.errors.ConfigException; import org.pipservices3.commons.refer.*; import beacons.data.version1.*; import beacons.persistence.IBeaconsPersistence; public class BeaconsController implements IReferenceable, ICommandable, IBeaconsController, IConfigurable { private IBeaconsPersistence _persistence; private BeaconsCommandSet _commandSet; public BeaconsController() { } @Override public void configure(ConfigParams config) throws ConfigException { } public void setReferences(IReferences references) throws ReferenceException { _persistence = (IBeaconsPersistence) references .getOneRequired(new Descriptor("beacons", "persistence", "*", "*", "1.0")); } @Override public CommandSet getCommandSet() { return _commandSet != null ? _commandSet : new BeaconsCommandSet(this); } @Override public DataPage<BeaconV1> getBeaconsByFilter(String correlationId, FilterParams filter, PagingParams paging) throws ApplicationException { return _persistence.getPageByFilter(correlationId, filter, paging); } @Override public BeaconV1 getBeaconsById(String correlationId, String id) throws ApplicationException { return _persistence.getOneById(correlationId, id); } @Override public BeaconV1 getBeaconsByUdi(String correlationId, String udi) throws ApplicationException { return _persistence.getOneByUdi(correlationId, udi); } @Override public CenterObjectV1 calculatePosition(String correlationId, String siteId, String[] udis) throws ApplicationException { if (udis == null || udis.length == 0) return null; DataPage<BeaconV1> result = _persistence.getPageByFilter(correlationId, FilterParams.fromTuples("site_id", siteId, "udis", udis), null); List<BeaconV1> beacons = result.getData(); double lat = 0; double lng = 0; int count = 0; for (BeaconV1 beacon : beacons) { if (beacon.getCenter() != null && beacon.getCenter().getType().equals("Point") && beacon.getCenter().getCoordinates() != null && beacon.getCenter().getCoordinates().size() > 1) { List<Double> coordinates = beacon.getCenter().getCoordinates(); lng += coordinates.get(0); lat += coordinates.get(1); count += 1; } } if (count > 0) { CenterObjectV1 position = new CenterObjectV1("Point", new double[] { lng / count, lat / count }); return position; } return null; } @Override public BeaconV1 createBeacon(String correlationId, BeaconV1 item) throws ApplicationException { return _persistence.create(correlationId, item); } @Override public BeaconV1 updateBeacon(String correlationId, BeaconV1 item) throws ApplicationException { return _persistence.update(correlationId, item); } @Override public BeaconV1 deleteBeaconById(String correlationId, String id) throws ApplicationException { return _persistence.deleteById(correlationId, id); } }
0df5d8b5897426af2ef8bff46073235bf4f78ae3
85b06a3f7420b07290815bae81077b721e1a4486
/src/main/java/com/cloud/memory/controller/EnumTestController.java
43d1cd6fa1bc9e1e2958a113697a139a369739ee
[ "MIT" ]
permissive
mhearttzw/cloud-memory
6f44e48f6ecc1067c1c9d10cdf7109ef8e209939
ec381abf1a5c920483790aa4da3eea871ac473cd
refs/heads/master
2020-03-28T17:08:53.915028
2018-11-21T11:59:41
2018-11-21T11:59:41
148,761,784
0
0
null
null
null
null
UTF-8
Java
false
false
900
java
package com.cloud.memory.controller; import com.alibaba.fastjson.JSONObject; import com.cloud.memory.common.enums.BusinessCode; import com.cloud.memory.common.enums.ProductClassType; import com.cloud.memory.model.EnumTestModel; import com.cloud.memory.model.JsonResult; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @RequestMapping("/enum") public class EnumTestController { @RequestMapping("/test") public JsonResult enumTest(@RequestParam("name") String name, @RequestParam("enum") ProductClassType productClassType) { EnumTestModel enumTestModel = new EnumTestModel(); enumTestModel.setName(name); enumTestModel.setProductClassType(productClassType); return new JsonResult(BusinessCode.SUCCESS, JSONObject.toJSONString(enumTestModel)); } }
c3945b01d35b93831318390ee517b972a2a357e5
05f07899d8c5aff146eabebb3fd3193d3cebac7d
/PZNOOP/src/toString/Product.java
8c5571b0389115144e8e43bf9bf6084c220b38bf
[]
no_license
agungprastia1/PZN
662e8ce7bb73d4d69343ad172e5299462d1fe31b
90084a43d89f2dfa6b10cfca06c4615d37f02a35
refs/heads/master
2023-06-22T02:17:07.569952
2021-07-20T11:51:26
2021-07-20T11:51:26
374,004,865
0
0
null
2021-07-20T11:51:27
2021-06-05T02:42:48
Java
UTF-8
Java
false
false
673
java
package toString; import java.util.Objects; public class Product { public String name; public int price; public Product(String name,int price){ this.name = name; this.price = price; } public String toString(){ return "nama "+name+", price "+price; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Product product = (Product) o; return price == product.price && Objects.equals(name, product.name); } @Override public int hashCode() { return Objects.hash(name, price); } }
f99b754b57c51a82e5be1010211d170df8930de3
71962842a1c32beba7b38d79befb8ded1d30b86d
/app/src/main/java/com/panaceasoft/psmultistore/viewmodel/collection/ProductCollectionProductViewModel.java
53558838fc320375b04fd019a41ec87312302b0a
[]
no_license
davalmeyda/MultiStoreAndroid
4e438dc1a284b9f8af149017543ddf170464e1c0
0667f5c667315010fd76ca25c3b9a8351e7cbea7
refs/heads/master
2021-01-16T16:03:21.907784
2020-03-09T15:18:03
2020-03-09T15:18:03
243,177,399
1
0
null
2020-03-09T15:18:05
2020-02-26T05:34:35
Java
UTF-8
Java
false
false
3,721
java
package com.panaceasoft.psmultistore.viewmodel.collection; import com.panaceasoft.psmultistore.Config; import com.panaceasoft.psmultistore.repository.collection.ProductCollectionRepository; import com.panaceasoft.psmultistore.utils.AbsentLiveData; import com.panaceasoft.psmultistore.utils.Utils; import com.panaceasoft.psmultistore.viewmodel.common.PSViewModel; import com.panaceasoft.psmultistore.viewobject.Product; import com.panaceasoft.psmultistore.viewobject.common.Resource; import java.util.List; import javax.inject.Inject; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.Transformations; public class ProductCollectionProductViewModel extends PSViewModel { // for ProductCollectionHeader private final LiveData<Resource<List<Product>>> productCollectionProductListData; private MutableLiveData<ProductCollectionProductViewModel.TmpDataHolder> productCollectionProductListObj = new MutableLiveData<>(); private final LiveData<Resource<Boolean>> nextPageLoadingStateData; private MutableLiveData<ProductCollectionProductViewModel.TmpDataHolder> nextPageLoadingStateObj = new MutableLiveData<>(); //region Constructor @Inject ProductCollectionProductViewModel(ProductCollectionRepository repository) { Utils.psLog("Inside ProductViewModel"); // Latest ProductCollectionHeader List productCollectionProductListData = Transformations.switchMap(productCollectionProductListObj, obj -> { if (obj == null) { return AbsentLiveData.create(); } return repository.getProductCollectionProducts(Config.API_KEY, obj.limit, obj.offset, obj.id); }); nextPageLoadingStateData = Transformations.switchMap(nextPageLoadingStateObj, obj -> { if (obj == null) { return AbsentLiveData.create(); } return repository.getNextPageProductCollectionProduct(obj.limit, obj.offset, obj.id); }); } //endregion //region ProductCollectionHeader // Get ProductCollectionHeader public void setProductCollectionProductListObj(String limit, String offset, String id) { if (!isLoading) { ProductCollectionProductViewModel.TmpDataHolder tmpDataHolder = new ProductCollectionProductViewModel.TmpDataHolder(); tmpDataHolder.limit = limit; tmpDataHolder.offset = offset; tmpDataHolder.id = id; productCollectionProductListObj.setValue(tmpDataHolder); // start loading setLoadingState(true); } } public LiveData<Resource<List<Product>>> getProductCollectionProductListData() { return productCollectionProductListData; } //Get Latest ProductCollectionHeader Next Page public void setNextPageLoadingStateObj(String limit, String offset, String id) { if (!isLoading) { ProductCollectionProductViewModel.TmpDataHolder tmpDataHolder = new ProductCollectionProductViewModel.TmpDataHolder(); tmpDataHolder.limit = limit; tmpDataHolder.offset = offset; tmpDataHolder.id = id; nextPageLoadingStateObj.setValue(tmpDataHolder); // start loading setLoadingState(true); } } public LiveData<Resource<Boolean>> getNextPageLoadingStateData() { return nextPageLoadingStateData; } //endregion //region Holder class TmpDataHolder { public String offset = ""; String limit = ""; String id = ""; public Boolean isConnected = false; public String shopId = ""; } //endregion }
a4c593605cfd746e41e749c04e40425980f627fb
2f812bb134b09e1f0607e879cfcabf08ac296853
/app/src/main/java/com/unipad/http/HitopQuitLogin.java
b63c60ffa2abd4fa6eadab4b8667a8f61349f539
[ "Apache-2.0" ]
permissive
qiuzichi/MadBrain
35c455ebc0da891a50bfc5b5f0ed119b5baba6ad
3dcc615df19ae31e2d125b54e707825d5aba5a21
refs/heads/master
2020-04-05T22:53:59.532601
2016-11-01T06:08:12
2016-11-01T06:08:12
62,781,641
0
2
null
2016-07-07T06:42:38
2016-07-07T06:42:37
null
UTF-8
Java
false
false
1,362
java
package com.unipad.http; import com.unipad.AppContext; import com.unipad.brain.App; import com.unipad.brain.consult.entity.AdPictureBean; import com.unipad.brain.home.dao.NewsService; import com.unipad.brain.personal.dao.PersonCenterService; import com.unipad.common.Constant; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; /** * Created by gongkan on 2016/6/12. */ public class HitopQuitLogin extends HitopRequest<List<AdPictureBean>> { public HitopQuitLogin() { super(HttpConstant.USER_QUIT_APPLICATION); mParams.addBodyParameter("user_id", AppContext.instance().loginUser.getUserId()); } @Override public String buildRequestURL() { return null; } @Override public List handleJsonData(String json) { JSONObject jsObj = null; int result = -1; try { jsObj = new JSONObject(json); if (jsObj != null && jsObj.toString().length() != 0) { if (jsObj.getInt("ret_code") == 0) { result = 0; } } } catch (Exception e) { return null; } ((PersonCenterService) AppContext.instance().getService(Constant.PERSONCENTER)).noticeDataChange(HttpConstant.QUIT_APPLICATION, result); return null; } }
a5286f6004ca94c3be2c97afa97e6ef78dbc67ea
6e6cdcfb7f4c190d1c77c777a014accb832bcefa
/Java/com/thecodevillage/day_1/age.java
db96aeb30c086941848b62de54a9492e8a3ea430
[]
no_license
nickmwangemi/thecodevillage-java
cd356774e41793e7bce65968cd751d752c3fbddd
b7a7ac93b147aa7312dd091ab0b37c0000414c1a
refs/heads/master
2022-11-21T00:16:03.637444
2020-07-13T18:02:05
2020-07-13T18:02:05
276,166,886
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
class Age { public static void main(String[] args) { int myAge = 20; System.out.println("I am " + myAge + " years old"); } }
a66851064f806950e15ba40232060dafb03a186d
189d820ad0527b71a04596e385c6a84f904669d0
/exercise/src/exceptions/ex14/OnOffException2.java
5ce957d46213d89bd35c37ead8b82280d891457e
[ "Apache-2.0" ]
permissive
jhwsx/Think4JavaExamples
30484e128ce43ed3d1da0104b77d8e3fedee7b59
bf912a14def15c11a9a5eada308ddaae8e31ff8f
refs/heads/master
2023-07-06T17:27:18.738304
2021-08-08T12:33:57
2021-08-08T12:33:57
198,008,875
0
1
null
null
null
null
UTF-8
Java
false
false
77
java
package exceptions.ex14; public class OnOffException2 extends Exception { }
b1cd5cb9ee0f15ddf4ab4945bffe0cd1ab8a0efc
1194d509d9f12e5d7d3e180eedbed63efd1f99e4
/app/src/main/java/fr/epsi/verbes/VerbAdapter.java
fb5845e28fb781e72b0caaca917568964164f08f
[]
no_license
fredericlb/tp-android-verbes-poef
003a9241975dc721e286d6a9e00abcd612f3a23d
00a30cff504eca8ac904efc3d918680f281cf715
refs/heads/master
2020-04-24T10:20:42.270241
2019-02-26T11:36:40
2019-02-26T11:36:40
171,891,252
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package fr.epsi.verbes; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.TextView; import org.w3c.dom.Text; import java.util.ArrayList; public class VerbAdapter extends RecyclerView.Adapter<VerbsViewHolder> { private ArrayList<Verbe> verbes; public VerbAdapter(ArrayList<Verbe> verbes) { this.verbes = verbes; } @NonNull @Override public VerbsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { TextView text = (TextView) LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.verb_item, viewGroup, false); return new VerbsViewHolder(text); } @Override public void onBindViewHolder(@NonNull VerbsViewHolder verbsViewHolder, int i) { Verbe v = verbes.get(i); String info = v.baseVerbale + "/" + v.traduction + "/" + v.preterit + "/" + v.participePasse; verbsViewHolder.text.setText(info); } @Override public int getItemCount() { return verbes.size(); } }
ecab0e46bc206eccb5008951676e493a17ab9c62
df2d0ce55896ea6349c9b594fc148827c9a1bb8b
/src/test/java/ohtu/ohtuvarasto/VarastoTest.java
b4d2d5da4f9d52ac6436582233ea6c3c888b129b
[]
no_license
sallasal/ohtu-2021-viikko1
6da93bfc5df8e66f1f116e0ba6a5e917645ae8ba
fc9b2c0eeef23ebcdffb811ab916d8ba7f262e44
refs/heads/main
2023-03-16T19:16:26.405510
2021-03-10T17:25:21
2021-03-10T17:25:21
330,167,099
0
0
null
null
null
null
UTF-8
Java
false
false
3,691
java
package ohtu.ohtuvarasto; import org.junit.*; import static org.junit.Assert.*; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; public class VarastoTest { Varasto varasto; double vertailuTarkkuus = 0.0001; @Before public void setUp() { varasto = new Varasto(10); } @Test public void konstruktoriLuoTyhjanVaraston() { assertEquals(0, varasto.getSaldo(), vertailuTarkkuus); } @Test public void uudellaVarastollaOikeaTilavuus() { assertEquals(10, varasto.getTilavuus(), vertailuTarkkuus); } @Test public void luominenOmallaTilavuudellaToimii() { Varasto isompiVarasto = new Varasto(20, 2); assertEquals(20, isompiVarasto.getTilavuus(), vertailuTarkkuus); } @Test public void luominenOmallaSaldollaToimii() { Varasto isompiVarasto = new Varasto(20, 2); assertEquals(2, isompiVarasto.getSaldo(), vertailuTarkkuus); } @Test public void asettaaNegatiivisenAlkusaldonOikein() { Varasto negAlkusaldo = new Varasto(2, -3); assertEquals(0, negAlkusaldo.getSaldo(), vertailuTarkkuus); } @Test public void tunnistaaTurhanVarastonYhdellaParametrilla() { Varasto turhaVarasto = new Varasto(-3); assertEquals(0, turhaVarasto.getTilavuus(), vertailuTarkkuus); } @Test public void tunnistaaTurhanVarastonKahdellaParametrilla() { Varasto turhaVarasto = new Varasto(-2, 0); assertEquals(0, turhaVarasto.getTilavuus(), vertailuTarkkuus); } @Test public void tayttaaVarastonJaHukkaaYlijaaman() { Varasto liianTaysi = new Varasto(10, 20); assertEquals(10, liianTaysi.getSaldo(), vertailuTarkkuus); } @Test public void lisaysLisaaSaldoa() { varasto.lisaaVarastoon(8); // saldon pitäisi olla sama kun lisätty määrä assertEquals(8, varasto.getSaldo(), vertailuTarkkuus); } @Test public void lisaysLisaaPienentaaVapaataTilaa() { varasto.lisaaVarastoon(8); // vapaata tilaa pitäisi vielä olla tilavuus-lisättävä määrä eli 2 assertEquals(2, varasto.paljonkoMahtuu(), vertailuTarkkuus); } @Test public void ottaminenPalauttaaOikeanMaaran() { varasto.lisaaVarastoon(8); double saatuMaara = varasto.otaVarastosta(2); assertEquals(2, saatuMaara, vertailuTarkkuus); } @Test public void ottaminenLisääTilaa() { varasto.lisaaVarastoon(8); varasto.otaVarastosta(2); // varastossa pitäisi olla tilaa 10 - 8 + 2 eli 4 assertEquals(4, varasto.paljonkoMahtuu(), vertailuTarkkuus); } @Test public void negatiivinenOttaminenKasitellaanOikein() { assertEquals(0, varasto.otaVarastosta(-5), vertailuTarkkuus); } @Test public void asettaaSaldonOikeinKunOttaaKaiken() { varasto.otaVarastosta(15); assertEquals(0, varasto.getSaldo(), vertailuTarkkuus); } @Test public void kasitteleeLisayksenYlivuodonOikein() { varasto.lisaaVarastoon(5); varasto.lisaaVarastoon(10); assertEquals(10, varasto.getSaldo(), vertailuTarkkuus); } @Test public void kasitteleeNegLisayksenOikein() { varasto.lisaaVarastoon(5); varasto.lisaaVarastoon(-3); assertEquals(5, varasto.getSaldo(), vertailuTarkkuus); } @Test public void palauttaaOikeanStringin() { assertEquals("saldo = 0.0, vielä tilaa 10.0", varasto.toString()); } }
b754554e2b45bcfe76355519a731e39fc45aa249
8d0a4501877006fb7fb172bc0c02ba3ca1fc35be
/Lab05-OMSApp/src/com/oms/serverapi/CompactDiscApi.java
6f1005047b273b5063036f8c91877fd8b62bdcc0
[]
no_license
ledong2512/TKXDPM-Lab05
d6b19c59801301bc0bf1a1afaa6215d738ffd808
977eab11c071a05288b202ffdf1c89dcd4c4144c
refs/heads/master
2023-02-09T03:19:40.521164
2021-01-05T16:07:30
2021-01-05T16:07:30
327,049,969
0
0
null
null
null
null
UTF-8
Java
false
false
1,295
java
package com.oms.serverapi; import java.util.ArrayList; import java.util.Map; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.oms.bean.CompactDisc; public class CompactDiscApi implements IDataMediaApi<CompactDisc> { public static final String PATH = "http://localhost:8080/"; private Client client; public CompactDiscApi() { client = ClientBuilder.newClient(); } @Override public ArrayList<CompactDisc> gets(Map<String, String> queryParams) { WebTarget webTarget = client.target(PATH).path("cds"); if (queryParams != null) { for (String key : queryParams.keySet()) { String value = queryParams.get(key); webTarget = webTarget.queryParam(key, value); } } Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON); Response response = invocationBuilder.get(); ArrayList<CompactDisc> res = response.readEntity(new GenericType<ArrayList<CompactDisc>>() {}); System.out.println(res); return res; } @Override public CompactDisc update(CompactDisc t) { // TODO Auto-generated method stub return null; } }
43a41b2f6909be5e8f4e5f3686b7027196e151dc
2ee274075ea2ffae834fe4bce3428013296661d6
/jam/src/main/java/it/francescosantagati/jam/JAMAgent.java
02a027c0a7242f1acacf66dc418c76ea76bf867a
[ "MIT" ]
permissive
FrancescoSantagati/java-rmi-agents
b766c856b50cac179b358e34dff0b681ce93c397
1b94f8e2ae13a09e1ce1f4e0a75b0e9b22706d19
refs/heads/master
2021-07-05T20:38:36.242654
2017-09-29T13:29:57
2017-09-29T13:29:57
50,579,155
0
0
null
null
null
null
UTF-8
Java
false
false
10,561
java
package it.francescosantagati.jam; import java.net.MalformedURLException; import java.rmi.Naming; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List; import java.util.Observable; /** * An intelligent object that can have multiple behaviours. * We can add behaviours with <code>addBehaviour</code> method. * <p> * Usage: * <ol> * <li><code>init()</code>: subscribe agent to an it.francescosantagati.jam.ADSL remote instance. * <li><code>start()</code>: start behaviours associated to agent and not currently in execution. * <li><code>destroy()</code>: remove agent association from it.francescosantagati.jam.ADSL and stop execution of all behaviours, * </ol> * * @author Francesco Santagati */ public abstract class JAMAgent extends Observable { private List<JAMBehaviour> myBehaviours; private MessageBox myMessageBox; private PersonalAgentID myID; private ADSL adsl; private String name; private String ip; private int port; /** * Construct a it.francescosantagati.jam.JAMAgent with default params. * <ul> * <li>IP: 127.0.0.1 * <li>Port: 1099 * <li>Name: it.francescosantagati.jam.ADSL * </ul> * * @param agentID Agent id * @throws JAMADSLException when fail to connect */ public JAMAgent(PersonalAgentID agentID) throws JAMADSLException { this(agentID, "127.0.0.1", "it.francescosantagati.jam.ADSL", 1099); } /** * Construct a it.francescosantagati.jam.JAMAgent with params specified. * * @param agentID Agent id * @param ip Ip address * @param name Name * @param port Port * @throws JAMADSLException when fail to connect */ public JAMAgent(PersonalAgentID agentID, String ip, String name, int port) throws JAMADSLException { myID = agentID; this.ip = ip; this.name = name; this.port = port; myBehaviours = new ArrayList<>(); try { myMessageBox = new MessageBox(agentID); } catch (RemoteException e) { throw new JAMADSLException(); } new JAMAgentMonitor(this).showFrame(); } /** * Add a new behaviour to agent. * * @param behaviour a it.francescosantagati.jam.JAMBehaviour instance */ public void addBehaviour(JAMBehaviour behaviour) { myBehaviours.add(behaviour); } /** * Provide agent id. * * @return Agent id */ public PersonalAgentID getMyID() { return myID; } /** * Initialize agent. * <ul> * <li>Tries to connect to an it.francescosantagati.jam.ADSL instance in the RMI registry; * <li>Subscribe agent message box to it.francescosantagati.jam.ADSL; * </ul> * * @throws JAMADSLException when fail */ public void init() throws JAMADSLException { String url = RMIUtil.renderConnectionString(ip, port, name); try { adsl = (ADSL) Naming.lookup(url); adsl.insertRemoteMessageBox(myMessageBox); } catch (RemoteException | NotBoundException | MalformedURLException e) { throw new JAMADSLException(e); } } /** * Start every beharious that is not currently in execution in a separate thread. */ public void start() { for (JAMBehaviour behaviour : myBehaviours) { if (behaviour.hasNeverBeenStarted()) { Thread thread = new Thread(behaviour); behaviour.setMyThread(thread); thread.start(); } } } /** * Destroy agent. * <ul> * <li>Remove message box from it.francescosantagati.jam.ADSL; * <li>Stop all behaviours currently in execution; * </ul> * * @throws JAMADSLException when fail */ public void destroy() throws JAMADSLException { try { adsl.removeRemoteMessageBox(myID); for (JAMBehaviour behaviour : myBehaviours) { if (!behaviour.isDone()) { behaviour.done(); } } } catch (RemoteException | IllegalArgumentException e) { throw new JAMADSLException(e); } } /** * Check if there is a message with provided {@link Performative} in the agent message box. * * @param agent Agent id * @param performative it.francescosantagati.jam.Performative * @return True if message is found, False otherwise. */ public boolean check(AgentID agent, Performative performative) { return myMessageBox.isThereMessage(agent, performative); } /** * Send a message to message recipients. * * @param message it.francescosantagati.jam.Message to send * @throws JAMADSLException se il collegamento con l'it.francescosantagati.jam.ADSL non � andato a buon fine * @throws JAMBehaviourInterruptedException when send fail */ public void send(Message message) throws JAMBehaviourInterruptedException, JAMADSLException { try { List<RemoteMessageBox> boxList = adsl.getRemoteMessageBox(message.getReceiver()); for (RemoteMessageBox box : boxList) { box.writeMessage(message); } } catch (RemoteException e) { throw new JAMADSLException(e); } catch (InterruptedException e) { throw new JAMBehaviourInterruptedException(); } String logMessage = "SEND message " + message.getPerformative() + " to " + message.getReceiver(); setChanged(); notifyObservers(logMessage); } /** * Retrieve and delete the first message from message box sent by agent and with performative provided. * If no message found an exception it.francescosantagati.jam.JAMMessageBoxException will be thrown * * @param agentID Agent ID * @param performative it.francescosantagati.jam.Performative * @return message * @throws JAMBehaviourInterruptedException when send fail */ public Message receive(AgentID agentID, Performative performative) throws JAMBehaviourInterruptedException { Message message; try { message = myMessageBox.readMessage(agentID, performative); } catch (InterruptedException | JAMMessageBoxException e) { throw new JAMBehaviourInterruptedException(); } String logMessage = "RECEIVE message " + message.getPerformative() + " to " + message.getReceiver(); setChanged(); notifyObservers(logMessage); return message; } /** * Retrieve and delete the first message from message box sent by agent provided. * If no message found an exception it.francescosantagati.jam.JAMMessageBoxException will be thrown * * @param agentID it.francescosantagati.jam.AgentID * @return message * @throws JAMBehaviourInterruptedException when send fail */ public Message receive(AgentID agentID) throws JAMBehaviourInterruptedException { Message message; try { message = myMessageBox.readMessage(agentID); } catch (InterruptedException | JAMMessageBoxException e) { throw new JAMBehaviourInterruptedException(); } String logMessage = "RECEIVE message " + message.getPerformative() + " to " + message.getReceiver(); setChanged(); notifyObservers(logMessage); return message; } /** * Retrieve and delete the first message from message box with performative provided. * If no message found an exception it.francescosantagati.jam.JAMMessageBoxException will be thrown * * @param performative it.francescosantagati.jam.Performative * @return message * @throws JAMBehaviourInterruptedException when send fail */ public Message receive(Performative performative) throws JAMBehaviourInterruptedException { Message message; try { message = myMessageBox.readMessage(performative); } catch (InterruptedException | JAMMessageBoxException e) { throw new JAMBehaviourInterruptedException(); } String logMessage = "RECEIVE message " + message.getPerformative() + " to " + message.getReceiver(); setChanged(); notifyObservers(logMessage); return message; } /** * Retrieve and delete the first message from message box. * If no message found an exception it.francescosantagati.jam.JAMMessageBoxException will be thrown * * @return message * @throws JAMBehaviourInterruptedException when send fail */ public Message receive() throws JAMBehaviourInterruptedException { Message message; try { message = myMessageBox.readMessage(); } catch (InterruptedException | JAMMessageBoxException e) { throw new JAMBehaviourInterruptedException(); } String logMessage = "RECEIVE message " + message.getPerformative() + " to " + message.getReceiver(); setChanged(); notifyObservers(logMessage); return message; } /** * Check if a message with provided agent and performative is in the message box. * * @param agentID it.francescosantagati.jam.AgentID * @param performative it.francescosantagati.jam.Performative * @return True if message found, false otherwise */ public boolean isThereMessage(AgentID agentID, Performative performative) { return myMessageBox.isThereMessage(agentID, performative); } /** * Check if a message with provided agent is in the message box. * * @param agentID it.francescosantagati.jam.AgentID * @return True if message found, false otherwise */ public boolean isThereMessage(AgentID agentID) { return myMessageBox.isThereMessage(agentID); } /** * Check if a message with provided performative is in the message box. * * @param performative it.francescosantagati.jam.Performative * @return True if message found, false otherwise */ public boolean isThereMessage(Performative performative) { return myMessageBox.isThereMessage(performative); } /** * Check if a message is in the message box. * * @return True if message found, false otherwise */ public boolean isThereMessage() { return myMessageBox.isThereMessage(); } }
77da1b93b58fd6a527d9eb05083e8392e5aa5057
b70e8168c170b893478ca14a0f2e8c19834d960b
/app/src/main/java/com/example/eshopping/SellerLoginActivity.java
572758ba047f267424a0101b7b339a6a9f5f7db0
[]
no_license
lahiru-98/eShopping-MadProject-
0ebe32d6d6824095fe0ab157b399f74b2aad4022
320ae9da4262512ff7b6388d3dbd93c4223c6694
refs/heads/master
2022-12-28T21:20:57.326012
2020-10-12T08:26:40
2020-10-12T08:26:40
291,155,026
0
0
null
2020-10-11T09:08:04
2020-08-28T22:08:33
Java
UTF-8
Java
false
false
4,050
java
package com.example.eshopping; import androidx.appcompat.app.AppCompatActivity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.example.eshopping.Model.Sellers; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class SellerLoginActivity extends AppCompatActivity { private EditText InputPhone,InputPassword; private Button LoginButton; private ProgressDialog loadingBar; private String parentsDbName1="Sellers"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_seller_login); LoginButton=(Button)findViewById(R.id.seller_login_btn) ; InputPhone=(EditText) findViewById(R.id.seller_login_phone); InputPassword=(EditText) findViewById(R.id.seller_login_password); loadingBar = new ProgressDialog(this); LoginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { logingSeller(); } private void logingSeller() { String phone=InputPhone.getText().toString(); String password =InputPassword.getText().toString(); if (TextUtils.isEmpty(phone)) { Toast.makeText(getApplicationContext(), "Please write your email...", Toast.LENGTH_SHORT).show(); } else if (TextUtils.isEmpty(password)) { Toast.makeText(getApplicationContext(), "Please write your password...", Toast.LENGTH_SHORT).show(); } else { loadingBar.setTitle("Logging Seller Account"); loadingBar.setMessage("Please wait, while we are checking the credentials."); loadingBar.setCanceledOnTouchOutside(false); loadingBar.show(); AllowAccessAccount(phone,password); } } private void AllowAccessAccount(final String phone, final String password) { final DatabaseReference RootRef; RootRef = FirebaseDatabase.getInstance().getReference(); RootRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(dataSnapshot.child(parentsDbName1).child(phone).exists() ){ Sellers sellersData=dataSnapshot.child(parentsDbName1).child(phone).getValue(Sellers.class); if(sellersData.getPhone().equals(phone)){ if(sellersData.getPassword().equals(password)){ Toast.makeText(SellerLoginActivity.this, "logging is sucessfully", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(SellerLoginActivity.this, SellerHome.class); startActivity(intent); } } } else { Toast.makeText(SellerLoginActivity.this, "Account with this"+phone+"do not exist", Toast.LENGTH_SHORT).show(); loadingBar.dismiss(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } }); } }
510256c7584d24d613b17b8793d54515a6055ef5
9f7b58f52c44e90432194e4a0e455e78cfa2f566
/src/pl/dymczyk/arraysandstring/Problem1.java
13ea411df1ca4bf7352902389ec86350efde361f
[]
no_license
mdymczyk/cracking-the-coding-interview
09f16d2a50f717f9695e70474e740d10e9bac017
8e04ebde397fbbe08488a78733784850dc114e41
refs/heads/master
2021-01-11T10:47:57.786387
2013-03-12T16:53:44
2013-03-12T16:53:44
3,370,262
1
0
null
null
null
null
UTF-8
Java
false
false
1,679
java
package pl.dymczyk.arraysandstring; import java.util.HashSet; import java.util.Set; public class Problem1 { // ==================== MINE ==================== \\ public boolean containsOnlyUniqueChars(String string) { Set<Character> foundCharacters = new HashSet<Character>(); for(char c : string.toCharArray()) { if(foundCharacters.contains(c)) { return false; } foundCharacters.add(c); } return true; } public boolean containsOnlyUniqueCharsNoAddDS(String string) { for (int i = 0; i < string.length() - 1; i++) { for (int j = i + 1; j < string.length(); j++) { if(string.charAt(i) == string.charAt(j)) { return false; } } } return true; } // ==================== BOOK ==================== \\ public boolean fromTheBook(String string) { boolean[] charSet = new boolean[256]; for (int i = 0; i < string.length(); i++) { int val = string.charAt(i); if(charSet[val]) return false; charSet[val] = true; } return true; } public boolean formTheBook2(String string) { int checker = 0; for (int i = 0; i < string.length(); i++) { int val = string.charAt(i) - 'a'; if((checker & (1 << val)) > 0) return false; checker |= (1 << val); } return true; } // ==================== TODO ==================== \\ // sort the string in nlong (insitu) public static void main(String[] args) { Problem1 test = new Problem1(); System.out.println(test.containsOnlyUniqueChars("abcd")); System.out.println(test.containsOnlyUniqueChars("abca")); System.out.println(test.containsOnlyUniqueCharsNoAddDS("abcd")); System.out.println(test.containsOnlyUniqueCharsNoAddDS("abca")); } }
f0fce147323c64e45974d472207ce19906d812db
9dd2a326353a96a44bfb55e04e7bc195e40c98f6
/02-maven/src/test/java/xml_config/test/Test.java
74feebdb68551c772d9ab5d749a1732de188c568
[]
no_license
gdbrough/Cucumber_Stuff
c3ac5224aba220d6390ff0e940da5f40841a8a76
2355832c3a6aa015df43aac4d6bba41bb94c76f4
refs/heads/master
2020-03-21T05:44:03.249410
2018-06-29T12:24:57
2018-06-29T12:24:57
138,176,521
0
0
null
null
null
null
UTF-8
Java
false
false
813
java
package xml_config.test; import static org.junit.Assert.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import xml_config.Hello; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("applicationContext.xml") public class Test { @Autowired private Hello hello = null; @org.junit.Test public void testNameIsNotNullAndIsGreg() { assertNotNull("Constructor message instance is null.", hello); String name = hello.getName(); assertNotNull("Name is null.", name); String expectedName = "Greg"; assertEquals("Name should be '" + expectedName + "'.", expectedName, name); } }
4e1f4124d922c8ed5a71e5294c0a8678e1d9452b
445c3cf84dd4bbcbbccf787b2d3c9eb8ed805602
/aliyun-java-sdk-ecs/src/main/java/com/aliyuncs/ecs/model/v20140526/DescribeImageComponentsResponse.java
e844ee6820e893319789c7f382fb3fbc2dc19d6d
[ "Apache-2.0" ]
permissive
caojiele/aliyun-openapi-java-sdk
b6367cc95469ac32249c3d9c119474bf76fe6db2
ecc1c949681276b3eed2500ec230637b039771b8
refs/heads/master
2023-06-02T02:30:02.232397
2021-06-18T04:08:36
2021-06-18T04:08:36
172,076,930
0
0
NOASSERTION
2019-02-22T14:08:29
2019-02-22T14:08:29
null
UTF-8
Java
false
false
4,300
java
/* * 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.aliyuncs.ecs.model.v20140526; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.ecs.transform.v20140526.DescribeImageComponentsResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class DescribeImageComponentsResponse extends AcsResponse { private String requestId; private Integer totalCount; private String nextToken; private Integer maxResults; private List<ImageComponentSet> imageComponent; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public Integer getTotalCount() { return this.totalCount; } public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public String getNextToken() { return this.nextToken; } public void setNextToken(String nextToken) { this.nextToken = nextToken; } public Integer getMaxResults() { return this.maxResults; } public void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } public List<ImageComponentSet> getImageComponent() { return this.imageComponent; } public void setImageComponent(List<ImageComponentSet> imageComponent) { this.imageComponent = imageComponent; } public static class ImageComponentSet { private String creationTime; private String imageComponentId; private String name; private String description; private String systemType; private String componentType; private String content; private String resourceGroupId; private List<Tag> tags; public String getCreationTime() { return this.creationTime; } public void setCreationTime(String creationTime) { this.creationTime = creationTime; } public String getImageComponentId() { return this.imageComponentId; } public void setImageComponentId(String imageComponentId) { this.imageComponentId = imageComponentId; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public String getSystemType() { return this.systemType; } public void setSystemType(String systemType) { this.systemType = systemType; } public String getComponentType() { return this.componentType; } public void setComponentType(String componentType) { this.componentType = componentType; } public String getContent() { return this.content; } public void setContent(String content) { this.content = content; } public String getResourceGroupId() { return this.resourceGroupId; } public void setResourceGroupId(String resourceGroupId) { this.resourceGroupId = resourceGroupId; } public List<Tag> getTags() { return this.tags; } public void setTags(List<Tag> tags) { this.tags = tags; } public static class Tag { private String tagKey; private String tagValue; public String getTagKey() { return this.tagKey; } public void setTagKey(String tagKey) { this.tagKey = tagKey; } public String getTagValue() { return this.tagValue; } public void setTagValue(String tagValue) { this.tagValue = tagValue; } } } @Override public DescribeImageComponentsResponse getInstance(UnmarshallerContext context) { return DescribeImageComponentsResponseUnmarshaller.unmarshall(this, context); } }
934ae973ffd26fb3e5d48bb42da4ee0ae4a82f7c
0d2a216b3d07e921b83edb4315c7fd79f9546aa7
/src/main/java/pers/opappo/playlist/controller/PlaylistController.java
67910c495fbab945e396448b2a9db4733c2b5571
[ "MIT" ]
permissive
Amethyst-564/springboot-playlist
7fa33d3927bc2bad908dc6b1fb1a4ae878904ac4
5ee98b189b0e25eb4ce6495d736958fb5aa109c0
refs/heads/master
2020-03-28T23:41:47.328125
2018-12-18T12:56:03
2018-12-18T12:56:03
149,304,086
0
0
null
null
null
null
UTF-8
Java
false
false
7,091
java
package pers.opappo.playlist.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import pers.opappo.playlist.VO.PlaylistDetailVO; import pers.opappo.playlist.VO.PlaylistVO; import pers.opappo.playlist.VO.ResultVO; import pers.opappo.playlist.dataobject.PlaylistDetail; import pers.opappo.playlist.dataobject.PlaylistInfo; import pers.opappo.playlist.dataobject.UserInfo; import pers.opappo.playlist.enums.ResultEnum; import pers.opappo.playlist.service.PlaylistDetailService; import pers.opappo.playlist.service.PlaylistInfoService; import pers.opappo.playlist.service.UserInfoService; import pers.opappo.playlist.utils.ResultVOUtil; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * Created by minghli on 2018/9/19. */ @RestController @RequestMapping("/playlist") public class PlaylistController { @Autowired private PlaylistInfoService playlistInfoService; @Autowired private PlaylistDetailService playlistDetailService; @Autowired private UserInfoService userInfoService; @PostMapping("/save") public ResultVO save(@RequestBody Map<String, String> data) { try { Boolean pidIsExist = false; Integer playlistId = null; //判断pid是否存在 List<PlaylistInfo> playlistInfoList = playlistInfoService.findByUserId(Integer.valueOf(data.get("user_id"))); if (playlistInfoList.size() != 0) { for (PlaylistInfo playlistInfo : playlistInfoList) { if (playlistInfo.getPid().equals(data.get("pid"))) { pidIsExist = true; playlistId = playlistInfo.getPlaylistId(); break; } } } if (!pidIsExist) { // 若不存在则写入info表 PlaylistInfo playlistInfo = new PlaylistInfo(); playlistInfo.setUserId(Integer.valueOf(data.get("user_id"))); playlistInfo.setPlaylistName(data.get("playlist_name")); playlistInfo.setPid(data.get("pid")); playlistInfoService.save(playlistInfo); // playlistId为新info生成 playlistId = playlistInfo.getPlaylistId(); } PlaylistDetail playlistDetail = new PlaylistDetail(); playlistDetail.setPlaylistId(playlistId); playlistDetail.setPlaylistCover(data.get("playlist_cover")); playlistDetail.setPlaylistContent(data.get("playlist_content")); playlistDetailService.save(playlistDetail); return ResultVOUtil.success("保存歌单", data); } catch (Exception e) { return ResultVOUtil.error(ResultEnum.PLAYLIST_SAVE_FAILED); } } @GetMapping("/list") public ResultVO list(@RequestParam("username") String username) { // 1 从库中查询用户信息 UserInfo userInfo = userInfoService.findUserInfoByUsername(username); if (userInfo == null) { return ResultVOUtil.error(ResultEnum.USER_NOT_EXIST); } // 2 判断用户状态 if (userInfo.getUserStatus() != 0) { return ResultVOUtil.error(ResultEnum.USER_STATUS_ERROR); } // 3 查询用户所拥有歌单并拼装 List<PlaylistInfo> playlistInfoList = playlistInfoService.findByUserId(userInfo.getUserId()); List<PlaylistVO> playlistVOList = new ArrayList<>(); for (PlaylistInfo playlistInfo : playlistInfoList) { PlaylistVO playlistVO = new PlaylistVO(); playlistVO.setPlaylistId(playlistInfo.getPlaylistId()); playlistVO.setPlaylistName(playlistInfo.getPlaylistName()); playlistVO.setPid(playlistInfo.getPid()); // 拼装歌单详情list List<PlaylistDetail> playlistDetailList = playlistDetailService.findByPlaylistId(playlistInfo.getPlaylistId()); List<PlaylistDetailVO> playlistDetailVOList = new ArrayList<>(); for (PlaylistDetail playlistDetail : playlistDetailList) { PlaylistDetailVO playlistDetailVO = new PlaylistDetailVO(); playlistDetailVO.setPlaylistCover(playlistDetail.getPlaylistCover()); playlistDetailVO.setAddTime(playlistDetail.getAddTime()); playlistDetailVOList.add(playlistDetailVO); } playlistVO.setPlaylistDetailVOList(playlistDetailVOList); playlistVOList.add(playlistVO); } return ResultVOUtil.success("查询用户歌单", playlistVOList); } @GetMapping("/detail") public ResultVO detail(@RequestParam("id") Integer playlistId) { PlaylistInfo playlistInfo = playlistInfoService.findOne(playlistId); List<PlaylistDetail> playlistDetailList = playlistDetailService.findByPlaylistId(playlistId); List<PlaylistDetailVO> playlistDetailVOList = new ArrayList<>(); for (PlaylistDetail playlistDetail : playlistDetailList) { PlaylistDetailVO playlistDetailVO = new PlaylistDetailVO(); playlistDetailVO.setPlaylistDetailId(playlistDetail.getPlaylistDetailId()); playlistDetailVO.setPlaylistCover(playlistDetail.getPlaylistCover()); playlistDetailVO.setPlaylistContent(playlistDetail.getPlaylistContent()); playlistDetailVO.setAddTime(playlistDetail.getAddTime()); playlistDetailVOList.add(playlistDetailVO); } PlaylistVO playlistVO = new PlaylistVO(); playlistVO.setPlaylistName(playlistInfo.getPlaylistName()); playlistVO.setPid(playlistInfo.getPid()); playlistVO.setPlaylistDetailVOList(playlistDetailVOList); return ResultVOUtil.success("查询歌单详情", playlistVO); } @DeleteMapping("/delete_detail") public ResultVO deleteDetail(@RequestParam("id") Integer playlistDetailId) { try { Integer playlistIdOfDetail = playlistDetailService.findOne(playlistDetailId).getPlaylistId(); playlistDetailService.deleteOne(playlistDetailId); // 如果是该playlist info的最后一条detail,则同时删除info记录 if (playlistDetailService.findByPlaylistId(playlistIdOfDetail).size() == 0) { playlistInfoService.deleteOne(playlistIdOfDetail); } } catch (Exception e) { return ResultVOUtil.error(ResultEnum.DELETE_PLAYLIST_DETAIL_FAILED); } return ResultVOUtil.success("删除歌单详情"); } @DeleteMapping("/delete_info") public ResultVO deleteInfo(@RequestParam("id") Integer playlistId) { try { playlistInfoService.deleteOne(playlistId); playlistDetailService.deleteList(playlistId); } catch (Exception e) { return ResultVOUtil.error(ResultEnum.DELETE_PLAYLIST_INFO_FAILED); } return ResultVOUtil.success("删除歌单信息"); } }
f43f01dfd0e374a80a9b10116aec8c28e8f3393e
aeaf2b39c46c7c8098a1c194cb318e89d628d9fc
/src/boletin18/Clase18.java
c78ea60b81d21df1b5f1d1eeb811d02c89a701eb
[]
no_license
garciaamor/Boletin18_1
0516a475c2cb31b1af92c0ab4ed9e812368e4c9d
44215be50eadaaf7eac2766c9a8edefc8ea32d48
refs/heads/master
2021-01-10T11:11:58.535610
2016-01-27T10:08:24
2016-01-27T10:08:24
50,498,771
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package boletin18; public class Clase18 { int []numeros=new int [6]; public void crearArray(){ for (int i=0;i<numeros.length;i++){ numeros [i]=(int)Math.floor(Math.random()*50+1); } } public void visualizarNormal(){ System.out.println("numeros generados"); for (int i =0;i<numeros.length;i++){ System.out.println(numeros[i]); } } public void visualizarReves(){ System.out.println("numeros al reves"); for (int i=numeros.length-1;i>=0;i--){ System.out.println(numeros[i]); } } }
453b159e820ed91375bab294b392fb729674fadc
3c338c2ee66cf7ee344fcd341820155265390ed7
/src/main/java/es/meep/tecnicaltest/utils/UrlUtils.java
51f19415731df4d4c157084577267f5c0e1dca7c
[]
no_license
aharkergutierrez/meep-pooling
48da1183af509e073c2186fe40a545a94c6141ea
98d1960a1649f6c598df859e46f4104bea4101eb
refs/heads/master
2023-03-18T00:00:37.353548
2021-03-02T08:06:47
2021-03-02T08:06:47
343,691,927
0
0
null
null
null
null
UTF-8
Java
false
false
2,787
java
package es.meep.tecnicaltest.utils; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; public class UrlUtils { public static String replaceValues(String urlReturnValue, String json, List<String> variablesInUrl) { for (String variable : variablesInUrl) { String variableToReplace = readVariable(json, variable); urlReturnValue = urlReturnValue.replace("{" + variable + "}", variableToReplace); } return urlReturnValue; } public static String readVariable(String json, String variable) { DocumentContext jsonContext = JsonPath.parse(json); Object jsonValue = jsonContext.read(variable); if (Objects.isNull(jsonValue)) { return ""; } if (jsonValue instanceof Collection) { return (String) ((Collection) jsonValue).stream().map(n -> n.toString()).collect(Collectors.joining(",")); } else { return jsonValue.toString(); } } public static List<String> findUrlVariables(String urlReturnValue) { List<String> variables = new ArrayList<>(); Map<Integer, Integer> openAndCloseIndexes = findIndexesPairs(urlReturnValue); openAndCloseIndexes.keySet().forEach(indexOpen -> { variables.add(urlReturnValue.substring(indexOpen + 1, openAndCloseIndexes.get(indexOpen))); }); return variables; } public static Map<Integer, Integer> findIndexesPairs(String urlReturnValue) { List<Integer> openBrakets = findIndexes(urlReturnValue, "{"); List<Integer> closeBrakets = findIndexes(urlReturnValue, "}"); Map<Integer, Integer> openAndCloseIndexes = new HashMap<>(); for (int i = 0; i < openBrakets.size(); ++i) { openAndCloseIndexes.put(openBrakets.get(i), closeBrakets.get(i)); } return openAndCloseIndexes; } public static List<Integer> findIndexes(String urlReturnValue, String bracket) { List<Integer> indexes = new ArrayList<>(); int index = urlReturnValue.indexOf(bracket); while (index >= 0) { indexes.add(index); index = urlReturnValue.indexOf(bracket, index + 1); } return indexes; } public static Double measure(Double lat1, Double lon1, Double lat2, Double lon2){ // generally used geo measurement function Double R = 6378.0; // Radius of earth in KM Double dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180; Double dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180; Double a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon/2) * Math.sin(dLon/2); Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); Double d = R * c; return d * 1000; // meters } }
1ef8a3f0e71afd8769f4e66043bfcc71cd5a2610
a674c3e6e514cfee0f3a5d24265092308fec76e4
/lec12/src/lec12/Vectordemo.java
bd092b9a533faa5b2865a4c6522d31dd3537ac91
[]
no_license
abhishek03joshi/Java-practice
338bc0fae62854dfb43de8f22d8a82d0e5609bf6
4eec98e20674ccdd8317398cce5b9bba464b5a0d
refs/heads/master
2020-03-27T02:24:21.372911
2018-08-24T02:55:34
2018-08-24T02:55:34
145,788,082
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
package lec12; import java.util.Vector; public class Vectordemo { public static void main(String[] args) { // TODO Auto-generated method stub Vector <String> vc = new Vector<String>(); vc.add("Vector Object 1"); vc.add("Vector Object 2"); vc.add("Vector Object 3"); vc.add("Vector Object 4"); vc.add("Vector Object 5"); System.out.println(vc); vc.add(3, "Element at fixed position"); System.out.println("Vector Size: "+vc.size()); for(int i=0;i<vc.size();i++) { System.out.println("Vector Element"+i+" : "+vc.get(i)); } } }
59a26a0959e8f14cd18e2e075ef7d9672e1cb32f
c1fe7d7dbdb667418430f28a2b49abeab5f7e2e3
/app/src/main/java/com/kuchingitsolution/asus/eventmanagement/config/AppStatus.java
d6e1c4d2e4f7fc0b85f24e83ddc1d2987c428050
[]
no_license
tw-voon/event-s-ndbox
1ad1bf467b89182f1f8198abe98d46300df10da2
05164937ea2f502ce9633a44d37aa6b15e36bc63
refs/heads/master
2020-04-20T07:14:47.934479
2019-12-01T07:30:17
2019-12-01T07:30:17
168,705,575
0
0
null
null
null
null
UTF-8
Java
false
false
1,490
java
package com.kuchingitsolution.asus.eventmanagement.config; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; public class AppStatus { static Context context; /** * We use this class to determine if the application has been connected to either WIFI Or Mobile * Network, before we make any network request to the server. * <p> * The class uses two permission - INTERNET and ACCESS NETWORK STATE, to determine the user's * connection stats */ private static AppStatus instance = new AppStatus(); ConnectivityManager connectivityManager; NetworkInfo wifiInfo, mobileInfo; boolean connected = false; public static AppStatus getInstance(Context ctx) { context = ctx.getApplicationContext(); return instance; } public boolean isOnline() { try { connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); connected = networkInfo != null && networkInfo.isAvailable() && networkInfo.isConnected(); return connected; } catch (Exception e) { System.out.println("CheckConnectivity Exception: " + e.getMessage()); Log.v("connectivity", e.toString()); } return connected; } }
2f99bc0394918f2ab76a84a603c798656864892a
1ec1df92d9e579e476a5d23171a55eebe65dc06b
/target/classes/org/apache/tomcat/util/buf/ByteChunk.java
0308de1f77c6f27ea729105fc6bc0b22ad5a5e96
[ "LicenseRef-scancode-unknown-license-reference", "bzip2-1.0.6", "Apache-2.0", "CDDL-1.0", "CPL-1.0", "Zlib", "EPL-1.0", "LZMA-exception" ]
permissive
EugeneWang/tomcat7079
0c8e0d182e60bb5f889dcd753440073bcb112815
817bb00d42d3de2cfa745e872a9b4e535a319e9c
refs/heads/master
2022-02-02T00:53:51.675239
2019-05-23T06:07:06
2019-05-23T06:07:06
97,283,181
0
0
Apache-2.0
2022-01-21T23:19:36
2017-07-15T00:54:47
Java
UTF-8
Java
false
false
26,370
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.tomcat.util.buf; import java.io.IOException; import java.io.Serializable; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; /* * In a server it is very important to be able to operate on * the original byte[] without converting everything to chars. * Some protocols are ASCII only, and some allow different * non-UNICODE encodings. The encoding is not known beforehand, * and can even change during the execution of the protocol. * ( for example a multipart message may have parts with different * encoding ) * * For HTTP it is not very clear how the encoding of RequestURI * and mime values can be determined, but it is a great advantage * to be able to parse the request without converting to string. */ // TODO: This class could either extend ByteBuffer, or better a ByteBuffer // inside this way it could provide the search/etc on ByteBuffer, as a helper. /** * This class is used to represent a chunk of bytes, and * utilities to manipulate byte[]. * * The buffer can be modified and used for both input and output. * * There are 2 modes: The chunk can be associated with a sink - ByteInputChannel * or ByteOutputChannel, which will be used when the buffer is empty (on input) * or filled (on output). * For output, it can also grow. This operating mode is selected by calling * setLimit() or allocate(initial, limit) with limit != -1. * * Various search and append method are defined - similar with String and * StringBuffer, but operating on bytes. * * This is important because it allows processing the http headers directly on * the received bytes, without converting to chars and Strings until the strings * are needed. In addition, the charset is determined later, from headers or * user code. * * @author [email protected] * @author James Todd [[email protected]] * @author Costin Manolache * @author Remy Maucherat */ public final class ByteChunk implements Cloneable, Serializable { private static final long serialVersionUID = 1L; /** Input interface, used when the buffer is empty * * Same as java.nio.channel.ReadableByteChannel */ public static interface ByteInputChannel { /** * Read new bytes ( usually the internal conversion buffer ). * The implementation is allowed to ignore the parameters, * and mutate the chunk if it wishes to implement its own buffering. */ public int realReadBytes(byte cbuf[], int off, int len) throws IOException; } /** Same as java.nio.channel.WritableByteChannel. */ public static interface ByteOutputChannel { /** * Send the bytes ( usually the internal conversion buffer ). * Expect 8k output if the buffer is full. */ public void realWriteBytes(byte cbuf[], int off, int len) throws IOException; } // -------------------- /** Default encoding used to convert to strings. It should be UTF8, as most standards seem to converge, but the servlet API requires 8859_1, and this object is used mostly for servlets. */ public static final Charset DEFAULT_CHARSET = B2CConverter.ISO_8859_1; // byte[] private byte[] buff; private int start=0; private int end; private Charset charset; private boolean isSet=false; // XXX // How much can it grow, when data is added private int limit=-1; private ByteInputChannel in = null; private ByteOutputChannel out = null; private boolean optimizedWrite=true; /** * Creates a new, uninitialized ByteChunk object. */ public ByteChunk() { // NO-OP } public ByteChunk( int initial ) { allocate( initial, -1 ); } /** * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public ByteChunk getClone() { try { return (ByteChunk)this.clone(); } catch( Exception ex) { return null; } } public boolean isNull() { return ! isSet; // buff==null; } /** * Resets the message buff to an uninitialized state. */ public void recycle() { // buff = null; charset=null; start=0; end=0; isSet=false; } public void reset() { buff=null; } // -------------------- Setup -------------------- public void allocate( int initial, int limit ) { if( buff==null || buff.length < initial ) { buff=new byte[initial]; } this.limit=limit; start=0; end=0; isSet=true; } /** * Sets the message bytes to the specified subarray of bytes. * * @param b the ascii bytes * @param off the start offset of the bytes * @param len the length of the bytes */ public void setBytes(byte[] b, int off, int len) { buff = b; start = off; end = start+ len; isSet=true; } /** * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public void setOptimizedWrite(boolean optimizedWrite) { this.optimizedWrite = optimizedWrite; } public void setCharset(Charset charset) { this.charset = charset; } public Charset getCharset() { if (charset == null) { charset = DEFAULT_CHARSET; } return charset; } /** * Returns the message bytes. */ public byte[] getBytes() { return getBuffer(); } /** * Returns the message bytes. */ public byte[] getBuffer() { return buff; } /** * Returns the start offset of the bytes. * For output this is the end of the buffer. */ public int getStart() { return start; } public int getOffset() { return start; } public void setOffset(int off) { if (end < off ) { end=off; } start=off; } /** * Returns the length of the bytes. * XXX need to clean this up */ public int getLength() { return end-start; } /** Maximum amount of data in this buffer. * * If -1 or not set, the buffer will grow indefinitely. * Can be smaller than the current buffer size ( which will not shrink ). * When the limit is reached, the buffer will be flushed ( if out is set ) * or throw exception. */ public void setLimit(int limit) { this.limit=limit; } public int getLimit() { return limit; } /** * When the buffer is empty, read the data from the input channel. */ public void setByteInputChannel(ByteInputChannel in) { this.in = in; } /** When the buffer is full, write the data to the output channel. * Also used when large amount of data is appended. * * If not set, the buffer will grow to the limit. */ public void setByteOutputChannel(ByteOutputChannel out) { this.out=out; } public int getEnd() { return end; } public void setEnd( int i ) { end=i; } // -------------------- Adding data to the buffer -------------------- /** Append a char, by casting it to byte. This IS NOT intended for unicode. * * @param c * @throws IOException * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public void append( char c ) throws IOException { append( (byte)c); } public void append( byte b ) throws IOException { makeSpace( 1 ); // couldn't make space if( limit >0 && end >= limit ) { flushBuffer(); } buff[end++]=b; } public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); } /** Add data to the buffer */ public void append( byte src[], int off, int len ) throws IOException { // will grow, up to limit makeSpace( len ); // if we don't have limit: makeSpace can grow as it wants if( limit < 0 ) { // assert: makeSpace made enough space System.arraycopy( src, off, buff, end, len ); end+=len; return; } // Optimize on a common case. // If the buffer is empty and the source is going to fill up all the // space in buffer, may as well write it directly to the output, // and avoid an extra copy if ( optimizedWrite && len == limit && end == start && out != null ) { out.realWriteBytes( src, off, len ); return; } // if we have limit and we're below if( len <= limit - end ) { // makeSpace will grow the buffer to the limit, // so we have space System.arraycopy( src, off, buff, end, len ); end+=len; return; } // need more space than we can afford, need to flush // buffer // the buffer is already at ( or bigger than ) limit // We chunk the data into slices fitting in the buffer limit, although // if the data is written directly if it doesn't fit int avail=limit-end; System.arraycopy(src, off, buff, end, avail); end += avail; flushBuffer(); int remain = len - avail; while (remain > (limit - end)) { out.realWriteBytes( src, (off + len) - remain, limit - end ); remain = remain - (limit - end); } System.arraycopy(src, (off + len) - remain, buff, end, remain); end += remain; } // -------------------- Removing data from the buffer -------------------- public int substract() throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } int n = in.realReadBytes( buff, 0, buff.length ); if (n < 0) { return -1; } } return (buff[start++] & 0xFF); } /** * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public int substract(ByteChunk src) throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } int n = in.realReadBytes( buff, 0, buff.length ); if (n < 0) { return -1; } } int len = getLength(); src.append(buff, start, len); start = end; return len; } public byte substractB() throws IOException { if ((end - start) == 0) { if (in == null) return -1; int n = in.realReadBytes( buff, 0, buff.length ); if (n < 0) return -1; } return (buff[start++]); } public int substract( byte src[], int off, int len ) throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } int n = in.realReadBytes( buff, 0, buff.length ); if (n < 0) { return -1; } } int n = len; if (len > getLength()) { n = getLength(); } System.arraycopy(buff, start, src, off, n); start += n; return n; } /** * Send the buffer to the sink. Called by append() when the limit is * reached. You can also call it explicitly to force the data to be written. * * @throws IOException */ public void flushBuffer() throws IOException { //assert out!=null if( out==null ) { throw new IOException( "Buffer overflow, no sink " + limit + " " + buff.length ); } out.realWriteBytes( buff, start, end-start ); end=start; } /** * Make space for len chars. If len is small, allocate a reserve space too. * Never grow bigger than limit. */ public void makeSpace(int count) { byte[] tmp = null; int newSize; int desiredSize=end + count; // Can't grow above the limit if( limit > 0 && desiredSize > limit) { desiredSize=limit; } if( buff==null ) { if( desiredSize < 256 ) { desiredSize=256; // take a minimum } buff=new byte[desiredSize]; } // limit < buf.length ( the buffer is already big ) // or we already have space XXX if( desiredSize <= buff.length ) { return; } // grow in larger chunks if( desiredSize < 2 * buff.length ) { newSize= buff.length * 2; if( limit >0 && newSize > limit ) { newSize=limit; } tmp=new byte[newSize]; } else { newSize= buff.length * 2 + count ; if( limit > 0 && newSize > limit ) { newSize=limit; } tmp=new byte[newSize]; } System.arraycopy(buff, start, tmp, 0, end-start); buff = tmp; tmp = null; end=end-start; start=0; } // -------------------- Conversion and getters -------------------- @Override public String toString() { if (null == buff) { return null; } else if (end-start == 0) { return ""; } return StringCache.toString(this); } public String toStringInternal() { if (charset == null) { charset = DEFAULT_CHARSET; } // new String(byte[], int, int, Charset) takes a defensive copy of the // entire byte array. This is expensive if only a small subset of the // bytes will be used. The code below is from Apache Harmony. CharBuffer cb; cb = charset.decode(ByteBuffer.wrap(buff, start, end-start)); return new String(cb.array(), cb.arrayOffset(), cb.length()); } /** * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public int getInt() { return Ascii.parseInt(buff, start,end-start); } public long getLong() { return Ascii.parseLong(buff, start,end-start); } // -------------------- equals -------------------- /** * Compares the message bytes to the specified String object. * @param s the String to compare * @return true if the comparison succeeded, false otherwise */ public boolean equals(String s) { // XXX ENCODING - this only works if encoding is UTF8-compat // ( ok for tomcat, where we compare ascii - header names, etc )!!! byte[] b = buff; int blen = end-start; if (b == null || blen != s.length()) { return false; } int boff = start; for (int i = 0; i < blen; i++) { if (b[boff++] != s.charAt(i)) { return false; } } return true; } /** * Compares the message bytes to the specified String object. * @param s the String to compare * @return true if the comparison succeeded, false otherwise */ public boolean equalsIgnoreCase(String s) { byte[] b = buff; int blen = end-start; if (b == null || blen != s.length()) { return false; } int boff = start; for (int i = 0; i < blen; i++) { if (Ascii.toLower(b[boff++]) != Ascii.toLower(s.charAt(i))) { return false; } } return true; } public boolean equals( ByteChunk bb ) { return equals( bb.getBytes(), bb.getStart(), bb.getLength()); } public boolean equals( byte b2[], int off2, int len2) { byte b1[]=buff; if( b1==null && b2==null ) { return true; } int len=end-start; if ( len2 != len || b1==null || b2==null ) { return false; } int off1 = start; while ( len-- > 0) { if (b1[off1++] != b2[off2++]) { return false; } } return true; } public boolean equals( CharChunk cc ) { return equals( cc.getChars(), cc.getStart(), cc.getLength()); } public boolean equals( char c2[], int off2, int len2) { // XXX works only for enc compatible with ASCII/UTF !!! byte b1[]=buff; if( c2==null && b1==null ) { return true; } if (b1== null || c2==null || end-start != len2 ) { return false; } int off1 = start; int len=end-start; while ( len-- > 0) { if ( (char)b1[off1++] != c2[off2++]) { return false; } } return true; } /** * Returns true if the message bytes starts with the specified string. * @param s the string * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public boolean startsWith(String s) { // Works only if enc==UTF byte[] b = buff; int blen = s.length(); if (b == null || blen > end-start) { return false; } int boff = start; for (int i = 0; i < blen; i++) { if (b[boff++] != s.charAt(i)) { return false; } } return true; } /** * Returns true if the message bytes start with the specified byte array. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public boolean startsWith(byte[] b2) { byte[] b1 = buff; if (b1 == null && b2 == null) { return true; } int len = end - start; if (b1 == null || b2 == null || b2.length > len) { return false; } for (int i = start, j = 0; i < end && j < b2.length;) { if (b1[i++] != b2[j++]) { return false; } } return true; } /** * Returns true if the message bytes starts with the specified string. * @param s the string * @param pos The position */ public boolean startsWithIgnoreCase(String s, int pos) { byte[] b = buff; int len = s.length(); if (b == null || len+pos > end-start) { return false; } int off = start+pos; for (int i = 0; i < len; i++) { if (Ascii.toLower( b[off++] ) != Ascii.toLower( s.charAt(i))) { return false; } } return true; } public int indexOf( String src, int srcOff, int srcLen, int myOff ) { char first=src.charAt( srcOff ); // Look for first char int srcEnd = srcOff + srcLen; mainLoop: for( int i=myOff+start; i <= (end - srcLen); i++ ) { if( buff[i] != first ) { continue; } // found first char, now look for a match int myPos=i+1; for( int srcPos=srcOff + 1; srcPos< srcEnd;) { if( buff[myPos++] != src.charAt( srcPos++ )) { continue mainLoop; } } return i-start; // found it } return -1; } // -------------------- Hash code -------------------- // normal hash. public int hash() { return hashBytes( buff, start, end-start); } /** * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public int hashIgnoreCase() { return hashBytesIC( buff, start, end-start ); } private static int hashBytes( byte buff[], int start, int bytesLen ) { int max=start+bytesLen; byte bb[]=buff; int code=0; for (int i = start; i < max ; i++) { code = code * 37 + bb[i]; } return code; } private static int hashBytesIC( byte bytes[], int start, int bytesLen ) { int max=start+bytesLen; byte bb[]=bytes; int code=0; for (int i = start; i < max ; i++) { code = code * 37 + Ascii.toLower(bb[i]); } return code; } /** * Returns the first instance of the given character in this ByteChunk * starting at the specified byte. If the character is not found, -1 is * returned. * <br/> * NOTE: This only works for characters in the range 0-127. * * @param c The character * @param starting The start position * @return The position of the first instance of the character or * -1 if the character is not found. */ public int indexOf(char c, int starting) { int ret = indexOf(buff, start + starting, end, c); return (ret >= start) ? ret - start : -1; } /** * Returns the first instance of the given character in the given byte array * between the specified start and end. * <br/> * NOTE: This only works for characters in the range 0-127. * * @param bytes The byte array to search * @param start The point to start searching from in the byte array * @param end The point to stop searching in the byte array * @param c The character to search for * @return The position of the first instance of the character or -1 * if the character is not found. */ public static int indexOf(byte bytes[], int start, int end, char c) { int offset = start; while (offset < end) { byte b=bytes[offset]; if (b == c) { return offset; } offset++; } return -1; } /** * Returns the first instance of the given byte in the byte array between * the specified start and end. * * @param bytes The byte array to search * @param start The point to start searching from in the byte array * @param end The point to stop searching in the byte array * @param b The byte to search for * @return The position of the first instance of the byte or -1 if the * byte is not found. */ public static int findByte(byte bytes[], int start, int end, byte b) { int offset = start; while (offset < end) { if (bytes[offset] == b) { return offset; } offset++; } return -1; } /** * Returns the first instance of any of the given bytes in the byte array * between the specified start and end. * * @param bytes The byte array to search * @param start The point to start searching from in the byte array * @param end The point to stop searching in the byte array * @param b The array of bytes to search for * @return The position of the first instance of the byte or -1 if the * byte is not found. */ public static int findBytes(byte bytes[], int start, int end, byte b[]) { int blen = b.length; int offset = start; while (offset < end) { for (int i = 0; i < blen; i++) { if (bytes[offset] == b[i]) { return offset; } } offset++; } return -1; } /** * Returns the first instance of any byte that is not one of the given bytes * in the byte array between the specified start and end. * * @param bytes The byte array to search * @param start The point to start searching from in the byte array * @param end The point to stop searching in the byte array * @param b The list of bytes to search for * @return The position of the first instance a byte that is not * in the list of bytes to search for or -1 if no such byte * is found. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. */ @Deprecated public static int findNotBytes(byte bytes[], int start, int end, byte b[]) { int blen = b.length; int offset = start; boolean found; while (offset < end) { found = true; for (int i = 0; i < blen; i++) { if (bytes[offset] == b[i]) { found=false; break; } } if (found) { return offset; } offset++; } return -1; } /** * Convert specified String to a byte array. This ONLY WORKS for ascii, UTF * chars will be truncated. * * @param value to convert to byte array * @return the byte array value */ public static final byte[] convertToBytes(String value) { byte[] result = new byte[value.length()]; for (int i = 0; i < value.length(); i++) { result[i] = (byte) value.charAt(i); } return result; } }
e958929ae346de1f5ee558694f69138138b818dc
07c41d89eb7aeee828264dc6975ef705287e2cb5
/Test Code/testPaper.java
78f17c511059080bfc3c6bff74302d488e912298
[]
no_license
keevinli/TCSS360_Project
bebb668f4c527c5c48b60fa3a0174f0df066afa0
f3d551fae186544477d5269dd645ea3535e5a9c2
refs/heads/master
2021-01-21T13:52:49.286362
2016-05-07T16:26:20
2016-05-07T16:26:20
55,426,306
0
0
null
null
null
null
UTF-8
Java
false
false
820
java
package JUnitTests; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import TCSS360.Paper; public class testPaper { private Paper testPaper; private static final String TEST_PATH = "Test Path"; private static final String TEST_AUTHOR = "Test Author"; private static final String TEST_DATE = "05/06/2016"; private static final String TEST_TITLE = "Test Title"; @Before public void setupTests() { testPaper = new Paper(TEST_PATH, TEST_AUTHOR, TEST_DATE, TEST_TITLE); } @Test public void testConstructor() { assertTrue(testPaper.getPath().equals(TEST_PATH)); assertTrue(testPaper.getAuthor().equals(TEST_AUTHOR)); assertTrue(testPaper.getSubmitDate().equals(TEST_DATE)); assertTrue(testPaper.getTitle().equals(TEST_TITLE)); } }
ceb76fab79b4893f3c6a31ba875efe550cddb3c1
5c6bd14b0fe4ccb4349b88464c3fa6ef7e82f709
/src/com/yansheng/beans/MethodInvocationException.java
f39cfbc0616c8f0bf54a7d1dbfff7aadf64aabb0
[]
no_license
aeolusyansheng/spring-yansh
740991732f6fa9e71e0201b4e98188396987411b
d25c88d2d46a1183916d459e4d8eb2600c551c69
refs/heads/master
2021-09-13T08:56:39.114652
2018-04-27T09:32:31
2018-04-27T09:32:31
113,549,533
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package com.yansheng.beans; import java.beans.PropertyChangeEvent; @SuppressWarnings("serial") public class MethodInvocationException extends PropertyAccessException { public static final String ERROR_CODE = "methodInvocation"; public MethodInvocationException(PropertyChangeEvent propertyChangeEvent, Throwable cause) { super(propertyChangeEvent, "属性:" + propertyChangeEvent.getPropertyName() + "发生异常。", cause); } @Override public String getErrorCode() { return ERROR_CODE; } }
22cb63640ab2e567fde6a8eab7b73be728ae14ea
5f1456983faf72e11471e90c0a72f9aac4d66cfb
/src/main/java/day16/se01/n8DateFormat/Demo04Test2.java
bc1add87b92f914f5390828143f9c3ac593d2f35
[]
no_license
less-2010/Demo1
eb3c676093a45ca30279faa50b4eb905b1bde9b7
c1434d2d2ad20fce4d2c970484c55a0211ca03e1
refs/heads/master
2022-12-19T03:54:14.090051
2020-09-14T12:53:07
2020-09-14T12:53:07
276,821,803
2
0
null
null
null
null
UTF-8
Java
false
false
424
java
package day16.se01.n8DateFormat; public class Demo04Test2 { public static void main(String[] args) { /** * * 程序启动后要求用户输入自己的生日,格式如下: * 1996-05-05 * 然后经过程序计算,输出到今天为止一共活了多少天? * 再输出其出生10000天的纪念日是哪天?| */ } }
7899178e8d17531f0391b8c38ca72e5936e95785
977ebe395f2d9c1a80d6f6c505bde157f7d088f6
/target/generated/src/main/java/com/huawei/bme/cbsinterface/bcservices/BatchChangeAcctOfferingRequestMsg.java
035de88a2e875ec428be57b0f763a74e2baf07a9
[]
no_license
EOnyenezido/esb
5bc8e394809d8db46772c1e814dded69c1caa802
64b82667e253f03c9e18b4ff1be37264399d26b9
refs/heads/master
2020-03-28T06:13:37.875748
2018-09-14T12:44:04
2018-09-14T12:44:04
147,821,707
0
0
null
null
null
null
UTF-8
Java
false
false
2,964
java
package com.huawei.bme.cbsinterface.bcservices; import java.io.Serializable; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.huawei.bme.cbsinterface.cbscommon.RequestHeader; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="RequestHeader" type="{http://www.huawei.com/bme/cbsinterface/cbscommon}RequestHeader" form="unqualified"/&gt; * &lt;element name="BatchChangeAcctOfferingRequest" type="{http://www.huawei.com/bme/cbsinterface/bcservices}BatchChangeAcctOfferingRequest" form="unqualified"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "requestHeader", "batchChangeAcctOfferingRequest" }) @XmlRootElement(name = "BatchChangeAcctOfferingRequestMsg") public class BatchChangeAcctOfferingRequestMsg implements Serializable { private final static long serialVersionUID = 11082012L; @XmlElement(name = "RequestHeader", namespace = "", required = true) protected RequestHeader requestHeader; @XmlElement(name = "BatchChangeAcctOfferingRequest", namespace = "", required = true) protected BatchChangeAcctOfferingRequest batchChangeAcctOfferingRequest; /** * Gets the value of the requestHeader property. * * @return * possible object is * {@link RequestHeader } * */ public RequestHeader getRequestHeader() { return requestHeader; } /** * Sets the value of the requestHeader property. * * @param value * allowed object is * {@link RequestHeader } * */ public void setRequestHeader(RequestHeader value) { this.requestHeader = value; } /** * Gets the value of the batchChangeAcctOfferingRequest property. * * @return * possible object is * {@link BatchChangeAcctOfferingRequest } * */ public BatchChangeAcctOfferingRequest getBatchChangeAcctOfferingRequest() { return batchChangeAcctOfferingRequest; } /** * Sets the value of the batchChangeAcctOfferingRequest property. * * @param value * allowed object is * {@link BatchChangeAcctOfferingRequest } * */ public void setBatchChangeAcctOfferingRequest(BatchChangeAcctOfferingRequest value) { this.batchChangeAcctOfferingRequest = value; } }
32cc0cbea21a806eed1a75a0284fac3b8df8ffdb
a0424a6f5fa87c725866bf349e9bceb862a36f42
/src/main/java/getRequest/GetData.java
90e2044dbf9ed748bb6b830fe968e3887ca32efe
[]
no_license
Udita09/Bluestacks-assignment
593459295cf782271420f7eb5fe6163b10a492bd
7c8c367b5703ccdd1c3ea644981540559c020990
refs/heads/master
2023-06-23T14:41:48.228471
2021-07-21T17:38:37
2021-07-21T17:38:37
388,196,744
0
0
null
null
null
null
UTF-8
Java
false
false
565
java
package getRequest; import io.restassured.RestAssured; import io.restassured.response.Response; public class GetData { public void testResponseCode() { Response res = RestAssured.get("https://api.openweathermap.org/data/2.5/weather?appid={openweathermap_apikey}&q=chicago"); int code = res.getStatusCode(); Assert.assertEquals(code,200); } public void getString() { Response res = RestAssured.get("https://api.openweathermap.org/data/2.5/weather?appid={openweathermap_apikey}&q=chicago"); String data = res.asString(); System.out.println(data); } }
d1b1a20578b5a4794ee2dd23f94cc72c77df2c2d
d57862c79f348c55bef1488dcae0824abd5e7bc1
/src/com/thread/Pool1.java
6cbc18a9692f967ea89b900f652e16f1a477bad0
[]
no_license
wangshiz/threadproject
8c36b6069a05f61938a1d6043f12afe9f95f0888
4fb1d7f05a6e196965b1f519cb14112cf01d374f
refs/heads/master
2022-12-25T09:41:36.912347
2020-09-27T12:51:24
2020-09-27T12:51:24
295,065,844
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package com.thread; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; //测试线程池 public class Pool1 { public static void main(String[] args) { //创建服务 创建线程池 //newFixedThreadPool 参数为 线程池大小 ExecutorService service = Executors.newFixedThreadPool(10); //执行 service.execute(new MyThread()); service.execute(new MyThread()); service.execute(new MyThread()); service.execute(new MyThread()); service.execute(new MyThread()); //关闭线程 service.shutdown(); } } class MyThread implements Runnable{ @Override public void run() { System.out.println(Thread.currentThread().getName()); } }
c15da95905325977ddee283cf38be75cae0eede3
6f758395a7aa050dd5732979d16c3453945a82fe
/src/pboif2/pkg10119044/latihan57/vehicle/Bicycle.java
3e2ef55c779452fdf88ad35235678782b97180cb
[]
no_license
YohanaSriRejeki/PBOIF2-10119044-Latihan57-Vehicle
4e7a77a181f73a16bb8c5e365c576d1ba399affb
3b154eede009ba7394772c5f9cff19d5439a2723
refs/heads/master
2023-01-19T00:29:05.179855
2020-11-20T23:28:20
2020-11-20T23:28:20
314,693,177
0
0
null
null
null
null
UTF-8
Java
false
false
758
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 pboif2.pkg10119044.latihan57.vehicle; /** * * @author * NAMA : Yohana Sri Rejeki * KELAS : IF2 * NIM : 10119044 * Deskripsi Program : Program ini bertujuan menampilkan jenis-jenis vehicle */ public class Bicycle extends Vehicle { private int myGearCount; public Bicycle(){ System.out.println(getClass().getSimpleName()); } public int getGearCount(){ return myGearCount; } public void setGearCount(int gearCount){ this.myGearCount = gearCount; } }
[ "ASUS@ASUS-X541U" ]
ASUS@ASUS-X541U
1b615c298d80771f9d7c854c706fce9fcd1491d6
802b594e44622958eea734e3611cc93ba830536d
/src/main/java/com/hbl/global/utils/PropertiesUtil.java
81f46606c5c1e04b04fdb981f60da13bf34d0483
[]
no_license
Rontic/hbl_global
a2dfe5ce71a8cccfb3c820a8cc1dd228e4fd38c3
282b04f5aa4c376e0b66febd631e4009ee8287e5
refs/heads/master
2020-04-13T19:33:49.569268
2019-01-06T07:26:04
2019-01-06T07:26:04
162,398,377
0
0
null
null
null
null
UTF-8
Java
false
false
1,323
java
package com.hbl.global.utils; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Properties; /** * 资源文件读取工具类 * * @author founder * */ public final class PropertiesUtil { private PropertiesUtil() { } /** * 读取资源文件 * * @param fileName * 资源文件名 * @return 资源文件 */ public static Properties loadProperties(String fileName) { InputStream inputStream = null; InputStreamReader inputStreamReader = null; Properties p = new Properties(); try { inputStream = PropertiesUtil.class.getClassLoader() .getResourceAsStream(fileName); inputStreamReader = new InputStreamReader(PropertiesUtil.class.getClassLoader() .getResourceAsStream(fileName),"UTF-8"); //p.load(inputStream); p.load(inputStreamReader); } catch (IOException e) { e.printStackTrace(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } return p; } }
a91c65c60ee4132740f84018ceb70defbd72cf61
9460a81d99c61d70dd7c77c98df797b31bec724b
/src/WrongGraphSpecificationException.java
198952a55aff8b5041f61d251a15af47749c77f3
[]
no_license
dke-group-23/DKE-Project
ad142b0a44d6eb2d603514bd3106dc49730fb54f
a25847acab9a79102977de08c389598f800c0579
refs/heads/master
2020-03-31T00:59:34.141991
2019-01-23T10:03:12
2019-01-23T10:03:12
151,762,759
0
2
null
null
null
null
UTF-8
Java
false
false
513
java
/** * Custom exception indicating wrong graph specification. * * (This class is more specific than IllegalArgumentException and * allows to catch only exceptions generated by inner workings of a game.) * * Author: Tomek */ public class WrongGraphSpecificationException extends IllegalArgumentException { public WrongGraphSpecificationException(String s) { super(s); } public WrongGraphSpecificationException(String message, Throwable cause) { super(message, cause); } }
ec68979c66ab7533b87c4b73068bdbd55ff46803
668829ddf218f6cba1d5a7948d0fb169a99017b8
/app/src/main/java/Interface/OnClicked.java
c1fdda02342e5bdd2132db6ef007b85c8f8c6183
[]
no_license
NalinikantaOjha/Farfetch
daa8ab07b9452fed5c681aa7535edddba92a4c04
da7dabbd5dbfa05861a32e6cc9decbec9f267f5b
refs/heads/master
2023-08-09T06:30:56.571264
2021-08-27T15:27:46
2021-08-27T15:27:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package Interface; import Model.HomeModel; public interface OnClicked { void onButtonClicked(HomeModel model, int position); void onItemClicked(HomeModel model,int position); }
50ce89348507aeab40896e56001ec4f178dd33e4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/26/26_3100248714a579293991936e25aea49170747b6a/QuestionValidation/26_3100248714a579293991936e25aea49170747b6a_QuestionValidation_t.java
6bf7b65632e8c3c88b77dd4865e0b1d07aa45efe
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,922
java
package com.forum.repository; import org.apache.commons.lang.StringEscapeUtils; import org.springframework.stereotype.Repository; @Repository public class QuestionValidation { private static final int MINIMUM_CHARACTERS = 20; private static final int JAVA_SPACE = 32; private static final int HTML_SPACE = 160; public boolean isQuestionValid(String question) { if (question == null) return false; question = getPlainText(question); question = reduceBlanks(question); if (question == "" || question.length() < MINIMUM_CHARACTERS) return false; return true; } private String getPlainText(String question) { question = question.replaceAll("\\<.*?>", ""); return StringEscapeUtils.unescapeHtml(question); } private String reduceBlanks(String question) { int spaceCount = 0; StringBuilder refactoredQuestion = new StringBuilder(question.length()); for (int i = 0; i < question.length(); i++) { boolean spaceCharacter = question.charAt(i) == JAVA_SPACE || question.charAt(i) == HTML_SPACE; if (spaceCharacter) spaceCount++; if (!spaceCharacter || spaceCount <= 1) { refactoredQuestion.append(question.charAt(i)); } if (!spaceCharacter) spaceCount = 0; } return refactoredQuestion.toString(); } public String insertApostrophe(String question) { StringBuilder refactoredQuestion = new StringBuilder(question.length()); String apostrophe = "'"; for (int i = 0; i < question.length(); i++) { refactoredQuestion.append(question.charAt(i)); if (question.charAt(i) == '\'') { refactoredQuestion.append(apostrophe); } } return refactoredQuestion.toString(); } }
cdcb706950519eedf68d8339dc00ba4753e4a9bc
a9c3c705060b9efc284e9ce71743f37f06940633
/ndsc-backstage/src/main/java/com/njusc/npm/app/security/shiro/MyCasRealm.java
9ae3c41ddcaa20c70470d23c9816f98711f9ebb1
[]
no_license
Mr-Swift/clock_in_project
e84f3c46464d1837b6c5066738c0d25b4adf36ae
14084b53af59697cff8bf833cb943af097c33d44
refs/heads/master
2023-04-04T13:45:43.754131
2021-03-17T05:09:42
2021-04-24T12:54:05
348,586,432
0
0
null
null
null
null
UTF-8
Java
false
false
2,248
java
package com.njusc.npm.app.security.shiro; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.cas.CasRealm; import org.apache.shiro.subject.PrincipalCollection; import java.util.HashSet; import java.util.Set; public class MyCasRealm extends CasRealm { // public MyCasRealm() { // super(); //} // 获取授权信息 @Override protected AuthorizationInfo doGetAuthorizationInfo( PrincipalCollection principals) { //ModularRealmAuthenticator // CentralAuthenticationServiceImpl // DefaultFilter System.out.println("===============================已经授权了添加授权信息"); // ... 与前面 MyShiroRealm 相同 Set<String> roleNames = new HashSet<String>(); // Set<String> permissions = new HashSet<String>(); // roleNames.add("admin"); // permissions.add("user.do?myjsp"); // permissions.add("login.do?main"); // permissions.add("login.do?logout"); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(roleNames); // info.setStringPermissions(permissions); return info; } //@Override //protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { // System.out.println("===============================已经授权了添加授权信息"); //// String username = (String)principals.getPrimaryPrincipal(); // SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); //// authorizationInfo.setRoles(userService.findRoles(username)); //// authorizationInfo.setStringPermissions(userService.findPermissions(username)); // return authorizationInfo; //} /** * 返回 CAS 服务器地址,实际使用一般通过参数进行配置 */ public String getCasServerUrlPrefix() { System.out.println("======================================getCasServerUrlPrefix"); return "http://10.88.2.8:8080/cas"; // return "http://www.baidu.com"; } /** * 返回 CAS 客户端处理地址,实际使用一般通过参数进行配置 */ public String getCasService() { System.out.println("======================================getCasService"); return "http://10.88.2.33:8080/shirodemo/main.jsp"; // return "http://www.baidu.com"; } }
1bf1ceaa0c4f346f664007a99cab634093a3f06c
b251d4052bf32621d4ca944cc7b2717831da11d5
/src/main/java/printing/Printer.java
ea149864f75b3fd3abc40b4596c844b9045ac81b
[]
no_license
amrutashgaikwad/JavaFundamental-Part-1
db830576cb194091ba054acdf6f8e3165664010c
1959a80a092ddba352ed2def1daf3a450273154e
refs/heads/master
2020-07-05T09:35:06.161853
2016-08-22T12:14:58
2016-08-22T12:14:58
66,263,895
0
0
null
null
null
null
UTF-8
Java
false
false
520
java
package printing; public class Printer<T> { private String modelNumber; private boolean printer_isON; private T cartridge; public Printer(boolean isON, String modelNumber, T cartridge ) { this.modelNumber = modelNumber; this.printer_isON = isON; this.cartridge = cartridge; } public void print() { System.out.println(cartridge.toString()); String onStatus = ""; if(printer_isON) System.out.println("Printer is ON"); else System.out.println("Printer is OFF"); } }
953e97096fc551cc5e4a8f6a57ff66e81389afc8
422eaef4f1c7b022c525357ebb523d249906b7fe
/app/src/main/java/com/android/orion/OrionContentProvider.java
17859a28f16e210a05a894ccac2bfdaee77f1b89
[]
no_license
aswdz/Orion
ce22e5ed8dcfc806d9af0062da1c245474aec016
9fffeb6ff05b1d821090f8a723ca699424ac1cad
refs/heads/master
2023-08-28T04:30:04.229186
2021-10-14T14:40:44
2021-10-14T14:40:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,408
java
package com.android.orion; import java.util.ArrayList; import android.content.ContentProvider; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.OperationApplicationException; import android.content.UriMatcher; import android.database.Cursor; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.provider.BaseColumns; import android.text.TextUtils; import com.android.orion.database.DatabaseContract; import com.android.orion.database.DatabaseManager; public class OrionContentProvider extends ContentProvider { private static final int STOCK = 200; private static final int STOCK_ID = 201; private static final int STOCK_DATA = 300; private static final int STOCK_DATA_ID = 301; private static final int STOCK_DEAL = 400; private static final int STOCK_DEAL_ID = 401; private static final int FINANCIAL_DATA = 500; private static final int FINANCIAL_DATA_ID = 501; private static final int SHARE_BONUS = 600; private static final int SHARE_BONUS_ID = 601; private static final int TOTAL_SHARE = 700; private static final int TOTAL_SHARE_ID = 701; private static final int IPO = 800; private static final int IPO_ID = 801; private static final UriMatcher mUriMatcher = new UriMatcher( UriMatcher.NO_MATCH); static { mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.Stock.TABLE_NAME, STOCK); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.Stock.TABLE_NAME + "/#", STOCK_ID); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.StockData.TABLE_NAME, STOCK_DATA); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.StockData.TABLE_NAME + "/#", STOCK_DATA_ID); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.StockDeal.TABLE_NAME, STOCK_DEAL); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.StockDeal.TABLE_NAME + "/#", STOCK_DEAL_ID); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.FinancialData.TABLE_NAME, FINANCIAL_DATA); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.FinancialData.TABLE_NAME + "/#", FINANCIAL_DATA_ID); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.ShareBonus.TABLE_NAME, SHARE_BONUS); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.ShareBonus.TABLE_NAME + "/#", SHARE_BONUS_ID); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.TotalShare.TABLE_NAME, TOTAL_SHARE); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.TotalShare.TABLE_NAME + "/#", TOTAL_SHARE_ID); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.IPO.TABLE_NAME, IPO); mUriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.IPO.TABLE_NAME + "/#", IPO_ID); } ContentResolver mContentResolver = null; DatabaseManager mDatabaseManager = null; @Override public boolean onCreate() { if (mContentResolver == null) { mContentResolver = getContext().getContentResolver(); } if (mDatabaseManager == null) { mDatabaseManager = new DatabaseManager(getContext()); } if (mDatabaseManager != null) { mDatabaseManager.openDatabase(); } return true; } @Override public String getType(Uri uri) { String type = null; switch (mUriMatcher.match(uri)) { case STOCK: type = DatabaseContract.Stock.CONTENT_TYPE; break; case STOCK_ID: type = DatabaseContract.Stock.CONTENT_ITEM_TYPE; break; case STOCK_DATA: type = DatabaseContract.StockData.CONTENT_TYPE; break; case STOCK_DATA_ID: type = DatabaseContract.StockData.CONTENT_ITEM_TYPE; break; case STOCK_DEAL: type = DatabaseContract.StockDeal.CONTENT_TYPE; break; case STOCK_DEAL_ID: type = DatabaseContract.StockDeal.CONTENT_ITEM_TYPE; break; case FINANCIAL_DATA: type = DatabaseContract.FinancialData.CONTENT_TYPE; break; case FINANCIAL_DATA_ID: type = DatabaseContract.FinancialData.CONTENT_ITEM_TYPE; break; case SHARE_BONUS: type = DatabaseContract.ShareBonus.CONTENT_TYPE; break; case SHARE_BONUS_ID: type = DatabaseContract.ShareBonus.CONTENT_ITEM_TYPE; break; case TOTAL_SHARE: type = DatabaseContract.TotalShare.CONTENT_TYPE; break; case TOTAL_SHARE_ID: type = DatabaseContract.TotalShare.CONTENT_ITEM_TYPE; break; case IPO: type = DatabaseContract.IPO.CONTENT_TYPE; break; case IPO_ID: type = DatabaseContract.IPO.CONTENT_ITEM_TYPE; break; default: break; } return type; } @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor cursor = null; if (mDatabaseManager == null) { return null; } if (mDatabaseManager.mDatabase == null) { return null; } SQLiteQueryBuilder builder = new SQLiteQueryBuilder(); switch (mUriMatcher.match(uri)) { case STOCK: builder.setTables(DatabaseContract.Stock.TABLE_NAME); break; case STOCK_ID: builder.setTables(DatabaseContract.Stock.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; case STOCK_DATA: builder.setTables(DatabaseContract.StockData.TABLE_NAME); break; case STOCK_DATA_ID: builder.setTables(DatabaseContract.StockData.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; case STOCK_DEAL: builder.setTables(DatabaseContract.StockDeal.TABLE_NAME); break; case STOCK_DEAL_ID: builder.setTables(DatabaseContract.StockDeal.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; case FINANCIAL_DATA: builder.setTables(DatabaseContract.FinancialData.TABLE_NAME); break; case FINANCIAL_DATA_ID: builder.setTables(DatabaseContract.FinancialData.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; case SHARE_BONUS: builder.setTables(DatabaseContract.ShareBonus.TABLE_NAME); break; case SHARE_BONUS_ID: builder.setTables(DatabaseContract.ShareBonus.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; case TOTAL_SHARE: builder.setTables(DatabaseContract.TotalShare.TABLE_NAME); break; case TOTAL_SHARE_ID: builder.setTables(DatabaseContract.TotalShare.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; case IPO: builder.setTables(DatabaseContract.IPO.TABLE_NAME); break; case IPO_ID: builder.setTables(DatabaseContract.IPO.TABLE_NAME); builder.appendWhere(BaseColumns._ID + " = " + uri.getLastPathSegment()); break; default: break; } cursor = builder.query(mDatabaseManager.mDatabase, projection, selection, selectionArgs, null, null, sortOrder); if (cursor != null) { cursor.setNotificationUri(mContentResolver, uri); } return cursor; } public Uri insert(Uri uri, ContentValues contentValues, boolean notifyChange) { long id = 0; Uri itemUri = null; if (mDatabaseManager == null) { return itemUri; } if (mDatabaseManager.mDatabase == null) { return itemUri; } switch (mUriMatcher.match(uri)) { case STOCK: id = mDatabaseManager.mDatabase.insert( DatabaseContract.Stock.TABLE_NAME, null, contentValues); break; case STOCK_DATA: id = mDatabaseManager.mDatabase.insert( DatabaseContract.StockData.TABLE_NAME, null, contentValues); break; case STOCK_DEAL: id = mDatabaseManager.mDatabase.insert( DatabaseContract.StockDeal.TABLE_NAME, null, contentValues); break; case FINANCIAL_DATA: id = mDatabaseManager.mDatabase.insert( DatabaseContract.FinancialData.TABLE_NAME, null, contentValues); break; case SHARE_BONUS: id = mDatabaseManager.mDatabase .insert(DatabaseContract.ShareBonus.TABLE_NAME, null, contentValues); break; case TOTAL_SHARE: id = mDatabaseManager.mDatabase .insert(DatabaseContract.TotalShare.TABLE_NAME, null, contentValues); break; case IPO: id = mDatabaseManager.mDatabase.insert( DatabaseContract.IPO.TABLE_NAME, null, contentValues); break; default: break; } if (id > 0) { itemUri = ContentUris.withAppendedId(uri, id); if (notifyChange) { mContentResolver.notifyChange(itemUri, null); } } return itemUri; } @Override public Uri insert(Uri uri, ContentValues contentValues) { return insert(uri, contentValues, true); } @Override public int bulkInsert(Uri uri, ContentValues[] values) { int result = 0; if (mDatabaseManager == null) { return result; } if (mDatabaseManager.mDatabase == null) { return result; } mDatabaseManager.mDatabase.beginTransaction(); try { for (ContentValues contentValues : values) { if (insert(uri, contentValues, false) != null) { result++; } } mDatabaseManager.mDatabase.setTransactionSuccessful(); if (result > 0) { mContentResolver.notifyChange(uri, null); } } catch (Exception e) { e.printStackTrace(); } finally { mDatabaseManager.mDatabase.endTransaction(); } return result; } @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { int result = 0; String whereClause; if (mDatabaseManager == null) { return result; } if (mDatabaseManager.mDatabase == null) { return result; } switch (mUriMatcher.match(uri)) { case STOCK: result = mDatabaseManager.mDatabase.update( DatabaseContract.Stock.TABLE_NAME, values, selection, selectionArgs); break; case STOCK_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.Stock.TABLE_NAME, values, whereClause, selectionArgs); break; case STOCK_DATA: result = mDatabaseManager.mDatabase.update( DatabaseContract.StockData.TABLE_NAME, values, selection, selectionArgs); break; case STOCK_DATA_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.StockData.TABLE_NAME, values, whereClause, selectionArgs); break; case STOCK_DEAL: result = mDatabaseManager.mDatabase.update( DatabaseContract.StockDeal.TABLE_NAME, values, selection, selectionArgs); break; case STOCK_DEAL_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.StockDeal.TABLE_NAME, values, whereClause, selectionArgs); break; case FINANCIAL_DATA: result = mDatabaseManager.mDatabase.update( DatabaseContract.FinancialData.TABLE_NAME, values, selection, selectionArgs); break; case FINANCIAL_DATA_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.FinancialData.TABLE_NAME, values, whereClause, selectionArgs); break; case SHARE_BONUS: result = mDatabaseManager.mDatabase.update( DatabaseContract.ShareBonus.TABLE_NAME, values, selection, selectionArgs); break; case SHARE_BONUS_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.ShareBonus.TABLE_NAME, values, whereClause, selectionArgs); break; case TOTAL_SHARE: result = mDatabaseManager.mDatabase.update( DatabaseContract.TotalShare.TABLE_NAME, values, selection, selectionArgs); break; case TOTAL_SHARE_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.TotalShare.TABLE_NAME, values, whereClause, selectionArgs); break; case IPO: result = mDatabaseManager.mDatabase.update( DatabaseContract.IPO.TABLE_NAME, values, selection, selectionArgs); break; case IPO_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.update( DatabaseContract.IPO.TABLE_NAME, values, whereClause, selectionArgs); break; default: break; } if (result > 0) { mContentResolver.notifyChange(uri, null); } return result; } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { int result = 0; String whereClause; if (mDatabaseManager == null) { return result; } if (mDatabaseManager.mDatabase == null) { return result; } switch (mUriMatcher.match(uri)) { case STOCK: result = mDatabaseManager.mDatabase .delete(DatabaseContract.Stock.TABLE_NAME, selection, selectionArgs); break; case STOCK_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.delete( DatabaseContract.Stock.TABLE_NAME, whereClause, selectionArgs); break; case STOCK_DATA: result = mDatabaseManager.mDatabase.delete( DatabaseContract.StockData.TABLE_NAME, selection, selectionArgs); break; case STOCK_DATA_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.delete( DatabaseContract.StockData.TABLE_NAME, whereClause, selectionArgs); break; case STOCK_DEAL: result = mDatabaseManager.mDatabase.delete( DatabaseContract.StockDeal.TABLE_NAME, selection, selectionArgs); break; case STOCK_DEAL_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.delete( DatabaseContract.StockDeal.TABLE_NAME, whereClause, selectionArgs); break; case FINANCIAL_DATA: result = mDatabaseManager.mDatabase.delete( DatabaseContract.FinancialData.TABLE_NAME, selection, selectionArgs); break; case FINANCIAL_DATA_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.delete( DatabaseContract.FinancialData.TABLE_NAME, whereClause, selectionArgs); break; case SHARE_BONUS: result = mDatabaseManager.mDatabase.delete( DatabaseContract.ShareBonus.TABLE_NAME, selection, selectionArgs); break; case SHARE_BONUS_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.delete( DatabaseContract.ShareBonus.TABLE_NAME, whereClause, selectionArgs); break; case TOTAL_SHARE: result = mDatabaseManager.mDatabase.delete( DatabaseContract.TotalShare.TABLE_NAME, selection, selectionArgs); break; case TOTAL_SHARE_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase.delete( DatabaseContract.TotalShare.TABLE_NAME, whereClause, selectionArgs); break; case IPO: result = mDatabaseManager.mDatabase.delete( DatabaseContract.IPO.TABLE_NAME, selection, selectionArgs); break; case IPO_ID: whereClause = BaseColumns._ID + " = " + uri.getLastPathSegment(); if (!TextUtils.isEmpty(selection)) { whereClause += " AND " + whereClause; } result = mDatabaseManager.mDatabase .delete(DatabaseContract.IPO.TABLE_NAME, whereClause, selectionArgs); break; default: break; } if (result > 0) { mContentResolver.notifyChange(uri, null); } return result; } @Override public ContentProviderResult[] applyBatch( ArrayList<ContentProviderOperation> operations) throws OperationApplicationException { ContentProviderResult[] results = null; if (mDatabaseManager == null) { return results; } if (mDatabaseManager.mDatabase == null) { return results; } mDatabaseManager.mDatabase.beginTransaction(); try { results = super.applyBatch(operations); mDatabaseManager.mDatabase.setTransactionSuccessful(); return results; } finally { mDatabaseManager.mDatabase.endTransaction(); } } }
27d9a74a5b9d627d3a341a429d736a24f53ade22
2770d8e28f3b1443de85f98845633c8a635b90e0
/server/src/main/java/lu/cecchinel/smarthome/server/handlers/ValueHandler.java
2ac3062ff9c84e10424ecc64208acd5f9e81110a
[ "Apache-2.0" ]
permissive
ulrich06/Smarthome
3111aad607da2505bb661743618e22b3a1f20182
6919792f5746a1aa2c4206734965a91550dbb803
refs/heads/master
2021-06-28T01:58:59.879878
2020-04-18T16:21:43
2020-04-18T16:21:43
138,925,401
0
0
Apache-2.0
2020-10-13T00:22:02
2018-06-27T19:39:50
Java
UTF-8
Java
false
false
1,262
java
package lu.cecchinel.smarthome.server.handlers; import greycat.Graph; import greycat.Type; import io.undertow.server.HttpHandler; import model.Sensor; import model.sensors; import static greycat.Tasks.newTask; public class ValueHandler { public static HttpHandler valuesHandler(Graph graph) { return httpServerExchange -> { try { String name = httpServerExchange.getQueryParameters().get("name").getFirst(); Long time = Long.valueOf(httpServerExchange.getQueryParameters().get("time").getFirst()); Double value = Double.valueOf(httpServerExchange.getQueryParameters().get("value").getFirst()); newTask().readIndex(sensors.META.name, name) .travelInTime(String.valueOf(time)) .setAttribute(Sensor.VALUE.name, Type.DOUBLE, String.valueOf(value)) .save() .execute(graph, cb -> { if (cb.exception() != null) cb.exception().printStackTrace(); }); } catch (NullPointerException e) { System.out.println("Incomplete request: " + httpServerExchange.getQueryString()); } }; } }
efbeeb94ed09bdf8b558747ff3f5d68cf4b21d76
ec72c80c81feda41428b0dc7f103da3791a4c3cd
/OOPs/Assignment/TechmentAssignmentAbstractionInheritanceInheritanceandAbstraction5.java
9ca5aace727da4f2e55557694747f50b5650cf0d
[]
no_license
ZankyaniAbhishek/TechmentTraningAssignment
d604deea33d1ecc2f3fb735cb2c0ae720d103799
e64758f1ffbc9f98b77048cfcc6366afadfd4ff5
refs/heads/main
2023-07-26T16:45:03.187888
2021-09-13T12:36:07
2021-09-13T12:36:07
394,304,942
0
0
null
null
null
null
UTF-8
Java
false
false
3,029
java
package com.Techment.OOPs.Assignment; import java.util.Random; import java.util.Scanner; abstract class Medicine { int price; String Expirydate; void getDetails(int price, String expirydate) { this.price = price; Expirydate = expirydate; /*System.out.println("Price is : "+price); System.out.println("Edxpity Date is : ");*/ } abstract void displayLabel(); } class Tablet extends Medicine { @Override void displayLabel() { // TODO Auto-generated method stub System.out.println("Medicine type is TABLET , Price of the medicine is : " + price); System.out.println("Medicine Expiry Dated is : " + Expirydate); System.out.println("Store in a dry place"); } } class Syrup extends Medicine { @Override void displayLabel() { // TODO Auto-generated method stub System.out.println("Medicine type is Syrup , Price of the medicine is : " + price); System.out.println("Medicine Expiry Dated is : " + Expirydate); System.out.println("Store in a cool place"); } } class Ointment extends Medicine { @Override void displayLabel() { // TODO Auto-generated method stub System.out.println("Medicine type is Oinment , Price of the medicine is : " + price); System.out.println("Medicine Expiry Dated is : " + Expirydate); System.out.println("Store in a cool dry place"); } } public class TechmentAssignmentAbstractionInheritanceInheritanceandAbstraction5 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); Medicine[] medicine=new Medicine[5]; for(int i=0;i<medicine.length;i++) { //Medicine medicine1=new Medicine(); //Medicine medicine1 = new Syrup(); Medicine tablet=new Tablet(); Medicine syrup=new Syrup(); Medicine oitment=new Ointment(); Random random=new Random(); int n=random.nextInt(3); if(n==1) { System.out.println("Price of Tablet : "); int price=sc.nextInt(); System.out.println("Expiry date of Tablet : "); String expiryDate=sc.next(); tablet.getDetails(price,expiryDate); tablet.displayLabel(); //tablet.displayLabel(); } else if(n==2) { System.out.println("Price of Syrup : "); int price=sc.nextInt(); System.out.println("Expiry date of Syrup : "); String expiryDate=sc.next(); syrup.getDetails(price,expiryDate); //syrup.displayLabel(); syrup.displayLabel(); } else if(n==3) { System.out.println("Price of Oitment: "); int price=sc.nextInt(); System.out.println("Expiry date of Oitment : "); String expiryDate=sc.next(); oitment.getDetails(price,expiryDate); //oitment.displayLabel(); oitment.displayLabel(); } //Medicine.add(medicine); } } }
6e3f8c7b3f8e044b03202e066c379d80a231fdc7
7d260ad33e852fb22fce303282ced1c3230da4f7
/Solution.java
4be6cc06ba280afbdc88471a88858d6689cec177
[]
no_license
hirenmayani/competativeCoding
a39996c360f2d0650c5b3017f73595f1a7288b76
625d0a1cf47a4db6e98eccf3b2c61cd6cf8c1d07
refs/heads/master
2021-01-16T21:24:06.221256
2015-01-29T11:06:00
2015-01-29T11:06:00
30,012,288
1
2
null
2019-10-02T06:02:10
2015-01-29T09:07:14
Java
UTF-8
Java
false
false
782
java
package updatequery; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int maxD = sc.nextInt(); sc.close(); int[] maxVals = new int[maxD]; for (int i = 2; i < maxD; i++) { int sqrt = (int) Math.sqrt(i); if (sqrt * sqrt != i) { maxVals[i] = findX(i); } } int index=1,j = maxVals[1]; for (int i = 1; i < maxD; i++) { if (maxVals[i] > j) { index = i; j=maxVals[i]; } } System.out.println(index); } static int findX(int D) { int i = 2; int X = -1; boolean breaker =false; while (!breaker) { for (int j = 1; j < i; j++) { if ((i * i) - (D * j * j) == 1) { X = i; breaker=true; break; } } i++; } return X; } }
afd78ff6b96ddf27a32fb9a32cd03b7725e72fde
da3ae3952150454c35cd2bc36107dc490eaedcd8
/src/test/java/RunnerFeatures.java
674bbfa4ebd7c4e9c929cc261747d2bf2a280d99
[]
no_license
CharlesArth9/POM_BASE
46aa7580dedd56f67c5cf70c027593c6fd643c7a
6b4b4cb7e248262f28a2aa594b5ce22536dbaf01
refs/heads/master
2020-11-23T22:04:16.273897
2019-12-13T14:04:51
2019-12-13T14:04:51
227,691,187
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import net.serenitybdd.cucumber.CucumberWithSerenity; @RunWith(CucumberWithSerenity.class) //@CucumberOptions(features ="src/test/resources/features/") @CucumberOptions(features ="src/test/resources/features/Demo.Feature") //@CucumberOptions(features ="src/test/resources/features/ColorLib/nombre.feature") public class RunnerFeatures { }
9fd6388e458cdbae062132b982b496c31c1c9a71
e66dfd2f3250e0e271dcdac4883227873e914429
/zml-jce/src/main/java/com/jce/framework/weixin/api/core/handler/impl/WeixinReqDefaultHandler.java
37507602e3dac218c245fff7126c9f456fd9ce9d
[]
no_license
tianshency/zhuminle
d13b45a8a528f0da2142aab0fd999775fe476e0c
c864d0ab074dadf447504f54a82b2fc5b149b97e
refs/heads/master
2020-03-18T00:54:16.153820
2018-05-20T05:20:08
2018-05-20T05:20:08
134,118,245
0
1
null
null
null
null
UTF-8
Java
false
false
2,222
java
package com.jce.framework.weixin.api.core.handler.impl; import java.util.Map; import org.apache.log4j.Logger; import com.jce.framework.weixin.api.core.annotation.ReqType; import com.jce.framework.weixin.api.core.exception.WexinReqException; import com.jce.framework.weixin.api.core.handler.WeiXinReqHandler; import com.jce.framework.weixin.api.core.req.model.WeixinReqConfig; import com.jce.framework.weixin.api.core.req.model.WeixinReqParam; import com.jce.framework.weixin.api.core.util.HttpRequestProxy; import com.jce.framework.weixin.api.core.util.WeiXinConstant; import com.jce.framework.weixin.api.core.util.WeiXinReqUtil; public class WeixinReqDefaultHandler implements WeiXinReqHandler { private static Logger logger = Logger.getLogger(WeixinReqDefaultHandler.class); public String doRequest(WeixinReqParam weixinReqParam) throws WexinReqException { String strReturnInfo = ""; if (weixinReqParam.getClass().isAnnotationPresent(ReqType.class)) { ReqType reqType = (ReqType)weixinReqParam.getClass().getAnnotation(ReqType.class); WeixinReqConfig objConfig = WeiXinReqUtil.getWeixinReqConfig(reqType.value()); if (objConfig != null) { String reqUrl = objConfig.getUrl(); String method = objConfig.getMethod(); String datatype = objConfig.getDatatype(); Map parameters = WeiXinReqUtil.getWeixinReqParam(weixinReqParam); if (WeiXinConstant.JSON_DATA_TYPE.equalsIgnoreCase(datatype)) { parameters.clear(); parameters.put("access_token", weixinReqParam.getAccess_token()); weixinReqParam.setAccess_token(null); String jsonData = WeiXinReqUtil.getWeixinParamJson(weixinReqParam); strReturnInfo = HttpRequestProxy.doJsonPost(reqUrl, parameters, jsonData); } else if (WeiXinConstant.REQUEST_GET.equalsIgnoreCase(method)) { strReturnInfo = HttpRequestProxy.doGet(reqUrl, parameters, "UTF-8"); } else { strReturnInfo = HttpRequestProxy.doPost(reqUrl, parameters, "UTF-8"); } } } else { logger.info("没有找到对应的配置信息"); } return strReturnInfo; } }
7703e2baaaf3500663cfa02a9bf1ea35801794f9
3492ca0cc61a839ad53c485185cb639ba7b6d71a
/src/com/servlet/servlet2.java
a066c4e9d3146631ac50c07a8856e5bc1b892a82
[]
no_license
Dovishhh/Second_resp
9648b19ca906e1274384b85f062d32b6560e3915
8a95d3f45c493dec2cc5204f0666d187f175b167
refs/heads/master
2021-02-09T08:39:45.531920
2020-03-03T02:43:12
2020-03-03T02:43:12
244,262,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,254
java
package com.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class servlet2 */ @WebServlet("/servlet2") public class servlet2 extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public servlet2() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "a@LAPTOP-VQBLMAST" ]
a@LAPTOP-VQBLMAST
167bed8cc1856dddcce336b16f38feb37f32c196
eecc0c30a156f387c58e470a5ca2e25fd25afc4a
/rightangleoverlineview/src/androidTest/java/com/anwesh/uiprojects/rightangleoverlineview/ExampleInstrumentedTest.java
5b7e7d6246c8fec8c16de3f73c80fc811ad64d8a
[]
no_license
Anwesh43/LinkedRightAngleOverLineView
24dbed71ad02c3739828406be400f4675da7ad79
3dc8782fc3f57394e100abfba93516537336a41a
refs/heads/master
2020-06-25T12:41:45.279511
2019-07-28T16:17:54
2019-07-28T16:17:54
199,310,108
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package com.anwesh.uiprojects.rightangleoverlineview; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.anwesh.uiprojects.rightangleoverlineview.test", appContext.getPackageName()); } }
9921905032ea562117891f7b9bf0aa9e99f8bc27
96fbaf27343e4ede04672c25159b59064fbd7657
/src/main/java/meng/spring/test19/springaopapi/MyAfterReturningAdvice.java
7003a832b54a1a5b310870dec7e50bfa3211f3d7
[]
no_license
mengzhang6/spring-framework-sample-v02
0bcc77f6bb98bb5770dba5210ba891a351eaac37
19792177ec8932161a0a7ba7e53780a34a69e88c
refs/heads/master
2021-10-26T04:50:52.661122
2019-04-10T16:56:18
2019-04-10T16:56:18
82,319,322
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package meng.spring.test19.springaopapi; import java.lang.reflect.Method; import org.springframework.aop.AfterReturningAdvice; public class MyAfterReturningAdvice implements AfterReturningAdvice { private int count; public int getCount() { return count; } @Override public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { System.out.println("MyAfterReturningAdvice - afterThrowing"); System.out.println("MyAfterReturningAdvice-" + target.getClass().getName()); System.out.println("MyAfterReturningAdvice-" + method.getName()); System.out.println("MyAfterReturningAdvice-" + args); ++count; } }