blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
e31da36cbaeb3f37def5658bbf7f9dd22a4ecc06
b61ab83d9e7a5a32402beb9252305133d0713c10
/app/src/main/java/com/example/myreadproject8/widget/BadgeView.java
031370dfb905884583c200e8c8db37f5840b3805
[]
no_license
DJVQ/RoRReader
b312c3805810608f0f0269c4b2b8d6627ebb596a
4753a4f81584e6f96baa77f3d2c85cd860e46978
refs/heads/master
2023-05-07T15:57:51.525651
2021-06-03T03:34:15
2021-06-03T03:34:15
362,713,069
0
0
null
null
null
null
UTF-8
Java
false
false
7,165
java
package com.example.myreadproject8.widget; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.RoundRectShape; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; import android.widget.TabWidget; import androidx.appcompat.widget.AppCompatTextView; import com.example.myreadproject8.R; /** * Created by milad heydari on 5/6/2016. */ public class BadgeView extends AppCompatTextView { private boolean mHideOnNull = true; private float radius; public BadgeView(Context context) { this(context, null); } public BadgeView(Context context, AttributeSet attrs) { this(context, attrs, android.R.attr.textViewStyle); } public BadgeView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init() { if (!(getLayoutParams() instanceof LayoutParams)) { LayoutParams layoutParams = new LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); setLayoutParams(layoutParams); } // set default font setTextColor(Color.WHITE); //setTypeface(Typeface.DEFAULT_BOLD); setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); setPadding(dip2Px(5), dip2Px(1), dip2Px(5), dip2Px(1)); radius = 8; // set default background setBackground(radius, Color.parseColor("#d3321b")); setGravity(Gravity.CENTER); // default values setHideOnNull(true); setBadgeCount(0); setMinWidth(dip2Px(16)); setMinHeight(dip2Px(16)); } public void setBackground(float dipRadius, int badgeColor) { int radius = dip2Px(dipRadius); float[] radiusArray = new float[]{radius, radius, radius, radius, radius, radius, radius, radius}; RoundRectShape roundRect = new RoundRectShape(radiusArray, null, null); ShapeDrawable bgDrawable = new ShapeDrawable(roundRect); bgDrawable.getPaint().setColor(badgeColor); setBackground(bgDrawable); } public void setBackground(int badgeColor) { setBackground(radius, badgeColor); } /** * @return Returns true if view is hidden on badge value 0 or null; */ public boolean isHideOnNull() { return mHideOnNull; } /** * @param hideOnNull the hideOnNull to set */ public void setHideOnNull(boolean hideOnNull) { mHideOnNull = hideOnNull; setText(getText()); } /** * @see android.widget.TextView#setText(CharSequence, BufferType) */ @Override public void setText(CharSequence text, BufferType type) { if (isHideOnNull() && TextUtils.isEmpty(text)) { setVisibility(GONE); } else { setVisibility(VISIBLE); } super.setText(text, type); } public void setBadgeCount(int count) { setText(String.valueOf(count)); if (count == 0) { setVisibility(GONE); } } public void setHighlight(boolean highlight) { setBackground(getResources().getColor(highlight ? R.color.highlight : R.color.darker_gray)); } public Integer getBadgeCount() { if (getText() == null) { return null; } String text = getText().toString(); try { return Integer.parseInt(text); } catch (NumberFormatException e) { return null; } } public void setBadgeGravity(int gravity) { LayoutParams params = (LayoutParams) getLayoutParams(); params.gravity = gravity; setLayoutParams(params); } public int getBadgeGravity() { LayoutParams params = (LayoutParams) getLayoutParams(); return params.gravity; } public void setBadgeMargin(int dipMargin) { setBadgeMargin(dipMargin, dipMargin, dipMargin, dipMargin); } public void setBadgeMargin(int leftDipMargin, int topDipMargin, int rightDipMargin, int bottomDipMargin) { LayoutParams params = (LayoutParams) getLayoutParams(); params.leftMargin = dip2Px(leftDipMargin); params.topMargin = dip2Px(topDipMargin); params.rightMargin = dip2Px(rightDipMargin); params.bottomMargin = dip2Px(bottomDipMargin); setLayoutParams(params); } public int[] getBadgeMargin() { LayoutParams params = (LayoutParams) getLayoutParams(); return new int[]{params.leftMargin, params.topMargin, params.rightMargin, params.bottomMargin}; } public void incrementBadgeCount(int increment) { Integer count = getBadgeCount(); if (count == null) { setBadgeCount(increment); } else { setBadgeCount(increment + count); } } public void decrementBadgeCount(int decrement) { incrementBadgeCount(-decrement); } /** * Attach the BadgeView to the TabWidget * * @param target the TabWidget to attach the BadgeView * @param tabIndex index of the tab */ public void setTargetView(TabWidget target, int tabIndex) { View tabView = target.getChildTabViewAt(tabIndex); setTargetView(tabView); } /** * Attach the BadgeView to the target view * * @param target the view to attach the BadgeView */ public void setTargetView(View target) { if (getParent() != null) { ((ViewGroup) getParent()).removeView(this); } if (target == null) { return; } if (target.getParent() instanceof FrameLayout) { ((FrameLayout) target.getParent()).addView(this); } else if (target.getParent() instanceof ViewGroup) { // use a new Framelayout container for adding badge ViewGroup parentContainer = (ViewGroup) target.getParent(); int groupIndex = parentContainer.indexOfChild(target); parentContainer.removeView(target); FrameLayout badgeContainer = new FrameLayout(getContext()); ViewGroup.LayoutParams parentLayoutParams = target.getLayoutParams(); badgeContainer.setLayoutParams(parentLayoutParams); target.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); parentContainer.addView(badgeContainer, groupIndex, parentLayoutParams); badgeContainer.addView(target); badgeContainer.addView(this); } } /** * converts dip to px */ private int dip2Px(float dip) { return (int) (dip * getContext().getResources().getDisplayMetrics().density + 0.5f); } }
[ "1597264380@qq.com" ]
1597264380@qq.com
74cf0cc6befebe5d7dfdd478a678041253fdf482
8a5fc0c5e638fe00d5b0fe5d116e31727525dea9
/hkt/module/warehouse/service/src/main/java/com/hkt/module/promotion/entity/PromotionDetail.java
d5d0d2e6968cfd5425a55acdd92ad492ad983ad3
[]
no_license
ngthedung/learn-java
e4510a60a6b91490ccb0eb75e9c9dbed963edfa9
1d33f4b8376384b4919182f0fe3fa06c36a02ac6
refs/heads/master
2021-01-10T07:06:50.748610
2016-02-04T08:44:26
2016-02-04T08:44:26
47,745,756
0
0
null
null
null
null
UTF-8
Java
false
false
3,929
java
package com.hkt.module.promotion.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.OrderColumn; import javax.persistence.Table; import org.codehaus.jackson.annotate.JsonIgnore; @Entity @Table public class PromotionDetail extends Promotion { private double appliedToMinExpense; private double maxExpense; private boolean haveProduct; private boolean haveCustomer; private boolean haveLocation; private String storeCode; @Embedded @OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true, fetch = FetchType.EAGER) @JoinColumn(name = "promotionId", nullable = false, updatable = true) @OrderColumn private List<ProductTarget> productTargets; @Embedded @OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true, fetch = FetchType.EAGER) @JoinColumn(name = "promotionId", nullable = false, updatable = true) @OrderColumn private List<CustomerTarget> customerTargets; @Embedded @OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true, fetch = FetchType.EAGER) @JoinColumn(name = "promotionId", nullable = false, updatable = true) @OrderColumn private List<LocationTarget> locationTargets; public PromotionDetail() { productTargets = new ArrayList<ProductTarget>(); customerTargets = new ArrayList<CustomerTarget>(); locationTargets = new ArrayList<LocationTarget>(); haveProduct = false; haveCustomer = false; haveLocation = false; } public List<ProductTarget> getProductTargets() { return productTargets; } public boolean isHaveProduct() { return haveProduct; } public void setHaveProduct(boolean haveProduct) { this.haveProduct = haveProduct; } public boolean isHaveCustomer() { return haveCustomer; } public void setHaveCustomer(boolean haveCustomer) { this.haveCustomer = haveCustomer; } public boolean isHaveLocation() { return haveLocation; } public void setHaveLocation(boolean haveLocation) { this.haveLocation = haveLocation; } public void setProductTargets(List<ProductTarget> productTargets) { this.productTargets = productTargets; } public void add(ProductTarget productTarget) { if (productTargets == null) { productTargets = new ArrayList<ProductTarget>(); } productTargets.add(productTarget); } public List<CustomerTarget> getCustomerTargets() { return customerTargets; } public void setCustomerTargets(List<CustomerTarget> customerTargets) { this.customerTargets = customerTargets; } public void add(CustomerTarget customerTarget) { if (customerTargets == null) { customerTargets = new ArrayList<CustomerTarget>(); } customerTargets.add(customerTarget); } public List<LocationTarget> getLocationTargets() { return locationTargets; } public void setLocationTargets(List<LocationTarget> locationTargets) { this.locationTargets = locationTargets; } public void add(LocationTarget locationTarget) { if (locationTargets == null) { locationTargets = new ArrayList<LocationTarget>(); } locationTargets.add(locationTarget); } @JsonIgnore public boolean isNew() { return null == getId(); } public double getAppliedToMinExpense() { return appliedToMinExpense; } public void setAppliedToMinExpense(double appliedToMinExpense) { this.appliedToMinExpense = appliedToMinExpense; } public double getMaxExpense() { return maxExpense; } public void setMaxExpense(double maxExpense) { this.maxExpense = maxExpense; } public String getStoreCode() { return storeCode; } public void setStoreCode(String storeCode) { this.storeCode = storeCode; } }
[ "ngthedung.com@gmail.com" ]
ngthedung.com@gmail.com
b466029237137c7ab41254255c738af1493d6b31
0353ed49966e539faaf9ea5b887f30c2b1d52940
/gulimall-sms/src/main/java/com/atguigu/gulimall/sms/controller/SkuLadderController.java
98eb1d80e6beace171b022dce0dc865e58a29d61
[]
no_license
xingxingsese/gulimall
0fd75feeab3fbeea375b839ac459c5e6fc14acb2
fa3e1f3a829bba61d8531e7e5af157228ee85225
refs/heads/master
2022-07-21T13:54:06.326710
2019-08-15T09:30:58
2019-08-15T09:30:58
200,026,388
1
0
null
2022-06-21T01:40:16
2019-08-01T10:04:07
JavaScript
UTF-8
Java
false
false
2,437
java
package com.atguigu.gulimall.sms.controller; import java.util.Arrays; import java.util.Map; import com.atguigu.gulimall.commons.bean.PageVo; import com.atguigu.gulimall.commons.bean.QueryCondition; import com.atguigu.gulimall.commons.bean.Resp; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import com.atguigu.gulimall.sms.entity.SkuLadderEntity; import com.atguigu.gulimall.sms.service.SkuLadderService; /** * 商品阶梯价格 * * @author heyijieyou * @email zuihou098@qq.com * @date 2019-08-01 20:13:11 */ @Api(tags = "商品阶梯价格 管理") @RestController @RequestMapping("sms/skuladder") public class SkuLadderController { @Autowired private SkuLadderService skuLadderService; /** * 列表 */ @ApiOperation("分页查询(排序)") @GetMapping("/list") @PreAuthorize("hasAuthority('sms:skuladder:list')") public Resp<PageVo> list(QueryCondition queryCondition) { PageVo page = skuLadderService.queryPage(queryCondition); return Resp.ok(page); } /** * 信息 */ @ApiOperation("详情查询") @GetMapping("/info/{id}") @PreAuthorize("hasAuthority('sms:skuladder:info')") public Resp<SkuLadderEntity> info(@PathVariable("id") Long id){ SkuLadderEntity skuLadder = skuLadderService.getById(id); return Resp.ok(skuLadder); } /** * 保存 */ @ApiOperation("保存") @PostMapping("/save") @PreAuthorize("hasAuthority('sms:skuladder:save')") public Resp<Object> save(@RequestBody SkuLadderEntity skuLadder){ skuLadderService.save(skuLadder); return Resp.ok(null); } /** * 修改 */ @ApiOperation("修改") @PostMapping("/update") @PreAuthorize("hasAuthority('sms:skuladder:update')") public Resp<Object> update(@RequestBody SkuLadderEntity skuLadder){ skuLadderService.updateById(skuLadder); return Resp.ok(null); } /** * 删除 */ @ApiOperation("删除") @PostMapping("/delete") @PreAuthorize("hasAuthority('sms:skuladder:delete')") public Resp<Object> delete(@RequestBody Long[] ids){ skuLadderService.removeByIds(Arrays.asList(ids)); return Resp.ok(null); } }
[ "zuihou098@qq.com" ]
zuihou098@qq.com
a3a797ec9a8de2ef8176c439287d1867ad3027d7
7948afb1af34de7a773f7f97357e1b1904263420
/notification-core/src/main/java/fr/sii/notification/core/template/resolver/ConditionalResolver.java
e6a880b6f00a80e060d05e89aaeab1b1bd6894d2
[]
no_license
wei20024/notification-module
4a229323b2ea971eafa8e538995940a12fa428f9
2399cfb5b148a3a16ff2ae9d94e23c49503adeaa
refs/heads/master
2021-01-18T16:11:51.594740
2015-05-28T17:03:27
2015-05-28T17:03:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package fr.sii.notification.core.template.resolver; /** * Extension of the basic template resolution interface for adding conditional * use of the implementations. This extension adds a method that indicates to * the system that uses it if the implementation is able to handle the provided * template path. * * @author Aurélien Baudet * */ public interface ConditionalResolver extends TemplateResolver { /** * Indicates if the template path can be handled by this template resolver * or not. * * @param templateName * the name or the path of the template * @return true if the template path can be handled by this template * resolver, false otherwise */ public boolean supports(String templateName); }
[ "abaudet@sii.fr" ]
abaudet@sii.fr
71e490b4c417e1d9986a0f7cf60343e42c4607ce
7dd2ed6759bd6e20cde067fe907c40ecf6b2f0ac
/payshop/src/com/zsTrade/web/prj/controller/ProductTypeController.java
f19f1f856a495ada281d1f506a1e6529bfbd2c83
[ "Apache-2.0" ]
permissive
T5750/store-repositories
64406e539dd41508acd4d17324a420bd722a126d
10c44c9fc069c49ff70c45373fd3168286002308
refs/heads/master
2020-03-16T13:10:40.115323
2018-05-16T02:19:39
2018-05-16T02:19:43
132,683,143
0
0
null
null
null
null
UTF-8
Java
false
false
2,739
java
/** Powered By zscat科技, Since 2016 - 2020 */ package com.zsTrade.web.prj.controller; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageInfo; import com.zsTrade.common.utils.LogUtils; import com.zsTrade.web.prj.model.ProductType; import com.zsTrade.web.prj.service.ProductTypeService; /** * * @author zsCat 2016-12-22 9:29:55 * @Email: [email] * @version [version] * 项目类别管理 */ @Controller @RequestMapping("productType") public class ProductTypeController { @Resource private ProductTypeService ProductTypeService; @RequestMapping public String toProductType(Model model){ return "prj/productType/productType"; } /** * 分页显示字典table * @param params * @return */ @RequestMapping(value = "list", method = RequestMethod.POST) public String list(@RequestParam(required = false, value = "pageNum", defaultValue = "1")int pageNum, @RequestParam(required = false, value = "pageSize", defaultValue = "15")int pageSize, @ModelAttribute ProductType ProductType, Model model) { PageInfo<ProductType> page = ProductTypeService.selectPage(pageNum, pageSize, ProductType); model.addAttribute("page", page); return "prj/productType/productType-list"; } /** * 添加或更新区域 * @param params * @return */ @RequestMapping(value = "save", method = RequestMethod.POST) public @ResponseBody Integer save(@ModelAttribute ProductType ProductType) { try { return ProductTypeService.saveProductType(ProductType); } catch (Exception e) { LogUtils.ERROR_LOG.error(e.getMessage()); e.printStackTrace(); } return null; } /** * 删除字典 * @param id * @return */ @RequestMapping(value="delete",method=RequestMethod.POST) public @ResponseBody Integer del(@ModelAttribute ProductType ProductType){ try { return ProductTypeService.deleteProductType(ProductType); } catch (Exception e) { LogUtils.ERROR_LOG.error(e.getMessage()); e.printStackTrace(); } return null; } @RequestMapping(value="{mode}/showlayer",method=RequestMethod.POST) public String showLayer(Long id, Model model){ ProductType productType = ProductTypeService.selectByPrimaryKey(id); model.addAttribute("productType", productType); return "prj/productType/productType-save"; } }
[ "evangel_a@sina.com" ]
evangel_a@sina.com
8f0cf3287316d8787660dc80a5989aa18bc43fa0
7c886a2b5ee0d570355f72b4e69b461a5291df2b
/src/main/java/com/example/tdd/model/User.java
29ac86e8001c83d76c6ada78bb76afad8df865ad
[]
no_license
Serg-Maximchuk/tdd-example
32a33c9985319c408a6b581267b5f821358b6679
eb8680f16ca13a9e1e8534900553679b5f8ae1bd
refs/heads/master
2020-03-26T15:01:35.497469
2018-08-16T22:42:00
2018-08-16T22:42:00
145,018,492
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.example.tdd.model; import lombok.Data; @Data public class User { protected Long id; protected String email; public User() { } public User(User from) { setId(from.getId()); setEmail(from.getEmail()); } }
[ "serg.maximchuk@gmail.com" ]
serg.maximchuk@gmail.com
969192a469525760ffeb2d5283d9f3c80d65ca6b
767a4f247d67f2e0f1d7cbf2b2053019a43d84f1
/src/main/java/com/kh/scheduler/model/ToDoRepository.java
215b6ed32b1c716f206230126dfca4468a731f1d
[]
no_license
rekin7244/sch
6c73fef0d5dfed2d7050f1b90fafd5f57fcfb914
7924a1f4a5318583a983419f2374f60c58a9cdfe
refs/heads/master
2020-12-19T13:42:55.967424
2020-02-02T10:06:16
2020-02-02T10:06:16
235,750,850
0
0
null
2020-02-02T10:06:18
2020-01-23T08:13:14
Java
UTF-8
Java
false
false
312
java
package com.kh.scheduler.model; import java.util.List; import java.util.Optional; import org.springframework.data.repository.CrudRepository; public interface ToDoRepository extends CrudRepository<ToDo, String> { Optional<ToDo> findById(long id); List<ToDo> findByAuthor(String author); }
[ "rekint7244@gmail.com" ]
rekint7244@gmail.com
4aeb779f09d1716831b2cf27f25b5e78f027e1ea
66c846a595f3e0d4367d5a6c908a4ec940a966cd
/AlgosRef/src/Q050_Q099/Q079v2.java
d6847eb7fea365559774e093a638364ca55fe576
[]
no_license
cheers32/tradepartner
8cd052a9b73386abe31d998707f828144600318b
ab3936f0b4c71127fb19f9b963ac0c00acb28e29
refs/heads/master
2022-12-07T21:27:18.925248
2020-09-07T18:49:40
2020-09-07T18:49:40
273,936,249
0
0
null
2020-06-21T20:21:57
2020-06-21T15:52:34
Python
UTF-8
Java
false
false
1,712
java
package Q050_Q099; import java.util.HashSet; import java.util.Set; public class Q079v2 { public boolean exist(char[][] board, String word) { // this no-set approach is very fast; m*n*k (search full word at every cell) if(board==null || board[0].length==0 || word == null || word.length() == 0) return false; for(int i=0; i<board.length; i++) { for(int j=0; j<board[0].length; j++) { if(board[i][j]==word.charAt(0)) { if(search(board, word, 0, i, j)) { return true; } } } } return false; } boolean search(char[][] board, String word, int idx, int i, int j) { // signature needs to be interface type if(idx==word.length()) return true; if(i<0 || i>=board.length || j<0 || j>=board[0].length) return false; if(board[i][j]==' ') // char must be a space return false; if(word.charAt(idx)!=board[i][j]) return false; char temp = board[i][j]; board[i][j] = ' '; if(search(board, word, idx+1, i-1, j)) return true; // up if(search(board, word, idx+1, i, j+1)) return true; // right if(search(board, word, idx+1, i+1, j)) return true; // down if(search(board, word, idx+1, i, j-1)) return true; // left board[i][j] = temp; // this last step must be done, either remove from set or reassign board value return false; } public static void main(String[] args) { char[][] board = new char[][] {{'a', 'a'}}; System.out.println(new Q079v2().exist(board, "aaa")); } }
[ "cheers32@outlook.com" ]
cheers32@outlook.com
f332a22b7c83a30e5a7b41925f84d6ee440edebf
a9e7169afc472d07d3e22f4bd766454b3c41ce07
/Project Folder/Card.java
3b969609f896e318283f675c1b8c3fd78f2fffa9
[]
no_license
sefinn/hackTheNorth
fb6e8907abd8eccd38cc5350156a522e8bc817e2
ba6dfbbac2ea0062e1850fdf5863b07789258990
refs/heads/master
2020-03-28T19:01:57.575544
2018-09-15T22:02:09
2018-09-15T22:02:09
148,937,817
0
1
null
null
null
null
UTF-8
Java
false
false
5,482
java
/** * An object of type Card represents a playing card from a * standard Poker deck, including Jokers. The card has a suit, which * can be spades, hearts, diamonds, clubs, or joker. A spade, heart, * diamond, or club has one of the 13 values: ace, 2, 3, 4, 5, 6, 7, * 8, 9, 10, jack, queen, or king. Note that "ace" is considered to be * the smallest value. A joker can also have an associated value; * this value can be anything and can be used to keep track of several * different jokers. */ public class Card { public final static int SPADES = 0; // Codes for the 4 suits, plus Joker. public final static int HEARTS = 1; public final static int DIAMONDS = 2; public final static int CLUBS = 3; public final static int JOKER = 4; public final static int ACE = 1; // Codes for the non-numeric cards. public final static int JACK = 11; // Cards 2 through 10 have their public final static int QUEEN = 12; // numerical values for their codes. public final static int KING = 13; /** * This card's suit, one of the constants SPADES, HEARTS, DIAMONDS, * CLUBS, or JOKER. The suit cannot be changed after the card is * constructed. */ private final int suit; /** * The card's value. For a normal card, this is one of the values * 1 through 13, with 1 representing ACE. For a JOKER, the value * can be anything. The value cannot be changed after the card * is constructed. */ private final int value; /** * Creates a Joker, with 1 as the associated value. (Note that * "new Card()" is equivalent to "new Card(1,Card.JOKER)".) */ public Card() { suit = JOKER; value = 1; } /** * Creates a card with a specified suit and value. * @param theValue the value of the new card. For a regular card (non-joker), * the value must be in the range 1 through 13, with 1 representing an Ace. * You can use the constants Card.ACE, Card.JACK, Card.QUEEN, and Card.KING. * For a Joker, the value can be anything. * @param theSuit the suit of the new card. This must be one of the values * Card.SPADES, Card.HEARTS, Card.DIAMONDS, Card.CLUBS, or Card.JOKER. * @throws IllegalArgumentException if the parameter values are not in the * permissible ranges */ public Card(int theValue, int theSuit) { if (theSuit != SPADES && theSuit != HEARTS && theSuit != DIAMONDS && theSuit != CLUBS && theSuit != JOKER) throw new IllegalArgumentException("Illegal playing card suit"); if (theSuit != JOKER && (theValue < 1 || theValue > 13)) throw new IllegalArgumentException("Illegal playing card value"); value = theValue; suit = theSuit; } /** * Returns the suit of this card. * @returns the suit, which is one of the constants Card.SPADES, * Card.HEARTS, Card.DIAMONDS, Card.CLUBS, or Card.JOKER */ public int getSuit() { return suit; } /** * Returns the value of this card. * @return the value, which is one of the numbers 1 through 13, inclusive for * a regular card, and which can be any value for a Joker. */ public int getValue() { return value; } /** * Returns the score value of a card. * @return the Score value, 2-10,10,10,10,15 respectively * A numeric value for their score */ public int getScoreValue() { if(getValue() == 1){ return 15; //ace } else if (getValue() == 11 || getValue() == 12 || getValue() == 13) { return 10; } else { return getValue(); } } /** * Returns a String representation of the card's suit. * @return one of the strings "Spades", "Hearts", "Diamonds", "Clubs" * or "Joker". */ public String getSuitAsString() { switch ( suit ) { case SPADES: return "Spades"; case HEARTS: return "Hearts"; case DIAMONDS: return "Diamonds"; case CLUBS: return "Clubs"; default: return "Joker"; } } /** * Returns a String representation of the card's value. * @return for a regular card, one of the strings "Ace", "2", * "3", ..., "10", "Jack", "Queen", or "King". For a Joker, the * string is always numerical. */ public String getValueAsString() { if (suit == JOKER) return "" + value; else { switch ( value ) { case 1: return "Ace"; case 2: return "2"; case 3: return "3"; case 4: return "4"; case 5: return "5"; case 6: return "6"; case 7: return "7"; case 8: return "8"; case 9: return "9"; case 10: return "10"; case 11: return "Jack"; case 12: return "Queen"; default: return "King"; } } } /** * Returns a string representation of this card, including both * its suit and its value (except that for a Joker with value 1, * the return value is just "Joker"). Sample return values * are: "Queen of Hearts", "10 of Diamonds", "Ace of Spades", * "Joker", "Joker #2" */ public String toString() { if (suit == JOKER) { if (value == 1) return "Joker"; else return "Joker #" + value; } else return getValueAsString() + " of " + getSuitAsString(); } } // end class Card
[ "mgkoudro@edu.uwaterloo.ca" ]
mgkoudro@edu.uwaterloo.ca
debcf7b18b6e1b5d86c2d6d21200dca5be444c92
05ca4214198f0b56b8f586711cd5c06f63ec8f7a
/SymbolMapping/GeneticAlgorithm/GAAlgorithm.java
095ed94284e932af2e94839c41211d478553b9c0
[]
no_license
habibdanesh/GAvizTool
65fe2d38aa11f3fa00752b51271e977d3389164c
64d3cff108b207d4cc5a2bf63b34dce9de5d3eba
refs/heads/master
2020-12-20T03:05:12.027895
2020-01-24T05:16:46
2020-01-24T05:16:46
235,942,423
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
package GA_Visualizer.SymbolMapping.GeneticAlgorithm; public class GAAlgorithm<T> { private GAPopulation<T> pop; protected double pcross; protected double mut; public GAAlgorithm(GAPopulation<T> pop) { this.pop = pop; } public GAPopulation<T> getPopulation() { return pop; } public int popsize() { return pop.size(); } public void setCrossOver(double cross) { this.pcross = cross; } public double getCrossOver() { return pcross; } public void setMutation(double mut) { this.mut = mut; } public double getMutation() { return this.mut; } }
[ "noreply@github.com" ]
noreply@github.com
ad9f70812a77bc0ab086abdd8b05554985456d15
304ac65115500a8d99144b7b272975d061ff50cc
/roteiro1-/src/main/java/sorting/simpleSorting/SelectionSort.java
0c0782d6071d75f7e5986c2758cec0af1ffd4572
[]
no_license
thiagocm1/EDA-LEDA
714d89330488d581ed981ff921ccd0f8ea433ffe
ef8f249648b4b7a4f1704c9edd666d105d773970
refs/heads/master
2021-01-15T10:54:20.955340
2018-03-10T23:34:22
2018-03-10T23:34:22
99,600,429
0
0
null
null
null
null
UTF-8
Java
false
false
761
java
package sorting.simpleSorting; import sorting.AbstractSorting; import util.Util; /** * The selection sort algorithm chooses the smallest element from the array and * puts it in the first position. Then chooses the second smallest element and * stores it in the second position, and so on until the array is sorted. */ public class SelectionSort<T extends Comparable<T>> extends AbstractSorting<T> { @Override public void sort(T[] array, int leftIndex, int rightIndex) { // TODO Auto-generated method stub for (int i = leftIndex; i <= rightIndex; i++) { int lower = i; for (int j = i + 1; j <= rightIndex; j++) { if (array[j].compareTo(array[lower]) < 0) { Util.swap(array, j, lower); } } } } }
[ "noreply@github.com" ]
noreply@github.com
3d163e7e90f63ac60d92e2b85939be29fb199914
80711ada854dffac2b9cd1f1454959dc9f3b449f
/poker_management/GameLogic.java
b721823bd88bfb292a727d3fc7ac7ce0195170db
[]
no_license
JoeMaherZonal/card_game
05e00f859ec6b9755ee5c5c8c30362969e33ee08
cf9d9f55f1ff493b7f71d214828673658abe4cca
refs/heads/master
2021-06-01T15:58:13.987667
2016-08-15T07:55:47
2016-08-15T07:55:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,870
java
package poker_management; import java.util.*; public class GameLogic { public int determinePoints(Player player){ sortCards(player); Card card1 = player.getHand().get(0); Card card2 = player.getHand().get(1); Card card3 = player.getHand().get(2); int card1EnumIndex = card1.getValue().ordinal(); int card2EnumIndex = card2.getValue().ordinal(); int card3EnumIndex = card3.getValue().ordinal(); //checking for three of a kind if( (card1.getValue() == card2.getValue()) && (card1.getValue() == card3.getValue()) ){ if(card1.getValue() == ValueType.THREE){return 1;} if(card1.getValue() == ValueType.ACE){return 2;} if(card1.getValue() == ValueType.KING){return 3;} if(card1.getValue() == ValueType.QUEEN){return 4;} if(card1.getValue() == ValueType.JACK){return 5;} if(card1.getValue() == ValueType.TEN){return 6;} if(card1.getValue() == ValueType.NINE){return 7;} if(card1.getValue() == ValueType.EIGHT){return 8;} if(card1.getValue() == ValueType.SEVEN){return 9;} if(card1.getValue() == ValueType.SIX){return 10;} if(card1.getValue() == ValueType.FIVE){return 11;} if(card1.getValue() == ValueType.FOUR){return 12;} if(card1.getValue() == ValueType.TWO){return 13;} } //checking for a running flush if( (card3EnumIndex == (card2EnumIndex + 1) ) && (card2EnumIndex == (card1EnumIndex + 1)) ){ int flushAddition = 12; if( card1.getSuit() == card2.getSuit() && card2.getSuit() == card3.getSuit() ){ //we have a running flush flushAddition = 2; } if(card1.getValue() == ValueType.ACE && card2.getValue() == ValueType.TWO && card3.getValue() == ValueType.THREE) {return 14;} if(card1.getValue() == ValueType.ACE && card2.getValue() == ValueType.QUEEN && card3.getValue() == ValueType.KING) {return 15;} if(card1.getValue() == ValueType.JACK){return 16 + flushAddition;} if(card1.getValue() == ValueType.TEN){return 17 + flushAddition;} if(card1.getValue() == ValueType.NINE){return 18 + flushAddition;} if(card1.getValue() == ValueType.EIGHT){return 19 + flushAddition;} if(card1.getValue() == ValueType.SEVEN){return 20 + flushAddition;} if(card1.getValue() == ValueType.SIX){return 21 + flushAddition;} if(card1.getValue() == ValueType.FIVE){return 22 + flushAddition;} if(card1.getValue() == ValueType.FOUR){return 23 + flushAddition;} if(card1.getValue() == ValueType.THREE){return 24 + flushAddition;} if(card1.getValue() == ValueType.TWO){return 25 + flushAddition;} } //we have a flush if(card1.getValue() == ValueType.ACE && card2.getValue() == ValueType.TWO && card3.getValue() == ValueType.THREE){ return 26 + getValueofCards(player); } //we have a pair if(card1.getValue() == card2.getValue() || card2.getValue() == card3.getValue() || card3.getValue == card1.getValue()){ return 110 + getValueofCards(players) } return determineBestCard(player) + 300; } public int determineBestCard(Player player){ card1Points = getValueofCard(player.getHand().get(0)); card2Points = getValueofCard(player.getHand().get(1)); card3Points = getValueofCard(player.getHand().get(2)); if(card1Points > card2Points && card1Points > card3Points){ return card1Points; } if(card2Points > card1Points && card2Points > card3Points){ return card2Points; } if(card3Points > card2Points && card3Points > card1Points){ return card3Points; } } public int getValueofCards(Player player){ int total = 0; for(int i = 0; i < player.getHand().size(); i++){ total = total + getValueofCard(player.getHand().get(i)); } return total; } public int getValueofCard(Card card){ if(card.getValue() == ValueType.ACE){return 15;} if(card.getValue() == ValueType.KING){return 16;} if(card.getValue() == ValueType.QUEEN){return 17;} if(card.getValue() == ValueType.JACK){return 18;} if(card.getValue() == ValueType.TEN){return 19;} if(card.getValue() == ValueType.NINE){return 20;} if(card.getValue() == ValueType.EIGHT){return 21;} if(card.getValue() == ValueType.SEVEN){return 22;} if(card.getValue() == ValueType.SIX){return 23;} if(card.getValue() == ValueType.FIVE){return 24;} if(card.getValue() == ValueType.FOUR){return 25;} if(card.getValue() == ValueType.THREE){return 26;} return 27; } public void sortCards(Player player){ ArrayList<Card> orderedCards = new ArrayList<Card>(); ArrayList<Card> dealtCards = player.getHand(); for(int n = 0; n < ValueType.values().length; n++){ for(int i = 0; i < dealtCards.size(); i++){ if(dealtCards.get(i).getValue() == ValueType.values()[n]){ orderedCards.add(dealtCards.get(i)); } } } player.receiveOrderedHand(orderedCards); } }
[ "joseph-maher@hotmail.co.uk" ]
joseph-maher@hotmail.co.uk
f5e9d2c345a4d311d48061eaba166babde0e543c
580df24f826833073ea566d3cea8663ebcf5e42e
/Configuration.java
3133e180e9d12af7fef0d5d0fe88e18beb065955
[]
no_license
vanimardirossian/15-Puzzle
efaab50cae102c33ef8dbe6ac8b038fe901732c7
db7f9e488d6cbac960146ab6778a9790cd04b378
refs/heads/master
2022-04-21T07:39:31.278052
2020-04-14T09:28:17
2020-04-14T09:28:17
255,565,101
0
0
null
null
null
null
UTF-8
Java
false
false
2,169
java
/** * Configuration takes care of taking the input configuration from the user in String format, * and initializing the Tiles to correspond to the given input string. */ public class Configuration { /** * Represents the format String for initalizing the Tiles. */ private String data; /** * Constructor for Configuration, initializes data to the String format. * @param format The String which data will be initalized to. * @throws ConfigurationFormatException An Exception for malformed Configurations. */ public Configuration(String format) throws ConfigurationFormatException { data = format; } /** * Accessor method for Configuration data. * @return The Configuration data. */ public String getData() { return data; } /** * Initializes Tiles based on the Configuration data. * @param tiles An object of type Tiles, to be initialized. * @throws ConfigurationFormatException An Exception for malformed Configurations. * @throws InvalidConfigurationException An Exception for invalid Configurations. */ public void initialise(Tiles tiles) throws ConfigurationFormatException, InvalidConfigurationException { int SIZE = Tiles.SIZE; String[] rows = data.split(": "); if(data.trim().length() == 0) { throw new ConfigurationFormatException(); } if(rows.length != SIZE) { throw new ConfigurationFormatException("Incorrect number of rows in configuration (found " + rows.length + ")."); } for(String row : rows) { String[] cols = row.split(" "); if(cols.length != SIZE) { throw new ConfigurationFormatException("Incorrect number of columns in configuration (found " + cols.length + ")."); } for(String col : cols) { byte byteCol; try { byteCol = Byte.parseByte(col); } catch(NumberFormatException e) { throw new ConfigurationFormatException("Malformed Configuration" + this.data); } } } String[] values = data.replaceAll(": ", "").split(" "); int k = 0; for(int i = 0; i < Math.sqrt(values.length); i++) { for(int j = 0; j < Math.sqrt(values.length); j++) { tiles.setTile(i, j, Byte.parseByte(values[k])); k++; } } tiles.ensureValidity(); } }
[ "vani.mardirossian@gmail.com" ]
vani.mardirossian@gmail.com
9b3b12547635cdce7932bb8995944c1d38eae490
fe3b788178710844fbb2a18c199811493c1f728a
/src/main/java/com/kevin/designmode/strategypattern/Client.java
e7b81f8bfc3efd1dab3a68eaa7cf4f522cc4cfed
[]
no_license
ChengYongchao/kevinProject
4d83285ae1e2eb8a2b2c187aedfa4cb019a5726e
800c5557801f7587c1c4d41107f7e8aeeb5dc1f9
refs/heads/master
2022-01-01T10:42:04.950148
2020-11-20T07:41:53
2020-11-20T07:41:53
219,925,585
0
0
null
2021-12-14T21:53:56
2019-11-06T06:16:57
Java
UTF-8
Java
false
false
490
java
package com.kevin.designmode.strategypattern; /** * 在这里加入功能说明 * * @author chengyongchao * @version 1.0, 2020年1月9日 */ public class Client { public static void main(String[] args) { ConcreteStrategy1 str1 = new ConcreteStrategy1(); ConcreteStrategy2 str2 = new ConcreteStrategy2(); Context context1 = new Context(str1); context1.execute(); Context context2 = new Context(str2); context2.execute(); } }
[ "chengyc@meng-tu.com" ]
chengyc@meng-tu.com
6052cccc7b099e3a61af534d6ac1ba422b4ba460
252f247f738b99c98203f207fb86fbec861f1651
/app/src/main/java/com/example/porterduffxfermodedemo/view/SampleView.java
541c46d356a6722e9c0ef3785a397d73c1f8d845
[ "Apache-2.0" ]
permissive
JeffrayZ/PorterDuffXferModeDemo
05242bdbf69560d86eeb91bae2adc5bf5fbe2d4d
86bb445cc892cb9b105775b56090365081c258e7
refs/heads/master
2022-04-10T17:52:22.575050
2020-03-26T10:26:34
2020-03-26T10:26:34
250,226,052
1
0
null
null
null
null
UTF-8
Java
false
false
7,347
java
package com.example.porterduffxfermodedemo.view; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.Xfermode; import android.util.AttributeSet; import android.view.View; import androidx.annotation.Nullable; /** * @ProjectName: PorterDuffXferModeDemo * @Package: com.example.porterduffxfermodedemo.view * @ClassName: SampleView * @Description: java类作用描述 * @Author: Jeffray * @CreateDate: 2020/3/26 15:51 * @UpdateUser: 更新者 * @UpdateDate: 2020/3/26 15:51 * @UpdateRemark: 更新说明 * @Version: 1.0 */ public class SampleView extends View { private static final int W = 200; private static final int H = 200; private static final int ROW_MAX = 4; // number of samples per row private Bitmap mSrcB; private Bitmap mDstB; private Shader mBG; // background checker-board pattern private static final Xfermode[] sModes = { new PorterDuffXfermode(PorterDuff.Mode.CLEAR), new PorterDuffXfermode(PorterDuff.Mode.SRC), new PorterDuffXfermode(PorterDuff.Mode.DST), new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER), new PorterDuffXfermode(PorterDuff.Mode.DST_OVER), new PorterDuffXfermode(PorterDuff.Mode.SRC_IN), new PorterDuffXfermode(PorterDuff.Mode.DST_IN), new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT), new PorterDuffXfermode(PorterDuff.Mode.DST_OUT), new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP), new PorterDuffXfermode(PorterDuff.Mode.DST_ATOP), new PorterDuffXfermode(PorterDuff.Mode.XOR), new PorterDuffXfermode(PorterDuff.Mode.DARKEN), new PorterDuffXfermode(PorterDuff.Mode.LIGHTEN), new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY), new PorterDuffXfermode(PorterDuff.Mode.SCREEN) }; private static final String[] sLabels = { "Clear", "Src", "Dst", "SrcOver", "DstOver", "SrcIn", "DstIn", "SrcOut", "DstOut", "SrcATop", "DstATop", "Xor", "Darken", "Lighten", "Multiply", "Screen" }; public SampleView(Context context) { super(context); mSrcB = makeSrc(W, H); mDstB = makeDst(W, H); // make a ckeckerboard pattern Bitmap bm = Bitmap.createBitmap(new int[]{0xFFFFFFFF, 0xFFCCCCCC, 0xFFCCCCCC, 0xFFFFFFFF}, 2, 2, Bitmap.Config.RGB_565); mBG = new BitmapShader(bm, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m = new Matrix(); m.setScale(6, 6); mBG.setLocalMatrix(m); } public SampleView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); mSrcB = makeSrc(W, H); mDstB = makeDst(W, H); // make a ckeckerboard pattern Bitmap bm = Bitmap.createBitmap(new int[]{0xFFFFFFFF, 0xFFCCCCCC, 0xFFCCCCCC, 0xFFFFFFFF}, 2, 2, Bitmap.Config.RGB_565); mBG = new BitmapShader(bm, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m = new Matrix(); m.setScale(6, 6); mBG.setLocalMatrix(m); } public SampleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mSrcB = makeSrc(W, H); mDstB = makeDst(W, H); // make a ckeckerboard pattern Bitmap bm = Bitmap.createBitmap(new int[]{0xFFFFFFFF, 0xFFCCCCCC, 0xFFCCCCCC, 0xFFFFFFFF}, 2, 2, Bitmap.Config.RGB_565); mBG = new BitmapShader(bm, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m = new Matrix(); m.setScale(6, 6); mBG.setLocalMatrix(m); } public SampleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mSrcB = makeSrc(W, H); mDstB = makeDst(W, H); // make a ckeckerboard pattern Bitmap bm = Bitmap.createBitmap(new int[]{0xFFFFFFFF, 0xFFCCCCCC, 0xFFCCCCCC, 0xFFFFFFFF}, 2, 2, Bitmap.Config.RGB_565); mBG = new BitmapShader(bm, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m = new Matrix(); m.setScale(6, 6); mBG.setLocalMatrix(m); } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.WHITE); Paint labelP = new Paint(Paint.ANTI_ALIAS_FLAG); labelP.setTextAlign(Paint.Align.CENTER); Paint paint = new Paint(); paint.setFilterBitmap(false); canvas.translate(15, 35); int x = 0; int y = 0; for (int i = 0; i < sModes.length; i++) { // draw the border paint.setStyle(Paint.Style.STROKE); paint.setShader(null); canvas.drawRect(x - 0.5f, y - 0.5f, x + W + 0.5f, y + H + 0.5f, paint); // draw the checker-board pattern paint.setStyle(Paint.Style.FILL); paint.setShader(mBG); canvas.drawRect(x, y, x + W, y + H, paint); // draw the src/dst example into our offscreen bitmap int sc = canvas.saveLayer(x, y, x + W, y + H, null); canvas.translate(x, y); canvas.drawBitmap(mDstB, 0, 0, paint); paint.setXfermode(sModes[i]); canvas.drawBitmap(mSrcB, 0, 0, paint); paint.setXfermode(null); canvas.restoreToCount(sc); // draw the label canvas.drawText(sLabels[i], x + W / 2, y - labelP.getTextSize() / 2, labelP); x += W + 10; // wrap around when we've drawn enough for one row if ((i % ROW_MAX) == ROW_MAX - 1) { x = 0; y += H + 30; } } } // create a bitmap with a circle, used for the "dst" image static Bitmap makeDst(int w, int h) { Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(bm); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(0xFFFFCC44); c.drawOval(new RectF(0, 0, w * 3 / 4, h * 3 / 4), p); return bm; } // create a bitmap with a rect, used for the "src" image static Bitmap makeSrc(int w, int h) { Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(bm); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(0xFF66AAFF); c.drawRect(w / 3, h / 3, w * 19 / 20, h * 19 / 20, p); return bm; } }
[ "noreply@github.com" ]
noreply@github.com
781ad1ccfd824a11af2040322c19ce1deeab46b1
41908550507b9321c45f124b9da5cdcb8d427a52
/datastructure_tree/Tree.java
94b9363c1df448c8cb2da20744b0be0229c2d01d
[]
no_license
hii9505/inil
d3d69b8a4ce81072ac221c6d8d3e4634d663b6b5
3f6bae705d49f18ffe94cf5def181b2fe6ad32d4
refs/heads/master
2020-04-16T17:46:53.004674
2019-05-14T15:13:35
2019-05-14T15:13:35
165,788,398
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
public class Tree { int number; Tree left, right; public Tree(int number, Tree left, Tree right) { this.number = number; this.left = left; this.right = right; } }
[ "hii9505@naver.com" ]
hii9505@naver.com
b322937321e15d2bf43bdf40bb944b1e4451394e
340fb5588ce31482f048d49bcd2b18011f4b8968
/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/legacy/coreui/R.java
e7707d251aca71e9a886d959bd5b13277b2b8140
[]
no_license
liluodii/movieINTOjew
b5da74f7ffb27c4da189faa5c1ea48693464249c
be1d07de85ecd97751076f88863193233309671d
refs/heads/master
2022-05-28T15:49:44.851845
2020-04-26T06:02:40
2020-04-26T06:02:40
258,952,502
0
0
null
null
null
null
UTF-8
Java
false
false
12,395
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.legacy.coreui; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f04002a; public static final int coordinatorLayoutStyle = 0x7f0400a7; public static final int font = 0x7f0400da; public static final int fontProviderAuthority = 0x7f0400dc; public static final int fontProviderCerts = 0x7f0400dd; public static final int fontProviderFetchStrategy = 0x7f0400de; public static final int fontProviderFetchTimeout = 0x7f0400df; public static final int fontProviderPackage = 0x7f0400e0; public static final int fontProviderQuery = 0x7f0400e1; public static final int fontStyle = 0x7f0400e2; public static final int fontVariationSettings = 0x7f0400e3; public static final int fontWeight = 0x7f0400e4; public static final int keylines = 0x7f040110; public static final int layout_anchor = 0x7f040115; public static final int layout_anchorGravity = 0x7f040116; public static final int layout_behavior = 0x7f040117; public static final int layout_dodgeInsetEdges = 0x7f040143; public static final int layout_insetEdge = 0x7f04014c; public static final int layout_keyline = 0x7f04014d; public static final int statusBarBackground = 0x7f0401a9; public static final int ttcIndex = 0x7f04020b; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f060072; public static final int notification_icon_bg_color = 0x7f060073; public static final int ripple_material_light = 0x7f06007e; public static final int secondary_text_default_material_light = 0x7f060080; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f070050; public static final int compat_button_inset_vertical_material = 0x7f070051; public static final int compat_button_padding_horizontal_material = 0x7f070052; public static final int compat_button_padding_vertical_material = 0x7f070053; public static final int compat_control_corner_material = 0x7f070054; public static final int compat_notification_large_icon_max_height = 0x7f070055; public static final int compat_notification_large_icon_max_width = 0x7f070056; public static final int notification_action_icon_size = 0x7f0700c2; public static final int notification_action_text_size = 0x7f0700c3; public static final int notification_big_circle_margin = 0x7f0700c4; public static final int notification_content_margin_start = 0x7f0700c5; public static final int notification_large_icon_height = 0x7f0700c6; public static final int notification_large_icon_width = 0x7f0700c7; public static final int notification_main_column_padding_top = 0x7f0700c8; public static final int notification_media_narrow_margin = 0x7f0700c9; public static final int notification_right_icon_size = 0x7f0700ca; public static final int notification_right_side_padding_top = 0x7f0700cb; public static final int notification_small_icon_background_padding = 0x7f0700cc; public static final int notification_small_icon_size_as_large = 0x7f0700cd; public static final int notification_subtext_size = 0x7f0700ce; public static final int notification_top_pad = 0x7f0700cf; public static final int notification_top_pad_large_text = 0x7f0700d0; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f0800bc; public static final int notification_bg = 0x7f0800bd; public static final int notification_bg_low = 0x7f0800be; public static final int notification_bg_low_normal = 0x7f0800bf; public static final int notification_bg_low_pressed = 0x7f0800c0; public static final int notification_bg_normal = 0x7f0800c1; public static final int notification_bg_normal_pressed = 0x7f0800c2; public static final int notification_icon_background = 0x7f0800c3; public static final int notification_template_icon_bg = 0x7f0800c4; public static final int notification_template_icon_low_bg = 0x7f0800c5; public static final int notification_tile_bg = 0x7f0800c6; public static final int notify_panel_notification_icon_bg = 0x7f0800c7; } public static final class id { private id() {} public static final int action_container = 0x7f0a000e; public static final int action_divider = 0x7f0a0010; public static final int action_image = 0x7f0a0011; public static final int action_text = 0x7f0a0017; public static final int actions = 0x7f0a0018; public static final int async = 0x7f0a001e; public static final int blocking = 0x7f0a0022; public static final int bottom = 0x7f0a0023; public static final int chronometer = 0x7f0a003a; public static final int end = 0x7f0a0059; public static final int forever = 0x7f0a0065; public static final int icon = 0x7f0a006d; public static final int icon_group = 0x7f0a006e; public static final int info = 0x7f0a0078; public static final int italic = 0x7f0a007a; public static final int left = 0x7f0a0080; public static final int line1 = 0x7f0a0081; public static final int line3 = 0x7f0a0082; public static final int none = 0x7f0a008f; public static final int normal = 0x7f0a0090; public static final int notification_background = 0x7f0a0091; public static final int notification_main_column = 0x7f0a0092; public static final int notification_main_column_container = 0x7f0a0093; public static final int right = 0x7f0a00a6; public static final int right_icon = 0x7f0a00a7; public static final int right_side = 0x7f0a00a8; public static final int start = 0x7f0a00d6; public static final int tag_transition_group = 0x7f0a00dc; public static final int tag_unhandled_key_event_manager = 0x7f0a00dd; public static final int tag_unhandled_key_listeners = 0x7f0a00de; public static final int text = 0x7f0a00df; public static final int text2 = 0x7f0a00e0; public static final int time = 0x7f0a00ef; public static final int title = 0x7f0a00f0; public static final int top = 0x7f0a00f3; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0b000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0d0039; public static final int notification_action_tombstone = 0x7f0d003a; public static final int notification_template_custom_big = 0x7f0d0041; public static final int notification_template_icon_group = 0x7f0d0042; public static final int notification_template_part_chronometer = 0x7f0d0046; public static final int notification_template_part_time = 0x7f0d0047; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0f003f; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f100116; public static final int TextAppearance_Compat_Notification_Info = 0x7f100117; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f100119; public static final int TextAppearance_Compat_Notification_Time = 0x7f10011c; public static final int TextAppearance_Compat_Notification_Title = 0x7f10011e; public static final int Widget_Compat_NotificationActionContainer = 0x7f1001c6; public static final int Widget_Compat_NotificationActionText = 0x7f1001c7; public static final int Widget_Support_CoordinatorLayout = 0x7f1001f6; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f04002a }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] CoordinatorLayout = { 0x7f040110, 0x7f0401a9 }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f040115, 0x7f040116, 0x7f040117, 0x7f040143, 0x7f04014c, 0x7f04014d }; public static final int CoordinatorLayout_Layout_android_layout_gravity = 0; public static final int CoordinatorLayout_Layout_layout_anchor = 1; public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static final int CoordinatorLayout_Layout_layout_behavior = 3; public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static final int CoordinatorLayout_Layout_layout_insetEdge = 5; public static final int CoordinatorLayout_Layout_layout_keyline = 6; public static final int[] FontFamily = { 0x7f0400dc, 0x7f0400dd, 0x7f0400de, 0x7f0400df, 0x7f0400e0, 0x7f0400e1 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400da, 0x7f0400e2, 0x7f0400e3, 0x7f0400e4, 0x7f04020b }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "liluodedra13@gmail.com" ]
liluodedra13@gmail.com
5448a71c8150b97211975597ec1becd9d7b2e0a8
fae551eb54ab3a907ba13cf38aba1db288708d92
/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/AccessorySheetRenderTest.java
f7323d58a67868f43839184fcd21571c850de4a9
[ "BSD-3-Clause" ]
permissive
xtblock/chromium
d4506722fc6e4c9bc04b54921a4382165d875f9a
5fe0705b86e692c65684cdb067d9b452cc5f063f
refs/heads/main
2023-04-26T18:34:42.207215
2021-05-27T04:45:24
2021-05-27T04:45:24
371,258,442
2
1
BSD-3-Clause
2021-05-27T05:36:28
2021-05-27T05:36:28
null
UTF-8
Java
false
false
15,485
java
// Copyright 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.keyboard_accessory.sheet_component; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetProperties.ACTIVE_TAB_INDEX; import static org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetProperties.HEIGHT; import static org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetProperties.NO_ACTIVE_TAB; import static org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetProperties.TABS; import static org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetProperties.TOP_SHADOW_VISIBLE; import static org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetProperties.VISIBLE; import static org.chromium.ui.base.LocalizationUtils.setRtlForTesting; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.test.filters.MediumTest; import android.view.Gravity; import android.view.ViewStub; import android.widget.FrameLayout; import android.widget.LinearLayout; import androidx.annotation.DimenRes; import androidx.annotation.IdRes; import androidx.annotation.LayoutRes; import androidx.annotation.Nullable; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.Callback; import org.chromium.base.FeatureList; import org.chromium.base.test.BaseActivityTestRule; import org.chromium.base.test.params.ParameterAnnotations; import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.ApplicationTestUtils; import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; import org.chromium.chrome.browser.keyboard_accessory.R; import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData; import org.chromium.chrome.browser.keyboard_accessory.data.PropertyProvider; import org.chromium.chrome.browser.keyboard_accessory.data.Provider; import org.chromium.chrome.browser.keyboard_accessory.data.UserInfoField; import org.chromium.chrome.browser.keyboard_accessory.helper.FaviconHelper; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabCoordinator; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AddressAccessorySheetCoordinator; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.CreditCardAccessorySheetCoordinator; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.PasswordAccessorySheetCoordinator; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.ViewUtils; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.content_public.browser.test.NativeLibraryTestUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.DeferredViewStubInflationProvider; import org.chromium.ui.modelutil.LazyConstructionPropertyMcp; import org.chromium.ui.modelutil.ListModel; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.test.util.DummyUiActivity; import org.chromium.ui.test.util.NightModeTestUtils; import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * These tests render screenshots of various accessory sheets and compare them to a gold standard. */ @RunWith(ParameterizedRunner.class) @ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @Batch(Batch.PER_CLASS) @EnableFeatures({ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AccessorySheetRenderTest { @ParameterAnnotations.ClassParameter private static List<ParameterSet> sClassParams = Arrays.asList(new ParameterSet().value(false, false).name("Default"), new ParameterSet().value(false, true).name("RTL"), new ParameterSet().value(true, false).name("NightMode")); private FrameLayout mContentView; private PropertyModel mSheetModel; // No @Rule since we only need the launching helpers. Adding the rule to the chain breaks with // any ParameterizedRunnerDelegate. private BaseActivityTestRule<DummyUiActivity> mActivityTestRule = new BaseActivityTestRule<>(DummyUiActivity.class); @Rule public final ChromeRenderTestRule mRenderTestRule = ChromeRenderTestRule.Builder.withPublicCorpus().build(); public AccessorySheetRenderTest(boolean nightModeEnabled, boolean useRtlLayout) { FeatureList.setTestFeatures( Collections.singletonMap(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY, true)); setRtlForTesting(useRtlLayout); NightModeTestUtils.setUpNightModeForDummyUiActivity(nightModeEnabled); mRenderTestRule.setNightModeEnabled(nightModeEnabled); mRenderTestRule.setVariantPrefix(useRtlLayout ? "RTL" : "LTR"); } private static class TestFaviconHelper extends FaviconHelper { public TestFaviconHelper(Context context) { super(context); } @Override public void fetchFavicon(String origin, Callback<Drawable> setIconCallback) { setIconCallback.onResult(getDefaultIcon(origin)); } } @Before public void setUp() throws InterruptedException { NativeLibraryTestUtils.loadNativeLibraryNoBrowserProcess(); FaviconHelper.setCreationStrategy(TestFaviconHelper::new); mActivityTestRule.launchActivity(null); TestThreadUtils.runOnUiThreadBlocking(() -> { ViewStub sheetStub = initializeContentViewWithSheetStub(); mSheetModel = createSheetModel( mActivityTestRule.getActivity().getResources().getDimensionPixelSize( R.dimen.keyboard_accessory_sheet_height)); LazyConstructionPropertyMcp.create(mSheetModel, VISIBLE, new DeferredViewStubInflationProvider<>(sheetStub), AccessorySheetViewBinder::bind); }); } @After public void tearDown() { TestThreadUtils.runOnUiThreadBlocking( NightModeTestUtils::tearDownNightModeForDummyUiActivity); setRtlForTesting(false); try { ApplicationTestUtils.finishActivity(mActivityTestRule.getActivity()); } catch (Exception e) { // Activity was already closed (e.g. due to last test tearing down the suite). } } @Test @MediumTest @Feature({"RenderTest"}) public void testAddingPasswordTabToModelRendersTabsView() throws IOException { final KeyboardAccessoryData.AccessorySheetData sheet = new KeyboardAccessoryData.AccessorySheetData( AccessoryTabType.PASSWORDS, "Passwords", ""); sheet.getUserInfoList().add( new KeyboardAccessoryData.UserInfo("http://psl.origin.com/", false)); sheet.getUserInfoList().get(0).addField( new UserInfoField("No username", "No username", "", false, null)); sheet.getUserInfoList().get(0).addField( new UserInfoField("Password", "Password for No username", "", true, cb -> {})); sheet.getFooterCommands().add( new KeyboardAccessoryData.FooterCommand("Suggest strong password", cb -> {})); sheet.getFooterCommands().add( new KeyboardAccessoryData.FooterCommand("Manage Passwords", cb -> {})); showSheetTab(new PasswordAccessorySheetCoordinator(mActivityTestRule.getActivity(), null), sheet); mRenderTestRule.render(mContentView, "Passwords"); } @Test @MediumTest @Feature({"RenderTest"}) public void testAddingCreditCardToModelRendersTabsView() throws IOException { // Construct a sheet with a few data fields. Leave gaps so that the footer is visible in the // screenshot (but supply the fields itself since the field count should be fixed). final KeyboardAccessoryData.AccessorySheetData sheet = new KeyboardAccessoryData.AccessorySheetData( AccessoryTabType.CREDIT_CARDS, "Payments", ""); sheet.getUserInfoList().add(new KeyboardAccessoryData.UserInfo("", false)); sheet.getUserInfoList().get(0).addField( new UserInfoField("**** 9219", "Card for Todd Tester", "1", false, result -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("10", "10", "-1", false, result -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("2021", "2021", "-1", false, result -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("Todd Tester", "Todd Tester", "0", false, result -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("123", "123", "-1", false, result -> {})); sheet.getUserInfoList().add(new KeyboardAccessoryData.UserInfo("", false)); sheet.getUserInfoList().get(1).addField( new UserInfoField("**** 8012", "Card for Maya Park", "1", false, result -> {})); sheet.getUserInfoList().get(1).addField( // Unused expiration month field. new UserInfoField("", "", "-1", false, result -> {})); sheet.getUserInfoList().get(1).addField( // Unused expiration year field. new UserInfoField("", "", "-1", false, result -> {})); sheet.getUserInfoList().get(1).addField( // Unused card holder field. new UserInfoField("", "", "1", false, result -> {})); sheet.getUserInfoList().get(1).addField( new UserInfoField("", "", "-1", false, result -> {})); sheet.getFooterCommands().add( new KeyboardAccessoryData.FooterCommand("Manage payment methods", cb -> {})); showSheetTab(new CreditCardAccessorySheetCoordinator(mActivityTestRule.getActivity(), null), sheet); mRenderTestRule.render(mContentView, "Payments"); } @Test @MediumTest @Feature({"RenderTest"}) public void testAddingAddressToModelRendersTabsView() throws IOException { // Construct a sheet with a few data fields. Leave gaps so that the footer is visible in the // screenshot (but supply the fields itself since the field count should be fixed). final KeyboardAccessoryData.AccessorySheetData sheet = new KeyboardAccessoryData.AccessorySheetData( AccessoryTabType.ADDRESSES, "Addresses", ""); sheet.getUserInfoList().add(new KeyboardAccessoryData.UserInfo("", false)); sheet.getUserInfoList().get(0).addField( new UserInfoField("Todd Tester", "Todd Tester", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( // Unused company name field. new UserInfoField("", "", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("112 Second Str", "112 Second Str", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( // Unused address line 2 field. new UserInfoField("", "", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( // Unused ZIP code field. new UserInfoField("", "", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("Budatest", "Budatest", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( // Unused state field. new UserInfoField("", "", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( // Unused country field. new UserInfoField("", "", "", false, item -> {})); sheet.getUserInfoList().get(0).addField( new UserInfoField("+088343188321", "+088343188321", "", false, item -> {})); sheet.getUserInfoList().get(0).addField(new UserInfoField( "todd.tester@gmail.com", "todd.tester@gmail.com", "", false, item -> {})); sheet.getFooterCommands().add( new KeyboardAccessoryData.FooterCommand("Manage addresses", cb -> {})); showSheetTab( new AddressAccessorySheetCoordinator(mActivityTestRule.getActivity(), null), sheet); mRenderTestRule.render(mContentView, "Addresses"); } private ViewStub initializeContentViewWithSheetStub() { mContentView = new FrameLayout(mActivityTestRule.getActivity()); mActivityTestRule.getActivity().setContentView(mContentView); ViewStub sheetStub = createViewStub(R.id.keyboard_accessory_sheet_stub, R.layout.keyboard_accessory_sheet, null, R.dimen.keyboard_accessory_sheet_height); mContentView.addView(sheetStub, MATCH_PARENT, WRAP_CONTENT); return sheetStub; } private ViewStub createViewStub(@IdRes int id, @LayoutRes int layout, @Nullable @IdRes Integer inflatedId, @DimenRes int layoutHeight) { ViewStub stub = new ViewStub(mActivityTestRule.getActivity()); stub.setId(id); stub.setLayoutResource(layout); if (inflatedId != null) stub.setInflatedId(inflatedId); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(MATCH_PARENT, mActivityTestRule.getActivity().getResources().getDimensionPixelSize(layoutHeight)); layoutParams.gravity = Gravity.START | Gravity.BOTTOM; stub.setLayoutParams(layoutParams); return stub; } private static PropertyModel createSheetModel(int height) { return new PropertyModel .Builder(TABS, ACTIVE_TAB_INDEX, VISIBLE, HEIGHT, TOP_SHADOW_VISIBLE) .with(HEIGHT, height) .with(TABS, new ListModel<>()) .with(ACTIVE_TAB_INDEX, NO_ACTIVE_TAB) .with(VISIBLE, false) .with(TOP_SHADOW_VISIBLE, false) .build(); } private void showSheetTab(AccessorySheetTabCoordinator sheetComponent, KeyboardAccessoryData.AccessorySheetData sheetData) { mSheetModel.get(TABS).add(sheetComponent.getTab()); Provider<KeyboardAccessoryData.AccessorySheetData> provider = new PropertyProvider<>(); sheetComponent.registerDataProvider(provider); provider.notifyObservers(sheetData); mSheetModel.set(ACTIVE_TAB_INDEX, 0); TestThreadUtils.runOnUiThreadBlocking(() -> mSheetModel.set(VISIBLE, true)); ViewUtils.waitForView(mContentView, withId(R.id.keyboard_accessory_sheet)); } }
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
d43267d783f2739659fed79e22141463fe9c7ede
424d6cdf6ceb562d9408ab0ca9e27a275a197167
/lab12android/app/src/main/java/com/example/lab12android/ui/gallery/GalleryFragment.java
52ad3ddfba62a629526acae52c2c61fef89c2e1b
[]
no_license
julianagarzond/Android_Secure_REST_API_Lab12
a7bbfba3685060aba5f355bec8a77b95eef3226b
66b5594d789dda1ba0fa4cbccec54325028b77a8
refs/heads/master
2023-01-12T02:12:34.913649
2020-11-18T01:50:38
2020-11-18T01:50:38
313,791,770
0
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package com.example.lab12android.ui.gallery; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import com.example.lab12android.R; public class GalleryFragment extends Fragment { private GalleryViewModel galleryViewModel; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { galleryViewModel = new ViewModelProvider(this).get(GalleryViewModel.class); View root = inflater.inflate(R.layout.fragment_gallery, container, false); final TextView textView = root.findViewById(R.id.text_gallery); galleryViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { @Override public void onChanged(@Nullable String s) { textView.setText(s); } }); return root; } }
[ "juliana.garzon-d@mail.escuelaing.edu.co" ]
juliana.garzon-d@mail.escuelaing.edu.co
552eed006aedf3709a9267a293dc48ee215b2dd0
6b826cab54da27afc4a2dd5e971db69eee8cd4fb
/src/test/java/com/deconware/ops/dimensions/ExtensionTest.java
05c653c6b97edf64f7db6acada2a1d6d78b5d6c0
[]
no_license
bnorthan/deconware-ops
96d1d2ecbd8739782235d44dd7bf540a3f312d4a
a868c54e5a010f8ab600d705c506e56b0eb291eb
refs/heads/master
2021-05-29T12:01:25.619126
2015-07-23T16:10:38
2015-07-23T16:10:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,560
java
package com.deconware.ops.dimensions; import net.imagej.ops.Op; import net.imglib2.RandomAccessibleInterval; import net.imglib2.img.Img; import net.imglib2.meta.AxisType; import net.imglib2.meta.Axes; import net.imglib2.meta.ImgPlus; import net.imglib2.type.numeric.integer.UnsignedByteType; import org.junit.Test; import org.junit.Assert; import com.deconware.ops.AbstractOpsTest; import com.deconware.algorithms.dim.ExtendImageUtility.BoundaryType; import com.deconware.algorithms.fft.SimpleFFTFactory.FFTTarget; public class ExtensionTest extends AbstractOpsTest { //@Test public void ExtendHyperSlicesTest() { int xSize=40; int ySize=50; int numChannels=3; int numSlices=25; int numTimePoints=5; Img<UnsignedByteType> testImage = generateUnsignedByteTestImg(true, xSize, ySize, numChannels, numSlices, numTimePoints); int[] axisIndices=new int[3]; int[] extensions=new int[3]; // set up the axis so the resulting hyperslices are x,y,z and // we loop through channels and time axisIndices[0]=0; axisIndices[1]=1; axisIndices[2]=3; extensions[0]=20; extensions[1]=20; extensions[2]=10; Op extend=new ExtendOp<UnsignedByteType>(); RandomAccessibleInterval<UnsignedByteType> out= (RandomAccessibleInterval<UnsignedByteType>)ops.run(extend, null, testImage, axisIndices, extensions, BoundaryType.ZERO, FFTTarget.MINES_SPEED); Assert.assertEquals(out.dimension(0), xSize+2*extensions[0]); Assert.assertEquals(out.dimension(1), ySize+2*extensions[1]); Assert.assertEquals(out.dimension(2), numChannels); Assert.assertEquals(out.dimension(3), numSlices+2*extensions[2]); Assert.assertEquals(out.dimension(4), numTimePoints); AxisType[] axes=new AxisType[testImage.numDimensions()]; axes[0]=Axes.X; axes[1]=Axes.Y; axes[2]=Axes.CHANNEL; axes[3]=Axes.Z; axes[4]=Axes.TIME; ImgPlus<UnsignedByteType> testPlus=new ImgPlus<UnsignedByteType>(testImage, "test", axes); Op extendSpatial=new ExtendOpImgPlusImgPlus(); ImgPlus<UnsignedByteType> outPlus=null; outPlus=(ImgPlus<UnsignedByteType>)ops.run(extendSpatial, null, testPlus, extensions[0], extensions[2], BoundaryType.ZERO, FFTTarget.MINES_SPEED); Assert.assertEquals(outPlus.dimension(0), xSize+2*extensions[0]); Assert.assertEquals(outPlus.dimension(1), ySize+2*extensions[0]); Assert.assertEquals(outPlus.dimension(2), numChannels); Assert.assertEquals(outPlus.dimension(3), numSlices+2*extensions[2]); Assert.assertEquals(outPlus.dimension(4), numTimePoints); } }
[ "bnorthan@gmail.com" ]
bnorthan@gmail.com
6a20a41c0b31c5c3d11b2195b0f869a9d68b29fb
088e34cb3d8a463c5405023509a8fa81bf207ee6
/app/src/main/java/com/example/securestoredatakoltin/securealogritham/KeystoreTool.java
e72f685287526becfeffe81cee514ba14e8655fe
[]
no_license
chaudharybharat/SecureStoreDataKoltin
754be3880d5dc89070556fd2ccb78b96a54de87b
5bb760f3b64fd57ebcca709aa39d57200eefd59b
refs/heads/master
2020-08-10T00:18:06.777816
2019-10-14T06:16:22
2019-10-14T06:16:22
214,208,333
1
0
null
null
null
null
UTF-8
Java
false
false
11,510
java
/* * Copyright (C) 2019 Bharat * * 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.example.securestoredatakoltin.securealogritham; import android.content.Context; import android.content.res.Configuration; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.security.KeyPairGeneratorSpec; import android.security.keystore.KeyGenParameterSpec; import android.security.keystore.KeyProperties; import android.util.Base64; import android.util.Log; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import com.example.securestoredatakoltin.BuildConfig; import com.example.securestoredatakoltin.R; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.math.BigInteger; import java.security.KeyPairGenerator; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.UnrecoverableKeyException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Locale; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.security.auth.x500.X500Principal; import static android.os.Build.VERSION_CODES.M; import static com.example.securestoredatakoltin.securealogritham.SecureStorageException.ExceptionType.CRYPTO_EXCEPTION; import static com.example.securestoredatakoltin.securealogritham.SecureStorageException.ExceptionType.INTERNAL_LIBRARY_EXCEPTION; import static com.example.securestoredatakoltin.securealogritham.SecureStorageException.ExceptionType.KEYSTORE_EXCEPTION; final class KeystoreTool { private static final String KEY_ALIAS = "BharatKeyPair"; private static final String KEY_ENCRYPTION_ALGORITHM = "RSA"; private static final String KEY_CHARSET = "UTF-8"; private static final String KEY_KEYSTORE_NAME = "AndroidKeyStore"; private static final String KEY_CIPHER_JELLYBEAN_PROVIDER = "AndroidOpenSSL"; private static final String KEY_CIPHER_MARSHMALLOW_PROVIDER = "AndroidKeyStoreBCWorkaround"; private static final String KEY_TRANSFORMATION_ALGORITHM = "RSA/ECB/PKCS1Padding"; private static final String KEY_X500PRINCIPAL = "CN=SecureDeviceStorage, O=Bharat, C=Germany"; // hidden constructor to disable initialization private KeystoreTool() { } @Nullable static String encryptMessage(@NonNull Context context, @NonNull String plainMessage) throws SecureStorageException { try { Cipher input; if (VERSION.SDK_INT >= M) { input = Cipher.getInstance(KEY_TRANSFORMATION_ALGORITHM, KEY_CIPHER_MARSHMALLOW_PROVIDER); } else { input = Cipher.getInstance(KEY_TRANSFORMATION_ALGORITHM, KEY_CIPHER_JELLYBEAN_PROVIDER); } input.init(Cipher.ENCRYPT_MODE, getPublicKey(context)); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); CipherOutputStream cipherOutputStream = new CipherOutputStream( outputStream, input); cipherOutputStream.write(plainMessage.getBytes(KEY_CHARSET)); cipherOutputStream.close(); byte[] values = outputStream.toByteArray(); return Base64.encodeToString(values, Base64.DEFAULT); } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } } @NonNull static String decryptMessage(@NonNull Context context, @NonNull String encryptedMessage) throws SecureStorageException { try { Cipher output; if (VERSION.SDK_INT >= M) { output = Cipher.getInstance(KEY_TRANSFORMATION_ALGORITHM, KEY_CIPHER_MARSHMALLOW_PROVIDER); } else { output = Cipher.getInstance(KEY_TRANSFORMATION_ALGORITHM, KEY_CIPHER_JELLYBEAN_PROVIDER); } output.init(Cipher.DECRYPT_MODE, getPrivateKey(context)); CipherInputStream cipherInputStream = new CipherInputStream( new ByteArrayInputStream(Base64.decode(encryptedMessage, Base64.DEFAULT)), output); List<Byte> values = new ArrayList<>(); int nextByte; while ((nextByte = cipherInputStream.read()) != -1) { //NOPMD values.add((byte) nextByte); } byte[] bytes = new byte[values.size()]; for (int i = 0; i < bytes.length; i++) { bytes[i] = values.get(i); } return new String(bytes, 0, bytes.length, KEY_CHARSET); } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, CRYPTO_EXCEPTION); } } static boolean keyPairExists() throws SecureStorageException { try { return getKeyStoreInstance().getKey(KEY_ALIAS, null) != null; } catch (NoSuchAlgorithmException e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } catch (KeyStoreException | UnrecoverableKeyException e) { return false; } } @RequiresApi(api = VERSION_CODES.JELLY_BEAN_MR2) static void generateKeyPair(@NonNull Context context) throws SecureStorageException { // Create new key if needed if (!keyPairExists()) { if (VERSION.SDK_INT >= M) { generateKeyPairForMarshmallow(context); } else { PRNGFixes.apply(); generateKeyPairUnderMarshmallow(context); } } else if (BuildConfig.DEBUG) { Log.e(KeystoreTool.class.getName(), context.getString(R.string.message_keypair_already_exists)); } } static void deleteKeyPair(@NonNull Context context) throws SecureStorageException { // Delete Key from Keystore if (keyPairExists()) { try { getKeyStoreInstance().deleteEntry(KEY_ALIAS); } catch (KeyStoreException e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } } else if (BuildConfig.DEBUG) { Log.e(KeystoreTool.class.getName(), context.getString(R.string.message_keypair_does_not_exist)); } } @Nullable private static PublicKey getPublicKey(@NonNull Context context) throws SecureStorageException { PublicKey publicKey; try { if (keyPairExists()) { publicKey = getKeyStoreInstance().getCertificate(KEY_ALIAS).getPublicKey(); } else { if (BuildConfig.DEBUG) { Log.e(KeystoreTool.class.getName(), context.getString(R.string.message_keypair_does_not_exist)); } throw new SecureStorageException(context.getString(R.string.message_keypair_does_not_exist), null, INTERNAL_LIBRARY_EXCEPTION); } } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } return publicKey; } @Nullable private static PrivateKey getPrivateKey(@NonNull Context context) throws SecureStorageException { PrivateKey privateKey; try { if (keyPairExists()) { privateKey = (PrivateKey) getKeyStoreInstance().getKey(KEY_ALIAS, null); } else { if (BuildConfig.DEBUG) { Log.e(KeystoreTool.class.getName(), context.getString(R.string.message_keypair_does_not_exist)); } throw new SecureStorageException(context.getString(R.string.message_keypair_does_not_exist), null, INTERNAL_LIBRARY_EXCEPTION); } } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } return privateKey; } @RequiresApi(api = VERSION_CODES.JELLY_BEAN_MR1) private static boolean isRTL(@NonNull Context context) { Configuration config = context.getResources().getConfiguration(); return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } @RequiresApi(api = M) private static void generateKeyPairForMarshmallow(@NonNull Context context) throws SecureStorageException { try { if (isRTL(context)) { Locale.setDefault(Locale.US); } KeyPairGenerator generator = KeyPairGenerator.getInstance(KEY_ENCRYPTION_ALGORITHM, KEY_KEYSTORE_NAME); KeyGenParameterSpec keyGenParameterSpec = new KeyGenParameterSpec.Builder(KEY_ALIAS, KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT) .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1) .build(); generator.initialize(keyGenParameterSpec); generator.generateKeyPair(); } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } } @RequiresApi(api = VERSION_CODES.JELLY_BEAN_MR2) private static void generateKeyPairUnderMarshmallow(@NonNull Context context) throws SecureStorageException { try { if (isRTL(context)) { Locale.setDefault(Locale.US); } Calendar start = Calendar.getInstance(); Calendar end = Calendar.getInstance(); end.add(Calendar.YEAR, 99); KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(context) .setAlias(KEY_ALIAS) .setSubject(new X500Principal(KEY_X500PRINCIPAL)) .setSerialNumber(BigInteger.TEN) .setStartDate(start.getTime()) .setEndDate(end.getTime()) .build(); KeyPairGenerator generator = KeyPairGenerator.getInstance(KEY_ENCRYPTION_ALGORITHM, KEY_KEYSTORE_NAME); generator.initialize(spec); generator.generateKeyPair(); } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } } @NonNull private static KeyStore getKeyStoreInstance() throws SecureStorageException { try { // Get the AndroidKeyStore instance KeyStore keyStore = KeyStore.getInstance(KEY_KEYSTORE_NAME); // Relict of the JCA API - you have to call load even // if you do not have an input stream you want to load or it'll crash keyStore.load(null); return keyStore; } catch (Exception e) { throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION); } } }
[ "bharartchaudhary20893@gmail.com" ]
bharartchaudhary20893@gmail.com
c5993a309365efe28ee1866e2de0b531079ae937
4b772c596d26c3d67b306dca16a4b577b1545c44
/EserciziModulo6/src/GestorePrenotazioni/GestorePrenotazioni.java
fab4028c58147d281ebfb69e0726f8178b1272b0
[]
no_license
moneypuch/EserciziCorsoJava
c61b6808815e6d4f7bd496475770b69ab0e064ef
c6feeb66415e5bba7b36db0ff02f4bc8135a6f0a
refs/heads/main
2023-01-18T23:07:38.860525
2020-11-17T14:14:58
2020-11-17T14:14:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,898
java
package GestorePrenotazioni; public class GestorePrenotazioni { private int nPostiInterno, nPostiEsterno; private Prenotazione prenotazioniInterno[] = new Prenotazione[100]; private Prenotazione prenotazioniEsterno[] = new Prenotazione[100]; GestorePrenotazioni(int nPostiInterno, int nPostiEsterno) { this.nPostiInterno = nPostiInterno; this.nPostiEsterno = nPostiEsterno; } public boolean prenota(Prenotazione p) { boolean prenotazioneInserita; if (p instanceof PrenotazioneSingola) { PrenotazioneSingola prenotazioneSingola = (PrenotazioneSingola) p; if (prenotazioneSingola.getPreferenza() == Preferenza.INTERNO) { prenotazioneInserita = inserisciPrenotazioneInterno(p); if(!prenotazioneInserita) prenotazioneInserita = inserisciPrenotazioneEsterno(p); } else { prenotazioneInserita = inserisciPrenotazioneEsterno(p); if(!prenotazioneInserita) prenotazioneInserita = inserisciPrenotazioneInterno(p); } return prenotazioneInserita; } else { prenotazioneInserita = inserisciPrenotazioneInterno(p); if(!prenotazioneInserita) prenotazioneInserita = inserisciPrenotazioneEsterno(p); return prenotazioneInserita; } } private boolean inserisciPrenotazioneInterno(Prenotazione p) { int prenotazioniInternoAttuali = postiOccupati(prenotazioniInterno); if (prenotazioniInternoAttuali < nPostiInterno) { for (int i = 0; i < prenotazioniInterno.length; i++) if (prenotazioniInterno[i] == null) { prenotazioniInterno[i] = p; return true; } return false; } return false; } private boolean inserisciPrenotazioneEsterno(Prenotazione p) { int prenotazioniEsternoAttuali = postiOccupati(prenotazioniEsterno); if (prenotazioniEsternoAttuali < nPostiEsterno) { for (int i = 0; i < prenotazioniEsterno.length; i++) if (prenotazioniEsterno[i] == null) { prenotazioniEsterno[i] = p; return true; } return false; } return false; } private int postiOccupati(Prenotazione[] prenotazioni) { int prenotazioniAttuali = 0; for(int i=0; i<prenotazioni.length; i++) { if(prenotazioni[i] != null) prenotazioniAttuali += prenotazioni[i].getNumPosti(); } return prenotazioniAttuali; } public boolean terminaPrenotazione(Prenotazione prenotazione) { boolean prenotazioneTrovata = false; for (int i = 0; i < prenotazioniInterno.length; i++) if (prenotazioniInterno[i].getCode().equals(prenotazione.getCode())) { prenotazioniInterno[i] = null; return true; } for (int i = 0; i < prenotazioniEsterno.length; i++) if (prenotazioniEsterno[i].getCode().equals(prenotazione.getCode())) { prenotazioniEsterno[i] = null; return true; } return false; } public Prenotazione[] prenotazioniAttualiInterno(){ return prenotazioniInterno; } public Prenotazione[] prenotazioniAttualiEsterno(){ return prenotazioniEsterno; } }
[ "massimo.palmieri16@gmail.com" ]
massimo.palmieri16@gmail.com
a56c1095b951cfd4c01581860fdcb946828a6714
2a3851dfa8e5f7f8a4f9dd07bcd892d10ac1908c
/E-storeapp/src/main/java/com/eshop/model/Category.java
c716e666ea80a9b7920e47639c0c4680d5717500
[]
no_license
Poojas31/azureinfra
addf68d7b9f27845e81547eb1f72271c5e5b3bba
bdec33f7cb2403ce288d2dc4396ceabd08feeb34
refs/heads/master
2020-03-25T20:45:41.798007
2018-08-28T10:59:35
2018-08-28T10:59:35
144,144,455
0
0
null
null
null
null
UTF-8
Java
false
false
1,362
java
package com.eshop.model; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; 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 org.hibernate.validator.constraints.NotEmpty; @Entity @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @Table(name = "category") public class Category implements Serializable { private static final long serialVersionUID = 7326961244572654173L; @XmlElement @Id @GeneratedValue private int id; @XmlElement @NotEmpty(message = "The category name shouldn't be empty") private String categoryName; @XmlElement @NotEmpty(message = "The description shouldn't be empty") private String description; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "yadavranjan33@gmail.com" ]
yadavranjan33@gmail.com
f76868b209a51c8653775d080ce74f01b5bf62bd
a0210a865f74c5fe81971584b75dd17f5e0af914
/src/main/java/cc/mrbird/system/controller/GoldRewardsController.java
ecdaa460579c1fbc545ab5d3017b39e777b513fe
[ "Apache-2.0" ]
permissive
myrluxifa/DailyNewsCMS
813a534d774fbd9427d88480817a595af512cfc8
6376982eda53182d3dfb13632067f5edfd7ccb90
refs/heads/master
2020-03-20T08:34:55.827889
2018-08-10T10:16:22
2018-08-10T10:16:22
137,313,007
0
0
null
null
null
null
UTF-8
Java
false
false
4,035
java
package cc.mrbird.system.controller; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jsoup.helper.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import cc.mrbird.common.annotation.Log; import cc.mrbird.common.controller.BaseController; import cc.mrbird.common.domain.QueryRequest; import cc.mrbird.common.domain.ResponseBo; import cc.mrbird.common.util.ImgUtil; import cc.mrbird.system.domain.EasyMoney; import cc.mrbird.system.domain.GoldRewards; import cc.mrbird.system.domain.MakeMoney; import cc.mrbird.system.service.GoldRewardsService; import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example.Criteria; @Controller public class GoldRewardsController extends BaseController{ @Autowired private GoldRewardsService goldRewardsService; @Log("金币设置") @RequestMapping("goldSetting") @RequiresPermissions("goldSetting:list") public String index() { return "system/goldSetting/goldSetting"; } @RequestMapping("goldSetting/list") @ResponseBody public Map<String, Object> goldSettingList(QueryRequest request) { GoldRewards goldRewards=new GoldRewards(); goldRewards.setMoney("0"); List<GoldRewards> list = this.goldRewardsService.findGoldRewards(goldRewards); PageInfo<GoldRewards> pageInfo = new PageInfo<>(list); return getDataTable(pageInfo); } @Log("现金设置") @RequestMapping("balanceSetting") @RequiresPermissions("balanceSetting:list") public String balanceIndex() { return "system/balanceSetting/balanceSetting"; } @RequestMapping("balanceSetting/list") @ResponseBody public Map<String, Object> balanceSettingList(QueryRequest request) { GoldRewards goldRewards=new GoldRewards(); goldRewards.setGold("0"); List<GoldRewards> list = this.goldRewardsService.findGoldRewards(goldRewards); PageInfo<GoldRewards> pageInfo = new PageInfo<>(list); return getDataTable(pageInfo); } @RequestMapping("balanceSetting/getBalanceSetting") @RequiresPermissions("balanceSetting:edit") @ResponseBody public ResponseBo getBalanceRewards(String id) { try { GoldRewards g=new GoldRewards(); g.setId(id); GoldRewards goldRewards=goldRewardsService.findById(g); return ResponseBo.ok(goldRewards); }catch (Exception e) { // TODO: handle exception return ResponseBo.error("获取信息失败"); } } @Log("修改金币参数") @RequestMapping("balanceSetting/update") @RequiresPermissions("balanceSetting:edit") @ResponseBody public ResponseBo balanceUpdate(GoldRewards goldRewards) { try { goldRewardsService.updateBalance(goldRewards); return ResponseBo.ok("修改参数成功"); }catch(Exception e) { return ResponseBo.error("修改参数失败"); } } @RequestMapping("goldSetting/getGoldSetting") @RequiresPermissions("goldSetting:edit") @ResponseBody public ResponseBo getGoldRewards(String id) { try { GoldRewards g=new GoldRewards(); g.setId(id); GoldRewards goldRewards=goldRewardsService.findById(g); return ResponseBo.ok(goldRewards); }catch (Exception e) { // TODO: handle exception return ResponseBo.error("获取信息失败"); } } @Log("修改金币参数") @RequestMapping("goldSetting/update") @RequiresPermissions("goldSetting:edit") @ResponseBody public ResponseBo update(GoldRewards goldRewards) { try { goldRewardsService.updateGold(goldRewards); return ResponseBo.ok("修改参数成功"); }catch(Exception e) { return ResponseBo.error("修改参数失败"); } } }
[ "185148512@qq.com" ]
185148512@qq.com
4ef15091ad751f1bcc478ea6afa7ddebbc51231b
a20819acbcbe08529f70a97c3989f9a8b25767a4
/src/main/java/com/github/lindenb/jvarkit/tools/burden/VcfBurdenSplitter2.java
fe79302ec3fdbe9cf1e3fa563709662a7e05cc46
[ "MIT" ]
permissive
pradyumnasagar/jvarkit
97929e5d85af02dfe5375cfa4661fcf6645afa23
4d17618d058ff27a1866addff4b6f84194d02ad5
refs/heads/master
2022-03-24T16:31:06.001444
2018-08-13T13:30:51
2018-08-13T13:30:51
145,077,900
0
0
NOASSERTION
2022-02-16T07:29:47
2018-08-17T05:54:47
Java
UTF-8
Java
false
false
12,201
java
/* The MIT License (MIT) Copyright (c) 2017 Pierre Lindenbaum Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. History: * 2014 creation * 2015 moving to knime */ package com.github.lindenb.jvarkit.tools.burden; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import htsjdk.samtools.util.CloseableIterator; import htsjdk.samtools.util.CloserUtil; import htsjdk.samtools.util.Interval; import htsjdk.samtools.util.RuntimeIOException; import htsjdk.samtools.util.SortingCollection; import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.variantcontext.VariantContextBuilder; import htsjdk.variant.variantcontext.writer.VariantContextWriter; import htsjdk.variant.vcf.VCFHeader; import htsjdk.variant.vcf.VCFHeaderLineCount; import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParametersDelegate; import com.github.lindenb.jvarkit.io.IOUtils; import com.github.lindenb.jvarkit.io.NullOuputStream; import com.github.lindenb.jvarkit.util.iterator.EqualRangeIterator; import com.github.lindenb.jvarkit.util.jcommander.Program; import com.github.lindenb.jvarkit.util.log.Logger; import com.github.lindenb.jvarkit.util.picard.AbstractDataCodec; import com.github.lindenb.jvarkit.util.vcf.DelegateVariantContextWriter; import com.github.lindenb.jvarkit.util.vcf.VCFUtils; import com.github.lindenb.jvarkit.util.vcf.VcfIterator; import com.github.lindenb.jvarkit.util.vcf.predictions.AnnPredictionParser; import com.github.lindenb.jvarkit.util.vcf.predictions.AnnPredictionParserFactory; import com.github.lindenb.jvarkit.util.vcf.predictions.VepPredictionParser; import com.github.lindenb.jvarkit.util.vcf.predictions.VepPredictionParser.VepPrediction; import com.github.lindenb.jvarkit.util.vcf.predictions.VepPredictionParserFactory; import com.github.lindenb.jvarkit.util.vcf.predictions.AnnPredictionParser.AnnPrediction; /** * @author lindenb * BEGIN_DOC END_DOC */ @Program(name="vcfburdensplitter2",description="new version",keywords={"vcf","burden","gene","vep","snpeff","prediction"}) public class VcfBurdenSplitter2 { //public for knime public static final String DEFAULT_VCF_HEADER_SPLITKEY="VCFBurdenSplitName"; private static final Logger LOG = Logger.build(). prefix("splitter2"). make(); @Parameter(names={"-if","--ignorefilter"},description="accept variants having a FILTER column. Default is ignore variants with a FILTER column") private boolean acceptFiltered = false; @Parameter(names="--maxRecordsInRam",description="Max records in RAM") private int maxRecordsInRam=50000; @Parameter(names="--tmpDir",description="Temporary directory") private File tmpDir = IOUtils.getDefaultTmpDir(); @Parameter(names={"-m","--manifestFile"},description="Manifest File") private File manifestFile = null; @Parameter(names={"-t","--tag"},description="Split Key") private String splitInfoKey = DEFAULT_VCF_HEADER_SPLITKEY; public VariantContextWriter open(final VariantContextWriter delegate) { final MyWriter w = new MyWriter(delegate); w.manifestFile=this.manifestFile; w.acceptFiltered=this.acceptFiltered; w.tmpDir=this.tmpDir; w.maxRecordsInRam=this.maxRecordsInRam; w.splitInfoKey=this.splitInfoKey; return w; } private class MyWriter extends DelegateVariantContextWriter { private String prev_contig=null; private SortingCollection<Interval> sortingcollection=null; private PrintWriter manifestWriter=null; private File manifestFile = null; private boolean acceptFiltered = false; private File tmpDir=null; private int maxRecordsInRam; private String splitInfoKey; private AnnPredictionParser annPredictionParser = null; private VepPredictionParser vepPredictionParser = null; MyWriter(final VariantContextWriter w) { super(w); } @Override public void writeHeader(final VCFHeader header) { final VCFHeader header2= new VCFHeader(header); this.annPredictionParser = new AnnPredictionParserFactory(header).get(); this.vepPredictionParser = new VepPredictionParserFactory(header).get(); this.prev_contig=null; if(this.manifestFile==null) { LOG.warning("Manifest file is undefined"); this.manifestWriter=new PrintWriter(new NullOuputStream()); } else { try { this.manifestWriter=new PrintWriter(this.manifestFile); } catch (final FileNotFoundException e) { throw new RuntimeIOException(e); } } header2.addMetaDataLine( new VCFInfoHeaderLine( this.splitInfoKey, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String, "Split Names" )); super.writeHeader(header2); } @Override public void add(final VariantContext ctx) { if(prev_contig==null || !ctx.getContig().equals(prev_contig)) { dump(); prev_contig=ctx.getContig(); } if(ctx.isFiltered() && !this.acceptFiltered) { //add to delegate without registering the SPLIT name super.add(ctx); return; } final Set<String> splitNames = getSplitNamesFor(ctx); if(splitNames.isEmpty()) { super.add(ctx); return; } if(this.sortingcollection==null) { /* create sorting collection for new contig */ this.sortingcollection = SortingCollection.newInstance( Interval.class, new IntervalCodec(), new IntervalComparator(), this.maxRecordsInRam, this.tmpDir.toPath() ); this.sortingcollection.setDestructiveIteration(true); } for(final String spltiName:splitNames) { this.sortingcollection.add( new Interval(ctx.getContig(), ctx.getStart(), ctx.getEnd(),false,spltiName)); } super.add(new VariantContextBuilder(ctx).attribute( this.splitInfoKey, new ArrayList<>(splitNames)). make()); } @Override public void close() { dump(); if(manifestWriter!=null) { this.manifestWriter.flush(); if(this.manifestWriter.checkError()) { throw new RuntimeIOException("There was a I/O error when writing the manifest files"); } this.manifestWriter.close(); this.manifestWriter=null; } super.close(); } private Set<String> getSplitNamesFor(final VariantContext ctx){ final Set<String> keys = new HashSet<>(); for(final VepPrediction pred: this.vepPredictionParser.getPredictions(ctx)) { keys.addAll(pred.getGeneKeys().stream().map(S->ctx.getContig()+"_"+S).collect(Collectors.toSet())); } for(final AnnPrediction pred: this.annPredictionParser.getPredictions(ctx)) { keys.addAll(pred.getGeneKeys().stream().map(S->ctx.getContig()+"_"+S).collect(Collectors.toSet())); } /* replace . by _ so we don't have problems with regex later */ return keys.stream(). map(S->S.replace('.', '_').replace('-', '_')). collect(Collectors.toSet()); } private void dump() { if(this.sortingcollection==null || this.manifestWriter==null) return; CloseableIterator<Interval> iter; this.sortingcollection.doneAdding(); iter = this.sortingcollection.iterator(); LOG.info("dumping data for CONTIG: \""+prev_contig+"\""); final EqualRangeIterator<Interval> eqiter = new EqualRangeIterator<>(iter, new Comparator<Interval>() { @Override public int compare(final Interval o1, final Interval o2) { return o1.getName().compareTo(o2.getName()); } }); while(eqiter.hasNext()) { final List<Interval> buffer = eqiter.next(); final Interval first = buffer.get(0); this.manifestWriter.print(first.getContig()); this.manifestWriter.print('\t'); this.manifestWriter.print(buffer.stream().map(I->I.getStart()).min((A,B)->A.compareTo(B)).get()); this.manifestWriter.print('\t'); this.manifestWriter.print(buffer.stream().map(I->I.getEnd()).max((A,B)->A.compareTo(B)).get()); this.manifestWriter.print('\t'); this.manifestWriter.print(first.getName()); this.manifestWriter.print('\t'); this.manifestWriter.print(buffer.size()); this.manifestWriter.println(); this.manifestWriter.flush(); } if(this.manifestWriter.checkError()) { LOG.warn("I/O error when writing manifest"); } eqiter.close(); iter.close();iter=null; //dispose sorting collection sortingcollection.cleanup(); sortingcollection=null; } } private static class IntervalComparator implements Comparator<Interval> { @Override public int compare(final Interval o1, final Interval o2) { int i = o1.getName().compareTo(o2.getName()); if(i!=0) return i; if(!o1.getContig().equals(o2.getContig())) { throw new IllegalStateException("not same contig???"); } i =o1.getStart() - o2.getStart(); if(i!=0) return i; return o1.getEnd() - o2.getEnd(); } } private static class IntervalCodec extends AbstractDataCodec<Interval> { @Override public Interval decode(final DataInputStream dis) throws IOException { String k; try { k=dis.readUTF(); } catch(IOException err) { return null;} final String contig = dis.readUTF(); final int beg= dis.readInt(); final int end= dis.readInt(); return new Interval(contig,beg,end,false,k); } @Override public void encode(final DataOutputStream dos, final Interval object) throws IOException { dos.writeUTF(object.getName()); dos.writeUTF(object.getContig()); dos.writeInt(object.getStart()); dos.writeInt(object.getStart()); } @Override public IntervalCodec clone() { return new IntervalCodec(); } } protected boolean isDebuggingVariant(final VariantContext ctx) { return false; } protected String shortName(final VariantContext ctx) { return ctx.getContig()+":"+ctx.getStart()+":"+ctx.getAlleles(); } public VcfBurdenSplitter2() { } private static class Launcher extends com.github.lindenb.jvarkit.util.jcommander.Launcher { @Parameter(names={"-ls","--listsplitters"},description="List available splitters and exit") private boolean listSplitters = false; @ParametersDelegate private VcfBurdenSplitter2 instance=new VcfBurdenSplitter2(); @Parameter(names={"-o","--out"},description="Vcf output.") private VariantContextWriter output=new com.github.lindenb.jvarkit.util.jcommander.Launcher.VcfWriterOnDemand(); Launcher() { } @Override public int doWork(final List<String> args) { VariantContextWriter w=null; VcfIterator in=null; try { in = VCFUtils.createVcfIterator(super.oneFileOrNull(args)); w= this.instance.open(output); VCFUtils.copyHeaderAndVariantsTo(in, w); w.close(); return 0; } catch(Exception err) { LOG.fatal(err); return -1; } finally { CloserUtil.close(w); CloserUtil.close(in); } } } public static void main(String[] args) { new Launcher().instanceMainWithExit(args); } }
[ "plindenbaum@yahoo.fr" ]
plindenbaum@yahoo.fr
0af42e6991031adcd88c765b5070f6e906873ef9
fa10aa7f76deff6aaf09a52c720a5f84195d7c74
/adapterpro/src/main/java/xyz/yhsj/helper/ViewHolderHelper.java
1f73ad36dfead1f961c8d791cb9310d84e4400d4
[]
no_license
zhideyongyou/AdapterPro
4f61d1c4af4b3e3f1d05dafa04d2dd6c29c15fc6
c8b8e092dcf815956aadd0779669e35085449b82
refs/heads/master
2020-07-13T01:28:34.822240
2016-04-26T03:48:10
2016-04-26T03:48:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,480
java
/** * Copyright 2015 bingoogolapple * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * 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 xyz.yhsj.helper; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.support.annotation.ColorRes; import android.support.annotation.DrawableRes; import android.support.annotation.IdRes; import android.support.annotation.StringRes; import android.support.v7.widget.RecyclerView; import android.text.Html; import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; import android.widget.Checkable; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; import xyz.yhsj.event.OnItemChildCheckedChangeListener; import xyz.yhsj.event.OnItemChildClickListener; import xyz.yhsj.event.OnItemChildLongClickListener; import xyz.yhsj.viewholder.BaseRecyclerViewHolder; /** * 作者:王浩 邮件:bingoogolapple@gmail.com * 创建时间:15/5/26 17:06 * 描述:为AdapterView和RecyclerView的item设置常见属性(链式编程) */ public class ViewHolderHelper implements View.OnClickListener, View.OnLongClickListener, CompoundButton.OnCheckedChangeListener { protected final SparseArray<View> mViews; protected OnItemChildClickListener mOnItemChildClickListener; protected OnItemChildLongClickListener mOnItemChildLongClickListener; protected OnItemChildCheckedChangeListener mOnItemChildCheckedChangeListener; protected View mConvertView; protected Context mContext; protected int mPosition; protected BaseRecyclerViewHolder mRecyclerViewHolder; protected RecyclerView mRecyclerView; protected ViewGroup mAdapterView; /** * 留着以后作为扩充对象 */ protected Object mObj; public ViewHolderHelper(ViewGroup adapterView, View convertView) { mViews = new SparseArray<>(); mAdapterView = adapterView; mConvertView = convertView; mContext = convertView.getContext(); } public ViewHolderHelper(RecyclerView recyclerView, View convertView) { mViews = new SparseArray<>(); mRecyclerView = recyclerView; mConvertView = convertView; mContext = convertView.getContext(); } public void setRecyclerViewHolder(BaseRecyclerViewHolder recyclerViewHolder) { mRecyclerViewHolder = recyclerViewHolder; } public BaseRecyclerViewHolder getRecyclerViewHolder() { return mRecyclerViewHolder; } public void setPosition(int position) { mPosition = position; } public int getPosition() { if (mRecyclerViewHolder != null) { return mRecyclerViewHolder.getAdapterPosition(); } return mPosition; } /** * 设置item子控件点击事件监听器 * * @param onItemChildClickListener */ public void setOnItemChildClickListener(OnItemChildClickListener onItemChildClickListener) { mOnItemChildClickListener = onItemChildClickListener; } /** * 为id为viewId的item子控件设置点击事件监听器 * * @param viewId */ public void setItemChildClickListener(@IdRes int viewId) { getView(viewId).setOnClickListener(this); } /** * 设置item子控件长按事件监听器 * * @param onItemChildLongClickListener */ public void setOnItemChildLongClickListener(OnItemChildLongClickListener onItemChildLongClickListener) { mOnItemChildLongClickListener = onItemChildLongClickListener; } /** * 为id为viewId的item子控件设置长按事件监听器 * * @param viewId */ public void setItemChildLongClickListener(@IdRes int viewId) { getView(viewId).setOnLongClickListener(this); } /** * 设置item子控件选中状态变化事件监听器 * * @param onItemChildCheckedChangeListener */ public void setOnItemChildCheckedChangeListener(OnItemChildCheckedChangeListener onItemChildCheckedChangeListener) { mOnItemChildCheckedChangeListener = onItemChildCheckedChangeListener; } /** * 为id为viewId的item子控件设置选中状态变化事件监听器 * * @param viewId */ public void setItemChildCheckedChangeListener(@IdRes int viewId) { if (getView(viewId) instanceof CompoundButton) { ((CompoundButton) getView(viewId)).setOnCheckedChangeListener(this); } } @Override public void onClick(View v) { if (mOnItemChildClickListener != null) { if (mRecyclerView != null) { mOnItemChildClickListener.onItemChildClick(mRecyclerView, v, getPosition()); } else if (mAdapterView != null) { mOnItemChildClickListener.onItemChildClick(mAdapterView, v, getPosition()); } } } @Override public boolean onLongClick(View v) { if (mOnItemChildLongClickListener != null) { if (mRecyclerView != null) { return mOnItemChildLongClickListener.onItemChildLongClick(mRecyclerView, v, getPosition()); } else if (mAdapterView != null) { return mOnItemChildLongClickListener.onItemChildLongClick(mAdapterView, v, getPosition()); } } return false; } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (mOnItemChildCheckedChangeListener != null) { if (mRecyclerView != null) { mOnItemChildCheckedChangeListener.onItemChildCheckedChanged(mRecyclerView, buttonView, getPosition(), isChecked); } else if (mAdapterView != null) { mOnItemChildCheckedChangeListener.onItemChildCheckedChanged(mAdapterView, buttonView, getPosition(), isChecked); } } } /** * 通过控件的Id获取对应的控件,如果没有则加入mViews,则从item根控件中查找并保存到mViews中 * * @param viewId * @return */ public <T extends View> T getView(@IdRes int viewId) { View view = mViews.get(viewId); if (view == null) { view = mConvertView.findViewById(viewId); mViews.put(viewId, view); } return (T) view; } /** * 通过ImageView的Id获取ImageView * * @param viewId * @return */ public ImageView getImageView(@IdRes int viewId) { return getView(viewId); } /** * 通过TextView的Id获取TextView * * @param viewId * @return */ public TextView getTextView(@IdRes int viewId) { return getView(viewId); } /** * 获取item的根控件 * * @return */ public View getConvertView() { return mConvertView; } public void setObj(Object obj) { mObj = obj; } public Object getObj() { return mObj; } /** * 设置对应id的控件的文本内容 * * @param viewId * @param text * @return */ public ViewHolderHelper setText(@IdRes int viewId, CharSequence text) { TextView view = getView(viewId); view.setText(text); return this; } /** * 设置对应id的控件的文本内容 * * @param viewId * @param stringResId 字符串资源id * @return */ public ViewHolderHelper setText(@IdRes int viewId, @StringRes int stringResId) { TextView view = getView(viewId); view.setText(stringResId); return this; } /** * 设置对应id的控件的html文本内容 * * @param viewId * @param source html文本 * @return */ public ViewHolderHelper setHtml(@IdRes int viewId, String source) { TextView view = getView(viewId); view.setText(Html.fromHtml(source)); return this; } /** * 设置对应id的控件是否选中 * * @param viewId * @param checked * @return */ public ViewHolderHelper setChecked(@IdRes int viewId, boolean checked) { Checkable view = getView(viewId); view.setChecked(checked); return this; } public ViewHolderHelper setTag(@IdRes int viewId, Object tag) { View view = getView(viewId); view.setTag(tag); return this; } public ViewHolderHelper setTag(@IdRes int viewId, int key, Object tag) { View view = getView(viewId); view.setTag(key, tag); return this; } public ViewHolderHelper setVisibility(@IdRes int viewId, int visibility) { View view = getView(viewId); view.setVisibility(visibility); return this; } public ViewHolderHelper setImageBitmap(@IdRes int viewId, Bitmap bitmap) { ImageView view = getView(viewId); view.setImageBitmap(bitmap); return this; } public ViewHolderHelper setImageDrawable(@IdRes int viewId, Drawable drawable) { ImageView view = getView(viewId); view.setImageDrawable(drawable); return this; } /** * @param viewId * @param textColorResId 颜色资源id * @return */ public ViewHolderHelper setTextColorRes(@IdRes int viewId, @ColorRes int textColorResId) { TextView view = getView(viewId); view.setTextColor(mContext.getResources().getColor(textColorResId)); return this; } /** * @param viewId * @param textColor 颜色值 * @return */ public ViewHolderHelper setTextColor(@IdRes int viewId, int textColor) { TextView view = getView(viewId); view.setTextColor(textColor); return this; } /** * @param viewId * @param backgroundResId 背景资源id * @return */ public ViewHolderHelper setBackgroundRes(@IdRes int viewId, int backgroundResId) { View view = getView(viewId); view.setBackgroundResource(backgroundResId); return this; } /** * @param viewId * @param color 颜色值 * @return */ public ViewHolderHelper setBackgroundColor(@IdRes int viewId, int color) { View view = getView(viewId); view.setBackgroundColor(color); return this; } /** * @param viewId * @param colorResId 颜色值资源id * @return */ public ViewHolderHelper setBackgroundColorRes(@IdRes int viewId, @ColorRes int colorResId) { View view = getView(viewId); view.setBackgroundColor(mContext.getResources().getColor(colorResId)); return this; } /** * @param viewId * @param imageResId 图像资源id * @return */ public ViewHolderHelper setImageResource(@IdRes int viewId, @DrawableRes int imageResId) { ImageView view = getView(viewId); view.setImageResource(imageResId); return this; } }
[ "1130402124@qq.com" ]
1130402124@qq.com
7bdb6c17747c5191b5a255c3b9430c8bac5ce423
f6da044ec6e4d1c15a4829ba55f6a067ed5217fd
/src/main/java/ca/ulaval/glo4003/spamdul/shared/utils/MapUtil.java
439b8deacab85ec2d8823220e3a3a80618c74069
[]
no_license
vigenere23/SPAMDUL
a0e245424121aad8ebc97749c9839bb9d8b9880e
795869921f2ca05ebf19fc44330325d074c1f7b4
refs/heads/main
2023-02-20T18:41:42.634506
2021-01-26T15:24:19
2021-01-26T15:24:45
321,693,886
1
0
null
2021-01-26T15:11:13
2020-12-15T14:33:57
Java
UTF-8
Java
false
false
288
java
package ca.ulaval.glo4003.spamdul.shared.utils; import java.util.HashMap; import java.util.Map; public class MapUtil { public static <Key, Value> Map<Key, Value> toMap(Key key, Value value) { Map<Key, Value> map = new HashMap<>(); map.put(key, value); return map; } }
[ "gabriel.st-pierre.6@ulaval.ca" ]
gabriel.st-pierre.6@ulaval.ca
d3412e7de78948d4e83cca74c20c39bdeed6c783
e325822e10d8343486cff3276c240272f4d6e3a0
/SPRING/OAuth2/study-oauth2/src/main/java/com/oauth2/study/dto/UserVO.java
4a18bea69ac982aa3a2e38acf0eefe7884a3cd40
[]
no_license
EunhaKyeong/studyRepo
c9b25d19c8a9c62351b48bef3417177adad8a933
f8a252cff479d828bb2811f47419ea7d0d5f7718
refs/heads/master
2023-02-22T01:57:41.939452
2021-01-19T11:33:16
2021-01-19T11:33:16
301,754,097
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package com.oauth2.study.dto; import lombok.Data; @Data public class UserVO { private int userCode; private String social; private String userId; private String userEmail; private String userAddress; private String userPhone; private String userName; }
[ "eh0634a@gmail.com" ]
eh0634a@gmail.com
4905742230b0e65eb666b06515840f1585930afc
3622749c29726027f553a04e66131f56fcc31931
/Hero Team Coach/src/Entity/Status.java
e00d2ce25a34153f3323e36b226f829b859f1ff5
[]
no_license
jefbu/HTC
796c59c59862b5345787b4d97b8b2c608b786cfa
cf528f2f01fac9f0777ef0fea08ec5266b1d6f2d
refs/heads/master
2020-05-18T14:29:38.166857
2017-04-15T20:23:59
2017-04-15T20:23:59
84,248,488
0
0
null
null
null
null
UTF-8
Java
false
false
88
java
package Entity; public enum Status { HEALTHY, LATE, ABSENT, WOUNDED }
[ "Jefbussens@gmail.com" ]
Jefbussens@gmail.com
13793af822777a58006f4dfa05e950286137f064
109ad176c4d3698f76fb01c5d7e13d6fa6bb6308
/ddd-spring/src/main/java/com/runssnail/ddd/spring/CommandBusFactoryBean.java
3ac59408fcfbee8206fc5bc61885e9b9aa1ee6cb
[]
no_license
xudilei/ddd
66734d00107cb8f178e1cc03cf4fe01b94488a11
53e452fcf263cdb6dec3f968d7c74cec6f22ecbf
refs/heads/master
2022-04-26T01:45:49.469527
2020-04-07T03:16:00
2020-04-07T03:16:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,534
java
package com.runssnail.ddd.spring; import com.runssnail.ddd.command.CommandBus; import com.runssnail.ddd.command.DefaultCommandBus; import com.runssnail.ddd.command.handler.CommandExceptionHandler; import com.runssnail.ddd.command.handler.CommandHandler; import org.apache.commons.collections4.MapUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.annotation.AnnotationAwareOrderComparator; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import com.runssnail.ddd.command.handler.CannotFindCommandHandlerException; import com.runssnail.ddd.command.interceptor.CommandInterceptor; import lombok.extern.slf4j.Slf4j; /** * CommandBus FactoryBean * * @author zhengwei * @date 2019-11-07 17:14 **/ @Slf4j public class CommandBusFactoryBean implements FactoryBean<CommandBus>, ApplicationContextAware, InitializingBean { private ApplicationContext applicationContext; private CommandBus commandBus; @Autowired private CommandExceptionHandler commandExceptionHandler; private boolean detectAllCommandHandlers = true; private boolean detectAllCommandInterceptors = true; @Override public CommandBus getObject() throws Exception { return this.commandBus; } @Override public Class<?> getObjectType() { return CommandBus.class; } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @Override public void afterPropertiesSet() throws Exception { DefaultCommandBus commandBus = new DefaultCommandBus(); commandBus.setCommandExceptionHandler(this.commandExceptionHandler); commandBus.init(); if (this.detectAllCommandHandlers) { detectAllCommandHandlers(commandBus); } if (this.detectAllCommandInterceptors) { detectAllCommandInterceptors(commandBus); } this.commandBus = commandBus; } private void detectAllCommandInterceptors(DefaultCommandBus commandBus) { Map<String, CommandInterceptor> beansOfInterceptors = this.applicationContext.getBeansOfType(CommandInterceptor.class); if (MapUtils.isEmpty(beansOfInterceptors)) { log.info("can not find any CommandInterceptor in the spring context"); return; } log.info("find CommandInterceptor in the spring context {}", beansOfInterceptors.size()); List<CommandInterceptor> interceptors = new ArrayList<>(beansOfInterceptors.values()); // 排序 AnnotationAwareOrderComparator.sort(interceptors); for (CommandInterceptor interceptor : interceptors) { commandBus.registerCommandInterceptor(interceptor); } log.info("find CommandInterceptor final commandInterceptors={}", interceptors); } private void detectAllCommandHandlers(DefaultCommandBus commandBus) { Map<String, CommandHandler> beansOfCommandHandlers = this.applicationContext.getBeansOfType(CommandHandler.class); if (MapUtils.isEmpty(beansOfCommandHandlers)) { throw new CannotFindCommandHandlerException("can not find any CommandHandler in spring context"); } log.info("find CommandHandler in spring context {}", beansOfCommandHandlers.size()); Collection<CommandHandler> commandHandlers = beansOfCommandHandlers.values(); for (CommandHandler commandHandler : commandHandlers) { commandBus.registerCommandHandler(commandHandler); } log.info("find CommandHandler final {}", commandHandlers); } public boolean isDetectAllCommandHandlers() { return detectAllCommandHandlers; } public void setDetectAllCommandHandlers(boolean detectAllCommandHandlers) { this.detectAllCommandHandlers = detectAllCommandHandlers; } public boolean isDetectAllCommandInterceptors() { return detectAllCommandInterceptors; } public void setDetectAllCommandInterceptors(boolean detectAllCommandInterceptors) { this.detectAllCommandInterceptors = detectAllCommandInterceptors; } }
[ "zhengwei@007fenqi.com.cn" ]
zhengwei@007fenqi.com.cn
589ac6d3fb9350bdab70f5b4a44a28dae739b984
a8fc92ba0d3d3f9ce434115fa98d7d887b6f8cba
/src/main/java/com/novopay/wallet/Exceptions/WalletInvalid.java
540eedc97dfe34a66e23c537acdc02d29d96618c
[]
no_license
pratyushpadmnav/novoPayPrat
4f52ee8c80b87df7d8f2c399f7d151529f4ae059
33234dc3b14dc92150f3a321f6074fd5e2b8bd54
refs/heads/master
2022-12-26T07:35:12.019362
2020-09-26T20:26:01
2020-09-26T20:26:01
298,624,766
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.novopay.wallet.Exceptions; public class WalletInvalid extends Exception{ private static final long serialVersionUID = 1L; public WalletInvalid(String message, Throwable cause) { super(message, cause); } public WalletInvalid(String message) { // TODO Auto-generated constructor stub super(message); } public WalletInvalid() { super(); } }
[ "pratyushpadmnav@gmail.com" ]
pratyushpadmnav@gmail.com
87f4e7f1eceae2d0d9677c1bac9ed99dfd8e9c89
78c03b261521a9681adc2f33f2deaadb5a33a82c
/app/src/main/java/com/example/dcexpertsubmit3/fragment/MovieFragment.java
80badb5164bb4306915dce3fcc39a1698877b94d
[]
no_license
sampurnoaji/android-moviedb
27f8f538c8a2129fe62511901c80a6cd1d759750
1970c968aff95b96e8a92716b9021a68eb4cde7f
refs/heads/master
2022-03-27T17:10:47.204846
2020-01-03T08:16:37
2020-01-03T08:16:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,171
java
package com.example.dcexpertsubmit3.fragment; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import com.example.dcexpertsubmit3.R; import com.example.dcexpertsubmit3.adapter.ItemListAdapter; import com.example.dcexpertsubmit3.connectivity.Connectivity; import com.example.dcexpertsubmit3.model.Movie; import com.example.dcexpertsubmit3.view_model.MovieViewModel; import java.util.ArrayList; /** * A simple {@link Fragment} subclass. */ public class MovieFragment extends Fragment { private MovieViewModel movieViewModel; private ItemListAdapter adapter; private ArrayList<Movie> list = new ArrayList<>(); private RecyclerView recyclerView; private ProgressBar progressBar; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_movie, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); recyclerView = view.findViewById(R.id.rv); progressBar = view.findViewById(R.id.progressBar); setHasOptionsMenu(true); loadData(); showData(list); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.clear(); inflater.inflate(R.menu.menu_main, menu); final SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { loadSearchData(query); showData(list); searchView.clearFocus(); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); } private void loadData(){ showLoading(true); movieViewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(MovieViewModel.class); movieViewModel.setMovie(Connectivity.ENDPOINT_MOVIE); movieViewModel.getMovie().observe(this, new Observer<ArrayList<Movie>>() { @Override public void onChanged(ArrayList<Movie> movies) { adapter.setDataMovie(movies); showLoading(false); } }); } private void showData(ArrayList<Movie> arrayList){ adapter = new ItemListAdapter(getContext(), arrayList, null); adapter.notifyDataSetChanged(); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(adapter); } private void showLoading(Boolean state) { if (state) { progressBar.setVisibility(View.VISIBLE); } else { progressBar.setVisibility(View.GONE); } } private void loadSearchData(String query){ showLoading(true); movieViewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(MovieViewModel.class); movieViewModel.setMovie(Connectivity.ENDPOINT_SEARCH_MOVIE + query); movieViewModel.getMovie().observe(this, new Observer<ArrayList<Movie>>() { @Override public void onChanged(ArrayList<Movie> movies) { adapter.setDataMovie(movies); showLoading(false); } }); } }
[ "man.sanji23@gmail.com" ]
man.sanji23@gmail.com
97dd63038ca6e5e4410884fe9285eb5b8ce1bc0d
9fa765025ef941b5252d01a34fa89154cdcf5ecd
/no.hal.pg/tests/no.hal.pg.http.impl.tests/src/no/hal/pg/http/tests/RequestHandlerTest.java
7ea2a35becd457e6ce89960e836d7e1d60c79666
[]
no_license
hallvard/tdt4250-2017
f3a9225ef5fa179e19cfaa1040cf7484190029e0
528445b78775c135faebee4e56efc6a6fb391c8a
refs/heads/master
2022-09-22T12:49:29.523256
2019-10-16T08:05:58
2019-10-16T08:05:58
93,861,366
0
1
null
null
null
null
UTF-8
Java
false
false
4,342
java
package no.hal.pg.http.tests; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.eclipse.emf.ecore.EObject; import org.junit.Before; import org.junit.Test; import no.hal.pg.http.impl.NameReferenceResolver; import no.hal.pg.http.impl.RequestHandler; import pghttptest.C; public class RequestHandlerTest extends AbstractPgHttpTest { private RequestHandler requestHandler; @Override @Before public void setUp() { super.setUp(); requestHandler = new RequestHandler(); requestHandler.addReferenceResolver(new NameReferenceResolver()); } protected Object getObjects(String... segments) { return requestHandler.getObjectForPath(resource.getContents(), segments); } @Test public void testAsPath() { // /as testN(root.getAs(), getObjects("as")); } @Test public void testAs1Path() { // /as/1 test1(root.getAs().get(1), getObjects("as", "1")); } @Test public void testNameRefPath() { // /a1 and /b/d1 test1(root.getAs().get(0), getObjects("a1")); test1(root.getB().getCs().get(2), getObjects("b", "d1")); } @Test public void testAsNamePath() { // /as/name testN(Arrays.asList("a1", "a2", "a3"), getObjects("as", "name")); } @Test public void testBPath() { // /b test1(root.getB(), getObjects("b")); } @Test public void testBCsPath() { // /b/cs testN(root.getB().getCs(), getObjects("b", "cs")); } @Test public void testBLastCNamePath() { // /b/lastC/name test1("c3", getObjects("b", "lastC", "name")); } @Test public void testBCsC2Path() { // /b/cs/name=c2 test1(root.getB().getCs().get(1), getObjects("b", "cs", "name=c2")); } @Test public void testBCsDPath() { // /b/cs/D test1(root.getB().getCs().get(2), getObjects("b", "cs", "D")); } @Test public void testAsRelPath() { test1(root.getAs().get(1), getObjects("as", "value==3")); test1(root.getAs().get(2), getObjects("as", "value>3")); testN(Arrays.asList(root.getAs().get(1), root.getAs().get(2)), getObjects("as", "value>=3")); testN(Arrays.asList(root.getAs().get(1), root.getAs().get(2)), getObjects("as", "value=>3")); testN(Arrays.asList(root.getAs().get(0), root.getAs().get(1)), getObjects("as", "value<=3")); testN(Arrays.asList(root.getAs().get(0), root.getAs().get(1)), getObjects("as", "value=<3")); test1(root.getAs().get(0), getObjects("as", "value<3")); testN(Arrays.asList(root.getAs().get(0), root.getAs().get(2)), getObjects("as", "value<>3")); testN(Arrays.asList(root.getAs().get(0), root.getAs().get(2)), getObjects("as", "value><3")); } @Test public void testPrivPath() { testN(Collections.emptyList(), getObjects("b", "priv1")); testN(Collections.emptyList(), getObjects("b", "priv2")); } // protected Object getResult(Collection<?> target, String op) { return requestHandler.getRequestQueryResult(target, op, null); } protected Object getResult(EObject target, String op, Map<String, ?> parameters) { return requestHandler.getRequestQueryResult(Collections.singleton(target), op, parameters); } protected Object getResult(EObject target, String op, String... keyValues) { Map<String, String> parameters = new HashMap<>(); for (int i = 0; i < keyValues.length; i += 2) { parameters.put(keyValues[i], keyValues[i + 1]); } return requestHandler.getRequestQueryResult(Collections.singleton(target), op, parameters); } @Test public void testCNameQuery() { test1("c1", getResult(root.getB().getCs().get(0), "name")); } @Test public void testCsNameQuery() { testN(Arrays.asList("c1", "c2", "d1", "c3"), getResult(root.getB().getCs(), "name")); } @Test public void testCs0Query() { test1(root.getB().getCs().get(0), getResult(root.getB().getCs(), "0")); } @Test public void testNameRefQuery() { // /a1 and /b/d1 test1(root.getAs().get(0), getResult(root, "a1")); test1(root.getB().getCs().get(2), getResult(root.getB(), "d1")); } @Test public void testRotName1FalseQuery() { test1("d1", getResult(root.getB().getCs().get(0), "rotName", "distance", "1", "update", "false")); } @Test public void testRotName2TrueQuery() { C c = root.getB().getCs().get(0); Object result = getResult(c, "rotName", "distance", "2", "update", "true"); test1("e1", result); test1(c.getName(), result); } }
[ "hal@ntnu.no" ]
hal@ntnu.no
f5f87598737224693922436303255ce7bc81bad5
32d65f73187fd2a2f1051d21ea7d3c59eef143c5
/platform-system/src/main/java/com/sdjtu/platform/modules/system/service/impl/MenuServiceImpl.java
0bdfdc1e861df4711717b3b0319cd943e848ff4a
[]
no_license
gexing521/k8splatform
67aaf2c8b3e75eff73d5c8663cf830c96a8f4fb8
644455867832a45e6f08314ec198137a01cd1bb5
refs/heads/master
2022-07-12T16:29:28.571500
2019-10-13T04:12:58
2019-10-13T04:12:58
214,799,764
0
0
null
2022-06-29T17:42:24
2019-10-13T10:22:52
Java
UTF-8
Java
false
false
10,825
java
package com.sdjtu.platform.modules.system.service.impl; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.sdjtu.platform.exception.handler.BadRequestException; import com.sdjtu.platform.exception.handler.EntityExistException; import com.sdjtu.platform.utils.QueryHelp; import com.sdjtu.platform.utils.StringUtils; import com.sdjtu.platform.utils.ValidationUtil; import com.sdjtu.platform.modules.system.domain.Menu; import com.sdjtu.platform.modules.system.domain.vo.MenuMetaVo; import com.sdjtu.platform.modules.system.domain.vo.MenuVo; import com.sdjtu.platform.modules.system.repository.MenuRepository; import com.sdjtu.platform.modules.system.service.MenuService; import com.sdjtu.platform.modules.system.service.RoleService; import com.sdjtu.platform.modules.system.service.dto.MenuDTO; import com.sdjtu.platform.modules.system.service.dto.MenuQueryCriteria; import com.sdjtu.platform.modules.system.service.dto.RoleSmallDTO; import com.sdjtu.platform.modules.system.service.mapper.MenuMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; /** * @Author: ytuan * @Date: 2019-10-12 15:52 */ @Service @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class MenuServiceImpl implements MenuService { @Autowired private MenuRepository menuRepository; @Autowired private MenuMapper menuMapper; @Autowired private RoleService roleService; @Override public List queryAll(MenuQueryCriteria criteria) { return menuMapper.toDto(menuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); } @Override public MenuDTO findById(long id) { Optional<Menu> menu = menuRepository.findById(id); ValidationUtil.isNull(menu, "Menu", "id", id); return menuMapper.toDto(menu.get()); } @Override public List<MenuDTO> findByRoles(List<RoleSmallDTO> roles) { Set<Menu> menus = new LinkedHashSet<>(); for (RoleSmallDTO role : roles) { List<Menu> menus1 = menuRepository.findByRoles_IdOrderBySortAsc(role.getId()).stream().collect(Collectors.toList()); menus.addAll(menus1); } return menus.stream().map(menuMapper::toDto).collect(Collectors.toList()); } @Override public MenuDTO create(Menu resources) { if (menuRepository.findByName(resources.getName()) != null) { throw new EntityExistException(Menu.class, "name", resources.getName()); } if (StringUtils.isNotBlank(resources.getComponentName())) { if (menuRepository.findByComponentName(resources.getComponentName()) != null) { throw new EntityExistException(Menu.class, "componentName", resources.getComponentName()); } } if (resources.getIFrame()) { if (!(resources.getPath().toLowerCase().startsWith("http://") || resources.getPath().toLowerCase().startsWith("https://"))) { throw new BadRequestException("外链必须以http://或者https://开头"); } } return menuMapper.toDto(menuRepository.save(resources)); } @Override public void update(Menu resources) { if (resources.getId().equals(resources.getPid())) { throw new BadRequestException("上级不能为自己"); } Optional<Menu> optionalPermission = menuRepository.findById(resources.getId()); ValidationUtil.isNull(optionalPermission, "Permission", "id", resources.getId()); if (resources.getIFrame()) { if (!(resources.getPath().toLowerCase().startsWith("http://") || resources.getPath().toLowerCase().startsWith("https://"))) { throw new BadRequestException("外链必须以http://或者https://开头"); } } Menu menu = optionalPermission.get(); Menu menu1 = menuRepository.findByName(resources.getName()); if (menu1 != null && !menu1.getId().equals(menu.getId())) { throw new EntityExistException(Menu.class, "name", resources.getName()); } if (StringUtils.isNotBlank(resources.getComponentName())) { menu1 = menuRepository.findByComponentName(resources.getComponentName()); if (menu1 != null && !menu1.getId().equals(menu.getId())) { throw new EntityExistException(Menu.class, "componentName", resources.getComponentName()); } } menu.setName(resources.getName()); menu.setComponent(resources.getComponent()); menu.setPath(resources.getPath()); menu.setIcon(resources.getIcon()); menu.setIFrame(resources.getIFrame()); menu.setPid(resources.getPid()); menu.setSort(resources.getSort()); menu.setCache(resources.getCache()); menu.setHidden(resources.getHidden()); menu.setComponentName(resources.getComponentName()); menuRepository.save(menu); } @Override public Set<Menu> getDeleteMenus(List<Menu> menuList, Set<Menu> menuSet) { // 递归找出待删除的菜单 for (Menu menu1 : menuList) { menuSet.add(menu1); List<Menu> menus = menuRepository.findByPid(menu1.getId()); if (menus != null && menus.size() != 0) { getDeleteMenus(menus, menuSet); } } return menuSet; } @Override @Transactional(rollbackFor = Exception.class) public void delete(Set<Menu> menuSet) { for (Menu menu : menuSet) { roleService.untiedMenu(menu.getId()); menuRepository.deleteById(menu.getId()); } } @Override public Object getMenuTree(List<Menu> menus) { List<Map<String, Object>> list = new LinkedList<>(); menus.forEach(menu -> { if (menu != null) { List<Menu> menuList = menuRepository.findByPid(menu.getId()); Map<String, Object> map = new HashMap<>(); map.put("id", menu.getId()); map.put("label", menu.getName()); if (menuList != null && menuList.size() != 0) { map.put("children", getMenuTree(menuList)); } list.add(map); } } ); return list; } @Override public List<Menu> findByPid(long pid) { return menuRepository.findByPid(pid); } @Override public Map buildTree(List<MenuDTO> menuDTOS) { List<MenuDTO> trees = new ArrayList<MenuDTO>(); Set<Long> ids = new HashSet<>(); for (MenuDTO menuDTO : menuDTOS) { if (menuDTO.getPid() == 0) { trees.add(menuDTO); } for (MenuDTO it : menuDTOS) { if (it.getPid().equals(menuDTO.getId())) { if (menuDTO.getChildren() == null) { menuDTO.setChildren(new ArrayList<MenuDTO>()); } menuDTO.getChildren().add(it); ids.add(it.getId()); } } } Map map = new HashMap(); if (trees.size() == 0) { trees = menuDTOS.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); } map.put("content", trees); map.put("totalElements", menuDTOS != null ? menuDTOS.size() : 0); return map; } @Override public List<MenuVo> buildMenus(List<MenuDTO> menuDTOS) { List<MenuVo> list = new LinkedList<>(); menuDTOS.forEach(menuDTO -> { if (menuDTO != null) { List<MenuDTO> menuDTOList = menuDTO.getChildren(); MenuVo menuVo = new MenuVo(); menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getName()); // 一级目录需要加斜杠,不然会报警告 menuVo.setPath(menuDTO.getPid() == 0 ? "/" + menuDTO.getPath() : menuDTO.getPath()); menuVo.setHidden(menuDTO.getHidden()); // 如果不是外链 if (!menuDTO.getIFrame()) { if (menuDTO.getPid() == 0) { menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent()); } else if (!StrUtil.isEmpty(menuDTO.getComponent())) { menuVo.setComponent(menuDTO.getComponent()); } } menuVo.setMeta(new MenuMetaVo(menuDTO.getName(), menuDTO.getIcon(), !menuDTO.getCache())); if (menuDTOList != null && menuDTOList.size() != 0) { menuVo.setAlwaysShow(true); menuVo.setRedirect("noredirect"); menuVo.setChildren(buildMenus(menuDTOList)); // 处理是一级菜单并且没有子菜单的情况 } else if (menuDTO.getPid() == 0) { MenuVo menuVo1 = new MenuVo(); menuVo1.setMeta(menuVo.getMeta()); // 非外链 if (!menuDTO.getIFrame()) { menuVo1.setPath("index"); menuVo1.setName(menuVo.getName()); menuVo1.setComponent(menuVo.getComponent()); } else { menuVo1.setPath(menuDTO.getPath()); } menuVo.setName(null); menuVo.setMeta(null); menuVo.setComponent("Layout"); List<MenuVo> list1 = new ArrayList<MenuVo>(); list1.add(menuVo1); menuVo.setChildren(list1); } list.add(menuVo); } } ); return list; } @Override public Menu findOne(Long id) { Optional<Menu> menu = menuRepository.findById(id); ValidationUtil.isNull(menu, "Menu", "id", id); return menu.get(); } }
[ "ytuan996@163.com" ]
ytuan996@163.com
80faf0710b2c64e31cf4b00cd7a10ff42857f7af
ca0bf34334f3eeed0d0b1463b8726bbbb9e05282
/src/renderer/ImageWriter.java
1c2afbaa3be2e2cbecae137554c6a3426e1c409d
[]
no_license
OdeyaSadoun/3DImagesRendering
3ab51bd661cfd727e07039dc32154b27b95b20b7
ae90e835161c966c706275e69af1dd5c3973eaa6
refs/heads/master
2023-08-04T12:02:10.889622
2021-07-13T16:26:32
2021-07-13T16:26:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,796
java
package renderer; import primitives.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.*; /** * Image writer class combines accumulation of pixel color matrix and finally * producing a non-optimized jpeg image from this matrix. The class although is * responsible of holding image related parameters of View Plane - pixel matrix * size and resolution * * @author Tamar Gavrieli 322533977 & Odeya Sadoun 212380406 */ public class ImageWriter { private int nX; private int nY; private static final String FOLDER_PATH = System.getProperty("user.dir") + "/images"; private BufferedImage image; private String imageName; private Logger logger = Logger.getLogger("ImageWriter"); // ***************** Constructors ********************** // /** * Image Writer constructor accepting image name and View Plane parameters, * * @param imageName the name of jpeg file * @param width View Plane width in size units * @param height View Plane height in size units * @param nX amount of pixels by Width * @param nY amount of pixels by height */ public ImageWriter(String imageName, int nX, int nY) { this.imageName = imageName; this.nX = nX; this.nY = nY; image = new BufferedImage(nX, nY, BufferedImage.TYPE_INT_RGB); } // ***************** Getters/Setters ********************** // /** * View Plane Y axis resolution * * @author Tamar Gavrieli 322533977 & Odeya Sadoun 212380406 * @return the amount of vertical pixels */ public int getNy() { return nY; } /** * View Plane X axis resolution * * @author Tamar Gavrieli 322533977 & Odeya Sadoun 212380406 * @return the amount of horizontal pixels */ public int getNx() { return nX; } // ***************** Operations ******************** // /** * Function writeToImage produces unoptimized png file of the image according to * pixel color matrix in the directory of the project * * @author Tamar Gavrieli 322533977 & Odeya Sadoun 212380406 */ public void writeToImage() { try { File file = new File(FOLDER_PATH + '/' + imageName + ".png"); ImageIO.write(image, "png", file); } catch (IOException e) { logger.log(Level.SEVERE, "I/O error", e); } } /** * The function writePixel writes a color of a specific pixel into pixel color * matrix * * @author Tamar Gavrieli 322533977 & Odeya Sadoun 212380406 * @param xIndex X axis index of the pixel * @param yIndex Y axis index of the pixel * @param color final color of the pixel */ public void writePixel(int xIndex, int yIndex, Color color) { image.setRGB(xIndex, yIndex, color.getColor().getRGB()); } }
[ "osadoun@g.jct.ac.il" ]
osadoun@g.jct.ac.il
2aa34f988f138800b2f77e8e7c99d7ecf1de29cc
32ec45a6c701235736106e7ba50e11d1a4902452
/WMethod/Utilities.java
285ab0836fcf8bb1dcd2bca059c603119bed8361
[]
no_license
Tayham/cosc442-hamilton-project5
78e43f2497a2de8360acd7d98d56d21221253175
9419cd493b8459bddd01b85f43bae9927d4e08d0
refs/heads/master
2020-03-11T10:16:00.546276
2018-04-18T00:54:50
2018-04-18T00:54:50
129,937,774
0
0
null
null
null
null
UTF-8
Java
false
false
3,680
java
/* * * This class contains debug switches, and several utility methods. * * Coded on: July 31, 2013 * Aditya Mathur * */ import java.io.*; import java.util.*; public class Utilities{ public static boolean fsmPrintSw=true; public static boolean pTableDebugSw=false; public static boolean testingTreeDebugSw=false; public static boolean transitionCoverSetDebugSw=true; // To or not to print the transition cover set. public static boolean fsmCreationDebugSw=false; public static boolean fsmExecutionDebugSw=true; public static boolean WSetDebugSw=true; public static void debugPtable(String s){ if(pTableDebugSw) System.out.println(s); } public static void debugTestingTree(String s){ if(testingTreeDebugSw) System.out.println(s); } public static void debugFSM(String s){ if(fsmCreationDebugSw) System.out.println(s); } public static void debugSort(String s){ if(fsmExecutionDebugSw) System.out.println(s); } public static void debugFSMExecution(String s){ if(fsmExecutionDebugSw) System.out.println(s); } public static void debugWSet(String s){ if(WSetDebugSw) System.out.println(s); } public static void printException(String c, String m, String s){ System.out.println("\nException occured. \nClass:"+c +"\nMethod: "+m+"\n"+s); System.exit(0); } public static boolean existsInVector(String searchString, Vector searchVector){ for(int i = 0; i < searchVector.size(); i++){ if((searchVector.get(i)).toString().equals(searchString)){ return true; } } return false; }// End of existsInVector() public static void printAllTestCases(Vector<String> testCases){ System.out.println("\nNumber of Test Cases :"+ testCases.size()); Collections.sort(testCases); System.out.println("Test cases: " + testCases); }// End of printAllTestCases() public static String runFSM(State [] FSM, int stateID, String input, String separator){ // input is a sequence of symbols from the input alphabet separated by string in separator. // StateId is the ID of the state to which input is to be applied. String outputPattern=""; // Output sequence generated by the FSM. Illegal input generates empty output. String token; // An input symbol from the input sequence. StringTokenizer inputTokens=new StringTokenizer(input, separator); int currentState=stateID; // Rest the FSM to state StateID. // Utilities.debugFSMExecution("\nFSM execution begins. Input: "+input+" Initial state: "+stateID); if(FSM[stateID]==null){ Utilities.printException("wAlgorithm", "runFSM", "Invalid start state. Execution aborted."); return ""; } while(inputTokens.hasMoreTokens()){ token=inputTokens.nextToken(); //Get next token from input. try{ // Utilities.debugFSMExecution("Current state: "+currentState); Edge nextStateEdge=FSM[currentState].getNextState(token); String outputGenerated=nextStateEdge.output(); int nextState=nextStateEdge.tail(); outputPattern=outputPattern+outputGenerated; // Utilities.debugFSMExecution(" Input: "+token+" Next state: "+nextState+" Output: "+outputGenerated); currentState=nextState; }catch (NoNextStateException e){ Utilities.printException("WMethod", "runFSM", " Invalid token: "+token); } } // Utilities.debugFSMExecution("\nFSM execution completed. Final state: "+currentState); // Utilities.debugFSMExecution("Output pattern:"+outputPattern); return outputPattern; } }// End of class Utilities.
[ "tayham1996@gmail.com" ]
tayham1996@gmail.com
c39c7e60619fff6a33779bf1a358a629a6469a21
3baf8a1e503872ce9ec4b0a5820e63f3a2da00e1
/app/src/test/java/com/lcardoso/testecontrollers3/presenter/UserPresenterTest.java
457fd8fa0f45a59a513f826527f8da214a0dbee2
[]
no_license
luizlimazup/Teste-Controllers-3
cd5ea9725b9dd985430419d7170aa8d3ffd3218f
8526f92c2806be64b8efa8e72d6804f521f42292
refs/heads/master
2020-09-10T16:49:36.304037
2019-11-14T19:00:16
2019-11-14T19:00:16
221,766,938
0
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
package com.lcardoso.testecontrollers3.presenter; import com.lcardoso.testecontrollers3.contract.UserContract; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class UserPresenterTest { private UserPresenter presenter = new UserPresenter(); @Mock private UserContract.View view; @Before public void setup() { MockitoAnnotations.initMocks(this); presenter.onStart(view); } @Test public void when_OnResetButtonClicked() { presenter.onResetButtonClicked(); Mockito.verify(view, Mockito.times(1)).clearForm(); } @Test public void when_OnSendButtonClicked() { presenter.onSendButtonClicked(); Mockito.verify(view, Mockito.times(1)).navigateToNextScreen(); Mockito.verify(view, Mockito.times(1)).isValidForm(); } }
[ "56737969+luizlimazup@users.noreply.github.com" ]
56737969+luizlimazup@users.noreply.github.com
9193b8f2232b287762902e420bfe7d96321713be
c83663cb3f458bf3f7a510666f64d2a8a42de0bc
/src/main/java/org/ifes/dominio/Moustruo.java
998330747138893a3904dc8d55038de8d42af30f
[]
no_license
matiasnahuelheredia/javaAutoRPJ
98c6e1f1b5ad21f90163577aeb2b1b858a94c134
aa3f06cd978feba804d0f52bf6f08365308e3c5a
refs/heads/master
2020-06-08T09:48:53.725311
2012-11-04T10:13:53
2012-11-04T10:13:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,200
java
package org.ifes.dominio; import java.util.List; import java.util.Random; abstract class Moustruo { private int hv; private int danio; public String getNombre(){ return this.getClass().getSimpleName(); } public Moustruo(int hv, int danio) { super(); this.hv = hv; this.danio = danio; } public int getVida(){ return this.hv; } public void setVida(int nuevaVida){ this.hv = nuevaVida; } public int getDanio(){ return this.danio; } public void setDanio(int nuevoDanio) { this.danio = nuevoDanio; } public void cargarVida(int vida) { int operacion = this.hv+vida; if((operacion) < 0) this.hv = 0; else this.hv = this.hv+vida; } public List<IPersonaje> AtacarAUnPersonaje(List<IPersonaje> personaje) { Random rnd = new Random(); IPersonaje persAux;//personaje auxiliar persAux = personaje.get(rnd.nextInt(personaje.size())); if(rnd.nextInt(2)==1) { persAux.cargarVida(this.getDanio()); System.out.println("El monstruo "+this.getNombre()+" a atacado al "+persAux.getNombre()+" haciendole "+this.getDanio()+" de daño!"); } else {System.out.println("El monstruo "+this.getNombre()+" a fallado su ataque!");} return personaje; } }
[ "matias@informaticos.com" ]
matias@informaticos.com
765e2ab651813085df4732ed249d5ff7757f2159
f9aa18a3783ad8640a8fe26206650a800f043d1e
/src/view/View.java
b2e4bf16d6f9feba61c9f6b6aa04a2cc581354bd
[]
no_license
VilimKrajinovic/JavaHospitalManagement
c5247ff0b618e300b585cf96656bc03561dcb3a3
a5da60ccfce4936c0d187ccd18e62c3eed2a53ea
refs/heads/master
2021-08-19T20:19:56.417172
2017-11-27T10:38:20
2017-11-27T10:38:20
104,048,418
0
0
null
null
null
null
UTF-8
Java
false
false
115
java
package View; /** * * @author amd */ public interface View { public abstract void initialize(); }
[ "amd@VilimKrajinovic.lan" ]
amd@VilimKrajinovic.lan
fc917bef4ae3742f6ce3a90d4176f385c94e29ac
daa98794b33a100647fecc630dcf3ce97edf663c
/src/com/roshangautam/boxoffice/application/BoxOfficeApplication.java
6786ea16eb14fd2e63a832c1ebb53d1b994f3271
[]
no_license
gaalvarez/android-rest-client-example
02d693ec54cacb2d62c97b61efead28b186fd361
6788da4d39004d1c63332f8dbef365f794dbc728
refs/heads/master
2021-01-18T09:05:01.746757
2014-05-06T23:54:04
2014-05-06T23:54:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package com.roshangautam.boxoffice.application; import android.app.Application; import com.activeandroid.ActiveAndroid; public class BoxOfficeApplication extends Application { public static final String AUTHORITY = "com.roshangautam.boxoffice"; @Override public void onCreate() { super.onCreate(); ActiveAndroid.initialize(this); } @Override public void onTerminate() { super.onTerminate(); ActiveAndroid.dispose(); } }
[ "rgautam@astate.edu" ]
rgautam@astate.edu
7ab539f441fac11ad19936b54a096552ab656edc
866fa35e4256485aa72ee83ac401ed15cb95d50c
/src/main/java/mgttg/parser/MGTTGInstructionParser.java
ae0b2b68c46045abc1672fb2e4ad42f04f18830a
[]
no_license
prasegaonkar/mgttg
4de58c39b8642fbb3b86f12c850f86c444eee461
54ad5fde4b8009b693c431944de743e43ebc1aea
refs/heads/master
2020-04-17T02:35:13.417975
2019-01-19T09:11:21
2019-01-19T09:11:21
166,142,658
0
0
null
null
null
null
UTF-8
Java
false
false
1,361
java
package mgttg.parser; import static mgttg.instructions.InstructionType.CREDITS_DECLARATION; import static mgttg.instructions.InstructionType.CREDITS_QUESTION; import static mgttg.instructions.InstructionType.INVALID; import static mgttg.instructions.InstructionType.LITERAL_DECLARATION; import static mgttg.instructions.InstructionType.LITERAL_QUESTION; import mgttg.instructions.InstructionType; public class MGTTGInstructionParser implements InstructionParser { @Override public InstructionType determineInstructionType(String instruction) { InstructionType type = INVALID; final boolean isInstructionBlank = instruction == null || "".equals(instruction.trim()); if (isInstructionBlank) { return type; } type = instruction.matches(LITERAL_DECLARATION.getMatchingPattern()) ? LITERAL_DECLARATION : INVALID; if (INVALID.equals(type) == false) { return type; } type = instruction.matches(CREDITS_DECLARATION.getMatchingPattern()) ? CREDITS_DECLARATION : INVALID; if (INVALID.equals(type) == false) { return type; } type = instruction.matches(LITERAL_QUESTION.getMatchingPattern()) ? LITERAL_QUESTION : INVALID; if (INVALID.equals(type) == false) { return type; } type = instruction.matches(CREDITS_QUESTION.getMatchingPattern()) ? CREDITS_QUESTION : INVALID; return type; } }
[ "prashant.rasegaonkar@gmail.com" ]
prashant.rasegaonkar@gmail.com
cc32269b08c8a6caa60dc99f6fcfafde4da3ac07
034416becb36f4a9922053daf5f1175349a2843f
/mmall-oms/mmall-oms-provider/src/main/java/com/xyl/mmall/oms/report/dao/SendOutReportDao.java
28f51e465e50aab7e8b102c7e999b87e00c151a8
[]
no_license
timgle/utilcode
40ee8d05e96ac324f452fccb412e07b4465e5345
a8c81c90ec1965d45589dd7be8d2c8b0991a6b6a
refs/heads/master
2021-05-09T22:39:11.417003
2016-03-20T14:30:52
2016-03-20T14:30:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,674
java
package com.xyl.mmall.oms.report.dao; import java.util.List; import com.netease.print.daojar.dao.AbstractDao; import com.xyl.mmall.oms.report.meta.OmsSendOutCountryForm; import com.xyl.mmall.oms.report.meta.OmsSendOutProvinceForm; import com.xyl.mmall.oms.report.meta.OmsSendOutReport; /** * * @author hzliujie * 2014年12月11日 上午11:39:08 */ public interface SendOutReportDao extends AbstractDao<OmsSendOutReport> { /** * 根据日期获取发货数据 * @param date * @return */ public List<OmsSendOutReport> getSentOutListByDay(long date); /** * 根据开始和结束日期获取发货数据 * @param date * @return */ public List<OmsSendOutReport> getSentOutListByDuration(long startTime,long endTime); /** * 根据日期获取当日发货量 * @param date * @return */ public int getSendOutCountByDay(long date); /** * 根据仓库id获取发货数量 * @param warehouseId * @return */ public int getSendOutByWarehouseId(long warehouseId); /** * 存储每日统计数据 * @param report * @return */ public OmsSendOutReport save(OmsSendOutReport report); /** * 构建每日统计数据 * @param day * @return */ public List<OmsSendOutReport> getSendOutReport(long day); /** * * @param day * @return */ public List<OmsSendOutProvinceForm> getSendOutProvinceForm(long day); /** * 组装全国发货报表数据 * @param day * @return */ public List<OmsSendOutCountryForm> getSendOutCountryForm(long day); /** * 根据仓库和日期获取每日基础数据 */ public OmsSendOutReport getSendOutReportByWarehouseIdAndDay(long warehouseId,long day); }
[ "jack_lhp@163.com" ]
jack_lhp@163.com
7bba329dfc70f2daf2b04e7dffcfddf37f293da7
fefcd2a7278f11b941862a28ab3bb66bee92bf7d
/src/main/java/com/bmdb/web/ActorController.java
b3e0d4203ce4b39987a0b65b479767647e5a1135
[]
no_license
EmsCode82/bmdb
2e5a9349e5f708539237d3503299fb20fad88f26
a3076749f69d96ec03785b09b0e98675b2b2e366
refs/heads/master
2022-06-28T20:52:40.272933
2020-05-14T17:58:19
2020-05-14T17:58:19
256,600,132
0
0
null
null
null
null
UTF-8
Java
false
false
2,880
java
package com.bmdb.web; import java.time.LocalDate; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; import com.bmdb.business.Actor; import com.bmdb.business.JsonResponse; import com.bmdb.business.MovieGenre; import com.bmdb.db.ActorRepository; @CrossOrigin @RestController @RequestMapping("/actors") public class ActorController { @Autowired private ActorRepository actorRepo; @GetMapping("/") public JsonResponse list() { JsonResponse jr = null; List<Actor> actors = actorRepo.findAll(); if (actors.size() > 0) { jr = JsonResponse.getInstance(actors); } else { jr = JsonResponse.getErrorInstance("No Actors Found."); } return jr; } @GetMapping("/list/birthDate") public JsonResponse findByBirthDate(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)@PathVariable String birthDate) { LocalDate ld = LocalDate.parse(birthDate); JsonResponse jr = null; List<Actor> actors = actorRepo.findAllByBirthDateBefore(ld); if (actors.size() > 0) { jr = JsonResponse.getInstance(actors); } else { jr = JsonResponse.getErrorInstance("No Actors Found."); } return jr; } @GetMapping("/{id}") public JsonResponse get(@PathVariable int id) { JsonResponse jr = null; Optional<Actor> actor = actorRepo.findById(id); if (actor.isPresent()) { jr = JsonResponse.getInstance(actor.get()); } else { jr = JsonResponse.getErrorInstance("No Actor found for Id." + id); } return jr; } // 'create' method @PostMapping("/") public JsonResponse createActor(@RequestBody Actor a) { JsonResponse jr = null; try { a = actorRepo.save(a); jr = JsonResponse.getInstance(a); } catch (DataIntegrityViolationException dive) { jr = JsonResponse.getErrorInstance(dive.getRootCause().getMessage()); dive.printStackTrace(); } catch (Exception e) { jr = JsonResponse.getErrorInstance("Error creating actor: " + e.getMessage()); e.printStackTrace(); } return jr; } @PutMapping("/") public JsonResponse updateActor(@RequestBody Actor a) { JsonResponse jr = null; try { a = actorRepo.save(a); jr = JsonResponse.getInstance(a); } catch (Exception e) { jr = JsonResponse.getErrorInstance("Error updating actor: " + e.getMessage()); e.printStackTrace(); } return jr; } @DeleteMapping("/{id}") public JsonResponse deleteActor(@PathVariable int id) { JsonResponse jr = null; try { actorRepo.deleteById(id); jr = JsonResponse.getInstance("Actor id: " + id + " deleted successfully"); } catch (Exception e) { jr = JsonResponse.getErrorInstance("Error deleting actor: " + e.getMessage()); e.printStackTrace(); } return jr; } }
[ "emsgithub@gmail.com" ]
emsgithub@gmail.com
13d9389d2d1ff90eb5e65caa1c66048ad2fb2c22
a9f3d6e50ad8cfaea811fcd10dd88f241589df22
/2021_OJ习题/src/com/ssz/大整数排序/Main.java
ae24ced81f37437fac37e928b495356ff6e18896
[]
no_license
Zshuangshuang/Reload
cd75520aff1811a5c939bc85bee402a016306c6f
346bb613c3fcd80e94d9043f559b68a465fe891b
refs/heads/master
2023-06-19T23:25:34.493003
2021-07-14T11:16:57
2021-07-14T11:16:57
322,004,400
0
0
null
null
null
null
UTF-8
Java
false
false
629
java
package com.ssz.大整数排序; import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while(scanner.hasNext()){ int num = scanner.nextInt(); BigInteger[] bigNum = new BigInteger[num]; for (int i = 0; i < num; i++) { bigNum[i] = scanner.nextBigInteger(); } Arrays.sort(bigNum); for (int i = 0; i < num; i++) { System.out.println(bigNum[i]); } } } }
[ "Zshuangshuang@yeah.net" ]
Zshuangshuang@yeah.net
a2a30e32935166bb73fbde9d5e767a117437b151
36bd1f6f4550e37e1359285369159c8b51cb3a16
/src/Controller/ChooseCareerController.java
6b596b889265ec0826df2f1c98e6a075d6614dec
[]
no_license
dychosenone/Thats-Life
a9b23a35441369fff0114bde5d4e5472e46964c8
847c33fd4aa6b64355dc9a734e7d9e061f9e48bc
refs/heads/master
2022-12-27T10:39:16.141121
2020-10-02T04:41:58
2020-10-02T04:41:58
292,523,293
0
0
null
null
null
null
UTF-8
Java
false
false
1,739
java
package Controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import Model.Career.CareerCard; import Model.SalaryCard.SalaryCard; import View.ChooseCareerUI; public class ChooseCareerController implements ActionListener, WindowListener{ private int choice = 0; private ChooseCareerUI ui; private String career1; private String career2; public ChooseCareerController (ChooseCareerUI gui, CareerCard c1, SalaryCard s1, CareerCard c2, SalaryCard s2) { ui = gui; ui.setActionListener(this); ui.setWindowListener(this); career1 = c1.getCareerName(); career2 = c2.getCareerName(); ui.chooseCareer(c1, s1, c2, s2); } public int getChoice () { return choice; } @Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equalsIgnoreCase(career1)) { choice = 1; ui.dispose(); } if (e.getActionCommand().equalsIgnoreCase(career2)) { choice = 2; ui.dispose(); } } @Override public void windowOpened(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowClosing(WindowEvent e) { choice = -1; } @Override public void windowClosed(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowIconified(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowDeiconified(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowActivated(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowDeactivated(WindowEvent e) { // TODO Auto-generated method stub } }
[ "44496680+azrielortega@users.noreply.github.com" ]
44496680+azrielortega@users.noreply.github.com
737ff1b5e0d08ebd0b35dac66c9a04b4a05bb9ee
b322dc934e99756ae2ec8613e1468d707ecff7bb
/com/company/Algorithm.java
5c6978589fd251d62e0b535664156a9221d343b6
[]
no_license
KomorowskiKuba/Watering-the-lawn-in-JAVA
8a2ede5488aca04d3ae07e1c7024e9e2ee401b3c
d1007027d30109714dfc2d2e0446be582a4cc09b
refs/heads/master
2023-01-27T13:57:47.898529
2020-12-07T23:14:00
2020-12-07T23:14:00
281,397,742
0
0
null
null
null
null
UTF-8
Java
false
false
13,049
java
package com.company; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Algorithm extends Global { int[][] entryArray = new int[49][89]; private int x, y; Algorithm(int[][] small_array, int[][] t, File f) throws FileNotFoundException { fill_borders(small_array, t); fileReader(f); fill(t); fill_interior(t); } private void fill_borders(int[][] small_array, int[][] t) { int[] counter = new int[10]; int condition = 0; int i, j, k; for (i = 0; i < 40; i++) { for (j = 0; j < 80; j++) { if (small_array[i][j] == -9) { if (i > 1 && small_array[i - 1][j] == 0 && small_array[i - 2][j] == 0) counter[0] += 1; else counter[0] = 0; if (i < 38 && small_array[i + 1][j] == 0 && small_array[i + 2][j] == 0) counter[2] += 1; else counter[2] = 0; } if (counter[0] == 8) { for (k = 0; (i - 1 - k >= 0 && j - 8 >= 0 && small_array[i - 1 - k][j - 8] < 0 && small_array[i - 1 - k][j - 7] >= 0); k++) { if (((i - k >= 0 && j - 8 >= 0 && j + 1 < 80) && (small_array[i - k][j - 8] < 0 || small_array[i - k][j + 1] < 0)) || ((i + k < 40 && j - 8 >= 0 && j + 1 < 80) && (small_array[i + k][j - 8] < 0 || small_array[i + k][j + 1] < 0))) condition++; } if (condition >= 5) counter[0] = 5; condition = 0; if (counter[0] == 8) { if (j - 3 > 0) { x = j - 3; y = i; Sprinkler s = new Sprinkler(t, x * 100, y * 100 - 1, 180, 0); sprinklerList.add(s); } x = 0; y = 0; counter[0] = 0; } } if (counter[2] == 8) { for (k = 0; (i + 1 + k < 40 && j - 8 >= 0 && small_array[i + 1 + k][j - 8] < 0 && small_array[i + 1 + k][j - 7] >= 0); k++) { if (((i > 4 && i - k >= 0 && j - 8 >= 0 && j + 1 < 80) && (small_array[i - k][j - 8] < 0 || small_array[i - k][j + 1] < 0)) || ((i < 37 && i + k < 40 && j - 8 >= 0 && j + 1 < 80) && (small_array[i + k][j - 8] < 0 || small_array[i + k][j + 1] < 0))) condition++; } if (condition >= 5) counter[2] = 5; condition = 0; if (counter[2] == 8) { if (j - 3 > 0 && i + 1 < 40) { x = j - 3; y = i + 1; Sprinkler s = new Sprinkler(t, x * 100, y * 100, 180, 180); sprinklerList.add(s); } x = 0; y = 0; counter[2] = 0; } } } } for (i = 0; i < 80; i++) { for (j = 0; j < 40; j++) { if (small_array[j][i] == -9) { if (i - 1 >= 0 && i - 2 >= 0 && small_array[j][i - 1] == 0 && small_array[j][i - 2] == 0) counter[1] += 1; else counter[1] = 0; if (i < 77 && small_array[j][i + 1] == 0 && small_array[j][i + 2] == 0) counter[3] += 1; else counter[3] = 0; } if (counter[1] == 8) { for (k = 0; (j - 8 >= 0 && i - 1 - k >= 0 && small_array[j - 8][i - 1 - k] < 0 && small_array[j - 7][i - 1 - k] >= 0); k++) { if (((j - 8 >= 0 && i - k >= 0 && j + 8 < 40) && (small_array[j - 8][i - k] < 0 || small_array[j + 8][i - k] < 0)) || ((j - 8 >= 0 && i + k < 80 && j + 8 < 40) && (small_array[j - 8][i + k] < 0 || small_array[j + 8][i + k] < 0))) condition++; } if (condition >= 5) counter[1] = 5; condition = 0; if (counter[1] == 8) { if (j - 3 >= 0) { x = i; y = j - 3; Sprinkler s = new Sprinkler(t, x * 100 - 1, y * 100, 180, 90); sprinklerList.add(s); } x = 0; y = 0; counter[1] = 0; } } if (counter[3] == 8) { for (k = 0; (small_array[j - 8][i + 1 + k] < 0 && small_array[j - 7][i + 1 + k] >= 0 && j - 8 >= 0 && i + 1 + k < 80); k++) { if (((j - 8 >= 0 && i - k >= 0 && j + 8 < 40) && (small_array[j - 8][i - k] < 0 || small_array[j + 8][i - k] < 0)) || ((j - 8 >= 0 && i + k < 80 && j + 8 < 40) && (small_array[j - 8][i + k] < 0 || small_array[j + 8][i + k] < 0))) condition++; } if (condition >= 5) counter[3] = 4; condition = 0; if (counter[3] == 8) { if (i + 1 < 80 && j - 3 > 0) { x = i + 1; y = j - 3; Sprinkler s = new Sprinkler(t, x * 100, y * 100, 180, 270); sprinklerList.add(s); } x = 0; y = 0; counter[3] = 0; } } } } } private void fill_interior(int[][] array) { for (int i = X_SIZE_START; i < X_SIZE_END; i += 100) //horizontally { for (int j = Y_SIZE_START; j < Y_SIZE_END; j += 50) //vertically { double test = check_condition(array, i, j); if (test >= 0.5) { Sprinkler s = new Sprinkler(array, i - X_SIZE_START, j - Y_SIZE_START, 360, 0); sprinklerList.add(s); } } } } private double check_condition(int[][] array, int center_x, int center_y) { double checked_fields = 0.0; double unwatered_fields = 0.0; double factor = 0.0; for (int i = 0; i < 2 * 200; i++) { x = center_x - 200 + i; for (int j = 0; j < 2 * 200; j++) { y = center_y - 200 + j; if ((i - 200) * (i - 200) + (j - 200) * (j - 200) <= 200 * 200 + TOLERANCE) { if (array[y][x] == 0) { unwatered_fields += 1.5; checked_fields++; } else if (array[y][x] > 0) { checked_fields++; } else if (array[y][x] < 0) { checked_fields++; } factor = unwatered_fields / checked_fields; } } } return factor; } private void fileReader(File f) throws FileNotFoundException { Scanner sc = new Scanner(f); for (int i = 0; i < 40; i++) { String temp = sc.next(); for (int j = 0; j < 80; j++) { if (temp.charAt(j) == '*') { entryArray[i][j] = 1; } else { entryArray[i][j] = 0; } } } } private void fill(int[][] t) { int c, k, l; for (int i = 1; i < 39; i++) { for (int j = 1; j < 79; j++) { if (entryArray[i][j] == 0) { if (entryArray[i - 1][j] == 1 && entryArray[i][j - 1] == 1) { c = 1; for (k = 1; k <= 4; k++) if (entryArray[i + k][j] == 1 || entryArray[i][j + k] == 1) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * j + 1, 100 * i + 1, 90, 270); sprinklerList.add(s); } } if (entryArray[i - 1][j] == 1 && entryArray[i][j + 1] == 1) { c = 1; for (k = 1; k <= 4; k++) for (l = 1; l <= 9; l++) if (j - l >= 0 && (entryArray[i + k][j] == 1 || entryArray[i][j - l] == 1)) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * (j + 1) - 1, 100 * i + 1, 90, 180); sprinklerList.add(s); } } if (entryArray[i + 1][j] == 1 && entryArray[i][j - 1] == 1) { c = 1; for (k = 1; k <= 4; k++) for (l = 1; l <= 9; l++) if (i - l >= 0 && (entryArray[i - l][j] == 1 || entryArray[i][j + k] == 1)) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * j + 1, 100 * (i + 1) - 1, 90, 0); sprinklerList.add(s); } } if (entryArray[i + 1][j] == 1 && entryArray[i][j + 1] == 1) { c = 1; for (k = 1; k <= 9; k++) if ((i - k >= 0 && j - k >= 0) && (entryArray[i - k][j] == 1 || entryArray[i][j - k] == 1)) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * (j + 1) - 1, 100 * (i + 1) - 1, 90, 90); sprinklerList.add(s); } } if (entryArray[i + 1][j + 1] == 1 && entryArray[i + 1][j] == 0 && entryArray[i][j + 1] == 0) { c = 1; for (k = 1; k <= 7; k++) if (entryArray[i + k][j] == 1 || entryArray[i][j + k] == 1) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * (j + 1) - 1, 100 * (i + 1) - 1, 270, 270); sprinklerList.add(s); } } if (entryArray[i + 1][j - 1] == 1 && entryArray[i + 1][j] == 0 && entryArray[i][j - 1] == 0) { c = 1; for (k = 1; k <= 7; k++) if (j - k >= 0 && (entryArray[i + k][j] == 1 || entryArray[i][j - k] == 1)) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * j + 1, 100 * (i + 1) - 1, 270, 180); sprinklerList.add(s); } } if (entryArray[i - 1][j + 1] == 1 && entryArray[i][j + 1] == 0 && entryArray[i - 1][j] == 0) { c = 1; for (k = 1; k <= 7; k++) if (i - k >= 0 && (entryArray[i - k][j] == 1 || entryArray[i][j + k] == 1)) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * (j + 1) - 1, 100 * i + 1, 270, 0); sprinklerList.add(s); } } if (entryArray[i - 1][j - 1] == 1 && entryArray[i][j - 1] == 0 && entryArray[i - 1][j] == 0) { c = 1; for (k = 1; k <= 7; k++) if ((i - k >= 0 && j - k >= 0) && (entryArray[i - k][j] == 1 || entryArray[i][j - k] == 1)) c = 0; if (c == 1) { Sprinkler s = new Sprinkler(t, 100 * j + 1, 100 * i + 1, 270, 0); sprinklerList.add(s); } } } } } } }
[ "noreply@github.com" ]
noreply@github.com
f399c820956f75f0a736ec56698f4afdc66e0532
5be276b07080d4ac4487df51b7e95c427fcad33f
/src/main/java/com/luketowell/webexample/model/Book.java
ff01075d2a8fc37ee2d15e3cf017c9190134cda9
[]
no_license
luketowell/springwebapp
fda851c38c719d49c92ebca3ca8e6362be761bf5
2ba735d94082030b76d8799364dacadb1bb5f381
refs/heads/master
2022-11-27T23:56:54.935927
2020-08-04T14:57:32
2020-08-04T14:57:32
284,676,065
0
0
null
null
null
null
UTF-8
Java
false
false
2,026
java
package com.luketowell.webexample.model; import javax.persistence.*; import java.util.HashSet; import java.util.Set; @Entity public class Book { @Id @GeneratedValue (strategy = GenerationType.AUTO) private Long id; private String title; private String ispn; @ManyToOne private Publisher publisher; @ManyToMany @JoinTable(name = "author_book", joinColumns = @JoinColumn(name = "book_id"), inverseJoinColumns = @JoinColumn(name = "authorId")) private Set<Author> authors = new HashSet<>(); public Book() { } public Book(String title, String ispn) { this.title = title; this.ispn = ispn; this.authors = authors; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getIspn() { return ispn; } public void setIspn(String ispn) { this.ispn = ispn; } public Set<Author> getAuthors() { return authors; } public void setAuthors(Set<Author> authors) { authors = authors; } public Publisher getPublisher() { return publisher; } public void setPublisher(Publisher publisher) { this.publisher = publisher; } @Override public String toString() { return "Book{" + "id=" + id + ", title='" + title + '\'' + ", ispn='" + ispn + '\'' + ", authors=" + authors + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Book book = (Book) o; return id != null ? id.equals(book.id) : book.id == null; } @Override public int hashCode() { return id != null ? id.hashCode() : 0; } }
[ "luke.towell@hotmail.com" ]
luke.towell@hotmail.com
21d0dfc37f4f5d6500b88c91a3f19310ca3f10fe
e7bb03380a2ebe08e0c1619a885817f91cc82fd2
/app/src/main/java/com/example/ckz/demo1/bean/cookbook/ResultBean.java
23e9920240b6eab8daf63be044e721cfd2eeea20
[]
no_license
c786909486/Demo1
e4566926a122ef5c10a25617fd3bd4cd93aeed70
10ea135a3a35f8297ecf001f3882b884aa47ce4c
refs/heads/master
2020-12-02T06:40:39.437677
2017-08-08T09:27:34
2017-08-08T09:27:34
96,875,323
0
0
null
null
null
null
UTF-8
Java
false
false
2,507
java
package com.example.ckz.demo1.bean.cookbook; import com.google.gson.annotations.SerializedName; import org.litepal.crud.DataSupport; import java.io.Serializable; import java.util.List; /** * Created by CKZ on 2017/6/6. */ public class ResultBean extends DataSupport implements Serializable{ /** * classid : 1 * name : 功效 * parentid : 0 * list : [{"classid":"2","name":"减肥","parentid":"1"},{"classid":"3","name":"瘦身","parentid":"1"},{"classid":"4","name":"消脂","parentid":"1"},{"classid":"5","name":"丰胸","parentid":"1"},{"classid":"6","name":"美容","parentid":"1"},{"classid":"7","name":"养颜","parentid":"1"},{"classid":"8","name":"美白","parentid":"1"},{"classid":"9","name":"防晒","parentid":"1"},{"classid":"10","name":"排毒","parentid":"1"},{"classid":"11","name":"祛痘","parentid":"1"},{"classid":"12","name":"祛斑","parentid":"1"},{"classid":"13","name":"保湿","parentid":"1"},{"classid":"14","name":"补水","parentid":"1"},{"classid":"15","name":"通乳","parentid":"1"},{"classid":"16","name":"催乳","parentid":"1"},{"classid":"17","name":"回奶","parentid":"1"},{"classid":"18","name":"下奶","parentid":"1"},{"classid":"19","name":"调经","parentid":"1"},{"classid":"20","name":"安胎","parentid":"1"},{"classid":"21","name":"抗衰老","parentid":"1"},{"classid":"22","name":"抗氧化","parentid":"1"},{"classid":"23","name":"延缓衰老","parentid":"1"},{"classid":"24","name":"补钙","parentid":"1"},{"classid":"25","name":"补铁","parentid":"1"},{"classid":"26","name":"补锌","parentid":"1"},{"classid":"27","name":"补碘","parentid":"1"},{"classid":"28","name":"补硒","parentid":"1"}] */ @SerializedName("classid") private String classid; @SerializedName("name") private String name; @SerializedName("parentid") private String parentid; @SerializedName("list") private List<ListBean> list; public String getClassid() { return classid; } public void setClassid(String classid) { this.classid = classid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getParentid() { return parentid; } public void setParentid(String parentid) { this.parentid = parentid; } public List<ListBean> getList() { return list; } public void setList(List<ListBean> list) { this.list = list; } }
[ "786909486@qq.com" ]
786909486@qq.com
d137d920d79f989a898ad3a027a6b44c3cf75e4e
4ef10c0affa01d24d13a2f582c91dfebd89fa1c9
/src/Tree/FindKClosestElements/Main.java
ec0d5a02559ca44d2a42b06b869b80b0a0c71f96
[]
no_license
ClaudeWu/LintCode-Playground
abb561099370e830446efb7ffa37359621b3d958
9637e42cb6f82540a0847b5937be2c354ed7a41d
refs/heads/master
2023-06-07T22:07:35.183105
2021-06-28T01:45:25
2021-06-28T01:45:25
341,438,256
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
package Tree.FindKClosestElements; import java.util.Arrays; public class Main { public static void main(String[] args) { Solution s = new Solution(); Solution2 s2 = new Solution2(); int[] test1 = {1, 2, 3}; int[] test2 = {1, 4, 6, 8}; int[] result1 = s.kClosestNumbers(test1, 2, 3); int[] result2 = s.kClosestNumbers(test2, 3, 3); int[] result3 = s2.kClosestNumbers(test1, 2, 3); int[] result4 = s2.kClosestNumbers(test2, 3, 3); System.out.println(Arrays.toString(result1)); System.out.println(Arrays.toString(result2)); System.out.println(Arrays.toString(result3)); System.out.println(Arrays.toString(result4)); } }
[ "dwu1026@gmail.com" ]
dwu1026@gmail.com
7f9db59c0e02211d4c047819611648bce80d76b8
434c995b751813b8a0fb1a85b7e1d527afdfa984
/heron/Heron-Perf/src/main/java/edu/wisc/streaming/WordCountTopology.java
db2e43d4f2044ae66cdc8cd26a3dcd145a349a1e
[]
no_license
rdamkondwar/Streaming-Benchmark
1cf24f30fe6afcda297bf784b4cf149ae64c62ed
7fc680d9628c77a4cd67f15d5704ab049b037fad
refs/heads/master
2021-04-30T23:58:01.582728
2017-04-16T17:21:38
2017-04-16T17:21:38
73,422,975
0
1
null
null
null
null
UTF-8
Java
false
false
5,785
java
// Copyright 2016 Twitter. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package edu.wisc.streaming; import java.util.HashMap; import java.util.Map; import java.util.Random; import backtype.storm.Config; import backtype.storm.StormSubmitter; import backtype.storm.generated.AlreadyAliveException; import backtype.storm.generated.InvalidTopologyException; import backtype.storm.spout.SpoutOutputCollector; import backtype.storm.task.OutputCollector; import backtype.storm.task.TopologyContext; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.topology.TopologyBuilder; import backtype.storm.topology.base.BaseRichBolt; import backtype.storm.topology.base.BaseRichSpout; import backtype.storm.tuple.Fields; import backtype.storm.tuple.Tuple; import backtype.storm.tuple.Values; /** * This is a topology that does simple word counts. * <p> * In this topology, * 1. the spout task generate a set of random words during initial "open" method. * (~128k words, 20 chars per word) * 2. During every "nextTuple" call, each spout simply picks a word at random and emits it * 3. Spouts use a fields grouping for their output, and each spout could send tuples to * every other bolt in the topology * 4. Bolts maintain an in-memory map, which is keyed by the word emitted by the spouts, * and updates the count when it receives a tuple. */ public final class WordCountTopology { private WordCountTopology() { } // Utils class to generate random String at given length public static class RandomString { private final char[] symbols; private final Random random = new Random(); private final char[] buf; public RandomString(int length) { // Construct the symbol set StringBuilder tmp = new StringBuilder(); for (char ch = '0'; ch <= '9'; ++ch) { tmp.append(ch); } for (char ch = 'a'; ch <= 'z'; ++ch) { tmp.append(ch); } symbols = tmp.toString().toCharArray(); if (length < 1) { throw new IllegalArgumentException("length < 1: " + length); } buf = new char[length]; } public String nextString() { for (int idx = 0; idx < buf.length; ++idx) { buf[idx] = symbols[random.nextInt(symbols.length)]; } return new String(buf); } } /** * A spout that emits a random word */ public static class WordSpout extends BaseRichSpout { private static final long serialVersionUID = 4322775001819135036L; private static final int ARRAY_LENGTH = 128 * 1024; private static final int WORD_LENGTH = 20; private final String[] words = new String[ARRAY_LENGTH]; private final Random rnd = new Random(31); private SpoutOutputCollector collector; @Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(new Fields("word")); } @Override @SuppressWarnings("rawtypes") public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) { RandomString randomString = new RandomString(WORD_LENGTH); for (int i = 0; i < ARRAY_LENGTH; i++) { words[i] = randomString.nextString(); } collector = spoutOutputCollector; } @Override public void nextTuple() { int nextInt = rnd.nextInt(ARRAY_LENGTH); collector.emit(new Values(words[nextInt])); } } /** * A bolt that counts the words that it receives */ public static class ConsumerBolt extends BaseRichBolt { private static final long serialVersionUID = -5470591933906954522L; private OutputCollector collector; private Map<String, Integer> countMap; @SuppressWarnings("rawtypes") public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) { collector = outputCollector; countMap = new HashMap<String, Integer>(); } @Override public void execute(Tuple tuple) { String key = tuple.getString(0); if (countMap.get(key) == null) { countMap.put(key, 1); } else { Integer val = countMap.get(key); countMap.put(key, ++val); } collector.ack(tuple); } @Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { } } /** * Main method */ public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException { if (args.length < 1) { throw new RuntimeException("Specify topology name"); } int parallelism = 1; if (args.length > 1) { parallelism = Integer.parseInt(args[1]); } TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("word", new WordSpout(), parallelism); builder.setBolt("consumer", new ConsumerBolt(), parallelism) .fieldsGrouping("word", new Fields("word")); Config conf = new Config(); conf.setNumStmgrs(parallelism); /* Set config here */ conf.setComponentRam("word", 2L * 1024 * 1024 * 1024); conf.setComponentRam("consumer", 3L * 1024 * 1024 * 1024); conf.setContainerCpuRequested(6); StormSubmitter.submitTopology(args[0], conf, builder.createTopology()); } }
[ "pradeep.kashyap@wisc.edu" ]
pradeep.kashyap@wisc.edu
57a4d157bf9d4820f9da2ad59b2143d6aa748fff
b97bc0706448623a59a7f11d07e4a151173b7378
/src/main/java/radian/tcmis/server7/client/avcorp/servlets/AvcorpWasteTrack.java
6432a1d24ac2548d2b1d0a487266373f569b9d47
[]
no_license
zafrul-ust/tcmISDev
576a93e2cbb35a8ffd275fdbdd73c1f9161040b5
71418732e5465bb52a0079c7e7e7cec423a1d3ed
refs/heads/master
2022-12-21T15:46:19.801950
2020-02-07T21:22:50
2020-02-07T21:22:50
241,601,201
0
0
null
2022-12-13T19:29:34
2020-02-19T11:08:43
Java
UTF-8
Java
false
false
979
java
package radian.tcmis.server7.client.avcorp.servlets; import radian.tcmis.server7.share.helpers.*; import radian.tcmis.server7.share.servlets.*; import radian.tcmis.server7.client.avcorp.dbObjs.*; import radian.tcmis.server7.client.avcorp.helpers.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class AvcorpWasteTrack extends HttpServlet { public void init(ServletConfig config) throws ServletException { super.init(config); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { AvcorpTcmISDBModel db = null; try { db = new AvcorpTcmISDBModel("Avcorp",(String)request.getHeader("logon-version")); WasteTrack obj = new WasteTrack((ServerResourceBundle) new AvcorpServerResourceBundle(),db); obj.doPost(request,response); } catch (Exception e){ e.printStackTrace(); } finally { db.close(); } } }
[ "julio.rivero@wescoair.com" ]
julio.rivero@wescoair.com
85e7f3d5002d8c331ecdffc5f82d3f089ee44ddc
6cb3237a57b0ddff27ab28901a0e2838e05a040c
/Laboratory 3/src/TeorieEx/SingletonClass.java
5293a2bd7880930ebbb64c3345c69437a26a0cb5
[]
no_license
AnMa12/LearningJava
798f2397feb2d2a57d35fc92be1c18b428c56b52
f2136c83e7a4543c9b098a4cb65ee07d9a488032
refs/heads/master
2020-03-11T03:43:09.127471
2018-12-02T12:51:49
2018-12-02T12:51:49
129,756,358
0
0
null
null
null
null
UTF-8
Java
false
false
872
java
package TeorieEx; public class SingletonClass { // instanta este statica pentru a fi initializata o singura // data in memorie private static SingletonClass instance; // constructorul este privat pentru a nu putea sa facem // instante noi ale clasei din exteriorul clasei private SingletonClass(){} // metoda prin care returnam prima instanta existenta a clasei // de fiecare data cand avem nevoie de acest obiect public static SingletonClass getInstance(){ //daca nu a fost instantiata niciodata clasa o instantiem if(instance == null){ System.out.println("Initializare singleton"); return instance = new SingletonClass(); } // in caz contrar returnam prima instanta existenta System.out.println("Returnare isntanta initiala singleton"); return instance; } }
[ "34279579+AnMa12@users.noreply.github.com" ]
34279579+AnMa12@users.noreply.github.com
8f4fd0ef61f4007a032c3f562e2d7d2adafb42f8
6e04d02f4856cf9ed092e4ace288e4f688ded3f6
/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HugeHPBoiler_HSSG.java
9168df2d68b0d0805935126cf05aba36d9dd364b
[]
no_license
StalinKyn/Gregtech-madness
15c06ebb37affc66ccf6417a096817cde7f04a58
b3f0bc51f9407c977c860fc31b3f0b792790729a
refs/heads/master
2020-09-16T03:57:07.443785
2020-03-22T18:56:12
2020-03-22T18:56:12
223,643,366
0
1
null
null
null
null
UTF-8
Java
false
false
3,544
java
package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; public class GT_MetaTileEntity_HugeHPBoiler_HSSG extends GT_MetaTileEntity_HugeBoiler { public GT_MetaTileEntity_HugeHPBoiler_HSSG(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); processMultiplier = 5; } public GT_MetaTileEntity_HugeHPBoiler_HSSG(String aName) { super(aName); processMultiplier = 5; } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_HugeHPBoiler_HSSG(this.mName); } public String getCasingMaterial(){ return "HSSG"; } @Override public String getCasingBlockType() { return "Durable Machine Casings"; } public Block getCasingBlock() { return GregTech_API.sBlockCasings8; } public byte getCasingMeta() { return 5; } public int getCasingTextureIndex() { return 181; } public Block getPipeBlock() { return GregTech_API.sBlockCasings8; } public byte getPipeMeta() { return 4; } public Block getFireboxBlock() { return GregTech_API.sBlockCasings8; } public byte getFireboxMeta() { return 3; } public int getFireboxTextureIndex() { return 179; } public int getEUt() { return 1000; } public int getEfficiencyIncrease() { return 4; } @Override int runtimeBoost(int mTime) { return mTime * 120 / 100; } @Override public boolean onRunningTick(ItemStack aStack) { if (this.mEUt > 0) { if (this.mSuperEfficencyIncrease > 0) mEfficiency = Math.max(0, Math.min(mEfficiency + mSuperEfficencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); if (tGeneratedEU > 0) { long amount = (tGeneratedEU + 160) / 160; if (depleteInput(Materials.Water.getFluid(amount)) || depleteInput(GT_ModHandler.getDistilledWater(amount))) { addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", (tGeneratedEU))); } else { explodeMultiblock(); } } return true; } return true; } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[1][50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[1][50]}; } }
[ "37311176+AndreySolodovnikov@users.noreply.github.com" ]
37311176+AndreySolodovnikov@users.noreply.github.com
422f31af1aeb745b5e696a91d961a410c69615d6
359bba5d2f25b30a18d08c743e668be51edd4ed7
/src/org/gavrog/jane/fpgroups/Alphabet.java
a6aefc48f51c3dcf30ecec555404da98e26f3bb0
[ "Apache-2.0" ]
permissive
undeadinu/gavrog
74e76d46f6818730aa4f5bf34b4593d8afdb8957
159ebdb80ba661c48164b392d59a0519ec643521
refs/heads/master
2020-04-16T06:18:20.625109
2018-11-05T09:50:08
2018-11-05T09:50:08
165,339,987
0
0
Apache-2.0
2019-01-12T03:35:24
2019-01-12T03:05:54
Java
UTF-8
Java
false
false
1,150
java
/* Copyright 2012 Olaf Delgado-Friedrichs Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.gavrog.jane.fpgroups; /** * Defines a translation between abstract letters and their names. */ public interface Alphabet<E> { /** * Retrieves a specific letter name. * @param i the numeric letter. * @return the name of the ith letter or null if no name was defined. */ public abstract E letterToName(int i); /** * Retrieves the index of a letter name. * @param name the name. * @return the index or abstract letter for this name. */ public abstract int nameToLetter(E name); }
[ "olaf.delgado@gmail.com" ]
olaf.delgado@gmail.com
d2e65daf32915253e2c31928d03cc9260990c68c
66cfcba747c36995d752a17a70a3f914de54ba46
/JinZhiZhuanHuan.java
215255a9ddd572427415e0d5144f3cc8fbbcf6f2
[]
no_license
hizhanglijun/learngit
6d111186a2bc1947bb195a217d16d30893b91a6d
dff1eda01ad3a69d65ed504653c677d9a79f9ba2
refs/heads/master
2021-01-10T10:02:46.119402
2015-11-23T18:14:30
2015-11-23T18:14:30
46,730,323
0
0
null
null
null
null
UTF-8
Java
false
false
1,590
java
/* 需求:抽取进制转换的特点,转换为一个函数,使其能把十进制的数转换为二进制、八进制、以及十六进制 思路: 1、使用查表法来进行进制转换,所以需要定义数组存储不同进制的字符{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'} 2、需要使用容器来存储转换完成之后对应进制的表示,所以定义一个数组来存储,使用存储数量最多的二进制的存储容易,因为其也可存储八进制与十六进制。 3、定义一个变量来存储&运算之后所得的数字,该数字即为想要转换的禁制的一位。 4、&运算,转2禁制 &1;转八进制 &7,转十六禁制 &15,结果存入 临时变量。 5、无符号右移offset位(1、3、4) 6、循环4、5直到num变成0。 */ class JinZhiZhuanHuan { public static void main(String[] args) { toOct(-237); } /* 转二禁制 */ public static void toBin(int num) { transform(num,1,1); } /* 转八禁制 */ public static void toOct(int num) { transform(num,7,3); } /* 转十六禁制 */ public static void toHex(int num) { transform(num,15,4); } public static void transform(int num,int base,int offset) { if(num == 0) return; char[] chs = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; char[] cc = new char[32]; int pos = cc.length; while(num!=0) { int temp; temp = num & base; num = num >>> offset; cc[--pos]=chs[temp]; } for(int x=pos;x<cc.length;x++) { System.out.print(cc[x]); } } }
[ "zhanglijunv@foxmail.com" ]
zhanglijunv@foxmail.com
c5255112f1a392ffd489d378e83960e79e798fdd
1bdc065bad0305f2017e0a3865c26251e8e76aa3
/Recursion/Recursion with ArrayList/getmazepath.java
61bd543f1d4aacbd59cd66ac41e9fe6656ad62f0
[]
no_license
ManshuSengar/Data-structure-and-algorithms
8b573b9e3d7048a7c35827e161d5e44a96663e52
4bb4d09cc7c1d53404ed0af8c3a0c5deb91bbe43
refs/heads/master
2023-08-31T10:14:34.081735
2021-09-25T03:19:54
2021-09-25T03:19:54
407,895,906
0
0
null
null
null
null
UTF-8
Java
false
false
1,017
java
import java.util.*; class getmazepath{ public static Scanner scn = new Scanner(System.in); public static ArrayList<String> getMaze(int sr,int sc,int dr,int dc){ if(sr==dr && sc==dc) { ArrayList<String> base=new ArrayList<>(); base.add(""); return base; } ArrayList<String> ans=new ArrayList<>(); if(sc+1<=dc) { ArrayList<String> recAns= getMaze(sr,sc+1,dr,dc); for(String s:recAns) { ans.add("H"+s); } } if(sr+1<=dr) { ArrayList<String> recAns= getMaze(sr+1,sc,dr,dc); for(String s:recAns) { ans.add("V"+s); } } return ans; } public static void main(String[] args){ int sr=scn.nextInt(); int sc=scn.nextInt(); int dr=scn.nextInt(); int dc=scn.nextInt(); ArrayList<String> ans=getMaze(sr,sc,dr,dc); System.out.println(ans); } }
[ "c0debreaker41517@gmail.com" ]
c0debreaker41517@gmail.com
2e11436e6502228cf2331ad9fc4703849ea15e11
8472528c8d35995ccf963ecdc3198eb3e65051f0
/hk-core-authentication-alipay/src/main/java/com/hk/alipay/security/AlipayAuthenticationDetailsSource.java
150863073660c5c4acd7b2a71458a1a9ecc24617
[]
no_license
huankai/hk-core
a314499cf5796ddd81452ce66f6f8343e131f345
f97f346aefeab9471d5219a9b505e216bbf457ad
refs/heads/master
2021-05-26T08:01:20.342175
2019-12-31T09:52:12
2020-01-02T00:59:45
127,990,324
9
3
null
2019-10-11T09:35:42
2018-04-04T01:36:50
Java
UTF-8
Java
false
false
510
java
package com.hk.alipay.security; import org.springframework.security.authentication.AuthenticationDetailsSource; import javax.servlet.http.HttpServletRequest; /** * @author kevin * @date 2019-7-18 17:57 */ public class AlipayAuthenticationDetailsSource implements AuthenticationDetailsSource<HttpServletRequest, AlipayAuthenticationDetails> { @Override public AlipayAuthenticationDetails buildDetails(HttpServletRequest context) { return new AlipayAuthenticationDetails(context); } }
[ "huankai@139.com" ]
huankai@139.com
97d50f2b223966e889661dd012c291a23c298496
7247a69cb1d9040bb732432abbb59ca887540c75
/origin-service/src/main/java/space/dyenigma/service/impl/SysRoleService.java
000eb4ee3627b74d3165f660e6d358fcf3864817
[ "Apache-2.0" ]
permissive
dingdongliang/origin
10813135a51873d90ebbff1a45c2d3123c646077
f1149918d6f0aa3e6384d0c5696bbc616a6fe1b3
refs/heads/master
2021-04-30T10:17:11.033465
2018-03-04T02:39:29
2018-03-04T02:39:29
121,329,170
0
0
null
null
null
null
UTF-8
Java
false
false
4,823
java
package space.dyenigma.service.impl; import space.dyenigma.dao.SysPermissionMapper; import space.dyenigma.dao.SysPostRoleMapper; import space.dyenigma.dao.SysPrjRoleMapper; import space.dyenigma.dao.SysRoleMapper; import space.dyenigma.dao.SysRolePmsnMapper; import space.dyenigma.dao.SysUserRoleMapper; import space.dyenigma.entity.BaseDomain; import space.dyenigma.entity.SysPermission; import space.dyenigma.entity.SysPostRole; import space.dyenigma.entity.SysPrjRole; import space.dyenigma.entity.SysRole; import space.dyenigma.entity.SysRolePmsn; import space.dyenigma.entity.SysUserRole; import space.dyenigma.service.ISysRoleService; import space.dyenigma.util.Constants; import space.dyenigma.util.PageUtil; import space.dyenigma.util.StringUtil; import space.dyenigma.util.UUIDUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; /** * origin/space.dyenigma.service.impl * * @Description: * @Author: dingdongliang * @Date: 2017/07/21 */ @Service @Transactional public class SysRoleService extends BaseService<SysRole> implements ISysRoleService { private final Logger logger = LoggerFactory.getLogger(SysRoleService.class); @Autowired private SysRoleMapper sysRoleMapper; @Autowired private SysPermissionMapper sysPermissionMapper; @Autowired private SysRolePmsnMapper sysRolePmsnMapper; @Autowired private SysPostRoleMapper sysPostRoleMapper; @Autowired private SysPrjRoleMapper sysPrjRoleMapper; @Autowired private SysUserRoleMapper sysUserRoleMapper; @Override public List<SysRole> findAllRoleList(PageUtil pageUtil) { logger.info("开始查找用户信息,分页显示"); List<SysRole> roleList = sysRoleMapper.findAllByPage(pageUtil); return roleList; } @Override public Integer getCount(Map<String, Object> paramMap) { logger.info("开始查找用户信息的总条数"); return sysRoleMapper.selectCountByCondition(paramMap); } /** * @param role * @return boolean * @Description : 新增和修改角色 * @author dingdongliang * @date 2018/2/20 19:50 */ @Override public boolean persistenceRole(SysRole role) { String userId = Constants.getCurrendUser().getUserId(); if (StringUtil.isEmpty(role.getRoleId())) { BaseDomain.createLog(role, userId); role.setStatus(Constants.PERSISTENCE_STATUS); role.setRoleId(UUIDUtil.getUUID()); sysRoleMapper.insert(role); // 这里设置新增用户的默认权限,首先获取所有的默认且有效的权限 List<SysPermission> pList = sysPermissionMapper.findAllDefault(); //然后逐一添加进映射表 for (SysPermission permission : pList) { SysRolePmsn rolePmsn; rolePmsn = new SysRolePmsn(); rolePmsn.setStatus(Constants.PERSISTENCE_STATUS); BaseDomain.createLog(rolePmsn, userId); rolePmsn.setPmsnId(permission.getPmsnId()); rolePmsn.setRoleId(role.getRoleId()); rolePmsn.setRpId(UUIDUtil.getUUID()); sysRolePmsnMapper.insert(rolePmsn); } } else { BaseDomain.editLog(role, userId); sysRoleMapper.updateByPrimaryKeySelective(role); } return true; } @Override public boolean delRole(String id) { //删除角色权限关联 List<SysRolePmsn> rpList = sysRolePmsnMapper.findAllByRoleId(id); for (SysRolePmsn rolePmsn : rpList) { sysRoleMapper.deleteByPrimaryKey(rolePmsn.getRpId()); } //删除角色岗位关联 List<SysPostRole> prList = sysPostRoleMapper.findAllByRoleId(id); for (SysPostRole postRole : prList) { sysRoleMapper.deleteByPrimaryKey(postRole.getPrId()); } //删除角色用户关联 List<SysUserRole> urList = sysUserRoleMapper.findAllByRoleId(id); for (SysUserRole userRole : urList) { sysRoleMapper.deleteByPrimaryKey(userRole.getUrId()); } //删除项目角色关联 List<SysPrjRole> prjRoles = sysPrjRoleMapper.findAllByRoleId(id); for (SysPrjRole prjRole : prjRoles) { sysRoleMapper.deleteByPrimaryKey(prjRole.getPrId()); } //删除角色 SysRole role = sysRoleMapper.selectByPrimaryKey(id); role.setStatus(Constants.PERSISTENCE_DELETE_STATUS); return sysRoleMapper.updateByPrimaryKey(role) > 0; } }
[ "dyenigma@163.com" ]
dyenigma@163.com
58b4fa152484be0d9a0952737c073913dd94db22
17ee5f5c78d1288b935a54fea678c9b781f5828e
/src/main/java/com/udemy/java/CustomList.java
d897c46b07e9b4b6e512d48be0edb83a24e5cfa5
[]
no_license
portnovtest/javaeightplusfortesters
ad0e8fd441482eb95cc0f8a38b1d45faeca73e1c
cd05395cfb4e608e7e415516b1a264218b8d5ea4
refs/heads/master
2023-05-29T17:06:16.307078
2019-12-29T22:14:03
2019-12-29T22:14:03
230,809,294
0
0
null
2023-05-09T18:36:38
2019-12-29T22:13:35
Java
UTF-8
Java
false
false
309
java
package com.udemy.java; import java.util.function.Consumer; public interface CustomList { void add(int item); int size(); int get(int index); default void forEach(Consumer<Integer> consumer){ for (int i = 0; i < size(); i++) { consumer.accept(get(i)); } } }
[ "phildolganov@yahoo.com" ]
phildolganov@yahoo.com
68666ef47fa910e4c670c78e29f60d83e46c5c2c
3821f3af0b954cbb3a35b883b7cccd4b93119567
/src/main/java/com/google/api/codegen/util/testing/ValueProducer.java
c97965ad6ebee30e08b26ab5cae1b29ca596acfd
[ "Apache-2.0" ]
permissive
Shasthojoy/toolkit
65d8bd83f5b8f7d924e6c44d70b1eeb1b899f62f
ae590450bb4835785f1904205e81e3aa0ef298a2
refs/heads/master
2021-05-15T12:15:47.852137
2017-10-26T00:27:56
2017-10-26T00:27:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
872
java
/* Copyright 2016 Google Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.api.codegen.util.testing; import com.google.api.codegen.config.TypeModel; import com.google.api.codegen.util.Name; /** A utility interface used by TestValueGenerator. */ public interface ValueProducer { String produce(TypeModel typeRef, Name identifier); }
[ "noreply@github.com" ]
noreply@github.com
015a051f8ede8fd8ef63114eb1904a8368a5be7e
839f3a4218cd26a6e80f9c9e5b5fdf45e74d7f5e
/src/by/it/grechishnikov/jd01_13/matLab/controller/operation/Operation.java
bce1f3633c24028d6dc220f9d49d8a9dfb4dc2f8
[]
no_license
du4/JD2016-08-22
a10fb3b268c46e52a8c4003bd9bba1622bfa3ca1
9c594c48deef622754483d088ee326b89526ecd1
refs/heads/master
2021-01-15T16:36:45.135865
2016-11-09T08:13:36
2016-11-09T08:13:36
68,627,723
0
2
null
2016-09-19T17:09:30
2016-09-19T17:09:29
null
UTF-8
Java
false
false
6,407
java
package by.it.grechishnikov.jd01_13.matLab.controller.operation; import by.it.grechishnikov.jd01_13.matLab.model.*; public class Operation implements IOperationable { @Override public Var add(String name, Var var1, Var var2) { try { if (var1 instanceof Scalar && var2 instanceof Scalar) return Add.add(name, (Scalar) var1, (Scalar) var2); else if (var1 instanceof Scalar && var2 instanceof Vector) return Add.add(name, (Scalar) var1, (Vector) var2); else if (var1 instanceof Scalar && var2 instanceof Matrix) return Add.add(name, (Scalar) var1, (Matrix) var2); else if (var1 instanceof Vector && var2 instanceof Scalar) return Add.add(name, (Vector) var1, (Scalar) var2); else if (var1 instanceof Vector && var2 instanceof Vector) return Add.add(name, (Vector) var1, (Vector) var2); else if (var1 instanceof Vector && var2 instanceof Matrix) return Add.add(name, (Vector) var1, (Matrix) var2); else if (var1 instanceof Matrix && var2 instanceof Scalar) return Add.add(name, (Matrix) var1, (Scalar) var2); else if (var1 instanceof Matrix && var2 instanceof Vector) return Add.add(name, (Matrix) var1, (Vector) var2); else if (var1 instanceof Matrix && var2 instanceof Matrix) return Add.add(name, (Matrix) var1, (Matrix) var2); else throw new NotSupportedException(); } catch (NotSupportedException e) { System.out.println("Операция невозможна"); return new NullObject(); } } public Var mul(String name, Var var1, Var var2) { try { if (var1 instanceof Scalar && var2 instanceof Scalar) return Mul.mul(name, (Scalar) var1, (Scalar) var2); else if (var1 instanceof Scalar && var2 instanceof Vector) return Mul.mul(name, (Scalar) var1, (Vector) var2); else if (var1 instanceof Scalar && var2 instanceof Matrix) return Mul.mul(name, (Scalar) var1, (Matrix) var2); else if (var1 instanceof Vector && var2 instanceof Scalar) return Mul.mul(name, (Vector) var1, (Scalar) var2); else if (var1 instanceof Vector && var2 instanceof Vector) return Mul.mul(name, (Vector) var1, (Vector) var2); else if (var1 instanceof Vector && var2 instanceof Matrix) return Mul.mul(name, (Vector) var1, (Matrix) var2); else if (var1 instanceof Matrix && var2 instanceof Scalar) return Mul.mul(name, (Matrix) var1, (Scalar) var2); else if (var1 instanceof Matrix && var2 instanceof Vector) return Mul.mul(name, (Matrix) var1, (Vector) var2); else if (var1 instanceof Matrix && var2 instanceof Matrix) return Mul.mul(name, (Matrix) var1, (Matrix) var2); else throw new NotSupportedException(); } catch (NotSupportedException e) { System.out.println("Операция невозможна"); return new NullObject(); } } public Var div(String name, Var var1, Var var2) { try { if (var1 instanceof Scalar && var2 instanceof Scalar) return Div.div(name, (Scalar) var1, (Scalar) var2); else if (var1 instanceof Scalar && var2 instanceof Vector) return Div.div(name, (Scalar) var1, (Vector) var2); else if (var1 instanceof Scalar && var2 instanceof Matrix) return Div.div(name, (Scalar) var1, (Matrix) var2); else if (var1 instanceof Vector && var2 instanceof Scalar) return Div.div(name, (Vector) var1, (Scalar) var2); else if (var1 instanceof Vector && var2 instanceof Vector) return Div.div(name, (Vector) var1, (Vector) var2); else if (var1 instanceof Vector && var2 instanceof Matrix) return Div.div(name, (Vector) var1, (Matrix) var2); else if (var1 instanceof Matrix && var2 instanceof Scalar) return Div.div(name, (Matrix) var1, (Scalar) var2); else if (var1 instanceof Matrix && var2 instanceof Vector) return Div.div(name, (Matrix) var1, (Vector) var2); else if (var1 instanceof Matrix && var2 instanceof Matrix) return Div.div(name, (Matrix) var1, (Matrix) var2); else throw new NotSupportedException(); } catch (NotSupportedException e) { System.out.println("Операция невозможна"); return new NullObject(); } } public Var sub(String name, Var var1, Var var2) { try { if (var1 instanceof Scalar && var2 instanceof Scalar) return Sub.sub(name, (Scalar) var1, (Scalar) var2); else if (var1 instanceof Scalar && var2 instanceof Vector) return Sub.sub(name, (Scalar) var1, (Vector) var2); else if (var1 instanceof Scalar && var2 instanceof Matrix) return Sub.sub(name, (Scalar) var1, (Matrix) var2); else if (var1 instanceof Vector && var2 instanceof Scalar) return Sub.sub(name, (Vector) var1, (Scalar) var2); else if (var1 instanceof Vector && var2 instanceof Vector) return Sub.sub(name, (Vector) var1, (Vector) var2); else if (var1 instanceof Vector && var2 instanceof Matrix) return Sub.sub(name, (Vector) var1, (Matrix) var2); else if (var1 instanceof Matrix && var2 instanceof Scalar) return Sub.sub(name, (Matrix) var1, (Scalar) var2); else if (var1 instanceof Matrix && var2 instanceof Vector) return Sub.sub(name, (Matrix) var1, (Vector) var2); else if (var1 instanceof Matrix && var2 instanceof Matrix) return Sub.sub(name, (Matrix) var1, (Matrix) var2); else throw new NotSupportedException(); } catch (NotSupportedException e) { System.out.println("Операция невозможна"); return new NullObject(); } } }
[ "ke6a93@gmail.com" ]
ke6a93@gmail.com
933f3f3f2aa88fa3702c291a6283c9c66cc19927
75fd169dd5f9c61fba2a8efea01f52f5852571be
/src/org/jprotocol/framework/dsl/BitFieldEncoder.java
7beea8a8f0be313641a1c1ee14a58acba0da1d0b
[]
no_license
martinfolkman/JProtocol
a79085a1d4037e0714380611e767e43c6bafba9e
dc53b3c11d21cd498ec4caa96d75c76ad8ff7ca1
refs/heads/master
2016-09-05T14:46:26.686729
2011-05-31T19:27:27
2011-05-31T19:27:27
1,770,961
0
2
null
null
null
null
UTF-8
Java
false
false
498
java
package org.jprotocol.framework.dsl; import static org.jprotocol.framework.dsl.BitFilterUtil.arrayOf; class BitFieldEncoder extends Encoder { BitFieldEncoder(IProtocolMessage protocol) { super(protocol); } @Override boolean encode(IArgumentType argType, String value) { if (!isBitField(argType)) return false; protocol.setData(arrayOf(argType.valueOf(value), protocol.getDataAsInts(), argType.getOffset(), argType.getSizeInBits()), 0); return true; } }
[ "eliassonaand@yahoo.com" ]
eliassonaand@yahoo.com
4c330682ba8633632daa9e9416807aabe5c70556
299e697a7f3fad4e780b758f8f8bd471ae6fb351
/sb2/src/main/java/com/example/sb2/event/Test.java
619bee91380101caa489231b7e7fd24da227bfe5
[]
no_license
dutlzn/SpringBoot-Deep-Research
bb94125330a5b4eee139699f62f5d96a37712532
09845ea4f0e533c1efb1d443858e8582e4a3ff4a
refs/heads/master
2023-02-15T09:07:36.501999
2020-12-31T07:37:55
2020-12-31T07:37:55
322,452,644
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
package com.example.sb2.event; public class Test { public static void main(String[] args){ // 首先构造广播器 WeatherEventMulticaster eventMulticaster = new WeatherEventMulticaster(); // 构造监听器 RainListener rainListener = new RainListener(); SnowListener snowListener = new SnowListener(); // 添加监听器到广播器中 eventMulticaster.addListener(rainListener); eventMulticaster.addListener(snowListener); // 通过广播器发送下雪事件 eventMulticaster.multicastEvent(new SnowEvent()); eventMulticaster.multicastEvent(new RainEvent()); // 移除监听器 eventMulticaster.removeListener(snowListener); // 继续发送事件 eventMulticaster.multicastEvent(new SnowEvent()); eventMulticaster.multicastEvent(new RainEvent()); } }
[ "2436013662@qq.com" ]
2436013662@qq.com
8cb9c6b42b08a000e04368a861e7754537e002bf
7b78d95f193bfa087634d886736e1267fac96638
/me/hgilman/Spells/Library/NetSpell.java
fb8055fc5ec4bbc94b95433e162025d981a25f37
[]
no_license
Hypersonic/SpellCraft
f8d606a01e3ae8dde2d0d36b9ef62de59bd826e7
1711a041ba58fdc0ca7fbd2042ec492d5ef9ad59
refs/heads/master
2021-01-18T06:38:16.015579
2011-12-26T23:46:41
2011-12-26T23:46:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
package me.hgilman.Spells.Library; import java.util.ArrayList; import java.util.List; import me.hgilman.Spells.Spell; import me.hgilman.Spells.Spells; import me.hgilman.Spells.Runnables.NetRunnable; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.entity.CraftCaveSpider; import org.bukkit.craftbukkit.entity.CraftChicken; import org.bukkit.craftbukkit.entity.CraftCow; import org.bukkit.craftbukkit.entity.CraftCreeper; import org.bukkit.craftbukkit.entity.CraftEnderDragon; import org.bukkit.craftbukkit.entity.CraftEnderman; import org.bukkit.craftbukkit.entity.CraftFish; import org.bukkit.craftbukkit.entity.CraftGhast; import org.bukkit.craftbukkit.entity.CraftGiant; import org.bukkit.craftbukkit.entity.CraftMonster; import org.bukkit.craftbukkit.entity.CraftPig; import org.bukkit.craftbukkit.entity.CraftPigZombie; import org.bukkit.craftbukkit.entity.CraftSheep; import org.bukkit.craftbukkit.entity.CraftSilverfish; import org.bukkit.craftbukkit.entity.CraftSkeleton; import org.bukkit.craftbukkit.entity.CraftSlime; import org.bukkit.craftbukkit.entity.CraftSnowman; import org.bukkit.craftbukkit.entity.CraftSpider; import org.bukkit.craftbukkit.entity.CraftSquid; import org.bukkit.craftbukkit.entity.CraftVillager; import org.bukkit.craftbukkit.entity.CraftWolf; import org.bukkit.craftbukkit.entity.CraftZombie; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; public class NetSpell extends Spell { protected int range = 30; private int radius = 10; public NetSpell(Spells instance, Player playerinstance) { super(playerinstance,instance,"Net","Freezes all life in 10-block radius for 10 seconds.",new ItemStack(Material.STRING,10)); } protected boolean isOf(Entity entity, Class... classes) { for(int iii=0;iii<classes.length;iii++) { if(entity.getClass() == classes[iii]) { return true; } } return false; } protected void freezeNearby(LivingEntity center, int range) { List<Entity> nearbyMobs = center.getNearbyEntities(range * 2, (range * 2), (range*2) ); ArrayList<Block> frozenBlocks = new ArrayList<Block>(); for (int iii=0;iii<nearbyMobs.size();iii++) // Scroll through every entity in the list. { if(isOf(nearbyMobs.get(iii), CraftCaveSpider.class,CraftChicken.class,CraftCow.class,CraftCreeper.class,CraftEnderDragon.class,CraftEnderman.class,CraftFish.class,CraftGhast.class,CraftGiant.class,CraftMonster.class,CraftPig.class,CraftPigZombie.class,CraftSheep.class,CraftSilverfish.class,CraftSkeleton.class,CraftSlime.class,CraftSnowman.class,CraftSpider.class,CraftSquid.class,CraftVillager.class,CraftWolf.class,CraftZombie.class)) { Block frozenBlock = nearbyMobs.get(iii).getLocation().getWorld().getBlockAt(nearbyMobs.get(iii).getLocation()); frozenBlocks.add(frozenBlock); frozenBlock.setType(Material.WEB); } } plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new NetRunnable(frozenBlocks), (200)); } protected void castSpell() { freezeNearby(player,radius); } }
[ "h.herbie@gmail.com" ]
h.herbie@gmail.com
65f2778d13ac70c0ffc2f8c895c9eb844d7d83ca
672d821bf82b29dbcaed1a17c67b508539493d2a
/EndikaPrueba/src/main/java/com/ipartek/formacion/pojos/Constantes.java
8d317b147a8b029f3e7cbf3bd908a8f36fa1febc
[]
no_license
Endika1994/MiRepositorio
4345e2b39db022c4b5a398370fd8377ebd8c5c7d
131bc1a26f0bfbe4ea326afc1987e674f966a949
refs/heads/master
2020-04-08T07:58:08.069440
2018-12-13T12:29:06
2018-12-13T12:29:06
159,159,133
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package com.ipartek.formacion.pojos; public class Constantes { public static final String REGEX_EMAIL = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"; public static final String REGEX_PASSWORD = "(?=^.{6,}$)(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&amp;*()_+}{&quot;:;'?/&gt;.&lt;,])(?!.*\\s).*$"; }
[ "Curso@PORT-Z12.ipartekaula.com" ]
Curso@PORT-Z12.ipartekaula.com
6bb27e93516e96a8855c2df9476727355b7e51ec
6376b3c7f63f02467fa2527ff36d52023926a4ba
/src/test/java/com/newtours/pages/BaseTest.java
00a1512c7bfeaed67f82b778b3a62ee487ea444c
[]
no_license
lukkson/selenium-docker
aa28b88d366ba3ce68da3c0044bf6aa3c88ea676
9a8cfac46a8ad6c60ed7a0d88ce5ad80a2ed0735
refs/heads/main
2023-02-19T21:17:05.968674
2021-01-22T12:42:58
2021-01-22T12:42:58
329,988,974
0
0
null
null
null
null
UTF-8
Java
false
false
1,583
java
package com.newtours.pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.ITestContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import java.net.MalformedURLException; import java.net.URL; public class BaseTest { protected WebDriver driver; @BeforeTest public void setUp(ITestContext iTestContext) throws MalformedURLException { if(System.getProperty("LOCAL") != null) { System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe"); this.driver = new ChromeDriver(); } else { String host = "localhost"; DesiredCapabilities dc; if(System.getProperty("BROWSER") != null && System.getProperty("BROWSER").equalsIgnoreCase("firefox")) { dc = DesiredCapabilities.firefox(); } else { dc = DesiredCapabilities.chrome(); } if(System.getProperty("HUB_HOST") != null){ host = System.getProperty("HUB_HOST"); } String completeURL = "http://" + host + ":4444/wd/hub"; String name = iTestContext.getCurrentXmlTest().getName() ; dc.setCapability("name", name); this.driver = new RemoteWebDriver(new URL(completeURL), dc); } } @AfterTest public void tearDown() { driver.quit(); } }
[ "lukasz.dugosz091@gmail.com" ]
lukasz.dugosz091@gmail.com
45916847b8395b4cf9f8c92139b8fa530a9944e3
8863ff6243bd741ea0bf9e21f3c137b5c64f72d8
/src/main/java/MinimumSpanningTree/Edge.java
0fd2540c0123f83e6964146a8383add64e03b912
[]
no_license
Poplar-hills/Play-with-algorithms
10f247efc9c800c63928de286bbe7485f2d20657
997440f04a1c68f99e8dc7d2cd88e89209749b7f
refs/heads/master
2021-11-12T06:02:47.531460
2021-10-27T03:05:49
2021-10-27T03:05:49
165,807,033
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package MinimumSpanningTree; /* * 带权重的边(Weighted Edge) * */ public class Edge<Weight extends Number & Comparable> implements Comparable<Edge<Weight>> { private int a, b; // 边上的两个顶点(对于有向图来说,该边是从 a 指向 b,对于无向图来说都一样) private Weight weight; // 边的权值 public Edge(int a, int b, Weight weight) { this.a = a; this.b = b; this.weight = weight; } public Edge() { } public int v() { return a; } public int w() { return b; } public Weight weight() { return weight; } public int theOther(int x) { // 给定边上的一个顶点,返回另一个顶点 if (x != a && x != b) throw new IllegalArgumentException("theOther failed. x is not a vertex on the edge"); return x == a ? b : a; } @Override public int compareTo(Edge other) { int comp = weight.compareTo(other.weight()); if (comp < 0) return -1; else if (comp > 0) return 1; else return 0; } @Override public String toString() { return a + "-" + b + ": " + weight; } }
[ "maxjiang23326@gmail.com" ]
maxjiang23326@gmail.com
40cec18d13ea05c0f0918511c79f4454df7f8b25
7e87b386c03a8e7c0f31eb02369bc8248a6ca47d
/resmanagement/ResmanagementService/service/src/integration-test/java/org/openo/nfvo/resmanagement/test/ITResOperateRoaSuccess.java
718d688fe22004f4bc6d2aa166e4f51fc981c67d
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-public-domain", "CC-BY-4.0" ]
permissive
openov2/nfvo
19685a51c6960508c20f16fe88310c6e3f5cf140
6d4dd2cd45ef0131fca23ef07e4e8ffe8fc5fd55
refs/heads/master
2021-09-01T00:01:38.630277
2017-05-19T10:21:17
2017-05-19T10:21:17
115,208,180
0
0
null
null
null
null
UTF-8
Java
false
false
2,038
java
/* * Copyright 2016 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openo.nfvo.resmanagement.test; import java.io.File; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openo.baseservice.remoteservice.exception.ServiceException; import org.openo.nfvo.resmanagement.mocoserver.VimDriverSuccessServer; import org.openo.nfvo.resmanagement.util.MyTestManager; /** * <br> * <p> * </p> * * @author * @version NFVO 0.5 Oct 15, 2016 */ public class ITResOperateRoaSuccess extends MyTestManager { private VimDriverSuccessServer driver = new VimDriverSuccessServer(); private static final String POST_PATH = "src/integration-test/resources/testcase/resoperateroa/addresourcesuccess1.json"; private static final String PUT_PATH = "src/integration-test/resources/testcase/resoperateroa/modresourcesuccess1.json"; private static final String DEL_PATH = "src/integration-test/resources/testcase/resoperateroa/deleteresourcesuccess1.json"; @Before public void setup() throws ServiceException, InterruptedException { driver.start(); // Thread.sleep(30 * 1000); } @After public void tearDown() throws ServiceException { driver.stop(); } @Test public void testOperateSuccess() throws ServiceException { execTestCase(new File(POST_PATH)); execTestCase(new File(PUT_PATH)); execTestCase(new File(DEL_PATH)); } }
[ "luxin7@huawei.com" ]
luxin7@huawei.com
692efdc8a4ee4b3efd2398e1852b20e9d4f9dccb
484a155b5353e8482c697bef1de4263d2c66893e
/src/com/company/swea/SWEA16800.java
f51c73616022994f847327394a4f970362324bae
[]
no_license
gogoadl/Algorithm
2ca7ce89d1d477067f0ec5e886cc9e45fa0c848d
ae322c223ba0d4ac2598dda1553dfcc147dc505b
refs/heads/master
2023-08-07T18:57:18.040540
2023-08-07T08:31:18
2023-08-07T08:31:18
245,440,157
2
0
null
null
null
null
UTF-8
Java
false
false
1,399
java
package com.company.swea; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class SWEA16800 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int testCaseCount = Integer.parseInt(br.readLine()); for (int i = 1; i <= testCaseCount; i++) { long input = Long.parseLong(br.readLine()); long answer = 0; ArrayList<Long> arrayList = new ArrayList(); ArrayList<Long> arrayList1 = new ArrayList(); for (long j = 1; j <= Math.sqrt(input); j++) { if (input % j == 0) { arrayList.add(j); } } if (arrayList.size() > 1) { for (int j = 1; j < arrayList.size(); j++) { long value = (input / arrayList.get(j)); arrayList1.add(arrayList.get(j) + value - 2); } Collections.sort(arrayList1); answer = arrayList1.get(0); } else { answer = input - 1; } sb.append(String.format("#%d %s\n", i, answer)); } System.out.println(sb); } }
[ "49335446+gogoadl@users.noreply.github.com" ]
49335446+gogoadl@users.noreply.github.com
4c4db84479b769f766a695f7d6c6c372e8cba4aa
e355e79c0cd08ec85f6d0f68091839506d7b3a17
/android/app/src/main/java/com/flatlist/MainActivity.java
bb108568eeb1a7eb8905b68cfe26e8c9669e40ce
[]
no_license
ngoctan95/ReactNative_FlatList
ccc92100de7c732195340e96dbc5ce82d7ed58dd
8e7b159c5b66b6f28b77846228f608f70c7149fc
refs/heads/master
2021-05-02T06:16:32.156333
2018-02-09T04:39:32
2018-02-09T04:39:32
120,855,797
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.flatlist; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "FlatList"; } }
[ "nguyenngoctan44@gmail.com" ]
nguyenngoctan44@gmail.com
b43f652e584e01842858515ef6e39bd0f1e00718
d1e97e51920dc240e1b592c32c00eb18d324605b
/Semester/src/ru/itis/Task18/Main.java
9b6a17c784b2ed219c1390b3a7ce868f2efa789b
[]
no_license
IrNesterova/KHUSNUTDINOV_11_702
5951fe26fe5fbf0d912e2734f551badfb4093937
8dd21962754b1e660d11f5e160343167ce1c7e69
refs/heads/master
2020-04-08T13:13:40.309181
2018-11-27T07:42:08
2018-11-27T07:42:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package ru.itis.Task18; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String num1 = scanner.next(); String num2 = scanner.next(); int count = 0; for (int i = 0; i < 4; i++){ if (num1.charAt(i) == num2.charAt(i)){ count++; } } System.out.println(count); } }
[ "=khusnut99@gmail.com" ]
=khusnut99@gmail.com
058c92e1483f28f29a4e4b765c2d42233076526d
41e589a8f3e6f31f14c133e11c832c045fc27106
/app/src/main/java/joqu/intervaltrainer/ui/fragments/TemplateFragment.java
820b5d2e61c99f3f09f14298fbc3fb62aafc7873
[]
no_license
thomond/IntervalTrainer2
2d6f633e4ffb88ccde8910e9b0e6abafcfe0a981
150c2cb9b8cfd4859f6d9c8c60d47bb745672fdb
refs/heads/master
2021-07-21T23:54:27.262950
2020-05-14T20:06:46
2020-05-14T20:06:46
166,992,109
0
0
null
null
null
null
UTF-8
Java
false
false
5,272
java
package joqu.intervaltrainer.ui.fragments; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.List; import joqu.intervaltrainer.R; import joqu.intervaltrainer.Util; import joqu.intervaltrainer.model.entities.Interval; import joqu.intervaltrainer.model.entities.Template; import joqu.intervaltrainer.ui.AppViewModel; import joqu.intervaltrainer.ui.ItemClickListener; import joqu.intervaltrainer.ui.adapters.IntervalAdapter; import joqu.intervaltrainer.ui.adapters.TemplateListAdapter; import static android.content.ContentValues.TAG; // TODO: generalise fragment to also show selected template public class TemplateFragment extends Fragment implements ItemClickListener, View.OnClickListener { private AppViewModel mViewModel; private int mTemplateSelected; // The template id selelcted via the template list to be presented private RecyclerView intervalRecyclerView; private RecyclerView templateListRecyclerView; private TextView templateListItem_name; private TextView templateListItem_time; private TextView templateListItem_distance; private Button template_btnNewSession; private View mTemplateView; private View mTemplateListView; private int mTemplateID; private TextView templateListItem_intervals; public static TemplateFragment newInstance() { return new TemplateFragment(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_template, container, false); mViewModel = ViewModelProviders.of(this).get(AppViewModel.class); templateListRecyclerView = v.findViewById(R.id.templateListRecyclerView); mTemplateView = v.findViewById(R.id.templateView); mTemplateListView = v.findViewById(R.id.templateListView); // Viewholder items go here templateListItem_name = v.findViewById(R.id.template_name); templateListItem_time = v.findViewById(R.id.template_time); templateListItem_intervals = v.findViewById(R.id.template_intervals); templateListItem_distance = v.findViewById(R.id.template_distance); template_btnNewSession = v.findViewById(R.id.template_btnNewSession); intervalRecyclerView = v.findViewById(R.id.intervalView); showTemplateList(); MainActivity a = (MainActivity) getActivity(); a.getSupportActionBar().setTitle("Test"); return v; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } private void showTemplateList(){ mTemplateListView.setVisibility(View.VISIBLE); mTemplateView.setVisibility(View.GONE); // Populate recycler for items final TemplateListAdapter mAdapter = new TemplateListAdapter(getContext(), this); templateListRecyclerView.setAdapter(mAdapter); templateListRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mAdapter.setTemplateList(mViewModel.getAllTemplates()); } private void showTemplate(final int templateID) { mTemplateListView.setVisibility(View.GONE); mTemplateView.setVisibility(View.VISIBLE); mTemplateID = templateID; // Template information Template template = mViewModel.getSessionTemplate(templateID); templateListItem_name.setText(template.name); templateListItem_time.setText(Util.millisToTimeFormat(template.time,"mm:ss")); template_btnNewSession.setOnClickListener(this); // Retrive template Intervals and set the number List<Interval> intervals = mViewModel.getTemplateIntervals(templateID); templateListItem_intervals.setText(String.valueOf(intervals.size())); final IntervalAdapter mAdapter = new IntervalAdapter(getContext()); intervalRecyclerView.setAdapter(mAdapter); intervalRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mAdapter.setIntervalList(intervals,mViewModel.getSessionTemplate(templateID)); } @Override public void onItemClick(View view, int position) { this.mTemplateSelected = position; Log.i(TAG,"Click From View: "+view.toString()); // TODO switch view to saved template based on ID showTemplate(this.mTemplateSelected); } @Override public void onClick(View v) { // Include template id in argument list Bundle fragmentBundle = new Bundle(); fragmentBundle.putInt("template_id",mTemplateID); MainActivity.switchFragment(LiveSessionFragment.newInstance(),R.id.mainContentFrame,getActivity().getSupportFragmentManager(),fragmentBundle); } }
[ "john.quirke@gmail.com" ]
john.quirke@gmail.com
95ea97e8b03d9240930f55bd7b790af94c134731
12709a8dbdc26ac669034f4e5a79746eb5d0296b
/soapServiceCall/src/main/java/com/dxc/soapcall/I_getZoznamSudov.java
a54528c13b00d8eec75e8e1980e32031ef5fc57c
[]
no_license
alangyi2020/integration_microservice
9022c7d9b8c6618950f3a1af6ae93009c053e266
8274c54b8de27c747920fe47b191131c9b1f62e7
refs/heads/main
2023-04-16T20:00:23.637650
2021-04-26T12:20:27
2021-04-26T12:20:27
340,310,036
0
0
null
null
null
null
UTF-8
Java
false
false
2,173
java
package com.dxc.soapcall; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import com.hp.sk.ru.verejnost.konanie.datatypes.GetZoznamSudovRequest; import com.hp.sk.ru.verejnost.konanie.datatypes.GetZoznamSudovResponse; import com.hp.sk.ru.verejnost.konanie.datatypes.KonanieServicePort; import com.hp.sk.ru.verejnost.konanie.datatypes.KonanieServicePortService; /*NOVA MIKROSLUZBA instancia I_getZoznamSudov od providera RU*/ public class I_getZoznamSudov { private URL wsdlURL; /*vytvorim premenne pre Request aj pre Response NOVEJ MIKROSLUZBY I_getZoznamSudov*/ private GetZoznamSudovRequest GetZoznamSudovReq; private GetZoznamSudovResponse GetZoznamSudovResp; private static final QName SERVICE_NAME = new QName("datatypes.konanie.verejnost.ru.sk.hp.com", "KonanieServicePortService"); /*vytvorim novu instaciu MIKROSLUZBY I_getZoznamSudov a tiez instancie pre Request a Response*/ I_getZoznamSudov() { GetZoznamSudovReq = new GetZoznamSudovRequest(); GetZoznamSudovResp = new GetZoznamSudovResponse(); } public GetZoznamSudovResponse getGetZoznamSudovResponse() { return this.GetZoznamSudovResp; } public URL getURL() { return wsdlURL; } public void setURL(String SwsdlURL) throws MalformedURLException { this.wsdlURL = new URL(SwsdlURL); } /* funkcia na ziskanie odpovedi get...Response */ /* metody pre nastavenie parametrov na zaklade wsdl... ?? datatype GetZoznamSudovRequest neobsahuje ziadne parametre??*/ public void setGetZoznamSudovRequest(GetZoznamSudovRequest req) { this.GetZoznamSudovReq = req; } public GetZoznamSudovRequest getGetZoznamSudovRequest() { return this.GetZoznamSudovReq; } public int callService() { try { KonanieServicePortService ss = new KonanieServicePortService(wsdlURL, SERVICE_NAME); KonanieServicePort port = ss.getKonanieServicePortSoap11(); System.out.println("Invoking soapcall..."); /* this.<objekt response> = port.<nazov sluzby>(this.<objektRequestu>); */ this.GetZoznamSudovResp = port.getZoznamSudov(this.GetZoznamSudovReq); } catch (Exception e) { return 1; } return 0; } }
[ "arpi@worker01" ]
arpi@worker01
3b20d73f4988f9ba64c4a6630c05d0b85f497317
83c24be95a7d9429e12dff117621db95324dfaf5
/exercise-17/src/ExerciseSeventeen.java
d474edfb3bdc293411644b3c75325bf7875d9450
[]
no_license
iaraisle/linear-algorithm
f7188d1242390b87e9db21f076dc769ce1ca19d0
fd6b9a8aeaec96da7ca2a83c8a117b7c4137d7ec
refs/heads/master
2022-11-30T12:08:31.853197
2020-08-20T04:26:51
2020-08-20T04:26:51
282,332,444
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
// 17 – Realice el diagrama de flujo y pseudocódigo que representen el algoritmo para // determinar el promedio que obtendrá un alumno considerando que realiza tres exámenes, // de los cuales el primero y el segundo tienen una ponderación de 25%, mientras que el // tercero de 50%. import java.util.Scanner; public class ExerciseSeventeen { public static void main(String[] args) { double noteOne, noteTwo, noteThree, percentOne = 0.25, percentTwo = 0.50, noteResult; Scanner keyboard = new Scanner(System.in); System.out.print("Ingrese nota del primer examen: "); noteOne = keyboard.nextDouble(); System.out.print("Ingrese nota del segundo examen: "); noteTwo = keyboard.nextDouble(); System.out.print("Ingrese nota del tercer examen: "); noteThree = keyboard.nextDouble(); noteResult = (noteOne * percentOne) + (noteTwo * percentOne) + (noteThree * percentTwo); System.out.printf("El promedio del alumno es de %.2f", noteResult); } }
[ "iara_joana@hotmail.com" ]
iara_joana@hotmail.com
ddafa6760729ae498183342d747f07f9bdfa9221
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14263-113-3-MOEAD-WeightedSum:TestLen:CallDiversity/org/xwiki/container/servlet/filters/internal/SetHTTPHeaderFilter_ESTest_scaffolding.java
218300fb5097a4b570af3b74bf748772f8ac312a
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Apr 09 02:07:59 UTC 2020 */ package org.xwiki.container.servlet.filters.internal; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class SetHTTPHeaderFilter_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
1ca01b1f08f47ca1dc67c6cea6e108284b578065
e385fc34f6c6f3e1d047916d6add9ea2d387026c
/3.JavaCollections/task36/task3601/Controller.java
de03e6db97d03e03d1cb6e0b4d7ef804bb6b59fe
[]
no_license
vladyslavkarpovych/JavaRushTasks
096b3fc41e0201ba9a4b17174949afae5c58e972
614667a0f475e6f413b70682d15b3119139c49d6
refs/heads/master
2022-11-10T12:12:42.036676
2020-07-01T16:24:43
2020-07-01T16:24:43
275,099,070
0
0
null
null
null
null
UTF-8
Java
false
false
230
java
package com.javarush.task.task36.task3601; import java.util.List; public class Controller { Model model = new Model(); public List<String> onShowDataList() { return model.getStringDataList(); } }
[ "noreply@github.com" ]
noreply@github.com
b84f9a8f988b808b350ec9c301542206fc2e56fa
104b09ec0720bd8b097b878d29665d70af8628a1
/BatchCollector.java
f95c0b0a658d72d8c5e7cfd1f4175f9737638b6e
[ "MIT" ]
permissive
adaphi/batch-collector
b256fdd62171a9ecc7d06fca98f18f00cb8c62c4
3c892477da69a82877df2832a8105d16d49914de
refs/heads/master
2020-12-25T14:34:12.472788
2016-08-17T20:33:02
2016-08-17T20:33:02
65,938,845
0
0
null
null
null
null
UTF-8
Java
false
false
3,367
java
import java.util.*; import java.util.stream.*; import java.util.function.*; public class BatchCollector<T> implements Collector<T, Collection<Collection<T>>, Collection<Collection<T>>> { @FunctionalInterface private static interface CollectionSupplier { public <G> Collection<G> get(); } private static final CollectionSupplier defaultCollectionSupplier = ArrayList::new; private final int batchSize; // batchSupplier -> for making new batches private final CollectionSupplier batchSupplier; // batchCollectionSupplier -> for making new collections of batches private final CollectionSupplier batchCollectionSupplier; public BatchCollector(int batchSize) { this(batchSize, BatchCollector.defaultCollectionSupplier); } public BatchCollector(int batchSize, CollectionSupplier genericSupplier) { this(batchSize, genericSupplier, genericSupplier); } public BatchCollector(int batchSize, CollectionSupplier batchSupplier, CollectionSupplier batchCollectionSupplier) { this.batchSize = batchSize; this.batchSupplier = batchSupplier; this.batchCollectionSupplier = batchCollectionSupplier; } public static <T> Collector<T, ?, Collection<Collection<T>>> asBatch(int batchSize) { return new BatchCollector<T>(batchSize); } public static <T> Collector<T, ?, Collection<Collection<T>>> asBatch(int batchSize, CollectionSupplier genericSupplier) { return new BatchCollector<T>(batchSize, genericSupplier); } public static <T> Collector<T, ?, Collection<Collection<T>>> asBatch(int batchSize, CollectionSupplier batchSupplier, CollectionSupplier batchCollectionSupplier) { return new BatchCollector<T>(batchSize, batchSupplier, batchCollectionSupplier); } // Interface implementation @Override public Supplier<Collection<Collection<T>>> supplier() { return batchCollectionSupplier::get; } @Override public BiConsumer<Collection<Collection<T>>, T> accumulator() { return this::addToNextBatch; } @Override public BinaryOperator<Collection<Collection<T>>> combiner() { return this::mergeBatches; } @Override public Function<Collection<Collection<T>>, Collection<Collection<T>>> finisher() { return (c) -> c; } @Override public Set<Collector.Characteristics> characteristics() { return Collections.<Collector.Characteristics>emptySet(); } // Actual functionality private void addToNextBatch(Collection<Collection<T>> batches, T value) { batches.stream() .filter( c -> c.size() < batchSize ) .findFirst() .orElseGet(addNewBatch(batches)) .add(value); } private Supplier<Collection<T>> addNewBatch(Collection<Collection<T>> batches) { return () -> { Collection<T> batch = batchSupplier.get(); batches.add(batch); return batch; }; } private Collection<Collection<T>> mergeBatches(Collection<Collection<T>> targetBatches, Collection<Collection<T>> sourceBatches) { for (Collection<T> batch : sourceBatches) { for (T value : batch) { addToNextBatch(targetBatches, value); } }; return targetBatches; } public static void main(String[] args) { System.out.println("Default:"); IntStream.rangeClosed(1,100).boxed().collect(BatchCollector.asBatch(7)).forEach(System.out::println); System.out.println("HashSet:"); IntStream.rangeClosed(1,100).boxed().collect(BatchCollector.asBatch(7, HashSet::new)).forEach(System.out::println); } }
[ "adaphi@outlook.com" ]
adaphi@outlook.com
e337179f449bf6d7a313a01a08fe75d52dc1a09a
63ad68453a9328ca35d682b29bba0a8097941040
/hframe-common/src/main/java/com/hframework/common/frame/cache/SetCacheFactory.java
9c63fd3f7a83224c3c1ff28530bcc3280e66bb06
[]
no_license
duduniao666/hframe-trunk
0f8641fbeb583f7e83afacaf8158b2e1e847c9e9
bd54d88b18843b068d9ddba4e915909d3460c4aa
refs/heads/master
2020-07-25T18:26:39.867470
2017-07-12T06:59:45
2017-07-12T06:59:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,977
java
package com.hframework.common.frame.cache; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; public class SetCacheFactory { private static Map<String,Object> tableCacheMap=new HashMap<String, Object>();//这是一个隐藏的对应与数据库表 private static Map<String,Object> columnsSetCacheMap=new HashMap<String, Object>();//对应与form,grid private static Map<String,Object> fieldsSetCacheMap=new HashMap<String, Object>();//对应于tree,list,menu private static Map<String,Object> elementCacheMap=new HashMap<String, Object>();//源元素map,用于保存具体某一个基本单元,比如具体某一个field,select,input,等等 public static Set<String> getTableSetKey(){ Set<String> set=tableCacheMap.keySet(); return set; } public static Set<String> getColumnSetKey(){ Set<String> set=columnsSetCacheMap.keySet(); return set; } public static Set<String> getFieldSetKey(){ Set<String> set=fieldsSetCacheMap.keySet(); return set; } public static Set<String> getElementSetKey(){ Set<String> set=elementCacheMap.keySet(); return set; } public static void put(String key,Map map,String type){ if(key==null||map==null){ return; } if("table".equals(type)){ tableCacheMap.put(key, map); }else if ("fields".equals(type)) { fieldsSetCacheMap.put(key, map); }else if ("element".equals(type)) { elementCacheMap.put(key, map); }else{ columnsSetCacheMap.put(key, map); } } public static void put(String key,List elementsList,String title,String type){ Map map=new HashMap(); map.put("Title", title); if ("fields".equals(type)) { map.put("fieldsList", elementsList); }else if ("element".equals(type)) { map.put("optionList", elementsList); }else{ map.put("columnsList", elementsList); } put(key, map,type); } public static void put(String key,List elementsList,String type){ put(key,elementsList,null,type); } public static Map get(String key){ if(columnsSetCacheMap.get(key)!=null){ return (Map) columnsSetCacheMap.get(key); } if(fieldsSetCacheMap.get(key)!=null){ return (Map) fieldsSetCacheMap.get(key); } if(tableCacheMap.get(key)!=null){ return (Map) tableCacheMap.get(key); } if(elementCacheMap.get(key)!=null){ return (Map) elementCacheMap.get(key); } return null; } public static Map get(String key,String type){ if("table".equals(type)){ return (Map) tableCacheMap.get(key); }else if ("fields".equals(type)) { return (Map) fieldsSetCacheMap.get(key); }else if ("element".equals(type)) { return (Map) elementCacheMap.get(key); }else if ("columns".equals(type)){ return (Map) columnsSetCacheMap.get(key); }else { return null; } } public static Map getCacheMap() { return columnsSetCacheMap; } public static void setCacheMap(Map cacheMap) { SetCacheFactory.columnsSetCacheMap = cacheMap; } }
[ "zhangquanhong@ucfgroup.com" ]
zhangquanhong@ucfgroup.com
96aabfe6623098b3ec5ffc845ab4943458843306
0520cf71cf6e18fb18e87734dd06e59e41db65f2
/src/main/java/cn/neu/edu/wlg/ZJoffer/Offer059.java
ab077f865e9947b666fb59dd2932a1909ba528b2
[]
no_license
zheyi1996/JavaLearn
32f5293f5aa55b1261cde094df20a42275dcc77e
0663d2d75ae04ccfc38b7130808777e819b54e29
refs/heads/master
2022-12-17T22:06:09.929020
2020-09-25T12:24:59
2020-09-25T12:24:59
276,617,557
0
0
null
null
null
null
UTF-8
Java
false
false
2,588
java
package cn.neu.edu.wlg.ZJoffer; import cn.neu.edu.wlg.ZJoffer.util.TreeNode; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.Queue; /* 题目:按之字形顺序打印二叉树 思路: 在按层(每层都是从左到右)打印二叉树的基础之上加上一个奇偶判断 按层打印二叉树思路: 1. 进行二叉树的层次遍历 2. 对于每一个取出的节点都计算该节点的深度,同一深度的节点的值保存到同一个ArrayList中 计算二叉树的深度 知识点: 1.Collections.reverse(arrayList); 可以反转ArrayList中的元素 */ public class Offer059 { public ArrayList<ArrayList<Integer>> Print(TreeNode pRoot) { ArrayList<ArrayList<Integer>> results = new ArrayList<ArrayList<Integer>>(); if (null == pRoot) { return results; } Queue<TreeNode> queue = new LinkedList<>(); ArrayList<Integer> result = new ArrayList<>(); queue.add(pRoot); int i = treeDepth(pRoot); // 表明第几层 int oddEven = 0; while (!queue.isEmpty()) { TreeNode temp = queue.remove(); int deep = treeDepth(temp); if (deep == i) { result.add(temp.val); } else { --i; ArrayList<Integer> arrayList = (ArrayList<Integer>) result.clone(); if (0 == oddEven) { oddEven = 1; // arrayList = (ArrayList<Integer>) result.clone(); } else { Collections.reverse(arrayList); oddEven = 0; } results.add(arrayList); result.clear(); result.add(temp.val); } if (null != temp.left) { queue.add(temp.left); } if (null != temp.right) { queue.add(temp.right); } } if (!result.isEmpty()) { ArrayList<Integer> arrayList = (ArrayList<Integer>) result.clone(); if (1 == oddEven) { Collections.reverse(arrayList); } results.add(arrayList); } return results; } private int treeDepth(TreeNode root) { if (null == root) { return 0; } int left = treeDepth(root.left); int right = treeDepth(root.right); return (left > right ? left : right) + 1; } }
[ "305616809@qq.com" ]
305616809@qq.com
e8386a6918c03c0c6063a19b135efb2359811e1e
47d39a68a288c6f725595fed129cceead6f7af5c
/src/main/java/com/elccep/common/enity/javaObj/consumerBestRecord/derivedBestRecordList/derivedBestRecord/personalData/HobbyList.java
8d90f86429980453feea464665bdc645ee0e50b0
[]
no_license
2868463718/jsonToJavaObj
7d493dc56f5d9d886b740917dd9ffcfb289bed10
5a7734da4f050007f09a5956f885ac2390640075
refs/heads/master
2022-11-28T11:09:39.801902
2020-08-10T05:35:06
2020-08-10T05:35:06
286,384,841
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
package com.elccep.common.enity.javaObj.consumerBestRecord.derivedBestRecordList.derivedBestRecord.personalData; import java.util.List; import com.elccep.common.enity.javaObj.consumerBestRecord.derivedBestRecordList.derivedBestRecord.personalData.hobbyList.Hobby; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Data /** * @author blue7 * @date 2020-08-10 12: 01: 07: 387 **/ public class HobbyList{ private List<Hobby> hobby; }
[ "zhangyingak@digitalchina.com" ]
zhangyingak@digitalchina.com
f694a369b5bc06ea3f33efcc00951d0ba1658375
015b8a6674dbb82853232922d732f91bcfdb5921
/Java/src/CtCl6/Ch07/Q7_01_Deck_of_Cards/Suit.java
5cbea0afc4f5b56dc8769922758a1a10b406c367
[]
no_license
bh007/CtCI6
89edca3fadf94443c364687b11abeaf299c1bf96
3eb313deea3ea59e9e20f7047a67bab29371ec47
refs/heads/master
2020-03-26T17:20:04.839307
2018-08-17T19:36:37
2018-08-17T19:36:37
145,042,690
0
0
null
null
null
null
UTF-8
Java
false
false
455
java
package CtCl6.Ch07.Q7_01_Deck_of_Cards; public enum Suit { Club (0), Diamond (1), Heart (2), Spade (3); private int value; private Suit(int v) { value = v; } public int getValue() { return value; } public static Suit getSuitFromValue(int value) { switch (value) { case 0: return Suit.Club; case 1: return Suit.Diamond; case 2: return Suit.Heart; case 3: return Suit.Spade; default: return null; } } }
[ "ywhui30@gmail.com" ]
ywhui30@gmail.com
f5f4b85e26aad5c339afba3342308e81960d2e0e
33fed8652d9a95e5ff1424745a00ef6a09a0b7e7
/src/main/java/ru/gontarenko/carsharing/app/CustomerService.java
461908ef95d5f8cab66cf6b192f3277755e9d5e4
[]
no_license
luminousbrain/car-sharing
77231a39c13b60801d2b72d9615e4f41c6648ab8
1a91bb587b5188b621d80eb9c4842b274aa73a6b
refs/heads/main
2023-07-05T06:54:45.298101
2021-08-19T06:25:12
2021-08-19T06:25:12
369,824,133
0
0
null
null
null
null
UTF-8
Java
false
false
4,744
java
package ru.gontarenko.carsharing.app; import ru.gontarenko.carsharing.dao.CarDAO; import ru.gontarenko.carsharing.dao.CompanyDAO; import ru.gontarenko.carsharing.dao.CustomerDAO; import ru.gontarenko.carsharing.entity.Car; import ru.gontarenko.carsharing.entity.Company; import ru.gontarenko.carsharing.entity.Customer; import ru.gontarenko.carsharing.util.UserInput; import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; public class CustomerService { private final CarDAO carDAO; private final CustomerDAO customerDAO; private final CompanyDAO companyDAO; private Customer currentCustomer; public CustomerService(CarDAO carDAO, CustomerDAO customerDAO, CompanyDAO companyDAO) { this.carDAO = carDAO; this.customerDAO = customerDAO; this.companyDAO = companyDAO; } public void menu(Customer customer) { currentCustomer = customer; while (true) { System.out.println("\n1. Rent a car"); System.out.println("2. Return a rented car"); System.out.println("3. My rented car"); System.out.println("0. Back"); switch (UserInput.getChoiceAsString()) { case "1": rentCar(); break; case "2": returnRentedCar(); break; case "3": showRentedCar(); break; case "0": return; default: System.out.println("Wrong input!"); } } } private void rentCar() { if (currentCustomer.getRentedCarId() == null) { List<Company> companyList = companyDAO.findAll(); if (companyList.isEmpty()) { System.out.println("\nThe company list is empty!"); } else { System.out.println("\nChoose a company:"); AtomicInteger i = new AtomicInteger(1); companyList.forEach(x -> System.out.println(i.getAndIncrement() + ". " + x.getName())); System.out.println("0. Back"); Company company; try { int userInput = UserInput.getChoiceAsInteger(); if (userInput == 0) { return; } company = companyList.get(userInput - 1); List<Car> carList = carDAO.findAllNotRentedCarByCompanyId(company.getId()); if (!carList.isEmpty()) { System.out.println("\nChoose a car:"); AtomicInteger i2 = new AtomicInteger(1); carList.forEach(x -> System.out.println(i2.getAndIncrement() + ". " + x.getName())); System.out.println("0. Back"); userInput = UserInput.getChoiceAsInteger(); if (userInput == 0) { return; } Car car = carList.get(userInput - 1); currentCustomer.setRentedCarId(car.getId()); customerDAO.update(currentCustomer); System.out.println(String.format("\nYou rented '%s'", car.getName())); } else { System.out.println(String.format("\nNo available cars in the '%s' company", company.getName())); } } catch (NumberFormatException e) { System.out.println("\nWrong Input"); } } } else { System.out.println("\nYou've already rented a car!"); } } private void returnRentedCar() { if (currentCustomer.getRentedCarId() == null) { System.out.println("\nYou didn't rent a car!"); } else { currentCustomer.setRentedCarId(null); customerDAO.update(currentCustomer); System.out.println("\nYou've returned a rented car!"); } } private void showRentedCar() { if (currentCustomer.getRentedCarId() != null) { Optional<Car> byId = carDAO.findById(currentCustomer.getRentedCarId()); Car car = byId.get(); System.out.println("\nYour rented car:"); System.out.println(car.getName()); System.out.println("Company:"); Optional<Company> company = companyDAO.findById(car.getCompanyId()); company.ifPresent(x -> System.out.println(x.getName())); } else { System.out.println("\nYou didn't rent a car!"); } } }
[ "solo.kutuzov@yandex.ru" ]
solo.kutuzov@yandex.ru
6e95a70e048716dfa93a41eda1630e93f7e73fee
8cd83231140e3b53add1398b2b774da086bd2adb
/src/main/java/org/hkz/algorithm/sort/MergeSort.java
9e6628e300fdd1d5efb750ecec4ef4b4b6b29b53
[]
no_license
yldzxz/xz-algorithm
89140fb37e6d51e597ea675f6cb4bc93aeea8f6b
f844c55059240d3c2b1343313bf2f924df94fab8
refs/heads/master
2021-05-06T13:55:59.582440
2017-12-26T10:18:29
2017-12-26T10:18:29
113,293,153
0
0
null
null
null
null
GB18030
Java
false
false
856
java
package org.hkz.algorithm.sort; public class MergeSort { public static void main(String[] args) { int a[] = SortUtils.getArrays(10); //int a[] = { 9 ,18 ,7, 10, 1 ,10, 8, 9, 7, 18 }; System.out.print("排序前的数据 : "); SortUtils.print(a); System.out.print("排序后的数据 : "); mergeSort(a); SortUtils.print(a); } private static void mergeSort(int[] a) { int len = a.length; } public static int[] merge(int a[], int[] b ){ int alen = a.length; int blen = b.length; int[] c = new int[alen + blen]; int i = 0, j = 0,k=0; for (; i < alen && j < blen; ){ if (a[i] < a[j]){ c[k++] = a[i]; i++; }else { c[k++] = a[j]; j++; } } while (i < alen){ c[k++] = a[i++]; } while (j < blen){ c[k++] = a[j++]; } return c; } }
[ "741386917@qq.com" ]
741386917@qq.com
2f3efe053cf7048fb64060e3bc78e7bc0334a7f0
b8df84dd934689b7e99c19c33c7005a2c9a3558b
/src/Offer/Offer60.java
43123fd125de45972a2bd831842803a6a219492e
[]
no_license
HkunaMia/LeetCode
ce68f1715fc44d96f2b08066e6682ba1bd0f1d1a
289ef6c582ee8f2dfafd0e6761539356dc655901
refs/heads/master
2022-12-08T21:39:06.961528
2020-08-26T01:51:18
2020-08-26T01:51:18
272,737,700
0
0
null
null
null
null
UTF-8
Java
false
false
732
java
package Offer; public class Offer60 { // 扔色子的概率 public double[] twoSum(int n) { int[][] dp = new int[n+1][6*n+1]; for(int s = 1;s<=6;s++){ dp[1][s] = 1; } for (int i = 2;i<n+1;i++){ for(int j = i; j<=6*i; j++){ for(int cur=1;cur<=6;cur++){ if(j-cur<i-1){ break; } dp[i][j] += dp[i-1][j-cur]; } } } double total = Math.pow((double) 6,(double) n); double[] res = new double[5*n+1]; for(int i = n; i<=6*n; i++){ res[i-n] = (double)dp[n][i]/total; } return res; } }
[ "mzr962464@outlook.com" ]
mzr962464@outlook.com
a65f5a78a52e7ffe776c51ea94d6b6c7eb3f1d88
5b0578f22dd325f3910b3c0e312eb404fc077729
/jyhbase/src/main/java/com/yhjia/me/logger/LogLevel.java
91b16ffce350b2dbb58bb95ff712a8a358df2caf
[]
no_license
jiayonghua1988/Circle
a0e2e5765fd33c870cd35fefe256dac1dbb5f64d
5e9a645d75c662486f205680eebd9e442bc5afe7
refs/heads/master
2020-04-05T23:24:00.483481
2016-07-21T02:38:06
2016-07-21T02:38:06
62,779,393
0
1
null
null
null
null
UTF-8
Java
false
false
145
java
package com.yhjia.me.logger; public enum LogLevel { /** * Prints all logs */ FULL, /** * No log will be printed */ NONE }
[ "1048922801@qq.com" ]
1048922801@qq.com
d6997d87e99fef61531256dd7d323d9cbad5c178
dd7810b7d812e725ca74b587829162a6d1a9544f
/tarea3/src/com/example/tarea3/fragments/FragmentImages.java
6151eb698679a6c93d62e47082f026fa4978c907
[]
no_license
aliciadc/SeminarioP1
2a77e8e95a9c6aa08086412d30ea485af76ef0f1
543a977e5820d4c1cc23b9f1f7ce62a539750816
refs/heads/master
2021-01-22T05:24:41.794099
2014-05-08T04:02:47
2014-05-08T04:02:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
package com.example.tarea3.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.example.tarea3.R; public class FragmentImages extends Fragment { public final static String RESOURCE = "resourse"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_images, null); ImageView imageView =(ImageView)view.findViewById(R.id.imageView); Bundle args = getArguments(); imageView.setImageResource(args.getInt(RESOURCE)); return view; } }
[ "jorgetr@galileo.edu" ]
jorgetr@galileo.edu
b6a21161ae1e3b8b2d1d87912bf3363396ef128a
f156a6def1ce95e54f5d07ea9581ece7cf494921
/ThreadsSO.java
784dfbf0144441fcb6f581ebc8d8ea792234bacb
[]
no_license
luisadiasm/Threads
cdb62d405d0fc38b05a17f815641fa12654b9dbd
7b8d4354c5c960ea0738e803e859ec49ef0fbff8
refs/heads/master
2020-04-02T05:08:49.421491
2018-10-22T19:21:21
2018-10-22T19:21:21
154,054,671
1
0
null
null
null
null
UTF-8
Java
false
false
992
java
import java.lang.Thread; public class ThreadsSO { public static void main(String[] args) { new Thread(T1).start(); //para iniciar o thread, chama o run() new Thread(T2).start(); } //Em vez de herdar de Thread, Clock implementa a interface Runnable e implementa o método run public static Runnable T1 = new Runnable() { @Override public void run() { //especifica o comportamento do thread for (int x = 1; x < 101; x++) { System.out.println("numero: " + x); try { Thread.sleep(1 * 100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }; public static Runnable T2 = new Runnable() { @Override public void run() { for (int y = 0; y < 11; y++) { int aux = y * 10; System.out.println("contagem total: " + aux); try { Thread.sleep(1 * 1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }; }
[ "noreply@github.com" ]
noreply@github.com
33097c0cabaf026c8c50463eb410921827a374e9
6f76935a16cf928285e48f9952e6dfb9095ba039
/training/trainingrules/src/org/training/setup/TrainingrulesSystemSetup.java
6bec059420a562ef5dc742da703650cae8135287
[]
no_license
nchauhan5/Tacobell_Customer_Personalisation_POC
4f65082c2fdf9554819e96fd573543109640e6cf
0407c905e6d03a28c403ba4c3afa0587cd11442f
refs/heads/master
2021-09-01T06:21:42.745201
2017-12-25T09:38:22
2017-12-25T09:38:22
115,325,207
5
0
null
null
null
null
UTF-8
Java
false
false
1,322
java
/* * [y] hybris Platform * * Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package org.training.setup; import static org.training.constants.TrainingrulesConstants.PLATFORM_LOGO_CODE; import de.hybris.platform.core.initialization.SystemSetup; import java.io.InputStream; import org.training.constants.TrainingrulesConstants; import org.training.service.TrainingrulesService; @SystemSetup(extension = TrainingrulesConstants.EXTENSIONNAME) public class TrainingrulesSystemSetup { private final TrainingrulesService trainingrulesService; public TrainingrulesSystemSetup(final TrainingrulesService trainingrulesService) { this.trainingrulesService = trainingrulesService; } @SystemSetup(process = SystemSetup.Process.INIT, type = SystemSetup.Type.ESSENTIAL) public void createEssentialData() { trainingrulesService.createLogo(PLATFORM_LOGO_CODE); } private InputStream getImageStream() { return TrainingrulesSystemSetup.class.getResourceAsStream("/trainingrules/sap-hybris-platform.png"); } }
[ "nchauhan5@sapient.com" ]
nchauhan5@sapient.com
f87000b7e49d61a6a32b450d7c00c2ab7f1c79ac
a0dbf31feae5bac7b50936eebeca0cea20e0f9d8
/mycms-main/src/main/java/pl/codecity/main/repository/ArticleRepositoryCustom.java
584f63c8da8a87bd049c06bb6b681ca249b5efc2
[ "Apache-2.0" ]
permissive
stamich/myCms
bbfdf299acd9817e5e01cc9db3dac0d2aa35c21a
6a51e5fa7448041d34a7bda5977291da568f11ba
refs/heads/master
2020-04-05T03:23:41.773092
2019-02-06T11:18:19
2019-02-06T11:18:19
156,512,631
1
1
null
null
null
null
UTF-8
Java
false
false
476
java
package pl.codecity.main.repository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import pl.codecity.main.model.Article; import pl.codecity.main.request.ArticleSearchRequest; import java.util.List; public interface ArticleRepositoryCustom { Page<Article> search(ArticleSearchRequest request); Page<Article> search(ArticleSearchRequest request, Pageable pageable); List<Long> searchForId(ArticleSearchRequest request); }
[ "m.ski@poczta.fm" ]
m.ski@poczta.fm
32490ff9749e0fe2c9b34132a8586a896b8272d3
337eb84dd6ac3c363c54701d30015e4093520d9f
/MysqlConnection/src/com/mysql/DBConnection.java
edaa2422fdb2c56e2f2e38d28b46baf776a21156
[]
no_license
vamshi-kuchikulla/Kvk-Spring-Repo
96be5263a4bef92a1790aac2a01c6d4b7f022f42
fa4ccc1806af305e072953c650b0e292bc118d37
refs/heads/master
2022-08-04T16:29:38.365484
2018-06-11T18:53:05
2018-06-11T18:53:05
136,966,294
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package com.mysql; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class DBConnection { public static void main(String[] args) { Connection con = null; try { SingeltonDBConnection db = SingeltonDBConnection.getInstance(); con = db.getConnection(); System.out.println("Connention Established !!!!!!!!"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from test.emp"); while (rs.next()) System.out.println("Employee : " + rs.getInt(1) + " , " + rs.getString(2) + " , " + rs.getInt(3)); rs.close(); } catch (SQLException e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
[ "vamshi.kuchikulla@gmail.com" ]
vamshi.kuchikulla@gmail.com
87dccc2b5a18452161fd648155fcc31c93d76fe1
d31e8ed7fab0b16a1161ec375f4de220124980f8
/src/main/java/com/example/paydashlookup/api/PaydashApi.java
b9731ec3d5fda4337cac6ea1f4e4e3d6003c5dd6
[]
no_license
puskr23/lookup
1f3b39fae2677db1e196d11c3b9e3bbe7b4df4ff
0fdf1aac782ed0cfb4a99f88a152d44c54975681
refs/heads/master
2023-01-30T06:08:22.672653
2020-12-07T07:23:24
2020-12-07T07:23:24
319,234,293
0
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package com.example.paydashlookup.api; import java.util.HashMap; import java.util.Map; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; @Component public class PaydashApi { final String url = "http://api1.pareva.umelimited.com:8080/rest/UtilityServices/msisdn-lookup/paydash"; final String username = "raj"; final String password = "raj"; private static final String AUTHORIZATION_TOKEN = "cmFqOnJhag=="; public String getOperator(String msisdn) { Map<String, String> parameters = new HashMap(); parameters.put("username", "red"); parameters.put("password", "KHND-jr56-KJH"); parameters.put("msisdn", msisdn); RestTemplate rest = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON_VALUE); headers.add("Authorization", "Basic " + AUTHORIZATION_TOKEN); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url); HttpEntity<?> entity = new HttpEntity(parameters, headers); ResponseEntity<PaydashResponse> response = rest.exchange(builder.toUriString(), HttpMethod.POST, entity, PaydashResponse.class); PaydashResponse a = response.getBody(); return a.getOperator(); } }
[ "puskr23@gmail.com" ]
puskr23@gmail.com
5ab58ef8ba0d74cb0321f32c921fb4a48edf38dd
abdb9b2ede104e214b2f9475f06d882d138852c2
/hbrain/src/main/java/com/haizhi/dao/BiddingPriceDao.java
578325abd2772787a73a1217bcc82e7411a01fff
[]
no_license
sunny19930321/java
1598da9eaf41ec6ff602debcdb444e0e493ef8f0
f346da5579bd34d22f7864af2c98c131fc3eb9b2
refs/heads/master
2021-09-01T09:37:41.175745
2017-12-26T08:36:47
2017-12-26T08:36:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,228
java
package com.haizhi.dao; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @Mapper public interface BiddingPriceDao { //查询物料历史中标信息总数 @Select("<script>select count(*) as count from " + "record_bidding where 1=1" + "<if test='category != null'>" + " and category = #{category}" + "</if>" + "<if test='orderedItem != null'>" + " and hbrainCategory = #{orderedItem}" + "</if>" + "<if test='itemCondition != null'>" + " and itemCondition = #{itemCondition}" + "</if>" + "<if test='customer != null'>" + " and customer = #{customer}" + "</if>" + "</script>") HashMap<String, String> historyBiddingCountQuery(HashMap<String, Object> paramMap); //查询物料历史中标信息,带翻页,每页5条 @Select("<script>select seller,unitText, totalUnit, totalPrice, price, orderDate from record_bidding where 1 = 1" + "<if test='category != null'>" + " and category = #{category}" + "</if>" + "<if test='orderedItem != null'>" + " and hbrainCategory = #{orderedItem}" + "</if>" + "<if test='itemCondition != null'>" + " and itemCondition = #{itemCondition}" + "</if>" + "<if test='customer != null'>" + " and customer = #{customer}" + "</if>" + " order by orderDate desc" + "<if test='pageStart != null'>" + " limit #{pageStart}, 5" + "</if>" + "</script>") List<HashMap<String, Object>> historyBiddingQuery(HashMap<String, Object> paramMap); //查询物料所有的历史中标信息 @Select("<script>select seller, totalUnit, totalPrice, price, orderDate from record_bidding where 1 = 1" + "<if test='category != null'>" + " and category = #{category}" + "</if>" + "<if test='orderedItem != null'>" + " and hbrainCategory = #{orderedItem}" + "</if>" + "<if test='itemCondition != null'>" + " and itemCondition = #{itemCondition}" + "</if>" + "<if test='customer != null'>" + " and customer = #{customer}" + "</if>" + " order by orderDate asc" + "</script>") List<HashMap<String, Object>> historyBiddingQueryAll(HashMap<String, Object> paramMap); //------------------------------------------------------筛选条件start---------------------- //根据分类名称查找该分类下"firstLetter"开头的物料名称 @Select("<script>" + "select distinct orderedItem from bidding_condition where category = #{category}" + "</script>") ArrayList<HashMap<String, String>> selectBiddingItemByCategory(HashMap<String, String> paramMap); //根据以上检索条件检索查找中标物料规格 @Select("<script>select distinct itemCondition from bidding_condition where " + " category = #{category}" + " and orderedItem = #{orderedItem}"+ "</script>") ArrayList<HashMap<String, String>> selectBiddingCondition(HashMap<String, String> paramMap); //根据以上检索条件检索查找中标物料使用企业 @Select("<script>select distinct customer from bidding_condition where " + " category = #{category}" + " and orderedItem = #{orderedItem}"+ "<if test='itemCondition != null'>" + " and itemCondition = #{itemCondition}" + "</if>" + "</script>") ArrayList<HashMap<String, String>> selectBiddingCustomer(HashMap<String, String> paramMap); //查询物料对应的历史中标信息,市场价格信息,中标预估信息 @Select("<script>select orderDate, price, m_price, lasso from bidding_price_fitting where 1 = 1" + "<if test='category != null'>" + " and category = #{category}" + "</if>" + "<if test='orderedItem != null'>" + " and hbrainCategory = #{orderedItem}" + "</if>" + "<if test='itemCondition != null'>" + " and itemCondition = #{itemCondition}" + "</if>" + "<if test='customer != null'>" + " and customer = #{customer}" + "</if>" + " order by orderDate asc" + "</script>") List<HashMap<String, Object>> marketHistoryForecastQuery(HashMap<String, Object> paramMap); //查询物料历史中标预估记录信息 @Select("<script>select orderDate, hbrainCategory, lasso, status, customer, itemCondition from record_bidding_forecasting where forecast_flag = '1'" + " order by orderDate desc" + " limit 0, 3" + "</script>") List<HashMap<String, Object>> historyBiddingForecastQuery(); // @Select("INSERT INTO user(name, age) VALUES (#{name}, #{age})") // void insert(User user); }
[ "923976094@qq.com" ]
923976094@qq.com
42fd158eddb530552ee6dfc2cc8869ebb5d44c39
36f3a715b233bb2952c405a76d4f4ebe4105bd3a
/Spring/SimpleServlet/src/com/jcaga/service/WelcomeService.java
14d8994f1bac64ebca1fed70d1fa00d423c996a5
[ "Apache-2.0" ]
permissive
Lucka256/ProgrammingBook
3bdc3b7eba847cd85fd050cd683ff28d0601df3d
1ffd1f3f835a0cdc846e64ea4bbbf6c271e85f1f
refs/heads/master
2022-04-09T18:30:19.968781
2020-03-02T15:23:31
2020-03-02T15:23:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.jcaga.service; import java.util.ArrayList; import java.util.List; public class WelcomeService { public List<String> getWelcomeMessages(String name){ List<String> result = new ArrayList<>(); // Add data to the list result.add("Hello"); result.add(name); result.add(" , welcome to the Spring course. :-)"); return result; } }
[ "jcaga@freelancedevelop.eu" ]
jcaga@freelancedevelop.eu
74c243939038e6ae43c395ed67ec003b360c93d3
dc9cb9d1545468da69a87f1ef744276f7709a288
/app/src/main/java/com/riwise/aging/info/sqlInfo/AdminInfo.java
a4e5076719f0faac0ec2d02556ab34b30ca43fea
[]
no_license
tindream/Android.AgingTest
75a169a2ad32634fbd9a30e9496b640a1dd4bebb
7e48c9c35d7a26dd6159aef139b96d6eaa8f679b
refs/heads/master
2022-11-12T01:23:49.474700
2019-05-06T05:43:41
2019-05-06T05:43:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package com.riwise.aging.info.sqlInfo; import java.util.Date; import com.riwise.aging.data.SQLiteServer; import com.riwise.aging.support.Config; public class AdminInfo { public int Version = 0; public String Images; public String Audios; public String Videos; public String Apps; public String File4s; public byte[] File4sf; public String File8s; public byte[] File8sf; public String File128s; public byte[] File128sf; }
[ "tinn@959d4b5e-b010-b042-88fa-26a3fb3b00db" ]
tinn@959d4b5e-b010-b042-88fa-26a3fb3b00db
177f24bc4c4912f2b8c0fff7b1101eec8e4321da
b46e41d2f4e63e77d94889dedffca2eb93701fb6
/security-service/security-server/src/main/java/cn/linkmore/security/service/impl/DictGroupServiceImpl.java
5d5bcec0c85d7e8dbc333ec9b5657507d1c11532
[]
no_license
gaofeifan/linkemore
f2ec16d34ccdb073278031fd3508246bf05006d9
562b331a26be0059a207dba7094646cd53f831b1
refs/heads/master
2023-03-30T10:53:29.914763
2019-06-20T08:10:19
2019-06-20T08:10:19
197,494,665
1
2
null
2023-03-22T21:27:09
2019-07-18T02:15:13
Java
UTF-8
Java
false
false
3,098
java
package cn.linkmore.security.service.impl; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.linkmore.bean.view.ViewFilter; import cn.linkmore.bean.view.ViewPage; import cn.linkmore.bean.view.ViewPageable; import cn.linkmore.security.dao.cluster.DictGroupClusterMapper; import cn.linkmore.security.dao.master.DictGroupMasterMapper; import cn.linkmore.security.entity.DictGroup; import cn.linkmore.security.request.ReqCheck; import cn.linkmore.security.request.ReqDictGroup; import cn.linkmore.security.response.ResDictGroup; import cn.linkmore.security.service.DictGroupService; import cn.linkmore.util.DomainUtil; import cn.linkmore.util.ObjectUtils; /** * Service实现类 -权限模块 - 字典分类信息 * @author jiaohanbin * @version 2.0 * */ @Service public class DictGroupServiceImpl implements DictGroupService { @Autowired private DictGroupClusterMapper dictGroupClusterMapper; @Autowired private DictGroupMasterMapper dictGroupMasterMapper; @Override public Integer check(ReqCheck reqCheck) { Map<String,Object> param = new HashMap<String,Object>(); param.put("property", reqCheck.getProperty()); param.put("value", reqCheck.getValue()); param.put("id", reqCheck.getId()); return this.dictGroupClusterMapper.check(param); } @Override public ViewPage findPage(ViewPageable pageable) { Map<String,Object> param = new HashMap<String,Object>(); List<ViewFilter> filters = pageable.getFilters(); if(StringUtils.isNotBlank(pageable.getSearchProperty())) { param.put(pageable.getSearchProperty(), pageable.getSearchValue()); } if(filters!=null&&filters.size()>0) { for(ViewFilter filter:filters) { param.put(filter.getProperty(), filter.getValue()); } } if(StringUtils.isNotBlank(pageable.getOrderProperty())) { param.put("property", DomainUtil.camelToUnderline(pageable.getOrderProperty())); param.put("direction", pageable.getOrderDirection()); } Integer count = this.dictGroupClusterMapper.count(param); param.put("start", pageable.getStart()); param.put("pageSize", pageable.getPageSize()); List<ResDictGroup> list = this.dictGroupClusterMapper.findPage(param); return new ViewPage(count,pageable.getPageSize(),list); } @Override public int save(ReqDictGroup resDictGroup) { DictGroup dictGroup = new DictGroup(); dictGroup = ObjectUtils.copyObject(resDictGroup, dictGroup); dictGroup.setCreateTime(new Date()); return this.dictGroupMasterMapper.save(dictGroup); } @Override public int update(ReqDictGroup resDictGroup) { DictGroup dictGroup = new DictGroup(); dictGroup = ObjectUtils.copyObject(resDictGroup, dictGroup); return this.dictGroupMasterMapper.update(dictGroup); } @Override public int delete(List<Long> ids) { return this.dictGroupMasterMapper.delete(ids); } }
[ "jiaohanbin@papayixing.com" ]
jiaohanbin@papayixing.com
f6c59f1077bae043ff7013349d4e14259314c422
1e4d7a89b3c8193a26dd9ac4a5d927c355efaf6e
/spring-boot-demo-swagger/src/main/java/com/xkcoding/swagger/config/Swagger2Config.java
b163cef5c68a4ec93921ecc467bb9a880c0fffea
[ "MIT" ]
permissive
daQzi/spring-boot-demo
27d44518f9978039b6c011e020ef4e88a5814455
d15907a8357653ed0e1f117cdf8d704470253c80
refs/heads/master
2022-07-26T04:54:01.055635
2019-06-06T11:04:49
2019-06-06T11:04:49
183,128,317
2
0
MIT
2022-06-21T01:05:26
2019-04-24T02:06:24
Java
UTF-8
Java
false
false
1,574
java
package com.xkcoding.swagger.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * <p> * Swagger2 配置 * </p> * * @package: com.xkcoding.swagger.config * @description: Swagger2 配置 * @author: wangzw * @date: Created in 2018-11-29 11:14 * @copyright: Copyright (c) 2018 * @version: V1.0 * @modified: wangzw */ @Configuration @EnableSwagger2 public class Swagger2Config { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.xkcoding.swagger.controller")) .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder().title("spring-boot-demo") .description("这是一个简单的 Swagger API 演示") .contact(new Contact("Yangkai.Shen", "http://xkcoding.com", "237497819@qq.com")) .version("1.0.0-SNAPSHOT") .build(); } }
[ "1094272364@qq.com" ]
1094272364@qq.com
d3c6d162b0a0e87551e9f716e85859620a52356e
9112e1fafd5aaf115ea3afede27a6b43201c5dfb
/src/main/java/br/com/qosdesenvolvimentos/model/Permissao.java
9baa48962245b09cef753471c5f1b638091ea91c
[]
no_license
carlosmeloti/bacamoney-api
6ee2f3090313e96b12852f4cb222d7933fdb6598
5cb21558de95acbbfe48fed3a0c26e77be939993
refs/heads/master
2020-04-11T18:13:59.502474
2018-12-25T12:11:16
2018-12-25T12:11:16
161,990,729
0
0
null
null
null
null
UTF-8
Java
false
false
1,035
java
package br.com.qosdesenvolvimentos.model; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "permissao") public class Permissao { @Id private Long codigo; private String descricao; public Long getCodigo() { return codigo; } public void setCodigo(Long codigo) { this.codigo = codigo; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Permissao other = (Permissao) obj; if (codigo == null) { if (other.codigo != null) return false; } else if (!codigo.equals(other.codigo)) return false; return true; } }
[ "carlosmeloti@gmail.com" ]
carlosmeloti@gmail.com
457f14c8504c305d180b1f444e7bcf1966ce9aa6
9453b2d5b3cfd02027fade7ec948143f0777e9f1
/pinyougou-web/pinyougou-manager-web/src/main/java/com/pinyougou/manager/controller/BrandController.java
ce72acd84d2fada553d9b6c45cbb3df23fdda450
[]
no_license
liuxiaoqiang01/pinyougou
89fa2837bd8881937b723d7c5684b731ec3e9330
21090fdaa3ce8d64b1c426399234a965c636a4e0
refs/heads/master
2020-04-13T13:23:47.102529
2018-12-26T09:26:17
2018-12-26T09:26:17
163,228,707
2
0
null
null
null
null
UTF-8
Java
false
false
835
java
package com.pinyougou.manager.controller; import com.alibaba.dubbo.config.annotation.Reference; import com.pinyougou.pojo.Brand; import com.pinyougou.service.BrandService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @Package: com.pinyougou.manager.controller * @ClassName: CLASS_NAME * @Description: TODO(这里用一句话描述这个类的作用) * @Author: LiuXiaoQiang * @Date: Created in 2018/12/26 0026 时间: 11:27 * < > **/ @RestController public class BrandController { // 注入service @Reference(timeout = 10000) private BrandService brandService; /*查询全部品牌*/ @GetMapping("/brand/findAll") public List<Brand> findAll(){ return brandService.findAll(); } }
[ "liuxiaoqiang@itcast.cn" ]
liuxiaoqiang@itcast.cn
1d5c1bcaba6c36df5086c51f8fb3f5ae3852fb7b
ca8df73191b8f3a5eba2bd30c9b1f8844e0d95b7
/src/main/java/com/example/examen/repository/PacienteRepository.java
ba51703d70d199c89365b6d8f38068d5fdaaae9e
[]
no_license
Ariana3-cmd/Examen_Parcial_lp2
26104f618855e1ae1684f94d76f81d23c41d4371
ecd7b26b879913ca1915913b08e77a4d66ea48b3
refs/heads/master
2023-08-20T04:51:26.049677
2021-09-28T01:40:43
2021-09-28T01:40:43
411,092,289
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package com.example.examen.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.example.examen.model.Paciente; @Repository public interface PacienteRepository extends JpaRepository<Paciente, Long>{ }
[ "arianavillava@upeu.edu.pe" ]
arianavillava@upeu.edu.pe
1cb43c8972fe5cff1c7b88834f88461e7a740b39
10659065ca7f27c6c53399346f8fbe8264619dc4
/app/src/main/java/com/muscu/benjamin/muscu/LesTypesExercicesActivity.java
d3de2a1c05cc30bcb4571f5e1eb1e5bedd399310
[]
no_license
Snake4100/Muscu
950c51b267bcb583017f68e16df4d97e3ab078f8
a07a47847db549b385e34c67f7af620c3f1ddaf6
refs/heads/master
2021-01-25T05:35:55.868615
2015-10-22T19:24:01
2015-10-22T19:24:01
28,610,482
0
0
null
null
null
null
UTF-8
Java
false
false
5,064
java
package com.muscu.benjamin.muscu; import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TableLayout; import android.widget.TableRow; import com.muscu.benjamin.muscu.DAO.TypeExerciceDAO; import com.muscu.benjamin.muscu.Entity.TypeExercice; import java.util.ArrayList; public class LesTypesExercicesActivity extends Activity { ArrayAdapter<TypeExercice> typeExerciceArrayAdapter; TypeExerciceDAO daoTypeExercice; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_les_types_exercices); this.setTitle(R.string.exercices_text); this.daoTypeExercice = new TypeExerciceDAO(this.getBaseContext()); this.daoTypeExercice.open(); //on initilisale la list des types d'exercice ListView listExercices = (ListView) findViewById(R.id.listView_exercices); this.typeExerciceArrayAdapter = new ArrayAdapter<TypeExercice>(this, android.R.layout.simple_list_item_1, new ArrayList<TypeExercice>()); listExercices.setAdapter(this.typeExerciceArrayAdapter); listExercices.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(LesTypesExercicesActivity.this, TypeExerciceActivity.class); intent.putExtra("typeExercice",LesTypesExercicesActivity.this.typeExerciceArrayAdapter.getItem(position)); startActivity(intent); } }); listExercices.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { LesTypesExercicesActivity.this.alertSuppressionTypeExercice(LesTypesExercicesActivity.this.typeExerciceArrayAdapter.getItem(position)); return true; } }); //On initialise le bouton de création Button bouton_creer = (Button) findViewById(R.id.button_creerTypeExercice); bouton_creer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LesTypesExercicesActivity.this, TypeExerciceActivity.class); startActivity(intent); } }); } @Override protected void onResume() { super.onResume(); this.miseAjoursListeTypeExercice(); } private void miseAjoursListeTypeExercice() { this.typeExerciceArrayAdapter.clear(); this.typeExerciceArrayAdapter.addAll(this.daoTypeExercice.getAll()); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void alertSuppressionTypeExercice(final TypeExercice typeExercice){ AlertDialog.Builder builderSingle = new AlertDialog.Builder(LesTypesExercicesActivity.this); builderSingle.setIcon(R.drawable.ic_launcher); builderSingle.setTitle("Suppression de l'exercice "+typeExercice.getNom()); //Boutton pour annuler la suppression builderSingle.setNegativeButton("Annuler", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); //Boutton pour supprimer builderSingle.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { LesTypesExercicesActivity.this.daoTypeExercice.supprimer(typeExercice.getId()); LesTypesExercicesActivity.this.miseAjoursListeTypeExercice(); dialog.dismiss(); } }); builderSingle.show(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_exercices, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "msn.neilzb@hotmail.fr" ]
msn.neilzb@hotmail.fr