blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
330e974a8cdc35146e7337637d298961a969ac72 | cfd19cdabb61608bdb5e9b872e840305084aec07 | /SmartUniversity/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativeStatusBarManagerIOSSpec.java | d6391740bbd55aef381ef3a15947555716c3b35d | [
"MIT"
] | permissive | Roshmar/React-Native | bab2661e6a419083bdfb2a44af26d40e0b67786c | 177d8e47731f3a0b82ba7802752976df1ceb78aa | refs/heads/main | 2023-06-24T17:33:00.264894 | 2021-07-19T23:01:12 | 2021-07-19T23:01:12 | 387,580,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | version https://git-lfs.github.com/spec/v1
oid sha256:53673bd91fdc335373e3225efa841ea3c341ec5b57d4e486051325d79dcc18b5
size 2764
| [
"martin.roshko@student.tuke.sk"
] | martin.roshko@student.tuke.sk |
f81b82d2723dcaf77e247bf90e7cb1a22e5cb12a | 824ec8193c9048f71a99fe8a6b5af8a967f51e0b | /app/src/main/java/com/qupp/client/ui/view/activity/mine/setting/ChangePhoneActivity.java | da2ae6b2560e7af01be5150aad02eb8902ceaf7d | [] | no_license | wllysx/qupaipai | 4469d8a89d106a78220a7498e9c4cdf20f901ad6 | 8ee0605af6f29b9f63026acf244c3ecc16bfc801 | refs/heads/master | 2022-11-19T06:16:06.444214 | 2020-07-20T06:49:57 | 2020-07-20T06:49:57 | 281,039,124 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,793 | java | package com.qupp.client.ui.view.activity.mine.setting;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.qupp.client.MyApplication;
import com.qupp.client.R;
import com.qupp.client.ui.view.activity.BaseActivity;
import com.qupp.client.utils.DoubleClick;
import com.qupp.client.utils.TimeCount1;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ChangePhoneActivity extends BaseActivity {
@BindView(R.id.et_phone)
EditText etPhone;
@BindView(R.id.et_code)
EditText etCode;
@BindView(R.id.linear)
LinearLayout linear;
@BindView(R.id.bt_login)
TextView btLogin;
@BindView(R.id.iv_close)
ImageView ivClose;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.tv_code)
TextView tvCode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting_changephone);
ButterKnife.bind(this);
linear.setPadding(0, MyApplication.getStateBar(ChangePhoneActivity.this), 0, 0);
setStateColor(false);
initView();
}
private void initView() {
etPhone.addTextChangedListener(textWatcher);
etCode.addTextChangedListener(textWatcher);
tvTitle.setText("更换手机号");
}
TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String content = etPhone.getText().toString().trim();
if (TextUtils.isEmpty(content)) {
ivClose.setVisibility(View.GONE);
} else {
ivClose.setVisibility(View.VISIBLE);
}
/* if (!TextUtils.isEmpty(etPhone.getText()) && !TextUtils.isEmpty(etCode.getText())) {
btLogin.setClickable(true);
btLogin.setEnabled(true);
btLogin.setBackgroundResource(R.drawable.bg_login_enable);
} else {
btLogin.setClickable(false);
btLogin.setEnabled(false);
btLogin.setBackgroundResource(R.drawable.bg_login_unable);
}*/
}
};
public static void startActivityInstance(Activity activity) {
activity.startActivity(new Intent(activity, ChangePhoneActivity.class));
}
@Override
protected void onRestart() {
super.onRestart();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@OnClick({R.id.bt_login, R.id.iv_close, R.id.back, R.id.tv_code})
public void onViewClicked(View view) {
if (DoubleClick.isFastDoubleClick()) {
return;
}
switch (view.getId()) {
case R.id.bt_login:
finish();
break;
case R.id.iv_close:
etPhone.setText("");
break;
case R.id.back:
finish();
break;
case R.id.tv_code:
TimeCount1 time = new TimeCount1(60000, 1000, tvCode, "获取验证码");
time.start();
break;
}
}
}
| [
"230869192@qq.com"
] | 230869192@qq.com |
46c6cfdbce5762b18b024112beb2149ecb2ed3bb | 59c2be2000ebffc1dffd517a01a2cac84b6ec16d | /src/com/bluemobi/dao/ams/AmsArchivesAllDao.java | 8da73f6232e314d6b536e2c262d7b940443a95da | [] | no_license | wuxinda/bis_app | 7f67f65d725dada1134bee5003315da7396cdf32 | a115a6caa7d19f0bd320bb514192f0cedf691b57 | refs/heads/master | 2020-03-28T01:05:44.033131 | 2018-09-10T06:08:04 | 2018-09-10T06:08:04 | 147,476,565 | 2 | 0 | null | 2018-09-10T06:08:05 | 2018-09-05T07:19:12 | JavaScript | UTF-8 | Java | false | false | 4,017 | java | package com.bluemobi.dao.ams;
import java.util.List;
import java.util.Map;
import com.appcore.dao.MyBatisBaseDao;
/**
* 【档案详情表】 数据访问对象 接口
*
* @author AutoCode 309444359@qq.com
* @date 2016-11
*
*/
public interface AmsArchivesAllDao extends MyBatisBaseDao {
/**
* 获取档案操作统计数据
* @param map
* @return
*/
List<Map<String,Object>> selectActStatis(Map<String,Object> map);
/**
* 获取档案在库状态统计数据
* @param map
* @return
*/
List<Map<String,Object>> selectInflagStatis(Map<String,Object> map);
/**
* 获取档案保密等级统计数据
* @param map
* @return
*/
List<Map<String,Object>> selectSecurityStatis(Map<String,Object> map);
/**
* 获取档案保管年限统计数据
* @param map
* @return
*/
List<Map<String,Object>> selectKeepyearStatis(Map<String,Object> map);
/**
* 获取档案组卷方式统计数据
* @param map
* @return
*/
List<Map<String,Object>> selectAmsTypeStatis(Map<String,Object> map);
/**
* 获取档指定档案类型数量
* @param map
* @return
*/
Integer selectAmsStatusCount(Map<String,Object> map);
/**
* 根据Id批量更新档案状态
* @param map
* @return
*/
Integer updateAmsArchivesStatus(Map<String,Object> map);
/**
* 取消申请跟新档案
* @param map
* @return
*/
Integer taskCancelUpdate(Map<String,Object> map);
/**
* 获取档案统计按库房分组
* @param map
* @return
*/
List<Map<String,Object>> selectAmsgroupByStore(Map<String,Object> map);
/**
* 通过档案号查询申请单档案列表3.1
* @param map
* @return
*/
List<Map<String,Object>> selectAmsListByArchiveno(Map<String,Object> map);
/**
* 根据档案id更新档案在库数量
* @param map type:0加1;1减1
* @return
* @author huangzuoguo
* @date 2017年7月20日
*
*/
void updateAmsNowNumber(Map<String,Object> map);
/**
*
* 查询档案总量
* @return
*/
Map<String,Object> getCountAms(Map<String,Object> map);
/**
*
* 档案查询列表
* @return
*/
List<Map<String,Object>> getArchives(Map<String,Object> map);
/**
*
* 按档案类型查询总量
* @return
*/
List<Map<String,Object>> getArchivesCount(Map<String,Object> map);
/**
*
* 按在库状态查询总量
* @return
*/
List<Map<String,Object>> getInflagCount(Map<String,Object> map);
/**
*
* 案卷号查询
* @return
*/
List<Map<String,Object>> getArchivesQzh(Map<String,Object> map);
/**
*
* 按档案号和档案类型查询档案
* @return
*/
Map<String,Object> findArchivesByNoAndType(Map<String,Object> map);
/**
*
* 档案搜索
* @return
*/
List<Map<String,Object>> searchArchives(Map<String,Object> map);
/**
*
* 档案图表
* @return
*/
List<Map<String,Object>> selectStrore(Map<String,Object> map);
/**
*
* 档案在架图表
* @return
*/
List<Map<String,Object>> selectInflag(Map<String,Object> map);
/**
*
* 档案搜索
* @return
*/
int searchArchivesCount(Map<String,Object> map);
/**
*
* 档案搜索
* @return
*/
List<Map<String,Object>> selectArchivesListFroPlace(Map<String,Object> map);
/**
*
* 档案搜索
* @return
*/
int getArchiveYearAdd(Map<String,Object> map);
/**
*
* 档案搜索首页
* @return
*/
List<Map<String,Object>> indexFindArchives(Map<String,Object> map);
/**
*
* 档案搜索条数统计
* @return
*/
int indexFindArchivesCount(Map<String,Object> map);
}
| [
"826054177@qq.com"
] | 826054177@qq.com |
f3e3a304b2fd2f35dcd653b5af2edfaf2ddfbf28 | 0e1780ddc894314dd19b3c90294057a402c4de52 | /Dynamic Programming/MaxSubarray.java | 340e5c0adf32c84a1f858c4904554f66a14d2c79 | [] | no_license | gaggudeep/codes | 397cc746dbf884d1ef81ccded13ec85e2c0a1400 | fcff9d61413ce302acc599321668c4f7e571307b | refs/heads/master | 2023-04-09T19:26:22.319158 | 2021-04-13T07:07:05 | 2021-04-13T07:07:05 | 286,741,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | class MaxSubarray {
public static int maxSubArray(int[] A) {
int maxSumSoFar = A[0], maxEndingHere = A[0];
for(int i = 1 ; i < A.length ; i++)
{
maxEndingHere = Math.max(A[i], maxEndingHere + A[i]);
maxSumSoFar = Math.max(maxSumSoFar, maxEndingHere);
}
return maxSumSoFar;
}
} | [
"gagandeepsinghjubbal@gmail.com"
] | gagandeepsinghjubbal@gmail.com |
8af8d79a82e4c866fa49aa0f29a4898566b57a23 | 1944dfba95ced46450e7024efcb193b67df26510 | /src/main/java/com/enginemobi/bssuite/domain/QuoteLineItem.java | f9cedf6cf1d953c0199c7fd0474949cad35b0d02 | [
"Apache-2.0"
] | permissive | gitter-badger/bssuite | d13ee568ac2a44f6080c4e4406001ff8941ce152 | c1bbd09b116eba54ee85c699538eeb8fe66b5fb9 | refs/heads/develop-0.3.x | 2021-01-19T19:22:44.549072 | 2015-11-06T08:59:50 | 2015-11-06T08:59:50 | 45,677,252 | 0 | 0 | null | 2015-11-06T11:06:21 | 2015-11-06T11:06:21 | null | UTF-8 | Java | false | false | 6,229 | java | package com.enginemobi.bssuite.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A QuoteLineItem.
*/
@Entity
@Table(name = "quote_line_item")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName="quotelineitem")
public class QuoteLineItem implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "description")
private String description;
@Column(name = "cost", precision=10, scale=2)
private BigDecimal cost;
@Column(name = "sold_for", precision=10, scale=2)
private BigDecimal soldFor;
@Column(name = "qty_quoted")
private Double qtyQuoted;
@Column(name = "discount_price_group_code")
private String discountPriceGroupCode;
@Column(name = "total_tax_charge", precision=10, scale=2)
private BigDecimal totalTaxCharge;
@Column(name = "discount_percentage", precision=10, scale=2)
private BigDecimal discountPercentage;
@Column(name = "line_no")
private Integer lineNo;
@Column(name = "list_price", precision=10, scale=2)
private BigDecimal listPrice;
@Column(name = "list_price_discount", precision=10, scale=2)
private BigDecimal listPriceDiscount;
@Column(name = "cost2", precision=10, scale=2)
private BigDecimal cost2;
@Column(name = "is_hidden")
private Boolean isHidden;
@Column(name = "ref1")
private String Ref1;
@Column(name = "ref2")
private String Ref2;
@ManyToOne
private Quote quote;
@ManyToOne
private Product product;
@ManyToOne
private TaxTable taxRate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public BigDecimal getCost() {
return cost;
}
public void setCost(BigDecimal cost) {
this.cost = cost;
}
public BigDecimal getSoldFor() {
return soldFor;
}
public void setSoldFor(BigDecimal soldFor) {
this.soldFor = soldFor;
}
public Double getQtyQuoted() {
return qtyQuoted;
}
public void setQtyQuoted(Double qtyQuoted) {
this.qtyQuoted = qtyQuoted;
}
public String getDiscountPriceGroupCode() {
return discountPriceGroupCode;
}
public void setDiscountPriceGroupCode(String discountPriceGroupCode) {
this.discountPriceGroupCode = discountPriceGroupCode;
}
public BigDecimal getTotalTaxCharge() {
return totalTaxCharge;
}
public void setTotalTaxCharge(BigDecimal totalTaxCharge) {
this.totalTaxCharge = totalTaxCharge;
}
public BigDecimal getDiscountPercentage() {
return discountPercentage;
}
public void setDiscountPercentage(BigDecimal discountPercentage) {
this.discountPercentage = discountPercentage;
}
public Integer getLineNo() {
return lineNo;
}
public void setLineNo(Integer lineNo) {
this.lineNo = lineNo;
}
public BigDecimal getListPrice() {
return listPrice;
}
public void setListPrice(BigDecimal listPrice) {
this.listPrice = listPrice;
}
public BigDecimal getListPriceDiscount() {
return listPriceDiscount;
}
public void setListPriceDiscount(BigDecimal listPriceDiscount) {
this.listPriceDiscount = listPriceDiscount;
}
public BigDecimal getCost2() {
return cost2;
}
public void setCost2(BigDecimal cost2) {
this.cost2 = cost2;
}
public Boolean getIsHidden() {
return isHidden;
}
public void setIsHidden(Boolean isHidden) {
this.isHidden = isHidden;
}
public String getRef1() {
return Ref1;
}
public void setRef1(String Ref1) {
this.Ref1 = Ref1;
}
public String getRef2() {
return Ref2;
}
public void setRef2(String Ref2) {
this.Ref2 = Ref2;
}
public Quote getQuote() {
return quote;
}
public void setQuote(Quote quote) {
this.quote = quote;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public TaxTable getTaxRate() {
return taxRate;
}
public void setTaxRate(TaxTable taxTable) {
this.taxRate = taxTable;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
QuoteLineItem quoteLineItem = (QuoteLineItem) o;
if ( ! Objects.equals(id, quoteLineItem.id)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "QuoteLineItem{" +
"id=" + id +
", description='" + description + "'" +
", cost='" + cost + "'" +
", soldFor='" + soldFor + "'" +
", qtyQuoted='" + qtyQuoted + "'" +
", discountPriceGroupCode='" + discountPriceGroupCode + "'" +
", totalTaxCharge='" + totalTaxCharge + "'" +
", discountPercentage='" + discountPercentage + "'" +
", lineNo='" + lineNo + "'" +
", listPrice='" + listPrice + "'" +
", listPriceDiscount='" + listPriceDiscount + "'" +
", cost2='" + cost2 + "'" +
", isHidden='" + isHidden + "'" +
", Ref1='" + Ref1 + "'" +
", Ref2='" + Ref2 + "'" +
'}';
}
}
| [
"smaxllimit@gmail.com"
] | smaxllimit@gmail.com |
87a31cb82a12399a5ae383efcda288bdb37431d5 | e43828e54aa956f918156d2379f5bc4a0d1509c4 | /lib/common/src/main/java/study/daydayup/wolf/common/io/enums/JoinEnum.java | 5bf30eb6354d4d3c4f3db561e59e69e77d25a7e8 | [
"MIT"
] | permissive | soon14/wolf | 0d4b93e211caae72379c2cf03a0f86ab45b2f17f | 0ed026c500bc76db074bc8938b00416597d0ce3d | refs/heads/master | 2020-12-10T22:14:08.387738 | 2020-01-11T07:35:33 | 2020-01-11T07:35:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package study.daydayup.wolf.common.io.enums;
import lombok.Getter;
import study.daydayup.wolf.common.lang.enums.CodeBasedEnum;
/**
* study.daydayup.wolf.common.io.db
*
* @author Wingle
* @since 2019/11/25 9:10 下午
**/
@Getter
public enum JoinEnum implements CodeBasedEnum {
LEFT(2, "left"),
RIGHT(1, "right")
;
private int code;
private String desc;
JoinEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
}
| [
"winglechen@gmail.com"
] | winglechen@gmail.com |
8d51b870e77d52180707dfa135516484e1f0b90b | 506a4656e73e77b7774248799fa508af9a23fa8a | /Android/app/src/main/java/com/oort/bunny/demoyu/view/particle/ShapeColor.java | 4f97d14aef476d07e3072600498552ea11bed0c5 | [
"Apache-2.0"
] | permissive | RockySteveJobs/ParticleView | 134dbff34ae3d06b5292c74b7d037f181c59709c | 7bb9f7e7b9be3cd7a90650759d583db7098a0f5c | refs/heads/master | 2021-01-02T08:22:47.026317 | 2017-05-08T04:34:19 | 2017-05-08T04:34:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java | package com.oort.bunny.demoyu.view.particle;
import android.graphics.LinearGradient;
import android.graphics.PointF;
import android.graphics.Shader;
/**
* Created by bunny on 2017/4/18.
* 颜色和形状
*/
public class ShapeColor {
private Shader shader;//渐变色
private SHAPE shape;
public void setShader(Shader shader) {
this.shader = shader;
}
public Shader getShader() {
return shader;
}
public void setShape(SHAPE shape) {
this.shape = shape;
}
public SHAPE getShape() {
return shape;
}
/**
* 传入开始颜色,结束颜色,形状
* @param startColor
* @param endColor
* @param end
* @param shape
*/
public ShapeColor(int startColor, int endColor, PointF start, PointF end, SHAPE shape) {
this.shape = shape;
shader = new LinearGradient(start.x, start.y, end.x, end.y, startColor, endColor, Shader.TileMode.REPEAT);
}
/**
* 形状枚举
*/
public enum SHAPE {
CIRCEL,//圆形
SQUARE,//方形
IMAGE,//图片
TRIANGLE,//三角形
}
}
| [
"nokia.yao@qq.com"
] | nokia.yao@qq.com |
0b7973329840d6a6c591c3ced3dd39f5b5c0486c | cf63f0d3e6c239c48175cf343c2ad6527ad10eeb | /MillionSongAnalysis/FirstMapper.java | 10ce8fe0c0b50971b347d148ec01ac79da338c30 | [] | no_license | skmishra5/Analyzing-The-Million-Song-Dataset-Using-MapReduce | fea325feb6bb1696b0f7a23bb827ac97123dd112 | e9bc476c880b88739390cc3052578651ec81d9b1 | refs/heads/master | 2021-08-30T12:49:00.258560 | 2017-12-18T02:00:58 | 2017-12-18T02:00:58 | 114,498,938 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,508 | java | package MillionSongAnalysis;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;
// The most commonly tagged genre for each artist
public class FirstMapper extends Mapper<LongWritable, Text, Text, Text>{
//private final static IntWritable one = new IntWritable(1);
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String[] field = value.toString().split("\t");
String artistTerms = "";
String artistTermsFrequency;
String artistName = "";
artistTerms = field[13];
String finalArtistTerms = "";
if(artistTerms.contains("["))
{
finalArtistTerms = artistTerms.replaceAll("\\[", "").replaceAll("\\]", "");
}
if(artistTerms.contains("\""))
{
finalArtistTerms = finalArtistTerms.replaceAll("\"", "");
}
String[] artistTermsArray = finalArtistTerms.split(",");
if(artistTermsArray.length > 0)
{
artistTermsFrequency = field[14];
String finalArtistTermsFreq = "";
if(artistTermsFrequency.contains("["))
{
finalArtistTermsFreq = artistTermsFrequency.replaceAll("\\[", "").replaceAll("\\]", "");
}
if(artistTermsFrequency.contains("\""))
{
finalArtistTermsFreq = finalArtistTermsFreq.replaceAll("\"", "");
}
String[] artistTermsFreqArray = finalArtistTermsFreq.split(",");
artistName = field[11];
int topTerm = 0;
int lenCheck = finalArtistTermsFreq.length();
if(lenCheck > 0)
{
for (int i = 0; i < artistTermsArray.length; i++)
{
if(isDouble(artistTermsFreqArray[i]) && isDouble(artistTermsFreqArray[topTerm]))
{
if(Double.parseDouble(artistTermsFreqArray[i]) > Double.parseDouble(artistTermsFreqArray[topTerm]))
{
topTerm = i;
}
}
}
}
if(!artistName.equals("artist_name"))
{
context.write(new Text(artistName), new Text(artistTermsArray[topTerm]));
}
}
//context.write(new Text(finalArtistTerms), one);
/*if(!finalString.contains("\""))
{
if(finalString != "")
{
context.write(new Text(finalString), one);
}
}*/
}
boolean isDouble(String str) {
try {
Double.parseDouble(str);
return true;
} catch (NumberFormatException e) {
return false;
}
}
}
| [
"sitakanta.mishra@gmail.com"
] | sitakanta.mishra@gmail.com |
f5e2f1427f0b4204230765272808e2441109d55b | 967984ad8996ca5690e11e8a1d1f15a843e735e8 | /app/src/main/java/com/jsti/pile/collector/widgets/NavigationBar.java | 93e9f122b205a6ba2a8e568c10fc38ee72afbb8c | [] | no_license | liang979zhang/PileCollectorNew | d74ff69fd4767986f35f804b77de8912f5d308de | 381ab4f7a0c4f217bd776388f6f45a1fd53932ad | refs/heads/master | 2020-04-11T10:28:42.869838 | 2018-12-14T01:36:41 | 2018-12-14T01:36:41 | 161,716,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,761 | java | package com.jsti.pile.collector.widgets;
import com.jsti.pile.collector.R;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* 公用导航栏
*/
public class NavigationBar extends FrameLayout implements OnClickListener {
private LinearLayout leftBox;
private LinearLayout rightBox;
private ViewGroup titleViewBlock;
private TextView titleView;
public interface NavItem {
public enum ResType {
layout, drawable, string
}
public int getResId();
public ResType getResType();
public int getId();
}
public NavigationBar(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.template_nav_bar,
this, true);
titleViewBlock = (ViewGroup) findViewById(R.id.template_nav_title_block);
titleView = (TextView) findViewById(R.id.template_nav_title);
leftBox = (LinearLayout) findViewById(R.id.template_nav_left_box);
rightBox = (LinearLayout) findViewById(R.id.template_nav_right_box);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right,
int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (isInEditMode()) {
// TODO just for preview in XML
return;
}
int leftOffset = 0;
int rightOffset = 0;
View v = findSizeableViewFromEnd(leftBox);
if (v != null) {
leftOffset = v.getLeft() + v.getMeasuredWidth();
v = null;
}
v = rightBox.getChildAt(0);
v = findSizeableViewFromHeader(rightBox);
if (v != null) {
rightOffset = getMeasuredWidth() - rightBox.getLeft() - v.getLeft();
}
int minOffset = Math.max(leftOffset, rightOffset);
titleViewBlock.setPadding(minOffset, 0, minOffset, 0);
titleViewBlock.invalidate();
}
private View findSizeableViewFromHeader(ViewGroup vg) {
int childcount;
if (vg == null || (childcount = vg.getChildCount()) <= 0) {
return null;
}
for (int i = 0; i < childcount; i++) {
View v = vg.getChildAt(i);
if (v.getVisibility() == View.VISIBLE) {
return v;
}
}
return null;
}
private View findSizeableViewFromEnd(ViewGroup vg) {
int childcount;
if (vg == null || (childcount = vg.getChildCount()) <= 0) {
return null;
}
for (int i = childcount - 1; i > -1; i--) {
View v = vg.getChildAt(i);
if (v.getVisibility() == View.VISIBLE) {
return v;
}
}
return null;
}
/**
* 设置title
*
* @param title
*/
public void setTitle(String title) {
titleView.setText(title);
}
/**
* 通过 string res id 设置title
*
* @param titleResId
*/
public void setTitle(int titleResId) {
String titleStr = null;
try {
titleStr = getResources().getString(titleResId);
} catch (Exception e) {
}
setTitle(titleStr);
}
/**
* 获取标题View
*
* @return
*/
public TextView getTitleView() {
return titleView;
}
/**
* 使用自定义的View替换title view
*
* @param titleView
*/
public void replaceTitleView(View titleView) {
titleViewBlock.removeAllViews();
titleViewBlock.addView(titleView);
}
public void setTitleTextViewDrawable(Drawable l, Drawable t, Drawable r,
Drawable b) {
setDrawableBound(l);
setDrawableBound(t);
setDrawableBound(r);
setDrawableBound(b);
titleView.setCompoundDrawables(l, t, r, b);
// 解决低版本sdk不能生效的问题
titleViewBlock.requestLayout();
titleViewBlock.invalidate();
}
private void setDrawableBound(Drawable d) {
if (d != null) {
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
}
}
/**
* 添加的资源的类型
*/
public enum ResIdType {
layout, drawable, text
}
/**
* @see #addFromLeft(NavItem, boolean)
*/
public void addFromLeft(NavItem item) {
addFromLeft(item, true);
}
/**
* 从左边开始添加
*
* @param actionId
* @param defaultShow
* 默认是显示还是隐藏
*/
public void addFromLeft(NavItem item, boolean defaultShow) {
addFromLeft(item, getDefaultVisibleFlag(defaultShow));
}
/**
* @param item
* @param visibale
* View的可见属性Gone,Visible,invisible
*/
public void addFromLeft(NavItem item, int visibale) {
View v = createItem(item, leftBox);
leftBox.addView(v);
//
innerChangeNavChildViewVisiable(v, visibale);
perItemAdded(v);
}
/**
* @see #addFromRight(NavItem, boolean)
*/
public void addFromRight(NavItem item) {
addFromRight(item, true);
}
/**
* 从右边开始添加
*
* @param item
* @param defaultShow
* 默认是显示还是隐藏
*/
public void addFromRight(NavItem item, boolean defaultShow) {
addFromRight(item, getDefaultVisibleFlag(defaultShow));
}
/**
* @param item
* @param visibale
* View的可见属性Gone,Visible,invisible
*/
public void addFromRight(NavItem item, int visibale) {
View v = createItem(item, rightBox);
//
innerChangeNavChildViewVisiable(v, visibale);
rightBox.addView(v);
perItemAdded(v);
}
private void perItemAdded(View item) {
// if (item != null) {
// ViewGroup.LayoutParams lp = item.getLayoutParams();
// if (lp == null) {
// lp = new LayoutParams(LayoutParams.WRAP_CONTENT,
// LayoutParams.MATCH_PARENT);
// } else {
// lp.width = LayoutParams.WRAP_CONTENT;
// lp.height = LayoutParams.WRAP_CONTENT;
// }
// item.setBackgroundColor(Color.BLUE);
// item.setLayoutParams(lp);
// }
}
/**
* 修改NAV Item的可见性
*
* @param childId
* @param show
*/
public void changeNavChildVisiable(int childId, boolean show) {
innerChangeNavChildViewVisiable(findViewById(childId), show);
}
public void changeNavChildVisiable(int childId, int visible) {
innerChangeNavChildViewVisiable(findViewById(childId), visible);
}
private void innerChangeNavChildViewVisiable(View v, boolean show) {
if (v == null) {
return;
}
int targetVisible = getDefaultVisibleFlag(show);
innerChangeNavChildViewVisiable(v, targetVisible);
}
private int getDefaultVisibleFlag(boolean show) {
return show ? View.VISIBLE : View.INVISIBLE;
}
private void innerChangeNavChildViewVisiable(View v, int visible) {
if (v == null) {
return;
}
checkViewVisible(v, visible);
if (v.getTag() instanceof View) {
checkViewVisible((View) v.getTag(), visible);
}
}
private void checkViewVisible(View view, int visibility) {
if (view != null && view.getVisibility() != visibility) {
view.setVisibility(visibility);
}
}
/**
* 状态监听
*
* @author skg
*
*/
public interface NavgationListener {
public void onItemClick(View v, NavItem item, NavigationBar nav);
}
private NavgationListener mNavListener;
public void setNavgationListener(NavgationListener l) {
mNavListener = l;
}
public void dismis() {
if (isShown()) {
setVisibility(View.GONE);
}
}
public void show() {
if (!isShown()) {
setVisibility(View.VISIBLE);
}
}
private static final int TAG_KEY_ITEM = R.id.tag_key_item;
private View createItem(NavItem item, ViewGroup parent) {
LayoutInflater f = LayoutInflater.from(getContext());
View v = null;
switch (item.getResType()) {
case layout:
v = f.inflate(item.getResId(), parent, false);
break;
case string:
v = f.inflate(R.layout.template_nav_item_txt, parent, false);
((TextView) v).setText(item.getResId());
break;
case drawable:
v = f.inflate(R.layout.template_nav_item_img, parent, false);
((ImageView) v).setImageResource(item.getResId());
break;
default:
throw new IllegalArgumentException("bad Item resType");
}
if (v != null) {
v.setOnClickListener(this);
v.setId(item.getId());
v.setTag(TAG_KEY_ITEM, item);
}
return v;
}
private View lastClickItemView;
@Override
public void onClick(View v) {
lastClickItemView = v;
this.post(OnItemClickRunnable);
}
private final Runnable OnItemClickRunnable = new Runnable() {
@Override
public void run() {
if (mNavListener != null && lastClickItemView != null) {
mNavListener.onItemClick(lastClickItemView,
(NavItem) lastClickItemView.getTag(TAG_KEY_ITEM),
NavigationBar.this);
}
}
};
/**
* 设置自定义的图片,必须NavItem已经添加成功了才能生效
*
* @param navItem
* @param faceResId
*/
public void setNavItemFace(View navItem, int faceResId) {
if (navItem instanceof ImageView) {
((ImageView) navItem).setImageResource(faceResId);
} else if (navItem != null) {
navItem.setBackgroundResource(faceResId);
}
}
/**
* 设置自定义的图片,必须NavItem已经添加成功了才能生效
*
* @param navItemId
* @param faceResId
*/
public void setNavItemFace(int navItemId, int faceResId) {
setNavItemFace(findViewById(navItemId), faceResId);
}
public boolean replaceItem(NavItem old, NavItem newItem) {
View itemView = findViewById(old.getId());
if (itemView == null) {
return false;
}
ViewGroup itemViewParent = (ViewGroup) itemView.getParent();
int oldItemIndex = itemViewParent.indexOfChild(itemView);
View newItemView = createItem(newItem, itemViewParent);
itemViewParent.removeViewAt(oldItemIndex);
itemViewParent.addView(newItemView, oldItemIndex);
invalidate();
requestLayout();
return true;
}
public void reset() {
leftBox.removeAllViews();
rightBox.removeAllViews();
setTitle(null);
}
public void commit() {
this.forceLayout();
this.requestLayout();
this.invalidate();
}
} | [
"zhangdl@yemast.com"
] | zhangdl@yemast.com |
d5634dedd267d25f41cc912a90c6fb96138d275f | cfaa57238cbfe4c58bbdc44028ca4399ca55fc85 | /src/main/java/controllers/player/PlayerPlayerController.java | 37ee7aa5199c1aeea9aa791e8ffb06ef26427917 | [] | no_license | GeekCriiz/Nonsense | e37f6126c504b1268b4bf0ea3422c6d6395adf32 | 19db65d15477334da0defb6d8188518cb2c92f92 | refs/heads/master | 2021-01-23T12:27:15.115355 | 2016-07-13T17:13:47 | 2016-07-13T17:13:47 | 63,265,856 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,727 | java | package controllers.player;
import java.util.ArrayList;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import services.PlayerService;
import controllers.AbstractController;
import domain.Player;
import forms.EditionPlayerForm;
import forms.NegativePlayerForm;
import forms.SeePlayerForm;
@Controller
@RequestMapping("/player/player")
public class PlayerPlayerController extends AbstractController{
// Constructors -----------------------------------------------------------
public PlayerPlayerController(){
super();
}
// Services ---------------------------------------------------------------
@Autowired
private PlayerService playerService;
//Listing followers
@RequestMapping("/listFollowers")
public @ResponseBody Collection<String> listFollowers(){
Collection<String> result;
try{
result = playerService.findAllFollowers();
}catch(Throwable t){
result = new ArrayList<String>();
}
return result;
}
//Listing following
@RequestMapping("/listFollowing")
public @ResponseBody Collection<String> listFollowing(){
Collection<String> result;
try{
result = playerService.findAllFollowing();
}catch(Throwable t){
result = new ArrayList<String>();
}
return result;
}
//Displaying
@RequestMapping("/see")
public @ResponseBody SeePlayerForm seePlayer(int playerId) {
SeePlayerForm result;
try{
result =playerService.seePlayer(playerId);
}catch(Throwable t){
result = null;
}
return result;
}
// Edition -----------------------------------------------------------------
@RequestMapping("/editAdmin")
public @ResponseBody EditionPlayerForm editPlayer(@RequestBody int playerId) {
EditionPlayerForm result;
Player player;
try{
player = playerService.findOne(playerId);
result = playerService.fragmentToEdit(player);
}catch(Throwable t){
result = null;
}
return result;
}
@RequestMapping(value = "/savePlayer", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody int save(@RequestBody EditionPlayerForm playerForm){
int result;
Player player;
try{
player = playerService.reconstructToEdit(playerForm);
result = playerService.save(player);
} catch (org.springframework.dao.DataIntegrityViolationException oops) {
result = -50;
}catch(Throwable t){
result = -1;
}
return result;
}
// Negative -------------------------------------------------
@RequestMapping(value = "/negative", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody NegativePlayerForm negative(@RequestBody NegativePlayerForm negativePlayerForm){
NegativePlayerForm result;
try{
// - Devuelve -100 si hay que mandar una alerta al jugador de que le están marcando como sospechoso de hacer trampa
// y que si continúa así podrá ser expulsado del juego temporalmente.
// - Devuelve -200 si hay que mandar una alerta al jugador de que se ha comunicado a los administradores del sistema
// que le han marcado demasiadas veces como sospechoso de hacer trampa.
// - En otro caso, devuelve el ID del jugador.
result = playerService.putNegative(negativePlayerForm);
}catch(Throwable t){
result = new NegativePlayerForm();
result.setPlayerId(0);
result.setGameId(-1);
}
return result;
}
}
| [
"geekcriiz@gmail.com"
] | geekcriiz@gmail.com |
608046ffa8f20f1c8c7880f51f6237bebb04650f | 13c502784d3520fe1205389487f6ff7c91732846 | /open-feign/src/main/java/com/yunhui/openfeign/interfaces/OpenFeignService.java | b762288f9533402beb525d7cecd834d2c59be977 | [] | no_license | kingrocy/javaer | d5c6fc4de124c8a2a4c9a3b6267a83e7e7e7d66a | 3e3f79a59a80096d1676857f628e1826952342bc | refs/heads/master | 2022-10-07T09:30:36.490423 | 2021-03-04T08:11:30 | 2021-03-04T08:11:30 | 251,542,808 | 0 | 0 | null | 2022-10-04T23:57:21 | 2020-03-31T08:26:42 | Java | UTF-8 | Java | false | false | 570 | java | package com.yunhui.openfeign.interfaces;
import com.yunhui.openfeign.bean.User;
import feign.Body;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
/**
* @Date : 2019-07-10 15:14
* @Desc :
*/
public interface OpenFeignService {
@RequestLine("GET /user/{id}")
User getUser(@Param("id") Long id);
@RequestLine("POST /user/login")
@Headers("Content-Type: application/json")
@Body("%7B\"account\": \"{account}\", \"passwd\": \"{passwd}\"%7D")
User login(@Param("account") String account,@Param("passwd")String passwd);
}
| [
"dushaoyun@souche.com"
] | dushaoyun@souche.com |
b5a96167d1aa16eed26ed9cc5b134579fd9255a8 | 788e4590594da9ffd52f10a77e372ac3b6bf0610 | /src/main/java/net/beaconpe/jraklib/protocol/EncapsulatedPacket.java | 74966a85891d1b7de51f5df6c9614c72ee8b983b | [] | no_license | yungtechboy1/DiamondCore | 8a65c7eb737133d866b55aeaa8191574819716b7 | 8dc0d69c9271b5ee59dfb74c1a7e566f34c6fe41 | refs/heads/master | 2021-08-08T03:09:15.520099 | 2015-07-07T23:00:09 | 2015-07-07T23:00:09 | 38,969,643 | 4 | 8 | null | 2021-06-14T02:27:46 | 2015-07-12T16:52:33 | Java | UTF-8 | Java | false | false | 5,271 | java | /*
JRakLib networking library.
This software is not affiliated with RakNet or Jenkins Software LLC.
This software is a port of PocketMine/RakLib <https://github.com/PocketMine/RakLib>.
All credit goes to the PocketMine Project (http://pocketmine.net)
Copyright (C) 2015 BlockServerProject & PocketMine team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.beaconpe.jraklib.protocol;
import net.beaconpe.jraklib.Binary;
import java.nio.ByteBuffer;
import java.util.Arrays;
/**
* Represents an encapsulated packet inside a CustomPacket
*/
public class EncapsulatedPacket {
public byte reliability;
public boolean hasSplit = false;
public int length = 0;
public int messageIndex = -1;
public int orderIndex = -1;
public byte orderChannel = -1;
public int splitCount = -1;
public short splitID = -1;
public int splitIndex = -1;
public byte[] buffer;
public boolean needACK = false;
public int identifierACK = -1;
protected int offset;
public static EncapsulatedPacket fromBinary(byte[] binary){
return fromBinary(binary, false);
}
public static EncapsulatedPacket fromBinary(byte[] binary, boolean internal){
return fromBinary(binary, internal, -1);
}
public static EncapsulatedPacket fromBinary(byte[] binary, boolean internal, int offset){
EncapsulatedPacket packet = new EncapsulatedPacket();
byte flags = binary[0];
packet.reliability = (byte) ((flags & 0b11100000) >> 5);
packet.hasSplit = (flags & 0b00010000) > 0;
int length;
if(internal){
length = Binary.readInt(Binary.subbytes(binary, 1, 4));
packet.identifierACK = Binary.readInt(Binary.subbytes(binary, 5, 4));
offset = 9;
} else {
length = Binary.readShort(Binary.subbytes(binary, 1, 2)) / 8;
offset = 3;
packet.identifierACK = -1;
}
if(packet.reliability > 0){
if(packet.reliability >= 2 && packet.reliability != 5){
packet.messageIndex = Binary.readLTriad(Binary.subbytes(binary, offset, 3));
offset = offset + 3;
}
if(packet.reliability <= 4 && packet.reliability != 2){
packet.orderIndex = Binary.readLTriad(Binary.subbytes(binary, offset, 3));
offset = offset + 3;
packet.orderChannel = binary[offset++];
}
}
if(packet.hasSplit){
packet.splitCount = Binary.readInt(Binary.subbytes(binary, offset, 4));
offset = offset + 4;
packet.splitID = (short) Binary.readShort(Binary.subbytes(binary, offset, 2));
offset = offset + 2;
packet.splitIndex = Binary.readInt(Binary.subbytes(binary, offset, 4));
offset = offset + 4;
}
packet.buffer = Binary.subbytes(binary, offset, length);
offset = offset + length;
packet.offset = offset;
return packet;
}
public int getTotalLength(){
return getTotalLength(false);
}
public int getTotalLength(boolean internal){
if(internal) {
return 9 + buffer.length + (messageIndex != -1 ? 3 : 0) + (orderIndex != -1 ? 4 : 0) + (hasSplit ? 10 : 0);
} else {
return 3 + buffer.length + (messageIndex != -1 ? 3 : 0) + (orderIndex != -1 ? 4 : 0) + (hasSplit ? 10 : 0);
}
}
public byte[] toBinary(boolean internal){
@SuppressWarnings("unused")
int offset = 0;
ByteBuffer bb = ByteBuffer.allocate(1024 * 1024 * 32);
bb.put((byte) ((byte) (reliability << 5) | (hasSplit ? 0b00010000 : 0)));
if(internal){
bb.put(Binary.writeInt(buffer.length));
bb.put(Binary.writeInt(identifierACK));
} else {
bb.put(Binary.writeShort((short) (buffer.length << 3)));
}
if(reliability > 0){
if(reliability >= 2 && reliability != 5){
bb.put(Binary.writeLTriad(messageIndex));
}
if(reliability <= 4 && reliability != 2){
bb.put(Binary.writeLTriad(orderIndex));
bb.put(Binary.writeByte(orderChannel));
}
}
if(hasSplit){
bb.put(Binary.writeInt(splitCount));
bb.put(Binary.writeShort(splitID));
bb.put(Binary.writeInt(splitIndex));
}
bb.put(buffer);
byte[] data = Arrays.copyOf(bb.array(), bb.position());
bb = null;
return data;
}
public byte[] toBinary(){
return toBinary(false);
}
}
| [
"trent0308@live.com"
] | trent0308@live.com |
8402fc9a87cc2c238679ab16a18490c17fce320f | bc278325e139829c62e6b0940126141384a02d67 | /src/OOP/Them2_11/ExceptionDemo/InvalidAgeException.java | f0c27292b07934a2365ef0e377f829b86b006d86 | [] | no_license | yuriy-vin/lesson1 | e77f07427bc955c66bbcb9e128c40c09d1d29c54 | 7d2377f279ec8ffd91405c0348130d93c7c47351 | refs/heads/master | 2020-12-30T12:00:04.991925 | 2017-05-16T17:35:56 | 2017-05-16T17:36:17 | 91,482,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package OOP.Them2_11.ExceptionDemo;
/**
* Created by Yuriy on 12.03.2017.
*/
public class InvalidAgeException extends RuntimeException {
public String getMessage() {
return "Invalid Age!";
}
}
| [
"smashnjuk@ukr.net"
] | smashnjuk@ukr.net |
64e1e124631af093caad73a1ce3f11e224265de5 | 3fc908e4b99cb8bb23ce78cdd69ecee37c3cfadb | /diorite-core/src/main/java/org/diorite/impl/entity/IGuardian.java | 08a2e17f469130254931025bd75eb4540b884e07 | [
"MIT"
] | permissive | XakepSDK/Diorite | 2bb97fb3f8f70e44dad4a4e1c67bd4c66802f9e7 | d69adecfbe8da9c1d492e29349f7b43e0e0c4b29 | refs/heads/master | 2021-01-20T05:41:29.584156 | 2016-05-28T19:45:51 | 2016-05-28T19:45:51 | 59,948,440 | 0 | 1 | null | 2016-05-29T14:52:57 | 2016-05-29T14:52:54 | null | UTF-8 | Java | false | false | 1,930 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2016. Diorite (by Bartłomiej Mazur (aka GotoFinal))
*
* 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.
*/
package org.diorite.impl.entity;
import org.diorite.entity.Guardian;
import org.diorite.utils.math.geometry.ImmutableEntityBoundingBox;
public interface IGuardian extends IMonsterEntity, Guardian
{
ImmutableEntityBoundingBox BASE_SIZE = new ImmutableEntityBoundingBox(0.85F, 0.85F);
/**
* Size of metadata.
*/
byte META_KEYS = 13;
/**
* byte, bit flags. <br>
* Eldery, RetractingSpikes
*/
byte META_KEY_GUARDIAN_STATUS = 11;
/**
* int, entity id
*/
byte META_KEY_GUARDIAN_TARGET = 12;
/**
* Contains status flags used in matadata.
*/
interface GuardianStatusFlag
{
byte ELDERY = 0;
byte RETRACTING_SPIKES = 1;
}
}
| [
"bartlomiejkmazur@gmail.com"
] | bartlomiejkmazur@gmail.com |
302240542e10c31de3fcac0410878f03bb29fe01 | c419943d727e3b812cbaaef4b81767d45a400b79 | /Mobile platform development/learnAndroid/FirstLineCode2/MediaPlay/app/src/androidTest/java/com/example/he/mediaplay/ApplicationTest.java | 9f2e90970f6f912e95246d2ad515db043e402a52 | [] | no_license | HeziLiu/Little-rookie | cf27e0168a8e9e025c858244d78be8b24f2fa27a | 964bd6b191a3864a4c6c4430a85d17bb16920581 | refs/heads/master | 2022-01-17T03:48:12.194375 | 2019-06-02T07:47:10 | 2019-06-02T07:47:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.example.he.mediaplay;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"7891444@qq.com"
] | 7891444@qq.com |
22c708586ae6b0bcaacd80738342ef6f1645ff2f | f646f688f02f676dcc5c70df3f33da99ad61171c | /Wizard Game/src/Handler.java | cfbe88f44e99915222a4ae0787100c156c5c11bf | [] | no_license | RegJoshua/Wizard-Game | ba5d35bf799cfbd00058c29cd11bead1e6bd06ef | c62a9b7d48093e14b541c737b0b6ebb27222b7ce | refs/heads/master | 2021-04-30T06:42:19.256523 | 2018-02-14T00:00:46 | 2018-02-14T00:00:46 | 121,451,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | import java.awt.Graphics;
import java.util.LinkedList;
public class Handler {
LinkedList<GameObject> object = new LinkedList<GameObject>();
private boolean up = false, down = false, right = false, left = false;
public void tick(){
for(int i = 0; i < object.size(); i++){
GameObject tempObject = object.get(i);
tempObject.tick();
}
}
public void render(Graphics g){
for(int i = 0; i < object.size(); i++){
GameObject tempObject = object.get(i);
tempObject.render(g);;
}
}
public void addObject(GameObject tempObject){
object.add(tempObject);
}
public void removeObject(GameObject tempObject){
object.remove(tempObject);
}
public boolean isUp() {
return up;
}
public void setUp(boolean up) {
this.up = up;
}
public boolean isDown() {
return down;
}
public void setDown(boolean down) {
this.down = down;
}
public boolean isRight() {
return right;
}
public void setRight(boolean right) {
this.right = right;
}
public boolean isLeft() {
return left;
}
public void setLeft(boolean left) {
this.left = left;
}
}
| [
"noreply@github.com"
] | RegJoshua.noreply@github.com |
d57ac1e3477597f31d7a17b6be47cb08e5a40737 | 759515839162ba7d28bd4b12abdedd388210f860 | /app/src/androidTest/java/com/example/a41615045/simulacro/ApplicationTest.java | 3f5785a81058ae76feaae79de02d363f9724a9bd | [] | no_license | julian98/LOOOOOOOOL | f9b4ebf795ce0c6cf22a9e16ff54bbcd656337af | 2f0cd2741b6499cb7b3c04d65098eab743919d1e | refs/heads/master | 2021-01-13T13:40:17.890175 | 2016-12-13T15:21:08 | 2016-12-13T15:21:08 | 76,370,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.example.a41615045.simulacro;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"41615045@ort"
] | 41615045@ort |
f4386bdab9fcfd38dbb2f569e3dac989d775e21c | 1cc3205fd7bcc83be408eab2eed4b87a1a0ad115 | /src/trees/TestIfABinaryTreeIsHeightBalanced.java | 77d4f91f9ff030961d2e2199cd61e1906b8e2018 | [] | no_license | sunny-sunwoo/b2b-algo | 1c7787173941a8202139b63b54a75ad874e090d3 | 7b0367cc8687185f0ec1601b3ccd3bb55c143053 | refs/heads/master | 2023-01-10T18:51:53.092653 | 2020-11-16T15:53:44 | 2020-11-16T15:53:44 | 301,651,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,505 | java | package trees;
public class TestIfABinaryTreeIsHeightBalanced {
public static boolean isBalanced(TreeNode root) {
return getData(root).balance;
}
private static Data getData(TreeNode node) {
if (node == null) {
return new Data(true, -1);
}
Data leftData = getData(node.left);
if (leftData.balance == false) {
return leftData;
}
Data rightData = getData(node.right);
if (rightData.balance = false) {
return rightData;
}
boolean balance = Math.abs(leftData.height - rightData.height) <= 1;
int height = Math.max(leftData.height, rightData.height) + 1;
return new Data(balance, height);
}
private static class Data {
boolean balance;
int height;
public Data(boolean balance, int height) {
this.balance = balance;
this.height = height;
}
}
public static class TreeNode {
int value;
TreeNode left;
TreeNode right;
public TreeNode(int value) {
this.value = value;
}
}
public static void main(String[] args) {
TreeNode root = new TreeNode(1);
root.left = new TreeNode(2);
root.right = new TreeNode(3);
root.right.left = new TreeNode(4);
root.right.right = new TreeNode(5);
System.out.println(isBalanced(root));
// Output: true
TreeNode root2 = new TreeNode(1);
root2.left = new TreeNode(2);
root2.right = new TreeNode(3);
root2.right.left = new TreeNode(4);
root2.right.right = new TreeNode(5);
root2.right.right.right = new TreeNode(6);
System.out.println(isBalanced(root2));
// Output: false
}
}
| [
"jeesub.brad.lee@gmail.com"
] | jeesub.brad.lee@gmail.com |
a821ba9ff8d42d4e91032fd17f9dc6b17ffa5534 | ab0199fcef3c065d4fe66624d6b26d4df50efc43 | /src/TYUT/network/LoginAgain.java | f44598835193064020b823bd229fd657ba58d580 | [
"Apache-2.0"
] | permissive | sunduan/TYUTApp | 28c5940c63bda075de24234c5fb453027184550f | 44e9837389d8308154519e335524314facf4b98b | refs/heads/master | 2021-01-21T04:48:28.634403 | 2016-06-05T18:01:16 | 2016-06-05T18:01:16 | 54,626,287 | 1 | 1 | null | null | null | null | GB18030 | Java | false | false | 1,653 | java | package TYUT.network;
import java.util.ArrayList;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import TYUT.database.Dbconnetc;
import TYUT.tmp.Tmp;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
public class LoginAgain {
public void loginAgain(Context context ) {
// 连接对象
Dbconnetc dbconnetc = new Dbconnetc(context);
final SQLiteDatabase database = dbconnetc.getReadableDatabase();
// 创建USER数据库如果存在则不创建
dbconnetc.onCreate(database);
Cursor c = database.query("user",null,null,null,null,null,null);//查询并获得游标
Log.i("大小",c.getCount()+"");
c.moveToPosition(0);//移动到指定记录,只去第一条
final String username = c.getString(c.getColumnIndex("username"));
final String password = c.getString(c.getColumnIndex("password"));
ConnectTYUT connectTYUT = new ConnectTYUT();
// 数据接收对象
//MessageFacj facj = new MessageFacj();
// 参数对象
ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("username", username));
params.add(new BasicNameValuePair("password", password));
// 连接
String getcookie =connectTYUT.getByPost("http://" + Tmp.getServerIp() + "/login.action", params);
JSONObject jsonObject;
try {
jsonObject = new JSONObject(getcookie);
Tmp.setCookies(jsonObject.getString("cookie"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"2435703066@qq.com"
] | 2435703066@qq.com |
6b4d62de5a094b6a41a218c0eeabf56d2df4bf3e | bb207653f41bbcc92a8b7ebb4f4ea86908f59b86 | /Nowhere/src/model/AI/Core.java | 6cd3d2b4dcc0961b58f5949398bbb86966c3f0c7 | [] | no_license | Thundurus/Nowhere | 1f3b5abbbba4c1557b7de19dcd716ea60efb7267 | 2f280e971e8be41dfe6d02eef42806ebf2a5058d | refs/heads/master | 2020-03-16T16:25:40.312733 | 2019-03-05T22:25:08 | 2019-03-05T22:25:08 | 132,786,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package model.AI;
import java.util.ArrayList;
import java.util.Map;
import model.Character;
import model.NPC;
import model.Skill;
import model.SkillFlags;
import model.Skills.*;
public class Core
{
public static Map.Entry<Skill, ArrayList<Object>> decideAction(NPC npc)
{
ArrayList<Object> target = new ArrayList<Object>();
target.add("self");
return Map.entry(new IceNine(), target);
}
public static void score(NPC npc)
{
}
}
| [
"marcus.moss@live.com"
] | marcus.moss@live.com |
6eaecbbe294223b80a0bf48b6019326773240990 | 14881c059dd7163c9788d9fbdfd0f87f451895c1 | /dropwizard/tasklist-service/src/main/java/com/bjedrzejewski/tasklistservice/TaskListPost.java | d608c68214459dd691bf33ab5b8047af49942231 | [] | no_license | bsdshell/java | 74cd6c74024e81c04885b70578a5640580a50de2 | a8749fc12f3dee96da7d79c89ea8aae7a063c575 | refs/heads/master | 2021-01-23T13:54:21.033184 | 2017-08-31T17:51:24 | 2017-08-31T17:51:24 | 7,270,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 621 | java | package com.bjedrzejewski.tasklistservice;
import com.google.common.base.Optional;
import com.codahale.metrics.annotation.Timed;
import com.google.common.io.CharStreams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
@Path("/post")
@Produces(MediaType.APPLICATION_JSON)
public class TaskListPost{
}
| [
"monosurface@gmail.com"
] | monosurface@gmail.com |
643b84a732dd361ff83d8b8993bdd1aab6b33e61 | 23574e36203a1ad85029c59079ec0f24666d41d7 | /src/main/java/br/com/felippeneves/abstract_factory/car_service/services/CarService.java | 75b160db0b5fa65029666ad7715641f51496f67d | [] | no_license | felippeneves/creational-patterns | 9a7246a7d85e27d132122f08641c44ef25185aa8 | 2e9c13f0ff1cfc21d74e105220e1a8f16206f6d1 | refs/heads/master | 2023-08-14T12:41:53.664128 | 2021-10-17T17:13:51 | 2021-10-17T17:13:51 | 417,646,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package br.com.felippeneves.abstract_factory.car_service.services;
public interface CarService extends Service {
void save(String model);
void update(String newModel);
}
| [
"felippenevesmonteiro@gmail.com"
] | felippenevesmonteiro@gmail.com |
990e215f861ea6bafa78f676235e0b8be883a273 | 45c8f4785305127c9e3b350291c800d5e30f24d5 | /app/src/main/java/com/example/jacob/android_sprint1_challenge/EditActivity.java | 74306dd77778466edb9e34efef3710fd27d13704 | [] | no_license | jbseppanen/Android_Sprint1_Challenge | 973a55b0594e4b9cd7a2ce4b26bd06056dfe5e40 | cfc19cf8ffcc7b0b508499dc48f72ca093f24768 | refs/heads/master | 2020-04-05T13:11:07.338045 | 2018-11-10T01:12:10 | 2018-11-10T01:12:10 | 156,887,117 | 0 | 0 | null | 2018-11-09T16:15:30 | 2018-11-09T16:15:29 | null | UTF-8 | Java | false | false | 2,540 | java | package com.example.jacob.android_sprint1_challenge;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Switch;
public class EditActivity extends AppCompatActivity {
public static final String EDIT_MOVIE_KEY = "edit_movie";
EditText editTitle;
Switch switchWatched;
Movie movie;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
editTitle = findViewById(R.id.edit_title);
switchWatched = findViewById(R.id.switch_watched);
context = this;
movie = (Movie) getIntent().getSerializableExtra(EDIT_MOVIE_KEY);
if (movie == null) {
movie = new Movie(Movie.NO_ID);
movie.setTitle("");
movie.setWatched(false);
} else {
editTitle.setText(movie.getTitle());
switchWatched.setChecked(movie.getWatched());
}
findViewById(R.id.button_save).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showKeyboard(context);
movie.setTitle(editTitle.getText().toString());
movie.setWatched(switchWatched.isChecked());
Intent resultIntent = new Intent();
resultIntent.putExtra(EDIT_MOVIE_KEY, movie);
setResult(Activity.RESULT_OK, resultIntent);
finish();
}
});
findViewById(R.id.button_delete).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showKeyboard(context);
Intent resultIntent = new Intent();
resultIntent.putExtra(EDIT_MOVIE_KEY, movie);
setResult(Constants.DELETE_RESULT_CODE, resultIntent);
finish();
}
});
editTitle.requestFocus();
showKeyboard(context);
}
public static void showKeyboard(Context context) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
}
} | [
"jbseppanen@gmail.com"
] | jbseppanen@gmail.com |
908ae5f69aa16545a17313056850fba3888ceee6 | e631409fc701bc3966a51868ce859cb0b590cac9 | /app/src/main/java/com/android/cameraclone/stats/Camera2FaceProxy.java | d7335aaf048aa172e505f34219104def9b135c2f | [] | no_license | abhinay100/cameraApp | de22d6df9636baf76851220fe1168ddc236a784c | f03c2b51e52aa1c8a552a0b1315951fbf37b939b | refs/heads/master | 2021-01-23T19:25:45.232844 | 2017-09-22T06:52:46 | 2017-09-22T06:52:46 | 102,819,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.cameraclone.stats;
import android.graphics.Rect;
import android.hardware.camera2.params.Face;
/**
* Wraps the Camera2 required class to insulate Kit-Kat devices from Camera2 API
* contamination.
*/
public class Camera2FaceProxy {
private final Rect mFaceRect;
private final int mScore;
public Camera2FaceProxy(Rect faceRect, int score) {
mFaceRect = faceRect;
mScore = score;
}
public static Camera2FaceProxy from(Face face) {
Camera2FaceProxy convertedFace = new Camera2FaceProxy(face.getBounds(), face.getScore());
return convertedFace;
}
public Rect getFaceRect() {
return mFaceRect;
}
public int getScore() {
return mScore;
}
}
| [
"abhinay212@gmail.com"
] | abhinay212@gmail.com |
2a733d3c4a58f36b128287a999f9c8e206055536 | 536c6ae32642863b5d8e695d963ee52bcabe1942 | /AndroidShaders/src/graphics/shaders/Object3D.java | 0c5c9c04ddeab1b50e76f09aaeba03e298510fb2 | [] | no_license | campeloal/monografia_opengles | 532ef14f8ba892cdb2802d6ad6b55975d402ec85 | b7ecf4ec959854d16fb5bd0cd3530373f0e761dc | refs/heads/master | 2020-05-18T09:19:04.504959 | 2014-04-29T04:29:00 | 2014-04-29T04:29:00 | 16,750,957 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,420 | java | package graphics.shaders;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import java.util.ArrayList;
import java.util.StringTokenizer;
import android.content.Context;
import android.util.Log;
public class Object3D {
/*************************
* PROPERTIES
************************/
// Constants
private static final int FLOAT_SIZE_BYTES = 4;
private static final int SHORT_SIZE_BYTES = 2;
// Vertices
private float _vertices[];
// Indices
private short _indices[];
// Buffers - index, vertex, normals and texcoords
private FloatBuffer _vb;
private FloatBuffer _nb;
private ShortBuffer _ib;
// Store the context
Context activity;
ArrayList<Float> mainBuffer;
ArrayList<Short> indicesB;
// keep reading vertices
ArrayList<Float> vs = new ArrayList<Float>(1000); // vertices
ArrayList<Float> tc = new ArrayList<Float>(1000); // texture coords
ArrayList<Float> ns = new ArrayList<Float>(1000); // normals
ArrayList<Integer> vertIndex = new ArrayList<Integer>(1000);
ArrayList<Integer> normalIndex = new ArrayList<Integer>(1000);
ArrayList<Integer> texIndex = new ArrayList<Integer>(1000);
int numVertices = 0;
int numNormals = 0;
int numTexCoords = 0;
boolean hasTexture = false;
short index = 0;
int objID;
public Object3D(int objID,Context activity){
this.activity = activity;
this.objID = objID;
loadFile();
}
private int loadFile() {
//Log.d("Start-loadFile", "Starting loadFile");
try {
// Read the file from the resource
//Log.d("loadFile", "Trying to buffer read");
InputStream inputStream = activity.getResources().openRawResource(objID);
// setup Bufferedreader
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
loadOBJ(in);
// Generate your vertex, normal and index buffers
// vertex buffer
_vb = ByteBuffer.allocateDirect(_vertices.length
* FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
_vb.put(_vertices);
_vb.position(0);
// index buffer
_ib = ByteBuffer.allocateDirect(_indices.length
* SHORT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asShortBuffer();
_ib.put(_indices);
_ib.position(0);
//Log.d("loadFile - size", _indices.length/3 + "," + _vertices.length);
// close the reader
in.close();
return 1;
} catch (Exception e) {
//Log.d("Error-LoadFile", "FOUND ERROR: " + e.toString());
return 0;
}
}
private int loadOBJ(BufferedReader in) throws Exception {
try {
//Log.d("In OBJ:", "First");
/* read vertices first */
String str;
mainBuffer = new ArrayList<Float>(numVertices * 6);
indicesB = new ArrayList<Short>(numVertices * 3);
while((str = in.readLine()) != null)
{
StringTokenizer t = new StringTokenizer(str);
String type = t.nextToken();
if (type.equals("v")) {
vs.add(Float.parseFloat(t.nextToken())); // x
vs.add(Float.parseFloat(t.nextToken())); // y
vs.add(Float.parseFloat(t.nextToken())); // z
numVertices++;
}
// read tex coords
if (type.equals("vt"))
{
if(!hasTexture)
hasTexture = true;
tc.add(Float.parseFloat(t.nextToken())); // u
tc.add(Float.parseFloat(t.nextToken())); // v
numTexCoords++;
}
// read vertex normals
if (type.equals("vn"))
{
ns.add(Float.parseFloat(t.nextToken())); // x
ns.add(Float.parseFloat(t.nextToken())); // y
ns.add(Float.parseFloat(t.nextToken())); // y
numNormals++;
}
// now read all the faces
if (type.equals("f"))
{
if(hasTexture)
{
loadFaceTexture(t);
}
else
{
loadFaceNoTexture(t);
}
}
}
for (int i =0; i<vertIndex.size();i++)
{
// Add all the vertex info
mainBuffer.add(vs.get(vertIndex.get(i) * 3)); // x
mainBuffer.add(vs.get(vertIndex.get(i) * 3 + 1));// y
mainBuffer.add(vs.get(vertIndex.get(i) * 3 + 2));// z
// add the normal info
mainBuffer.add(-ns.get(normalIndex.get(i) * 3)); // x
mainBuffer.add(-ns.get(normalIndex.get(i) * 3 + 1)); // y
mainBuffer.add(-ns.get(normalIndex.get(i) * 3 + 2)); // z
// add the tex coord info
mainBuffer.add(tc.get(texIndex.get(i) * 2)); // u
mainBuffer.add(tc.get(texIndex.get(i) * 2 + 1)); // v
}
mainBuffer.trimToSize();
_vertices = new float[mainBuffer.size()];
// copy over the mainbuffer to the vertex + normal array
for(int i = 0; i < mainBuffer.size(); i++)
{
_vertices[i] = mainBuffer.get(i);
}
Log.d("COMPLETED TRANSFER:", "VERTICES: " + _vertices.length);
// copy over indices buffer
indicesB.trimToSize();
_indices = new short[indicesB.size()];
for(int i = 0; i < indicesB.size(); i++) {
_indices[i] = indicesB.get(i);
}
return 1;
} catch(Exception e) {
throw e;
}
}
public void loadFaceTexture(StringTokenizer t){
String fFace;
StringTokenizer ft;
for (int j = 0; j < 3; j++)
{
fFace = t.nextToken();
// another tokenizer - based on /
ft = new StringTokenizer(fFace, "/");
vertIndex.add(Integer.parseInt(ft.nextToken()) - 1);
texIndex.add(Integer.parseInt(ft.nextToken()) - 1);
normalIndex.add(Integer.parseInt(ft.nextToken()) - 1);
// Add to the index buffer
indicesB.add(index++);
}
}
public void loadFaceNoTexture(StringTokenizer t){
String fFace;
StringTokenizer ft;
for (int j = 0; j < 3; j++)
{
fFace = t.nextToken();
// another tokenizer - based on /
ft = new StringTokenizer(fFace, "//");
vertIndex.add(Integer.parseInt(ft.nextToken()) - 1);
texIndex.add(0);
normalIndex.add(Integer.parseInt(ft.nextToken()) - 1);
// Add to the index buffer
indicesB.add(index++);
}
if(tc.isEmpty())
{
tc.add((float) 1.0); // u
tc.add((float) 1.0); // v
}
}
public float[] get_vertices() {
return _vertices;
}
public void set_vertices(float[] _vertices) {
this._vertices = _vertices;
}
public short[] get_indices() {
return _indices;
}
public FloatBuffer get_vb() {
return this._vb;
}
public FloatBuffer get_nb() {
return this._nb;
}
public ShortBuffer get_ib() {
return this._ib;
}
}
| [
"chevalier.beaumont@gmail.com"
] | chevalier.beaumont@gmail.com |
4203a1c4dc97851f03bdf80b8121a68a623a3136 | 050c1e416d93dcd0d7dff0ad29c699824b5a427b | /android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/bumptech/glide/R.java | b5399a608fa27bc516c757e0368286af0b1bbde5 | [] | no_license | redwin-0007/BMI | 0f56e374e4bf6f35b0afe4d0aa153587638e7df2 | bb9cf6a8e97a82e9015ea2981009797ab74c4d83 | refs/heads/master | 2022-12-21T06:38:46.176935 | 2020-10-03T05:28:05 | 2020-10-03T05:28:05 | 300,801,410 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,595 | 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 com.bumptech.glide;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int coordinatorLayoutStyle = 0x7f0300c6;
public static final int font = 0x7f030123;
public static final int fontProviderAuthority = 0x7f030125;
public static final int fontProviderCerts = 0x7f030126;
public static final int fontProviderFetchStrategy = 0x7f030127;
public static final int fontProviderFetchTimeout = 0x7f030128;
public static final int fontProviderPackage = 0x7f030129;
public static final int fontProviderQuery = 0x7f03012a;
public static final int fontStyle = 0x7f03012b;
public static final int fontWeight = 0x7f03012d;
public static final int keylines = 0x7f03016a;
public static final int layout_anchor = 0x7f03016f;
public static final int layout_anchorGravity = 0x7f030170;
public static final int layout_behavior = 0x7f030171;
public static final int layout_dodgeInsetEdges = 0x7f030174;
public static final int layout_insetEdge = 0x7f030175;
public static final int layout_keyline = 0x7f030176;
public static final int statusBarBackground = 0x7f030212;
}
public static final class bool {
private bool() {}
public static final int abc_action_bar_embed_tabs = 0x7f040000;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f0500b4;
public static final int notification_icon_bg_color = 0x7f0500b5;
public static final int ripple_material_light = 0x7f0500c0;
public static final int secondary_text_default_material_light = 0x7f0500c2;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f060055;
public static final int compat_button_inset_vertical_material = 0x7f060056;
public static final int compat_button_padding_horizontal_material = 0x7f060057;
public static final int compat_button_padding_vertical_material = 0x7f060058;
public static final int compat_control_corner_material = 0x7f060059;
public static final int notification_action_icon_size = 0x7f060130;
public static final int notification_action_text_size = 0x7f060131;
public static final int notification_big_circle_margin = 0x7f060132;
public static final int notification_content_margin_start = 0x7f060133;
public static final int notification_large_icon_height = 0x7f060134;
public static final int notification_large_icon_width = 0x7f060135;
public static final int notification_main_column_padding_top = 0x7f060136;
public static final int notification_media_narrow_margin = 0x7f060137;
public static final int notification_right_icon_size = 0x7f060138;
public static final int notification_right_side_padding_top = 0x7f060139;
public static final int notification_small_icon_background_padding = 0x7f06013a;
public static final int notification_small_icon_size_as_large = 0x7f06013b;
public static final int notification_subtext_size = 0x7f06013c;
public static final int notification_top_pad = 0x7f06013d;
public static final int notification_top_pad_large_text = 0x7f06013e;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f070096;
public static final int notification_bg = 0x7f070097;
public static final int notification_bg_low = 0x7f070098;
public static final int notification_bg_low_normal = 0x7f070099;
public static final int notification_bg_low_pressed = 0x7f07009a;
public static final int notification_bg_normal = 0x7f07009b;
public static final int notification_bg_normal_pressed = 0x7f07009c;
public static final int notification_icon_background = 0x7f07009d;
public static final int notification_template_icon_bg = 0x7f07009e;
public static final int notification_template_icon_low_bg = 0x7f07009f;
public static final int notification_tile_bg = 0x7f0700a0;
public static final int notify_panel_notification_icon_bg = 0x7f0700a1;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f080039;
public static final int action_divider = 0x7f08003b;
public static final int action_image = 0x7f08003c;
public static final int action_text = 0x7f080042;
public static final int actions = 0x7f080043;
public static final int async = 0x7f08004b;
public static final int blocking = 0x7f08004e;
public static final int bottom = 0x7f08004f;
public static final int chronometer = 0x7f080062;
public static final int end = 0x7f08007c;
public static final int forever = 0x7f080091;
public static final int glide_custom_view_target_tag = 0x7f080096;
public static final int icon = 0x7f08009b;
public static final int icon_group = 0x7f08009c;
public static final int info = 0x7f0800a0;
public static final int italic = 0x7f0800a1;
public static final int left = 0x7f0800a5;
public static final int line1 = 0x7f0800a7;
public static final int line3 = 0x7f0800a8;
public static final int none = 0x7f0800ce;
public static final int normal = 0x7f0800cf;
public static final int notification_background = 0x7f0800d0;
public static final int notification_main_column = 0x7f0800d1;
public static final int notification_main_column_container = 0x7f0800d2;
public static final int right = 0x7f0800e0;
public static final int right_icon = 0x7f0800e1;
public static final int right_side = 0x7f0800e2;
public static final int start = 0x7f080113;
public static final int tag_transition_group = 0x7f08011e;
public static final int text = 0x7f080123;
public static final int text2 = 0x7f080124;
public static final int time = 0x7f08012e;
public static final int title = 0x7f08012f;
public static final int top = 0x7f080132;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f090017;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0b004c;
public static final int notification_action_tombstone = 0x7f0b004d;
public static final int notification_template_custom_big = 0x7f0b0054;
public static final int notification_template_icon_group = 0x7f0b0055;
public static final int notification_template_part_chronometer = 0x7f0b0059;
public static final int notification_template_part_time = 0x7f0b005a;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0e0094;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0f0160;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0161;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0163;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0166;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0168;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f024e;
public static final int Widget_Compat_NotificationActionText = 0x7f0f024f;
public static final int Widget_Support_CoordinatorLayout = 0x7f0f02b6;
}
public static final class styleable {
private styleable() {}
public static final int[] CoordinatorLayout = { 0x7f03016a, 0x7f030212 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f03016f, 0x7f030170, 0x7f030171, 0x7f030174, 0x7f030175, 0x7f030176 };
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 = { 0x7f030125, 0x7f030126, 0x7f030127, 0x7f030128, 0x7f030129, 0x7f03012a };
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, 0x7f030123, 0x7f03012b, 0x7f03012c, 0x7f03012d, 0x7f030278 };
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;
}
}
| [
"redwin0007@gmail.com"
] | redwin0007@gmail.com |
ea807525ad453efab0ee4017e56747fe85c7635d | e33a14ea3bfc98e4d362a7b6ae2e2f0850834f06 | /app/src/main/java/tech/linjiang/android/pandora/db/KeyDatabase.java | 85665e2b12af2dd46bd6301f5fd8d6816a3b85c1 | [
"Apache-2.0"
] | permissive | morristech/pandora | 139c2d80386285b9203b141aa926cd78a91f9d4d | f85fbbe67b555d531b37c86da9c7513624eda60a | refs/heads/master | 2020-04-04T08:33:07.715399 | 2018-10-31T02:23:40 | 2018-10-31T02:23:40 | 155,785,557 | 1 | 0 | Apache-2.0 | 2018-11-01T22:53:43 | 2018-11-01T22:53:42 | null | UTF-8 | Java | false | false | 1,409 | java | package tech.linjiang.android.pandora.db;
import android.arch.persistence.db.SupportSQLiteDatabase;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.Room;
import android.arch.persistence.room.RoomDatabase;
import android.arch.persistence.room.migration.Migration;
import android.support.annotation.NonNull;
import tech.linjiang.android.pandora.MyApp;
import tech.linjiang.android.pandora.db.dao.KeyDao;
import tech.linjiang.android.pandora.db.entity.KeyValue;
/**
* Created by linjiang on 2018/3/13.
*/
@Database(
entities = {
KeyValue.class
},
version = 1,
exportSchema = false)
public abstract class KeyDatabase extends RoomDatabase {
public static final String TAG = "KeyDatabase";
public abstract KeyDao keyDao();
private static KeyDatabase db =
Room.databaseBuilder(MyApp.getContext(), KeyDatabase.class, "key.db")
.allowMainThreadQueries()
.addMigrations(
new MIGRATE_1_2()
)
.build();
public static KeyDatabase get() {
return db;
}
private static class MIGRATE_1_2 extends Migration {
MIGRATE_1_2() {
super(1, 2);
}
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
}
}
}
| [
"y837979117@gmail.com"
] | y837979117@gmail.com |
2bb6f8b0a89c71656e688a95bc01c792183031ca | d37351bd644f7fa08e51bfd1d7fe08dbee55c591 | /echo-model/src/main/java/com/netflix/spinnaker/echo/model/trigger/ArtifactoryEvent.java | 10eeb3f40f2b47628cf49b8e7deab6ef447e3c54 | [
"Apache-2.0"
] | permissive | spinnaker/echo | cca4f2493498ed37016f8b826f4816d69b272ed9 | c24b570673fc0f441a65fb69f6936027905c686d | refs/heads/master | 2023-08-31T02:10:15.238645 | 2023-08-29T18:12:32 | 2023-08-29T18:12:32 | 21,145,185 | 74 | 849 | Apache-2.0 | 2023-09-07T17:49:14 | 2014-06-23T22:59:57 | Java | UTF-8 | Java | false | false | 1,192 | java | /*
* Copyright 2019 Pivotal, 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.netflix.spinnaker.echo.model.trigger;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.netflix.spinnaker.kork.artifacts.model.Artifact;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ArtifactoryEvent extends TriggerEvent {
public static final String TYPE = "artifactory";
private Content content;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Content {
private String name;
private Artifact artifact;
}
}
| [
"jkschneider@gmail.com"
] | jkschneider@gmail.com |
294b0d6e29f2c5f56f5c3b2d8328cad3e2734d65 | c890655375bdfdaa52773405886e0673759b74bb | /Examples/Test_Q3.java | c137d434ec919fbee644130a269b3c0145792237 | [] | no_license | LeviScott13/CS-1301 | 0113a418f347fc21ca3c90e0f711c9b1bc8ac8bd | 9df84014f3134bcb794f0e64749324c10f9c585d | refs/heads/master | 2020-08-02T00:41:29.781455 | 2019-09-28T03:39:09 | 2019-09-28T03:39:09 | 211,180,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | public class Test_Q3
{
public static void main (String [] args)
{
Object [] objects = {new Tiger(), new Chicken(), new Apple()};
for (int i = i; i < objects.length; i++)
{
if (objects[i] instanceof Edible)
System.out.println (((Edible)objects[i]).howToEat());
if (objects[i] instanceof Animal)
System.out.println (((Animal)objects[i]).sound());
}
}
} | [
"levi.sutton2013@gmail.com"
] | levi.sutton2013@gmail.com |
f32ca8126269751d07d0c1b4916c1ab63a054e3e | 1db13a2d49f08042e6c9a649da35222a0561d64e | /alogic-dbcp/src/main/java/com/logicbus/dbcp/sql/RowListener.java | a92bf1fa6daa6e846e5855c83dfcabcde0eee0ae | [] | no_license | ungfeng/alogic | 50ac39cbe0272f72bb598b71b0b26c9110064ded | 3db38a3e6a426072a93e402832abf5cde7e37102 | refs/heads/master | 2021-01-23T04:53:04.228241 | 2014-11-11T08:45:12 | 2014-11-11T08:45:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.logicbus.dbcp.sql;
/**
* 数据记录监听器
*
* @author duanyy
* @since 1.2.5
*
*/
public interface RowListener {
/**
* 数据行开始
* @param column 列数
* @return 数据行对象(由具体实现去定)
*/
public Object rowStart(int column);
/**
* 发现数据列
* @param cookies 数据行对象
* @param columnIndex 列索引(以0开始)
* @param name 数据行名称(SQL语句中指定,小写)
* @param value 数据对象
*/
public void columnFound(Object cookies,int columnIndex,String name,Object value);
/**
* 数据行结束
* @param cookies 数据行记录
*/
public void rowEnd(Object cookies);
}
| [
"hmyyduan@gmail.com"
] | hmyyduan@gmail.com |
1a2227589f5687596167ad9a553ec1fd87d3998e | 17dc1db25e28195c1ee40f2972f562b68845f1b1 | /quicktfs.apiclients.restapi/src/main/java/quicktfs/apiclients/restapi/RestClient.java | 5125bbc55c4cee04b48ad9a692c3fe8a7d7123eb | [] | no_license | Chips100/QuickTFS | a3eb2d126e06b5eb7e725e9b309e1cd8fbac3ff0 | 72d8131a932fb3e9579ede9b4c73fe58b860dc2d | refs/heads/master | 2020-03-08T11:06:30.496106 | 2018-06-16T07:13:29 | 2018-06-16T07:13:29 | 128,088,972 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,271 | java | package quicktfs.apiclients.restapi;
import quicktfs.apiclients.contracts.exceptions.ApiAccessException;
import quicktfs.apiclients.restapi.authentication.AuthenticatedIdentity;
/**
* Client for accessing a REST interface.
*/
public interface RestClient {
/**
* Executes a GET call to the REST interface.
* @param apiUrl Relative URL of the REST action that should be called.
* @param responseClass Type of the response for deserialization.
* @param <T> Type of the response.
* @return The result returned from the Api.
* @throws ApiAccessException Thrown if any errors occur while accessing the Api.
*/
<T> T get(String apiUrl, Class<T> responseClass) throws ApiAccessException;
/**
* Executes a PATCH call to the REST interface.
* @param apiUrl Relative URL of the REST action that should be called.
* @param body Body that will be sent with the patch request.
* @param responseClass Type of the response for deserialization.
* @param <TBody> Type of the body to send with the patch request.
* @param <TResponse> Type of the response.
* @return The result returned from the Api.
* @throws ApiAccessException Thrown if any errors occur while accessing the Api.
*/
@SuppressWarnings("UnusedReturnValue") // Will be used later.
<TBody, TResponse> TResponse patch(String apiUrl, TBody body, Class<TResponse> responseClass)
throws ApiAccessException;
/**
* Sets the credentials that should be used when accessing the REST interface.
* @param domain Name of the domain.
* @param username Name of the user.
* @param password Password of the account.
*/
void setCredentials(String domain, String username, String password);
/**
* Sets the current identity that has been received
* after successfully logging in with previously configured credentials.
* @param identity Identity that is currently logged in.
*/
void setCurrentIdentity(AuthenticatedIdentity identity);
/**
* Gets the identity that is currently logged in; or null if not logged in.
* @return The identity that is currently logged in; or null if not logged in.
*/
AuthenticatedIdentity getCurrentIdentity();
}
| [
"dennis.janiak@googlemail.com"
] | dennis.janiak@googlemail.com |
e9de14223197d64c081676c734da83b260dc5b7f | ff041d34bffa97c29defa4c8e241694f36a6111b | /src/test/java/ChatServerTest.java | c7a2af32f2b1593c657bf8548936389074d8de7e | [] | no_license | dev-null-org/ChatServerAPI | 375177949ff462501c9109e9945b00110e1d943b | 5dca9579feed7416c6006d6c7fb297627db6475b | refs/heads/master | 2023-03-21T20:55:13.832613 | 2021-03-09T08:48:24 | 2021-03-09T08:48:24 | 341,219,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java | import main.Main;
import main.chat.service.ChatRoomService;
import main.chat.service.MessageService;
import main.chat.service.UserService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import java.util.Random;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@SpringBootTest(classes = Main.class)
@AutoConfigureMockMvc
public class ChatServerTest {
@Autowired
UserService userService;
@Autowired
ChatRoomService chatRoomService;
@Autowired
MessageService messageService;
@Autowired
private MockMvc mockMvc;
@Test
public void notNull() {
Assertions.assertNotNull(userService);
Assertions.assertNotNull(chatRoomService);
Assertions.assertNotNull(messageService);
}
@Test
public void testGetRooms() throws Exception {
Random random=new Random();
this.mockMvc.perform(get("/room/all")).andDo(print()).andExpect(status().isOk());
}
} | [
"martinkos007@gmail.com"
] | martinkos007@gmail.com |
ab4d3d64ed365825d922d1fab298235d4300b86f | de27d94d512fc07d404f682468bbcfab4bbe516a | /Chapter3/Chapter3-ExternalValues/src/main/java/com/chohee/ExpressiveConfig.java | 602d68c658769344101f356274b7729d6bf7cfe1 | [] | no_license | choheekim/SpringInAction-Examples | 02826c0030edabd50c055a6329c1628581219d44 | bc20d51a0eeeb13475dff25b4925dad088cbdc5d | refs/heads/master | 2021-01-17T20:12:35.521485 | 2016-09-12T21:27:17 | 2016-09-12T21:27:17 | 66,697,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | package com.chohee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
/**
* Created by Chohee on 8/28/16.
*/
@Configuration
@PropertySource("app.properties")
public class ExpressiveConfig {
@Autowired
Environment env;
@Bean
public CompactDisc disc() {
System.out.println(env.getProperty("disc.title") + " " + env.getProperty("disc.artist"));
return new BlankDisc( env.getProperty("disc.title"), env.getProperty("disc.artist"));
}
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
| [
"kch5559@gmail.com"
] | kch5559@gmail.com |
3780c008a62183f571b4eb7d8824d81dc7d11cd0 | edae9bb9980176d85e4f0943896a995547b00dfe | /src/main/java/com/covid/relief/ui/CityAndResource.java | 298739c4ab41583555f9fdd6d2189de31a508a51 | [] | no_license | neeraj7/covid-relief-resources | ecb9ac8bc6dc634fd70bc8bc025e3a71d13e2f82 | 5966023ff2c792c5de5f1541f1efc22a4f2d891e | refs/heads/master | 2023-05-12T04:04:14.348525 | 2023-04-30T09:18:06 | 2023-04-30T09:18:06 | 362,869,001 | 0 | 0 | null | 2023-04-30T08:45:25 | 2021-04-29T15:48:06 | Java | UTF-8 | Java | false | false | 1,023 | java | //package com.covid.relief.ui;
//
//import java.util.stream.Collectors;
//
//import com.covid.relief.init.AppInitializer;
//import com.vaadin.flow.component.button.Button;
//import com.vaadin.flow.component.button.ButtonVariant;
//import com.vaadin.flow.component.combobox.ComboBox;
//import com.vaadin.flow.component.formlayout.FormLayout;
//import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
//import com.vaadin.flow.component.textfield.TextField;
//
//public class CityAndResource extends FormLayout {
//
// private TextField test = new TextField("this is a test");
// private ComboBox<String> list = new ComboBox<>("Select resource:");
// private Button next = new Button("Test button");
//
// public CityAndResource() {
// list.setItems(AppInitializer.getResourcesList().stream().map(qh -> qh.getResource()).collect(Collectors.toList()));
// HorizontalLayout buttons = new HorizontalLayout(next);
// next.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
// add(test, list, buttons);
// }
//
//}
| [
"kneeraj508@gmail.com"
] | kneeraj508@gmail.com |
8b2843c44af37f5297422d0103a2a6e9957d528b | 8f1f90adfdc6dbc9f09544097a197d3e69f98ae1 | /src/main/java/com/protest/protesting/config/SecurityConfigV2.java | c4ea0aa175009e874ac233f7e557377006a55813 | [] | no_license | fantman12/protesting-production | 66581ce31ca1f00de23bbeb6218c7e1bfe181223 | adb2350b3590d920d876b24767a4d76951dfbec7 | refs/heads/master | 2023-07-22T09:37:53.455028 | 2020-09-03T07:16:20 | 2020-09-03T07:16:20 | 292,184,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,950 | java | package com.protest.protesting.config;
import com.protest.protesting.filter.JwtAuthenticationFilter;
//import com.protest.protesting.filter.JwtAuthenticationFilterV2;
import com.protest.protesting.service.UserService;
import com.protest.protesting.utils.JwtUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@RequiredArgsConstructor
@EnableWebSecurity
public class SecurityConfigV2 extends WebSecurityConfigurerAdapter {
@Value("${jwt.secret}")
private String secret;
// @Autowired
// private JwtUtils jwtUtils;
//
// @Autowired
// private AuthenticationManager authenticationManager;
@Autowired UserService userService;
@Override
protected void configure(HttpSecurity http) throws Exception {
System.out.println("configure");
http
.httpBasic().disable()
.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests() // 요청에 대한 사용권한 체크
.antMatchers("/user/**").hasAuthority("ROLE_USER")
.antMatchers("/admin/**").hasAuthority("ROLE_ADMIN")
.anyRequest().permitAll()
.and();
// .addFilterBefore(new JwtAuthenticationFilter((AuthenticationManager) authenticationManager, jwtUtils),
// UsernamePasswordAuthenticationFilter.class);
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService).passwordEncoder(userService.passwordEncoder());
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public JwtUtils jwtUtils() {
return new JwtUtils(secret);
}
// @Bean
// public JwtAuthenticationFilter jwtAuthenticationFilter() throws Exception {
// return new JwtAuthenticationFilter(authenticationManager(), jwtUtils());
// }
}
| [
"fantman12@gmail.com"
] | fantman12@gmail.com |
3a78ba76773418676881828805d957f6d1a38db2 | dd871c4a556245cc18125bdd52b3d360068a9add | /src/main/java/ir/ac/aut/hesabgar_group/request/CreatingGroupRequest.java | c03f83bd3884e5dc554146d167e6f91ac9214de6 | [] | no_license | hesamrezaeii/Hesabgar_group | 4ecc8f7e23135db56e3de139bfb05b32a8e42b99 | ac65065d5a9c2fe95a3239b7cda718e1aa121d80 | refs/heads/main | 2023-07-24T23:47:36.618326 | 2021-09-08T17:44:38 | 2021-09-08T17:44:38 | 386,555,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package ir.ac.aut.hesabgar_group.request;
public class CreatingGroupRequest {
private String userId;
private String groupName;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}
| [
"hesamrezaei77@gmail.com"
] | hesamrezaei77@gmail.com |
f5c1fdc28959b4e1ffbad96b6c67894d2908f405 | 48e575a39a9dfd52ce395e599010d1a5ee052c80 | /chapter12/src/pk13/Dog.java | 1c99c06ac69206ae71af4d4f3cd660650344724f | [] | no_license | ksw1212/ksw12 | 08bddd3a69e66d66e83e7f5189a26d75eed9f1e1 | 44f5f6e5d58a72d5be7503f20d249a45462542b4 | refs/heads/master | 2023-06-10T17:57:48.060086 | 2021-07-06T00:32:25 | 2021-07-06T00:32:25 | 379,836,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 194 | java | package pk13;
public class Dog extends Animal{
public Dog() {
this.kind="포유류";
System.out.println(kind);
}
@Override
public void sound() {
System.out.println("멍멍");
}
}
| [
"rlatn@DESKTOP-KMHIAH6"
] | rlatn@DESKTOP-KMHIAH6 |
6af0716fa61240da21322215cb7dd9583454b6e3 | 148eac61bddad397e68a2ea893ab58baee8eccb5 | /app/src/androidTest/java/com/brendler/joe/sensortesting/ExampleInstrumentedTest.java | 29c27a0f23a8275b2e3c36a0bf2a37bff6e2ac7d | [] | no_license | JosephBrendler/MultiSensor | 493ea5d2cdcd0518054c4874a265d51559f48d5c | 0a8443278514a2f861fd37ea93992d9af84125b6 | refs/heads/master | 2022-12-21T07:07:08.450398 | 2022-12-16T21:09:16 | 2022-12-16T21:09:16 | 165,321,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.brendler.joe.sensortesting;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.brendler.joe.sensortesting", appContext.getPackageName());
}
}
| [
"joseph.brendler@googlemail.com"
] | joseph.brendler@googlemail.com |
ddf68ad31abd38a6b23ba6d93b2a4ffb89b96ccc | 90ea0162027a292b3477bee5827e00ebbf363ed0 | /ultimateandroidui/src/main/java/com/marshalchen/common/uimodule/niftymodaldialogeffects/NiftyDialogBuilder.java | 8e993946d52cb7c377ca21d3e0fed358f3c3c8dc | [] | no_license | caoxiaoliang/Yhb-2.0 | 120567ff7b33774b5dfdc765decdfbf09144fef9 | f36e894392e838f0d8a2b60de369b9ad50c2efdd | refs/heads/master | 2021-01-18T00:10:46.274969 | 2015-06-22T00:33:58 | 2015-06-22T00:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,386 | java | package com.marshalchen.common.uimodule.niftymodaldialogeffects;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.*;
import com.marshalchen.common.uimodule.R;
import com.marshalchen.common.uimodule.niftymodaldialogeffects.effects.BaseEffects;
/**
* Created by lee on 2014/7/30.
*/
public class NiftyDialogBuilder extends Dialog implements DialogInterface {
private final String defTextColor="#FFFFFFFF";
private final String defDividerColor="#11000000";
private final String defMsgColor="#FFFFFFFF";
private final String defDialogColor="#FFE74C3C";
private Effectstype type=null;
private LinearLayout mLinearLayoutView;
private RelativeLayout mRelativeLayoutView;
private LinearLayout mLinearLayoutMsgView;
private LinearLayout mLinearLayoutTopView;
private FrameLayout mFrameLayoutCustomView;
private View mDialogView;
private View mDivider;
private TextView mTitle;
private TextView mMessage;
private ImageView mIcon;
private Button mButton1;
private Button mButton2;
private int mDuration = -1;
private static int mOrientation=1;
private boolean isCancelable=true;
private static NiftyDialogBuilder instance;
public NiftyDialogBuilder(Context context) {
super(context);
init(context);
}
public NiftyDialogBuilder(Context context,int theme) {
super(context, theme);
init(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes((WindowManager.LayoutParams) params);
}
public static NiftyDialogBuilder getInstance(Context context) {
instance = new NiftyDialogBuilder(context,R.style.dialog_untran);
return instance;
}
private void init(Context context) {
mDialogView = View.inflate(context, R.layout.nifty_dialog_layout, null);
mLinearLayoutView=(LinearLayout)mDialogView.findViewById(R.id.parentPanel);
mRelativeLayoutView=(RelativeLayout)mDialogView.findViewById(R.id.main);
mLinearLayoutTopView=(LinearLayout)mDialogView.findViewById(R.id.topPanel);
mLinearLayoutMsgView=(LinearLayout)mDialogView.findViewById(R.id.contentPanel);
mFrameLayoutCustomView=(FrameLayout)mDialogView.findViewById(R.id.customPanel);
mTitle = (TextView) mDialogView.findViewById(R.id.alertTitle);
mMessage = (TextView) mDialogView.findViewById(R.id.message);
mIcon = (ImageView) mDialogView.findViewById(R.id.icon);
mDivider = mDialogView.findViewById(R.id.titleDivider);
mButton1=(Button)mDialogView.findViewById(R.id.button1);
mButton2=(Button)mDialogView.findViewById(R.id.button2);
setContentView(mDialogView);
this.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
mLinearLayoutView.setVisibility(View.VISIBLE);
if(type==null){
type=Effectstype.Slidetop;
}
start(type);
}
});
mRelativeLayoutView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (isCancelable)dismiss();
}
});
}
public void toDefault(){
mTitle.setTextColor(Color.parseColor(defTextColor));
mDivider.setBackgroundColor(Color.parseColor(defDividerColor));
mMessage.setTextColor(Color.parseColor(defMsgColor));
mLinearLayoutView.setBackgroundColor(Color.parseColor(defDialogColor));
}
public NiftyDialogBuilder withDividerColor(String colorString) {
mDivider.setBackgroundColor(Color.parseColor(colorString));
return this;
}
public NiftyDialogBuilder withTitle(CharSequence title) {
toggleView(mLinearLayoutTopView,title);
mTitle.setText(title);
return this;
}
public NiftyDialogBuilder withTitleColor(String colorString) {
mTitle.setTextColor(Color.parseColor(colorString));
return this;
}
public NiftyDialogBuilder withMessage(int textResId) {
toggleView(mLinearLayoutMsgView,textResId);
mMessage.setText(textResId);
return this;
}
public NiftyDialogBuilder withMessage(CharSequence msg) {
toggleView(mLinearLayoutMsgView,msg);
mMessage.setText(msg);
return this;
}
public NiftyDialogBuilder withMessageColor(String colorString) {
mMessage.setTextColor(Color.parseColor(colorString));
return this;
}
public NiftyDialogBuilder withIcon(int drawableResId) {
mIcon.setImageResource(drawableResId);
return this;
}
public NiftyDialogBuilder withIcon(Drawable icon) {
mIcon.setImageDrawable(icon);
return this;
}
public NiftyDialogBuilder withDuration(int duration) {
this.mDuration=duration;
return this;
}
public NiftyDialogBuilder withEffect(Effectstype type) {
this.type=type;
return this;
}
public NiftyDialogBuilder withButtonDrawable(int resid) {
mButton1.setBackgroundResource(resid);
mButton2.setBackgroundResource(resid);
return this;
}
public NiftyDialogBuilder withLeftButtonDrawable(int resid){
mButton1.setBackgroundResource(resid);
return this;
}
public NiftyDialogBuilder withRightButtonDrawable(int resid){
mButton2.setBackgroundResource(resid);
return this;
}
public NiftyDialogBuilder withButton1Text(CharSequence text) {
mButton1.setVisibility(View.VISIBLE);
mButton1.setText(text);
return this;
}
public NiftyDialogBuilder withButton2Text(CharSequence text) {
mButton2.setVisibility(View.VISIBLE);
mButton2.setText(text);
return this;
}
public NiftyDialogBuilder setButton1Click(View.OnClickListener click) {
mButton1.setOnClickListener(click);
return this;
}
public NiftyDialogBuilder setButton2Click(View.OnClickListener click) {
mButton2.setOnClickListener(click);
return this;
}
public NiftyDialogBuilder setCustomView(int resId, Context context) {
View customView = View.inflate(context, resId, null);
if (mFrameLayoutCustomView.getChildCount()>0){
mFrameLayoutCustomView.removeAllViews();
}
mFrameLayoutCustomView.addView(customView);
return this;
}
public NiftyDialogBuilder setCustomView(View view, Context context) {
if (mFrameLayoutCustomView.getChildCount()>0){
mFrameLayoutCustomView.removeAllViews();
}
mFrameLayoutCustomView.addView(view);
return this;
}
public NiftyDialogBuilder isCancelableOnTouchOutside(boolean cancelable) {
this.isCancelable=cancelable;
this.setCanceledOnTouchOutside(cancelable);
return this;
}
public NiftyDialogBuilder isCancelable(boolean cancelable) {
this.isCancelable=cancelable;
this.setCancelable(cancelable);
return this;
}
private void toggleView(View view,Object obj){
if (obj==null){
view.setVisibility(View.GONE);
}else {
view.setVisibility(View.VISIBLE);
}
}
@Override
public void show() {
super.show();
}
private void start(Effectstype type){
BaseEffects animator = type.getAnimator();
if(mDuration != -1){
animator.setDuration(Math.abs(mDuration));
}
animator.start(mRelativeLayoutView);
}
@Override
public void dismiss() {
super.dismiss();
mButton1.setVisibility(View.GONE);
mButton2.setVisibility(View.GONE);
}
}
| [
"871999566@qq.com"
] | 871999566@qq.com |
02f8f33c557d191a4e014e48279e0f43dfefd1c9 | 2f3c7964db7a15e62cdf7c25e5694567e5190da0 | /src/data_structure/dynamic_array/ArrayList_Generic.java | 80d6210a7a3e9d6223d5201fe17d002809078df4 | [] | no_license | HunLv/DataStructure_Mj | b9bcccf46f4529fb1eb17e15e7bd84b8201aa7c9 | bfb4c00708bf3ebb7c788415990406c9e6330974 | refs/heads/master | 2022-12-27T18:10:33.544170 | 2020-10-17T08:39:09 | 2020-10-17T08:39:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,564 | java | package data_structure.dynamic_array;
/**
* @program: DataStructure_Mj
* @description: 动态数组
* @author: MH
* @create: 2020-06-20 20:43
**/
public class ArrayList_Generic<E> {
private int size; // 当前数目
private E[] elements; // 所有元素
private static final int DEFAULT_CAPCITY = 2; // 默认容量
private static final int ELEMENT_NOT_FOUND = -1; // 元素找不到
public ArrayList_Generic(int capaticy) {
capaticy = (capaticy < DEFAULT_CAPCITY) ? DEFAULT_CAPCITY:capaticy;
// TODO 1 错误写法
// elements = new E[capaticy];
// TODO done
elements = (E[]) new Object[capaticy];
}
public ArrayList_Generic() {
this(DEFAULT_CAPCITY);
}
/**
* 1 元素的数量
* @return
*/
public int size() {
return size;
}
/**
* 1 是否为空
* @return
*/
public boolean isEmpty() {
if (size == 0) return true;
return false;
}
/**
* TODO 5 增加泛型之后,不应该使用 == 来比较对象的——直接用等号比的是内存地址是否相等
* TODO done 重写 person 的equals ,自定义比较标准
*
* TODO 6 null 比较的问题
* 2 查看元素的索引
* @param element
* @return
*/
public int indexOf(E element) {
// for (int i = 0; i < size; i++) {
// // todo 有问题的代码——比较
// if (elements[i] == element) return i;
//// todo 5 done,自定义 equals
// if (elements[i].equals(element)) return i;
// }
// todo 6 done
if (element == null){ // 为空,找第一个 为 null 的元素
for (int i = 0; i < size; i++) {
if (elements[i] == null) return i;
}
}else { // 不为空,找相同的元素
for (int i = 0; i < size; i++) {
// TODO 强调:这里使用 equals 重点是为用户 提供接口,不仅仅是 == 中简单的比较内存地址,而是可以自定义比较的内容
// 注意: 经过 判断, element 一定不为空,因此可以 调用 equals 方法
if (element.equals(elements[i])) return i;
}
}
return ELEMENT_NOT_FOUND;
}
/**
* 3 是否包含某个元素
* @param element
* @return
*/
public boolean contains(E element) {
// 可以复用之前的 劳动
return indexOf(element) != ELEMENT_NOT_FOUND;
}
/**
* 4 获取index位置的元素
* @param index
* @return
*/
public E get(int index) {
rangeCheck(index);
return elements[index];
}
/**
* 4 设置index位置的元素
* @param index
* @param element
* @return 原来的元素ֵ
*/
public E set(int index, E element) {
rangeCheck(index);
E old = elements[index];
elements[index] = element;
return old;
}
/**
* TODO 2 增加泛型支持后 需要 调整: 问什么之前(元素类型为 int )不需要调整? 为什么现在要调整? —— 可以利用的,旧重复利用,否则,滚蛋
* 5 清除所有元素
*/
public void clear() {
// TODO 注意区别开始的写法
// elements = null;
// TODO done 纠正
for (int i = 0; i < size; i++) {
elements[i] = null;
}
size = 0;
}
/**
* 6 打印 ArrayList
*/
@Override
public String toString() {
StringBuilder string= new StringBuilder();
// 格式为:size=3, [22,333,444]
string.append("size=").append(size).append(", [");
// 添加所有元素
for (int i = 0; i < size ; i++) {
if(i != 0){
string.append(",");
}
string.append(elements[i]);
}
string.append("]");
return string.toString();
}
/**
* 7 添加元素到尾部
* @param element
*/
public void add(E element) {
add(size,element);
}
/**
* TODO 3 也需要调整
* 8 删除index位置的元素
* @param index
* @return 返回被删除元素的值
*/
public E remove(int index) {
rangeCheck(index);
E old = elements[index];
for (int i = index + 1; i <= size - 1; i++) {
elements[i-1] = elements[i];
}
size--;
// TODO done 由于最后一个位置保存着原来 堆 空间 对象的 地址引用, 而 clear 清空后,这个引用仍存在,因此,需要清理这条引用线
elements[size] = null;
return old;
}
/**
* 9 在index位置插入一个元素
* @param index
* @param element
*/
public void add(int index, E element) {
rangeCheckForAdd(index);
// 动态扩容
ensureCapacity(size + 1);
/* 改正*/
for (int i = size - 1; i >= index; i--) {
// 向后 挪动
elements[i+1] = elements[i];
}
elements[index] = element;
size++;
}
/* 10 封装 检查范围的代码 */
private void outOfBounds(int index) {
throw new IndexOutOfBoundsException("Index " + index +",Size:"+size);
}
private void rangeCheck(int index) {
if(index < 0 || index >= size) {
outOfBounds(index);
}
}
private void rangeCheckForAdd(int index) {
if(index < 0 || index > size) {
outOfBounds(index);
}
}
/**
* 11 保证要有capacity的容量, 在添加元素的时候调用
* @param needCapicity 当前需要的容量
*/
private void ensureCapacity(int needCapicity) {
// 计算原来的容量——数组的长度
int oldCapacity = elements.length;
if (oldCapacity >= needCapicity) return;
// 新容量是旧容量 的 1.5 倍数,右移一位缩小一半
int newCapacity = oldCapacity+ (oldCapacity>>1);
// 新开辟一块内存
E[] newElements = (E[]) new Object[newCapacity];
// 复制
// TODO 4 错误写法
// for (int i = 0; i < newCapacity; i++) {
// TODO done 纠正, 拷贝的仅仅是原来有的个数
for (int i = 0; i < size; i++) {
newElements[i] = elements[i];
}
elements = newElements;
System.out.println("原来内存由 "+oldCapacity+" 变为 "+ newCapacity);
}
}
| [
"2651016635@qq.com"
] | 2651016635@qq.com |
6809037faf98ef7be3939f4f2f15589586ed4463 | 710a35b74c464fb0545c7b61b4cecf4b838b28d1 | /app/src/main/java/com/example/yandre/biontest/ui/calculator/CalculatorFragment.java | cc17399ad476bd1e488fc628e69021c320f2ff1d | [] | no_license | YandreNagorniy/Biontest | e31656937d82fb5f443cab6bac1f9d702aec7496 | 01ab7df05d1c47975e746614b4a7d0f248a8c163 | refs/heads/master | 2020-04-16T20:54:37.825499 | 2018-12-31T11:39:23 | 2018-12-31T11:39:23 | 165,909,658 | 2 | 0 | null | 2019-01-20T19:02:21 | 2019-01-15T19:21:29 | Java | UTF-8 | Java | false | false | 953 | java | package com.example.yandre.biontest.ui.calculator;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.yandre.biontest.R;
import com.example.yandre.biontest.databinding.FragmentCalculatorBinding;
public class CalculatorFragment extends Fragment {
FragmentCalculatorBinding binding;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(
inflater, R.layout.fragment_calculator, container, false);
return binding.getRoot();
}
}
| [
"yandre00111@gmail.com"
] | yandre00111@gmail.com |
3e9ca5a25cd712e236847a9c636428b13536519c | 8589b88c863933d24039f21e644576f793f76115 | /org.blackbox.execution.parent/org.blackbox.execution.routing/src/main/java/org/blackbox/execution/routing/c3/model/Output.java | 050702841a120f066c7856e7d05eae11d1f34620 | [] | no_license | Falzi/Blackbox-Execution | 07e79f2b641b28cbb11948a50e6293104079951c | 13bc3d76d471c45551eb974e8edc3237617f4b9a | refs/heads/master | 2016-09-05T10:06:05.866892 | 2014-01-24T22:24:29 | 2014-01-24T22:25:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | package org.blackbox.execution.routing.c3.model;
public class Output {
public double[] array;
}
| [
"elise.falzi@wanadoo.fr"
] | elise.falzi@wanadoo.fr |
7811ac8492342c46397a3ca80921c96513ae3e09 | 3464004c6217bb20907a3ab1372c22635809b011 | /jms-webservice/jms-webservice-store/src/main/java/com/jms/service/store/CostCenterService.java | 61b5e9a5d4deb70361be67a163c079a5fad06c20 | [] | no_license | jmsCompany/jms-server1 | d675385c22566f6c3b2108aef36d44508924fe95 | 50bef61d1a8929e5d5e71ec4994b23eef9c241ef | refs/heads/master | 2021-01-19T09:29:30.420778 | 2017-08-29T07:03:21 | 2017-08-29T07:03:21 | 87,761,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,222 | java | package com.jms.service.store;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jms.domain.db.FCostCenter;
import com.jms.domain.db.Users;
import com.jms.domain.ws.Valid;
import com.jms.domain.ws.f.WSFCostCenter;
import com.jms.domainadapter.BeanUtil;
import com.jms.repositories.company.CompanyRepository;
import com.jms.repositories.f.FCostCenterRepository;
import com.jms.web.security.SecurityUtils;
@Service
@Transactional
public class CostCenterService {
private static final Logger logger = LogManager.getLogger(CostCenterService.class
.getCanonicalName());
@Autowired
private FCostCenterRepository fCostCenterRepository;
@Autowired
private CompanyRepository companyRepository;
@Autowired
private SecurityUtils securityUtils;
@Transactional(readOnly=true)
public List<WSFCostCenter> getCostCenterList() throws Exception {
Users u = securityUtils.getCurrentDBUser();
List<FCostCenter> costCenters = fCostCenterRepository.getByCompanyId(u.getCompany().getIdCompany());
List<WSFCostCenter> wsCostCenters = new ArrayList<WSFCostCenter>();
for(FCostCenter s:costCenters)
{
wsCostCenters.add(toWSCostCenter(s));
}
return wsCostCenters;
}
@Transactional(readOnly=false)
public WSFCostCenter saveWSFCostCenter(WSFCostCenter wsFCostCenter) throws Exception {
FCostCenter fCostCenter;
if(wsFCostCenter.getIdCostCenter()!=null&&!wsFCostCenter.getIdCostCenter().equals(0l))
{
fCostCenter = fCostCenterRepository.findOne(wsFCostCenter.getIdCostCenter());
}
else
{
fCostCenter = new FCostCenter();
}
FCostCenter dbFCostCenter = toDBFCostCenter(wsFCostCenter,fCostCenter);
fCostCenterRepository.save(dbFCostCenter);
wsFCostCenter.setIdCostCenter(dbFCostCenter.getIdCostCenter());
return wsFCostCenter;
}
@Transactional(readOnly=false)
public Valid deleteFCostCenter(Long fCostCenterId)
{
Valid valid = new Valid();
fCostCenterRepository.delete(fCostCenterId);
valid.setValid(true);
return valid;
}
@Transactional(readOnly=true)
public WSFCostCenter findFCostCenter(Long fCostCenterId) throws Exception
{
FCostCenter fCostCenter = fCostCenterRepository.findOne(fCostCenterId);
return toWSCostCenter(fCostCenter);
}
private FCostCenter toDBFCostCenter(WSFCostCenter wsFCostCenter,FCostCenter fCostCenter) throws Exception
{
FCostCenter dbFCostCenter = (FCostCenter)BeanUtil.shallowCopy(wsFCostCenter, FCostCenter.class, fCostCenter);
dbFCostCenter.setCompany(securityUtils.getCurrentDBUser().getCompany());
return dbFCostCenter;
}
private WSFCostCenter toWSCostCenter(FCostCenter fCostCenter) throws Exception
{
WSFCostCenter fc = (WSFCostCenter)BeanUtil.shallowCopy(fCostCenter, WSFCostCenter.class, null);
if(fCostCenter.getCompany()!=null)
{
fc.setCompanyId(fCostCenter.getCompany().getIdCompany());
fc.setCompanyName(fCostCenter.getCompany().getCompanyName());
}
return fc;
}
}
| [
"h-t-ren@icloud.com"
] | h-t-ren@icloud.com |
d4551e580c2a5306096d485c0a118ee6321a8768 | f2572433519cf82e981adf972a5b0d93aaa9bf5a | /src/main/java/com/albion/core/ListNode.java | 77d625e8454baf3a6acd78da26dcf1d7bbda6376 | [] | no_license | KyleLearnedThis/CodingChallenges | eda0639387c20ecbe4a1328fb64b45a8d3863721 | 3933ab1c1e1445d1c78e77818cbc60d696c68f6b | refs/heads/master | 2021-09-14T07:02:49.683825 | 2017-10-11T03:55:24 | 2017-10-11T03:55:24 | 77,719,000 | 0 | 0 | null | 2017-10-11T03:55:25 | 2016-12-31T01:16:50 | Java | UTF-8 | Java | false | false | 177 | java | package com.albion.core;
public class ListNode {
public int val;
public ListNode next;
public ListNode(int x) {
val = x;
next = null;
}
} | [
"kyle.learned.this@gmail.com"
] | kyle.learned.this@gmail.com |
bf1d8561669f7eaf69b7f807dc92615dd308fd69 | c1d6a9ec1e6fc769faf61f5970d181e9aa98a0ac | /app/src/main/java/com/winklix/indu/gooni/imageslider/FlipperAdapter.java | 70369b7dbb139b878acfb108a3a946bc5ed02376 | [] | no_license | funnynikit/Ecommerce-App | a2394d38ad0fc13e907f05b04602ce249b4405f5 | fa5e884304457cf0afde2ffef8797871286849be | refs/heads/master | 2020-04-01T21:22:34.635536 | 2018-10-18T16:15:36 | 2018-10-18T16:15:36 | 153,652,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,589 | java | package com.winklix.indu.gooni.imageslider;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
class FlipperAdapter extends PagerAdapter {
private Context context;
private ArrayList<FlipperView> flipperViews = new ArrayList<>();
FlipperAdapter(Context context) {
this.context = context;
}
public void setFlipperViews(ArrayList<FlipperView> flipperViews) {
this.flipperViews = flipperViews;
}
void addFlipperView(FlipperView view) {
flipperViews.add(view);
notifyDataSetChanged();
}
public void removeAllFlipperViews() {
flipperViews.clear();
notifyDataSetChanged();
}
public FlipperView getFlipperView(int position) {
if (flipperViews.isEmpty() || position >= flipperViews.size()) {
return null;
}
return flipperViews.get(position);
}
@Override
public int getCount() {
return flipperViews.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
FlipperView imageFlipperView = flipperViews.get(position);
View v = imageFlipperView.getView();
container.addView(v);
return v;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
}
| [
"kumar.nikit1@gmail.com"
] | kumar.nikit1@gmail.com |
f1d0b81a9a563def188705c43cd6846184a3c5d3 | 24d8cf871b092b2d60fc85d5320e1bc761a7cbe2 | /iText/rev2818-4022/left-trunk-4022/core/com/lowagie/text/pdf/fonts/cmaps/CMap.java | a3b87084df79c54c4388a3cb49f47ee2cf1475aa | [] | no_license | joliebig/featurehouse_fstmerge_examples | af1b963537839d13e834f829cf51f8ad5e6ffe76 | 1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad | refs/heads/master | 2016-09-05T10:24:50.974902 | 2013-03-28T16:28:47 | 2013-03-28T16:28:47 | 9,080,611 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,993 | java |
package com.lowagie.text.pdf.fonts.cmaps;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CMap
{
private List codeSpaceRanges = new ArrayList();
private Map singleByteMappings = new HashMap();
private Map doubleByteMappings = new HashMap();
public CMap()
{
}
public boolean hasOneByteMappings()
{
return !singleByteMappings.isEmpty();
}
public boolean hasTwoByteMappings()
{
return !doubleByteMappings.isEmpty();
}
public String lookup( byte[] code, int offset, int length )
{
String result = null;
Integer key = null;
if( length == 1 )
{
key = new Integer( code[offset] & 0xff );
result = (String)singleByteMappings.get( key );
}
else if( length == 2 )
{
int intKey = code[offset] & 0xff;
intKey <<= 8;
intKey += code[offset+1] & 0xff;
key = new Integer( intKey );
result = (String)doubleByteMappings.get( key );
}
return result;
}
public void addMapping( byte[] src, String dest ) throws IOException
{
if( src.length == 1 )
{
singleByteMappings.put( new Integer( src[0] & 0xff ), dest );
}
else if( src.length == 2 )
{
int intSrc = src[0]&0xFF;
intSrc <<= 8;
intSrc |= (src[1]&0xFF);
doubleByteMappings.put( new Integer( intSrc), dest );
}
else
{
throw new IOException( "Mapping code should be 1 or two bytes and not " + src.length );
}
}
public void addCodespaceRange( CodespaceRange range )
{
codeSpaceRanges.add( range );
}
public List getCodeSpaceRanges()
{
return codeSpaceRanges;
}
} | [
"joliebig@fim.uni-passau.de"
] | joliebig@fim.uni-passau.de |
e86a0248bd9ba67f911bfb8eb3bb1c959d663e8c | f5ce1cc9e0f18c15ba37b497ce7ab0e5e4746682 | /app/src/main/java/com/example/admin/exercise/data/local/db/DbHelper.java | b075ba0c2a62c153d43ab422aa43a5d67579cb75 | [] | no_license | davran312/mvvmTestingProjetc | a22ab6c7a2d71c397a76463aefc41b88a7619c3b | 5b30b8aa1503c712091ff4b4ee3ebffe1bec8c76 | refs/heads/master | 2020-03-30T15:58:53.556866 | 2018-10-03T09:25:02 | 2018-10-03T09:25:02 | 151,388,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,266 | java | package com.example.admin.exercise.data.local.db;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.admin.exercise.model.ApplicationContext;
import com.example.admin.exercise.model.DatabaseInfo;
import com.example.admin.exercise.model.User;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class DbHelper extends SQLiteOpenHelper {
private static final String USER_TABLE_NAME = "users";
private static final String USER_COLUMN_USER_ID = "id";
private static final String USER_COLUMN_USER_NAME = "usr_name";
private static final String USER_COLUMN_USER_ADDRESS = "usr_address";
private static final String USER_COLUMN_USER_CREATED_AT = "created_at";
private static final String USER_COLUMN_USER_UPDATED_AT = "updated_at";
@Inject
public DbHelper(@ApplicationContext Context context,
@DatabaseInfo String dbName,
@DatabaseInfo Integer version){
super(context,dbName,null,version);
}
@Override
public void onCreate(SQLiteDatabase db) {
tableCreateStatements(db);
}
private void tableCreateStatements(SQLiteDatabase db) {
try{
db.execSQL("CREATE TABLE IF NOT EXISTS"+
USER_TABLE_NAME+"("
+USER_COLUMN_USER_ID + "INTEGER PRIMARY KEY AUTOINCREMENT,"
+USER_COLUMN_USER_NAME + " VARCHAR(20),"
+USER_COLUMN_USER_ADDRESS+"VARCHAR(50),"
+USER_COLUMN_USER_CREATED_AT+"VARCHAR(10) DEFAULT"+getCurrentTimeStamp()+ ","
+USER_COLUMN_USER_UPDATED_AT+"VARCHAR(10) DEFAULT"+getCurrentTimeStamp()+")");
}catch (SQLException e){
e.printStackTrace();
}
}
public User getUser(Long userId) throws Resources.NotFoundException,
NullPointerException{
Cursor cursor = null;
try{
SQLiteDatabase db = this.getReadableDatabase();
cursor = db.rawQuery(
"SELECT * FROM "
+USER_TABLE_NAME
+" WHERE "
+USER_COLUMN_USER_ID
+ " = ?",new String[]{userId + ""}
);
if(cursor.getCount() > 0) {
cursor.moveToFirst();
User user = new User();
user.setId(cursor.getLong(cursor.getColumnIndex(USER_COLUMN_USER_ID)));
user.setName(cursor.getString(cursor.getColumnIndex(USER_COLUMN_USER_NAME)));
user.setAddress(cursor.getString(cursor.getColumnIndex(USER_COLUMN_USER_ADDRESS)));
user.setCreatedAt(cursor.getString(cursor.getColumnIndex(USER_COLUMN_USER_CREATED_AT)));
user.setUpdatedAt(cursor.getString(cursor.getColumnIndex(USER_COLUMN_USER_UPDATED_AT)));
return user;
}
else {
throw new Resources.NotFoundException("User with id "+userId+ " does not exists");
}
}catch (NullPointerException e){
e.printStackTrace();
throw e;
}finally {
if(cursor != null)
cursor.close();
}
}
private String getCurrentTimeStamp() {
return String.valueOf(System.currentTimeMillis()/1000);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+ USER_TABLE_NAME);
onCreate(db);
}
public Long insertUser(User user) throws Exception{
try{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(USER_COLUMN_USER_NAME,user.getName());
contentValues.put(USER_COLUMN_USER_ADDRESS,user.getAddress());
contentValues.put(USER_COLUMN_USER_ADDRESS,user.getAddress());
return db.insert(USER_TABLE_NAME,null,contentValues);
}
catch (Exception e){
e.printStackTrace();
throw e;
}
}
}
| [
"shohkarim7@gmail.com"
] | shohkarim7@gmail.com |
2d287dffe71cafdede32dccda67b09ddcd552b9c | 7a2e4d5ebda46c70054aeae83dd80ca74d9838d5 | /src/main/java/org/glsid/metier/CompteMetierImpl.java | c504756d37121b040c5a4d8714b3563b1fbc78cc | [] | no_license | mahugnon/BanqueSI | adf4a9b8a49afa4cc9cfefafcc644ada021675bc | e2e5ea885ae647b14bc566b7e679c58899e6d065 | refs/heads/master | 2020-05-29T19:17:00.928515 | 2017-02-20T23:02:25 | 2017-02-20T23:02:25 | 82,611,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | package org.glsid.metier;
import java.util.Date;
import java.util.List;
import org.glsid.dao.JpaRepository.CompteRepository;
import org.glsid.dao.entities.Compte;
import org.glsid.dao.entities.Employe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CompteMetierImpl implements CompteMetier{
@Autowired
private CompteRepository compteRepository;
@Override
public Compte saveCompte(Compte cp) {
cp.setDateCreation(new Date());
return compteRepository.save(cp);
}
@Override
public List<Compte> listCompte() {
return compteRepository.findAll();
}
@Override
public Compte getCompte(String code) {
return compteRepository.findOne(code);
}
}
| [
"TECHNOPC@TECHNOPC-PC"
] | TECHNOPC@TECHNOPC-PC |
205b714eb7fd2fcb8eadffca54c1f2b08bc1c331 | de6182d88d83298af7d8a700f3cf250893982cf0 | /src/main/java/com/plantserver/entity/TTTT.java | 2884dfe6e013529c4a79b776e6ae3a9b3fbbba24 | [
"Apache-2.0"
] | permissive | Brand960/Akyc_PlantServer | 854645a9b79fd5cbdf961b7db6f1040b1724e1ea | b3da8dddf9530816c7967f395f156bc968048736 | refs/heads/master | 2022-07-05T14:21:29.439659 | 2020-05-21T07:21:59 | 2020-05-21T07:21:59 | 198,189,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | package com.plantserver.entity;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.math.RoundingMode;
// 1219温度温度温度温度
@Getter
@Setter
public class TTTT extends BytePayload {
public long timestamp;
public float t1; //the data of current value the unit is (A)
public float t2; //the data of voltage value the unit is (V)
public float t3; //the data of power value the unit is (W)
public float t4; //the data of electric energy value the unit is (Kwh)
TTTT(byte[] input) throws NullPointerException {
timestamp = (long) Math.abs(getIntValue(input, 0)) * 1000 + Math.abs(getIntValue(input, 4));
BigDecimal raw_t1 = BigDecimal.valueOf(getFloatValue(input, 8));
BigDecimal raw_t2 = BigDecimal.valueOf(getFloatValue(input, 12));
BigDecimal raw_t3 = BigDecimal.valueOf(getFloatValue(input, 16));
BigDecimal raw_t4 = BigDecimal.valueOf(getFloatValue(input, 20));
t1 = raw_t1.setScale(3, RoundingMode.DOWN).floatValue();
t2 = raw_t2.setScale(3, RoundingMode.DOWN).floatValue();
t3 = raw_t3.setScale(3, RoundingMode.DOWN).floatValue();
t4 = raw_t4.setScale(3, RoundingMode.DOWN).floatValue();
// t1 = getFloatValue(input, 8);
// t2 = getFloatValue(input, 12);
// t3 = getFloatValue(input, 16);
// t4 = getFloatValue(input, 20);
}
}
| [
"brand960@foxmail.com"
] | brand960@foxmail.com |
8e20fad7b6597408d7c8abd8da433a5287689a46 | 10c3b1b5a26c1ea1282f8e0b4f3a889d46f85d0b | /Collectionss/src/com/techno/collectionmain/Demo.java | 474636ec7b441d15a96c9614f0c6e69b53687640 | [] | no_license | manoj238/Noddy_Mj | 8c7f75c63ff17940fb1fb18c0e9919f8d316b757 | 72e295f23862a2f8ac614c6e1e31525439eb73fb | refs/heads/master | 2023-08-14T02:01:44.328116 | 2021-09-27T08:04:13 | 2021-09-27T08:04:13 | 410,796,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package com.techno.collectionmain;
import java.util.ArrayList;
public class Demo {
public static void main(String[] args) {
ArrayList<Integer> arrayList = new ArrayList<>();
arrayList.add(10);
arrayList.add(20);
arrayList.add(30);
arrayList.add(40);
System.out.println(arrayList.toString());
ArrayList<String> arrayList2 = new ArrayList<String>();
arrayList2.add("Manoj");
arrayList2.add("Is");
arrayList2.add("great");
arrayList2.add("guy");
System.out.println(arrayList2.toString());
ArrayList arrayList3 = new ArrayList();
arrayList3.addAll(arrayList);
for (Object object : arrayList3) {
System.out.println(object);
}
arrayList3.addAll(arrayList2);
for (Object object : arrayList3) {
System.out.println(object);
}
// System.out.println(arrayList3.toString());
}
}
| [
"manoj_vivek23@yahoo.com"
] | manoj_vivek23@yahoo.com |
8a2deee6f0428d1b5216cd44884c99d1bf7b215c | d7d59eaa717ad38c8bb9d11385a5632d64ccbd5a | /src/main/java/org/hibernate/main/TestEmployeeConcreate.java | 1dca4f801d4cd5b28fa4654f35003470be83fb2f | [] | no_license | amiransarii/HibernateDemos | 3acf629a1a12865fde139f97f83583d8e9e983b2 | 030eb13be639d0bb2ba6fc446f2166e0318cfe5f | refs/heads/master | 2022-07-04T15:43:18.554330 | 2019-12-27T11:18:25 | 2019-12-27T11:18:25 | 229,360,349 | 0 | 0 | null | 2022-06-21T02:31:41 | 2019-12-21T01:25:25 | Java | UTF-8 | Java | false | false | 1,985 | java | package org.hibernate.main;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.entity.Contract_Employee;
import org.hibernate.entity.Employee;
import org.hibernate.entity.Regular_Employee;
/**
*
* @author Amir Ansari
* created at 22-12-2019
* In case of Table Per Concrete class, there will be three tables
* in the database having no relations to each other. There are two ways to map the
* table with table per concrete class strategy.
By union-subclass element
By self creating the table for each class
*
*/
public class TestEmployeeConcreate {
public static void main(String args[]) {
StandardServiceRegistry ssr=new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build();
/* Metadata meta=new MetadataSources(ssr).getMetadataBuilder().build();
SessionFactory factory=meta.getSessionFactoryBuilder().build();
Session session=factory.openSession();
Transaction t=session.beginTransaction();
Employee e1 = new Employee();
e1.setFirstName("Gaurav");
e1.setLastName("Chawla");
Regular_Employee e2=new Regular_Employee();
e2.setFirstName("Vivek");
e2.setLastName("Kumar");
e2.setSalary(50000);
e2.setBonous(5);
Contract_Employee e3=new Contract_Employee();
e3.setFirstName("Arjun");
e3.setLastName("Kumar");
e3.setPay_per_hour(1000);
e3.setContract_duration("15 hours");
session.persist(e1);
session.persist(e2);
session.persist(e3);
t.commit();
session.close();
System.out.println("successfully stored"); */
}
}
| [
"amiransari.my@gmail.com"
] | amiransari.my@gmail.com |
6a73a1a4f0b4d8705f998a87d3d30d632f77db86 | 44c5dc8af1a14532c9e9513f8d48a54841aa38ce | /src/main/java/com/duprasville/limiters/util/AtomicTableWithCustomIndexes.java | 291d5a6028caf946479c4afee682c78c327244e7 | [
"MIT"
] | permissive | SeokhyunKim/limiters | 771c9f11e823fd3e6be37e3cc88efbc3d8516841 | 23945dd0bf76c21b45fa06460741c910b2063f26 | refs/heads/master | 2020-03-07T14:58:47.639329 | 2018-03-10T13:13:49 | 2018-03-10T13:18:05 | 127,541,430 | 0 | 0 | MIT | 2018-03-31T14:52:09 | 2018-03-31T14:52:08 | null | UTF-8 | Java | false | false | 2,877 | java | package com.duprasville.limiters.util;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
public class AtomicTableWithCustomIndexes<V> extends AtomicTable<V> {
private final long[] rows;
private final long[] cols;
public AtomicTableWithCustomIndexes(long[] rows, long cols[], V emptyValue) {
super(rows.length, cols.length, emptyValue);
this.rows = Arrays.copyOf(rows, rows.length);
Arrays.sort(this.rows);
this.cols = Arrays.copyOf(cols, cols.length);
Arrays.sort(this.cols);
}
public AtomicTableWithCustomIndexes(AtomicTableWithCustomIndexes<V> original) {
super(original);
this.rows = original.rows;
this.cols = original.cols;
}
public V get(long row, long col) {
return super.get(superRow(row), superCol(col));
}
public List<V> getRow(long row) {
return super.getRow(superRow(row));
}
public Map<Long, V> getRowMap(long row) {
HashMap<Long, V> ret = new HashMap<>(cols.length);
for (long c : cols) {
ret.put(c, get(row, c));
}
return ret;
}
public Map<Long, V> getEntries(long row) {
return getRowMap(row)
.entrySet()
.stream()
.filter(e -> e.getValue() != emptyValue)
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
}
public List<Long> getEmptyEntries(long row) {
return getRowMap(row)
.entrySet()
.stream()
.filter(e -> e.getValue() == emptyValue)
.map(Map.Entry::getKey)
.collect(toList());
}
public boolean tryPut(long row, long col, V value) {
return super.tryPut(superRow(row), superCol(col), value);
}
public boolean tryPut(long row, V value) {
return super.tryPut(superRow(row), value);
}
@Override
public V get(int row, int col) {
return this.get((long) row, (long) col);
}
@Override
public List<V> getRow(int row) {
return this.getRow((long) row);
}
@Override
public boolean tryPut(int row, int col, V value) {
return this.tryPut((long) row, (long) col, value);
}
@Override
public boolean tryPut(int row, V value) {
return this.tryPut((long) row, value);
}
protected int superRow(long row) {
return getSuperIndex(rows, row);
}
protected int superCol(long col) {
return getSuperIndex(cols, col);
}
private int getSuperIndex(long[] idx, long i) {
int ret = Arrays.binarySearch(idx, i);
if (ret < 0)
throw new ArrayIndexOutOfBoundsException();
return ret;
}
}
| [
"bdupras@twitter.com"
] | bdupras@twitter.com |
2fd8cbbe17179f53e235dc64e30077391944b20d | a91d6cb132fd1ef9a6a3c316aa72eac8af13cd61 | /AracTakipSistemi-NDAT/src/com/aractakip/arackiralama/domain/Sistem.java | 4f1a3c7f23593b47a3204617b712489d22c9d6bb | [] | no_license | HeydarBinaliyev/Object-Oriented-Analysis-and-Design | 235b33d1e6ff2a53e4b8c73d2c023d9b43f72cbe | 1ccbc473fb56c9317747072c3e47a461ed11f4da | refs/heads/master | 2021-01-01T03:36:11.904482 | 2016-05-25T19:35:47 | 2016-05-25T19:35:47 | 59,380,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package com.aractakip.arackiralama.domain;
import java.util.LinkedList;
import java.util.List;
import com.aractakip.arackiralama.facade.Facade;
public class Sistem {
List<AracKiralama>list=new LinkedList<AracKiralama>();
private Facade facade=new Facade();
private Register register=new Register(facade);
public Register getRegister(){
return register;
}
}
| [
"haydabinali@hotmail.com"
] | haydabinali@hotmail.com |
9f3527b63565b21fce07bf556b583b43a41f2aa6 | ad3c4b0fdc1e22b66ab61ceffe322bedb87dd37c | /Myjdbc/src/com/my/helper/StudentHelper.java | 90302445138ea37d64f79af7bf0f53c30003445b | [] | no_license | Zafarimam7032/Core_Java | 5b24a0a9edb2e1739eb3c94b0d8e1e99317827c4 | 6c48c2edf3ee3fb0ce614ffa938db5a13bb278d0 | refs/heads/master | 2023-04-02T13:20:15.967957 | 2021-04-02T05:10:13 | 2021-04-02T05:10:13 | 353,907,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package com.my.helper;
import java.sql.ResultSet;
import com.my.info.StudentVo;
public class StudentHelper {
public StudentVo takeDatafromResultsetAndPutStudentVo(ResultSet result)
{
StudentVo stud=null;
try
{
if(result!=null)
{
stud=new StudentVo();
stud.setSno(result.getInt("sno"));
stud.setStudentName(result.getString("StudentName"));
stud.setCity(result.getString("city"));
stud.setPhoneNumber(result.getString("phoneNumber"));
}
}
catch(Exception e)
{
}
return stud;
}
}
| [
"Zafar.imam@greatWits.com"
] | Zafar.imam@greatWits.com |
9954f19ad2371d91745205d38f757774e86074d4 | 7cff3f3b7f59882473c0abd107151cd4792953fe | /calendarview/src/main/java/com/offcn/calendarview/CalendarUtil.java | 8b5cb1053f4ba12a176ac52711442eb5f7805e48 | [] | no_license | jasonMouse/ConstraintLayoutDemo | 864f7627f08221d1e2006717ec1535de0c454038 | 18894256fa7b72b7d10c019ee14e1c14ace3ded2 | refs/heads/master | 2020-07-26T20:25:05.720528 | 2019-09-16T09:14:41 | 2019-09-16T09:14:41 | 208,756,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,096 | java | /*
* Copyright (C) 2016 huanghaibin_dev <huanghaibin_dev@163.com>
* WebSite https://github.com/MiracleTimes-Dev
* 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.offcn.calendarview;
import android.annotation.SuppressLint;
import android.content.Context;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 一些日期辅助计算工具
*/
final class CalendarUtil {
private static final long ONE_DAY = 1000 * 3600 * 24;
@SuppressLint("SimpleDateFormat")
static int getDate(String formatStr, Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatStr);
return Integer.parseInt(format.format(date));
}
/**
* 判断一个日期是否是周末,即周六日
*
* @param calendar calendar
* @return 判断一个日期是否是周末,即周六日
*/
static boolean isWeekend(Calendar calendar) {
int week = getWeekFormCalendar(calendar);
return week == 0 || week == 6;
}
/**
* 获取某月的天数
*
* @param year 年
* @param month 月
* @return 某月的天数
*/
static int getMonthDaysCount(int year, int month) {
int count = 0;
//判断大月份
if (month == 1 || month == 3 || month == 5 || month == 7
|| month == 8 || month == 10 || month == 12) {
count = 31;
}
//判断小月
if (month == 4 || month == 6 || month == 9 || month == 11) {
count = 30;
}
//判断平年与闰年
if (month == 2) {
if (isLeapYear(year)) {
count = 29;
} else {
count = 28;
}
}
return count;
}
/**
* 是否是闰年
*
* @param year year
* @return 是否是闰年
*/
static boolean isLeapYear(int year) {
return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
}
static int getMonthViewLineCount(int year, int month, int weekStartWith, int mode) {
if (mode == CalendarViewDelegate.MODE_ALL_MONTH) {
return 6;
}
int nextDiff = CalendarUtil.getMonthEndDiff(year, month, weekStartWith);
int preDiff = CalendarUtil.getMonthViewStartDiff(year, month, weekStartWith);
int monthDayCount = CalendarUtil.getMonthDaysCount(year, month);
return (preDiff + monthDayCount + nextDiff) / 7;
}
/**
* 获取月视图的确切高度
* Test pass
*
* @param year 年
* @param month 月
* @param itemHeight 每项的高度
* @return 不需要多余行的高度
*/
static int getMonthViewHeight(int year, int month, int itemHeight, int weekStartWith) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, month - 1, 1);
int preDiff = getMonthViewStartDiff(year, month, weekStartWith);
int monthDaysCount = getMonthDaysCount(year, month);
int nextDiff = getMonthEndDiff(year, month, monthDaysCount, weekStartWith);
return (preDiff + monthDaysCount + nextDiff) / 7 * itemHeight;
}
/**
* 获取月视图的确切高度
* Test pass
*
* @param year 年
* @param month 月
* @param itemHeight 每项的高度
* @return 不需要多余行的高度
*/
static int getMonthViewHeight(int year, int month, int itemHeight, int weekStartWith, int mode) {
if (mode == CalendarViewDelegate.MODE_ALL_MONTH) {
return itemHeight * 6;
}
return getMonthViewHeight(year, month, itemHeight, weekStartWith);
}
/**
* 获取某天在该月的第几周,换言之就是获取这一天在该月视图的第几行,第几周,根据周起始动态获取
* Test pass,单元测试通过
*
* @param calendar calendar
* @param weekStart 其实星期是哪一天?
* @return 获取某天在该月的第几周 the week line in MonthView
*/
static int getWeekFromDayInMonth(Calendar calendar, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar.getYear(), calendar.getMonth() - 1, 1);
//该月第一天为星期几,星期天 == 0
int diff = getMonthViewStartDiff(calendar, weekStart);
return (calendar.getDay() + diff - 1) / 7 + 1;
}
/**
* 获取上一个日子
*
* @param calendar calendar
* @return 获取上一个日子
*/
static Calendar getPreCalendar(Calendar calendar) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar.getYear(), calendar.getMonth() - 1, calendar.getDay());//
long timeMills = date.getTimeInMillis();//获得起始时间戳
date.setTimeInMillis(timeMills - ONE_DAY);
Calendar preCalendar = new Calendar();
preCalendar.setYear(date.get(java.util.Calendar.YEAR));
preCalendar.setMonth(date.get(java.util.Calendar.MONTH) + 1);
preCalendar.setDay(date.get(java.util.Calendar.DAY_OF_MONTH));
return preCalendar;
}
static Calendar getNextCalendar(Calendar calendar) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar.getYear(), calendar.getMonth() - 1, calendar.getDay());//
long timeMills = date.getTimeInMillis();//获得起始时间戳
date.setTimeInMillis(timeMills + ONE_DAY);
Calendar nextCalendar = new Calendar();
nextCalendar.setYear(date.get(java.util.Calendar.YEAR));
nextCalendar.setMonth(date.get(java.util.Calendar.MONTH) + 1);
nextCalendar.setDay(date.get(java.util.Calendar.DAY_OF_MONTH));
return nextCalendar;
}
/**
* DAY_OF_WEEK return 1 2 3 4 5 6 7,偏移了一位
* 获取日期所在月视图对应的起始偏移量
* Test pass
*
* @param calendar calendar
* @param weekStart weekStart 星期的起始
* @return 获取日期所在月视图对应的起始偏移量 the start diff with MonthView
*/
static int getMonthViewStartDiff(Calendar calendar, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar.getYear(), calendar.getMonth() - 1, 1);
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
if (weekStart == CalendarViewDelegate.WEEK_START_WITH_SUN) {
return week - 1;
}
if (weekStart == CalendarViewDelegate.WEEK_START_WITH_MON) {
return week == 1 ? 6 : week - weekStart;
}
return week == CalendarViewDelegate.WEEK_START_WITH_SAT ? 0 : week;
}
/**
* DAY_OF_WEEK return 1 2 3 4 5 6 7,偏移了一位
* 获取日期所在月视图对应的起始偏移量
* Test pass
*
* @param year 年
* @param month 月
* @param weekStart 周起始
* @return 获取日期所在月视图对应的起始偏移量 the start diff with MonthView
*/
static int getMonthViewStartDiff(int year, int month, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, month - 1, 1);
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
if (weekStart == CalendarViewDelegate.WEEK_START_WITH_SUN) {
return week - 1;
}
if (weekStart == CalendarViewDelegate.WEEK_START_WITH_MON) {
return week == 1 ? 6 : week - weekStart;
}
return week == CalendarViewDelegate.WEEK_START_WITH_SAT ? 0 : week;
}
/**
* DAY_OF_WEEK return 1 2 3 4 5 6 7,偏移了一位
* 获取日期月份对应的结束偏移量,用于计算两个年份之间总共有多少周,不用于MonthView
* Test pass
*
* @param year 年
* @param month 月
* @param weekStart 周起始
* @return 获取日期月份对应的结束偏移量 the end diff in Month not MonthView
*/
static int getMonthEndDiff(int year, int month, int weekStart) {
return getMonthEndDiff(year, month, getMonthDaysCount(year, month), weekStart);
}
/**
* DAY_OF_WEEK return 1 2 3 4 5 6 7,偏移了一位
* 获取日期月份对应的结束偏移量,用于计算两个年份之间总共有多少周,不用于MonthView
* Test pass
*
* @param year 年
* @param month 月
* @param weekStart 周起始
* @return 获取日期月份对应的结束偏移量 the end diff in Month not MonthView
*/
private static int getMonthEndDiff(int year, int month, int day, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, month - 1, day);
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
if (weekStart == CalendarViewDelegate.WEEK_START_WITH_SUN) {
return 7 - week;
}
if (weekStart == CalendarViewDelegate.WEEK_START_WITH_MON) {
return week == 1 ? 0 : 7 - week + 1;
}
return week == 7 ? 6 : 7 - week - 1;
}
/**
* 获取某个日期是星期几
* 测试通过
*
* @param calendar 某个日期
* @return 返回某个日期是星期几
*/
static int getWeekFormCalendar(Calendar calendar) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar.getYear(), calendar.getMonth() - 1, calendar.getDay());
return date.get(java.util.Calendar.DAY_OF_WEEK) - 1;
}
/**
* 获取周视图的切换默认选项位置 WeekView index
* 测试通过 test pass
*
* @param calendar calendar
* @param weekStart weekStart
* @return 获取周视图的切换默认选项位置
*/
static int getWeekViewIndexFromCalendar(Calendar calendar, int weekStart) {
return getWeekViewStartDiff(calendar.getYear(), calendar.getMonth(), calendar.getDay(), weekStart);
}
/**
* 是否在日期范围內
* 测试通过 test pass
*
* @param calendar calendar
* @param minYear minYear
* @param minYearDay 最小年份天
* @param minYearMonth minYearMonth
* @param maxYear maxYear
* @param maxYearMonth maxYearMonth
* @param maxYearDay 最大年份天
* @return 是否在日期范围內
*/
static boolean isCalendarInRange(Calendar calendar,
int minYear, int minYearMonth, int minYearDay,
int maxYear, int maxYearMonth, int maxYearDay) {
java.util.Calendar c = java.util.Calendar.getInstance();
c.set(minYear, minYearMonth - 1, minYearDay);
long minTime = c.getTimeInMillis();
c.set(maxYear, maxYearMonth - 1, maxYearDay);
long maxTime = c.getTimeInMillis();
c.set(calendar.getYear(), calendar.getMonth() - 1, calendar.getDay());
long curTime = c.getTimeInMillis();
return curTime >= minTime && curTime <= maxTime;
}
/**
* 获取两个日期之间一共有多少周,
* 注意周起始周一、周日、周六
* 测试通过 test pass
*
* @param minYear minYear 最小年份
* @param minYearMonth maxYear 最小年份月份
* @param minYearDay 最小年份天
* @param maxYear maxYear 最大年份
* @param maxYearMonth maxYear 最大年份月份
* @param maxYearDay 最大年份天
* @param weekStart 周起始
* @return 周数用于WeekViewPager itemCount
*/
static int getWeekCountBetweenBothCalendar(int minYear, int minYearMonth, int minYearDay,
int maxYear, int maxYearMonth, int maxYearDay,
int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(minYear, minYearMonth - 1, minYearDay);
long minTimeMills = date.getTimeInMillis();//给定时间戳
int preDiff = getWeekViewStartDiff(minYear, minYearMonth, minYearDay, weekStart);
date.set(maxYear, maxYearMonth - 1, maxYearDay);
long maxTimeMills = date.getTimeInMillis();//给定时间戳
int nextDiff = getWeekViewEndDiff(maxYear, maxYearMonth, maxYearDay, weekStart);
int count = preDiff + nextDiff;
int c = (int) ((maxTimeMills - minTimeMills) / ONE_DAY) + 1;
count += c;
return count / 7;
}
/**
* 根据日期获取距离最小日期在第几周
* 用来设置 WeekView currentItem
* 测试通过 test pass
*
* @param calendar calendar
* @param minYear minYear 最小年份
* @param minYearMonth maxYear 最小年份月份
* @param minYearDay 最小年份天
* @param weekStart 周起始
* @return 返回两个年份中第几周 the WeekView currentItem
*/
static int getWeekFromCalendarStartWithMinCalendar(Calendar calendar,
int minYear, int minYearMonth, int minYearDay,
int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(minYear, minYearMonth - 1, minYearDay);//起始日期
long firstTimeMill = date.getTimeInMillis();//获得范围起始时间戳
int preDiff = getWeekViewStartDiff(minYear, minYearMonth, minYearDay, weekStart);//范围起始的周偏移量
int weekStartDiff = getWeekViewStartDiff(calendar.getYear(),
calendar.getMonth(),
calendar.getDay(),
weekStart);//获取点击的日子在周视图的起始,为了兼容全球时区,最大日差为一天,如果周起始偏差weekStartDiff=0,则日期加1
date.set(calendar.getYear(),
calendar.getMonth() - 1,
weekStartDiff == 0 ? calendar.getDay() + 1 : calendar.getDay());
long curTimeMills = date.getTimeInMillis();//给定时间戳
int c = (int) ((curTimeMills - firstTimeMill) / ONE_DAY);
int count = preDiff + c;
return count / 7 + 1;
}
/**
* 根据星期数和最小日期推算出该星期的第一天
* //测试通过 Test pass
*
* @param minYear 最小年份如2017
* @param minYearMonth maxYear 最小年份月份,like : 2017-07
* @param minYearDay 最小年份天
* @param week 从最小年份minYear月minYearMonth 日1 开始的第几周 week > 0
* @return 该星期的第一天日期
*/
static Calendar getFirstCalendarStartWithMinCalendar(int minYear, int minYearMonth, int minYearDay, int week, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(minYear, minYearMonth - 1, minYearDay);//
long firstTimeMills = date.getTimeInMillis();//获得起始时间戳
long weekTimeMills = (week - 1) * 7 * ONE_DAY;
long timeCountMills = weekTimeMills + firstTimeMills;
date.setTimeInMillis(timeCountMills);
int startDiff = getWeekViewStartDiff(date.get(java.util.Calendar.YEAR),
date.get(java.util.Calendar.MONTH) + 1,
date.get(java.util.Calendar.DAY_OF_MONTH), weekStart);
timeCountMills -= startDiff * ONE_DAY;
date.setTimeInMillis(timeCountMills);
Calendar calendar = new Calendar();
calendar.setYear(date.get(java.util.Calendar.YEAR));
calendar.setMonth(date.get(java.util.Calendar.MONTH) + 1);
calendar.setDay(date.get(java.util.Calendar.DAY_OF_MONTH));
return calendar;
}
/**
* 是否在日期范围内
*
* @param calendar calendar
* @param delegate delegate
* @return 是否在日期范围内
*/
static boolean isCalendarInRange(Calendar calendar, CalendarViewDelegate delegate) {
return isCalendarInRange(calendar,
delegate.getMinYear(), delegate.getMinYearMonth(), delegate.getMinYearDay(),
delegate.getMaxYear(), delegate.getMaxYearMonth(), delegate.getMaxYearDay());
}
/**
* 是否在日期范围內
*
* @param year year
* @param month month
* @param minYear minYear
* @param minYearMonth minYearMonth
* @param maxYear maxYear
* @param maxYearMonth maxYearMonth
* @return 是否在日期范围內
*/
static boolean isMonthInRange(int year, int month, int minYear, int minYearMonth, int maxYear, int maxYearMonth) {
return !(year < minYear || year > maxYear) &&
!(year == minYear && month < minYearMonth) &&
!(year == maxYear && month > maxYearMonth);
}
/**
* 运算 calendar1 - calendar2
* test Pass
*
* @param calendar1 calendar1
* @param calendar2 calendar2
* @return calendar1 - calendar2
*/
static int differ(Calendar calendar1, Calendar calendar2) {
if (calendar1 == null) {
return Integer.MIN_VALUE;
}
if (calendar2 == null) {
return Integer.MAX_VALUE;
}
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar1.getYear(), calendar1.getMonth() - 1, calendar1.getDay());//
long startTimeMills = date.getTimeInMillis();//获得起始时间戳
date.set(calendar2.getYear(), calendar2.getMonth() - 1, calendar2.getDay());//
long endTimeMills = date.getTimeInMillis();//获得结束时间戳
return (int) ((startTimeMills - endTimeMills) / ONE_DAY);
}
/**
* 比较日期大小
*
* @param minYear minYear
* @param minYearMonth minYearMonth
* @param minYearDay minYearDay
* @param maxYear maxYear
* @param maxYearMonth maxYearMonth
* @param maxYearDay maxYearDay
* @return -1 0 1
*/
static int compareTo(int minYear, int minYearMonth, int minYearDay,
int maxYear, int maxYearMonth, int maxYearDay) {
Calendar first = new Calendar();
first.setYear(minYear);
first.setMonth(minYearMonth);
first.setDay(minYearDay);
Calendar second = new Calendar();
second.setYear(maxYear);
second.setMonth(maxYearMonth);
second.setDay(maxYearDay);
return first.compareTo(second);
}
/**
* 为月视图初始化日历
*
* @param year year
* @param month month
* @param currentDate currentDate
* @param weekStar weekStar
* @return 为月视图初始化日历项
*/
static List<Calendar> initCalendarForMonthView(int year, int month, Calendar currentDate, int weekStar) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, month - 1, 1);
int mPreDiff = getMonthViewStartDiff(year, month, weekStar);//获取月视图其实偏移量
int monthDayCount = getMonthDaysCount(year, month);//获取月份真实天数
int preYear, preMonth;
int nextYear, nextMonth;
int size = 42;
List<Calendar> mItems = new ArrayList<>();
int preMonthDaysCount;
if (month == 1) {//如果是1月
preYear = year - 1;
preMonth = 12;
nextYear = year;
nextMonth = month + 1;
preMonthDaysCount = mPreDiff == 0 ? 0 : CalendarUtil.getMonthDaysCount(preYear, preMonth);
} else if (month == 12) {//如果是12月
preYear = year;
preMonth = month - 1;
nextYear = year + 1;
nextMonth = 1;
preMonthDaysCount = mPreDiff == 0 ? 0 : CalendarUtil.getMonthDaysCount(preYear, preMonth);
} else {//平常
preYear = year;
preMonth = month - 1;
nextYear = year;
nextMonth = month + 1;
preMonthDaysCount = mPreDiff == 0 ? 0 : CalendarUtil.getMonthDaysCount(preYear, preMonth);
}
int nextDay = 1;
for (int i = 0; i < size; i++) {
Calendar calendarDate = new Calendar();
if (i < mPreDiff) {
calendarDate.setYear(preYear);
calendarDate.setMonth(preMonth);
calendarDate.setDay(preMonthDaysCount - mPreDiff + i + 1);
} else if (i >= monthDayCount + mPreDiff) {
calendarDate.setYear(nextYear);
calendarDate.setMonth(nextMonth);
calendarDate.setDay(nextDay);
++nextDay;
} else {
calendarDate.setYear(year);
calendarDate.setMonth(month);
calendarDate.setCurrentMonth(true);
calendarDate.setDay(i - mPreDiff + 1);
}
if (calendarDate.equals(currentDate)) {
calendarDate.setCurrentDay(true);
}
LunarCalendar.setupLunarCalendar(calendarDate);
mItems.add(calendarDate);
}
return mItems;
}
static List<Calendar> getWeekCalendars(Calendar calendar, CalendarViewDelegate mDelegate) {
long curTime = calendar.getTimeInMillis();
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(calendar.getYear(),
calendar.getMonth() - 1,
calendar.getDay());//
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
int startDiff;
if (mDelegate.getWeekStart() == 1) {
startDiff = week - 1;
} else if (mDelegate.getWeekStart() == 2) {
startDiff = week == 1 ? 6 : week - mDelegate.getWeekStart();
} else {
startDiff = week == 7 ? 0 : week;
}
curTime -= startDiff * ONE_DAY;
java.util.Calendar minCalendar = java.util.Calendar.getInstance();
minCalendar.setTimeInMillis(curTime);
Calendar startCalendar = new Calendar();
startCalendar.setYear(minCalendar.get(java.util.Calendar.YEAR));
startCalendar.setMonth(minCalendar.get(java.util.Calendar.MONTH) + 1);
startCalendar.setDay(minCalendar.get(java.util.Calendar.DAY_OF_MONTH));
return initCalendarForWeekView(startCalendar, mDelegate, mDelegate.getWeekStart());
}
/**
* 生成周视图的7个item
*
* @param calendar calendar
* @param mDelegate mDelegate
* @param weekStart weekStart
* @return 生成周视图的7个item
*/
static List<Calendar> initCalendarForWeekView(Calendar calendar, CalendarViewDelegate mDelegate, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();//当天时间
date.set(calendar.getYear(), calendar.getMonth() - 1, calendar.getDay());
long curDateMills = date.getTimeInMillis();//生成选择的日期时间戳
int weekEndDiff = getWeekViewEndDiff(calendar.getYear(), calendar.getMonth(), calendar.getDay(), weekStart);
List<Calendar> mItems = new ArrayList<>();
date.setTimeInMillis(curDateMills);
Calendar selectCalendar = new Calendar();
selectCalendar.setYear(date.get(java.util.Calendar.YEAR));
selectCalendar.setMonth(date.get(java.util.Calendar.MONTH) + 1);
selectCalendar.setDay(date.get(java.util.Calendar.DAY_OF_MONTH));
if (selectCalendar.equals(mDelegate.getCurrentDay())) {
selectCalendar.setCurrentDay(true);
}
LunarCalendar.setupLunarCalendar(selectCalendar);
selectCalendar.setCurrentMonth(true);
mItems.add(selectCalendar);
for (int i = 1; i <= weekEndDiff; i++) {
date.setTimeInMillis(curDateMills + i * ONE_DAY);
Calendar calendarDate = new Calendar();
calendarDate.setYear(date.get(java.util.Calendar.YEAR));
calendarDate.setMonth(date.get(java.util.Calendar.MONTH) + 1);
calendarDate.setDay(date.get(java.util.Calendar.DAY_OF_MONTH));
if (calendarDate.equals(mDelegate.getCurrentDay())) {
calendarDate.setCurrentDay(true);
}
LunarCalendar.setupLunarCalendar(calendarDate);
calendarDate.setCurrentMonth(true);
mItems.add(calendarDate);
}
return mItems;
}
/**
* 单元测试通过
* 从选定的日期,获取周视图起始偏移量,用来生成周视图布局
*
* @param year year
* @param month month
* @param day day
* @param weekStart 周起始,1,2,7 日 一 六
* @return 获取周视图起始偏移量,用来生成周视图布局
*/
private static int getWeekViewStartDiff(int year, int month, int day, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, month - 1, day);//
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
if (weekStart == 1) {
return week - 1;
}
if (weekStart == 2) {
return week == 1 ? 6 : week - weekStart;
}
return week == 7 ? 0 : week;
}
/**
* 单元测试通过
* 从选定的日期,获取周视图结束偏移量,用来生成周视图布局
*
* @param year year
* @param month month
* @param day day
* @param weekStart 周起始,1,2,7 日 一 六
* @return 获取周视图结束偏移量,用来生成周视图布局
*/
private static int getWeekViewEndDiff(int year, int month, int day, int weekStart) {
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, month - 1, day);
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
if (weekStart == 1) {
return 7 - week;
}
if (weekStart == 2) {
return week == 1 ? 0 : 7 - week + 1;
}
return week == 7 ? 6 : 7 - week - 1;
}
/**
* 从月视图切换获得第一天的日期
*
* @param position position
* @param delegate position
* @return 从月视图切换获得第一天的日期
*/
static Calendar getFirstCalendarFromMonthViewPager(int position, CalendarViewDelegate delegate) {
Calendar calendar = new Calendar();
calendar.setYear((position + delegate.getMinYearMonth() - 1) / 12 + delegate.getMinYear());
calendar.setMonth((position + delegate.getMinYearMonth() - 1) % 12 + 1);
if (delegate.getDefaultCalendarSelectDay() != CalendarViewDelegate.FIRST_DAY_OF_MONTH) {
int monthDays = getMonthDaysCount(calendar.getYear(), calendar.getMonth());
Calendar indexCalendar = delegate.mIndexCalendar;
calendar.setDay(indexCalendar == null || indexCalendar.getDay() == 0 ? 1 :
monthDays < indexCalendar.getDay() ? monthDays : indexCalendar.getDay());
} else {
calendar.setDay(1);
}
if (!isCalendarInRange(calendar, delegate)) {
if (isMinRangeEdge(calendar, delegate)) {
calendar = delegate.getMinRangeCalendar();
} else {
calendar = delegate.getMaxRangeCalendar();
}
}
calendar.setCurrentMonth(calendar.getYear() == delegate.getCurrentDay().getYear() &&
calendar.getMonth() == delegate.getCurrentDay().getMonth());
calendar.setCurrentDay(calendar.equals(delegate.getCurrentDay()));
LunarCalendar.setupLunarCalendar(calendar);
return calendar;
}
/**
* 根据传入的日期获取边界访问日期,要么最大,要么最小
*
* @param calendar calendar
* @param delegate delegate
* @return 获取边界访问日期
*/
static Calendar getRangeEdgeCalendar(Calendar calendar, CalendarViewDelegate delegate) {
if (CalendarUtil.isCalendarInRange(delegate.getCurrentDay(), delegate)
&& delegate.getDefaultCalendarSelectDay() != CalendarViewDelegate.LAST_MONTH_VIEW_SELECT_DAY_IGNORE_CURRENT) {
return delegate.createCurrentDate();
}
if (isCalendarInRange(calendar, delegate)) {
return calendar;
}
Calendar minRangeCalendar = delegate.getMinRangeCalendar();
if (minRangeCalendar.isSameMonth(calendar)) {
return delegate.getMinRangeCalendar();
}
return delegate.getMaxRangeCalendar();
}
/**
* 是否是最小访问边界了
*
* @param calendar calendar
* @return 是否是最小访问边界了
*/
private static boolean isMinRangeEdge(Calendar calendar, CalendarViewDelegate delegate) {
java.util.Calendar c = java.util.Calendar.getInstance();
c.set(delegate.getMinYear(), delegate.getMinYearMonth() - 1, delegate.getMinYearDay());
long minTime = c.getTimeInMillis();
c.set(calendar.getYear(), calendar.getMonth() - 1, calendar.getDay());
long curTime = c.getTimeInMillis();
return curTime < minTime;
}
/**
* dp转px
*
* @param context context
* @param dpValue dp
* @return px
*/
static int dipToPx(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
}
| [
"jasonMouse@163.com"
] | jasonMouse@163.com |
98f9da8d3a71c17912142a63f3744a48315d72c2 | 8afdb7c62eb74ffcaded52090055be1180114214 | /city-common/src/main/java/util/FileHelper.java | 157ee9d0a122c894f38136fcb64f7faa70a653d7 | [] | no_license | tickluo/rebate | fb0eb0c8cccfd9735a3d198a08c08e161acf8e82 | 1c6c35f301ab1ab78a90aa673f8bbf1d949c1cec | refs/heads/master | 2021-01-20T08:06:47.237251 | 2017-06-08T07:03:27 | 2017-06-08T07:03:27 | 90,097,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,902 | java | package util;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedOutputStream;
import java.io.CharArrayWriter;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.nio.file.FileAlreadyExistsException;
/**
* 文件操作工具类
* 实现文件的创建、删除、复制以及目录的创建、删除、复制等功能
*
* @author zhangxd
*/
public class FileHelper extends FileUtils {
/**
* Logger
*/
private static final Logger LOGGER = LoggerFactory.getLogger(FileHelper.class);
/**
* 文件未发现
*/
private static final String FILE_NOT_FIND = "%s 文件不存在!";
/**
* Buff Size
*/
private static final int BUF_SIZE = 1024 * 100;
/**
* 默认编码
*/
private static final String DEFAULT_ENCODING = "utf8";
/**
* 复制文件,可以复制单个文件或文件夹
*
* @param srcFileName 待复制的文件名
* @param descFileName 目标文件名
* @return 如果复制成功 ,则返回true,否是返回false
* @throws IOException the io exception
*/
public static boolean copy(String srcFileName, String descFileName) throws IOException {
File file = new File(srcFileName);
if (!file.exists()) {
LOGGER.debug(String.format(FILE_NOT_FIND, srcFileName));
return false;
} else {
if (file.isFile()) {
return !copyFile(srcFileName, descFileName);
} else {
return !copyDirectory(srcFileName, descFileName);
}
}
}
/**
* 复制单个文件,如果目标文件存在,则不覆盖
*
* @param srcFileName 待复制的文件名
* @param descFileName 目标文件名
* @return 如果复制成功 ,则返回true,否则返回false
* @throws IOException the io exception
*/
public static boolean copyFile(String srcFileName, String descFileName) throws IOException {
return copyFileCover(srcFileName, descFileName, false);
}
/**
* 复制单个文件
*
* @param srcFileName 待复制的文件名
* @param descFileName 目标文件名
* @param coverlay 如果目标文件已存在,是否覆盖
* @return 如果复制成功 ,则返回true,否则返回false
* @throws IOException the io exception
*/
public static boolean copyFileCover(String srcFileName,
String descFileName, boolean coverlay) throws IOException {
File srcFile = new File(srcFileName);
// 判断源文件是否存在
if (!srcFile.exists()) {
throw new FileNotFoundException(String.format("复制文件失败,源文件 %s 不存在!", srcFileName));
} else if (!srcFile.isFile()) { // 判断源文件是否是合法的文件
throw new FileNotFoundException(String.format("复制文件失败,%s 不是一个文件!", srcFileName));
}
File descFile = new File(descFileName);
// 判断目标文件是否存在
if (descFile.exists()) {
// 如果目标文件存在,并且允许覆盖
if (coverlay) {
if (delFile(descFileName)) {
throw new IOException(String.format("删除目标文件 %s 失败!", descFileName));
}
} else {
throw new FileAlreadyExistsException(String.format("复制文件失败,目标文件 %s 已存在!", descFileName));
}
} else {
if (!descFile.getParentFile().exists() && !mkParentDirs(descFile)) {
throw new IOException("创建目标文件所在的目录失败!");
}
}
// 准备复制文件
try (
InputStream ins = new FileInputStream(srcFile);
OutputStream outs = new FileOutputStream(descFile);
) {
copy(ins, outs);
return true;
} catch (Exception e) {
LOGGER.warn("复制文件失败:", e);
return false;
}
}
/**
* 复制整个目录的内容,如果目标目录存在,则不覆盖
*
* @param srcDirName 源目录名
* @param descDirName 目标目录名
* @return 如果复制成功返回true ,否则返回false
* @throws IOException the io exception
*/
public static boolean copyDirectory(String srcDirName, String descDirName) throws IOException {
return copyDirectoryCover(srcDirName, descDirName, false);
}
/**
* 复制整个目录的内容
*
* @param srcDirName 源目录名
* @param descDirName 目标目录名
* @param coverlay 如果目标目录存在,是否覆盖
* @return 如果复制成功返回true ,否则返回false
* @throws IOException the io exception
*/
public static boolean copyDirectoryCover(String srcDirName,
String descDirName, boolean coverlay) throws IOException {
File srcDir = new File(srcDirName);
// 判断源目录是否存在
if (!srcDir.exists()) {
throw new FileNotFoundException(String.format("复制目录失败,源目录 %s 不存在!", srcDirName));
} else if (!srcDir.isDirectory()) { // 判断源目录是否是目录
throw new FileNotFoundException(String.format("复制目录失败,%s 不是一个目录!", srcDirName));
}
// 如果目标文件夹名不以文件分隔符结尾,自动添加文件分隔符
String descDirNames = descDirName;
if (!descDirNames.endsWith(File.separator)) {
descDirNames = descDirNames + File.separator;
}
File descDir = new File(descDirNames);
// 如果目标文件夹存在
if (descDir.exists()) {
if (coverlay) {
// 允许覆盖目标目录
if (delFile(descDirNames)) {
throw new IOException(String.format("删除目录 %s 失败!", descDirNames));
}
}
else {
throw new FileAlreadyExistsException(String.format("目标目录复制失败,目标目录 %s 已存在!", descDirNames));
}
} else {
if (!descDir.mkdirs()) {
throw new IOException("创建目标目录失败!");
}
}
return copyFolder(srcDir, descDirName);
}
/**
* 复制整个目录的内容
*
* @param folder 源目录
* @param descDirName 目的地址
* @return boolean boolean
* @throws IOException the io exception
*/
public static boolean copyFolder(File folder, String descDirName) throws IOException {
File[] files = folder.listFiles();
if (files != null) {
for (File file : files) {
// 如果是一个单个文件,则直接复制
if ((file.isFile() && !copyFile(file.getAbsolutePath(), descDirName + file.getName()))
|| (file.isDirectory() && !copyDirectory(file.getAbsolutePath(), descDirName + file.getName()))) {
return false;
}
}
}
return true;
}
/**
* Stream copy, use default buf_size.
*
* @param is InputStream
* @param os OutputStream
* @throws IOException IO异常
*/
public static void copy(InputStream is, OutputStream os) throws IOException {
copy(is, os, BUF_SIZE);
}
/**
* copy data from reader to writer.
*
* @param reader Reader
* @param writer Writer
* @throws IOException IO异常
*/
public static void copy(Reader reader, Writer writer) throws IOException {
char[] buf = new char[BUF_SIZE];
int len;
try {
while ((len = reader.read(buf)) != -1) {
writer.write(buf, 0, len);
}
} finally {
close(reader);
}
}
/**
* Stream copy.
*
* @param is InputStream
* @param os OutputStream
* @param bufSize int
* @throws IOException IO异常
*/
public static void copy(InputStream is, OutputStream os, int bufSize) throws IOException {
byte[] buf = new byte[bufSize];
int c;
try {
while ((c = is.read(buf)) != -1) {
os.write(buf, 0, c);
}
} finally {
close(is);
}
}
/**
* 将目标的文件或目录移动到新位置上.
*
* @param srcFileName 待复制的文件名
* @param descFileName 目标文件名
* @return 如果移动成功 ,则返回true,否是返回false
* @throws IOException the io exception
*/
public static boolean move(String srcFileName, String descFileName) throws IOException {
return copy(srcFileName, descFileName) && delFile(srcFileName);
}
/**
* 删除文件,可以删除单个文件或文件夹
*
* @param fileName 被删除的文件名
* @return 如果删除成功 ,则返回true,否是返回false
*/
public static boolean delFile(String fileName) {
File file = new File(fileName);
if (!file.exists()) {
LOGGER.debug(String.format(FILE_NOT_FIND, fileName));
return false;
} else {
if (file.isFile()) {
return deleteFile(fileName);
} else {
return deleteDirectory(fileName);
}
}
}
/**
* 删除单个文件
*
* @param fileName 被删除的文件名
* @return 如果删除成功 ,则返回true,否则返回false
*/
public static boolean deleteFile(String fileName) {
File file = new File(fileName);
if (file.exists() && file.isFile()) {
if (file.delete()) {
LOGGER.debug("删除文件 {} 成功!", fileName);
return true;
} else {
LOGGER.debug("删除文件 {} 失败!", fileName);
return false;
}
} else {
LOGGER.debug(String.format(FILE_NOT_FIND, fileName));
return true;
}
}
/**
* 删除目录及目录下的文件
*
* @param dirName 被删除的目录所在的文件路径
* @return 如果目录删除成功 ,则返回true,否则返回false
*/
public static boolean deleteDirectory(String dirName) {
String dirNames = dirName;
if (!dirNames.endsWith(File.separator)) {
dirNames = dirNames + File.separator;
}
File dirFile = new File(dirNames);
if (!dirFile.exists() || !dirFile.isDirectory()) {
LOGGER.debug("{} 目录不存在!", dirNames);
return true;
}
if (clearFolder(dirFile) && dirFile.delete()) {
LOGGER.debug("删除目录 {} 成功!", dirName);
return true;
} else {
LOGGER.debug("删除目录 {} 失败!", dirName);
return false;
}
}
/**
* 清空一个目录.
*
* @param dirName 需要清除的目录.如果该参数实际上是一个file,不处理,返回true,
* @return 是否清除成功 boolean
*/
public static boolean clearFolder(String dirName) {
File file = new File(dirName);
return file.isFile() || clearFolder(file);
}
/**
* 清空目录
*
* @param folder 目标目录
* @return 是否清除成功
*/
private static boolean clearFolder(File folder) {
File[] files = folder.listFiles();
if (files != null) {
for (File file : files) {
if ((file.isFile() && !deleteFile(file.getAbsolutePath()))
|| (file.isDirectory() && !deleteDirectory(file.getAbsolutePath()))) {
return false;
}
}
}
return true;
}
/**
* 创建单个文件
*
* @param descFileName 文件名,包含路径
* @return 如果创建成功 ,则返回true,否则返回false
* @throws IOException the io exception
*/
public static boolean createFile(String descFileName) throws IOException {
File file = new File(descFileName);
if (file.exists()) {
throw new FileAlreadyExistsException(String.format("文件 %s 已存在!", descFileName));
}
if (descFileName.endsWith(File.separator)) {
throw new IOException(String.format("%s 为目录,不能创建目录!", descFileName));
}
if (!file.getParentFile().exists() && !mkParentDirs(file)) {
throw new IOException("创建文件所在的目录失败!");
}
// 创建文件
try {
if (file.createNewFile()) {
LOGGER.debug("{} 文件创建成功!", descFileName);
return true;
} else {
LOGGER.debug("{} 文件创建失败!", descFileName);
return false;
}
} catch (IOException e) {
LOGGER.debug(String.format("%s 文件创建失败!", descFileName), e);
return false;
}
}
/**
* 创建目录
*
* @param descDirName 目录名,包含路径
* @return 如果创建成功 ,则返回true,否则返回false
* @throws IOException the io exception
*/
public static boolean createDirectory(String descDirName) throws IOException {
String descDirNames = descDirName;
if (!descDirNames.endsWith(File.separator)) {
descDirNames = descDirNames + File.separator;
}
File descDir = new File(descDirNames);
if (descDir.exists()) {
throw new FileAlreadyExistsException(String.format("目录 %s 已存在!", descDirNames));
}
// 创建目录
if (descDir.mkdirs()) {
LOGGER.debug("目录 {} 创建成功!", descDirNames);
return true;
} else {
LOGGER.debug("目录 {} 创建失败!", descDirNames);
return false;
}
}
/**
* 从指定Reader中读取数据字符串.
*
* @param reader Reader
* @return String string
* @throws IOException IO异常
*/
public static String read(Reader reader) throws IOException {
CharArrayWriter writer = new CharArrayWriter();
copy(reader, writer);
return writer.toString();
}
/**
* 保存一个数据到指定文件中.
*
* @param file 文件
* @param data 内容
* @throws IOException IO异常
*/
public static void saveData(File file, String data) throws IOException {
if (!file.getParentFile().exists() && !mkParentDirs(file)) {
return;
}
saveData(new FileOutputStream(file), data);
}
/**
* 创建父目录
*
* @param file 文件
* @return boolean
*/
private static boolean mkParentDirs(File file) {
return file.getParentFile().mkdirs();
}
/**
* 将数据保存到指定位置上.
*
* @param file 文件
* @param data 内容
* @param append 是否追加
* @throws IOException IO异常
*/
public static void saveData(String file, String data, Boolean append) throws IOException {
saveData(new File(file), data, append);
}
/**
* 保存一个数据到指定文件中
*
* @param file 文件
* @param data 内容
* @param append 是否追加
* @throws IOException IO异常
*/
public static void saveData(File file, String data, Boolean append) throws IOException {
if (!file.getParentFile().exists() && !mkParentDirs(file)) {
return;
}
saveData(new FileOutputStream(file, append), data);
}
/**
* 保存bytes到一个输出流中并且关闭它
*
* @param os 输出流
* @param data 内容
* @throws IOException IO异常
*/
public static void saveData(OutputStream os, byte[] data) throws IOException {
try {
os.write(data);
} finally {
close(os);
}
}
/**
* 保存String到指定输出流中.
*
* @param os 输出流
* @param data 内容
* @throws IOException IO异常
*/
public static void saveData(OutputStream os, String data) throws IOException {
try (
BufferedOutputStream bos = new BufferedOutputStream(os, BUF_SIZE);
) {
byte[] bs = data.getBytes(DEFAULT_ENCODING);
bos.write(bs);
}
}
/**
* 将数据保存到指定位置上.
*
* @param file 文件路径
* @param data 内容
* @throws IOException IO异常
*/
public static void saveData(String file, String data) throws IOException {
saveData(new File(file), data);
}
/**
* 修复路径,将 \\ 或 / 等替换为 File.separator
*
* @param path 路径
* @return 路径 string
*/
public static String path(String path) {
String p = StringHelper.replace(path, "\\", "/");
p = StringHelper.join(StringHelper.split(p, "/"), "/");
if (!StringHelper.startsWithAny(p, "/") && StringHelper.startsWithAny(path, "\\", "/")) {
p += "/";
}
if (!StringHelper.endsWithAny(p, "/") && StringHelper.endsWithAny(path, "\\", "/")) {
p = p + "/";
}
return p;
}
/**
* 关闭流.
*
* @param closeable 流
*/
public static void close(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (Exception e) {
LOGGER.error("数据流关闭失败.", e);
}
}
}
/**
* 增加文件结尾/
*
* @param name 文件路径
* @return 文件路径 string
*/
public static String addEndSlash(String name) {
return StringHelper.isEmpty(name) || name.endsWith("/") ? name : name + "/";
}
/**
* 移除文件结尾/
*
* @param name 文件路径
* @return 文件路径 string
*/
public static String clearEndSlash(String name) {
return StringHelper.isEmpty(name) || !name.endsWith("/") ? name : name.substring(0, name.length() - 1);
}
}
| [
"tickluo@sina.com"
] | tickluo@sina.com |
c26184c316a53665a06953cab2ed1dd40d5a8f7b | f58dc56b30e51535ea0d37d2a9b79a0f8689518b | /moho-remote/src/test/java/com/voxeo/rayo/client/test/AskTest.java | 7bcb0c636a78c1b5100c48ceb287117466da0f5b | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | voxeolabs/moho | 748abfcd6503fa98b9d4be7b91d90a3062f93ab1 | 3f455d4cf895571208d2cc8114f201bc5c26bad8 | refs/heads/master | 2021-01-17T13:37:03.565820 | 2016-06-21T09:44:05 | 2016-06-21T09:44:05 | 590,532 | 4 | 9 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package com.voxeo.rayo.client.test;
import org.junit.Test;
import com.voxeo.rayo.client.DefaultXmppConnectionFactory;
import com.voxeo.rayo.client.XmppConnection;
import com.voxeo.rayo.client.internal.XmppIntegrationTest;
public class AskTest extends XmppIntegrationTest {
@Test
public void testAsk() throws Exception {
rayo.answer(lastCallId);
rayo.ask("What's your favorite colour?", "red,green", lastCallId);
Thread.sleep(400);
assertServerReceived("<iq id=\"*\" type=\"set\" from=\"userc@localhost/voxeo\" to=\"#callId@localhost\"><ask xmlns=\"urn:xmpp:tropo:ask:1\" min-confidence=\"0.3\" mode=\"dtmf\" terminator=\"#\" timeout=\"650000\" bargein=\"true\"><prompt>What's your favorite colour?</prompt><choices content-type=\"application/grammar+voxeo\"><![CDATA[red,green]]></choices></ask></iq>");
}
@Override
protected XmppConnection createConnection(String hostname, Integer port) {
return new DefaultXmppConnectionFactory().createConnection(hostname, port);
}
}
| [
"wzhu@voxeo.com"
] | wzhu@voxeo.com |
1c269f101116fc879b532908a00a994726702bb9 | eb89e756b26a7a685cd9713142a346888ef34f37 | /src/main/java/com/reminder/application/repository/RoleRepository.java | 4dbac6e4e310b2ba3780175fe8c669c6972add7f | [] | no_license | vikash0439/ReminderSotware | ba7ed9d89a5c922410f7525f70dd31dede1df6fa | f6669fa363e85cc21c9572444b1b192be1323a09 | refs/heads/master | 2020-04-21T12:02:25.283399 | 2019-02-21T11:36:31 | 2019-02-21T11:36:31 | 169,549,216 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package com.reminder.application.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.reminder.application.model.Role;
public interface RoleRepository extends JpaRepository<Role, Long>{
} | [
"vikash.k@dcmtech.com"
] | vikash.k@dcmtech.com |
f666a4fcaa7640b383d8027dd1a77520bb7044d2 | 1f6ada7c423e815c063e223ed849c51013dad787 | /cipango-dar/src/main/java/org/cipango/dar/DefaultApplicationRouter.java | ec38a3eeb847f3a0fd500b9cd54f570aba3a82c8 | [
"Apache-2.0"
] | permissive | leoleegit/cipango | 6e4b1086370cf96bb7199c4e8177b20c2cb9d316 | c4212d03cb1ab9edd60d4e5e6520c682dfd85b80 | refs/heads/master | 2020-05-03T21:39:25.572378 | 2014-08-30T16:36:44 | 2014-08-30T16:36:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,446 | java | // ========================================================================
// Copyright 2008-2009 NEXCOM Systems
// ------------------------------------------------------------------------
// 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.cipango.dar;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.ar.SipApplicationRouter;
import javax.servlet.sip.ar.SipApplicationRouterInfo;
import javax.servlet.sip.ar.SipApplicationRoutingDirective;
import javax.servlet.sip.ar.SipApplicationRoutingRegion;
import javax.servlet.sip.ar.SipRouteModifier;
import javax.servlet.sip.ar.SipTargetedRequestInfo;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* Default Application Router.
* Looks for its configuration from the property javax.servlet.sip.ar.dar.configuration
* or etc/dar.properties if not defined.
*/
public class DefaultApplicationRouter implements SipApplicationRouter, Dumpable
{
private static final Logger LOG = Log.getLogger(DefaultApplicationRouter.class);
public static final String __J_S_DAR_CONFIGURATION = "javax.servlet.sip.ar.dar.configuration";
public static final String ROUTE_OUTGOING_REQUESTS = "org.cipango.dar.routeOutgoingRequests";
public static final String DEFAULT_CONFIGURATION = "etc/dar.properties";
private Map<String, RouterInfo[]> _routerInfoMap;
private String _configuration;
private SortedSet<String> _applicationNames = new TreeSet<String>();
private boolean _routeOutgoingRequests = true;
public void setConfiguration(String configuration)
{
_configuration = configuration;
}
public String getConfiguration()
{
return _configuration;
}
public void setRouteOutgoingRequests(boolean b)
{
_routeOutgoingRequests = b;
}
public boolean getRouteOutgoingRequests()
{
return _routeOutgoingRequests;
}
public String[] getApplicationNames()
{
return _applicationNames.toArray(new String[] {});
}
public void applicationDeployed(List<String> newlyDeployedApplicationNames)
{
_applicationNames.addAll(newlyDeployedApplicationNames);
init();
}
public void applicationUndeployed(List<String> undeployedApplicationNames)
{
_applicationNames.removeAll(undeployedApplicationNames);
init();
}
public void destroy()
{
}
public SipApplicationRouterInfo getNextApplication(SipServletRequest initialRequest,
SipApplicationRoutingRegion region, SipApplicationRoutingDirective directive, SipTargetedRequestInfo toto, Serializable stateInfo)
{
if (!_routeOutgoingRequests && initialRequest.getRemoteAddr() == null)
return null;
if (_routerInfoMap == null || _routerInfoMap.isEmpty())
{
if (stateInfo != null || _applicationNames.isEmpty() || directive != SipApplicationRoutingDirective.NEW)
return null;
return new SipApplicationRouterInfo(_applicationNames.first(),
SipApplicationRoutingRegion.NEUTRAL_REGION,
initialRequest.getFrom().getURI().toString(),
null,
SipRouteModifier.NO_ROUTE,
1);
}
String method = initialRequest.getMethod();
RouterInfo[] infos = _routerInfoMap.get(method.toUpperCase());
if (infos == null)
return null;
int index = 0;
if (stateInfo != null)
index = (Integer) stateInfo;
if (index >= 0 && index < infos.length)
{
RouterInfo info = infos[index];
String identity = info.getIdentity();
if (identity.startsWith("DAR:"))
{
try
{
identity = initialRequest.getAddressHeader(identity.substring("DAR:".length())).getURI().toString();
}
catch (Exception e)
{
Log.debug("Failed to parse router info identity: " + info.getIdentity(), e);
}
}
return new SipApplicationRouterInfo(info.getName(), info.getRegion(), identity, null,
SipRouteModifier.NO_ROUTE, index + 1);
}
return null;
}
public String getDefaultApplication()
{
if ((_routerInfoMap == null || _routerInfoMap.isEmpty()) && !_applicationNames.isEmpty())
return _applicationNames.first();
return null;
}
public void setRouterInfos(Map<String, RouterInfo[]> infoMap)
{
_routerInfoMap = infoMap;
}
public Map<String, RouterInfo[]> getRouterInfos()
{
return _routerInfoMap;
}
public String getConfig()
{
if (_routerInfoMap == null)
return null;
StringBuilder sb = new StringBuilder();
Iterator<String> it = _routerInfoMap.keySet().iterator();
while (it.hasNext())
{
String method = (String) it.next();
RouterInfo[] routerInfos = _routerInfoMap.get(method);
sb.append(method).append(": ");
for (int i = 0; routerInfos != null && i < routerInfos.length; i++)
{
RouterInfo routerInfo = routerInfos[i];
sb.append('(');
sb.append('"').append(routerInfo.getName()).append("\", ");
sb.append('"').append(routerInfo.getIdentity()).append("\", ");
sb.append('"').append(routerInfo.getRegion().getType()).append("\", ");
sb.append('"').append(routerInfo.getUri()).append("\", ");
sb.append('"').append(routerInfo.getRouteModifier()).append("\", ");
sb.append('"').append(i).append('"');
sb.append(')');
if (i + 1 < routerInfos.length)
sb.append(", ");
}
sb.append('\n');
}
return sb.toString();
}
public RouterInfo[] getRouterInfo(String key)
{
return _routerInfoMap.get(key);
}
public void init()
{
if (!System.getProperty(ROUTE_OUTGOING_REQUESTS, "true").equalsIgnoreCase("true"))
_routeOutgoingRequests = false;
if (_configuration == null)
{
String configuration = System.getProperty(__J_S_DAR_CONFIGURATION);
if (configuration != null)
{
_configuration = configuration;
}
else if (System.getProperty("jetty.home") != null)
{
File home = new File(System.getProperty("jetty.home"));
_configuration = new File(home, DEFAULT_CONFIGURATION).toURI().toString();
}
if (_configuration == null)
_configuration = DEFAULT_CONFIGURATION;
}
try
{
DARConfiguration config = new DARConfiguration(new URI(_configuration));
config.configure(this);
}
catch (Exception e)
{
LOG.debug("DAR configuration error: " + e);
}
if ((_routerInfoMap == null || _routerInfoMap.isEmpty()) && !_applicationNames.isEmpty())
LOG.info("No DAR configuration. Using application: " + _applicationNames.first());
}
public void init(Properties properties)
{
init();
}
public String dump()
{
return AggregateLifeCycle.dump(this);
}
public void dump(Appendable out, String indent) throws IOException
{
out.append("DefaultApplicationRouter ");
if (_routerInfoMap == null || _routerInfoMap.isEmpty())
{
if (!_applicationNames.isEmpty())
out.append("default application: ").append(getDefaultApplication());
else
out.append("No applications");
}
else
{
out.append("\n");
List<Dumpable> l = new ArrayList<Dumpable>();
Iterator<String> it = _routerInfoMap.keySet().iterator();
while (it.hasNext())
l.add(new DumpableMethod(it.next()));
AggregateLifeCycle.dump(out,indent, l);
}
}
public class DumpableMethod implements Dumpable
{
private String _method;
public DumpableMethod(String method)
{
_method = method;
}
public String dump()
{
return AggregateLifeCycle.dump(this);
}
public void dump(Appendable out, String indent) throws IOException
{
out.append(_method).append("\n");
AggregateLifeCycle.dump(out,indent, Arrays.asList(_routerInfoMap.get(_method)));
}
}
}
| [
"workspaceleo@gmail.com"
] | workspaceleo@gmail.com |
aa3805deac2baff7f677a503c923cead221d328b | dc41f78ed6d3b11d76b431768cf815b94ddfb655 | /cjlibrary/src/main/java/com/carljay/cjlibrary/annotations/CJNetInterface.java | f352c78b9a9a703312caaaee17b72ca867ce2591 | [] | no_license | 683280/BookReader | 2cf2c98645a68eed2d47604f37046be442fc3887 | 3316f8c031814d999a7d9e07ad0e857a8358f84c | refs/heads/master | 2021-04-18T20:35:16.035484 | 2018-03-26T11:27:43 | 2018-03-26T11:27:43 | 126,769,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package com.carljay.cjlibrary.annotations;
import com.carljay.cjlibrary.enums.NetType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by carljay on 2017/3/1.
*/
@Target({ElementType.METHOD,ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface CJNetInterface{
String name() default "";
String url() ;
NetType type() default NetType.GET;
}
| [
"683280love"
] | 683280love |
44ef0b21ee5325ae3888c9453780c6674184f0a8 | 94ea494456c4d3edc313de151f003719ca260fa9 | /Webservice-From-WSDL/src/main/java/servicemix/example/PersonImpl.java | 7aa516f04ea9d08afff816e5574b837bed30ecb4 | [] | no_license | onjsdnjs/servicemix-example | 8f23550d1441c4ec9dd10d0f8cb045b164f155c8 | b96629c33e9b1e17f7b1191ed307331a7c3162d9 | refs/heads/master | 2021-01-17T22:51:56.145570 | 2013-03-14T11:15:59 | 2013-03-14T11:15:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,795 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package servicemix.example;
import org.apache.servicemix.samples.wsdl_first.Person;
import org.apache.servicemix.samples.wsdl_first.UnknownPersonFault;
import javax.jws.WebService;
import javax.xml.ws.Holder;
@WebService(serviceName = "PersonService", targetNamespace = "http://servicemix.apache.org/samples/wsdl-first", endpointInterface = "org.apache.servicemix.samples.wsdl_first.Person")
public class PersonImpl implements Person {
public void getPerson(Holder<String> personId, Holder<String> ssn, Holder<String> name)
throws UnknownPersonFault
{
if (personId.value == null || personId.value.length() == 0) {
org.apache.servicemix.samples.wsdl_first.types.UnknownPersonFault fault = new org.apache.servicemix.samples.wsdl_first.types.UnknownPersonFault();
fault.setPersonId(personId.value);
throw new UnknownPersonFault(null,fault);
}
name.value = "Guillaume";
ssn.value = "000-000-0000";
}
}
| [
"north.alex@gmail.com"
] | north.alex@gmail.com |
7b2fd0311b65357bf572794f59f798641d6cfa23 | a239ce8bc5b897987e3acb0515fdd34e35272eee | /src/HW3/Calculator.java | 60302830ba27174a0859dc2afd6cde7b3fcf792a | [] | no_license | DimaBah/HomeWorkStorm | f1980a914a5c0abd9bf7b6113fc38ba3f59c723b | 9174a5e738bd37be2b17be1c32d201eb83df0eb0 | refs/heads/master | 2022-10-07T02:15:50.176432 | 2020-05-31T11:23:59 | 2020-05-31T11:23:59 | 256,505,836 | 0 | 0 | null | 2020-05-31T11:29:14 | 2020-04-17T13:08:43 | Java | UTF-8 | Java | false | false | 1,590 | java | package HW3;
import java.util.Random;
public class Calculator{
int operand1;
int operand2;
Calculator(){
operand1 = 1;
operand2 = 2;
}
public int getOperand1() {
return operand1;
}
public void setOperand1(int operand1) {
this.operand1 = operand1;
}
public int getOperand2() {
return operand2;
}
public void setOperand2(int operand2) {
this.operand2 = operand2;
}
public int addition(int operand1, int operand2){
return operand1 + operand2;
}
public int multiplication(int operand1, int operand2){
return operand1 * operand2;
}
public double middle(double operand1, double operand2){
return (operand1 + operand2)/2;
}
public int aInGradeB(int operand1, int operand2){
return (int)Math.pow(operand1, operand2);
}
public static void main(String[] args) {
Random rnd = new Random();
int op1 = 1 + rnd.nextInt(10);
int op2 = 1 + rnd.nextInt(10);
Calculator a = new Calculator();
System.out.println("Сумма чисел " + op1 + " и " + op2 + " равна: " + a.addition(op1, op2));
System.out.println("Произведение " + op1 + " и " + op2 + " равно: " + a.multiplication(op1, op2));
System.out.println("Среднее арифметическое чисел " + op1 + " и " + op2 + " равно: " + a.middle(op1, op2));
System.out.println("Число " + op1 + " в степени " + op2 + " равно: " + a.aInGradeB(op1, op2));
}
}
| [
"bahdiman@mail.ru"
] | bahdiman@mail.ru |
ea2474edd47806c5e8b6844a5dcfe012d70d236f | e2a9f609c360fa8ad42855c9bea6d4b91ee7770a | /SystemWeb/src/java/com/selectcar/DAO/clientDAO.java | 424db95869e9435d4c7151a80d3137935fc5f130 | [] | no_license | Suspir0n/SelectCar | 46161a54846e1ecae08ea4d134e63e1b7c320572 | 60ed9cfc8e3c18b0bf55915bff3f48241894f4ee | refs/heads/main | 2023-01-19T15:24:43.177575 | 2020-11-24T23:24:19 | 2020-11-24T23:24:19 | 302,162,130 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,775 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.selectcar.DAO;
import com.selectcar.entitys.clientEntitys;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Suspir0n
*/
public class clientDAO {
// Attributes \\
Connection connect;
PreparedStatement ps;
// Instances \\
baseDAO base = new baseDAO();
// Constructor \\
public clientDAO() {
}
// Methods \\
/*
* Method of save
* register the data at database.
*/
public void save(clientEntitys client) throws Exception {
if (!checkClient(client)) {
try {
connect = com.selectcar.database.connection.getConnection(); // obtem a conexão com o BD
base.setSomeAttributesClients(client);
// se é uma inserção
ps = connect.prepareStatement("INSERT INTO client(uid, active, deleted, createAt, updateAt, name, address, complementationAddress, state, city, zipCode, phone, cpf, email, photo) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setInt(1, client.getUid());
ps.setBoolean(2, client.getActive());
ps.setBoolean(3, client.getDeleted());
ps.setString(4, client.getCreateAt());
ps.setString(5, client.getUpdateAt());
ps.setString(6, client.getName());
ps.setString(7, client.getAddress());
ps.setString(8, client.getAddressComplementation());
ps.setString(9, client.getState());
ps.setString(10, client.getCity());
ps.setString(11, client.getZipCode());
ps.setString(12, client.getPhone());
ps.setString(13, client.getCpf());
ps.setString(14, client.getEmail());
ps.setString(15, client.getPhoto());
} catch (SQLException e) {
throw new Exception("Erro na preparação do SQL", e);
}
}else {
throw new Exception("Já existe um cliente cadastrado com esse CPF!");
}
try {
ps.execute();
} catch (SQLException e) {
throw new Exception("Erro na execução do SQL", e);
}
}
/*
* Method that checks the client
* checks whether a client is registered.
*/
public boolean checkClient(clientEntitys client) throws Exception {
boolean result = false;
ResultSet rs = null;
connect = com.selectcar.database.connection.getConnection();
ps = connect.prepareStatement("SELECT * FROM client WHERE cpf = '" + client.getCpf() + "'");
rs = ps.executeQuery();
if (rs.next()) {
result = true;
}
return result;
}
/*
* Method search
* search a data at database.
*/
public clientEntitys search(Integer id) throws Exception {
connect = com.selectcar.database.connection.getConnection();
try {
ps = connect.prepareStatement("select * from client where uid=?"); // obtem apena uma única informação
ps.setInt(1, id);
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
clientEntitys client = new clientEntitys();
client.setUid(resultSet.getInt("uid"));
client.setActive(resultSet.getBoolean("active"));
client.setDeleted(resultSet.getBoolean("deleted"));
client.setCreateAt(resultSet.getString("createAt"));
client.setUpdateAt(resultSet.getString("updateAt"));
client.setName(resultSet.getString("name"));
client.setAddress(resultSet.getString("address"));
client.setAddressComplementation(resultSet.getString("complementationAddress"));
client.setState(resultSet.getString("state"));
client.setCity(resultSet.getString("city"));
client.setZipCode(resultSet.getString("zipCode"));
client.setPhone(resultSet.getString("phone"));
client.setCpf(resultSet.getString("cpf"));
client.setEmail(resultSet.getString("email"));
client.setPhoto(resultSet.getString("photo"));
return client;
}
} catch (SQLException ex) {
throw new Exception("Erro na execução do SQL - busca de cliente", ex);
}
return null;
}
/*
* Method Delete
* delete some clients register.
*/
public void delete(clientEntitys client) throws Exception {
connect = com.selectcar.database.connection.getConnection();
try {
ps = connect.prepareStatement("delete from client where uid=?");
ps.setInt(1, client.getUid());
ps.execute();
} catch (SQLException e) {
throw new Exception("Erro ao deletar o cliente", e);
}
com.selectcar.database.connection.closeConnection(connect);
}
/*
* Method Count
* Counts how many clients are registered.
*/
public clientEntitys CountsHowManyClients() throws Exception {
connect = com.selectcar.database.connection.getConnection();
try {
ps = connect.prepareStatement("select count(*) as Clientes from client"); // obtem apena uma única informação
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
clientEntitys client = new clientEntitys();
client.setTotal(resultSet.getInt("Clientes"));
return client;
}
} catch (SQLException ex) {
throw new Exception("Erro na execução do SQL - contador de clientes", ex);
}
return null;
}
/*
* Method of bring all the clients
* brings all the clients and put in a table.
*/
public List<clientEntitys> all() throws Exception {
connect = com.selectcar.database.connection.getConnection();
List<clientEntitys> listClient = new ArrayList<>();
try {
ps = connect.prepareStatement("select * from client");
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
clientEntitys client = new clientEntitys();
client.setUid(resultSet.getInt("uid"));
client.setActive(resultSet.getBoolean("active"));
client.setDeleted(resultSet.getBoolean("deleted"));
client.setCreateAt(resultSet.getString("createAt"));
client.setUpdateAt(resultSet.getString("updateAt"));
client.setName(resultSet.getString("name"));
client.setAddress(resultSet.getString("address"));
client.setAddressComplementation(resultSet.getString("complementationAddress"));
client.setState(resultSet.getString("state"));
client.setCity(resultSet.getString("city"));
client.setZipCode(resultSet.getString("zipCode"));
client.setPhone(resultSet.getString("phone"));
client.setCpf(resultSet.getString("cpf"));
client.setEmail(resultSet.getString("email"));
client.setPhoto(resultSet.getString("photo"));
listClient.add(client);
}
} catch (SQLException sqle) {
throw new Exception(sqle);
}
return listClient;
}
}
| [
"evandrojunior1615@gmail.com"
] | evandrojunior1615@gmail.com |
972af40f81e5f64b679648e05a3d5f3db1b23c48 | 2a28a49afc228e6c29f6ab4587199ec950b457a7 | /src/main/java/core/Util/ScatterType.java | 9061b47feb54f2bad985bf78d13d64fbedc94284 | [] | no_license | 0-3/CrispCore | 6d1abad19ad1e0dc00d7fb961ed6c3a622c84220 | 7a58a15b8a7080e8a729ca5c6af9b15d97dcc15e | refs/heads/master | 2021-09-16T20:58:39.738662 | 2018-06-25T03:14:42 | 2018-06-25T03:14:42 | 138,538,097 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package network.reborn.core.Util;
public enum ScatterType {
GAME, MEETUP, OTHER
}
| [
"ethan.t.ford@gmail.com"
] | ethan.t.ford@gmail.com |
a2315104aac9be6cb4209c6354e8f0857242ca34 | 3745b4157eb72f6975448d6601730a4c96c5369f | /src/card/CardNFC.java | 3e3ac284e39a863cd8e4a2805171c7b6a41c9824 | [] | no_license | JuliaDobrovolska/javaCourse | d2afcb7294f8a607c6258b01e1c5f6a33085db8a | eff58542ee1b3e927d3f532cd62dfcb93da5d956 | refs/heads/master | 2020-07-13T13:58:48.403809 | 2019-09-02T18:07:01 | 2019-09-02T18:07:01 | 205,096,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package card;
public abstract class CardNFC extends CardChip {
private String nfc;
public String getNfc(String nfc) {
return nfc;
};
public abstract boolean checkNfc(String nfc);
public String setNfc(String nfc){
this.nfc = nfc;
return this.nfc;
};
}
| [
"dobrovolskajulia@gmail.com"
] | dobrovolskajulia@gmail.com |
39e8db88da63a069a0a1a0354b7f7f37d812879b | 0529524c95045b3232f6553d18a7fef5a059545e | /app/src/androidTest/java/TestCase_com_acs_beautifulautumnlwp_free__409751865.java | 98780e74f0c8273c8658bb4c4c7ac259e2519adf | [] | no_license | sunxiaobiu/BasicUnitAndroidTest | 432aa3e10f6a1ef5d674f269db50e2f1faad2096 | fed24f163d21408ef88588b8eaf7ce60d1809931 | refs/heads/main | 2023-02-11T21:02:03.784493 | 2021-01-03T10:07:07 | 2021-01-03T10:07:07 | 322,577,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | import android.opengl.GLES20;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class TestCase_com_acs_beautifulautumnlwp_free__409751865 {
public static void testCase() throws Exception {
byte var0 = 1;
GLES20.glBindAttribLocation(var0, 0, "a_position");
}
@Test
public void staticTest() throws Exception {
testCase();
}
}
| [
"sunxiaobiu@gmail.com"
] | sunxiaobiu@gmail.com |
29c9e6034597fcb7e57b7cac5f622ecd3bb163b6 | 558ec2d7d4b43e03f6fcf06c05ad86e526e18a0a | /src/Encryption.java | 99992c7856bc3203a1417353b26cc9de58881a4a | [] | no_license | freakybaba/Digital-Diary | 106e092da7e8b43c30df221107168909e049470b | 9d75137116484fafa48276ce0eaa86f8ee032675 | refs/heads/master | 2021-09-23T12:00:50.068267 | 2018-09-22T11:18:29 | 2018-09-22T11:18:29 | 113,662,090 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 873 | java |
public class Encryption {
public String encrypt(String s)
{
String str=new String(s);
char ch[]=str.toCharArray();
int l=str.length();
int count=1;
for(int i=0;i<l;i++)
{
if(count>26)
count=1;
ch[i]=(char)((int)ch[i]+count);
count++;
}
String sa=new String(ch);
System.out.println(sa);
return sa;
}
public String decrypt(String s)
{
String str=new String(s);
char ch[]=str.toCharArray();
int l=str.length();
int count=1;
for(int i=0;i<l-1;i++)
{
if(count>26)
count=1;
ch[i]=(char)((int)ch[i]-count);
count++;
}
String sa=new String(ch);
System.out.println(sa);
return sa;
}
}
| [
"noreply@github.com"
] | freakybaba.noreply@github.com |
467770483670aa3a126851c93c0dcea07bf683c0 | 0b117d2e9efa2ea7dc2ac9fe3ee31e88659d4823 | /.svn/pristine/cc/cc67a29665961ca9b29bc0d3486bbe4aae944736.svn-base | 2e94066e79eed1268172cb54cf35b8806e60f268 | [] | no_license | 123qweqwe123/PEACE3 | e8ab475f4281b3b4c1d6198b0c0f46c00d5ad2a6 | f99b013225308177f15f43bd0acbdcf08445a9e4 | refs/heads/master | 2020-03-09T22:08:26.151165 | 2018-04-11T03:16:48 | 2018-04-11T03:16:48 | 129,027,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | package com.bdcor.pip.web.common.service;
import java.util.List;
import java.util.Map;
import com.bdcor.pip.web.common.domain.PipCommRemark;
public interface RemarkService {
/**
* 由主键查询主键下不同类别对应的备注
* @param remark
* @return
*/
Map<Short,List<PipCommRemark>> getRemakListByPk(PipCommRemark remark);
public void setRemarkCount(Object srcList,String remarkFieldName,String...paraName);
}
| [
"1074673969@qq.com"
] | 1074673969@qq.com | |
76b56950cefb01652599874dbaff3efb7eb57af9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_a9a5683f21de68de496de82918f80aec6a6878e9/JDBCMetadata/10_a9a5683f21de68de496de82918f80aec6a6878e9_JDBCMetadata_t.java | 568a6b1bdfad257c0fcd8e101f9dabc4960eb4a7 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,595 | java | /*
* JDBCMetadata.java
*
* Created on June 6, 2007, 10:47 AM
*
* CodaServer and related original technologies are copyright 2008, 18th Street Software, LLC.
*
* Permission to use them is granted under the terms of the GNU GPLv2.
*/
package org.codalang.codaserver.database;
import java.sql.*;
import java.util.Vector;
/**
*
* @author michaelarace
*/
public class JDBCMetadata implements CodaDatabaseMetadata {
Connection conn;
/** Creates a new instance of JDBCMetadata */
public JDBCMetadata(Connection conn) {
this.conn = conn;
}
public String[] getTables() {
try {
DatabaseMetaData metadata = conn.getMetaData();
ResultSet rs = metadata.getTables(null, "PUBLIC", null, null);
Vector<String> retval = new Vector();
while(rs.next()) {
retval.add(rs.getString("TABLE_NAME").toUpperCase());
}
return retval.toArray(new String[retval.size()]);
} catch (SQLException ex) {
System.out.println(ex.getMessage());
return new String[0];
}
}
public ColumnDefinition[] getColumnsForTable(String tableName) {
try {
Vector<ColumnDefinition> retvalTemp = new Vector<ColumnDefinition>();
DatabaseMetaData metadata = conn.getMetaData();
ResultSet rs = metadata.getColumns(null, null, tableName.toUpperCase(), null);
while(rs.next()) {
retvalTemp.add(new ColumnDefinition(rs.getString("COLUMN_NAME").toUpperCase(), rs.getInt("DATA_TYPE"), (rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable)));
}
return retvalTemp.toArray(new ColumnDefinition[retvalTemp.size()]);
} catch (SQLException ex) {
return new ColumnDefinition[0];
}
}
public boolean isTable(String tableName) {
try {
String [] retval = new String[0];
DatabaseMetaData metadata = conn.getMetaData();
ResultSet rs = metadata.getTables(null, null, tableName.toUpperCase(), null);
if (rs.next()) {
return true;
} else {
return false;
}
} catch (SQLException ex) {
return false;
}
}
public boolean isColumn(String tableName, String columnName) {
try {
String [] retval = new String[0];
DatabaseMetaData metadata = conn.getMetaData();
ResultSet rs = metadata.getColumns(null, null, tableName.toUpperCase(), columnName.toUpperCase());
if (rs.next()) {
return true;
} else {
return false;
}
} catch (SQLException ex) {
return false;
}
}
public boolean isColumnDefinition(String tableName, ColumnDefinition definition) {
try {
String [] retval = new String[0];
DatabaseMetaData metadata = conn.getMetaData();
ResultSet rs = metadata.getColumns(null, null, tableName.toUpperCase(), definition.getName().toUpperCase());
if (rs.next()) {
if (definition.getName().toUpperCase().equals(rs.getString("COLUMN_NAME").toUpperCase()) && definition.getSqlType() == rs.getInt("COLUMN_TYPE") && definition.getNullable() == (rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable)) {
return true;
} else {
return false;
}
} else {
return false;
}
} catch (SQLException ex) {
return false;
}
}
public boolean doTablesExist(CodaTable[] tables) {
boolean retval = true;
for (int i = 0; i < tables.length; i++) {
if (retval) {
ColumnDefinition[] tempColumnDefinitions = tables[i].getColumnDefinitions();
for (int j = 0; j < tempColumnDefinitions.length; j++) {
if (retval) {
if (!isColumnDefinition(tables[i].getTableName(), tempColumnDefinitions[j])) {
retval = false;
}
}
}
}
}
return retval;
}
public CodaSystemTable getSystemTable() {
try {
boolean codaServerFlag = false;
long revisionId = 0, refTableRevisionId = 0;
String applicationName = "", prefixString = "";
float codaFormatVersion = 1;
Statement sql = conn.createStatement();
ResultSet rs = sql.executeQuery("select system_property, system_value from coda_system_information");
while(rs.next()) {
if (rs.getString(1).toUpperCase().equals("REVISION_ID")) {
revisionId = rs.getLong(2);
} else if (rs.getString(1).toUpperCase().equals("REF_TABLE_REVISION_ID")) {
refTableRevisionId = rs.getLong(2);
} else if (rs.getString(1).toUpperCase().equals("APPLICATION_NAME")) {
applicationName = rs.getString(2);
} else if (rs.getString(1).toUpperCase().equals("PREFIX")) {
prefixString = rs.getString(2);
} else if (rs.getString(1).toUpperCase().equals("FORMAT_VERSION")) {
codaFormatVersion = rs.getFloat(2);
} else if (rs.getString(1).toUpperCase().equals("CODA_SERVER")) {
codaServerFlag = rs.getString(2).toUpperCase().equals("TRUE");
}
}
return new CodaSystemTable(codaServerFlag, revisionId, refTableRevisionId, applicationName, prefixString, codaFormatVersion);
} catch (Exception e) {
return null;
}
}
public int getMaxTableNameLength() {
try {
return conn.getMetaData().getMaxTableNameLength();
} catch (SQLException ex) {
return 30;
}
}
public int getMaxColumnNameLength() {
try {
return conn.getMetaData().getMaxColumnNameLength();
} catch (SQLException ex) {
return 30;
}
}
public int getMaxSchemaNameLength() {
try {
return conn.getMetaData().getMaxSchemaNameLength();
} catch (SQLException ex) {
return 30;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d7186508b0443a3496b36ea4ea1a2a2dd08792ad | c5b360cad01ba71d04ffcb49dbae491b15c420d5 | /src/Document.java | c3c5e962da801737ead62f2106a83a5cf42784e6 | [] | no_license | MarcoZaror/reader_app | e2ed324e9b439f4bf9a6dcced6ae53b995d0156e | 93ba6594c6f0d0c846a8a9982a8374746db0fa4b | refs/heads/master | 2022-11-08T04:56:05.974170 | 2020-06-26T13:19:08 | 2020-06-26T13:19:08 | 275,158,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,624 | java | /**
* Document.java
*
* Document parent class representing all three types of documents.
* Provides methods to obtain stats of the document, to count its words and to acces its instance fields.
*
* @version 1.1 December 2019
*
*/
import java.util.*;
public class Document {
// Declare instance fields
private String doc_type;
private String title;
private String author;
private ArrayList<String> body;
//Two constructors to allow creation of a Document object without arguments (to be filled later)
public Document(){
this.doc_type = "default";
this.title = "default";
this.author = "default";
this.body = new ArrayList<String>();
}
public Document( String d, String t, String a, ArrayList<String> b){
this.doc_type = d;
this.title = t;
this.author = a;
this.body = b;
}
// Method to provide stats of the document, will be override by each subclass adding its particular information
public ArrayList<String> getStats(){
ArrayList<String> stats = new ArrayList<String>();
stats.add("Document Type: " + this.doc_type);
stats.add("Title: " + this.title);
stats.add("Author: " + this.author);
return stats;
}
// Method to obtain info about words (count and frequency)
public ArrayList<String> getWordsInfo(){
List<String> words = new LinkedList<String>();
String wd;
StringTokenizer st;
// Split sentences into tokens, add to LinkedList and sorted
for (String line : body){
// Only the space and punctuation signs were defined as a separators
st = new StringTokenizer(line," .,:?;[]()");
while (st.hasMoreTokens()) {
wd = st.nextToken();
words.add(wd);
}
}
Collections.sort(words, String.CASE_INSENSITIVE_ORDER);
//Create a HashMap to store pairs <word, count>
HashMap<String, Integer> pair = new HashMap<String, Integer>();
// Count words and store it in the HashMap
String previous = null;
String current;
int counter = 0;
Iterator<String> i1 = words.iterator();
while (i1.hasNext()) {
current = i1.next();
if (current.equalsIgnoreCase(previous)) {
counter +=1;
} else {
if (previous != null) {
pair.put(previous,counter);
}
previous = current;
counter = 1;
}
}
// Create a TreeMap with a pre-defined comparator to compare words by its count
Comparator<String> comparator = new CompareCounts(pair);
TreeMap<String, Integer> pairs = new TreeMap<String, Integer>(comparator);
pairs.putAll(pair);
// Store 10 most frequent words with its values in an ArrayList
ArrayList<String> wds = new ArrayList<String>();
wds.addAll(pairs.keySet());
ArrayList<Integer> val = new ArrayList<Integer>();
val.addAll(pairs.values());
// Obtain number of total words in the document
int wordsTotal = 1; //Start with 1 to add the count of the initial word 'Text:', because it is not in the body
for (int values: val){
wordsTotal += values;
}
// Put all the information in an ArrayList
ArrayList<String> wordCount = new ArrayList<String>();
String wordsTotal_str = String.valueOf(wordsTotal);
wordCount.add("Total number of words in document: " + wordsTotal_str);
wordCount.add("\n");
wordCount.add("10 most frequent words");
for (int a = 0; a < 11; a++){
String v = String.valueOf(val.get(a));
wordCount.add("Word: " +"'" +wds.get(a)+"'" + ", freq: " + v);
}
return wordCount;
}
// Create accessing methods
public String getDocType(){ return doc_type;}
public String getTitle() { return title; }
public String getAuthor() { return author; }
public ArrayList<String> getBody(){return body;}
}
| [
"mazarorpolenta1@sheffield.ac.uk"
] | mazarorpolenta1@sheffield.ac.uk |
2057f69af727449f22d6c63e5d435888e5189808 | b73dd534ef88d92e55466cf43f06ca67d1621544 | /JAVA I - Grundlagen der Programmierung/Quellcode zu den Folien/com/leycarno/javacourse/java_05_collections/Arrays.java | 4620c41178fce7c44c9c2fe8854f471509f81312 | [] | no_license | Leycarno/javacourse | d24356ca3a638ff0b91ac4c92a6569c77c2f37d8 | 4bec279d9517bde75d2f8d092f4dc962471d32c1 | refs/heads/master | 2021-01-17T22:31:17.853167 | 2017-05-16T14:24:36 | 2017-05-16T14:24:36 | 84,198,073 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,016 | java | package com.leycarno.javacourse.java_05_collections;
public class Arrays {
public void run() {
this.integerArrayDemo();
this.integerArrayResizeDemo();
this.carArrayDemo();
this.useArraysClass();
}
/** ************************************************************
* simple demo of an array
*/
private void integerArrayDemo() {
int[] integerArray;
integerArray = new int[3]; // create a int-array with 3 positions
System.out.println("\nInteger Array @Start: " + this.integerArrayToString(integerArray));
integerArray[0] = 7; // set the first position with the value of 7
integerArray[2] = 13; // set the last position with the value of 13
int seven = integerArray[0]; // get the value of the first position
int last = integerArray[2]; // get the value of the last position
System.out.println("Integer Array @End: " + this.integerArrayToString(integerArray));
}
/** ************************************************************
* simple demo to resize an array
*/
private void integerArrayResizeDemo() {
int[] integerArray = { 1, 6, 8 }; // init the array with values (auto-size to 3)
System.out.println("\nInteger RESIZE Array @Start: " + this.integerArrayToString(integerArray));
// you cannot resize an array - you have to create another and copy the values:
int[] biggerIntegerArray = new int[4];
for (int i = 0; i <integerArray.length; i++) {
biggerIntegerArray[i] = integerArray[i];
}
biggerIntegerArray[3] = 4;
integerArray = biggerIntegerArray; // at least you can override the original array
System.out.println("Integer RESIZE Array @End: " + this.integerArrayToString(integerArray));
}
/** ************************************************************
* simple demo for an array with objects
*/
private void carArrayDemo() {
Car[] carArray = new Car[2]; // definition of an array of (car) objects
// these cars are just defined - for now the objects are all NULL!
System.out.println("\nCar Array @Start: " + this.carArrayToString(carArray));
Car golf = new Car(); // you can create an object as usual...
golf.setType("Golf");
golf.setFuelMax(63);
golf.setFuel(3);
carArray[0] = golf; // .. and add the object to an array later
carArray[1] = new Car(); // you can also create an new object INTO the array
carArray[1].setType("Opel"); // and always you can manipulate the attributes like this
carArray[1].setFuelMax(45); // ...
carArray[1].setFuel(7);
System.out.println("\nCar Array @End: " + this.carArrayToString(carArray));
}
/** ************************************************************
* simple demo of the use of the "Arrays"-class
*/
private void useArraysClass() {
int[] integerArray = { 5, 9, 3, 1, 8 }; // init the array with values (auto-size to 3)
System.out.println("\nInteger Array USE ARRAYS @Start: " + this.integerArrayToString(integerArray));
java.util.Arrays.sort(integerArray); // sort by value
System.out.println("Integer Array USE ARRAYS @sort: " + this.integerArrayToString(integerArray));
java.util.Arrays.fill(integerArray, 7); // set every value on 7
System.out.println("Integer Array USE ARRAYS @fill: " + this.integerArrayToString(integerArray));
int[] smallerArray = java.util.Arrays.copyOf(integerArray, 3); // resize to a smaller array (NOT change the original)
System.out.println("Integer Array USE ARRAYS @copyOf: " + this.integerArrayToString(smallerArray));
boolean equal= java.util.Arrays.equals(integerArray, smallerArray); // compare the original with the copy
System.out.println("Integer Array USE ARRAYS @equals: "
+ this.integerArrayToString(integerArray)
+ " == "
+ this.integerArrayToString(smallerArray)
+ " ? " + equal);
}
/* ==================================================================================================== */
/**
* helper-method for a nice display of integer arrays
* @param integerArray
* @return String
*/
private String integerArrayToString(int[] integerArray) {
String result = "";
for (int value : integerArray) {
result += "[" + value + "]";
}
return result;
}
/**
* helper-method for a nice display of car arrays
* @param carArray
* @return
*/
private String carArrayToString(Car[] carArray) {
String result = "";
for (Car car : carArray) {
result += "\n[" + car + "]"; // There is a special "toString()" method in the car class!
}
return result;
}
}
| [
"leycarno.com@gmail.com"
] | leycarno.com@gmail.com |
7d46fb991360bbd5c0f3d7f32be321c164e03b0f | 218b6afdf7d69b9285a45bc42d0f24c1df7979ea | /src/main/java/com/briup/sb/web/controller/ResponseController.java | 65d3a8b643e29239006511efaf5a75f1f6a3afe9 | [] | no_license | XT594684736/firstday | 67f47c8163d0a0da8bbb8b470f6670a65a3adab5 | 46a491bfb9014cd8268acc9b4629a8517d86a0a0 | refs/heads/master | 2020-11-28T18:07:53.337897 | 2019-12-24T06:58:40 | 2019-12-24T06:58:40 | 229,888,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package com.briup.sb.web.controller;
import com.briup.sb.bean.Message;
import com.briup.sb.bean.Person;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class ResponseController {
@GetMapping("/test1")
public Map<String,String> test1() {
Map<String , String> map = new HashMap<>();
map.put("name","lisi");
map.put("desc","very nice");
return map;
}
@GetMapping("/test2")
public List<Map<String,String>> test2() {
Map<String,String> map = new HashMap<>();
Map<String,String> map1 = new HashMap<>();
map.put("name","mazd");
map1.put("name","ztt");
List<Map<String,String>> list = new ArrayList<>();
list.add(map);
list.add(map1);
return list;
}
@GetMapping("/test3")
public Message test3() {
Message message = new Message();
message.setCode(22);
message.setStatus("xiaoql");
return message;
}
@GetMapping("/test4")
public String test4(String name,int age,String desc,String nice) {
System.out.println("name:" + name);
System.out.println("age:" + age);
return "我也想不出什么话了";
}
@GetMapping("/test5")
public String test5(Person person) {
System.out.println(person);
return "那就这样吧";
}
}
| [
"594684736@qq.com"
] | 594684736@qq.com |
aa25336a2c004cc2e7a0808161ed4fd264306f9f | b0877c20057369667effd49122099ea99fe0d6f5 | /StringProcessing_V.java | 1ce721769adf01f3f21a8280dad7779593393841 | [] | no_license | karthikeyanr97/Programs | 15632b2587403d42645d5247593d787cdf8df14b | 9383c40447cbd295af3be509c29793ea60b3273d | refs/heads/main | 2023-04-13T01:47:49.157832 | 2021-04-23T14:14:01 | 2021-04-23T14:14:01 | 348,395,834 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | import java.util.Scanner;
public class StringProcessing_V extends UserMainCode {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the string:");
String string = scanner.nextLine();
System.out.println("Enter the number:");
int number = scanner.nextInt();
String result = returnLastRepeatedCharacters(string, number);
System.out.println(result);
scanner.close();
}
}
class UserMainCode {
public static String returnLastRepeatedCharacters(String string, int number) {
String result = "";
for (int i = 0; i < number; i++) {
result += string.substring(string.length() - number, string.length());
}
return result;
}
} | [
"noreply@github.com"
] | karthikeyanr97.noreply@github.com |
246600923bbe289c9304c3f6a495b2fc9afbde5d | b7397158f531848da076278b7bb7a8b48e10c6e5 | /chapter01_Maven/src/sample03/HelloSpring.java | f97cfcf0c32c0586505fd29bed33f262ffa95795 | [] | no_license | hyunEuiAhn/workspace | 926997374bd3de2119e8411ab92aad7763646651 | 3ada720b888e3847172c619d4bc4d6935f969566 | refs/heads/master | 2022-12-09T09:58:00.239197 | 2020-08-19T13:04:16 | 2020-08-19T13:04:16 | 288,733,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package sample03;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class HelloSpring {
public static void main(String[] args) {
// ApplicationContext context = new FileSystemXmlApplicationContext("src/applicationConte //src 안에 xml 파일을 읽어와라
ApplicationContext context =
new ClassPathXmlApplicationContext("applicationContext.xml");
MessageBean bean = (MessageBean)context.getBean("messageBean"); //getBean이 object 형으로 가져오기 때문에 형변환이 필요하다.
bean.sayHello("Spring");
System.out.println();
MessageBean bean2 = context.getBean("messageBean", MessageBean.class);
bean2.sayHello("Spring");
System.out.println();
MessageBean bean3 = (MessageBean)context.getBean("messageBean"); //getBean이 object 형으로 가져오기 때문에 형변환이 필요하다.
bean3.sayHello("Spring");
System.out.println();
//((AbstractApplicationContext) context).close();
((ConfigurableApplicationContext)context).close(); //warning이 발생했을 때 close()로 닫아주면 없어진다.
}
}
//xml에 생성한 클래스를 새롭게 new로 생성하는 게 아니라 싱글톤으로한 번만 생성을 한다.
//new로 새롭게 생성을 하려면 xml에 scope="prototype"를 추가하면 됨. | [
"heahn153@gmail.com"
] | heahn153@gmail.com |
32b1627ea5bc7ff7ad226fa2f55ea7a364438af0 | 5c4974942b58342fd85cd3d8b2e17741e6f31abe | /xiyan-parent/cms-service/src/main/java/com/xiyan/vo/UserVO.java | 61893f4869d289b582ea6c859781fc7fb7b9da50 | [
"Apache-2.0"
] | permissive | BestJex/xiyan-blog | 6ea0cacb8b15fd8e35cebd5886d957e64fae7570 | 84a0cb9e0e7c91755c508a1209e375f32a195326 | refs/heads/master | 2023-02-07T14:48:17.180073 | 2020-12-31T06:39:03 | 2020-12-31T06:39:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.xiyan.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author: bright
* @date:Created in 2020/11/8 14:33
* @describe :
*/
@Data
public class UserVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "头像")
private String photo;
@ApiModelProperty(value = "金币")
private Integer point;
@ApiModelProperty(value = "状态")
private Integer state;
@ApiModelProperty(value = "粉丝数")
private Integer attentionCount;
@ApiModelProperty(value = "发布数")
private Integer codeCount;
}
| [
"694475668@qq.com"
] | 694475668@qq.com |
59cfebf8135b0537e33893d89c844fa32aa04511 | 4492154a3acc13860c653c98ee9d49d31bb55bac | /src/main/java/Monsters/Monster.java | 9bb34556f5350418d22c690e1323ad00a659d9d7 | [] | no_license | DavidDuveau/projetRpg | 42d0bae584423b4dbba7467bbef3556819ec602f | 9f7f43e600b96368a8c015711a8816969033e9c5 | refs/heads/master | 2021-07-18T11:54:00.899400 | 2019-11-08T19:58:27 | 2019-11-08T19:58:27 | 220,489,066 | 0 | 0 | null | 2020-10-13T17:19:21 | 2019-11-08T14:57:55 | Java | UTF-8 | Java | false | false | 1,052 | java | package Monsters;
public class Monster {
private int health_pt;
private int level = 1;
private int strengh;
private int agility;
private int intelligence;
public Monster() {
}
public Monster(int health_pt, int level, int strengh, int agility, int intelligence) {
super();
this.health_pt = health_pt;
this.level = level;
this.strengh = strengh;
this.agility = agility;
this.intelligence = intelligence;
}
public int gethealth_pt() {
return health_pt;
}
public void sethealth_pt(int health_pt) {
this.health_pt = health_pt;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getStrengh() {
return strengh;
}
public void setStrengh(int strengh) {
this.strengh = strengh;
}
public int getAgility() {
return agility;
}
public void setAgility(int agility) {
this.agility = agility;
}
public int getIntelligence() {
return intelligence;
}
public void setIntelligence(int intelligence) {
this.intelligence = intelligence;
}
}
| [
"david.duveau@hotmail.fr"
] | david.duveau@hotmail.fr |
7d6b52341374d5f9cac3018b750e80a7bdb1a191 | 8fdb5d05bbab81f7742cb8fe2d7b23fa129b1e49 | /springcloud-service-api/src/main/java/com/jk/model/UserBean.java | b5d1051f8776c79223795750831ea9259a96f3f8 | [] | no_license | 1441022584/springcloud_mfw | 533261c667a9cdadf20b990f3b91f5c89fea7e12 | 2615509877554a6d8afb56ac8239d4c8e95a4860 | refs/heads/master | 2020-04-18T11:50:27.662015 | 2019-01-27T05:46:55 | 2019-01-27T05:46:55 | 167,508,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,337 | java | package com.jk.model;
import java.io.Serializable;
public class UserBean implements Serializable {
private Integer id; //主键id
private String name; //用户名称
private String userImg; //头像
private Integer sex; //性别 (1 男 , 2女)
private String userSignature; //签名
private Integer userFans; //我的粉丝
private String userCity; //所在地区
private Integer wendaId; // 我的问答 关联表 t_user_wenda
private Integer traveId; // 我的游记 关联表 t_user_trave // 准备去哪
private Integer remarkId; //我的点评 关联表 t_user_remark
private Integer collectId; //我的收藏 // 关联地区表 用户表
private Integer indentId; //我的订单 关联表 t_user_Indent
private Integer footprintId; //我的足迹 关联表 t_user_footprint // 去过哪
private Integer userAttention; //我的关注
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getUserImg() {
return userImg;
}
public void setUserImg(String userImg) {
this.userImg = userImg == null ? null : userImg.trim();
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getUserSignature() {
return userSignature;
}
public void setUserSignature(String userSignature) {
this.userSignature = userSignature == null ? null : userSignature.trim();
}
public Integer getUserFans() {
return userFans;
}
public void setUserFans(Integer userFans) {
this.userFans = userFans;
}
public String getUserCity() {
return userCity;
}
public void setUserCity(String userCity) {
this.userCity = userCity == null ? null : userCity.trim();
}
public Integer getWendaId() {
return wendaId;
}
public void setWendaId(Integer wendaId) {
this.wendaId = wendaId;
}
public Integer getTraveId() {
return traveId;
}
public void setTraveId(Integer traveId) {
this.traveId = traveId;
}
public Integer getRemarkId() {
return remarkId;
}
public void setRemarkId(Integer remarkId) {
this.remarkId = remarkId;
}
public Integer getCollectId() {
return collectId;
}
public void setCollectId(Integer collectId) {
this.collectId = collectId;
}
public Integer getIndentId() {
return indentId;
}
public void setIndentId(Integer indentId) {
this.indentId = indentId;
}
public Integer getFootprintId() {
return footprintId;
}
public void setFootprintId(Integer footprintId) {
this.footprintId = footprintId;
}
public Integer getUserAttention() {
return userAttention;
}
public void setUserAttention(Integer userAttention) {
this.userAttention = userAttention;
}
} | [
"1441022584@qq.com"
] | 1441022584@qq.com |
71e979362b22187997e8195a9dd5513dd8fae195 | 84874504beb75cf9ca6fe022b5fbc9873477ba81 | /app/src/main/java/com/example/mp2projectmadraman/Plants.java | 3d2eb533a0fee0b2677f01dae0c104156f3ff623 | [] | no_license | ramandeepsuri/MP2projectsMADraman | eaa674afef2ccaf827b7fc70650e5d72c9565999 | 53309d7662253e2e19962bd1c3a65eb6c75114d0 | refs/heads/master | 2023-08-22T12:19:02.561823 | 2021-10-12T07:10:43 | 2021-10-12T07:10:43 | 416,172,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.example.mp2projectmadraman;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class Plants {
@SerializedName("Plants")
@Expose
private List<Plants_> plants = null;
public List<Plants_> getPlants() {
return plants;
}
public void setPlants(List<Plants_> plants) {
this.plants = plants;
}
}
| [
"Kunalskw143@gmail.com"
] | Kunalskw143@gmail.com |
808fc65873d9b3b3537bb815f6e5514d77cf767c | 6a89a3211fc2023ea08d16c08896a48ce1f19b16 | /base/src/main/java/com/spldeolin/allison1875/base/exception/ConfigInvalidException.java | 68f87f23f1896c5b0a534a6b2215a73d97d79497 | [] | no_license | leeshinx/allison-1875 | 78e74c4a4058556ce1065857cf285e5cae39da0f | a317ec9a97bb96de17717bc8ee7b05ffb0f01882 | refs/heads/master | 2022-12-18T08:23:33.782751 | 2020-09-17T14:09:42 | 2020-09-17T14:09:42 | 294,668,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.spldeolin.allison1875.base.exception;
/**
* @author Deolin 2020-08-21
*/
public class ConfigInvalidException extends RuntimeException {
private static final long serialVersionUID = 747426296944731969L;
} | [
"lix6406@joyowo.com"
] | lix6406@joyowo.com |
4234497a476fb71ea1f2c11bc850ec68f2adae70 | bf0a24f50c0026629fe0cd462dceecb145dcd606 | /beauty/src/main/java/com/cntend/beauty/controller/user/PlanController.java | 7c210bacc315ca3c7fa567489e1ef6d6ab839798 | [] | no_license | moncat/mpackage | d21af9c1a208b3847cfae482408f6ebbdf28088b | 4347f18cb7a8317be7461c493167594f529120d5 | refs/heads/master | 2022-12-10T09:59:21.590725 | 2020-03-09T01:15:00 | 2020-03-09T01:15:00 | 94,493,254 | 3 | 2 | null | 2022-12-06T00:40:56 | 2017-06-16T01:35:25 | Roff | UTF-8 | Java | false | false | 5,661 | java | package com.cntend.beauty.controller.user;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.co.example.constant.HttpStatusCode;
import com.co.example.entity.question.TBrQuestionPlan;
import com.co.example.entity.user.TBrUserPlan;
import com.co.example.entity.user.TBrUserPlanItem;
import com.co.example.entity.user.aide.TBrUserPlanItemQuery;
import com.co.example.service.question.TBrQuestionPlanService;
import com.co.example.service.user.TBrUserPlanItemService;
import com.co.example.service.user.TBrUserPlanService;
import com.co.example.utils.SessionUtil;
import com.google.common.collect.Maps;
@Controller
@RequestMapping("plan")
public class PlanController {
@Autowired
TBrUserPlanService tBrUserPlanService;
@Autowired
TBrQuestionPlanService tBrQuestionPlanService;
@Autowired
TBrUserPlanItemService tBrUserPlanItemService;
@RequestMapping(value="init",method = { RequestMethod.GET})
public String plan(Model model, HttpSession session) {
Long userId = SessionUtil.getUserId(session);
TBrUserPlan tBrUserPlan = tBrUserPlanService.getUserPlan(userId);
//从未测试,需要跳转到测试
if(tBrUserPlan == null){
return "question/init";
}
TBrUserPlanItemQuery tBrUserPlanItemQuery = new TBrUserPlanItemQuery();
tBrUserPlanItemQuery.setUserPlanId(tBrUserPlan.getId());
List<TBrUserPlanItem> planItem = tBrUserPlanItemService.queryList(tBrUserPlanItemQuery);
model.addAttribute("planItem", planItem);
return "plan/init";
}
@ResponseBody
@RequestMapping(value="flag",method = { RequestMethod.POST})
public Map<String, Object> flag(Model model, HttpSession session) {
Map<String, Object> map = Maps.newHashMap();
//获得用户计划
Long userId = SessionUtil.getUserId(session);
TBrUserPlan tBrUserPlan = tBrUserPlanService.getUserPlan(userId);
if(tBrUserPlan == null){
map.put("code", HttpStatusCode.CODE_ERROR);
map.put("desc", "请先进行肤质测试");
return map;
}else{
map.put("code", HttpStatusCode.CODE_SUCCESS);
}
return map;
}
@ResponseBody
@RequestMapping(value="index",method = { RequestMethod.POST})
public Map<String, Object> indexPlan(Model model, HttpSession session) {
Map<String, Object> map = Maps.newHashMap();
map.put("code", HttpStatusCode.CODE_ERROR);
//获得用户计划
Long userId = SessionUtil.getUserId(session);
TBrUserPlan tBrUserPlan = tBrUserPlanService.getUserPlan(userId);
if(tBrUserPlan == null){
return map;
}
//获得用户计划类目
TBrUserPlanItemQuery tBrUserPlanItemQuery = new TBrUserPlanItemQuery();
tBrUserPlanItemQuery.setUserPlanId(tBrUserPlan.getId());
List<TBrUserPlanItem> planItem = tBrUserPlanItemService.queryList(tBrUserPlanItemQuery);
if(4 == planItem.size()){
map.put("code", HttpStatusCode.CODE_SUCCESS);
//组合首页描述信息
String desc ="";
String flags ="";
String typeNames ="";
for (TBrUserPlanItem tBrUserPlanItem : planItem) {
flags += tBrUserPlanItem.getFlag().toUpperCase();
typeNames += tBrUserPlanItem.getTypeName()+".";
}
desc=flags+"("+typeNames+")";
map.put("desc", desc);
}
return map;
}
@RequestMapping(value="detail",method = { RequestMethod.GET})
public String detail(Model model, HttpSession session) {
Long userId = SessionUtil.getUserId(session);
TBrUserPlan tBrUserPlan = tBrUserPlanService.getUserPlan(userId);
TBrQuestionPlan plan = tBrQuestionPlanService.queryById(tBrUserPlan.getPlanId());
//本次测试方案
TBrUserPlanItemQuery tBrUserPlanItemQuery = new TBrUserPlanItemQuery();
tBrUserPlanItemQuery.setUserPlanId(tBrUserPlan.getId());
List<TBrUserPlanItem> planItem = tBrUserPlanItemService.queryList(tBrUserPlanItemQuery);
model.addAttribute("plan", plan);
model.addAttribute("planItem", planItem);
return "plan/detail";
}
@ResponseBody
@RequestMapping(value="chart",method = { RequestMethod.POST})
public Map<String, Object> chart(Model model, HttpSession session) {
Map<String, Object> map = Maps.newHashMap();
Long userId = SessionUtil.getUserId(session);
TBrUserPlan tBrUserPlan = tBrUserPlanService.getUserPlan(userId);
TBrUserPlan lastUserPlan = tBrUserPlanService.getLastUserPlan(userId);
TBrUserPlanItemQuery tBrUserPlanItemQuery = new TBrUserPlanItemQuery();
Float element = 0f;
List<Float> arrayNow = Lists.newArrayList();
List<Float> arrayOld = Lists.newArrayList();
//本次测试方案
tBrUserPlanItemQuery.setUserPlanId(tBrUserPlan.getId());
List<TBrUserPlanItem> planItem = tBrUserPlanItemService.queryList(tBrUserPlanItemQuery);
for (TBrUserPlanItem tBrUserPlanItem : planItem) {
element = tBrUserPlanItem.getGradeCount();
arrayNow.add(element);
}
//上次测试方案
tBrUserPlanItemQuery.setUserPlanId(lastUserPlan.getId());
List<TBrUserPlanItem> lastPlanItem = tBrUserPlanItemService.queryList(tBrUserPlanItemQuery);
for (TBrUserPlanItem tBrUserPlanItem2 : lastPlanItem) {
element = tBrUserPlanItem2.getGradeCount();
arrayOld.add(element);
}
map.put("now", arrayNow);
map.put("old", arrayOld);
return map;
}
}
| [
"moncat@126.com"
] | moncat@126.com |
41338c82396ee0fee1f56d23ccefb55fa99abaf0 | cdd3273f4dff2285959cb4109ac8b13341099bc6 | /game/src/main/java/com/leader/game/util/ExcelUtils.java | c8ebae30ddfd587a558de6bf2e87156fa6352e5b | [] | no_license | Whale-Island/leader | 2b5d14f5e895791be9f30d6264110ec5defb52d4 | b9532891466adb0b8ef36f8f1d97a93aeb411f78 | refs/heads/master | 2021-05-11T10:50:06.572027 | 2018-10-17T01:33:37 | 2018-10-17T01:33:37 | 118,114,281 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,715 | java | package com.leader.game.util;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.leader.game.data.Element;
import com.leader.game.data.Scope;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import lombok.extern.log4j.Log4j;
@Log4j
public class ExcelUtils {
public static <T> List<T> load(Class<T> t, String path)
throws BiffException, IOException, InstantiationException, IllegalAccessException, NoSuchFieldException,
SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
List<T> list = new ArrayList<T>();
Workbook rwb = null;
Cell cell = null;
T data = null;
// 创建输入流
InputStream stream = new FileInputStream(path);
// 获取Excel文件对象
rwb = Workbook.getWorkbook(stream);
// 获取文件的指定工作表 默认的第一个
Sheet sheet = rwb.getSheet(0);
// 获取表头
Cell[] handers = sheet.getRow(1);
Map<String, Integer> map = new HashMap<>();
for (Cell hander : handers) {
map.put(hander.getContents(), hander.getColumn());
}
// 行数(表头的目录不需要,从2开始)
for (int i = 2; i < sheet.getRows(); i++) {
data = t.newInstance();
Field[] fs = t.getDeclaredFields();
for (Field field : fs) {
if (!map.containsKey(field.getName())) {
log.error("表格未找到对象属性:" + t.getName() + "-->" + field.getName());
throw new NullPointerException();
}
int column = map.get(field.getName());
cell = sheet.getCell(column, i);
// 该单元格是否禁用
if (cell.getContents().toLowerCase().equals("null"))
continue;
field.setAccessible(true);
Object value = null;
// 必须是实现类
if (field.getType().isAssignableFrom(HashMap.class)) {
String[] strs = cell.getContents().split("\\|");
Element e = field.getAnnotation(Element.class);
Class<?>[] generics = e.generic();
if (generics.length != 2)
log.error(field.getName() + "缺少泛型注释!");
value = field.getType().newInstance();
Method m = field.getType().getMethod("put", Object.class, Object.class);
for (int j = 0; j < strs.length; j++) {
String[] kv = strs[j].split(":");
Object k = transform(kv[0], generics[0]);
Object v = transform(kv[1], generics[1]);
m.invoke(value, k, v);
}
} else
value = transform(cell.getContents(), field.getType());
// 赋值
field.set(data, value);
}
// 把刚获取的列存入list
list.add(data);
}
return list;
}
/** 其他通用的赋值转换 */
private static Object transform(String str, Class<?> c) {
Object o = null;
if (c.getName().equals("java.lang.String")) {
o = str;
} else if (c.getName().equals("int") || c.isAssignableFrom(Integer.class)) {
o = Integer.valueOf(str);
} else if (c.getName().equals("[I")) {// 数组
String[] strs = str.split(",");
int[] values = new int[strs.length];
for (int j = 0; j < strs.length; j++) {
values[j] = Integer.valueOf(strs[j]);
}
o = values;
} else if (c.getName().equals("com.leader.game.data.Scope")) {// 范围值
String[] strs = str.split("-");
Scope scope = new Scope();
scope.setMin(Integer.valueOf(strs[0]));
scope.setMax(Integer.valueOf(strs[1]));
o = scope;
}
return o;
}
}
| [
"1109968833@qq.com"
] | 1109968833@qq.com |
360022ebe514c061c71983ce66663879a1aec8ea | 77904c75de32939b97a00b10691bfb5fc6c49c72 | /Backend/src/main/java/com/unep/wcmc/biodiversity/model/ForgetPasswordToken.java | 9670ab25b7652a4747891e5063bcd8e6d19d6435 | [] | no_license | unepwcmc/Biodiversity-Collections | 1367b7a67721f516f8c11b941dd786f27f65a195 | 74d552f57f46abdf3d7d4f0591233e2fb406b780 | refs/heads/master | 2020-07-09T03:12:25.060350 | 2016-03-23T15:28:54 | 2016-03-23T15:28:54 | 45,797,599 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,769 | java | package com.unep.wcmc.biodiversity.model;
import com.unep.wcmc.biodiversity.support.BaseEntity;
import javax.persistence.*;
import java.util.Calendar;
import java.util.Date;
@Entity
public class ForgetPasswordToken implements BaseEntity {
private static final int TIMEOUT = 60 * 24; // one day
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column
private String token;
@Column
private Date expiryDate;
@Column
private String urlCallback;
@OneToOne(targetEntity = User.class, fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name = "userId")
private User user;
public ForgetPasswordToken() {
}
public ForgetPasswordToken(String token, String urlCallback, User user) {
this.token = token;
this.user = user;
this.urlCallback = urlCallback;
createExpiryDate();
}
@Override
public Long getId() {
return id;
}
public String getToken() {
return token;
}
public Date getExpiryDate() {
return expiryDate;
}
public User getUser() {
return user;
}
@Override
public void setId(Long id) {
this.id = id;
}
public void setToken(String token) {
this.token = token;
}
public void setExpiryDate(Date expiryDate) {
this.expiryDate = expiryDate;
}
public void setUser(User user) {
this.user = user;
}
public String getUrlCallback() {
return urlCallback;
}
public void setUrlCallback(String urlCallback) {
this.urlCallback = urlCallback;
}
private void createExpiryDate() {
final Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(calendar.getTimeInMillis());
calendar.add(Calendar.MINUTE, TIMEOUT);
expiryDate = calendar.getTime();
}
}
| [
"rcandidosilva@gmail.com"
] | rcandidosilva@gmail.com |
69b73b3ebef993657202deee20d193abb2e4cfb1 | a35f22b16d423fd7e310848430e325176edcbcf9 | /src/main/java/edu/internet2/middleware/shibboleth/idp/authn/ShibbolethSSOLoginContext.java | 98b2ca248c393c3db69281286b2f2a93664e9f82 | [
"Apache-2.0"
] | permissive | brainysmith/shibboleth-idp | 83dad2c43eeb624276a03cdb58ab5cea82341e64 | f40788be35a9d9ff66f62e845a749d81052cc441 | refs/heads/master | 2021-01-17T17:07:26.838947 | 2014-09-08T06:59:57 | 2014-09-08T06:59:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,411 | java | /*
* Licensed to the University Corporation for Advanced Internet Development,
* Inc. (UCAID) under one or more contributor license agreements. See the
* NOTICE file distributed with this work for additional information regarding
* copyright ownership. The UCAID licenses this file to You under the Apache
* License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package edu.internet2.middleware.shibboleth.idp.authn;
/** Shibboleth SSO aware extension to {@link LoginContext}. */
public class ShibbolethSSOLoginContext extends LoginContext {
/** Serial version UID. */
private static final long serialVersionUID = -8388394528549536613L;
/** Service provider assertion consumer service URL. */
private String spAssertionConsumerService;
/** Service provider target URL. */
private String spTarget;
/** Constructor. */
public ShibbolethSSOLoginContext() {
super(false, false);
}
/**
* Gets the service provider assertion consumer service URL.
*
* @return service provider assertion consumer service URL
*/
public /*synchronized*/ String getSpAssertionConsumerService() {
return spAssertionConsumerService;
}
/**
* Sets the service provider assertion consumer service URL.
*
* @param url service provider assertion consumer service URL
*/
public /*synchronized*/ void setSpAssertionConsumerService(String url) {
spAssertionConsumerService = url;
changed = true;
}
/**
* Gets the service provider target URL.
*
* @return service provider target URL
*/
public /*synchronized*/ String getSpTarget() {
return spTarget;
}
/**
* Sets the service provider target URL.
*
* @param url service provider target URL
*/
public /*synchronized*/ void setSpTarget(String url) {
spTarget = url;
changed = true;
}
} | [
"tadpoletad@gmail.com"
] | tadpoletad@gmail.com |
fa9aab4f1db696bbe28c5ae5cb608db3d206b9dd | d8498747af7400591d9078e214282411b1b5c8b5 | /topic0/ProxyPattern/src/com/company/IDataBase.java | f2b5aab83fc63c30a286f80b79436278f07852ab | [] | no_license | daveramiel/BootCamp2018 | 7aaef85cf40ec09e53a4cd0dd5a5c7939bd4326a | db75ad7ea211324f60fc348982485c4dcdb0d530 | refs/heads/master | 2020-03-15T14:12:44.175841 | 2018-05-30T16:23:04 | 2018-05-30T16:23:04 | 132,185,628 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package com.company;
public interface IDataBase {
public void Connect();
}
| [
"davidjupg@gmail.com"
] | davidjupg@gmail.com |
d1cec251e1f642e3892c7617d820341ccd515a0d | 20ef0eaaa77093335a0ea254e5e9cf9cffcf4f0c | /jingpeng/001_油厂项目/oilfactory/src/com/oil/interceptor/SessionListener.java | 08782d2dbabb40a2161ae90dbd17fcdadf0251d3 | [] | no_license | elaine140626/jingpeng | 1749830a96352b0c853f148c4808dd67650df8a0 | 2329eb463b4d36bdb4dedf451702b4c73ef87982 | refs/heads/master | 2021-03-15T00:29:17.637034 | 2019-08-15T01:35:49 | 2019-08-15T01:35:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.oil.interceptor;
import javax.servlet.annotation.WebListener;
/**
* session监听
*/
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.oil.model.Userinfo;
import com.oil.service.login.LoginService;
@WebListener
public class SessionListener implements HttpSessionListener {
private LoginService loginService;
@Override
public void sessionCreated(HttpSessionEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void sessionDestroyed(HttpSessionEvent arg0) {
ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(
arg0.getSession().getServletContext());
loginService = applicationContext.getBean(LoginService.class);
// session销毁时清除数据库记录
Userinfo userInfo = (Userinfo)arg0.getSession().getAttribute("user");
if(userInfo!=null) {
int result = loginService.delUserSession(userInfo);
if(result>0) {
arg0.getSession().removeAttribute("user");
}
}
}
}
| [
"474296307@qq.com"
] | 474296307@qq.com |
fc92f18d39fbd7590988c8370730f9583f7ff9c2 | c5a6a7957587c283308cafa6489cb1b9d0523a8a | /src/main/java/org/adrianwalker/startstopcontinue/websocket/EventSocketConfigurator.java | 41240a65df473cd7c6f3d71613487557ee389494 | [] | no_license | adrianwalker/start-stop-continue | bba52425200c7368cb2bb1579fde974ea2928906 | 436fbb21cbf951575873bc4acca4daf0074a5935 | refs/heads/master | 2023-06-22T05:53:14.812250 | 2022-02-25T19:59:03 | 2022-02-25T19:59:03 | 217,923,217 | 2 | 0 | null | 2023-06-13T23:12:22 | 2019-10-27T22:09:43 | Java | UTF-8 | Java | false | false | 575 | java | package org.adrianwalker.startstopcontinue.websocket;
import org.adrianwalker.startstopcontinue.pubsub.EventPubSub;
import javax.websocket.server.ServerEndpointConfig;
public final class EventSocketConfigurator extends ServerEndpointConfig.Configurator {
private final EventPubSub eventPubSub;
public EventSocketConfigurator(final EventPubSub eventPubSub) {
super();
this.eventPubSub = eventPubSub;
}
@Override
public <T> T getEndpointInstance(final Class<T> clazz) throws InstantiationException {
return (T) new EventSocket(eventPubSub);
}
}
| [
"adrian.walker@bcs.org"
] | adrian.walker@bcs.org |
661688c307c44cfdc18140f215306d7a379d6c11 | 8720d43acbe619b3fde75cffc51f0116b7ad8857 | /Board/src/main/java/com/spring/board/model/InterBoardDAO.java | 3a88341883ef176617cd3c75587f7e1911b802f3 | [] | no_license | fine2656/Board | cce19e67b6fed205504a6f9964745be0737a8523 | d5a1323eb49bd53427bdd0496c2d5524472cb4af | refs/heads/master | 2020-04-18T10:34:30.879158 | 2019-02-01T02:07:49 | 2019-02-01T02:07:49 | 167,471,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,687 | java | package com.spring.board.model;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.spring.member.model.MemberVO;
// model단 (DA0)의 인터페이스 선언
@Repository
public interface InterBoardDAO {
//이미지 파일명 가져오기
List<String> getImgfilenameList();
//로그인 여부 알아오기 및 마지막으로 로그인 한 날짜 기록하기(트랜잭션 처리)
MemberVO getLoginMemever(HashMap<String, String> map);
//마지막으로 로그인한 날짜/시간 기록하기
void setLastLoginDate(HashMap<String, String> map);
// 글쓰기(파일 첨부가 없는 글쓰기)
int add(BoardVO boardvo);
// 글쓰기 (첨부 파일이 있는 글쓰기)
int add_withFile(BoardVO boardvo);
// 글 목록보기 가져오기(검색조건이 없는 전체 글목록, 페이징 처리 안함) ====
List<BoardVO> boardListNoSerach();
// 검색어 조건에 해당하는 글 목록 가져오기.(페이징 처리 안함)
List<BoardVO> boardListWithSerach(HashMap<String, String> paraMap);
// 글 상세보기 가져오기
BoardVO getView(String seq);
// 글 조회수(Readcount) 1증가 시키기
void setAddReadCount(String seq);
// 글 수정 및 글 삭제 시 암호 일치여부 알아오기
Boolean checkPW(HashMap<String, String> paraMap);
//
int updateContent(HashMap<String, String> paraMap);
// 글 한개 삭제하기
int deleteContent(HashMap<String, String> paraMap);
// 댓글 추가하기
int addComment(CommentVO commentvo);
// 댓글 쓰기 이후에 댓글의 갯수 (commnetCount 컬럼 1증가 시키키)
int updateCommentCount(String parentSeq);
//원글의 글번호에 대한 댓글 중 페이지 번호에 해당하는 댓글만 조회해 온다.
List<CommentVO> listComment(HashMap<String, String> paraMap);
// 원글 글번호에 해당하는 총갯수 알아오기
int getCommentTotalCount(HashMap<String, String> paraMap);
// 원글에 딸린 댓글이 있는지 없는지 확인하기 ====
int isExistsComment(HashMap<String, String> paraMap);
int delComment(HashMap<String, String> paraMap);
// 검색조건에 만족하는 게시물의 총 갯수 알아오기
int getTotalCountWithSearch(HashMap<String, String> paraMap);
// 검색조건이 없는 게시물의 총 갯수 알아오기
int getTotalCountNoSearch();
// 검색조건이 없는 것 또는 검색조건이 있는 것 목록 가져오기(페이징 처리함)
List<BoardVO> boarListPaging(HashMap<String, String> paraMap);
//getGroupnoMax
int getGroupnoMax();
;
}
| [
"user1@Suwook"
] | user1@Suwook |
8032f24491f08df43e5abb689cd6e034ba37d6b3 | 9521f1c652b06fa0f2c47f3205b0e41dee6e85b3 | /Directory Service - Ripple - Mongo - Sub/src/ds/ripple/mongo/DBoperations.java | 6ee81f8b74df6caf5391fb03e85b3c038eec8a9c | [] | no_license | sanyaade-robotic/Ripple-Cloud | 9153bd44d0a61efc9dc4331c14d49551b9949c66 | 121f99214b8f71f8386d456a5748ed891f6f4375 | refs/heads/master | 2021-01-14T13:47:23.154866 | 2014-08-13T17:56:47 | 2014-08-13T17:56:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,085 | java | package ds.ripple.mongo;
import java.util.Set;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
public final class DBoperations {
private DB db;
private Set<String> collection;
public DBoperations(DB connection){
db=connection;
}
public Set<String> getCollections(){
collection = db.getCollectionNames();
for (String s : collection) {
System.out.println(s);
}
return collection;
}
/**
* retrieves all data from the specified collection
* in connected db
* @param collectionName, key, value
*
* @return BasicDBObject
*
*/
public void retrieveAll(String collectionName){
if(this.checkCollection(collectionName)){
DBCollection col = db.getCollection(collectionName);
//BasicDBObject query = new BasicDBObject();
// query.put("level", "Warning");
DBCursor cursor = col.find();
while (cursor.hasNext()) {
System.out.println(cursor.next());
}
}
}
/**
* retrieves data from the specified collection
* with specified key and value
* in connected db
* @param collectionName, key, value
*
* @return BasicDBObject
*
*/
public BasicDBObject retrieveOne(String collectionName,String key,String value ){
String collection=collectionName, field=key, fieldvalue=value;
DBCollection col = db.getCollection(collection);
BasicDBObject qry = new BasicDBObject();
qry.put(field, fieldvalue);
DBCursor cur=col.find(qry);
if(cur.hasNext()){
qry = (BasicDBObject) cur.next();
return qry;
}
else{
return null;
}
}
/**
* checks for the existence of the mentioned Collection
* name in connected DB.
* @param colName
*
* @return boolean
*
*/
private boolean checkCollection(String colName){
String collection=colName;
for (String s : this.getCollections()) {
System.out.println(s);
// System.out.println(db.getDb().getCollection(s).find());
if(collection.equals(s)){
return true;
}
}
return false;
}
}
| [
"rahulbodduluri@gmail.com"
] | rahulbodduluri@gmail.com |
1bff0ebbbcf6b7bb6e827734e5d5232610116b2f | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /api-vs-impl-small/utils/src/main/java/org/gradle/testutils/performancenull_17/Productionnull_1692.java | 7f85df0de5c8eca4a8686c45b2bf807d0d70c773 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 590 | java | package org.gradle.testutils.performancenull_17;
public class Productionnull_1692 {
private final String property;
public Productionnull_1692(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
72f7508a3a972b2798a727b20a64ee40adfe9dfe | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/25258/src_0.java | ee01e7d1f5d5aacfe9cb8f950a8506611961749a | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 56,845 | java | /*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.accessibility;
import java.util.Vector;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.internal.carbon.*;
/**
* Instances of this class provide a bridge between application
* code and assistive technology clients. Many platforms provide
* default accessible behavior for most widgets, and this class
* allows that default behavior to be overridden. Applications
* can get the default Accessible object for a control by sending
* it <code>getAccessible</code>, and then add an accessible listener
* to override simple items like the name and help string, or they
* can add an accessible control listener to override complex items.
* As a rule of thumb, an application would only want to use the
* accessible control listener to implement accessibility for a
* custom control.
*
* @see Control#getAccessible
* @see AccessibleListener
* @see AccessibleEvent
* @see AccessibleControlListener
* @see AccessibleControlEvent
* @see <a href="http://www.eclipse.org/swt/snippets/#accessibility">Accessibility snippets</a>
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*
* @since 2.0
*/
public class Accessible {
static final String [] requiredAttributes = {
OS.kAXRoleAttribute,
OS.kAXSubroleAttribute,
OS.kAXRoleDescriptionAttribute,
OS.kAXHelpAttribute,
OS.kAXTitleAttribute,
OS.kAXValueAttribute,
OS.kAXEnabledAttribute,
OS.kAXFocusedAttribute,
OS.kAXParentAttribute,
OS.kAXChildrenAttribute,
OS.kAXSelectedChildrenAttribute,
OS.kAXVisibleChildrenAttribute,
OS.kAXWindowAttribute,
OS.kAXTopLevelUIElementAttribute,
OS.kAXPositionAttribute,
OS.kAXSizeAttribute,
OS.kAXDescriptionAttribute,
};
static final String [] textAttributes = {
OS.kAXNumberOfCharactersAttribute,
OS.kAXSelectedTextAttribute,
OS.kAXSelectedTextRangeAttribute,
OS.kAXStringForRangeParameterizedAttribute,
OS.kAXInsertionPointLineNumberAttribute,
OS.kAXRangeForLineParameterizedAttribute,
};
Vector accessibleListeners = new Vector();
Vector accessibleControlListeners = new Vector();
Vector accessibleTextListeners = new Vector ();
Control control;
int axuielementref = 0;
int[] osChildIDCache = new int[0];
Accessible(Control control) {
this.control = control;
axuielementref = OS.AXUIElementCreateWithHIObjectAndIdentifier(control.handle, 0);
OS.HIObjectSetAccessibilityIgnored(control.handle, false);
}
/**
* Invokes platform specific functionality to allocate a new accessible object.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Accessible</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*
* @param control the control to get the accessible object for
* @return the platform specific accessible object
*/
public static Accessible internal_new_Accessible(Control control) {
return new Accessible(control);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when an accessible client asks for certain strings,
* such as name, description, help, or keyboard shortcut. The
* listener is notified by sending it one of the messages defined
* in the <code>AccessibleListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
* is asked for a name, description, help, or keyboard shortcut string
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see AccessibleListener
* @see #removeAccessibleListener
*/
public void addAccessibleListener(AccessibleListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
accessibleListeners.addElement(listener);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when an accessible client asks for custom control
* specific information. The listener is notified by sending it
* one of the messages defined in the <code>AccessibleControlListener</code>
* interface.
*
* @param listener the listener that should be notified when the receiver
* is asked for custom control specific information
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see AccessibleControlListener
* @see #removeAccessibleControlListener
*/
public void addAccessibleControlListener(AccessibleControlListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
accessibleControlListeners.addElement(listener);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when an accessible client asks for custom text control
* specific information. The listener is notified by sending it
* one of the messages defined in the <code>AccessibleTextListener</code>
* interface.
*
* @param listener the listener that should be notified when the receiver
* is asked for custom text control specific information
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see AccessibleTextListener
* @see #removeAccessibleTextListener
*
* @since 3.0
*/
public void addAccessibleTextListener (AccessibleTextListener listener) {
checkWidget ();
if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
accessibleTextListeners.addElement (listener);
}
/**
* Returns the control for this Accessible object.
*
* @return the receiver's control
* @since 3.0
*/
public Control getControl() {
return control;
}
/**
* Invokes platform specific functionality to dispose an accessible object.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Accessible</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*/
public void internal_dispose_Accessible() {
if (axuielementref != 0) {
OS.CFRelease(axuielementref);
axuielementref = 0;
for (int index = 1; index < osChildIDCache.length; index += 2) {
OS.CFRelease(osChildIDCache [index]);
}
osChildIDCache = new int[0];
}
}
/**
* Invokes platform specific functionality to handle a window message.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Accessible</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*/
public int internal_kEventAccessibleGetChildAtPoint (int nextHandler, int theEvent, int userData) {
if (axuielementref != 0) {
OS.CallNextEventHandler (nextHandler, theEvent);
//TODO: check error?
int childID = getChildIDFromEvent(theEvent);
CGPoint pt = new CGPoint ();
OS.GetEventParameter (theEvent, OS.kEventParamMouseLocation, OS.typeHIPoint, null, CGPoint.sizeof, null, pt);
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.x = (int) pt.x;
event.y = (int) pt.y;
event.childID = ACC.CHILDID_SELF;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getChildAtPoint(event);
}
if (event.accessible != null) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {event.accessible.axuielementref});
return OS.noErr;
}
if (event.childID == ACC.CHILDID_SELF || event.childID == ACC.CHILDID_NONE || event.childID == childID) {
/*
* From the Carbon doc for kEventAccessibleGetChildAtPoint: "If there is no child at the given point,
* you should still return noErr, but leave the parameter empty (do not call SetEventParameter)."
*/
return OS.noErr;
}
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {childIDToOs(event.childID)});
return OS.noErr;
}
return OS.eventNotHandledErr;
}
/**
* Invokes platform specific functionality to handle a window message.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Accessible</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*/
public int internal_kEventAccessibleGetFocusedChild (int nextHandler, int theEvent, int userData) {
if (axuielementref != 0) {
int result = OS.CallNextEventHandler (nextHandler, theEvent);
//TODO: check error?
int childID = getChildIDFromEvent(theEvent);
if (childID != ACC.CHILDID_SELF) {
/* From the Carbon doc for kEventAccessibleGetFocusedChild:
* "Only return immediate children; do not return grandchildren of yourself."
*/
return OS.noErr; //TODO: should this return eventNotHandledErr?
}
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = ACC.CHILDID_MULTIPLE; // set to invalid value, to test if the application sets it in getFocus()
event.accessible = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getFocus(event);
}
/* The application can optionally answer an accessible. */
if (event.accessible != null) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {event.accessible.axuielementref});
return OS.noErr;
}
/* Or the application can answer a valid child ID, including CHILDID_SELF and CHILDID_NONE. */
if (event.childID == ACC.CHILDID_SELF) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {0});
return OS.noErr;
}
if (event.childID == ACC.CHILDID_NONE) {
/*
* From the Carbon doc for kEventAccessibleGetFocusedChild: "If there is no child in the
* focus chain, your handler should leave the kEventParamAccessibleChild parameter empty
* and return noErr."
*/
return OS.noErr;
}
if (event.childID != ACC.CHILDID_MULTIPLE) {
/* Other valid childID. */
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {childIDToOs(event.childID)});
return OS.noErr;
}
/* Invalid childID means the application did not implement getFocus, so just go with the default handler. */
return result;
}
return OS.eventNotHandledErr;
}
/**
* Invokes platform specific functionality to handle a window message.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Accessible</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*/
public int internal_kEventAccessibleGetAllAttributeNames (int nextHandler, int theEvent, int userData) {
int code = userData; // userData flags whether nextHandler has already been called
if (axuielementref != 0) {
if (code == OS.eventNotHandledErr) OS.CallNextEventHandler (nextHandler, theEvent);
int [] arrayRef = new int[1];
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeNames, OS.typeCFMutableArrayRef, null, 4, null, arrayRef);
int stringArrayRef = arrayRef[0];
int length = OS.CFArrayGetCount(stringArrayRef);
String [] osAllAttributes = new String [length];
for (int i = 0; i < length; i++) {
int stringRef = OS.CFArrayGetValueAtIndex(stringArrayRef, i);
osAllAttributes[i] = stringRefToString (stringRef);
}
/* Add our list of supported attributes to the array.
* Make sure each attribute name is not already in the array before appending.
*/
for (int i = 0; i < requiredAttributes.length; i++) {
if (!contains(osAllAttributes, requiredAttributes[i])) {
int stringRef = stringToStringRef(requiredAttributes[i]);
OS.CFArrayAppendValue(stringArrayRef, stringRef);
OS.CFRelease(stringRef);
}
}
if (accessibleTextListeners.size() > 0) {
for (int i = 0; i < textAttributes.length; i++) {
if (!contains(osAllAttributes, textAttributes[i])) {
int stringRef = stringToStringRef(textAttributes[i]);
OS.CFArrayAppendValue(stringArrayRef, stringRef);
OS.CFRelease(stringRef);
}
}
}
code = OS.noErr;
}
return code;
}
boolean contains (String [] array, String element) {
for (int i = 0; i < array.length; i++) {
if (array[i].equals(element)) {
return true;
}
}
return false;
}
/**
* Invokes platform specific functionality to handle a window message.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Accessible</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*/
public int internal_kEventAccessibleGetNamedAttribute (int nextHandler, int theEvent, int userData) {
if (axuielementref != 0) {
int [] stringRef = new int [1];
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeName, OS.typeCFStringRef, null, 4, null, stringRef);
int length = 0;
if (stringRef [0] != 0) length = OS.CFStringGetLength (stringRef [0]);
char [] buffer= new char [length];
CFRange range = new CFRange ();
range.length = length;
OS.CFStringGetCharacters (stringRef [0], range, buffer);
String attributeName = new String(buffer);
if (attributeName.equals(OS.kAXRoleAttribute)) return getRoleAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXSubroleAttribute)) return getSubroleAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXRoleDescriptionAttribute)) return getRoleDescriptionAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXHelpAttribute)) return getHelpAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXTitleAttribute)) return getTitleAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXValueAttribute)) return getValueAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXEnabledAttribute)) return getEnabledAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXFocusedAttribute)) return getFocusedAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXParentAttribute)) return getParentAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXChildrenAttribute)) return getChildrenAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXSelectedChildrenAttribute)) return getSelectedChildrenAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXVisibleChildrenAttribute)) return getVisibleChildrenAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXPositionAttribute)) return getPositionAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXSizeAttribute)) return getSizeAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXDescriptionAttribute)) return getDescriptionAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXNumberOfCharactersAttribute)) return getNumberOfCharactersAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXSelectedTextAttribute)) return getSelectedTextAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXSelectedTextRangeAttribute)) return getSelectedTextRangeAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXStringForRangeParameterizedAttribute)) return getStringForRangeAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXInsertionPointLineNumberAttribute)) return getInsertionPointLineNumberAttribute(nextHandler, theEvent, userData);
if (attributeName.equals(OS.kAXRangeForLineParameterizedAttribute)) return getRangeForLineParameterizedAttribute(nextHandler, theEvent, userData);
return getAttribute(nextHandler, theEvent, userData);
}
return userData;
}
int getAttribute (int nextHandler, int theEvent, int userData) {
/* Generic handler: first try just calling the default handler. */
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
if (code != OS.noErr && getChildIDFromEvent(theEvent) != ACC.CHILDID_SELF) {
/*
* If the childID is unknown to the control, then it was created by the application,
* so delegate to the application's accessible UIElement for the control.
*/
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleObject, OS.typeCFTypeRef, 4, new int [] {axuielementref});
code = OS.CallNextEventHandler (nextHandler, theEvent);
}
return code;
}
int getHelpAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
String osHelpAttribute = null;
int [] stringRef = new int [1];
if (code == OS.noErr) {
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
osHelpAttribute = stringRefToString (stringRef [0]);
}
AccessibleEvent event = new AccessibleEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.result = osHelpAttribute;
for (int i = 0; i < accessibleListeners.size(); i++) {
AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
listener.getHelp(event);
}
if (event.result != null) {
stringRef [0] = stringToStringRef (event.result);
if (stringRef [0] != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
OS.CFRelease(stringRef [0]);
code = OS.noErr;
}
}
return code;
}
int getRoleAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.detail = -1;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getRole(event);
}
if (event.detail != -1) {
String appRole = roleToOs (event.detail);
int index = appRole.indexOf(':');
if (index != -1) appRole = appRole.substring(0, index);
int stringRef = stringToStringRef (appRole);
if (stringRef != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringRef});
OS.CFRelease(stringRef);
code = OS.noErr;
}
}
return code;
}
int getSubroleAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.detail = -1;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getRole(event);
}
if (event.detail != -1) {
String appRole = roleToOs (event.detail);
int index = appRole.indexOf(':');
if (index != -1) {
appRole = appRole.substring(index + 1);
int stringRef = stringToStringRef (appRole);
if (stringRef != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringRef});
OS.CFRelease(stringRef);
}
}
code = OS.noErr;
}
return code;
}
int getRoleDescriptionAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.detail = -1;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getRole(event);
}
if (event.detail != -1) {
String appRole = roleToOs (event.detail);
String appSubrole = null;
int index = appRole.indexOf(':');
if (index != -1) {
appSubrole = appRole.substring(index + 1);
appRole = appRole.substring(0, index);
}
int stringRef1 = stringToStringRef (appRole);
if (stringRef1 != 0) {
int stringRef2 = 0;
if (appSubrole != null) stringRef2 = stringToStringRef (appSubrole);
int stringRef3 = OS.HICopyAccessibilityRoleDescription (stringRef1, stringRef2);
OS.CFRelease(stringRef1);
if (stringRef2 != 0) OS.CFRelease(stringRef2);
if (stringRef3 != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringRef3});
OS.CFRelease(stringRef3);
code = OS.noErr;
}
}
}
return code;
}
int getTitleAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
int childID = getChildIDFromEvent(theEvent);
/*
* Feature of the Macintosh. The text of a Label is returned in its value,
* not its title, so ensure that the role is not Label before asking for the title.
*/
AccessibleControlEvent roleEvent = new AccessibleControlEvent(this);
roleEvent.childID = childID;
roleEvent.detail = -1;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getRole(roleEvent);
}
if (roleEvent.detail != ACC.ROLE_LABEL) {
String osTitleAttribute = null;
int [] stringRef = new int [1];
if (code == OS.noErr) {
int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
if (status == OS.noErr) {
osTitleAttribute = stringRefToString (stringRef [0]);
}
}
AccessibleEvent event = new AccessibleEvent(this);
event.childID = childID;
event.result = osTitleAttribute;
for (int i = 0; i < accessibleListeners.size(); i++) {
AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
listener.getName(event);
}
if (event.result != null) {
stringRef [0] = stringToStringRef (event.result);
if (stringRef [0] != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
OS.CFRelease(stringRef [0]);
code = OS.noErr;
}
}
}
return code;
}
int getValueAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
int childID = getChildIDFromEvent(theEvent);
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = childID;
event.detail = -1;
event.result = null; //TODO: could pass the OS value to the app
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getRole(event);
listener.getValue(event);
}
int role = event.detail;
String value = event.result;
if (value != null || role == ACC.ROLE_LABEL) {
int stringRef = 0;
switch (role) {
case ACC.ROLE_RADIOBUTTON: // 1 = on, 0 = off
case ACC.ROLE_CHECKBUTTON: // 1 = checked, 0 = unchecked, 2 = mixed
case ACC.ROLE_SCROLLBAR: // numeric value representing the position of the scroller
case ACC.ROLE_TABITEM: // 1 = selected, 0 = not selected
case ACC.ROLE_SLIDER: // the value associated with the position of the slider thumb
case ACC.ROLE_PROGRESSBAR: // the value associated with the fill level of the progress bar
try {
int number = Integer.parseInt(value);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeSInt32, 4, new int [] {number});
code = OS.noErr;
} catch (NumberFormatException ex) {
if (value.equalsIgnoreCase("true")) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {true});
code = OS.noErr;
} else if (value.equalsIgnoreCase("false")) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {false});
code = OS.noErr;
}
}
break;
case ACC.ROLE_TABFOLDER: // the accessibility object representing the currently selected tab item
//break;
case ACC.ROLE_COMBOBOX: // text of the currently selected item
case ACC.ROLE_TEXT: // text in the text field
stringRef = stringToStringRef(value);
break;
case ACC.ROLE_LABEL: // text in the label
/* On a Mac, the 'value' of a label is the same as the 'name' of the label. */
AccessibleEvent e = new AccessibleEvent(this);
e.childID = childID;
e.result = null;
for (int i = 0; i < accessibleListeners.size(); i++) {
AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
listener.getName(e);
}
if (e.result != null) {
stringRef = stringToStringRef(e.result);
} else {
if (value != null) stringRef = stringToStringRef(value);
}
break;
}
if (stringRef != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringRef});
OS.CFRelease(stringRef);
code = OS.noErr;
}
}
return code;
}
int getEnabledAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
if (code == OS.eventNotHandledErr) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {control.isEnabled()});
code = OS.noErr;
}
return code;
}
int getFocusedAttribute (int nextHandler, int theEvent, int userData) {
int[] osChildID = new int[1];
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleObject, OS.typeCFTypeRef, null, 4, null, osChildID);
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = ACC.CHILDID_MULTIPLE; // set to invalid value, to test if the application sets it in getFocus()
event.accessible = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getFocus(event);
}
/* The application can optionally answer an accessible. */
if (event.accessible != null) {
boolean hasFocus = OS.CFEqual(event.accessible.axuielementref, osChildID[0]);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {hasFocus});
return OS.noErr;
}
/* Or the application can answer a valid child ID, including CHILDID_SELF and CHILDID_NONE. */
if (event.childID == ACC.CHILDID_SELF) {
boolean hasFocus = OS.CFEqual(axuielementref, osChildID[0]);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {hasFocus});
return OS.noErr;
}
if (event.childID == ACC.CHILDID_NONE) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {false});
return OS.noErr;
}
if (event.childID != ACC.CHILDID_MULTIPLE) {
/* Other valid childID. */
int childID = osToChildID(osChildID[0]);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {event.childID == childID});
return OS.noErr;
}
/* Invalid childID at this point means the application did not implement getFocus, so return the native focus. */
boolean hasFocus = false;
int focusWindow = OS.GetUserFocusWindow ();
if (focusWindow != 0) {
int [] focusControl = new int [1];
OS.GetKeyboardFocus (focusWindow, focusControl);
if (focusControl [0] == control.handle) hasFocus = true;
}
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {hasFocus});
return OS.noErr;
}
int getParentAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
if (code == OS.eventNotHandledErr) {
/* If the childID was created by the application, the parent is the accessible for the control. */
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFTypeRef, 4, new int [] {axuielementref});
code = OS.noErr;
}
return code;
}
int getChildrenAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
int childID = getChildIDFromEvent(theEvent);
if (childID == ACC.CHILDID_SELF) {
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = childID;
event.detail = -1; // set to impossible value to test if app resets
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getChildCount(event);
}
if (event.detail == 0) {
code = OS.noErr;
} else if (event.detail > 0) {
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getChildren(event);
}
Object [] appChildren = event.children;
if (appChildren != null && appChildren.length > 0) {
/* return a CFArrayRef of AXUIElementRefs */
int children = OS.CFArrayCreateMutable (OS.kCFAllocatorDefault, 0, 0);
if (children != 0) {
for (int i = 0; i < appChildren.length; i++) {
Object child = appChildren[i];
if (child instanceof Integer) {
OS.CFArrayAppendValue (children, childIDToOs(((Integer)child).intValue()));
} else {
OS.CFArrayAppendValue (children, ((Accessible)child).axuielementref);
}
}
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFMutableArrayRef, 4, new int [] {children});
OS.CFRelease(children);
code = OS.noErr;
}
}
}
}
return code;
}
int getSelectedChildrenAttribute (int nextHandler, int theEvent, int userData) {
//TODO
return getAttribute (nextHandler, theEvent, userData);
}
int getVisibleChildrenAttribute (int nextHandler, int theEvent, int userData) {
//TODO
return getAttribute (nextHandler, theEvent, userData);
}
int getPositionAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
CGPoint osPositionAttribute = new CGPoint ();
if (code == OS.noErr) {
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeHIPoint, null, CGPoint.sizeof, null, osPositionAttribute);
}
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.x = (int) osPositionAttribute.x;
event.y = (int) osPositionAttribute.y;
if (code != OS.noErr) event.width = -1;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getLocation(event);
}
if (event.width != -1) {
osPositionAttribute.x = event.x;
osPositionAttribute.y = event.y;
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeHIPoint, CGPoint.sizeof, osPositionAttribute);
code = OS.noErr;
}
return code;
}
int getSizeAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
CGPoint osSizeAttribute = new CGPoint ();
if (code == OS.noErr) {
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeHISize, null, CGPoint.sizeof, null, osSizeAttribute);
}
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.width = (code != OS.noErr) ? -1 : (int) osSizeAttribute.x;
event.height = (int) osSizeAttribute.y;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getLocation(event);
}
if (event.width != -1) {
osSizeAttribute.x = event.width;
osSizeAttribute.y = event.height;
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeHISize, CGPoint.sizeof, osSizeAttribute);
code = OS.noErr;
}
return code;
}
int getDescriptionAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
String osDescriptionAttribute = null;
int [] stringRef = new int [1];
if (code == OS.noErr) {
int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
if (status == OS.noErr) {
osDescriptionAttribute = stringRefToString (stringRef [0]);
}
}
AccessibleEvent event = new AccessibleEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.result = osDescriptionAttribute;
for (int i = 0; i < accessibleListeners.size(); i++) {
AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
listener.getDescription(event);
}
if (event.result != null) {
stringRef [0] = stringToStringRef (event.result);
if (stringRef [0] != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
OS.CFRelease(stringRef [0]);
code = OS.noErr;
}
}
return code;
}
int getInsertionPointLineNumberAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleControlEvent controlEvent = new AccessibleControlEvent(this);
controlEvent.childID = getChildIDFromEvent(theEvent);
controlEvent.result = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getValue(controlEvent);
}
AccessibleTextEvent textEvent = new AccessibleTextEvent(this);
textEvent.childID = getChildIDFromEvent(theEvent);
textEvent.offset = -1;
for (int i = 0; i < accessibleTextListeners.size(); i++) {
AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
listener.getCaretOffset(textEvent);
}
if (controlEvent.result != null && textEvent.offset != -1) {
int lineNumber = lineNumberForOffset (controlEvent.result, textEvent.offset);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeSInt32, 4, new int [] {lineNumber});
code = OS.noErr;
}
return code;
}
int getNumberOfCharactersAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.result = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getValue(event);
}
String appValue = event.result;
if (appValue != null) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeSInt32, 4, new int [] {appValue.length()});
code = OS.noErr;
}
return code;
}
int getRangeForLineParameterizedAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
int lineNumber [] = new int [1];
int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeParameter, OS.typeSInt32, null, 4, null, lineNumber);
if (status == OS.noErr) {
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.result = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getValue(event);
}
if (event.result != null) {
CFRange range = rangeForLineNumber (lineNumber [0], event.result);
if (range.location != -1) {
int valueRef = OS.AXValueCreate(OS.kAXValueCFRangeType, range);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFTypeRef, 4, new int [] {valueRef});
OS.CFRelease(valueRef);
code = OS.noErr;
}
}
}
return code;
}
int getSelectedTextAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleTextEvent event = new AccessibleTextEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.offset = -1;
event.length = -1;
for (int i = 0; i < accessibleTextListeners.size(); i++) {
AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
listener.getSelectionRange(event);
}
int offset = event.offset;
int length = event.length;
if (offset != -1 && length != -1 && length != 0) { // TODO: do we need the && length != 0 ?
AccessibleControlEvent event2 = new AccessibleControlEvent(this);
event2.childID = event.childID;
event2.result = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getValue(event2);
}
String appValue = event2.result;
if (appValue != null) {
int stringRef = stringToStringRef (appValue.substring(offset, offset + length));
if (stringRef != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringRef});
OS.CFRelease(stringRef);
code = OS.noErr;
}
}
}
return code;
}
int getSelectedTextRangeAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
AccessibleTextEvent event = new AccessibleTextEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.offset = -1;
event.length = -1;
for (int i = 0; i < accessibleTextListeners.size(); i++) {
AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
listener.getSelectionRange(event);
}
if (event.offset != -1) {
CFRange range = new CFRange();
range.location = event.offset;
range.length = event.length;
int valueRef = OS.AXValueCreate(OS.kAXValueCFRangeType, range);
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFTypeRef, 4, new int [] {valueRef});
OS.CFRelease(valueRef);
code = OS.noErr;
}
return code;
}
int getStringForRangeAttribute (int nextHandler, int theEvent, int userData) {
int code = userData;
int valueRef [] = new int [1];
int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeParameter, OS.typeCFTypeRef, null, 4, null, valueRef);
if (status == OS.noErr) {
CFRange range = new CFRange();
boolean ok = OS.AXValueGetValue(valueRef[0], OS.kAXValueCFRangeType, range);
if (ok) {
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = getChildIDFromEvent(theEvent);
event.result = null;
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getValue(event);
}
String appValue = event.result;
if (appValue != null) {
int stringRef = stringToStringRef (appValue.substring(range.location, range.location + range.length));
if (stringRef != 0) {
OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringRef});
OS.CFRelease(stringRef);
code = OS.noErr;
}
}
}
}
return code;
}
int lineNumberForOffset (String text, int offset) {
int lineNumber = 1;
int length = text.length();
for (int i = 0; i < offset; i++) {
switch (text.charAt (i)) {
case '\r':
if (i + 1 < length) {
if (text.charAt (i + 1) == '\n') ++i;
}
// FALL THROUGH
case '\n':
lineNumber++;
}
}
return lineNumber;
}
CFRange rangeForLineNumber (int lineNumber, String text) {
CFRange range = new CFRange();
range.location = -1;
int line = 1;
int count = 0;
int length = text.length ();
for (int i = 0; i < length; i++) {
if (line == lineNumber) {
if (count == 0) {
range.location = i;
}
count++;
}
if (line > lineNumber) break;
switch (text.charAt (i)) {
case '\r':
if (i + 1 < length && text.charAt (i + 1) == '\n') i++;
// FALL THROUGH
case '\n':
line++;
}
}
range.length = count;
return range;
}
/**
* Removes the listener from the collection of listeners who will
* be notified when an accessible client asks for certain strings,
* such as name, description, help, or keyboard shortcut.
*
* @param listener the listener that should no longer be notified when the receiver
* is asked for a name, description, help, or keyboard shortcut string
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see AccessibleListener
* @see #addAccessibleListener
*/
public void removeAccessibleListener(AccessibleListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
accessibleListeners.removeElement(listener);
}
/**
* Removes the listener from the collection of listeners who will
* be notified when an accessible client asks for custom control
* specific information.
*
* @param listener the listener that should no longer be notified when the receiver
* is asked for custom control specific information
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see AccessibleControlListener
* @see #addAccessibleControlListener
*/
public void removeAccessibleControlListener(AccessibleControlListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
accessibleControlListeners.removeElement(listener);
}
/**
* Removes the listener from the collection of listeners who will
* be notified when an accessible client asks for custom text control
* specific information.
*
* @param listener the listener that should no longer be notified when the receiver
* is asked for custom text control specific information
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see AccessibleTextListener
* @see #addAccessibleTextListener
*
* @since 3.0
*/
public void removeAccessibleTextListener (AccessibleTextListener listener) {
checkWidget ();
if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
accessibleTextListeners.removeElement (listener);
}
/**
* Sends a message to accessible clients that the child selection
* within a custom container control has changed.
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @since 3.0
*/
public void selectionChanged () {
checkWidget();
int stringRef = stringToStringRef(OS.kAXSelectedChildrenChangedNotification);
OS.AXNotificationHIObjectNotify(stringRef, control.handle, 0);
OS.CFRelease(stringRef);
}
/**
* Sends a message to accessible clients indicating that the focus
* has changed within a custom control.
*
* @param childID an identifier specifying a child of the control
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*/
public void setFocus(int childID) {
checkWidget();
childIDToOs(childID); // Make sure the childID is cached
int stringRef = stringToStringRef(OS.kAXFocusedUIElementChangedNotification);
OS.AXNotificationHIObjectNotify(stringRef, control.handle, 0);
OS.CFRelease(stringRef);
}
/**
* Sends a message to accessible clients that the text
* caret has moved within a custom control.
*
* @param index the new caret index within the control
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @since 3.0
*/
public void textCaretMoved (int index) {
checkWidget();
int stringRef = stringToStringRef(OS.kAXSelectedTextChangedNotification);
OS.AXNotificationHIObjectNotify(stringRef, control.handle, 0);
OS.CFRelease(stringRef);
}
/**
* Sends a message to accessible clients that the text
* within a custom control has changed.
*
* @param type the type of change, one of <code>ACC.NOTIFY_TEXT_INSERT</code>
* or <code>ACC.NOTIFY_TEXT_DELETE</code>
* @param startIndex the text index within the control where the insertion or deletion begins
* @param length the non-negative length in characters of the insertion or deletion
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @see ACC#TEXT_INSERT
* @see ACC#TEXT_DELETE
*
* @since 3.0
*/
public void textChanged (int type, int startIndex, int length) {
checkWidget();
int stringRef = stringToStringRef(OS.kAXValueChangedNotification);
OS.AXNotificationHIObjectNotify(stringRef, control.handle, 0);
OS.CFRelease(stringRef);
}
/**
* Sends a message to accessible clients that the text
* selection has changed within a custom control.
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
* </ul>
*
* @since 3.0
*/
public void textSelectionChanged () {
checkWidget();
int stringRef = stringToStringRef(OS.kAXSelectedTextChangedNotification);
OS.AXNotificationHIObjectNotify(stringRef, control.handle, 0);
OS.CFRelease(stringRef);
}
int getChildIDFromEvent(int theEvent) {
int[] ref = new int[1];
OS.GetEventParameter (theEvent, OS.kEventParamAccessibleObject, OS.typeCFTypeRef, null, 4, null, ref);
return osToChildID(ref[0]);
}
int childIDToOs(int childID) {
if (childID == ACC.CHILDID_SELF) {
return axuielementref;
}
/* Check cache for childID, if found, return corresponding osChildID. */
int index;
for (index = 0; index < osChildIDCache.length; index += 2) {
if (childID == osChildIDCache [index]) {
return osChildIDCache [index + 1];
}
}
/* If childID not in cache, create osChildID, grow cache by 2,
* add childID/osChildID to cache, and return new osChildID. */
int osChildID = OS.AXUIElementCreateWithHIObjectAndIdentifier(control.handle, childID + 1);
int [] newCache = new int [osChildIDCache.length + 2];
System.arraycopy (osChildIDCache, 0, newCache, 0, osChildIDCache.length);
osChildIDCache = newCache;
osChildIDCache [index] = childID;
osChildIDCache [index + 1] = osChildID;
return osChildID;
}
int osToChildID(int osChildID) {
if (OS.CFEqual(osChildID, axuielementref)) {
return ACC.CHILDID_SELF;
}
/* osChildID is an AXUIElementRef containing the control handle and a long identifier. */
long[] childID = new long[1];
OS.AXUIElementGetIdentifier(osChildID, childID);
if (childID[0] == 0) {
return ACC.CHILDID_SELF;
}
return (int) childID[0] - 1;
}
int stateToOs(int state) {
// int osState = 0;
// if ((state & ACC.STATE_SELECTED) != 0) osState |= OS.;
// return osState;
return state;
}
int osToState(int osState) {
// int state = ACC.STATE_NORMAL;
// if ((osState & OS.) != 0) state |= ACC.STATE_SELECTED;
// return state;
return osState;
}
String roleToOs(int role) {
switch (role) {
case ACC.ROLE_CLIENT_AREA: return OS.kAXGroupRole;
case ACC.ROLE_WINDOW: return OS.kAXWindowRole;
case ACC.ROLE_MENUBAR: return OS.kAXMenuBarRole;
case ACC.ROLE_MENU: return OS.kAXMenuRole;
case ACC.ROLE_MENUITEM: return OS.kAXMenuItemRole;
case ACC.ROLE_SEPARATOR: return OS.kAXSplitterRole;
case ACC.ROLE_TOOLTIP: return OS.kAXHelpTagRole;
case ACC.ROLE_SCROLLBAR: return OS.kAXScrollBarRole;
case ACC.ROLE_DIALOG: return OS.kAXWindowRole + ':' + OS.kAXDialogSubrole;
case ACC.ROLE_LABEL: return OS.kAXStaticTextRole;
case ACC.ROLE_PUSHBUTTON: return OS.kAXButtonRole;
case ACC.ROLE_CHECKBUTTON: return OS.kAXCheckBoxRole;
case ACC.ROLE_RADIOBUTTON: return OS.kAXRadioButtonRole;
case ACC.ROLE_COMBOBOX: return OS.kAXComboBoxRole;
case ACC.ROLE_TEXT: return (control.getStyle () & SWT.MULTI) != 0 ? OS.kAXTextAreaRole : OS.kAXTextFieldRole;
case ACC.ROLE_TOOLBAR: return OS.kAXToolbarRole;
case ACC.ROLE_LIST: return OS.kAXOutlineRole;
case ACC.ROLE_LISTITEM: return OS.kAXStaticTextRole;
case ACC.ROLE_TABLE: return OS.kAXTableRole;
case ACC.ROLE_TABLECELL: return OS.kAXRowRole + ':' + OS.kAXTableRowSubrole;
case ACC.ROLE_TABLECOLUMNHEADER: return OS.kAXButtonRole + ':' + OS.kAXSortButtonSubrole;
case ACC.ROLE_TABLEROWHEADER: return OS.kAXRowRole + ':' + OS.kAXTableRowSubrole;
case ACC.ROLE_TREE: return OS.kAXOutlineRole;
case ACC.ROLE_TREEITEM: return OS.kAXOutlineRole + ':' + OS.kAXOutlineRowSubrole;
case ACC.ROLE_TABFOLDER: return OS.kAXTabGroupRole;
case ACC.ROLE_TABITEM: return OS.kAXRadioButtonRole;
case ACC.ROLE_PROGRESSBAR: return OS.kAXProgressIndicatorRole;
case ACC.ROLE_SLIDER: return OS.kAXSliderRole;
case ACC.ROLE_LINK: return OS.kAXLinkRole;
}
return OS.kAXUnknownRole;
}
int osToRole(String osRole) {
if (osRole == null) return 0;
if (osRole.equals(OS.kAXWindowRole)) return ACC.ROLE_WINDOW;
if (osRole.equals(OS.kAXMenuBarRole)) return ACC.ROLE_MENUBAR;
if (osRole.equals(OS.kAXMenuRole)) return ACC.ROLE_MENU;
if (osRole.equals(OS.kAXMenuItemRole)) return ACC.ROLE_MENUITEM;
if (osRole.equals(OS.kAXSplitterRole)) return ACC.ROLE_SEPARATOR;
if (osRole.equals(OS.kAXHelpTagRole)) return ACC.ROLE_TOOLTIP;
if (osRole.equals(OS.kAXScrollBarRole)) return ACC.ROLE_SCROLLBAR;
if (osRole.equals(OS.kAXScrollAreaRole)) return ACC.ROLE_LIST;
if (osRole.equals(OS.kAXWindowRole + ':' + OS.kAXDialogSubrole)) return ACC.ROLE_DIALOG;
if (osRole.equals(OS.kAXWindowRole + ':' + OS.kAXSystemDialogSubrole)) return ACC.ROLE_DIALOG;
if (osRole.equals(OS.kAXStaticTextRole)) return ACC.ROLE_LABEL;
if (osRole.equals(OS.kAXButtonRole)) return ACC.ROLE_PUSHBUTTON;
if (osRole.equals(OS.kAXCheckBoxRole)) return ACC.ROLE_CHECKBUTTON;
if (osRole.equals(OS.kAXRadioButtonRole)) return ACC.ROLE_RADIOBUTTON;
if (osRole.equals(OS.kAXComboBoxRole)) return ACC.ROLE_COMBOBOX;
if (osRole.equals(OS.kAXTextFieldRole)) return ACC.ROLE_TEXT;
if (osRole.equals(OS.kAXTextAreaRole)) return ACC.ROLE_TEXT;
if (osRole.equals(OS.kAXToolbarRole)) return ACC.ROLE_TOOLBAR;
if (osRole.equals(OS.kAXListRole)) return ACC.ROLE_LIST;
if (osRole.equals(OS.kAXTableRole)) return ACC.ROLE_TABLE;
if (osRole.equals(OS.kAXColumnRole)) return ACC.ROLE_TABLECOLUMNHEADER;
if (osRole.equals(OS.kAXButtonRole + ':' + OS.kAXSortButtonSubrole)) return ACC.ROLE_TABLECOLUMNHEADER;
if (osRole.equals(OS.kAXRowRole + ':' + OS.kAXTableRowSubrole)) return ACC.ROLE_TABLEROWHEADER;
if (osRole.equals(OS.kAXOutlineRole)) return ACC.ROLE_TREE;
if (osRole.equals(OS.kAXOutlineRole + ':' + OS.kAXOutlineRowSubrole)) return ACC.ROLE_TREEITEM;
if (osRole.equals(OS.kAXTabGroupRole)) return ACC.ROLE_TABFOLDER;
if (osRole.equals(OS.kAXProgressIndicatorRole)) return ACC.ROLE_PROGRESSBAR;
if (osRole.equals(OS.kAXSliderRole)) return ACC.ROLE_SLIDER;
if (osRole.equals(OS.kAXLinkRole)) return ACC.ROLE_LINK;
return ACC.ROLE_CLIENT_AREA;
}
/* Return a CFStringRef representing the given java String.
* Note that the caller is responsible for calling OS.CFRelease
* when they are done with the stringRef.
*/
int stringToStringRef(String string) {
char [] buffer = new char [string.length ()];
string.getChars (0, buffer.length, buffer, 0);
return OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, buffer, buffer.length);
}
/* Return a Java String representing the given CFStringRef.
* Note that this method does not call OS.CFRelease(stringRef).
*/
String stringRefToString(int stringRef) {
if (stringRef == 0) return "";
int length = OS.CFStringGetLength (stringRef);
char [] buffer= new char [length];
CFRange range = new CFRange ();
range.length = length;
OS.CFStringGetCharacters (stringRef, range, buffer);
return new String(buffer);
}
/* checkWidget was copied from Widget, and rewritten to work in this package */
void checkWidget () {
if (!isValidThread ()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (control.isDisposed ()) SWT.error (SWT.ERROR_WIDGET_DISPOSED);
}
/* isValidThread was copied from Widget, and rewritten to work in this package */
boolean isValidThread () {
return control.getDisplay ().getThread () == Thread.currentThread ();
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
bb23bfa513782b9ec8fb4cf11c7e69817bb9d3ab | c7caae2f14d6d11980aaa286784c5a591f7b7592 | /lcms-common/src/main/java/com/ljb/utils/SizeUtils.java | 05b15cd143a30e20a848d6a6435bf6e46ff50f4c | [] | no_license | longjinbing/lcms | aabeb6e399ff48f2bdd34780e5b53a59a8454954 | 0a8784016f498a42dff211f81cafceb26b0d0310 | refs/heads/master | 2022-07-12T06:09:07.901339 | 2019-09-15T10:50:01 | 2019-09-15T10:50:01 | 159,462,412 | 0 | 0 | null | 2022-06-29T17:05:01 | 2018-11-28T07:35:54 | JavaScript | UTF-8 | Java | false | false | 1,035 | java | package com.ljb.utils;
import java.text.DecimalFormat;
/**
* 作者: @author longjinbin <br>
* 时间: 2018/11/23<br>
* 描述: <br>
*/
public class SizeUtils {
public static String convertSize(Long size){
int GB = 1024 * 1024 * 1024;//定义GB的计算常量
int MB = 1024 * 1024;//定义MB的计算常量
int KB = 1024;//定义KB的计算常量
DecimalFormat df = new DecimalFormat("0.00");//格式化小数
String resultSize = "";
if (size / GB >= 1) {
//如果当前Byte的值大于等于1GB
resultSize = df.format(size / (float) GB) + "GB";
} else if (size / MB >= 1) {
//如果当前Byte的值大于等于1MB
resultSize = df.format(size / (float) MB) + "MB";
} else if (size / KB >= 1) {
//如果当前Byte的值大于等于1KB
resultSize = df.format(size / (float) KB) + "KB";
} else {
resultSize = size + "B ";
}
return resultSize;
}
}
| [
"longjinbin@yeah.net"
] | longjinbin@yeah.net |
da1647ffc2da4d05449ceac1bdc35e19659bd64f | c25ac84e50998723b03a7e8808a77fea897ebc2e | /src/main/java/edu/iit/sat/itmd4515/wgu10/web/CustomerController.java | f9290bbead7ca0350cf3ec6c388c376dfb41ae43 | [] | no_license | wgu10/wgu10-lab4 | 80f1eba8032124bcbefaf84d7b9e02bd7a95f60c | 29cfcfde1aba62d12832ded59e66e62cdb8f7f15 | refs/heads/master | 2023-03-08T15:00:10.955081 | 2021-02-21T16:03:58 | 2021-02-21T16:03:58 | 340,933,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,802 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.iit.sat.itmd4515.wgu10.web;
import edu.iit.sat.itmd4515.wgu10.domain.Customer;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import javax.validation.ConstraintViolation;
// important - use javax.validation.Validator as import
import javax.validation.Validator;
/**
*
* @author wgu10
*/
@WebServlet(name = "CustomerController", urlPatterns = "/cust")
public class CustomerController extends HttpServlet {
private static final Logger LOG = Logger.getLogger(CustomerController.class.getName());
@Resource
Validator validator;
@Resource(lookup = "java:app/jdbc/itmd4515DS")
DataSource ds;
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
LOG.info("Inside CustomerController.doPost");
try {
// lab 4 - accepted user input from HTMl form/view
String custIdStr = req.getParameter("custId");
String custFirstName = req.getParameter("custFirstName");
String custLastName = req.getParameter("custLastName");
String custEmail = req.getParameter("custEmail");
String comments = req.getParameter("comments");
Integer custId = null;
// lower-level validation for converstin from client-side text input to java data-type
if ((custIdStr != null) && !(custIdStr.isEmpty())) {
custId = Integer.valueOf(custIdStr);
}
// instantiated our pojo based on user input
Customer customer = new Customer(custId, custFirstName, custLastName, custEmail);
LOG.info(customer.toString());
// validate our pojo using BV constraints
Set<ConstraintViolation<Customer>> violations = validator.validate(customer);
// check the result of that validation
// if the size of violations collection is not 0, we have problem
if (violations.size() > 0) {
LOG.info("There was an issue validating the customer.");
// log the problems
for (ConstraintViolation<Customer> violation : violations) {
LOG.info(violation.getPropertyPath() + ":\t" + violation.getMessage());
}
// put the problems and the failed user input back into the request
req.setAttribute("problems", violations);
req.setAttribute("cust", customer);
// send it back to the user for correction
RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/views/cust.jsp");
dispatcher.forward(req, resp);
// otherwise, there were no issues with validation
} else {
LOG.info("There were no issues validating the customer.");
// graduate students, if successful, write to DB
String INSERT_SQL = "insert into Customer "
+ "(CustomerId, FirstName, LastName, Email) "
+ "values (?,?,?,?)";
try( Connection c = ds.getConnection(); PreparedStatement ps = c.prepareStatement(INSERT_SQL)){
ps.setInt(1, customer.getId());
ps.setString(2, customer.getFirstName());
ps.setString(3, customer.getLastName());
ps.setString(4, customer.getEmail());
ps.executeUpdate();
}
req.setAttribute("cust", customer);
RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/views/custConf.jsp");
dispatcher.forward(req, resp);
}
} catch( Exception e ){
LOG.log(Level.SEVERE, null, e);
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
LOG.info("Inside CustomerController.doGet");
RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/views/cust.jsp");
dispatcher.forward(req, resp);
}
}
| [
"ext.yuchangcheng3@jd.com"
] | ext.yuchangcheng3@jd.com |
0b58e8e774aa0acbd521fe2c2ee19dd4cdb87f0b | cb568a0f9afd60d7dca004e48e5092315e35cdad | /source/model/src/test/java/au/model/repository/CardParameterCRUDTestCase.java | 0b8fec74af64df3f981c2c133dfb75f471b0efcb | [] | no_license | nicbotha/Cardies | 276d77b90904c98cb3131eb270cf3165d8bb043e | 41a9fa406089dd29f31aa1c73bb4e5496584beaf | refs/heads/master | 2020-06-29T09:23:19.350083 | 2016-11-22T05:01:53 | 2016-11-22T05:01:53 | 74,435,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package au.model.repository;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import au.model.entity.Card;
import au.model.entity.CardParameter;
import au.model.entity.Template;
public class CardParameterCRUDTestCase extends BaseRepositoryTestCase<CardParameterCRUDRepository, CardParameter> {
@Override
public CardParameter newEntity() {
Card card = EntityTestHelper.newCard();
Template template = card.getTemplate();
return EntityTestHelper.newCardParameter(card, EntityTestHelper.newTemplateParameter(template));
}
@Override
protected CardParameter updateTestEntity(CardParameter entity) {
entity.setValue("value1");
return entity;
}
@Override
protected void assertIsUpdated(CardParameter entity) {
assertThat("value1", equalTo(entity.getValue()));
}
@Test
public void testConstraints_Size() throws Exception {
CardParameter entity = newEntity();
final String SIZE_CONSTRAINT_VIOLATION = StringUtils.repeat("a", 500);
String[] expected = new String[] {getI18n("model.cardparameter.value.size")};
entity.setValue(SIZE_CONSTRAINT_VIOLATION);
checkExceptions(entity, expected);
}
@Test
public void testConstraints_Null() throws Exception {
CardParameter entity = newEntity();
String[] expected = new String[] {getI18n("model.cardparameter.card.notnull"), getI18n("model.cardparameter.templateparameter.notnull")};
entity.setCard(null);
entity.setTemplateParameter(null);
checkExceptions(entity, expected);
}
}
| [
"nic.botha@gmail.com"
] | nic.botha@gmail.com |
797d7d733911a1f8f6f659535347a88445a295ee | be22e3938e01d2fce7071003467ee4924c200e19 | /navigational_access/src/main/java/travel/impl/DefaultBudgetHotelDestination.java | 6439a1acdc19b3098d7fe2778e73d5d3efb9eeac | [] | no_license | ayushyadav99/rdf-oo-store | 8defcec3c8a092b587521b22b76cbca9561d5770 | 77b4a0033eb7a1da8ddc4b9cb2be52efdd93fa0b | refs/heads/master | 2023-04-22T16:36:04.459300 | 2021-05-17T09:23:44 | 2021-05-17T09:23:44 | 360,221,589 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,730 | java | package travel.impl;
import travel.*;
import java.net.URI;
import java.io.Serializable;
import javax.jdo.annotations.Embedded;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Collection;
import javax.xml.datatype.XMLGregorianCalendar;
import org.protege.owl.codegeneration.WrappedIndividual;
import org.protege.owl.codegeneration.impl.WrappedIndividualImpl;
import org.protege.owl.codegeneration.inference.CodeGenerationInference;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
/**
* Generated by Protege (http://protege.stanford.edu).<br>
* Source Class: DefaultBudgetHotelDestination <br>
* @version generated on Sun May 16 18:22:29 IST 2021 by ayushyadav
*/
@Entity
public class DefaultBudgetHotelDestination extends WrappedIndividualImpl implements BudgetHotelDestination , Serializable {
private static final long serialVersionUID = 1L;
@GeneratedValue
private long id;
@Id
private String name;
private Collection < ? extends Accommodation > HasAccommodation ; ;
private Collection < ? extends Activity > HasActivity ; ;
private Collection < ? extends Destination > HasPart ;
public DefaultBudgetHotelDestination(CodeGenerationInference inference, IRI iri) {
super(inference, iri);
name = iri.toString();
HasAccommodation= getHasAccommodation();
HasActivity= getHasActivity();
HasPart= getHasPart();
}
/* ***************************************************
* Object Property http://www.owl-ontologies.com/travel.owl#hasAccommodation
*/
public Collection<? extends Accommodation> getHasAccommodation() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASACCOMMODATION,
DefaultAccommodation.class);
}
public boolean hasHasAccommodation() {
return !getHasAccommodation().isEmpty();
}
public void addHasAccommodation(Accommodation newHasAccommodation) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASACCOMMODATION,
newHasAccommodation);
}
public void removeHasAccommodation(Accommodation oldHasAccommodation) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASACCOMMODATION,
oldHasAccommodation);
}
/* ***************************************************
* Object Property http://www.owl-ontologies.com/travel.owl#hasActivity
*/
public Collection<? extends Activity> getHasActivity() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASACTIVITY,
DefaultActivity.class);
}
public boolean hasHasActivity() {
return !getHasActivity().isEmpty();
}
public void addHasActivity(Activity newHasActivity) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASACTIVITY,
newHasActivity);
}
public void removeHasActivity(Activity oldHasActivity) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASACTIVITY,
oldHasActivity);
}
/* ***************************************************
* Object Property http://www.owl-ontologies.com/travel.owl#hasPart
*/
public Collection<? extends Destination> getHasPart() {
return getDelegate().getPropertyValues(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASPART,
DefaultDestination.class);
}
public boolean hasHasPart() {
return !getHasPart().isEmpty();
}
public void addHasPart(Destination newHasPart) {
getDelegate().addPropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASPART,
newHasPart);
}
public void removeHasPart(Destination oldHasPart) {
getDelegate().removePropertyValue(getOwlIndividual(),
Vocabulary.OBJECT_PROPERTY_HASPART,
oldHasPart);
}
}
| [
"ayushyadav.ay42@gmail.com"
] | ayushyadav.ay42@gmail.com |
27a9a549336f9e21ce1ef9079b94db215e97fbfa | b59f850f6456427be1877d44e76385ed7e39328f | /src/Sabrina07239_Entity/Sabrina07239_CameraEntity.java | b01576d7df6ef2519c4d6ff921c0f134648c7c7b | [] | no_license | sabrinawp/Praktikum_Modul2 | 93de498859ab09f863f4fea90c18d4dd66173ca7 | 776523f62a7955196223e29d8c83c9543fcee248 | refs/heads/master | 2023-01-31T14:11:42.061139 | 2020-12-15T02:24:30 | 2020-12-15T02:24:30 | 321,529,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package Sabrina07239_Entity;
public class Sabrina07239_CameraEntity {
public static String merk [] = {"Canon 600D", "CANON 1000D", "CANON 1200D"};
public static String periode;
}
| [
"sabrina@192.168.0.2"
] | sabrina@192.168.0.2 |
6d87ed1f86a2e6ab14fa61ef29e3f0b2b38e0943 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_4d3726cd52c72b80b5f298989d6637c4e87e4756/Zed/18_4d3726cd52c72b80b5f298989d6637c4e87e4756_Zed_s.java | 797e0164feced60633ba0220a16ff2cb81bb6435 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,807 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package com.edinarobotics.zed;
import com.edinarobotics.utils.commands.MaintainStateCommand;
import com.edinarobotics.utils.commands.RepeatCommand;
import com.edinarobotics.utils.gamepad.Gamepad;
import com.edinarobotics.utils.pid.PIDTuningManager;
import com.edinarobotics.zed.commands.AugerRotateCommand;
import com.edinarobotics.zed.commands.ConveyorPulseSequenceCommand;
import com.edinarobotics.zed.commands.FixedPointVisionTrackingCommand;
import com.edinarobotics.zed.commands.GamepadDriveRotationCommand;
import com.edinarobotics.zed.commands.GamepadDriveStrafeCommand;
import com.edinarobotics.zed.commands.SetCollectorToLimitCommand;
import com.edinarobotics.zed.commands.SetConveyorCommand;
import com.edinarobotics.zed.commands.SetShooterCommand;
import com.edinarobotics.zed.commands.VisionTrackingCommand;
import com.edinarobotics.zed.subsystems.Auger;
import com.edinarobotics.zed.subsystems.Collector;
import com.edinarobotics.zed.subsystems.Conveyor;
import com.edinarobotics.zed.subsystems.DrivetrainRotation;
import com.edinarobotics.zed.subsystems.DrivetrainStrafe;
import com.edinarobotics.zed.subsystems.Lifter;
import com.edinarobotics.zed.subsystems.Shooter;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.PrintCommand;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.command.WaitCommand;
import edu.wpi.first.wpilibj.command.WaitForChildren;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class Zed extends IterativeRobot {
private Command autonomousCommand;
/**
* This function is called when the robot switches between modes (eg. Autonomous,
* Teleop) to reset running subsystems.
*/
public void betweenModes() {
DrivetrainStrafe drivetrainStrafe = Components.getInstance().drivetrainStrafe;
drivetrainStrafe.setDefaultCommand(new MaintainStateCommand(drivetrainStrafe));
DrivetrainRotation drivetrainRotation = Components.getInstance().drivetrainRotation;
drivetrainRotation.setDefaultCommand(new MaintainStateCommand(drivetrainRotation));
stop();
if(autonomousCommand != null) {
autonomousCommand.cancel();
}
}
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
Components.getInstance(); //Create all robot subsystems.
Controls.getInstance(); //Create all robot controls.
System.out.println("Robot initialized.");
}
public void disabledInit() {
betweenModes();
}
public void disabledPeriodic() {
stop();
}
/**
* This function is called once at the start of autonomous mode.
*/
public void autonomousInit(){
DriverStation driverStation = DriverStation.getInstance();
double delayTime = driverStation.getAnalogIn(1);
byte goalType = VisionTrackingCommand.ANY_GOAL;
boolean trackHighGoal = driverStation.getDigitalIn(1);
boolean trackMiddleGoal = driverStation.getDigitalIn(2);
boolean shootInAuto = true;
if(trackHighGoal && trackMiddleGoal){
goalType = VisionTrackingCommand.ANY_GOAL;
}
else if(trackHighGoal){
goalType = VisionTrackingCommand.HIGH_GOAL;
}
else if(trackMiddleGoal){
goalType = VisionTrackingCommand.MIDDLE_GOAL;
}
else{
shootInAuto = false;
}
betweenModes();
DrivetrainStrafe drivetrainStrafe = Components.getInstance().drivetrainStrafe;
drivetrainStrafe.setDefaultCommand(new MaintainStateCommand(drivetrainStrafe));
DrivetrainRotation drivetrainRotation = Components.getInstance().drivetrainRotation;
drivetrainRotation.setDefaultCommand(new MaintainStateCommand(drivetrainRotation));
CommandGroup fastAugerSequence = new CommandGroup();
fastAugerSequence.addSequential(new PrintCommand("Dispensing auger"));
fastAugerSequence.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
fastAugerSequence.addSequential(new WaitCommand(0.8));
CommandGroup augerSequence = new CommandGroup();
augerSequence.addSequential(new PrintCommand("Dispensing auger"));
augerSequence.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
augerSequence.addSequential(new WaitCommand(2));
CommandGroup autoCommand = new CommandGroup();
autoCommand.addSequential(new PrintCommand("Starting autonomous"));
autoCommand.addSequential(new WaitCommand(delayTime));
if(shootInAuto){
autoCommand.addSequential(new FixedPointVisionTrackingCommand(FixedPointVisionTrackingCommand.PYRAMID_BACK_MIDDLE_X,
FixedPointVisionTrackingCommand.PYRAMID_BACK_MIDDLE_Y, VisionTrackingCommand.HIGH_GOAL), 2);
autoCommand.addSequential(new SetShooterCommand(Shooter.SHOOTER_ON));
autoCommand.addSequential(new WaitCommand(2));
autoCommand.addSequential(new SetConveyorCommand(Conveyor.CONVEYOR_SHOOT_IN));
autoCommand.addSequential(new WaitCommand(3));
autoCommand.addSequential(fastAugerSequence);
autoCommand.addSequential(new RepeatCommand(augerSequence, 4));
autoCommand.addSequential(new WaitForChildren());
autoCommand.addSequential(new WaitCommand(2));
autoCommand.addSequential(new SetConveyorCommand(Conveyor.CONVEYOR_STOP));
autoCommand.addSequential(new SetShooterCommand(Shooter.SHOOTER_OFF));
}
autonomousCommand = autoCommand;
autonomousCommand.start();
}
/**
* This function is called periodically during autonomous.
*/
public void autonomousPeriodic() {
Scheduler.getInstance().run();
}
/**
* This function is called once at the start of teleop mode.
*/
public void teleopInit(){
betweenModes();
Gamepad driveGamepad = Controls.getInstance().gamepad1;
Gamepad shootGamepad = Controls.getInstance().gamepad2;
Components.getInstance().drivetrainStrafe.setDefaultCommand(new GamepadDriveStrafeCommand(driveGamepad));
Components.getInstance().drivetrainRotation.setDefaultCommand(new GamepadDriveRotationCommand(driveGamepad, shootGamepad));
}
/**
* This function is called periodically during operator control.
*/
public void teleopPeriodic() {
Scheduler.getInstance().run();
}
/**
* This function is called once at the start of test mode.
*/
public void testInit() {
betweenModes();
LiveWindow.setEnabled(false);
teleopInit();
}
/**
* This function is called periodically during test mode.
*/
public void testPeriodic() {
teleopPeriodic();
PIDTuningManager.getInstance().runTuning();
}
/**
* This function is called to stop <i>each</i> subsystem.
*/
public void stop() {
Components.getInstance().auger.setAugerDirection(Auger.AugerDirection.AUGER_STOP);
Components.getInstance().collector.setCollectorDirection(Collector.CollectorDirection.COLLECTOR_STOP);
Components.getInstance().collector.setCollectorLiftDirection(Collector.CollectorLiftDirection.COLLECTOR_LIFT_STOP);
Components.getInstance().conveyor.setConveyorSpeed(0);
Components.getInstance().drivetrainRotation.mecanumPolarRotate(0);
Components.getInstance().drivetrainStrafe.mecanumPolarStrafe(0, 0);
Components.getInstance().lifter.setLifterDirection(Lifter.LifterDirection.LIFTER_STOP);
Components.getInstance().shooter.setShooterVelocity(0);
Components.getInstance().climber.setClimberDeployed(false);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
986d7719e5a1bf6d9c7c16af1921ae20d5645e87 | 84cfff0639c808af4921865243bd09fee5ffd4e3 | /modules/front-service-user/src/main/java/com/zgljl2012/modules/front/user/query/T20Query.java | 2b31ed1135a5e66bd092b0a83407657a14390d5b | [] | no_license | zgljl2012/DataAnalystIntermediaryPlatform | 1479a0134721e7ab4cb86f9b2b3cc0b7e2dabc30 | f6f2fb58fd26e42308a2db29e44d5a7fec7b9864 | refs/heads/master | 2021-01-21T12:58:10.181022 | 2016-05-24T04:52:25 | 2016-05-24T04:52:25 | 48,831,286 | 2 | 0 | null | 2016-03-09T09:13:06 | 2015-12-31T03:28:00 | Java | UTF-8 | Java | false | false | 990 | java | package com.zgljl2012.modules.front.user.query;
import java.util.Date;
import com.zgljl2012.common.database.enums.Degree;
import com.zgljl2012.common.database.enums.Gender;
/**
*@author 廖金龙
*@version 2016年2月29日上午12:36:09
*T20分析师表插入情况
*/
public interface T20Query {
/**
* 获取真实姓名
* @return
*/
public String getRealName();
/**
* 获取性别
* @return
*/
public Gender getGender();
/**
* 获取出生日期
* @return
*/
public Date getBornDate();
/**
* 获取个人简介
* @return
*/
public String getPersonalIntroduce();
/**
* 获取从业开始时间
* @return
*/
public Date getEmployDate();
/**
* 获取毕业院校
* @return
*/
public String getSchool();
/**
* 获取从业公司
* @return
*/
public String getCompany();
/**
* 获取图像链接
* @return
*/
public String getHeadImgLink();
/**
* 学历
* @return
*/
public Degree getDegree();
}
| [
"2693491512@qq.com"
] | 2693491512@qq.com |
f218c962f7228634597663ded7d064c53427fd2e | 875fbb6435dc066e74a2d21c367396703ff871b0 | /src/main/java/com/squarepolka/readyci/taskrunner/TaskRunnerFactory.java | 0d20690701376b2067e417f53b6dbc3175658bda | [
"BSD-3-Clause"
] | permissive | plummer/readyci | 4fb52b3a5ce2ad95cf2fe14ae2e401870f70264b | 4dcea7f8c52feb690712dd563dfc7d05f79ebd49 | refs/heads/master | 2020-03-23T11:26:49.662352 | 2018-07-19T00:30:36 | 2018-07-19T00:30:36 | 141,504,195 | 0 | 0 | null | 2018-07-19T00:29:27 | 2018-07-19T00:29:27 | null | UTF-8 | Java | false | false | 2,243 | java | package com.squarepolka.readyci.taskrunner;
import com.squarepolka.readyci.configuration.PipelineConfiguration;
import com.squarepolka.readyci.configuration.TaskConfiguration;
import com.squarepolka.readyci.tasks.Task;
import com.squarepolka.readyci.tasks.code.GitCheckout;
import com.squarepolka.readyci.tasks.realci.ConfigurationLoad;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class TaskRunnerFactory {
private List<Task> allTasks;
@Autowired
public TaskRunnerFactory(List<Task> allTasks) {
this.allTasks = allTasks;
}
public TaskRunner createTaskRunner(PipelineConfiguration pipelineConf) {
BuildEnvironment buildEnvironment = new BuildEnvironment(pipelineConf);
TaskRunner taskRunner = new TaskRunner(buildEnvironment, this);
addDefaultTasks(taskRunner);
List<Task> configuredTasks = createTaskListFromConfig(pipelineConf.tasks);
taskRunner.setConfiguredTasks(configuredTasks);
return taskRunner;
}
public List<Task> createTaskListFromConfig(List<TaskConfiguration> taskConfigurations) {
List<Task> taskList = new ArrayList<Task>();
for (TaskConfiguration taskConfiguration : taskConfigurations) {
Task task = findTaskForIdentifier(taskConfiguration.type);
task.configure(taskConfiguration);
taskList.add(task);
}
return taskList;
}
private void addDefaultTasks(TaskRunner taskRunner) {
taskRunner.addDefaultTask(findTaskForIdentifier("build_path_clean"));
taskRunner.addDefaultTask(findTaskForIdentifier("build_path_create"));
taskRunner.addDefaultTask(findTaskForIdentifier(GitCheckout.TASK_CHECKOUT_GIT));
taskRunner.addDefaultTask(findTaskForIdentifier(ConfigurationLoad.TASK_CONFIGURATION_LOAD));
}
private Task findTaskForIdentifier(String taskIdentifer) {
for (Task task : allTasks) {
if (task.taskIdentifier().equalsIgnoreCase(taskIdentifer)) {
return task;
}
}
throw new TaskNotFoundException(taskIdentifer);
}
}
| [
"bclayton@deloitte.com.au"
] | bclayton@deloitte.com.au |
3d570cf8ec8a880b2b0357c9b79ff11edbd6bfb1 | 4e4c86144891ffb18d04c41189574a60a2dcbf7b | /src/main/java/Ej15/Main.java | b7d9ef000fdadd4e549e2f84d4872ef32a2c9438 | [] | no_license | enriquejdd/T6 | b74623ca0eb697867731b24c7cc895dc97db6a0e | 2158454ae29f9949225da610ec403de8fe641549 | refs/heads/master | 2023-03-19T20:53:42.157363 | 2021-03-17T13:46:48 | 2021-03-17T13:46:48 | 340,021,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ej15;
import java.util.ArrayList;
/**
*
* @author enrique
*/
public class Main {
public static void main(String[] args) {
ArrayList<Diputado> diputados = new ArrayList<>();
diputados.add(new Diputado(15, "Cadiz", "P", "Jose", "Muñoz"));
diputados.add(new Diputado(25, "Malaga", "E", "Lucia", "Gutiérrez"));
diputados.add(new Diputado(63, "Madrid", "E", "Antonio", "Garcia"));
diputados.add(new Diputado(5, "Valencia", "E", "Isabel", "Martín"));
ArrayList<Senador> senadores = new ArrayList<>();
senadores.add(new Senador(45, "Cadiz", "P", "Daniel", "Sánchez"));
senadores.add(new Senador(45, "Malaga", "E", "Juan", "Díaz"));
senadores.add(new Senador(45, "Madrid", "I", "Laura", "López"));
senadores.add(new Senador(45, "Valencia", "C", "Ana", "García"));
System.out.println("Diputados");
for (Diputado f : diputados) {
System.out.println(f.toString());
System.out.println(f.getCamara());
}
System.out.println("");
System.out.println("Senadores");
for (Senador f : senadores) {
System.out.println(f.toString());
System.out.println(f.getCamara());
}
}
}
| [
"enriquejdd1999@gmail.com"
] | enriquejdd1999@gmail.com |
0990d14d05fa7eb41acf0cf2036cfc224dfe79a4 | 1dc89d4c7adfd035db89b7267365fc834f325adf | /src/main/java/com/mola/OnlineCatalogProject/service/SendGridEmailService.java | e0294542727d6341c8143bbd99a4090f1fe8fd46 | [] | no_license | M-Laura/OnlineCatalogProject | c096f1745e65637effe9ad9cebe88fa0b675f61a | 7f1ffe85c8d3918194e4fd652b5a7686cddd05a5 | refs/heads/master | 2022-12-30T04:23:48.547495 | 2020-10-15T23:59:28 | 2020-10-15T23:59:28 | 294,438,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,317 | java | package com.mola.OnlineCatalogProject.service;
import com.sendgrid.Method;
import com.sendgrid.Request;
import com.sendgrid.Response;
import com.sendgrid.SendGrid;
import com.sendgrid.helpers.mail.Mail;
import com.sendgrid.helpers.mail.objects.Content;
import com.sendgrid.helpers.mail.objects.Email;
import com.sendgrid.helpers.mail.objects.Personalization;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import java.io.IOException;
@Service
@Slf4j
public class SendGridEmailService {
@Autowired
private SendGrid sendGridClient;
@Autowired
public SendGridEmailService(SendGrid sendGridClient) {
this.sendGridClient = sendGridClient;
}
public void sendText(String from, String to, String subject, String body) {
Response response = sendEmail(from, to, subject, new Content("text/plain", body));
log.info("Status Code: " + response.getStatusCode() + ", Body: " + response.getBody() + ", Headers: "
+ response.getHeaders());
}
public void sendHTML(String from, String to, String subject, String body) {
Response response = sendEmail(from, to, subject, new Content("text/html", body));
log.info("Status Code: " + response.getStatusCode() + ", Body: " + response.getBody() + ", Headers: "
+ response.getHeaders());
}
public void sendHTML(String from, String[] to, String subject, String body) {
Response response = sendEmail(from, to, subject, new Content("text/html", body));
log.info("Status Code: " + response.getStatusCode() + ", Body: " + response.getBody() + ", Headers: "
+ response.getHeaders());
}
private Response sendEmail(String from, String to, String subject, Content content) {
Mail mail = new Mail(new Email(from), subject, new Email(to), content);
Request request = new Request();
Response response = null;
try {
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody(mail.build());
response = this.sendGridClient.api(request);
} catch (IOException ex) {
log.error(ex.getMessage());
}
return response;
}
// send to several receipients
private Response sendEmail(String from, String[] to, String subject, Content content) {
Mail mail = new Mail();
mail.setFrom(new Email(from));
mail.setSubject(subject);
mail.addContent(content);
Personalization personalization = new Personalization();
for (String recipient : to) {
personalization.addTo(new Email(recipient));
}
mail.addPersonalization(personalization);
Request request = new Request();
Response response = null;
try {
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody(mail.build());
response = this.sendGridClient.api(request);
} catch (IOException ex) {
log.error(ex.getMessage());
}
return response;
}
}
| [
"M-Laura@users.noreply.github.com"
] | M-Laura@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.