blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8e121bd81928e7012718e8eb979f266a4359688f | 3478cc4fd904194ecbe8f68bbc6f745438c62e26 | /ProjectManagementToolWebservice/src/java/pkgEntities/Sprint.java | b4895d1533846ceb78cf9b285119f18f0ce5e9fc | [] | no_license | Figgu/ProjectManagementTool | b19b3575153936a18cc3b0f1708a72099265eb29 | f04738779d77c50759ba1be045edc86938634f3d | refs/heads/master | 2021-09-12T12:53:21.354521 | 2018-04-16T22:46:13 | 2018-04-16T22:46:13 | 104,447,477 | 0 | 0 | null | 2018-04-16T22:46:14 | 2017-09-22T07:53:36 | Java | UTF-8 | Java | false | false | 4,201 | 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 pkgEntities;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author alexk
*/
@Entity
@Table(name = "SPRINT03", catalog = "", schema = "D5B03")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Sprint.findAll", query = "SELECT s FROM Sprint s")
, @NamedQuery(name = "Sprint.findBySprintid", query = "SELECT s FROM Sprint s WHERE s.sprintPK.sprintid = :sprintid")
, @NamedQuery(name = "Sprint.findByProjectid", query = "SELECT s FROM Sprint s WHERE s.sprintPK.projectid = :projectid")
, @NamedQuery(name = "Sprint.findByStartdate", query = "SELECT s FROM Sprint s WHERE s.startdate = :startdate")
, @NamedQuery(name = "Sprint.findByEnddate", query = "SELECT s FROM Sprint s WHERE s.enddate = :enddate")})
public class Sprint implements Serializable {
private static final long serialVersionUID = 1L;
private BigDecimal sprintid;
@EmbeddedId
protected SprintPK sprintPK;
@Column(name = "STARTDATE")
@Temporal(TemporalType.TIMESTAMP)
private Date startdate;
@Column(name = "ENDDATE")
@Temporal(TemporalType.TIMESTAMP)
private Date enddate;
@JoinColumn(name = "PROJECTID", referencedColumnName = "PROJECTID", insertable = false, updatable = false)
@ManyToOne(optional = false)
private Project project;
@OneToMany(mappedBy = "sprint")
private Collection<Issue> issueCollection;
public Sprint() {
}
public Sprint(SprintPK sprintPK) {
this.sprintPK = sprintPK;
}
public Sprint(BigInteger sprintid, BigInteger projectid) {
this.sprintPK = new SprintPK(sprintid, projectid);
}
public SprintPK getSprintPK() {
return sprintPK;
}
public void setSprintPK(SprintPK sprintPK) {
this.sprintPK = sprintPK;
}
public Date getStartdate() {
return startdate;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
public Date getEnddate() {
return enddate;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
public Project getProject() {
return project;
}
public void setProject(Project project03) {
this.project = project03;
}
@XmlTransient
public Collection<Issue> getIssueCollection() {
return issueCollection;
}
public BigDecimal getSprintid() {
return sprintid;
}
public void setSprintid(BigDecimal sprintid) {
this.sprintid = sprintid;
}
public void setIssueCollection(Collection<Issue> issueCollection) {
this.issueCollection = issueCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (sprintPK != null ? sprintPK.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Sprint)) {
return false;
}
Sprint other = (Sprint) object;
if ((this.sprintPK == null && other.sprintPK != null) || (this.sprintPK != null && !this.sprintPK.equals(other.sprintPK))) {
return false;
}
return true;
}
@Override
public String toString() {
return "pkgEntities.Sprint[ sprintPK=" + sprintPK + " ]";
}
}
| [
"[email protected]"
] | |
33691f520ee81d5b8b3a961aa08e0d2c73d2cfc6 | cb6513c6bfa7100c95e84a1d333dc678524e550a | /src/com/java/testing/Testing.java | 03078d14d574502de7ad9239877bb1b552e8572d | [] | no_license | parksungjoon/openjava | 29cef9425cb00c8b216a93d79a53200e201ebedd | 029b9d07d3497fdb3d93e5236d2edd3edcd718de | refs/heads/master | 2021-01-10T05:23:22.597709 | 2015-12-04T05:34:02 | 2015-12-04T05:34:02 | 47,382,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package com.java.testing;
public class Testing {
public static void main(String[] args) {
System.out.println("hahahahaha");
}
}
| [
"[email protected]"
] | |
6c6c91ecafd6e335702289fc0a56a7d4fa535810 | 69b75d9e233369288eae9e43709f63b815b257e9 | /app/src/main/java/com/example/foodorderapp/ViewHolder/OrderViewHolder.java | cfdbc5fb9c8ba1d826e39ef7a971696f70546243 | [] | no_license | MJStokes86/FoodOrder | aea06ed27eaff80c74cc09ab4413559ef72aeeb5 | 57366d8f87773cc980d52994cf4aaaca73cdb166 | refs/heads/master | 2022-12-16T21:46:03.343890 | 2020-09-04T01:58:00 | 2020-09-04T01:58:00 | 290,665,454 | 0 | 0 | null | 2020-09-04T02:06:52 | 2020-08-27T03:26:55 | Java | UTF-8 | Java | false | false | 1,217 | java | package com.example.foodorderapp.ViewHolder;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.foodorderapp.Interface.ItemClickListener;
import com.example.foodorderapp.R;
public class OrderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView txtOrderId, txtOrderStatus, txtOrderPhone, txtOrderAddress;
private ItemClickListener itemClickListener;
public OrderViewHolder(@NonNull View itemView) {
super(itemView);
txtOrderAddress = (TextView) itemView.findViewById(R.id.order_address);
txtOrderId = (TextView) itemView.findViewById(R.id.order_id);
txtOrderStatus = (TextView) itemView.findViewById(R.id.order_status);
txtOrderPhone = (TextView) itemView.findViewById(R.id.order_phone);
itemView.setOnClickListener(this);
}
public void setItemClickListener(ItemClickListener itemClickListener) {
this.itemClickListener = itemClickListener;
}
@Override
public void onClick(View view) {
itemClickListener.onClick(view, getAdapterPosition(), false);
}
}
| [
"[email protected]"
] | |
173df5be6caef9dfbd18d17af62607263cdc480d | 9993a2e5334591d21a31d2f9e4bc5fa7f4a8cae3 | /src/main/java/com/freetax/utils/sms/SDKSendTaoBaoSMS.java | 3e5cfce05ffa3afbd3e83dd5dca6f631155d8970 | [] | no_license | stozen/freetax | 906c223779c798a32eb0b0144407d0c8e92388ba | c7b625177b1f310abf62339f21227405a9758244 | refs/heads/master | 2020-06-24T01:34:17.422540 | 2018-01-23T10:08:33 | 2018-01-23T10:08:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,665 | java | package com.freetax.utils.sms;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Author shuxf
* @Date 2017/11/24 9:34
*/
public class SDKSendTaoBaoSMS {
private static Logger log = LoggerFactory.getLogger(SDKSendTaoBaoSMS.class);
private static final String accessKeyId = "LTAINEVbOyw36vwB";
private static final String accessKeySecret = "4A42SZruiDzI09uWtfSGIZmm7qgcgp";
/**
* 发送短信(这里的集成从 阿里大于 改成 阿里云通信)
*
* @param mobile 短信接收号码 (支持单个或多个手机号码) 英文逗号分隔 最多200个
* @param verifyCode 短信验证码
* @param templateCode 短信模板编码
* @return 成功失败 {true|false}
*/
public static Boolean sendSMS(String mobile, String verifyCode, String templateCode) throws ClientException {
//设置超时时间-可自行调整
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "300000");
//初始化ascClient需要的几个参数
final String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改)
final String domain = "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
//初始化ascClient,暂时不支持多region(请勿修改)
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象
SendSmsRequest request = new SendSmsRequest();
//使用post提交
request.setMethod(MethodType.POST);
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
request.setPhoneNumbers(mobile);
//必填:短信签名-可在短信控制台中找到
request.setSignName("少税派");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateCode);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
//友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
request.setTemplateParam("{\"code\":" + verifyCode + "}");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
//request.setOutId("yourOutId");
//请求失败这里会抛ClientException异常
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if(sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")) {
//请求成功
log.info("短信发送成功");
return true;
}else {
log.info("短信发送失败");
return false;
}
}
}
| [
"[email protected]"
] | |
52c42ac83998091a974d80d1a3542aea3e218e6e | ed0a75f03eebb5bdd77cf025dde6a94692afaaad | /ch19_thread/src/com/tj/ex3_object1ThreadN/ThreadEx.java | 0b0edf8a38cdf605ba30b0ca8f318558a6f6adb3 | [] | no_license | warugen/java_study | ec5aea135cf3308efb4a0eaf70406c3e39ebbc9c | ad711a60a3c428cccf25eb5bb0a769647d3df494 | refs/heads/master | 2020-12-19T13:41:53.865251 | 2020-01-23T08:35:30 | 2020-01-23T08:35:30 | 235,749,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package com.tj.ex3_object1ThreadN;
// Thread N개에 객체 1개 공유
public class ThreadEx implements Runnable{
private int num = 0; // 공유 변수
@Override
public void run() {
for (int i = 0; i < 10; i++) {
if(Thread.currentThread().getName().equals("A")) {
System.out.println("~~ ~~ A 쓰레드 실행중 ~~ ~~");
num++;
}
System.out.println(Thread.currentThread().getName()+"의 num = "+ num);
try {
Thread.sleep(500);
} catch (InterruptedException e) {}
}
}
}
| [
"[email protected]"
] | |
87282ad9cc25207b60c88367984793ec0d6ef114 | 299b4cbaf29b4043ab906e69f8b0323a2a20cd6d | /mall-admin/src/main/java/com/macro/mall/service/PmsProductCategoryService.java | 64ce791351a7454b2b29f421faa454b6289f2165 | [
"Apache-2.0"
] | permissive | duxuefen/mall-end-bishe | eb42a2b2f8af4522bb27593c47410d243113383e | 1a3c989704919dd35f93a2c231b174fcb0a6d17b | refs/heads/master | 2023-04-19T03:20:47.285140 | 2021-05-12T05:40:09 | 2021-05-12T05:40:09 | 357,209,401 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,406 | java | package com.macro.mall.service;
import com.macro.mall.dto.PmsProductCategoryParam;
import com.macro.mall.dto.PmsProductCategoryWithChildrenItem;
import com.macro.mall.model.PmsProductCategory;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 商品分类管理Service
* /4/26.
*/
public interface PmsProductCategoryService {
/**
* 创建商品分类
*/
@Transactional
int create(PmsProductCategoryParam pmsProductCategoryParam);
/**
* 修改商品分类
*/
@Transactional
int update(Long id, PmsProductCategoryParam pmsProductCategoryParam);
/**
* 分页获取商品分类
*/
List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum);
/**
* 删除商品分类
*/
int delete(Long id);
/**
* 根据ID获取商品分类
*/
PmsProductCategory getItem(Long id);
/**
* 批量修改导航状态
*/
int updateNavStatus(List<Long> ids, Integer navStatus);
/**
* 批量修改显示状态
*/
int updateShowStatus(List<Long> ids, Integer showStatus);
/**
* 以层级形式获取商品分类
*/
List<PmsProductCategoryWithChildrenItem> listWithChildren();
}
| [
"[email protected]"
] | |
ee2227944ec3382bd6d4831f2870cbaca05bc7bb | 4247bd939c3736a6b5b795c7c4e7a2ffc5e599ed | /gmall-api/src/main/java/com/wang/gmall/bean/PmsSkuImage.java | 3d632468c2c1a997ea103b1311df3c3f6948cdb3 | [] | no_license | weixiao920/gmall | b2e05d542687821b30ddc6c5b0643af727842be0 | 7a0804a35172a0562489c094aeed065e40c28abd | refs/heads/master | 2022-09-10T13:11:19.753370 | 2019-12-07T11:20:15 | 2019-12-07T11:20:15 | 220,762,473 | 1 | 1 | null | 2022-09-01T23:15:35 | 2019-11-10T08:32:46 | CSS | UTF-8 | Java | false | false | 1,257 | java | package com.wang.gmall.bean;
import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
/**
* @param
* @return
*/
public class PmsSkuImage implements Serializable {
@Id
@Column
String id;
@Column
String skuId;
@Column
String imgName;
@Column
String imgUrl;
@Column
String spuImgId;
@Column
String isDefault;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSkuId() {
return skuId;
}
public void setSkuId(String skuId) {
this.skuId = skuId;
}
public String getImgName() {
return imgName;
}
public void setImgName(String imgName) {
this.imgName = imgName;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getSpuImgId() {
return spuImgId;
}
public void setSpuImgId(String spuImgId) {
this.spuImgId = spuImgId;
}
public String getIsDefault() {
return isDefault;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
} | [
"[email protected]"
] | |
2c8217b0005269ccf1dfa953244313ca8308f4b3 | 877035a3a275cde7a01ce6f8e90c7d2c1a1607e8 | /app/src/main/java/com/aharoldk/iak_final/AboutActivity.java | a89403062e04be135b38878883bc611399b86385 | [] | no_license | aharoldk/Cinemaks-XxX | 1ca6877b10ab843b5342eb5bff45bb890c0cc703 | eacac24a2ea68dcd59aa5140e5f568de1de46a0f | refs/heads/master | 2021-01-20T04:01:51.688002 | 2017-08-30T17:22:12 | 2017-08-30T17:22:12 | 101,379,122 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.aharoldk.iak_final;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
}
}
| [
"[email protected]"
] | |
719adc1beafcd1030d7dfd72df31f5ea2dc5a06a | e2780900e9644b45aad4e23965019ebbace8da1b | /code/DeleteDuplicateFromSortedList.java | d605c7bb9afb8bef9b0433e9a81358d53cd7fc07 | [] | no_license | wyou127/code | 0b51a2cae8cad616c3b6b5e35351994931173e2d | f1c12a0a86123d46ac797b50922b4d6385bbc844 | refs/heads/master | 2021-01-22T23:54:33.610956 | 2015-04-07T19:45:11 | 2015-04-07T19:45:11 | 25,708,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package code;
/**
* Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
* Created: 4/6/15 8:11 PM
* Author: <A HREF="mailto:[email protected]">Wei You</A>
*/
public class DeleteDuplicateFromSortedList {
public ListNode deleteDuplicates(ListNode head) {
if (head == null || head.next == null)
return head;
ListNode node = head;
while(node!=null) {
ListNode tmp = node.next;
while(tmp!=null && tmp.val == node.val) {
tmp = tmp.next;
}
node.next = tmp;
node = node.next;
}
return head;
}
}
| [
"[email protected]"
] | |
3f63942cd8d388924540be0cca57cee32f95ea34 | 4f8e948fa9df0ee53cc895dac587d5a0d2ab2899 | /datasource-identifiers/src/main/java/edu/ucdenver/ccp/datasource/identifiers/ensembl/EnsemblGeneID.java | 13634e6c33a0be9ea50c317268cdf360ebef6928 | [] | no_license | tuh8888/datasource | c4ab966fd1a1bbdf8931e9f09b53e05b96e4594a | 9dcfa04a4c099991ed5cd5b36baea27ea1161462 | refs/heads/master | 2020-04-07T14:52:28.765064 | 2017-03-20T14:23:43 | 2017-03-20T14:23:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,148 | java | package edu.ucdenver.ccp.datasource.identifiers.ensembl;
/*
* #%L
* Colorado Computational Pharmacology's common module
* %%
* Copyright (C) 2012 - 2014 Regents of the University of Colorado
* %%
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the Regents of the University of Colorado nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
import edu.ucdenver.ccp.datasource.identifiers.DataSourceIdentifier;
import edu.ucdenver.ccp.datasource.identifiers.DataSource;
public class EnsemblGeneID extends DataSourceIdentifier<String>{
public EnsemblGeneID(String resourceID) {
super(resourceID, DataSource.ENSEMBL);
}
@Override
public String validate(String ensemblID) throws IllegalArgumentException {
return ensemblID;
}
}
| [
"[email protected]"
] | |
68d8a5ac7ccd2d97036ceee9078872cf09ea2d5b | 6be712fecab4ad1f37106da8b92b73bead711453 | /thesis-code/src/org/six11/sf/rec/RecognizedItem.java | d3ba46f96d2fbb6d53fb70138a689b874a8084cd | [] | no_license | florescl/pen-ui | 4283f816eff48a2f212d45014465ed82f1d19b64 | 10f2bde1f6560f367fe2fc21d5d58082295ecfe3 | refs/heads/master | 2021-01-10T11:41:09.676226 | 2012-05-15T17:28:36 | 2012-05-15T17:28:36 | 53,809,129 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,355 | java | package org.six11.sf.rec;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import org.six11.sf.Ink;
import org.six11.sf.Segment;
import org.six11.sf.rec.RecognizerPrimitive.Certainty;
import org.six11.util.pen.Pt;
public class RecognizedItem {
private RecognizedItemTemplate template;
private Map<String, RecognizerPrimitive> subshapes;
// private Map<String, Boolean> flipState;
private Map<String, Certainty> constraints;
private Map<String, Pt> featurePoints;
private Map<String, Object> targets;
private String debugString;
/**
* Instantiate a shape using the given template. This assumes that all the necessary slots are
* present and bound. On exit, all bindings are copied and stored, and constraint certainties are
* recorded.
*
* @param template
* the source template (e.g. 'Arrow')
* @param bindSlot
* names of slots. each element corresponds to elements of bindObj.
* @param bindObj
* values of slots. each element corresponds to elements in bindSlot.
*/
public RecognizedItem(RecognizedItemTemplate template, Stack<String> bindSlot,
Stack<RecognizerPrimitive> bindObj) {
this.template = template;
this.subshapes = new HashMap<String, RecognizerPrimitive>();
this.featurePoints = new HashMap<String, Pt>();
this.constraints = new HashMap<String, Certainty>();
this.targets = new HashMap<String, Object>();
for (String cName : template.getConstraints().keySet()) {
RecognizerConstraint c = template.getConstraints().get(cName);
if (!(c instanceof TypeConstraint)) {
RecognizerPrimitive[] arguments = c.makeArguments(bindSlot, bindObj);
Certainty result = c.check(arguments);
constraints.put(cName, result);
}
}
for (int i = 0; i < bindSlot.size(); i++) {
subshapes.put(bindSlot.get(i), bindObj.get(i));
}
// make a debugging string.
StringBuffer buf = new StringBuffer();
buf.append(subshapes.size() + " shapes: ");
for (String sName : subshapes.keySet()) {
buf.append("[" + sName + "=" + subshapes.get(sName).toString() + " <"
+ subshapes.get(sName).getCert() + ">] ");
}
buf.append(constraints.size() + " constraints: ");
for (String cName : constraints.keySet()) {
buf.append("[" + cName + "=" + constraints.get(cName) + "] ");
}
debugString = template.getName() + " " + buf.toString();
}
public String toString() {
return debugString;
}
public Map<String, Certainty> getCertainties() {
return constraints;
}
public Collection<RecognizerPrimitive> getSubshapes() {
return subshapes.values();
}
public RecognizerPrimitive getSubshape(String name) {
return subshapes.get(name);
}
public RecognizedItemTemplate getTemplate() {
return template;
}
public boolean containsAll(Stack<RecognizerPrimitive> otherShapes) {
return subshapes.values().containsAll(otherShapes);
}
public Pt getFeaturePoint(String key) {
return featurePoints.get(key);
}
public void setFeaturedPoint(String key, Pt pt) {
featurePoints.put(key, pt);
}
public void addTarget(String targetKey, Segment seg) {
targets.put(targetKey, seg);
}
public Segment getSegmentTarget(String targetKey) {
return (Segment) targets.get(targetKey);
}
public boolean conflictsWith(RecognizedItem other) {
boolean conflict = false;
Collection<RecognizerPrimitive> listA = other.getSubshapes();
Collection<RecognizerPrimitive> listB = getSubshapes();
for (RecognizerPrimitive p : listA) {
if (listB.contains(p)) {
conflict = true;
break;
}
}
for (RecognizerPrimitive p : listB) {
if (listA.contains(p)) {
conflict = true;
break;
}
}
return conflict;
}
public Collection<Ink> getInk() {
Collection<Ink> ret = new HashSet<Ink>();
for (RecognizerPrimitive p : getSubshapes()) {
ret.add(p.getInk());
}
return ret;
}
public Collection<Ink> getStrokes() {
Set <Ink> inkStrokes = new HashSet<Ink>();
for (RecognizerPrimitive subshape : subshapes.values()) {
inkStrokes.add(subshape.getInk());
}
return inkStrokes;
}
}
| [
"[email protected]"
] | |
9f1ea5391657ddd4ff62f5c6a042fbebb00243b6 | c2a7c2dc868b350b21276b8a8828f8e3fa3ef08c | /MathKitPlugin/src/ru/ipo/dces/plugins/MyAppletStub.java | c278d960469528ecae2bd2789d61a91c315bf0cf | [] | no_license | stden/cs-javaphp | ea87d5f6d15b41bb520b28a2e145ad3e6ce07ff0 | c325983b911f0be721cd62efa45d5af08a6beb59 | refs/heads/master | 2021-01-10T03:28:26.575525 | 2010-11-21T19:46:38 | 2010-11-21T19:46:38 | 45,978,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,933 | java | package ru.ipo.dces.plugins;
import java.applet.*;
import java.io.File;
import java.net.*;
import java.util.Hashtable;
import javax.swing.JApplet;
public class MyAppletStub implements AppletStub{
AppletContext ac;
Hashtable<String, String> parameters=new Hashtable<String, String>();
JApplet applet;
boolean isActive=false;
public MyAppletStub( JApplet applet,AppletContext ac, Hashtable<String, String> params)
{
this.applet=applet;
this.ac=ac;
this.parameters=params;
}
/*
public void activate(){
isActive=true;
}
public void disactiate(){
isActive=false;
}
*/
public boolean isActive() {
return isActive;
}
public URL getDocumentBase(){
URL url;
try {
String db=(String)parameters.get("documentBase");
File file = new File(db);
url = file.toURI().toURL();
} catch (MalformedURLException e){
System.out.println("Bad URL");
url = null;
}
return url;
}
public URL getCodeBase() {
URL url = null;
try {
String db = parameters.get("documentBase");
File file = new File(db);
url = file.toURI().toURL();
} catch (MalformedURLException e){
System.out.println("Bad URL");
url = null;
}
return url;
}
public String getParameter(String name) {
return parameters.get(name);
}
public AppletContext getAppletContext() {
return ac;
}
public void appletResize(int width, int height) {
System.out.printf("%d x %d\n", width, height);
//Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
//applet.setPreferredSize(new Dimension(660, 500));
}
}
| [
"iposov@7cf9c0ce-a34d-0410-a4ad-6744d85870b3"
] | iposov@7cf9c0ce-a34d-0410-a4ad-6744d85870b3 |
7ebff1f465910c92830a237245f32dfde32e9c8b | 1883c7a36ffd9fd6cc029f03bf042542a38eca6c | /java/src/main/java/org/plos/ned_client/model/Auth.java | 437c07eb7277ce228cf309144b72a16bca5bd104 | [
"MIT"
] | permissive | PLOS/ned-client | 7665b2c5623e991ab4e9f0f638c26bdd5f3b9410 | df6a58ac59c0c4730ee74de67d24a56319f2cbae | refs/heads/develop | 2022-11-24T23:49:05.320335 | 2019-11-18T17:22:15 | 2019-11-18T17:22:15 | 53,693,846 | 1 | 1 | MIT | 2022-11-16T08:59:35 | 2016-03-11T20:09:38 | Python | UTF-8 | Java | false | false | 8,989 | java | package org.plos.ned_client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen")
public class Auth {
private Integer id = null;
private Integer nedid = null;
private String source = null;
private Integer sourcetypeid = null;
private Date created = null;
private Date lastmodified = null;
private Integer createdby = null;
private String createdbyname = null;
private Integer lastmodifiedby = null;
private String lastmodifiedbyname = null;
private String email = null;
private Integer emailid = null;
private String authid = null;
private String plainTextPassword = null;
private String password = null;
private Boolean passwordreset = false;
private String verificationtoken = null;
private Boolean verified = false;
private Boolean isactive = false;
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("nedid")
public Integer getNedid() {
return nedid;
}
public void setNedid(Integer nedid) {
this.nedid = nedid;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("source")
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("sourcetypeid")
public Integer getSourcetypeid() {
return sourcetypeid;
}
public void setSourcetypeid(Integer sourcetypeid) {
this.sourcetypeid = sourcetypeid;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("created")
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("lastmodified")
public Date getLastmodified() {
return lastmodified;
}
public void setLastmodified(Date lastmodified) {
this.lastmodified = lastmodified;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("createdby")
public Integer getCreatedby() {
return createdby;
}
public void setCreatedby(Integer createdby) {
this.createdby = createdby;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("createdbyname")
public String getCreatedbyname() {
return createdbyname;
}
public void setCreatedbyname(String createdbyname) {
this.createdbyname = createdbyname;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("lastmodifiedby")
public Integer getLastmodifiedby() {
return lastmodifiedby;
}
public void setLastmodifiedby(Integer lastmodifiedby) {
this.lastmodifiedby = lastmodifiedby;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("lastmodifiedbyname")
public String getLastmodifiedbyname() {
return lastmodifiedbyname;
}
public void setLastmodifiedbyname(String lastmodifiedbyname) {
this.lastmodifiedbyname = lastmodifiedbyname;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("email")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("emailid")
public Integer getEmailid() {
return emailid;
}
public void setEmailid(Integer emailid) {
this.emailid = emailid;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("authid")
public String getAuthid() {
return authid;
}
public void setAuthid(String authid) {
this.authid = authid;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("plainTextPassword")
public String getPlainTextPassword() {
return plainTextPassword;
}
public void setPlainTextPassword(String plainTextPassword) {
this.plainTextPassword = plainTextPassword;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("password")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("passwordreset")
public Boolean getPasswordreset() {
return passwordreset;
}
public void setPasswordreset(Boolean passwordreset) {
this.passwordreset = passwordreset;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("verificationtoken")
public String getVerificationtoken() {
return verificationtoken;
}
public void setVerificationtoken(String verificationtoken) {
this.verificationtoken = verificationtoken;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("verified")
public Boolean getVerified() {
return verified;
}
public void setVerified(Boolean verified) {
this.verified = verified;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("isactive")
public Boolean getIsactive() {
return isactive;
}
public void setIsactive(Boolean isactive) {
this.isactive = isactive;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Auth auth = (Auth) o;
return Objects.equals(id, auth.id) &&
Objects.equals(nedid, auth.nedid) &&
Objects.equals(source, auth.source) &&
Objects.equals(sourcetypeid, auth.sourcetypeid) &&
Objects.equals(created, auth.created) &&
Objects.equals(lastmodified, auth.lastmodified) &&
Objects.equals(createdby, auth.createdby) &&
Objects.equals(createdbyname, auth.createdbyname) &&
Objects.equals(lastmodifiedby, auth.lastmodifiedby) &&
Objects.equals(lastmodifiedbyname, auth.lastmodifiedbyname) &&
Objects.equals(email, auth.email) &&
Objects.equals(emailid, auth.emailid) &&
Objects.equals(authid, auth.authid) &&
Objects.equals(plainTextPassword, auth.plainTextPassword) &&
Objects.equals(password, auth.password) &&
Objects.equals(passwordreset, auth.passwordreset) &&
Objects.equals(verificationtoken, auth.verificationtoken) &&
Objects.equals(verified, auth.verified) &&
Objects.equals(isactive, auth.isactive);
}
@Override
public int hashCode() {
return Objects.hash(id, nedid, source, sourcetypeid, created, lastmodified, createdby, createdbyname, lastmodifiedby, lastmodifiedbyname, email, emailid, authid, plainTextPassword, password, passwordreset, verificationtoken, verified, isactive);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Auth {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" nedid: ").append(toIndentedString(nedid)).append("\n");
sb.append(" source: ").append(toIndentedString(source)).append("\n");
sb.append(" sourcetypeid: ").append(toIndentedString(sourcetypeid)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" lastmodified: ").append(toIndentedString(lastmodified)).append("\n");
sb.append(" createdby: ").append(toIndentedString(createdby)).append("\n");
sb.append(" createdbyname: ").append(toIndentedString(createdbyname)).append("\n");
sb.append(" lastmodifiedby: ").append(toIndentedString(lastmodifiedby)).append("\n");
sb.append(" lastmodifiedbyname: ").append(toIndentedString(lastmodifiedbyname)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" emailid: ").append(toIndentedString(emailid)).append("\n");
sb.append(" authid: ").append(toIndentedString(authid)).append("\n");
sb.append(" plainTextPassword: ").append(toIndentedString(plainTextPassword)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" passwordreset: ").append(toIndentedString(passwordreset)).append("\n");
sb.append(" verificationtoken: ").append(toIndentedString(verificationtoken)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" isactive: ").append(toIndentedString(isactive)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
ffd13885a75bce93b87e6e1da9b33916a9bf737b | c36e1f2f1712f71cd11c829588ef8e82b09b7ef1 | /java/monkey_foxwan_web/src/com/stang/game/ffd/controller/CreateRaceAction.java | 355864a5357a2d30fd0c43eaa2056e4ecb0c7311 | [] | no_license | CJSDCQS/Monkey-Web-Game | 8b5645c7d5278708679827b956e9ca17d60a93e0 | c2e93001db22df775c9638651d84d9bb2dcdb52a | refs/heads/master | 2021-12-04T08:15:23.863743 | 2014-10-24T09:10:44 | 2014-10-24T09:10:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,223 | java | package com.stang.game.ffd.controller;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import com.opensymphony.xwork2.Action;
import com.stang.game.ffd.client.Client;
import com.stang.game.ffd.common.Config;
import com.stang.game.ffd.entity.detail.GameRaceConfDetail;
import com.stang.game.ffd.service.IGameRaceConfService;
import com.stang.game.ffd.service.impl.GameRaceConfServiceImpl;
public class CreateRaceAction implements Action, ServletResponseAware,
ServletRequestAware {
private HttpServletResponse response;
private HttpServletRequest request;
private String raceName;
private Integer maxNum;
private String startTime;
private Integer teamNum;
private String signUpStartTime;
private String signUpEndTime;
private Integer battleNum;
private String[] map;
private String[] items;
private String tip;
private Integer timeBetweenTwoTace;
private String raceDes;
private Integer batchRaceTime;
private Integer batchRaceSpacing;
private Integer startLevel;
private Integer endLevel;
private Integer signUpMoney;
private Integer signUpMoneyType;
private Integer raceId;
public static Vector<String> cacheKeyList = new Vector<String>();
private static Random random = new Random();
private HashMap<String, Object> infoMap = new HashMap<String, Object>();
public String[] getItems() {
return items;
}
public void setItems(String[] items) {
this.items = items;
}
public Integer getTimeBetweenTwoTace() {
return timeBetweenTwoTace;
}
public void setTimeBetweenTwoTace(Integer timeBetweenTwoTace) {
this.timeBetweenTwoTace = timeBetweenTwoTace;
}
public String delRace() throws Exception{
int raceId=Integer.parseInt(request.getParameter("raceId")+"");
String _cachekey = random.nextLong() + "";
new Client(Config.getConfig("serverip"), 8000).start();
infoMap = new HashMap<String, Object>();
infoMap.put("_guid", 0);
infoMap.put("_cachekey", _cachekey);
infoMap.put("_sig", "robot");
infoMap.put("_serverId", 1);
infoMap.put("_pid", 1);
infoMap.put("_cmd", "gm.delRace");
Map<String, Object> _params = new HashMap<String, Object>();
_params.put("id", raceId);
IGameRaceConfService igrcf = new GameRaceConfServiceImpl();
List<GameRaceConfDetail> grc = igrcf.getGameRaceConfDetail(_params);
if(grc.size()<1){
tip = "没有这场比赛";
return SUCCESS;
}
if(grc.get(0).getFlag()!=1){
tip = "只能删除未报名状态的比赛";
return SUCCESS;
}
infoMap.put("_params", _params);
if (!startSend()) {
tip = "UNKONWN ERROR!";
return SUCCESS;
}
for (int j = 0; j < 5; j++) {
Thread.sleep(500);
// System.out.println(cacheKeyList.size());
if (cacheKeyList.contains(_cachekey)) {
tip = "SEND SUCCESS";
cacheKeyList.remove(_cachekey);
return SUCCESS;
}
Thread.sleep(1000);
}
tip = "SEND FAILURE!";
return SUCCESS;
}
public String execute() throws Exception {
String _cachekey = random.nextLong() + "";
int i = 1;
if ((raceName == null || raceName.equals(""))
|| (maxNum == null || maxNum.equals(""))
|| (startTime == null || startTime.equals(""))
|| (teamNum == null || teamNum.equals(""))
|| (signUpStartTime == null || signUpStartTime.equals(""))
|| (signUpEndTime == null || signUpEndTime.equals(""))
|| (battleNum == null || battleNum.equals(""))
|| (map == null || map.length < 1)
|| (request.getParameter("gifts1") == null)
|| (raceDes == null || raceDes.equals(""))
|| (batchRaceTime == null || batchRaceTime.equals(""))
|| (batchRaceSpacing == null || batchRaceSpacing.equals(""))) {
tip = "ERROR!!WRONG OPERAT";
return SUCCESS;
}
new Client(Config.getConfig("serverip"), 8000).start();
infoMap = new HashMap<String, Object>();
infoMap.put("_guid", 0);
infoMap.put("_cachekey", _cachekey);
infoMap.put("_sig", "robot");
infoMap.put("_serverId", 1);
infoMap.put("_pid", 1);
infoMap.put("_cmd", "gm.createRace");
Map<String, Object> _params = new HashMap<String, Object>();
_params.put("raceName", this.raceName);
_params.put("raceDes", this.raceDes);
_params.put("maxNum", this.maxNum);
_params.put("startTime", this.startTime);
_params.put("teamNum", this.teamNum);
_params.put("signUpStartTime", this.signUpStartTime);
_params.put("signUpEndTime", this.signUpEndTime);
_params.put("battleNum", this.battleNum);
_params.put("map", this.map);
_params.put("items", this.items);
_params.put("timeBetweenTwoTace", this.timeBetweenTwoTace * 1000 * 60);
_params.put("batchRaceTime", this.batchRaceTime);
_params.put("batchRaceSpacing", this.batchRaceSpacing);
_params.put("startLevel", this.startLevel);
_params.put("endLevel", this.endLevel);
_params.put("signUpMoney", this.signUpMoney);
_params.put("signUpMoneyType", this.signUpMoneyType);
// 时间判定
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date sTime = format.parse(this.startTime);
Date signUpStart = format.parse(this.signUpStartTime);
Date signUpEnd = format.parse(this.signUpEndTime);
if (sTime.getTime() < signUpEnd.getTime()
|| signUpEnd.getTime() < signUpStart.getTime()) {
tip = "比赛时间设置顺序出错!!!!!!!!";
return SUCCESS;
}
Map<String, Object> giftMap = new HashMap<String, Object>();
while (request.getParameter("gifts" + i) != null
&& request.getParameter("content" + i) != null
&& request.getParameter("title" + i) != null) {
String gifts[] = request.getParameterValues("gifts" + i);
String content = request.getParameter("content" + i);
String title = request.getParameter("title" + i);
List<Map<String, Integer>> list = new ArrayList<Map<String, Integer>>();
for (String gift : gifts) {
HashMap<String, Integer> map = new HashMap<String, Integer>();
String[] g = gift.split("-");
if (g.length != 4) {
continue;
}
map.put("type", Integer.parseInt(g[0]));
map.put("num", Integer.parseInt(g[1]));
map.put("id", Integer.parseInt(g[2]));
list.add(map);
}
giftMap.put("content" + i, content);
giftMap.put("title" + i, title);
giftMap.put("gifts" + i, list);
i *= 2;
}
_params.put("giftMap", giftMap);
infoMap.put("_params", _params);
if (!startSend()) {
tip = "UNKONWN ERROR!";
return SUCCESS;
}
for (int j = 0; j < 5; j++) {
Thread.sleep(500);
// System.out.println(cacheKeyList.size());
if (cacheKeyList.contains(_cachekey)) {
tip = "SEND SUCCESS";
cacheKeyList.remove(_cachekey);
return SUCCESS;
}
Thread.sleep(1000);
}
tip = "SEND FAILURE!";
return SUCCESS;
}
public String updateRace() throws Exception {
String _cachekey = random.nextLong() + "";
int i = 1;
IGameRaceConfService igrcs = new GameRaceConfServiceImpl();
Map<String,Object> raceMap = new HashMap<String, Object>();
raceMap.put("id", this.raceId);
List<GameRaceConfDetail> grcdList = igrcs.getGameRaceConfDetail(raceMap);
if(grcdList.size()<1){
tip="没有这场比赛~~~";
return SUCCESS;
}
GameRaceConfDetail grcd = grcdList.get(0);
if(grcd.getFlag()!=1){
tip="比赛只能在未开始报名的状态下修改!";
return SUCCESS;
}
if ((raceName == null || raceName.equals(""))
|| (maxNum == null || maxNum.equals(""))
|| (startTime == null || startTime.equals(""))
|| (teamNum == null || teamNum.equals(""))
|| (signUpStartTime == null || signUpStartTime.equals(""))
|| (signUpEndTime == null || signUpEndTime.equals(""))
|| (battleNum == null || battleNum.equals(""))
|| (map == null || map.length < 1)
|| (request.getParameter("gifts1") == null)
|| (raceDes == null || raceDes.equals(""))) {
tip = "ERROR!!WRONG OPERAT";
return SUCCESS;
}
new Client(Config.getConfig("serverip"), 8000).start();
infoMap = new HashMap<String, Object>();
infoMap.put("_guid", 0);
infoMap.put("_cachekey", _cachekey);
infoMap.put("_sig", "robot");
infoMap.put("_serverId", 1);
infoMap.put("_pid", 1);
infoMap.put("_cmd", "gm.updateRace");
Map<String, Object> _params = new HashMap<String, Object>();
_params.put("id", this.raceId);
_params.put("raceName", this.raceName);
_params.put("raceDes", this.raceDes);
_params.put("maxNum", this.maxNum);
_params.put("startTime", this.startTime);
_params.put("teamNum", this.teamNum);
_params.put("signUpStartTime", this.signUpStartTime);
_params.put("signUpEndTime", this.signUpEndTime);
_params.put("battleNum", this.battleNum);
_params.put("map", this.map);
_params.put("items", this.items);
_params.put("timeBetweenTwoTace", this.timeBetweenTwoTace * 1000 * 60);
_params.put("batchRaceTime", this.batchRaceTime);
_params.put("batchRaceSpacing", this.batchRaceSpacing);
_params.put("startLevel", this.startLevel);
_params.put("endLevel", this.endLevel);
_params.put("signUpMoney", this.signUpMoney);
_params.put("signUpMoneyType", this.signUpMoneyType);
// 时间判定
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date sTime = format.parse(this.startTime);
Date signUpStart = format.parse(this.signUpStartTime);
Date signUpEnd = format.parse(this.signUpEndTime);
if (sTime.getTime() < signUpEnd.getTime()
|| signUpEnd.getTime() < signUpStart.getTime()) {
tip = "比赛时间设置顺序出错!!!!!!!!";
return SUCCESS;
}
Map<String, Object> giftMap = new HashMap<String, Object>();
while (request.getParameter("gifts" + i) != null
&& request.getParameter("content" + i) != null
&& request.getParameter("title" + i) != null) {
String gifts[] = request.getParameterValues("gifts" + i);
String content = request.getParameter("content" + i);
String title = request.getParameter("title" + i);
List<Map<String, Integer>> list = new ArrayList<Map<String, Integer>>();
for (String gift : gifts) {
HashMap<String, Integer> map = new HashMap<String, Integer>();
String[] g = gift.split("-");
if (g.length != 4) {
continue;
}
map.put("type", Integer.parseInt(g[0]));
map.put("num", Integer.parseInt(g[1]));
map.put("id", Integer.parseInt(g[2]));
list.add(map);
}
giftMap.put("content" + i, content);
giftMap.put("title" + i, title);
giftMap.put("gifts" + i, list);
i *= 2;
}
_params.put("giftMap", giftMap);
infoMap.put("_params", _params);
if (!startSend()) {
tip = "UNKONWN ERROR!";
return SUCCESS;
}
for (int j = 0; j < 5; j++) {
Thread.sleep(500);
// System.out.println(cacheKeyList.size());
if (cacheKeyList.contains(_cachekey)) {
tip = "SEND SUCCESS";
cacheKeyList.remove(_cachekey);
return SUCCESS;
}
Thread.sleep(1000);
}
tip = "SEND FAILURE!";
return SUCCESS;
}
boolean startSend() {
// int i = 0;
// while (!Client.flag) {
// try {
// Thread.sleep(20);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// i++;
// if (i == 200) {
// return false;
// }
// }
//
// for (i = 0; i < 5; i++) {
//// if (Client.flag && Client.cf.isConnected()) {
//// Client.smcHander.sendData(infoMap);
//// return true;
//// }
//// try {
//// Thread.sleep(300);
//// } catch (InterruptedException e) {
//// e.printStackTrace();
//// }
// }
return false;
}
public void setServletResponse(HttpServletResponse arg0) {
this.response = arg0;
}
public void setServletRequest(HttpServletRequest arg0) {
this.request = arg0;
}
public String getRaceName() {
return raceName;
}
public void setRaceName(String raceName) {
this.raceName = raceName;
}
public Integer getMaxNum() {
return maxNum;
}
public void setMaxNum(Integer maxNum) {
this.maxNum = maxNum;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public Integer getTeamNum() {
return teamNum;
}
public void setTeamNum(Integer teamNum) {
this.teamNum = teamNum;
}
public String getSignUpStartTime() {
return signUpStartTime;
}
public void setSignUpStartTime(String signUpStartTime) {
this.signUpStartTime = signUpStartTime;
}
public String getSignUpEndTime() {
return signUpEndTime;
}
public void setSignUpEndTime(String signUpEndTime) {
this.signUpEndTime = signUpEndTime;
}
public Integer getBattleNum() {
return battleNum;
}
public void setBattleNum(Integer battleNum) {
this.battleNum = battleNum;
}
public String[] getMap() {
return map;
}
public void setMap(String[] map) {
this.map = map;
}
public String getTip() {
return tip;
}
public void setTip(String tip) {
this.tip = tip;
}
public String getRaceDes() {
return raceDes;
}
public void setRaceDes(String raceDes) {
this.raceDes = raceDes;
}
public Integer getBatchRaceTime() {
return batchRaceTime;
}
public void setBatchRaceTime(Integer batchRaceTime) {
this.batchRaceTime = batchRaceTime;
}
public Integer getBatchRaceSpacing() {
return batchRaceSpacing;
}
public void setBatchRaceSpacing(Integer batchRaceSpacing) {
this.batchRaceSpacing = batchRaceSpacing;
}
public Integer getStartLevel() {
return startLevel;
}
public void setStartLevel(Integer startLevel) {
this.startLevel = startLevel;
}
public Integer getEndLevel() {
return endLevel;
}
public void setEndLevel(Integer endLevel) {
this.endLevel = endLevel;
}
public Integer getSignUpMoney() {
return signUpMoney;
}
public void setSignUpMoney(Integer signUpMoney) {
this.signUpMoney = signUpMoney;
}
public Integer getSignUpMoneyType() {
return signUpMoneyType;
}
public void setSignUpMoneyType(Integer signUpMoneyType) {
this.signUpMoneyType = signUpMoneyType;
}
public Integer getRaceId() {
return raceId;
}
public void setRaceId(Integer raceId) {
this.raceId = raceId;
}
}
| [
"[email protected]"
] | |
62f13cca9f137cbf6593e582e8f04feec5af13ac | 2df1d979b983494e10cce3ca2b0b6c3c3093932a | / calipo-samples/calypso_pruebas/src/tk/product/EquityBasket.java | 7f5aa98006567376f7f7a31b2c25fbc567715e5e | [] | no_license | quantbin/calipo-samples | ef9dafec07c9cacb2e77df73624e2a7d57a19390 | 3989ff63fd83f42e296bedacb114a13beffa9af7 | refs/heads/master | 2021-01-17T14:56:20.865462 | 2016-06-08T16:38:58 | 2016-06-08T16:38:58 | 44,826,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,048 | java | package tk.product;
//ejercicio EquityBasket
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* COOKBOOK EXAMPLE:
* How do I create a custom persistent object that does not extend from an
* existing Calypso object?
* -----
* This example is an extension to the Calypso API. It creates a custom
* persistent object that does not extend from an existing Calypso object. This
* particular class is a very simple model of an equity basket, a collection of
* equity names and corresponding weights that represent the percentage of shares
* that each equity contributes to the entire basket. This example is for
* illustrative purposes only, and should not be used to model an actual,
* full-fledged equity basket.
* -----
*
* NOTE ON SERIALIZATION:
* In order for the data server to properly handle EquityBaskiet as a persistent
* object, the class must implement Serializable. In short, serialization is
* the process of converting an object to a stream of bytes. Deserialization is
* the inverse process of reconstructing an object from a stream of bytes.
*
* In general, serialization/deserialization is needed to transfer objects across
* the network (e.g., as arguments in RMI service remote method invocations),
* and it can also be used to store objects in a non-relational (flat) structure
* in a file or database and to later reconstruct those objects in memory.
*
* For the Calypso system in particular, there are many important benefits to the
* data server's use of serialized objects. For example, serialization allows
* the data server to pass the object between the client machine and the database
* via the data server's RemoteAccess RMI service. Furthermore, it allows the
* data server to distribute a single object across multiple machines. Other
* important data server benefits that can be made use of by serializable objects
* include caching, fault-tolerant transaction handling, event generation, data
* security, data authorization, and data auditing and versioning. For more
* information, see the Developer's Guide entry for the Data Server.
*
* For simplicity, this example uses default serialization/deserialization
* (i.e., it does not declare the serialVersionUID field, nor does it implement
* the writeObject or readObject methods). For an example that overrides default
* serialization by implementing Externalizable instead of Serializable, see "How
* do I create and use a custom event?" in the Calypso Cookbook
* (PSEventEquityBasket.java). For further information, see Sun's document,
* "Object Serilization".
*/
@SuppressWarnings({"unchecked","rawtypes"})
public class EquityBasket implements Serializable {
private static final long serialVersionUID = -3350651080498261165L;
protected String _name;
protected String _audit;
protected Hashtable _equityWeights = new Hashtable();
public void setName(String name) {
_name = name;
}
public String getName() {
return _name;
}
public void setAudit(String audit) {
_audit = audit;
}
public String getAudit() {
return _audit;
}
public void addEquityWeight(String equity, double weight) {
_equityWeights.put(equity, new Double(weight));
}
public double getEquityWeight(String equity) {
return((Double) _equityWeights.get(equity)).doubleValue();
}
public Enumeration getEquityNames() {
return _equityWeights.keys();
}
public String toString() {
String s = _name;
Enumeration equityNames = getEquityNames();
while(equityNames.hasMoreElements()) {
String equityName = (String) equityNames.nextElement();
double equityWeight = getEquityWeight(equityName);
s += " " + equityName + ":" + equityWeight;
}
return s;
}
}
| [
"[email protected]"
] | |
3d60bcd4eaea41257c4bf3c8fe28858e83c37b20 | 98e53f3932ecce2a232d0c314527efe49f62e827 | /org.rcfaces.renderkit.html/src/org/rcfaces/renderkit/html/internal/renderer/ImageRenderer.java | 0447dead0badc007fd3033f43360c8ad798fe84d | [] | no_license | Vedana/rcfaces-2 | f053a4ebb8bbadd02455d89a5f1cb870deade6da | 4112cfe1117c4bfcaf42f67fe5af32a84cf52d41 | refs/heads/master | 2020-04-02T15:03:08.653984 | 2014-04-18T09:36:54 | 2014-04-18T09:36:54 | 11,175,963 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,498 | java | /*
* $Id: ImageRenderer.java,v 1.3 2013/11/13 12:53:30 jbmeslin Exp $
*/
package org.rcfaces.renderkit.html.internal.renderer;
import javax.faces.context.FacesContext;
import org.rcfaces.core.component.ImageComponent;
import org.rcfaces.core.image.GeneratedImageInformation;
import org.rcfaces.core.internal.component.IImageAccessors;
import org.rcfaces.core.internal.contentAccessor.BasicGenerationResourceInformation;
import org.rcfaces.core.internal.contentAccessor.IContentAccessor;
import org.rcfaces.core.internal.renderkit.IComponentWriter;
import org.rcfaces.core.internal.renderkit.WriterException;
import org.rcfaces.core.model.IFilterProperties;
import org.rcfaces.renderkit.html.internal.AbstractCssRenderer;
import org.rcfaces.renderkit.html.internal.HtmlTools;
import org.rcfaces.renderkit.html.internal.IHtmlComponentRenderContext;
import org.rcfaces.renderkit.html.internal.IHtmlWriter;
import org.rcfaces.renderkit.html.internal.IJavaScriptRenderContext;
import org.rcfaces.renderkit.html.internal.JavaScriptClasses;
import org.rcfaces.renderkit.html.internal.ns.XhtmlNSAttributes;
/**
*
* @author Olivier Oeuillot (latest modification by $Author: jbmeslin $)
* @version $Revision: 1.3 $ $Date: 2013/11/13 12:53:30 $
*/
@XhtmlNSAttributes({ "filtred", "filterExpression", "blank" })
public class ImageRenderer extends AbstractCssRenderer {
private static final String FILTRED_CONTENT_PROPERTY = "camelia.image.filtredContent";
protected void encodeEnd(IComponentWriter writer) throws WriterException {
IHtmlComponentRenderContext componentRenderContext = (IHtmlComponentRenderContext) writer
.getComponentRenderContext();
FacesContext facesContext = componentRenderContext.getFacesContext();
ImageComponent image = (ImageComponent) componentRenderContext
.getComponent();
IHtmlWriter htmlWriter = (IHtmlWriter) writer;
htmlWriter.startElement(IHtmlWriter.IMG);
writeHtmlAttributes(htmlWriter);
writeJavaScriptAttributes(htmlWriter);
writeCssAttributes(htmlWriter);
writeFirstTooltipClientId(htmlWriter);
GeneratedImageInformation generatedImageInformation = null;
IImageAccessors imageAccessors = (IImageAccessors) image
.getImageAccessors(facesContext);
String url = null;
IContentAccessor contentAccessor = imageAccessors.getImageAccessor();
if (contentAccessor != null) {
generatedImageInformation = new GeneratedImageInformation();
BasicGenerationResourceInformation generationInformation = new BasicGenerationResourceInformation(
componentRenderContext);
IFilterProperties filterProperties = image.getFilterProperties();
generationInformation.setFilterProperties(filterProperties);
url = contentAccessor.resolveURL(facesContext,
generatedImageInformation, generationInformation);
if (generatedImageInformation.isFiltredModel()) {
componentRenderContext.setAttribute(FILTRED_CONTENT_PROPERTY,
Boolean.TRUE);
htmlWriter.writeAttributeNS("filtred", true);
if (filterProperties != null
&& filterProperties.isEmpty() == false) {
String filterExpression = HtmlTools.encodeFilterExpression(
filterProperties, componentRenderContext
.getRenderContext().getProcessContext(),
componentRenderContext.getComponent());
htmlWriter.writeAttributeNS("filterExpression",
filterExpression);
}
}
}
if (url == null) {
url = componentRenderContext.getHtmlRenderContext()
.getHtmlProcessContext()
.getStyleSheetURI(BLANK_IMAGE_URL, true);
htmlWriter.writeAttributeNS("blank", true);
}
htmlWriter.writeSrc(url);
int imageWidth = image.getImageWidth(facesContext);
int imageHeight = image.getImageHeight(facesContext);
if (imageWidth < 0 && imageHeight < 0
&& generatedImageInformation != null) {
imageWidth = generatedImageInformation.getImageWidth();
imageHeight = generatedImageInformation.getImageHeight();
}
if (imageWidth > 0) {
htmlWriter.writeWidth(imageWidth);
}
if (imageHeight > 0) {
htmlWriter.writeHeight(imageHeight);
}
String alternateText = image.getAlternateText(facesContext);
if (alternateText != null) {
htmlWriter.writeAlt(alternateText);
}
htmlWriter.endElement(IHtmlWriter.IMG);
super.encodeEnd(htmlWriter);
}
protected String getJavaScriptClassName() {
return JavaScriptClasses.IMAGE;
}
public void addRequiredJavaScriptClassNames(IHtmlWriter htmlWriter,
IJavaScriptRenderContext javaScriptRenderContext) {
super.addRequiredJavaScriptClassNames(htmlWriter,
javaScriptRenderContext);
if (htmlWriter.getComponentRenderContext().containsAttribute(
FILTRED_CONTENT_PROPERTY)) {
javaScriptRenderContext.appendRequiredClass(
JavaScriptClasses.FILTRED_COMPONENT, "filter");
}
}
} | [
"[email protected]"
] | |
6ada9896dccd8cacc62abd15d2705ec50c6bc3c1 | 54b925c1d6c4219b48addf73304e93fb2016a934 | /app/src/test/java/com/emery/test/tinker/ExampleUnitTest.java | daa01b722e3b3540e8f7513379292d786f974f1d | [] | no_license | ZMNOTZ/tinker | d301b161e3d16e1b1f11f3ef45a4f60eed4bdaef | 6dd169a7885a43bb3506d07a4177d8de1bc50019 | refs/heads/master | 2021-06-27T19:29:19.295851 | 2017-09-16T03:22:16 | 2017-09-16T03:22:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.emery.test.tinker;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
983fc6d8594a4a4b88ff3841ea55b5544615f8e6 | 27ab3e71869a48890e3de4b0fca19793d20fda1b | /library/src/main/java/com/vorlonsoft/android/rate/DialogManager.java | bf4036ae663af110760b5d960c61142ca299bc30 | [
"MIT",
"CC-BY-4.0"
] | permissive | morristech/AndroidRate | 55fe2ca582c48a9bf7041f507c26fb2df97fe8af | 8c883e3108409e6213fd336d713ef6b329a2aedd | refs/heads/master | 2020-03-27T12:57:16.635381 | 2018-08-29T07:01:42 | 2018-08-29T07:01:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,312 | java | /*
* Copyright 2017 - 2018 Vorlonsoft LLC
*
* Licensed under The MIT License (MIT)
*/
package com.vorlonsoft.android.rate;
import android.app.Dialog;
import android.content.Context;
/**
* <p>DialogManager Interface - dialog manager interface of
* the AndroidRate library. You can implements it and use
* {@code AppRate.with(this).setDialogManagerFactory(DialogManager.Factory)]}
* if you want to use fully custom dialog (from support library etc.)</p>
*
* @since 1.0.2
* @version 1.1.9
* @author Alexander Savin
* @author Antoine Vianey
*/
public interface DialogManager {
Dialog createDialog();
/**
* <p>DialogManager.Factory Interface - dialog manager factory interface
* of the AndroidRate library. You can implements it and use
* {@code AppRate.with(this).setDialogManagerFactory(DialogManager.Factory)]}
* if you want to use fully custom dialog (from support library etc.)</p>
*
* @since 1.0.2
* @version 1.1.9
* @author Alexander Savin
* @author Antoine Vianey
*/
interface Factory {
/** Clear DialogManager singleton */
void clearDialogManager();
DialogManager createDialogManager(final Context context, final DialogOptions dialogOptions, final StoreOptions storeOptions);
}
} | [
"[email protected]"
] | |
5378519f41dce9e6faa635bc1ff2d22bf3f4cde4 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-mediaconnect/src/main/java/com/amazonaws/services/mediaconnect/model/UpdateFailoverConfig.java | b7667167a7efed47320db00321b5736b43d73708 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 11,200 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.mediaconnect.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* The settings for source failover.
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFailoverConfig" target="_top">AWS
* API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateFailoverConfig implements Serializable, Cloneable, StructuredPojo {
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*/
private String failoverMode;
/** Recovery window time to look for dash-7 packets */
private Integer recoveryWindow;
/**
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two equally
* prioritized streams.
*/
private SourcePriority sourcePriority;
private String state;
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*
* @param failoverMode
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream,
* allowing graceful recovery from any single-source loss. FAILOVER allows switching between different
* streams.
* @see FailoverMode
*/
public void setFailoverMode(String failoverMode) {
this.failoverMode = failoverMode;
}
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*
* @return The type of failover you choose for this flow. MERGE combines the source streams into a single stream,
* allowing graceful recovery from any single-source loss. FAILOVER allows switching between different
* streams.
* @see FailoverMode
*/
public String getFailoverMode() {
return this.failoverMode;
}
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*
* @param failoverMode
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream,
* allowing graceful recovery from any single-source loss. FAILOVER allows switching between different
* streams.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FailoverMode
*/
public UpdateFailoverConfig withFailoverMode(String failoverMode) {
setFailoverMode(failoverMode);
return this;
}
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*
* @param failoverMode
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream,
* allowing graceful recovery from any single-source loss. FAILOVER allows switching between different
* streams.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FailoverMode
*/
public UpdateFailoverConfig withFailoverMode(FailoverMode failoverMode) {
this.failoverMode = failoverMode.toString();
return this;
}
/**
* Recovery window time to look for dash-7 packets
*
* @param recoveryWindow
* Recovery window time to look for dash-7 packets
*/
public void setRecoveryWindow(Integer recoveryWindow) {
this.recoveryWindow = recoveryWindow;
}
/**
* Recovery window time to look for dash-7 packets
*
* @return Recovery window time to look for dash-7 packets
*/
public Integer getRecoveryWindow() {
return this.recoveryWindow;
}
/**
* Recovery window time to look for dash-7 packets
*
* @param recoveryWindow
* Recovery window time to look for dash-7 packets
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateFailoverConfig withRecoveryWindow(Integer recoveryWindow) {
setRecoveryWindow(recoveryWindow);
return this;
}
/**
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two equally
* prioritized streams.
*
* @param sourcePriority
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two
* equally prioritized streams.
*/
public void setSourcePriority(SourcePriority sourcePriority) {
this.sourcePriority = sourcePriority;
}
/**
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two equally
* prioritized streams.
*
* @return The priority you want to assign to a source. You can have a primary stream and a backup stream or two
* equally prioritized streams.
*/
public SourcePriority getSourcePriority() {
return this.sourcePriority;
}
/**
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two equally
* prioritized streams.
*
* @param sourcePriority
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two
* equally prioritized streams.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateFailoverConfig withSourcePriority(SourcePriority sourcePriority) {
setSourcePriority(sourcePriority);
return this;
}
/**
* @param state
* @see State
*/
public void setState(String state) {
this.state = state;
}
/**
* @return
* @see State
*/
public String getState() {
return this.state;
}
/**
* @param state
* @return Returns a reference to this object so that method calls can be chained together.
* @see State
*/
public UpdateFailoverConfig withState(String state) {
setState(state);
return this;
}
/**
* @param state
* @return Returns a reference to this object so that method calls can be chained together.
* @see State
*/
public UpdateFailoverConfig withState(State state) {
this.state = state.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getFailoverMode() != null)
sb.append("FailoverMode: ").append(getFailoverMode()).append(",");
if (getRecoveryWindow() != null)
sb.append("RecoveryWindow: ").append(getRecoveryWindow()).append(",");
if (getSourcePriority() != null)
sb.append("SourcePriority: ").append(getSourcePriority()).append(",");
if (getState() != null)
sb.append("State: ").append(getState());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UpdateFailoverConfig == false)
return false;
UpdateFailoverConfig other = (UpdateFailoverConfig) obj;
if (other.getFailoverMode() == null ^ this.getFailoverMode() == null)
return false;
if (other.getFailoverMode() != null && other.getFailoverMode().equals(this.getFailoverMode()) == false)
return false;
if (other.getRecoveryWindow() == null ^ this.getRecoveryWindow() == null)
return false;
if (other.getRecoveryWindow() != null && other.getRecoveryWindow().equals(this.getRecoveryWindow()) == false)
return false;
if (other.getSourcePriority() == null ^ this.getSourcePriority() == null)
return false;
if (other.getSourcePriority() != null && other.getSourcePriority().equals(this.getSourcePriority()) == false)
return false;
if (other.getState() == null ^ this.getState() == null)
return false;
if (other.getState() != null && other.getState().equals(this.getState()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getFailoverMode() == null) ? 0 : getFailoverMode().hashCode());
hashCode = prime * hashCode + ((getRecoveryWindow() == null) ? 0 : getRecoveryWindow().hashCode());
hashCode = prime * hashCode + ((getSourcePriority() == null) ? 0 : getSourcePriority().hashCode());
hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
return hashCode;
}
@Override
public UpdateFailoverConfig clone() {
try {
return (UpdateFailoverConfig) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.mediaconnect.model.transform.UpdateFailoverConfigMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
8d3114329306da9b3d9e6d23bc2b4d7213fad875 | 2e110c036c20e879f1ca3ca9f4000d0d8a1dbf93 | /src/lyh/web/school/SelfAction.java | c20dbcb4946e53bcd3c25d6dd9d18798bd045fc6 | [] | no_license | YeRuGeMiMi/StudentLoanBank | 66156d043a0c1ad0da1c3b82dd5fbb2a9626bae1 | 02350899be3493504af70dedab93869780b41804 | refs/heads/master | 2021-01-20T23:31:41.521115 | 2014-11-17T03:05:21 | 2014-11-17T03:05:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,027 | java | package lyh.web.school;
import java.util.HashMap;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import lyh.base.BaseAction;
import lyh.po.school.School;
import lyh.po.user.Member;
import lyh.services.school.SchoolServices;
public class SelfAction extends BaseAction{
private String name;
private String scode;
private String email;
private String address;
private String officetel;
private String fax;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getScode() {
return scode;
}
public void setScode(String scode) {
this.scode = scode;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getOfficetel() {
return officetel;
}
public void setOfficetel(String officetel) {
this.officetel = officetel;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
@Override
public String execute() throws Exception {
Member member = (Member)super.session.get("member");
String method = ServletActionContext.getRequest().getMethod();
School sch = SchoolServices.getOneByUid(member.getUid());
if(sch != null){
super.request.put("school", sch);
return "sucess";
}
if(method.equals("POST")){
Map<String,Object> keys = new HashMap<String, Object>();
keys.put("name", name);
keys.put("scode", scode);
keys.put("email", email);
keys.put("address", address);
keys.put("officetel", officetel);
keys.put("fax", fax);
keys.put("member", member);
int i = SchoolServices.saveOneSchool(keys);
if(!(i>0)){
return "fail";
}{
School school = SchoolServices.getOneByUid(member.getUid());
super.request.put("school", school);
return "sucess";
}
}
return "In";
}
}
| [
"[email protected]"
] | |
f39c41de7665348539776c094f27ef9e9ec4c134 | cf747680dc09aa1d0084833ef3d454761dd22318 | /src/main/java/ru/easyjava/spring/data/jpa/service/GreeterServiceImpl.java | 8e9eec8958008f5d02f5d627a940094226dbd828 | [] | no_license | EasyJavaRu/spring-data-orm-jpa | 6621cd48cf749f76305685691e4b155dfc006d41 | a87aeb32d93bc1fb681ea1215c122ed0a96712d7 | refs/heads/master | 2021-01-12T06:51:36.918608 | 2016-12-19T09:06:58 | 2016-12-19T09:06:58 | 76,846,016 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package ru.easyjava.spring.data.jpa.service;
import org.springframework.stereotype.Service;
import ru.easyjava.spring.data.jpa.dao.GreeterDao;
import ru.easyjava.spring.data.jpa.entity.Greeter;
import javax.inject.Inject;
import java.util.Iterator;
import java.util.List;
/**
* Simple greeter implementation.
*/
@Service
public class GreeterServiceImpl implements GreeterService {
/**
* Our data layer.
*/
@Inject
private GreeterDao dao;
@Override
public final String greet() {
List<Greeter> greets = dao.getGreetings();
Iterator<Greeter> it = greets.iterator();
if (!it.hasNext()) {
return "No greets";
}
Greeter greeter = it.next();
return greeter.getGreeting() + ", " + greeter.getTarget();
}
}
| [
"[email protected]"
] | |
62db9e13a219e230d8d17a8c1d7a58bbc4e84ec4 | 966e02716bfda542e1a22226a677d6c00fa5341a | /main/src/com/apptive/help/ThreeFragment.java | 90c155bdbc40308735d8b444ae91abc8fd467fbe | [] | no_license | dlawogus/INTOLAW_1 | e64879d09e37bf328a5506e2ca61aece004a5c4b | 902a654a20393dd689b43b2c9bb0cce033c7e18a | refs/heads/master | 2016-08-11T10:44:40.043507 | 2016-03-05T18:03:10 | 2016-03-05T18:03:10 | 53,215,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package com.apptive.help;
import com.apptive.intolaw.R;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class ThreeFragment extends Fragment{
public Button right;
public Button left;
public Button cancle;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.help3fragment, container, false);
return v;
}
}
| [
"[email protected]"
] | |
c2618509de1595ed23ae2b73f352565a87705842 | 6dc3e20ab05923c125628df11cceef26b94b39ff | /src/main/java/org/hl7/v3/PRPAMT201302UV02AdministrativeObservationId.java | b18e302a81020ab41ce0b27c29fa8ba71ecb4e66 | [] | no_license | joaoamilcar/barramento-cns | 11ecccaa44a58dec1f8070c81401312d8a9f60ef | 6349bb8c7de8fbf2dc946696380748bd65686c48 | refs/heads/master | 2021-01-10T09:52:42.688073 | 2016-02-25T17:33:21 | 2016-02-25T17:33:21 | 52,538,172 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,740 | java |
package org.hl7.v3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java de PRPA_MT201302UV02.AdministrativeObservation.id complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="PRPA_MT201302UV02.AdministrativeObservation.id">
* <complexContent>
* <extension base="{urn:hl7-org:v3}II">
* <attribute name="updateMode" type="{urn:hl7-org:v3}PRPA_MT201302UV02.AdministrativeObservation.id.updateMode" />
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PRPA_MT201302UV02.AdministrativeObservation.id")
public class PRPAMT201302UV02AdministrativeObservationId
extends II
{
@XmlAttribute(name = "updateMode")
protected PRPAMT201302UV02AdministrativeObservationIdUpdateMode updateMode;
/**
* Obtém o valor da propriedade updateMode.
*
* @return
* possible object is
* {@link PRPAMT201302UV02AdministrativeObservationIdUpdateMode }
*
*/
public PRPAMT201302UV02AdministrativeObservationIdUpdateMode getUpdateMode() {
return updateMode;
}
/**
* Define o valor da propriedade updateMode.
*
* @param value
* allowed object is
* {@link PRPAMT201302UV02AdministrativeObservationIdUpdateMode }
*
*/
public void setUpdateMode(PRPAMT201302UV02AdministrativeObservationIdUpdateMode value) {
this.updateMode = value;
}
}
| [
"[email protected]"
] | |
d172d267192599511a0da4aee218b43cb000277a | b2f07f3e27b2162b5ee6896814f96c59c2c17405 | /javax/management/loading/MLetObjectInputStream.java | 10c11e1b59fb8548c329ac04823e50c4d43f69a8 | [] | no_license | weiju-xi/RT-JAR-CODE | e33d4ccd9306d9e63029ddb0c145e620921d2dbd | d5b2590518ffb83596a3aa3849249cf871ab6d4e | refs/heads/master | 2021-09-08T02:36:06.675911 | 2018-03-06T05:27:49 | 2018-03-06T05:27:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,211 | java | /* */ package javax.management.loading;
/* */
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.io.ObjectInputStream;
/* */ import java.io.ObjectStreamClass;
/* */ import java.io.StreamCorruptedException;
/* */ import java.lang.reflect.Array;
/* */
/* */ class MLetObjectInputStream extends ObjectInputStream
/* */ {
/* */ private MLet loader;
/* */
/* */ public MLetObjectInputStream(InputStream paramInputStream, MLet paramMLet)
/* */ throws IOException, StreamCorruptedException
/* */ {
/* 51 */ super(paramInputStream);
/* 52 */ if (paramMLet == null) {
/* 53 */ throw new IllegalArgumentException("Illegal null argument to MLetObjectInputStream");
/* */ }
/* 55 */ this.loader = paramMLet;
/* */ }
/* */
/* */ private Class<?> primitiveType(char paramChar) {
/* 59 */ switch (paramChar) {
/* */ case 'B':
/* 61 */ return Byte.TYPE;
/* */ case 'C':
/* 64 */ return Character.TYPE;
/* */ case 'D':
/* 67 */ return Double.TYPE;
/* */ case 'F':
/* 70 */ return Float.TYPE;
/* */ case 'I':
/* 73 */ return Integer.TYPE;
/* */ case 'J':
/* 76 */ return Long.TYPE;
/* */ case 'S':
/* 79 */ return Short.TYPE;
/* */ case 'Z':
/* 82 */ return Boolean.TYPE;
/* */ case 'E':
/* */ case 'G':
/* */ case 'H':
/* */ case 'K':
/* */ case 'L':
/* */ case 'M':
/* */ case 'N':
/* */ case 'O':
/* */ case 'P':
/* */ case 'Q':
/* */ case 'R':
/* */ case 'T':
/* */ case 'U':
/* */ case 'V':
/* */ case 'W':
/* */ case 'X':
/* 84 */ case 'Y': } return null;
/* */ }
/* */
/* */ protected Class<?> resolveClass(ObjectStreamClass paramObjectStreamClass)
/* */ throws IOException, ClassNotFoundException
/* */ {
/* 94 */ String str = paramObjectStreamClass.getName();
/* 95 */ if (str.startsWith("["))
/* */ {
/* 97 */ for (int i = 1; str.charAt(i) == '['; i++);
/* */ Class localClass;
/* 99 */ if (str.charAt(i) == 'L') {
/* 100 */ localClass = this.loader.loadClass(str.substring(i + 1, str.length() - 1));
/* */ } else {
/* 102 */ if (str.length() != i + 1)
/* 103 */ throw new ClassNotFoundException(str);
/* 104 */ localClass = primitiveType(str.charAt(i));
/* */ }
/* 106 */ int[] arrayOfInt = new int[i];
/* 107 */ for (int j = 0; j < i; j++) {
/* 108 */ arrayOfInt[j] = 0;
/* */ }
/* 110 */ return Array.newInstance(localClass, arrayOfInt).getClass();
/* */ }
/* 112 */ return this.loader.loadClass(str);
/* */ }
/* */
/* */ public ClassLoader getClassLoader()
/* */ {
/* 120 */ return this.loader;
/* */ }
/* */ }
/* Location: C:\Program Files\Java\jdk1.7.0_79\jre\lib\rt.jar
* Qualified Name: javax.management.loading.MLetObjectInputStream
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
7c61d1852f89ff04f69bc85fee61eb2a5bac0ba7 | 3631ad8f913e4adabc963acc6e26e6783f592d21 | /src/jp/ac/titech/is/wakitalab/apps/scdraw/SDApplet.java | 102cc267fb42272119878f5146bb8ce7573324bf | [] | no_license | wakita/colorscience | 7f26378fb629f8df3ba7d61ad6d65f1e48411022 | 2f0c06aeb78644c653a0fadcb3d3967e56cbc556 | HEAD | 2016-09-06T10:22:42.461884 | 2011-02-05T08:15:09 | 2011-02-05T08:15:09 | 1,152,699 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package jp.ac.titech.is.wakitalab.apps.scdraw;
import javax.swing.JApplet;
public class SDApplet extends JApplet {
public void init() {
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
new SDView(getContentPane());
}
});
} catch (Exception e) {
System.err.println("GUI failed to build successfully.");
}
}
}
| [
"[email protected]"
] | |
03e3122cea333ef398d9e256d07b958a25f8b715 | 95527ee9a8359507d5951bb38ed392885d5f111e | /spring-boot-2-restful/src/main/java/cn/mesie/service/impl/UserServiceImpl.java | 0604a02fd2176ac0eb3492525daca6d5ebaefed8 | [] | no_license | littlemesie/spring-boot-tutorial | 520141760c13d6be496dd059b646d40d502b22af | 53c1a0d59a363dabb4336625382e4099fffd0c60 | refs/heads/master | 2020-04-09T01:59:18.281733 | 2019-04-23T15:40:10 | 2019-04-23T15:40:10 | 159,924,915 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package cn.mesie.service.impl;
import cn.mesie.dao.UserDao;
import cn.mesie.model.User;
import cn.mesie.service.UserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by 2018/12/4 22:50
*
* @author: mesie
*/
@Service
public class UserServiceImpl implements UserService{
@Resource
UserDao userDao;
@Override
public List<User> findAll() {
return userDao.findAll();
}
}
| [
"[email protected]"
] | |
c96f10df70c79566f19814cf6870f493aff96292 | 18069113cd6528b5a538e8540ebeace8d40b0298 | /app/src/main/java/org/tensorflow/lite/examples/detection/Games.java | e0a747d063f1e4144f26db0bff146925ecb040a2 | [] | no_license | Soudipdas/Ghajhini-App | 0f82f19bba31ff19fb74eb186d5a9300282958f4 | 994ff070a8d47e646e6e2bef173b78f57f49b729 | refs/heads/main | 2023-04-11T12:33:31.916356 | 2021-04-23T07:28:26 | 2021-04-23T07:28:26 | 360,797,464 | 1 | 0 | null | 2021-04-23T07:18:06 | 2021-04-23T07:18:06 | null | UTF-8 | Java | false | false | 678 | java | package org.tensorflow.lite.examples.detection;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class Games extends AppCompatActivity {
WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_games);
mWebView = (WebView) findViewById(R.id.webv);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("https://www.improvememory.org/brain-games/memory-games/");
}
} | [
"[email protected]"
] | |
bac720eefff053d36777444b127d5b026b288669 | a4c4caaea368c4836fc09d2b26431782cbe7cb14 | /10/ObjectExpressionTest.java | ce577572383ab733cc3145476e033c83b5e66614 | [] | no_license | antkhorin/Java | 66b62ec4d81320376d40b9b45814245d90fe369e | e80d51f638d9885d529339ed0ca1ef3a414a49c8 | refs/heads/master | 2021-06-24T06:12:42.731276 | 2017-09-09T19:31:42 | 2017-09-09T19:31:42 | 102,980,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,128 | java | import javax.script.ScriptException;
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleUnaryOperator;
import static expression.Util.*;
/**
* @author Georgiy Korneev ([email protected])
*/
public class ObjectExpressionTest extends BaseTest {
public final double D = 1e-4;
protected final Test vx = variable("x", 0);
protected final Test vy = variable("y", 0);
protected final Test vz = variable("z", 0);
protected final Op2<DoubleBinaryOperator> add = op2("new Add", "+", (a, b) -> a + b);
protected final Op2<DoubleBinaryOperator> multiply = op2("new Multiply", "*", (a, b) -> a * b);
protected final Op2<DoubleBinaryOperator> subtract = op2("new Subtract", "-", (a, b) -> a - b);
protected final Op2<DoubleBinaryOperator> divide = op2("new Divide", "/", (a, b) -> a / b);
protected final Op2<DoubleUnaryOperator> neg = op2("new Negate", "negate", a -> -a);
protected final boolean bonus;
protected String toStringMethod = "toString";
protected ObjectExpressionTest(final boolean hard, final boolean bonus) {
super("objectExpression.js", hard, ".evaluate");
this.bonus = bonus;
unary.addAll(list(neg));
binary.addAll(list(add, subtract, multiply, divide));
tests.addAll(list(
op3(cnst(10), (x, y, z) -> 10.0, 1, 1, 1),
op3(vx, (x, y, z) -> x, 1, 1, 1),
op3(vy, (x, y, z) -> y, 1, 1, 1),
op3(vz, (x, y, z) -> z, 1, 1, 1),
op3(add(vx, cnst(2)), (x, y, z) -> x + 2, 1, 1, 1),
op3(sub(cnst(3), vy), (x, y, z) -> 3 - y, 1, 2, 1),
op3(mul(cnst(4), vz), (x, y, z) -> 4 * z, 1, 1, 1),
op3(div(cnst(5), vz), (x, y, z) -> 5 / z, 1, 1, 10),
op3(div(neg(vx), cnst(2)), (x, y, z) -> -x / 2, 4, 1, 1),
op3(div(vx, mul(vy, vz)), (x, y, z) -> x / (y * z), 21, 28, 28),
op3(add(add(mul(vx, vx), mul(vy, vy)), mul(vz, vz)), (x, y, z) -> x * x + y * y + z * z, 5, 5, 5),
op3(sub(add(mul(vx, vx), mul(cnst(5), mul(vz, mul(vz, vz)))), mul(vy, cnst(8))), (x, y, z) -> x * x + 5 * z * z * z - 8 * y, 5, 2, 21)
));
}
protected Test neg(final Test a) { return unary(neg, a); }
protected Test add(final Test a, final Test b) { return binary(add, a, b); }
protected Test sub(final Test a, final Test b) { return binary(subtract, a, b); }
protected Test mul(final Test a, final Test b) { return binary(multiply, a, b); }
protected Test div(final Test a, final Test b) { return binary(divide, a, b); }
@Override
protected void test() {
super.test();
if (hard) {
for (final Op2 t : tests) {
final Op3 test = (Op3) t;
testDiff(test, test.name, false);
testDiff(test, parseMethod + "('" + test.polish + "')", false);
if (bonus) {
testDiff(test, parseMethod + "('" + test.polish + "')", true);
}
}
}
}
private void testDiff(final Op3 test, final String expression, final boolean simplify) {
for (int variable = 0; variable < 3; variable++) {
final String s = expression + ".diff('" + "xyz".charAt(variable) + "')";
final String value = s + (simplify ? ".simplify()" : "");
System.out.println("Testing: " + value);
try {
engine.eval("expr = " + value);
if (simplify) {
final int length = (int) engine.eval("expr." + toStringMethod + "().length");
final int expected = test.simplified[variable];
assertTrue(value + "." + toStringMethod + "().length too long: " + length + " instead of " + expected, length <= expected);
}
} catch (final ScriptException e) {
throw new AssertionError("Script error", e);
}
for (int i = 1; i <= N; i += 1) {
final double di = variable == 0 ? D : 0;
for (int j = 1; j <= N; j += 1) {
final double dj = variable == 1 ? D : 0;
for (int k = 1; k <= N; k += 1) {
final double dk = variable == 2 ? D : 0;
final double expected = (test.f.evaluate(i + di, j + dj, k + dk) - test.f.evaluate(i - di, j - dj, k - dk)) / D / 2;
test(value, new double[]{i, j, k}, "expr", expected, 1e-5);
}
}
}
}
}
@Override
protected String variable(final String name) {
return "new Variable('" + name + "')";
}
@Override
protected String constant(final int value) {
return "new Const(" + value + ")";
}
@Override
protected void test(final String expression, final String polish) {
testToString(expression, polish);
testToString(addSpaces(expression), polish);
}
private void testToString(final String expression, final String expected) {
final String script = expression + "." + toStringMethod + "()";
try {
assertEquals(script, engine.eval(script), expected);
} catch (final ScriptException e) {
throw new AssertionError("Error parsing " + script + "\n" + e.getMessage() + "\n", e);
}
}
public static Op3 op3(final Test test, final TExpression f, final int sx, final int sy, final int sz) {
return new Op3(test.expr, test.polish, f, sx, sy, sz);
}
public static class Op3 extends Op2<TExpression> {
public final int[] simplified;
public Op3(final String name, final String polish, final TExpression f, final int... simplified) {
super(name, polish, f);
this.simplified = simplified;
}
}
public static void main(final String... args) {
final int mode = mode(args, ObjectExpressionTest.class, "easy", "hard", "bonus");
new ObjectExpressionTest(mode >= 1, mode >= 2).test();
}
} | [
"[email protected]"
] | |
39482ce5931035dc779487015d55c0f20d2d49a8 | 90bf374bf58c2b86c23c4b8d0d22af81a2392d7f | /spring-sample/src/main/java/aware/AwareBeanImpl.java | 6ba601aaa4185bac67032ecc83a4206ec3ac5fba | [] | no_license | vks3m2015/java_practice | f0b50e9e3d8119a5b1072ab360ebe17eca6e17da | 576926ce246963727947b33cfcddeaf464989b3c | refs/heads/master | 2023-04-30T04:26:09.815841 | 2022-03-14T14:51:23 | 2022-03-14T14:51:23 | 207,102,960 | 0 | 0 | null | 2023-04-17T19:50:16 | 2019-09-08T11:33:20 | Java | UTF-8 | Java | false | false | 1,325 | java | package aware;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import java.util.Arrays;
public class AwareBeanImpl implements ApplicationContextAware, BeanNameAware, BeanFactoryAware {
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
System.out.println("setBeanFactory method of AwareBeanImpl is called");
//System.out.println("setBeanFactory:: AwareBeanImpl singleton= " + beanFactory.isSingleton("awareBean"));
}
@Override
public void setBeanName(String beanName) {
System.out.println("setBeanName method of AwareBeanImpl is called");
System.out.println("setBeanName:: Bean Name defined in context= " + beanName);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
System.out.println("setApplicationContext method of AwareBeanImpl is called");
System.out.println("setApplicationContext:: Bean Definition Names= "
+ Arrays.toString(applicationContext.getBeanDefinitionNames()));
}
}
| [
"Vikas Singh@DESKTOP-DE78VGG"
] | Vikas Singh@DESKTOP-DE78VGG |
99e47829f1745ff4c0ada073a1a476284ed9523a | 0637ccccc1145432181e70d8dfdf8214df20c9ea | /OOP_proj/src/Professor.java | 14b9589b6476dcc33953831862c4bd37abcb0a8b | [] | no_license | rpecorreia/TheaterSchool | 8819fd07c8b0b9c969061632b89de112131880e3 | 41f01391d536db49bd5b5f6bfd279657ee00c5b4 | refs/heads/main | 2023-03-20T11:32:16.102261 | 2021-03-11T16:59:27 | 2021-03-11T16:59:27 | 346,774,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java |
public class Professor extends Utilizador {
private final static int PROF = 2;
private Disciplina disciplina;
private double salario;
private long nib;
private int numero;
public Professor(String nome, String email, int numero, long nib, double salario, Disciplina disciplina) {
super(nome, email, PROF);
this.disciplina = disciplina;
this.salario = salario;
this.nib = nib;
this.numero = numero;
}
public Disciplina getDisciplina() {
return disciplina;
}
public void setDisciplina(Disciplina disciplina) {
this.disciplina = disciplina;
}
public double getSalario() {
return salario;
}
public void setSalario(double salario) {
this.salario = salario;
}
public long getNib() {
return nib;
}
public void setNib(long nib) {
this.nib = nib;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
@Override
public String toString() {
return "Número: " + getId() + " Nome: " + getNome() + " Email: " + getEmail() + " Salario: " + getSalario() + " Disciplina: ID:" + disciplina.toString();
}
}
| [
"[email protected]"
] | |
29233d1e9fe9939d3bf0c0ff57d873a5a87ba1ff | c9d73a4fe6ab550c74e91895505e6dcf7376b703 | /src/main/java/com/genius/samples/exception/MainClass.java | 4e1f17f03beae617fe0eec1e27336abc56b4bf4a | [] | no_license | mpanicker/java-training-samples | 0f2ca5b6068b801c46e7f0f96890766e67c99f62 | fc1d577f14fc6c89c9dce1fc2ab0e0732d9f51bb | refs/heads/master | 2022-11-25T06:36:00.237420 | 2020-07-31T12:58:19 | 2020-07-31T12:58:19 | 281,659,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package com.genius.samples.exception;
import org.apache.log4j.Logger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class MainClass {
private static String DATABASE_EXCEPTION = "DATABASE_EXCEPTION";
private static final Logger logger = Logger.getLogger(MainClass.class);
public static void main(String[] args) {
try {
makeDatabaseConnection();
} catch (HandledException e) {
// Display custom message to the user
System.out.println("Code: "+e.getCode()+" Exception Message : "+e.getMessage());
// Log the exception detail
logger.error("Exception: ", e);
}
}
static void makeDatabaseConnection() throws HandledException {
String dbURL = "jdbc:sqlserver://localhost\\sqlexpress";
String userName = "sa";
String password = "secret";
Connection conn = null;
try {
conn = DriverManager.getConnection(dbURL, userName, password);
} catch (SQLException e) {
throw new HandledException(DATABASE_EXCEPTION,"Failed to connect to database", e);
}
}
}
| [
"[email protected]"
] | |
27d424a1b9dbb0d15b9f7e277959023170a60a57 | 69ed18f94b2c1caf9742d983f5daf28f40614ca2 | /BomWebPortal/src/com/bomwebportal/dao/WaiveDAO.java | 3268821db0f0578afad7212aa7c8ceaf9812b61f | [] | no_license | RodexterMalinao/springBoard | d1b4f9d2f7e76f63e2690f414863096e3e271369 | aa4bf03395b12d923d28767e1561049c45ee3261 | refs/heads/master | 2020-09-03T07:21:15.415737 | 2019-12-16T07:12:22 | 2019-12-16T07:12:22 | 219,409,720 | 0 | 1 | null | 2019-12-16T07:12:23 | 2019-11-04T03:28:03 | Java | UTF-8 | Java | false | false | 3,017 | java | package com.bomwebportal.dao;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import com.bomwebportal.dto.WaiveLkupDTO;
import com.bomwebportal.exception.DAOException;
public class WaiveDAO extends BaseDAO {
protected final Log logger = LogFactory.getLog(getClass());
public WaiveLkupDTO getWaiveLkupDTO(String reasonType, String reasonCd) throws DAOException {
logger.debug("getWaiveLkupDTO is called");
String sql = " SELECT "
+ " REASON_TYPE, REASON_CD, "
+ " REASON_DESC, "
+ " START_DATE, END_DATE, "
+ " CREATE_BY, CREATE_DATE, "
+ " LAST_UPD_BY, LAST_UPD_DATE "
+ " FROM "
+ " W_WAIVE_LKUP "
+ " WHERE "
+ " REASON_CD=:reasonCd "
+ " AND REASON_TYPE=:reasonType "
;
try {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("reasonType", reasonType);
params.addValue("reasonCd", reasonCd);
List<WaiveLkupDTO> list = this.simpleJdbcTemplate.query(sql,
ParameterizedBeanPropertyRowMapper.newInstance(WaiveLkupDTO.class), params);
return CollectionUtils.isEmpty(list) ? null : list.get(0);
} catch (EmptyResultDataAccessException erdae) {
if (logger.isDebugEnabled()) {
logger.debug("EmptyResultDataAccessException in getWaiveLkupDTO()");
}
return null;
} catch (Exception e) {
logger.info("Exception caught in getWaiveDTO():", e);
throw new DAOException(e.getMessage(), e);
}
}
public List<WaiveLkupDTO> findWaiveLkupByReasonType(String reasonType, Date appDate) throws DAOException {
logger.debug("findWaiveLkupByReasonType is called");
String sql = " SELECT "
+ " REASON_TYPE, REASON_CD, "
+ " REASON_DESC, "
+ " START_DATE, END_DATE, "
+ " CREATE_BY, CREATE_DATE, "
+ " LAST_UPD_BY, LAST_UPD_DATE "
+ " FROM "
+ " W_WAIVE_LKUP "
+ " WHERE "
+ " REASON_TYPE=:reasonType "
+ " AND TRUNC(NVL(:appDate, sysdate)) BETWEEN TRUNC(NVL(START_DATE, sysdate)) AND TRUNC(NVL(END_DATE, sysdate)) "
;
try {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("reasonType", reasonType);
params.addValue("appDate", appDate);
List<WaiveLkupDTO> list = this.simpleJdbcTemplate.query(sql,
ParameterizedBeanPropertyRowMapper.newInstance(WaiveLkupDTO.class), params);
return list;
} catch (EmptyResultDataAccessException erdae) {
if (logger.isDebugEnabled()) {
logger.debug("EmptyResultDataAccessException in findWaiveLkupByReasonType()");
}
return null;
} catch (Exception e) {
logger.info("Exception caught in findWaiveLkupByReasonType():", e);
throw new DAOException(e.getMessage(), e);
}
}
}
| [
"[email protected]"
] | |
473981734c404511b790c346a1dd29db05e64af5 | 86be3298aa9cf1d60da0369756412b5b0978aba9 | /net/minecraft/server/PathfinderGoalRandomTargetNonTamed.java | 902dbc7cbd496657fb583e347fb0bdbf5115cb85 | [] | no_license | mushroomhostage/mc-dev | 30cb3f35e509509087cbe9c172803c02e28351d7 | 9afea7ed76ebdb0741651a6a1477d7177f65cd52 | refs/heads/master | 2021-01-18T05:54:26.351237 | 2012-08-02T03:52:09 | 2012-08-02T04:16:41 | 4,626,480 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package net.minecraft.server;
public class PathfinderGoalRandomTargetNonTamed extends PathfinderGoalNearestAttackableTarget {
private EntityTameableAnimal g;
public PathfinderGoalRandomTargetNonTamed(EntityTameableAnimal entitytameableanimal, Class oclass, float f, int i, boolean flag) {
super(entitytameableanimal, oclass, f, i, flag);
this.g = entitytameableanimal;
}
public boolean a() {
return this.g.isTamed() ? false : super.a();
}
}
| [
"[email protected]"
] | |
3adfa9efc409a832a3ffb9dae7a9e5fdb80d091d | 34b8e226da9f7b8427c43bd1327deb5d129537c1 | /workreport/src/main/java/intersky/workreport/receiver/NewReportReceiver.java | 3e4ce0f182b068e9f91a00fedb0743a400040078 | [] | no_license | xpx456/xpxproject | 11485d4a475c10f19dbbfed2b44cfb4644a87d12 | c19c69bc998cbbb3ebc0076c394db9746e906dce | refs/heads/master | 2021-04-23T08:46:43.530627 | 2021-03-04T09:38:24 | 2021-03-04T09:38:24 | 249,913,946 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,376 | java | package intersky.workreport.receiver;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.Message;
import intersky.appbase.BaseReceiver;
import intersky.workreport.WorkReportManager;
import intersky.workreport.handler.NewReportHandler;
@SuppressLint("NewApi")
public class NewReportReceiver extends BaseReceiver {
public Handler mHandler;
public NewReportReceiver(Handler mHandler)
{
this.mHandler = mHandler;
this.intentFilter = new IntentFilter();
intentFilter.addAction(WorkReportManager.ACTION_REPORT_UPATE_SENDER);
intentFilter.addAction(WorkReportManager.ACTION_REPORT_UPATE_COPYER);
intentFilter.addAction(WorkReportManager.ACTION_REPORT_ADDPICTORE);
intentFilter.addAction(WorkReportManager.ACTION_SET_WORK_CONTENT5);
intentFilter.addAction(WorkReportManager.ACTION_SET_WORK_CONTENT1);
intentFilter.addAction(WorkReportManager.ACTION_SET_WORK_CONTENT2);
intentFilter.addAction(WorkReportManager.ACTION_SET_WORK_CONTENT3);
intentFilter.addAction(WorkReportManager.ACTION_SET_WORK_CONTENT4);
}
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
if (intent.getAction().equals(WorkReportManager.ACTION_REPORT_ADDPICTORE)) {
Message msg = new Message();
msg.what = NewReportHandler.EVENT_ADD_PIC;
msg.obj = intent;
if(mHandler != null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_REPORT_UPATE_SENDER))
{
Message msg = new Message();
msg.what = NewReportHandler.EVENT_SET_SEND;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_REPORT_UPATE_COPYER))
{
Message msg = new Message();
msg.what = NewReportHandler.EVENT_SET_COPY;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_SET_WORK_CONTENT5))
{
Message msg = new Message();
msg.obj = intent.getStringExtra("value");
msg.what = NewReportHandler.EVENT_WORK_SET_CONTENT5;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_SET_WORK_CONTENT1))
{
Message msg = new Message();
msg.obj = intent.getStringExtra("value");
msg.what = NewReportHandler.EVENT_WORK_SET_CONTENT1;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_SET_WORK_CONTENT2))
{
Message msg = new Message();
msg.obj = intent.getStringExtra("value");
msg.what = NewReportHandler.EVENT_WORK_SET_CONTENT2;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_SET_WORK_CONTENT3))
{
Message msg = new Message();
msg.obj = intent.getStringExtra("value");
msg.what = NewReportHandler.EVENT_WORK_SET_CONTENT3;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
else if(intent.getAction().equals(WorkReportManager.ACTION_SET_WORK_CONTENT4))
{
Message msg = new Message();
msg.obj = intent.getStringExtra("value");
msg.what = NewReportHandler.EVENT_WORK_SET_CONTENT4;
if(mHandler!=null)
mHandler.sendMessage(msg);
}
}
}
| [
"[email protected]"
] | |
e2aff262f61221dbeb87a4b340be9b4ae4f5b93f | 3652d751657cc6e98207eb120bfcc7beef3b36ad | /hooktrack/src/main/java/com/slib/hooktrack/ResourceReader.java | 676c2aa2b08d15d4c59c782b1dd5bab0258a5dec | [] | no_license | Vincent-Lei/UILearn | 0c90a6e7c0eaab457407f6fc44862f2be303dcd8 | 1876cc84a609cd5897057b74cbc0b02981ccb96e | refs/heads/master | 2020-04-10T03:54:51.126311 | 2019-12-12T10:24:22 | 2019-12-12T10:24:22 | 160,782,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,706 | java | package com.slib.hooktrack;
import android.content.Context;
import android.util.SparseArray;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
public abstract class ResourceReader implements ResourceIds {
public static class Ids extends ResourceReader {
private volatile static Ids sInstance = null;
public static Ids getInstance(Context context) {
if (sInstance == null) {
synchronized (Ids.class) {
if (sInstance == null && context != null) {
sInstance = new Ids(context.getPackageName(), context);
}
}
}
return sInstance;
}
private Ids(String resourcePackageName, Context context) {
super(context);
mResourcePackageName = resourcePackageName;
initialize();
}
@Override
protected Class<?> getSystemClass() {
return android.R.id.class;
}
@Override
protected String getLocalClassName(Context context) {
return mResourcePackageName + ".R$id";
}
private final String mResourcePackageName;
}
public static class Layouts extends ResourceReader {
public Layouts(String resourcePackageName, Context context) {
super(context);
mResourcePackageName = resourcePackageName;
initialize();
}
@Override
protected Class<?> getSystemClass() {
return android.R.layout.class;
}
@Override
protected String getLocalClassName(Context context) {
return mResourcePackageName + ".R$layout";
}
private final String mResourcePackageName;
}
@SuppressWarnings("unused")
public static class Drawables extends ResourceReader {
protected Drawables(String resourcePackageName, Context context) {
super(context);
mResourcePackageName = resourcePackageName;
initialize();
}
@Override
protected Class<?> getSystemClass() {
return android.R.drawable.class;
}
@Override
protected String getLocalClassName(Context context) {
return mResourcePackageName + ".R$drawable";
}
private final String mResourcePackageName;
}
ResourceReader(Context context) {
mContext = context;
mIdNameToId = new HashMap<>();
mIdToIdName = new SparseArray<>();
}
@Override
public boolean knownIdName(String name) {
return mIdNameToId.containsKey(name);
}
@Override
public int idFromName(String name) {
return mIdNameToId.get(name);
}
@Override
public String nameForId(int id) {
return mIdToIdName.get(id);
}
private static void readClassIds(Class<?> platformIdClass, String namespace, Map<String, Integer> namesToIds) {
try {
final Field[] fields = platformIdClass.getFields();
Class fieldType;
String name;
int value;
for (final Field field : fields) {
final int modifiers = field.getModifiers();
if (Modifier.isStatic(modifiers)) {
fieldType = field.getType();
if (fieldType == int.class) {
name = field.getName();
value = field.getInt(null);
namesToIds.put((namespace == null ? name : namespace + ":" + name), value);
}
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
protected abstract Class<?> getSystemClass();
protected abstract String getLocalClassName(Context context);
void initialize() {
mIdNameToId.clear();
mIdToIdName.clear();
// final Class<?> sysIdClass = getSystemClass();
// readClassIds(sysIdClass, "android", mIdNameToId);
final String localClassName = getLocalClassName(mContext);
try {
final Class<?> rIdClass = Class.forName(localClassName);
readClassIds(rIdClass, null, mIdNameToId);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
for (Map.Entry<String, Integer> idMapping : mIdNameToId.entrySet()) {
mIdToIdName.put(idMapping.getValue(), idMapping.getKey());
}
}
private final Context mContext;
private final Map<String, Integer> mIdNameToId;
private final SparseArray<String> mIdToIdName;
}
| [
"[email protected]"
] | |
fa914587650fce653520a0780ca1f58f049d03ec | ddfe6f4ad53cd58768bfce17d045f1b4f4d9e640 | /src/main/java/com/example/demo/repository/UniversityRepository.java | 919351b28240af4bd1c42ee61eb760f60582cd47 | [] | no_license | RuthMaina/DistributedObjectsCat1 | eee433653ce283f8365a4d4792a4437c71601e42 | e1b5aa32c70f1f689ed3a0f499c7dad2d797af36 | refs/heads/master | 2020-08-01T16:02:35.276211 | 2019-10-17T11:24:44 | 2019-10-17T11:24:44 | 211,041,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.example.demo.repository;
import com.example.demo.model.University;
import org.springframework.data.jpa.repository.JpaRepository;
/*
Generics
create repository with object University with the ID which is a type long
Its the model class name with the unique identifier which is a long
*/
public interface UniversityRepository extends JpaRepository<University, Long>{
}
| [
"[email protected]"
] | |
ff950b95e6709ce5b594a66d04e2dc95903d1ceb | c5283b2e9b247407d4fe877d766bd41a8ff02410 | /src/main/java/club/wadreamer/cloudlearning/model/custom/NoticeCourse.java | ec3d8de5c8abf43223f887e34fff1609843a9b7d | [] | no_license | wadreamer/cloudlearning | 7da5c9143ca1cc318ce8c0eb20c7cee384173b87 | a5602a0ec7d1ae26b5f92fd1ab0f0b2231eb668c | refs/heads/master | 2022-11-11T08:55:46.886565 | 2020-06-26T02:44:58 | 2020-06-26T02:44:58 | 273,382,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,058 | java | package club.wadreamer.cloudlearning.model.custom;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* @ClassName NoticeCourse
* @Description TODO
* @Author bear
* @Date 2020/5/2 17:31
* @Version 1.0
**/
public class NoticeCourse {
private Integer ncid; // 学生的课程公告主键
private String publisher; // 发布者
private String cname; // 公告的课程名
private String topic; // 公告的主题
private String content; // 公告的内容
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", locale = "zh", timezone = "GMT+8")
private Date publishDate; // 公告发布时间
private Integer status; // 公告的阅读状态
private Integer nid; // 公告主键
public NoticeCourse() {
}
public NoticeCourse(String publisher, Integer nid) {
this.publisher = publisher;
this.nid = nid;
}
public Integer getNid() {
return nid;
}
public void setNid(Integer nid) {
this.nid = nid;
}
public Integer getNcid() {
return ncid;
}
public void setNcid(Integer ncid) {
this.ncid = ncid;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
| [
"[email protected]"
] | |
f443f034371f826fdc273f1e24dc1cd9bca26587 | 7f20b1bddf9f48108a43a9922433b141fac66a6d | /coreplugins/tags/parent-2.8.0-beta1/linkout/src/main/java/linkout/LinkOutPlugin.java | e8e5eeddcc8087f1bf45a7719c46278f2bd498e5 | [] | no_license | ahdahddl/cytoscape | bf783d44cddda313a5b3563ea746b07f38173022 | a3df8f63dba4ec49942027c91ecac6efa920c195 | refs/heads/master | 2020-06-26T16:48:19.791722 | 2013-08-28T04:08:31 | 2013-08-28T04:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,122 | java | /*$Id$*/
package linkout;
import cytoscape.*;
import cytoscape.plugin.*;
import ding.view.*;
import java.util.*;
/**
* Linkout plugin for customized url links
* this is the old implementation of the plugin using previous node context menu
**
public class LinkOutPlugin
extends
CytoscapePlugin
implements
PropertyChangeListener {
public LinkOutPlugin () {
Cytoscape.getDesktop().getSwingPropertyChangeSupport().addPropertyChangeListener( CytoscapeDesktop.NETWORK_VIEW_CREATED, this );
System.out.println("Initialized LinkOutPlugin");
}
//Note - This implementation does not work with the cytoscape-2.3
//see 'TooltipsAndContextMenusForRender' on Cytoscape wiki for future implementation
//
public void propertyChange ( PropertyChangeEvent e ) {
if ( e.getPropertyName() == CytoscapeDesktop.NETWORK_VIEW_CREATED ) {
CyNetworkView view = ( CyNetworkView )e.getNewValue();
//Add LinkOut Menu
//TODO- check the bool return value
view.addContextMethod("class phoebe.PNodeView",//phoebe class is part of the GINY graph library
// the package name
"csplugins.mskcc.doron.LinkOut",
"AddLinks", //method name
new Object[] {view}, // arguments
CytoscapeInit.getClassLoader() ); // the class load
}
}
}
*************************/
/**
* LinkOut plugin for customized URL links
* **/
public class LinkOutPlugin extends CytoscapePlugin {
/**
* Creates a new LinkOutPlugin object.
*/
public LinkOutPlugin() {
try {
//Create a Network create event listener
LinkOutNetworkListener m_listener = new LinkOutNetworkListener();
Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(m_listener);
// Create a new ContextMenuListener and register with the pre-loaded networks.
// Cases where networks are loaded before the plugins. For example, when running Cytoscape
// from the command line.
//Todo - To be tested
Set networkSet = Cytoscape.getNetworkSet();
for (Iterator it = networkSet.iterator(); it.hasNext();) {
CyNetwork cyNetwork = (CyNetwork) it.next();
LinkOutNodeContextMenuListener nodeMenuListener = new LinkOutNodeContextMenuListener();
((DGraphView) Cytoscape.getNetworkView(cyNetwork.getIdentifier()))
.addNodeContextMenuListener(nodeMenuListener);
LinkOutEdgeContextMenuListener edgeMenuListener = new LinkOutEdgeContextMenuListener();
((DGraphView) Cytoscape.getNetworkView(cyNetwork.getIdentifier()))
.addEdgeContextMenuListener(edgeMenuListener);
}
/*
DGraphView currentNetwork=((DGraphView)Cytoscape.getCurrentNetworkView());
if(currentNetwork!=null){
LinkOutNodeContextMenuListener nodeMenuListener=new LinkOutNodeContextMenuListener();
currentNetwork.addNodeContextMenuListener(nodeMenuListener);
LinkOutEdgeContextMenuListener edgeMenuListener=new LinkOutEdgeContextMenuListener();
currentNetwork.addEdgeContextMenuListener(edgeMenuListener);
}
*/
} catch (ClassCastException e) {
cytoscape.logger.CyLogger.getLogger(LinkOutPlugin.class).error(e.getMessage());
return;
}
}
}
/*
$Log: LinkOutPlugin.java,v $
Revision 1.1 2006/06/14 18:12:46 mes
updated project to actually compile and work with ant
Revision 1.4 2006/06/12 19:27:44 betel
Fixes to bug reports 346-links to missing labels, 637-linkout fix for command line mode
Revision 1.3 2006/05/19 21:51:29 betel
New implementation of LinkOut with network-view listener
Revision 1.1 2006/05/11 22:42:28 betel
Initial deposit of linkout to pre-coreplugins
Revision 1.2 2006/05/09 22:32:47 betel
New implementation of LinkOutPlugin with new context menu interface and addition of linkout.props
Revision 1.1 2006/05/08 17:15:22 betel
Initial deposit of linkout source code
*/
| [
"mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] | mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5 |
900bf9d0f2029238983d8c4af3b188e2b24c4865 | f09e7e5b76f15003cd649c2cb83ddda5f00646d8 | /deltastreamedittextcontroller/src/main/java/com/deltastream/example/edittextcontroller/spans/UnderlineSpan.java | 4c7043dc78fcd00e12e1b524c066529b28b82ea2 | [] | no_license | darmilola/EstelloV1 | 6e6ccf735ac6f8b7a1fc3bbab8efe294a92c7307 | 8775ad26e26b939ff0cbdae60abb0fa9c9d17671 | refs/heads/master | 2023-03-18T08:51:31.917100 | 2021-03-13T15:46:18 | 2021-03-13T15:46:18 | 308,169,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,061 | java | /*
* Copyright (C) 2015-2018 Emanuel Moecklin
*
* 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.deltastream.example.edittextcontroller.spans;
/**
* Our custom UnderlineSpan.
* We need this to be able to distinguish between underlining done by the app and underlining
* inserted by e.g. a spell checker or a keyboard with auto-complete function.
*/
public class UnderlineSpan extends android.text.style.UnderlineSpan implements RTSpan<Boolean> {
@Override
public Boolean getValue() {
return Boolean.TRUE;
}
}
| [
"[email protected]"
] | |
5ee7e0819495d474e033b750427b54d220250fca | 513b58e53066b37b7b5c657f983209ce5c9ec336 | /app/src/main/java/com/gsb/alexa/gsbappli/MainActivity.java | dbc756a648c62d5b0aa3e89f18382c8fdf52a710 | [] | no_license | MadKidTm/AndroidApp | 0aadc29d45c7743d494b8874e03df6988d632d86 | f809ee26418fa25714cd6f39acdf95990bdfdc43 | refs/heads/master | 2020-03-08T08:36:32.507647 | 2018-04-14T17:29:50 | 2018-04-14T17:29:50 | 128,025,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,074 | java | package com.gsb.alexa.gsbappli;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.icu.util.Calendar;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.gsb.alexa.gsbappli.Classes.DAOBaseGSB;
import com.gsb.alexa.gsbappli.Classes.Database;
import com.gsb.alexa.gsbappli.Classes.FamilleDAO;
import com.gsb.alexa.gsbappli.Classes.MedecinDAO;
import com.gsb.alexa.gsbappli.Classes.MedicamentDAO;
import com.gsb.alexa.gsbappli.Classes.RapportDAO;
import com.gsb.alexa.gsbappli.Classes.Visiteur;
import com.gsb.alexa.gsbappli.Classes.VisiteurDAO;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MainActivity extends Activity {
private Button login = null;
private EditText id = null;
private EditText password = null;
private TextView idInfo = null;
private TextView passwordInfo = null;
private Context context = this;
private String[] tableauVisiteur = new String[9];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login = findViewById(R.id.login);
id = findViewById(R.id.id);
password = findViewById(R.id.password);
idInfo = (TextView)findViewById(R.id.idInfo);
passwordInfo = (TextView)findViewById(R.id.passwordInfo);
password.addTextChangedListener(textWatcher);
id.addTextChangedListener(textWatcher);
FamilleDAO familleDAO = new FamilleDAO(context);
MedicamentDAO medicamentDAO = new MedicamentDAO(this);
//familleDAO.insertFamille("antalgique");
//familleDAO.insertFamille("anti-inflamatoire");
//familleDAO.insertFamille("antibiotique");
//medicamentDAO.insertLignes("doliprane",familleDAO.getIdFamille("antalgique"),"paracetamol", "traitement douleurs", "enfant de moins de 6ans" );
//medicamentDAO.insertLignes("neurofen",familleDAO.getIdFamille("anti-inflamatoire"),"ibuprofene", "traitement fièvre", "émoragie gastro intestinale" );
//medicamentDAO.insertLignes("orelox",familleDAO.getIdFamille("antibiotique"),"cefpodoxime", "traitement sinusite aigue", "allergie betalactamines" );
//familleDAO.selectFamille();
//medicamentDAO.selectLignes();
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
VisiteurDAO visiteurDAO = new VisiteurDAO(context);
Visiteur visiteur ;
//visiteurDAO.insertLigne("TOMASIA", "Alex","talex", "buga1994", "16 avenue du trident", "06300", "Nice", "2018-03-20");
String idText = id.getText().toString();
String pwText = password.getText().toString();
System.out.println(idText);
System.out.println(pwText);
//System.out.println("visiteur : "+ visiteur.getNom()+" "+visiteur.getPrenom());
if(idText.length() == 0){
Toast.makeText(context, "Veuillez entrer votre identifiant", Toast.LENGTH_LONG).show();
}
if(idText.length() != 0 && pwText.length() != 0){
if(visiteurDAO.isConnectionOK(idText,pwText)){
tableauVisiteur = visiteurDAO.selectLigne(idText, pwText);
visiteur = new Visiteur(Long.valueOf(tableauVisiteur[0]),
tableauVisiteur[1],
tableauVisiteur[2],
tableauVisiteur[3],
tableauVisiteur[4],
tableauVisiteur[5],
tableauVisiteur[6],
tableauVisiteur[7],
tableauVisiteur[8]);
id.setText("");
password.setText("");
Intent i = new Intent(MainActivity.this, MainMenuActivity.class);
i.putExtra("com.gsb.alexa.gsbappli.Classes.Visiteur", visiteur);
startActivity(i);
}
}
//Intent i = new Intent(MainActivity.this, MainMenuActivity.class);
//startActivity(i);
}
});
}
private TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
}
};
}
| [
"[email protected]"
] | |
192632ef07e92e3fceca80101066036694a301f7 | 8fc42c9f162dca2fc868df89fb1385cbd061013d | /app/src/main/java/anthony/uteq/mlkittestant/utiles/Methods.java | 3e69389c2454764da5bb1645f490492a8e33c9c6 | [] | no_license | ANTHONYPACHAY/ML_KIT_Test_ANT | 0500652f3353864a4147aa5f1c1ed77c1136ce3e | 9ea8122d09231a602ed9e233d5a22989f55d6e45 | refs/heads/master | 2023-06-28T23:34:15.673636 | 2021-07-29T03:53:46 | 2021-07-29T03:53:46 | 390,265,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,372 | java | package anthony.uteq.mlkittestant.utiles;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author tonyp * This java class contains the methods used within the back-end
* of the application.
*/
public final class Methods {
public static String getJsonMessage(String status, String information, String data) {
return "{\"status\":" + status + ",\"information\":\"" + information + "\",\"data\":" + data + "}";
}
/**
* This method is for the security application.
*
* @param email String type variable, contains the email.
* @return a String, for the security request.
*/
public static Boolean comprobeEmail(String email) {
Pattern pat = Pattern.compile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$");//".*@uteq.edu.ec"
Matcher mat = pat.matcher(email);
if (mat.matches()) {
return (email.length() <= 100);// length in database
} else {
return false;
}
}
public static Boolean comprobePassword(String pass) {
Pattern pat = Pattern.compile("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])\\w{6,}");///^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])\w{6,}/
Matcher mat = pat.matcher(pass);
return mat.matches();// length in database
}
/**
* Convert from string to json.
*
* @param json String type variable, contains the json to be converted.
* @return a json.
*/
public static JsonObject stringToJSON(String json) {
try {
JsonParser parser = new JsonParser();
JsonObject Jso = parser.parse(json).getAsJsonObject();
return Jso;
} catch (Exception e) {
System.out.println(e.getMessage());
return new JsonObject();
}
}
/**
* Convert from string to json.
*
* @param json String type variable, contains the json to be converted.
* @return a json.
*/
public static JsonArray stringToJsonArray(String json) {
try {
JsonParser parser = new JsonParser();
JsonArray jsa = parser.parse(json).getAsJsonArray();
return jsa;
} catch (Exception e) {
System.out.println(e.getMessage());
return new JsonArray();
}
}
/**
* Convert from string to json.
*
* @param json String type variable, contains the json to be converted.
* @return a json.
*/
public static JsonElement stringToJSON2(String json) {
try {
JsonElement parser = new JsonPrimitive(json);
System.out.println(parser.getAsString());
//JsonObject Jso = new JsonObject();
//Jso = (JsonObject) parser.p(json);
return parser;
} catch (Exception e) {
return new JsonObject();
}
}
/**
* Get a part of the json.
*
* @param jso Variable type json, contains the information.
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @return a json, divided.
*/
public static JsonElement securGetJSON(JsonObject jso, String param) {
try {
JsonElement res = jso.get(param);//request.getParameter(param);
return res;
} catch (Exception e) {
return null;
}
}
/**
* Method to divide a json.
*
* @param jso Variable type json, contains the information.
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @param defaulx String type variable, return variable
* @return Return a String, with the json divided.
*/
public static String JsonToSub(JsonObject jso, String param, String defaulx) {
try {
JsonElement res = securGetJSON(jso, param);
if (res != null) {
return res.toString();
} else {
return defaulx;
}
} catch (Exception e) {
return defaulx;
}
}
/**
* A sub json of a json.
*
* @param jso Variable type json, contains the information.
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @return a json.
*/
public static JsonObject JsonToSubJSON(JsonObject jso, String param) {
try {
JsonElement res = securGetJSON(jso, param);
if (res != null) {
return res.getAsJsonObject();
} else {
return new JsonObject();
}
} catch (Exception e) {
return new JsonObject();
}
}
/**
* From json to array.
*
* @param jso Variable type json, contains the information.
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @return a jsonArray, with data loaded
*/
public static JsonArray JsonToArray(JsonObject jso, String param) {
try {
JsonArray jarr = jso.get(param).getAsJsonArray();
if (jarr != null) {
return jarr;
} else {
return new JsonArray();
}
} catch (Exception e) {
// System.out.println("erro json a string");
return new JsonArray();
}
}
public static String[] JsonToStringVecttor(JsonObject jso, String param) {
Gson gson = new Gson();
try {
String[] jarr = gson.fromJson(jso.get(param), String[].class);
if (jarr != null) {
return jarr;
} else {
return new String[]{};
}
} catch (Exception e) {
// System.out.println("erro json a string");
return new String[]{};
}
}
/**
* From json to String
*
* @param jso Variable type json, contains the information.
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @param defaulx String type variable, return variable
* @return a String, with data loaded from the json.
*/
public static String JsonToString(JsonObject jso, String param, String defaulx) {
try {
JsonElement res = securGetJSON(jso, param);
if (res != null) {
String result = res.getAsString();
result = result.trim().replace("\n", "\\n").replace("\t", "\\t").replace("'", "''");
return result;
} else {
return defaulx;
}
} catch (Exception e) {
// System.out.println("erro json a string");
return defaulx;
}
}
public static JsonObject objectToJson(Object jsonO) {
try {
return (JsonObject) jsonO;
} catch (Exception e) {
return new JsonObject();
}
}
public static JsonArray objectToJsonArray(Object jsonarrayO) {
try {
return (JsonArray) jsonarrayO;
} catch (Exception e) {
return new JsonArray();
}
}
public static String JsonToStringWithFormat(JsonObject jso, String param, String defaulx) {
try {
JsonElement res = securGetJSON(jso, param);
if (res != null) {
String result = res.getAsString();
return result;
} else {
return defaulx;
}
} catch (Exception e) {
// System.out.println("erro json a string");
return defaulx;
}
}
/**
* Obtain an element from a Json, and store it in a String variable.
*
* @param jse The variable type JsonElement, contains the information.
* @param defaulx String type variable, contains the element of the selected
* json.
* @return a variable of type String, selected element of the json.
*/
public static String JsonElementToString(JsonElement jse, String defaulx) {
try {
if (jse != null) {
return jse.getAsString();
} else {
return defaulx;
}
} catch (Exception e) {
return defaulx;
}
}
/**
* from JsonElement to json.
*
* @param jse Variable type jsonElement, contains an element of another
* json.
* @return an object-type json
*/
public static JsonObject JsonElementToJSO(JsonElement jse) {
try {
if (jse != null) {
return jse.getAsJsonObject();
} else {
return new JsonObject();
}
} catch (Exception e) {
return new JsonObject();
}
}
/**
* from json to Integer.
*
* @param jso Variable type json, contains the information
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @param defaulx String type Integer, return variable
* @return an integer, the variable is defaulx.
*/
public static int JsonToInteger(JsonObject jso, String param, int defaulx) {
try {
JsonElement res = securGetJSON(jso, param);
if (res != null) {
return res.getAsInt();
} else {
return defaulx;
}
} catch (Exception e) {
return defaulx;
}
}
/**
* from json to boolean
*
* @param jso Variable type json, contains the information
* @param param String type variable, contains the name of the json
* parameter to be divided.
* @param defaulx String type Boolean, return variable
* @return an Boolean, the variable is defaulx.
*/
public static Boolean JsonToBoolean(JsonObject jso, String param, boolean defaulx) {
try {
JsonElement res = securGetJSON(jso, param);
if (res != null) {
return res.getAsBoolean();
} else {
return defaulx;
}
} catch (Exception e) {
return defaulx;
}
}
/**
* Convert from string to integer, and then convert back to string.
*
* @param number String type variable, contains an integer to validate.
* @return Returns a string, validating if it is integer.
*/
public static String StringToIntegerString(String number) {
int num;
try {
num = Integer.parseInt(number);
} catch (Exception e) {
num = -1;
}
return String.valueOf(num);
}
public static boolean isInteger(String number) {
try {
int num = Integer.parseInt(number);
return true;
} catch (Exception e) {
return false;
}
}
public static boolean JsonValid(String json) {
try {
JsonParser parser = new JsonParser();
JsonElement jse = parser.parse(json);
boolean flag1 = false, flag2 = false;
try {
jse.getAsJsonObject();
flag1 = true;
} catch (Exception e) {
flag1 = false;
}
try {
jse.getAsJsonArray();
flag2 = true;
} catch (Exception e) {
flag2 = false;
}
return (flag1 || flag2);
} catch (Exception e) {
// System.out.println(e.getMessage());
return false;
}
}
public static Boolean isValidCoordinates(String coordinatesValue) {
//Longitud es coordenadas X, Latitud es coordeadas Y
String twoDoublesRegularExpression = "-?[1-9][0-9]*(\\.[0-9]+)?,\\s*-?[1-9][0-9]*(\\.[0-9]+)?";
return coordinatesValue.matches(twoDoublesRegularExpression);
}
public static Boolean testregex(String pattern, String text) {
Pattern pat = Pattern.compile(pattern);
Matcher mat = pat.matcher(text);
return mat.matches();
}
public static Boolean verifyString(String text, String unEqString, int length) {
if (!text.equals(unEqString)) {
// -1 para indicar que no existe un maxlength
if (length > -1) {
return (text.length() <= length);
} else {
return true;
}
}
return false;
}
public static Boolean verifyMaxLength(String text, int length) {
return (text.length() <= length);
}
public static int wordsCount(String text, String spaces) {
int contador = 1, pos;//**METODO PIRATEADO XD
text = text.trim(); //eliminar los posibles espacios en blanco al principio y al final
if (text.isEmpty()) { //si la cadena está vacía
contador = 0;
} else {
pos = text.indexOf(spaces); //se busca el primer espacio en blanco
while (pos != -1) { //mientras que se encuentre un espacio en blanco
contador++; //se cuenta una palabra
pos = text.indexOf(spaces, pos + spaces.length()); //se busca el siguiente espacio en blanco
} //a continuación del actual
}
return contador;
}
public static Boolean verifyMaxWords(String text, int length, String spaces) {
int contador = wordsCount(text, spaces);
return (contador > 0 && contador <= length);
}
public static Boolean verifyParraf(String text, int length, String spaces) {
int contador = wordsCount(text, spaces);
return (contador <= length);
}
public static JsonObject getIndixJarray(JsonArray jarr, int indice) {
if (indice > -1 && indice < jarr.size()) {
try {
return jarr.get(indice).getAsJsonObject();
} catch (Exception e) {
return new JsonObject();
}
} else {
return new JsonObject();
}
}
}
| [
"="
] | = |
849136824448f63fefbe7affa4b951a18c8dd6ec | f94c447fe353acea9e1389be9b355ecb84249c00 | /src/main/java/head/first/design/pattern/rule/adapter/v1/DuckTestDrive.java | aefd1222a99b294aff081742c39f80753541293f | [
"Unlicense"
] | permissive | ppzxc/HeadFirstDesignPattern | 45fa3e5ec84e7cd1a798aeff7c3adfa81682d51a | 42ae5ae928b6eb6b6a9509568ab531876f040316 | refs/heads/master | 2021-09-11T17:46:15.033671 | 2018-04-10T13:23:36 | 2018-04-10T13:23:36 | 118,101,606 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package head.first.design.pattern.rule.adapter.v1;
public class DuckTestDrive {
public static void main(String[] args) {
MallardDuck duck = new MallardDuck();
WildTurkey turkey = new WildTurkey();
Duck turkeyAdapter = new TurkeyAdapter(turkey);
System.out.println("Turkey Say");
turkey.gobble();
turkey.fly();
System.out.println("\nDuck Say");
testDuck(duck);
System.out.println("\nTurkeyAdapter Say");
testDuck(turkeyAdapter);
}
static void testDuck(Duck duck) {
duck.quack();
duck.fly();
}
}
| [
"[email protected]"
] | |
9a110f672d01cd3a50e5eafdb99c16595cbe3dce | 8c83d42755d45ee26000bee9b01abca8c8bdd502 | /app/src/main/java/com/rjyx/webviewdemo/impi/IsIphone.java | 5efa982a08e1b9c8d7258bcc49401fa9adede8b6 | [] | no_license | zhaozhao-ak/WebViewDemo | 05bed2ec5478f05e24fd2615107f0f95a4a8e3e7 | c557b1800f0fd4186f44588075e04390999896c4 | refs/heads/master | 2020-04-16T18:04:41.071023 | 2019-01-15T07:11:16 | 2019-01-15T07:11:16 | 165,802,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.rjyx.webviewdemo.impi;
import org.json.JSONException;
import org.json.JSONObject;
import com.rjyx.webviewdemo.api.FCDeviceApi;
import com.rjyx.webviewdemo.jsbridge.CallBackFunction;
import android.app.Activity;
public class IsIphone extends BaseImpl{
public IsIphone(Activity activity) {
super(activity);
// TODO Auto-generated constructor stub
}
public void isIphone(CallBackFunction responseCallback){
this.setResponseCallback(responseCallback);
JSONObject outputs = new JSONObject();
try {
outputs.put("result","NO");
successCallback(FCDeviceApi.ACTION_ISIPHONE,outputs);
} catch (JSONException e) {
e.printStackTrace();
faileCallback(FCDeviceApi.ACTION_ISIPHONE,e.getMessage());
}
}
}
| [
"Rjyx@123"
] | Rjyx@123 |
5c7be63e544d74840162fcf9d7993dfb381093e1 | d4fd84b44ab049a4ed1827d1c192ebfca3677b1a | /app/src/main/java/com/example/unistud/Helpers/UserAdapter.java | 47288f1aa993a7eafd048b50f45c9ca48adb7255 | [
"MIT"
] | permissive | aurelhoxha/UniStud | c64a3610e7821223bf7a29c0122700131b5d9029 | 547ec6c7877f02d41a8573374987acd279131a07 | refs/heads/master | 2020-04-28T17:41:40.474123 | 2019-05-12T19:47:59 | 2019-05-12T19:47:59 | 175,454,936 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,698 | java | package com.example.unistud.Helpers;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.unistud.R;
import com.squareup.picasso.Picasso;
import java.util.List;
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
private Context mContext;
private List<Student> mStudents;
public UserAdapter(Context mContext, List<Student> mStudents){
this.mStudents = mStudents;
this.mContext = mContext;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.user_item, parent, false);
return new UserAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
Student student = mStudents.get(i);
viewHolder.username.setText(student.getFullname());
Picasso.get().load(student.getProfile_photo()).into(viewHolder.profile_image);
}
@Override
public int getItemCount() {
return mStudents.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView username;
public ImageView profile_image;
public ViewHolder(View itemView){
super(itemView);
username = itemView.findViewById(R.id.username);
profile_image = itemView.findViewById(R.id.profile_image);
}
}
}
| [
"[email protected]"
] | |
a2dd031f2384b3e0ed2c7c72c6f88f661846e217 | b752a99077c3d7dba1e8aca4301456c2607ed072 | /AP/src/main/java/edu/bionic/sverkunov/com/DAODB3/interfaces/BusinessAnalystDAOI.java | 1ee48e813c7fd9b861791f80bf9695f90dd8b0f4 | [] | no_license | underey/Alfama | 1cab3f1bafd9927fcef476819aadd3805033b281 | ce891e709cf7c4f920c491023db5cbb397403d68 | refs/heads/master | 2021-01-15T14:29:08.184030 | 2015-01-20T11:09:31 | 2015-01-20T11:09:31 | 29,525,459 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package edu.bionic.sverkunov.com.DAODB3.interfaces;
import java.sql.Timestamp;
import java.util.List;
import edu.bionic.sverkunov.com.DAODB3.classes.Menusection;
import edu.bionic.sverkunov.com.DAODB3.classes.PeriodTotalReport;
public interface BusinessAnalystDAOI {
public PeriodTotalReport getPeriodTotalReport(Timestamp from, Timestamp until);
public PeriodTotalReport getDailyReport(Timestamp from, Timestamp until,
int menuSection);
public List<Menusection> getMenusection();
}
| [
"[email protected]"
] | |
bd2da4ffecc65f58a1a91f66bde75b0d59773948 | 8e0dc6f1d31fd0624164fa92639983bc424a12c3 | /app/src/main/java/com/example/madhaviruwandika/teacher_assistant/Model/GroupMessage.java | d1c57883baec2c246cfd7454a005876ad19a9d49 | [] | no_license | madhavi93/Teacher-Assistant-App | 26c1bd00d5ae25a93f65047bd7bd98baf8929e8a | 7efcbc6b4b50b03fa917993465212efccc3019d8 | refs/heads/master | 2021-06-21T18:26:38.359543 | 2017-08-26T10:44:29 | 2017-08-26T10:44:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,824 | java | package com.example.madhaviruwandika.teacher_assistant.Model;
/**
* Created by Madhavi Ruwandika on 5/2/2016.
*/
public class GroupMessage {
private int Message_ID;
private int Msg_type;
private String DateOfMsg;
private String Content;
private int Class_Id;
private int No_Of_Recip;
public GroupMessage(int msg_type, String dateOfMsg, String content, int class_Id, int no_Of_Recip) {
Msg_type = msg_type;
DateOfMsg = dateOfMsg;
Content = content;
Class_Id = class_Id;
No_Of_Recip = no_Of_Recip;
}
public GroupMessage(int message_ID, int msg_type, String dateOfMsg, String content, int class_Id, int no_Of_Recip) {
Message_ID = message_ID;
Msg_type = msg_type;
DateOfMsg = dateOfMsg;
Content = content;
Class_Id = class_Id;
No_Of_Recip = no_Of_Recip;
}
public GroupMessage() {
}
public int getMessage_ID() {
return Message_ID;
}
public void setMessage_ID(int message_ID) {
Message_ID = message_ID;
}
public int getMsg_type() {
return Msg_type;
}
public void setMsg_type(int msg_type) {
Msg_type = msg_type;
}
public String getDateOfMsg() {
return DateOfMsg;
}
public void setDateOfMsg(String dateOfMsg) {
DateOfMsg = dateOfMsg;
}
public String getContent() {
return Content;
}
public void setContent(String content) {
Content = content;
}
public int getClass_Id() {
return Class_Id;
}
public void setClass_Id(int class_Id) {
Class_Id = class_Id;
}
public int getNo_Of_Recip() {
return No_Of_Recip;
}
public void setNo_Of_Recip(int no_Of_Recip) {
No_Of_Recip = no_Of_Recip;
}
}
| [
"[email protected]"
] | |
24178fff784930355a7c5da0e83285a0c90d9a6d | 849aa8a3787f0d24bb925ce9cfa6dffd432a6500 | /test/CompositeTest.java | 866aeefb32a8b72282c8266ee91f5e5d8958861d | [] | no_license | chayes1987/DesignPatternsCA | 522d740b71427c2192fcac764bd3dae168aa7ab5 | 1a31c5456a67f245acb1cd2d911cc9a58d776462 | refs/heads/master | 2020-06-05T14:08:18.168920 | 2015-01-07T18:13:14 | 2015-01-07T18:13:14 | 30,409,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | import composite.*;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
/**
* Created by Conor on 17/12/2014.
*/
public class CompositeTest {
@Test
public void TestComposite(){
Level level = new Level("One", "Test", new ArrayList<LevelComponent>());
Assert.assertEquals("One", level.getLevel());
Assert.assertEquals("Test", level.getLevelDescription());
Objective objective1 = new Objective("Kill 5 Enemies");
Assert.assertEquals("Kill 5 Enemies", objective1.getObjective());
}
}
| [
"[email protected]"
] | |
d27684993f1c0bee99556a052009a493d2cb3cd1 | be2da1256619024a0b43c314e94842f72fc0486a | /imbra/src/com/inmost/novoda/imageloader/core/cache/LruBitmapCache.java | 528a676d2c3fb3a90c6f3b1c224e557c6b523d82 | [] | no_license | xingyes/inmost | 1c66a6a1df0e5eb442db14c5cba7c5e6d0c54c24 | f5ff4342cc913248be4dd158e0e504a7710dc19a | refs/heads/master | 2021-01-20T11:01:30.034115 | 2015-07-16T06:51:33 | 2015-07-16T06:51:33 | 40,540,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,933 | java | /**
* Copyright 2012 Novoda Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.inmost.novoda.imageloader.core.cache;
import android.app.ActivityManager;
import android.content.Context;
import android.graphics.Bitmap;
import com.inmost.imbra.util.GlobalImageCache;
import com.inmost.imbra.util.GlobalImageCache.BitmapDigest;
import com.inmost.novoda.imageloader.core.cache.util.LruCache;
import com.xingy.util.SDKUtils;
import com.xingy.util.ToolUtil;
/**
* LruBitmapCache overcome the issue with soft reference cache. It is in fact keeping all the certain amount of images in memory. The size of the memory used for cache depends on the memory that the
* android SDK provide to the application and the percentage specified (default percentage is 25%).
*/
public class LruBitmapCache {
public static final int DEFAULT_MEMORY_CACHE_PERCENTAGE = 25;
private static final int DEFAULT_MEMORY_CAPACITY_FOR_DEVICES_OLDER_THAN_API_LEVEL_4 = 12;
/**
* 1M多少字节
*/
private static final long ONE_M_BYTES = 1024L * 1024L;
private LruCache<BitmapDigest, Bitmap> cache;
private long capacity;
/**
* It is possible to set a specific percentage of memory to be used only for images.
*
* @param context
* @param percentageOfMemoryForCache
* 1-80
*/
public LruBitmapCache(Context context, int percentageOfMemoryForCache) {
ActivityManager manager = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE));
int memClass = 0;
if(SDKUtils.isSDKVersionMoreThan16()) {
memClass = ToolUtil.getMemoryClass(manager);
}
if (memClass == 0) {
memClass = DEFAULT_MEMORY_CAPACITY_FOR_DEVICES_OLDER_THAN_API_LEVEL_4;
}
if (percentageOfMemoryForCache < 0) {
percentageOfMemoryForCache = 0;
}
if (percentageOfMemoryForCache > 81) {
percentageOfMemoryForCache = 80;
}
this.capacity = (memClass * percentageOfMemoryForCache) / 100L;
if (this.capacity <= 0) {
this.capacity = 4;
}
// else if (this.capacity > MAX_IMAGE_MEMERY_CACHE) {
// this.capacity = MAX_IMAGE_MEMERY_CACHE;
// }
this.capacity = this.capacity * ONE_M_BYTES;
reset();
}
/**
* Setting the default memory size to 25% percent of the total memory available of the application.
*
* @param context
*/
public LruBitmapCache(Context context) {
this(context, DEFAULT_MEMORY_CACHE_PERCENTAGE);
}
private void reset() {
if (cache != null) {
cache.evictAll();
}
cache = new LruCache<BitmapDigest, Bitmap>(capacity) {
@Override
protected long sizeOf(BitmapDigest key, Bitmap bitmap) {
return bitmap.getWidth() * bitmap.getHeight() * 4L;
}
@Override
protected void entryRemoved(boolean evicted, BitmapDigest key, Bitmap oldValue, Bitmap newValue) {
if (key.isAllowRecycle()) {
cache.remove(key);
}
if (evicted) {
GlobalImageCache.remove(key);
}
}
};
}
public Bitmap get(BitmapDigest bd) {
return cache.get(bd);
}
public void put(BitmapDigest bd, Bitmap bmp) throws NullPointerException {
cache.put(bd, bmp);
}
public void clean() {
// 由于发现重置后再次加载会出现闪屏(画出来立即被回收又重新画)的问题,使用cleanMost后会感觉好一点
// reset();
// recycleMemery();
cleanMost();
}
public void cleanMost() {
//直接清除 图片内存缓存
recycleMemery();
long maxSize = Math.round(capacity * 0.5D);
cache.evict(maxSize);
}
private void recycleMemery() {
System.gc();
}
public void remove(BitmapDigest bd) {
cache.remove(bd);
}
// /**
// * 批量图片回收器
// * @author tandingqiang
// */
// public static class BitmapRecycleTask extends Thread {
//
// private ArrayList<Bitmap> queue = new ArrayList<Bitmap>();
// private boolean hasStarted = false;
//
// /**
// * 添加一个需要回收的图片数据
// */
// public void recycleBitmap(Bitmap bitmap) {
// synchronized (recycleTask) {
// queue.add(bitmap);
// recycleTask.notify();
// if(Log.D) {
// Log.d(LruBitmapCache.class.getName(),"recycleBitmap hasStarted : " + hasStarted);
// }
// if (!hasStarted) {
// hasStarted = true;
// start();
// }
// if(Log.D) {
// Log.d(LruBitmapCache.class.getName(),"recycleBitmap starting........");
// }
// }
// }
//
// @Override
// public void run() {
// while (needAlive) {
// try {
// Bitmap bitmap = null;
// synchronized (recycleTask) {
// if (queue.size() < 1) {
// System.gc();
// if(Log.D) {
// Log.d(LruBitmapCache.class.getName(), "wating for more task......");
// }
// recycleTask.wait();
// }
// bitmap = queue.remove(0);
// }
// if(Log.D) {
// Log.d(LruBitmapCache.class.getName(), "thread has be notify, " + bitmap + " wanted be recyle");
// }
// if (bitmap != null && !bitmap.isRecycled()) {
// //调用这个方法容易引起异常,不能强制调用图片回收器,
// //bitmap.recycle();
// System.gc();
// if(Log.D) {
// Log.d(LruBitmapCache.class.getName(), bitmap + " has recyled");
// }
// }
// } catch (Throwable e) {
// if (Log.E) {
// e.printStackTrace();
// }
// }
// }
// }
//
// }
//
// /**
// * 退出图片回收线程
// */
// public static void quit() {
// needAlive = false;
// synchronized (recycleTask) {
// recycleTask.notify();
// }
// }
}
| [
"[email protected]"
] | |
731739ff1fc7f95a5a5cec09673b734f0853579c | eb2fceb2e22c54cc001b76beea7e7dd3b6830087 | /java course/worksapce_java/JavaExam/src/day10/Circle.java | a43a18038d852db00ccd159237a2393003c54194 | [] | no_license | kdg0109/multicampus_course | e0591ae6579359b0accc10babeeccedf696e71c8 | a14d6013a5ffd3a7fec4419ecb1bd2f1a7ea351d | refs/heads/master | 2020-03-07T13:32:20.849013 | 2019-03-22T01:55:35 | 2019-03-22T01:55:35 | 127,503,539 | 6 | 0 | null | null | null | null | UHC | Java | false | false | 130 | java | package day10;
public class Circle implements Drawable {
public void draw() {
System.out.println("원을 그립니다.");
}
} | [
"[email protected]"
] | |
517efa8b1a6c54f8ca53c099132c300956ea469d | 263bcaef4505656ad428f631ad18f7afc3fa13ee | /cms/src/main/java/com/xlauncher/dao/RoleDao.java | 025e31f0f9c5161b44b081b4632456e534bd5c40 | [] | no_license | baishuailei666/Tiangong | 629c4de4d9e2007b3e5f53406e4086878b49013e | f7b297553fe02ffb424c8181bde49f2f394135ca | refs/heads/master | 2020-05-07T05:55:33.913171 | 2019-04-09T05:49:40 | 2019-04-09T05:49:40 | 180,292,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,755 | java | package com.xlauncher.dao;
import com.xlauncher.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 角色Dao层,包括角色添加,角色修改,角色删除,角色信息检索
* @author mao ye
* @since 2018-05-07
* Copyright: @V0.5
* Company: www.xlauncher.com
*/
@Service
public interface RoleDao {
/**
* 添加角色
* @param role 完整的角色信息
* @return 添加操作影响的数据库行数
*/
int insertRole(Role role);
/**
* 初始化用户-超级管理员
* @param role 完整的角色信息
* @return 添加操作影响的数据库行数
*/
int rootRole(Role role);
/**
* 角色名称查重
* @param roleName 角色名
* @return 已存在返回1,可用返回0
*/
int countRoleName(@Param("roleName") String roleName);
/**
* 删除角色
* @param roleId 需要删除的角色的编号
* @return 删除操作影响的数据库行数
*/
int deleteRole(int roleId);
/**
* 更新角色信息
* @param role 更新的角色的信息
* @return 更新操作影响的数据库行数
*/
int updateRole(Role role);
/**
* 角色信息检索(具体条件待定)
* @return 满足条件的一个角色信息列表
*/
List<Role> listRole();
/**
* 通过角色编号查询角色信息
* @param roleId 角色编号
* @return 角色的完整信息
*/
Role getRoleById(int roleId);
/**
* 通过角色编号查询角色名称
* @param roleId 角色编号
* @return 角色的完整信息
*/
String getRoleNameById(int roleId);
}
| [
"[email protected]"
] | |
6afc941654b33c94d1c050f9c16a8bf6b1f234d4 | 1349e9b0d0c7bd9cd90648dc837c723893522104 | /yue-library-data-redis/src/main/java/ai/yue/library/data/redis/annotation/MQListener.java | cfe42babb74ba8f396384e7d960239365712aa77 | [
"Apache-2.0"
] | permissive | tfnick/yue-library | ddf2b77876c11e02de4408f2d0ccc8ce3d60b8ca | 55fa13f5afab04d5a7a5c68e632808fe806f5df0 | refs/heads/master | 2022-12-13T23:28:44.662107 | 2020-09-05T04:20:50 | 2020-09-05T04:20:50 | 287,201,540 | 0 | 0 | Apache-2.0 | 2020-08-13T06:39:58 | 2020-08-13T06:39:57 | null | UTF-8 | Java | false | false | 803 | java | package ai.yue.library.data.redis.annotation;
import java.lang.annotation.*;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MQListener {
/**
* topic name
* @return
*/
String name();
// /**
// * 匹配模式 <br />
// * PRECISE精准的匹配 如:name="myTopic" 那么发送者的topic name也一定要等于myTopic <br />
// * PATTERN模糊匹配 如: name="myTopic.*" 那么发送者的topic name 可以是 myTopic.name1 myTopic.name2.尾缀不限定
// * @return
// */
// MQModel model() default MQModel.PRECISE;
/**
* 消费者组
* @return
*/
String group();
/**
* 单节点并发的consumer数,默认为1
* @return
*/
int concurrent() default 1;
}
| [
"Ykt@9527vip"
] | Ykt@9527vip |
862e81848c42e22f626d1570ab3c107e38309339 | 5107efb8d21492964d3624fea23a5dec889814d8 | /Exercise4_3.java | d7656f094dc28566c101ec1a39d9db780770400b | [] | no_license | chinphing5/ctf010535_java | ebe47d9c82e59572d091ae01b83344d9037ba3a0 | 3a9ff56da12b4dc046ba3c1a355b52bfaada4cad | refs/heads/master | 2023-06-19T16:47:46.679393 | 2021-07-09T18:28:30 | 2021-07-09T18:28:30 | 362,202,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | /*
* File: Exercise4_3.java
* ----------------------
*
* Switch Statement
*
*/
public class Exercise4_3 {
public static void main(String[] args) {
int score = 80;
char grade = ' ';
;
switch(score) {
case 80:
grade = 'A';
break;
case 70:
grade = 'B';
break;
case 60:
grade = 'C';
break;
case 50:
grade = 'D';
break;
case 40:
grade = 'F';
break;
default:
grade = 'E';
}
System.out.println("Your grade is " + grade);
}
}
| [
"[email protected]"
] | |
897d6921bce8142e490af3c08975cd09da0df7f5 | 2a04397fc0abec3cffa427a587fee1e74ba32fec | /j2se50/src/annotations/Dog.java | b5ba5b24adcd2511d0bbab1eb5e3a22d13092a8d | [] | no_license | abrakitlaw/java | e79335d803ff863cb165b7ff7edc7ffcc4a22958 | a9c6c403300609ed0d3cf589913f6e997050323b | refs/heads/master | 2020-06-17T07:37:00.498674 | 2019-07-11T08:16:26 | 2019-07-11T08:16:26 | 195,848,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package annotations;
public class Dog extends Animal {
@Override
public void speak() {
System.out.println("Woof woof");
}
@Override
public String getType() {
return "Dog";
}
}
| [
"[email protected]"
] | |
f2449aba671838a861405927abac40e73b541331 | 79418fbee74d009ba8371a0b40ed55182934c32c | /src/solutions/_3_Streams/creatingStreams/model/Person.java | a70a163997e1378b4157f621600fa2a0f3636242 | [] | no_license | mirtaqee/JavaSE8NewFeatures | b55c8f71fa2116699cfdec8e1202a1e532963045 | 86a162c8802ab76c88a6791df509e599a7001441 | refs/heads/master | 2020-04-07T23:34:29.000835 | 2018-11-23T10:33:33 | 2018-11-23T10:33:33 | 158,817,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package solutions._3_Streams.creatingStreams.model;
public class Person {
private String name;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getInfo() {
return name + " (" + age + ")";
}
}
| [
"[email protected]"
] | |
6b57b57aaf60a8282d830b8494d7fd41b25c3fdb | 7f000d5db4078c9906f9290f14f21a63d3c4d755 | /src/com/xpfirst/MyToolWin.java | 26d31456929aef0808e86c36730d2b033e0bdba7 | [] | no_license | nanjizhiyin/javaCodeRules | 39a609dc322677fbffab8245b520b613e4275c3b | 4be67f64659115f2fee9fcd97769cdfe7cac9405 | refs/heads/master | 2020-05-15T11:15:14.686444 | 2019-04-19T07:10:57 | 2019-04-19T07:10:57 | 182,218,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,708 | java | package com.xpfirst;
import com.intellij.openapi.editor.CaretModel;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.PsiShortNamesCache;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.treeStructure.Tree;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class MyToolWin implements ToolWindowFactory {
Tree rootTree = new Tree();
///构造一个 有滚动条的面板
JBScrollPane scrollPane=new JBScrollPane();
private final String rootNodeName = "检查规则";
//定义tree 的根目录
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(rootNodeName);
public MyToolWin(){
//构造一个treeModel 对象,进行刷新树操作
DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
rootTree.setModel(treeModel);
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); //得到屏幕的尺寸
JPanel mainPanel=new JPanel();
//设置主面板的大小
mainPanel.setPreferredSize(new Dimension((int)screenSize.getWidth()-50,(int)screenSize.getHeight()/3*2));
//tree 设置大小
rootTree.setPreferredSize(new Dimension((int)screenSize.getWidth()-50,(int)screenSize.getHeight()/3*2));
//设置滚动条面板位置
scrollPane.setPreferredSize(new Dimension((int)screenSize.getWidth()-50,(int)screenSize.getHeight()/3*2-50));
//将tree添加道滚动条面板上
scrollPane.setViewportView(rootTree);
//将滚动条面板设置哼可见
scrollPane.setVisible(true);
//设置滚动条的滚动速度
scrollPane.getVerticalScrollBar().setUnitIncrement(15);
//解决闪烁问题
scrollPane.getVerticalScrollBar().setDoubleBuffered(true);
mainPanel.add(scrollPane);
}
// 添加行数规则的node
public void addLineNode(DefaultMutableTreeNode lineNode){
rootNode = lineNode;
}
public void showToolWin(Project project){
//构造一个treeModel 对象,进行刷新树操作
DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
rootTree.setModel(treeModel);
rootTree.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent e){
//BUTTON3是鼠标右键 BUTTON2是鼠标中键 BUTTON1是鼠标左键
// 双击事件
if(e.getButton()==e.BUTTON1 && e.getClickCount() == 2){
//获取点击的tree节点
DefaultMutableTreeNode note=(DefaultMutableTreeNode)rootTree.getLastSelectedPathComponent();
if(note!=null){
Object[] objects = note.getUserObjectPath();
String className = (String)objects[0];
//查找名称为mapperName的文件
PsiFile[] files = PsiShortNamesCache.getInstance(project).getFilesByName(className);
if (files.length == 1) {
PsiFile psiFile = (PsiFile) files[0];
VirtualFile virtualFile = psiFile.getVirtualFile();
// 标题内容
String tmpStr = (String) note.getUserObject();
//打开文件
OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(project, virtualFile);
Editor editor = FileEditorManager.getInstance(project).openTextEditor(openFileDescriptor, true);
//获取sql所在的行数,这里用了比较笨的方法。api找了很久没找到有什么方法可以获取行号,希望有大神指点
//定位到对应的行
String lineNumberStr = tmpStr.substring(tmpStr.indexOf("(line ") + 6,tmpStr.indexOf(")"));
Integer lineNumber = Integer.valueOf(lineNumberStr);
CaretModel caretModel = editor.getCaretModel();
LogicalPosition logicalPosition = caretModel.getLogicalPosition();
logicalPosition.leanForward(true);
LogicalPosition logical = new LogicalPosition(lineNumber, logicalPosition.column);
caretModel.moveToLogicalPosition(logical);
SelectionModel selectionModel = editor.getSelectionModel();
selectionModel.selectLineAtCaret();
}
}
}
}
});
//将tree添加道滚动条面板上
scrollPane.setViewportView(rootTree);
JPanel mainPanel=new JPanel();
mainPanel.add(scrollPane);
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(mainPanel,"", false);
// 获取工具窗口,用于输出结果
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow("输出");
toolWindow.getContentManager().removeAllContents(true);
toolWindow.getContentManager().addContent(content);
// 将项目对象,ToolWindow的id传入,获取控件对象
if (toolWindow != null) {
// 无论当前状态为关闭/打开,进行强制打开ToolWindow
toolWindow.show(new Runnable() {
@Override
public void run() {
}
});
}
}
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
// ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
// Content content = contentFactory.createContent(mainPanel,"", false);
// toolWindow.getContentManager().addContent(content);
}
} | [
"[email protected]"
] | |
05b60a5d52082e0f2f7a72df2b51a46002eff821 | 4aa2491cf28b70d30c8bbb773fd03d5a792c101d | /buzzer_app/build/app/generated/source/buildConfig/debug/com/example/buzzer_app/BuildConfig.java | e69c3ade4448932eb746caa8c8862f44aa2e320f | [] | no_license | AbhayVAshokan/GeeksOut-Buzzer | 5f8451e74ec0a9462cb0d51475f0b6146372b8d8 | 4f85bfb3056063e2f14318fb712ffb1e12f15772 | refs/heads/master | 2021-08-18T11:21:56.203654 | 2021-01-03T12:56:38 | 2021-01-03T12:56:38 | 238,977,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.buzzer_app;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.buzzer_app";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0.0";
}
| [
"[email protected]"
] | |
05ee708e2426c1ae67e81e48cdefd67899a577d3 | a9d457c77eedded34019111f06ed9f8a1ff5186a | /src/main/java/ibczy/logview/singlespark/Start.java | f97a399d53a8319496c608730913245d16eae69c | [] | no_license | sk925/logview | f014fae4afa89f7580581307481b5b87a54bda77 | 49b44d552d1bc427faf66b99738b0ff1950a72c0 | refs/heads/master | 2020-03-22T23:37:37.652436 | 2018-07-13T08:50:43 | 2018-07-13T08:50:43 | 140,820,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package ibczy.logview.singlespark;
import ibczy.logview.analysis.task.CountTask;
import ibczy.logview.service.SchedulerStarter;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by BC349 on 2018/7/12.
* spark统计程序入口
*/
public class Start {
public static final String root = "hdfs://10.1.1.11:8020//ibczy/reader/book.[TAG].log/log-reader-book-[TAGB]-DATE.txt";
public static final String tag = "click,read.time,in.bookshelf,subscribe";
public static ExecutorService pool;
public static void main(String []args){
String tags[] = tag.split(",");
pool = Executors.newFixedThreadPool(tags.length);
for(String t:tags){
CountTask task = new CountTask(t,root);
pool.execute(task);
}
//启动定时任务,每天的零点刷新数据。将最新一天的数据量加入到监控
SchedulerStarter starter = new SchedulerStarter();
try {
starter.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
926e7e029ded880b97de07eb6b7250da9f89b491 | 3ae8c0eee763fffa271a79471874a1727ecf709a | /src/main/java/org/encog/bot/browse/LoadWebPage.java | 733e92c797a0a3a068570a571eb8465f422047ab | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | rahulchaudhary2244/encog-java-core | c468dcd934facd41261b2d194c7913ce4e18308c | fc7b3602666399cc3a614c1f85ae2b3c52552bf4 | refs/heads/master | 2022-12-27T06:27:22.135793 | 2020-10-01T05:18:32 | 2020-10-01T05:18:32 | 300,153,359 | 0 | 0 | NOASSERTION | 2020-10-01T05:15:56 | 2020-10-01T05:15:55 | null | UTF-8 | Java | false | false | 11,354 | java | /*
* Encog(tm) Core v3.4 - Java Version
* http://www.heatonresearch.com/encog/
* https://github.com/encog/encog-java-core
* Copyright 2008-2017 Heaton Research, 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.
*
* For more information on Heaton Research copyrights, licenses
* and trademarks visit:
* http://www.heatonresearch.com/copyright
*/
package org.encog.bot.browse;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.encog.bot.browse.range.Div;
import org.encog.bot.browse.range.DocumentRange;
import org.encog.bot.browse.range.Form;
import org.encog.bot.browse.range.Input;
import org.encog.bot.browse.range.Link;
import org.encog.bot.browse.range.Span;
import org.encog.bot.dataunit.CodeDataUnit;
import org.encog.bot.dataunit.DataUnit;
import org.encog.bot.dataunit.TagDataUnit;
import org.encog.bot.dataunit.TextDataUnit;
import org.encog.parse.tags.Tag;
import org.encog.parse.tags.read.ReadHTML;
import org.encog.util.logging.EncogLogging;
/**
* Called to actually load a web page. This will read the HTML on a web page and
* generate the DocumentRange classes.
*
* @author jheaton
*
*/
public class LoadWebPage {
/**
* The loaded webpage.
*/
private WebPage page;
/**
* The base URL for the page being loaded.
*/
private final URL base;
/**
* The last form that was processed.
*/
private Form lastForm;
/**
* The last hierarchy element that was processed.
*/
private DocumentRange lastHierarchyElement;
/**
* Construct a web page loader with the specified base URL.
*
* @param theBase
* The base URL to use when loading.
*/
public LoadWebPage(final URL theBase) {
this.base = theBase;
}
/**
* Add the specified hierarchy element.
*
* @param element
* The hierarchy element to add.
*/
private void addHierarchyElement(final DocumentRange element) {
if (this.lastHierarchyElement == null) {
this.page.addContent(element);
} else {
this.lastHierarchyElement.addElement(element);
}
this.lastHierarchyElement = element;
}
/**
* Create a dataunit to hode the code HTML tag.
*
* @param str
* The code to create the data unit with.
*/
private void createCodeDataUnit(final String str) {
if (str.trim().length() > 0) {
final CodeDataUnit d = new CodeDataUnit();
d.setCode(str);
this.page.addDataUnit(d);
}
}
/**
* Create a tag data unit.
*
* @param tag
* The tag name to create the data unit for.
*/
private void createTagDataUnit(final Tag tag) {
final TagDataUnit d = new TagDataUnit();
d.setTag(tag.clone());
this.page.addDataUnit(d);
}
/**
* Create a text data unit.
*
* @param str
* The text.
*/
private void createTextDataUnit(final String str) {
if (str.trim().length() > 0) {
final TextDataUnit d = new TextDataUnit();
d.setText(str);
this.page.addDataUnit(d);
}
}
/**
* Find the end tag that lines up to the beginning tag.
*
* @param index
* The index to start the search on. This specifies the starting
* data unit.
* @param tag
* The beginning tag that we are seeking the end tag for.
* @return The index that the ending tag was found at. Returns -1 if not
* found.
*/
public final int findEndTag(final int index, final Tag tag) {
int depth = 0;
int count = index;
while (count < this.page.getDataSize()) {
final DataUnit du = this.page.getDataUnit(count);
if (du instanceof TagDataUnit) {
final Tag nextTag = ((TagDataUnit) du).getTag();
if (tag.getName().equalsIgnoreCase(nextTag.getName())) {
if (nextTag.getType() == Tag.Type.END) {
if (depth == 0) {
return count;
} else {
depth--;
}
} else if (nextTag.getType() == Tag.Type.BEGIN) {
depth++;
}
}
}
count++;
}
return -1;
}
/**
* Load a web page from the specified stream.
*
* @param is
* The input stream to load from.
* @return The loaded web page.
*/
public final WebPage load(final InputStream is) {
this.page = new WebPage();
loadDataUnits(is);
loadContents();
return this.page;
}
/**
* Load the web page from a string that contains HTML.
*
* @param str
* A string containing HTML.
* @return The loaded WebPage.
*/
public final WebPage load(final String str) {
try {
final ByteArrayInputStream bis = new ByteArrayInputStream(str
.getBytes());
final WebPage result = load(bis);
bis.close();
return result;
} catch (final IOException e) {
EncogLogging.log(e);
throw new BrowseError(e);
}
}
/**
* Using the data units, which should have already been loaded by this time,
* load the contents of the web page. This includes the title, any links and
* forms. Div tags and spans are also processed.
*/
protected final void loadContents() {
for (int index = 0; index < this.page.getDataSize(); index++) {
final DataUnit du = this.page.getDataUnit(index);
if (du instanceof TagDataUnit) {
final Tag tag = ((TagDataUnit) du).getTag();
if (tag.getType() != Tag.Type.END) {
if (tag.getName().equalsIgnoreCase("a")) {
loadLink(index, tag);
} else if (tag.getName().equalsIgnoreCase("title")) {
loadTitle(index, tag);
} else if (tag.getName().equalsIgnoreCase("form")) {
loadForm(index, tag);
} else if (tag.getName().equalsIgnoreCase("input")) {
loadInput(index, tag);
}
}
if (tag.getType() == Tag.Type.BEGIN) {
if (tag.getName().equalsIgnoreCase("div")) {
loadDiv(index, tag);
} else if (tag.getName().equalsIgnoreCase("span")) {
loadSpan(index, tag);
}
}
if (tag.getType() == Tag.Type.END) {
if (tag.getName().equalsIgnoreCase("div")) {
if (this.lastHierarchyElement != null) {
this.lastHierarchyElement =
this.lastHierarchyElement
.getParent();
}
} else if (tag.getName().equalsIgnoreCase("span")) {
if (this.lastHierarchyElement != null) {
this.lastHierarchyElement =
this.lastHierarchyElement
.getParent();
}
}
}
}
}
}
/**
* Load the data units. Once the lower level data units have been loaded,
* the contents can be loaded.
*
* @param is
* The input stream that the data units are loaded from.
*/
protected final void loadDataUnits(final InputStream is) {
final StringBuilder text = new StringBuilder();
int ch;
final ReadHTML parse = new ReadHTML(is);
boolean style = false;
boolean script = false;
while ((ch = parse.read()) != -1) {
if (ch == 0) {
if (style) {
createCodeDataUnit(text.toString());
} else if (script) {
createCodeDataUnit(text.toString());
} else {
createTextDataUnit(text.toString());
}
style = false;
script = false;
text.setLength(0);
createTagDataUnit(parse.getTag());
if (parse.getTag().getName().equalsIgnoreCase("style")) {
style = true;
} else if (parse.getTag().getName().equalsIgnoreCase(
"script")) {
script = true;
}
} else {
text.append((char) ch);
}
}
createTextDataUnit(text.toString());
}
/**
* Called by loadContents to load a div tag.
*
* @param index
* The index to begin at.
* @param tag
* The beginning div tag.
*/
private void loadDiv(final int index, final Tag tag) {
final Div div = new Div(this.page);
final String classAttribute = tag.getAttributeValue("class");
final String idAttribute = tag.getAttributeValue("id");
div.setIdAttribute(idAttribute);
div.setClassAttribute(classAttribute);
div.setBegin(index);
div.setEnd(findEndTag(index + 1, tag));
addHierarchyElement(div);
}
/**
* Called by loadContents to load a form on the page.
*
* @param index
* The index to begin loading at.
* @param tag
* The beginning tag.
*/
protected final void loadForm(final int index, final Tag tag) {
final String method = tag.getAttributeValue("method");
final String action = tag.getAttributeValue("action");
final Form form = new Form(this.page);
form.setBegin(index);
form.setEnd(findEndTag(index + 1, tag));
if ((method == null) || method.equalsIgnoreCase("GET")) {
form.setMethod(Form.Method.GET);
} else {
form.setMethod(Form.Method.POST);
}
if (action == null) {
form.setAction(new Address(this.base));
} else {
form.setAction(new Address(this.base, action));
}
this.page.addContent(form);
this.lastForm = form;
}
/**
* Called by loadContents to load an input tag on the form.
*
* @param index
* The index to begin loading at.
* @param tag
* The beginning tag.
*/
protected final void loadInput(final int index, final Tag tag) {
final String type = tag.getAttributeValue("type");
final String name = tag.getAttributeValue("name");
final String value = tag.getAttributeValue("value");
final Input input = new Input(this.page);
input.setType(type);
input.setName(name);
input.setValue(value);
if (this.lastForm != null) {
this.lastForm.addElement(input);
} else {
this.page.addContent(input);
}
}
/**
* Called by loadContents to load a link on the page.
*
* @param index
* The index to begin loading at.
* @param tag
* The beginning tag.
*/
protected final void loadLink(final int index, final Tag tag) {
final Link link = new Link(this.page);
final String href = tag.getAttributeValue("href");
if (href != null) {
link.setTarget(new Address(this.base, href));
link.setBegin(index);
link.setEnd(findEndTag(index + 1, tag));
this.page.addContent(link);
}
}
/**
* Called by loadContents to load a span.
*
* @param index
* The index to begin loading at.
* @param tag
* The beginning tag.
*/
private void loadSpan(final int index, final Tag tag) {
final Span span = new Span(this.page);
final String classAttribute = tag.getAttributeValue("class");
final String idAttribute = tag.getAttributeValue("id");
span.setIdAttribute(idAttribute);
span.setClassAttribute(classAttribute);
span.setBegin(index);
span.setEnd(findEndTag(index + 1, tag));
addHierarchyElement(span);
}
/**
* Called by loadContents to load the title of the page.
*
* @param index
* The index to begin loading at.
* @param tag
* The beginning tag.
*/
protected final void loadTitle(final int index, final Tag tag) {
final DocumentRange title = new DocumentRange(this.page);
title.setBegin(index);
title.setEnd(findEndTag(index + 1, tag));
this.page.setTitle(title);
}
}
| [
"[email protected]"
] | |
79fd4960f47186c99cd589db6e0e76fa39cb3337 | 7e3e67b0e94d6b137df60738bf6b3f5f732b25d0 | /corejavaweek/src/usinginterfaceconcept/StaticInterface/Mainclass.java | ed1422cbcffb3a096eff5e5070880f491dddfa3b | [] | no_license | gvenkatesh4/corejavaprograms | 428f8d1f884e708c5b964e9f967743e1942d825f | 91aca8c8485e68e3a0dda3dc39021caf4f501e79 | refs/heads/master | 2022-10-15T22:23:52.280300 | 2020-06-13T05:20:52 | 2020-06-13T05:20:52 | 271,946,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package usinginterfaceconcept.StaticInterface;
public class Mainclass {
public static void main(String[] args) {
ClassB object = new ClassB(5, "it is cube");
System.out.println(object);
}
}
| [
"Venkatesh@LAPTOP-4OKHSCA5"
] | Venkatesh@LAPTOP-4OKHSCA5 |
9ad221d85606ea652ad34d4ad07438969ec93ad3 | 8cc604d67d76f07a5c43926d56f5db42d64c6879 | /weixiao/weixiao/weixiao-student/src/main/java/com/zjw/graduation/service/post/PostCategoryService.java | c3547890fabd8623fffb0af23d76e0ec7ffa097e | [] | no_license | small-little-time/weixiao-center | 7b702aa83a94c20bd263d756e86ebe55bd68e28b | f7f60de9b4551b2e93647b6bd79085e4621b81c2 | refs/heads/master | 2022-12-16T03:13:49.684757 | 2020-09-11T07:14:52 | 2020-09-11T07:14:52 | 293,831,699 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package com.zjw.graduation.service.post;
import com.zjw.graduation.data.PagingResult;
import com.zjw.graduation.entity.post.PostCategory;
/**
* 内容类别表
*
* @author zjw
* @email [email protected]
* @date 2020-02-25 17:09:07
*/
public interface PostCategoryService {
PagingResult<PostCategory> page(int pageIndex, int pageSize);
PostCategory get(Long id);
PostCategory save(PostCategory Admin);
PostCategory update(PostCategory Admin);
void delete(Long id);
}
| [
"[email protected]"
] | |
e62fc8a2268f651ac1e5b0ac0c9a7ac7d1777bed | 945fbcaad0decbe244c77ffc99d97eaadcb8e8a8 | /src/main/java/helper/Base.java | fe241a620e4d3dbd106a797bbb55cf1d83b8cc20 | [] | no_license | shrey-ops/trresgen | 6ad2da69740f2bd1a62cde78796037833505a37f | de0214579fee3855452a7fc9bcdd2696d1539b8c | refs/heads/master | 2023-04-18T00:34:43.181867 | 2020-06-01T06:00:22 | 2020-06-01T06:00:22 | 268,255,736 | 0 | 0 | null | 2021-04-26T20:20:30 | 2020-05-31T10:20:35 | HTML | UTF-8 | Java | false | false | 3,379 | java | package helper;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.opencsv.CSVReader;
import utilis.ExtentTestManager;
import java.util.HashMap;
import java.util.Properties;
public class Base {
public static WebDriver driver;
public WebDriverWait wait;
public static HashMap<String, String> CSV = new HashMap<String, String>();
// ChromeDriverLaunchMethod
public Base() {
if (driver == null)
driver = new ChromeDriver();
driver.manage().window().maximize();
wait = new WebDriverWait(driver, 15);
}
// Wait Wrapper Method
public void waitVisibility(By elementBy) {
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(elementBy));
}
// Click Method
public void click(By elementBy) {
waitVisibility(elementBy);
driver.findElement(elementBy).click();
}
// Write Text
public void writeText(By elementBy, String text) {
waitVisibility(elementBy);
driver.findElement(elementBy).sendKeys(text);
}
// // Read Text
// public String readText(By elementBy) {
// waitVisibility(elementBy);
// return this.driver.findElement(elementBy).getText().trim();
// }
//
//// // Assert
// public void assertEquals(By elementBy, String expectedText) {
// waitVisibility(elementBy);
// Assert.assertEquals(readText(elementBy), expectedText);
//
// }
// Assertion Method
public void assertions(By elementBy, String expect) throws IOException {
waitVisibility(elementBy);
String given1 = driver.findElement(elementBy).getText().trim();
System.out.println("Success" + given1);
Assert.assertEquals(given1, expect);
}
// Property File (Resource)
public static String propertyFile(String Key) throws IOException {
File file = new File(
"C:\\Users\\Shrey\\eclipse-workspace1\\Tresgen\\src\\main\\java\\resource\\File.properties");
FileInputStream fileInput = new FileInputStream(file);
Properties prop = new Properties();
prop.load(fileInput);
return prop.getProperty(Key);
}
//CSV File (Resource)
@SuppressWarnings({ "resource" })
public static HashMap<String, String> CSVfile() throws IOException {
String PATH = "C:\\Users\\Shrey\\eclipse-workspace1\\Tresgen\\src\\main\\java\\resource\\credentials.csv";
CSVReader reader = new CSVReader(new FileReader(PATH));
String[] csvCell;
while ((csvCell = reader.readNext()) != null) {
CSV.put(csvCell[0], csvCell[1]);
}
return CSV;
}
public void report() {
ExtentHtmlReporter report = new ExtentHtmlReporter(
System.getProperty("C:\\Users\\Shrey\\eclipse-workspace1\\Tresgen\\TestReport")
+ "TresgenReporting.html");
ExtentReports reports = new ExtentReports();
reports.attachReporter(report);
report.config().setDocumentTitle("Tresgeneraciones");
report.config().setReportName("Tresgeneraciones Report");
}
// Reporting in Extent
public void report(String message) {
ExtentTestManager.getTest().log(Status.INFO, message);
}
}
| [
"[email protected]"
] | |
16d48958cbac0b2ae6e51a5388e26f79a2b00a17 | c3e319a1a5b56b709304356022ac4c6a22284fda | /java/algorithm-dataStructure/src/main/java/com/wsmhz/algorithm/sort/QuickSortThree.java | 997749a77ce00348957b39c2fb67faa67914d3d7 | [
"MIT"
] | permissive | wsmhz/technical-talks | 3af020ef7d730242f070316e8405d43f3a3fdc0e | d35bef7158ffd350ce2d3b175380924a64ecb42d | refs/heads/master | 2020-05-01T10:38:35.642636 | 2019-12-18T08:43:59 | 2019-12-18T08:43:59 | 177,424,913 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,418 | java | package com.wsmhz.algorithm.sort;
import com.wsmhz.algorithm.common.Generater;
/**
* create by tangbj on 2018/11/29
*/
public class QuickSortThree {
public static void quickSort(int[] arr){
sort(arr , 0 , arr.length - 1);
}
private static void sort(int[] arr, int left, int right) {
if(left >= right){
return;
}
int lt = left;
int gt = right + 1;
int i = left + 1;
// 优化 尽可能的让e是随机数,防止近乎顺序的数组退化后的运行复杂度为O(n^2)
// 随机取后,期望的复杂度是O(NlogN),为O(n^2)的概率几乎为零
Generater.swapIntArr(arr , left , (int) (Math.random() * (right - left + 1) + left));
int e = arr[left];
while (i < gt){
if(arr[i] < e){
Generater.swapIntArr(arr , i , lt + 1);
lt ++;
i ++;
}else if(arr[i] == e){
i ++;
}else{
Generater.swapIntArr(arr , i , gt - 1);
gt --;
}
}
Generater.swapIntArr(arr , left , lt);
sort(arr , left , lt - 1);
sort(arr , gt , right);
}
public static void main(String[] args) {
int[] arr = Generater.getIntArray();
quickSort(arr);
for (int i : arr) {
System.out.print(i + " ");
}
}
}
| [
"[email protected]"
] | |
5322aaee454238c26568089ecdac67244f5907ce | 4b7edf809c05a83898588164e599968112dd5036 | /spring-angular/src/main/java/com/sieyip/config/ApplicationProperties.java | 0946f08c3dffffb659089859e860ec976739dc52 | [] | no_license | sieyip/spring-starter-packs | 243573d9e42941ef6768bac7afee854e4d216e96 | 4c42db1507788f53d854d1b33e3e81338c7e417a | refs/heads/master | 2021-01-17T04:22:25.747234 | 2017-07-24T21:47:18 | 2017-07-24T21:47:18 | 82,942,464 | 0 | 2 | null | 2017-07-24T21:47:19 | 2017-02-23T15:43:35 | Java | UTF-8 | Java | false | false | 347 | java | package com.sieyip.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties specific to JHipster.
*
* <p>
* Properties are configured in the application.yml file.
* </p>
*/
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {
}
| [
"[email protected]"
] | |
51ab31664b341068e5c76fc19e1f670e62c5aaa9 | 32cb52a54f18e1468b61dd904c52aecfa0c8e588 | /FrameWork/POM/KiteHomePage.java | d8b85a70fe5e018c938d3fbabdbaa545b4eac032 | [] | no_license | asiftamboli/asiftamboli | 5eb71cd2ecff649ae7dc811ebab6c59bd12813e5 | d72a3ad02b09c5a74b97dd94801da1a58d8b25e3 | refs/heads/master | 2023-06-30T09:33:48.731108 | 2021-08-02T03:55:02 | 2021-08-02T03:55:02 | 391,655,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | package POM;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class KiteHomePage
{
@FindBy(xpath="//span[@class='user-id']") private WebElement userID;
public KiteHomePage(WebDriver driver)
{
PageFactory.initElements(driver, this);
}
public void verifyUserID()
{
String atulUserID = userID.getText();
String expetedUserID = "DV1510";
if(atulUserID.equals(expetedUserID))
{
System.out.println("Pass");
}
else
{
System.out.println("Fail");
}
}
}
| [
"Admin@L_RA_520"
] | Admin@L_RA_520 |
512ee4a477cd0317f9332deefa1430507a979951 | acecf18bb3efe7defcb1cd13ff1128ddc0446759 | /program1/src/win/flrque/university/program1/Main.java | 2e93f066d1a7abb5aa1a34a6b48bf3efc12e29fa | [] | no_license | Florke64/wsinf-pzo | af9e15500517acee8b32337cdf88fe4dfda6e52b | 5e0a4fd7c9fc7d88fa3d2304907c3644f8e8e3da | refs/heads/master | 2022-11-14T14:17:15.638473 | 2020-07-08T20:52:33 | 2020-07-08T20:52:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package win.flrque.university.program1;
public class Main {
private static final String prefix = "To jest pierwszy program";
private static final String myName = "Daniel Wasiak";
public static void main(String[] args) {
final StringBuilder message = new StringBuilder();
message.append(prefix).append(" - ").append(myName);
System.out.println(message.toString());
}
}
| [
"[email protected]"
] | |
d1747e8f1fe61b9a60bc5d76e8469f8ed19e2d88 | 5dafab30a157ac4e240055d1136924ff12a2bd43 | /dag/runtime/extension/trace/src/main/java/com/asakusafw/dag/extension/trace/PortTracer.java | 56dd59228e989b0012ac564e84399b5af33f9403 | [
"Apache-2.0"
] | permissive | shino/asakusafw-compiler | 7e105567406d9c0d7e98a41f096aacf6c6e027fb | 1909f8d8333e2968914e5e47ba43eb540aa3e848 | refs/heads/master | 2020-12-03T05:22:01.250223 | 2016-10-12T03:20:29 | 2016-10-12T03:20:29 | 55,666,219 | 0 | 0 | null | 2016-04-07T05:30:22 | 2016-04-07T05:30:22 | null | UTF-8 | Java | false | false | 1,472 | java | /**
* Copyright 2011-2016 Asakusa Framework Team.
*
* 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.asakusafw.dag.extension.trace;
import java.util.function.Consumer;
/**
* An abstract super interface which provides object sinks for tracing.
* @since 0.4.0
*/
public interface PortTracer {
/**
* Returns whether the target vertex MAY support tracing facilities or not.
* @param vertexId the target vertex ID
* @return {@code true} if the target vertex may support tracing facilities,
* or {@code false} if the vertex never support it
*/
default boolean isSupported(String vertexId) {
return true;
}
/**
* Returns a trace sink for the target port.
* @param vertexId the target vertex ID
* @param portId the target port ID
* @return the related trace sink, or {@code null} if it id not supported
*/
Consumer<Object> getSink(String vertexId, String portId);
}
| [
"[email protected]"
] | |
69bffd397cdf71147d4913ea095dc2e769ecb77c | 201abdf855465cac55b0e75738b13cdced9b123b | /huiget-service/src/main/java/com/huiget/mall/service/CategoryPropertyService.java | 0dc884181d8850e49abaebfe1df89d3d167e9b27 | [] | no_license | nemoshi/huiget | b1a2a12bd90c8af868cd4edf90af984ae04d7a8a | 636ec55c2b628a8930040c5fcc73b34f0fc6cb81 | refs/heads/master | 2021-01-10T07:04:55.304297 | 2015-11-13T04:16:58 | 2015-11-13T04:16:58 | 46,099,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | /**
*
* 惠购 - 惠购网 - www.huiget.com - 特别会购!
* Copyright © 2014 惠购 www.huiget.com 版权所有
*/
package com.huiget.mall.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huiget.mall.common.dal.mapper.BaseMapper;
import com.huiget.mall.common.dal.mapper.CategoryPropertyMapper;
/**
*
* @author yaofang
* @version $Id: CategoryPropertyService.java, v 0.1 2014年9月25日 下午6:06:12 yaofang Exp $
*/
@Service
public class CategoryPropertyService extends BaseSevice {
@Autowired
private CategoryPropertyMapper categoryPropertyMapper;
/**
* @see com.baoseed.mall.service.BaseSevice#getMapper()
*/
@Override
protected BaseMapper getMapper() {
return categoryPropertyMapper;
}
}
| [
"[email protected]"
] | |
42c87f72aa20950312ffb48d69073cf80a1f759e | 6d33abaf313235c8d279d9f88a86031d67b4ae7c | /current/version 1/Skill.java | 5d05b0e6cc87e8542a67ffd8036f13e5ae7b0de1 | [
"BSD-3-Clause"
] | permissive | erikmellum/MedievalConquest | 18299130f02d2f28df29a5cb97517a5b831eca6b | 9c43265bb309e5d87261db4b6dcbc06b0486e979 | refs/heads/master | 2021-01-19T06:52:57.917120 | 2014-02-15T08:38:33 | 2014-02-15T08:38:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | import java.util.HashMap;
import java.io.Serializable;
public class Skill extends Stat
{
protected HashMap<String, GameObject> skill;
protected GameList<String, Stat> stats;
public Skill()
{
name = "swords";
description = "Learn how to master the art of swordmanship";
buildSkill();
}
public Skill(String newName, String newDescription, int newLevel)
{
name = newName;
description = newDescription;
buildSkill();
stats.lget("Level").setValue(newLevel);
}
public void buildSkill()
{
skill = stat;
stats = new GameList<String, Stat>();
skill.put("Stats",stats);
stats.put("Level",new Stat("Level",1));
stats.put("Current Experience",new Stat("Current Experience",0));
stats.put("Experience Needed",new Stat("Experience Needed",10));
}
} | [
"[email protected]"
] | |
5da5585c89bbb28d5d959b289e018a1a9a3d7fc1 | 2e182263de409bc7866debc9ab3cd770aef73eff | /crossover-server/src/main/java/org/crossover/server/ws/CompileServiceImpl.java | 936ae29769c48269e1c4f1d5202013db4e84b0cc | [] | no_license | mcelio/work-02 | 07022140aa71ccf2596ae9175d21424e8199ede2 | 036ebe927225b091c92671b55897f9a9460f30d3 | refs/heads/master | 2021-01-19T14:55:54.028444 | 2015-08-14T13:30:13 | 2015-08-14T13:30:13 | 40,716,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,329 | java | package org.crossover.server.ws;
import javax.jws.WebService;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.crossover.server.service.CompilationService;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Class responsible to implement the soap web service.
*
* @author Marcos
*
*/
@WebService(endpointInterface = "org.crossover.server.ws.CompileService", serviceName = "compileService")
public class CompileServiceImpl implements CompileService {
// Console logger
static final Logger logger = LogManager.getLogger(CompileServiceImpl.class.getName());
@Autowired
private CompilationService compilationService;
/**
* Compilation implementation method.
*
* @param compilation object.
*/
public Compilation compile(Compilation compilation) throws Exception {
logger.debug("Start compilation process");
Compilation result = compilationService.compile(compilation);
logger.debug("End compilation process");
return result;
}
/**
* Finds a compilation by id
*
* @param id
*/
public Compilation findCompilation(Compilation compilation) throws Exception {
logger.debug("Start find compilation");
Compilation result = compilationService.findCompilation(compilation);
logger.debug("End find compilation");
return result;
}
}
| [
"[email protected]"
] | |
d3fc8a7b93e7de4f44cf13331a4e3585c777404b | c9e2035df0aa14ff2415250338540fcb2b9bf8d1 | /circle_lib/src/main/java/com/yiw/circledemo/utils/CommonUtils.java | 61f4a4e81920c3cb2dfdd715f4c4f14ed2342262 | [] | no_license | xmong123/sealtalk-android-speers | 614052fb4108a4aed680bb86adbedc17684246a3 | 7bdfe4c2926d6ef52cf8fe0a06662f8b2bfaac14 | refs/heads/master | 2021-08-15T18:43:24.445183 | 2020-12-08T04:42:46 | 2020-12-08T04:42:46 | 230,228,818 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package com.yiw.circledemo.utils;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
/**
* @author yiw
* @ClassName: CommonUtils
* @Description:
* @date 2015-12-28 下午4:16:01
*/
public class CommonUtils {
public static int keyboardHeight = 0;
public static void showSoftInput(Context context, View view) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
//imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
public static void hideSoftInput(Context context, View view) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); //强制隐藏键盘
}
public static boolean isShowSoftInput(Context context) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
//获取状态信息
return imm.isActive();//true 打开
}
}
| [
"87892505"
] | 87892505 |
e556b2e866e7f5e28077e085a38e6ecc17c1b337 | 10e6ea3ea1aaae78105141bad6af2dea774c83e8 | /InClassExercise/JavaDIExercise/src/org/cs27x/dropbox/DropboxClient.java | 0c00631c4097a3844fb7c9a141f9a41b95607677 | [] | no_license | juleswhite/CS278 | 518d377df219dd8c441a96b798979b3b387d73ec | 411b96eef141874e798611dc18ee9588fc39fcb5 | refs/heads/master | 2021-01-14T14:16:57.039024 | 2013-10-01T17:08:33 | 2013-10-01T17:08:33 | 13,655,471 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,133 | java | package org.cs27x.dropbox;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchEvent.Kind;
import java.util.Map;
import org.cs27x.dropbox.DropboxCmd.OpCode;
import org.cs27x.filewatcher.FileEvent;
import org.cs27x.filewatcher.FileEventListener;
import org.cs27x.filewatcher.FileEventSource;
import org.cs27x.filewatcher.FileSystemState;
import org.cs27x.filewatcher.FileSystemStateImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
/**
* The DropboxClient is responsible for translating incoming DropboxCmds into
* changes on the local file system. The DropboxClient is also responsible for
* translating FileEvents into DropboxCmds and propagating them to other clients
* via the DropboxTransport.
*
*
* @author jules
*
*/
@Singleton
public class DropboxClient implements FileEventListener, DropboxCmdListener {
private static final Logger LOG = LoggerFactory
.getLogger(DropboxClient.class);
private static final Map<Kind<Path>, OpCode> EVENT_TYPE_TO_OPCODES = new ImmutableMap.Builder<WatchEvent.Kind<Path>, DropboxCmd.OpCode>()
.put(StandardWatchEventKinds.ENTRY_CREATE, OpCode.ADD)
.put(StandardWatchEventKinds.ENTRY_MODIFY, OpCode.UPDATE)
.put(StandardWatchEventKinds.ENTRY_DELETE, OpCode.REMOVE).build();
public interface CmdHandler {
public void handleCmd(DropboxCmd cmd) throws IOException;
}
private CmdHandler ADD_UPDATE_HANDLER = new CmdHandler() {
@Override
public void handleCmd(DropboxCmd cmd) throws IOException {
Path p = fileManager_.resolve(cmd.getPath());
fileManager_.write(p, cmd.getData(), true);
}
};
private CmdHandler REMOVE_HANDLER = new CmdHandler() {
@Override
public void handleCmd(DropboxCmd cmd) throws IOException {
Path p = fileManager_.resolve(cmd.getPath());
fileManager_.delete(p);
}
};
private final Map<OpCode, CmdHandler> OPCODE_TO_HANDLER = new ImmutableMap.Builder<OpCode, CmdHandler>()
.put(OpCode.ADD, ADD_UPDATE_HANDLER)
.put(OpCode.UPDATE, ADD_UPDATE_HANDLER)
.put(OpCode.REMOVE, REMOVE_HANDLER).build();
private final FileSystemState fileSystemState_;
private final FileManager fileManager_;
private final DropboxTransport transport_;
private final FileEventSource fileEvents_;
@Inject
public DropboxClient(FileManager fileManager, DropboxTransport transport) {
this(new FileSystemStateImpl(), null, fileManager, transport);
}
public DropboxClient(FileSystemState fileSystemState,
FileEventSource fileEvents, FileManager fileManager,
DropboxTransport transport) {
super();
fileEvents_ = fileEvents;
fileSystemState_ = fileSystemState;
fileManager_ = fileManager;
transport_ = transport;
if (transport_ != null) {
transport_.addCmdListener(this);
}
if (fileEvents_ != null) {
fileEvents_.addListener(this);
}
}
/**
* This method should translate FileEvents into DropboxCmds and publish them
* to the DropboxTransport as follows:
*
* 1. ENTRY_CREATE --> ADD 2. ENTRY_MODIFY --> UPDATE 3. ENTRY_DELETE -->
* REMOVE
*
* Create and modify cmds should be created with the data contained in the
* FileEvent.
*
* DropboxCmds should only be created if the FileSystemState indicates that
* they should be propagated.
*
*/
@Override
public void handleEvent(FileEvent rawEvt) {
if (EVENT_TYPE_TO_OPCODES.containsKey(rawEvt.getEventType())) {
final Path sharedPath = fileManager_.ensureRelative(rawEvt
.getFile());
final FileEvent evt = new FileEvent(rawEvt.getEventType(),
sharedPath, rawEvt.getData());
if (fileSystemState_.updateState(evt)) {
try {
final OpCode code = EVENT_TYPE_TO_OPCODES.get(evt
.getEventType());
final byte[] data = (evt.getEventType() != StandardWatchEventKinds.ENTRY_DELETE) ? fileManager_
.read(Paths.get(rawEvt.getPath())) : null;
final DropboxCmd cmd = new DropboxCmd(code, evt.getPath()
.toString(), data);
transport_.publish(cmd);
} catch (Exception e) {
LOG.error("Error dispatching file event.");
LOG.error("Exception:",e);
}
}
}
}
/**
* This method should add, update, and delete files in response to incoming
* DropboxCmds.
*
* Add/Update cmds should trigger a write on the FileManager with the data
* in the cmd.
*
* Remove cmds should trigger a delete on the FileManager
*
* All Paths should be resolved using the FileManager before invoking any
* file management operations.
*
* DropboxCmds should only be executed if the FileSystemState indicates that
* they should be propagated.
*/
@Override
public void handleCmd(DropboxCmd cmd) {
if (fileSystemState_.updateState(cmd)) {
try {
CmdHandler hdlr = OPCODE_TO_HANDLER.get(cmd.getOpCode());
hdlr.handleCmd(cmd);
} catch (IOException e) {
LOG.error("Unexpected exception processing cmd: [{}]", cmd);
LOG.error("Error:", e);
}
}
}
}
| [
"[email protected]"
] | |
9bdc957ed3f6a7bff1400595fc7cb2671c2c5495 | a78b493dbdc0b0d49f5b85bf6f8d2120b3020909 | /src/oldtypedip/TypedUniSend.java | 2b0bafa5e0a39d5748f8dd3031a7e21af9559c10 | [] | no_license | pdewan/GIPC | 6998839307eedf37dda0451bfe331c45c0bfc1b5 | 46c18824b7a5cf73bf12122023a714194a464415 | refs/heads/master | 2022-04-26T20:32:09.075467 | 2022-04-03T19:48:39 | 2022-04-03T19:48:39 | 16,309,078 | 3 | 6 | null | 2017-05-10T23:29:18 | 2014-01-28T10:45:03 | Java | UTF-8 | Java | false | false | 183 | java | package oldtypedip;
import java.io.Serializable;
public interface TypedUniSend {
void send(String remoteName, Serializable message);
void send (Serializable message);
}
| [
"[email protected]"
] | |
f85e89b928a457f9a3af5537ebd22c806f4bf242 | eec24b057c4bc6b7a2675d21c7501808bdab3511 | /src/main/java/Servlet/AcaoUsuario.java | 1f04b72ade7e0cdde9457ecc539c9d04b1584fd4 | [] | no_license | Dio-Rit/ControleDespesas | 39636797ba91847c3606acb0596444920edee538 | d537bc7376dab66bde3962c53ef2eb2f846fdf8a | refs/heads/master | 2023-06-10T12:50:54.881260 | 2021-06-30T23:31:42 | 2021-06-30T23:31:42 | 351,264,327 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,086 | 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 Servlet;
import DAO.UsuarioDAO;
import Entidade.Usuario;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author yNot
*/
public class AcaoUsuario extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet AcaoUsuario</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet AcaoUsuario at " + request.getContextPath() + "</h1>");
out.println("Ação Realizada com sucesso");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//processRequest(request, response);
String param = request.getParameter("param");
if (param.equals("EdUsuario")) {
String id = request.getParameter("id");
Usuario usu = new UsuarioDAO().consultarId(Integer.parseInt(id));
request.setAttribute("objUsuario", usu);
System.out.println(usu.getId());
encaminharPagina("../DAOUsuario/AtualizaUsuario.jsp", request, response);
} else if (param.equals("ExcluirUsuario")) {
UsuarioDAO b = new UsuarioDAO();
b.excluir1(Integer.parseInt(request.getParameter("id")));
response.sendRedirect("../DAOUsuario/ListarUsuarios.jsp");
} else if (param.equals("ListarUsuario")) {
int id = Integer.parseInt(request.getParameter("id"));
String nome = request.getParameter("nome");
String login = request.getParameter("login");
String senha = request.getParameter("senha");
String status = request.getParameter("x");
Usuario tl = new Usuario();
tl.setId(id);
tl.setNome(nome);
tl.setLogin(login);
tl.setSenha(senha);
tl.setX(status);
response.sendRedirect("../DAOUsuario/ListarUsuarios.jsp");
}
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// processRequest(request, response);
String param = request.getParameter("param");
String Nome = request.getParameter("Nome");
String Login = request.getParameter("Login");
String Senha = request.getParameter("Senha");
if (param.equals("SalvarUsuario")) {
Usuario u = new Usuario();
u.setNome(Nome);
u.setLogin(Login);
u.setSenha(Senha);
u.setX("A");
UsuarioDAO c = new UsuarioDAO();
c.salvar1(u);
response.sendRedirect("../DAOUsuario/ListarUsuarios.jsp");
} else if (param.equals("EditarUsuario")) {
Usuario u = new Usuario();
System.out.println(request.getParameter("id"));
System.out.println(request.getParameter("Nome"));
System.out.println(request.getParameter("Login"));
u.setId(Integer.parseInt(request.getParameter("id")));
u.setNome(request.getParameter("Nome"));
u.setLogin(request.getParameter("Login"));
u.setSenha(request.getParameter("Senha"));
u.setX("A");
UsuarioDAO a = new UsuarioDAO();
a.atualizar(u);
response.sendRedirect("../DAOUsuario/ListarUsuarios.jsp");
}
}
private void encaminharPagina(String pagina, HttpServletRequest request, HttpServletResponse response) {
try {
RequestDispatcher rd = request.getRequestDispatcher(pagina);
rd.forward(request, response);
} catch (Exception e) {
System.out.println("Erro ao encaminhar: " + e);
}
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
0fc4ad855f972c12af1685c394dd8c0420180d49 | bbb332a5a7972233923f0c8a24c7abf3174d1619 | /support_ui/src/main/java/com/fkh/support/ui/activity/RefreshLoadListViewActivity.java | c9d4bc77cd6ca47fbafc8f27d3b8a05cba15f84b | [] | no_license | dinghu/SupportUi | 07cddde372a2314991084480175badc8e73f02a9 | ea0bde77fef799564fa5032365f31e1d4649faab | refs/heads/master | 2020-05-07T22:22:34.053381 | 2019-04-12T06:39:11 | 2019-04-12T06:39:11 | 180,943,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,976 | java | package com.fkh.support.ui.activity;
import android.content.Context;
import android.view.View;
import android.widget.AbsListView;
import com.fkh.support.ui.adapter.BaseListAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.List;
public abstract class RefreshLoadListViewActivity<T> extends RefreshLoadActivity<T> {
private AbsListView listView;
private BaseListAdapter adapter;
private int itemLayout;
public void bindView(SmartRefreshLayout smartRefreshLayout, AbsListView listView, List<T> mData, int itemLayout) {
super.bindView(smartRefreshLayout, mData);
this.listView = listView;
this.itemLayout = itemLayout;
adapter = new ListAdapter(this, mData);
this.listView.setAdapter(this.adapter);
}
public AbsListView getListView() {
return listView;
}
public BaseListAdapter getAdapter() {
return adapter;
}
@Override
public void notifyDataSetChanged(boolean noMoreData) {
super.notifyDataSetChanged(noMoreData);
adapter.notifyDataSetChanged();
}
@Override
public void dealError(String message) {
super.dealError(message);
}
public abstract Object getViewHolder(View convertView);
public abstract void initializeViews(int position, T t, Object holder);
private class ListAdapter extends BaseListAdapter<T> {
public ListAdapter(Context context, List<T> list) {
super(list, context);
}
@Override
public int getItemLayout() {
return itemLayout;
}
@Override
public Object getViewHolder(View convertView) {
return RefreshLoadListViewActivity.this.getViewHolder(convertView);
}
@Override
public void initializeViews(int position, T object, Object holder) {
RefreshLoadListViewActivity.this.initializeViews(position, object, holder);
}
}
}
| [
"[email protected]"
] | |
5a3a1fd8aa8b53b64327bccdb9c0d94653b96ddf | ddd70ab9543c7012f4a7fa7e574fb146cb743a3c | /src/Model/Register.java | df65b83b113358eac8aaf01016fe972e83e75f98 | [] | no_license | ariboss89/Spk_Bipolar_Disorder | 841b427b84235ebb57cac5768adef7d88e617de3 | 8fd494915b38633e5c6caa84b7497218c4a84a87 | refs/heads/master | 2020-12-14T23:41:43.265474 | 2020-01-29T06:46:56 | 2020-01-29T06:46:56 | 234,912,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | 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 Model;
import com.sun.jndi.ldap.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import Controller.koneksi;
import View.FormLogin;
import View.FormAsGuest;
/**
*
* @author User
*/
public class Register{
private static String nama;
private static String alamat;
public static String getNama() {
return nama;
}
public static void setNama(String nama) {
Register.nama = nama;
}
public static String getAlamat() {
return alamat;
}
public static void setAlamat(String alamat) {
Register.alamat = alamat;
}
}
| [
"[email protected]"
] | |
ba400ef06b3c22d358942760dc4f91e7e38444ed | 30b77fed029a874b54579459e5a8055ada683b92 | /app/src/main/java/com/edu/aimt/AttendanceActivity.java | f97c7b554ae0c2b61f91bf97b4b2a1a044402f40 | [] | no_license | anvesh523/CollegeBusErp | e3e91e3c5f4a68d9ad910411bce0611a0f2580eb | cdcd4328d3044081e31ac6d2598920c1088fe527 | refs/heads/master | 2020-04-14T16:29:51.883599 | 2018-08-03T16:32:46 | 2018-08-03T16:32:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,654 | java | package com.edu.aimt;
import android.content.Intent;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.lylc.widget.circularprogressbar.CircularProgressBar;
import java.util.ArrayList;
public class AttendanceActivity extends AppCompatActivity implements
NavigationView.OnNavigationItemSelectedListener{
NavigationView navigationView;
int present=0, absent=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendance);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
View view = navigationView.getHeaderView(0);
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
imageView.setImageResource(0);
imageView.setImageBitmap(new BitmapDisplayer().convertToBitmap(BitmapDisplayer.buildArtist(9, this), 54, 54));
setDataSet();
}
public void setDataSet(){
final ArrayList<DataObject> res;
final RecyclerView mRecyclerView = (RecyclerView)findViewById(R.id.attendance_list);
mRecyclerView.setHasFixedSize(true);
final RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
res=getDataSet();
final AttendanceAdapter mAdapter = new AttendanceAdapter(res);
mAdapter.setOnItemClickListener(new AttendanceAdapter.OnItemClickListener() {
@Override
public void onItemClick(final int position, View v) {
// TODO Auto-generated method stub
int resid = v.getId();
Log.i("Position", position + "");
TextView name = (TextView) mLayoutManager.findViewByPosition(position).findViewById(R.id.mainContent);
if (resid == R.id.present || resid == R.id.absent) {
if (resid == R.id.present) {
present = present + 1;
Snackbar.make(findViewById(R.id.drawer_layout), name.getText().toString() + " is present", Snackbar.LENGTH_LONG).setAction("Undo", new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
mAdapter.addItem(res.get(position), position);
present = present - 1;
}
}).show();
} else {
absent = absent + 1;
Snackbar.make(findViewById(R.id.drawer_layout), name.getText().toString() + " is absent", Snackbar.LENGTH_LONG)
.setAction("Undo", new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
mAdapter.addItem(res.get(position), position);
absent = absent - 1;
}
}).show();
}
mAdapter.deleteItem(position);
if (mAdapter.getItemCount() <= 0)
setStats();
}
}
});
mRecyclerView.setAdapter(mAdapter);
}
private void setStats(){
findViewById(R.id.stats_container).setVisibility(View.VISIBLE);
final CircularProgressBar progressBar = (CircularProgressBar) findViewById(R.id.circularprogressbar1);
progressBar.animateProgressTo(0, (int) (present * 10), new CircularProgressBar.ProgressAnimationListener() {
@Override
public void onAnimationStart() {
}
@Override
public void onAnimationProgress(int progress) {
progressBar.setTitle(progress + "%");
}
@Override
public void onAnimationFinish() {
progressBar.setSubTitle("Present");
}
});
final CircularProgressBar progressBar1 = (CircularProgressBar) findViewById(R.id.circularprogressbar2);
progressBar1.animateProgressTo(0, 92, new CircularProgressBar.ProgressAnimationListener() {
@Override
public void onAnimationStart() {
}
@Override
public void onAnimationProgress(int progress) {
progressBar1.setTitle(progress + "%");
}
@Override
public void onAnimationFinish() {
progressBar1.setSubTitle("Present");
}
});
DefaulterAdapter defaulterAdapter = new DefaulterAdapter(this,getDefaulterSet());
ExpandableHeightListView listView = (ExpandableHeightListView) findViewById(R.id.defaulter_list);
listView.setVisibility(View.VISIBLE);
listView.setAdapter(defaulterAdapter);
listView.setExpanded(true);
}
private ArrayList<DataObject> getDefaulterSet() {
ArrayList<DataObject> results = new ArrayList<DataObject>();
String attendance[]={"32%","28%","26%","34%","40%"};
String branches[]=DetailsManager.getBranches(5);
String names[] =DetailsManager.getNames(5);
for (int index = 0; index < 5; index++) {
DataObject obj = new DataObject(names[index],
branches[index]+" Year",
attendance[index],
"");
results.add(index, obj);
}
return results;
}
private ArrayList<DataObject> getDataSet() {
ArrayList<DataObject> results = new ArrayList<DataObject>();
String branches[]=DetailsManager.getBranches(10);
String names[] =DetailsManager.getNames(10);
for (int index = 0; index < 10; index++) {
DataObject obj = new DataObject(names[index],
branches[index]+" Year",
""+index,
""+(20-index));
results.add(index, obj);
}
return results;
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.nav_attendance) {
// Handle the camera action
}
else if(id == R.id.nav_home) {
supportFinishAfterTransition();
}
else if(id == R.id.nav_schedule){
Intent i = new Intent(this,BusSchedule.class);
startActivity(i);
supportFinishAfterTransition();
}
else if(id == R.id.nav_bunk){
Intent i = new Intent(this,BunkActivity.class);
startActivity(i);
supportFinishAfterTransition();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
@Override
public void onResume(){
super.onResume();
navigationView.getMenu().findItem(R.id.nav_attendance).setChecked(true);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
}
| [
"[email protected]"
] | |
e66816bd5677ccbe66c022da4a212fcf1af5e767 | b60230401507d6dd86e4b419a53d16555fa76b00 | /src/main/java/com/example/springServer/repository/UserRepository.java | 6ab914c6bc679b9a9050e0286cdef43f94eda00f | [] | no_license | amerariia/DiplomServer | 2104bf24db3f100bcc9ec9cf8bfb4048d039390e | 4d19c044cbd9b7512b7742c12bbc689af25d5ec6 | refs/heads/master | 2023-05-12T22:42:05.121102 | 2021-06-05T13:35:47 | 2021-06-05T13:35:47 | 342,677,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.example.springServer.repository;
import com.example.springServer.entity.Group;
import com.example.springServer.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface UserRepository extends JpaRepository<User,Integer> {
Optional<User> findByEmailAndPassword(String email, String password);
List<User> findAllByGroup_Id(Integer id);
List<User> findAllByGroup_IdIn(List<Integer> ids);
}
| [
"[email protected]"
] | |
a084c56b30c7d8ebe120abefb98fbec7f0e990c7 | 56b1dff3a5cb0cef4b33158b4de6c5b4b8345018 | /src/main/java/com/bizflow/core/definition/DefinitionFactory.java | 543d7df3ebecaa8434d674943e27f819f04bac6d | [] | no_license | run-zheng/bizflow-framework | 9010086563d6ae17beb01531ddcc702d30251d69 | b6cd71f56ddf876389d40e044421a4c61af3ef50 | refs/heads/master | 2021-01-17T18:30:34.081509 | 2016-07-25T16:57:47 | 2016-07-25T16:57:47 | 63,613,748 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,901 | java | package com.bizflow.core.definition;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.bizflow.annotation.AutoInject;
import com.bizflow.annotation.BizFlowBuilder;
import com.bizflow.annotation.BizHandler;
import com.bizflow.annotation.DataProvider;
import com.bizflow.annotation.NotRequire;
import com.bizflow.annotation.Parameter;
import com.bizflow.annotation.Processor;
import com.bizflow.core.InjectNameGenerator;
import com.bizflow.core.context.FlowContext;
import com.bizflow.core.flow.builder.BizFlowConfigBuilder;
import com.bizflow.exception.RegisterException;
/**
* 创建definition的工厂, 用枚举实现单例简单点做
* @author zhengrun 2016年7月6日
*
*/
public enum DefinitionFactory {
INSTANCE;
private static final Logger logger = LoggerFactory.getLogger(DefinitionFactory.class);
public BizFlowDefinition createBizFlowConfigDefition(Method method){
logger.debug("handler biz flow builder processor: " + method.getDeclaringClass().getName() + " --> " + method.getName());
BizFlowBuilder flowBuilder = method.getAnnotation(BizFlowBuilder.class);
AbstractProcessorSimpleInfo simpleInfo = AbstractProcessorSimpleInfo.simpleInfo(flowBuilder);
BizFlowDefinition definition = createBizFlowDefinition(method, flowBuilder, simpleInfo);
return definition;
}
/**
* 创建并注册BizFlowDefintion
* @param method
* @param flowBuilder
* @param simpleInfo
*/
private BizFlowDefinition createBizFlowDefinition(Method method, BizFlowBuilder flowBuilder,
AbstractProcessorSimpleInfo simpleInfo) {
Class<?> returnType = method.getReturnType();
Type type = method.getGenericReturnType();
logger.debug(String.format("%-80s %s", " return type:"+ returnType.getName() , " genericType: " + type));
if(StringUtils.isEmpty(flowBuilder.value())){
throw new IllegalArgumentException("Biz Flow's value should not be empty");
}
if(returnType.isAssignableFrom(BizFlowConfigBuilder.class)){
throw new RegisterException("BizFlowBuilder's return type must be "
+ "instance of FlowConfig or subtype of FlowConfig");
}
BizFlowDefinition definition = createFlowBuilderDefinition(method, simpleInfo);
processFlowBuilderMethodParameter(method, returnType, definition);
return definition;
}
/**
* 处理BizFlowBuilder的方法参数
* @param method
* @param returnType
* @param definition
*/
private void processFlowBuilderMethodParameter(Method method, Class<?> returnType, BizFlowDefinition definition) {
Class<?>[] parameterTypes = method.getParameterTypes();
Type[] types = method.getGenericParameterTypes();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
if(parameterTypes != null && parameterTypes.length > 0 ) {
processParameterSetting(definition, true, parameterTypes, types, parameterAnnotations);
}
}
/**
* 创建BizFlowDefinition
* @param method
* @param simpleInfo
* @return
*/
private BizFlowDefinition createFlowBuilderDefinition(Method method, AbstractProcessorSimpleInfo simpleInfo) {
BizFlowDefinition definition = new BizFlowDefinition();
fillAbstraceDefinition(definition, method, simpleInfo.name(),
simpleInfo.alias() , simpleInfo.description());
return definition;
}
/**
* 从注解了BizHandler的方法创建ProcessorDefition
* @param method
* @return
*/
public ProcessorDefinition createBizHandlerProcessorDefinition(Method method){
logger.debug("handler bizhandler processor : "+ method.getDeclaringClass().getName()+" --> "+ method.getName());
BizHandler processor = method.getAnnotation(BizHandler.class);
AbstractProcessorSimpleInfo simpleInfo = AbstractProcessorSimpleInfo.simpleInfo(processor);
ProcessorDefinition definition = createProcessorDefinition(method, simpleInfo, "BizHandler Processor");
definition.setBizHandler(Boolean.TRUE);
definition.setFlowName(processor.flowName());
return definition;
}
/**
* 从注解了Processor的方法创建ProcessorDefinition
* @param method
* @return
*/
public ProcessorDefinition createProcessorDefinition(Method method){
Assert.notNull(method);
logger.debug("handler processor : "+ method.getDeclaringClass().getName()+" --> "+ method.getName());
Processor processor = method.getAnnotation(Processor.class);
Assert.notNull(processor);
AbstractProcessorSimpleInfo simpleInfo = AbstractProcessorSimpleInfo.simpleInfo(processor);
ProcessorDefinition definition = createProcessorDefinition(method, simpleInfo, "Processor");
return definition;
}
/**
* 创建并注册ProcessorDefinition
* @param method
* @param simpleInfo
* @param processorType
* @return
*/
private ProcessorDefinition createProcessorDefinition(Method method, AbstractProcessorSimpleInfo simpleInfo,
String processorType) {
Class<?> returnType = method.getReturnType();
Type type = method.getGenericReturnType();
logger.debug(String.format("%-80s %s", " return type:"+ returnType.getName() , " genericType: " + type));
if(StringUtils.isEmpty(simpleInfo.name())){
throw new IllegalArgumentException(processorType+"' value should not be empty");
}
ProcessorDefinition processorDefinition = createProcessorDefinition(method, simpleInfo);
processProcessorParameter(method, processorDefinition);
return processorDefinition;
}
private ProcessorDefinition createProcessorDefinition(Method method, AbstractProcessorSimpleInfo simpleInfo) {
ProcessorDefinition processorDefinition = new ProcessorDefinition();
fillAbstraceDefinition(processorDefinition, method, simpleInfo.name(),
simpleInfo.alias() , simpleInfo.description());
return processorDefinition;
}
private void processProcessorParameter(Method method, ProcessorDefinition processorDefinition) {
Class<?>[] parameterTypes = method.getParameterTypes();
Type[] types = method.getGenericParameterTypes();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
if(parameterTypes != null && parameterTypes.length > 0 ) {
processParameterSetting(processorDefinition, true,
parameterTypes, types, parameterAnnotations);
}
}
/**
* 根据注解的方法创建DataProviderDefinition
* @param method
* @return
*/
public DataProviderDefinition createDataProviderDefinition(Method method){
Assert.notNull(method);
logger.debug("handler data provider : "+ method.getDeclaringClass().getName()+" --> "+ method.getName());
DataProvider dataProvider = method.getAnnotation(DataProvider.class);
Assert.notNull(dataProvider);
Class<?> returnType = method.getReturnType();
Type type = method.getGenericReturnType();
logger.debug(String.format("%-80s %s", " return type:"+ returnType.getName() , " genericType: " + type));
if(StringUtils.isEmpty(dataProvider.value())){
throw new IllegalArgumentException("Data Provider's value should not be empty");
}
//生成dataProvider的名称
String dataProviderName = dataProvider.value();
if(StringUtils.isEmpty(dataProviderName)){
dataProviderName =InjectNameGenerator.generateBeanName(returnType);
}
DataProviderDefinition definition = createDataProviderDefinition(method, dataProvider, dataProviderName);
processDataProviderMethodParameter(method, returnType, definition);
return definition;
}
/**
* 创建DataProviderDefinition
* @param method
* @param dataProvider
* @param dataProviderName
* @return
*/
private DataProviderDefinition createDataProviderDefinition(Method method,
DataProvider dataProvider, String dataProviderName) {
DataProviderDefinition definition = new DataProviderDefinition();
fillAbstraceDefinition(definition, method, dataProviderName, StringUtils.isEmpty(dataProvider.alias()) ?
dataProviderName : dataProvider.alias(), dataProvider.description());
definition.setIsGlobal(dataProvider.global());
definition.setIsAsync(dataProvider.async());
definition.setScope(dataProvider.scope());
definition.setTimeOut(dataProvider.timeOut(), dataProvider.timeUnit());
return definition;
}
/**
* 解析DataProvider的参数
* @param method
* @param returnType
* @param definition
*/
private void processDataProviderMethodParameter(Method method, Class<?> returnType,
DataProviderDefinition definition) {
boolean requireInjectContext = false;
boolean hasContext = false;
if(returnType.isAssignableFrom(void.class)){
requireInjectContext = true;
}
Class<?>[] parameterTypes = method.getParameterTypes();
Type[] types = method.getGenericParameterTypes();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
if(parameterTypes != null && parameterTypes.length > 0 ) {
hasContext = processParameterSetting(definition, hasContext,
parameterTypes, types, parameterAnnotations);
}
if(requireInjectContext && !hasContext){
throw new RegisterException("Void return type data provider requires inject FlowContext");
}
}
private AbstractDefinition fillAbstraceDefinition(AbstractDefinition definition,
Method method, String name, String alias, String description){
if(!method.isAccessible()){
if(Modifier.isPublic(method.getModifiers())){
method.setAccessible(true);
}else {
throw new RegisterException("method can't access");
}
}
Class<?> declareingClass = method.getDeclaringClass();
definition.setBeanNameAndType(declareingClass);
definition.setMethod(method);
definition.setIsStaticMethod(Modifier.isStatic(method.getModifiers()));
definition.setClazz(declareingClass);
definition.setName(name);
definition.setAlias(alias);
definition.setDescription(description);
definition.setReturnType(method.getReturnType());
return definition;
}
private boolean processParameterSetting(AbstractDefinition definition, boolean hasContext,
Class<?>[] parameterTypes, Type[] types, Annotation[][] parameterAnnotations) {
for(int i = 0; i < parameterTypes.length; i++){
Class<?> parameterType = parameterTypes[i];
Type type = types[i];
logger.debug(String.format("%-80s %s", " parameter type:"+ parameterType.getName() , " genericType: " + type));
ParameterSetting parameterSetting = new ParameterSetting();
parameterSetting.setIndex(i);
parameterSetting.setType(parameterType);
if(parameterAnnotations[i] != null) {
for(int j = 0; j < parameterAnnotations[i].length; j++){
Annotation annotation = parameterAnnotations[i][j];
processParameterAnnotation(parameterSetting, annotation);
}
}
if(StringUtils.isEmpty(parameterSetting.getAnnotatedName())){
String typeString = type.toString();
if(typeString.startsWith("class") && !typeString.startsWith("class [")
|| typeString.startsWith("interface")){
//如果是类或接口,直接将类或接口的端名称作为
String candidateName = InjectNameGenerator.generateBeanName(parameterType);;
parameterSetting.setName(candidateName);
/*parameterSetting.setAnnotatedName(candidateName);*/
}else {
throw new RegisterException("Array/Collection/Map/GenericType/GenericTypeArray"
+ " requires annotated name");
}
}
/*if(!StringUtils.isEmpty(parameterSetting.getAnnotatedName())
&& parameterSetting.isAutoInject()){
throw new RegisterException();
}*/
/*if(StringUtils.isEmpty(parameterSetting.getName())){
parameterSetting.setName(ClassUtils.getShortName(parameterType));
}*/
if(parameterTypes[i].isAssignableFrom(FlowContext.class)){
hasContext = true;
}
definition.addParameterSetting(parameterSetting);
}
return hasContext;
}
private void processParameterAnnotation(ParameterSetting parameterSetting, Annotation annotation) {
if(annotation != null){
if(annotation instanceof Parameter){
Parameter parameter = (Parameter)annotation;
parameterSetting.setName(parameter.value());
parameterSetting.setAnnotatedName(parameter.value());
parameterSetting.setRequire(parameter.require());
}
if(annotation instanceof NotRequire){
parameterSetting.setRequire(Boolean.TRUE);
}
if(annotation instanceof AutoInject){
AutoInject autoInject = (AutoInject)annotation;
parameterSetting.setAutoInject(autoInject.value());
}
}
}
private static abstract class AbstractProcessorSimpleInfo{
public abstract String name();
public abstract String alias();
public abstract String description();
public static AbstractProcessorSimpleInfo simpleInfo(final BizFlowBuilder bizFlowBuilder){
return new AbstractProcessorSimpleInfo() {
@Override
public String name() {
return bizFlowBuilder.value();
}
@Override
public String description() {
return bizFlowBuilder.description();
}
@Override
public String alias() {
return bizFlowBuilder.value();
}
};
}
public static AbstractProcessorSimpleInfo simpleInfo(final BizHandler processor){
return new AbstractProcessorSimpleInfo() {
@Override
public String name() {
return processor.value();
}
@Override
public String description() {
return processor.description();
}
@Override
public String alias() {
return processor.value();
}
};
}
public static AbstractProcessorSimpleInfo simpleInfo(final Processor processor){
return new AbstractProcessorSimpleInfo() {
@Override
public String name() {
return processor.value();
}
@Override
public String description() {
return processor.description();
}
@Override
public String alias() {
return processor.value();
}
};
}
}
}
| [
"[email protected]"
] | |
2f061e44825e392b0b8793816d14261531d372d9 | 0ac8dc02f47d03718e5691474465ab53ec586086 | /core/src/test/java/com/netflix/conductor/validations/WorkflowDefConstraintTest.java | 17ed4500e1e7f6c8754f16a013f0b0df76ddd8d4 | [
"Apache-2.0"
] | permissive | bharadwajrembar/conductor | 324f128cb860f5151a53785aaad631778d4b2f91 | 4f3be168e412e3fb6007f5633073e2afb664d2db | refs/heads/master | 2020-06-15T01:15:31.586000 | 2019-11-23T02:19:54 | 2019-11-23T02:19:54 | 195,173,184 | 2 | 0 | Apache-2.0 | 2019-11-23T02:27:00 | 2019-07-04T05:17:13 | Java | UTF-8 | Java | false | false | 6,242 | java | package com.netflix.conductor.validations;
import com.netflix.conductor.common.metadata.tasks.TaskDef;
import com.netflix.conductor.common.metadata.workflow.TaskType;
import com.netflix.conductor.common.metadata.workflow.WorkflowDef;
import com.netflix.conductor.common.metadata.workflow.WorkflowTask;
import com.netflix.conductor.dao.MetadataDAO;
import org.hibernate.validator.HibernateValidator;
import org.hibernate.validator.HibernateValidatorConfiguration;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
public class WorkflowDefConstraintTest {
private Validator validator;
private MetadataDAO mockMetadataDao;
private HibernateValidatorConfiguration config;
@Before
public void init() {
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
validator = vf.getValidator();
mockMetadataDao = Mockito.mock(MetadataDAO.class);
ValidationContext.initialize(mockMetadataDao);
config = Validation.byProvider(HibernateValidator.class).configure();
}
@Test
public void testWorkflowTaskName() {
TaskDef taskDef = new TaskDef();//name is null
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Object>> result = validator.validate(taskDef);
assertEquals(1, result.size());
}
@Test
public void testWorkflowTaskSimple() {
WorkflowDef workflowDef = new WorkflowDef();
workflowDef.setName("sampleWorkflow");
workflowDef.setDescription("Sample workflow def");
workflowDef.setVersion(2);
WorkflowTask workflowTask_1 = new WorkflowTask();
workflowTask_1.setName("task_1");
workflowTask_1.setTaskReferenceName("task_1");
workflowTask_1.setType(TaskType.TASK_TYPE_SIMPLE);
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("fileLocation", "${workflow.input.fileLocation}");
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
Set<ConstraintViolation<WorkflowDef>> result = validator.validate(workflowDef);
assertEquals(0, result.size());
}
@Test
/*Testcase to check inputParam is not valid
*/
public void testWorkflowTaskInvalidInputParam() {
WorkflowDef workflowDef = new WorkflowDef();
workflowDef.setName("sampleWorkflow");
workflowDef.setDescription("Sample workflow def");
workflowDef.setVersion(2);
WorkflowTask workflowTask_1 = new WorkflowTask();
workflowTask_1.setName("task_1");
workflowTask_1.setTaskReferenceName("task_1");
workflowTask_1.setType(TaskType.TASK_TYPE_SIMPLE);
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("fileLocation", "${work.input.fileLocation}");
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
validator = factory.getValidator();
when(mockMetadataDao.getTaskDef("work1")).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowDef>> result = validator.validate(workflowDef);
assertEquals(1, result.size());
assertEquals(result.iterator().next().getMessage(), "taskReferenceName: work for given task: task_1 input value: fileLocation of input parameter: ${work.input.fileLocation} is not defined in workflow definition.");
}
@Test
public void testWorkflowTaskReferenceNameNotUnique() {
WorkflowDef workflowDef = new WorkflowDef();
workflowDef.setName("sampleWorkflow");
workflowDef.setDescription("Sample workflow def");
workflowDef.setVersion(2);
WorkflowTask workflowTask_1 = new WorkflowTask();
workflowTask_1.setName("task_1");
workflowTask_1.setTaskReferenceName("task_1");
workflowTask_1.setType(TaskType.TASK_TYPE_SIMPLE);
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("fileLocation", "${task_2.input.fileLocation}");
workflowTask_1.setInputParameters(inputParam);
WorkflowTask workflowTask_2 = new WorkflowTask();
workflowTask_2.setName("task_2");
workflowTask_2.setTaskReferenceName("task_1");
workflowTask_2.setType(TaskType.TASK_TYPE_SIMPLE);
workflowTask_2.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
tasks.add(workflowTask_2);
workflowDef.setTasks(tasks);
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
validator = factory.getValidator();
when(mockMetadataDao.getTaskDef(anyString())).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowDef>> result = validator.validate(workflowDef);
assertEquals(3, result.size());
List<String> validationErrors = new ArrayList<>();
result.forEach(e -> validationErrors.add(e.getMessage()));
assertTrue(validationErrors.contains("taskReferenceName: task_2 for given task: task_2 input value: fileLocation of input parameter: ${task_2.input.fileLocation} is not defined in workflow definition."));
assertTrue(validationErrors.contains("taskReferenceName: task_2 for given task: task_1 input value: fileLocation of input parameter: ${task_2.input.fileLocation} is not defined in workflow definition."));
assertTrue(validationErrors.contains("taskReferenceName: task_1 should be unique across tasks for a given workflowDefinition: sampleWorkflow"));
}
}
| [
"[email protected]"
] | |
5196a1d3b0df2ba1347785e3dccc4b993ff58f03 | 0721305fd9b1c643a7687b6382dccc56a82a2dad | /src/app.zenly.locator_4.8.0_base_source_from_JADX/sources/app/zenly/locator/map/marker/C4263u.java | ef889d4f141600e96ebae7e49ea29c8712e3386b | [] | no_license | a2en/Zenly_re | 09c635ad886c8285f70a8292ae4f74167a4ad620 | f87af0c2dd0bc14fd772c69d5bc70cd8aa727516 | refs/heads/master | 2020-12-13T17:07:11.442473 | 2020-01-17T04:32:44 | 2020-01-17T04:32:44 | 234,470,083 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package app.zenly.locator.map.marker;
import java.util.Comparator;
/* renamed from: app.zenly.locator.map.marker.u */
/* compiled from: lambda */
public final /* synthetic */ class C4263u implements Comparator {
/* renamed from: e */
public static final /* synthetic */ C4263u f11437e = new C4263u();
private /* synthetic */ C4263u() {
}
public final int compare(Object obj, Object obj2) {
return Integer.compare(((C4178e0) obj2).mo11040i(), ((C4178e0) obj).mo11040i());
}
}
| [
"[email protected]"
] | |
0a61a534febe84274b03e66b53b8d986bc74be3a | 8cf240a0c59ac64d86c173fa03839e55fcf86ae6 | /src/main/java/com/campushare/config/ThymeleafConfiguration.java | 804a5d297862781aed03ed05196236b7d80938d1 | [] | no_license | Alpccelik/CampuShare | 9fb0438af5789f1e203c3504ccebcbb800169c30 | 2dbda8e19c11f8ea603d56689fa14e98fc2bca29 | refs/heads/master | 2020-03-10T01:41:56.844294 | 2018-05-16T23:04:53 | 2018-05-16T23:04:53 | 129,116,707 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 983 | java | package com.campushare.config;
import org.apache.commons.lang3.CharEncoding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.*;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
@Configuration
public class ThymeleafConfiguration {
@SuppressWarnings("unused")
private final Logger log = LoggerFactory.getLogger(ThymeleafConfiguration.class);
@Bean
@Description("Thymeleaf template resolver serving HTML 5 emails")
public ClassLoaderTemplateResolver emailTemplateResolver() {
ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver();
emailTemplateResolver.setPrefix("mails/");
emailTemplateResolver.setSuffix(".html");
emailTemplateResolver.setTemplateMode("HTML5");
emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8);
emailTemplateResolver.setOrder(1);
return emailTemplateResolver;
}
}
| [
"[email protected]"
] | |
5f58e6cf15e45e7621e1ecb7e098150dba0fa6a2 | b8e593b4a7588e8275736514ab6d7247e06b84f8 | /src/Chapter_11/DistinctNumbers.java | 107a2902fac03c71115a5a217c9c6cfb5ed9f80c | [] | no_license | Partynin/Introduction_to_java | 1cf439ba4c7f686c45eb929525f3639bf96e51e9 | b7bd6f1646ca95eb8c819888d0cc9eaa26cb946f | refs/heads/master | 2020-03-09T10:15:09.169268 | 2018-06-11T15:12:50 | 2018-06-11T15:12:50 | 128,716,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package Chapter_11;
import java.util.ArrayList;
import java.util.Scanner;
public class DistinctNumbers {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<>();
Scanner input = new Scanner(System.in);
System.out.print("Enter integers (input ends with 0): ");
int value;
do {
value = input.nextInt(); // Read a value from the input
if (!list.contains(value) && value != 0)
list.add(value); // Add value if it not in the list
} while (value != 0);
// Display the distinct list
for (int i = 0; i < list.size(); i++) {
System.out.print(list.get(i) + " ");
}
System.out.println();
for (int number: list)
System.out.print(number + " ");
}
}
| [
"[email protected]"
] | |
ac0d84cd3578fa681b404d2a93a3309e56a7df75 | 24d8cf871b092b2d60fc85d5320e1bc761a7cbe2 | /JFreeChart/rev91-1538/right-trunk-1538/source/org/jfree/chart/title/LegendTitle.java | 72e13def8a3e3b47363c9fc2ddba0966e8858611 | [] | 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 | 11,979 | java |
package org.jfree.chart.title;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.jfree.chart.LegendItem;
import org.jfree.chart.LegendItemCollection;
import org.jfree.chart.LegendItemSource;
import org.jfree.chart.block.Arrangement;
import org.jfree.chart.block.Block;
import org.jfree.chart.block.BlockContainer;
import org.jfree.chart.block.BlockFrame;
import org.jfree.chart.block.BorderArrangement;
import org.jfree.chart.block.CenterArrangement;
import org.jfree.chart.block.ColumnArrangement;
import org.jfree.chart.block.FlowArrangement;
import org.jfree.chart.block.LabelBlock;
import org.jfree.chart.block.RectangleConstraint;
import org.jfree.chart.event.TitleChangeEvent;
import org.jfree.chart.util.PaintUtilities;
import org.jfree.chart.util.PublicCloneable;
import org.jfree.chart.util.RectangleAnchor;
import org.jfree.chart.util.RectangleEdge;
import org.jfree.chart.util.RectangleInsets;
import org.jfree.chart.util.SerialUtilities;
import org.jfree.chart.util.Size2D;
public class LegendTitle extends Title
implements Cloneable, PublicCloneable, Serializable {
private static final long serialVersionUID = 2644010518533854633L;
public static final Font DEFAULT_ITEM_FONT
= new Font("SansSerif", Font.PLAIN, 12);
public static final Paint DEFAULT_ITEM_PAINT = Color.black;
private LegendItemSource[] sources;
private transient Paint backgroundPaint;
private RectangleEdge legendItemGraphicEdge;
private RectangleAnchor legendItemGraphicAnchor;
private RectangleAnchor legendItemGraphicLocation;
private RectangleInsets legendItemGraphicPadding;
private Font itemFont;
private transient Paint itemPaint;
private RectangleInsets itemLabelPadding;
private BlockContainer items;
private Arrangement hLayout;
private Arrangement vLayout;
private BlockContainer wrapper;
public LegendTitle(LegendItemSource source) {
this(source, new FlowArrangement(), new ColumnArrangement());
}
public LegendTitle(LegendItemSource source,
Arrangement hLayout, Arrangement vLayout) {
this.sources = new LegendItemSource[] {source};
this.items = new BlockContainer(hLayout);
this.hLayout = hLayout;
this.vLayout = vLayout;
this.backgroundPaint = null;
this.legendItemGraphicEdge = RectangleEdge.LEFT;
this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
this.legendItemGraphicLocation = RectangleAnchor.CENTER;
this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.itemFont = DEFAULT_ITEM_FONT;
this.itemPaint = DEFAULT_ITEM_PAINT;
this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
}
public LegendItemSource[] getSources() {
return this.sources;
}
public void setSources(LegendItemSource[] sources) {
if (sources == null) {
throw new IllegalArgumentException("Null 'sources' argument.");
}
this.sources = sources;
notifyListeners(new TitleChangeEvent(this));
}
public Paint getBackgroundPaint() {
return this.backgroundPaint;
}
public void setBackgroundPaint(Paint paint) {
this.backgroundPaint = paint;
notifyListeners(new TitleChangeEvent(this));
}
public RectangleEdge getLegendItemGraphicEdge() {
return this.legendItemGraphicEdge;
}
public void setLegendItemGraphicEdge(RectangleEdge edge) {
if (edge == null) {
throw new IllegalArgumentException("Null 'edge' argument.");
}
this.legendItemGraphicEdge = edge;
notifyListeners(new TitleChangeEvent(this));
}
public RectangleAnchor getLegendItemGraphicAnchor() {
return this.legendItemGraphicAnchor;
}
public void setLegendItemGraphicAnchor(RectangleAnchor anchor) {
if (anchor == null) {
throw new IllegalArgumentException("Null 'anchor' point.");
}
this.legendItemGraphicAnchor = anchor;
}
public RectangleAnchor getLegendItemGraphicLocation() {
return this.legendItemGraphicLocation;
}
public void setLegendItemGraphicLocation(RectangleAnchor anchor) {
this.legendItemGraphicLocation = anchor;
}
public RectangleInsets getLegendItemGraphicPadding() {
return this.legendItemGraphicPadding;
}
public void setLegendItemGraphicPadding(RectangleInsets padding) {
if (padding == null) {
throw new IllegalArgumentException("Null 'padding' argument.");
}
this.legendItemGraphicPadding = padding;
notifyListeners(new TitleChangeEvent(this));
}
public Font getItemFont() {
return this.itemFont;
}
public void setItemFont(Font font) {
if (font == null) {
throw new IllegalArgumentException("Null 'font' argument.");
}
this.itemFont = font;
notifyListeners(new TitleChangeEvent(this));
}
public Paint getItemPaint() {
return this.itemPaint;
}
public void setItemPaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.itemPaint = paint;
notifyListeners(new TitleChangeEvent(this));
}
public RectangleInsets getItemLabelPadding() {
return this.itemLabelPadding;
}
public void setItemLabelPadding(RectangleInsets padding) {
if (padding == null) {
throw new IllegalArgumentException("Null 'padding' argument.");
}
this.itemLabelPadding = padding;
notifyListeners(new TitleChangeEvent(this));
}
protected void fetchLegendItems() {
this.items.clear();
RectangleEdge p = getPosition();
if (RectangleEdge.isTopOrBottom(p)) {
this.items.setArrangement(this.hLayout);
}
else {
this.items.setArrangement(this.vLayout);
}
for (int s = 0; s < this.sources.length; s++) {
LegendItemCollection legendItems = this.sources[s].getLegendItems();
if (legendItems != null) {
for (int i = 0; i < legendItems.getItemCount(); i++) {
LegendItem item = legendItems.get(i);
Block block = createLegendItemBlock(item);
this.items.add(block);
}
}
}
}
protected Block createLegendItemBlock(LegendItem item) {
BlockContainer result = null;
LegendGraphic lg = new LegendGraphic(item.getShape(),
item.getFillPaint());
lg.setFillPaintTransformer(item.getFillPaintTransformer());
lg.setShapeFilled(item.isShapeFilled());
lg.setLine(item.getLine());
lg.setLineStroke(item.getLineStroke());
lg.setLinePaint(item.getLinePaint());
lg.setLineVisible(item.isLineVisible());
lg.setShapeVisible(item.isShapeVisible());
lg.setShapeOutlineVisible(item.isShapeOutlineVisible());
lg.setOutlinePaint(item.getOutlinePaint());
lg.setOutlineStroke(item.getOutlineStroke());
lg.setPadding(this.legendItemGraphicPadding);
LegendItemBlockContainer legendItem = new LegendItemBlockContainer(
new BorderArrangement(), item.getDataset(),
item.getSeriesKey());
lg.setShapeAnchor(getLegendItemGraphicAnchor());
lg.setShapeLocation(getLegendItemGraphicLocation());
legendItem.add(lg, this.legendItemGraphicEdge);
Font textFont = item.getLabelFont();
if (textFont == null) {
textFont = this.itemFont;
}
Paint textPaint = item.getLabelPaint();
if (textPaint == null) {
textPaint = this.itemPaint;
}
LabelBlock labelBlock = new LabelBlock(item.getLabel(), textFont,
textPaint);
labelBlock.setPadding(this.itemLabelPadding);
legendItem.add(labelBlock);
legendItem.setToolTipText(item.getToolTipText());
legendItem.setURLText(item.getURLText());
result = new BlockContainer(new CenterArrangement());
result.add(legendItem);
return result;
}
public BlockContainer getItemContainer() {
return this.items;
}
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
Size2D result = new Size2D();
fetchLegendItems();
if (this.items.isEmpty()) {
return result;
}
BlockContainer container = this.wrapper;
if (container == null) {
container = this.items;
}
RectangleConstraint c = toContentConstraint(constraint);
Size2D size = container.arrange(g2, c);
result.height = calculateTotalHeight(size.height);
result.width = calculateTotalWidth(size.width);
return result;
}
public void draw(Graphics2D g2, Rectangle2D area) {
draw(g2, area, null);
}
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
Rectangle2D target = (Rectangle2D) area.clone();
target = trimMargin(target);
if (this.backgroundPaint != null) {
g2.setPaint(this.backgroundPaint);
g2.fill(target);
}
BlockFrame border = getFrame();
border.draw(g2, target);
border.getInsets().trim(target);
BlockContainer container = this.wrapper;
if (container == null) {
container = this.items;
}
target = trimPadding(target);
return container.draw(g2, target, params);
}
public BlockContainer getWrapper() {
return this.wrapper;
}
public void setWrapper(BlockContainer wrapper) {
this.wrapper = wrapper;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof LegendTitle)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
LegendTitle that = (LegendTitle) obj;
if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {
return false;
}
if (this.legendItemGraphicEdge != that.legendItemGraphicEdge) {
return false;
}
if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor) {
return false;
}
if (this.legendItemGraphicLocation != that.legendItemGraphicLocation) {
return false;
}
if (!this.itemFont.equals(that.itemFont)) {
return false;
}
if (!this.itemPaint.equals(that.itemPaint)) {
return false;
}
if (!this.hLayout.equals(that.hLayout)) {
return false;
}
if (!this.vLayout.equals(that.vLayout)) {
return false;
}
return true;
}
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
SerialUtilities.writePaint(this.backgroundPaint, stream);
SerialUtilities.writePaint(this.itemPaint, stream);
}
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.itemPaint = SerialUtilities.readPaint(stream);
}
}
| [
"[email protected]"
] | |
3f237c21179847210943535007330fb552284ba0 | 4a37ed60c596297dd2462d63e90f4f889c796315 | /src/main/java/ru/maksimov/Music.java | e17609acccc78e74634217dcf08b2f1bcd1a8fbf | [] | no_license | Aleksandr-bit123/SpringProject | 3005cce30b8ebe2c7eeba695e63da97ba035ec6b | 30b9d97ffd7f8ebb18fb8ca569b58138da350fc6 | refs/heads/master | 2023-03-07T23:44:55.245377 | 2021-02-17T14:33:07 | 2021-02-17T14:33:07 | 339,726,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package ru.maksimov;
public interface Music {
String getSong();
}
| [
"[email protected]"
] | |
1616e462ea1de6ee0986c9624812e76d69dc1f49 | 74d374c2249a04346d12ba09e492473c991a1b06 | /Printing Half Diamond pattern/Main.java | 3b118668f19b17ff4925501f1a18034224ae5834 | [] | no_license | Ameerkhatib/Playground | c0b75134a20c951f0779ba323690ed5690c7a4b2 | 2a63b85f7f4b2fb8949599f307f25b343a1c7166 | refs/heads/master | 2020-04-14T12:45:34.324632 | 2019-10-14T09:04:13 | 2019-10-14T09:04:13 | 163,849,776 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | import java.util.Scanner;
class Main {
public static void main (String[] args){
// Type your code here
Scanner in=new Scanner(System.in);
int n=in.nextInt();
for(int row=1;row<=n;row++)
{
for(int space=1;space<=(n-row);space++)
{
System.out.print(" ");
}
for(int col=1;col<=(2*row-1);col++)
{
System.out.print("*");
}
System.out.println();
}
}
} | [
"[email protected]"
] | |
b8d9b30c9de2f0784c888aac6819c9a7ca6c720d | 44fa41d28ab3bef6281ea126c31c66ea8436d6ce | /ArrayList Assignment/Question2.java | b7573d3aced3b085da96040f56465c087e6510bb | [] | no_license | choukendra/arraylist-assignment-1 | 6b315610392b17ac9262bd8b2fd0a78410e3c9d4 | acbbc9503fb20b012742e64ff9e1aaff0aabe191 | refs/heads/main | 2023-02-15T17:08:11.821819 | 2021-01-08T21:10:23 | 2021-01-08T21:10:23 | 327,827,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 871 | java | import java.util.ArrayList;
class Question2 {
public static void removeSmallest(ArrayList<Integer> nums) {
//This method removes the smallest number in the list nums
if(nums.size() == 0) return;
int small = nums.get(0);
int smallIndex = 0;
for(int i = 0; i < nums.size(); i++){
if(nums.get(i) < small){
small = nums.get(i);
smallIndex = i;
}
}
nums.remove(smallIndex);
}
public static void main (String[] args) {
ArrayList<Integer> nums = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
nums.add( (int) (Math.random()*100) );
}
System.out.println("Our list before: " + nums);
removeSmallest(nums);
System.out.println("Our list after: " + nums);
}
}
| [
"[email protected]"
] | |
ed9adcf3450abeffc21113b8afe3858b5dd1fe38 | 8e76d6cb52c086850f207d0b912749000fae0390 | /src/com/android/launcher20/util/ToastUtil.java | 0f28c7961868b4864f4e98beda3f344cf2d4cb66 | [
"Apache-2.0"
] | permissive | xinlyun/Launcher20 | 4269a906e94a12d9f5391c37dbf1df80515e7912 | 5dd87b21afcc750c388478559dc378b8617a8ee0 | refs/heads/master | 2021-01-25T07:39:37.233128 | 2015-11-09T05:41:53 | 2015-11-09T05:41:53 | 42,281,294 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | /**
*
*/
package com.android.launcher20.util;
import android.content.Context;
import android.widget.Toast;
public class ToastUtil {
public static void show(Context context, String info) {
Toast.makeText(context, info, Toast.LENGTH_LONG).show();
}
public static void show(Context context, int info) {
Toast.makeText(context, info, Toast.LENGTH_LONG).show();
}
}
| [
"="
] | = |
c0297b073af27a8a11d14ca0e46b9840097c8469 | d9f02127e59d5118fb60054278045a196e43033f | /src/main/java/com/fast/family/tomcat/TomcatGracefulShutdown.java | 98d442c505902f6831202d0c31c713f4bd110546 | [
"Apache-2.0"
] | permissive | sanrentai/fast-family-master | 6e1a8d87b1856b36caa7af8c0c3c4960e68d55f1 | e26fe64d862559dd9e2754a4c48f07af263706b6 | refs/heads/master | 2020-03-29T22:48:48.073044 | 2018-09-26T09:14:01 | 2018-09-26T09:14:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,855 | java | package com.fast.family.tomcat;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Slf4j
public class TomcatGracefulShutdown implements TomcatConnectorCustomizer,ApplicationListener<ContextClosedEvent> {
private volatile Connector connector;
private final TomcatGracefulShutdownProperties tomcatGracefulShutdownProperties;
public TomcatGracefulShutdown(TomcatGracefulShutdownProperties tomcatGracefulShutdownProperties) {
this.tomcatGracefulShutdownProperties = tomcatGracefulShutdownProperties;
}
@Override
public void customize(Connector connector) {
if (connector == null){
log.info("We are running unit test");
return;
}
final Executor executor = connector.getProtocolHandler().getExecutor();
if (executor instanceof ThreadPoolExecutor){
log.info("executor is ThreadPoolExecutor");
final ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;
if (threadPoolExecutor.isTerminated()){
log.info("thread pool executor has terminated");
} else {
LocalDateTime startShutdown = LocalDateTime.now();
LocalDateTime stopShutdown = LocalDateTime.now();
try{
threadPoolExecutor.shutdown();
if (!threadPoolExecutor
.awaitTermination(tomcatGracefulShutdownProperties.getWaitTime(), TimeUnit.SECONDS)){
log.warn("Tomcat thread pool did not shut down gracefully within"
+ tomcatGracefulShutdownProperties.getWaitTime() + " second(s). Proceeding with force shutdown");
threadPoolExecutor.shutdownNow();
} else {
log.info("Tomcat thread pool is empty,we stop now");
}
} catch (Exception e){
log.error("The await termination has been interrupted : " + e.getMessage());
Thread.currentThread().interrupt();;
} finally {
final long seconds = Duration.between(startShutdown,stopShutdown).getSeconds();
log.info("Shutdown performed in " + seconds + " second(s)");
}
}
}
}
@Override
public void onApplicationEvent(ContextClosedEvent contextClosedEvent) {
}
}
| [
"[email protected]"
] | |
a55c2375e68d942a8ccae1faf08c53993cfb650c | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/card/ui/v2/CardInvalidTicketListUI$i.java | 9255de3f6140d4a60458cbef333be5702b26856c | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,392 | java | package com.tencent.mm.plugin.card.ui.v2;
import a.l;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
@l(dWo={1, 1, 13}, dWp={""}, dWq={"<anonymous>", "", "it", "Landroid/view/MenuItem;", "kotlin.jvm.PlatformType", "onMenuItemClick"})
final class CardInvalidTicketListUI$i
implements MenuItem.OnMenuItemClickListener
{
CardInvalidTicketListUI$i(CardInvalidTicketListUI paramCardInvalidTicketListUI)
{
}
public final boolean onMenuItemClick(MenuItem paramMenuItem)
{
AppMethodBeat.i(89263);
com.tencent.mm.ui.base.h.a((Context)this.kpK.dxU(), false, this.kpK.getString(2131297886), "", this.kpK.getString(2131298421), this.kpK.getString(2131298419), (DialogInterface.OnClickListener)new CardInvalidTicketListUI.i.1(this), (DialogInterface.OnClickListener)CardInvalidTicketListUI.i.2.kpP);
com.tencent.mm.plugin.report.service.h.pYm.e(16322, new Object[] { Integer.valueOf(10) });
AppMethodBeat.o(89263);
return false;
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.card.ui.v2.CardInvalidTicketListUI.i
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
4f8ecce8c76da2926b39f4b2049ab435bc1d9720 | bb41a97577420ff7dc84f55b5a0a9356516f82bf | /DropdownAssignment.java | d66860dfcb78d2b5158cb4b44a2390ca984af301 | [] | no_license | Rajstar02/Raj-java | 8e1685c1fa2ce0576d286a82dfa42114d160bc75 | 0ec40cbe37980903d2a4daa3a912129182c02597 | refs/heads/main | 2023-04-07T04:07:04.331191 | 2021-04-25T07:22:38 | 2021-04-25T07:22:38 | 358,293,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package week2.day1;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class DropdownAssignment {
public static void main(String[] args) throws InterruptedException {
WebDriverManager.chromedriver().setup();
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.leafground.com/");
driver.manage().window().maximize();
driver.findElementByLinkText("Drop down").click();
Thread.sleep(2000);
driver.close();
}
}
| [
"[email protected]"
] | |
b68649503335167ccc610027b21f6466842aed20 | 1bc1ac6e8971097899c809df9bda42c4203247db | /src/com/jmexe/interview/PopulatingNextRightPointersinEachNodeII/Solution.java | e08f3b20051f87c462b34f6871a1d616e66654d5 | [] | no_license | jmexe/leetcode | be061cdf5fcbe6cf42dfa9db1feb4c28d1fc9e37 | 8775a74f6d0dfc5c46e921ed899103fbfc713291 | refs/heads/master | 2021-01-10T09:55:06.391792 | 2016-02-19T17:58:27 | 2016-02-19T17:58:27 | 47,373,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.jmexe.interview.PopulatingNextRightPointersinEachNodeII;
/**
* Created by Jmexe on 2/9/16.
*/
class TreeLinkNode{
int val;
TreeLinkNode left, right, next;
TreeLinkNode(int x) {val = x;}
}
public class Solution {
public static void connect(TreeLinkNode root) {
helper(root, null);
}
public static void helper(TreeLinkNode root, TreeLinkNode prev) {
if (root == null) {
return;
}
if (prev == null) {
root.next = null;
}
while (prev != null) {
if (prev.left != null) {
if (root == prev.left) {
continue;
}
root.next = prev.left;
break;
}
if (prev.right != null) {
root.next = prev.right;
break;
}
prev = prev.next;
}
if (root.left != null) {
helper(root.left, root);
}
if (root.right != null) {
helper(root.right, root.next);
}
}
public static void main(String[] args) {
TreeLinkNode root = new TreeLinkNode(1);
root.left = new TreeLinkNode(2);
connect(root);
}
}
| [
"[email protected]"
] | |
849a897580f476e65dfa95a8230878eeddabda70 | 9483b7649c6c83a3289cd390d7b9a9c305077f3f | /app/src/main/java/ddw/com/richang/controller/Config.java | 0e0f87d2a02bfcc417f26dec23b8f4207c9d59f1 | [] | no_license | DingDewen/RiChang | 6fd01dac8f61ca6e526ca45392b217a5829f47f3 | 7cfd3f76eeee25643a023f267b4e053b4c473618 | refs/heads/master | 2021-01-16T20:42:04.864003 | 2016-05-24T02:31:20 | 2016-05-24T02:31:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,664 | java | package ddw.com.richang.controller;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import ddw.com.richang.model.USR;
import ddw.com.richang.model.common.IdNameMap;
import ddw.com.richang.controller.data.oldversion.WebHTTP;
/**
* Created by dingdewen on 15/11/23.
* 配置文件
*/
public class Config {
//版本号
public static String VERSION = "1.01";
//页面尺寸
public static int SCALE=2;
//短信验证码有效时间
public static int CHECKTIME=60;
//接口域名
public static String DOMAIN = "";
//接口详情(因为要先加载域名,所以不能把接口作为静态类)
public static InterFace getInterface(){return InterFace.getInstance();}
//每次传递数
public static int ACTSumOnce=10;
//以下需要网络更新的东西都放在USR的getInfo()里,因为那是必须要做的事情。
//用户信息
public static USR getUSR(){
return USR.getInstance();
}
public static USR getUSR(Context context){return USR.getInstance(context);}
//城市:
public static ArrayList<IdNameMap> CITYS = new ArrayList<IdNameMap>();//从网络更新
//个性标签:
public static ArrayList<IdNameMap> TAGS = new ArrayList<IdNameMap>();//从网络更新
//专栏:
public static ArrayList<IdNameMap> COLUMNS = new ArrayList<IdNameMap>();//从网络更新
//提醒:
public static boolean HINT;
public static boolean SHAKE;
//页面返回码
public static int REQ=0;
//新版本
public static void cheVersion(final Activity activity,final boolean silence){
//getVersion
new Thread(new Runnable() {
@Override
public void run() {
final String versionJson = WebHTTP.getStr(Config.getInterface().getVersion);
if(activity!=null) activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try{
JSONObject obj=new JSONObject(versionJson);
if(200==obj.getInt("code")) {
JSONObject ver=obj.getJSONObject("data");
final String version = ver.getString("app_version");
final String url = ver.getString("app_url");
String msg = ver.getString("app_msg");
Log.e("outcv",version+""+url);
if (!version.equals(Config.VERSION)) {
new AlertDialog.Builder(activity)
.setTitle("检测到新版本" + version)
.setMessage(msg)
.setPositiveButton("升级", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(activity.getApplicationContext(), "正在下载", Toast.LENGTH_SHORT).show();
new Thread(new Runnable() {
@Override
public void run() {
try {
WebHTTP w = new WebHTTP(url);
final String uri = Environment.getExternalStorageDirectory().getAbsolutePath().toString() + "/Richang/cache/" + version + ".apk";
w.save(uri);
w.close();
//安装
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(uri)), "application/vnd.android.package-archive");
activity.startActivity(intent);
} catch (Exception e) {}
}
}).start();
}
})
.setNegativeButton("取消", null).show();
} else if (!silence)
Toast.makeText(activity.getApplicationContext(), "已是最新版本", Toast.LENGTH_SHORT).show();
}else Toast.makeText(activity.getApplicationContext(), "获取错误", Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(activity.getApplicationContext(), "获取错误"+e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
}).start();
}
}
| [
"[email protected]"
] | |
6dcf8320cb04c5c14648c1d7b6d633a21c438243 | 1eca56a6a08594306e08b6a3d4adacd29be798bf | /sensappdroid-test/src/main/java/org/sensapp/android/sensappdroid/test/DeleteSensorRestTaskTest.java | 7a7b1b05a2695d2fa2b92b90d6641502a5a19400 | [] | no_license | SINTEF-9012/sensapp-android | 4a02a5bd0fb46c33ec7c28cfd466232436e1cc1c | ad62216ce97cedda59dfa5c59d69c34069f64812 | refs/heads/master | 2020-05-07T13:30:23.170029 | 2014-01-14T09:33:23 | 2014-01-14T09:33:23 | 5,244,499 | 0 | 0 | null | 2014-01-07T15:14:02 | 2012-07-31T10:30:29 | Java | UTF-8 | Java | false | false | 2,005 | java | /**
* Copyright (C) 2012 SINTEF <[email protected]>
*
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3, 29 June 2007;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* 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.sensapp.android.sensappdroid.test;
import java.util.concurrent.TimeUnit;
import org.sensapp.android.sensappdroid.restrequests.DeleteSensorRestTask;
import org.sensapp.android.sensappdroid.restrequests.PostSensorRestTask;
import android.test.AndroidTestCase;
public class DeleteSensorRestTaskTest extends AndroidTestCase {
public void testSensorDontExists() {
try {
assertNull(new DeleteSensorRestTask(getContext()).execute("testSensor").get(5, TimeUnit.SECONDS));
} catch (Exception e) {
e.printStackTrace();
assertTrue(false);
}
}
public void testSensorNotUploaded() {
try {
assertNull(new DeleteSensorRestTask(getContext()).execute("testSensor0").get(5, TimeUnit.SECONDS));
} catch (Exception e) {
e.printStackTrace();
assertTrue(false);
}
}
public void testSensorEmptyUploaded() {
DataManager.insertSensors(getContext().getContentResolver(), 1);
try {
assertNotNull(new PostSensorRestTask(getContext(), "testSensor0").execute().get(15, TimeUnit.SECONDS));
String result = new DeleteSensorRestTask(getContext()).execute("testSensor0").get(5, TimeUnit.SECONDS);
assertNotNull(result);
assertTrue(result.trim().equals("true"));
} catch (Exception e) {
e.printStackTrace();
assertTrue(false);
}
}
@Override
public void tearDown() throws Exception {
DataManager.cleanAll(getContext());
}
}
| [
"[email protected]"
] | |
4905c12fc856cd7867b0ee5adfb9570b0c07c13b | 14f9ff7278df7ef2d3293186a574c4046bdde6bf | /src/main/java/com/joyxj/leetcode/difficulty/easy/E119_PascalsTriangleII.java | 526bb8471c9d0ce1a8f6ec851a2c4809ad32b9bd | [
"MIT"
] | permissive | xiaojun90/leetcode | c03249a6295910ae25416ce5903841e18c2b545b | bb0ec5fc10ae2992d7d87b9e3da08dfa896680f0 | refs/heads/master | 2020-04-24T00:49:28.683442 | 2020-02-21T03:04:55 | 2020-02-21T03:04:55 | 171,577,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package com.joyxj.leetcode.difficulty.easy;
import java.util.ArrayList;
import java.util.List;
public class E119_PascalsTriangleII {
public static void main(String[] args) {
}
class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> result = new ArrayList<>();
for (int i=0;i<rowIndex + 1;i++) {
// 第一个位置为1
// 关键就在于add方法,i每增加1就会新增填充一个元素在初始位置,
// 此时result的元素个数就和rowIndex一致了,后面只需要重置元素的值就可以了
result.add(0, 1);
for (int j=1;j<i;j++) {
result.set(j,result.get(j) + result.get(j+1));
}
}
return result;
}
}
} | [
"[email protected]"
] | |
2b212a5c22932959581cdcf58ccbdd6b2e009cdd | 4f7248eeb9dfd513d0d8e4e575ea904c92246125 | /isASingleTable/src/main/java/com/ducat/entities/Person.java | ab3dc4f480a139827024e72963070eab6b05bec1 | [] | no_license | neeraj-ducat/boot2020 | 24060ce9ea08c1f21df5f89f2cbc969053935ab2 | 5b25b43b5a61c50c2fcc31de60a1fd998590cf97 | refs/heads/master | 2023-08-10T09:48:48.978010 | 2020-02-15T08:14:59 | 2020-02-15T08:14:59 | 230,748,304 | 2 | 1 | null | 2023-07-23T01:29:42 | 2019-12-29T12:38:45 | Java | UTF-8 | Java | false | false | 575 | java | package com.ducat.entities;
import javax.persistence.*;
@Entity
@Table(name="Persons")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="personType",discriminatorType=DiscriminatorType.INTEGER)
@DiscriminatorValue(value="10")
public class Person {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
099e7d7ae179dbb6e402c8cd8325e555c16e81e1 | b56bc06180f8154c6cd348d3a82623c2ae277130 | /src/main/java/samplejhipster/web/rest/util/PaginationUtil.java | c2a8e8eb6b309a3ce6049cc1aa6d548927a12cf2 | [] | no_license | josephbagnes/samplejhipster | 9f529e2ef37583d5b2983f8db4205f652718d2a6 | 498724ae314682d13205b306a7bedba3d20881d5 | refs/heads/master | 2020-03-16T01:23:02.671038 | 2018-05-07T09:35:15 | 2018-05-07T09:35:15 | 132,438,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,737 | java | package samplejhipster.web.rest.util;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import org.springframework.web.util.UriComponentsBuilder;
/**
* Utility class for handling pagination.
*
* <p>
* Pagination uses the same principles as the <a href="https://developer.github.com/v3/#pagination">GitHub API</a>,
* and follow <a href="http://tools.ietf.org/html/rfc5988">RFC 5988 (Link header)</a>.
*/
public final class PaginationUtil {
private PaginationUtil() {
}
public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Total-Count", Long.toString(page.getTotalElements()));
String link = "";
if ((page.getNumber() + 1) < page.getTotalPages()) {
link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\",";
}
// prev link
if ((page.getNumber()) > 0) {
link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\",";
}
// last and first link
int lastPage = 0;
if (page.getTotalPages() > 0) {
lastPage = page.getTotalPages() - 1;
}
link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\",";
link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\"";
headers.add(HttpHeaders.LINK, link);
return headers;
}
private static String generateUri(String baseUrl, int page, int size) {
return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString();
}
}
| [
"[email protected]"
] | |
5747c61f1404ed6cca0a838f627124aa69d8a80c | d4e5220c8ade3d30f49f5d90a8b3a186bec076f2 | /src/main/java/br/edu/ifes/BlackWhite/cdp/FabricaIngrediente.java | b9dd08d61c0a2abe74e970ab1fd041f8ddbb9451 | [] | no_license | brunomergh/FabricaBlackWhite | 76e77386334168d1663feb626c728a306f455983 | 8c9a4706894b0ed0fe87c745d802fe6ad8fb4f0a | refs/heads/master | 2021-01-10T12:54:27.690357 | 2015-09-29T12:10:25 | 2015-09-29T12:10:25 | 43,365,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | 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 br.edu.ifes.BlackWhite.cdp;
/**
*
* @author 20131bsi0033
*/
public interface FabricaIngrediente{
public Ingrediente criarIngrediente();
}
| [
"[email protected]"
] | |
83b40b36e338fb5c47d031f267dca842ee4ea3a6 | f39554bdfe339871aabdb051bd1ca3656bf2858e | /AdministradorUnificado/src/main/java/com/grupodot/telefonica/Controllers/MovistarPlayController.java | 8d7a96ff89c1feeebce35ba4d31c3a93cd0e97f0 | [] | no_license | IanDex/AdminMovistar | 4cc8c73cefd8168675a1659484d1ea82aa56b9ba | 7d95a5eec0984cececaa1abf727c1b03594b7ded | refs/heads/master | 2020-04-04T12:45:11.512528 | 2018-11-03T00:53:26 | 2018-11-03T00:53:26 | 155,936,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,515 | java | package com.grupodot.telefonica.Controllers;
import java.sql.ResultSet;
import java.sql.SQLException;
public class MovistarPlayController extends GenericController {
public MovistarPlayController() {
super();
}
public MovistarPlayController(String dbName, String tableName, String headers) {
super(dbName, tableName, headers);
}
@Override
public String listar(String limit, String interval, String palabra) {
String JsonStr = "", response = "[";
boolean sucess = false;
try {
con = dataSource.getConnection(super.dbName);
String consulta =
"SELECT "
+ "personas.nombre AS nombre,"
+ "personas.cedula AS cedula,"
+ "respuestas.respuesta1 AS respuesta1,"
+ "respuestas.respuesta2 AS respuesta2,"
+ "respuestas.respuesta3 AS respuesta3,"
+ "respuestas.respuesta4 AS respuesta4,"
+ "respuestas.respuesta5 AS respuesta5,"
+ "respuestas.respuesta6 AS respuesta6,"
+ "respuestas.respuesta7 AS tiempo"
+ " FROM "
+ "formularios_telefonica.formulario_the_son_personas personas,"
+ "formularios_telefonica.formulario_the_son_respuestas respuestas"
+ " WHERE "
+ "respuestas.cc_Persona = personas.cedula COLLATE utf8_unicode_ci"
+ " order by "
+ "personas.fecha"
+ " LIMIT ?, ?";
pst = con.prepareStatement(consulta);
pst.setInt(1, Integer.parseInt(interval));
pst.setInt(2, Integer.parseInt(limit));
ResultSet rs = pst.executeQuery();
while (rs.next()) {
sucess = true;
response += "["
+ "\"" + rs.getObject("nombre") + "\" ,"
+ "\"" + rs.getObject("cedula") + "\" ,"
+ "\"" + rs.getObject("respuesta1") + "\" ,"
+ "\"" + rs.getObject("respuesta2") + "\" ,"
+ "\"" + rs.getObject("respuesta3") + "\" ,"
+ "\"" + rs.getObject("respuesta4") + "\" ,"
+ "\"" + rs.getObject("respuesta5") + "\" ,"
+ "\"" + rs.getObject("respuesta6") + "\" ,"
+ "\"" + rs.getObject("tiempo") + "\""
+ "],";
}
if (sucess) {
response = response.substring(0, response.length() - 1);
response += "]";
} else {
response = "[]";
}
JsonStr = "[{"
+ "\"success\":\"" + sucess + "\","
+ "\"numRows\":\"" + count() + "\","
+ "\"headers\":" + headers + ","
+ "\"response\":" + response
+ "}]";
dataSource.closeConnection(con);
} catch (SQLException f) {
f.printStackTrace();
}
return JsonStr;
}
@Override
public String listar(String limite, String intervalo, String palabra, String fechaInicio, String fechaFin) {
String JsonStr = "", response = "[";
boolean sucess = false;
try {
con = dataSource.getConnection(super.dbName);
String consulta =
"SELECT "
+ "personas.nombre AS nombre,"
+ "personas.cedula AS cedula,"
+ "respuestas.respuesta1 AS respuesta1,"
+ "respuestas.respuesta2 AS respuesta2,"
+ "respuestas.respuesta3 AS respuesta3,"
+ "respuestas.respuesta4 AS respuesta4,"
+ "respuestas.respuesta5 AS respuesta5,"
+ "respuestas.respuesta6 AS respuesta6,"
+ "respuestas.respuesta7 AS tiempo"
+ " FROM "
+ "formularios_telefonica.formulario_the_son_personas personas,"
+ "formularios_telefonica.formulario_the_son_respuestas respuestas"
+ " WHERE "
+ "respuestas.cc_Persona = personas.cedula COLLATE utf8_unicode_ci"
+ " AND "
+ " personas.fecha BETWEEN ? AND ?"
+ " order by "
+ "personas.fecha"
+ " LIMIT ?, ?";
pst = con.prepareStatement(consulta);
pst.setString(1, fechaInicio);
pst.setString(2, fechaFin);
pst.setInt(3, Integer.parseInt(intervalo));
pst.setInt(4, Integer.parseInt(limite));
ResultSet rs = pst.executeQuery();
while (rs.next()) {
sucess = true;
response += "["
+ "\"" + rs.getObject("nombre") + "\" ,"
+ "\"" + rs.getObject("cedula") + "\" ,"
+ "\"" + rs.getObject("respuesta1") + "\" ,"
+ "\"" + rs.getObject("respuesta2") + "\" ,"
+ "\"" + rs.getObject("respuesta3") + "\" ,"
+ "\"" + rs.getObject("respuesta4") + "\" ,"
+ "\"" + rs.getObject("respuesta5") + "\" ,"
+ "\"" + rs.getObject("respuesta6") + "\" ,"
+ "\"" + rs.getObject("tiempo") + "\""
+ "],";
}
if (sucess) {
response = response.substring(0, response.length() - 1);
response += "]";
} else {
response = "[]";
}
JsonStr = "[{"
+ "\"success\":\"" + sucess + "\","
+ "\"numRows\":\"" + count(fechaInicio, fechaFin) + "\","
+ "\"headers\":" + headers + ","
+ "\"response\":" + response
+ "}]";
dataSource.closeConnection(con);
} catch (SQLException f) {
f.printStackTrace();
}
return JsonStr;
}
@Override
public String exportar() {
String JsonStr = "[" + super.headers + ",";
boolean sucess = false;
try {
con = dataSource.getConnection(super.dbName);
String consulta =
"SELECT "
+ "personas.nombre AS nombre,"
+ "personas.cedula AS cedula,"
+ "respuestas.respuesta1 AS respuesta1,"
+ "respuestas.respuesta2 AS respuesta2,"
+ "respuestas.respuesta3 AS respuesta3,"
+ "respuestas.respuesta4 AS respuesta4,"
+ "respuestas.respuesta5 AS respuesta5,"
+ "respuestas.respuesta6 AS respuesta6,"
+ "respuestas.respuesta7 AS tiempo"
+ " FROM "
+ "formularios_telefonica.formulario_the_son_personas personas,"
+ "formularios_telefonica.formulario_the_son_respuestas respuestas"
+ " WHERE "
+ "respuestas.cc_Persona = personas.cedula COLLATE utf8_unicode_ci"
+ " order by "
+ "personas.fecha";
pst = con.prepareStatement(consulta);
ResultSet rs = pst.executeQuery();
while (rs.next()) {
sucess = true;
JsonStr += "["
+ "\"" + rs.getObject("nombre") + "\" ,"
+ "\"" + rs.getObject("cedula") + "\" ,"
+ "\"" + rs.getObject("respuesta1") + "\" ,"
+ "\"" + rs.getObject("respuesta2") + "\" ,"
+ "\"" + rs.getObject("respuesta3") + "\" ,"
+ "\"" + rs.getObject("respuesta4") + "\" ,"
+ "\"" + rs.getObject("respuesta5") + "\" ,"
+ "\"" + rs.getObject("respuesta6") + "\" ,"
+ "\"" + rs.getObject("tiempo") + "\""
+ "],";
}
if (sucess) {
JsonStr = JsonStr.substring(0, JsonStr.length() - 1);
} else {
JsonStr = "[]";
}
JsonStr += "]";
dataSource.closeConnection(con);
} catch (SQLException f) {
f.printStackTrace();
}
return JsonStr;
}
@Override
public String exportar(String fechaInicio, String fechaFin) {
String JsonStr = "[" + super.headers + ",";
boolean sucess = false;
try {
con = dataSource.getConnection(super.dbName);
String consulta =
"SELECT "
+ "personas.nombre AS nombre,"
+ "personas.cedula AS cedula,"
+ "respuestas.respuesta1 AS respuesta1,"
+ "respuestas.respuesta2 AS respuesta2,"
+ "respuestas.respuesta3 AS respuesta3,"
+ "respuestas.respuesta4 AS respuesta4,"
+ "respuestas.respuesta5 AS respuesta5,"
+ "respuestas.respuesta6 AS respuesta6,"
+ "respuestas.respuesta7 AS tiempo"
+ " FROM "
+ "formularios_telefonica.formulario_the_son_personas personas,"
+ "formularios_telefonica.formulario_the_son_respuestas respuestas"
+ " WHERE "
+ "respuestas.cc_Persona = personas.cedula COLLATE utf8_unicode_ci"
+ " AND "
+ " personas.fecha BETWEEN ? AND ?"
+ " order by "
+ "personas.fecha";
pst = con.prepareStatement(consulta);
pst.setString(1, fechaInicio);
pst.setString(2, fechaFin);
ResultSet rs = pst.executeQuery();
while (rs.next()) {
sucess = true;
JsonStr += "["
+ "\"" + rs.getObject("nombre") + "\" ,"
+ "\"" + rs.getObject("cedula") + "\" ,"
+ "\"" + rs.getObject("respuesta1") + "\" ,"
+ "\"" + rs.getObject("respuesta2") + "\" ,"
+ "\"" + rs.getObject("respuesta3") + "\" ,"
+ "\"" + rs.getObject("respuesta4") + "\" ,"
+ "\"" + rs.getObject("respuesta5") + "\" ,"
+ "\"" + rs.getObject("respuesta6") + "\" ,"
+ "\"" + rs.getObject("tiempo") + "\""
+ "],";
}
if (sucess) {
JsonStr = JsonStr.substring(0, JsonStr.length() - 1);
} else {
JsonStr = "[]";
}
JsonStr += "]";
dataSource.closeConnection(con);
} catch (SQLException f) {
f.printStackTrace();
}
return JsonStr;
}
@Override
public String count() {
String str = "";
try {
con = dataSource.getConnection(super.dbName);
String consulta = "SELECT count(*) As cantidad from " + super.tableName;
pst = con.prepareStatement(consulta);
ResultSet rs = pst.executeQuery();
if (rs.next()) {
str = rs.getInt("cantidad") + "";
}
dataSource.closeConnection(con);
} catch (SQLException f) {
f.printStackTrace();
}
return str;
}
@Override
public String count(String fechaInicio, String fechaFin) {
String str = "";
try {
con = dataSource.getConnection(super.dbName);
String consulta = "SELECT count(*) As cantidad from " + super.tableName
+ " WHERE fecha BETWEEN ? AND ?";
pst = con.prepareStatement(consulta);
pst.setString(1, fechaInicio);
pst.setString(2, fechaFin);
ResultSet rs = pst.executeQuery();
if (rs.next()) {
str = rs.getInt("cantidad") + "";
}
dataSource.closeConnection(con);
} catch (SQLException f) {
f.printStackTrace();
}
return str;
}
}
| [
"[email protected]"
] | |
c30c0e00d1d19b43082af85be22091202ce910cc | 99a6f9a9140dfb3f34fbe23067bb8e864132115d | /app/src/main/java/com/example/aluno/appbio/Adapter/CheckboxAssuntoListAdapter.java | a57c722178caba99abd2ec541e7b287c4ae2cd2f | [] | no_license | luizfrancisco2000/AppBio2 | a548de5d053691428c7f8ca8a63799973521347c | 504ee41488cb2cabc24e9e7e7bfe6508e66a0a33 | refs/heads/master | 2020-03-31T09:00:06.514488 | 2018-11-22T16:09:59 | 2018-11-22T16:09:59 | 152,079,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,013 | java | package com.example.aluno.appbio.Adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Toast;
import com.example.aluno.appbio.Model.Assunto;
import com.example.aluno.appbio.R;
import java.util.List;
public class CheckboxAssuntoListAdapter extends BaseAdapter {
private Activity activity;
private Context mContext;
private List<Assunto> assuntos;
public CheckboxAssuntoListAdapter(Activity a, Context context, List<Assunto> assuntos) {
activity = a;
mContext = context;
this.assuntos = assuntos;
}
public int getCount() {
// TODO Auto-generated method stub
return assuntos.size();
}
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return assuntos.get(arg0);
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return assuntos.get(position).getId();
}
public View getView(int position, View convertView, ViewGroup parent) {
final Assunto assunto = assuntos.get(position);
View view = LayoutInflater.from(mContext).inflate(R.layout.checkbox_layout, null);
CheckBox checkBox = view.findViewById(R.id.checkbox1);
TextView textView = view.findViewById(R.id.lbl_assunto);
if (assunto.isAtivo() && !checkBox.isChecked()){
checkBox.setChecked(assunto.isAtivo());
}
textView.setText(assunto.getNome());
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
assunto.setAtivo(isChecked);
}
});
return view;
}
}
| [
"[email protected]"
] | |
4802a989bd54fb75209bfea57ff30ac14bd06840 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesisanalytics/model/transform/KinesisStreamsInputUpdateJsonUnmarshaller.java | 2e63aa1a8c01411db2560dd7477cc6369ded6528 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 3,150 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.kinesisanalytics.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.kinesisanalytics.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* KinesisStreamsInputUpdate JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class KinesisStreamsInputUpdateJsonUnmarshaller implements Unmarshaller<KinesisStreamsInputUpdate, JsonUnmarshallerContext> {
public KinesisStreamsInputUpdate unmarshall(JsonUnmarshallerContext context) throws Exception {
KinesisStreamsInputUpdate kinesisStreamsInputUpdate = new KinesisStreamsInputUpdate();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("ResourceARNUpdate", targetDepth)) {
context.nextToken();
kinesisStreamsInputUpdate.setResourceARNUpdate(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("RoleARNUpdate", targetDepth)) {
context.nextToken();
kinesisStreamsInputUpdate.setRoleARNUpdate(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return kinesisStreamsInputUpdate;
}
private static KinesisStreamsInputUpdateJsonUnmarshaller instance;
public static KinesisStreamsInputUpdateJsonUnmarshaller getInstance() {
if (instance == null)
instance = new KinesisStreamsInputUpdateJsonUnmarshaller();
return instance;
}
}
| [
""
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.