blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f22bbb5676a0fa9583c7ed276263f7c4eae2247b | 14c9ae30b0d131ddfc3a70e71de85c38010aac40 | /src/test/java/stepDefinitions/StepDef07_AmbigousMethods.java | dfce34d372e904a4cc7dda051b793b98a990483d | [] | no_license | Amit-GitRepository/CucumberFeatures | c67e0e02f8e9cb76d6c615f5734bc1982291ed68 | fa93a4568b410d8fe2f45e5c5ef25a0b2c893356 | refs/heads/master | 2021-01-12T17:21:09.800259 | 2016-09-30T05:36:29 | 2016-09-30T05:36:29 | 69,483,214 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package stepDefinitions;
import cucumber.api.java.en.Given;
public class StepDef07_AmbigousMethods {
@Given("^I have (\\d+) rupees in my account with \"([^\"]*)\" bank$")
public void i_have_rupees_in_my_account_with_bank(int arg1, String arg2) throws Throwable {
System.out.println("Accout Balance: "+arg1);
System.out.println("Bank Name: "+arg2);
}
@Given("^I have 2000 rupees in my account with \"([^\"]*)\" bank$")
public void rupees_in_my_account_with_bank(int arg1, String arg2) throws Throwable {
System.out.println("Accout Balance: "+arg1);
System.out.println("Bank Name: "+arg2);
}
}
| [
"amitkumar@xebia.com"
] | amitkumar@xebia.com |
5c6bc2d28350bf3ebb836e340616679d89f62daa | a826a5709957db117836c32b6e35ec3c83c7a77a | /src/opc/ua/iec611313/CtrlProgramType.java | 339c709533e64f126e0d667b10d10617d87575a9 | [] | no_license | laihoj/opcua | 8edc1a9eaf397876286e951a5dc1967f45cbe9a8 | c08fe721d814264a340bfe3f9a54fc9a25063d75 | refs/heads/master | 2020-09-06T15:22:37.216828 | 2019-11-14T10:27:35 | 2019-11-14T10:27:35 | 220,464,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | // Generated from SampleTypes
// by Prosys OPC UA Java SDK Codegen
//
package opc.ua.iec611313;
import com.prosysopc.ua.StatusException;
import com.prosysopc.ua.TypeDefinitionId;
import com.prosysopc.ua.nodes.Optional;
import com.prosysopc.ua.stack.builtintypes.Structure;
import com.prosysopc.ua.types.opcua.BaseDataVariableType;
import java.lang.String;
/**
* Generated on 2019-11-05 12:19:46
*/
@TypeDefinitionId("nsu=http://PLCopen.org/OpcUa/IEC61131-3/;i=1004")
public interface CtrlProgramType extends CtrlProgramOrganizationUnitType {
String PROGRAM = "Program";
@Optional
BaseDataVariableType getProgramNode();
@Optional
Structure getProgram();
@Optional
void setProgram(Structure value) throws StatusException;
}
| [
"jaakkolaiho94@gmail.com"
] | jaakkolaiho94@gmail.com |
053e03817019aeda5f9989a30c6e9f76fcad78d8 | d7b92da0970ba9d758b3c45ac9a6b8a99a891b5d | /framework-commons/src/main/java/com/qsd/framework/commons/page/Page.java | cd37df24513ccc4ce26e6737181c90eb4a02281f | [
"MIT"
] | permissive | qianshanding/framework | e5cfc17311214cb1b0fab6c7df13c0f1f18db129 | 435d16cd036a0e06fa3a186d9f5eae2d9787112c | refs/heads/master | 2021-01-17T05:05:59.234953 | 2018-01-02T08:34:18 | 2018-01-02T08:34:18 | 83,105,533 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,278 | java | package com.qsd.framework.commons.page;
import java.io.Serializable;
import java.util.List;
/**
* 该类主要是提供分页类,是一个<code>final</code>类.防止继承了该类而修改不必要的属性.<br/>
* <br/>
*
* 使用方法:<br/>
*
* <br/>
* 1、该类创建后必须设置当前页,默认为第一页,如:<br/>
* <code>setCurPage(2)</code>设置为当前显示第二页;<br/>
*
* 2、可以根据自己喜好设置每页多少条记录显示,如:<br/>
* <code>setPageSize(15)</code>设置 为每页显示15条记录;<br/>
*
* 3、可以通过<br/>
* <code>getItemList()</code>获取当前查询到的数据.其中<code>T</code>是自身定义的类型;<br/>
*
* 查询数据用法:<br/>
*
* 1.在要进来查询的时候首先查询到数据的总记录.<br/>
*
* 2.设置到总记录后.<code>setTotalRecord(总记录数)</code><br/>
*
* 3.获取<code>getStartRow()</code>开始记录,获取<code>getEndRow()</code>结束记录<br/>
*
* 4.通过3里面的开始记录和结束记录查询数据信息
*
* @author Fish
*
* @param <T>
*/
public final class Page<T> implements Serializable {
private static final long serialVersionUID = -4443715053463068200L;
/**
* 总记录
*/
private Integer totalRecord;
/**
* 每页记录,默认每页10条记录.
*/
private Integer sizePage = 10;
/**
* 当前页,从第一页开始
*/
private Integer curPage = 1;
/**
* 总页数
*/
private Integer totalPages;
/**
* 起始行数
*/
private Integer startRow;
/**
* 结束行数
*/
private Integer endRow;
/**
* 返回的查询数据信息
*/
private List<T> itemList;
/**
* 排序字段
*/
private String orderBy;
/**
* 排序desc, asc
*/
private String order;
/**
* 默认构造函数
*/
public Page() {
this(10);
}
/**
* 带参数构造函数
*
* @param sizePage
*/
public Page(int sizePage) {
super();
this.sizePage = sizePage;
}
/**
* 返回查询数据的总记录
*/
public int getTotalRecord() {
return totalRecord == null ? 0 : totalRecord;
}
/**
* 设置查询总记录
*/
public void setTotalRecord(Integer totalRecord) {
this.totalRecord = totalRecord;
}
/**
* 返回每页记录,如果没有设置,则默认为每页10条记录
*/
public int getSizePage() {
return sizePage;
}
/**
* 设置每页的记录.
*/
public void setSizePage(int sizePage) {
this.sizePage = sizePage;
}
/**
* 当前页数,如果没有设置则是从第一页开始.
*/
public int getCurPage() {
return curPage;
}
/**
* 设置当前页数,页面设置的值如果少于或者等于0时候则赋值 1.
*/
public void setCurPage(int curPage) {
this.curPage = ((curPage <= 0) ? 1 : curPage);
}
/**
* 根据页数和每页设置数量获取数据库查询记录开始
*/
public int getStartRow() {
startRow = ((getCurPage() - 1) * getSizePage());
return startRow;
}
/**
* 根据页数和每页设置数量获取数据查询记录结束
*/
public int getEndRow() {
int curRow = getStartRow() + getSizePage();
endRow = curRow > getTotalRecord() ? getTotalRecord() : curRow;
return endRow;
}
/**
* 可以根据查询设置<code>setItemList()</code>方法获取数据.
*/
public List<T> getItemList() {
return itemList;
}
/**
* 可以在dal里面查询设置到该对象集合里面.
*
* @param itemList
*/
public void setItemList(List<T> itemList) {
this.itemList = itemList;
}
/**
* 判断是否有上页,如果存在上页返回<code>true</code>,否则反之.
*/
public boolean getPrePage() {
return (getCurPage() != 1);
}
/**
* 判断是否有上页,如果存在下页返回<code>true</code>,否则反之.
*/
public boolean getNextPage() {
return curPage < getTotalPages();
}
/**
* 获取总页数
*/
public int getTotalPages() {
totalPages = ((getTotalRecord() % getSizePage() == 0) ? getTotalRecord() / getSizePage()
: (getTotalRecord() / getSizePage()) + 1);
return totalPages;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
}
| [
"qianshanding@163.com"
] | qianshanding@163.com |
a9e703c16697b05bb8d77b21dd06de8d82f0b8ad | 6c7e4dadd20b1dc56ec0057b25be6a7928b1169e | /Easyui/src/test/java/cn/tqs/easyui/biz/impl/BooksBizImplTest.java | 19c23160112cadd24f248484a5d214afb846c383 | [
"Apache-2.0"
] | permissive | 18937062462/Book-Manager | b8aea21758181cf80a3ab8d404642bf3ba34c9ac | 27affdaf2b4c019d4f9570beb8ed492dea8c0cdb | refs/heads/master | 2021-09-02T03:50:13.968660 | 2017-12-30T03:30:54 | 2017-12-30T03:30:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | package cn.tqs.easyui.biz.impl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import cn.tqs.easyui.bo.ConditionBo;
import cn.tqs.easyui.dao.TblBooksEntryMapper;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:config/applicationContext.xml" })
public class BooksBizImplTest {
@Autowired
private TblBooksEntryMapper mapper;
@Test
public void testQuery() {
ConditionBo condition = new ConditionBo();
condition.setIsbn("01");
condition.setOffset(0);
condition.setRows(10);
System.out.println(mapper.query(condition));
}
}
| [
"1210345800@qq.com"
] | 1210345800@qq.com |
96def13fb453a51013aa028c032629879d518ed2 | 2716440171ca87cabfc89373a5a0cd3f46c1f6f9 | /src/main/java/com/zhouhc/eachPattern/facade/desc/code/ClassC.java | 890875a1855d86e5092da84316b1dbbe95a12fea | [] | no_license | XZTJJ/design_patterns | eb3772065f37bf1c92f9655eb977f47dbde131b5 | b17ffeddc2e7d8635954f8d12e4861b6b8030587 | refs/heads/master | 2023-02-18T07:37:58.620458 | 2021-01-22T16:26:02 | 2021-01-22T16:26:02 | 326,387,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package com.zhouhc.eachPattern.facade.desc.code;
/**
* 子系统的中的 一个对象,
* 子系统有可能只有一个对象,也有可能有多个对象
*/
public class ClassC {
public void doSomethingC(){
//具体的业务逻辑
}
}
| [
"2734788393@qq.com"
] | 2734788393@qq.com |
8f66598cfe4099aa2727f23d65e127ca0312b497 | c2b43443f5cd3f71a8f16410ead2b1dccfbe124a | /积分共享系统/pointsystem-master/src/main/java/com/wyd/dao/impl/PointsAccountDaoImpl.java | 662b68ae42678f05266a765b0017b413992e2a3f | [] | no_license | mhlseye/WeBuy | fc5abf4435884070106906e2d0222403ca832273 | df8804f2c7eaf378fe03a67ecb8343bc70030c82 | refs/heads/master | 2020-04-26T01:51:34.718925 | 2019-02-15T02:14:32 | 2019-02-15T02:14:32 | 173,216,934 | 1 | 0 | null | 2019-03-01T01:52:40 | 2019-03-01T01:52:40 | null | UTF-8 | Java | false | false | 1,781 | java | package com.wyd.dao.impl;
import java.sql.Date;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.wyd.dao.PointsAccountDao;
import com.wyd.domain.PointsAccount;
@Repository("pointsAccountDao")
@Transactional
public class PointsAccountDaoImpl implements PointsAccountDao{
@Resource
private SessionFactory sessionFactory;
private Session getCurrentSession(){
return this.sessionFactory.getCurrentSession();
}
public PointsAccount load(int id) {
return this.getCurrentSession().load(PointsAccount.class, id);
}
public PointsAccount get(int id) {
return this.getCurrentSession().get(PointsAccount.class, id);
}
@SuppressWarnings("unchecked")
public List<PointsAccount> findAll() {
return this.getCurrentSession().createQuery("from PointsAccount").setCacheable(true).list();
}
public void persist(PointsAccount entity) {
this.getCurrentSession().persist(entity);
}
public Integer save(PointsAccount entity) {
return (Integer) this.getCurrentSession().save(entity);
}
public void saveOrUpdate(PointsAccount entity) {
this.getCurrentSession().saveOrUpdate(entity);
}
public void delete(int id) {
this.getCurrentSession().delete(this.load(id));
}
public void flush() {
this.getCurrentSession().flush();
}
@Override
public void cleanPoints(int id,Date beginDate, Date endDate) {
getCurrentSession()
.createQuery("delete from PointsAccount where (LAST_UPDATED_DTTM between :beginDate and :endDate) and id = :id")
.setParameter("beginDate", beginDate)
.setParameter("endDate", endDate)
.setParameter("id", id);
}
}
| [
"1217047025@qq.com"
] | 1217047025@qq.com |
a0adcea63c07193d1fc873b4108a6b7a91f7d4e3 | 07701676268b026f197d776352f16a015148b1d6 | /src/node/AStrLiteralPrimary.java | 58e093b27a38fcd8d62b49a7ec8a8bfd3630053e | [] | no_license | jmsktm/MUM-Compiler-Lab04-Part2 | 0c8cdc584bcd4fcc6bb174c62553805aea08b526 | 98d9f886d20572e21e1697ff64bf2fcc770381df | refs/heads/master | 2021-01-10T09:53:52.783028 | 2016-02-21T08:37:03 | 2016-02-21T08:37:03 | 51,818,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,995 | java | /* This file was generated by SableCC (http://www.sablecc.org/). */
package node;
import analysis.*;
@SuppressWarnings("nls")
public final class AStrLiteralPrimary extends PPrimary
{
private TStringLiteral _stringLiteral_;
public AStrLiteralPrimary()
{
// Constructor
}
public AStrLiteralPrimary(
@SuppressWarnings("hiding") TStringLiteral _stringLiteral_)
{
// Constructor
setStringLiteral(_stringLiteral_);
}
@Override
public Object clone()
{
return new AStrLiteralPrimary(
cloneNode(this._stringLiteral_));
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseAStrLiteralPrimary(this);
}
public TStringLiteral getStringLiteral()
{
return this._stringLiteral_;
}
public void setStringLiteral(TStringLiteral node)
{
if(this._stringLiteral_ != null)
{
this._stringLiteral_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._stringLiteral_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._stringLiteral_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._stringLiteral_ == child)
{
this._stringLiteral_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._stringLiteral_ == oldChild)
{
setStringLiteral((TStringLiteral) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}
| [
"james@icloudtech.com"
] | james@icloudtech.com |
d1d8d4bf09acb625185da670aaf520435233969e | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Junit/Junit1054.java | dc4f8938841601e1b16258dd77d478c86fc1ed0f | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | @Test
void executeSafelyFailed() {
AssertionError assertionError = new AssertionError("assumption violated");
TestExecutionResult result = new SingleTestExecutor().executeSafely(() -> {
throw assertionError;
});
assertEquals(FAILED, result.getStatus());
assertSame(assertionError, result.getThrowable().get());
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
cb586b7273cc206b032a2e5c4d562ebb276a7959 | d76808c5ef5a50f46f5714ed737b85b2603f90dc | /javassist/CtMethod$LongConstParameter.java | 6cb7fa358a57f3693d3ed0af74c047a0545fe802 | [] | no_license | XeonLyfe/Backdoored-1.6-Deobf-Source-Leak | d5e70e6bc09bf1f8ef971cb2f019492310cf28c0 | d01450acd69b1d995931aa3bcaca5c974344e556 | refs/heads/master | 2022-04-07T07:58:45.140489 | 2019-11-10T02:56:19 | 2019-11-10T02:56:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package javassist;
import javassist.bytecode.*;
static class LongConstParameter extends ConstParameter
{
long param;
LongConstParameter(final long l) {
super();
this.param = l;
}
@Override
int compile(final Bytecode code) throws CannotCompileException {
code.addLconst(this.param);
return 2;
}
@Override
String descriptor() {
return "([Ljava/lang/Object;J)Ljava/lang/Object;";
}
@Override
String constDescriptor() {
return "([Ljava/lang/Object;J)V";
}
}
| [
"57571957+RIPBackdoored@users.noreply.github.com"
] | 57571957+RIPBackdoored@users.noreply.github.com |
387eedb901b0e034188f2205cdf4e63ec104d27c | a987d6fedee9acf078a7f378a35cbbd51f818518 | /zjk_zs/src/com/jinmayi/service/QrCodeService.java | 11c08c53427b50ec1a0c0a481515fc9519c46ac9 | [] | no_license | shanpengfei7/jmy | ae82403c45931ed11415562a3b37d53d7e4ff5d8 | 8cc511fdfa60829e51a4707a1195ed562d540c9e | refs/heads/master | 2021-08-18T23:44:42.423974 | 2017-11-24T05:47:56 | 2017-11-24T06:13:21 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,540 | java | package com.jinmayi.service;
import java.util.List;
import com.jinmayi.entity.Makeqrcode;
import com.jinmayi.entity.Qrcode;
public interface QrCodeService {
public void printQrCodeBatch(Integer pid, Integer count, Integer eid,
String pname, String pvalue, Double price);
public String getLastQrCode(Integer pid, Integer eid);
public Qrcode getQrCodeById(Integer id);
public Qrcode getQrCodeByQrCode(String qrcode);
public Qrcode getQrCodeByQrCode(Qrcode qrcode);
/**
* 打包
*
* @param employeeid
* @param sonids
* @param parentid
* @param soncount
* @return
*/
public Integer packageQrCode(Integer enterpriseid, Integer employeeid,
List<Integer> sonids, Integer parentid, Integer soncount,
String place);
/**
* 拆包
*
* @param employeeid
* @param sonids
* @param parentid
* @param soncount
* @return
*/
public Integer packageUnQrCode(Integer enterpriseid, Integer employeeid,
List<Integer> parentids, String place);
/**
* 销售
*
* @param qrcode
* @return
*/
public void sellQrCode(List<Qrcode> qrcodes, Integer enid, Integer emid,
String sellplace);
/**
* 评价
*
* @param qrcode
* @return
*/
public Integer sellEvaluate(Integer id);
/**
* 这个厂家所有的码,分页
*
* @param eid
* @param pid
* @param page
* @param rows
* @return
*/
public List<Qrcode> getQrcodes(Integer eid, Integer pid, Integer page,
Integer rows);
public Integer getQrcodeCount(Integer eid, Integer pid);
public List<Qrcode> getSellQrcodes(Integer eid, Integer pid, Integer page,
Integer rows);
public Integer getSellQrcodeCount(Integer eid, Integer pid);
/**
* 厂家未使用的码量
*
* @param eid
* @param pid
* @return
*/
public Integer getNoUseQrcodeCount(Integer eid, Integer pid);
public List<Qrcode> getQrcodesByParentId(Integer pid);
public Integer getQrcodeCountBySeEnId(Integer sid);
public List<Qrcode> getQrcodesBySeEnId(Integer sid, Integer page,
Integer rows);
public Integer updateScanCountAddOne(Integer id);
public List<Makeqrcode> getMakeqrcodesByEidAndPid(Integer eid, Integer pid);
public List<Qrcode> getQrcodesByMakeQrCodeId(Integer id);
public Integer updateMakeQrCode(Integer id);
public List<Makeqrcode> getMakeQrCodesByEnId(Integer id);
public Integer getQrcodeCountByMqid(Integer makeQrCodeId);
public List<Qrcode> getQrcodesByMqid(Integer makeQrCodeId, Integer page,
Integer rows);
public Integer getNoUseQrcodeCountByMqid(Integer makeQrCodeId);
}
| [
"shanpengfei7@163.com"
] | shanpengfei7@163.com |
435c915840d8df9f2fe8a965a05b64dc4c18fddb | f48c04532f155c30a040e03237cffdde586e96fb | /src/main/java/com/hu/fenxiao/service/MemberService.java | b22992283038646a23e31ea93bf26c5b36efeb88 | [] | no_license | Metathinking/fenxiao | 7d649e37303d77755fd14a40cb1313d37de89096 | 5c14e99773b75f33ba7cb29742fe245fe6573141 | refs/heads/master | 2020-03-07T21:20:04.097037 | 2018-05-07T03:48:37 | 2018-05-07T03:48:37 | 127,723,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.hu.fenxiao.service;
import com.hu.fenxiao.domain.Member;
import com.hu.fenxiao.domain.vo.MemberVO;
import java.util.List;
import java.util.Map;
public interface MemberService {
// void test();
Member edit(Member member, Integer tuiGuangMemberId);
List<Member> list(Map<String, Object> params);
int getCount(Map<String, Object> params);
Member findByOpenId(String openid);
MemberVO getTuiGuangList(Map<String, Object> params,String memberOpenId);
}
| [
"503523986@qq.com"
] | 503523986@qq.com |
a36db80d91d3443aa292735577880c85bd348304 | 7852b12ab9fc634a3f640dde5f6862c8cf4778bf | /src/test/java/pages/AddToWishListPage.java | 029ff1933d876cd436022f5cf56b266f2169cfb4 | [] | no_license | RiyazullaSharief/POM-Framework | 45eae24014a6667c4c862bd0cc02cd48a8e3e3d1 | 96e1891b09a32bf9e3f82244b05d1b00253f660d | refs/heads/master | 2021-06-10T16:03:20.284642 | 2020-04-21T09:58:27 | 2020-04-21T09:58:27 | 163,534,970 | 0 | 2 | null | 2021-03-31T21:56:48 | 2018-12-29T19:12:44 | Java | UTF-8 | Java | false | false | 892 | java | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Reporter;
public class AddToWishListPage
{
public WebDriver driver;
@FindBy(xpath="//input[@id='search']")
private WebElement searchbox;
@FindBy(xpath="//button[@id='search_button']")
private WebElement searchbutton;
@FindBy(xpath="(//div[@class='wishproduct wishblock'])[1]")
private WebElement wishlst;
public AddToWishListPage(WebDriver driver)
{
this.driver=driver;
PageFactory.initElements(driver,this);
}
public void search(String search)
{
searchbox.sendKeys(search);
searchbutton.click();
}
public void wishlist()
{
wishlst.click();
Reporter.log("Item Added to wishlist successfully...!!", true);
}
}
| [
"Riyazulla Sharief@RIYAZ-PC"
] | Riyazulla Sharief@RIYAZ-PC |
68c31881c5e321c752af1e5160706e1649232bfb | b6370deda16d2aef4863b586f2aaa10b285b6cc4 | /kie-wb-common-services/kie-wb-common-compiler/kie-wb-common-compiler-core/src/main/java/org/kie/workbench/common/services/backend/compiler/impl/pomprocessor/MavenAPIUtil.java | c80b9b262651eb249efcdd5433108f53e0a9daa9 | [
"Apache-2.0"
] | permissive | pszubiak/kie-wb-common | b46e3cbfbd050e7033be79f6171245ec8545fbb7 | 079ac2c1346e571aed588655526d66d48efba161 | refs/heads/master | 2020-03-25T14:00:40.643241 | 2018-08-07T08:41:18 | 2018-08-07T08:41:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,333 | java | /*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.workbench.common.services.backend.compiler.impl.pomprocessor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.guvnor.common.services.project.backend.server.utils.configuration.ConfigurationKey;
import org.kie.workbench.common.services.backend.compiler.configuration.MavenCLIArgs;
import org.kie.workbench.common.services.backend.compiler.configuration.MavenConfig;
public class MavenAPIUtil {
public final static String TRUE = "true";
public static Plugin getPlugin(String groupdID, String artifactID, String version, Boolean extensions){
Plugin plugin = new Plugin();
plugin.setGroupId(groupdID);
plugin.setArtifactId(artifactID);
plugin.setVersion(version);
plugin.setExtensions(extensions);
return plugin;
}
public static Plugin getPlugin(String groupdID, String artifactID, String version){
Plugin plugin = new Plugin();
plugin.setGroupId(groupdID);
plugin.setArtifactId(artifactID);
plugin.setVersion(version);
return plugin;
}
public static Plugin getNewCompilerPlugin(Map<ConfigurationKey, String> conf) {
Plugin newCompilerPlugin = new Plugin();
newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_GROUP));
newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_ARTIFACT));
newCompilerPlugin.setVersion(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_VERSION));
Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
compilerId.setValue(conf.get(ConfigurationKey.COMPILER));
Xpp3Dom sourceVersion = new Xpp3Dom(MavenConfig.MAVEN_SOURCE);
sourceVersion.setValue(conf.get(ConfigurationKey.SOURCE_VERSION));
Xpp3Dom targetVersion = new Xpp3Dom(MavenConfig.MAVEN_TARGET);
targetVersion.setValue(conf.get(ConfigurationKey.TARGET_VERSION));
Xpp3Dom failOnError = new Xpp3Dom(MavenConfig.FAIL_ON_ERROR);
failOnError.setValue(conf.get(ConfigurationKey.FAIL_ON_ERROR));
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(compilerId);
configuration.addChild(sourceVersion);
configuration.addChild(targetVersion);
configuration.addChild(failOnError);
newCompilerPlugin.setConfiguration(configuration);
PluginExecution execution = new PluginExecution();
execution.setId(MavenCLIArgs.DEFAULT_COMPILE);
execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
execution.setPhase(MavenCLIArgs.COMPILE);
newCompilerPlugin.setExecutions(Arrays.asList(execution));
return newCompilerPlugin;
}
public static void disableMavenCompilerAlreadyPresent(Plugin plugin) {
Xpp3Dom skipMain = new Xpp3Dom(MavenConfig.MAVEN_SKIP_MAIN);
skipMain.setValue(TRUE);
Xpp3Dom skip = new Xpp3Dom(MavenConfig.MAVEN_SKIP);
skip.setValue(TRUE);
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(skipMain);
configuration.addChild(skip);
plugin.setConfiguration(configuration);
PluginExecution exec = new PluginExecution();
exec.setId(MavenConfig.MAVEN_DEFAULT_COMPILE);
exec.setPhase(MavenConfig.MAVEN_PHASE_NONE);
List<PluginExecution> executions = new ArrayList<>();
executions.add(exec);
plugin.setExecutions(executions);
}
}
| [
"alexandre.porcelli@gmail.com"
] | alexandre.porcelli@gmail.com |
1e47e76df9c6b8ab44851bd90da79b00f70e79f0 | 7c1a3d46443aff4bf5d5e95860461757744ed9ca | /src/jp/co/ec_10/dao/ItemDAO.java | 52184e55ee5365992dc81ae695f21b11dd523707 | [] | no_license | AkiraAtom/struts2_login | 71d881cdd229c747ed30b3e4c63009b730ebcbc6 | bdaaabd998522621ccaa388d9b62c2ae01bb4645 | refs/heads/master | 2021-01-17T17:32:48.258482 | 2017-02-23T17:25:25 | 2017-02-23T17:25:25 | 82,952,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,703 | java | package jp.co.ec_10.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import jp.co.ec_10.bean.CartBean;
import jp.co.ec_10.dto.AdminDTO;
/**
* クラス名:ItemDAO
* クラスの説明:item_table(商品情報テーブル)に接続する
*
* @author Yamanobe
* @version 1.0
* @since 1.0
*/
public class ItemDAO {
Connection con = null;
String sql = null;
String sql2 = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null;
ResultSet res = null;
public int list_count;
public String item_name;
public String item_price;
public String item_stock;
public String item_img;
public int flg = 0;
public List<AdminDTO> itemlist = new ArrayList<AdminDTO>();
/**
* メソッド名:item_all
* メソッドの説明 : 商品の総数を調べる
*
* @author Yamanobe
* @version 1.0
* @since 1.0
*/
public void item_all(){
try{
con = DBmanager.getConnection();
sql = "SELECT COUNT(*) FROM item_table";
pstmt = con.prepareStatement(sql);
res = pstmt.executeQuery();
while(res.next()){
list_count = res.getInt(1);
}
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
/**
* メソッド名:item_select
* メソッドの説明:item_tableから商品を5件づつ表示させる
*
* @author Yamanobe
* @version 1.0
* @since 1.0
* @param paging2 ページ移動をするための基準(paging2 から 10件)
*/
public void item_select(int paging2){
try{
con = DBmanager.getConnection();
sql = "SELECT * FROM item_table LIMIT "+paging2+" ,10";
pstmt = con.prepareStatement(sql);
res = pstmt.executeQuery();
while(res.next()){
AdminDTO Adto = new AdminDTO();
Adto.setItem_id(res.getString("item_id"));
Adto.setItem_name(res.getString("item_name"));
Adto.setItem_price(res.getString("item_price"));
Adto.setItem_stock(res.getString("item_stock"));
Adto.setItem_img(res.getString("item_img"));
itemlist.add(Adto);
}
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
public void item_search_like(String kwd){
try{
con = DBmanager.getConnection();
sql = "SELECT * FROM item_table WHERE item_name like '%" + kwd + "%'";
pstmt = con.prepareStatement(sql);
res = pstmt.executeQuery();
while(res.next()){
AdminDTO Adto = new AdminDTO();
Adto.setItem_id(res.getString("item_id"));
Adto.setItem_name(res.getString("item_name"));
Adto.setItem_price(res.getString("item_price"));
Adto.setItem_stock(res.getString("item_stock"));
Adto.setItem_img(res.getString("item_img"));
itemlist.add(Adto);
}
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
/**
* メソッド名:select_edit
* メソッドの説明:ad_item_info.jsp(商品一覧画面)で選択されたIDで商品を検索する
*
* @author Yamanobe
* @version 1.0
* @since 1.0
* @param itemselect ad_item_info.jspで選択された商品ID
*/
public void select_edit(String itemselect) {
try{
con = DBmanager.getConnection();
sql = "SELECT * FROM item_table WHERE item_id = ?";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, itemselect);
res = pstmt.executeQuery();
while(res.next()){
item_name = res.getString("item_name");
item_price = res.getString("item_price");
item_stock = res.getString("item_stock");
item_img = res.getString("item_img");
}
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
/**
* メソッド名:item_edit
* メソッドの説明:商品名,値段,在庫数,画像パスを変更する
*
* @author Yamanobe
* @version 1.0
* @since 1.0
* @param inputitem ad_item_edit.jsp(商品編集画面)にて入力された商品名
* @param inputprice ad_item_edit.jspにて入力された値段
* @param inputstock ad_item_edit.jspにて入力された在庫
* @param inputimg ad_item_edit.jspにて入力された画像パス
* @param inputid 変更するための基準となる商品ID
*/
public void item_edit(String inputitem, String inputprice,
String inputstock, String inputimg, String inputid) {
try{
// 商品の変更
con = DBmanager.getConnection();
sql = "UPDATE item_table SET item_name=?, item_price=?, item_stock=?, item_img=? WHERE item_id=?";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, inputitem);
pstmt.setString(2, inputprice);
pstmt.setString(3, inputstock);
pstmt.setString(4, inputimg);
pstmt.setString(5, inputid);
pstmt.executeUpdate();
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
/**
* メソッド名:item_del
* メソッドの説明:商品を削除する
*
* @author Yamanobe
* @version 1.0
* @since 1.0
* @param inputid ad_item_info.jsp(商品一覧画面)にて選択された商品ID(削除の基準とする)
*/
public void item_del(String inputid){
try{
// 商品の削除
con = DBmanager.getConnection();
sql = "DELETE FROM item_table WHERE item_id=?";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, inputid);
pstmt.executeUpdate();
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
/**
* メソッド名:item_reg
* メソッドの説明:新商品を登録する
*
* @author Yamanobe
* @version 1.0
* @since 1.0
* @param inputitem ad_item_register.jsp(商品登録画面)にて入力された商品名
* @param inputprice ad_item_register.jspにて入力された値段
* @param inputstock ad_item_register.jspにて入力された在庫
* @param inputimg ad_item_register.jspにて入力された画像パス
*/
public void item_reg(String inputitem, String inputprice,
String inputstock, String inputimg) {
try{
// 商品の登録
con = DBmanager.getConnection();
sql = "INSERT INTO item_table (item_name, item_price, item_stock, item_img) "
+ "VALUES (?,?,?,?)";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, inputitem);
pstmt.setString(2, inputprice);
pstmt.setString(3, inputstock);
pstmt.setString(4, inputimg);
pstmt.executeUpdate();
pstmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
/**
* メソッド名:item_reduce
* メソッドの説明: 注文数だけ商品の出荷
*
* @author Mitsuda
* @version 1.0
* @since 1.0
* @param itemlist
*/
public void item_reduce(ArrayList<CartBean> itemlist){
try {
//注文された数だけ商品テーブルの在庫を減らす
con = DBmanager.getConnection();
for (int i = 0; i < itemlist.size(); i++) {
int item_id;
int num;
item_id = itemlist.get(i).getItem_id();
num = itemlist.get(i).getNum();
sql = "SELECT * FROM item_table WHERE item_id ="+item_id;
pstmt = con.prepareStatement(sql);
res = pstmt.executeQuery();
while (res.next()) {
item_stock = res.getString("item_stock");
}
pstmt.close();
int stock = Integer.parseInt(item_stock);
//注文個数に対して在庫があるかのチェック
if (num <= stock) {
int newstock =stock-num;
sql2 ="UPDATE item_table SET item_stock=? WHERE item_id = ?";
pstmt2 = con.prepareStatement(sql2);
pstmt2.setInt(1,newstock);
pstmt2.setInt(2,item_id);
pstmt2.executeUpdate();
pstmt2.close();
}else if(num > stock && stock >= 1){
flg = 1;
sql2 ="UPDATE item_table SET item_stock=? WHERE item_id = ?";
pstmt2 = con.prepareStatement(sql2);
pstmt2.setInt(1,0);
pstmt2.setInt(2,item_id);
pstmt2.executeUpdate();
pstmt2.close();
}else{
flg = 1;
}
}
con.close();
} catch (Exception e) {
e.printStackTrace();
flg = 2;
}
}
// リストを返す
/**
* メソッド名:select_ALL
* メソッドの説明:item_selectメソッドにて格納されたitemlistを送る
*
* @author Yamanobe
* @version 1.0
* @since 1.0
* @return itemlist item_selectメソッドにて格納されたリスト
*/
public List<AdminDTO> select_ALL(){
return itemlist;
}
}
| [
"akirafunakoshi.nestplus2@gmail.com"
] | akirafunakoshi.nestplus2@gmail.com |
d60031eb9ad3886b49edf7c2dbd18a7e9c491f16 | 5f43f03fc8908969358598c915fc6e7385f6ed6b | /src/java/org/kabeja/ui/impl/OpenProcessingAction.java | dca9d800c1a6f8fd9c6930747ce9c620bb50048e | [
"Apache-2.0"
] | permissive | andriybohdan/kabeja-0.4 | 340c8e2eca806ca71eceb0e28df807049b416217 | 585e3daba931a3eb21cbe2f0083a43d178abe665 | refs/heads/master | 2023-01-21T18:38:12.090354 | 2020-12-06T14:55:28 | 2020-12-06T14:55:28 | 319,057,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,199 | java | /*
Copyright 2008 Simon Mieth
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.kabeja.ui.impl;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.swing.AbstractAction;
import javax.swing.JFileChooser;
import org.kabeja.processing.ProcessingManager;
import org.kabeja.tools.SAXProcessingManagerBuilder;
public class OpenProcessingAction extends AbstractAction {
protected String baseDir = "";
protected ServiceContainer container;
public OpenProcessingAction(ServiceContainer container) {
super(Messages.getString("OpenProcessingAction.menuitem"));
putValue(SHORT_DESCRIPTION, Messages.getString("OpenProcessingAction.menuitem.description"));
this.container = container;
}
public void actionPerformed(ActionEvent e) {
Thread t = new Thread(new Runnable() {
public void run() {
openProcessing();
}
});
t.start();
}
protected void openProcessing() {
JFileChooser fc = new JFileChooser(this.baseDir);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int value = fc.showOpenDialog(null);
if (value == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try {
ProcessingManager m = SAXProcessingManagerBuilder.buildFromStream(new FileInputStream(
file));
container.setProcessingManager(m);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
}
| [
"a.bohdan@gmail.com"
] | a.bohdan@gmail.com |
e9e7c3cdee4ffe454e5496e14686c00db32265d1 | c1794e0194fa851a9356edfc7d0494508b1abb9a | /src/employe/dateEntreeService.java | 0dbe79afd171b14125fd6020a4644f3ce97a1701 | [] | no_license | TAMIBE62/Projet-de-poo | 8f9fc8e15c00675c83c9bbc3558000d4d28c3f38 | aefe4632acca6eba2ce762cd15e32c6161c3b9db | refs/heads/master | 2021-08-24T18:14:55.087211 | 2017-11-21T11:09:08 | 2017-11-21T11:09:08 | 111,538,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | 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 employe;
/**
*
* @author compaq
*/
class dateEntreeService {
}
| [
"Clotilde@ClotildeNadinanFAMR"
] | Clotilde@ClotildeNadinanFAMR |
6d1858f8b9d6b33c16b7ada8ed917ee0b54ffd66 | ce03464ae9c92fb067395e0c06598d81452a1aed | /file.java | 3e877facca70d711c6bca1d90e1b09cb5cdafa46 | [] | no_license | TimHack/git-featues-demo | 856dfab0847ab1f26c286853a5e536336c644a8a | fe9f0433ada26edaa41fac71802e05a0fdae3dc4 | refs/heads/master | 2020-12-08T14:43:10.738638 | 2020-01-10T15:22:31 | 2020-01-10T15:22:31 | 233,008,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 70 | java | Test java file
More changes in this file
Editing file
More edits
| [
"timothee.hack@netcentric.biz"
] | timothee.hack@netcentric.biz |
1d8c14effb757c81d6f14a9eacd2429323c3f40b | a1323506facc66a346da6e6751c50277f374eed3 | /fecon/src/main/java/es/ldrsoftware/fecon/cnt/ctrl/CtTradFormRqt.java | 3bee5d1feaf34d3f68360cb2eaccc198acdae927 | [] | no_license | luisda1983/fecon | 7408d57d2c76184b9488ca6eda89299d2c9dd1c3 | 1eb524a90948b060c63b00dd1feefcd1928920f6 | refs/heads/master | 2023-01-15T10:08:56.661473 | 2023-01-11T22:41:45 | 2023-01-11T22:41:45 | 105,206,531 | 0 | 0 | null | 2023-01-10T22:05:18 | 2017-09-28T22:50:30 | Java | UTF-8 | Java | false | false | 479 | java | package es.ldrsoftware.fecon.cnt.ctrl;
import es.ldrsoftware.core.arq.data.BaseRequest;
public class CtTradFormRqt extends BaseRequest {
public long iden;
public String nomb;
public String tip1;
public long dom1;
public String ide1;
public String obl1;
public String tip2;
public long dom2;
public String ide2;
public String obl2;
public String tip3;
public long dom3;
public String ide3;
public String obl3;
public String desc;
}
| [
"LDR Software@LAPTOP-FPVDSJB2"
] | LDR Software@LAPTOP-FPVDSJB2 |
0efbda60ec3bd22a81dc2e3d6d0b39830a2baef9 | 5c49155ab55d65c9c9ea209973282d8805fd61da | /iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/LogManagerRdf.java | 715e854b2394d9f40d24d48e88106d7b962696ec | [
"Apache-2.0"
] | permissive | ericstephan/iserve | 40ce27de4167f8667e162152a1c24d340755eb78 | d70f11e02ce6ede02fb5b1fcf94de8eb2067a6d1 | refs/heads/master | 2020-12-30T22:57:21.475669 | 2013-10-21T17:40:13 | 2013-10-21T17:40:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,532 | java | ///*
// Copyright ${year} Knowledge Media Institute - The Open University
//
// 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 uk.ac.open.kmi.iserve.sal.manager.impl;
//
//import java.util.Date;
//import java.util.GregorianCalendar;
//import java.util.HashMap;
//import java.util.Map;
//import java.util.TimeZone;
//
//import javax.xml.datatype.DatatypeConfigurationException;
//import javax.xml.datatype.DatatypeFactory;
//import javax.xml.datatype.XMLGregorianCalendar;
//
//import org.ontoware.aifbcommons.collection.ClosableIterator;
//import org.ontoware.rdf2go.model.QueryResultTable;
//import org.ontoware.rdf2go.model.QueryRow;
//import org.ontoware.rdf2go.model.node.URI;
//import org.ontoware.rdf2go.vocabulary.RDF;
//import org.ontoware.rdf2go.vocabulary.XSD;
//import org.openrdf.rdf2go.RepositoryModel;
//import org.openrdf.repository.RepositoryException;
//
//import uk.ac.open.kmi.iserve.commons.io.RDFRepositoryConnector;
//import uk.ac.open.kmi.iserve.sal.SystemConfiguration;
//import uk.ac.open.kmi.iserve.sal.exception.LogException;
//import uk.ac.open.kmi.iserve.sal.manager.LogManager;
//
//import com.hp.hpl.jena.vocabulary.DC;
//
//public class LogManagerRdf implements LogManager {
//
// private static final String LOG_ENTRY_PREFIX = LOG.NS_URI + "logEntry";
//
// private static final String ACTION_PREFIX = LOG.NS_URI + "action";
//
// private static final String TIME_INSTANT_PREFIX = LOG.TIME_NS_URI + "instant";
//
// private RDFRepositoryConnector repoConnector;
//
// /**
// * Constructor for the Log Manager. Protected to avoid external access.
// * Any access to this should take place through the iServeManager
// *
// * @param configuration
// * @throws RepositoryException
// */
// protected LogManagerRdf(SystemConfiguration configuration) throws RepositoryException {
// repoConnector = new RDFRepositoryConnector(configuration.getLogServerUrl().toString(),
// configuration.getLogsRepositoryName());
// }
//
// /* (non-Javadoc)
// * @see uk.ac.open.kmi.iserve.sal.manager.LogManager#log(java.lang.String, java.lang.String, java.lang.String, java.util.Date, java.lang.String)
// */
// @Override
// public void log(String agentUri, String actionUri, String object, Date time, String method) throws LogException {
// URI action = null;
// if ( actionUri.toString().endsWith(LOG.ITEM_CREATION) ) {
// action = LOG.createdItem;
// } else if ( actionUri.toString().endsWith(LOG.ITEM_RETRIEVAL) ) {
// action = LOG.retrievedItem;
// } else if ( actionUri.toString().endsWith(LOG.ITEM_UPDATING) ) {
// action = LOG.updatedItem;
// } else if ( actionUri.toString().endsWith(LOG.ITEM_DELETING) ) {
// action = LOG.deletedItem;
// }
//
// if ( null == action ) {
// throw new LogException("Unknown Action: " + actionUri.toString());
// }
//
// RepositoryModel repoModel = repoConnector.openRepositoryModel();
// // FIXME: only logging ONCE within ONE millisecond.
// long currentTime = System.currentTimeMillis();
// URI logEntryInst = repoModel.createURI(LOG_ENTRY_PREFIX + currentTime);
// URI actionInst = repoModel.createURI(ACTION_PREFIX + currentTime);
// URI timeInstantInst = repoModel.createURI(TIME_INSTANT_PREFIX + currentTime);
// URI actionType = repoModel.createURI(actionUri);
// URI agnetInst = repoModel.createURI(agentUri);
// URI objectInst = repoModel.createURI(object);
//
// DatatypeFactory datatypeFactory;
// try {
// datatypeFactory = DatatypeFactory.newInstance();
// } catch (DatatypeConfigurationException e) {
// throw new LogException(e);
// }
// GregorianCalendar utcCalendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
// utcCalendar.setTime(time);
// XMLGregorianCalendar xmlCalendar = datatypeFactory.newXMLGregorianCalendar(utcCalendar);
// xmlCalendar = xmlCalendar.normalize();
//
// repoModel.addStatement(actionInst, RDF.type, actionType);
// repoModel.addStatement(actionInst, action, objectInst);
// repoModel.addStatement(timeInstantInst, RDF.type, LOG.TimeInstant);
// repoModel.addStatement(timeInstantInst, LOG.inXSDDateTime, repoModel.createDatatypeLiteral(xmlCalendar.toXMLFormat(), XSD._dateTime));
// repoModel.addStatement(logEntryInst, RDF.type, LOG.ServiceRepositoyLogEntry);
// repoModel.addStatement(logEntryInst, LOG.hasAction, actionInst);
// repoModel.addStatement(logEntryInst, LOG.hasAgent, agnetInst);
// repoModel.addStatement(logEntryInst, LOG.hasDateTime, timeInstantInst);
// repoModel.addStatement(logEntryInst, LOG.hasMethod, method);
//
// if ( actionUri.endsWith(LOG.CREATED_ITEM) ) {
// repoModel.addStatement(objectInst, DC.creator, agnetInst);
// }
//
// repoConnector.closeRepositoryModel(repoModel);
// repoModel = null;
// }
//
// /* (non-Javadoc)
// * @see uk.ac.open.kmi.iserve.sal.manager.LogManager#getAllLogItems()
// */
// @Override
// public Map<String, LogItem> getAllLogItems() throws DatatypeConfigurationException {
// Map<String, LogItem> result = new HashMap<String, LogItem>();
// String logQueryString = "SELECT DISTINCT ?uri ?agent ?t WHERE { " +
// "?log " + RDF.type.toSPARQL() + " " + LOG.ServiceRepositoyLogEntry.toSPARQL() + " . \n" +
// "?log " + LOG.hasAction.toSPARQL() + " ?a . \n" +
// "?log " + LOG.hasDateTime.toSPARQL() + " ?inst . \n" +
// "?inst " + LOG.inXSDDateTime.toSPARQL() + " ?t . \n" +
// "?log " + LOG.hasAgent.toSPARQL() + " ?agent . \n" +
// "?a " + LOG.createdItem.toSPARQL() + " ?uri }";
// RepositoryModel model = repoConnector.openRepositoryModel();
// QueryResultTable qrt = model.sparqlSelect(logQueryString);
// ClosableIterator<QueryRow> iter = qrt.iterator();
// while ( iter.hasNext() ) {
// QueryRow row = iter.next();
// String uri = row.getValue("uri").toString();
// String author = row.getValue("agent").toString();
// String timeString = row.getValue("t").toString();
// timeString = timeString.substring(0, timeString.indexOf('^'));
// DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
// XMLGregorianCalendar xmlCalendar = datatypeFactory.newXMLGregorianCalendar(timeString);
// GregorianCalendar cal = xmlCalendar.toGregorianCalendar();
// Date time = cal.getTime();
// LogItem log = new LogItemImpl(author, time);
// result.put(uri, log);
// }
// iter.close();
// repoConnector.closeRepositoryModel(model);
// return result;
// }
//
// /* (non-Javadoc)
// * @see uk.ac.open.kmi.iserve.sal.manager.LogManager#getAllLogItemsForUser(java.net.URI)
// */
// @Override
// public Map<String, LogItem> getAllLogItemsForUser(java.net.URI userUri)
// throws DatatypeConfigurationException {
// // TODO Auto-generated method stub
// return null;
// }
//
// /* (non-Javadoc)
// * @see uk.ac.open.kmi.iserve.sal.manager.LogManager#getAllLogItemsAboutResource(java.net.URI)
// */
// @Override
// public Map<String, LogItem> getAllLogItemsAboutResource(
// java.net.URI resourceUri) throws DatatypeConfigurationException {
// // TODO Auto-generated method stub
// return null;
// }
//
//}
| [
"c.pedrinaci@open.ac.uk"
] | c.pedrinaci@open.ac.uk |
cea170e4467c9c6b6434258ce3b9acf757d034e8 | 6d82f06048d330216b17c19790f29075e62e47d5 | /branches/SDK-2/main/metro/part/src/test/net/dpml/runtime/composition/CompositeTestCase.java | 31b8fde8bcc10e50d41988e210694d04d925856f | [
"Apache-2.0"
] | permissive | IdelsTak/dpml-svn | 7d1fc3f1ff56ef2f45ca5f7f3ae88b1ace459b79 | 9f9bdcf0198566ddcee7befac4a3b2c693631df5 | refs/heads/master | 2022-03-19T15:50:45.872930 | 2009-11-23T08:45:39 | 2009-11-23T08:45:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,251 | java | /*
* Copyright 2006 Stephen J. McConnell.
*
* 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 net.dpml.runtime.composition;
import net.dpml.runtime.AbstractTestCase;
import org.acme.CompositeComponent;
/**
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class CompositeTestCase extends AbstractTestCase
{
public void testComponent() throws Exception
{
CompositeComponent component =
load( CompositeComponent.class, "composite.xml", "composite" );
assertNotNull( "widget", component.getParts().getWidget() );
assertNotNull( "gizmo", component.getParts().getGizmo() );
}
}
| [
"mcconnell@00579e91-1ffa-0310-aa18-b241b61564ef"
] | mcconnell@00579e91-1ffa-0310-aa18-b241b61564ef |
c9364d8e0325e3a7cb193ce0be8ee7c6e7dddc9f | 23257a43bdf73bf16fbd3b73d988828f38e583ba | /app/src/main/java/knf/animeflv/Configuracion.java | 6485e075617a099b57c4d2ca48043a7292bb3666 | [] | no_license | guerra1337/Animeflv | 82770aa6aac4218b56746a07c1b402d49ac8b8e7 | 79f57548b77fc2d5f41721402a574e21d65aab01 | refs/heads/master | 2020-04-27T21:51:21.132762 | 2019-02-23T17:40:33 | 2019-02-23T17:40:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,036 | java | package knf.animeflv;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.GravityEnum;
import com.afollestad.materialdialogs.MaterialDialog;
import com.onesignal.OneSignal;
import knf.animeflv.Utils.ThemeUtils;
public class Configuracion extends AppCompatActivity {
public static final int OPEN_SOUNDS = 1;
public static final int GET_WRITE_PERMISSIONS = 2;
public static boolean isXLargeScreen(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
public static String byte2HexFormatted(byte[] arr) {
StringBuilder str = new StringBuilder(arr.length * 2);
for (int i = 0; i < arr.length; i++) {
String h = Integer.toHexString(arr[i]);
int l = h.length();
if (l == 1) h = "0" + h;
if (l > 2) h = h.substring(l - 2, l);
str.append(h.toUpperCase());
if (i < (arr.length - 1)) str.append(':');
}
return str.toString();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeUtils.setThemeOn(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.configuracion);
ThemeUtils.Theme theme = ThemeUtils.Theme.create(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(theme.primaryDark);
getWindow().setNavigationBarColor(theme.primary);
}
Toolbar toolbar=(Toolbar) findViewById(R.id.conf_toolbar);
toolbar.setBackgroundColor(theme.primary);
toolbar.getRootView().setBackgroundColor(theme.background);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Configuracion");
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setTitleTextColor(theme.textColorToolbar);
ThemeUtils.setNavigationColor(toolbar, theme.toolbarNavigation);
/*final Drawable upArrow = getResources().getDrawable(R.drawable.ic_back_r);
upArrow.setColorFilter(getResources().getColor(R.color.blanco), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);*/
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
getFragmentManager().beginTransaction().replace(R.id.container_conf, new Conf_fragment()).commitAllowingStateLoss();
if (getIntent().getExtras() != null) {
setResult(getIntent().getIntExtra("return", -1));
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu_ayuda, menu);
ThemeUtils.setMenuColor(menu, ThemeUtils.Theme.get(this, ThemeUtils.Theme.KEY_TOOLBAR_NAVIGATION));
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
MaterialDialog dialog = new MaterialDialog.Builder(this)
.title("Codigo de referencia")
.backgroundColor(ThemeUtils.isAmoled(this) ? ColorsRes.Prim(this) : ColorsRes.Blanco(this))
.titleGravity(GravityEnum.CENTER)
.customView(R.layout.lay_info, false)
.build();
final String id = OneSignal.getPermissionSubscriptionState().getSubscriptionStatus().getUserId();
TextView textView = (TextView) dialog.getCustomView().findViewById(R.id.help_id);
textView.setText(id);
textView.setTextColor(ThemeUtils.getAcentColor(this));
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", id);
clipboard.setPrimaryClip(clip);
Toast.makeText(Configuracion.this, "Codigo copiado a portapapeles", Toast.LENGTH_SHORT).show();
}
});
dialog.show();
return true;
}
@Override
public void onConfigurationChanged (Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (!isXLargeScreen(getApplicationContext()) ) {
return;
}
}
}
| [
"jordyamc@hotmail.com"
] | jordyamc@hotmail.com |
385ee677685d8971ba364c382c74d37f6953bd18 | b537c2aa44dfa53e6b2fadcf82b8ef32aee6fe51 | /app/src/main/java/com/lsj/douyutv/ui/MyAutoRelativeLayout.java | 03a8e743af1f842eacebb8e77389a995abf82aeb | [
"MIT"
] | permissive | serge66/DouYuTV | 7485fef8b85ffc4fb73bdcc46878ebe7c85e7000 | 4faee8430919ab4a84fae98e216535100c32c5a6 | refs/heads/master | 2021-09-02T12:12:00.276669 | 2018-01-02T13:55:43 | 2018-01-02T13:55:43 | 115,254,354 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | package com.lsj.douyutv.ui;
import android.content.Context;
import android.util.AttributeSet;
import com.zhy.autolayout.AutoRelativeLayout;
/*
* Description:
* Author: lishengjiejob@163.com
* Time: 2017/12/25 14:33
*/
public class MyAutoRelativeLayout extends AutoRelativeLayout {
public MyAutoRelativeLayout(Context context) {
super(context);
}
public MyAutoRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyAutoRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MyAutoRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
}
| [
"lishengjiejob@163.com"
] | lishengjiejob@163.com |
6fc891cbde02a42d2d391c0fd1d0fd28662fa723 | 207bdc32984a1bfb17d5373316b8cf2710268378 | /JavaBase/workspace/day08-20180306/src/lesson16/Demo01.java | 8fa2ef8e6809f85c5cc18310b875824c26248739 | [] | no_license | frank-lam/JavaWebLearn | 49ecd03ed55362f4d3a00e106bf222d7499bfcde | 9be28d346b425fad34e739227ea879557bbd5d5a | refs/heads/master | 2020-04-25T08:14:55.793363 | 2018-12-08T15:53:09 | 2018-12-08T15:53:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,161 | java | package lesson16;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Demo01 {
public static void main(String[] args) throws Exception {
//JDK7的六个新特性回顾和讲解
// A:二进制字面量
System.out.println(0b1000);
// B:数字字面量可以出现下划线
System.out.println(1000_0000);
// C:switch 语句可以用字符串
String s = "A";
switch (s) {
case "A":
break;
case "B":
break;
default:
break;
}
// D:泛型简化,菱形泛型
//List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
// E:异常的多个catch合并,每个异常用或|
try{
int i = 10 / 0;//算术异常
int[] arr = null;
System.out.println(arr[0]);//空指针异常
}catch (ArithmeticException | NullPointerException e) {
// TODO: handle exception
}
// F:try-with-resources 语句 //这样写不用关流
try(
FileInputStream fis = new FileInputStream("a.txt");
){
fis.read();
}
}
}
| [
"1924949262@qq.com"
] | 1924949262@qq.com |
1298131345b3871de19180bacc9998b52836d901 | 85f184aefe413094b03f715ca19afcaf2d7efd1a | /com.ptoceti.osgi.pi/src/main/java/com/ptoceti/osgi/pi/impl/PinConfig.java | e61e35a9a7bfcf976e0c99fb45d67ed647e11076 | [
"Apache-2.0"
] | permissive | kite29/Ptoceti | a47528533bb03ee0b1f2c44e3cdf747499b91e55 | 7cc23ec134c3ff6c8e0fb0a42e73f897edaba178 | refs/heads/master | 2020-04-05T17:54:34.895920 | 2017-09-07T21:13:09 | 2017-09-07T21:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,602 | java | package com.ptoceti.osgi.pi.impl;
/*
* #%L
* **********************************************************************
* ORGANIZATION : ptoceti
* PROJECT : Pi
* FILENAME : PinConfig.java
*
* This file is part of the Ptoceti project. More information about
* this project can be found here: http://www.ptoceti.com/
* **********************************************************************
* %%
* Copyright (C) 2013 - 2015 ptoceti
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class PinConfig {
private String identification;
private String scope;
private boolean digital;
private boolean directionIn;
private Integer pinNumber;
private Integer value;
private Integer lastValue;
private Double scale;
private Double offset;
private String unit;
public String getIdentification() {
return identification;
}
public void setIdentification(String identification) {
this.identification = identification;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public Double getScale() {
return scale;
}
public void setScale(Double scale) {
this.scale = scale;
}
public Double getOffset() {
return offset;
}
public void setOffset(Double offset) {
this.offset = offset;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public Integer getLastValue() {
return lastValue;
}
public void setLastValue(Integer lastValue) {
this.lastValue = lastValue;
}
public boolean isDigital() {
return digital;
}
public void setDigital(boolean digital) {
this.digital = digital;
}
public boolean isDirectionIn() {
return directionIn;
}
public void setDirectionIn(boolean directionIn) {
this.directionIn = directionIn;
}
public Integer getPinNumber() {
return pinNumber;
}
public void setPinNumber(Integer pinNumber) {
this.pinNumber = pinNumber;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
| [
"lathil.dev@gmail.com"
] | lathil.dev@gmail.com |
7b711d1cfccad285f73f86fbd2bc8844757e8f6a | 29acc5b6a535dfbff7c625f5513871ba55554dd2 | /aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/AcceptCertificateTransferRequest.java | 347617c11fd83c0a20a36296d83498b33c8bb0e3 | [
"JSON",
"Apache-2.0"
] | permissive | joecastro/aws-sdk-java | b2d25f6a503110d156853836b49390d2889c4177 | fdbff1d42a73081035fa7b0f172b9b5c30edf41f | refs/heads/master | 2021-01-21T16:52:46.982971 | 2016-01-11T22:55:28 | 2016-01-11T22:55:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,292 | java | /*
* Copyright 2010-2016 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.iot.model;
import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;
/**
* <p>
* The input for the AcceptCertificateTransfer operation.
* </p>
*/
public class AcceptCertificateTransferRequest extends AmazonWebServiceRequest
implements Serializable, Cloneable {
/**
* <p>
* The ID of the certificate.
* </p>
*/
private String certificateId;
/**
* <p>
* Specifies whether the certificate is active.
* </p>
*/
private Boolean setAsActive;
/**
* <p>
* The ID of the certificate.
* </p>
*
* @param certificateId
* The ID of the certificate.
*/
public void setCertificateId(String certificateId) {
this.certificateId = certificateId;
}
/**
* <p>
* The ID of the certificate.
* </p>
*
* @return The ID of the certificate.
*/
public String getCertificateId() {
return this.certificateId;
}
/**
* <p>
* The ID of the certificate.
* </p>
*
* @param certificateId
* The ID of the certificate.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public AcceptCertificateTransferRequest withCertificateId(
String certificateId) {
setCertificateId(certificateId);
return this;
}
/**
* <p>
* Specifies whether the certificate is active.
* </p>
*
* @param setAsActive
* Specifies whether the certificate is active.
*/
public void setSetAsActive(Boolean setAsActive) {
this.setAsActive = setAsActive;
}
/**
* <p>
* Specifies whether the certificate is active.
* </p>
*
* @return Specifies whether the certificate is active.
*/
public Boolean getSetAsActive() {
return this.setAsActive;
}
/**
* <p>
* Specifies whether the certificate is active.
* </p>
*
* @param setAsActive
* Specifies whether the certificate is active.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public AcceptCertificateTransferRequest withSetAsActive(Boolean setAsActive) {
setSetAsActive(setAsActive);
return this;
}
/**
* <p>
* Specifies whether the certificate is active.
* </p>
*
* @return Specifies whether the certificate is active.
*/
public Boolean isSetAsActive() {
return this.setAsActive;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getCertificateId() != null)
sb.append("CertificateId: " + getCertificateId() + ",");
if (getSetAsActive() != null)
sb.append("SetAsActive: " + getSetAsActive());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AcceptCertificateTransferRequest == false)
return false;
AcceptCertificateTransferRequest other = (AcceptCertificateTransferRequest) obj;
if (other.getCertificateId() == null ^ this.getCertificateId() == null)
return false;
if (other.getCertificateId() != null
&& other.getCertificateId().equals(this.getCertificateId()) == false)
return false;
if (other.getSetAsActive() == null ^ this.getSetAsActive() == null)
return false;
if (other.getSetAsActive() != null
&& other.getSetAsActive().equals(this.getSetAsActive()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getCertificateId() == null) ? 0 : getCertificateId()
.hashCode());
hashCode = prime
* hashCode
+ ((getSetAsActive() == null) ? 0 : getSetAsActive().hashCode());
return hashCode;
}
@Override
public AcceptCertificateTransferRequest clone() {
return (AcceptCertificateTransferRequest) super.clone();
}
} | [
"aws@amazon.com"
] | aws@amazon.com |
028288a2cc9d60c942b24c18a80074dae79efa34 | 6a04b2bd89109c11350746d6a8627299dfd3dbd7 | /src/main/java/com/uisek/servicio/admin/model/service/AplicacionServiceImp.java | 777b0569eba104426fb20c7f6f141665a61e2aac | [] | no_license | WilsonCastro1988/ServicioUisekAdmin | a331d30d8b80a573f4bb6df688a8d15487b7af90 | 6b5a1a6c6ed9b3fc2037b54a5266043957e9ef5d | refs/heads/master | 2023-04-20T01:25:01.186728 | 2021-05-11T00:10:24 | 2021-05-11T00:10:24 | 312,599,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package com.uisek.servicio.admin.model.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.uisek.servicio.admin.model.dao.AplicacionDao;
import com.uisek.servicio.admin.model.entity.Aplicacion;
@Service
public class AplicacionServiceImp implements AplicacionService{
@Autowired
private AplicacionDao repo;
@Override
public List<Aplicacion> findAll() {
return (List<Aplicacion>) repo.findAll();
}
@Override
public Aplicacion findById(Long id) {
return repo.findById(id).orElse(null);
}
@Override
public Aplicacion save(Aplicacion entidad) {
return repo.save(entidad);
}
@Override
public void deleteById(Long id) {
repo.deleteById(id);
}
@Override
public Aplicacion findByUrl(String url) {
return repo.findByUrl(url);
}
}
| [
"wilson.castro@kpitalink.com"
] | wilson.castro@kpitalink.com |
501587f8da755e713dc881fbedb94342ae19e06d | 3a59bd4f3c7841a60444bb5af6c859dd2fe7b355 | /sources/org/apache/commons/codec/binary/BinaryCodec.java | cf0fb997008d4013bc40cb9355d21b1a5a2b0a08 | [] | no_license | sengeiou/KnowAndGo-android-thunkable | 65ac6882af9b52aac4f5a4999e095eaae4da3c7f | 39e809d0bbbe9a743253bed99b8209679ad449c9 | refs/heads/master | 2023-01-01T02:20:01.680570 | 2020-10-22T04:35:27 | 2020-10-22T04:35:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,418 | java | package org.apache.commons.codec.binary;
import org.apache.commons.codec.BinaryDecoder;
import org.apache.commons.codec.BinaryEncoder;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.EncoderException;
public class BinaryCodec implements BinaryDecoder, BinaryEncoder {
private static final int[] BITS = {1, 2, 4, 8, 16, 32, 64, 128};
private static final int BIT_0 = 1;
private static final int BIT_1 = 2;
private static final int BIT_2 = 4;
private static final int BIT_3 = 8;
private static final int BIT_4 = 16;
private static final int BIT_5 = 32;
private static final int BIT_6 = 64;
private static final int BIT_7 = 128;
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
private static final char[] EMPTY_CHAR_ARRAY = new char[0];
public byte[] encode(byte[] bArr) {
return toAsciiBytes(bArr);
}
public Object encode(Object obj) throws EncoderException {
if (obj instanceof byte[]) {
return toAsciiChars((byte[]) obj);
}
throw new EncoderException("argument not a byte array");
}
public Object decode(Object obj) throws DecoderException {
if (obj == null) {
return EMPTY_BYTE_ARRAY;
}
if (obj instanceof byte[]) {
return fromAscii((byte[]) obj);
}
if (obj instanceof char[]) {
return fromAscii((char[]) obj);
}
if (obj instanceof String) {
return fromAscii(((String) obj).toCharArray());
}
throw new DecoderException("argument not a byte array");
}
public byte[] decode(byte[] bArr) {
return fromAscii(bArr);
}
public byte[] toByteArray(String str) {
if (str == null) {
return EMPTY_BYTE_ARRAY;
}
return fromAscii(str.toCharArray());
}
public static byte[] fromAscii(char[] cArr) {
if (cArr == null || cArr.length == 0) {
return EMPTY_BYTE_ARRAY;
}
byte[] bArr = new byte[(cArr.length >> 3)];
int length = cArr.length - 1;
int i = 0;
while (i < bArr.length) {
for (int i2 = 0; i2 < BITS.length; i2++) {
if (cArr[length - i2] == '1') {
bArr[i] = (byte) (bArr[i] | BITS[i2]);
}
}
i++;
length -= 8;
}
return bArr;
}
public static byte[] fromAscii(byte[] bArr) {
if (isEmpty(bArr)) {
return EMPTY_BYTE_ARRAY;
}
byte[] bArr2 = new byte[(bArr.length >> 3)];
int length = bArr.length - 1;
int i = 0;
while (i < bArr2.length) {
for (int i2 = 0; i2 < BITS.length; i2++) {
if (bArr[length - i2] == 49) {
bArr2[i] = (byte) (bArr2[i] | BITS[i2]);
}
}
i++;
length -= 8;
}
return bArr2;
}
private static boolean isEmpty(byte[] bArr) {
return bArr == null || bArr.length == 0;
}
public static byte[] toAsciiBytes(byte[] bArr) {
if (isEmpty(bArr)) {
return EMPTY_BYTE_ARRAY;
}
byte[] bArr2 = new byte[(bArr.length << 3)];
int length = bArr2.length - 1;
int i = 0;
while (i < bArr.length) {
for (int i2 = 0; i2 < BITS.length; i2++) {
if ((bArr[i] & BITS[i2]) == 0) {
bArr2[length - i2] = 48;
} else {
bArr2[length - i2] = 49;
}
}
i++;
length -= 8;
}
return bArr2;
}
public static char[] toAsciiChars(byte[] bArr) {
if (isEmpty(bArr)) {
return EMPTY_CHAR_ARRAY;
}
char[] cArr = new char[(bArr.length << 3)];
int length = cArr.length - 1;
int i = 0;
while (i < bArr.length) {
for (int i2 = 0; i2 < BITS.length; i2++) {
if ((bArr[i] & BITS[i2]) == 0) {
cArr[length - i2] = '0';
} else {
cArr[length - i2] = '1';
}
}
i++;
length -= 8;
}
return cArr;
}
public static String toAsciiString(byte[] bArr) {
return new String(toAsciiChars(bArr));
}
}
| [
"joshuahj.tsao@gmail.com"
] | joshuahj.tsao@gmail.com |
30c3678e7a51660a8cf5e5a40c944b42cb69aeba | 5db6651519bd0ce864d956c785533cf8a2f7f843 | /src/main/java/lt/pavelvincel/lbapp/services/CurrencyService.java | c37fb39d2eb66af5e3ade67ad3f488dec2844b52 | [] | no_license | jullbull/eis_test | 43d31a89b7683f11b3960868f0773e308dab90e8 | 0a7bb687e60d61c2e21a20bc45ce4f2636854c5f | refs/heads/master | 2020-03-16T18:10:05.220897 | 2018-05-10T07:19:38 | 2018-05-10T07:19:38 | 132,862,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,287 | java | package lt.pavelvincel.lbapp.services;
import lt.pavelvincel.lbapp.domains.Currency;
import lt.pavelvincel.lbapp.services.constants.FileName;
import java.util.List;
public class CurrencyService {
public List<Currency> getAllCodesAndNames(String date) {
CurrencyDataReceiver receiver = new CurrencyDataReceiver();
CurrencyDataExtractor extractor = new CurrencyDataExtractor();
try {
receiver.getFile(FileName.URL_ALL_CODES_AND_NAMES + date, FileName.CODES_AND_NAMES);
List<Currency> currencies = extractor.getCurrencyData(FileName.XML_FILE_FULL);
return currencies;
} catch (Exception e) {
return null;
}
}
public List<Currency> getDataFromTo(String code, String dateFrom, String dateTo) {
CurrencyDataReceiver receiver = new CurrencyDataReceiver();
CurrencyDataExtractor extractor = new CurrencyDataExtractor();
String url = receiver.getUrlByFromToAndCode(code, dateFrom, dateTo);
try {
receiver.getFile(url, FileName.VALUES);
List<Currency> currencies = extractor.getCurrencyData(FileName.XML_FILE_VALUES);
return currencies;
} catch (Exception e) {
return null;
}
}
}
| [
"jullbull@localhost.localdomain"
] | jullbull@localhost.localdomain |
f6202edc2acdce68a995918ec9de803574d0b035 | e4bcee6690310b8e82aca08a1ccde295dcbda57e | /src/main/java/com/zty/Mapper/ServersMetricMapper.java | 771282d2a68bca060ca5a351981f03b31dc3532f | [] | no_license | tian0121/ansibles | d989fd0acdbbeec36b0b2e1bda07afbda0ea11f1 | 8488a0a15b7c1c3541b56137321b392375a46b85 | refs/heads/master | 2022-07-14T22:06:36.670230 | 2019-06-17T10:01:47 | 2019-06-17T10:01:47 | 192,323,447 | 0 | 0 | null | 2022-06-21T01:17:50 | 2019-06-17T10:13:45 | Java | UTF-8 | Java | false | false | 356 | java | package com.zty.Mapper;
import com.zty.entity.ServerMetrics;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface ServersMetricMapper extends Mapper<ServerMetrics> {
public void addServersMetrics(ServerMetrics serverMetrics);
public void deleteTaskMetric(Integer taskId);
}
| [
"17812117061@163.com"
] | 17812117061@163.com |
dd91f4fbb08bc4df5a943291d4f050e924c1b2cb | c43f1d92ae1046754e55e5479ea03b84d81ffb42 | /trainingcockpits/src/org/training/cockpits/cmscockpit/session/impl/DefaultLiveEditBrowserArea.java | 5ef8f837745118ce02aac2b93d115a6815415a1c | [] | no_license | Ojasmodi/training-hybris | 9296b5d2e8e710bd027eff9cebef94a1423a529f | dcd292935bf08b3d4c6e4b50ee17085026f6f472 | refs/heads/master | 2020-12-20T04:29:44.707635 | 2020-02-24T18:17:06 | 2020-02-24T18:17:06 | 235,962,253 | 0 | 1 | null | 2020-04-30T14:15:25 | 2020-01-24T08:05:05 | Java | UTF-8 | Java | false | false | 10,474 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package org.training.cockpits.cmscockpit.session.impl;
import de.hybris.platform.cms2.model.preview.PreviewDataModel;
import de.hybris.platform.cms2.model.site.CMSSiteModel;
import de.hybris.platform.cmscockpit.events.impl.CmsLiveEditEvent;
import de.hybris.platform.cmscockpit.events.impl.CmsPerspectiveInitEvent;
import de.hybris.platform.cmscockpit.events.impl.CmsUrlChangeEvent;
import de.hybris.platform.cmscockpit.session.impl.LiveEditBrowserArea;
import de.hybris.platform.cockpit.components.contentbrowser.AbstractContentBrowser;
import de.hybris.platform.cockpit.events.CockpitEvent;
import de.hybris.platform.cockpit.events.impl.ItemChangedEvent;
import de.hybris.platform.cockpit.session.AdvancedBrowserModel;
import de.hybris.platform.cockpit.session.BrowserModel;
import de.hybris.platform.cockpit.session.BrowserModelListener;
import de.hybris.platform.cockpit.session.UICockpitPerspective;
import de.hybris.platform.cockpit.session.UISessionListener;
import de.hybris.platform.cockpit.session.UISessionUtils;
import de.hybris.platform.cockpit.session.impl.DefaultSearchBrowserModelListener;
import de.hybris.platform.core.model.user.UserModel;
import de.hybris.platform.servicelayer.i18n.CommonI18NService;
import java.util.Collections;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Required;
/**
* Represents a browser area of <b>Live Edit Perspective</b>
*/
public class DefaultLiveEditBrowserArea extends LiveEditBrowserArea
{
private static final Logger LOG = Logger.getLogger(DefaultLiveEditBrowserArea.class);
private static final String UNABLE_TO_LOAD_LIVE_EDIT_BROWSER_MODEL_MSG = "It is not possible to load LiveEdit Browser Model";
private CommonI18NService commonI18NService;
private CMSSiteModel currentSite = null;
private AdvancedBrowserModel welcomeBrowserModel = null;
private boolean initialized = false;
private boolean liveEditModeEnabled = false;
private final DefaultSearchBrowserModelListener liveEditBrowserListener = newDefaultSearchBrowserModelListener();
@Override
public void initialize(final Map<String, Object> params)
{
if (!this.initialized)
{
this.initialized = true;
final DefaultLiveEditBrowserModel browserModel = newDefaultLiveEditBrowserModel();
browserModel.setCurrentSite(this.currentSite);
browserModel.addBrowserModelListener(liveEditBrowserListener);
addVisibleBrowser(browserModel);
setFocusedBrowser(browserModel);
UISessionUtils.getCurrentSession().addSessionListener(newLiveEditBrowserAreaUISessionListener());
}
}
protected DefaultLiveEditBrowserModel newDefaultLiveEditBrowserModel()
{
return new DefaultLiveEditBrowserModel();
}
protected DefaultSearchBrowserModelListener newDefaultSearchBrowserModelListener()
{
return new DefaultSearchBrowserModelListener(this);
}
@Override
public boolean addVisibleBrowser(final int index, final BrowserModel browserModel)
{
// this area does not support tabbing so we need to make sure now "unexpected" browsers are added.
if (browserModel instanceof DefaultLiveEditBrowserModel)
{
return super.addVisibleBrowser(index, browserModel);
}
else
{
LOG.warn("Not showing browser " + browserModel + ". Reason: Only " + DefaultLiveEditBrowserModel.class.getCanonicalName() + " allowed.");
return false;
}
}
@Override
public BrowserModelListener getBrowserListener()
{
return null;
}
@Override
public void saveQuery(final BrowserModel browserModel)
{
// Isn't intended to be use here.
}
@Override
public void refreshContent(final CMSSiteModel siteModel)
{
this.currentSite = siteModel;
if (getFocusedBrowser() instanceof DefaultLiveEditBrowserModel)
{
((DefaultLiveEditBrowserModel) getFocusedBrowser()).setCurrentSite(siteModel);
((DefaultLiveEditBrowserModel) getFocusedBrowser()).updateItems();
}
else
{
LOG.warn(UNABLE_TO_LOAD_LIVE_EDIT_BROWSER_MODEL_MSG);
}
}
@Override
public void refreshContent()
{
if (getFocusedBrowser() instanceof DefaultLiveEditBrowserModel)
{
((DefaultLiveEditBrowserModel) getFocusedBrowser()).refresh();
}
else
{
LOG.warn(UNABLE_TO_LOAD_LIVE_EDIT_BROWSER_MODEL_MSG);
}
}
/**
* Called whenever user changes a browser area mode in <b> Live Edit Perspective </b>
*/
@Override
public void fireModeChange()
{
if (getFocusedBrowser() instanceof DefaultLiveEditBrowserModel)
{
final DefaultLiveEditBrowserModel model = (DefaultLiveEditBrowserModel) getFocusedBrowser();
if (isLiveEditModeEnabled())
{
setLiveEditModeEnabled(false);
}
else
{
setLiveEditModeEnabled(true);
}
//
model.fireModeChange(getCorrespondingContentBrowser(getFocusedBrowser()));
}
else
{
LOG.warn(UNABLE_TO_LOAD_LIVE_EDIT_BROWSER_MODEL_MSG);
}
}
@Override
public void fireModeChange(final boolean liveEditMode)
{
if (getFocusedBrowser() instanceof DefaultLiveEditBrowserModel)
{
final DefaultLiveEditBrowserModel model = (DefaultLiveEditBrowserModel) getFocusedBrowser();
setLiveEditModeEnabled(liveEditMode);
model.fireModeChange(getCorrespondingContentBrowser(getFocusedBrowser()));
}
else
{
LOG.warn(UNABLE_TO_LOAD_LIVE_EDIT_BROWSER_MODEL_MSG);
}
}
@Override
public boolean isLiveEditModeEnabled()
{
return liveEditModeEnabled;
}
@Override
public void setLiveEditModeEnabled(final boolean liveEditModeEnabled)
{
this.liveEditModeEnabled = liveEditModeEnabled;
}
public CMSSiteModel getCurrentSite()
{
return currentSite;
}
@Override
public AdvancedBrowserModel getWelcomeBrowserModel()
{
return this.welcomeBrowserModel;
}
@Override
public void setWelcomeBrowserModel(final AdvancedBrowserModel welcomeBrowserModel)
{
this.welcomeBrowserModel = welcomeBrowserModel;
}
@Override
public boolean isClosable(final BrowserModel browserModel)
{
boolean closable = super.isClosable(browserModel);
if (browserModel instanceof DefaultLiveEditBrowserModel)
{
closable = false;
}
return closable;
}
@Override
public void onCockpitEvent(final CockpitEvent event)
{
super.onCockpitEvent(event);
if (event instanceof CmsLiveEditEvent)
{
processCmsLiveEditEvent((CmsLiveEditEvent) event);
}
else if (event instanceof ItemChangedEvent)
{
processItemChangedEvent((ItemChangedEvent) event);
}
else if (event instanceof CmsUrlChangeEvent)
{
processCmsUrlChangeEvent(event);
}
else if (event instanceof CmsPerspectiveInitEvent)
{
processCmsPerspectiveInitEvent(event);
}
else
{
processGenericEvent();
}
}
protected void processGenericEvent() {
final BrowserModel focusedBrowserModel = getFocusedBrowser();
if (focusedBrowserModel instanceof DefaultLiveEditBrowserModel)
{
final DefaultLiveEditBrowserModel liveBrowserModel = (DefaultLiveEditBrowserModel) focusedBrowserModel;
liveBrowserModel.setRelatedPagePk(null);
}
}
protected void processCmsPerspectiveInitEvent(final CockpitEvent event) {
if (event.getSource() == null || !event.getSource().equals(getPerspective()))
{
return;
}
final BrowserModel focusedBrowserModel = getFocusedBrowser();
if (focusedBrowserModel instanceof DefaultLiveEditBrowserModel)
{
final DefaultLiveEditBrowserModel liveBrowserModel = (DefaultLiveEditBrowserModel) focusedBrowserModel;
liveBrowserModel.onCmsPerpsectiveInitEvent();
}
}
protected void processCmsUrlChangeEvent(final CockpitEvent event) {
//exit when comes from another perspective!
if (!event.getSource().equals(getPerspective()))
{
return;
}
final AbstractContentBrowser abstractContentBrowser = getCorrespondingContentBrowser(getFocusedBrowser());
if (abstractContentBrowser != null)
{
final DefaultLiveEditContentBrowser liveEditContentBrowser = (DefaultLiveEditContentBrowser) abstractContentBrowser;
liveEditContentBrowser.updateAfterChangedUrl((CmsUrlChangeEvent) event);
}
}
protected void processItemChangedEvent(final ItemChangedEvent event) {
final AbstractContentBrowser abstractContentBrowser = getCorrespondingContentBrowser(getFocusedBrowser());
if (abstractContentBrowser != null)
{ //update changed item
abstractContentBrowser.updateItem(event.getItem(), Collections.emptySet());
}
}
protected void processCmsLiveEditEvent(final CmsLiveEditEvent event) {
if (!event.getUrl().isEmpty())
{
if (getFocusedBrowser() instanceof DefaultLiveEditBrowserModel)
{
((DefaultLiveEditBrowserModel) getFocusedBrowser()).setCurrentUrl(event.getUrl());
}
refreshContent(this.getCurrentSite());
}
}
@Required
public void setCommonI18NService(final CommonI18NService commonI18NService)
{
this.commonI18NService = commonI18NService;
}
public CommonI18NService getCommonI18NService()
{
return commonI18NService;
}
protected class LiveEditBrowserAreaUISessionListener implements UISessionListener
{
@Override
public void perspectiveChanged(final UICockpitPerspective previous, final UICockpitPerspective newOne)
{
// NOOP
}
@Override
public void globalDataLanguageChanged()
{
for (final BrowserModel browserModel : DefaultLiveEditBrowserArea.this.getBrowsers())
{
if (browserModel instanceof DefaultLiveEditBrowserModel)
{
final PreviewDataModel previewData = ((DefaultLiveEditBrowserModel) browserModel).getPreviewData();
if (previewData != null)
{
previewData.setLanguage(getCommonI18NService().getLanguage(UISessionUtils.getCurrentSession().getGlobalDataLanguageIso()));
((DefaultLiveEditBrowserModel) browserModel).setPreviewData(previewData);
((DefaultLiveEditBrowserModel) browserModel).clearPreviewPageIfAny();
}
}
}
}
@Override
public void beforeLogout(final UserModel user)
{
// NOOP
}
@Override
public void afterLogin(final UserModel user)
{
// NOOP
}
}
}
| [
"ojas.modi@nagarro.com"
] | ojas.modi@nagarro.com |
de38d960422c4bb3751e29008a19ab81dc90f158 | f0c864f22930d751c32fe2248c4d1753985ef510 | /server_java/src/main/java/fr/ippon/pamelaChu/domain/status/StatusType.java | f90e967618ce66ef26f073cd647a26846169f5d3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | BulkSecurityGeneratorProject/PamelaChuNetwork | ce319e7ad1128bb977cbf7332a676e37ee414aa7 | ad3c0e07b30d253541f417eee0bbe1ca2244b269 | refs/heads/master | 2022-12-15T21:50:43.271259 | 2015-04-17T18:37:55 | 2015-04-17T18:37:55 | 296,613,714 | 0 | 0 | null | 2020-09-18T12:22:43 | 2020-09-18T12:22:42 | null | UTF-8 | Java | false | false | 149 | java | package fr.ippon.pamelaChu.domain.status;
public enum StatusType {
STATUS,
SHARE,
ANNOUNCEMENT,
MENTION_FRIEND,
MENTION_SHARE
}
| [
"fabrice.trebuchon@epitech.eu"
] | fabrice.trebuchon@epitech.eu |
052684c235f55281c0f8368ae1e4473ca5a8c529 | 6603c4b97de82eeb62d819ae3d142c3273f6380e | /src/main/java/com/howtodoinjava/lambdacalculo/TypedL.java | af16b672518161aa790d4b495cac89294a2b0b70 | [
"MIT"
] | permissive | JeanPaulYazbek/TestCiCd | b3d4e1c9d6c4b0e3a99a1c4b0808d186abaee0b7 | 405828626f2192f4dafe06a55dc42e36133b5b13 | refs/heads/master | 2022-12-23T02:48:20.733698 | 2020-10-06T02:42:48 | 2020-10-06T02:42:48 | 296,377,660 | 0 | 0 | MIT | 2020-10-05T05:45:32 | 2020-09-17T16:09:00 | JavaScript | UTF-8 | Java | false | false | 517 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.howtodoinjava.lambdacalculo;
/**
*
* @author federico
*/
public class TypedL extends Const implements TypedTerm{
private final Bracket lambda_;
public TypedL(Bracket lambda)
{
super("L");
lambda_ = lambda;
}
public Term type()
{
return lambda_;
}
}
| [
"jeanpaulyf98@hotmail.com"
] | jeanpaulyf98@hotmail.com |
5bc4f3a16dcd5cffc89e6e37b5b8d4b7a4d468ca | dcbdd2e9fe61605551d301e20d40e637d08a239c | /ksc-sdk-java-core/src/main/java/com/ksc/partitions/model/Service.java | b24345ba01c9289576042ce5fd043435b2c25168 | [] | no_license | KscSDK/ksc-sdk-java | 557e2fdc5edff42350ac9f281e67056fef62f3e5 | e3acf4c97e7efe4af8e227bdf307e24814898802 | refs/heads/master | 2023-07-20T20:05:55.228476 | 2023-07-19T03:36:59 | 2023-07-19T03:36:59 | 67,019,969 | 49 | 75 | null | 2023-03-13T08:03:07 | 2016-08-31T08:45:15 | Java | UTF-8 | Java | false | false | 3,100 | java | /*
* Copyright 2016-2016 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://ksyun.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.ksc.partitions.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ksc.util.ValidationUtils;
import java.util.Map;
/**
* Endpoint configuration for a service in a partition.
*/
public class Service {
/**
* endpoint configuration for every region in a partition.
*/
private final Map<String, Endpoint> endpoints;
/**
* default endpoint configuration for a service across all regions in the
* partition
*/
private Endpoint defaults;
/**
* the region name if the service is enabled partition wide.
*/
private String partitionEndpoint;
/**
* Returns true if the service is regionalized.
*/
private boolean isRegionalized;
public Service(@JsonProperty(value = "endpoints") Map<String,
Endpoint> endpoints) {
this.endpoints = ValidationUtils.assertNotNull(endpoints, "endpoints");;
}
/**
* Returns the endpoints configuration for all regions in a partition
* that service supports.
*/
public Map<String, Endpoint> getEndpoints() {
return endpoints;
}
/**
* returns the default endpoints configuration for all regions in a
* partition.
*/
public Endpoint getDefaults() {
return defaults;
}
/**
* Sets the default endpoints configuration for all regions in a
* partition.
*/
public void setDefaults(Endpoint defaults) {
this.defaults = defaults;
}
/**
* returns the region name if the service is enabled partition wide.
*/
public String getPartitionEndpoint() {
return partitionEndpoint;
}
/**
* sets the region name if the service is enabled partition wide.
*/
@JsonProperty(value = "partitionEndpoint")
public void setPartitionEndpoint(String partitionEndpoint) {
this.partitionEndpoint = partitionEndpoint;
}
/**
* returns true if the service is regionalized.
*/
public boolean isRegionalized() {
return isRegionalized;
}
/**
* sets the regionalized property for a service..
*/
@JsonProperty(value = "isRegionalized")
public void setRegionalized(boolean regionalized) {
isRegionalized = regionalized;
}
/**
* A convienient method that returns true if a service has a partition
* wide endpoint available.
*/
public boolean isPartitionWideEndpointAvailable() {
return this.partitionEndpoint != null;
}
}
| [
"hezhijun@kingsoft.com"
] | hezhijun@kingsoft.com |
6009584c5662c86c8ff680e2437683b4b52fb01d | c74ef61b75e9344dc36f24a15084b9d0063c6796 | /app/src/main/java/com/gohachi/tugcairv02/Authentication/RegisterActivity.java | a4884f6e22ad238f9103411a729f828ffdd93e2f | [] | no_license | gohachibatam/TUGCair | 201a713e46264abe5835945365d017df4e151768 | 4b4692334215c56623dbdc8c00bc48a7bd77f549 | refs/heads/master | 2020-10-01T09:19:47.667417 | 2019-12-13T04:03:50 | 2019-12-13T04:03:50 | 227,507,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,174 | java | package com.gohachi.tugcairv02.Authentication;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.gohachi.tugcairv02.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class RegisterActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
private FirebaseFirestore mDatabase;
private EditText mEmail, mFullname, mPassword, mPasswordConfirm, mContactPhone;
private Button mDaftar;
private static final String TAG = "RegisterActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); //will hide the title
getSupportActionBar().hide(); // hide the title bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //enable full screen
setContentView(R.layout.activity_register);
FirebaseInit();
FirestoreInit();
mEmail = findViewById(R.id.assistant_email);
mFullname = findViewById(R.id.assistant_full_name);
mPassword = findViewById(R.id.assistant_password);
mPasswordConfirm = findViewById(R.id.assistant_password_confirm);
mDaftar = findViewById(R.id.assistant_signin);
mContactPhone = findViewById(R.id.assistant_contact_person);
mDaftar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String emailuser, passworduser, passwordconfirmuser;
emailuser = mEmail.getText().toString().trim();
passworduser = mPassword.getText().toString();
passwordconfirmuser = mPasswordConfirm.getText().toString();
if (emailuser.isEmpty() || passworduser.isEmpty() || passwordconfirmuser.isEmpty()){
Toast.makeText(RegisterActivity.this, "Form cannot be empty!", Toast.LENGTH_SHORT).show();
}else if(!passworduser.equals(passwordconfirmuser)){
Toast.makeText(RegisterActivity.this, "Password is not match!", Toast.LENGTH_SHORT).show();
}else if(passworduser.length() < 6){
Toast.makeText(RegisterActivity.this, "Password must be at least 6 character!", Toast.LENGTH_SHORT).show();
}else if(!(emailuser.isEmpty() && passworduser.isEmpty()) && passworduser.length() >= 6){
// Toast.makeText(RegisterActivity.this, "Success create account!", Toast.LENGTH_SHORT).show();
mAuth.createUserWithEmailAndPassword(emailuser, passwordconfirmuser)
.addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "createUserWithEmail:success");
FirebaseUser user = mAuth.getCurrentUser();
user.sendEmailVerification();
Toast.makeText(RegisterActivity.this, "A verification has been sent to your email!", Toast.LENGTH_SHORT).show();
addAccountToFirebase(user.getEmail());
redirectPage(RegisterActivity.this, LoginActivity.class);
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "createUserWithEmail:failure", task.getException());
Toast.makeText(RegisterActivity.this, "Registration failed.",
Toast.LENGTH_SHORT).show();
} // ...
}
});
}
}
});
}
private void FirebaseInit() {
mAuth = FirebaseAuth.getInstance();
}
private void FirestoreInit(){
mDatabase = FirebaseFirestore.getInstance();
}
private void redirectPage(Activity activity, Class goTo) {
Intent intent = new Intent(activity, goTo);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
finish();
startActivity(intent);
}
private void addAccountToFirebase(String emailuser){
String email, password, full_name, no_phone, role;
email = emailuser;
password = mPassword.getText().toString();
full_name = mFullname.getText().toString();
no_phone = mContactPhone.getText().toString();
role = "user";
Date timenow = Calendar.getInstance().getTime();
Map<String, Object> user = new HashMap<>();
user.put("email", email);
user.put("full_name", full_name);
user.put("key_pass", password);
user.put("no_phone", no_phone);
user.put("role", role);
user.put("created_at", timenow);
user.put("updated_at", null);
// Add a new document with a generated ID
mDatabase.collection("account")
.add(user)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Log.d(TAG, "DocumentSnapshot added with ID: " + documentReference.getId());//
Toast.makeText(RegisterActivity.this, "Data berhasil ditambahkan!", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Error adding document", e);
Toast.makeText(RegisterActivity.this, "Error! : "+e, Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"beemons123@gmail.com"
] | beemons123@gmail.com |
1fe8a4360fe6b19634ea65c5f4147310415cf812 | 0eeb14fc7dfe7993247414b4334e1655e9cf8d48 | /Important8/src/VisitCollection/VisitMap.java | 92fa030450b2e561540ed91f4c7bc47e4e3d2bff | [] | no_license | niujin/CoreJavaDemo | 031903a65b39dd1a693e9f0a82cf8a3fde77331f | a1dce9f1e862c9abee65b11679ddc6c59fb7af06 | refs/heads/master | 2022-12-30T21:36:13.273693 | 2020-07-26T19:29:59 | 2020-07-26T19:29:59 | 282,475,275 | 0 | 0 | null | 2020-10-13T23:55:23 | 2020-07-25T15:50:23 | JavaScript | UTF-8 | Java | false | false | 884 | java | package VisitCollection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class VisitMap {
public static void visitmap(){
Map<Integer, String> m = new HashMap<Integer, String>();
m.put(1, "a");
m.put(2, "b");
m.put(3, "c");
Set <Integer> keySets = m.keySet();
for(Integer key:keySets){
System.out.println(key+m.get(key));
}
Iterator<Integer> it = keySets.iterator();
while(it.hasNext()){
Integer k = it.next();
System.out.println(k+m.get(k));
}
Set<Map.Entry<Integer,String>> entries =m.entrySet();
for(Map.Entry<Integer, String> e: entries){
System.out.println(e.getKey()+e.getValue());
}
Iterator<Map.Entry<Integer, String>> itr = entries.iterator();
while(itr.hasNext()){
Map.Entry<Integer, String> en = itr.next();
System.out.println(en.getKey()+en.getValue());
}
}
}
| [
"jinniu87@gmail.com"
] | jinniu87@gmail.com |
e9578cb477c26be5edc17001972fddbe691acfa8 | 9914e70d2bd0db0b0c4f48b993343dfb175d6d58 | /goat-backend/goat-service/src/main/java/com/usc/csci401/goatservice/service/impl/SeedServiceImpl.java | 179217b8267f6bff33011058f67170c75c12529e | [] | no_license | vividoperation/goat | 2842a4621d5742184546baff77754d81ee66d752 | 296c2cc56c76b447f1933142e795a57c0fea80ca | refs/heads/main | 2023-01-19T19:04:57.683345 | 2020-11-20T13:28:00 | 2020-11-20T13:28:00 | 314,561,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,867 | java | package com.usc.csci401.goatservice.service.impl;
import com.google.common.base.Preconditions;
import com.usc.csci401.goatcommon.exception.TournamentException;
import com.usc.csci401.goatdao.SeedingRepository;
import com.usc.csci401.goatdao.model.Seeding;
import com.usc.csci401.goatservice.service.SeedingService;
import java.util.Optional;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class SeedServiceImpl implements SeedingService{
@Autowired
private SeedingRepository seedingRepository;
@Override
public Integer createSeeding(Integer tournamentId, String username, Integer maxPlayer){
Preconditions.checkArgument(tournamentId != null, "tournament id cannot be null");
Preconditions.checkArgument(StringUtils.isNotBlank(username), "username cannot be blank");
Seeding seeding = new Seeding();
seeding.setTournamentid(tournamentId);
seeding.setUsername(username);
seeding.setRound(1);
Integer maxSeed = seedingRepository.getMaxSeeding(tournamentId);
if(maxSeed == null || maxSeed > maxPlayer) {
maxSeed = 1;
}
else{
maxSeed++;
}
seeding.setSeed(maxSeed);
if(maxPlayer == 4 || maxPlayer == 8){
seeding.setRound(1);
}
if(maxPlayer == 5){
if(maxSeed == 1 || maxSeed == 2 || maxSeed == 3) {
seeding.setRound(2);
}
else{
seeding.setRound(1);
}
}
else if(maxPlayer == 6){
if(maxSeed == 1 || maxSeed == 2){
seeding.setRound(2);
}
else{
seeding.setRound(1);
}
}
else if(maxPlayer == 7){
if(maxSeed == 1){
seeding.setRound(2);
}
else{
seeding.setRound(1);
}
}
return seedingRepository.save(seeding).getSeedingid();
}
@Override
public List<Seeding> getByUsername(String username) {
return seedingRepository.getByUsername(username);
}
@Override
public Seeding getSeed(Integer tournamentId, String username){
Optional<Seeding> seed = seedingRepository.getByTournamentidAndUsername(tournamentId, username);
if(!seed.isPresent()){
throw new TournamentException("Seeding does not exist");
}
return seed.get();
}
@Override
public void updateRound(Seeding seeding){
Preconditions.checkArgument(seeding != null, "Seeding cannot be null");
seedingRepository.save(seeding);
}
@Override
public String getUsername(Integer tournamentId, Integer seeding){
Preconditions.checkArgument(tournamentId != null, "tournamentId cannot be null");
Optional<Seeding> seeds = seedingRepository.getByTournamentidAndSeed(tournamentId, seeding);
if(!seeds.isPresent()){
return null;
}
return seeds.get().getUsername();
}
}
| [
"zhumingh@usc.edu"
] | zhumingh@usc.edu |
c410b10ee465ca3c66e9fbcee4c8f11e6a76e404 | 4f8fb319b7ac98de7ee3af857b255a8f6b34ae70 | /NutriSoft1/src/Ventanas/Nutrientes.java | ec86083592efbadbd069d5d5af58817f897fc1a2 | [] | no_license | ALEJANDRAPONCE2116/Nutrisoft | a84c08aa2a6ceaea49422ff85d2287dfcef65cb6 | 853f368b972eb720a0b0f6a650895b9aac0cd361 | refs/heads/master | 2020-11-24T03:59:52.061453 | 2019-12-14T02:41:07 | 2019-12-14T02:41:07 | 227,955,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,320 | java | package Ventanas;
public class Nutrientes extends Lista {
public float carbohidratos;
public float proteina;
public float fibra;
public float calcio;
public float hierro;
public float magnesio;
public float sodio;
public float potasio;
public float vb1;
public float vb2;
public float vb12;
public float vbc;
public void Fresas(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Naranja(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Platano(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Melon(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Manzana(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Papaya(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Pera(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Piña(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Guayaba(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Moras(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Durazno(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Mango(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Elote(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Chile(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Tomate(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Cebolla(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Brocoli(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Aguacate(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Papa(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Calabaza(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Zanahoria(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Apio(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Lechuga(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Champiñones(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Res(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Salmon(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Atun(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Puerco(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Cerdo(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Pollo(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Pescado(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Mariscos(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Pasta(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Pan(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Quinoa(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Arroz(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Trigo(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Maiz(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Frijoles(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Soya(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Alubias(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Lentejas(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Habas(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Ejotes(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Garbanzos(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Cacahuates(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Leche(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Huevo(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Miel(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Queso(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Yogurt(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Palomitas(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Chocolate(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Galletas(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void PastaTomate(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void ChocolatePro(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public void Mermelada(float carbohidratos, float vb12, float proteina, float fibra, float calcio, float hierro, float magnesio, float sodio, float potasio, float vb1, float vb2, float vbc) {
}
public float getCarbohidratos() {
return carbohidratos;
}
public void setCarbohidratos(float carbohidratos) {
this.carbohidratos = carbohidratos;
}
public float getProteina() {
return proteina;
}
public void setProteina(float proteina) {
this.proteina = proteina;
}
public float getFibra() {
return fibra;
}
public void setFibra(float fibra) {
this.fibra = fibra;
}
public float getCalcio() {
return calcio;
}
public void setCalcio(float calcio) {
this.calcio = calcio;
}
public float getHierro() {
return hierro;
}
public void setHierro(float hierro) {
this.hierro = hierro;
}
public float getMagnesio() {
return magnesio;
}
public void setMagnesio(float magnesio) {
this.magnesio = magnesio;
}
public float getSodio() {
return sodio;
}
public void setSodio(float sodio) {
this.sodio = sodio;
}
public float getPotasio() {
return potasio;
}
public void setPotasio(float potasio) {
this.potasio = potasio;
}
public float getVb1() {
return vb1;
}
public void setVb1(float vb1) {
this.vb1 = vb1;
}
public float getVb2() {
return vb2;
}
public void setVb2(float vb2) {
this.vb2 = vb2;
}
public float getVbc() {
return vbc;
}
public void setVbc(float vb3) {
this.vbc = vbc;
}
public float getVb12() {
return vb12;
}
public void setVb12(float vb12) {
this.vb12 = vb12;
}
/*public void Elote(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Chile(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Tomate(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Cebolla(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Brocoli(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Aguacate(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Papa(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Calabaza(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Zanahoria(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Apio(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Lechuga(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Champiñones(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Res(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Salmon(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Atun(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Puerco(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Cerdo(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Pollo(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Pescado(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Mariscos(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Pasta(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Pan(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Quinoa(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Arroz(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Trigo(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Maiz(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Frijoles(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Soya(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Alubias(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Lentejas(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Habas(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Ejotes(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Garbanzos(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Cacahuates(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Leche(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Huevo(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Miel(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Queso(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Yogurt(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Palomitas(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Chocolate(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void Galletas(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void PastaTomate(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void ChocolatePro(float carbohidratos,float vb12,float proteina,float fibra,float calcio,float hierro,float magnesio,float sodio,float potasio,float vb1,float vb2,float vbc){
}
public void mermeladaCarb(float carbohidratos){
}*/
void setSiguiente(NodoAlimento inicio) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"41318673+ALEJANDRAPONCE2116@users.noreply.github.com"
] | 41318673+ALEJANDRAPONCE2116@users.noreply.github.com |
89b3fe03f88f3ad98beb6d9a1dee869fcd447f34 | a4ee06bd408862827bd0dcbb905a213b45bf593b | /JAVA/PM/MediathekVorlage_Blatt02u03/src/de/hawhh/informatik/sml/mediathek/service/einleser/DateiLeseException.java | af1093361c3c7dcaaa11157c64eee7e154a1db4d | [] | no_license | davekessener/VirtualMachine | 1a6b3af761e2763eebd1d61010fda517f51167d5 | 61679dd47f17246cad8261781000cf4aca5bfe14 | refs/heads/master | 2021-01-17T14:53:55.771007 | 2016-05-29T13:15:33 | 2016-05-29T13:15:33 | 14,454,172 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package de.hawhh.informatik.sml.mediathek.service.einleser;
import java.io.IOException;
/**
* Eine DateiLeseException signalisiert, dass das Lesen aus einer Datei nicht
* geklappt hat.
*
* @author SE2-Team, PR2-Team
* @version WiSe 2014
*/
public class DateiLeseException extends IOException
{
private static final long serialVersionUID = 1L;
/**
* Initialisiert eine neue DateiLeseException mit der übergebenen
* Fehlermeldung.
*
* @param message Eine beschreibung des Fehlers.
*
*/
public DateiLeseException(String message)
{
super(message);
}
}
| [
"davekessener@gmail.com"
] | davekessener@gmail.com |
01a994a92b0f3f712d59d79acdf20bf1caf52565 | 4f850dbb029199b7b05c6ee81685c85e1efc8b3b | /src/main/java/com/example/demo/DTOs/Ticket.java | 9b47f0ba8cf0d9c8fd5f38644cdc3979b3357bb4 | [] | no_license | Ruta9/Creo | 4972f73cb3fa383d2d964b308c6e6d66111fc28b | c65e1ef646929258545d0478f0b854881e559a05 | refs/heads/master | 2022-12-22T04:38:39.117071 | 2020-10-06T10:03:23 | 2020-10-06T10:03:23 | 289,033,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.example.demo.DTOs;
import java.util.Date;
public interface Ticket {
Long getId();
String getName();
String getShortenedDescription();
String getAssignee();
String getCreator();
String getStatus();
String getCreatedDate();
String getLastUpdatedDate();
Date getLastUpdatedDate_date();
Date getCreatedDate_date();
}
| [
"rutule9@gmail.com"
] | rutule9@gmail.com |
ce0f57a99af4b34e77f347feddae6128c1af34a0 | 4007fe329c59424507453d0c5d919fc1f6b0ceed | /src/gr/infocode/schemagraph/exporter/db/DBUtil.java | 14ddc40c5a35e26023f8349bb82329c2db808005 | [
"BSD-2-Clause"
] | permissive | gzoug/SchemaGraph | e3c53263e8e96889f308f4c68cf8fb2733199d01 | 812d6065e411e4c107aed0a7bff28245374bde73 | refs/heads/master | 2021-01-20T12:04:58.044823 | 2013-04-17T18:25:36 | 2013-04-17T18:25:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,074 | java | /*
Project: SchemaGraph
Copyright (c) 2007-2013, George Zouganelis (george.zouganelis@gmail.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of George Zouganelis nor the names of contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE GEORGE ZOUGANELIS 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 GEORGE ZOUGANELIS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package gr.infocode.schemagraph.exporter.db;
import java.sql.*;
import java.lang.Error;
import org.w3c.dom.*;
import gr.infocode.schemagraph.util.Logger;
import gr.infocode.schemagraph.util.StringUtil;
import gr.infocode.schemagraph.util.XMLUtil;
import gr.infocode.schemagraph.exporter.config.DBConfig;
import gr.infocode.schemagraph.exporter.config.DBConfigEnum;
import gr.infocode.schemagraph.exporter.config.ExporterOptionsEnum;
public class DBUtil {
private DBConnection con = null;
private static Logger log = Logger.getInstance();
public DBUtil(String ConnectionID) {
con = DBConfig.getInstance().getDBConnection(ConnectionID);
if ((con==null) || (!con.Connect())) {
log.exit("Couldn't connect to database " + ConnectionID);
}
}
// the main method that collects schema information
private void getMetadataDomFragment(Document doc, Node parentNode,
DatabaseMetaData meta, String catalogPattern, String schemaPattern, String objectname, String elementname,
DBObjectsEnum dbObject) {
ResultSetMetaData rsmeta = null;
ResultSet rs = null;
String objname;
String escapeString;
try {
escapeString = meta.getSearchStringEscape();
} catch (Exception e) {
escapeString = "";
}
if (con.getConfigValue(DBConfigEnum.ESCAPENAMES).equalsIgnoreCase("yes")) {
objname = objectname.replaceAll("_", StringUtil.repString(escapeString, 4) + "_");
} else {
objname = objectname;
}
try {
switch (dbObject) {
case TABLES: // unused here
log.info(" Retreiving views , user tables and system tables...");
rs = meta.getTables(catalogPattern, schemaPattern, objectname, null);
break;
case TABLE_COLUMNS:
log.info(" Retreiving table columns for " + objectname);
rs = meta.getColumns(catalogPattern, schemaPattern, objname, null);
break;
case PROCEDURE_COLUMNS:
log.info(" Retreiving procedure columns for " + objectname);
rs = meta.getProcedureColumns(catalogPattern, schemaPattern, objname, null);
break;
case FUNCTION_COLUMNS:
log.info(" Retreiving function columns for " + objectname);
rs = meta.getFunctionColumns(catalogPattern, schemaPattern, objname, null);
break;
case FOREIGN_KEYS:
log.info(" Retreiving foreign keys for " + objectname);
rs = meta.getImportedKeys(catalogPattern, schemaPattern, objname);
break;
case PRIMARY_KEYS:
log.info(" Retreiving primary keys for " + objectname);
rs = meta.getPrimaryKeys(catalogPattern, schemaPattern, objname);
break;
case INDEXES:
log.info(" Retreiving indexes for " + objectname);
rs = meta.getIndexInfo(catalogPattern, schemaPattern, objname, false, false);
break;
}
rsmeta = rs.getMetaData();
while (rs.next()) {
Node fragNode = doc.createElement(elementname);
NamedNodeMap nm = fragNode.getAttributes();
for (int i = 0; i < rsmeta.getColumnCount(); i++) {
String colName = rsmeta.getColumnName(i + 1).toLowerCase();
if (colName.compareTo("remarks") != 0) {
Attr attr = doc.createAttribute(colName);
String nv = "";
try {
nv = rs.getString(i + 1);
} catch (Exception e) {
log.error("Could not get column data : column [total count, index, name]=[" +
rsmeta.getColumnCount() + "," +
(i+1) + "," +
colName +
"]");
}
attr.setNodeValue(nv);
nm.setNamedItem(attr);
}
}
parentNode.appendChild(fragNode);
}
} catch (Exception e) {
log.error(e.getMessage());
System.err.println(e.getMessage());
e.printStackTrace();
}
}
private Node getObjectNode(Document doc, ResultSetMetaData rsMetadata,
ResultSet rsObject, String ElementName) {
Node objectNode = null;
try {
objectNode = doc.createElement(ElementName);
NamedNodeMap tnm = objectNode.getAttributes();
for (int ti = 0; ti < rsMetadata.getColumnCount(); ti++) {
String colName = rsMetadata.getColumnName(ti + 1).toLowerCase();
// stip out comments
if (colName.compareTo("remarks") != 0) {
Attr attr = doc.createAttribute(colName);
attr.setNodeValue(rsObject.getString(ti + 1));
tnm.setNamedItem(attr);
}
}
} catch (Exception e) {
}
return objectNode;
}
public Document getMetadataAsDOM() {
DatabaseMetaData dbMetadata = null;
ResultSetMetaData rsMetadata = null;
ResultSet rsObject = null;
Node objectNode = null;
String objectname = "";
String catalogPattern = null;
if (ExporterOptionsEnum.OPT_CATALOG.getOption().isDefined()) {
catalogPattern = ExporterOptionsEnum.OPT_CATALOG.getOption().getValue(0);
log.info("Using catalog pattern [" + catalogPattern + "]");
}
String schemaPattern = null;
if (ExporterOptionsEnum.OPT_SCHEMA.getOption().isDefined()) {
schemaPattern = ExporterOptionsEnum.OPT_SCHEMA.getOption().getValue(0);
log.info("Using schema pattern [" + schemaPattern + "]");
}
Document doc = XMLUtil.newDocument();
Node root = doc.createElement("xmldbschema");
doc.appendChild(root);
try {
dbMetadata = con.getConnection().getMetaData();
// Get VIEWS/TABLES/SYSTEM_TABLES
if (!ExporterOptionsEnum.OPT_NOTABLES.getOption().isDefined()) {
try {
log.info("Retreiving views , user tables and system tables...");
rsObject = dbMetadata.getTables(catalogPattern, schemaPattern, null, null);
rsMetadata = rsObject.getMetaData();
while (rsObject.next()) {
objectname = rsObject.getString("TABLE_NAME");
log.info("Retreiving metadata for table: " + objectname);
objectNode = getObjectNode(doc, rsMetadata, rsObject, "table");
getMetadataDomFragment(doc, objectNode, dbMetadata, catalogPattern, schemaPattern, objectname, "column", DBObjectsEnum.TABLE_COLUMNS);
getMetadataDomFragment(doc, objectNode, dbMetadata, catalogPattern, schemaPattern, objectname, "pkey", DBObjectsEnum.PRIMARY_KEYS);
getMetadataDomFragment(doc, objectNode, dbMetadata, catalogPattern, schemaPattern, objectname, "fkey", DBObjectsEnum.FOREIGN_KEYS);
getMetadataDomFragment(doc, objectNode, dbMetadata, catalogPattern, schemaPattern, objectname, "index", DBObjectsEnum.INDEXES);
root.appendChild(objectNode);
}
} catch (Exception e) {
log.error(e.getMessage());
// e.printStackTrace();
} catch (Error e) {
log.error(e.getMessage());
}
}
if (!ExporterOptionsEnum.OPT_NOPROCS.getOption().isDefined()) {
// Get PROCEDURES
try {
log.info("Retreiving stored procedures...");
rsObject = dbMetadata.getProcedures(catalogPattern, schemaPattern, null);
rsMetadata = rsObject.getMetaData();
while (rsObject.next()) {
objectname = rsObject.getString("PROCEDURE_NAME");
objectNode = getObjectNode(doc, rsMetadata, rsObject, "procedure");
getMetadataDomFragment(doc, objectNode, dbMetadata, catalogPattern, schemaPattern, objectname, "column", DBObjectsEnum.PROCEDURE_COLUMNS);
root.appendChild(objectNode);
}
} catch (Exception e) {
log.error(e.getMessage());
} catch (Error e) {
log.error(e.getMessage());
}
}
// Get FUNCTIONS
if (!ExporterOptionsEnum.OPT_NOFUNCS.getOption().isDefined()) {
try {
log.info("Retreiving functions...");
rsObject = dbMetadata.getFunctions(catalogPattern, schemaPattern, null);
rsMetadata = rsObject.getMetaData();
while (rsObject.next()) {
objectname = rsObject.getString("FUNCTION_NAME");
objectNode = getObjectNode(doc, rsMetadata, rsObject, "function");
getMetadataDomFragment(doc, objectNode, dbMetadata, catalogPattern, schemaPattern, objectname, "column", DBObjectsEnum.FUNCTION_COLUMNS);
root.appendChild(objectNode);
}
} catch (Exception e) {
log.error(e.getMessage());
log.exception(e);
} catch (Error e) {
log.error(e.getMessage());
log.exception(e);
}
}
if (!ExporterOptionsEnum.OPT_NOUDFS.getOption().isDefined()) {
// Get UDTs
try {
log.info("Retreiving UDTs...");
rsObject = dbMetadata.getUDTs(catalogPattern, schemaPattern, null, null);
rsMetadata = rsObject.getMetaData();
while (rsObject.next()) {
objectname = rsObject.getString("TYPE_NAME");
objectNode = getObjectNode(doc, rsMetadata, rsObject, "function");
root.appendChild(objectNode);
}
} catch (Exception e) {
log.error(e.getMessage());
} catch (Error e) {
log.error(e.getMessage());
}
}
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
} catch (Error e) {
log.error(e.getMessage());
}
return doc;
}
}
| [
"george.zouganelis@gmail.com"
] | george.zouganelis@gmail.com |
245f24722297924da5d766560b2577dcf4cff3fb | 0cc9e1d959571d46f18ebd1d06fbb3b0d98c4efa | /ListInList.java | a6f8ddfa4b0d621ec16b96cb98384586618f9bd9 | [] | no_license | ZhengKuang/LeetCode | fe5874894123dd598d01899caaee15274c4ae391 | 0082b4f9a068d161c0f2c272202a8aa8f28eee73 | refs/heads/master | 2021-01-01T06:12:50.190256 | 2017-12-16T20:24:17 | 2017-12-16T20:24:17 | 97,380,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | import com.sun.tools.javac.util.List;
/**
* Created by zhengkuang on 9/28/17.
*/
public class ListInList {
public static List<String> tolist(List<Object> list){
for(int i=0;i<list.size();i++){
if(list.get(i) instanceof Integer){
}
if(list.get(i) instanceof List){
}
}
return null;
}
public static void main(String args[]){
}
}
| [
"zhengkuang2016@gmail.com"
] | zhengkuang2016@gmail.com |
dcfdca8908408ca74d746897a606c1ed2952d0e0 | 92e07ad531c44c7830d9b2bdac711c37d928b328 | /153/Solution.java | 604ef1a4cd5decc2eafd5132e942de42534069e2 | [] | no_license | bjwbjw123456/leetcode | 26ea172d654a884d83025997a7fd64be9cc458ac | b906d7a8101114ede89485b856c692fba9db0832 | refs/heads/master | 2021-01-19T03:10:08.593329 | 2016-01-26T17:58:19 | 2016-01-26T17:58:19 | 42,789,433 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | public class Solution {
private int helper(int[] nums, int start, int end) {
if (nums[start] < nums[end]) return nums[start];
if (start==end) return nums[start];
int middle = start + (end-start)/2;
if( (middle==0 && nums[middle]<nums[middle+1]) || (middle!=0 && nums[middle]<nums[middle-1]) ) return nums[middle];
if (nums[middle] >= nums[start]) return helper(nums,middle+1,end);
else return helper(nums,start,middle-1);
}
public int findMin(int[] nums) {
if (nums.length==1) return nums[0];
return helper(nums,0,nums.length-1);
}
} | [
"bjwbjw770@gmail.com"
] | bjwbjw770@gmail.com |
2f199018ab166420a2eadc50942dafb5fa0e924f | dfd63d15edb35067bafb07328bf22bb3383d1cc0 | /spring-cloud-demo-service-consumer/src/main/java/com/just1984/spring/cloud/demo/service/consumer/configuration/RestTemplateConfiguration.java | 0c86272dd83865070f55389ebca52c4beaae4aa6 | [] | no_license | ethan-zhang-github/spring-cloud-demo | 0fcadd9401bce07f6270e6cb4fe1183660903f2c | 7cf07c07350a48d23497d2d0e9d09ef7504c66a9 | refs/heads/master | 2022-07-01T18:36:32.651199 | 2019-10-16T02:27:03 | 2019-10-16T02:27:03 | 204,471,624 | 0 | 0 | null | 2022-06-17T02:27:22 | 2019-08-26T12:32:20 | Java | UTF-8 | Java | false | false | 673 | java | package com.just1984.spring.cloud.demo.service.consumer.configuration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* @description:
* @author: zhangyifan@wshifu.com
* @date: 2019-08-15 21:38
*/
@Configuration
public class RestTemplateConfiguration {
@Bean
@LoadBalanced
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.build();
}
}
| [
"yixiezi1994@gmail.com"
] | yixiezi1994@gmail.com |
76661f92386b5a7ac217d53fc8c5bd69059f9c88 | 3e6fb5eefb45b405f6298e4a661e240acf3f7281 | /khoSach/src/main/java/com/khosach/controller/web/ProductSaleController.java | 264fb8e574c022edc5c02964512e8145db8ad03c | [] | no_license | DinhVinhQA/Book-sales-manager-Spring-MVC | 8509e50ef684a7cd36b3dd4367f361066b6a4e49 | a3ae09cac78b9b9f251e072dc3876bf92ea902a7 | refs/heads/master | 2022-12-02T10:13:26.552122 | 2020-08-16T03:34:41 | 2020-08-16T03:34:41 | 287,866,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | /*
* @author VTA
* @date May 20, 2020
* @version 1.0
*/
package com.khosach.controller.web;
import org.springframework.stereotype.Controller;
@Controller(value = "productSaleControllerOfWeb")
public class ProductSaleController {
}
| [
"wanbiquocanh.hs@gmail.com"
] | wanbiquocanh.hs@gmail.com |
b8e23b69d8808abdb1154db44b2e97ef41f44e71 | bcef8a03771ca77c08df38ca1badc0ca3cfd2cff | /src/main/threadPool/ThreadFactory.java | f17302f1d8971746faa9f62beeb41dd14e21dd41 | [] | no_license | Evey-Su/random_learning | 7df24849a29d66deec275cd713df699746ed92f5 | 512a36d1b55bc5605c512b823024d96cd78d8d34 | refs/heads/master | 2020-04-11T17:47:15.819461 | 2018-12-16T07:42:47 | 2018-12-16T07:42:47 | 161,974,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package threadPool;
@FunctionalInterface
public interface ThreadFactory {
Thread createThread(Runnable runnable);
}
| [
"18233562662@163.com"
] | 18233562662@163.com |
0e9966cef2d7ca5e5ea35d2b3800bc81cbba1a9c | 5a5c207a0727cd2e9d17f28edd2bddfda23245e2 | /dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperTransporter.java | 8dbb6e3067ff5cd15f73f9cb596efc9aa683eaab | [] | no_license | biggerRice/dubbo-2.7.5 | e385ae982e4005f453eb9a6c443fbd32b08fab29 | 8723e6808ceab32488792269f4333423e4ac0c09 | refs/heads/master | 2020-12-15T10:10:01.819626 | 2020-04-14T02:40:19 | 2020-04-14T02:40:19 | 235,070,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,368 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.remoting.zookeeper.curator;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.remoting.zookeeper.ZookeeperClient;
import org.apache.dubbo.remoting.zookeeper.support.AbstractZookeeperTransporter;
/**
* 实现 ZookeeperTransporter 接口,CuratorZookeeper 工厂实现类
*/
public class CuratorZookeeperTransporter extends AbstractZookeeperTransporter {
@Override
public ZookeeperClient createZookeeperClient(URL url) {
// 创建 CuratorZookeeperClient
return new CuratorZookeeperClient(url);
}
}
| [
"lilongsheng@01zhuanche.com"
] | lilongsheng@01zhuanche.com |
8b2c8fc6c90627014337b62d5206f2cfb8b881ac | 275601ea88b1047c4eac523f377c7f6d5151c9c0 | /core/src/com/potatospy/managers/CollisionManager.java | 5cbbdb64b5da0bd60c623d7445e845d3a62457c3 | [] | no_license | authentical/KanaBucket | 6a04615a915553e0c508d150ee31f34087ea74e0 | a14d9ec9e4601ca458aca2a33f94b18a1cfb8ce4 | refs/heads/master | 2020-04-24T07:52:19.043642 | 2019-11-20T23:50:46 | 2019-11-20T23:50:46 | 171,811,822 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.potatospy.managers;
import com.potatospy.entities.Bucket;
import com.potatospy.entities.GameCharacter;
public class CollisionManager {
public static boolean isCollision(Bucket bucket, GameCharacter gameCharacter, int difficulty){
float bucketX = bucket.getBucketX();
float letterX = gameCharacter.getCharacterX();
if(bucketX > letterX){
if(bucketX - letterX < 70/difficulty){
return true;
}
} else if(bucketX < letterX){
if(letterX - bucketX < 70/difficulty){
return true;
}
} else{
return true;
}
return false;
}
}
| [
"cvspencer@gmail.com"
] | cvspencer@gmail.com |
05c859e9b0315111202534cfe35693601a60eac6 | 56e3cdb67525ac6829035fbd2bafbef20c2755cf | /src/Aula_05_Recursao/Ex_08_RestoDivisao.java | b0e2defc91989513bc2d2e85f0582738f323d107 | [] | no_license | douglascf12/ED_3NB_2s2020 | e2b13c6eac4543343f2c33f91761869951b2f979 | 8037d632dd6dbea0a69bb1be7c1359e71d09e6bd | refs/heads/master | 2023-01-07T01:18:11.664240 | 2020-11-11T01:39:20 | 2020-11-11T01:39:20 | 290,337,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package Aula_05_Recursao;
import static Aula_01_Vetores.Ex_04_Inverter.leInteiroPositivo;
/**
*
* @author douglascf12
*/
public class Ex_08_RestoDivisao {
public static void main(String[] args) {
int n1 = leInteiroPositivo();
int n2 = leInteiroPositivo();
System.out.println("O resto da divisão é: " + restoDivisao(n1, n2));
}
public static int restoDivisao(int n1, int n2) {
if(n1 < n2) {
return n1;
}
return restoDivisao(n1-n2, n2);
}
}
| [
"douglascf12@live.com"
] | douglascf12@live.com |
3206644c2e2e1d72f732003924c7b5595be93d6b | 17b6a44e7acfb5194fc52a9dc41a4a6278325958 | /spring-boot/springBoot/springboot-example1/src/main/java/com/syf/springboot/SpringbootExample1Application.java | 4d7c1ea08feb5eb34a15e3b50e2cde8f537d6bca | [] | no_license | shiyufeng0919/JavaProject | efbc3f0bb192b31c5e473f7ceb7b01b6b14a418b | 6e7e392f3df11c1f191bc7493ab8df9989637544 | refs/heads/master | 2020-05-09T13:21:42.563173 | 2019-05-03T07:33:32 | 2019-05-03T07:33:32 | 181,148,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package com.syf.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/*
* 注解@SpringBootApplication声明当前类为springboot的入口类
*
* 一个springboot项目内有且只能有一个@SpringBootApplication注解存在
* */
@SpringBootApplication
public class SpringbootExample1Application {
public static void main(String[] args) {
SpringApplication.run(SpringbootExample1Application.class, args);
}
}
| [
"shiyufeng@jd.com"
] | shiyufeng@jd.com |
754702d550d96f0cf05e9086afb82dae2c8a46d9 | 1ae6abc37d7844879916e8f612ba1d616bc0c3cb | /src/private/nc/bs/xcgl/latecheckout/CloseMonBO.java | f3bfa7800582f0ecb64afc80fe752d169d9d56f8 | [] | no_license | menglingrui/xcgl | 7a3b3f03f14b21fbd25334042f87fa570758a7ad | 525b4e38cf52bb75c83762a9c27862b4f86667e8 | refs/heads/master | 2020-06-05T20:10:09.263291 | 2014-09-11T11:00:34 | 2014-09-11T11:00:34 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,361 | java | package nc.bs.xcgl.latecheckout;
import java.util.ArrayList;
import java.util.List;
import nc.bs.trade.business.IBDBusiCheck;
import nc.ui.scm.util.ObjectUtils;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.SuperVO;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDate;
import nc.vo.scm.pu.PuPubVO;
import nc.vo.trade.pub.IBDACTION;
import nc.vo.trade.voutils.VOUtil;
import nc.vo.xcgl.latecheckout.CloseMonBodyVO;
import nc.vo.xcgl.latecheckout.CloseMonVO;
import nc.vo.xcgl.latecheckout.MonthAccountVO;
import nc.vo.xcgl.pub.helper.MonthCloseHelper;
import nc.vo.xcgl.pub.stock.BillStockTool;
import nc.vo.xcgl.pub.stock.mod.XCAccountModBOTool;
/**
* 结存处理类
* @author zhf
*/
public class CloseMonBO implements IBDBusiCheck{
private CloseMonDMO dmo = null;
private BillStockTool stockBO=null;
public BillStockTool getStockBO(){
if(stockBO == null){
stockBO = new BillStockTool();
}
return stockBO;
}
public CloseMonDMO getDMO(){
if(dmo == null){
dmo = new CloseMonDMO();
}
return dmo;
}
public void countNotApprove(UFDate sdate,UFDate edate,String corp) throws BusinessException{
getDMO().countNotApprove(sdate, edate, corp);
}
private AccountFilter af = null;
private AccountFilter getAccountFilter(){
if(af == null){
af = new AccountFilter();
}
return af;
}
private CancelAccountFilter caf = null;
private CancelAccountFilter getCancelAccountFilter(){
if(caf == null){
caf = new CancelAccountFilter();
}
return caf;
}
public void check(int intBdAction,AggregatedValueObject billVo,Object userObj)
throws Exception {
if(intBdAction == IBDACTION.SAVE){//保存前数据校验
if(billVo == null)
return;
CloseMonVO bill = (CloseMonVO)ObjectUtils.serializableClone(billVo);
UFBoolean isaccount = bill.getIsaccount();
if(isaccount == null)
throw new BusinessException("数据异常,结账标识未明确");
if(isaccount.booleanValue()){//后台校验 结账月内的业务单据必须均审批通过
CloseMonBodyVO[] bodys = bill.getItems();
bodys = (CloseMonBodyVO[])VOUtil.filter(bodys, getAccountFilter());
bill.setChildrenVO(bodys);
if(bodys == null || bodys.length ==0){
throw new BusinessException("数据异常,结账数据为空");
}
//按月份升序
VOUtil.ascSort(bodys, CloseMonBodyVO.sort_fields);
UFDate dstartdate = bodys[0].getDstartdate();
UFDate denddate = bodys[bodys.length-1].getDenddate();
countNotApprove(dstartdate, denddate, bill.getHeader().getPk_corp());
}
if(isaccount.booleanValue())
doAccount(bill);
else
disAccount(bill);
}
}
/**
*
* @author zhf
* @说明:(鹤岗矿业)取消结账
* 2011-10-22下午04:20:01
* @param bill
* @throws BusinessException
*/
private void disAccount(CloseMonVO bill) throws BusinessException{
CloseMonBodyVO[] bodys = bill.getItems();
String pk_corp=PuPubVO.getString_TrimZeroLenAsNull(bill.getParentVO().getAttributeValue("pk_corp"));
bodys = (CloseMonBodyVO[])VOUtil.filter(bodys, getCancelAccountFilter());
if(bodys == null || bodys.length == 0)
return;
for(CloseMonBodyVO body:bodys){
getDMO().delMonAccountsForOneMonth(body.getPk_accperiodmonth(),pk_corp);
}
}
/**
*
* @author zhf
* @说明:(鹤岗矿业)结账
* 2011-10-22下午04:20:12
* @param bill
* @throws BusinessException
*/
private void doAccount(CloseMonVO bill) throws BusinessException{
CloseMonBodyVO[] bodys = bill.getItems();
String pk_corp=PuPubVO.getString_TrimZeroLenAsNull(bill.getParentVO().getAttributeValue("pk_corp"));
if(bodys == null || bodys.length == 0)
return;
if(bodys.length>1){
throw new BusinessException("不能多个月一起结账");
}
//按月份排序
VOUtil.ascSort(bodys, CloseMonBodyVO.sort_fields);
//逐月进行月结处理
List<MonthAccountVO> lmon = new ArrayList<MonthAccountVO>();//存放转后后本次结账的所有数据
for(CloseMonBodyVO body:bodys){
if(!MonthCloseHelper.isMonthClose(body.getDstartdate(),pk_corp).booleanValue()){
throw new BusinessException("要结转的月份没有关帐");
}
calForOneMonth(body,lmon,pk_corp);
}
if(lmon.size()>0){
//进行加锁处理
BillStockTool.getInstrance().lock(lmon.toArray(new MonthAccountVO[0]));
//存入结存表
getDMO().saveMonAccounts(lmon.toArray(new MonthAccountVO[0]));
}
}
/**
* 进行结账处理
* @param body
* @param lmon
* @param pk_corp
* @throws BusinessException
*/
private void calForOneMonth(CloseMonBodyVO body,List<MonthAccountVO> lmon,String pk_corp) throws BusinessException{
try {
SuperVO[] vos=XCAccountModBOTool.getInstrance().doAccount(body.getPk_accperiodmonth(), pk_corp);
if(vos==null|| vos.length==0){
return;
}
for(int i=0;i<vos.length;i++){
lmon.add((MonthAccountVO) vos[i]);
}
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public void dealAfter(int intBdAction, AggregatedValueObject billVo,
Object userObj) throws Exception {
}
}
| [
"menlging.rui@163.com"
] | menlging.rui@163.com |
18158fac3e36c9d409f8743d96dc3f07b44d03c0 | c6f612986d318ecba2b011c57dfdf2bbedab835a | /kth largest/src/kthlargerst.java | 27e1ee1e74ae8368b306c3332b23fdce92e81757 | [] | no_license | icesnakejin/LeetCode_Problems | 05462fc322432c6058db15dd60090534dc1bc8f9 | 290e431509e1c4ccb76bb24a6cd2d65dba1b52a2 | refs/heads/master | 2021-01-19T16:51:18.554073 | 2015-12-09T20:24:30 | 2015-12-09T20:24:30 | 35,127,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,055 | java | import java.util.Comparator;
import java.util.PriorityQueue;
public class kthlargerst {
public static void main(String[] args) {
int [] input = {2, 1};
int result = new Solution().findKthLargest(input, 1);
System.out.println(result);
}
}
class Solution {
public int findKthLargest(int[] nums, int k) {
Comparator<Integer> comparator = new reverseComparator();
PriorityQueue<Integer> minStack = new PriorityQueue<Integer>(k, comparator);
System.out.println(minStack.size());
for (int i = 0 ; i < nums.length ; i ++) {
minStack.offer(nums[i]);
if (--k == 0) break;
}
int result = 0;
while (minStack.size() > 0) {
result = minStack.poll();
System.out.println(result);
}
return result;
}
class reverseComparator implements Comparator<Integer> {
public int compare (Integer a, Integer b) {
if (a < b) return 1;
else if (a > b) return -1;
else return 0;
}
}
}
| [
"icesnakejin@gmail.com"
] | icesnakejin@gmail.com |
562dd086809d85e104436b8e8d6bd87b8da3e529 | c2d2e652d3691f38e3b2465c784667c589004830 | /ratpack-session/src/main/java/ratpack/session/internal/LocalMemorySessionStore.java | 0934e4a2e11d868cd3681915051138e4fcf048b6 | [
"Apache-2.0"
] | permissive | shangyi0102/ratpack | 461253608ed28f2fb9d9d5f24a948dc3352d8a60 | de9acd18c4b03aac360ba68370b089de0351508d | refs/heads/master | 2021-01-24T09:57:24.750493 | 2016-03-22T10:10:50 | 2016-03-22T10:10:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,457 | java | /*
* Copyright 2015 the original author or authors.
*
* 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 ratpack.session.internal;
import com.google.common.cache.Cache;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.AsciiString;
import ratpack.exec.Operation;
import ratpack.exec.Promise;
import ratpack.server.StopEvent;
import ratpack.session.SessionStore;
import java.util.concurrent.atomic.AtomicLong;
public class LocalMemorySessionStore implements SessionStore {
private final Cache<AsciiString, ByteBuf> cache;
private final AtomicLong lastCleanup = new AtomicLong(System.currentTimeMillis());
public LocalMemorySessionStore(Cache<AsciiString, ByteBuf> cache) {
this.cache = cache;
}
@Override
public Operation store(AsciiString sessionId, ByteBuf sessionData) {
return Operation.of(() -> {
maybeCleanup();
ByteBuf retained = Unpooled.unmodifiableBuffer(sessionData.retain());
cache.put(sessionId, retained);
});
}
@Override
public Promise<ByteBuf> load(AsciiString sessionId) {
return Promise.sync(() -> {
maybeCleanup();
ByteBuf value = cache.getIfPresent(sessionId);
if (value != null) {
return Unpooled.unreleasableBuffer(value.slice());
} else {
return Unpooled.EMPTY_BUFFER;
}
});
}
@Override
public Promise<Long> size() {
return Promise.sync(cache::size);
}
@Override
public Operation remove(AsciiString sessionId) {
return Operation.of(() -> {
maybeCleanup();
cache.invalidate(sessionId);
});
}
@Override
public void onStop(StopEvent event) throws Exception {
cache.invalidateAll();
}
private void maybeCleanup() {
long now = System.currentTimeMillis();
long last = lastCleanup.get();
if (now - last > 1000 * 10) {
if (lastCleanup.compareAndSet(last, now)) {
cache.cleanUp();
}
}
}
}
| [
"ld@ldaley.com"
] | ld@ldaley.com |
80987963e75107a279468e6b245c89cf8c3dacb7 | b156fbb6a0e040cee4a0dbbdb7c2a6298eb0b36a | /src/EcranF.java | 44a815a536113d32c09a0dc9a1022b35677ddd55 | [] | no_license | jiajwu72/morphing | bf690b94c5319e5c66e3ee4092d2096e94b49731 | 5058b87b2e401b7b61f48cea9465a7a3edbcbb27 | refs/heads/master | 2020-03-28T17:12:59.482768 | 2018-09-16T17:55:09 | 2018-09-16T17:55:09 | 148,768,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,286 | java | import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Polygon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.PixelGrabber;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.concurrent.SynchronousQueue;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import org.omg.Messaging.SyncScopeHelper;
import org.omg.PortableServer.POA;
import com.mysql.fabric.xmlrpc.base.Array;
public class EcranF extends JPanel implements MouseListener {
private static final Point[] trInterm = null;
Photo photo1;
Photo photo2;
BufferedImage imgInterm;
int a = 0;
// ArrayList<Point> points_interm;
int frames = 10;
Image morphs[] = new Image[frames];
LinkedList<Point[]> triangles;
ArrayList<Fonction> fonctions; // transformation lineairement des points en
// correspondants
public EcranF() {
super();
// points_interm=new ArrayList<Point>();
// miseAjourFonction();
/*
* photoInterm=photo1; photoInterm.triangles=photo1.triangles;
*/
this.addMouseListener(this);
}
public void paint(Graphics g) {
super.paint(g);
if (imgInterm != null) {
g.drawImage(imgInterm, 0, 0, imgInterm.getWidth(), imgInterm.getHeight(), this);
}
// System.out.println("draw imginterm");
// g.drawImage(morphs[52], 10, 10,(int)(this.getWidth()*0.95) ,
// (int)(this.getHeight()*0.95), this);
}
void setImgInterm(BufferedImage im) {
imgInterm = im;
}
/*
* void morph(int alpha){ miseAjourFonction();
* points_interm.add(photo1.points.get(0));
*
*
*
* for(int i=0;i<alpha;i++){ try { for(int j=1;j<points_interm.size();j++){
*
* Thread.sleep(20);
*
* //a chaque action on avance 1/alpha uniteX et uniteY de distance a
* deplacer int uniteX=(int)
* ((photo1.points.get(j).distance(photo2.points.get(j)))/alpha);//!!!!!!!!!
* !!!!!!!!
*
* int x=points_interm.get(j-1).x+uniteX;
* if(!fonctions.get(j).getClass().equals(FonctionVertical.class)){ Point
* p=fonctions.get(j).ptAbscisse(x); }else{
*
* }
*
* }
*
* } catch (InterruptedException e) { // TODO Auto-generated catch block
* e.printStackTrace(); } } }
*/
void miseAjourFonction() {
fonctions = new ArrayList<Fonction>();
Fonction f;
for (int i = 0; i < photo1.points.size(); i++) {
Point p1 = photo1.points.get(i);
Point p2 = photo2.points.get(i);
if (p1.x == p2.x) {
f = new FonctionVertical(p1);
} else if (p1.y == p2.y) {
f = new FonctionConstant(p1);
} else {
f = p1.fAPartir2Pts(p2);
}
fonctions.add(f);
}
}
/*
* BufferedImage miseAJourRGB(){
*
* System.out.println("photo1:"+photo1); BufferedImage img=null; try {
* photoInterm=photo1; img =
* ImageIO.read(getClass().getResource("/"+photoInterm.toString())); int
* width=img.getWidth(); int height=img.getHeight();
*
*
*
* for (int i=0;i<height;i++){ for (int j=0;j<height;j++){
*
* img.setRGB(i, j, img.getRGB(j, i)-a);
*
* }
*
* } a+=5;
*
*
*
* } catch (IOException e) { // TODO Auto-generated catch block
* e.printStackTrace(); } return img;
*
* }
*/
/*
* int pixel_from_Point(Point p){
*
* }
*/
Point pointAuTempsT(Point pointDepart, Point pointArrivee, int nbUnite) {
if(pointDepart.x==pointArrivee.x &&pointDepart.y==pointArrivee.y){
return pointArrivee;
}
double avancement = 1 / (frames + 0.0) * nbUnite;
int x = (int) (pointDepart.x + (pointArrivee.x - pointDepart.x) * (avancement));
int y = fonctions.get(pointArrivee.getId() - 1).ordonneeDAbscisse(x);
/*
* Fonction f=new FonctionAffine(); f=f.fApartir2pts(pointDepart,
* pointArrivee); int y=f.ordonneeDAbscisse(x);
*/
return new Point(x, y);
}
Point[] triangleAuTempsT(Point[] triangleDep, Point[] triangleArr, int temps) {
Point[] pts = new Point[3];
for (int i = 0; i < 3; i++) {
pts[i] = pointAuTempsT(triangleDep[i], triangleArr[i], temps);
}
return pts;
}
/*
* int rgbFromPoint(Point p){ BufferedImage img=null; int rgb=0; try {
* img=ImageIO.read(getClass().getResource("/"+photoInterm.toString()));
* rgb=img.getRGB(p.x, p.y); } catch (IOException e) { // TODO
* Auto-generated catch block e.printStackTrace(); } return rgb; }
*/
static double toDegres(Point p1, Point p2, Point p3) {
double a1 = p2.distance(p1);
double c1 = p2.distance(p3);
double b1 = p1.distance(p3);
double a1Carre = Math.pow(a1, 2);
double b1Carre = Math.pow(b1, 2);
double c1Carre = Math.pow(c1, 2);
double alpha = Math.toDegrees(Math.acos((c1Carre + a1Carre - b1Carre) / (2 * a1 * c1)));
return alpha;
}
static boolean ptDansTriangle(Point p, Point[] triangle) {
double alpha = toDegres(triangle[0], p, triangle[1]);
double beta = toDegres(triangle[0], p, triangle[2]);
double gamma = toDegres(triangle[1], p, triangle[2]);
double somme = alpha + beta + gamma;
// System.out.println("somme"+somme);
somme = Math.round(somme);
return somme == 360;
}
int rgbAuTemps(int rgb1, int rgb2, int temps) {
Color a = new Color(rgb1);
Color b = new Color(rgb2);
int ecartRed = (int) ((b.getRed() - a.getRed()) * temps / (frames + 0.0));
int ecartGreen = (int) ((b.getGreen() - a.getGreen()) * temps / (frames + 0.0));
int ecartBlue = (int) ((b.getBlue() - a.getBlue()) * temps / (frames + 0.0));
int red = a.getRed() + ecartRed;
int green = a.getGreen() + ecartGreen;
int blue = a.getBlue() + ecartBlue;
Color c = new Color(red, green, blue);
return c.getRGB();
}
void imgInterm(int temps) {
imgInterm = new BufferedImage(this.getWidth(), this.getHeight(), BufferedImage.TYPE_INT_RGB);
LinkedList<Point[]> trianglesDeparts = photo1.triangles;
LinkedList<Point[]> trianglesArrivees = photo2.triangles;
//LinkedList<Point[]> trianglesInterms = new LinkedList<>();
for (int i = 0; i < trianglesDeparts.size(); i++) { // on parcour la
// liste des
// triangles
Point[] trDepart = trianglesDeparts.get(i);
Point[] trArrivee = trianglesArrivees.get(i);
Point[] trInterm = triangleAuTempsT(trDepart,trArrivee,temps);// triangle
System.out.print("trDepart:"); afficherTriangle(trDepart);
System.out.print("trInterm:"); afficherTriangle(trInterm);
System.out.print("trArrivee:"); afficherTriangle(trArrivee); System.out.println();
for (int l = 0; l < 3; l++) { // dessiner des 3 sommets de triangle
// intermediaire
int rgb1 = photo1.getBufferedImage().getRGB(trDepart[l].getX(), trDepart[l].getY());
int rgb2 = photo2.getBufferedImage().getRGB(trArrivee[l].getX(), trArrivee[l].getY());
int rgb3 = rgbAuTemps(rgb1, rgb2, temps);
// System.out.println("imgInterm.getWidth()"+imgInterm.getWidth());
imgInterm.setRGB(trInterm[l].x, trInterm[l].y, rgb3);
}
System.out.println("------------------------------------------------------------------------");
for(int j=plusPetitOrdDeTriangle(trInterm);j<=plusGrandOrdDeTriangle(trInterm);j++){
for(int k=plusPetitAbsDeTriangle(trInterm);k<=plusGrandAbsDeTriangle(trInterm);k++){
//System.out.println("k:"+k+" j:"+j);
//si le point jest dans le triangle intermediare
Point p=new Point(k,j);
if(ptDansTriangle(p,trInterm)){
//definir les parametre alpha beta gamma de point p
p.setAlphaBetaGamma(trInterm);
//on trouve le point dans triangle de depart dont alpha beta gamma egale....
Point ptDep=ptDontAlphaBetaGammaEgale(p.alpha, p.beta, p.gamma, trDepart);
System.out.println("ptDep:"+ptDep);
if(ptDep.gamma==0){
//imgInterm.setRGB(p.x, p.y, Color.red.getRGB());
continue;
}
//System.out.println("ptDep:"+ptDep);
ptDep.setAlphaBetaGamma(trDepart);
//on trouve le point dans triangle de arrivee dont alpha beta gamma egale....
Point ptArrivee=ptDontAlphaBetaGammaEgale(p.alpha, p.beta, p.gamma, trArrivee);
ptDep.setAlphaBetaGamma(trArrivee);
afficherTriangle(trDepart);
afficherTriangle(trInterm);
afficherTriangle(trArrivee);
//on calcule le rgb de ce point
int rgb1 = photo1.img.getRGB(ptDep.x, ptDep.y);
int rgb2 = photo2.img.getRGB(ptArrivee.x, ptArrivee.y);
int rgb3 = rgbAuTemps(rgb1, rgb2, temps);
System.out.println("ptArr:"+ptArrivee);
//System.out.println(rgb3);
imgInterm.setRGB(p.x, p.y, rgb3);
}
}
}
}
/*int nT=0;
for(int h=0;h<=photo1.img.getHeight();h++){
for(int w=0;w<=photo1.img.getWidth();w++){
Point p=new Point(w,h);
for(int i=0;i<trianglesInterms.size();i++){
if(ptDansTriangle(p, trianglesInterms.get(i))){
nT=i;
}
}
Point[] trDepart = trianglesDeparts.get(nT);
Point[] trArrivee = trianglesArrivees.get(nT);
Point[] trInterm = trianglesInterms.get(nT);
//definir les parametre alpha beta gamma de point p
p.setAlphaBetaGamma(trInterm);
//on trouve le point dans triangle de depart dont alpha beta gamma egale....
Point ptDep=ptDontAlphaBetaGammaEgale(p.alpha, p.beta, p.gamma, trDepart);
System.out.println("ptDep:"+ptDep);
if(ptDep.gamma==0){
//imgInterm.setRGB(p.x, p.y, Color.red.getRGB());
continue;
}
//System.out.println("ptDep:"+ptDep);
ptDep.setAlphaBetaGamma(trDepart);
//on trouve le point dans triangle de arrivee dont alpha beta gamma egale....
Point ptArrivee=ptDontAlphaBetaGammaEgale(p.alpha, p.beta, p.gamma, trArrivee);
ptDep.setAlphaBetaGamma(trArrivee);
afficherTriangle(trDepart);
afficherTriangle(trInterm);
afficherTriangle(trArrivee);
//on calcule le rgb de ce point
System.out.println("ptDep:"+ptDep);
int rgb1=Color.black.getRGB();
if(ptDep.x<=275&&ptDep.y>=0){
rgb1 = photo1.img.getRGB(ptDep.x, ptDep.y);
}
//int rgb2 = photo2.img.getRGB(ptArrivee.x, ptArrivee.y);
//int rgb3 = rgbAuTemps(rgb1, rgb2, temps);
//System.out.println("ptArr:"+ptArrivee+"\n "+rgb3);
//System.out.println(rgb3);
imgInterm.setRGB(w,h, rgb1);
}
}*/
}
void definirTousAlphaBetaGamma(){
}
Point ptDontAlphaBetaGammaEgale(double alpha,double beta,double gamma,Point[] t){
Point p=new Point();
p.alpha=alpha;
p.beta=beta;
p.gamma=gamma;
double a= (alpha*t[0].x+beta*t[1].x+gamma*t[2].x);
double b= (alpha*t[0].y+beta*t[1].y+gamma*t[2].y);
double m=alpha+beta+gamma;
int x=(int) (Math.round(a/(m+0.0)));
int y=(int) (Math.round(b/(m+0.0)));
p.x=x;
p.y=y;
return p;
}
int plusPetitAbsDeTriangle(Point[] t){
int a=t[0].x;
for(int i=1;i<3;i++){
if(a>t[i].x){
a=t[i].x;
}
}
return a;
}
int plusPetitOrdDeTriangle(Point[] t){
int a=t[0].y;
for(int i=1;i<3;i++){
if(a>t[i].y){
a=t[i].y;
}
}
return a;
}
int plusGrandAbsDeTriangle(Point[] t){
int a=t[0].x;
for(int i=1;i<3;i++){
if(a<t[i].x){
a=t[i].x;
}
}
return a;
}
int plusGrandOrdDeTriangle(Point[] t){
int a=t[0].y;
for(int i=1;i<3;i++){
if(a<t[i].y){
a=t[i].y;
}
}
return a;
}
void afficherTriangle(Point[] tri) {
for (int i = 0; i < tri.length; i++) {
System.out.print(tri[i] + ",");
}
System.out.println();
}
void setPhoto1(Photo p) {
photo1 = p;
}
void setPhoto2(Photo p) {
photo2 = p;
}
ArrayList<Point> pixelsDansTriangle(Point[] triangle) {
ArrayList<Point> pixels = new ArrayList<Point>();
for (int i = plusPetitOrdDeTriangle(triangle); i < plusGrandOrdDeTriangle(triangle); i++) {
for (int j = plusPetitAbsDeTriangle(triangle); j < plusGrandAbsDeTriangle(triangle); j++) {
Point p = new Point(j, i);
if (ptDansTriangle(p, triangle)) {
pixels.add(p);
}
}
}
return pixels;
}
Point trouverPixelEnCorresp(Point p, ArrayList<Point> pixels) {
for (int i = 0; i < pixels.size(); i++) {
if (p.memeAlphaBetaGamma(p, pixels.get(i))) {
return pixels.get(i);
}
}
return null;
}
/*
* public void mouseClicked(MouseEvent e) {
*
* //if(a>0 && a<=morphs.length){ if(e.getButton()==MouseEvent.BUTTON1){
* imgInterm=morphs[a]; a++; this.repaint();
*
*
* } else if(e.getButton()==MouseEvent.BUTTON3){ a--; if(a<0){ a=0; }
*
* imgInterm=morphs[a];
*
* this.repaint();
*
* } //}
*
* }
*/
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
public static void main(String[] args) {
/*
* Point a=new Point(1,1); Point b=new Point(4,1); Point c=new
* Point(3,3); Point d=new Point(2,2); Point e=new Point(3,1); Point[]
* tr={a,b,c};
*
* System.out.println("bdc:"+toDegres(c, d, b));
* System.out.println("adb:"+toDegres(a, d, b));
* System.out.println("adc:"+toDegres(a, d, c));
* System.out.println(ptDansTriangle(e, tr));
*/
/*
* Point depart=new Point(10,10); Point arrivee=new Point(50,40);
*
* EcranF ef=new EcranF(); Point interm=ef.pointAuTempsT(depart,
* arrivee, 1); System.out.println(interm);
*/
// Fenetre f=new Fenetre();
/*
* EcranF ef=new EcranF();
*
* Point a=new Point(1,1,1); Point b=new Point(0,3,2); Point c=new
* Point(2,2,3); Point aa=new Point(2,1,1); Point bb=new Point(1,2,2);
* Point cc=new Point(3,3,3);
*
* Point[] triangleDep={a,b,c}; Point[] triangleArr={aa,bb,cc};
*
* ArrayList<Point> points1=new
*
* ef.triangleAuTempsT(triangleDep, triangleArr, 3);
*/
/*
* Color a=new Color(22,76, 2); Color b=new Color(132,79, 88);
*
* int rgb1=a.getRGB(); int rgb2=b.getRGB(); EcranF ef=new EcranF(); int
* rgb3=ef.rgbAuTemps(rgb1, rgb2, 10);
*
* System.out.println("rgb1:"+rgb1+" rgb2:"+rgb2+" rgb3:"+rgb3);
*/
// Fenetre f=new Fenetre();
EcranF ef = new EcranF();
Point a = new Point(0, 0);
Point b = new Point(2, 2);
Point c = new Point(2, 0);
Point m=new Point(1,0);
Point aa = new Point(7, 1);
Point bb = new Point(5, 3);
Point cc = new Point(10, 4);
Point[] triangleDep = { a, b, c };
Point[] triangleArrivee = { aa, bb, cc };
m.setAlphaBetaGamma(triangleDep);
System.out.println("m.alpha:"+m.alpha+" m.beta:"+m.beta+" m.gamma:"+m.gamma);
//Point[] trInterm=ef.triangleAuTempsT(triangleDep, triangleArrivee, 3);
//ef.afficherTriangle(trInterm);
//System.out.println(ef.ptDansTriangle(m, triangleDep));
/*m.setAlphaBetaGamma(triangleDep);
System.out.println("m.alpha:"+m.alpha+" m.beta:"+m.beta+" m.gamma:"+m.gamma);
Point p=ef.ptDontAlphaBetaGammaEgale(m.alpha, m.beta, m.gamma, triangleArrivee);
System.out.println("p.alpha:"+p.alpha+" p.beta:"+p.beta+" p.gamma:"+p.gamma+"\n"+p);*/
/*Point mm=ef.ptDontAlphaBetaGammaEgale(m.alpha, m.beta, m.gamma, triangleArrivee);
//ef.ptDontAlphaBetaGammaEgale(alpha, beta, gamma, t);
System.out.println(mm.x+" "+mm.y);*/
}
}
| [
"jwu@e2r12p18.42.fr"
] | jwu@e2r12p18.42.fr |
db22b0e6a89d164074f1994b7663b5e7af362c11 | 262f8324b74acda6bb6331ebafa17061c6da1337 | /src/Adapter/UKDevice.java | a7b0c9aa47c37907fade856945ec599d4b2f88d9 | [] | no_license | MarcinSemkowski/Java_U_Design_Patterns | 879ab836c09ddccea9b019cc5482ce5acbb9b090 | 8cf103c6ef332cee30abc93a915965c98d288b61 | refs/heads/master | 2020-06-17T19:50:12.257761 | 2019-09-16T18:38:51 | 2019-09-16T18:38:51 | 196,033,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | package Adapter;
public interface UKDevice {
void powerOn();
}
| [
"marcin96semkowski@gmail.com"
] | marcin96semkowski@gmail.com |
5eb5c2d33374510356aec07d8057bf3483f83e9b | f85c302d785f0c2a82e90d758427bdd7c0234916 | /src/session/s6/Main.java | 1fb69d3da196d28de2a2ebcd491bd49d85645873 | [] | no_license | hoatq-fptaptech/T2009M_ADF2 | c4f2fc9965fba61686d836d6c9b83347b69397c7 | 6166caab63bb288ca6bb440dcc37ac1c6881d968 | refs/heads/master | 2023-04-07T02:02:40.573740 | 2021-04-08T02:54:26 | 2021-04-08T02:54:26 | 349,624,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,009 | java | package session.s6;
public class Main {
public static void main(String[] args){
Runnable r1 = new Runnable() {
@Override
public void run() {
for (int i=0;i<10;i++){
System.out.println("RUN 1: "+i);
try {
Thread.sleep(1000);
}catch (Exception e){}
}
}
};
Thread t1 = new Thread(r1);
Runnable r2 = new Runnable() {
@Override
public void run() {
for (int i=0;i<10;i++){
System.out.println("RUN 2: "+i);
try {
Thread.sleep(1000);
}catch (Exception e){}
}
}
};
Thread t2 = new Thread(r2);
// t1.setDaemon(true);
Runnable r3 = new Runnable() {
@Override
public void run() {
for (int i=0;i<10;i++){
System.out.println("RUN 3: "+i);
try {
Thread.sleep(1000);
}catch (Exception e){}
}
}
};
Thread t3 = new Thread(r3);
Runnable r4 = new Runnable() {
@Override
public void run() {
for (int i=0;i<10;i++){
System.out.println("RUN 4: "+i);
try {
Thread.sleep(1000);
}catch (Exception e){}
}
}
};
Thread t4 = new Thread(r4);
t1.start();
try {
t1.join();// bắt các luồng phía sau phải chờ nó xong việc mới đc làm
}catch (Exception e){}
t2.start();
try {
t2.join();// bắt các luồng phía sau phải chờ nó xong việc mới đc làm
}catch (Exception e){}
t3.start();
t4.start();
}
}
| [
"quanghoa.trinh@gmail.com"
] | quanghoa.trinh@gmail.com |
f7f465eaf58014e24b0ea13e491f05e3f7eee3aa | 9cdd6bb678758ee6204c2b7a156e5a7d2abcd1cd | /Fundamental/src/main/java/vn/elite/fundamental/web/socket/MessageDecoder.java | 8d72e2dea5f31d04761a3f500c8e23d72491efdf | [] | no_license | duclmse/Lycanthrone | 67344a10289410f1cf3a0b19cfa107f338a1f214 | f033d6cef31ad6735ddeaf563639f0d8c1e8f637 | refs/heads/master | 2023-02-13T00:54:57.644110 | 2020-04-17T08:18:46 | 2020-04-17T08:18:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | package vn.elite.fundamental.web.socket;
import com.google.gson.Gson;
import javax.websocket.Decoder;
import javax.websocket.EndpointConfig;
public class MessageDecoder implements Decoder.Text<Message> {
private static Gson gson = new Gson();
@Override
public Message decode(String s) {
return gson.fromJson(s, Message.class);
}
@Override
public boolean willDecode(String s) {
return (s != null);
}
@Override
public void init(EndpointConfig endpointConfig) {
// Custom initialization logic
}
@Override
public void destroy() {
// Close resources
}
}
| [
"duclmdev@gmail.com"
] | duclmdev@gmail.com |
a12007e33a1435f2e2c5589aa448785636cbcdc4 | cb0944b21dbf54b02fc9ea979def0bcfa1ac729f | /common/src/main/java/medved/fias/scheduling/JobData.java | fc01f88b836e37052d6d32eb4bace1bce8bff05f | [] | no_license | arshvin/fias-spring | 320317655a2b3b55070af4765e80130c7589713d | 5ccf3f94e79fbaaabecc292b530df4402521f1a7 | refs/heads/master | 2021-01-18T21:47:56.587427 | 2017-04-18T20:24:15 | 2017-04-19T05:18:51 | 42,825,635 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package medved.fias.scheduling;
import java.util.Map;
/**
* Created by arshvin on 09.07.16.
*/
public interface JobData {
Long getId();
void setClassName(String className);
String getClassName();
void setName(String name);
String getName();
void setConfig(Map<String,String> config);
Map<String,String> getConfig();
void setSchedule(String schedule);
String getSchedule();
void setActive(Boolean active);
Boolean getActive();
}
| [
"arschvin@gmail.com"
] | arschvin@gmail.com |
1ccbc92fd76fe99b4c06fa31551ce76b92f9de7e | 6426a91576c8759cfb656ebdc6e26fb22d612fe1 | /vitya/src/hw5/Hw5T5.java | 903dce5373df8af5c821571b6fcd56c4c7c0794e | [] | no_license | Eugene1992/java-starter-04 | 609eaff84a4e1cce690f6cb0fdc5a30000cd9e4e | 8f894368afc712da79844d8d924fa8a28f4776ff | refs/heads/master | 2020-12-24T19:05:15.183336 | 2016-05-16T14:46:18 | 2016-05-16T14:46:18 | 56,602,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package hw5;
/**
* Created by User on 09.05.2016.
*/
public class Hw5T5 {
public static void main(String[] args) {
//Найти сумму все элементов в массиве
int a[]=new int[]{20,50,30};
for (int i = 0; i <a.length ; i++) {
System.out.println(a[i]);
}
}
}
| [
"vganich@hotmail.com"
] | vganich@hotmail.com |
01194f1b5b1345dbc7c996fa7c1285112d7f7f40 | fc0f9aa6d356e181cbf993cec93b478927bdef08 | /Sum of numbers using function/Main.java | 6950a0e66c949be947a2fedd2d4509419157de36 | [] | no_license | ravianand04/Playground | e40206687589dd181e4e9c2a7ba668577f3fe737 | c8b5b45f5a9c4d3afa2da39fe5b176456913c983 | refs/heads/master | 2020-04-14T15:28:53.627149 | 2019-01-27T06:23:08 | 2019-01-27T06:23:08 | 163,928,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | import java.util.Scanner;
class Main{
public static int sod(int m){
int sum = 0;
while(m != 0){
sum += m;
m--;
}
return sum;
}
public static void main (String[] args){
// Type your code here
Scanner in = new Scanner(System.in);
int m = in.nextInt();
int result = sod(m);
System.out.println(result);
}
} | [
"35536453+ravianand04@users.noreply.github.com"
] | 35536453+ravianand04@users.noreply.github.com |
1626e7d6b10bc70ad3eaaab84df4648666cf588c | 287d5a345cdcf88a641ac1f0cc44a2ddea9cd47a | /src/main/java/Main.java | e751394c3610df6d388741ba7d59b26b3ccceb87 | [] | no_license | anetaryznar/structures | f66fada6790fbd4a1cecd564425a5fc43440b33f | 10b2743bf115fe486e9757f10f22c2a4b918a9f8 | refs/heads/master | 2021-08-23T02:14:26.650255 | 2017-11-26T07:51:58 | 2017-11-26T07:51:58 | 111,210,067 | 0 | 0 | null | 2017-11-18T14:00:21 | 2017-11-18T14:00:20 | null | UTF-8 | Java | false | false | 1,688 | java | import java.util.Random;
public class Main {
public static void main(String[] args) {
/*String[] tab = new String[]{"Ala"};
String result = concat(tab, " ");
if("Ala".equals(result)) {
System.out.println("OK");
} else {
System.out.println("Error");
System.out.println("Ala ma kota");
System.out.println(result);
}*/
/*Random random = new Random();
int size = 10000;
int[] tab0 = new int[size];
int[] tab1 = new int[size];
for(int i = 0;i < tab0.length;++i) {
tab0[i] = random.nextInt(100);
}
long now = System.nanoTime();
for(int i = 0;i < tab0.length;++i) {
tab1[i] = tab0[i];
}
System.out.println(System.nanoTime() - now);
for(int i = 0;i < tab0.length;++i) {
tab0[i] = random.nextInt(100);
}
now = System.nanoTime();
System.arraycopy(tab0, 0, tab1, 0, tab0.length);
System.out.println(System.nanoTime() - now);
*/
Random random = new Random();
List numbers = new ArrayList();
for(int i = 0;i < 10;++i) {
numbers.add(random.nextInt(100) / 10.0);
}
numbers.remove(9);
System.out.println(numbers);
}
public static String concat(String[] tab, String delimiter) {
if(tab == null || tab.length == 0) {
return "";
}
StringBuilder result = new StringBuilder(tab[0]);
for(int i = 1;i < tab.length;++i) {
result.append(delimiter).append(tab[i]);
}
return result.toString();
}
}
| [
"szymon@rozkocha.pl"
] | szymon@rozkocha.pl |
aeaaf160b1d5cabe6b5119a7e87a9689dabaed9e | 0c71faad42369a86defd678930fed770b18ade8a | /src/api/java/forestry/api/genetics/AlleleManager.java | 6e3511621358633f29658b7f856142f68606ee64 | [
"CC-BY-4.0"
] | permissive | Prometheus0000/BloodMagic | 761974a1e7e774633efcb0c1053a7eae09921439 | 121bf66111e7ec6acecde30572c0b1df2952573f | refs/heads/1.7.10 | 2023-08-02T04:35:23.642056 | 2021-05-25T19:01:06 | 2021-05-25T19:01:06 | 305,008,776 | 0 | 0 | NOASSERTION | 2021-05-25T19:02:03 | 2020-10-18T02:40:11 | Java | UTF-8 | Java | false | false | 1,327 | java | /*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.genetics;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
/**
* Holds a static reference to the {@link IAlleleRegistry}.
*/
public class AlleleManager {
/**
* Main access point for all things related to genetics. See {@link IAlleleRegistry} for details.
*/
public static IAlleleRegistry alleleRegistry;
/**
* Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks.
*/
public static HashMap<ItemStack, IIndividual> ersatzSpecimen = new HashMap<ItemStack, IIndividual>();
/**
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
*/
public static HashMap<ItemStack, IIndividual> ersatzSaplings = new HashMap<ItemStack, IIndividual>();
/**
* Queryable instance of an {@link IClimateHelper} for easier implementation.
*/
public static IClimateHelper climateHelper;
/**
* Creates Forestry alleles.
*/
public static IAlleleFactory alleleFactory;
}
| [
"wtime@live.ca"
] | wtime@live.ca |
96a264aaa060e832948428606f90c7fa6984867d | 16a3610cda4afe9ebf4a1ed45e57cddd6b0a768b | /Test Data/Test 790ColabInc/Example1/All, Correct (acorrect)/Submission attachment(s)/im/im/src/im/AReplicatedHistory.java | bffb726d4ba7bdfa3183fc27b82d44ca70557a5e | [] | no_license | jphong89/Grader | f558299712313a15078ae14be745e18f338b2ab8 | 8464b331eec46f1f12b74e0d6f895ce2b95f576d | refs/heads/master | 2020-02-26T13:56:46.118821 | 2014-12-05T01:48:46 | 2014-12-05T01:48:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | package im;
import trace.im.ListEditSent;
import util.session.Communicator;
import util.trace.Tracer;
import util.trace.session.AddressedSentMessageInfo;
import echo.modular.AHistory;
public class AReplicatedHistory<ElementType> extends AHistory<ElementType> implements ReplicatedHistory<ElementType> {
Communicator communicator;
public AReplicatedHistory(Communicator theCommunicator) {
communicator = theCommunicator;
}
public synchronized void replicatedAdd(ElementType anInput) {
int anIndex = size();
super.observableAdd(anIndex, anInput);
// communicator.toOthers(new ARemoteInput(input));
// communicator.toOthers(input);
ListEdit listEdit = new AListEdit<ElementType>(OperationName.ADD, anIndex, anInput);
ListEditSent.newCase(
communicator.getClientName(),
listEdit.getOperationName(),
listEdit.getIndex(),
listEdit.getElement(),
AddressedSentMessageInfo.OTHERS, this);
communicator.toOthers(listEdit);
}
}
| [
"dewan@cs.unc.edu"
] | dewan@cs.unc.edu |
56c5aacd024f3597a9f58f08c271d5b886f79b9a | 66a2fd6110bf8f9937f0e5d6bb4dd34026379a2b | /src/Opdracht_14_1.java | 5f77fdc3b015f1b616abe64e48984ebf64c36af9 | [] | no_license | may-yuhan/H14 | 0775c73d6635085adc304feb38986d9faa7df3ea | 4e05aac0a91b7495cb9889eb4776f884af90cf6e | refs/heads/master | 2020-04-27T00:14:48.312890 | 2019-03-05T10:48:18 | 2019-03-05T10:48:18 | 173,928,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,372 | java | import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Opdracht_14_1 extends Applet {
int kleurenIndex, kaartenIndex;
String kleuren[] = {"Schoppen", "Harten", "Ruiten", "Klaveren"};
String[] kaarten = {"Lahire (boer)", "Hector (boer)", "Ogier (boer)", "Lancelot (boer)", "Judith (vrouw)", "Rachel (vrouw)", "Pallas (vrouw)", "Argine", "Charles (heer)", "César (heer)", "David (heer)", "Alexandre (heer)", "Aas (schoppen)","Aas (harten)", "Aas (ruiten)", "Aas (klaveren)", "Twee", "Drie", "Vier", "Vijf", "Zes", "Zeven", "Acht", "Negen", "Tien"};
public void init() {
setSize(400, 400);
Button button = new Button("Random kaart");
add(button);
button.addActionListener(new aButtonListener());
}
class aButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e){
// int kleurKeuze = new Random().nextInt(kleuren.length);
// int kaartenIndex = new Random().nextInt(kaarten.length);
kleurenIndex = (int) (Math.random() * kleuren.length);
kaartenIndex = (int) (Math.random() * kaarten.length);
repaint();
}
}
public void paint (Graphics g){
g.drawString(kleuren[kleurenIndex] + " | " + kaarten[kaartenIndex],30,60);
}
}
| [
"may-yuhan@qq.com"
] | may-yuhan@qq.com |
eb5270fd7f60878b2b25eb12e6147023fd3a225f | 58dac8b118a782b5267c43b79d1a1d5e00499f06 | /src/Helper/ketnoitest.java | 611528ac7d19d43530e80bd5bb0140704541befb | [] | no_license | hauntph07061/QL_trungtamtienganh_haunt | 9ad44a715297e5e59800133803380a341e1189fb | f69f41a0da00dbf0d412d0375332377fb53cbb7a | refs/heads/master | 2023-07-05T19:12:31.606233 | 2021-08-19T05:32:00 | 2021-08-19T05:32:00 | 397,826,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | 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 Helper;
/**
*
* @author haunguyen
*/
import java.net.ConnectException;
import java.sql.*;
import java.sql.DriverManager;
public class ketnoitest {
public static void main(String[] args) {
// TODO code application logic here
// định nghĩa
String userName = "sa";
String passWord = "songlong";
String url = "jdbc:sqlserver://localhost:1433;databaseName=Qly_StarPro";
//
try {
// nạp driver
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection(url,userName,passWord);
if(con != null){
System.out.println("Kết nối chuẩn rồi !");
}
} catch (Exception e) {
System.out.println(" Có lỗi kết nối !" + e);
}
}
}
| [
"hungnguyen321pro@gmail.com"
] | hungnguyen321pro@gmail.com |
893b0834a5d13b52b25381dce8dad161971336f8 | a9bc13d5e520f2c182fc955ac03fb1d8c96a9080 | /Circulo.java | 81e51f9df9b7047d5067b11ef947558608e7536d | [] | no_license | Damyck/PolimorfismeMArc | 675b25e60b38c7e7e2a676d182bd901cf61a82f3 | 4720fdde8b7af20ff6156d23b94b5177878e4831 | refs/heads/master | 2021-01-12T13:50:34.291358 | 2016-09-21T16:30:51 | 2016-09-21T16:30:51 | 68,836,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | /**
* Created by Marc on 21/9/2016.
*/
public class Circulo {
double r;
public Circulo(double r){
this.r = r;
}
public double area(){
return Math.PI*Math.pow(r,2);
}
}
| [
"marcjb2@gmail.com"
] | marcjb2@gmail.com |
5f782906a81fea8ad405672a1ebfbb19d4733d66 | 204b625f4642b5f4f3909d07e7e61ca7338deb5e | /src/net/Indyuce/moarbows/api/util/LinearValue.java | 15b3637cb5736294c3a610c950b4c9759b0bcb12 | [] | no_license | skerit/moar-bows | 0ea6ad677f4643aee7d3ef67f4058d16ed0ae66c | 7f95c08be1a58376f56192d71047184eb493958c | refs/heads/master | 2021-01-03T09:11:42.942902 | 2019-12-25T11:34:50 | 2019-12-25T11:34:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,669 | java | package net.Indyuce.moarbows.api.util;
import org.bukkit.configuration.ConfigurationSection;
public class LinearValue {
private final double base, perLevel;
private double min, max;
private boolean hasmin, hasmax;
/*
* a number which depends on the player level. it can be used as a skill
* modifier to make the ability better depending on the player level or as
* an attrribute value to make attributes increase with the player level
*/
public LinearValue(double base, double perLevel) {
this.base = base;
this.perLevel = perLevel;
}
public LinearValue(double base, double perLevel, double min, double max) {
this.base = base;
this.perLevel = perLevel;
this.min = min;
this.max = max;
hasmin = true;
hasmax = true;
}
public LinearValue(ConfigurationSection config) {
this.base = config.getDouble("base");
this.perLevel = config.getDouble("per-level");
if (config.contains("min")) {
this.min = config.getDouble("min");
this.hasmin = true;
}
if (config.contains("max")) {
this.max = config.getDouble("max");
this.hasmax = true;
}
}
public double getBaseValue() {
return base;
}
public double getPerLevel() {
return perLevel;
}
public double getMax() {
return max;
}
public double getMin() {
return min;
}
public boolean hasMax() {
return hasmax;
}
public boolean hasMin() {
return hasmin;
}
public double calculate(int level) {
double value = base + perLevel * (level - 1);
if (hasmin)
value = Math.max(min, value);
if (hasmax)
value = Math.min(max, value);
return value;
}
}
| [
"cym.peyrat@yahoo.fr"
] | cym.peyrat@yahoo.fr |
9f1bf5d2a8c4feeb974d5a3aed624d15c2d11092 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /fc-20230330/src/main/java/com/aliyun/fc20230330/models/DeleteCustomDomainResponse.java | 816c6fd5f7338ac55da7523200fe1078c5b92cc5 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,066 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.fc20230330.models;
import com.aliyun.tea.*;
public class DeleteCustomDomainResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
public static DeleteCustomDomainResponse build(java.util.Map<String, ?> map) throws Exception {
DeleteCustomDomainResponse self = new DeleteCustomDomainResponse();
return TeaModel.build(map, self);
}
public DeleteCustomDomainResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public DeleteCustomDomainResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
e0872913fefdd0206ee4a4df7a6bfe85e5d35bea | e5d3a03c2b47e3f68a11bd256ffde0dfe45f7ab0 | /app/src/main/java/deafop/srhr/video/Activity/video/FbActivity.java | 05da3d06d8b0171c613204d705185db726843056 | [] | no_license | maxmucks/Video-App | b0ee7ff0afbf28e6929ed5a07a7e1dc1cbd05c9c | 38e3793734c24d72d034fcf7b1db223b27d56a85 | refs/heads/master | 2023-09-03T12:19:50.841624 | 2021-11-05T04:15:41 | 2021-11-05T04:15:41 | 424,825,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,048 | java | package deafop.srhr.video.Activity.video;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
import deafop.srhr.video.Activity.FacebookPlayer;
import deafop.srhr.video.Constant.Constant;
import deafop.srhr.video.JSONParser.JSONParser;
import deafop.srhr.video.Methods.Methods;
import deafop.srhr.video.R;
import deafop.srhr.video.SharedPref.Setting;
public class FbActivity extends AppCompatActivity {
Methods methods;
int position;
protected void onCreate(Bundle savedInstanceState) {
if (Setting.Dark_Mode) {
setAppTheme(R.style.AppTheme4);
} else {
setAppTheme(R.style.AppTheme3);
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fb);
methods = new Methods(this);
position = getIntent().getIntExtra("pos2", 0);
FacebookPlayer fbPlayerView = (FacebookPlayer) findViewById(R.id.fbPlayerView);
fbPlayerView.setAutoPlay(true);
fbPlayerView.setShowCaptions(false);
fbPlayerView.setShowText(false);
fbPlayerView.initialize(Constant.fb_app_id, Setting.arrayList.get(position).getVideo_url());
fbPlayerView.setAutoPlayerHeight(this);
new AsyncTask<String, String, String>() {
@Override
protected String doInBackground(String... strings) {
String json = JSONParser.okhttpPost(Setting.SERVER_URL, methods.getAPIRequest(Setting.METHOD_VIDEO, 0, "", Setting.arrayList.get(position).getId(), "", "", "", "", "", "","","","","","","","", null));
return null;
}
}.execute();
}
private void setAppTheme(@StyleRes int style) {
setTheme(style);
}
}
| [
"maxmucks@gmail.com"
] | maxmucks@gmail.com |
75e1f0565d583dc86945e2655ec4350563b826ee | 9c485a0e0f34b95a9b9d2fef87c442d1c9d1fb7f | /src/test/java/HybridTest.java | 9412b05c262403d49d47457b434897425441b535 | [] | no_license | Edi8001990/CarDealerShipLab | eb1bb93323f09d45fff1536b99e89b595504a918 | f86b32eab6e48c76780e73be16a9d195d839163d | refs/heads/master | 2021-07-06T14:40:35.632109 | 2019-06-19T14:28:18 | 2019-06-19T14:28:18 | 192,748,628 | 0 | 0 | null | 2020-10-13T14:01:29 | 2019-06-19T14:29:02 | Java | UTF-8 | Java | false | false | 897 | java | import dealership.car.Hybrid;
import dealership.components.Engine;
import dealership.components.Tyres;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class HybridTest {
Hybrid hybrid;
Engine engine;
Tyres tyres;
@Before
public void before(){
engine = new Engine("Turbo Engine");
tyres = new Tyres("Michelin");
hybrid = new Hybrid(12000.00, "Blue", engine, tyres);
}
@Test
public void hybridHasAPrice(){
assertEquals(12000.00, hybrid.getPrice(), 0.01);
}
@Test
public void hybridHasAColour(){
assertEquals("Blue", hybrid.getColour());
}
@Test
public void checkIfCarHasAEngine(){
assertEquals(engine, hybrid.getEngine());
}
@Test
public void checkIfCarHasATyre(){
assertEquals(tyres, hybrid.getTyres());
}
}
| [
"mateusz.trajdos@gmail.com"
] | mateusz.trajdos@gmail.com |
29de3d7a99d18b875fd34adb652236334fa0099c | 0b4ea4dfe7b4d477a81cc49b9ebfda9bcbfdca4c | /ebay/src/test/java/com/ebay/utils/Utils.java | 5f9409dc53a0466cea269e600de1efd38592256b | [] | no_license | sureshlokiah/ebay_challenge | a5ce8ff20ae5abbe59d8e6be318a3ef8a439d818 | 32ac10319ee95408858b4508856f9a45f1092fc5 | refs/heads/master | 2023-05-12T15:57:58.392679 | 2020-03-24T00:19:41 | 2020-03-24T00:19:41 | 248,609,129 | 0 | 0 | null | 2023-05-09T18:21:58 | 2020-03-19T21:31:24 | HTML | UTF-8 | Java | false | false | 3,287 | java | package com.ebay.utils;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.HashMap;
/**
*
* Utilities class.
*
*/
public class Utils {
final static Logger logger = Logger.getLogger(Utils.class);
private static Utils utils = null;
private Utils() {
}
public static Utils getUtils() {
if(utils == null)
utils = new Utils();
return utils;
}
/**
* Get text using regex
* @param pattern - regex pattern
* @param matcher - regex matcher (text)
* @return - first value found otherwise empty string
*/
public String getByRegEx(String pattern, String matcher) {
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(matcher);
if (m.find()) {
//logger.debug("getByRegex=" + m.group(1));
return m.group(1);
} else {
return "";
}
}
/**
* Save to html file
* @param html - regex pattern
* @param location - regex matcher (text)
* @param filename - regex matcher (text)
*/
public void saveToFile(String html, String location, String filename)
{
File directory = new File(location);
if (!directory.exists())
directory.mkdirs();
String filepath = location + filename;
try {
FileWriter writer = new FileWriter(filepath);
writer.write(html);
writer.close();
}
catch(Exception e)
{
logger.error("Unable to write to file" + filepath + e);
}
}
/**
* Method used to sort a HashMap in descending order and print first maxValues elements
* @param hashMap - HashMap to be sorted
* @param maxValues - first maxValues elements to be printed
*/
public void sortHashMap_Save(HashMap<String, Integer> hashMap, int maxValues) {
try{
String output_directory = System.getProperty("user.dir") + "/output/";
new File(output_directory).mkdirs();
PrintWriter writer_top5 = new PrintWriter(new FileWriter(output_directory + "top5.txt"));
LinkedHashMap<String, Integer> reverseSortedMap = new LinkedHashMap<>();
hashMap.entrySet()
.stream()
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.forEachOrdered(x -> reverseSortedMap.put(x.getKey(), x.getValue()));
int iterator = 0;
logger.info("\nTop " + maxValues + " most watched watches:");
for(Map.Entry<String, Integer> entryMap : reverseSortedMap.entrySet()) {
if(iterator < maxValues) {
logger.info(entryMap.getValue() + " - " + entryMap.getKey());
writer_top5.println(entryMap.getValue() + " - " + entryMap.getKey());
writer_top5.flush();
iterator++;
} else {
break;
}
}
writer_top5.close();
}
catch(Exception e){
logger.error(e);
}
}
}
| [
"sureshlokiah@yahoo.com"
] | sureshlokiah@yahoo.com |
0a9f14efa0138d3f1ad86fdf532ac4bfed4cf3e4 | 7c5df1c9ab6f2ce63e9e3706773d23cd76d15359 | /FindPrimeNumbers.java | 5576288b3c074a407d2a9384bf00031f9b798320 | [] | no_license | KCMac89/Java-Programs | b7fb52849a187c459aeff26f8c8ce589622e42d3 | 9169f815547b33b82eefb3d87f858b952176107d | refs/heads/main | 2023-08-01T19:41:03.041434 | 2021-10-05T19:54:23 | 2021-10-05T19:54:23 | 413,959,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | import java.util.ArrayList;
public class FindPrimeNumbers {
public static void main(String[] args)
{
System.out.println(FindPrimes(1,100));
}
public static ArrayList<Integer> FindPrimes(int start, int end)
{
ArrayList<Integer> primes = new ArrayList<Integer>();
//for testing an array of numbers, i.e. 1,100
for (int n = start; n < end; n++)
{
boolean prime = true;
int i = 2;
while(i <= n/2)
{
//System.out.println("Checking if " + i + " is a multiple");
if (n % i == 0)
{
//System.out.println("Yes, we found a multiple: " + i);
prime = false;
break;
}
i++;
}
if (prime)
{
primes.add(n); // adds the prime numbers to primes array
}
}
return primes;
}
}
| [
"74109248+KCMac89@users.noreply.github.com"
] | 74109248+KCMac89@users.noreply.github.com |
55cd341b590ccb515f33940dc306d2097eeefd40 | 15885a44540c0b057726725b95e6bab94558a4ec | /app/src/main/java/com/timbau3285/myinventory/activity/AddItemActivity.java | d9a380660329217245a2fc174b6a533464619b2d | [] | no_license | PolymathWhiz/Inventory-App | 92424e3527bcfbb785f5867e9aa0921e2050a921 | 8110146d013f976659bf233f6d9f2cf6f7c225f3 | refs/heads/master | 2020-03-14T20:28:55.002366 | 2018-05-06T20:45:50 | 2018-05-06T20:45:50 | 131,777,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package com.timbau3285.myinventory.activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.timbau3285.myinventory.R;
public class AddItemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_item);
}
}
| [
"anyanwumiracle78@gmail.com"
] | anyanwumiracle78@gmail.com |
840f22bb6b8d38db69192793183d467c1360d8b9 | 4a431a6a3bd377f6d6c5b3dd2cf082164c584659 | /src/main/java/com/pollseed/detox/util/DateAddOn.java | 667441054eb58d046fd077f6ac40fcece7151abd | [
"MIT"
] | permissive | pollseed/detox | ef7bc4fbe7ab00036494a8bfe0b23e45a836fff0 | dbfb5b8efe98a0d9dc11c9537d616b3d1148d70b | refs/heads/master | 2021-01-10T04:36:33.818735 | 2016-04-03T12:38:02 | 2016-04-03T12:38:02 | 54,944,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,017 | java | package com.pollseed.detox.util;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Optional;
import org.joda.time.DateTime;
/**
* Date Add ON
*
* @author pollseed
*/
public class DateAddOn implements Serializable {
private static final long serialVersionUID = 1674067964754938905L;
private DateAddOn() {
}
/**
* now date of "Date" type
*
* @return now date
*/
public static Date now() {
return toDate(nowZonedDateTime());
}
/**
* now date of "DateTime" type
*
* @return now date
*/
public static DateTime nowDateTime() {
return toDateTime(nowZonedDateTime());
}
/**
* now date of "ZonedDateTime" type
*
* @return now date
*/
public static ZonedDateTime nowZonedDateTime() {
return ZonedDateTime.now();
}
/**
* Parse from "Date" type to "ZonedDateTime" type. If "Date" is NULL, use
* {@link DateAddOn#now()}.
*
* @param date "Date" type
* @return "ZonedDateTime" type
*/
public static ZonedDateTime toZonedDateTime(final Date date) {
return toOptionalOrElseNow(date).toInstant().atZone(ZoneId.systemDefault());
}
private static Date toOptionalOrElseNow(final Date date) {
return toOptionalOrElse(date, now());
}
private static <T> T toOptionalOrElse(final T t, final T orElse) {
return toOptional(t).orElse(orElse);
}
private static <T> Optional<T> toOptional(final T t) {
return Optional.ofNullable(t);
}
/**
* Parse from "DateTime" type to "ZonedDateTime" type.
*
* @param dateTime "DateTime" type
* @return "ZonedDateTime" type
*/
public static ZonedDateTime toZonedDateTime(final DateTime dateTime) {
return toOptionalOrElseNow(dateTime.toDate()).toInstant().atZone(ZoneId.systemDefault());
}
/**
* Parse from "ZonedDateTime" type to "Date" type.
*
* @param zonedDateTime "ZonedDateTime" type
* @return "Date" type
*/
public static Date toDate(final ZonedDateTime zonedDateTime) {
return Date.from(toOptionalOrElseNow(zonedDateTime).toInstant());
}
private static ZonedDateTime toOptionalOrElseNow(final ZonedDateTime zonedDateTime) {
return Optional.ofNullable(zonedDateTime).orElse(nowZonedDateTime());
}
/**
* Parse from "ZonedDateTime" type to "DateTime" type.
*
* @param zonedDateTime "ZonedDateTime" type
* @return "DateTime" type
*/
public static DateTime toDateTime(final ZonedDateTime zonedDateTime) {
return new DateTime(toDate(zonedDateTime));
}
/**
* Format from "Date" type to "String" type by {@link DateFormat}.
*
* @param date "Date" type
* @param dateFormat {@link DateFormat} return type
* @return parsed {@link DateFormat}
*/
public static String format(final Date date, final DateFormat dateFormat) {
return format(toZonedDateTime(date), dateFormat);
}
/**
* Format from "DateTime" type to "String" type by {@link DateFormat}.
*
* @param dateTime "DateTime" type
* @param dateFormat {@link DateFormat} return type
* @return parsed {@link DateFormat}
*/
public static String format(final DateTime dateTime, final DateFormat dateFormat) {
return format(toZonedDateTime(dateTime), dateFormat);
}
/**
* Format from "ZonedDateTime" type to "String" type by {@link DateFormat}.
*
* @param zonedDateTime "ZonedDateTime" type
* @param dateFormat {@link DateFormat} return type
* @return parsed {@link DateFormat}
*/
public static String format(final ZonedDateTime zonedDateTime, final DateFormat dateFormat) {
return toOptionalOrElseNow(zonedDateTime).format(toDateTimeFormatter(dateFormat));
}
private static DateTimeFormatter toDateTimeFormatter(final DateFormat dateFormat) {
return DateTimeFormatter.ofPattern(dateFormat.value);
}
/**
* Parse from "String" type to "LocalDate" type.
*
* @param str specific date string
* @param dateFormat "DateFormat" of specific date string
* @return "LocalDate" type
*/
public static LocalDate format(final String str, final DateFormat dateFormat) {
return toOptional(str).map(e -> LocalDate.parse(e, toDateTimeFormatter(dateFormat))).orElse(
null);
}
/**
* Format for parsing date.
*/
public enum DateFormat {
SLASH("yyyy/MM/dd"),
SLASH_HMS("yyyy/MM/dd HH:mm:ss"),
HYPHEN("yyyy-MM-dd"),
HYPHEN_HMS("yyyy-MM-dd HH:mm:ss"),
SPACE("yyyy MM dd"),
SPACE_HMS("yyyy MM dd HH:mm:ss"),;
String value;
DateFormat(final String value) {
this.value = value;
}
}
}
| [
"cb.so.devope+0001@gmail.com"
] | cb.so.devope+0001@gmail.com |
b81d28ad39f3aa9f9b630c7f32ab22507813d9ae | 3f9d4d90eab1584fbf4ae1af793581708c355968 | /ReservaAutomoveis-ejb/src/main/java/br/com/felipebatista/reservaautomoveis/util/ResponseException.java | 574cb9f643745d851a9628b53596f33fdabe8b6c | [] | no_license | felipefmb/reservaautomoveis | c5fcea1938f8d72d4fea19fe0c6eb888991ce146 | 88a345d089da61e41ff1459658053834214a6977 | refs/heads/master | 2020-03-11T00:18:58.021021 | 2018-04-16T00:46:17 | 2018-04-16T00:46:17 | 129,660,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,075 | java | package br.com.felipebatista.reservaautomoveis.util;
public class ResponseException {
private Integer statusCode;
private String type;
private String rootCause;
private String rootMessage;
public static class Builder {
private ResponseException builder;
public Builder() {
this.builder = new ResponseException();
}
public Builder(ResponseException builder) {
this.builder = builder;
}
public static Builder create() {
return new Builder();
}
public static Builder from(ResponseException builder) {
return new Builder(builder);
}
public Builder statusCode(Integer statusCode) {
this.builder.setStatusCode(statusCode);
return this;
}
public Builder type(String type) {
this.builder.setType(type);
return this;
}
public Builder rootCause(String rootCause) {
this.builder.setRootCause(rootCause);
return this;
}
public Builder rootMessage(String rootMessage) {
this.builder.setRootMessage(rootMessage);
return this;
}
public ResponseException build() {
return builder;
}
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRootCause() {
return rootCause;
}
public void setRootCause(String rootCause) {
this.rootCause = rootCause;
}
public String getRootMessage() {
return rootMessage;
}
public void setRootMessage(String rootMessage) {
this.rootMessage = rootMessage;
}
}
| [
"felipefmb@gmail.com"
] | felipefmb@gmail.com |
bfa77fa52512a7b2bc0d73532f90bdc236f8f9a0 | ae6c2d55aa8dd2b5243a2e0e7c8feeadeb640c78 | /simple.java | b6473ac0739e04c7a721f8283eebde302fbb4658 | [] | no_license | Nikhitha-madishetti3008/myproject | 856567c7cea9e2fc5bd41e88ffd7214ef05374af | 681dbd80985cd9d26ad04cbef59fe2460f5d36ca | refs/heads/master | 2020-08-11T14:31:56.108962 | 2019-10-12T13:39:48 | 2019-10-12T13:39:48 | 214,580,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | import java.util.*;
class dyna
{
public static void main(String args[])
{
int n,i;
Scanner sc=new Scanner(System.in);
System.out.print("enter the size of array elements");
n=sc.nextInt();
int a[]=new int[n];
for(i=0;i<=n;i++)
{
a[i]=1;
System.out.println(a[i]);
}
}
} | [
"Nikhithaladdu3008@gmail.com"
] | Nikhithaladdu3008@gmail.com |
267053f25fd514d4de348e62d442a327ada397e2 | 4eb90797cd49593b5b55cbe06959ae60ad3872df | /src/main/java/com/chest/currency/viewBean/CITCRAVendor.java | 639e873e4560749c00ec0ff52e54d2ae58e3cfbf | [] | no_license | sajjadamu/ICMC | 0dd390b0d81c77b2b04851b04fca5cc377fdf7f6 | 8a9d5c72849a01969e82d9fc2f76636ef7f321c2 | refs/heads/master | 2022-12-22T02:38:53.714104 | 2020-09-15T05:21:49 | 2020-09-15T05:21:49 | 247,260,923 | 0 | 0 | null | 2022-12-16T09:50:27 | 2020-03-14T11:08:21 | JavaScript | UTF-8 | Java | false | false | 2,967 | java | /*******************************************************************************
* /* Copyright (C) Indicsoft Technologies Pvt Ltd
* * All Rights Reserved.
*******************************************************************************/
package com.chest.currency.viewBean;
import java.util.Date;
public class CITCRAVendor {
private int id;
private String name;
private String typeOne;
private String typeTwo;
private String typeThree;
private String FPRName;
private String FPRNumber;
private String status;
private Date insertTime;
private Date updateTime;
private String updateBy;
private String insertBy;
private String reasonForDeletion;
private String approvalForDeletion;
private String zone;
private String region;
private String[] icmc;
public String getZone() {
return zone;
}
public void setZone(String zone) {
this.zone = zone;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String[] getIcmc() {
return icmc;
}
public void setIcmc(String[] icmc) {
this.icmc = icmc;
}
public String getReasonForDeletion() {
return reasonForDeletion;
}
public void setReasonForDeletion(String reasonForDeletion) {
this.reasonForDeletion = reasonForDeletion;
}
public String getApprovalForDeletion() {
return approvalForDeletion;
}
public void setApprovalForDeletion(String approvalForDeletion) {
this.approvalForDeletion = approvalForDeletion;
}
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;
}
public String getTypeOne() {
return typeOne;
}
public void setTypeOne(String typeOne) {
this.typeOne = typeOne;
}
public String getTypeTwo() {
return typeTwo;
}
public void setTypeTwo(String typeTwo) {
this.typeTwo = typeTwo;
}
public String getTypeThree() {
return typeThree;
}
public void setTypeThree(String typeThree) {
this.typeThree = typeThree;
}
public String getFPRName() {
return FPRName;
}
public void setFPRName(String fPRName) {
FPRName = fPRName;
}
public String getFPRNumber() {
return FPRNumber;
}
public void setFPRNumber(String fPRNumber) {
FPRNumber = fPRNumber;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getInsertTime() {
return insertTime;
}
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getInsertBy() {
return insertBy;
}
public void setInsertBy(String insertBy) {
this.insertBy = insertBy;
}
}
| [
"sajjad.hussain@indicsoft.com"
] | sajjad.hussain@indicsoft.com |
6ae97ed14a182fb0e0ed47baf854f8a9a4b7aaf1 | 9940c8c6954ea457c603ef5e1090ecadef02eca8 | /src/main/java/com/dolphinpay/server/rest_api/v1/orders_products/OrdersProductsController.java | fe17670e7f190be1c4dfd1d8ac95b1849e60a094 | [] | no_license | LucaBogdanPlatform/DolphinPayServer | c9fb1c864e333bec4e440c59932bbb1b2fdcbe8f | a08ebe5d7616e55fa2ed4b7ad07a4abd19dd90cf | refs/heads/master | 2020-05-17T09:21:54.935818 | 2019-09-23T16:00:58 | 2019-09-23T16:00:58 | 183,631,715 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package com.dolphinpay.server.rest_api.v1.orders_products;
import org.springframework.stereotype.Controller;
@Controller
public class OrdersProductsController {
}
| [
"vladislav.bogdan97@gmail.com"
] | vladislav.bogdan97@gmail.com |
c1534954b480b8152fbef9455eb7c673a86fa749 | e9b5e85f02c5a3fcdb636ead927c9fa5775bff6a | /LtiAirlines/src/main/java/com/lti/client/Main.java | d8ddc7e5ccbd27c9a9350eec75fc45b74dcbf723 | [] | no_license | Fayazzzzz/repo1 | b5093c62d2e006c03a8c35f6054df45b10b4cc21 | 2a8398ad78ba65d3c14dcf978150c2fdab67c29a | refs/heads/master | 2023-07-31T09:08:11.686677 | 2021-09-16T07:30:38 | 2021-09-16T07:30:38 | 406,629,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package com.lti.client;
import com.lti.model.Flight;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Flight flight = new Flight(1001, "A", "B");
System.out.println(flight.getFlightId()+" "+flight.getSource()+" "+flight.getDestination());
}
public static int add(int n1, int n2) {return n1+n2;}
public static boolean compare(int n1,int n2)
{
if(n1==n2){return true;}
else return false;
}
}
| [
"fmfayaz24@gmail.com"
] | fmfayaz24@gmail.com |
49d50879ae1ce1589aff136160b51ac8091c5c1c | 65615e71d879517131f4d3fb005b97aea22ea746 | /java/real-projects/word/web-app/web-app-common/web-app-common-war/src/test/java/com/mtsmda/word/test/config/TestApplicationContext.java | ecd523e3054b49aff2d217087be76d2b5213e515 | [] | no_license | akbars95/common_250117 | e1b151ec4973f8aedf1c8e71cb35febee7bbb4f0 | 9709cfa9b809ef12480e08646bcd48b9e2bf2225 | refs/heads/master | 2021-01-11T16:07:39.245311 | 2017-03-31T08:30:49 | 2017-03-31T08:30:49 | 80,009,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | package com.mtsmda.word.test.config;
import com.mtsmda.word.config.other.DatabaseConfiguration;
import org.junit.runner.RunWith;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* Created by dminzat on 3/14/2017.
*/
@EnableTransactionManagement
@TestPropertySource("classpath:database.properties")
@ComponentScan(basePackages = {"com.mtsmda.word.nonConfig"})
@Import(value = DatabaseConfiguration.class)
public class TestApplicationContext {
} | [
"mynzat.dmitrii@gmail.com"
] | mynzat.dmitrii@gmail.com |
a6544205196c409a45d0b3dfb82a4dad23de8f4a | 4ec621cc403be1b25aece91dfdf7dde6a5e79009 | /src/Round362/_1.java | 4ec01463a5443ba76a2ecbd4a364b37c01c89121 | [] | no_license | qinzhaokun/Algorithm | ac33dcfb142d36e86a22764247f44af1ca13c869 | 460bb9a533898c93e0b3aeed54ffb9e0caea4272 | refs/heads/master | 2020-05-30T07:18:52.636535 | 2016-09-03T02:23:43 | 2016-09-03T02:23:43 | 59,402,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package Round362;
import java.util.Scanner;
/**
* Created by KUN on 2016/7/15.
*/
public class _1 {
public static void main(String [] args){
Scanner scanner = new Scanner(System.in);
while(scanner.hasNext()){
int s = scanner.nextInt();
int t = scanner.nextInt();
int x = scanner.nextInt();
if(x < s) System.out.println("NO");
else if(x == s) System.out.println("YES");
else if(x < s+t) System.out.println("NO");
else{
int a = (x-s)%t;
if(a == 0 || a == 1) System.out.println("YES");
else System.out.println("NO");
}
}
}
}
| [
"qinzhaokun@qq.com"
] | qinzhaokun@qq.com |
165d4391be4a40b1523c44b637f9c162bb664ee0 | f74ae709dc68d482e6e8a41c3e1dc4f0727c833f | /kevin/src/approach_2/RunGame2.java | 489dd1577a92cc6cacedd3f8f9833de52c39f247 | [] | no_license | jamesjaccoma/level2 | bfa2ae68d650ff0dcd3e86d29e80247c7d770ce4 | 36b67bcb29d5c8e3996b91b9de4ef7cdfbd852bb | refs/heads/master | 2021-01-17T10:33:19.227409 | 2016-06-29T18:40:37 | 2016-06-29T18:40:37 | 58,560,341 | 0 | 0 | null | 2016-05-13T16:46:27 | 2016-05-11T16:07:36 | Java | UTF-8 | Java | false | false | 832 | java | package approach_2;
/**
* Created by ktabb on 5/24/16.
*/
public class RunGame2 {
public static void main(String[] args) {
String[][] locations = new String[2][2];
locations[0][0] = "Farm";
locations[0][1] = "Town";
locations[1][0] = "Cabin";
locations[1][1] = "Bar";
Game game = new Game(locations);
game.map[0][0].setDescription("Dozens of men are tending the vast fields of corn."); // Farm
game.map[0][1].setDescription("The town is bustling with drunk people stumbling out of bars left and right."); // Town
game.map[1][0].setDescription("The cabin looks abandoned. It is old and full of cobwebs."); // Cabin
game.map[1][1].setDescription("The bar is loud and rowdy. People are drunk and fighting."); // Bar
game.Run();
}
}
| [
"K128kevin@gmail.com"
] | K128kevin@gmail.com |
0e3933e2e90ebd92ac2d45d6b4d47371c70fbf34 | 41ffd24129794d20e3746910624968e9981a346d | /app/src/main/java/com/example/youxihouzainali/zhihu/CollectionAdapter.java | 49501f1ae14508ce5fdb855becb6288682478f89 | [] | no_license | youxiho1/ZhiHu | e763bae3010447ff209fb58b5c779ce102d2a07e | 5e10092224b8a26f72c17235f75ed2d30737726f | refs/heads/master | 2021-08-30T06:28:09.044764 | 2017-12-16T13:36:24 | 2017-12-16T13:36:24 | 112,584,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,319 | java | package com.example.youxihouzainali.zhihu;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.util.List;
/**
* Created by youxihouzainali on 2017/12/10.
*/
public class CollectionAdapter extends RecyclerView.Adapter<CollectionAdapter.ViewHolder> {
private List<Likes> mCollectionList;
private Context mContext;
private String u = null;
private MyDatabaseHelper dbHelper;
static class ViewHolder extends RecyclerView.ViewHolder {
View collectionView;
ImageView collectionImage;
TextView collectionName;
TextView collectionDescription;
Button Collection;
public ViewHolder(View view) {
super(view);
collectionView = view;
collectionImage = (ImageView) view.findViewById(R.id.collection_image);
collectionDescription = (TextView) view.findViewById(R.id.collection_description);
collectionName = (TextView) view.findViewById(R.id.collection_name);
Collection = (Button) view.findViewById(R.id.collection);
}
}
public CollectionAdapter(List<Likes> collectionList, String username) {
mCollectionList = collectionList;
u = username;
}
@Override
public CollectionAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.collection_item, parent, false);
mContext = parent.getContext();
dbHelper = new MyDatabaseHelper(mContext, "Zhihu.db", null, 1);
final SQLiteDatabase db = dbHelper.getWritableDatabase();
final CollectionAdapter.ViewHolder holder = new CollectionAdapter.ViewHolder(view);
holder.collectionView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = holder.getAdapterPosition();
Likes collection = mCollectionList.get(position);
if(collection.getFlag().equals("1")) {
Intent intent = new Intent(mContext, DetailActivity.class);
intent.putExtra("extra_url", collection.getUrl());
intent.putExtra("extra_data", u);
mContext.startActivity(intent);
}
else {
Intent intent = new Intent(mContext, HotDetailActivity.class);
intent.putExtra("extra_url", collection.getUrl());
intent.putExtra("extra_data", u);
intent.putExtra("id",collection.getNewsid());
mContext.startActivity(intent);
}
}
});
final Button btn_collection = (Button) view.findViewById(R.id.collection);
btn_collection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = holder.getAdapterPosition();
Likes collection = mCollectionList.get(position);
String uurl = collection.getUrl();
db.delete("Collection", "username=? and url=?", new String[] {u, uurl});
Intent intent =new Intent(mContext, CollectionActivity.class);
intent.putExtra("extra_data", u);
mContext.startActivity(intent);
}
});
return holder;
}
@Override
public void onBindViewHolder(CollectionAdapter.ViewHolder holder, int position) {
Likes collection = mCollectionList.get(position);
holder.collectionDescription.setText(collection.getDescription());
holder.collectionName.setText(collection.getName());
String image = collection.getThumbnail();
Glide.with(mContext).load(image).into(holder.collectionImage);
}
@Override
public int getItemCount() {
return mCollectionList.size();
}
}
| [
"750440234@qq.com"
] | 750440234@qq.com |
175186c1bf0bfbcfa413ec43efb2ce4f3eac48a9 | 7708eed9cf49079708a62400641651b12bd3c135 | /code/project/src/main/java/sd/project/business/services/AdminService.java | 149c99c5f8c42799647e675a0a8bd13eba5d2064 | [] | no_license | UTCNCSSoftwareDesignTudor2018/sd-project-2018-boroshanniel | 987719e6e1398496ff77130d6f1781d91d2aa0bf | 62a61cef4a441dec6ae6313a83daf7527ee9d719 | refs/heads/master | 2021-04-09T14:07:37.847938 | 2018-05-27T11:01:41 | 2018-05-27T11:01:41 | 125,519,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package sd.project.business.services;
import org.springframework.stereotype.Service;
import sd.project.persistence.entity.Admin;
import sd.project.persistence.repository.AdminRepo;
import javax.inject.Inject;
@Service
public class AdminService {
@Inject
AdminRepo adminRepo;
public Admin registerAdmin(Admin adminToRegister){
return adminRepo.save(adminToRegister);
}
public Admin updateAdmin(Admin adminToUpdate){
return adminRepo.save(adminToUpdate);
}
}
| [
"hanniel_boros@yahoo.com"
] | hanniel_boros@yahoo.com |
cbf22173a665e19b368c0251fe0b974c61e14105 | e925786f9aaa99fff1f80c9acbb1749d8f00e78e | /app/src/main/java/com/e/notepad/NotesAdapter.java | 7fe41e1eadd359e5cb99fc133341172b33597c53 | [] | no_license | priti78891/RoomDatabase_NotePad | 3650689abe84a538350786a2e7ee6e40fb43e6fd | 196555afbe341f7bd61a7d69b0173dac4010259d | refs/heads/main | 2023-05-23T18:07:43.961649 | 2021-07-02T09:11:53 | 2021-07-02T09:11:53 | 382,290,696 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,005 | java | package com.e.notepad;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class NotesAdapter extends RecyclerView.Adapter<NotesAdapter.BeanHolder> {
private List<Note> List;
private Context context;
private LayoutInflater LayoutInflater;
private OnNoteItemClick onNoteItemClick;
public NotesAdapter(List<Note> list,Context context) {
LayoutInflater = android.view.LayoutInflater.from(context);
this.List = list;
this.context=context;
this.onNoteItemClick = (OnNoteItemClick)context;
}
public interface OnNoteItemClick
{
void onNoteClick(int pos);
}
@NonNull
@Override
public BeanHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.inflate(R.layout.note_list_item,parent,false);
return new BeanHolder(view);
}
@Override
public void onBindViewHolder(@NonNull NotesAdapter.BeanHolder holder, int position) {
holder.textViewTitle.setText(List.get(position).getTitle());
holder.textViewContent.setText(List.get(position).getContent());
}
@Override
public int getItemCount() {
return List.size();
}
public class BeanHolder extends RecyclerView.ViewHolder implements View.OnClickListener
{ TextView textViewContent;
TextView textViewTitle;
public BeanHolder(@NonNull View itemView) {
super(itemView);
itemView.setOnClickListener(this);
textViewContent=itemView.findViewById(R.id.item_text);
textViewTitle=itemView.findViewById(R.id.tv_title);
}
@Override
public void onClick(View view) {
onNoteItemClick.onNoteClick(getAbsoluteAdapterPosition());
}
}
}
| [
"sahp78891@gmail.com"
] | sahp78891@gmail.com |
6a0b9d546365e68e5cfd246e72bcfb928e5a30c6 | 47c281458a14c58ad07f64b63861780fc95e0c62 | /modules/kernel/src/main/java/com/thegoate/logging/BleatFactory.java | 2046201732299884219eeb6edf7a54edabd3b5b1 | [
"MIT"
] | permissive | brian30040/GoaTE | d267e5290d0f913bad38dff18cd5a3b42d5e7529 | 3deab75525075df523938ef5672d08beb6e332a7 | refs/heads/master | 2021-12-03T14:23:02.248714 | 2021-08-26T02:24:07 | 2021-08-26T02:24:07 | 172,131,737 | 0 | 0 | null | 2021-08-20T21:50:37 | 2019-02-22T20:42:13 | Java | UTF-8 | Java | false | false | 2,909 | java | /*
* Copyright (c) 2017. Eric Angeli
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software
* and associated documentation files (the "Software"),
* to deal in the Software without restriction,
* including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission
* notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package com.thegoate.logging;
import com.thegoate.annotations.AnnotationFactory;
import com.thegoate.reflection.GoateReflection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
/**
* Simple factory class to initialize the logger.
* Assumes only one none default implementation of BleatBox, otherwise the first none default BleatBox is returned.
* If no none default BleatBox is found, the default will be returned.
* Created by Eric Angeli on 6/5/2017.
*/
public class BleatFactory {
protected static Logger LOG = LoggerFactory.getLogger(BleatFactory.class);//don't want to use self just in case.
public static BleatBox getLogger(Class logFromClass){
BleatBox bb = null;
AnnotationFactory af = new AnnotationFactory().doDefault().annotatedWith(Bleat.class).buildDirectory();
Map<String, Class> dir = af.getDirectory(Bleat.class.getCanonicalName());
Class def = dir.get("default");
Class logger = null;
for(String c:dir.keySet()){
if(def!=null&&!def.equals(dir.get(c))){
logger = dir.get(c);
break;
}
}
if(logger==null){
logger = def;
}
if(logger!=null){
GoateReflection gr = new GoateReflection();
Object[] args = {logFromClass};
try {
bb = (BleatBox)gr.findConstructor(logger.getConstructors(), args).newInstance(args);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
LOG.error("Failed initializing the logger: " + e.getMessage(), e);
}
}
return bb;
}
}
| [
"eric.angeli@onedatascan.com"
] | eric.angeli@onedatascan.com |
fc66e5e67cb574242d74166de90375b28783b1a1 | 1d9b3b2c22201c1e4873f101deb7735cb3e1a0d9 | /src/main/java/com/koreait/gallery/command/LeaveCommand.java | efd8fe86ba16290f0db8a66a0a1212a02821b293 | [] | no_license | kunwung8326/Test | 26ed9b77dd0ee8a3a7e6ec10daf43c0c0d7abbab | d6206747040a0396e36b494f47dc6b50634f3fd7 | refs/heads/main | 2023-06-11T06:40:36.361211 | 2021-07-04T14:39:29 | 2021-07-04T14:39:29 | 377,488,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,818 | java | package com.koreait.gallery.command;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.ibatis.session.SqlSession;
import org.springframework.ui.Model;
import com.koreait.gallery.dao.GalleryDAO;
import com.koreait.gallery.dto.GalleryMember;
public class LeaveCommand implements GalleryCommand {
@Override
public void execute(SqlSession Session, Model model) {
Map<String, Object> map = model.asMap();
HttpSession session = (HttpSession) map.get("session");
HttpServletResponse response = (HttpServletResponse) map.get("response");
long no = ((GalleryMember)session.getAttribute("loginUser")).getNo();
GalleryDAO galleryDAO = Session.getMapper(GalleryDAO.class);
int count = galleryDAO.leave(no);
if(count != 0) {
try {
response.setCharacterEncoding("text/html; charset=utf-8");
response.getWriter().println("<script>");
response.getWriter().println("alert('삭제 되었습니다.')");
response.getWriter().println("location.href='loginPage.do'");
response.getWriter().println("</script>");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
session.invalidate();
}else {
try {
response.setCharacterEncoding("text/html; charset=utf-8");
response.getWriter().println("<script>");
response.getWriter().println("alert('삭제 되지 않았습니다.')");
response.getWriter().println("location.href='selectGalleryList.do'");
response.getWriter().println("</script>");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"kunwung8326@naver.com"
] | kunwung8326@naver.com |
9d8c8cff0a7aaea5996e5ce97b0fa231219e59a3 | 9cd1326d33c89de5e651430bce0abbf25141ffb5 | /xDada/src/com/saurabh/dada/iq/impl/multithreading/Thread_SynchronizedMethodCallsNonSynchronized.java | c26b903c4c3c00d1e879a1e10113ae2fd3c250ce | [] | no_license | shagg2010/XplorationNew2019 | 3a2b86a948d7aaeaebbd477055be2ee78fba00f4 | aec7c600e2a9513fb1afd65b95cad87ce3c926cc | refs/heads/master | 2023-04-22T22:53:20.437295 | 2021-05-08T04:34:02 | 2021-05-08T04:34:02 | 365,418,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,484 | java | package com.saurabh.dada.iq.impl;
import java.util.concurrent.TimeUnit;
public class Thread_SynchronizedMethodCallsNonSynchronized {
public static void main(String[] args) {
SomeWorkClass someWorkClass = new SomeWorkClass();
SomeTask st = new SomeTask(someWorkClass);
Thread t1 = new Thread(st, "t1");
Thread t2 = new Thread(st, "t2");
Thread t3 = new Thread(st, "t3");
Thread t4 = new Thread(st, "t4");
Thread t5 = new Thread(st, "t5");
t1.start();t2.start();t3.start();t4.start();t5.start();
}
}
class SomeWorkClass{
public synchronized void methodOne() throws InterruptedException {
System.out.println("Before calling methodTwo\t" + "Thread-name: " + Thread.currentThread().getName());
TimeUnit.MILLISECONDS.sleep(10);
methodTwo();
TimeUnit.MILLISECONDS.sleep(10);
System.out.println("After calling methodTwo\t\t" + "Thread-name: " + Thread.currentThread().getName());
}
public void methodTwo() throws InterruptedException {
TimeUnit.MILLISECONDS.sleep(10);
System.out.println("Inside methodTwo\t\t" + "Thread-name: " + Thread.currentThread().getName());
TimeUnit.MILLISECONDS.sleep(10);
}
}
class SomeTask implements Runnable{
private SomeWorkClass someWorkClass;
public SomeTask(SomeWorkClass someWorkClass) {
this.someWorkClass = someWorkClass;
}
@Override
public void run() {
try {
someWorkClass.methodOne();
someWorkClass.methodTwo();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| [
"shagg2006@gmail.com"
] | shagg2006@gmail.com |
63545d21ae19acd1fcbdf579bc792622cdc1aa6a | 7797b8e5ca28df0484384222df9f48a97a6cd4f1 | /app/src/main/java/com/dev/smartmonitor/business/aplicativo/analise/model/AplicativoAnalise.java | 402ed1eed34e90346657b1c410ce20e0588028a6 | [] | no_license | GabrielMoro666/SmartMonitor | 4d56514c847017e5ba07d8aa92b6e5b83a53b19c | 96fc96b3038d4603979bc8d7f8d87d0232a31da4 | refs/heads/master | 2022-11-14T09:42:00.324223 | 2020-07-02T02:34:03 | 2020-07-02T02:34:03 | 265,979,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 832 | java | package com.dev.smartmonitor.business.aplicativo.analise.model;
import com.dev.smartmonitor.persistence.dao.model.Aplicativo;
public class AplicativoAnalise {
private Aplicativo aplicativo;
private boolean verificado;
public AplicativoAnalise(){
this.aplicativo = null;
this.verificado = false;
}
public AplicativoAnalise(Aplicativo aplicativo, boolean verificado){
this.aplicativo = aplicativo;
this.verificado = verificado;
}
public void setAplicativo(Aplicativo aplicativo) {
this.aplicativo = aplicativo;
}
public Aplicativo getAplicativo() {
return aplicativo;
}
public void setVerificado(boolean verificado) {
this.verificado = verificado;
}
public boolean isVerificado() {
return verificado;
}
}
| [
"gabrielmoro2009@hotmail.com"
] | gabrielmoro2009@hotmail.com |
5bbce484814a95974d025a6cd6b417e2ee19ac2d | 03ad72402dbe07c0a35040c20a51b858aa258858 | /src/com/bluedotinnovation/application/UpdateApplicationWithWebhook.java | 45c56df4c23e1548099193336f20775d9b834f99 | [] | no_license | patrickbluedot/PublicAPI-Client-Java | 67b36b41c6c6932ff3a863ac463f47ea43170a2d | 896fe0d9825b52c9cdce8f04d4a0ede2facb64a4 | refs/heads/master | 2020-04-05T02:42:49.150936 | 2017-02-27T04:07:57 | 2017-02-27T04:07:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,311 | java | package com.bluedotinnovation.application;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import com.bluedotinnovation.common.BDCommon;
/**
* @author Bluedot Innovation
* Copyright (c) 2016 Bluedot Innovation. All rights reserved.
* Update Application with Webhook client demonstrates updating existing an application which has webhooks enabled for it to your Bluedot backend
* using Apache HTTP client and JSON Simple libraries.
*/
public class UpdateApplicationWithWebhook extends BDCommon {
/**
* @param args
* @throws IOException
* @throws ParseException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
*/
public static void main(String[] args) throws IOException, ParseException, KeyManagementException, NoSuchAlgorithmException {
String bdCustomerApiKey = "86577370-7b91-11e4-bcb7-a0481cdc3311"; //This key is generated by Bluedot Point Access UI when your account is created.
String bdApplicationId = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This ID is retrieved through the GET Applications call
String bdRestUrl = "https://api.bluedotinnovation.com/1/applications";
CloseableHttpClient httpRestClient = HttpClients.custom().setSSLSocketFactory(getSSLContextFactory()).build();
String applicationWithWebhook =
"{" +
"\"security\": {" +
"\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
"}," +
"\"content\": { " +
"\"application\" : {" +
/*This is the id of the application as opposed to the api key.
* This is returned when the application/getAll is called*/
"\"applicationId\":" + "\"" + bdApplicationId + "\"," +
/*Time in Hour:Minute format.*/
"\"nextRuleUpdateIntervalFormatted\": \"00:10\"," +
"\"webhook\": {" +
/*The URL of the server where the webhooks will be received.*/
"\"url\": \"https://api.campusapp.com/webhook/checkinreceiver\"," +
"\"enabled\" : true," +
/*The Security Token Key is the name of the field to be sent in the POST request header.*/
"\"securityTokenKey\" : \"authToken\"," +
/*The Security Token Value field is value of the Security Token Key field sent in the POST request header.*/
"\"securityTokenValue\" : \"f2f7a58c-f0d5-498c-9bad-acbc89923dc5\"" +
"}"+
"}" +
"}" +
"}";
JSONObject bdApplicationJSONObject;
JSONParser parser = new JSONParser();
bdApplicationJSONObject = (JSONObject) parser.parse(applicationWithWebhook);
HttpPost postRequest = new HttpPost(bdRestUrl);
postRequest.addHeader("content-type", "application/json");
postRequest.setEntity(new StringEntity(bdApplicationJSONObject.toJSONString(), Charset.defaultCharset()));
HttpResponse response = httpRestClient.execute(postRequest);
if (response.getStatusLine().getStatusCode() == 200) {
System.out.println("Application was successfully updated.");
InputStream inputStream = response.getEntity().getContent();
byte[] bytes = readStream(inputStream);
String resultString = new String(bytes); //json result
JSONObject jsonResult = (JSONObject) parser.parse(resultString);
System.out.println("Application ID for your application is : " + jsonResult.get("applicationId"));
} else {
InputStream inputStream = response.getEntity().getContent();
byte[] bytes = readStream(inputStream);
String resultString = new String(bytes); //json error result
System.out.println(resultString);
}
}
}
| [
"melwinchiramel@gmail.com"
] | melwinchiramel@gmail.com |
68ab0ab31bcaa2ae9bd300c720b81905e93af62e | 47119d527d55e9adcb08a3a5834afe9a82dd2254 | /internalLibraries/models/src/main/java/com/emc/vipr/model/keystore/TruststoreSettingsChanges.java | 6685411c331696507c81813abd5d516b5043e413 | [] | no_license | chrisdail/coprhd-controller | 1c3ddf91bb840c66e4ece3d4b336a6df421b43e4 | 38a063c5620135a49013aae5e078aeb6534a5480 | refs/heads/master | 2020-12-03T10:42:22.520837 | 2015-06-08T15:24:36 | 2015-06-08T15:24:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | /**
* Copyright 2015 EMC Corporation
* All Rights Reserved
*/
/**
* Copyright (c) 2014 EMC Corporation
* All Rights Reserved
*
* This software contains the intellectual property of EMC Corporation
* or is licensed to EMC Corporation from third parties. Use of this
* software and the intellectual property contained therein is expressly
* limited to the terms and conditions of the License Agreement under which
* it is provided by or on behalf of EMC.
*/
package com.emc.vipr.model.keystore;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* represents the changes to be made to the settings of the truststore
*/
@XmlRootElement(name = "truststore_settings_changes")
public class TruststoreSettingsChanges {
private Boolean acceptAllCertificates;
@XmlElement(name = "accept_all_certificates")
public Boolean getAcceptAllCertificates() {
return acceptAllCertificates;
}
public void setAcceptAllCertificates(Boolean acceptAllCertificates) {
this.acceptAllCertificates = acceptAllCertificates;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("acceptAllCertificates = ");
builder.append(acceptAllCertificates);
return builder.toString();
}
}
| [
"review-coprhd@coprhd.org"
] | review-coprhd@coprhd.org |
06ebd818d07468aeae235464affc25f31c62cb05 | d3142950fdde40dfc8c70bc5271a059b5cc7bfcb | /src/main/java/com/spring/app/repository/UserRepository.java | f4eeac9455a4dbd9fe26864b576fc692b89094b9 | [] | no_license | BulkSecurityGeneratorProject/jTrace | d610f794d1b68b00eec35b38972648f3e7865bdb | f5f81ee1a1713eca648cf0e988c93931a994a146 | refs/heads/master | 2022-12-16T05:55:16.414280 | 2015-07-20T07:27:25 | 2015-07-20T07:27:25 | 296,574,801 | 0 | 0 | null | 2020-09-18T09:23:51 | 2020-09-18T09:23:50 | null | UTF-8 | Java | false | false | 638 | java | package com.spring.app.repository;
import com.spring.app.domain.User;
import org.joda.time.DateTime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* Spring Data JPA repository for the User entity.
*/
public interface UserRepository extends JpaRepository<User, Long> {
User findOneByActivationKey(String activationKey);
List<User> findAllByActivatedIsFalseAndCreatedDateBefore(DateTime dateTime);
User findOneByResetKey(String resetKey);
User findOneByLogin(String login);
User findOneByEmail(String email);
}
| [
"kamleshtayade@gmail.com"
] | kamleshtayade@gmail.com |
3c2c79a8efb6005f0e60d014a5123169dfed020d | 6f37328f060ef2a241d54b8cc949d7526a146a94 | /src/pkgAgenda_Virtual/frmModificarContactos.java | a588761dc1b7a7845284a90f928e763b6c2a8e3e | [] | no_license | icarloscornejo/2014_AgendaVirtual | 6b204027ae5670a4ad0206f05e7e60667d9c1822 | 0c64dfbb93502704a781f21157cbf8563c33dbc5 | refs/heads/master | 2020-06-17T04:12:47.365503 | 2016-11-29T04:21:04 | 2016-11-29T04:21:04 | 75,042,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,098 | 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 pkgAgenda_Virtual;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
/**
*
* @author Carlos
*/
public class frmModificarContactos extends javax.swing.JDialog {
/**
* Creates new form frmModificarContactos
*/
public frmModificarContactos(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.setLocationRelativeTo(null);
buscarusuario();
ImageIcon i = new ImageIcon(foto);
Image i2 = i.getImage().getScaledInstance(112, 151, Image.SCALE_SMOOTH);
Icon i3 = new ImageIcon(i2);
lblContacto.setIcon(i3);
File f = new File(foto);
try {
imagenaguardar = ImageIO.read(f.toURL());
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, ex.toString());
}
}
String foto = "";
ResultSet rs;
public void buscarusuario(){
try{
rs = H.Buscar("SELECT foto_contacto, cod_contacto, nom_contacto, ape_contacto, sex_contacto, fecnac_contacto, correo_contacto, tel1_contacto, tel2_contacto FROM Contactos WHERE nom_contacto = '"+frmVerContactos.nombremod+"' AND ape_contacto = '"+frmVerContactos.apellidomod+"'");
while(rs.next()){
foto = rs.getString(1);
cod_contacto = rs.getInt(2);
String nom, ape, sex, fecnac, correo, tel1, tel2;
nom = H.desencriptar(rs.getString(3));
ape = H.desencriptar(rs.getString(4));
sex = H.desencriptar(rs.getString(5));
fecnac = rs.getString(6);
correo = H.desencriptar(rs.getString(7));
tel1 = rs.getString(8);
tel2 = rs.getString(9);
txtNombre.setText(nom);
txtApellido.setText(ape);
if("Hombre".equals(sex)){
cmbSexo.setSelectedIndex(0);
}else{
cmbSexo.setSelectedIndex(1);
}
int dia, mes, año;
dia = Integer.parseInt(fecnac.substring(0, 2));
mes = Integer.parseInt(fecnac.substring(3, 5));
año = Integer.parseInt(fecnac.substring(6, 10));
cmbDia.setSelectedIndex(dia -1);
cmbMes.setSelectedIndex(mes -1);
cmbAño.setSelectedIndex(año -1990);
txtCorreo.setText(correo);
txtTelefono1.setText(tel1);
txtTelefono2.setText(tel2);
}
}catch(SQLException ex){
JOptionPane.showMessageDialog(null, ex.toString());
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
txtNombre = new javax.swing.JTextField();
lblTitulo7 = new javax.swing.JLabel();
txtCorreo = new javax.swing.JTextField();
txtTelefono2 = new javax.swing.JTextField();
txtApellido = new javax.swing.JTextField();
lblTitulo4 = new javax.swing.JLabel();
lblTitulo1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
lblContacto = new javax.swing.JLabel();
btnAgregar = new javax.swing.JButton();
cmbMes = new javax.swing.JComboBox();
lblTitulo2 = new javax.swing.JLabel();
lblTitulo5 = new javax.swing.JLabel();
cmbSexo = new javax.swing.JComboBox();
cmbDia = new javax.swing.JComboBox();
lblTitulo3 = new javax.swing.JLabel();
cmbAño = new javax.swing.JComboBox();
lblTitulo6 = new javax.swing.JLabel();
btnModificarContacto = new javax.swing.JButton();
btnCancelar = new javax.swing.JButton();
txtTelefono1 = new javax.swing.JTextField();
mbnAgregarActs = new javax.swing.JMenuBar(){
public void paintComponent(Graphics g){
g.drawImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/pkgAgenda_Virtual/Images/Toolbar.png")),0,0,this);
}
};
jMenu2 = new javax.swing.JMenu();
jMenu3 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setAlwaysOnTop(true);
setUndecorated(true);
txtNombre.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
txtNombre.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNombreKeyTyped(evt);
}
});
lblTitulo7.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo7.setText("Telefono 2:");
txtCorreo.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
txtTelefono2.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
txtTelefono2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtTelefono2KeyTyped(evt);
}
});
txtApellido.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
txtApellido.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtApellidoKeyTyped(evt);
}
});
lblTitulo4.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo4.setText("Telefono 1:");
lblTitulo1.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo1.setText("Nombre:");
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
btnAgregar.setText("Agregar");
btnAgregar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAgregarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(btnAgregar)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblContacto, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblContacto, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnAgregar)
.addContainerGap())
);
cmbMes.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
cmbMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
cmbMes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmbMesActionPerformed(evt);
}
});
lblTitulo2.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo2.setText("Apellido:");
lblTitulo5.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo5.setText("Correo Electronico:");
cmbSexo.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
cmbSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hombre", "Mujer" }));
cmbDia.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
cmbDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
lblTitulo3.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo3.setText("Sexo:");
cmbAño.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
cmbAño.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000" }));
lblTitulo6.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
lblTitulo6.setText("Fecha de Nacimiento:");
btnModificarContacto.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
btnModificarContacto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pkgAgenda_Virtual/Images/Editar.png"))); // NOI18N
btnModificarContacto.setText("Modificar");
btnModificarContacto.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnModificarContactoActionPerformed(evt);
}
});
btnCancelar.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pkgAgenda_Virtual/Images/Cancelar.png"))); // NOI18N
btnCancelar.setText("Cancelar");
btnCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelarActionPerformed(evt);
}
});
txtTelefono1.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
txtTelefono1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtTelefono1KeyTyped(evt);
}
});
mbnAgregarActs.setBorder(null);
mbnAgregarActs.setPreferredSize(new Dimension(this.getWidth(), 24));
mbnAgregarActs.setMinimumSize(new Dimension(this.getWidth(), 24));
mbnAgregarActs.setMaximumSize(new Dimension(this.getWidth(), 24));
mbnAgregarActs.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
mbnAgregarActsMousePressed(evt);
}
});
mbnAgregarActs.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
mbnAgregarActsMouseDragged(evt);
}
});
jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pkgAgenda_Virtual/Images/Cerrar.png"))); // NOI18N
jMenu2.addMenuListener(new javax.swing.event.MenuListener() {
public void menuCanceled(javax.swing.event.MenuEvent evt) {
}
public void menuDeselected(javax.swing.event.MenuEvent evt) {
}
public void menuSelected(javax.swing.event.MenuEvent evt) {
jMenu2MenuSelected(evt);
}
});
jMenu2.addMenuKeyListener(new javax.swing.event.MenuKeyListener() {
public void menuKeyPressed(javax.swing.event.MenuKeyEvent evt) {
jMenu2MenuKeyPressed(evt);
}
public void menuKeyReleased(javax.swing.event.MenuKeyEvent evt) {
}
public void menuKeyTyped(javax.swing.event.MenuKeyEvent evt) {
}
});
mbnAgregarActs.add(jMenu2);
jMenu3.setBackground(new java.awt.Color(255, 255, 255));
jMenu3.setText("Modificar Contactos");
jMenu3.setEnabled(false);
jMenu3.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
mbnAgregarActs.add(jMenu3);
setJMenuBar(mbnAgregarActs);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(lblTitulo1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblTitulo2)
.addComponent(lblTitulo3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cmbSexo, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtApellido, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))))
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(lblTitulo6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbDia, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(cmbMes, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(cmbAño, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblTitulo5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtCorreo))))
.addGroup(layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnModificarContacto, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(64, 64, 64)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(lblTitulo7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtTelefono2))
.addGroup(layout.createSequentialGroup()
.addComponent(lblTitulo4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtTelefono1, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(46, 46, 46)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblTitulo1)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblTitulo2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cmbSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblTitulo3))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblTitulo6)
.addComponent(cmbDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblTitulo5)
.addComponent(txtCorreo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblTitulo4)
.addComponent(txtTelefono1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblTitulo7)
.addComponent(txtTelefono2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnModificarContacto)
.addComponent(btnCancelar))
.addGap(30, 30, 30))
);
pack();
}// </editor-fold>//GEN-END:initComponents
Helper H = new Helper();
BufferedImage imagenaguardar;
String UrlFoto = "";
int cod_contacto = -1;
public void Buscador() throws IOException{
JFileChooser Buscador = new JFileChooser();
Buscador.showOpenDialog(null);
File archivo = Buscador.getSelectedFile();
imagenaguardar = ImageIO.read(Buscador.getSelectedFile().toURL());
String ruta = archivo.getPath();
ImageIcon imagen = new ImageIcon(ruta);
Image img = imagen.getImage().getScaledInstance(lblContacto.getWidth(), lblContacto.getHeight(), Image.SCALE_SMOOTH);
Icon icono = new ImageIcon(img);
lblContacto.setIcon(icono);
}
public void GuardarFoto(int cod_contacto){
try{
File archivoaborrar = new File(foto);
archivoaborrar.delete();
File archivoaguardar = new File("src/pkgAgenda_Virtual/Images/Contactos/"+cod_contacto+".png");
UrlFoto = archivoaguardar.getPath();
ImageIO.write(imagenaguardar, "png", archivoaguardar);
}catch(IOException ex){
JOptionPane.showMessageDialog(null,ex.toString());
}
}
private void jMenu2MenuSelected(javax.swing.event.MenuEvent evt) {//GEN-FIRST:event_jMenu2MenuSelected
this.dispose();
}//GEN-LAST:event_jMenu2MenuSelected
private void jMenu2MenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_jMenu2MenuKeyPressed
}//GEN-LAST:event_jMenu2MenuKeyPressed
int pX, pY;
private void mbnAgregarActsMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mbnAgregarActsMousePressed
pX=evt.getX();
pY=evt.getY();
}//GEN-LAST:event_mbnAgregarActsMousePressed
private void mbnAgregarActsMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mbnAgregarActsMouseDragged
setLocation(getLocation().x+evt.getX()-pX,getLocation().y+evt.getY()-pY);
}//GEN-LAST:event_mbnAgregarActsMouseDragged
private void txtNombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNombreKeyTyped
int x = H.SoloLetras(evt);
if(x == 0){
getToolkit().beep();
evt.consume();
}
}//GEN-LAST:event_txtNombreKeyTyped
private void txtTelefono2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtTelefono2KeyTyped
if(H.SoloNumeros(evt) == 0){
getToolkit().beep();
evt.consume();
}
if(txtTelefono2.getText().length() > 7){
getToolkit().beep();
evt.consume();
}
}//GEN-LAST:event_txtTelefono2KeyTyped
private void txtApellidoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtApellidoKeyTyped
if(H.SoloLetras(evt) == 0){
getToolkit().beep();
evt.consume();
}
}//GEN-LAST:event_txtApellidoKeyTyped
private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
try {
Buscador();
} catch (IOException ex) {
Logger.getLogger(frmAgregarContactos.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_btnAgregarActionPerformed
private void btnModificarContactoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarContactoActionPerformed
this.setAlwaysOnTop(false);
if(!"".equals(txtNombre.getText()) && !"".equals(txtApellido.getText()) && !"".equals(txtCorreo.getText()) && (!"".equals(txtTelefono1.getText()) || !"".equals(txtTelefono2.getText()))){
if(((txtTelefono1.getText().startsWith("7") || txtTelefono1.getText().startsWith("2")) && txtTelefono1.getText().length() == 8) || ((txtTelefono2.getText().startsWith("7") || txtTelefono2.getText().startsWith("2")) && txtTelefono2.getText().length() == 8)){
if(H.checkEmail(txtCorreo.getText()) == true){
String nom_contacto, ape_contacto, sex_contacto, fecnac_contacto, correo_contacto, tel1, tel2;
nom_contacto = H.encriptar(txtNombre.getText());
ape_contacto = H.encriptar(txtApellido.getText());
sex_contacto = H.encriptar(cmbSexo.getSelectedItem().toString());
String dia, mes;
if(cmbDia.getSelectedIndex() < 9){
dia = "0" + cmbDia.getSelectedItem().toString();
}else{
dia = cmbDia.getSelectedItem().toString();
}
if(cmbMes.getSelectedIndex() < 9){
mes = "0" + cmbMes.getSelectedItem().toString();
}else{
mes = cmbMes.getSelectedItem().toString();
}
fecnac_contacto = dia +"/"+mes+"/"+cmbAño.getSelectedItem().toString();
correo_contacto = H.encriptar(txtCorreo.getText());
tel1 = txtTelefono1.getText();
tel2 = txtTelefono2.getText();
GuardarFoto(cod_contacto);
H.Actualizar("UPDATE Contactos SET nom_contacto = '"+nom_contacto+"', ape_contacto = '"+ape_contacto+"', sex_contacto = '"+sex_contacto+"', fecnac_contacto = '"+fecnac_contacto+"', correo_contacto = '"+correo_contacto+"', tel1_contacto = '"+tel1+"', tel2_contacto = '"+tel2+"' WHERE cod_contacto = "+cod_contacto+"");
frmVerContactos.tbl = 1;
this.dispose();
}
else{
JOptionPane.showMessageDialog(null, "Correo electronico invalido.");
}
}
else{
JOptionPane.showMessageDialog(null, "Escriba bien los numeros telefonicos.");
}
}
else{
JOptionPane.showMessageDialog(null, "No deje campos vacios.");
}
}//GEN-LAST:event_btnModificarContactoActionPerformed
private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
this.dispose();
}//GEN-LAST:event_btnCancelarActionPerformed
private void txtTelefono1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtTelefono1KeyTyped
if(H.SoloNumeros(evt) == 0){
getToolkit().beep();
evt.consume();
}
if(txtTelefono1.getText().length() > 7){
getToolkit().beep();
evt.consume();
}
}//GEN-LAST:event_txtTelefono1KeyTyped
private void cmbMesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbMesActionPerformed
H.DiasdelMes(cmbDia, cmbMes);
}//GEN-LAST:event_cmbMesActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(frmModificarContactos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmModificarContactos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmModificarContactos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmModificarContactos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frmModificarContactos dialog = new frmModificarContactos(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAgregar;
private javax.swing.JButton btnCancelar;
private javax.swing.JButton btnModificarContacto;
private javax.swing.JComboBox cmbAño;
private javax.swing.JComboBox cmbDia;
private javax.swing.JComboBox cmbMes;
private javax.swing.JComboBox cmbSexo;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblContacto;
private javax.swing.JLabel lblTitulo1;
private javax.swing.JLabel lblTitulo2;
private javax.swing.JLabel lblTitulo3;
private javax.swing.JLabel lblTitulo4;
private javax.swing.JLabel lblTitulo5;
private javax.swing.JLabel lblTitulo6;
private javax.swing.JLabel lblTitulo7;
private javax.swing.JMenuBar mbnAgregarActs;
private javax.swing.JTextField txtApellido;
private javax.swing.JTextField txtCorreo;
private javax.swing.JTextField txtNombre;
private javax.swing.JTextField txtTelefono1;
private javax.swing.JTextField txtTelefono2;
// End of variables declaration//GEN-END:variables
}
| [
"icarloscornejo@outlook.com"
] | icarloscornejo@outlook.com |
c2850d8aca34974581f1314bdc51ae0a3ee262de | 7b0c74dd1a9da6c99bbf48c6f2040f3357668a0b | /collection/ListIndexOfSubList.java | 0ca0a8d3af52cf310cd5393d040132f1ef560748 | [] | no_license | Lapis-Hong/java-examples | 32793184dfb1ade09893b3a6fb77655186b7de3f | 78626db3f5852987494c317ba61e42b253292b4d | refs/heads/master | 2020-04-10T22:30:28.879609 | 2019-02-12T12:25:27 | 2019-02-12T12:25:27 | 161,326,146 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | /* 使用 Collections 类的 indexOfSubList() 和 lastIndexOfSubList() 方法来查看子列表是否在列表中,并查看子列表在列表中所在的位置 */
import java.util.*;
public class ListIndexOfSubList {
public static void main(String[] args) {
List list = Arrays.asList("one Two three Four five six one three Four".split(" "));
System.out.println("List :"+list);
List sublist = Arrays.asList("three Four".split(" "));
System.out.println("子列表 :"+sublist);
System.out.println("indexOfSubList: "
+ Collections.indexOfSubList(list, sublist));
System.out.println("lastIndexOfSubList: "
+ Collections.lastIndexOfSubList(list, sublist));
}
}
| [
"dinghongquan@sjtu.edu.cn"
] | dinghongquan@sjtu.edu.cn |
476c75776392167bada7206335041c36ef75dc1d | e826b8ae9def547b49a5913c1b0d5602a02ac2b0 | /web-socket-test/src/main/java/com/diyilu/ws/support/WebSocketConfig.java | 698d81d37108e65b094556980ef79d9427c95bc9 | [] | no_license | diyiliu/dyl-demo | f31439a818131135bf718ff381be9c8f340fa2e9 | ff1012a3adb619451b2660d2668ca08ff33fb944 | refs/heads/master | 2023-01-22T09:08:16.236758 | 2020-12-02T07:16:20 | 2020-12-02T07:16:20 | 313,807,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,618 | java | package com.diyilu.ws.support;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* Description: WebSocketConfig
* Author: diyiliu
* Update: 2020-11-17 17:26
*/
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
/**
* 配置 WebSocket 进入点,及开启使用 SockJS,这些配置主要用配置连接端点,用于 WebSocket 连接
*
* @param registry STOMP 端点
*/
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/myws")
.setAllowedOrigins("*")
.withSockJS();
}
/**
* 配置消息代理选项
*
* @param registry 消息代理注册配置
*/
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
// 设置客户端订阅前缀。
registry.enableSimpleBroker("/topic");
// 配置客户端发送前缀,该前缀会筛选消息目标转发到 Controller 类中注解对应的方法里
registry.setApplicationDestinationPrefixes("/app");
}
} | [
"572772828@qq.com"
] | 572772828@qq.com |
80464622aa0477f560a48b0b0cc18ee3f570bf77 | 54e279206618511167d569a69972ad475828a429 | /springboot-multi-datasource/src/main/java/com/qiuhuu/test/aop/DynamicDataSourceAspect.java | 8dafdef0f089ddf4a318a559c761909ec142a6fb | [] | no_license | qiuhuu/springboot-dynamic-multi-datasource | fd0be4a7208fed5827bd98767a43213da5f7fd79 | 28fcdc19cd5c5ea529765a36bff6a67e7f477067 | refs/heads/main | 2023-02-16T04:36:58.210759 | 2021-01-05T03:27:11 | 2021-01-05T03:27:11 | 326,868,818 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,485 | java | package com.qiuhuu.test.aop;
import com.qiuhuu.test.annotation.DataSource;
import com.qiuhuu.test.type.DataBaseType;
import com.qiuhuu.test.type.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
/**
* @author : qiuhuu
* @date : 2020-11-11 15:48
*/
@Slf4j
@Aspect
@Component
public class DynamicDataSourceAspect {
/**
* 在注解所在的方法执行之前,拦截方法
* @param point
* @param dataSource
* @throws Throwable
*/
@Before("@annotation(dataSource)")
public void changeDataSource(JoinPoint point, DataSource dataSource) throws Throwable {
DataBaseType value = dataSource.value();
log.info("switch to :?",value.toString());
switch (dataSource.value()){
case Slave:
DataSourceType.setDataBaseType(DataBaseType.Slave);
break;
default:
DataSourceType.setDataBaseType(DataBaseType.Master);
break;
}
}
/**
* 注解所在的方法执行完后,清除数据源的配置
* @param point
* @param dataSource
*/
@After("@annotation(dataSource)")
public void restoreDataSource(JoinPoint point, DataSource dataSource) {
DataSourceType.clearDataBaseType();
}
}
| [
"1094510079@qq.com"
] | 1094510079@qq.com |
781ecbdf1da10ba4eb723752ce66f2512a7fbcae | 211daff236ec43b40c7cdc29745ef88e35dd8d83 | /educloud_android_sh/src/com/linkage/mobile72/sh/activity/SearchGroupActivity.java | 987e9f76074d0c5a8a112a8a87410c1bb549c75a | [] | no_license | cash2one/AS_PRO1 | 4208809e0215fa523d1237de723e224ddac821c1 | 88a395fdbdb338a6873034c3d7838cd35ff7fef5 | refs/heads/master | 2021-01-11T05:22:14.842441 | 2015-12-16T03:12:20 | 2015-12-16T03:12:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,054 | java | package com.linkage.mobile72.sh.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.linkage.mobile72.sh.R;
import com.linkage.mobile72.sh.adapter.JoinGroupAdapter;
import com.linkage.mobile72.sh.adapter.JoinGroupAdapter.NotifiHandler;
import com.linkage.mobile72.sh.app.BaseActivity;
import com.linkage.mobile72.sh.app.BaseApplication;
import com.linkage.mobile72.sh.data.http.ClassRoomBean;
import com.linkage.mobile72.sh.http.WDJsonObjectRequest;
import com.linkage.mobile72.sh.utils.ProgressDialogUtils;
import com.linkage.mobile72.sh.utils.UIUtilities;
import com.linkage.mobile72.sh.Consts;
import com.linkage.ui.widget.PullToRefreshBase;
import com.linkage.ui.widget.PullToRefreshBase.OnRefreshListener;
import com.linkage.ui.widget.PullToRefreshListView;
/**
* 搜索群组 -- 感兴趣的群组 界面
* @author Yao
*
*/
public class SearchGroupActivity extends BaseActivity implements OnClickListener,NotifiHandler {
private static final String TAG = SearchGroupActivity.class.getSimpleName();
private Button back;
private RelativeLayout search_btn;
//private RelativeLayout interestLayout;
private PullToRefreshListView mListView;
private JoinGroupAdapter mAdapter;
private EditText edit_input;
private List<ClassRoomBean> mData;
private TextView mEmpty;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_group);
back = (Button)findViewById(R.id.back);
setTitle(R.string.title_search_group);
edit_input =(EditText)findViewById(R.id.search_edit);
search_btn =(RelativeLayout)findViewById(R.id.search_btn);
//interestLayout = (RelativeLayout)findViewById(R.id.relativelayout3);
mListView = (PullToRefreshListView) findViewById(R.id.base_pull_list);
mData = new ArrayList<ClassRoomBean>();
mAdapter = new JoinGroupAdapter(this,imageLoader_group, mData);
mListView.setAdapter(mAdapter);
mListView.setDivider(null);
//friendListView.setDivider(getResources().getDrawable(R.color.dark_gray));
mEmpty = (TextView) findViewById(android.R.id.empty);
mEmpty.setText("暂时没有数据");
mListView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
mListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
fetchInterestGroup();
}
});
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent = new Intent(SearchGroupActivity.this, ClazzInfoActivity.class);
intent.putExtra("CLAZZ_ID", mAdapter.getItemId(position));
startActivity(intent);
}
});
back.setOnClickListener(this);
search_btn.setOnClickListener(this);
edit_input.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// TODO Auto-generated method stub
if ((actionId == 0 || actionId == 3) && event != null) {
InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm.isActive()){
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(),0);
}
Animation shake = AnimationUtils.loadAnimation(SearchGroupActivity.this, R.anim.shake);
String search_str = edit_input.getEditableText().toString();
if (TextUtils.isEmpty(search_str)) {
edit_input.setText("");
edit_input.startAnimation(shake);
UIUtilities.showToast(SearchGroupActivity.this, "搜索内容不能为空");
return false;
}
Intent i = new Intent(SearchGroupActivity.this, SearchGroupResultActivity.class);
i.putExtra("keyword", search_str);
startActivity(i);
}
return false;
}
});
fetchInterestGroup();
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.back:
finish();
break;
case R.id.search_btn:
Animation shake = AnimationUtils.loadAnimation(SearchGroupActivity.this, R.anim.shake);
String search_str = edit_input.getEditableText().toString();
if (TextUtils.isEmpty(search_str)) {
edit_input.setText("");
edit_input.startAnimation(shake);
UIUtilities.showToast(this, "搜索内容不能为空");
return;
}
Intent i = new Intent(this, SearchGroupResultActivity.class);
i.putExtra("keyword", search_str);
startActivity(i);
break;
}
}
@Override
public void onResume() {
super.onResume();
JoinGroupAdapter.ehList.add(this);
}
@Override
public void onPause() {
super.onPause();
// MyPushMessageReceiver.ehList.remove(this);
}
@Override
public void onDestroy() {
super.onDestroy();
JoinGroupAdapter.ehList.remove(this);
}
private void fetchInterestGroup() {
mData.clear();
mListView.setMode(PullToRefreshBase.Mode.BOTH);
mAdapter.addAll(mData, false);
HashMap<String, String> params = new HashMap<String, String>();
params.put("commandtype", "findInterstedClassroomList");
WDJsonObjectRequest mRequest = new WDJsonObjectRequest(Consts.SERVER_URL, Request.Method.POST, params, true, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
mListView.onRefreshComplete();
ProgressDialogUtils.dismissProgressBar();
if (response.optInt("ret") == 0) {
mData = ClassRoomBean.parseFromJson(response.optJSONArray("data"));
if(mData.size() > 0) {
mAdapter.addAll(mData, false);
mListView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
}
if (mAdapter.isEmpty()) {
mEmpty.setVisibility(View.VISIBLE);
} else {
mEmpty.setVisibility(View.GONE);
}
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError arg0) {
mListView.onRefreshComplete();
ProgressDialogUtils.dismissProgressBar();
}
});
BaseApplication.getInstance().addToRequestQueue(mRequest, TAG);
}
@Override
public void onMessage(long clazz, int type) {
// TODO Auto-generated method stub
}
}
| [
"cunguoyao@gmail.com"
] | cunguoyao@gmail.com |
67da0035a1343963e3c1af4fb7cae517c0a957c3 | 34f2fb505332f3dd0c659ca2dba9486510af32d9 | /jkzzk-regular/src/com/jkzzk/regular/RegularDemo1.java | bd3a35d612810e2818b51c5a17250d53b3f36cc9 | [] | no_license | jkzzk/self-learn | 8c1abe2d437311344aef1d84fd1fe019a44ade74 | 3499d59e4a63e76f6bd904699778135b519e3c3e | refs/heads/master | 2020-09-16T17:24:14.159344 | 2020-03-18T01:42:40 | 2020-03-18T01:42:40 | 223,840,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,242 | java | package com.jkzzk.regular;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 正则表达式: 操作复杂类型文本
* 1.普通字符
* 数字、字母、下划线、汉字、以及没有特殊含义的特殊字符、转义字符
* 这些字符只匹配文本中的与之相同的一个字符
* 2.标准字符集合
* 匹配多种字符,区分大小写,大写为反义
* /d : 匹配0-9 10个数字
* /w : 匹配字母、数字、下划线
* /s : 匹配空白字符,空格、制表符、换行符
* . : 匹配除了换行符的任意字符
* 如果要匹配所有字符使用[/s/S]
* 3.自定义字符集合
* 匹配自定义字符集合,使用方括号[ ... ]包裹
* 被中括号包裹的字符,失去特殊意义,只匹配本身
* 被中括号包裹的标准字符集合,不会失去本身意义,将会当做中括号里的一部分
* 用法:
* [abc] : 匹配 a 或 b 或 c,其中任意一个都可以
* [^ abc] : 匹配 a 或 b 或 c 之外的字符,^ 取反的意思
* [a-c] :匹配 a 到 c 中的任意一个字符
* 4.量词
* {n} :匹配的字符重复n次
* {m,n} : 匹配的字符至少出现m次,最多出现n次
* {m,} : 匹配的字符至少出现m次
* ? : 匹配的字符至少出现0次,最多出现1次
* + : 匹配的字符至少出现1次
* * : 匹配的字符不出现或出现任意次
* 量词的模式:
* 贪婪模式:在匹配范围下,匹配最多的字符
* 非贪婪模式:在匹配范围下,匹配最少的字符
* 默认为贪婪模式,在正则表达式后面加一个问号,?表示启用非贪婪模式
* 注意:
* 只修饰前面的一个表达式或是一组表达式
* 5.字符边界
* 零宽匹配,匹配的是位置,不是字符
* ^ : 匹配字符串开始的地方
* $ : 匹配字符串结束的地方
* \b : 匹配单词边界
* 该位置两侧不全是字母、数字、下划线,就是一侧是,另一侧不是,可能是其他字符
* 注意:
* 在自定义字符集合中匹配意义会失效
* 6.匹配模式
* 1.忽略大小写模式 IGNORECAS
* 默认是区分大小写的
* 2.单行模式 SINGLELINE 默认
* 整个文本只有一个开头,一个结尾,"."可以匹配换行符
* 3.多行模式 MULTILINE
* 每一行都有一个开头和结尾,使用^和$来匹配每行的开头结尾
* 还可以使用\A和\Z来匹配整个文本的开头和结尾
* 7.选择符 或 | 用来连接两个独立的正则表达式,表示或者关系
* 8.分组
* 1.捕获组
* 使用小括号来表示(),被小括号包起来的表达式,被分为一组
* 从表达式开始,每一个小括号为一组,编号从 1 开始增加
* 如果有嵌套,就从外层开始数
* 从左至右,每一个左小括号,代表一组,开始编号
* 每一组,会把该表达式匹配到的结果保存下来,可以使用反向引用,来引用该结果字符串
* 2.非捕获组
* 格式:(?: )
* 不存储捕获组捕获的文本,在大量文本匹配时,推荐使用,不需要引用的捕获组,不让他
* 存储,不然浪费效率
* 3.反向引用
* 形势:\nnn nnn代表该级下的组编号
* 9.零宽断言
* 零宽: 表达式匹配的内容不计入在左后的结果之中
* 概念: 表达式匹配的是该位置之后或之前的字符串,并不记入最后的结果
* 说明一下要匹配的字符串前后的情况
* 格式:
* (? = exp) : 匹配字符串后面的情况
* (? <= exp) :匹配字符串前面的情况
* (? ! exp) :匹配字符串后面不能出现的情况
* (? < exp) : 匹配字符串前面不能出现的情况
*
* java中使用正则:
* java.util.regex.Pattern 类
* 三个常用的模式常量
* static int CASE_INSENSITIVE 启用不区分大小写的匹配
* static int MULTILINE 启用多行模式
* 编译正则的方法
* static Pattern compile(String regex) 将给定的正则表达式编译为模式
* static Pattern compile(String regex, int flags) 将给定的正则表达式编译为带有给定标志的模式
* Matcher matcher(CharSequence input) 创建一个匹配器,匹配给定的输入与此模式
*
* static boolean matches(String regex, CharSequence input) 编译给定的正则表达式,并尝试匹配给定的输入
* 如果只需要查看是否匹配,可以用这个方法,代替上面的一套方法
* java.util.regex.Matcher 类
* boolean matches() 尝试将整个区域与模式进行匹配
* 匹配整个字符串
* boolean find() 尝试找到匹配模式的输入序列的下一个子序列
* 查找子序列
* String group() 返回与上一个匹配匹配的输入子序列。
* 返回find方法产找的子序列
* String group(int group) 返回在上一次匹配操作期间由给定组捕获的输入子序列
* 获取指定捕获组,捕获的内容
* String replaceFirst(String replacement)
* 将与模式匹配的输入序列的第一个子序列替换为给定的替换字符串
*/
public class RegularDemo1 {
public static void main(String[] args) throws Exception {
// show01();
// show02();
// show03();
show04();
}
private static void show04() {
String str = "s123sfsf123123sdfdf45345ktmm66";
String regxStr = "[0-9]{1,10}";
Pattern pattern = Pattern.compile(regxStr);
Matcher matcher = pattern.matcher(str);
String s = matcher.replaceAll("1111");
System.out.println(s);
}
private static void show03() {
String str = "s123sfsf123123sdfdf45345ktmm66";
String regxStr = "([a-z]*)(?:[0-9]*)";
Pattern pattern = Pattern.compile(regxStr);
Matcher matcher = pattern.matcher(str);
while(matcher.find()) {
System.out.println(matcher.group());// s123
System.out.println(matcher.group(1));// s
System.out.println(matcher.group(2));// java.lang.IndexOutOfBoundsException: No group 2
}
}
private static void show02() {
String str = "s123sfsf123123sdfdf45345ktmm66";
String regxStr = "([a-z]*)([0-9]*)";
Pattern pattern = Pattern.compile(regxStr);
Matcher matcher = pattern.matcher(str);
while(matcher.find()) {
System.out.println(matcher.group());// s123
System.out.println(matcher.group(1));// s
System.out.println(matcher.group(2));// 123
}
}
private static void show01() {
String str = "s123sfsf123123sdfdf45345ktmm66";
String regxStr = "\\w*";
Pattern pattern = Pattern.compile(regxStr);
Matcher matcher = pattern.matcher(str);
boolean matches = matcher.matches();
System.out.println(matches);
/**
* 该方法的底层,就是使用了匹配器matcher
* public static boolean matches(String regex, CharSequence input) {
* Pattern p = Pattern.compile(regex);
* Matcher m = p.matcher(input);
* return m.matches();
* }
* */
boolean matches1 = Pattern.matches(regxStr, str);
System.out.println(matches1);
}
}
| [
"1745493589@qq.com"
] | 1745493589@qq.com |
5567f5a65e919aeb3726aabc0ba46aaa9907ebae | 6480864eb635da10800cd8c56ef79f4b8e5fbf3e | /Seminar8/src/ro/ase/cts/flyweight/clase/Rezervare.java | 2be23546bf11737c0ebafe2e06760a911424be96 | [] | no_license | dinugeorgian/CTS.Seminar | 80e0e3aeccd5a686b0b7853354952975ff1d89d2 | 29866b88926d2dd9c5868d12092abbf96e9c7f5c | refs/heads/master | 2023-05-06T10:50:08.662770 | 2021-05-20T05:19:38 | 2021-05-20T05:19:38 | 342,138,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package ro.ase.cts.flyweight.clase;
public class Rezervare {
private int nrMasa;
private int nrPersoane;
private String oraRezervare;
public Rezervare(int nrMasa, int nrPersoane, String oraRezervare) {
super();
this.nrMasa = nrMasa;
this.nrPersoane = nrPersoane;
this.oraRezervare = oraRezervare;
}
@Override
public String toString() {
return "Rezervare [nrMasa=" + nrMasa + ", nrPersoane=" + nrPersoane + ", oraRezervare=" + oraRezervare + "]";
}
}
| [
"dinug@DESKTOP-LR8C5NR.home"
] | dinug@DESKTOP-LR8C5NR.home |
d026b3b0da7e53af4d1016b4a70b282a493e50f5 | 57e8a41e63af3ef94001c03f07beacf39e340f0d | /cse_udub/CSE373/hw4/src/HvZPlayer.java | ce9c27b477e52458467ecd0d1070bfe24f80e6b4 | [] | no_license | zhy9036/cs_2016_fall | 0e5f9f1f84777729b1761675cfb27086269c2358 | c35c0cf64038dda3888e48ca63e92c67dc9ad346 | refs/heads/master | 2020-04-10T03:55:45.688046 | 2018-02-17T19:26:49 | 2018-02-17T19:26:49 | 68,164,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,902 | java | // CSE 373 Homework 4: HashMaps vs. Zombies
//Yang Zhang, 1030416
/**
* Each HvZPlayer object represents a single player (human or zombie) in the HvZT game.
* The object keeps track of whether the player is a human or a zombie, along
* with the number of kills that the zombie has made.
*/
public class HvZPlayer {
private static final int SUPER_ZOMBIE_KILLS = 3; // # of kills to be a "super zombie"
private final String name;
private boolean human; // false means zombie
private int kills;
/**
* Constructs a new human or zombie player with the given name and type.
* Throws a NullPointerException if the name is null.
*/
public HvZPlayer(String name, boolean human) {
if (name == null) {
throw new NullPointerException();
}
this.name = name;
this.human = human;
this.kills = 0;
}
/**
* Turns this player into a zombie.
* Throws an IllegalStateException if the player is already a zombie.
*/
public void becomeZombie() {
if (!isHuman()) {
throw new IllegalStateException(name + " is already a zombie");
}
this.human = false;
}
/**
* Returns whether this player is currently a human (true) or zombie (false).
*/
public boolean isHuman() {
return human;
}
/**
* Returns the number of humans this player has killed.
* If the player is a human or has not killed any humans, returns 0.
*/
public int getKills() {
return kills;
}
/**
* Returns this player's name.
*/
public String getName() {
return name;
}
/**
* Indicates that this player has killed one more human.
* Throws an IllegalStateException if the player is not a zombie.
*/
public void recordKill() {
if (isHuman()) {
throw new IllegalStateException(name + " is not a zombie");
}
this.kills++;
}
/**
* Returns a string representation of this player's name, type, and kills if applicable,
* such as "Joe(H)" for a human, or "Suzy(Z:2)" for a zombie.
* Includes an ! for "super zombies" with many kills, such as "Ed(Z:5!)".
*/
public String toString() {
String result = name + "(";
if (human) {
result += "H";
} else {
result += "Z:" + kills;
if (kills >= SUPER_ZOMBIE_KILLS) {
result += "!";
}
}
result += ")";
return result;
}
// --------- YOUR NEW METHODS GO BELOW ---------- //
/**
* Returns true if the object passed in is identical to this HvZPlayer respects to all the fields.
*/
public boolean equals(Object o) {
if(o instanceof HvZPlayer){
HvZPlayer temp = (HvZPlayer) o;
return (this.name.equals(temp.name)&& Boolean.valueOf(temp.human).equals(this.human)
&& this.kills == temp.kills);
}else{
return false;
}
}
/**
*Hash function for distinguishing HvZPlayer objects.
*/
public int hashCode() {
return Boolean.valueOf(human).hashCode()
+String.valueOf(name).hashCode()
//+153*Integer.valueOf(kills).hashCode();
+kills;
}
} | [
"zhangyang9036@gmail.com"
] | zhangyang9036@gmail.com |
961cd3b4acea7a695aa831983e5176a86436a5af | ff482b05b2cf895d4cf791f4f30dc42bb57b8aeb | /config/webform/testwebapp/WEB-INF/classes/test/PerfMain.java | f57db25972aeefa11cccb06364f331fc99c1412e | [] | no_license | Karthik131289/Framework | 7b42c5b11686edbeaa22feb7dee41fdd918f70e8 | f9a164d0ba77ec18c35f7b189147e7892ca67e67 | refs/heads/master | 2021-01-17T14:49:48.546252 | 2018-09-17T11:57:04 | 2018-09-17T11:57:14 | 70,252,194 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 3,077 | java | /*
* Main.java
*
* © Copyright 2001-2004 Volante Technologies, Inc.
* All rights reserved.
*
* This software is the confidential and proprietary information of Volante
* Technologies Inc. Your use of this software is governed by the terms of the
* license agreement and/or any nondisclosure agreements you have entered
* into with Volante. This software may not be disseminated, distributed
* or otherwise disclosed without the prior, written permission of Volante.
*/
package test;
import com.tplus.transform.runtime.*;
import com.tplus.transform.runtime.io.*;
import java.util.*;
import java.io.*;
import javax.naming.*;
import java.rmi.*;
import com.tplus.transform.util.ArrayUtils;
import com.tplus.transform.runtime.external.client.StaticContextOutputDeviceFactory;
import com.tplus.transform.runtime.external.client.DeviceHelper;
import com.tplus.transform.util.SequencedHashMap;
public class PerfMain {
private static int _loopCount = 10000;
public PerfMain() throws Exception {
}
private void populateOutputDeviceResult(StaticContextOutputDeviceFactory outputDeviceFactory, Map fieldAndValueMap, Map fieldAndTypeMap) throws TransformException, RemoteException {
Map result = new SequencedHashMap();
DeviceHelper.populateResult(outputDeviceFactory, result);
List outputDeviceNames = new ArrayList(result.keySet());
for (int i=0; i < outputDeviceNames.size(); ++i) {
String outputDeviceName = (String)outputDeviceNames.get(i);
Object deviceOutput = result.get(outputDeviceName);
fieldAndValueMap.put(outputDeviceName, deviceOutput);
fieldAndTypeMap.put(outputDeviceName, DesignerTypes.DESIGNER_BINARY_TYPE);
}
}
public void simpleTesting(MessageFlow messageFlow, DataObject inputDataObject, Map fieldAndValueMap, Map fieldAndTypeMap) throws NamingException, TransformException, IOException {
StaticContextOutputDeviceFactory outputDeviceFactory = DeviceHelper.prepareDevices(messageFlow);
DataObject outputDataObject = messageFlow.run(inputDataObject, new TransformContextImpl());
for (int i=0; i < outputDataObject.getFieldCount(); ++i) {
String fieldName = outputDataObject.getFieldName(i);
String fieldType = outputDataObject.getFieldType(i);
Object fieldValue = outputDataObject.getField(fieldName);
fieldAndValueMap.put(fieldName, fieldValue);
fieldAndTypeMap.put(fieldName, fieldType);
}
DeviceHelper.finishDevices(messageFlow);
populateOutputDeviceResult(outputDeviceFactory, fieldAndValueMap, fieldAndTypeMap);
}
public long perfTesting(MessageFlow messageFlow, DataObject inputDataObject) throws NamingException, IOException, TransformException {
int loopCount = _loopCount;
long start = System.currentTimeMillis();
for (int i = 0; i < loopCount; ++i) {
simpleTesting(messageFlow, inputDataObject, new SequencedHashMap(), new SequencedHashMap());
}
long end = System.currentTimeMillis();
long timeTaken = (end - start);
return (long)(loopCount / ((double) timeTaken / 1000));
}
}
| [
"karthik.p@volantetech.net"
] | karthik.p@volantetech.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.