blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
189495932b0c1586cd1b7ae8daa51db1e3b43dfd
d53238aa220e6d3cc24e15832c885935b69609ee
/src/br/com/extremeApps/SistemadeAposta/Inicial.java
f01cbb87bd7aae9f3705294a36ab9cc9312cddc2
[]
no_license
cscampana/SistemaDeAposta
14e519a11d73ec7331b9457ccbc7f69843139a2b
2151f1f620fb0d2a9606d5e37b859484d5e3392a
refs/heads/master
2021-05-28T04:57:35.216066
2014-03-23T15:13:20
2014-03-23T15:13:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
418
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.com.extremeApps.SistemadeAposta; /** * * @author SirExtreme */ public class Inicial { public static void main(String[] args) { Tela t = new Tela(); t.Janela(); } }
1e6ab4473e502f7bec566fc29430d5fa4e6ca69c
2f5cd5ba8a78edcddf99c7e3c9c19829f9dbd214
/java/playgrounds/balac/src/main/java/playground/balac/allcsmodestest/controler/listener/OWEventsHandler.java
20e6dd8d6e66bc232b94c90407f98ba2d7d0eebe
[]
no_license
HTplex/Storage
5ff1f23dfe8c05a0a8fe5354bb6bbc57cfcd5789
e94faac57b42d6f39c311f84bd4ccb32c52c2d30
refs/heads/master
2021-01-10T17:43:20.686441
2016-04-05T08:56:57
2016-04-05T08:56:57
55,478,274
1
1
null
2020-10-28T20:35:29
2016-04-05T07:43:17
Java
UTF-8
Java
false
false
5,094
java
package playground.balac.allcsmodestest.controler.listener; import java.util.ArrayList; import java.util.HashMap; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.LinkLeaveEvent; import org.matsim.api.core.v01.events.PersonArrivalEvent; import org.matsim.api.core.v01.events.PersonDepartureEvent; import org.matsim.api.core.v01.events.PersonEntersVehicleEvent; import org.matsim.api.core.v01.events.PersonLeavesVehicleEvent; import org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler; import org.matsim.api.core.v01.events.handler.PersonArrivalEventHandler; import org.matsim.api.core.v01.events.handler.PersonDepartureEventHandler; import org.matsim.api.core.v01.events.handler.PersonEntersVehicleEventHandler; import org.matsim.api.core.v01.events.handler.PersonLeavesVehicleEventHandler; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Person; import org.matsim.vehicles.Vehicle; public class OWEventsHandler implements PersonLeavesVehicleEventHandler, PersonEntersVehicleEventHandler, PersonArrivalEventHandler, PersonDepartureEventHandler, LinkLeaveEventHandler{ private HashMap<Id<Person>, RentalInfoOW> owRentalsStats = new HashMap<Id<Person>, RentalInfoOW>(); private ArrayList<RentalInfoOW> arr = new ArrayList<RentalInfoOW>(); private HashMap<Id<Person>, Boolean> inVehicle = new HashMap<Id<Person>, Boolean>(); private HashMap<Id<Vehicle>, Id<Person>> personVehicles = new HashMap<Id<Vehicle>, Id<Person>>(); private Network network; public OWEventsHandler(Network network) { this.network = network; } @Override public void reset(int iteration) { // TODO Auto-generated method stub owRentalsStats = new HashMap<Id<Person>, RentalInfoOW>(); arr = new ArrayList<RentalInfoOW>(); inVehicle = new HashMap<Id<Person>, Boolean>(); personVehicles = new HashMap<Id<Vehicle>, Id<Person>>(); } @Override public void handleEvent(PersonLeavesVehicleEvent event) { // TODO Auto-generated method stub personVehicles.remove(event.getVehicleId()); } @Override public void handleEvent(PersonEntersVehicleEvent event) { // TODO Auto-generated method stub if (event.getVehicleId().toString().startsWith("OW")) personVehicles.put(event.getVehicleId(), event.getPersonId()); } @Override public void handleEvent(LinkLeaveEvent event) { if (event.getVehicleId().toString().startsWith("OW")) { Id<Person> perid = personVehicles.get(event.getVehicleId()); RentalInfoOW info = owRentalsStats.get(perid); info.vehId = event.getVehicleId(); info.distance += network.getLinks().get(event.getLinkId()).getLength(); } } @Override public void handleEvent(PersonDepartureEvent event) { // TODO Auto-generated method stub inVehicle.put(event.getPersonId(), false); if (event.getLegMode().equals("walk_ow_sb")) { RentalInfoOW info = new RentalInfoOW(); info.accessStartTime = event.getTime(); info.personId = event.getPersonId(); if (owRentalsStats.get(event.getPersonId()) == null) { owRentalsStats.put(event.getPersonId(), info); } else { RentalInfoOW info1 = owRentalsStats.get(event.getPersonId()); info1.egressStartTime = event.getTime(); } } else if (event.getLegMode().equals("onewaycarsharing")) { inVehicle.put(event.getPersonId(), true); RentalInfoOW info = owRentalsStats.get(event.getPersonId()); info.startTime = event.getTime(); info.startLinkId = event.getLinkId(); info.accessEndTime = event.getTime(); } } @Override public void handleEvent(PersonArrivalEvent event) { // TODO Auto-generated method stub if (event.getLegMode().equals("onewaycarsharing")) { RentalInfoOW info = owRentalsStats.get(event.getPersonId()); info.endTime = event.getTime(); info.endLinkId = event.getLinkId(); } else if (event.getLegMode().equals("walk_ow_sb")) { if (owRentalsStats.get(event.getPersonId()) != null && owRentalsStats.get(event.getPersonId()).accessEndTime != 0.0) { RentalInfoOW info = owRentalsStats.remove(event.getPersonId()); info.egressEndTime = event.getTime(); arr.add(info); } } } public ArrayList<RentalInfoOW> rentals() { return arr; } public class RentalInfoOW { private Id<Person> personId = null; private double startTime = 0.0; private double endTime = 0.0; private Id<Link> startLinkId = null; private Id<Link> endLinkId = null; private double distance = 0.0; private double accessStartTime = 0.0; private double accessEndTime = 0.0; private double egressStartTime = 0.0; private double egressEndTime = 0.0; private Id<Vehicle> vehId = null; public String toString() { return personId + " " + Double.toString(startTime) + " " + Double.toString(endTime) + " " + startLinkId.toString() + " " + endLinkId.toString()+ " " + Double.toString(distance)+ " " + Double.toString(accessEndTime - accessStartTime)+ " " + Double.toString(egressEndTime - egressStartTime) + " " + vehId; } } }
110ef1da6b3e61036990270417d2e7a9ad47977b
e742f3272e1f6f13e3650b4c379389ef2d2e4b46
/MissingNumbers/src/MissingNumbersInArray.java
8e1a853643996056944ce4d55a576edb85e05abb
[]
no_license
anjusuryawanshi/study
15193365903195a7c4c4d5aac7b7dac69cc3541b
565161798ab87807d2706d73998ba38d727b5879
refs/heads/master
2021-01-09T05:20:07.702476
2017-04-03T04:25:30
2017-04-03T04:25:30
80,752,938
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
import java.util.ArrayList; import java.util.List; public class MissingNumbersInArray { public static void main(String[] args) { int[] nums = {4, 3, 2, 7, 8, 2, 3, 1}; List<Integer> missing = findDisappearedNumbers(nums); System.out.println(missing); } public static List<Integer> findDisappearedNumbers(int[] nums) { List<Integer> missingNumbers = new ArrayList<>(); for (int i = 0; i < nums.length; i++) { int val = Math.abs(nums[i]) - 1; if (nums[val] > 0) { nums[val] = -nums[val]; } } for (int i = 0; i < nums.length; i++) { if (nums[i] > 0) { missingNumbers.add(i+1); } } return missingNumbers; } }
5432ffd6638816d8e483dd540c6f6906b5ec8234
2a4c79eece6c250109db4e688cf88c5ec4954ec2
/src/cn/zcib/bean/Reward.java
d8dce5ebbb31502cc225eda72e84d8feb2eea238
[]
no_license
JPCui/demo_zcib
8e29d3e4ee48d8135c1df27f26078f1ec5bb0c55
1fd6e51082f71841d4b20892f4a9297d81e4e4f8
refs/heads/master
2016-09-05T17:33:17.824913
2014-12-31T05:32:48
2014-12-31T05:32:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,863
java
package cn.zcib.bean; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="Reward") public class Reward { @Id @GeneratedValue(strategy=GenerationType.AUTO) private int ID; @Column(length=13) private char[] Number; private String Name; private String Department; @Column(length=13) private char[] Rank; @Column(columnDefinition = "varchar(20) DEFAULT '' COMMENT '奖励名称'") private String Prize; @Column(columnDefinition = "datetime DEFAULT NULL COMMENT '奖励时间'") private Date Time; private int CheckState; private String Reason; private String Remark; public int getID() { return ID; } public void setID(int iD) { ID = iD; } public char[] getNumber() { return Number; } public void setNumber(char[] number) { Number = number; } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getDepartment() { return Department; } public void setDepartment(String department) { Department = department; } public char[] getRank() { return Rank; } public void setRank(char[] rank) { Rank = rank; } public String getPrize() { return Prize; } public void setPrize(String prize) { Prize = prize; } public Date getTime() { return Time; } public void setTime(Date time) { Time = time; } public int getCheckState() { return CheckState; } public void setCheckState(int checkState) { CheckState = checkState; } public String getReason() { return Reason; } public void setReason(String reason) { Reason = reason; } public String getRemark() { return Remark; } public void setRemark(String remark) { Remark = remark; } }
1174a8667f4c5ec8f7b4cc436bd564bde99adb48
370e3e22e89c65c5daa2304f970f2b17c45f2054
/src/main/java/io/github/makbn/authentication/service/StudentServiceImp.java
071e3c0da87ff9284ef89b948e7f8e7223a0027b
[]
no_license
makbn/authentication-service
2789afa5852d7ac8dbd0b12285a9fd38716614fa
9027325aada74a76e9f676eebb0dd120a656ca57
refs/heads/master
2020-03-07T05:47:48.881098
2018-04-04T14:11:44
2018-04-04T14:11:44
127,305,775
1
2
null
2018-04-04T14:11:45
2018-03-29T14:47:07
Java
UTF-8
Java
false
false
925
java
package io.github.makbn.authentication.service; import io.github.makbn.authentication.model.Student; import io.github.makbn.authentication.repository.StudentRepository; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Component("studentService") @Transactional public class StudentServiceImp implements StudentService { private final StudentRepository studentRepository; public StudentServiceImp(StudentRepository studentRepository) { this.studentRepository = studentRepository; } @Override public Student getStudentByStdNo(String stdNo) { List<Student> students=studentRepository.findStudentByStudentNumber(stdNo); return students==null || students.size()==0 ? null: students.get(0); } public void save(Student student){ this.studentRepository.save(student); } }
e7e62e06a02d7db4ecfc4e0d0d5454d5bc205d08
87a45004d9e5a454fb3911347901ae42699efff6
/mobile-app-ws/src/main/java/com/appdeveloperblog/app/ws/MobileAppWsApplication.java
c2a8df42c220953eb76f67e543a4d2107699facc
[]
no_license
mkba2019/spring-boot
abd13c144b8bb472554e767f81fb06e1660fcc34
d9474ffd82e11bf96810fb76698f00d3511973bd
refs/heads/master
2020-04-18T22:10:19.656272
2019-01-27T08:21:19
2019-01-27T08:21:19
167,786,015
0
1
null
null
null
null
UTF-8
Java
false
false
691
java
package com.appdeveloperblog.app.ws; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; @SpringBootApplication//(exclude = {SecurityAutoConfiguration.class}) public class MobileAppWsApplication { public static void main(String[] args) { SpringApplication.run(MobileAppWsApplication.class, args); } @Bean BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } }
439e0cac0857ba378bca74d411b0ca6282e0c273
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14462-5-12-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/extension/job/internal/AbstractInstallPlanJob_ESTest.java
9ef52d960f102107ec20006894a2fcd7074645ee
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
/* * This file was automatically generated by EvoSuite * Sun Apr 05 06:03:27 UTC 2020 */ package org.xwiki.extension.job.internal; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class AbstractInstallPlanJob_ESTest extends AbstractInstallPlanJob_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
e21584a621a2167a5854a4947b0edd76a565bf4c
68022d311463a775dd7d184369f6086c31f91c69
/JavaWebapps/java2web/.svn/pristine/e2/e21584a621a2167a5854a4947b0edd76a565bf4c.svn-base
3ca21d913998c84e9cd4a785658439a8a6862102
[ "Apache-2.0" ]
permissive
XavierGeerinck/KdG_IAO301A
067e18fc9f803e9796a0ff4517eb6b494ee0282e
6937c5fa10f6b1cfce31979551b16f7186532483
refs/heads/master
2021-05-26T20:53:30.074092
2013-12-04T15:29:58
2013-12-04T15:29:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
719
package be.kdg.cookies.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Deze klasse wordt maar door 1 gebruiker (thread) gebruikt. * Daarom is ze niet specifiek thread-safe gemaakt. */ public class Mandje implements Serializable { private List<String> aankopen; public Mandje() { aankopen = new ArrayList<String>(); } public List<String> getAankopen() { return Collections.unmodifiableList(aankopen); } public void add(String film) { aankopen.add(film); } public void remove(String film) { aankopen.remove(film); } }
d77389224a97fea6700d4472bbee0fe957c124ce
77351c48f3949346e596c356da95331447f0471a
/app/src/main/java/com/example/android/cinemusp/FragmentAdapter.java
143bf4655e0b7cee9c71433f832fd9e85010a38e
[]
no_license
Facina/Cinema
ee82108e9b61247799f7c171b5baf4718abaaf28
402e69af8d9efa346e077dd4bfeaa9b15f68d77b
refs/heads/master
2022-02-24T06:37:10.602451
2017-06-12T13:23:39
2017-06-12T13:23:39
94,099,008
0
0
null
null
null
null
UTF-8
Java
false
false
2,349
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.cinemusp; import android.content.Context; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; /** * {@link FragmentAdapter} is a {@link FragmentPagerAdapter} that can provide the layout for * each list item based on a data source which is a list of {@link Movie} objects. */ public class FragmentAdapter extends FragmentPagerAdapter { /** Context of the app */ private Context mContext; /** * Create a new {@link FragmentAdapter} object. * * @param context is the context of the app * @param fm is the fragment manager that will keep each fragment's state in the adapter * across swipes. */ public FragmentAdapter(Context context, FragmentManager fm) { super(fm); mContext = context; } /** * Return the {@link Fragment} that should be displayed for the given page number. */ @Override public Fragment getItem(int position) { if (position == 0) { return new HomeFragment(); } else if (position == 1) { return new MoviesFragment(); } else { return new SearchFragment(); } } /** * Return the total number of pages. */ @Override public int getCount() { return 3; } @Override public CharSequence getPageTitle(int position) { if (position == 0) { return mContext.getString(R.string.home); } else if (position == 1) { return mContext.getString(R.string.em_cartaz); } else { return mContext.getString(R.string.buscar); } } }
4378b84e071e281694c33890ed8c76fc65c980e5
a653c9fa8cc7a97765323c0230dc62b9b3309654
/src/cn/demi/res/po/ReagentLog.java
1734e10cb92a556fa83a2eabbf14439b31281b82
[]
no_license
peterwuhua/springBootDemoT
ef065d082017420dc56ac54f4714b11a4fbe9ee3
f8cebcae3becaa425fad93f116c40fb7ceb65e43
refs/heads/master
2020-09-13T22:47:25.013935
2019-11-20T13:16:09
2019-11-20T13:16:09
222,925,989
0
0
null
null
null
null
UTF-8
Java
false
false
6,387
java
package cn.demi.res.po; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; import cn.core.framework.common.po.Po; import cn.core.framework.utils.code.annotation.Module; @Entity(name = "res_reagent_log") @Table(name = "res_reagent_log") @Module(value = "res.reagent.log") public class ReagentLog extends Po<ReagentLog> { private static final long serialVersionUID = 1L; private Reagent reagent; private String name;// 试剂中文名称 private String ename;// 试剂英文名称 private String sname;// 试剂俗称 private String grade;// 试剂级别 private String type;// 试剂类型 private Double safeAmount;// 警戒数量 private Double amount;// 实际数量 private String no;// 编号 private String unit; // 单位 private String supplier;// 供应商 private String supplierId;// 供应商 private String mfg;// 生产日期 private String exp;// 效期 private String remark;// 备注 private String state;// 状态 private String price;// 价格 private String bnum;// 批号 private String purity;// 纯度 private String saveCode;// 保存条件及要求 private String purpose;// 用途 private Double lastAmount;// 修改前数量 private String cuser;// 修改人 private String date;// 修改时间 private String leadingPerson;// 领用人 private String rkNum;//入库数量 /*** * 仪器保管人 */ private String keeper; private String keepId; /*** * 仪器保管科室 */ private String deptId; private String deptName; /*** * 部门信息 */ private String orgId; private String orgName; public final String[] IGNORE_PROPERTY= {"id","createTime","lastUpdTime","isDel","version"}; @Column(length = 16) public String getRkNum() { return rkNum; } public void setRkNum(String rkNum) { this.rkNum = rkNum; } @ManyToOne @JoinColumn(name = "reagent_id") public Reagent getReagent() { return reagent; } public void setReagent(Reagent reagent) { this.reagent = reagent; } @Column(length = 64) public String getPurpose() { return purpose; } public void setPurpose(String purpose) { this.purpose = purpose; } @Column(length = 64) public String getBnum() { return bnum; } public void setBnum(String bnum) { this.bnum = bnum; } @Column(length = 64) public String getPurity() { return purity; } public void setPurity(String purity) { this.purity = purity; } @Column(length = 64) public String getSaveCode() { return saveCode; } public void setSaveCode(String saveCode) { this.saveCode = saveCode; } @Column(length = 64) public String getName() { return name; } public void setName(String name) { this.name = name; } @Column(length = 64) public String getEname() { return ename; } public void setEname(String ename) { this.ename = ename; } @Column(length = 64) public String getSname() { return sname; } public void setSname(String sname) { this.sname = sname; } @Column(length = 64) public String getGrade() { return grade; } public void setGrade(String grade) { this.grade = grade; } @Column(length = 32) public Double getSafeAmount() { return safeAmount; } public void setSafeAmount(Double safeAmount) { this.safeAmount = safeAmount; } @Column(length = 64) public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } @Column(length = 64) public String getType() { return type; } public void setType(String type) { this.type = type; } @Column(length = 64) public String getNo() { return no; } public void setNo(String no) { this.no = no; } @Column(length = 64) public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } @Column(length = 64) public String getSupplier() { return supplier; } public void setSupplier(String supplier) { this.supplier = supplier; } @Column(length = 20) public String getMfg() { return mfg; } public void setMfg(String mfg) { this.mfg = mfg; } @Column(length = 20) public String getExp() { return exp; } public void setExp(String exp) { this.exp = exp; } @Lob public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } @Column(length = 64) public String getState() { return state; } public void setState(String state) { this.state = state; } @Column(length = 16) public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } @Column(length = 64) public String getLeadingPerson() { return leadingPerson; } public void setLeadingPerson(String leadingPerson) { this.leadingPerson = leadingPerson; } @Column(length = 64) public String getKeeper() { return keeper; } public void setKeeper(String keeper) { this.keeper = keeper; } @Column(length = 32) public String getKeepId() { return keepId; } public void setKeepId(String keepId) { this.keepId = keepId; } @Column(length = 32) public String getDeptId() { return deptId; } public void setDeptId(String deptId) { this.deptId = deptId; } @Column(length = 64) public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } @Column(length = 32) public String getOrgId() { return orgId; } public void setOrgId(String orgId) { this.orgId = orgId; } @Column(length = 64) public String getOrgName() { return orgName; } public void setOrgName(String orgName) { this.orgName = orgName; } @Column(length = 32) public Double getLastAmount() { return lastAmount; } public void setLastAmount(Double lastAmount) { this.lastAmount = lastAmount; } @Column(length = 64) public String getCuser() { return cuser; } public void setCuser(String cuser) { this.cuser = cuser; } @Column(length = 20) public String getDate() { return date; } public void setDate(String date) { this.date = date; } @Column(length = 32) public String getSupplierId() { return supplierId; } public void setSupplierId(String supplierId) { this.supplierId = supplierId; } @Transient @Override public String[] getPropertyToMap() { return null; } }
fdf1e08dac99f18b9e760b4287f6a671f5bec4fb
e2fa3692cf395292798f38526d2e0b04c09a7d5d
/MainActivity2.java
a2f82e69d937060feb7931ab54073214a342c87c
[]
no_license
Justinsane20/android
73ed0591988b4fff11d635c6b7490135a3e4e2c5
0f4e298d2005ce86d62842e631e8223422a4355c
refs/heads/main
2023-04-16T13:33:43.713717
2021-04-30T05:56:48
2021-04-30T05:56:48
363,026,668
0
0
null
null
null
null
UTF-8
Java
false
false
2,815
java
package com.example.login; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity2 extends AppCompatActivity { EditText username, password, repassword; Button signup, signin; DBHelper DB; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); repassword = (EditText) findViewById(R.id.repassword); signup = (Button) findViewById(R.id.signup); signin = (Button) findViewById(R.id.signin); DB= new DBHelper(this); signup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String user=username.getText().toString(); String pass=password.getText().toString(); String repass=repassword.getText().toString(); if(user.equals("")||pass.equals("")||repass.equals("")) Toast.makeText(MainActivity2.this,"Please Fill All The Fields",Toast.LENGTH_SHORT).show(); else if(pass.equals(repass)){ Boolean checkuser = DB.checkusername(user); if(checkuser==false) { Boolean insert= DB.insertData(user,pass); if(insert==true) { Toast.makeText(MainActivity2.this, "Registered Successfully", Toast.LENGTH_SHORT).show(); Intent intent =new Intent(getApplicationContext(),HomeActivity.class); startActivity(intent); } else Toast.makeText(MainActivity2.this, "Registered Failed", Toast.LENGTH_SHORT).show(); } else Toast.makeText(MainActivity2.this, "ALREADY EXISTS", Toast.LENGTH_SHORT).show(); } else Toast.makeText(MainActivity2.this, "Password not matching", Toast.LENGTH_SHORT).show(); } }); signin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(getApplicationContext(),LoginActivity.class); startActivity(intent); } }); } }
ddfbffb387a66c1cfbb7bbc0ff05673e8e5505b7
9fbe009c6499382b3cc262450a178ef16cd3fa59
/refactoring/src/test/java/ru/akirakozov/sd/refactoring/servlet/QueryServletTest.java
7f199b71589c08668ec680a63903350d2dfeaef5
[]
no_license
romagolchin/software-design
eb99f7b5ab0982658fb4e162850adf5614a28c3a
486223ebd990f718f74f602061cfe1b27c82d6ba
refs/heads/master
2023-06-17T02:21:56.995122
2022-07-11T08:15:25
2022-07-11T08:15:25
154,562,909
0
0
null
2023-05-23T20:11:05
2018-10-24T20:11:11
Java
UTF-8
Java
false
false
2,416
java
package ru.akirakozov.sd.refactoring.servlet; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import ru.akirakozov.sd.refactoring.dao.IProductDao; import ru.akirakozov.sd.refactoring.util.HtmlWriter; import java.io.IOException; import java.util.function.Consumer; import java.util.stream.Stream; import static org.junit.jupiter.params.provider.Arguments.arguments; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; class QueryServletTest extends ServletAbstractTest { private QueryServlet servlet = new QueryServlet(productDao, htmlWriter); private static Stream<Arguments> commands() { return Stream.of( arguments( "min", (Consumer<IProductDao>) IProductDao::min, (Consumer<HtmlWriter>) hw -> hw.writeOptionalResult(any(), any(), any())), arguments( "max", (Consumer<IProductDao>) IProductDao::max, (Consumer<HtmlWriter>) hw -> hw.writeOptionalResult(any(), any(), any())), arguments( "count", (Consumer<IProductDao>) IProductDao::count, (Consumer<HtmlWriter>) hw -> hw.writeSingleResult(any(), any(), any())), arguments( "sum", (Consumer<IProductDao>) IProductDao::sum, (Consumer<HtmlWriter>) hw -> hw.writeSingleResult(any(), any(), any()))); } @ParameterizedTest @MethodSource("commands") void queryProducts(String command, Consumer<IProductDao> operation, Consumer<HtmlWriter> write) throws IOException { when(request.getParameter("command")).thenReturn(command); servlet.doGet(request, response); operation.accept(verify(productDao)); write.accept(verify(htmlWriter)); } @Test void unknownCommand() throws IOException { when(request.getParameter("command")).thenReturn(""); servlet.doGet(request, response); verify(printWriter).println(contains("Unknown command")); } }
826532ccf9a2544124586d779dc2b96ebfc4440d
85849ca2a152a8485165328cadb04ebdeca6bda1
/src/main/java/cn/edu/lynu/javactf/dao/NewsMapper.java
c4ff6eaefe3614f9306c694c0a7b438a7d4967f1
[ "Apache-2.0" ]
permissive
freekeeper9966/java-ctf
f05de7bd57f17d5d894728b31d37289098e615b5
50d86bbbd125f00d912605d34da08856ffa7c89d
refs/heads/master
2022-06-21T07:05:27.070913
2019-06-26T09:16:39
2019-06-26T09:16:39
262,307,328
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package cn.edu.lynu.javactf.dao; import java.util.List; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import cn.edu.lynu.javactf.model.News; @Mapper public interface NewsMapper { @Select("SELECT * FROM news") List<News> getAllNews(); @Select("SELECT * FROM news WHERE ID=#{id}") News getNewsById(@Param("id") int id); @Delete("DELETE news WHERE ID = #{id}") int deleteNewsById(@Param("id")int id); @Insert("INSERT INTO news(title, content) VALUES ( #{news.title}, #{news.content} )") int insertNews(@Param("news") News news); @Update("UPDATE news SET title=#{news.title}, content=#{news.content} WHERE ID = #{news.id}") int updateNews(@Param("news")News news); }
66060854c340b9c4e2ce525d4c3c6aae6183b0b6
c8d940a806634855b237a8ee82291e4fdf8b89ce
/app/src/main/java/hidenseek/devlanding/com/hideandseek/Maps/MapsCurrentLocation.java
6e265a07049ddce2bcb00f441174c3d90978c631
[]
no_license
TedHoryczun/Hide-And-Seek
077007e0e5e95bf0149e645baf30b39df2322340
6337db548ec6a989387d56888194d54c61f0735d
refs/heads/master
2021-01-19T11:15:06.743405
2017-04-12T23:38:29
2017-04-12T23:38:29
82,235,628
0
0
null
null
null
null
UTF-8
Java
false
false
3,748
java
package hidenseek.devlanding.com.hideandseek.Maps; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.model.Circle; /** * Created by ted on 2/17/17. */ public class MapsCurrentLocation implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, com.google.android.gms.location.LocationListener, MapsMVP.Interactor { private final MapsMVP.presenter presenter; private final Context context; private GoogleApiClient mGoogleApiClient; private LocationRequest mLocationRequest; private Location currentLocation; public MapsCurrentLocation(MapsMVP.presenter presenter, Context context) { this.presenter = presenter; this.context = context; buildGoogleApiClient(context); } @Override public Location getCurrentLocation() { return currentLocation; } @Override public synchronized void buildGoogleApiClient(Context context) { mGoogleApiClient = new GoogleApiClient.Builder(context) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mGoogleApiClient.connect(); } @Override public void onLocationChanged(Location location) { setCurrentLocation(location); presenter.updateCurrentLocation(location.getLatitude(), location.getLongitude()); presenter.showErrorMsgIfOutOfHideAndSeekAreaBounds(location); } @Override public void onConnected(@Nullable Bundle bundle) { System.out.println("connected"); mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(1000); mLocationRequest.setFastestInterval(1000); mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); } @Override public boolean isUserOutSideHideAndSeekArea(Location location) { boolean isUserOutsideHideAndSeekArea = false; Circle metersAllowedToPlayIn = presenter.getMetersAllowedToPlayIn(); if (metersAllowedToPlayIn != null) { double startLatitude = location.getLatitude(); double startLongitude = location.getLongitude(); double endLongitude = metersAllowedToPlayIn.getCenter().longitude; double endLatitude = metersAllowedToPlayIn.getCenter().latitude; float[] results = new float[2]; Location.distanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, results); if (results[0] > metersAllowedToPlayIn.getRadius()) { isUserOutsideHideAndSeekArea = true; } } return isUserOutsideHideAndSeekArea; } @Override public void onConnectionSuspended(int i) { } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { System.out.println("connection failed: " + connectionResult.getErrorMessage()); } public void setCurrentLocation(Location currentLocation) { this.currentLocation = currentLocation; } }
e371dd2531d111d91d51df27dc2ae601f578aba2
cba543b732a9a5ad73ddb2e9b20125159f0e1b2e
/sikuli/IDE/src/main/java/org/sikuli/ide/CloseableTabbedPaneListener.java
caeba2d97f11c1fc979d37c688a78441ea54e120
[]
no_license
wsh231314/IntelligentOperation
e6266e1ae79fe93f132d8900ee484a4db0da3b24
a12aca5c5c67e6a2dddcd2d8420ca8a64af476f2
refs/heads/master
2020-04-05T13:31:55.376669
2017-07-28T05:59:05
2017-07-28T05:59:05
94,863,918
1
2
null
2017-07-27T02:44:17
2017-06-20T07:45:10
Java
UTF-8
Java
false
false
615
java
/* * Copyright (c) 2010-2016, Sikuli.org, sikulix.com * Released under the MIT License. * */ package org.sikuli.ide; import java.util.EventListener; /** * The listener that's notified when an tab should be closed in the * <code>CloseableTabbedPane</code>. */ public interface CloseableTabbedPaneListener extends EventListener { /** * Informs all <code>CloseableTabbedPaneListener</code>s when a tab should be * closed * @param tabIndexToClose the index of the tab which should be closed * @return true if the tab can be closed, false otherwise */ boolean closeTab(int tabIndexToClose); }
3cedc85368ac2aee6d21d43d3ad7a94cf33ecf5d
8aefee1609bb581dabbb972740fed17a91047810
/src/org/zwobble/shed/compiler/types/ParameterisedType.java
7d7182227a08d42cc102b4f5b691ad80f114a40a
[]
no_license
mwilliamson/shed
24013de71af53b0238f0bef11296fba0a8d75254
65fef492344f5effd68356a353b760abcda09d1d
refs/heads/master
2020-12-24T15:22:58.130607
2012-02-12T15:50:39
2012-02-12T15:50:39
1,815,372
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package org.zwobble.shed.compiler.types; import lombok.Data; @Data(staticConstructor="parameterisedType") public class ParameterisedType implements TypeFunction { private final ScalarType baseType; private final FormalTypeParameters formalTypeParameters; @Override public String shortName() { String parameterString = formalTypeParameters.describe(); return parameterString + " -> Class[" + baseType.shortName() + parameterString + "]"; } }
9e0490ee8fe62aa823dc9725a4a3bf6fa3835dda
e5b4da15b5b65ee20134ba3855d1bbd69ab1795b
/src/test/java/org/pojotask/MainPojo.java
ab198d2736e3692afb99477b9f4d16df70714dea
[]
no_license
RagulM02/APIJSON
80a8f8ef51bb706d62157276e527683c0449cadb
77f890d514106a65ca9c8ae303b26d338b36ab6f
refs/heads/master
2022-12-28T22:41:17.557764
2020-05-13T10:22:18
2020-05-13T10:22:18
263,601,458
0
0
null
2020-10-13T21:57:32
2020-05-13T10:45:40
Java
UTF-8
Java
false
false
965
java
package org.pojotask; public class MainPojo { private String page; private String per_page; private String total; private String total_pages; private Data data; private Ad ad; public Ad getAd() { return ad; } public void setAd(Ad ad) { this.ad = ad; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public String getPer_page() { return per_page; } public void setPer_page(String per_page) { this.per_page = per_page; } public String getTotal() { return total; } public void setTotal(String total) { this.total = total; } public String getTotal_pages() { return total_pages; } public void setTotal_pages(String total_pages) { this.total_pages = total_pages; } public Data getData() { return data; } public void setData(Data data) { this.data = data; } /*public String getAd() { return ad; } public void setAd(String ad) { this.ad = ad; } */ }
ffda2c697871692523d90ba300326f2bd399f3c7
9ea1dba146b2d27626df880ecdf799b9dd298c26
/app/src/main/java/precisioninfomatics/servicefirst/Networks/GetMethod.java
2bd32b3ef5f63351ece69a5d765ea1f1b538f067
[]
no_license
dvelle/Yoges-
3f9c99f4a82aca060b11f1bb53aadf930ebb4981
1b601b0c1edff71caea06f1dec4121faa9045c31
refs/heads/master
2021-07-25T17:49:14.546342
2017-11-07T06:51:04
2017-11-07T06:51:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package precisioninfomatics.servicefirst.Networks; /** * Created by 4264 on 30-01-2017. */ public interface GetMethod { void getDataFromServer(String obj); }
561db262b5ca20afd456227a53d72f3decb141aa
540eb566580bc597394800267e1b63b4f76aacad
/yipinFrontWeb/src/main/java/com/ytoxl/yipin/web/action/index/IndexAction.java
772600b1811d6d1ef796b2cebef2ef92a577a8c0
[]
no_license
ichoukou/yipin
aa20621deea1e4487193796722e80d9780720b36
2c921389f1c77c6d0f80f3568c6daa36c83fda62
refs/heads/master
2020-05-20T23:56:27.870318
2018-11-28T05:31:33
2018-11-28T05:31:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,965
java
package com.ytoxl.yipin.web.action.index; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.oscache.util.StringUtil; import com.ytoxl.module.user.common.exception.YtoxlUserException; import com.ytoxl.module.user.security.CustomUserDetails; import com.ytoxl.module.user.service.UserService; import com.ytoxl.module.yipin.base.common.utils.CookieUtils; import com.ytoxl.module.yipin.base.common.utils.StringUtils; import com.ytoxl.yipin.web.action.BaseAction; /** 基本action用于暂时login * @author zengzhiming * */ public class IndexAction extends BaseAction{ private static final long serialVersionUID = -5124613538370970690L; private static Logger logger = LoggerFactory.getLogger(IndexAction.class); public static final String LOGIN="login"; public static final String REGISTER="register"; private String index; private String cookieName; private String userName; private static final String COOKIE_REMOVE_SUCCESS="1"; private static final String COOKIE_REMOVE_FAILED="2"; @Autowired private UserService userService; /**注册登陆 * @return */ public String show(){ HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); //首先注册登陆 需要判断是否已经登陆如果登陆跳转到首页 try { String refererUrl = request.getHeader("Referer"); String targetUrl = request.getParameter("targetUrl"); if(StringUtils.isEmpty(refererUrl)||refererUrl.indexOf("/show-register")!=-1||refererUrl.indexOf("/show-login")!=-1){//如果為空 則跳轉到首頁 refererUrl=request.getContextPath()+"/index.htm"; } if(!StringUtil.isEmpty(targetUrl)){ ServletActionContext.getRequest().getSession().setAttribute("targetUrl", targetUrl); } ServletActionContext.getRequest().getSession().setAttribute("url", refererUrl); //System.out.println(URLEncoder.encode("http://localhost/front/buy-100006.htm", "UTF-8")); CustomUserDetails user = userService.getCurrentUser(); if(user!=null){//只有当用户存在的情况下 //用户登陆 if(index.equals("myyipin")){ response.sendRedirect(request.getContextPath()+"/order/order-myOrders.htm"); }else{ if(!StringUtil.isEmpty(targetUrl)){ refererUrl = targetUrl; } response.sendRedirect(refererUrl); } } } catch (YtoxlUserException e) { logger.error("用户未登录:",e.getMessage()); return SUCCESS; } catch (IOException e) { // TODO Auto-generated catch block logger.error("用户登录跳转异常:",e.getMessage()); return SUCCESS; }finally{ } return SUCCESS; } /**首页 登陆成功 * @return */ @SuppressWarnings("finally") public String index(){ try { HttpServletResponse response = ServletActionContext.getResponse(); HttpSession session = ServletActionContext.getRequest().getSession(); Object obj = session.getAttribute("register");//得到注册时标示 if(obj!=null){ session.removeAttribute("register"); response.sendRedirect(obj.toString()); } String refererUrl = (String) session.getAttribute("url");//获得远程地址 String targetUrl = (String) session.getAttribute("targetUrl");//获得目标地址 if(!StringUtil.isEmpty(targetUrl)){ refererUrl = targetUrl; } if(!StringUtil.isEmpty(refererUrl)){ if(refererUrl.indexOf("/index.htm")<0){ response.sendRedirect(refererUrl); } } session.removeAttribute("targetUrl");//登陆成功就移除 } catch (IOException e) { logger.error("index IOException",e.getMessage()); } return SUCCESS;//任何异常都跳转进首页 } /**后台添加删除cookie的公共方法 * @return */ public String cookies(){ HttpServletResponse response = ServletActionContext.getResponse(); HttpServletRequest request = ServletActionContext.getRequest(); try { if(index.equals("add")){ CookieUtils.addCookie(response, cookieName, userName, 10*24*60*60); }else{ CookieUtils.removeCookie(request, response, cookieName); } } catch (Exception e) { logger.error("index cookies",e.getMessage()); setMessage(COOKIE_REMOVE_FAILED, "cookie 删除异常!"); } setMessage(COOKIE_REMOVE_SUCCESS, "cookie 删除成功!"); return JSONMSG; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getCookieName() { return cookieName; } public void setCookieName(String cookieName) { this.cookieName = cookieName; } public String getIndex() { return index; } public void setIndex(String index) { this.index = index; } }
e0766ffc1df896cb39b85ea03939000a866efb7c
3b21cc2913090d7246e043be489bebb0bfda723d
/jpashop/src/main/java/jpabook/jpashop/domain/Category.java
636d30f9216de0055559e9ebcec13324e54fc818
[]
no_license
JangYouJeong/jpashoppro
111b52dd601281a01081e8e367da01f8f26bcded
997449252ca64aa6ebf76fb17bdc26fd5bfc4ae0
refs/heads/master
2023-03-23T06:55:16.742900
2021-03-10T16:59:24
2021-03-10T16:59:24
346,310,455
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package jpabook.jpashop.domain; import jpabook.jpashop.domain.Item.Item; import lombok.Getter; import lombok.Setter; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Getter @Setter public class Category { @Id @GeneratedValue @Column(name = "category_id") private Long id; private String name; @ManyToMany @JoinTable(name = "category_item", joinColumns = @JoinColumn(name = "category_id"), inverseJoinColumns = @JoinColumn(name = "item_id")) private List<Item> items = new ArrayList<>(); @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "parent_id") private Category parent; @OneToMany(mappedBy = "parent") private List<Category> child = new ArrayList<>(); //==연관관계 메서드==// public void addChildCategory(Category child) { this.child.add(child); child.setParent(this); } }
0478e54ad22a256e95110391847dbfd074c31ecc
b927858dc16a66a69641ed1b3686a2c303cd054d
/GreenfootGaneMario Game/house2.java
031bc424775ebaf94013ed9d2f238674fb02e43f
[]
no_license
1990mUkuna/GreenFooot_Game-Java-languag
78d36f10dee20ce769f754c1e27913f04a4dd7c6
a525e5ed917b0f65ebc29bd1cafb41603decea63
refs/heads/master
2020-05-02T06:13:29.128458
2019-03-26T14:00:25
2019-03-26T14:00:25
177,789,906
0
0
null
null
null
null
UTF-8
Java
false
false
499
java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class house2 here. * * @author (your name) * @version (a version number or a date) */ public class house2 extends Actor { /** * Act - do whatever the house2 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. } }
e7933215a274160cc6ac508ed87761cdededbfb8
6bc8c084ab73580224fb0a27be60c8efc23a84c2
/src/ast/expression/AbstractExpression.java
8c902ad2a747f22821059c11f6113f4af118fb8b
[]
no_license
cesarcamblor/dlp
506310fd9723d360815a2e1b33dc8ab961864098
cc5ab91135ab282d46065edc0dfa92c99f11259f
refs/heads/master
2020-06-10T20:46:42.746504
2019-06-25T16:13:01
2019-06-25T16:13:01
193,741,507
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
/** * @generated VGen (for ANTLR) 1.4.0 */ package ast.expression; import ast.AbstractAST; import ast.type.Type; public abstract class AbstractExpression extends AbstractAST implements Expression { public void setType(Type type) { this.type = type; } public Type getType() { return type; } public void setModificable(boolean modificable) { this.modificable = modificable; } public boolean isModificable() { return modificable; } private Type type; private boolean modificable; }
1ed86310ac1acd5f2ce0456b4b6d067e2c9d3eb1
b10389c626a7e2673829686cb292aefcf69daa9a
/src/test/java/com/java/zonov/junit/db/MyBLogicTest.java
41e0dc0deadff64a3e3534209febae7e42ee7f8e
[]
no_license
EugeneNSK/JUnit
945b746c5b03b1a48a3285aff6f5f66bc7c688df
d270d139adc8c0789fdcd5bb8531fd2eec835b7b
refs/heads/master
2020-03-25T01:36:05.718724
2018-12-03T03:41:40
2018-12-03T03:41:40
143,245,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,344
java
package com.java.zonov.junit.db; import org.jmock.Expectations; import org.jmock.Mockery; import org.junit.Test; import java.sql.SQLException; import static org.junit.Assert.*; public class MyBLogicTest { //контейнер управляющий генерацие объектов имитации Mockery ctx = new Mockery(); @Test public void editItem() throws SQLException { int id=5; String newName = "world"; // Работа с Mock объектом *** начало DBase db = ctx.mock(DBase.class); // 1. Создание объекта имитации ctx.checking(new Expectations(){{ // 2. Указание ожиданий(действий) от имитации oneOf(db).find(id); // - на объекте db один раз вызывается метод find oneOf(db).save(id,newName); // - на объекте db один раз вызывается метод save will(returnValue(2)); // - ожидаем, что результат будет равен 2 }}); // Работа с Mock объектом *** конец MyBLogic myBLogic = new MyBLogic(); int expResult = 1; int result = myBLogic.editItem(id,newName,db); assertEquals(expResult, result); } }
19d36b010c738d3848a3dcccc7134594409313a4
14ab14873af277b8d0eff3988f80e5a9be87c262
/chap12-prac05/src/PlusMinusImageFrame.java
d776e08c453cbb60acaed4239ab07d58dff1a06c
[]
no_license
ehtlfkr/Java
5a0d659d69c2137c377beea6152c6ee4954f2b5c
fd7ec78b66fc0fbb505dd38805de397dbe69b3be
refs/heads/master
2020-05-14T23:50:43.822955
2019-12-06T03:05:20
2019-12-06T03:05:20
182,002,260
0
0
null
null
null
null
UHC
Java
false
false
1,302
java
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class PlusMinusImageFrame extends JFrame{ public PlusMinusImageFrame(){ setTitle("그래픽 이미지 확대 축소 연습"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setContentPane(new MyPanel()); setSize(300, 300); setVisible(true); getContentPane().setFocusable(true); getContentPane().requestFocus(); } class MyPanel extends JPanel{ private ImageIcon icon = new ImageIcon("images/apple.jpg"); private Image img = icon.getImage(); private int width, height; public MyPanel() { width = img.getWidth(this); height = img.getHeight(this); addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e){ if(e.getKeyChar() == '+'){ width = (int)(width*1.1); height = (int)(height*1.1); repaint(); } else if(e.getKeyChar() == '-'){ width = (int)(width*0.9); height = (int)(height*0.9); repaint(); } } }); } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img, 10, 10, width, height, this); } } public static void main(String[] args) { new PlusMinusImageFrame(); } }
[ "USER@AMP-10" ]
USER@AMP-10
10fda2a4580b0e42aceaa569f69d8e9ed5e9c4fa
f6dacb34c10fa1c3be84ebbc7cb482344b6fbd5d
/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java
770e7f3bd3ff90069d379fdfc09ab04fa005d7fa
[]
no_license
primesign/pdf-as-4
2f2a2f4cfdbff64ecf926fee64327c93c07d3473
29c19a50b93ea379feae1bb0d7f576c758be175b
refs/heads/master
2023-04-28T06:31:36.838914
2023-01-23T14:09:11
2023-01-23T14:10:33
30,864,921
4
2
null
2023-04-27T23:54:32
2015-02-16T11:14:06
Java
UTF-8
Java
false
false
3,787
java
/******************************************************************************* * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a * joint initiative of the Federal Chancellery Austria and Graz University of * Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * This product combines work with different licenses. See the "NOTICE" text * file for details on the various modules and licenses. * The "NOTICE" text file is part of the distribution. Any derivative works * that you distribute must include a readable copy of the "NOTICE" text file. ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.InputStream; import java.security.cert.X509Certificate; import java.util.Date; import java.util.List; import at.gv.egiz.pdfas.api.commons.Constants; import at.gv.egiz.pdfas.api.exceptions.PdfAsException; import at.gv.egiz.pdfas.api.exceptions.PdfAsWrappedException; import at.gv.egiz.pdfas.api.io.DataSource; import at.gv.egiz.pdfas.api.verify.SignatureCheck; import at.gv.egiz.pdfas.api.verify.VerifyResult; import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData; public class VerifyResultWrapper implements VerifyResult { private at.gv.egiz.pdfas.lib.api.verify.VerifyResult newResult; public VerifyResultWrapper(at.gv.egiz.pdfas.lib.api.verify.VerifyResult newResult) { this.newResult = newResult; } public String getSignatureType() { return null; } public DataSource getSignedData() { return new ByteArrayDataSource_OLD(this.newResult.getSignatureData()); } public X509Certificate getSignerCertificate() { return this.newResult.getSignerCertificate(); } public Date getSigningTime() { return null; } public Object getInternalSignatureInformation() { return null; } public String getTimeStampValue() { return null; } public void setNonTextualObjects(List nonTextualObjects) { } public boolean isVerificationDone() { return this.newResult.isVerificationDone(); } public PdfAsException getVerificationException() { return new PdfAsWrappedException(this.newResult.getVerificationException()); } public SignatureCheck getCertificateCheck() { return new SignatureCheckWrapper(this.newResult.getCertificateCheck()); } public SignatureCheck getValueCheckCode() { return new SignatureCheckWrapper(this.newResult.getValueCheckCode()); } public SignatureCheck getManifestCheckCode() { return new SignatureCheckWrapper(this.newResult.getManifestCheckCode()); } public boolean isQualifiedCertificate() { return this.newResult.isQualifiedCertificate(); } public boolean isPublicAuthority() { return false; } public String getPublicAuthorityCode() { return null; } public List getPublicProperties() { return null; } public Date getVerificationTime() { return null; } public String getHashInputData() { return null; } public List getNonTextualObjects() { return null; } public boolean hasNonTextualObjects() { return false; } public XMLDsigData getReconstructedXMLDsig() { return null; } }
bd52a40e8d1a6cd53bbc163fa8b7dd9da08f7d1b
73755b061d456d47ee9de1b0cfaf41cf2b974e56
/app/src/androidTest/java/com/np/dipendra/pearl/ExampleInstrumentedTest.java
59ac70f3e51e837b91d0554e38e2c42afb4e89fb
[]
no_license
dipendrabist/Pearl
c7457ae1f07a7d355fe339a58769ebb8404c1bf2
bf01cec90916bf4b3361cd80e52e0a39e631b0b9
refs/heads/master
2020-04-12T18:14:41.628887
2018-12-21T06:21:16
2018-12-21T06:21:16
162,673,773
1
0
null
null
null
null
UTF-8
Java
false
false
726
java
package com.np.dipendra.pearl; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.np.dipendra.pearl", appContext.getPackageName()); } }
[ "dipendrabist101gmail.com" ]
dipendrabist101gmail.com
84d50a574082128c0f1ded067ac05b02590e0fa4
8d8ace87328405a97a068a9bb1a265fc59b61a15
/src/com/concept/crackingthecodinginterview/chapter1/Problem1.java
99f66b8300197f7d26e10663c4296b4aa62b53dd
[]
no_license
iqbal2907/Java-Concepts
71cb5eb462e8f55dd515f0dd5a275cc364cc61f4
e6ffacf6874d4f624f3e1f9c6e31daee64d262f9
refs/heads/master
2021-07-02T18:04:23.970230
2021-06-10T05:14:07
2021-06-10T05:14:07
37,520,235
0
0
null
2018-04-02T05:46:17
2015-06-16T09:15:53
Java
UTF-8
Java
false
false
983
java
/** * Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? */ package com.concept.crackingthecodinginterview.chapter1; public class Problem1 { public static boolean isUniqueChars1(String str) { boolean[] char_set = new boolean[256]; for (int i = 0; i < str.length(); i++) { int val = str.charAt(i); if (char_set[val]) return false; char_set[val] = true; } return true; } /* * following method will check uniqueness only for string with small case */ public static boolean isUniqueChars2(String str) { int checker = 0; for (int i = 0; i < str.length(); ++i) { int val = str.charAt(i) - 'A'; if ((checker & (1 << val)) > 0) return false; checker |= (1 << val); } return true; } public static void main(String[] args) { String str = "dfgAS"; System.out.println(Problem1.isUniqueChars1(str)); System.out.println(Problem1.isUniqueChars2(str)); } }
478565f9cfad0cbb07fdb195496ccfc35867856a
14f11849720388164a3a2142ee6cf6efaca68faf
/src/main/java/com/iup/tp/twitup/ihm/components/inscriptionComponent/InscriptionComponentAdapter.java
6667ce5c85410c07e23eb10515e3a62888b2d9e7
[]
no_license
Robin-Ln/M2_Twitup_UE_IHM
e3fbdd94242fd8122a5481b93cda87f754f8d99c
d25deff01e1bc8b9b9c134f002d26512a24a046f
refs/heads/master
2020-04-26T19:35:34.341652
2019-03-12T16:43:21
2019-03-12T16:43:21
173,780,185
0
0
null
null
null
null
UTF-8
Java
false
false
280
java
package com.iup.tp.twitup.ihm.components.inscriptionComponent; import com.iup.tp.twitup.datamodel.User; public abstract class InscriptionComponentAdapter implements IInscriptionComponentObserver { @Override public void notifyRequestUserInscription(User user) { } }
edfdae94f8cd57c894faa16b137305dc5462ad8e
c7bf6b30d164793b330eefcfae078146843977c3
/reactor-core/ShowCase/backpressure/EventSource.java
6d24cc860db1239aee495eb80835561b8200802d
[]
no_license
machao23/dairy
3838ef7103d746e68dbfe9f796cefca0bd28c06f
c6d86357d0c027af4833f0aafb4172731cbbda1d
refs/heads/master
2022-08-06T12:46:40.634637
2022-07-31T07:11:01
2022-07-31T07:11:01
155,980,015
0
0
null
null
null
null
UTF-8
Java
false
false
607
java
package com.rinbo.reactor.backpressure; import java.util.ArrayList; import java.util.List; public class EventSource { private List<EventListener> listeners; public EventSource() { listeners = new ArrayList<>(); } public void onEvent(Event event) { for (EventListener listener : listeners) { listener.onEvent(event); } } public void onStop() { for (EventListener listener : listeners) { listener.onStop(); } } public void addListener(EventListener listener) { this.listeners.add(listener); } }
f3a935452b66c35b5eae9203457a08e1d8e27d4f
c2f8b6d1d153588a5055d96140352be1ceb98bc8
/A19N0028P-TicTacToe/tictactoe/app/src/main/java/com/tictactoe/MainActivity.java
89e812db3dc00517b0ce4406af9be4094be729eb
[]
no_license
danisik/MBKZ
4be10b6649afb071fed636418ec83a4b8078ad64
9bed3ab2dad579821cbef9eb4b061de861595906
refs/heads/master
2021-01-05T14:56:09.157940
2020-05-03T09:12:02
2020-05-03T09:12:02
241,055,551
0
0
null
null
null
null
UTF-8
Java
false
false
13,736
java
package com.tictactoe; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Point; import android.graphics.PorterDuff; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; import com.tictactoe.Checkers.EGameStatus; import com.tictactoe.Checkers.MoveChecker; import com.tictactoe.CustomElements.CustomButton; import com.tictactoe.Data.Constants; import com.tictactoe.Data.Node; import com.tictactoe.PlayerEngine.PlayerEngine; import android.os.Vibrator; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { public MainActivity activity = this; public MoveChecker moveChecker = new MoveChecker(); public PlayerEngine playerEngine = new PlayerEngine(this); public Boolean firstPlayerMove = true; private Point lastButtonClicked = null; public CustomButton[][] buttons; public int mapSize = 0; public int buttonTextSize = 80; public final String firstPlayerMarker = "X"; public final String secondPlayerMarker = "O"; public EGameStatus gameStatus = EGameStatus.NOT_RUNNING; // GUI. public PopupWindow popupWindow = null; public TextView textViewWinsValue = null; public int winsCount = 0; public TextView textViewDrawsValue = null; public int drawsCount = 0; public TextView textViewLosesValue = null; public int losesCount = 0; public Bundle bundle; private SharedPreferences sharedPreferences; @Override protected void onCreate(Bundle savedInstanceState) { this.bundle = savedInstanceState; super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); textViewWinsValue = (TextView) findViewById(R.id.textViewWinsValue); textViewDrawsValue = (TextView) findViewById(R.id.textViewDrawsValue); textViewLosesValue = (TextView) findViewById(R.id.textViewLosesValue); sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE); int loadedWinsCount = sharedPreferences.getInt("WINS", -1); int loadedDrawsCount = sharedPreferences.getInt("DRAWS", -1); int loadedLosesCount = sharedPreferences.getInt("LOSES", -1); if (loadedWinsCount != -1) { winsCount = loadedWinsCount; } if (loadedDrawsCount != -1) { drawsCount = loadedDrawsCount; } if (loadedLosesCount != -1) { losesCount = loadedLosesCount; } textViewWinsValue.setText("" + winsCount); textViewDrawsValue.setText("" + drawsCount); textViewLosesValue.setText("" + losesCount); } @Override protected void onStart() { super.onStart(); showPopupChooseMapSize(""); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); /* //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } */ return super.onOptionsItemSelected(item); } private LinearLayout createTicTacToeHorizontalLayout(int id) { LinearLayout layout = new LinearLayout(this); layout.setId(id); layout.setOrientation(LinearLayout.HORIZONTAL); layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1)); return layout; } private CustomButton createTicTacToeButton(int id) { final CustomButton btn = new CustomButton(this); btn.setId(id); btn.setTextSize(buttonTextSize); btn.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT, 1)); btn.setIncludeFontPadding(false); btn.getBackground().setColorFilter(ContextCompat.getColor(this, android.R.color.white), PorterDuff.Mode.MULTIPLY); btn.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { if (!setMarker(btn)) return; if (lastButtonClicked != null) { buttons[lastButtonClicked.x][lastButtonClicked.y].getBackground().setColorFilter(ContextCompat.getColor(activity, android.R.color.white), PorterDuff.Mode.MULTIPLY); lastButtonClicked = null; } EGameStatus status = moveChecker.checkGameStatus(buttons, btn); if (status == EGameStatus.DRAW) { drawsCount++; textViewDrawsValue.setText("" + drawsCount); showPopupChooseMapSize("It's a DRAW!"); gameStatus = EGameStatus.DRAW; saveDrawsCount(); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(400); return; } else if (status == EGameStatus.WIN) { winsCount++; textViewWinsValue.setText("" + winsCount); showPopupChooseMapSize("You WIN!"); gameStatus = EGameStatus.WIN; saveWinsCount(); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(400); return; } else { int[] buttonXY = playerEngine.getOptimalButton(); placeAMove(buttonXY[1], buttonXY[2], Constants.PLAYER_2_ID); buttons[buttonXY[1]][buttonXY[2]].setText(secondPlayerMarker); buttons[buttonXY[1]][buttonXY[2]].getBackground().setColorFilter(ContextCompat.getColor(activity, android.R.color.holo_orange_light), PorterDuff.Mode.MULTIPLY); status = moveChecker.checkGameStatus(buttons, buttons[buttonXY[1]][buttonXY[2]]); lastButtonClicked = new Point(buttonXY[1], buttonXY[2]); if (status == EGameStatus.DRAW) { drawsCount++; textViewDrawsValue.setText("" + drawsCount); saveDrawsCount(); showPopupChooseMapSize("It's a DRAW!"); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(400); return; } else if (status == EGameStatus.WIN) { losesCount++; textViewLosesValue.setText("" + losesCount); showPopupChooseMapSize("You LOSE!"); gameStatus = EGameStatus.LOSE; saveLosesCount(); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(400); return; } firstPlayerMove = true; } } }); return btn; } private Boolean setMarker(CustomButton btn) { if (!btn.getText().equals("")) { Toast.makeText(this,"This button was clicked before!", Toast.LENGTH_SHORT).show(); return false; } if (firstPlayerMove) { btn.setText(firstPlayerMarker); placeAMove(btn.getButtonX(), btn.getButtonY(), Constants.PLAYER_1_ID); firstPlayerMove = false; return true; } else { Toast.makeText(this,"It's not your turn!", Toast.LENGTH_SHORT).show(); return false; } } public void placeAMove(int x, int y, int player) { buttons[x][y].setPlayer(player); } public List<Node> generateNoClickedButtons() { List<Node> nodeList = new ArrayList<>(); for (int x = 0; x < mapSize; x++) { for (int y = 0; y < mapSize; y++) { if (buttons[x][y].getPlayer() == 0) nodeList.add(new Node(x, y, Constants.NO_PLAYER)); } } return nodeList; } private void newGame(int newMapSize) { firstPlayerMove = true; if (newMapSize == mapSize) { for (int i = 0; i < mapSize; i++) { for (int j = 0; j < mapSize; j++) { buttons[j][i].setText(""); buttons[j][i].setPlayer(Constants.NO_PLAYER); } } } else { mapSize = newMapSize; moveChecker.setMapSize(mapSize); LinearLayout buttonLayout = (LinearLayout) findViewById(R.id.buttonLayout); buttons = new CustomButton[mapSize][mapSize]; deleteAllElements(buttonLayout); for (int i = 0; i < mapSize; i++) { LinearLayout horizontalLayout = createTicTacToeHorizontalLayout(i); for (int j = 0; j < mapSize; j++) { CustomButton btn = createTicTacToeButton((i * mapSize) + (j+1)); btn.setButtonX(j); btn.setButtonY(i); btn.setPlayer(Constants.NO_PLAYER); horizontalLayout.addView(btn); buttons[j][i] = btn; } buttonLayout.addView(horizontalLayout); } } } private void deleteAllElements(LinearLayout buttonLayout ) { if(buttonLayout.getChildCount() > 0) buttonLayout.removeAllViews(); } private void saveWinsCount() { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt("WINS", winsCount); editor.commit(); } private void saveDrawsCount() { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt("DRAWS", drawsCount); editor.commit(); } private void saveLosesCount() { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt("LOSES", losesCount); editor.commit(); } private void showPopupChooseMapSize(String message) { DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics(); int width = displayMetrics.widthPixels; int height = displayMetrics.heightPixels; // Inflate the popup_layout.xml LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.layout_popup, null); TextView txtMessage = (TextView) layout.findViewById(R.id.textViewStatus); txtMessage.setText(message); // Creating the PopupWindow popupWindow = new PopupWindow(this); popupWindow.setContentView(layout); popupWindow.setWidth(width); popupWindow.setHeight(height); popupWindow.setFocusable(true); // prevent clickable background popupWindow.setBackgroundDrawable(null); // Getting a reference to button one and do something Button btn5x5 = (Button) layout.findViewById(R.id.button5x5); btn5x5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { buttonTextSize = 80; newGame(5); popupWindow.dismiss(); popupWindow = null; } }); // Getting a reference to button two and do something Button btn6x6 = (Button) layout.findViewById(R.id.button6x6); btn6x6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { buttonTextSize = 60; newGame(6); popupWindow.dismiss(); popupWindow = null; } }); // Getting a reference to button two and do something Button btn7x7 = (Button) layout.findViewById(R.id.button7x7); btn7x7.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { buttonTextSize = 50; newGame(7); popupWindow.dismiss(); popupWindow = null; } }); findViewById(R.id.buttonLayout).post(new Runnable() { @Override public void run() { popupWindow.showAtLocation(layout, Gravity.CENTER, 1, 1); } }); gameStatus = EGameStatus.RUNNING; } public MoveChecker getMoveChecker() { return moveChecker; } }
c13c1b57ed59ef0699bd68503d476d22db63b4e2
4e0943c9979a69650ff49feae3e1625a64b4219b
/src/com/xmlframework/entity/common/XmlReqHeader.java
2a92502dcc7c4125a1bf841e89356cfb92188081
[ "MIT" ]
permissive
hujingli/xml-framework
931e7cdaf488d89b8998d1d7a9d494b1b9cff201
8ba19258956aec177b256eb6facc9cc6883391a9
refs/heads/master
2020-07-05T14:10:02.607979
2019-08-16T06:20:08
2019-08-16T06:20:08
202,669,130
1
0
null
null
null
null
UTF-8
Java
false
false
437
java
package com.xmlframework.entity.common; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; @XmlType(propOrder = { "reqCode" }) public class XmlReqHeader { @XmlElement(name = "reqCode") private String reqCode; @XmlTransient public String getReqCode() { return reqCode; } public void setReqCode(String reqCode) { this.reqCode = reqCode; } }
a04180fc4d0987fde3cbdd9ad51df972eddb82b7
e34661720d8834a45812af768953f4be762d9dd3
/1. Bahan Ajar/Praktikum03-Pengenalan Pemrograman PBO/sinauclass/src/sinauclass/Sinauclass.java
6a8f854135e0353b635b3f76662b42e96cfdae19
[]
no_license
Ilham1996-cyber/PBO-TI20192020-3-4
39fe96fa967122e5560026e81825a4e0ce42f339
a2d1cd3bdb488e584e79afc8aa83e24a761d3703
refs/heads/master
2023-04-27T16:38:26.319693
2019-09-17T17:19:44
2019-09-17T17:19:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
147
java
package sinauclass; public class Sinauclass { public static void main(String[] args) { // TODO code application logic here } }
ea2c5236d6a227bc05287cb9426d263715035b00
961d51acd20d6ec5e203428c323988aed1493c79
/app/src/main/java/com/example/admin/pakistanweather/model/currentlocationdata/Geometry.java
0142ffaba7a4e83ee00a8fca0d102009814f5f16
[]
no_license
mrizwanghuman/PakistanWeather
7ad8074ad9c69b25d901046b0953b466ef540e83
c3472160703c77ad15a5c0d518da99158f69a9ba
refs/heads/master
2021-09-04T17:59:26.335134
2018-01-09T05:22:04
2018-01-09T05:22:04
114,578,188
1
0
null
2018-01-09T05:22:05
2017-12-18T00:06:59
Java
UTF-8
Java
false
false
1,131
java
package com.example.admin.pakistanweather.model.currentlocationdata; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Geometry { @SerializedName("location") @Expose private Location location; @SerializedName("location_type") @Expose private String locationType; @SerializedName("viewport") @Expose private Viewport viewport; @SerializedName("bounds") @Expose private Bounds bounds; public Location getLocation() { return location; } public void setLocation(Location location) { this.location = location; } public String getLocationType() { return locationType; } public void setLocationType(String locationType) { this.locationType = locationType; } public Viewport getViewport() { return viewport; } public void setViewport(Viewport viewport) { this.viewport = viewport; } public Bounds getBounds() { return bounds; } public void setBounds(Bounds bounds) { this.bounds = bounds; } }
3ee9cee992c7a78f81bbbbf405498f592083b6a6
a434ebad3d93ea87872e8174786ed15b906c94fa
/WebRest/WebRest/src/br/com/fiap/fiaproupasdelivery/dao/ClienteDAO.java
0275929c50e4633a10e995997c9a530b879a27c4
[]
no_license
kacioidarlan/workspace
0aaacc05d98b50346026c7b93300700bcb6c5f88
52e02003070ae6e719a85930eb01ade300fb1ae4
refs/heads/master
2016-09-10T00:26:06.622520
2014-02-23T18:44:04
2014-02-23T18:44:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,757
java
package br.com.fiap.fiaproupasdelivery.dao; import java.util.ArrayList; import java.util.List; import org.hibernate.Session; import br.com.fiap.fiaproupasdelivery.entities.Cliente; import br.com.fiap.fiaproupasdelivery.entities.Entregador; public class ClienteDAO implements GenericDAO<Cliente, Long>{ public Session session; public void setSession(Session session){ this.session = session; } @Override public boolean create(Cliente t) { boolean retorno = false; try{ this.session.beginTransaction(); this.session.save(t); this.session.getTransaction().commit(); //this.session.close(); retorno = true; }catch(Exception e){ e.printStackTrace(); } return retorno; } @Override public boolean update(Cliente t) { boolean retorno = false; try{ this.session.beginTransaction(); this.session.update(t); this.session.getTransaction().commit(); //this.session.close(); retorno = true; }catch(Exception e){ e.printStackTrace(); } return retorno; } @Override public boolean delete(Cliente t) { boolean retorno = false; try{ this.session.beginTransaction(); this.session.delete(t); this.session.getTransaction().commit(); //this.session.close(); retorno = true; }catch(Exception e){ } return retorno; } @Override public List<Cliente> findAll() { List<Cliente> clientes = new ArrayList<Cliente>(); this.session.beginTransaction(); clientes = this.session.createCriteria(Cliente.class).list(); //this.session.close(); return clientes; } @Override public Cliente findById(Long id) { Cliente c = new Cliente(); this.session.beginTransaction(); c = (Cliente) this.session.get(Cliente.class, id); //this.session.close(); return c; } }
d26269ffa51e38f51757c4e317c8e3df707f5811
4553ea35dcc41d585161b8411d49e9b70937fdd8
/src/main/java/com/demo/test/helper/FileHelper.java
d4805a238cba67b76f1ed70d706438ee6103ccfa
[]
no_license
wx8900/SpringBootPage
7913a75260273da776a7bcf78717abc081ced3cf
1d1dfcd81882677d6908b122f974370f48ada313
refs/heads/master
2022-07-06T19:59:08.393070
2021-02-03T02:33:32
2021-02-03T02:33:32
182,468,237
2
0
null
2022-06-29T19:48:15
2019-04-21T00:41:00
Java
UTF-8
Java
false
false
26,350
java
package com.demo.test.helper; import org.apache.commons.io.FilenameUtils; import org.dom4j.Document; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; import org.hibernate.internal.util.StringHelper; import java.io.*; import java.util.List; import java.util.StringTokenizer; import java.util.zip.CRC32; import java.util.zip.CheckedInputStream; public class FileHelper { /** * 1kb */ private final static int KB_1 = 1024; /** * 获得文件的CRC32校验和 * * @param file 要进行校验的文件 * @return * @throws Exception */ public static String getFileCRCCode(File file) throws Exception { FileInputStream is = new FileInputStream(file); CRC32 crc32 = new CRC32(); CheckedInputStream cis = new CheckedInputStream(is, crc32); byte[] buffer = null; buffer = new byte[KB_1]; while (cis.read(buffer) != -1) { } is.close(); buffer = null; return Long.toHexString(crc32.getValue()); } /** * 获得字串的CRC32校验和 * * @param string 要进行校验的字串 * @return * @throws Exception */ public static String getStringCRCCode(String string) throws Exception { ByteArrayInputStream inputStream = new ByteArrayInputStream(string.getBytes()); CRC32 crc32 = new CRC32(); CheckedInputStream checkedinputstream = new CheckedInputStream(inputStream, crc32); byte[] buffer = null; buffer = new byte[KB_1]; while (checkedinputstream.read(buffer) != -1) { } inputStream.close(); buffer = null; return Long.toHexString(crc32.getValue()); } /** * 连接路径和文件名称,组成最后的包含路径的文件名 * * @param basePath 文件路径 * @param fullFilenameToAdd 文件名称 * @return */ public static String concat(String basePath, String fullFilenameToAdd) { return FilenameUtils.concat(basePath, fullFilenameToAdd); } /** * 获得不带文件扩展名的文件名称 * * @param filename 文件完整路径 * @return 不带扩展名的文件名称 */ public static String getBaseName(String filename) { return FilenameUtils.getBaseName(filename); } /** * 获得带扩展名的文件名称 * * @param filename 文件完整路径 * @return 文件名称 */ public static String getFileName(String filename) { return FilenameUtils.getName(filename); } /** * 获得文件的完整路径,包含最后的路径分隔条 * * @param filename 文件完整路径 * @return 目录结构 */ public static String getFullPath(String filename) { return FilenameUtils.getFullPath(filename); } /** * 获得文件的完整路径,不包含最后的路径分隔条 * * @param filename 文件完整路径 * @return */ public static String getFullPathNoEndSeparator(String filename) { return FilenameUtils.getFullPathNoEndSeparator(filename); } /** * 判断文件是否有某扩展名 * * @param filename 文件完整路径 * @param extension 扩展名名称 * @return 若是,返回true,否则返回false */ public static boolean isExtension(String filename, String extension) { return FilenameUtils.isExtension(filename, extension); } /** * 判断文件的扩展名是否是扩展名数组中的一个 * * @param filename 文件完整路径 * @param extensions 扩展名名称 * @return 若是,返回true,否则返回false */ public static boolean isExtension(String filename, String[] extensions) { return FilenameUtils.isExtension(filename, extensions); } /** * 规范化路径,合并其中的多个分隔符为一个,并转化为本地系统路径格式 * * @param filename 文件完整路径 * @return */ public static String normalize(String filename) { return FilenameUtils.normalize(filename); } /** * 规范化路径,合并其中的多个分隔符为一个,并转化为本地系统路径格式,若是路径,则不带最后的路径分隔符 * * @param filename 文件完整路径 * @return */ public static String normalizeNoEndSeparator(String filename) { return FilenameUtils.normalizeNoEndSeparator(filename); } /** * 把文件路径中的分隔符转换为unix的格式,也就是"/" * * @param path 文件完整路径 * @return 转换后的路径 */ public static String separatorsToUnix(String path) { return FilenameUtils.separatorsToUnix(path); } /** * 把文件路径中的分隔符转换为window的格式,也就是"\" * * @param path 文件完整路径 * @return 转换后的路径 */ public static String separatorsToWindows(String path) { return FilenameUtils.separatorsToWindows(path); } /** * 把文件路径中的分隔符转换当前系统的分隔符 * * @param path 文件完整路径 * @return 转换后的路径 */ public static String separatorsToSystem(String path) { return FilenameUtils.separatorsToSystem(path); } /** * 提取文件的扩展名 * * @param filename 文件名称 * @return 文件扩展名,若没有扩展名,则返回空字符串 */ public static String getExtension(String filename) { return FilenameUtils.getExtension(filename); } /** * 移出文件的扩展名 * * @param filename 文件名称 * @return 若文件存在扩展名,则移出扩展名,然后返回移出后的值 */ public static String removeExtension(String filename) { return FilenameUtils.removeExtension(filename); } /** * 清除一个目录的内容,但不删除此目录 * * @param directory 需要清除的目录 * @return true:清除成功 false:清除失败 */ public static boolean cleanDirectory(File directory) { try { org.apache.commons.io.FileUtils.cleanDirectory(directory); return true; } catch (IOException ex) { System.err.println("清除目录出错"); ex.printStackTrace(); } return false; } /** * 拷贝一个目录的内容到另外一个目录中 * * @param srcDir 源目录 * @param destDir 目的目录 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyDirectory(File srcDir, File destDir) { return copyDirectory(srcDir, destDir, true); } /** * 拷贝一个目录的内容到另外一个目录中 * * @param srcDir 源目录 * @param destDir 目的目录 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyDirectory(String srcDir, String destDir) { return copyDirectory(new File(srcDir), new File(destDir)); } /** * 拷贝一个目录的内容到另外一个目录中 * * @param srcDir 源目录 * @param destDir 目的目录 * @param preserveFileDate 是否保持文件日期 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyDirectory(File srcDir, File destDir, boolean preserveFileDate) { try { org.apache.commons.io.FileUtils.copyDirectory(srcDir, destDir, preserveFileDate); return true; } catch (IOException ex) { System.err.println("复制目录出错"); ex.printStackTrace(); } return false; } /** * 拷贝源目录的内容到目的目录中(注:是拷贝到目的目录的里面) * * @param srcDir 源目录 * @param destDir 目的目录 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyDirectoryToDirectory(File srcDir, File destDir) { try { org.apache.commons.io.FileUtils.copyDirectoryToDirectory(srcDir, destDir); return true; } catch (IOException ex) { ex.printStackTrace(); System.err.println("复制目录出错"); } return false; } /** * 拷贝源目录的内容到目的目录中(注:是拷贝到目的目录的里面) * * @param srcDir 源目录 * @param destDir 目的目录 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyDirectoryToDirectory(String srcDir, String destDir) { return copyDirectoryToDirectory(new File(srcDir), new File(destDir)); } /** * 拷贝文件 * * @param srcFile 源文件 * @param destFile 目的文件 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyFile(File srcFile, File destFile) { return copyFile(srcFile, destFile, true); } /** * 拷贝文件 * * @param srcFile 源文件路径 * @param destFile 目的文件路径 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyFile(String srcFile, String destFile) { return copyFile(new File(srcFile), new File(destFile)); } /** * 拷贝文件 * * @param srcFile 源文件 * @param destFile 目的文件 * @param preserveFileDate 是否保留文件日期 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyFile(File srcFile, File destFile, boolean preserveFileDate) { try { org.apache.commons.io.FileUtils.copyFile(srcFile, destFile, preserveFileDate); return true; } catch (IOException ex) { ex.printStackTrace(); System.err.println("复制文件出错"); } return false; } /** * 拷贝文件到某目录中 * * @param srcFile 源文件 * @param destDir 目的目录 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyFileToDirectory(File srcFile, File destDir) { try { org.apache.commons.io.FileUtils.copyFileToDirectory(srcFile, destDir); return true; } catch (IOException ex) { ex.printStackTrace(); System.err.println("复制文件出错"); } return false; } /** * 拷贝文件到某目录中 * * @param srcFile 源文件 * @param destDir 目的目录 * @return true:拷贝成功 false:拷贝失败 */ public static boolean copyFileToDirectory(String srcFile, String destDir) { return copyFileToDirectory(new File(srcFile), new File(destDir)); } /** * 删除一个目录和该目录下的所有内容 * * @param directory 需要删除的目录 * @return true:删除成功 false:删除失败 */ public static boolean deleteDirectory(String directory) { try { org.apache.commons.io.FileUtils.deleteDirectory(new File(directory)); return true; } catch (IOException ex) { System.err.println("删除目录出错"); ex.printStackTrace(); } return false; } /** * 删除文件 * * @param file 需要删除的文件路径 * @return true:删除成功 false:删除失败 */ public static boolean deleteFile(String file) { try { org.apache.commons.io.FileUtils.forceDelete(new File(file)); return true; } catch (IOException ex) { System.err.println("删除文件出错"); ex.printStackTrace(); } return false; } /** * 递归创建目录 * * @param directory 目录 * @return */ public static boolean createDirectory(String directory) { try { org.apache.commons.io.FileUtils.forceMkdir(new File(directory)); return true; } catch (IOException ex) { System.err.println("创建目录出错"); ex.printStackTrace(); } return false; } /** * 读入文件到字节数组中 * * @param file 需要读取的文件路径 * @return 读取的字节数组,若读入失败,则返回null */ public static byte[] readFileToByteArray(String file) { try { byte[] bytes = org.apache.commons.io.FileUtils.readFileToByteArray(new File(file)); return bytes; } catch (IOException ex) { System.err.println("读取文件出错"); ex.printStackTrace(); } return null; } /** * 读入文件到字串中 * * @param file 需要读取的文件路径 * @return 读取的文件内容,若读入失败,则返回空字串 */ public static String readFileToString(String file, String encoding) { try { if (StringHelper.isEmpty(encoding)) { encoding = "GBK"; } String content = org.apache.commons.io.FileUtils.readFileToString(new File(file), encoding); return content; } catch (IOException ex) { System.err.println("读取文件出错"); ex.printStackTrace(); } return ""; } /** * 读入文件到字串中 * * @param file 需要读取的文件路径 * @return 读取的文件内容,若读入失败,则返回空字串 */ public static String readFileToString(String file) { return readFileToString(file, "GBK"); } /** * 读入文本文件到一个按行分开的List中 * * @param file 需要读取的文件路径 * @return 按行内容分开的List */ @SuppressWarnings("rawtypes") public static List readLines(String file) { return readLines(file, "GBK"); } /** * 读入文本文件到一个按行分开的List中 * * @param file 需要读取的文件路径 * @return 按行内容分开的List */ @SuppressWarnings("rawtypes") public static List readLines(String file, String encoding) { try { if (StringHelper.isEmpty(encoding)) { encoding = "GBK"; } List lineList = org.apache.commons.io.FileUtils.readLines(new File(file), encoding); return lineList; } catch (IOException ex) { System.err.println("读取文件出错"); ex.printStackTrace(); } return null; } /** * 递归求一个目录的容量大小 * * @param directory 需要计算容量的目录路径 * @return 容量的大小(字节数) */ public static long sizeOfDirectory(String directory) { return org.apache.commons.io.FileUtils.sizeOfDirectory(new File(directory)); } /** * 写字节数组到文件中,若文件不存在,则建立新文件 * * @param file 需要写的文件的路径 * @param data 需要写入的字节数据 * @return true:写入成功 false:写入失败 */ public static boolean writeToFile(String file, byte[] data) { try { org.apache.commons.io.FileUtils.writeByteArrayToFile(new File(file), data); return true; } catch (IOException ex) { System.err.println("写文件出错"); ex.printStackTrace(); } return false; } /** * 写字串到文件中,若文件不存在,则建立新文件 * * @param file 需要写的文件的路径 * @param data 需要写入的字串 * @return true:写入成功 false:写入失败 */ public static boolean writeToFile(String file, String data) { return writeToFile(file, data, "GBK"); } /** * 写字串到文件中,若文件不存在,则建立新文件 * * @param file 需要写的文件的路径 * @param data 需要写入的字串 * @param encoding 文件编码,默认为GBK * @return true:写入成功 false:写入失败 */ public static boolean writeToFile(String file, String data, String encoding) { try { if (encoding == null || "".equals(encoding)) { encoding = "GBK"; } org.apache.commons.io.FileUtils.writeStringToFile(new File(file), data, encoding); return true; } catch (IOException ex) { System.err.println("写文件出错"); ex.printStackTrace(); } return false; } /** * 建立由filePathName指定的文件,若文件路径中的目录不存在,则先建立目录 * * @param filePathName 文件路径全名 * @return */ public static boolean createNewFile(String filePathName) { String filePath = FileHelper.getFullPath(filePathName); // 若目录不存在,则建立目录 if (!FileHelper.exists(filePath)) { if (!createDirectory(filePath)) { return false; } } try { File file = new File(filePathName); return file.createNewFile(); } catch (IOException ex) { System.err.println("创建文件出错"); ex.printStackTrace(); return false; } } /** * 判断文件和目录是否已存在 * * @param filePath 文件和目录完整路径 * @return tru:存在 false:不存在 */ public static boolean exists(String filePath) { File file = new File(filePath); return file.exists(); } /** * 判断特定的路径是否为文件 * * @param filePath 文件完整的路径 * @return 若是文件,则返回true,否则返回false */ public static boolean isFile(String filePath) { File file = new File(filePath); return file.isFile(); } /** * 判断特定的路径是否为目录 * * @param filePath 文件完整的路径 * @return 若是目录,则返回true,否则返回false */ public static boolean isDirectory(String filePath) { File file = new File(filePath); return file.isDirectory(); } /** * 更改文件的名称,若不在同一个目录下,则系统会移动文件 * * @param srcFile 源文件路径名称 * @param destFile 目的文件路径名称 * @return */ public static boolean renameTo(String srcFile, String destFile) { File file = new File(srcFile); return file.renameTo(new File(destFile)); } /** * 描述:根据document生成Xml文件 作者:刘宝 时间:Jun 9, 2010 3:16:11 PM * * @param fileName 生成文件的路径 * @param document * @param encoding 编码格式 * @return */ public static boolean WriteToXMLFile(String fileName, Document document, String encoding) { createNewFile(fileName); boolean success = false; /** 格式化输出,类型IE浏览一样 */ OutputFormat format = OutputFormat.createPrettyPrint(); /** 指定XML编码 */ format.setEncoding(encoding); XMLWriter writer = null; try { /** 将document中的内容写入文件中 */ writer = new XMLWriter(new FileOutputStream(new File(fileName)), format); writer.write(document); writer.flush(); success = true; /** 执行成功,需返回true */ } catch (Exception ex) { System.err.println("写文件出错"); ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } finally { if (writer != null) { try { writer.close(); writer = null; } catch (IOException e) { System.err.println("Convert code Error"); e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } } return success; } /** * 新建目录 */ public static boolean newDir(String path) throws Exception { File file = new File(path); return file.mkdirs(); } /** * 删除目录 */ public static boolean deleteDir(String path) throws Exception { File file = new File(path); if (!file.exists()) { return false; } if (file.isFile()) { file.delete(); return false; } File[] files = file.listFiles();// 如果目录中有文件递归删除文件 for (int i = 0; i < files.length; i++) { deleteDir(files[i].getAbsolutePath()); } file.delete(); return file.delete();//删除目录 } /** * 更新目录 */ public static boolean updateDir(String path, String newPath) throws Exception { File file = new File(path); File newFile = new File(newPath); return file.renameTo(newFile); } // 删除文件夹 // param folderPath 文件夹完整绝对路径 public static void delFolder(String folderPath) { try { // 删除完里面所有内容 delAllFile(folderPath); String filePath = folderPath; filePath = filePath; java.io.File myFilePath = new java.io.File(filePath); // 删除空文件夹 myFilePath.delete(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } /** * 删除指定文件夹下所有文件 * * @param path 文件夹完整绝对路径 * @return */ public static boolean delAllFile(String path) { boolean flag = false; File file = new File(path); if (!file.exists()) { return flag; } if (!file.isDirectory()) { return flag; } String[] tempList = file.list(); File temp = null; for (int i = 0; i < tempList.length; i++) { if (path.endsWith(File.separator)) { temp = new File(path + tempList[i]); } else { temp = new File(path + File.separator + tempList[i]); } if (temp.isFile()) { temp.delete(); } if (temp.isDirectory()) { // 先删除文件夹里面的文件 delAllFile(path + "/" + tempList[i]); // 再删除空文件夹 delFolder(path + "/" + tempList[i]); flag = true; } } return flag; } public static void main(String[] d) throws Exception { //deleteDir("d:/ff/dddf"); updateDir("D:\\TOOLS\\Tomcat 6.0\\webapps\\BCCCSM\\nationalExperiment/22222", "D:\\TOOLS\\Tomcat 6.0\\webapps\\BCCCSM\\nationalExperiment/224222"); } /** * 获取文件的后缀名并转化成大写 * * @param fileName 文件名 * @return */ public String getFileSuffix(String fileName) throws Exception { return fileName.substring(fileName.lastIndexOf(".") + 1 ).toUpperCase(); } /** * 创建多级目录 * * @param path 目录的绝对路径 */ public void createMultilevelDir(String path) { try { StringTokenizer st = new StringTokenizer(path, "/"); String path1 = st.nextToken() + "/"; String path2 = path1; while (st.hasMoreTokens()) { path1 = st.nextToken() + "/"; path2 += path1; File inbox = new File(path2); if (!inbox.exists()) { inbox.mkdir(); } } } catch (Exception e) { System.out.println("目录创建失败" + e); e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } /** * 删除文件/目录(递归删除文件/目录) * * @param dirpath 文件或文件夹的绝对路径 */ public void deleteAll(String dirpath) { if (dirpath == null) { System.out.println("目录为空"); } else { File path = new File(dirpath); try { if (!path.exists()) { return;// 目录不存在退出 } // 如果是文件删除 if (path.isFile()) { path.delete(); return; } // 如果目录中有文件递归删除文件 File[] files = path.listFiles(); for (int i = 0, size = files.length; i < size; i++) { deleteAll(files[i].getAbsolutePath()); } path.delete(); } catch (Exception e) { System.out.println("文件/目录 删除失败" + e); e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } } /** * 文件/目录 重命名 * * @param oldPath 原有路径(绝对路径) * @param newPath 更新路径 * @author lyf 注:不能修改上层次的目录 */ public void renameDir(String oldPath, String newPath) { File oldFile = new File(oldPath);// 文件或目录 File newFile = new File(newPath);// 文件或目录 try { boolean success = oldFile.renameTo(newFile);// 重命名 if (!success) { System.out.println("重命名失败"); } else { System.out.println("重命名成功"); } } catch (RuntimeException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } }
881e293ec021a7b17db639deb6b1ea03422b5de6
33c0307d5fa6506c88571a98028281c6ae3a3918
/vertx3-tcp-java/src/chirow/vertx3/tcpclient/TcpClientController.java
62230346d2be9cb8bc2717bc467edbb4fe078534
[]
no_license
chirow/vertx3-tcp-samples
5cf20ce61580367b9869cd431fa33f0feb568d93
24a2d98741601588eb5ab705234b0acaf575866c
refs/heads/master
2016-08-06T16:08:31.738607
2015-08-26T08:11:38
2015-08-26T08:11:38
41,410,660
0
0
null
null
null
null
UTF-8
Java
false
false
1,872
java
package chirow.vertx3.tcpclient; import io.vertx.core.AbstractVerticle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import chirow.vertx3.tcpclient.TcpClientController; public class TcpClientController extends AbstractVerticle { //logback + slf4j static final Logger logger = LoggerFactory.getLogger(TcpClientController.class); public void start() { logger.info("[TcpClientController-start()] START!"); logger.info("[TcpClientController-start()] >>>>>>>>>> Actually not use now."); // 20150826 // if you hope to use tcp client, unlock '/* */' tag. // before use tcp-client, need to tcp-server to be connected from tcp-client! // REMIND, first step: Open TCP-Server. // /* NetClient tcpClient = vertx.createNetClient(); // Connecting to a Remote Server tcpClient.connect(3110, "192.168.0.75", new Handler<AsyncResult<NetSocket>>(){ @Override public void handle(AsyncResult<NetSocket> result) { NetSocket socket = result.result(); // Writing Data socket.write("GET / HTTP/1.1\r\nHost: jenkov.com\r\n\r\n"); // Reading Data socket.handler(new Handler<Buffer>(){ @Override public void handle(Buffer buffer) { System.out.println("Received data: " + buffer.length()); System.out.println(buffer.getString(0, buffer.length())); } }); } }); */ // Closing the TCP Connection //tcpClient.close(); } }
5659d552d14c517e5a7cc49cce7b62238b97d64d
c6d83db5ca391dfb5b068b0363060bb67c9c1d9f
/org.cse.visiri.util/src/main/java/org/cse/visiri/util/WindowQueue.java
1de5f980fac85db3f3cf594538cb287001c7e58e
[]
no_license
visiriCEP/VISIRI
e5775eb1330ac83b8cf605e1df3589f09dfcbe9b
eea51947ebd5d18ee5682e4694d6a722cfa8e130
refs/heads/master
2021-01-18T16:22:52.726429
2015-02-19T12:27:03
2015-02-19T12:27:03
25,860,143
1
1
null
null
null
null
UTF-8
Java
false
false
1,179
java
/* * Copyright 2004,2005 The Apache Software Foundation. * * 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.cse.visiri.util; public class WindowQueue { private int size; private double[] valueArray; private int pos; public WindowQueue(int size){ this.size=size; valueArray=new double[size]; pos=0; } public void add(double val){ if(pos==size) { pos = 0; } valueArray[pos]=val; pos++; } public double getAverage(){ double sum=0; for(int i=0;i<size;i++){ sum+=valueArray[i]; } return sum/size; } }
a03a8b968ade183e8f788971140241ef8141a11a
19f7e40c448029530d191a262e5215571382bf9f
/decompiled/instagram/sources/p000X/C23260zq.java
ddeea75be840070bcee6cb0d2fa81f4c58945933
[]
no_license
stanvanrooy/decompiled-instagram
c1fb553c52e98fd82784a3a8a17abab43b0f52eb
3091a40af7accf6c0a80b9dda608471d503c4d78
refs/heads/master
2022-12-07T22:31:43.155086
2020-08-26T03:42:04
2020-08-26T03:42:04
283,347,288
18
1
null
null
null
null
UTF-8
Java
false
false
480
java
package p000X; import com.instagram.pendingmedia.store.PendingMediaStoreSerializer; /* renamed from: X.0zq reason: invalid class name and case insensitive filesystem */ public final class C23260zq implements C11590fD { public final /* synthetic */ AnonymousClass0C1 A00; public C23260zq(AnonymousClass0C1 r1) { this.A00 = r1; } public final /* bridge */ /* synthetic */ Object get() { return new PendingMediaStoreSerializer(this.A00); } }
e738e304d521e74725072a7ddef06ba856bc25cd
69a96384dd88d49a2fe103ec2576d08cac71877c
/harness2/src/main/java/org/mds/harness2/tools/distruptor/DirectVsEventTranslatorWithSingleLongBenchmark.java
8bd057f252fb01a992dea12676b0a7eca597a61b
[]
no_license
mo-open/harness
820325cb6132bd76d0f6d1694b32e248d4cb6409
e59b3c43a4fb343d01c7b880693f0eda95c017e7
refs/heads/master
2021-06-01T17:53:19.723786
2016-04-09T14:23:04
2016-04-09T14:23:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,451
java
/* * Copyright 2012 LMAX Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mds.harness2.tools.distruptor; import org.mds.harness2.tools.distruptor.support.*; import com.google.caliper.Runner; import com.google.caliper.SimpleBenchmark; import com.lmax.disruptor.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static com.lmax.disruptor.RingBuffer.createSingleProducer; public class DirectVsEventTranslatorWithSingleLongBenchmark extends SimpleBenchmark { private static final int BUFFER_SIZE = 1024 * 8; private final ExecutorService executor = Executors.newCachedThreadPool(); private final RingBuffer<ValueEvent> ringBuffer = createSingleProducer(ValueEvent.EVENT_FACTORY, BUFFER_SIZE, new YieldingWaitStrategy()); private final SequenceBarrier sequenceBarrier = ringBuffer.newBarrier(); private final ValueAdditionEventHandler handler = new ValueAdditionEventHandler(); private final ValueEventTranslator translator = new ValueEventTranslator(); private final BatchEventProcessor<ValueEvent> batchEventProcessor = new BatchEventProcessor<ValueEvent>(ringBuffer, sequenceBarrier, handler); { ringBuffer.addGatingSequences(batchEventProcessor.getSequence()); executor.submit(batchEventProcessor); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static class ValueEventTranslator implements EventTranslator<ValueEvent> { long value; @Override public void translateTo(ValueEvent event, long sequence) { event.setValue(value); } } public void timeDirect(int iterations) throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); handler.reset(latch, batchEventProcessor.getSequence().get() + iterations); for (int i = 0; i < iterations; i++) { long next = ringBuffer.next(); try { ringBuffer.get(next).setValue(i); } finally { ringBuffer.publish(next); } } latch.await(); } public void timeEventTranslator(int iterations) throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); handler.reset(latch, batchEventProcessor.getSequence().get() + iterations); for (int i = 0; i < iterations; i++) { translator.value = i; ringBuffer.publishEvent(translator); } latch.await(); } public static void main(String[] args) { Runner.main(DirectVsEventTranslatorWithSingleLongBenchmark.class, args); } }
[ "root@zoo1.(none)" ]
root@zoo1.(none)
5dbd6527fbeb81ed55fca33a1bcaae2e7692a514
7be053e82a065edb493374b5e6f9321b180ecd48
/easy-shopping/src/com/easyshopping/template/directive/BrandListDirective.java
20329d6b5b462b9e83f51a3b7faa43c579ba904e
[]
no_license
anytime-hxy/shopping
10d0bb1202dfc33385d425cdd6a47aae2e9cdfd7
18b09d28b6e4f150285561c9702c5d7ae9c1a6a6
refs/heads/master
2021-01-01T06:53:43.632013
2017-07-18T05:44:04
2017-07-18T05:44:04
97,545,199
0
0
null
null
null
null
UTF-8
Java
false
false
1,574
java
/* * * */ package com.easyshopping.template.directive; import java.io.IOException; import java.util.List; import java.util.Map; import javax.annotation.Resource; import com.easyshopping.Filter; import com.easyshopping.Order; import com.easyshopping.entity.Brand; import com.easyshopping.service.BrandService; import org.springframework.stereotype.Component; import freemarker.core.Environment; import freemarker.template.TemplateDirectiveBody; import freemarker.template.TemplateException; import freemarker.template.TemplateModel; /** * 模板指令 - 品牌列表 * * * @version 1.0 */ @Component("brandListDirective") public class BrandListDirective extends BaseDirective { /** 变量名称 */ private static final String VARIABLE_NAME = "brands"; @Resource(name = "brandServiceImpl") private BrandService brandService; @SuppressWarnings({ "unchecked", "rawtypes" }) public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { List<Brand> brands; boolean useCache = useCache(env, params); String cacheRegion = getCacheRegion(env, params); Integer count = getCount(params); List<Filter> filters = getFilters(params, Brand.class); List<Order> orders = getOrders(params); if (useCache) { brands = brandService.findList(count, filters, orders, cacheRegion); } else { brands = brandService.findList(count, filters, orders); } setLocalVariable(VARIABLE_NAME, brands, env, body); } }
1bc7b5e851bde463f391297825037dea7950a366
e31d4ed4c3af08d31ccbdaccfbce3eb9779d2f1c
/src/radio/TransmitInterface.java
46eb6dbbadd995709754f2b3aad92cf1393e0204
[]
no_license
Bob-K2KI/java-sdr-1
d50cb77f01e3f5201fd19990e2c9653d3494417a
fde2f5e5cd7e896b68420c47f6879c5a540e05bc
refs/heads/master
2021-01-16T22:10:52.584395
2015-02-15T08:34:19
2015-02-15T08:34:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
/* * TransmitInterface.java * * Created on September 19, 2007, 5:28 PM * * Copyright (C) 2006, 2007 by John Melton, G0ORX/N6LYT * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * The author can be reached by email at * * [email protected] * */ package radio; public interface TransmitInterface { public void setMox(boolean state); public void setTune(boolean state); public void enableMox(boolean state); public void enableTune(boolean state); }
cc15698c6c011fa2f39cd8c2a48b56367b306e60
70b37de5cf1529b10b1cea8e3074fbfb0772850d
/src/main/java/com/libereco/server/crawler/amazon/soap/client/jax/BrowseNodeLookupResponse.java
a6a75edc5bf9cdfc6d36c14e4b66c6e158cf560b
[]
no_license
dushkindigital/crawlers
fc6951e005593d4dd59f8ab113e2064cc4d2f51e
6971f7e642962c056138d8a02cab3544c342865a
refs/heads/master
2021-01-25T04:50:15.859425
2014-05-19T01:19:32
2014-05-19T01:19:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,806
java
package com.libereco.server.crawler.amazon.soap.client.jax; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{http://webservices.amazon.com/AWSECommerceService/2009-11-01}OperationRequest" minOccurs="0"/> * &lt;element ref="{http://webservices.amazon.com/AWSECommerceService/2009-11-01}BrowseNodes" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "operationRequest", "browseNodes" }) @XmlRootElement(name = "BrowseNodeLookupResponse") public class BrowseNodeLookupResponse { @XmlElement(name = "OperationRequest") protected OperationRequest operationRequest; @XmlElement(name = "BrowseNodes") protected List<BrowseNodes> browseNodes; /** * Gets the value of the operationRequest property. * * @return * possible object is * {@link OperationRequest } * */ public OperationRequest getOperationRequest() { return operationRequest; } /** * Sets the value of the operationRequest property. * * @param value * allowed object is * {@link OperationRequest } * */ public void setOperationRequest(OperationRequest value) { this.operationRequest = value; } /** * Gets the value of the browseNodes property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the browseNodes property. * * <p> * For example, to add a new item, do as follows: * <pre> * getBrowseNodes().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link BrowseNodes } * * */ public List<BrowseNodes> getBrowseNodes() { if (browseNodes == null) { browseNodes = new ArrayList<BrowseNodes>(); } return this.browseNodes; } }
21e8f19b3ba905688432d6bed6d426f7a5b5bf51
73ad5b4a20e892563b25b0e32a7ea21ec98348e7
/src/yurtotomasyon/pers_odeme.java
f87a13353ef39089a3e884749808736567ac0c3b
[]
no_license
hakansefa/yurt_otomasyon_2019
bb04b1519078c7e1e3d7cc305fd1ab0bf60600c0
e0a279446177e29547a207999aa9b4f4094d02d1
refs/heads/master
2020-05-24T21:42:42.380005
2019-05-19T14:48:24
2019-05-19T14:48:24
187,481,152
1
0
null
null
null
null
ISO-8859-2
Java
false
false
4,900
java
package yurtotomasyon; import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.MatteBorder; import keeptoo.KButton; import javax.swing.JComboBox; import javax.swing.DefaultComboBoxModel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import javax.swing.JList; import javax.swing.SwingConstants; import javax.swing.ImageIcon; public class pers_odeme extends JPanel { private JTextField txtrenciAd; private JTextField txtAdresGiriniz; private JTextField txtAklama; private JTextField txtYl; private JTextField txtOnaylama; private JTextField txtdemeTarihi; private JScrollPane scrollPane; private JList list; private JTextField txtAdSoyad; private JLabel label; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { pers_odeme frame = new pers_odeme(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public pers_odeme() { setBackground(new Color (216,204,192)); setBorder(new MatteBorder(2, 0, 0, 0, (Color) new Color(0, 0, 0))); setBounds(0, 0, 847, 413); setLayout(null); JLabel lblNewLabel = new JLabel("\u00D6DEME B\u0130LG\u0130LER\u0130"); lblNewLabel.setForeground(new Color(0, 191, 255)); lblNewLabel.setFont(new Font("Ubuntu", Font.BOLD, 16)); lblNewLabel.setBounds(47, 12, 209, 44); add(lblNewLabel); txtAdresGiriniz = new JTextField(); txtAdresGiriniz.setOpaque(false); txtAdresGiriniz.setText("ADRES"); txtAdresGiriniz.setFont(new Font("Purisa", Font.BOLD, 16)); txtAdresGiriniz.setColumns(10); txtAdresGiriniz.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.BLACK)); txtAdresGiriniz.setBounds(486, 260, 285, 34); add(txtAdresGiriniz); txtAklama = new JTextField(); txtAklama.setOpaque(false); txtAklama.setText("TUTAR"); txtAklama.setFont(new Font("Purisa", Font.BOLD, 16)); txtAklama.setColumns(10); txtAklama.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.BLACK)); txtAklama.setBounds(486, 215, 285, 34); add(txtAklama); txtOnaylama = new JTextField(); txtOnaylama.setOpaque(false); txtOnaylama.setText("A\u00C7IKLAMA"); txtOnaylama.setFont(new Font("Purisa", Font.BOLD, 16)); txtOnaylama.setColumns(10); txtOnaylama.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.BLACK)); txtOnaylama.setBounds(486, 305, 285, 34); add(txtOnaylama); KButton button_1 = new KButton(); button_1.kAllowTab = false; button_1.kHoverEndColor = new Color(135, 206, 235); button_1.kHoverForeGround = new Color(255, 255, 0); button_1.kEndColor = new Color(64, 224, 208); button_1.setBounds(264, 356, 285, 45); button_1.setOpaque(false); button_1.setBorder(null); button_1.setFont(new Font("Purisa", Font.BOLD, 16)); button_1.setText("Ödeme Yap"); button_1.kBorderRadius=60; add(button_1); txtdemeTarihi = new JTextField(); txtdemeTarihi.setEnabled(false); txtdemeTarihi.setText("ODEME TAR\u0130H\u0130"); txtdemeTarihi.setOpaque(false); txtdemeTarihi.setFont(new Font("Purisa", Font.BOLD, 16)); txtdemeTarihi.setColumns(10); txtdemeTarihi.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.BLACK)); txtdemeTarihi.setBounds(486, 170, 285, 34); add(txtdemeTarihi); scrollPane = new JScrollPane(); scrollPane.setViewportBorder(null); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setBounds(26, 67, 352, 272); add(scrollPane); list = new JList(); scrollPane.setViewportView(list); txtAdSoyad = new JTextField(); txtAdSoyad.setText("AD SOYAD"); txtAdSoyad.setOpaque(false); txtAdSoyad.setFont(new Font("Dialog", Font.BOLD, 16)); txtAdSoyad.setColumns(10); txtAdSoyad.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.BLACK)); txtAdSoyad.setBounds(486, 126, 285, 34); add(txtAdSoyad); label = new JLabel(""); label.setIcon(new ImageIcon("C:\\Users\\hakan\\Desktop\\linux\\icon&resim\\cam.png")); label.setHorizontalAlignment(SwingConstants.CENTER); label.setBackground(Color.WHITE); label.setBounds(584, 30, 90, 90); add(label); txtAdresGiriniz.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { txtAdresGiriniz.setBorder(new MatteBorder(0, 0, 2, 0, (Color.CYAN))); } }); txtAklama.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { txtAklama.setBorder(new MatteBorder(0, 0, 2, 0, (Color.CYAN))); } }); txtOnaylama.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { txtOnaylama.setBorder(new MatteBorder(0, 0, 2, 0, (Color.CYAN))); } }); } }
38a7e0b0d5d79369640fa888f4343e2cbab9d751
8fb8ea3fce72511271d33708df6a5648e4dabc5d
/src/main/java/com/dhirajapps/springbootpostgresqlcrud/exception/ErrorDetails.java
13fec3e68e1d52e5ce2a7e4657b15f09f435e82f
[]
no_license
DhirajAswani/springboot-postgresql-crud
b75358bea7f34300bfef59b9e4ea03035be1d396
30f1896f9cbdee23307bd750fa052e75e18aee62
refs/heads/master
2023-04-21T13:43:03.527287
2021-05-04T18:11:48
2021-05-04T18:11:48
364,345,506
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
package com.dhirajapps.springbootpostgresqlcrud.exception; import java.util.Date; public class ErrorDetails { private Date timestamp; private String message; private String details; public ErrorDetails(Date timestamp, String message, String details) { super(); this.timestamp = timestamp; this.message = message; this.details = details; } public Date getTimestamp() { return timestamp; } public String getMessage() { return message; } public String getDetails() { return details; } }
7b067f3a103968f2fce34d746192c2f7cdafe738
73208473ead4c2483e3685765fc000bd9972b506
/plugins/gradle-dsl-impl/src/com/android/tools/idea/gradle/dsl/parser/android/DependenciesInfoDslElement.java
f07c9c50a6458a0a4a8e6601805b2ae226d8b866
[ "Apache-2.0" ]
permissive
code-general/intellij-community
a72bda439b374a08a2fb753e32ddeb4d494b0b98
a00c61d009b376bdf62a2859dd757c0766894a28
refs/heads/master
2023-02-12T04:29:56.503752
2020-12-30T04:29:00
2020-12-30T04:29:00
320,182,339
1
0
Apache-2.0
2020-12-30T06:58:32
2020-12-10T06:36:43
null
UTF-8
Java
false
false
3,429
java
/* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.idea.gradle.dsl.parser.android; import static com.android.tools.idea.gradle.dsl.model.android.DependenciesInfoModelImpl.INCLUDE_IN_APK; import static com.android.tools.idea.gradle.dsl.model.android.DependenciesInfoModelImpl.INCLUDE_IN_BUNDLE; import static com.android.tools.idea.gradle.dsl.parser.semantics.ArityHelper.exactly; import static com.android.tools.idea.gradle.dsl.parser.semantics.ArityHelper.property; import static com.android.tools.idea.gradle.dsl.parser.semantics.MethodSemanticsDescription.SET; import static com.android.tools.idea.gradle.dsl.parser.semantics.ModelMapCollector.toModelMap; import static com.android.tools.idea.gradle.dsl.parser.semantics.PropertySemanticsDescription.VAR; import com.android.tools.idea.gradle.dsl.parser.GradleDslNameConverter; import com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement; import com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElement; import com.android.tools.idea.gradle.dsl.parser.elements.GradleNameElement; import com.android.tools.idea.gradle.dsl.parser.semantics.ModelEffectDescription; import com.android.tools.idea.gradle.dsl.parser.semantics.PropertiesElementDescription; import com.google.common.collect.ImmutableMap; import java.util.stream.Stream; import kotlin.Pair; import org.jetbrains.annotations.NotNull; public class DependenciesInfoDslElement extends GradleDslBlockElement { public static final PropertiesElementDescription<DependenciesInfoDslElement> DEPENDENCIES_INFO = new PropertiesElementDescription<>("dependenciesInfo", DependenciesInfoDslElement.class, DependenciesInfoDslElement::new); @NotNull public static final ImmutableMap<Pair<String,Integer>, ModelEffectDescription> ktsToModelMap = Stream.of(new Object[][]{ {"includeInApk", property, INCLUDE_IN_APK, VAR}, {"includeInBundle", property, INCLUDE_IN_BUNDLE, VAR} }).collect(toModelMap()); public static final ImmutableMap<Pair<String,Integer>, ModelEffectDescription> groovyToModelMap = Stream.of(new Object[][] { {"includeInApk", property, INCLUDE_IN_APK, VAR}, {"includeInApk", exactly(1), INCLUDE_IN_APK, SET}, {"includeInBundle", property, INCLUDE_IN_BUNDLE, VAR}, {"includeInBundle", exactly(1), INCLUDE_IN_BUNDLE, SET} }).collect(toModelMap()); @NotNull @Override public ImmutableMap<Pair<String, Integer>, ModelEffectDescription> getExternalToModelMap(@NotNull GradleDslNameConverter converter) { if (converter.isKotlin()) { return ktsToModelMap; } else if (converter.isGroovy()) { return groovyToModelMap; } else { return super.getExternalToModelMap(converter); } } DependenciesInfoDslElement(@NotNull GradleDslElement parent, @NotNull GradleNameElement name) { super(parent, name); } }
ea7b3538253355562a8dfcbf1a6808a6148dfe76
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/83/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer_getMaxIterations_121.java
1d585629c1f65d1d4e2ac43d31d184a5b3860871
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
676
java
org apach common math optim gener base implement squar optim base handl boilerpl method threshold set jacobian error estim version revis date abstract squar optim abstractleastsquaresoptim differenti multivari vectori optim differentiablemultivariatevectorialoptim inherit doc inheritdoc max iter getmaxiter max iter maxiter
b443630082aa87bf1f7a89652fe5a91a79580428
3418f6daa4ad3f021ca16f90dd2032ae42da53a1
/library/src/main/java/com/vanniktech/rxpermission/ShadowActivity.java
c59de973e8fcc697b8ecac59e5ee503fb8b982ed
[ "Apache-2.0" ]
permissive
YanYanLun/RxPermission
394f749bcf1950ce21a76ec6933469c8d8f55c2f
c19eb4f4b6f676805397302d8252846eb4961e5d
refs/heads/master
2020-03-20T10:13:17.567544
2018-06-09T17:10:18
2018-06-09T17:10:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,594
java
package com.vanniktech.rxpermission; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import io.reactivex.annotations.NonNull; import static android.os.Build.VERSION_CODES.M; @TargetApi(M) public final class ShadowActivity extends Activity { private static final String ARG_PERMISSIONS = "permissions"; private static final String SAVE_RATIONALE = "save-rationale"; private static final int REQUEST_CODE = 42; static void start(final Context context, final String[] permissions) { final Intent intent = new Intent(context, ShadowActivity.class) .putExtra(ARG_PERMISSIONS, permissions) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } private boolean[] shouldShowRequestPermissionRationale; @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { handleIntent(getIntent()); } else { shouldShowRequestPermissionRationale = savedInstanceState.getBooleanArray(SAVE_RATIONALE); } } @Override protected void onNewIntent(final Intent intent) { handleIntent(intent); } private void handleIntent(final Intent intent) { final String[] permissions = intent.getStringArrayExtra(ARG_PERMISSIONS); shouldShowRequestPermissionRationale = rationales(permissions); requestPermissions(permissions, REQUEST_CODE); } @Override public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) { if (requestCode == REQUEST_CODE) { final boolean[] rationales = rationales(permissions); RealRxPermission.getInstance(getApplication()).onRequestPermissionsResult(grantResults, shouldShowRequestPermissionRationale, rationales, permissions); finish(); } } @Override public void finish() { // Reset the animation to avoid flickering. overridePendingTransition(0, 0); super.finish(); } @Override protected void onSaveInstanceState(final Bundle outState) { outState.putBooleanArray(SAVE_RATIONALE, shouldShowRequestPermissionRationale); super.onSaveInstanceState(outState); } private boolean[] rationales(@NonNull final String[] permissions) { final boolean[] rationales = new boolean[permissions.length]; for (int i = 0; i < permissions.length; i++) { rationales[i] = shouldShowRequestPermissionRationale(permissions[i]); } return rationales; } }
4ba6564ae85443e739463ee9b11f65df76a29d66
9ebcd5b38025a2bbf1c63725c23e34960dd8a48b
/digitsletters/src/main/java/com/cl/digitsletters/ConvertPlus.java
d5bdee5db961f993be33deda0fb3b7e7021dbb40
[]
no_license
climb-wang/digitsletters
1722898ac130b3ff045bc898e802cb11618a5eb3
57b2136f959799885b034baa2e24d6f8c72e0e83
refs/heads/master
2023-02-17T23:09:03.471706
2021-01-14T15:15:08
2021-01-14T15:15:08
329,643,085
0
0
null
null
null
null
UTF-8
Java
false
false
1,223
java
/* * $RCSfile: ConvertPlus.java,v $ * $Revision: 1.1 $ * $Date: 2021年1月14日 $ * * Copyright (C) 2014 NearBound, Inc. All rights reserved. * * This software is the proprietary information of NearBound, Inc. * Use is subject to license terms. */ /** * */ package com.cl.digitsletters; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Support converting the digits from 0 to 99 into letters * * @author climb * */ public class ConvertPlus extends Convert { /** * Support converting the digits from 0 to 99 into letters * * @param ints digits array * @return All possible letter */ public List<String> digitsLettersPlus(int[] nums) { if (nums == null || nums.length == 0) { return Collections.emptyList(); } List<Integer> ints = new ArrayList<>(); for (int i = 0; i < nums.length; i++) { int num = nums[i]; if (num > 99 || num < 0) { continue; } while (num >= 10) { ints.add(num % 10); num /= 10; } ints.add(num); } int[] integers = ints.stream().mapToInt(Integer::valueOf).toArray(); return super.digitsLetters(integers); } }
[ "climb@climb-pc" ]
climb@climb-pc
02e6399e8e5eab4fa8be71ff5f6718f529273f40
9fb7d211bd7842009228f234b9f0167cc370ad94
/BitCoin/NewsAppv1/Android Studio/NewsApp/app/src/main/java/com/btcnews/helpers/Cache.java
186b410ad924e799834ed341773b47a27b3d667a
[]
no_license
aloha1/BitCoin-Daily
b148feb532f740085035d26cc6232ad508b15302
6784164fc7fafb5d664fad235ce40a01fec17ebd
refs/heads/master
2021-07-06T02:42:14.811026
2017-10-01T00:40:45
2017-10-01T00:40:45
105,410,000
0
0
null
null
null
null
UTF-8
Java
false
false
3,199
java
package com.btcnews.helpers; import android.content.Context; import android.util.Log; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; /** * Created by melvin on 28/11/2016. * This Class stores and loads data in cache using the url as a key. */ public class Cache { Context context; /** * Initialise * * @param context */ public Cache(Context context) { this.context = context; } /** * Load a string data by url * * @param url * @return */ public String load(String url) { String key = getKey(url); String ret = null; try { File cacheDir = context.getCacheDir(); File file = new File(cacheDir, key + "data.bin"); FileInputStream inputStream = new FileInputStream(file); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String receiveString = ""; StringBuilder stringBuilder = new StringBuilder(); while ((receiveString = bufferedReader.readLine()) != null) { stringBuilder.append(receiveString); } inputStream.close(); ret = stringBuilder.toString(); } } catch (FileNotFoundException e) { Log.e("cache activity", "File not found: " + e.toString()); } catch (IOException e) { Log.e("cache activity", "Can not read file: " + e.toString()); } return ret; } /** * Store a string data by url * * @param url * @param value */ public void store(String url, String value) { String key = getKey(url); try { File cacheDir = context.getCacheDir(); File file = new File(cacheDir, key + "data.bin"); FileOutputStream stream = new FileOutputStream(file); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(stream); outputStreamWriter.write(value); outputStreamWriter.close(); } catch (IOException e) { Log.e("Exception", "File write failed: " + e.toString()); } } /** * convert a url to md5 so that the url can be used as a unique key. * * @param md5 * @return */ public String getKey(String md5) { try { java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); byte[] array = md.digest(md5.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (java.security.NoSuchAlgorithmException e) { } return null; } }
315a23a124ce2f40d7a796056073912f8f2e3427
7973ac4273d59607ec950f4e7fe416d08e40251b
/app/src/main/java/com/tech/cloudnausor/ohmytennispro/fragment/coachuserreservation/CoachUserReservationFragment.java
4be3ed5b8f5b3d5009aebb7d64b05d68a8751159
[]
no_license
Satvar/m_Android_OhMyTennisPRO
66dc15e01b54caae794f0f330fd7fae5414e4e0c
4936b482dacca44bb7f2a0293583951f84459307
refs/heads/master
2021-01-07T06:28:09.784709
2020-02-19T08:23:18
2020-02-19T08:23:18
241,606,486
0
0
null
null
null
null
UTF-8
Java
false
false
18,069
java
package com.tech.cloudnausor.ohmytennispro.fragment.coachuserreservation; import android.content.Context; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.google.gson.Gson; import com.tech.cloudnausor.ohmytennispro.R; import com.tech.cloudnausor.ohmytennispro.activity.coachuserreservation.CoachUserReservation; import com.tech.cloudnausor.ohmytennispro.activity.realhomepage.RealMainPageActivity; import com.tech.cloudnausor.ohmytennispro.adapter.CoachUserReservationAdapter; import com.tech.cloudnausor.ohmytennispro.apicall.ApiClient; import com.tech.cloudnausor.ohmytennispro.apicall.ApiInterface; import com.tech.cloudnausor.ohmytennispro.fragment.individualcourse.IndividualCourseFragment; import com.tech.cloudnausor.ohmytennispro.model.BookingData; import com.tech.cloudnausor.ohmytennispro.model.BookingDataDetails; import com.tech.cloudnausor.ohmytennispro.model.CoachUserReserveModel; import com.tech.cloudnausor.ohmytennispro.model.GetIndiCoachDetailsModel; import com.tech.cloudnausor.ohmytennispro.model.IndiCourseData; import com.tech.cloudnausor.ohmytennispro.response.BokingDataResponseData; import com.tech.cloudnausor.ohmytennispro.response.GetIndiCoachDetailsResponse; import com.tech.cloudnausor.ohmytennispro.session.SessionManagement; import com.tech.cloudnausor.ohmytennispro.utils.MyAutoCompleteTextView; import com.tech.cloudnausor.ohmytennispro.utils.SingleTonProcess; import com.tech.cloudnausor.ohmytennispro.utils.homepage.Constant; import com.tech.cloudnausor.ohmytennispro.utils.homepage.Menus; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link CoachUserReservationFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link CoachUserReservationFragment#newInstance} factory method to * create an instance of this fragment. */ public class CoachUserReservationFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; private boolean mSearchCheck; RecyclerView coachUserReservationCycle; CoachUserReservationAdapter coachUserReservationAdapter; ArrayList<BookingDataDetails> bookingDataDetailsArrayList = new ArrayList<BookingDataDetails>(); MyAutoCompleteTextView Reserve_Filter; ArrayAdapter adapter; List<String> Reserve_fliter_value; ArrayList<String> Reserve_fliter_arraylist = new ArrayList<>(); ImageView GoBack; Toolbar toolbar; ApiInterface apiInterface; private SharedPreferences sharedPreferences; SessionManagement session; SharedPreferences.Editor editor; String edit_sting = null,loginObject; String coachid_ = null; String uPassword =null; SingleTonProcess singleTonProcess; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; public CoachUserReservationFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @return A new instance of fragment CoachUserReservationFragment. */ // TODO: Rename and change types and number of parameters public CoachUserReservationFragment newInstance(String text) { CoachUserReservationFragment mFragment = new CoachUserReservationFragment(); Bundle mBundle = new Bundle(); mBundle.putString(Constant.TEXT_FRAGMENT, text); mFragment.setArguments(mBundle); return mFragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view_reservation = inflater.inflate(R.layout.fragment_coach_user_reservation, container, false); // Inflate the layout for this fragment toolbar = view_reservation.findViewById(R.id.toolbar_indi); GoBack = (ImageView)view_reservation.findViewById(R.id.back); singleTonProcess = singleTonProcess.getInstance(); Reserve_fliter_value = Reserve_fliter_arraylist; Reserve_fliter_arraylist.clear(); Reserve_fliter_arraylist.add("Toute"); Reserve_fliter_arraylist.add("Approuvé"); Reserve_fliter_arraylist.add("Demande de réservation"); Reserve_fliter_arraylist.add("Réservé"); Reserve_fliter_arraylist.add("Reprogrammer"); Reserve_fliter_arraylist.add("Utilisatrice Annulé"); Reserve_fliter_arraylist.add("Annulé"); Reserve_fliter_value = Reserve_fliter_arraylist; apiInterface = ApiClient.getClient().create(ApiInterface.class); adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.select_dialog_item, Reserve_fliter_value); Reserve_Filter = (MyAutoCompleteTextView) view_reservation.findViewById(R.id.reserve_filter); Reserve_Filter.setAdapter(adapter); coachUserReservationCycle = (RecyclerView)view_reservation.findViewById(R.id.reserve_cycle); coachUserReservationCycle.setLayoutManager(new LinearLayoutManager(getContext())); // coachUserReservationAdapter = new CoachUserReservationAdapter(CoachUserReservation.this,coachUserReserveModelArrayList); coachUserReservationAdapter = new CoachUserReservationAdapter(getActivity(),getContext(),bookingDataDetailsArrayList); coachUserReservationCycle.setAdapter(coachUserReservationAdapter); // adapterData(); sharedPreferences = getContext().getSharedPreferences("Reg", 0); editor = sharedPreferences.edit(); session = new SessionManagement(getContext()); if (sharedPreferences.contains("KEY_Coach_ID")) { coachid_ = sharedPreferences.getString("KEY_Coach_ID", ""); } if (sharedPreferences.contains("Email")) { uPassword = sharedPreferences.getString("Email", ""); } adapterData(); Reserve_Filter.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Reserve_Filter.showDropDown(); } }); Reserve_Filter.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { String filterValue = editable.toString(); System.out.println("testing bala filter" + filterValue); switch (filterValue){ case "Annulé": coachUserReservationAdapter.filter("C"); break; case "Réservé": coachUserReservationAdapter.filter("B"); break; case "Demande de réservation": coachUserReservationAdapter.filter("R"); break; case "Approuvé": coachUserReservationAdapter.filter("A"); break; case "Utilisatrice Annulé": coachUserReservationAdapter.filter("UC"); break; case "Reprogrammer": coachUserReservationAdapter.filter("S"); break; default: coachUserReservationAdapter.filter(""); break; } } }); // GoBack.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // onBackPressed(); // } // }); return view_reservation; } public void adapterData(){ ((RealMainPageActivity)getContext()).showprocess(); apiInterface.getBookingDataResponse(coachid_).enqueue(new Callback<BokingDataResponseData>() { @Override public void onResponse(@NonNull Call<BokingDataResponseData> call, @NonNull Response<BokingDataResponseData> response) { assert response.body() != null; if(response.body().getIsSuccess().equals("true")){ BookingData bookingData = response.body().getData(); bookingDataDetailsArrayList = bookingData.getBookingDataDetailsArrayList(); coachUserReservationAdapter = new CoachUserReservationAdapter(getActivity(),getContext(),bookingDataDetailsArrayList); coachUserReservationCycle.setAdapter(coachUserReservationAdapter); coachUserReservationAdapter.notifyDataSetChanged(); ((RealMainPageActivity)getContext()).dismissprocess(); System.out.println("- --> " + new Gson().toJson(response.body())); }else { ((RealMainPageActivity)getContext()).dismissprocess(); Toast.makeText(getActivity(),response.body().getMessage(),Toast.LENGTH_LONG).show(); } } @Override public void onFailure(Call<BokingDataResponseData> call, Throwable t) { ((RealMainPageActivity)getContext()).dismissprocess(); System.out.println("---> "+ call +" "+ t); } }); } // public void adapterData(){ // // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Cours de premiers soins - ATH Training", // "Bala","30/08/2019","de 6h à 12h","0")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Entraineurs de tennis britanniques","Chandran","30/08/2019" // ,"de 6h à 12h","1")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Cours de premiers soins - ATH Training","Guna","30/08/2019" // ,"de 6h à 12h","2")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Entraineurs de tennis britanniques","Sekaran","30/08/2019" // ,"de 6h à 12h","2")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Cours de premiers soins - ATH Training","Balachandran","30/08/2019" // ,"de 6h à 12h","0")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Entraineurs de tennis britanniques","Gunasekaran","30/08/2019" // ,"de 6h à 12h","1")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Cours de premiers soins - ATH Training","Vijayalakshmi","30/08/2019" // ,"de 6h à 12h","0")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Entraineurs de tennis britanniques","Boobalan","30/08/2019" // ,"de 6h à 12h","1")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Cours de premiers soins - ATH Training","Suresh","30/08/2019" // ,"de 6h à 12h","1")); // coachUserReserveModelArrayList.add(new CoachUserReserveModel("Entraineurs de tennis britanniques","Pushpavalli","30/08/2019" // ,"de 6h à 12h","2")); // coachUserReservationAdapter = new CoachUserReservationAdapter(getActivity(),getContext(),coachUserReserveModelArrayList); // coachUserReservationCycle.setAdapter(coachUserReservationAdapter); // // reservationHeading.add("Cours de premiers soins - ATH Training"); // reservationHeading.add("Entraineurs de tennis britanniques"); // reservationHeading.add("Cours de premiers soins - ATH Training"); // reservationHeading.add("Entraineurs de tennis britanniques"); // reservationHeading.add("Cours de premiers soins - ATH Training"); // reservationHeading.add("Entraineurs de tennis britanniques"); // reservationHeading.add("Cours de premiers soins - ATH Training"); // reservationHeading.add("Entraineurs de tennis britanniques"); // reservationHeading.add("Cours de premiers soins - ATH Training"); // reservationHeading.add("Entraineurs de tennis britanniques"); // reserveName.add("Bala"); // reserveName.add("Chandran"); // reserveName.add("Guna"); // reserveName.add("Sekaran"); // reserveName.add("Balachandran"); // reserveName.add("Gunasekaran"); // reserveName.add("Bala"); // reserveName.add("Chandran"); // reserveName.add("Guna"); // reserveName.add("Sekaran"); // reserveredDate.add("30/08/2019"); // reserveredDate.add("1/09/2019"); // reserveredDate.add("3/09/2019"); // reserveredDate.add("30/09/2019"); // reserveredDate.add("3/10/2019"); // reserveredDate.add("8/10/2019"); // reserveredDate.add("11/10/2019"); // reserveredDate.add("29/10/2019"); // reserveredDate.add("30/08/2019"); // reserveredDate.add("1/09/2019"); // reserveredTime.add("de 6h à 12h"); // reserveredTime.add("de 10h à 14h"); // reserveredTime.add("de 2h à 12h"); // reserveredTime.add("de 13h à 24h"); // reserveredTime.add("de 12h à 12h"); // reserveredTime.add("de 10h à 2h"); // reserveredTime.add("de 2h à 7h"); // reserveredTime.add("de 8h à 1h"); // reserveredTime.add("de 6h à 12h"); // reserveredTime.add("de 10h à 14h"); // reserveStatus.add("0"); // reserveStatus.add("1"); // reserveStatus.add("2"); // reserveStatus.add("2"); // reserveStatus.add("0"); // reserveStatus.add("1"); // reserveStatus.add("0"); // reserveStatus.add("1"); // reserveStatus.add("1"); // reserveStatus.add("2"); // coachUserReservationAdapter.notifyDataSetChanged(); // } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // TODO Auto-generated method stub super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu, menu); SearchView searchView = (SearchView) (menu.findItem(Menus.SEARCH).getActionView()); searchView.setQueryHint(this.getString(R.string.search)); ((EditText)searchView.findViewById(androidx.appcompat.R.id.search_src_text)) .setHintTextColor(getResources().getColor(R.color.white)); searchView.setOnQueryTextListener(OnQuerySearchView); menu.findItem(Menus.ADD).setVisible(false); menu.findItem(Menus.EDIT).setVisible(false); menu.findItem(Menus.UPDATE).setVisible(false); menu.findItem(Menus.SEARCH).setVisible(false); mSearchCheck = false; } @Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case Menus.ADD: break; case Menus.UPDATE: break; case Menus.SEARCH: mSearchCheck = true; break; } return true; } private SearchView.OnQueryTextListener OnQuerySearchView = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String arg0) { // TODO Auto-generated method stub return false; } @Override public boolean onQueryTextChange(String arg0) { // TODO Auto-generated method stub if (mSearchCheck){ // implement your search here } return false; } }; @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
c0792b9df60a8d6865342192aced6055c36563ef
3a2858658ae2d3f471e6a2b97e374e75d5ffb272
/fake-script/src/main/java/com/github/esrrhs/fakescript/callback.java
78c67c68b0fd49644670afa1698e2dbf82e9e82e
[]
no_license
cqingwang/ReflectMaster
772466fef9f371427ab321ecc8eeacd64491df5d
a459780bac20e84879da310feb377257dc6fb30a
refs/heads/master
2023-04-21T22:06:53.188230
2021-05-14T08:24:11
2021-05-14T08:24:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.github.esrrhs.fakescript; public interface callback { public void on_error(fake f, String file, int lineno, String func, String str); public void on_print(fake f, String str); }
0e941191225f2fd20021b03f2c1ca3e4d36fb9e7
67df353b789f5e81644ad77c09ecab7ae6fc3b85
/app/src/androidTest/java/net/ddns/himion0/homefull/app/ApplicationTest.java
319c26bbfdabb3ec0d965d9f4a4ec1f89ee05150
[]
no_license
GilesNicholas/HomelessShelter
f04afd4c62043b723cd709f80dc887a4d4f62209
f9cc266b69080b91bebd76c5da8a01d7a629fbc4
refs/heads/master
2022-12-05T21:22:35.886823
2020-08-19T08:48:26
2020-08-19T08:48:26
288,680,515
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package net.ddns.himion0.homefull.app; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
1b0dacb0fcd875ac1bf45f1db0c56f98e9d7ab8c
5fa8cac4bd7e816a5b53619c9836b7e56e53b541
/src/main/java/com/glodon/kafka/config/SenderConfig.java
e0c20fb4914ecb2323c4e9f88951781aee0d6cab
[]
no_license
SHUCharles/kafka-avro-confluent
71ebd5c11a476285bca8f72413a4ec990e508536
9e47798a1c0822103b6ee15f2401e60627763ca8
refs/heads/master
2020-06-28T07:26:01.327920
2019-08-02T06:10:31
2019-08-02T06:10:31
200,175,738
0
0
null
null
null
null
UTF-8
Java
false
false
1,703
java
package com.glodon.kafka.config; import com.glodon.avro.User; import com.glodon.kafka.product.Sender; import io.confluent.kafka.serializers.KafkaAvroSerializer; import io.confluent.kafka.serializers.KafkaAvroSerializerConfig; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.common.serialization.StringSerializer; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.kafka.core.DefaultKafkaProducerFactory; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.ProducerFactory; import java.util.HashMap; import java.util.Map; @Configuration public class SenderConfig { @Value("127.0.0.1:9092") private String bootstrapServers; @Bean public Map<String, Object> producerConfigs() { Map<String, Object> props = new HashMap<>(); props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaAvroSerializer.class); props.put(KafkaAvroSerializerConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://localhost:9081"); return props; } @Bean public ProducerFactory<String, User> producerFactory() { return new DefaultKafkaProducerFactory<>(producerConfigs()); } @Bean public KafkaTemplate<String, User> kafkaTemplate() { return new KafkaTemplate<>(producerFactory()); } @Bean public Sender sender() { return new Sender(); } }
742d10ab291b46c1c9911ce8116c3d3489547a75
3c72d4f8f5497e4cb9a9145ef1c4835a11768015
/src/main/java/com/axce1_/javacore/chapter28/FizzBuzzMain.java
4a6ff9b9054b6b043ebde8f440dccc69a65a7e92
[]
no_license
axce1/javacore
bacd54bf04db11a8d866bbdb676f3722de11bcd7
30dea4d5f732e1ebbfd28965a3e37a10462743c4
refs/heads/master
2022-11-06T10:02:18.920777
2020-07-01T16:52:32
2020-07-01T16:52:32
266,681,636
0
0
null
null
null
null
UTF-8
Java
false
false
2,398
java
package com.axce1_.javacore.chapter28; import java.util.concurrent.Semaphore; import java.util.function.IntConsumer; class FizzBuzz { int n; int cur; private final Semaphore fz, bz, fbz, num; public FizzBuzz(int n) { this.n = n; this.fz = new Semaphore(0, true); this.bz = new Semaphore(0, true); this.fbz = new Semaphore(0, true); this.num = new Semaphore(1, true); } public void fizz(Runnable printFizz) throws InterruptedException { for (int i=1; i<=this.n; i++) { if (i%3 == 0 ) { this.fz.acquire(); printFizz.run(); this.cur++; System.out.println(i); this.release(); } } } public void buzz(Runnable printBuzz) throws InterruptedException { for (int i=1; i<=this.n; i++) { if (i%5 == 0) { this.bz.acquire(); printBuzz.run(); this.cur++; this.release(); } } } public void fizzbuzz(Runnable printFizzBuzz) throws InterruptedException { for (int i=1; i<=this.n; i++) { if (i%5 == 0 && i %3 == 0) { this.bz.acquire(); printFizzBuzz.run(); this.cur++; this.release(); } } } public void number(IntConsumer printNumber) throws InterruptedException { for (int i=1; i<=this.n; i++) { if (i%3 != 0 && i %5 != 0) { this.num.acquire(); printNumber.accept(i); this.cur++; this.release(); } } } private void release() { if(this.cur % 3 == 0) { this.fz.release(); } else if (this.cur % 5 == 0){ this.bz.release(); } else if (this.cur % 5 == 0 && this.cur % 3 == 0) { this.fbz.release(); } else { this.num.release(); } } } public class FizzBuzzMain { public static void main(String[] args) throws InterruptedException { FizzBuzz fz = new FizzBuzz(15); fz.fizz(() -> System.out.println("wer")); fz.buzz(() -> System.out.println("w2er")); fz.fizzbuzz(() -> System.out.println("we23r")); IntConsumer d = null; fz.number(d); } }
5f8ffaac79ecd2c94deece0009c18b706a941c7b
bb1cb5d3cd79ba65287cbcc5ee7e26d3008b0c8c
/jdk7/src/main/java/evangel/util/treemap/TreeMapIteratorTest.java
1b6d6c63ac4383ddcd35832f00b2716d8a989f6e
[ "Apache-2.0" ]
permissive
T5750/java-repositories
bff7a5291a1792c9cc34d830dac34c51f1ed65d4
01ed32bc0e8263b978c95de8ca02ab49a345a5b5
refs/heads/master
2023-07-20T02:16:09.235998
2023-07-08T01:15:23
2023-07-08T01:15:23
90,839,689
3
1
Apache-2.0
2023-07-08T01:15:24
2017-05-10T08:25:19
Java
UTF-8
Java
false
false
2,748
java
package evangel.util.treemap; import java.util.*; /** * 遍历TreeMap的测试程序。 <br/> * (01) 通过entrySet()去遍历key、value,参考实现函数: iteratorTreeMapByEntryset() <br/> * (02) 通过keySet()去遍历key、value,参考实现函数: iteratorTreeMapByKeyset() <br/> * (03) 通过values()去遍历value,参考实现函数: iteratorTreeMapJustValues() */ public class TreeMapIteratorTest { public static void main(String[] args) { int val = 0; String key = null; Integer value = null; Random r = new Random(); TreeMap map = new TreeMap(); for (int i = 0; i < 12; i++) { // 随机获取一个[0,100)之间的数字 val = r.nextInt(100); key = String.valueOf(val); value = r.nextInt(5); // 添加到TreeMap中 map.put(key, value); System.out.println(" key:" + key + " value:" + value); } long start = System.currentTimeMillis(); // 通过entrySet()遍历TreeMap的key-value iteratorTreeMapByEntryset(map); long endByEntryset = System.currentTimeMillis(); System.out.println("during=" + (endByEntryset - start)); // 通过keySet()遍历TreeMap的key-value iteratorTreeMapByKeyset(map); long endByKeyset = System.currentTimeMillis(); System.out.println("during=" + (endByKeyset - endByEntryset)); // 单单遍历TreeMap的value iteratorTreeMapJustValues(map); long endJustValues = System.currentTimeMillis(); System.out.println("during=" + (endJustValues - endByKeyset)); } /* * 通过entry set遍历TreeMap 效率高! */ private static void iteratorTreeMapByEntryset(TreeMap map) { if (map == null) { return; } System.out.println("\niterator TreeMap By entryset"); String key = null; Integer integ = null; Iterator iter = map.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); key = (String) entry.getKey(); integ = (Integer) entry.getValue(); System.out.println(key + " -- " + integ.intValue()); } } /* * 通过keyset来遍历TreeMap 效率低! */ private static void iteratorTreeMapByKeyset(TreeMap map) { if (map == null) { return; } System.out.println("\niterator TreeMap By keyset"); String key = null; Integer integ = null; Iterator iter = map.keySet().iterator(); while (iter.hasNext()) { key = (String) iter.next(); integ = (Integer) map.get(key); System.out.println(key + " -- " + integ.intValue()); } } /* * 遍历TreeMap的values */ private static void iteratorTreeMapJustValues(TreeMap map) { if (map == null) { return; } System.out.println("\niterator TreeMap By values"); Collection c = map.values(); Iterator iter = c.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } } }
dce8ce6fd1c3504f81a96caedae3adaf5120ad7c
f4e276dd6fcac89eb20098c7e126a8706cff9da0
/cloud-gateway/src/main/java/com/aac/kpi/gateway/property/AuthProperties.java
762f6717ec288f82b6e2f59390ff2368c410f57d
[]
no_license
daiDai-study/cloud-template
6e8d23886b8693d769d51b837ce46f8fb71a9127
27549bc02fecbe81e193bd3c01d41ebe724ae27b
refs/heads/main
2023-02-24T15:19:51.366623
2021-02-01T13:11:50
2021-02-01T13:11:50
333,083,936
0
0
null
null
null
null
UTF-8
Java
false
false
1,202
java
package com.aac.kpi.gateway.property; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.context.config.annotation.RefreshScope; import java.util.Arrays; @Setter @ConfigurationProperties(prefix = "auth") public class AuthProperties { /** * 免认证 URL */ private String anonUrl; /** * JWT 认证 */ private String jwtUrl; public String[] getAnonUrls(){ return getUrls(this.anonUrl); } public String[] getJwtUrls(){ return getUrls(this.jwtUrl); } private String[] getUrls(String urlWithDelimiter){ if (StrUtil.isNotEmpty(urlWithDelimiter)) { String[] split = StringUtils.splitByWholeSeparatorPreserveAllTokens(urlWithDelimiter, ","); String[] trim = new String[split.length]; for (int i = 0; i < split.length; i++) { trim[i] = StrUtil.trim(split[i]); } return trim; } return new String[0]; } }
790fe364e73b323adf11ef2f0ca73fd76ef2b225
1ef9098eac88fa018e6ede29464adad62ad5f02b
/src/main/java/hu/kincstar/javasetraining/homework/HomeWork.java
c32dbe4929666db865b367a283f43492af8f93c1
[]
no_license
vanyotamas/HomeWork
7f1c468859809f7f6aeec358f7035c701a843b51
7eb55c5b1a6e4eaaf2ba8833b2a399f366fd07e4
refs/heads/master
2023-01-03T04:33:51.619297
2020-10-27T12:56:32
2020-10-27T12:56:32
299,235,065
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
package hu.kincstar.javasetraining.homework; /** * Házi feladat fő belépési pont */ public class HomeWork { public static void main(String[] args) { TaskApplication taskApplication = new TaskApplication(); taskApplication.createTasks(); taskApplication.createRelatedTasks(); taskApplication.trySetDone(); taskApplication.trySetStatus(); taskApplication.listTasks(); taskApplication.tryRemoveTasks(); } }
6cd510076f95047d606a0d8b44d4cdc66a89d3ca
7b7f5f76514c7a9a4cf892146394a5d2f4e38da1
/test/src/main/java/com/sub/entity/Course.java
059fc3e8a72b9ecec092a7e18ef3246c176b8f36
[]
no_license
TheFlyingBrid/bxx.github.io
e27df0a48fccc1877995e26c07f0e1ebdedb6bea
f5aca0bc1b57efc8d76005702e13d8c2553bd104
refs/heads/master
2022-12-21T15:19:34.501488
2020-07-02T10:15:15
2020-07-02T10:15:15
94,088,933
0
0
null
2022-12-16T02:23:19
2017-06-12T11:32:40
Java
UTF-8
Java
false
false
2,846
java
package com.sub.entity; import java.util.Date; public class Course { private String id; private String name; private String filename; private String status; private String author; private Date pubtime; private String img; private String flashfilename; private Integer viewcount; private String filetype; private String menuid; public Course(String id, String name, String filename, String status, String author, Date pubtime, String img, String flashfilename, Integer viewcount, String filetype, String menuid) { this.id = id; this.name = name; this.filename = filename; this.status = status; this.author = author; this.pubtime = pubtime; this.img = img; this.flashfilename = flashfilename; this.viewcount = viewcount; this.filetype = filetype; this.menuid = menuid; } public Course() { super(); } public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename == null ? null : filename.trim(); } public String getStatus() { return status; } public void setStatus(String status) { this.status = status == null ? null : status.trim(); } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author == null ? null : author.trim(); } public Date getPubtime() { return pubtime; } public void setPubtime(Date pubtime) { this.pubtime = pubtime; } public String getImg() { return img; } public void setImg(String img) { this.img = img == null ? null : img.trim(); } public String getFlashfilename() { return flashfilename; } public void setFlashfilename(String flashfilename) { this.flashfilename = flashfilename == null ? null : flashfilename.trim(); } public Integer getViewcount() { return viewcount; } public void setViewcount(Integer viewcount) { this.viewcount = viewcount; } public String getFiletype() { return filetype; } public void setFiletype(String filetype) { this.filetype = filetype == null ? null : filetype.trim(); } public String getMenuid() { return menuid; } public void setMenuid(String menuid) { this.menuid = menuid == null ? null : menuid.trim(); } }
9bdbb50abcd6be0b5800e87cfc6a29696e5195ab
df41898b50b1c1b1a0c73213d554682cd9826872
/elProj/src/main/java/com/db/elProj/service/BookService.java
b39db153bb5275347413936bae9db0b8acbd3781
[]
no_license
harshita-ha/Search-Engine
e2af500ab92b3878a9864e62458b820f087645c8
1988940d6eead7ec39f6ad79bcec58b5fdde46b5
refs/heads/main
2023-05-15T00:44:26.851409
2021-06-09T07:12:47
2021-06-09T07:12:47
375,075,877
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package com.db.elProj.service; import java.util.List; import org.springframework.stereotype.Service; import com.db.elProj.entity.Book; @Service public interface BookService { Book generateBook(List<String>bookList); }
d072b44f6b8d650e11cba597be5f45e24814332e
28b17238ac02d00e2d5210507b0d1dd75bb54b88
/code/Java/codechef/src/February_17/INTERVAL.java
3f430dd69f4e07c5cd116c497f2231f8707a276d
[]
no_license
shpalasara/competitive-programming
421edb807a17b10030a6c08ea7b43003df57f10c
a3da0c2a264b79fa84173bfa99d3a93882a5ec52
refs/heads/master
2021-04-09T17:13:38.480982
2018-03-18T06:22:41
2018-03-18T06:22:41
125,697,610
0
0
null
null
null
null
UTF-8
Java
false
false
8,155
java
package February_17; import java.util.List; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.InputMismatchException; public class INTERVAL { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); PrintWriter out = new PrintWriter(System.out); int t,n,m; t = sc.nextInt(); doubly_queue Qi = new doubly_queue(); // ArrayList<Long> list = new ArrayList<Long>(); long[] list = new long[300001]; int count; while(t-->0) { n = sc.nextInt(); m = sc.nextInt(); long[] data = new long[n+1]; // Sequence A long[] pre_sum = new long[n+1]; pre_sum[0] = 0; for(int i=0;i<n;i++) { data[i] = sc.nextInt(); pre_sum[i+1] = pre_sum[i] + data[i]; } int[] interval_length = new int[m+1]; // Sequence B for(int i=0;i<m;i++) interval_length[i] = sc.nextInt(); long[] dp = new long[n+1]; int length = interval_length[m-1]; if(m%2==0) for(int i=0;i<(n-length+1);i++) dp[i] = -(pre_sum[i+length] - pre_sum[i]); else for(int i=0;i<(n-length+1);i++) dp[i] = pre_sum[i+length] - pre_sum[i]; long[] temp = new long[n+1]; for(int i=m-1;i>0;i--) { int k_i_ = interval_length[i]; int k_i = interval_length[i-1]; // Apply for the current player (Score he should choose) for(int j=0;j<(n-k_i+1);j++) temp[j] = pre_sum[j+k_i] - pre_sum[j]; // list.clear(); count = 0; Qi.reset(); int k = k_i-1-k_i_,j; if((i+1)%2==0) { // Need to minimize the sum (chefu's term) for (j = 0; j < k; j++) { while ( (!Qi.isEmpty()) && dp[j] <= dp[Qi.get_back()]) Qi.pop_back(); Qi.push_back(j); } for ( ; j < (n-k_i_+1); j++) { // list.add(dp[Qi.get_front()]); list[count++] = dp[Qi.get_front()]; while ( (!Qi.isEmpty()) && Qi.get_front() <= j - k) Qi.pop_front(); while ( (!Qi.isEmpty()) && dp[j] <= dp[Qi.get_back()]) Qi.pop_back(); Qi.push_back(j); } // list.add(dp[Qi.get_front()]); list[count++] = dp[Qi.get_front()]; for(j=0;j<(n-k_i+1);j++) { dp[j] = temp[j] + list[j+1]; //list.get(j+1); temp[j] = 0; } } else { for (j = 0; j < k; j++) { while ( (!Qi.isEmpty()) && dp[j] >= dp[Qi.get_back()]) Qi.pop_back(); Qi.push_back(j); } for ( ; j < (n-k_i_+1); j++) { // list.add(dp[Qi.get_front()]); list[count++] = dp[Qi.get_front()]; while ( (!Qi.isEmpty()) && Qi.get_front() <= j - k) Qi.pop_front(); while ( (!Qi.isEmpty()) && dp[j] >= dp[Qi.get_back()]) Qi.pop_back(); Qi.push_back(j); } // list.add(dp[Qi.get_front()]); list[count++] = dp[Qi.get_front()]; for(j=0;j<(n-k_i+1);j++) { dp[j] = -temp[j] + list[j+1]; //list.get(j+1) ; temp[j] = 0; // list[j] = 0; } } for(;j<n;j++) { dp[j] = 0; temp[j] = 0; // list[j] = 0; } } long output = dp[0]; for(int i=1;i<n;i++) output = Math.max(output, dp[i]); out.println(output); } out.close(); } static class doubly_queue { public int s_i,e_i,size; public static int Def_size = 300001; private int[] data = new int[Def_size]; public void reset(){ s_i=0; e_i=0; size=0; } public boolean isEmpty(){ if(size<=0) return true; return false; } public void push_back(int element){ data[e_i++]=element; size++; e_i = e_i%Def_size; } public int pop_back(){ e_i--; if(e_i<0) e_i+=Def_size; size--; if(size==0) s_i = e_i; return data[e_i]; } public int get_back(){ return data[e_i-1]; } public int pop_front(){ int index = s_i; s_i = (s_i+1)%Def_size; size--; if(size == 0) e_i = s_i; return data[index]; } public int get_front(){ return data[s_i]; } // private List<Integer> deque = new ArrayList<Integer>(); // // private void reset(){ // // deque.clear(); // } // // private boolean isEmpty(){ // // return deque.isEmpty(); // } // // private void puch_front(int element){ // // deque.add(0,element); // } // // private void push_back(int element){ // // deque.add(element); // } // // private int pop_back(){ // // return deque.remove(deque.size()-1); // } // // public int get_back(){ // // return deque.get(deque.size()-1); // } // // public int pop_front(){ // // return deque.remove(0); // } // // public int get_front(){ // // return deque.get(0); // } } static class FasterScanner { private byte[] buf = new byte[8192]; private int curChar; private int numChars; public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = System.in.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) { return -1; } } return buf[curChar++]; } public String nextLine() { int c = read(); while (isSpaceChar(c)) { c = read(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndOfLine(c)); return res.toString(); } public String nextString() { int c = read(); while (isSpaceChar(c)) { c = read(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public long nextLong() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public int nextInt() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = nextInt(); } return arr; } public long[] nextLongArray(int n) { long[] arr = new long[n]; for (int i = 0; i < n; i++) { arr[i] = nextLong(); } return arr; } private boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } } }
82cd0a6bce95a99c70bc4ef9362998240a79f0c0
a5dbeadebfd268a529d6a012fb23dc0b635f9b8c
/core/src/test/java/ru/mipt/cybersecurity/pqc/crypto/test/McElieceKobaraImaiCipherTest.java
e8c0c43821372c5458529358936ac7d17f291eb2
[]
no_license
skhvostyuk/CyberSecurity
22f6a272e38b56bfb054aae0dd7aa03bc96b6d06
33ea483df41973984d0edbe47a20201b204150aa
refs/heads/master
2021-08-29T04:44:31.041415
2017-12-13T12:15:29
2017-12-13T12:15:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,489
java
package ru.mipt.cybersecurity.pqc.crypto.test; import java.security.SecureRandom; import java.util.Random; import ru.mipt.cybersecurity.crypto.AsymmetricCipherKeyPair; import ru.mipt.cybersecurity.crypto.Digest; import ru.mipt.cybersecurity.crypto.digests.SHA256Digest; import ru.mipt.cybersecurity.crypto.params.ParametersWithRandom; import ru.mipt.cybersecurity.pqc.crypto.mceliece.McElieceCCA2KeyGenerationParameters; import ru.mipt.cybersecurity.pqc.crypto.mceliece.McElieceCCA2KeyPairGenerator; import ru.mipt.cybersecurity.pqc.crypto.mceliece.McElieceCCA2Parameters; import ru.mipt.cybersecurity.pqc.crypto.mceliece.McElieceKobaraImaiCipher; import ru.mipt.cybersecurity.util.test.SimpleTest; public class McElieceKobaraImaiCipherTest extends SimpleTest { SecureRandom keyRandom = new SecureRandom(); public String getName() { return "McElieceKobaraImai"; } public void performTest() throws Exception { int numPassesKPG = 0; // TODO: this algorithm is broken int numPassesEncDec = 10; Random rand = new Random(); byte[] mBytes; for (int j = 0; j < numPassesKPG; j++) { McElieceCCA2Parameters params = new McElieceCCA2Parameters("SHA-256"); McElieceCCA2KeyPairGenerator mcElieceCCA2KeyGen = new McElieceCCA2KeyPairGenerator(); McElieceCCA2KeyGenerationParameters genParam = new McElieceCCA2KeyGenerationParameters(keyRandom, params); mcElieceCCA2KeyGen.init(genParam); AsymmetricCipherKeyPair pair = mcElieceCCA2KeyGen.generateKeyPair(); ParametersWithRandom param = new ParametersWithRandom(pair.getPublic(), keyRandom); Digest msgDigest = new SHA256Digest(); McElieceKobaraImaiCipher mcElieceKobaraImaiDigestCipher = new McElieceKobaraImaiCipher(); for (int k = 1; k <= numPassesEncDec; k++) { System.out.println("############### test: " + k); // initialize for encryption mcElieceKobaraImaiDigestCipher.init(true, param); // generate random message int mLength = (rand.nextInt() & 0x1f) + 1; mBytes = new byte[mLength]; rand.nextBytes(mBytes); msgDigest.update(mBytes, 0, mBytes.length); byte[] hash = new byte[msgDigest.getDigestSize()]; msgDigest.doFinal(hash, 0); // encrypt byte[] enc = mcElieceKobaraImaiDigestCipher.messageEncrypt(hash); // initialize for decryption mcElieceKobaraImaiDigestCipher.init(false, pair.getPrivate()); byte[] constructedmessage = mcElieceKobaraImaiDigestCipher.messageDecrypt(enc); // XXX write in McElieceFujisakiDigestCipher? boolean verified = true; for (int i = 0; i < hash.length; i++) { verified = verified && hash[i] == constructedmessage[i]; } if (!verified) { fail("en/decryption fails"); } else { System.out.println("test okay"); System.out.println(); } } } } public static void main( String[] args) { runTest(new McElieceKobaraImaiCipherTest()); } }
1005323b3159c0e1a7d02cd7cea097e6ea4fa844
6000edbe01f35679b1cf510575d547a6bb5e430c
/core/src/main/java/org/apache/logging/log4j/core/net/DatagramOutputStream.java
bf2a2e6c0935e2cb419adce3483dc39740623d35
[ "Apache-2.0" ]
permissive
JavaQualitasCorpus/log4j-2.0-beta
7cdd1a06e6b786bca3180c1fe1d077d0044b2b40
1aec5ba88965528ce8c3649b5d6f0136dc942c74
refs/heads/master
2023-08-12T09:29:17.392341
2020-06-02T18:02:37
2020-06-02T18:02:37
167,004,977
0
0
Apache-2.0
2022-12-16T01:21:49
2019-01-22T14:08:39
Java
UTF-8
Java
false
false
3,960
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.logging.log4j.core.net; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.appender.AppenderRuntimeException; import org.apache.logging.log4j.status.StatusLogger; import java.io.IOException; import java.io.OutputStream; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import java.net.UnknownHostException; /** * OutputStream for UDP connections. */ public class DatagramOutputStream extends OutputStream { /** * Allow subclasses access to the status logger without creating another instance. */ protected static final Logger LOGGER = StatusLogger.getLogger(); private static final int SHIFT_1 = 8; private static final int SHIFT_2 = 16; private static final int SHIFT_3 = 24; private DatagramSocket ds; private final InetAddress address; private final int port; private byte[] data; /** * The Constructor. * @param host The host to connect to. * @param port The port on the host. */ public DatagramOutputStream(final String host, final int port) { this.port = port; try { address = InetAddress.getByName(host); } catch (final UnknownHostException ex) { final String msg = "Could not find host " + host; LOGGER.error(msg, ex); throw new AppenderRuntimeException(msg, ex); } try { ds = new DatagramSocket(); } catch (final SocketException ex) { final String msg = "Could not instantiate DatagramSocket to " + host; LOGGER.error(msg, ex); throw new AppenderRuntimeException(msg, ex); } } @Override public synchronized void write(final byte[] bytes, final int offset, final int length) throws IOException { copy(bytes, offset, length); } @Override public synchronized void write(final int i) throws IOException { copy(new byte[] {(byte) (i >>> SHIFT_3), (byte) (i >>> SHIFT_2), (byte) (i >>> SHIFT_1), (byte) i}, 0, 4); } @Override public synchronized void write(final byte[] bytes) throws IOException { copy(bytes, 0, bytes.length); } @Override public synchronized void flush() throws IOException { if (this.ds != null && this.address != null) { final DatagramPacket packet = new DatagramPacket(data, data.length, address, port); ds.send(packet); } data = null; } @Override public synchronized void close() throws IOException { if (ds != null) { if (data != null) { flush(); } ds.close(); ds = null; } } private void copy(final byte[] bytes, final int offset, final int length) { final int index = data == null ? 0 : data.length; final byte[] copy = new byte[length + index]; if (data != null) { System.arraycopy(data, 0, copy, 0, index); } System.arraycopy(bytes, offset, copy, index, length); data = copy; } }
b161ec7ce63cd07e9e2b18f112b626b2d1889037
06fdc74f6373c45422860ad77002ece55bdd1fc0
/springboot/src/main/java/com/study/crawler/details/abstracts/WebsiteDetailAbstract.java
f5d68ef0fc754dcf50dc4a0622c8dacc1cfed903
[]
no_license
caiqiwang/learngit
d227e7ad5c1376bb371d6967c8b09ca152e1312d
0a2d9f373383d83f3cf865692f4161ecb925e95f
refs/heads/master
2021-04-12T02:59:06.975297
2018-04-02T11:39:32
2018-04-02T11:39:32
125,943,407
0
0
null
null
null
null
UTF-8
Java
false
false
1,586
java
package com.study.crawler.details.abstracts; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import com.study.crawler.details.WebsiteDetail; import com.study.crawler.entity.CompanyInfo; import com.study.crawler.entity.RecruitmentInfo; import com.study.crawler.tool.ConstantUtil; public abstract class WebsiteDetailAbstract implements WebsiteDetail, Runnable { private BlockingQueue<String> listQueue;// 存储每个分类下的所有详情url private ExecutorService service; private AtomicInteger atomic; public WebsiteDetailAbstract(BlockingQueue<String> listQueue, ExecutorService service, AtomicInteger atomic) { this.listQueue = listQueue; this.service = service; this.atomic = atomic; } public WebsiteDetailAbstract() { } public void run() { // TODO Auto-generated method stub String url = null; while (atomic.get() == ConstantUtil.number && listQueue.size() > 0) { url = getUrl(); if (url != null) { getWebsiteDetail(url); } } } public String getUrl() { String url = null; synchronized (listQueue) { while (listQueue.size() > 0) { try { url = listQueue.take(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return url; } public void getWebsiteDetail(String detailUrl) { // TODO Auto-generated method stub } public abstract CompanyInfo getCompanyInfo(String detailUrl); public abstract RecruitmentInfo getRecruitmentInfo(String detailUrl); }
12604dda9c65776a13b0c9b3f7f5beb359a16d8f
b21e690c1d348425ebc46c32a05406c3d67e3c47
/src/main/java/org/libsmith/anvil/net/mail/MailDelivery.java
d2c8b54a580e9d03db51992856bbe16f3361972b
[ "Apache-2.0" ]
permissive
libsmith/libanvil
1675cac295ee4176c42911eea2424cf556104936
74c68989533c701aea725b1efac741de38c1baf8
refs/heads/master
2021-01-19T01:38:53.677474
2016-10-18T15:36:01
2016-10-18T15:36:01
54,287,514
0
0
null
null
null
null
UTF-8
Java
false
false
4,880
java
package org.libsmith.anvil.net.mail; import org.libsmith.anvil.UncheckedException; import org.libsmith.anvil.time.ImmutableDate; import org.libsmith.anvil.time.TimePeriod; import javax.annotation.Nonnull; import javax.mail.Message; import java.io.Serializable; import java.util.Date; import java.util.concurrent.CompletableFuture; /** * @author Dmitriy Balakin <[email protected]> * @created 26.02.2015 21:19 */ public interface MailDelivery { @Nonnull DeliveryResult send(@Nonnull Message message); @Nonnull CompletableFuture<DeliveryResult> sendAsync(@Nonnull Message message); //<editor-fold desc="class DeliveryResult and his Builder"> class DeliveryResult implements Serializable { private static final long serialVersionUID = 730210939224224199L; enum Status { SENT, DELIVERED, IGNORED, ERROR } private final Message message; private final Status status; private final Date queuedDate; private final Date processedDate; private final Date deliveredDate; private final TimePeriod transportTime; private final Throwable throwable; protected DeliveryResult(Message message, Status status, Date queuedDate, Date processedDate, Date deliveredDate, TimePeriod transportTime, Throwable throwable) { this.message = message; this.status = status; this.queuedDate = queuedDate; this.processedDate = processedDate; this.deliveredDate = deliveredDate; this.transportTime = transportTime; this.throwable = throwable; } public DeliveryResult throwExceptionOnError() { if (getThrowable() != null) { throw UncheckedException.wrap(getThrowable()); } return this; } //<editor-fold desc="Getters"> public Message getMessage() { return message; } public Status getStatus() { return status; } public Date getQueuedDate() { return queuedDate; } public Date getProcessedDate() { return processedDate; } public Date getDeliveredDate() { return deliveredDate; } public TimePeriod getTransportTime() { return transportTime; } public Throwable getThrowable() { return throwable; } //</editor-fold> //<editor-fold desc="Builder"> public static class Builder implements Serializable { private static final long serialVersionUID = 7577528367072016185L; private final Message message; private final Date queuedDate; private volatile long sendingStartTimestamp; private volatile Date processedDate; private volatile TimePeriod transportTime; private volatile Date deliveredDate; protected Builder(Message message, Date queuedDate) { this.message = message; this.queuedDate = queuedDate; } public static Builder queued(Message message) { return new Builder(message, ImmutableDate.now()); } public Builder process() { this.sendingStartTimestamp = System.currentTimeMillis(); return this; } public DeliveryResult sent() { this.processedDate = ImmutableDate.now(); this.transportTime = TimePeriod.betweenMillis(sendingStartTimestamp, processedDate.getTime()); return new DeliveryResult(message, Status.SENT, queuedDate, processedDate, deliveredDate, transportTime, null); } public DeliveryResult delivered() { this.deliveredDate = ImmutableDate.now(); return new DeliveryResult(message, Status.DELIVERED, queuedDate, processedDate, deliveredDate, transportTime, null); } public DeliveryResult ignored() { return new DeliveryResult(message, Status.IGNORED, queuedDate, processedDate, deliveredDate, transportTime, null); } public DeliveryResult error(Throwable throwable) { this.processedDate = ImmutableDate.now(); this.transportTime = TimePeriod.betweenMillis(sendingStartTimestamp, processedDate.getTime()); return new DeliveryResult(message, Status.ERROR, queuedDate, processedDate, deliveredDate, transportTime, throwable); } } //</editor-fold> } //</editor-fold> }
579ce533f328df7c7e7a951c9bc36a55c55fd6a9
c0399f2ca217a4ffcf64aac88cfd6c04fa0d1ab2
/AppMonitor/src/com/app/monitor/boommenu/Eases/EaseOutQuad.java
e6a3382fc9c96d1e124816edebfe9ebd4d18b93a
[]
no_license
KingOfQueen/Android--AppMonitor
b4732e4b52013d94d07ec526aa9f6040506a5950
589461c6a10d651a586ebf0191efd1d5b770bf2e
refs/heads/master
2020-05-16T16:24:45.119364
2017-05-09T02:19:17
2017-05-09T02:19:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
164
java
package com.app.monitor.boommenu.Eases; public class EaseOutQuad extends CubicBezier { public EaseOutQuad() { init(0.25, 0.46, 0.45, 0.94); } }
0ab24b35aab49c32ae78915ad293fff2a2aa370e
27368bf04c9d6f41162efa805c106c4dffff79c3
/src/Telas/LigaDasLendas.java
6105650b54b872200201a1d90a1d72ac01904da1
[]
no_license
jaspionjpg/jogo-banco-imobiliario-java-swing
e0b1d9877f6727b939edf45c46c96c68f33540e3
ee33a524e6be15047867be3468c9bf1cae58a238
refs/heads/master
2020-05-30T17:39:11.518135
2019-06-02T18:12:08
2019-06-02T18:12:08
189,879,174
0
0
null
null
null
null
UTF-8
Java
false
false
48
java
package Telas; public class LigaDasLendas { }
c95236d871580d6846f19564e30739a96fcb83cc
30a98617d97fc0823005d21e3ddae641599f8e35
/src/main/java/clone/swaper/infrastructure/persistence/Id.java
416f80b097da9b33c4afba2f6d0123caca47023b
[]
no_license
yurachud/another-homework
c1ce0cc4e984413b7785ade9158f8b60c86f33f4
b70d89b0dac40f0f97e4d873eb2a7f619522a002
refs/heads/master
2021-01-23T21:10:48.886825
2017-05-08T21:27:29
2017-05-08T21:27:29
90,672,830
1
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
package clone.swaper.infrastructure.persistence; import com.google.common.base.Objects; import java.io.Serializable; import java.util.UUID; import java.util.function.Function; public abstract class Id implements Serializable { private UUID uuid; public Id(UUID uuid) { this.uuid = uuid; } public Id(Id id) { this.uuid = id.uuid(); } public UUID uuid() { return uuid; } public <T> T as(Function<Id, T> convert) { return convert.apply(this); } @Override public String toString() { return uuid.toString(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Id id = (Id) o; return Objects.equal(uuid, id.uuid); } @Override public int hashCode() { return Objects.hashCode(uuid); } }
5cf1aefa7b67145a48798258b53b4a04a329c144
c90fef529d010e901d3b3a675033625f479e76f6
/webapp/src/main/java/by/grodno/ss/rentacar/webapp/page/confirm/ConfirmPage.java
d857527255529dae08c432a8be9e0a4a69f8b17a
[]
no_license
stanevi4/rentacar
df4a65dd185429b9b900ee568bf78eadbbbb75df
f4a4d051e3acf1f3c0a685f22576a7d5d5d4aa37
refs/heads/master
2021-01-21T04:48:30.417998
2016-06-15T08:30:41
2016-06-15T08:30:41
55,909,281
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package by.grodno.ss.rentacar.webapp.page.confirm; import by.grodno.ss.rentacar.webapp.page.AbstractPage; public class ConfirmPage extends AbstractPage { private static final long serialVersionUID = 1L; public ConfirmPage() { } }
3eb4790197041602e2572996c111277e64efe936
ff4a0d23d201c581312490646c161dde1f676297
/src/org/ms2ms/mzjava/NumModMatchResolver.java
28677a0c02f71a22effa1e73e0338cc2f92783a0
[ "MIT" ]
permissive
wyu/ms2ms
f47bfd410feb1cab56b21b612234105953b22931
f5d7cb372d0bee0884ebf238e6ed218f673b1850
refs/heads/master
2022-11-14T09:19:29.396509
2021-08-14T02:33:39
2021-08-14T02:33:39
38,951,766
1
3
null
null
null
null
UTF-8
Java
false
false
760
java
package org.ms2ms.mzjava; import com.google.common.base.Optional; import org.expasy.mzjava.core.mol.NumericMass; import org.expasy.mzjava.proteomics.mol.modification.Modification; import org.expasy.mzjava.proteomics.ms.ident.ModificationMatch; import org.expasy.mzjava.proteomics.ms.ident.ModificationMatchResolver; /** * Created by yuw on 10/19/2015. */ public class NumModMatchResolver implements ModificationMatchResolver { @Override public Optional<Modification> resolve(ModificationMatch modMatch) { double mass = modMatch.getMassShift(); if (mass!=0) return Optional.of(new Modification(modMatch.getResidue().getSymbol()+(mass<0?"-":"")+mass, new NumericMass(mass))); return Optional.absent(); } }
41ad80fbecb6391c219aab79d9db6c74e9089a05
0469ac7db609fd7efccf4a86ff78e8295de3e407
/src/main/java/de/tum/in/www1/artemis/web/rest/ProgrammingSubmissionResultSimulationResource.java
38a314c6485a49b2bc7b48bab80547c473b2778c
[ "MIT" ]
permissive
LDAP/Artemis
7cbf64d58c40ed0556fcfd1703699e58f4bf049a
15d753fbd9c19e45a4c4d8da87ef4ad56b9c5436
refs/heads/main
2023-03-07T15:57:35.248642
2021-01-28T20:33:27
2021-01-28T20:33:27
334,384,899
0
0
MIT
2021-01-30T10:23:41
2021-01-30T10:23:41
null
UTF-8
Java
false
false
7,605
java
package de.tum.in.www1.artemis.web.rest; import static de.tum.in.www1.artemis.web.rest.util.ResponseUtil.forbidden; import java.net.URI; import java.net.URISyntaxException; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import de.tum.in.www1.artemis.domain.*; import de.tum.in.www1.artemis.domain.participation.Participant; import de.tum.in.www1.artemis.domain.participation.Participation; import de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation; import de.tum.in.www1.artemis.domain.participation.StudentParticipation; import de.tum.in.www1.artemis.service.*; import de.tum.in.www1.artemis.web.rest.util.HeaderUtil; /** * Only for local development * Simulates submission and results for a programming exercise without a connection to the VCS and CI server * This functionality is only for testing purposes (noVersionControlAndContinuousIntegrationAvailable) */ @Profile("dev") @RestController @RequestMapping(ProgrammingSubmissionResultSimulationResource.Endpoints.ROOT) public class ProgrammingSubmissionResultSimulationResource { @Value("${jhipster.clientApp.name}") private String applicationName; private final Logger log = LoggerFactory.getLogger(ProgrammingSubmissionResource.class); private final ProgrammingSubmissionService programmingSubmissionService; private final UserService userService; private final ParticipationService participationService; private final WebsocketMessagingService messagingService; private final ProgrammingExerciseService programmingExerciseService; private final ProgrammingSubmissionResultSimulationService programmingSubmissionResultSimulationService; private final ExerciseService exerciseService; private final AuthorizationCheckService authCheckService; public ProgrammingSubmissionResultSimulationResource(ProgrammingSubmissionService programmingSubmissionService, UserService userService, ParticipationService participationService, WebsocketMessagingService messagingService, ProgrammingExerciseService programmingExerciseService, ProgrammingSubmissionResultSimulationService programmingSubmissionResultSimulationService, ExerciseService exerciseService, AuthorizationCheckService authCheckService) { this.programmingSubmissionService = programmingSubmissionService; this.userService = userService; this.participationService = participationService; this.messagingService = messagingService; this.programmingExerciseService = programmingExerciseService; this.programmingSubmissionResultSimulationService = programmingSubmissionResultSimulationService; this.exerciseService = exerciseService; this.authCheckService = authCheckService; } /** * This method is used to create a participation and a submission * This participation and submission are only SIMULATIONS for the testing * of programming exercises without a connection to the VCS and CI server * This functionality is only for testing purposes (noVersionControlAndContinuousIntegrationAvailable) * @param exerciseId the id of the exercise * @return HTTP OK and ProgrammingSubmission */ @PostMapping(Endpoints.SUBMISSIONS_SIMULATION) @PreAuthorize("hasAnyRole('INSTRUCTOR', 'ADMIN')") public ResponseEntity<ProgrammingSubmission> createParticipationAndSubmissionSimulation(@PathVariable Long exerciseId) { User user = userService.getUserWithGroupsAndAuthorities(); Exercise exercise = exerciseService.findOne(exerciseId); if (!authCheckService.isAtLeastInstructorForExercise(exercise, user)) { return forbidden(); } ProgrammingSubmission programmingSubmission = programmingSubmissionResultSimulationService.createSubmission(exerciseId); programmingSubmissionService.notifyUserAboutSubmission(programmingSubmission); try { return ResponseEntity.created(new URI("/api/submissions" + programmingSubmission.getId())).body(programmingSubmission); } catch (URISyntaxException e) { log.error("Error while simulating a submission", e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .headers(HeaderUtil.createAlert(applicationName, "An error occurred while simulating a submission: " + e.getMessage(), "errorSubmission")).body(null); } } /** * This method is used to notify artemis that there is a new programming exercise build result. * This result is only a SIMULATION for the testing of programming exercises without a connection * to the VCS and CI server * This functionality is only for testing purposes (noVersionControlAndContinuousIntegrationAvailable) * @param exerciseId id of the exercise * @return HTTP OK and Result */ @PostMapping(Endpoints.RESULTS_SIMULATION) @PreAuthorize("hasAnyRole('INSTRUCTOR', 'ADMIN')") public ResponseEntity<Result> createNewProgrammingExerciseResult(@PathVariable Long exerciseId) { log.debug("Received result notify (NEW)"); User user = userService.getUserWithGroupsAndAuthorities(); Participant participant = user; ProgrammingExercise programmingExercise = programmingExerciseService.findByIdWithEagerStudentParticipationsAndSubmissions(exerciseId); Optional<StudentParticipation> optionalStudentParticipation = participationService.findOneByExerciseAndParticipantAnyState(programmingExercise, participant); if (optionalStudentParticipation.isEmpty()) { return forbidden(); } ProgrammingExerciseStudentParticipation programmingExerciseStudentParticipation = (ProgrammingExerciseStudentParticipation) optionalStudentParticipation.get(); Result result = programmingSubmissionResultSimulationService.createResult(programmingExerciseStudentParticipation); messagingService.broadcastNewResult((Participation) optionalStudentParticipation.get(), result); log.info("The new result for {} was saved successfully", ((ProgrammingExerciseStudentParticipation) optionalStudentParticipation.get()).getBuildPlanId()); try { return ResponseEntity.created(new URI("/api/results" + result.getId())).body(result); } catch (URISyntaxException e) { log.error("Error while simulating a result", e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .headers(HeaderUtil.createAlert(applicationName, "An error occurred while simulating a result: " + e.getMessage(), "errorResult")).body(null); } } public static final class Endpoints { public static final String ROOT = "/api"; public static final String SUBMISSIONS_SIMULATION = "/exercises/{exerciseId}/submissions/no-vcs-and-ci-available"; public static final String RESULTS_SIMULATION = "/exercises/{exerciseId}/results/no-vcs-and-ci-available"; } }
d892a749552d7d46b83aeeab8548b468411567f7
9ee95761949e36a42fc74e9a9331b294f3ef61ed
/target/classes/placeholder.java
019bbb5585b1fb342ff3df42475a0c7982620074
[]
no_license
copetty/TurkeySiteBackend
c26c1b749dfb8c359e625403f8f5ddf89be17aa0
94b944eea6bef12a8bea4e33bf43f2f36b18713d
refs/heads/main
2023-04-23T01:14:36.995772
2021-05-04T01:36:21
2021-05-04T01:36:21
364,109,094
0
0
null
null
null
null
UTF-8
Java
false
false
31
java
public class placeholder { }
9c7e1dac2d41e558d58b7601ad83eaac4b448979
9ff37e80409c1efde5eac77a2d132a9b1a395565
/sourcecheckWeb/src/main/java/com/fengdai/qa/service/ParseSrcService.java
a07a2eebe3ad5f84a5e527b476f9afd668dc2645
[]
no_license
shichaowei/analyzeCode
bb5e4be7e9c08dd3d8eac60e80e02d032c91433a
9c9f4eaadd33fac8056c5c8806c6a83f47e268db
refs/heads/master
2021-01-22T20:09:04.957040
2018-03-19T02:05:06
2018-03-19T02:05:06
85,290,149
3
0
null
null
null
null
UTF-8
Java
false
false
428
java
package com.fengdai.qa.service; import java.util.ArrayList; import java.util.HashSet; import com.fengdai.qa.model.tree; public interface ParseSrcService { public ArrayList<String> getroots() ; public String getTreeJson(String rootNode); public void parseSources(String classesDir,HashSet<String> varchange); public void buildToLinkTrees(String classesDir); public ArrayList<tree<String>> getLinkTrees(); }
ef959f8a29d9ecc78d601bbf3f4f06e21216331d
3604c82e5a87714b57cfa219e451db924993e1bb
/src/test/java/com/practice/greedy/JumpGameTest.java
a11e2b202efbfd58454dce51f22937d3a194a946
[]
no_license
mukeshkamboj/data-structure-and-algorithm
20535bab92d669cecb297872905372d43b646014
68ca8126ef7369e16ccf0bc4fb08cba7f7c56c1d
refs/heads/master
2023-07-12T08:36:26.594479
2021-08-11T01:15:26
2021-08-13T01:15:26
355,020,475
0
0
null
null
null
null
UTF-8
Java
false
false
731
java
package com.practice.greedy; import java.util.stream.Stream; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; public class JumpGameTest { @ParameterizedTest @MethodSource("testDataProvider") public void testCanJump(int[] arr, boolean expected) { //WHEN var canJump = new JumpGame().canJump(arr); //THEN Assertions.assertEquals(expected, canJump); } static Stream<Arguments> testDataProvider() { return Stream.of( Arguments.arguments(new int[]{2, 3, 1, 1, 4}, true), Arguments.arguments(new int[]{3, 2, 1, 0, 4}, false) ); } }
ca65e841b47cf68f6cc2ad52e94186a42c3d846a
91d9e91134115eb09404450e866a69b73e08f743
/worldoffice/src/test/java/com/spring/worldoffice/WorldofficeApplicationTests.java
9e398dd52766e98fed50b5806f44c2efa07fabf8
[]
no_license
milenamiranda177/WorldOffice
dcd97de376c303fad738e61ebdeb82ff65d6d219
7ce65ca18dbe7e1c3467bed7055be048653ac03f
refs/heads/master
2022-12-17T05:45:19.160556
2020-09-17T04:06:47
2020-09-17T04:06:47
296,212,742
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.spring.worldoffice; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class WorldofficeApplicationTests { @Test void contextLoads() { } }
79df036ad96b125ea26995d38667b0ece03ea2b1
756be5a11e265763e60f01ba4f89f0f2e8f3ea4a
/super ke/Example1.java
3aab7f321ccbc5fe6ad5c965df1eac4a5203c267
[]
no_license
pradeep-kumar-1705807/Java-Practice-Programs
31f820bbba2f8c144366b155dbe5de78f37f7163
603622b9d237e389ddf1809eaa9f70296f760799
refs/heads/master
2021-05-25T08:25:52.096203
2020-04-07T09:02:11
2020-04-07T09:02:11
253,739,122
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
class Fruit { protected Fruit() { System.out.println("Fruit Class"); } } class Apple extends Fruit { Apple() { super(); System.out.println("Apple Class"); } } class Example1 { public static void main(String args[]) { Apple a1=new Apple(); } }
447e5bf510dee45de4c34c49d9a979e84314e095
bee440803895b05f350972bc4ee82b92b53530d7
/app/src/main/java/com/laioffer/tinnews/ui/search/SearchNewsAdapter.java
b895747bf7e7be00a9945e28dc0027be3611fbcb
[]
no_license
zionhjs/tinNews_Project
8adf4739b4b8b6e133526641c52d5928ce2e8139
7d7cf5fd64028eeebbab8abd8c226871b594b03b
refs/heads/master
2022-11-12T06:22:48.104427
2020-06-28T04:46:38
2020-06-28T04:46:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,403
java
package com.laioffer.tinnews.ui.search; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import com.laioffer.tinnews.model.Article; import androidx.recyclerview.widget.RecyclerView; import com.laioffer.tinnews.R; import com.squareup.picasso.Picasso; import java.util.LinkedList; import java.util.List; public class SearchNewsAdapter extends RecyclerView.Adapter<SearchNewsAdapter.SearchNewsViewHolder>{ private List<Article> articles = new LinkedList<>(); @NonNull @Override public SearchNewsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = (View)LayoutInflater.from(parent.getContext()).inflate(R.layout.search_news_item, parent, false); return new SearchNewsViewHolder(view); } public void setArticles(List<Article> newsList){ this.articles.clear(); this.articles.addAll(newsList); notifyDataSetChanged(); } @Override public void onBindViewHolder(@NonNull SearchNewsViewHolder holder, int position) { Article article = articles.get(position); if(article.urlToImage == null){ holder.newsImage.setImageResource(R.drawable.ic_empty_image); }else{ Picasso.get().load(article.urlToImage).into(holder.newsImage); } if(article.favorite){ holder.favorite.setImageResource(R.drawable.ic_favorite_black_24dp); holder.favorite.setOnClickListener(null); }else{ holder.favorite.setImageResource(R.drawable.ic_favorite_black_24dp); holder.favorite.setOnClickListener( v -> { article.favorite = true; likeListener.onLike(article); }); } } @Override public int getItemCount() { return articles.size(); } public static class SearchNewsViewHolder extends RecyclerView.ViewHolder{ ImageView newsImage; ImageView favorite; public SearchNewsViewHolder(@NonNull View itemView){ super((android.view.View) itemView); newsImage = ((android.view.View) itemView).findViewById(R.id.image); favorite = ((android.view.View) itemView).findViewById(R.id.favorite); } } }
9341330823ed8625fbc4aa8df84c45d855197567
6608152698b0cbdcf56662de984e0f29e98bfe22
/app/src/main/java/com/android/uitest/yqlm/adapter/ContentAdapter.java
ac6c69d9739245ae9cd4b601fa93808cd0397d75
[]
no_license
seaFeng/UITest
d846100af8f95f58f306e340f3570843573b1ba3
2f051e9569c66dcb3413d4d1363dff25507d0fcd
refs/heads/master
2020-03-22T05:38:53.067607
2018-07-07T16:45:36
2018-07-07T16:45:36
139,580,901
0
0
null
null
null
null
UTF-8
Java
false
false
1,328
java
package com.android.uitest.yqlm.adapter; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.android.uitest.R; import java.util.List; /** * Created by 张海洋 on 2018-07-03. */ public class ContentAdapter extends RecyclerView.Adapter<ContentAdapter.ContentViewHolder> { private List<String> list; public ContentAdapter(List<String> list) { this.list = list; } @NonNull @Override public ContentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); return new ContentViewHolder(inflater.inflate(R.layout.view_recycler_content,parent,false)); } @Override public void onBindViewHolder(@NonNull ContentViewHolder holder, int position) { } @Override public int getItemCount() { return list.size(); } class ContentViewHolder extends RecyclerView.ViewHolder{ private TextView tvContent; public ContentViewHolder(View itemView) { super(itemView); tvContent = itemView.findViewById(R.id.view_recyclerView_menuItem); } } }
3f47c4636d71d47ae012324a6dc7633ed626dc85
00c5683488607cb6883e397a4ba91d7c0a13e972
/app/repository/SoilRepository.java
c3408cda4c11976bb0102746c6ac7e7f77dc309d
[ "CC0-1.0" ]
permissive
kavishitech/kb-backend
0f061bc93aa72a98e874a537818eb6b35853de34
91a12abeb73e1cbf9144e5ede7205a92fbf33b15
refs/heads/master
2021-04-17T01:27:54.697598
2020-03-23T10:32:43
2020-03-23T10:32:43
249,400,117
0
0
null
null
null
null
UTF-8
Java
false
false
2,322
java
package repository; import io.ebean.Ebean; import io.ebean.EbeanServer; import io.ebean.Model; import models.Soil; import play.db.ebean.EbeanConfig; import javax.inject.Inject; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletionStage; import static java.util.concurrent.CompletableFuture.supplyAsync; /** * A repository that executes database operations in a different * execution context. */ public class SoilRepository { private final EbeanServer ebeanServer; private final DatabaseExecutionContext executionContext; @Inject public SoilRepository(EbeanConfig ebeanConfig, DatabaseExecutionContext executionContext) { this.ebeanServer = Ebean.getServer(ebeanConfig.defaultServer()); this.executionContext = executionContext; } public CompletionStage<List<Soil>> page() { return supplyAsync(() -> ebeanServer.find(Soil.class). findList(), executionContext); } public CompletionStage<Soil> lookup(Long id) { return supplyAsync(() -> ebeanServer.find(Soil.class).setId(id).findOne(), executionContext); } public CompletionStage<Long> updateNames( Soil newSoilData) { return supplyAsync(() -> { Long value = 0l; Soil savedSoil = ebeanServer.find(Soil.class).setId(newSoilData.id).findOne(); if (savedSoil != null) { savedSoil.setName(newSoilData.getName()); savedSoil.update(); value = savedSoil.id; } return value; }, executionContext); } public CompletionStage<Optional<Long>> delete(Long id) { return supplyAsync(() -> { try { final Optional<Soil> SoilOptional = Optional.ofNullable(ebeanServer.find(Soil.class).setId(id).findOne()); SoilOptional.ifPresent(Model::delete); return SoilOptional.map(c -> c.id); } catch (Exception e) { return Optional.empty(); } }, executionContext); } public CompletionStage<Long> insert(Soil soil) { return supplyAsync(() -> { ebeanServer.insert(soil); return soil.id; }, executionContext); } }
d9c01514eae17b2f25ac3f80ee82d0ed1d5d0218
2796a6afd0ad85738da9f89fa0e4d540e2bd5bf4
/src/main/java/pl/tomo/luxmed/reservation/ReservationExecutor.java
beaeac5bda4c75b4135233af7498e06dabf7c8d7
[]
no_license
TomaszMolenda/luxmed
229edd3c15fbe37123c8830e6c2a309988bfc966
b46696b400d164b536a76c2bede0dc7bf8b50863
refs/heads/master
2021-03-27T12:31:45.701216
2018-01-09T20:04:26
2018-01-09T20:04:26
116,864,542
0
0
null
null
null
null
UTF-8
Java
false
false
1,325
java
package pl.tomo.luxmed.reservation; import org.jsoup.nodes.Document; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service class ReservationExecutor { private final ReservationStatusUpdater reservationStatusUpdater; private final ReservationChecker reservationChecker; private final ReservationRemover reservationRemover; private final ReservationConfirmer reservationConfirmer; @Autowired ReservationExecutor(ReservationStatusUpdater reservationStatusUpdater, ReservationChecker reservationChecker, ReservationRemover reservationRemover, ReservationConfirmer reservationConfirmer) { this.reservationStatusUpdater = reservationStatusUpdater; this.reservationChecker = reservationChecker; this.reservationRemover = reservationRemover; this.reservationConfirmer = reservationConfirmer; } void reserve(Reservation reservation) { final ReservationStatus reservationStatus = reservationChecker.checkIfIsReservation(reservation); if (reservationStatus.isExist()) { reservationRemover.remove(reservationStatus); } Document document = reservationConfirmer.confirm(reservation); reservationStatusUpdater.update(reservation, document); } }
b9b9b00afbd93dc18f814d3600d6f12c57b21e4b
0344b0746082049c332efcc7c8c15c19b47311dd
/src/com/example/gp/HomeFragment.java
a6759de6c5b4d4a071233a4202e7cbb0844cfa20
[]
no_license
ajeetsingh-123/gatepoint
c70bd7c50a12e9700df788affe68445094fff23a
76375bd9d2ed43a7c6c9fc6362cc75e9ee8f2cec
refs/heads/master
2022-12-22T06:58:26.235554
2020-10-04T17:17:01
2020-10-04T17:17:01
256,679,377
0
0
null
null
null
null
UTF-8
Java
false
false
14,404
java
package com.example.gp; import java.util.ArrayList; import java.util.List; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.annotation.SuppressLint; import android.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; @SuppressLint("NewApi") public class HomeFragment extends Fragment { ImageButton img1,img2,img3,img4; Button b1,b2,b3,b4,back,back1; ListView l,lv; TextView txt1; Thread t; String news1,s; LinearLayout l1,l2; private ArrayAdapter<String> adapter; String []a,b,c,e,f,g,h,i; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreateView(inflater, container, savedInstanceState); View rootView = inflater.inflate(R.layout.fragment_home, container, false); img1 = (ImageButton)rootView.findViewById(R.id.img1); img2 = (ImageButton)rootView.findViewById(R.id.img2); img3 = (ImageButton)rootView.findViewById(R.id.img3); img4 = (ImageButton)rootView.findViewById(R.id.img4); l1 =( LinearLayout)rootView.findViewById(R.id.llt1); l2 =( LinearLayout)rootView.findViewById(R.id.llt2); txt1 = (TextView)rootView.findViewById(R.id.txt1); b1 = ( Button)rootView.findViewById(R.id.b1); b2 = ( Button)rootView.findViewById(R.id.b2); b3 = ( Button)rootView.findViewById(R.id.b3); b4 = ( Button)rootView.findViewById(R.id.b4); back =(Button)rootView.findViewById(R.id.b5); back1 =(Button)rootView.findViewById(R.id.b6); l = ( ListView)rootView.findViewById(R.id.listView1); lv = ( ListView)rootView.findViewById(R.id.listView2); b1.setVisibility(View.VISIBLE); img1.setVisibility(View.VISIBLE); b2.setVisibility(View.VISIBLE); img2.setVisibility(View.VISIBLE); b3.setVisibility(View.VISIBLE); img3.setVisibility(View.VISIBLE); b4.setVisibility(View.VISIBLE); img4.setVisibility(View.VISIBLE); l1.setVisibility(View.VISIBLE); l2.setVisibility(View.GONE); //lv.setVisibility(View.GONE); //back1.setVisibility(View.GONE); b1.setText(Html.fromHtml("<font color=\"#ffffff\" >"+"<big><b>"+"Engineering Mathematics\n"+"</b></big>"+"</font></br>" +"<small><b>"+"Logic,Probability,Set Theory & Algebra,combinatorics,Graph Theory,Linear Algebra," + "calculus"+"</b></small>"+"<br />")); b2.setText(Html.fromHtml("<font color=\"#ffffff\" size=\"10\">"+"<big><b>"+"Computer Science\n"+"</b></big></br>"+"</font>" +"<small>"+"\n"+"\t\t\t\t\t\t\t\tDigital Logic,Algorithms,Theory of Computation,Compiler Design," + "Operating System,Databases,Computer Network" +"</br>"+ "Data Structure"+"</small>"+"<br/>")); b3.setText(Html.fromHtml("<font color=\"#ffffff\" size=\"10\">"+"<b><big>"+"Electronics & Communication\n"+"</big></b></br>"+"</font>" +"<small>"+"Networks,Electronic devices,Anlog Circuits," +"</br>"+ "Digital circuits,Signals And Systems Control Systems,Communications,..."+"</small>"+"<br />")); b4.setText(Html.fromHtml("<font color=\"#ffffff\">"+"<b><big>"+"Gate News...\n"+"</big></b>" +"<small>"+"</font>"+"</small>"+"<br />")); a = new String[4]; a[0]="Discrete Mathematics >"; a[1]="Linear Algebra >"; a[2]="Probability >"; a[3]="Calculus >"; b = new String[8]; b[0]="Digital Logic >"; b[1]="Computer Organisation and Architecture >"; b[2]="Design and Analysis of Algorithms >"; b[3]="Theory of Computation >"; b[4]="Compiler Design >"; b[5]="Operating System >"; b[6]="Database Management System >"; b[7]="Computer Network >"; c = new String[8]; c[0]="Anlog Circuit >"; c[1]="Control System >"; c[2]="Digital Logic >"; c[3]="Electonic device and Circuits >"; c[4]="Signal and Systems >"; c[5]="Communication System >"; c[6]="EMF Theory >"; c[7]="Electrical Networks Theory >"; b1.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call1(); } }); img1.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call1(); } } ); b2.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call2(); } }); img2.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call2(); } } ); b3.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call3(); } }); img3.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call3(); } } ); b4.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call4(); } }); img4.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call4(); } } ); back.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub l1.setVisibility(View.VISIBLE); l2.setVisibility(View.GONE); lv.setVisibility(View.GONE); l.setVisibility(View.GONE); } }); back1.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub call2(); back.setVisibility(View.VISIBLE); back1.setVisibility(View.GONE); l1.setVisibility(View.VISIBLE); l2.setVisibility(View.GONE); lv.setVisibility(View.GONE); l.setVisibility(View.GONE); } }); return rootView; } private void call1() { // TODO Auto-generated method stub list1(); lv.setVisibility(View.GONE); back1.setVisibility(View.GONE); l.setVisibility(View.VISIBLE); l2.setVisibility(View.VISIBLE); l1.setVisibility(View.GONE); txt1.setVisibility(View.GONE); } private void call2() { // TODO Auto-generated method stub list2(); lv.setVisibility(View.VISIBLE); l2.setVisibility(View.VISIBLE); l1.setVisibility(View.GONE); l.setVisibility(View.GONE); txt1.setVisibility(View.GONE); } private void call3() { // TODO Auto-generated method stub list3(); back1.setVisibility(View.GONE); lv.setVisibility(View.GONE); l.setVisibility(View.VISIBLE); l2.setVisibility(View.VISIBLE); l1.setVisibility(View.GONE); txt1.setVisibility(View.GONE); } private void call4() { // TODO Auto-generated method stub txt1.setVisibility(View.VISIBLE); lv.setVisibility(View.GONE); back1.setVisibility(View.GONE); l.setVisibility(View.GONE); t=new Thread() { public void run(){ List<BasicNameValuePair> li; li=new ArrayList<BasicNameValuePair>(); li.add(new BasicNameValuePair("key","cvb")); httpconnection con=new httpconnection(); final String res=con.get_httpvalue("http://10.0.2.2:8090/examples/Gate_news.jsp", li, getActivity()); JSONArray jAr = null; //s="Sorry! you are not connected to server..."; try{ jAr = new JSONArray(res); JSONObject obj = null; obj = jAr.getJSONObject(0); news1 = obj.getString("info"); }catch(JSONException e){ e.printStackTrace(); System.out.println("Sorry! you are not connected to server..."); //Toast.makeText(getActivity(), s, Toast.LENGTH_LONG).show(); } getActivity().runOnUiThread(new Runnable(){ public void run(){ Toast.makeText(getActivity(), news1, Toast.LENGTH_LONG).show(); // txt1.setText(news1); // l1.setVisibility(View.GONE); // l2.setVisibility(View.VISIBLE); } }); } }; t.start(); } private void list1() { // TODO Auto-generated method stub adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,a); l.setAdapter(adapter); l.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { String res=l.getItemAtPosition(arg2).toString(); //String type=state.getSelectedItem().toString(); //Toast.makeText(getActivity(),res,Toast.LENGTH_LONG).show(); for(int d=0;d<4;d++) if(res.equals(a[d])) { switch (d) { case 0: Intent i=new Intent(getActivity(),Discrete.class); startActivity(i); break; case 1: Intent p=new Intent(getActivity(),LinearAlgebra.class); startActivity(p); break; case 2: Intent q=new Intent(getActivity(),Probability.class); startActivity(q); break; case 3: Intent r=new Intent(getActivity(),Calculus.class); startActivity(r); break; default: break; } } l.setAdapter(adapter); //l.setVisibility(View.GONE); back.setVisibility(View.GONE); back1.setVisibility(View.VISIBLE); } }); } private void list2() { // TODO Auto-generated method stub adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,b); lv.setAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String res=lv.getItemAtPosition(arg2).toString(); //String type=state.getSelectedItem().toString(); //Toast.makeText(getActivity(),res,Toast.LENGTH_LONG).show(); for(int d=0;d<8;d++) if(res.equals(b[d])) { switch (d) { case 0: Intent i=new Intent(getActivity(),Digital1.class); startActivity(i); break; case 1: Intent p=new Intent(getActivity(),Digital1.class); startActivity(p); break; case 2: Intent q=new Intent(getActivity(),Algo.class); startActivity(q); break; case 3: Intent r=new Intent(getActivity(),Toc1.class); startActivity(r); break; case 4: Intent s =new Intent(getActivity(),Compiler1.class); startActivity(s); break; case 5: Intent t=new Intent(getActivity(),Os1.class); startActivity(t); break; case 6: Intent u=new Intent(getActivity(),Database1.class); startActivity(u); break; case 7: Intent v=new Intent(getActivity(),Networking1.class); startActivity(v); break; default: break; } } lv.setAdapter(adapter); //l.setVisibility(View.GONE); back.setVisibility(View.GONE); back1.setVisibility(View.VISIBLE); } }); } private void list3() { // TODO Auto-generated method stub adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,c); l.setAdapter(adapter); l.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String res=l.getItemAtPosition(arg2).toString(); //String type=state.getSelectedItem().toString(); //Toast.makeText(getActivity(),res,Toast.LENGTH_LONG).show(); for(int d=0;d<8;d++) if(res.equals(c[d])) { switch (d) { case 0: Intent i=new Intent(getActivity(),Anlog1.class); startActivity(i); break; case 1: Intent p=new Intent(getActivity(),Csystem1.class); startActivity(p); break; case 2: Intent q=new Intent(getActivity(),Digital1.class); startActivity(q); break; case 3: Intent r=new Intent(getActivity(),Edc1.class); startActivity(r); break; case 4: Intent s =new Intent(getActivity(),Ssystem1.class); startActivity(s); break; case 5: Intent t=new Intent(getActivity(),Cmsystem1.class); startActivity(t); break; case 6: Intent u=new Intent(getActivity(),Emf1.class); startActivity(u); break; case 7: Intent v=new Intent(getActivity(),Ent1.class); startActivity(v); break; default: break; } } l.setAdapter(adapter); //l.setVisibility(View.GONE); back.setVisibility(View.GONE); back1.setVisibility(View.VISIBLE); } }); } }
dda80cbe52abbdd4e7b3b26010ecf40503bf84d8
51fc65abd4f193e621096b6568b358c8999045b6
/src/main/java/org/cloud/ssm/mapper/SysLogMapper.java
3a4dd788cc5f76f4a2b1064f21073a8696fdd9a7
[ "MIT" ]
permissive
DongJeremy/complexSSMWithGradle
fc5f64682f969292ef7c9cf6acdffc1221055b28
a817302385a1b482f7acef3dcdc0d2f9ce351cec
refs/heads/master
2022-12-21T11:07:50.236202
2020-04-30T08:09:59
2020-04-30T08:09:59
253,219,603
0
0
MIT
2022-12-16T15:38:48
2020-04-05T11:33:12
JavaScript
UTF-8
Java
false
false
198
java
package org.cloud.ssm.mapper; import org.cloud.ssm.common.base.BaseMapper; import org.cloud.ssm.entity.SysLog; public interface SysLogMapper extends BaseMapper<SysLog> { void clearLogs(); }
8896487cb4dc1b33182b02971fe3ce90e165dda4
45aba410be5f2f117b84f085b3ae2bae1299c7ca
/src/main/java/com/example/service/MailSender.java
a8c4f3adef2c70a8d73de8df831cffdc7864a59c
[]
no_license
VladTVN/MySpring
f74133e95cfb2e8983165b9d6b35a7d369f39c5b
8264f0b0914eecf3651af7fdeb1793f06b23412d
refs/heads/master
2023-02-03T04:06:57.021334
2020-12-27T12:19:25
2020-12-27T12:19:25
299,046,794
1
0
null
null
null
null
UTF-8
Java
false
false
806
java
package com.example.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Service; @Service public class MailSender { @Value("${spring.mail.username}") private String username; @Autowired private JavaMailSender mailSender; public void send(String emailTo, String subject, String message){ SimpleMailMessage mailMessage = new SimpleMailMessage(); mailMessage.setFrom(username); mailMessage.setTo(emailTo); mailMessage.setSubject(subject); mailMessage.setText(message); mailSender.send(mailMessage); } }
22aa7e71377d66a5da3ddb4d179d512e650a0bbb
8ffecc0f347494236039f7b60b90405a1a669121
/src/com/example/javafundametal/basic/branching/IfElseIfElse.java
d7bc9aced26cb4ece27fc08d0e4f9d25feb95ee7
[]
no_license
PramudiaPutra/Java-Fundamental
e8a4d48d12ea5e27f19ee98ff6fda95346ad47b6
d94db582714f31b3494afa86ddb508bec77df35d
refs/heads/master
2023-07-24T07:08:15.651860
2021-08-17T07:02:44
2021-08-17T07:02:44
391,842,941
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.example.javafundametal.basic.branching; import java.util.Scanner; public class IfElseIfElse { public static void main(String[] args) { System.out.print("input your score: "); Scanner scanner = new Scanner(System.in); int score = scanner.nextInt(); String scoreIndex; if (score >= 90) { scoreIndex = "A"; } else if (score >= 80) { scoreIndex = "B"; } else if (score >= 70) { scoreIndex = "C"; } else if (score >= 60) { scoreIndex = "D"; } else { scoreIndex = "E"; } System.out.println("you score is : " + scoreIndex); } }
5d974ade7dec63a08fecf43592546175fd7b31a7
8beac5fb40f06380cc4bfb938f3a71317ea2f46c
/string2s/src/main/java/com/String1s/NonStart.java
a8caaf7bf38a0ce520be28403c21bafd06feccee
[]
no_license
SakshiGauro/codingBats
e7a6d6b2100f49a21f0721ad3c160bec10dd1331
f309681aa9d5a772b2bec43a9381ae614940b620
refs/heads/master
2023-05-07T08:39:59.414254
2021-06-01T15:54:06
2021-06-01T15:54:06
318,861,881
3
0
null
null
null
null
UTF-8
Java
false
false
560
java
package com.String1s; import java.util.Scanner; public class NonStart { public String nonStart(String a, String b) { String noA= a.substring(1,a.length()); String noB=b.substring(1,b.length()); return noA+noB; } public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter 2 words"); String word1 = in.nextLine(); String word2 = in.nextLine(); NonStart obj = new NonStart(); System.out.println(obj.nonStart(word1, word2)); } }
b81663d37441e5cc97e5077005e379e9af19d536
81deb9c54d1173d455e395f0e97a82923c9e9baf
/app/src/main/java/iti/team/tablia/Models/FollowedChef.java
bc532eeb6b16e396062187ed865ed39fccaa7ddd
[]
no_license
YasmineDwedar/Tablia-
77a2420780beaf9216b0f918388cdb70c46d9aac
35f57047b79d747bbdeda630d80ee1709bf375a6
refs/heads/master
2023-03-10T00:31:57.845064
2021-02-16T13:33:12
2021-02-16T13:33:12
283,022,051
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package iti.team.tablia.Models; public class FollowedChef { private String chefId; public FollowedChef(String chefIdl) { this.chefId = chefId; } public FollowedChef() { } public String getChefId() { return chefId; } public void setChefId(String chefIdl) { this.chefId = chefIdl; } }
74aa049a1d65782a6b1a32017db1c5d0ff4f7d98
1a79cd25c8a881a182fd5c3896844082cbca4274
/src/java/com/gerenciaProyecto/Util/ValidadorDeCampos.java
cdf263b21ad1687e17f558da870756db59add9d2
[]
no_license
EthanAmador/GestionDeVentas
a348f70cfdf69e5b2e779bd6e79f1da88a8f64b6
dbcc3fc7de1fa91603dfcd6c752a5efae1e08a68
refs/heads/master
2021-01-10T17:11:07.149014
2015-06-04T01:44:57
2015-06-04T01:44:57
35,985,607
1
1
null
2015-05-31T20:22:23
2015-05-21T02:13:57
HTML
UTF-8
Java
false
false
2,726
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.gerenciaProyecto.Util; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * * @author Agandio */ public class ValidadorDeCampos { /** * Metodo valida el ingreso de datos * * @param valor * @param expReg Representa el patrón * * @return boolean */ public static boolean validar(String expReg, String valor) { Pattern patron = Pattern.compile(expReg); Matcher expresion = patron.matcher(valor); return expresion.matches(); } public static boolean codigoCategoria(String valor) { return validar("^[0-9][A-Z]", valor); } /** * Metodo que verifica si el dato ingresado es un número teléfonico * * @param Valor Representa el dato a comprobar * @return */ public static boolean isPhoneNumber(String Valor) { return validar("[(?\\d{1,3})?[- ]*)]*\\d{7}", Valor); } public static boolean isCelular(String valor){ return validar("^[300-321]\\d{7}", valor); } /** * Metodo que verifica si el dato ingresado es un correo electrónico * * * @param valor * @return */ public static boolean isEmail(String valor) { return validar("^[\\w-\\.]+\\@[\\w\\.-]+\\.[a-z]{2,4}$", valor); } /** * Metodo que verifica si el dato ingresado es una cadena alfanumerica * * * @param valor * @return */ public static boolean isCaracteres(String valor) { return validar("[\\wá-úÁ-Ú\\s]*", valor); } /** * Metodo que verifica si el dato ingresado es un número * * * @param valor * @return */ public static boolean isNumero(String valor) { return validar("[\\d]*", valor); } /** * Metodo que verifica si el dato ingresado es una cadena alfabetica * * * @param valor * @return */ public static boolean isAlfabetico(String valor) { return validar("[a-zA-záéíóúÁÉÍÓÚ\\s]*", valor); } public static boolean isReal(String valor) { try { Double numero = Double.parseDouble(valor); return true; } catch (NumberFormatException e) { return false; } } public static boolean isDirrecion(String valor){ return validar("[\\w\\s]*" , valor); } public static boolean isIdentificacionColombia(String valor) { return validar("^[1-9][0-9]{6,9}", valor); } }
1e8ca07b27e88c76d8c96f15c01c7cdb03b81863
c3b8f86643593fd48562117acb6cf09ce10c85f8
/ky-public-model/src/main/java/com/ky/pm/model/ResponseMsg.java
9dea2e225f7f897ffd95b8433ab4923db0bcd1c4
[]
no_license
dlxsvip/ky
05457c6d075d06958e20306bafc7681d5915ca25
e14468bf0ba0caa81c9663793e6ad1bd623260ef
refs/heads/master
2021-05-06T15:48:07.792950
2017-12-16T01:02:13
2017-12-16T01:02:13
113,654,800
0
0
null
null
null
null
UTF-8
Java
false
false
4,197
java
package com.ky.pm.model; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class ResponseMsg { public static final String SUCCESS = "success"; public static final String FAILED = "failed"; private String result; private String responseCode; private Object data; private String errorMsg; private String errorDetail; public ResponseMsg(String responseCode, String result, Object data, String errorMsg, String errorDetail) { this.responseCode = responseCode; this.result = result; this.data = data; this.errorMsg = errorMsg; this.errorDetail = errorDetail; } public ResponseMsg() { } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getResponseCode() { return responseCode; } public void setResponseCode(String responseCode) { this.responseCode = responseCode; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public String getErrorMsg() { return errorMsg; } public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } public String getErrorDetail() { return errorDetail; } public void setErrorDetail(String errorDetail) { this.errorDetail = errorDetail; } /*操作成功的返回值封装*/ public void createSuccessResponse(Object data) { this.result = SUCCESS; this.responseCode = "200"; this.data = data; this.errorMsg = ""; this.errorDetail = ""; } /*操作失败的返回值封装,其中errorMsg必填,errDetail和data大家视情况而定*/ public void createFailedResponse( Object data, String errorMsg, String errorDetail) { this.result = FAILED; this.responseCode = ""; if (null == data) { this.data =""; } else { this.data = data; } this.errorMsg = errorMsg; if(null == errorDetail) { this.errorDetail = ""; } else { this.errorDetail = errorDetail; } } /*如果pageSize和pageNum不为空,则返回结果按分页方式返回,否则返回结果不进行分页*/ public void createSuccessResponsePage(Integer pageSize, Integer pageNum, Object data, Long totalRows) { Map<String,Object> map = new HashMap<String,Object>(); this.result = SUCCESS; this.responseCode = "200"; if ((null != pageSize) && (null != pageNum) && (1 <= pageSize) && (0 <= pageNum)){ map.put("pageSize",pageSize); map.put("pageNum",pageNum); map.put("totalRows",totalRows); map.put("rows",data); } else { map.put("totalRows",totalRows); map.put("rows",data); } this.data = map; this.errorMsg = ""; this.errorDetail = ""; } /*如果pageSize和pageNum不为空,则返回结果按分页方式返回,否则返回结果不进行分页*/ public void createFailedResponsePage(Integer pageSize, Integer pageNum,String errorMsg, String errorDetail) { Map<String,Object> map = new HashMap<String,Object>(); this.result = FAILED; this.responseCode = ""; if ((null != pageSize) && (null != pageNum) && (1 <= pageSize) && (0 <= pageNum)){ map.put("pageSize",pageSize); map.put("pageNum",pageNum); map.put("totalRows",0); map.put("rows",new ArrayList<String>()); } else { map.put("totalRows",0); map.put("rows",new ArrayList<String>()); } this.data = map; if(null == errorMsg) { this.errorMsg = ""; } else { this.errorMsg = errorMsg; } if (null == errorDetail) { this.errorDetail = ""; } else { this.errorDetail = errorDetail; } } public boolean succeeded(){ return SUCCESS.equals(this.result) ; } }
ad2235034e3b1cec55e063c1a97189418d414bd0
a6e6039ab78d14b28873407c5e6cabc9ba0e51af
/PC/gen/com/fairy/mic4pc/R.java
cae39ebffd4702e1a7ab2497e154d0fae0e60905
[]
no_license
fairylrt/Mic4PC
2199de241f37a3eede5a3d84d0156f8df0300425
01605b5c7736ac36626d04f46f2ee868cb32bf28
refs/heads/master
2021-01-18T18:25:03.643293
2014-12-10T07:19:59
2014-12-10T07:19:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,974
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.fairy.mic4pc; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080006; public static final int buttonConnect=0x7f080001; public static final int buttonDisconnect=0x7f080002; public static final int buttonTurnOff=0x7f080004; public static final int buttonTurnOn=0x7f080003; public static final int devices=0x7f080005; public static final int textView1=0x7f080000; } public static final class layout { public static final int list_name=0x7f030000; public static final int main=0x7f030001; public static final int room_list=0x7f030002; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050001; public static final int app_name=0x7f050000; public static final int conncect_fail=0x7f050013; public static final int conncect_success=0x7f050012; public static final int connect_to_room=0x7f05000f; public static final int create_room=0x7f050002; public static final int emptymessage=0x7f050015; public static final int input_roomname=0x7f050005; public static final int input_username=0x7f050006; public static final int is_connecting=0x7f050011; public static final int lost_server=0x7f050010; public static final int lost_user=0x7f05000d; public static final int new_user=0x7f05000c; public static final int no_bluetooth=0x7f050004; public static final int register=0x7f050014; public static final int search_again=0x7f050009; public static final int search_room=0x7f050003; public static final int searched=0x7f050008; public static final int searching=0x7f050007; public static final int send=0x7f05000b; public static final int set_discoverable=0x7f050016; public static final int wait=0x7f05000e; public static final int yes=0x7f05000a; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
754e5ff834f220d1553ded3757ccf519c42c344e
dff12e10d4c42792920fb9e23ffa968308f53d2e
/kaka/src/main/java/com/cc/common/http/service/HttpService.java
6d49fde6a2ee4441851ede465e18c48c43ecfbc2
[]
no_license
qianjun2017/kaka
627c8bf1e7df675fb09d33ab0af085d91051d671
935539f30c622ee24e1ad5c3d1f687f2aaefd8ed
refs/heads/master
2020-05-09T06:12:49.218715
2019-04-26T03:28:09
2019-04-26T03:28:09
180,989,328
0
0
null
null
null
null
UTF-8
Java
false
false
786
java
/** * */ package com.cc.common.http.service; import java.util.Map; /** * @author Administrator * */ public interface HttpService { /** * get请求 * @param url 资源地址 * @param paramMap 请求参数 * @param encoding 编码 * @return */ String get(String url, Map<String, Object> paramMap, String encoding); /** * post请求 * @param url 资源地址 * @param paramMap 请求参数 * @param encoding 编码 * @return */ String post(String url, Map<String, Object> paramMap, String encoding); /** * post请求 * @param url 资源地址 * @param paramMap 请求参数 * @param encoding 编码 * @return */ byte[] postForBytes(String url, Map<String, Object> paramMap, String encoding); }
e7d3b7d550794f8d0dc0b7f387ad2e481a9e784d
ca142aa2c4b81c95c9f62bb026f831e6f30881d1
/LocationTest/app/src/main/java/com/test/locationtest/utils/LocationUtils.java
7a91f3f1e0c248af18a517b40d4e59b9fa043af2
[]
no_license
DavidZXY/AndroidTest
9325d28dddb2977917a0d02b1b8a649d45fba638
baf86c8788740c5b6ccca2bad5d20815c63e74e3
refs/heads/master
2021-03-31T11:12:23.609384
2020-03-25T00:38:39
2020-03-25T00:38:39
248,103,473
0
0
null
null
null
null
UTF-8
Java
false
false
15,224
java
package com.test.locationtest.utils; import android.content.Context; import android.content.Intent; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.location.LocationProvider; import android.os.Bundle; import android.provider.Settings; import android.util.Log; import androidx.annotation.RequiresPermission; import com.blankj.utilcode.util.Utils; import java.io.IOException; import java.util.List; import java.util.Locale; import static android.Manifest.permission.ACCESS_COARSE_LOCATION; import static android.Manifest.permission.ACCESS_FINE_LOCATION; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 16/11/13 * desc : 定位相关工具类 * </pre> */ public final class LocationUtils { private static final int TWO_MINUTES = 1000 * 60 * 2; private static OnLocationChangeListener mListener; private static MyLocationListener myLocationListener; private static LocationManager mLocationManager; private LocationUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } // /** // * you have to check for Location Permission before use this method // * add this code <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> to your Manifest file. // * you have also implement LocationListener and passed it to the method. // * // * @param Context // * @param LocationListener // * @return {@code Location} // */ // // @SuppressLint("MissingPermission") // public static Location getLocation(Context context, LocationListener listener) { // Location location = null; // try { // mLocationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE); // if (!isLocationEnabled()) { // //no Network and GPS providers is enabled // Toast.makeText(context // , " you have to open GPS or INTERNET" // , Toast.LENGTH_LONG) // .show(); // } else { // if (isLocationEnabled()) { // mLocationManager.requestLocationUpdates( // LocationManager.NETWORK_PROVIDER, // MIN_TIME_BETWEEN_UPDATES, // MIN_DISTANCE_CHANGE_FOR_UPDATES, // listener); // // if (mLocationManager != null) { // location = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); // if (location != null) { // mLocationManager.removeUpdates(listener); // return location; // } // } // } // //when GPS is enabled. // if (isGpsEnabled()) { // if (location == null) { // mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, // MIN_TIME_BETWEEN_UPDATES, // MIN_DISTANCE_CHANGE_FOR_UPDATES, // listener); // // if (mLocationManager != null) { // location = // mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); // if (location != null) { // mLocationManager.removeUpdates(listener); // return location; // } // } // } // } // // } // } catch (Exception e) { // e.printStackTrace(); // } // // return location; // } /** * 判断Gps是否可用 * * @return {@code true}: 是<br>{@code false}: 否 */ public static boolean isGpsEnabled() { LocationManager lm = (LocationManager) Utils.getApp().getSystemService(Context.LOCATION_SERVICE); return lm.isProviderEnabled(LocationManager.GPS_PROVIDER); } /** * 判断定位是否可用 * * @return {@code true}: 是<br>{@code false}: 否 */ public static boolean isLocationEnabled() { LocationManager lm = (LocationManager) Utils.getApp().getSystemService(Context.LOCATION_SERVICE); return lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) || lm.isProviderEnabled(LocationManager.GPS_PROVIDER); } /** * 打开Gps设置界面 */ public static void openGpsSettings() { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); Utils.getApp().startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } /** * 注册 * <p>使用完记得调用{@link #unregister()}</p> * <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET" />}</p> * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />}</p> * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />}</p> * <p>如果{@code minDistance}为0,则通过{@code minTime}来定时更新;</p> * <p>{@code minDistance}不为0,则以{@code minDistance}为准;</p> * <p>两者都为0,则随时刷新。</p> * * @param minTime 位置信息更新周期(单位:毫秒) * @param minDistance 位置变化最小距离:当位置距离变化超过此值时,将更新位置信息(单位:米) * @param listener 位置刷新的回调接口 * @return {@code true}: 初始化成功<br>{@code false}: 初始化失败 */ @RequiresPermission(ACCESS_FINE_LOCATION) public static boolean register(long minTime, long minDistance, OnLocationChangeListener listener) { if (listener == null) { return false; } mLocationManager = (LocationManager) Utils.getApp().getSystemService(Context.LOCATION_SERVICE); if (!mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) && !mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Log.d("LocationUtils", "无法定位,请打开定位服务"); return false; } mListener = listener; String provider = mLocationManager.getBestProvider(getCriteria(), true); Location location = mLocationManager.getLastKnownLocation(provider); if (location != null) { listener.getLastKnownLocation(location); } if (myLocationListener == null) { myLocationListener = new MyLocationListener(); } mLocationManager.requestLocationUpdates(provider, minTime, minDistance, myLocationListener); return true; } /** * 注销 */ @RequiresPermission(ACCESS_COARSE_LOCATION) public static void unregister() { if (mLocationManager != null) { if (myLocationListener != null) { mLocationManager.removeUpdates(myLocationListener); myLocationListener = null; } mLocationManager = null; } if (mListener != null) { mListener = null; } } /** * 设置定位参数 * * @return {@link Criteria} */ private static Criteria getCriteria() { Criteria criteria = new Criteria(); // 设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细 criteria.setAccuracy(Criteria.ACCURACY_FINE); // 设置是否要求速度 criteria.setSpeedRequired(false); // 设置是否允许运营商收费 criteria.setCostAllowed(false); // 设置是否需要方位信息 criteria.setBearingRequired(false); // 设置是否需要海拔信息 criteria.setAltitudeRequired(false); // 设置对电源的需求 criteria.setPowerRequirement(Criteria.POWER_LOW); return criteria; } /** * 根据经纬度获取地理位置 * * @param latitude 纬度 * @param longitude 经度 * @return {@link Address} */ public static Address getAddress(double latitude, double longitude) { Geocoder geocoder = new Geocoder(Utils.getApp(), Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1); if (addresses.size() > 0) { return addresses.get(0); } } catch (IOException e) { e.printStackTrace(); } return null; } /** * 根据经纬度获取所在国家 * * @param latitude 纬度 * @param longitude 经度 * @return 所在国家 */ public static String getCountryName(double latitude, double longitude) { Address address = getAddress(latitude, longitude); return address == null ? "unknown" : address.getCountryName(); } /** * 根据经纬度获取所在地 * * @param latitude 纬度 * @param longitude 经度 * @return 所在地 */ public static String getLocality(double latitude, double longitude) { Address address = getAddress(latitude, longitude); return address == null ? "unknown" : address.getLocality(); } /** * 根据经纬度获取所在街道 * * @param latitude 纬度 * @param longitude 经度 * @return 所在街道 */ public static String getStreet(double latitude, double longitude) { Address address = getAddress(latitude, longitude); return address == null ? "unknown" : address.getAddressLine(0); } /** * 是否更好的位置 * * @param newLocation The new Location that you want to evaluate * @param currentBestLocation The current Location fix, to which you want to compare the new one * @return {@code true}: 是<br>{@code false}: 否 */ public static boolean isBetterLocation(Location newLocation, Location currentBestLocation) { if (currentBestLocation == null) { // A new location is always better than no location return true; } // Check whether the new location fix is newer or older long timeDelta = newLocation.getTime() - currentBestLocation.getTime(); boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; boolean isNewer = timeDelta > 0; // If it's been more than two minutes since the current location, use the new location // because the user has likely moved if (isSignificantlyNewer) { return true; // If the new location is more than two minutes older, it must be worse } else if (isSignificantlyOlder) { return false; } // Check whether the new location fix is more or less accurate int accuracyDelta = (int) (newLocation.getAccuracy() - currentBestLocation.getAccuracy()); boolean isLessAccurate = accuracyDelta > 0; boolean isMoreAccurate = accuracyDelta < 0; boolean isSignificantlyLessAccurate = accuracyDelta > 200; // Check if the old and new location are from the same provider boolean isFromSameProvider = isSameProvider(newLocation.getProvider(), currentBestLocation.getProvider()); // Determine location quality using a combination of timeliness and accuracy if (isMoreAccurate) { return true; } else if (isNewer && !isLessAccurate) { return true; } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { return true; } return false; } /** * 是否相同的提供者 * * @param provider0 提供者1 * @param provider1 提供者2 * @return {@code true}: 是<br>{@code false}: 否 */ public static boolean isSameProvider(String provider0, String provider1) { if (provider0 == null) { return provider1 == null; } return provider0.equals(provider1); } private static class MyLocationListener implements LocationListener { /** * 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发 * * @param location 坐标 */ @Override public void onLocationChanged(Location location) { if (mListener != null) { mListener.onLocationChanged(location); } } /** * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 * * @param provider 提供者 * @param status 状态 * @param extras provider可选包 */ @Override public void onStatusChanged(String provider, int status, Bundle extras) { if (mListener != null) { mListener.onStatusChanged(provider, status, extras); } switch (status) { case LocationProvider.AVAILABLE: Log.d("LocationUtils", "当前GPS状态为可见状态"); break; case LocationProvider.OUT_OF_SERVICE: Log.d("LocationUtils", "当前GPS状态为服务区外状态"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: Log.d("LocationUtils", "当前GPS状态为暂停服务状态"); break; } } /** * provider被enable时触发此函数,比如GPS被打开 */ @Override public void onProviderEnabled(String provider) { } /** * provider被disable时触发此函数,比如GPS被关闭 */ @Override public void onProviderDisabled(String provider) { } } public interface OnLocationChangeListener { /** * 获取最后一次保留的坐标 * * @param location 坐标 */ void getLastKnownLocation(Location location); /** * 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发 * * @param location 坐标 */ void onLocationChanged(Location location); /** * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 * * @param provider 提供者 * @param status 状态 * @param extras provider可选包 */ void onStatusChanged(String provider, int status, Bundle extras);//位置状态发生改变 } }
a0346e41c35b2174cbc3647481f12d1b64cbe63e
052e76559802520026a3ab2a7a07952eb7eb3e4e
/src/main/java/com/takaichi00/sample/quarkus/integration/dto/GoogleApiItem.java
50444d7484e19f7c438319490eacf9accbde0372
[]
no_license
Takaichi00/quarkus-sample
f369698da0798618a0cb633598a91a37e88fe103
4ac6443b7555c6bcfb222078c67401d8101b11dd
refs/heads/master
2023-07-20T03:33:16.746325
2022-05-06T05:11:02
2022-05-06T05:11:02
193,797,334
0
0
null
2023-07-07T21:47:46
2019-06-25T23:35:56
Java
UTF-8
Java
false
false
531
java
package com.takaichi00.sample.quarkus.integration.dto; import io.quarkus.runtime.annotations.RegisterForReflection; import java.io.Serializable; import javax.json.bind.annotation.JsonbProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Data @RegisterForReflection public class GoogleApiItem implements Serializable { private static final long serialVersionUID = 1L; @JsonbProperty(value = "volumeInfo") private VolumeInfo volumeInfo; }
2295b6cacc8f8c132dfdb53d1912a8cd2bf35717
9bc4a0e83088842fb83592756bc89853f2553da0
/src/main/java/cn/joylau/echarts/series/other/RippleEffect.java
8cd5cc0d3307b839ea46e12515570468e8390f4d
[ "MIT" ]
permissive
JoyLau/joylau-echarts
de077cefe819da35adb8eed7a84aca0989112315
80f66015dd2e9ca73c235e1aa6105a9e64da2557
refs/heads/master
2021-01-22T19:03:38.711296
2017-04-18T01:54:01
2017-04-18T01:54:01
85,150,079
1
2
null
null
null
null
UTF-8
Java
false
false
1,731
java
/******************************************************************************* * Copyright (c) 2017 by JoyLau. All rights reserved ******************************************************************************/ package cn.joylau.echarts.series.other; import cn.joylau.echarts.code.BrushType; import java.io.Serializable; /** * 涟漪特效相关配置 * * @author JoyLau */ public class RippleEffect implements Serializable { private static final long serialVersionUID = 1L; /** * 动画的时间 */ private Integer period; /** * 动画中波纹的最大缩放比例 */ private Double scale; /** * 波纹的填充方式,可选 'stroke' 和 'fill' */ private BrushType brushType; public Integer period() { return this.period; } public RippleEffect period(Integer period) { this.period = period; return this; } public Double scale() { return this.scale; } public RippleEffect scale(Double scale) { this.scale = scale; return this; } public BrushType brushType() { return this.brushType; } public RippleEffect brushType(BrushType brushType) { this.brushType = brushType; return this; } public Integer getPeriod() { return period; } public void setPeriod(Integer period) { this.period = period; } public Double getScale() { return scale; } public void setScale(Double scale) { this.scale = scale; } public BrushType getBrushType() { return brushType; } public void setBrushType(BrushType brushType) { this.brushType = brushType; } }
4e9d96a643a6044dfeb9782f09a9f57a32f3b789
cbb555403663705af08afe44322a92b477cbaedd
/MyProject_MVC2/src/jsp/board/action/BoardUpdateAction.java
7153d160ee61530128b7e6dea4d744eb761d50b6
[]
no_license
TaeBong-Yoon/MyProject_MVC2
7b31b8c6bf1df9f2499f405bd2d0dc30fbfe9b1a
6992a019887ab49195accd9172aa36e7c57c78ac
refs/heads/master
2022-11-16T23:44:56.736549
2020-07-07T05:16:49
2020-07-07T05:16:49
271,677,654
0
0
null
null
null
null
UTF-8
Java
false
false
2,551
java
package jsp.board.action; import java.util.Enumeration; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.oreilly.servlet.MultipartRequest; import com.oreilly.servlet.multipart.DefaultFileRenamePolicy; import jsp.board.model.BoardBean; import jsp.board.model.BoardDAO; import jsp.common.action.Action; import jsp.common.action.ActionForward; public class BoardUpdateAction implements Action { @Override public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception { ActionForward forward = new ActionForward(); // 답글 작성 후 원래 페이지로 돌아가기 위해 페이지 번호가 필요하다. String pageNum = request.getParameter("page"); // 업로드 파일 사이즈 int fileSize = 5 * 1024 * 1024; // 업로드될 폴더 절대경로 String uploadPath = request.getServletContext().getRealPath("/UploadFolder"); try { MultipartRequest multi = new MultipartRequest(request, uploadPath, fileSize, "euc-kr", new DefaultFileRenamePolicy()); // 파리미터 값을 가져온다. int num = Integer.parseInt(multi.getParameter("board_num")); // 글 번호 String subject = multi.getParameter("board_subject"); // 글 제목 String content = multi.getParameter("board_content"); // 글 내용 String existFile = multi.getParameter("existing_file"); // 기존 첨부 파일 // 파라미터 값을 자바빈에 세팅한다. BoardBean border = new BoardBean(); border.setBoard_num(num); border.setBoard_subject(subject); border.setBoard_content(content); // 글 수정 시 업로드된 파일 가져오기 Enumeration<String> fileNames = multi.getFileNames(); if (fileNames.hasMoreElements()) { String fileName = fileNames.nextElement(); String updateFile = multi.getFilesystemName(fileName); if (updateFile == null) // 수정시 새로운 파일을 첨부 안했다면 기존 파일명을 세팅 border.setBoard_file(existFile); else // 새로운 파일을 첨부했을 경우 border.setBoard_file(updateFile); } BoardDAO dao = new BoardDAO(); boolean result = dao.updateBoard(border); if (result) { forward.setRedirect(true); // 원래있던 페이지로 돌아가기 위해 페이지번호를 전달한다. forward.setNextPath("BoardListAction.bo?page=" + pageNum); } } catch (Exception e) { e.printStackTrace(); System.out.println("글 수정 오류 : " + e.getMessage()); } return forward; } }
5b6f409a7ea553fa9a8965492f7166176eb1cb21
cd51785a5e5a04aca510d0495bc16509e88a648d
/app/src/androidTest/java/com/example/robin/translatetestproject/ExampleInstrumentedTest.java
eaf6a2f5184c69a4ff3231b1cdfe01cc1cc726ae
[]
no_license
Robinm91/translateAPI
22e1434db032dde825730caf618fbaf5a9d1a0ea
d8876b781465ac40f512b290554608428a85a443
refs/heads/master
2020-03-18T06:24:09.676588
2018-05-22T09:40:01
2018-05-22T09:40:01
134,393,188
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.example.robin.translatetestproject; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.robin.translatetestproject", appContext.getPackageName()); } }
683db60a3ac4dc65f53e554343dfa84b1bece510
43c3914bd96fd060373009fb4113381c062ae39f
/Walmartqa1/test/com/cloudbees/walmartqa1/dao/ItemDAOTest.java
799c9e8871fcf0545775bafe730febf8ef4937cb
[]
no_license
weinmang/walmartqa1
919e4993027faa71c8896d8fd5981ed543842c98
9f1992d55efb3500b0b8bdfe1b08a02de6e445b2
refs/heads/master
2021-01-13T16:10:55.965242
2013-06-03T15:19:07
2013-06-03T15:19:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
package com.cloudbees.walmartqa1.dao; import java.util.Map; import org.testng.Assert; import org.testng.annotations.Test; import com.cloudbees.walmartqa1.dao.ItemDAO; import com.cloudbees.walmartqa1.dto.Item; import com.cloudbees.walmartqa1.exception.ApiException; import com.cloudbees.walmartqa1.provider.CsvDataProvider; public class ItemDAOTest { @Test(dataProvider = "csvReader", dataProviderClass = CsvDataProvider.class, expectedExceptions=ApiException.class) public void findByIdTest(Map<String,String> parms) throws ApiException { String itemId = parms.get("itemId"); ItemDAO dao = new ItemDAO(); Assert.assertNotNull(dao, "Could not instantiate data access object"); Item item = dao.findById(itemId); Assert.assertNotNull(item, "Item Not Found"); Assert.assertEquals(item.getItemId(), itemId, "Returned item inconsistant with search"); } @Test(dataProvider = "csvReader", dataProviderClass = CsvDataProvider.class, expectedExceptions=ApiException.class) public void createItemTest(Map<String,String> parms) throws ApiException { String itemId = parms.get("itemId"); String itemDescr = parms.get("itemDescr"); String itemPriceStr = parms.get("itemPrice"); Double itemPrice = Double.valueOf(itemPriceStr); String localeId = parms.get("localeId"); Item item = new Item(); item.setItemId(itemId); item.setItemDescr(itemDescr); item.setItemPrice(itemPrice); item.setLocaleId(localeId); ItemDAO dao = new ItemDAO(); Item newItem = dao.createItem(item); Assert.assertNotNull(newItem, "Item creation failure"); Assert.assertEquals(newItem.getItemId(), itemId, "Item creation failure"); } }
3e10f2c78089a3544aa1f6c7eac895405da17f1d
e0e2f67ecfd572969ea88c1832fed340ccfd1977
/job4j/Chapter_001/src/test/java/conditionTest/MaxTest.java
1623b589f9bc2a6943bd096d2dbea9cd4ea00770
[]
no_license
EkaterinaKibis/aero
c00f9aabf24b2eb3633968d448482e1f2ba45491
5f2c70eff65ded4fb9efab68489df6884bbeea80
refs/heads/master
2022-07-05T22:34:00.007600
2020-05-19T05:25:54
2020-05-19T05:25:54
265,152,306
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package conditionTest; import org.junit.Test; import ru.kibis.dataTypes.condition.Max; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; public class MaxTest { @Test public void whenMax1To2Then2() { int result; result = Max.max(1, 2); assertThat(result, is(2)); } }
297d0e09869cae5d1b8faa17c222090fc087239f
91682c22fa06d64b6fff5008e86260297f28ce0b
/mobile-runescape-client/src/main/java/class212.java
63b74262ec8a8e3352a7255ccc47749f5f5b9779
[ "BSD-2-Clause" ]
permissive
morscape/mors-desktop
a32b441b08605bd4cd16604dc3d1bc0b9da62ec9
230174cdfd2e409816c7699756f1a98e89c908d9
refs/heads/master
2023-02-06T15:35:04.524188
2020-12-27T22:00:22
2020-12-27T22:00:22
324,747,526
0
0
null
null
null
null
UTF-8
Java
false
false
2,658
java
/* * Decompiled with CFR 0.150. * * Could not load the following classes: * net.runelite.mapping.Export * net.runelite.mapping.ObfuscatedName * net.runelite.mapping.ObfuscatedSignature */ import net.runelite.mapping.Export; import net.runelite.mapping.ObfuscatedName; import net.runelite.mapping.ObfuscatedSignature; @ObfuscatedName(value="no") public class class212 { @ObfuscatedName(value="am") @ObfuscatedSignature(descriptor="Lei;") static IndexedSprite field3988; @ObfuscatedName(value="ar") @Export(value="Sprite_drawTransparent") static void Sprite_drawTransparent(int[] arrn, int[] arrn2, int n, int n2, int n3, int n4, int n5, int n6, int n7, int n8) { n8 = -(n4 >> 2); int n9 = -(n4 & 3); n4 = -n5; while (true) { if (n4 < 0) { n = n3; } else { return; } for (n3 = n8; n3 < 0; ++n3) { n5 = n2 + 1; int n10 = arrn2[n2]; if (n10 != 0) { n2 = n + 1; arrn[n] = n10; n = n2; } else { ++n; } n10 = n5 + 1; n5 = arrn2[n5]; if (n5 != 0) { n2 = n + 1; arrn[n] = n5; n = n2; } else { ++n; } n5 = n10 + 1; n10 = arrn2[n10]; if (n10 != 0) { n2 = n + 1; arrn[n] = n10; n = n2; } else { ++n; } n2 = n5 + 1; n5 = arrn2[n5]; if (n5 != 0) { arrn[n] = n5; ++n; continue; } ++n; } n3 = n9; while (n3 < 0) { n5 = arrn2[n2]; if (n5 != 0) { arrn[n] = n5; ++n; } else { ++n; } ++n3; ++n2; } ++n4; n3 = n + n6; n2 += n7; } } @ObfuscatedName(value="ar") @ObfuscatedSignature(descriptor="(Ljava/lang/CharSequence;B)Ljava/lang/String;", garbageValue="1") public static String method6894(CharSequence charSequence) { charSequence = Rasterizer3D.method614('*', charSequence.length(), -441697438); return charSequence; } }
40b0df75f3180fbe54b1600c45e0595b2aa86204
8b50464274784d93b7b474b9907b3b8982771f8c
/app/src/main/java/com/android/samiha/commitproject/MainActivity.java
8cb1dd54692af709711bc047e8b1602fea9df1b6
[]
no_license
Samiha23/NewProject
0b42298c095ce885e60ffbed1c041cf321690625
37a0bd096a931fc29739fbb027e18c47cd415e6f
refs/heads/master
2021-07-10T22:53:54.984642
2017-10-12T09:30:27
2017-10-12T09:30:27
106,670,917
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.android.samiha.commitproject; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
19f640948399f966830ebcb93d47be65fdabe0ab
e8f171ddb3c8fb54fcecaff0a84648e76681f982
/community/logicaldoc/tags/logicaldoc-7.5.3/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/StandardPropertiesPanel.java
67675d9141dad82cc0754d56259f4c3fe49604f8
[]
no_license
zhunengfei/logicaldoc
f12114ef72935e683af4b50f30a88fbd5df9bfde
9d432d29a9b43ebd2b13a1933a50add3f4784815
refs/heads/master
2021-01-20T01:05:48.499693
2017-01-13T16:24:16
2017-01-13T16:24:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,615
java
package com.logicaldoc.gui.frontend.client.document; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.logicaldoc.gui.common.client.DocumentObserver; import com.logicaldoc.gui.common.client.Feature; import com.logicaldoc.gui.common.client.Session; import com.logicaldoc.gui.common.client.beans.GUIDocument; import com.logicaldoc.gui.common.client.beans.GUIRating; import com.logicaldoc.gui.common.client.data.TagsDS; import com.logicaldoc.gui.common.client.i18n.I18N; import com.logicaldoc.gui.common.client.log.Log; import com.logicaldoc.gui.common.client.util.ItemFactory; import com.logicaldoc.gui.common.client.util.Util; import com.logicaldoc.gui.common.client.widgets.PreviewTile; import com.logicaldoc.gui.frontend.client.services.DocumentService; import com.logicaldoc.gui.frontend.client.services.DocumentServiceAsync; import com.smartgwt.client.data.Record; import com.smartgwt.client.types.TitleOrientation; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.ValuesManager; import com.smartgwt.client.widgets.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.FormItemIcon; import com.smartgwt.client.widgets.form.fields.LinkItem; import com.smartgwt.client.widgets.form.fields.MultiComboBoxItem; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.StaticTextItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.form.fields.events.IconClickEvent; import com.smartgwt.client.widgets.form.fields.events.IconClickHandler; import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent; import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.Layout; import com.smartgwt.client.widgets.layout.VLayout; /** * Shows document's standard properties and read-only data * * @author Marco Meschieri - Logical Objects * @since 6.0 */ public class StandardPropertiesPanel extends DocumentDetailTab { private static final int DEFAULT_ITEM_WIDTH = 250; private DocumentServiceAsync documentService = (DocumentServiceAsync) GWT.create(DocumentService.class); private DynamicForm form1 = new DynamicForm(); private DynamicForm form2 = new DynamicForm(); private VLayout container = new VLayout(); private HLayout columns = new HLayout(); private ValuesManager vm = new ValuesManager(); protected DocumentObserver observer; protected MultiComboBoxItem tagItem = null; private Layout tile = new HLayout(); public StandardPropertiesPanel(final GUIDocument document, ChangedHandler changedHandler, DocumentObserver observer) { super(document, changedHandler, null); this.observer = observer; setWidth100(); setHeight100(); container.setWidth100(); container.setMembersMargin(5); addMember(container); columns.setWidth100(); columns.setMembersMargin(10); container.setMembers(columns); refresh(); } private void refresh() { vm.clearErrors(false); if (form1 != null) form1.destroy(); if (tile != null) tile.destroy(); if (columns.contains(form1)) columns.removeMember(form1); if (columns.contains(tile)) columns.removeChild(tile); form1 = new DynamicForm(); form1.setNumCols(2); form1.setValuesManager(vm); form1.setTitleOrientation(TitleOrientation.LEFT); form1.setWidth(DEFAULT_ITEM_WIDTH); StaticTextItem id = ItemFactory.newStaticTextItem("id", "id", Long.toString(document.getId())); if (!Long.toString(document.getId()).equals(document.getCustomId())) { id.setTooltip(Long.toString(document.getId()) + " (" + document.getCustomId() + ")"); id.setValue(Util.padLeft(Long.toString(document.getId()) + " (" + document.getCustomId() + ")", 35)); } if (document.getDocRef() != null) id.setTooltip(I18N.message("thisisalias") + ": " + document.getDocRef()); StaticTextItem creation = ItemFactory.newStaticTextItem( "creation", "createdon", Util.padLeft( I18N.formatDate((Date) document.getCreation()) + " " + I18N.message("by") + " " + document.getCreator(), 40)); creation.setTooltip(I18N.formatDate((Date) document.getCreation()) + " " + I18N.message("by") + " " + document.getCreator()); StaticTextItem published = ItemFactory.newStaticTextItem( "date", "publishedon", Util.padLeft( I18N.formatDate((Date) document.getDate()) + " " + I18N.message("by") + " " + document.getPublisher(), 40)); published.setTooltip(I18N.formatDate((Date) document.getDate()) + " " + I18N.message("by") + " " + document.getPublisher()); StaticTextItem size = ItemFactory.newStaticTextItem( "size", "size", Util.formatSizeW7(document.getFileSize().doubleValue()) + " (" + Util.formatSizeBytes(document.getFileSize()) + ")"); TextItem title = ItemFactory.newTextItem("title", "title", document.getTitle()); title.addChangedHandler(changedHandler); title.setRequired(true); title.setWidth(DEFAULT_ITEM_WIDTH); title.setDisabled(!updateEnabled || !document.getFolder().isRename()); StaticTextItem filename = ItemFactory.newStaticTextItem("fileName", "file", Util.padLeft(document.getFileName(), 39)); filename.setWrap(false); filename.setWidth(DEFAULT_ITEM_WIDTH); filename.setTooltip(document.getFileName()); StaticTextItem wfStatus = ItemFactory.newStaticTextItem("wfStatus", "workflowstatus", document.getWorkflowStatus()); StaticTextItem version = ItemFactory.newStaticTextItem("version", "fileversion", document.getFileVersion() + " (" + document.getVersion() + ")"); version.setValue(version.getValue()); String comment = document.getComment(); if (comment != null && !"".equals(comment)) version.setTooltip(comment); LinkItem folder = ItemFactory.newLinkItem("folder", Util.padLeft(document.getPathExtended(), 40)); folder.setTitle(I18N.message("folder")); folder.setValue(Util.displaydURL(null, document.getFolder().getId())); folder.setTooltip(document.getPathExtended()); folder.setWrap(false); folder.setWidth(DEFAULT_ITEM_WIDTH); String downloadUrl = Util.downloadURL(document.getDocRef()!=null ? document.getDocRef() : document.getId()); String displayUrl = Util.displaydURL(document.getDocRef()!=null ? document.getDocRef() : document.getId(), null); String perma = "<a href='" + downloadUrl + "'>" + I18N.message("download") + "</a> | " + "<a href='" + displayUrl + "'>" + I18N.message("details") + "</a>"; StaticTextItem permaLink = ItemFactory.newStaticTextItem("permalink", "permalink", perma); if (Feature.enabled(Feature.WORKFLOW)) form1.setItems(id, title, filename, folder, size, version, wfStatus, creation, published, permaLink); else form1.setItems(id, title, filename, folder, size, version, creation, published, permaLink); columns.addMember(form1); /* * Prepare the second form for the tags */ prepareRightForm(); /* * Prepare the tile */ if (document.getId() != 0L) { tile = new PreviewTile(document.getId(), document.getTitle()); columns.addMember(tile); } } private void prepareRightForm() { if (columns.contains(form2)) { columns.removeMember(form2); form2.destroy(); } form2 = new DynamicForm(); form2.setValuesManager(vm); List<FormItem> items = new ArrayList<FormItem>(); FormItemIcon ratingIcon = ItemFactory.newItemIcon("rating" + document.getRating() + ".png"); StaticTextItem vote = ItemFactory.newStaticTextItem("vote", "vote", ""); vote.setIcons(ratingIcon); vote.setIconWidth(88); if (updateEnabled) vote.addIconClickHandler(new IconClickHandler() { public void onIconClick(IconClickEvent event) { documentService.getRating(document.getId(), new AsyncCallback<GUIRating>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUIRating rating) { if (rating != null) { RatingDialog dialog = new RatingDialog(document.getRating(), rating, observer); dialog.show(); } } }); } }); items.add(vote); vote.setDisabled(!updateEnabled); SelectItem language = ItemFactory.newLanguageSelector("language", false, false); language.addChangedHandler(changedHandler); language.setDisabled(!updateEnabled); language.setValue(document.getLanguage()); items.add(language); if (Feature.enabled(Feature.TAGS)) { String mode = Session.get().getConfig("tag.mode"); final TagsDS ds = new TagsDS(null, true, document.getId()); tagItem = ItemFactory.newTagsComboBoxItem("tag", "tag", ds, (Object[]) document.getTags()); tagItem.setDisabled(!updateEnabled); tagItem.addChangedHandler(changedHandler); final TextItem newTagItem = ItemFactory.newTextItem("newtag", "newtag", null); newTagItem.setRequired(false); newTagItem.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (newTagItem.validate() && newTagItem.getValue() != null && event.getKeyName() != null && "enter".equals(event.getKeyName().toLowerCase())) { String input = newTagItem.getValueAsString().trim(); newTagItem.clearValue(); if (!"".equals(input)) { String[] tokens = input.split("\\,"); int min = Integer.parseInt(Session.get().getConfig("tag.minsize")); int max = Integer.parseInt(Session.get().getConfig("tag.maxsize")); boolean containsInvalid = false; List<String> tags = new ArrayList<String>(); for (String token : tokens) { String t = token.trim(); if (t.length() < min || t.length() > max) { containsInvalid = true; continue; } tags.add(t); // Add the old tags to the new ones String[] oldVal = tagItem.getValues(); for (int i = 0; i < oldVal.length; i++) if (!tags.contains(oldVal[i])) tags.add(oldVal[i]); // Put the new tag in the options Record record = new Record(); record.setAttribute("index", t); record.setAttribute("word", t); ds.addData(record); } // Update the tag item and trigger the change tagItem.setValues((Object[]) tags.toArray(new String[0])); changedHandler.onChanged(null); if (containsInvalid) SC.warn(I18N.message("sometagaddedbecauseinvalid")); } } } }); items.add(tagItem); if ("free".equals(mode) && updateEnabled) items.add(newTagItem); } form2.setItems(items.toArray(new FormItem[0])); columns.addMember(form2); } @SuppressWarnings("unchecked") public boolean validate() { Map<String, Object> values = (Map<String, Object>) vm.getValues(); vm.validate(); if (!vm.hasErrors()) { document.setTitle((String) values.get("title")); document.setLanguage((String) values.get("language")); document.setTags(tagItem.getValues()); } return !vm.hasErrors(); } }
[ "car031@bae09422-6297-422f-b3ee-419521344c47" ]
car031@bae09422-6297-422f-b3ee-419521344c47
c43bc3aa2c30a55db9f3772467ecbb2fe5b67a2b
ffab40b1b5e12bc84707f38e10599ed749a154e2
/src/cn/calify/services/OperationDAOServices.java
e4d14742b458749d60f8a4b4ff922607685296d9
[]
no_license
calify/BeautifulGirlFileManage
a2c2cb3a3d72a3778f76f49f1bf2cc4239360ceb
2dbf10d90479fa52d8cdbd30886b1e1155df0252
refs/heads/master
2020-05-04T02:48:46.198793
2015-08-08T10:28:31
2015-08-08T10:28:31
40,037,602
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package cn.calify.services; import java.util.List; import cn.calify.beans.Page; import cn.calify.beans.TemplateJson; public interface OperationDAOServices { public List doQueryALL(); public Object doQueryById(int id); public TemplateJson doQueryByBean(Object o,Page page);//组合查询 public boolean doAddByBean(Object o); public boolean doDelById(int id); public boolean doUpdata(Object o); }