blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
d2fd0e99c7c8a73756a277ed54f99f80392b00ff
Java
lixingdeyongyuan/NetUtils
/netutilslib/src/main/java/com/aixue/netutilslib/http/api/CommonApi.java
UTF-8
794
1.953125
2
[]
no_license
package com.aixue.netutilslib.http.api; import java.util.Map; import io.reactivex.Observable; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.HeaderMap; import retrofit2.http.POST; import retrofit2.http.QueryMap; import retrofit2.http.Url; /** * 请求通用的API * 添加其他请求类型 */ public interface CommonApi { @GET Observable<ResponseBody> get(@Url String url); @GET Observable<ResponseBody> get(@Url String url, @QueryMap Map<String, String> options); @POST Observable<ResponseBody> post(@Url String url, @Body RequestBody body); @POST Observable<ResponseBody> post(@Url String url, @Body RequestBody body, @HeaderMap Map<String, String> headers); }
true
80fcab287d823a2ecf5cca801a494aff83faa4b2
Java
EloyMB/ironhack-midterm-project
/src/main/java/com/ironhack/bankingsystem/model/account/StudentCheckingAccount.java
UTF-8
1,079
2.5
2
[]
no_license
package com.ironhack.bankingsystem.model.account; import com.ironhack.bankingsystem.model.Money; import com.ironhack.bankingsystem.model.account.enums.Type; import com.ironhack.bankingsystem.model.user.impl.Owner; import javax.persistence.*; import java.math.BigDecimal; @Entity //@Table(name = "student_checking_account") @PrimaryKeyJoinColumn(name = "id") public class StudentCheckingAccount extends CheckingAccount { // Student Checking Accounts are identical to Checking Accounts except that they do NOT have: // // A monthlyMaintenanceFee // A minimumBalance public StudentCheckingAccount() { setMonthlyMaintenanceFee(new Money(BigDecimal.ZERO)); setMinimumBalance(new Money(BigDecimal.ZERO)); this.setType(Type.STUDENT_CHECKING); } public StudentCheckingAccount(Owner owner, Money balance, String secretKey) { super(owner, balance, secretKey); setMonthlyMaintenanceFee(new Money(BigDecimal.ZERO)); setMinimumBalance(new Money(BigDecimal.ZERO)); this.setType(Type.STUDENT_CHECKING); } }
true
3cde0fd747caef9e49eb4953815cc04e2390ff11
Java
livarb/move-service-registry
/serviceregistry-server/src/main/java/no/difi/meldingsutveksling/serviceregistry/service/ks/FiksAdresseClient.java
UTF-8
1,990
2.078125
2
[]
no_license
package no.difi.meldingsutveksling.serviceregistry.service.ks; import net.logstash.logback.marker.Markers; import org.apache.http.client.utils.URIBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import java.lang.invoke.MethodHandles; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.OK; public class FiksAdresseClient { private RestTemplate restTemplate; private URL url; private Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass().getName()); public FiksAdresseClient(RestTemplate restTemplate, URL url) { this.restTemplate = restTemplate; this.url = url; } public FiksAdressing getFiksAdressing(String identifier) { final URI orgUrl; final ResponseEntity<FiksAdressing> entity; try { URIBuilder builder; builder = new URIBuilder(url.toString()); orgUrl = builder.setPath(url.getPath() + "/organization/" + identifier).build().normalize(); } catch (URISyntaxException e) { throw new FiksAdresseServiceException("URL to MOVE FIKS adresse service is malformed", e); } try { entity = restTemplate.getForEntity(orgUrl, FiksAdressing.class); } catch (HttpClientErrorException e) { if (NOT_FOUND != e.getStatusCode()) { logger.error(Markers.append("receiver", identifier), "Failed to lookup in FIKS adresse service", e); } return FiksAdressing.EMPTY; } return entity.getStatusCode() == OK ? entity.getBody() : FiksAdressing.EMPTY; } public RestTemplate getRestTemplate() { return restTemplate; } }
true
ee89ccfffc72d74e81e1034baa0cb82e8043a501
Java
danilowilliam87/api-navita
/src/main/java/com/navita/test/desafioApiNavita/service/MarcaRn.java
UTF-8
608
1.789063
2
[]
no_license
package com.navita.test.desafioApiNavita.service; import com.navita.test.desafioApiNavita.dto.MarcaDTO; import com.navita.test.desafioApiNavita.dto.PatrimonioDTO; import com.navita.test.desafioApiNavita.model.Marca; import com.navita.test.desafioApiNavita.model.Patrimonio; import java.util.List; import java.util.Optional; public interface MarcaRn { public Marca save(Marca marca); public Optional<Marca>findById(Long id); public Optional<Marca>findByNome(String nome); public boolean update(Marca marca, Long id); public boolean delete(Long id); public List<Marca>findAll(); }
true
9d56a4f3ed5e63b647593623d8441c40e04e8084
Java
wildfly/maven-plugins
/quickstart-documentation-plugin/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/drupal/CodingResourceGenerator.java
UTF-8
3,191
2.3125
2
[ "Apache-2.0" ]
permissive
package org.wildfly.maven.plugins.quickstart.documentation.drupal; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Path; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import org.apache.maven.plugin.logging.Log; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.wildfly.maven.plugins.quickstart.documentation.MetaData; import org.wildfly.maven.plugins.quickstart.documentation.drupal.json.hal.CodingResource; import org.wildfly.maven.plugins.quickstart.documentation.drupal.json.hal.Product; import org.wildfly.maven.plugins.quickstart.documentation.drupal.json.hal.Tag; /** * @author Jason Porter <jporter@redhat.com> * Copyright 2017 Red Hat, Inc. and/or its affiliates. */ public class CodingResourceGenerator { private Log log; private DrupalCommunication drupalCommunication; public CodingResourceGenerator(DrupalCommunication drupalCommunication, Log log) { this.log = log; this.drupalCommunication = drupalCommunication; } public CodingResource createResource(Path codingResourceDir, String resourceType) { try { final MetaData metaData = MetaData.parseReadme(codingResourceDir); final Optional<Product> targetProduct = drupalCommunication.getProducts().stream().filter(product -> product.getShortName().equals(metaData.getTargetProduct())).findFirst(); String path = null; path = targetProduct .map(product -> "/" + resourceType + "s/" + product.getMachineName() + "/" + codingResourceDir.getFileName()) .orElseGet(() -> "/" + resourceType + "s/" + codingResourceDir.getFileName()); // Pull the body HTML InputStream file = new FileInputStream(codingResourceDir.resolve("README.html").toFile()); Document doc = Jsoup.parse(file, "UTF-8", ""); //Elements docContent = doc.select("h1 ~ *:not(p:first-of-type)"); Element docContent = doc.getElementById("content"); String body = docContent.html(); final CodingResource newResource = new CodingResource(path, metaData.getName(), body); newResource.addAuthor(metaData.getAuthor()); newResource.addDescription(metaData.getSummary()); newResource.addResourceType(resourceType); newResource.addLevel(metaData.getLevel()); Arrays.stream(metaData.getTechnologies()).map(String::trim).forEach(newResource::addTechnologies); newResource.addSourceLink(metaData.getSource(), ""); targetProduct.ifPresent(newResource::addRelatedProduct); final List<Tag> tags = drupalCommunication.getTags().stream().filter(tag -> Arrays.asList(metaData.getTechnologies()).contains(tag.getName())).collect(Collectors.toList()); tags.forEach(newResource::addTag); return newResource; } catch (IOException e) { this.log.error(e); } return null; // I don't like returning null, but probably about as good as I can do } }
true
4584bda73653e2dc6d028ea5e36351c783243cb0
Java
lizhijun81/myrpc
/myrpc-core/src/main/java/com/myrpc/rpc/netty/NettyInstanceFatory.java
UTF-8
2,021
2.515625
3
[]
no_license
package com.myrpc.rpc.netty; import com.myrpc.extension.RpcComponent; import com.myrpc.exception.MyRpcRpcException; import com.myrpc.rpc.InstanceFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @RpcComponent(name = "netty") public class NettyInstanceFatory implements InstanceFactory { private final static Logger logger = LoggerFactory.getLogger(NettyInstanceFatory.class); private Map<String, Object> instances = new HashMap<String, Object>(); private Map<String, Map<String, Method>> methodMap = new HashMap<String, Map<String, Method>>(); @Override public void setInstance(String infName, Object obj) { instances.put(infName, obj); } @Override public Object getInstance(String infName) throws MyRpcRpcException { Object obj = instances.get(infName); return obj; } public Method getMethod(String infName, String methodName) { Map<String, Method> map = this.methodMap.get(infName); if (map != null) { return map.get(methodName); } else { synchronized (this) { try { Object obj = instances.get(infName); Method[] infMethods = Class.forName(infName).getMethods(); Map<String, Method> methodMap = new HashMap<String, Method>(); for (Method infmth : infMethods) { Method m = obj.getClass().getMethod(infmth.getName(), infmth.getParameterTypes()); String _methodName = m.getName(); if (methodMap.containsKey(_methodName)) { logger.error("Duplicated method " + _methodName + " found in " + obj.getClass().getName()); } else { methodMap.put(m.getName(), m); } } this.methodMap.put(infName, methodMap); return map.get(methodName); } catch (NoSuchMethodException e1) { throw new MyRpcRpcException(e1.getMessage(), e1); } catch (ClassNotFoundException e) { throw new MyRpcRpcException(e.getMessage(), e); } } } } }
true
23d913b23911aa0afb56d8374fd2cca525001bdd
Java
praneethdodedu/KafkaExamples
/news-aggregator-app-producer/src/main/java/com/aggregator/news/client/NewsAggregator.java
UTF-8
2,184
2.640625
3
[]
no_license
package com.aggregator.news.client; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import com.aggregator.news.client.model.News; import com.aggregator.news.client.model.NewsApiResponse; import com.aggregator.news.producer.NewsProducer; @Component public class NewsAggregator { @Value("${news.api.url}") public String NEWS_API_URL; @Autowired private RestTemplate restTemplate; @Autowired private NewsProducer newsProducer; public void sendNewsToTopic() { try { for (int pageNumber = 1; pageNumber <= 1000; pageNumber++) { System.out.println(NEWS_API_URL + pageNumber); List<News> newsList = getAllNews(pageNumber); newsList.forEach(news -> { newsProducer.send(news); }); } } catch (Exception exception) { System.out.println("exception:::::::::::: " + exception); } } public List<News> getAllNews(int pageNumber) throws Exception { NewsApiResponse newsApiResponse = restTemplate.getForObject(NEWS_API_URL + pageNumber, NewsApiResponse.class); List<News> newsList = new LinkedList<News>(); newsApiResponse.getArticles().forEach(article -> { try { News news = new News(article.getSource().getId(), article.getSource().getName(), article.getAuthor(), article.getTitle(), article.getDescription(), article.getUrl(), article.getUrlToImage(), parseDate(article.getPublishedAt())); newsList.add(news); } catch (Exception exception) { System.out.println(exception); } }); return newsList; } public Date parseDate(String dateInString) throws Exception { try { if (dateInString != null) { dateInString = dateInString.replaceAll("T", "-").replaceAll("Z", ""); return new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss").parse(dateInString); } return null; } catch (ParseException exception) { throw new Exception("Error while parsing date", exception); } } }
true
b5bfef57b931533ec619761d4e9183d789940e42
Java
Angel777d/ChartApplication
/app/src/main/java/ru/angelovich/chartapplication/drawer/Bounds.java
UTF-8
178
2.125
2
[]
no_license
package ru.angelovich.chartapplication.drawer; class Bounds { float leftEdge = 0; float rightEdge = 1; float delta() { return rightEdge - leftEdge; } }
true
ba7ad79a6e334cd4d0658059fe18150b5296377c
Java
xhhqyh/Demo
/2-Java/3-Java/Test/src/Demo/MePhone.java
GB18030
460
2.6875
3
[]
no_license
package Demo; public class MePhone extends Telphone implements IPlayGame{ @Override public void call() { // TODO Auto-generated method stub System.out.println("绰"); } @Override public void message() { // TODO Auto-generated method stub System.out.println(""); } @Override public void playGame() { // TODO Auto-generated method stub System.out.println("ֻϷĹ"); } }
true
fedbd4ea5dc1a4c16f46d4b1d079b0420198ff13
Java
72worthyTh/Bus-payment
/app/src/main/java/ism/com/worthyth/beep/interfaces/EditorView.java
UTF-8
209
1.679688
2
[]
no_license
package ism.com.worthyth.beep.interfaces; public interface EditorView { void showProgress(); void hideProgress(); void onRequestSuccess(String messege); void onRequestError(String messege); }
true
1eb99d51f44102b51799d09f6091f81459dd4194
Java
Alexanderser/WanAndroid
/app/src/main/java/com/foxconn/lau/wanandroid/module/base/BaseAdapter.java
UTF-8
3,310
2.125
2
[]
no_license
package com.foxconn.lau.wanandroid.module.base; import android.annotation.SuppressLint; import android.content.Context; import android.view.View; import com.foxconn.lau.dialog.recyclerview.LauRecyclerAdapter; import com.foxconn.lau.dialog.recyclerview.LauRecyclerViewHolder; import com.foxconn.lau.dialog.recyclerview.ViewConfig; import com.foxconn.lau.wanandroid.R; import com.foxconn.lau.wanandroid.bean.main.Article; import com.foxconn.lau.wanandroid.module.main.contract.MainContract; import com.foxconn.lau.wanandroid.utils.LogUtils; import com.sackcentury.shinebuttonlib.ShineButton; import java.util.List; /** * @author 劉帥 * @version 1.0 * @des ${TODO} * @date 2019/12/5 下午 02:16 */ public class BaseAdapter extends LauRecyclerAdapter<Article> { private List<Article> mList; private MainContract.ItemClickCallback callback ; public BaseAdapter(Context mContext, List<Article> mList, MainContract.ItemClickCallback callback) { this(mContext,mList,R.layout.layout_article_item); this.callback = callback; } public BaseAdapter(Context mContext, List<Article> mList) { this(mContext,mList,R.layout.layout_article_item); } private BaseAdapter(Context mContext, List<Article> mList, int layoutId) { super(mContext, mList, layoutId); this.mList = mList; } @SuppressLint("SetTextI18n") // @Override public void bindData(LauRecyclerViewHolder viewHolder, int i) { LogUtils.s(i); String niceDate = mList.get(i).getNiceDate(); String superChapterName = mList.get(i).getSuperChapterName(); viewHolder.setText(R.id.article_item_author_name, mList.get(i).getAuthor()) .setText(R.id.article_item_chapter_name,superChapterName+"/" +mList.get(i).getChapterName()) .setText(R.id.article_item_title,mList.get(i).getTitle()) .setText(R.id.article_item_time,niceDate); String descriptionImgUrl = mList.get(i).getEnvelopePic(); if (!"".equals(descriptionImgUrl) && descriptionImgUrl != null) { viewHolder.setVisible(R.id.article_item_img_description, View.VISIBLE); viewHolder.setImageUrl(R.id.article_item_img_description, descriptionImgUrl); } else { viewHolder.setVisible(R.id.article_item_img_description, View.GONE); } if (niceDate.contains("小时")) { viewHolder.setVisible(R.id.article_item_new, View.VISIBLE); }else { viewHolder.setVisible(R.id.article_item_new, View.GONE); } if (superChapterName.contains("项目")) { viewHolder.setVisible(R.id.article_item_project_description, View.VISIBLE); } else { viewHolder.setVisible(R.id.article_item_project_description, View.GONE); } ShineButton shineButton = viewHolder.getView(R.id.article_item_like_img); shineButton.setOnCheckStateChangeListener((view, checked) -> { if (callback != null) { callback.likeChange(view,i,checked); } }); } public List<Article> getRecentAticleList(){ return mList; } public void addHeadView(View view){ super.addHeaderView(new ViewConfig(view, false)); } }
true
bba73318f698218ff486f3b1f4b52af188c6ec30
Java
Sherry280/java-code
/20210101剑指offer/src/day30/TestDay30.java
UTF-8
829
3.609375
4
[]
no_license
package day30; import java.util.Scanner; public class TestDay30 { /** * 奇偶校验 * 输入:每一个字符判断其二进制位的每一位是奇还是偶 */ public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String s=sc.nextLine(); char[] c=s.toCharArray(); for(char ch:c){ String s1=Integer.toBinaryString(ch);//转为二进制形式 String s2=String.format("%07d",Integer.parseInt(s1)); int count=0; for(int i=0;i<7;i++){ if(s2.charAt(i)=='1'){ count++; } } System.out.println(count%2==0?"1"+s2:"0"+s2); } } } }
true
1b2f8920a04cf7a0df1b0e698f5a755229b3a64f
Java
sahajs/MyFiles
/src/com/trupt/myfiles/persist/SaveToFileThread.java
UTF-8
952
2.828125
3
[]
no_license
package com.trupt.myfiles.persist; import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutputStream; import android.content.Context; public class SaveToFileThread extends Thread { private Context context; private String fileName; private Object object; public SaveToFileThread(Context context, String fileName, Object object) { super(); this.context = context; this.fileName = fileName; this.object = object; } @Override public void run() { FileOutputStream fOut = null; ObjectOutputStream oOut = null; try { File file = new File(context.getFilesDir(), fileName); fOut = new FileOutputStream(file); oOut = new ObjectOutputStream(fOut); oOut.writeObject(object); } catch(Exception e) { e.printStackTrace(); } if(fOut != null) { try { fOut.close(); } catch (Exception e) { } } if(oOut != null) { try { oOut.close(); } catch (Exception e) { } } } }
true
7ec66faff790c34d8f47aee8bc90cbcba179c4e8
Java
def-demo/Weavon1495098673033
/src/main/java/com/ford/fleet/models/AltiGeography.java
UTF-8
2,556
2.171875
2
[]
no_license
package com.ford.fleet.models; import java.util.Date; import java.util.Objects; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.FetchType; import javax.persistence.JoinColumn; @Entity public class AltiGeography { @Id private Integer id = null; private String geography = null; private String updateduser = null; private Date updatedtimestamp = null; /** * {"primaryKey":true} **/ public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } /** * {} **/ public String getGeography() { return geography; } public void setGeography(String geography) { this.geography = geography; } /** * {} **/ public String getUpdateduser() { return updateduser; } public void setUpdateduser(String updateduser) { this.updateduser = updateduser; } /** * {} **/ public Date getUpdatedtimestamp() { return updatedtimestamp; } public void setUpdatedtimestamp(Date updatedtimestamp) { this.updatedtimestamp = updatedtimestamp; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AltiGeography altiGeography = (AltiGeography) o; return Objects.equals(id, altiGeography.id) && Objects.equals(geography, altiGeography.geography) && Objects.equals(updateduser, altiGeography.updateduser) && Objects.equals(updatedtimestamp, altiGeography.updatedtimestamp); } @Override public int hashCode() { return Objects.hash(id, geography, updateduser, updatedtimestamp); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AltiGeography {\n"); sb.append(" id: ").append(id).append("\n"); sb.append(" geography: ").append(geography).append("\n"); sb.append(" updateduser: ").append(updateduser).append("\n"); sb.append(" updatedtimestamp: ").append(updatedtimestamp).append("\n"); sb.append("}\n"); return sb.toString(); } }
true
f13d9031dc5f457366149787ec06a9b4125634db
Java
y971140/ewt
/src/main/java/im/zhaojun/system/service/ProviderService.java
UTF-8
520
1.726563
2
[]
no_license
package im.zhaojun.system.service; import im.zhaojun.system.model.Provider; import org.springframework.stereotype.Service; import java.util.List; @Service public interface ProviderService { List<Provider> selectAllProvider(int page, int limit, Provider provider); String add(Provider provider); int disableProviderByID(Long id); int enableProviderByID(Long id); int deleteProvider(Integer id); int deleteAllProvider(Long[] id); void updateItem(Provider provider); Provider selectOne(Integer id); }
true
3e26a4e388c1bdc8cf49913a0381440cfaa1dbcc
Java
DylanHooch/Pisces
/app/src/main/java/scut218/pisces/network/ProtoCodecFactory.java
UTF-8
627
1.929688
2
[]
no_license
package scut218.pisces.network; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolEncoder; public class ProtoCodecFactory implements ProtocolCodecFactory{ // private static final Charset charset = Charset.forName("UTF-8"); public ProtocolDecoder getDecoder(IoSession session) throws Exception { return new CumulativeDecoder(); } public ProtocolEncoder getEncoder(IoSession session) throws Exception { return new ProtoBufEncoder(); } }
true
7c0470296bf022241215a186cedbdfa2d2a06b50
Java
tfisher1226/ARIES
/aries/common/common-data/src/main/java/org/aries/common/entity/PhoneNumberEntity.java
UTF-8
2,186
2.25
2
[ "Apache-2.0" ]
permissive
package org.aries.common.entity; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.aries.common.Country; import org.aries.common.PhoneLocation; import org.hibernate.annotations.Cache; @Entity(name = "PhoneNumber") @Table(name = "phone_number") @Cache(usage = READ_WRITE) public class PhoneNumberEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "area", nullable = false) private String area; @Column(name = "number", nullable = false) private String number; @Column(name = "extension") private String extension; @Column(name = "country", nullable = false) @Enumerated(EnumType.STRING) private Country country; @Column(name = "type", nullable = false) @Enumerated(EnumType.STRING) private PhoneLocation type; @Column(name = "value") private String value; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getArea() { return area; } public void setArea(String area) { this.area = area; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getExtension() { return extension; } public void setExtension(String extension) { this.extension = extension; } public Country getCountry() { return country; } public void setCountry(Country country) { this.country = country; } public PhoneLocation getType() { return type; } public void setType(PhoneLocation type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public String toString() { if (getId() != null) return getClass().getSimpleName()+"["+getId()+"]"; return super.toString(); } }
true
3f0152b3e668029474bb9f5673c3016c4244ff82
Java
mpi2/impc-production-tracker
/impc_prod_tracker/core/src/main/java/org/gentar/biology/plan/attempt/breeding/BreedingTypeRepository.java
UTF-8
198
1.539063
2
[ "Apache-2.0" ]
permissive
package org.gentar.biology.plan.attempt.breeding; import org.springframework.data.repository.CrudRepository; public interface BreedingTypeRepository extends CrudRepository<BreedingType, Long> { }
true
31a2c9e645b492ef18b3a18eb5037206d16e3e7d
Java
RedHatQE/polarize
/src/main/java/com/github/redhatqe/polarize/metadata/Param.java
UTF-8
473
1.796875
2
[ "Apache-2.0" ]
permissive
package com.github.redhatqe.polarize.metadata; import java.lang.annotation.Repeatable; import java.lang.annotation.Target; /** * This class is used to fill in information for com.github.redhatqe.polarize.importer.testcase.Parameter * It can only be used as an inner annotation type (it can't decorate any other method, annotation, class, etc). */ @Repeatable(Params.class) @Target({}) public @interface Param { String name(); String scope() default "local"; }
true
f326a98f833aa01467ecda74884a18a05b4e346d
Java
wind-clothes/IDWorker
/src/main/java/com/hunk/idworker/config/NettyConfig.java
UTF-8
2,458
2.4375
2
[ "Apache-2.0" ]
permissive
package com.hunk.idworker.config; import com.hunk.idworker.util.Constants; /** * <pre> * </pre> * * @author: xiongchengwei * @date: 2016年3月28日 下午12:09:09 */ public class NettyConfig { /** * 默认端口 */ private final static int DEFAULT_PORT = 80; private final static int DEFAULT_NETTY_BACKLOG = 1024; private final static int DEFAULT_NETTY_WORKER_NEVENTLOOPS_AVAILABLEPROCESSORS_MULTIPLE = 2; private final static int DEFAULT_NETTY_BOSS_NEVENTLOOPS_AVAILABLEPROCESSORS_MULTIPLE = 2; private final int port; private final int backlog; private final int workerEventLoopsAvailableProcessorsMultiple; private final int bossEventLoopsAvailableProcessorsMultiple; public NettyConfig() { String portStr = PropertiesUtil.getValue(Constants.NETTY_SERVER_PORT); port = (portStr == null || "".equals(portStr)) ? DEFAULT_PORT : Integer.valueOf(portStr); String backlogStr = PropertiesUtil.getValue(Constants.NETTY_BACKLOG); backlog = (backlogStr == null || "".equals(backlogStr)) ? DEFAULT_NETTY_BACKLOG : Integer.valueOf(backlogStr); String workerEventLoopsAvailableProcessorsMultipleStr = PropertiesUtil.getValue(Constants.NETTY_WORKER_NEVENTLOOPS_AVAILABLEPROCESSORS_MULTIPLE); workerEventLoopsAvailableProcessorsMultiple = (workerEventLoopsAvailableProcessorsMultipleStr == null || "".equals(workerEventLoopsAvailableProcessorsMultipleStr)) ? DEFAULT_NETTY_WORKER_NEVENTLOOPS_AVAILABLEPROCESSORS_MULTIPLE : Integer.valueOf(workerEventLoopsAvailableProcessorsMultipleStr); String bossEventLoopsAvailableProcessorsMultipleStr = PropertiesUtil.getValue(Constants.NETTY_BOSS_NEVENTLOOPS_AVAILABLEPROCESSORS_MULTIPLE); bossEventLoopsAvailableProcessorsMultiple = (bossEventLoopsAvailableProcessorsMultipleStr == null || "".equals(bossEventLoopsAvailableProcessorsMultipleStr)) ? DEFAULT_NETTY_BOSS_NEVENTLOOPS_AVAILABLEPROCESSORS_MULTIPLE : Integer.valueOf(bossEventLoopsAvailableProcessorsMultipleStr); } public int getPort() { return port; } public int getBacklog() { return backlog; } public int getWorkerEventLoopsAvailableProcessorsMultiple() { return workerEventLoopsAvailableProcessorsMultiple; } public int getBossEventLoopsAvailableProcessorsMultiple() { return bossEventLoopsAvailableProcessorsMultiple; } }
true
e53765d153cdf7b03a56aad2cf866aaf07e9f8ac
Java
zehranuralkan/JavaLesson4Hw1
/Interfaces1/src/CostumerDal.java
UTF-8
50
1.601563
2
[]
no_license
public interface CostumerDal { void add(); }
true
414669bc61bcee6d5533da9c05d40f1c3def66f8
Java
RyanCccc/LeetCode
/src/algorithm/Path_Sum.java
UTF-8
780
2.921875
3
[]
no_license
package algorithm; import util.TreeNode; import program.*; public class Path_Sum implements Testable{ public boolean hasPathSum(TreeNode root, int sum) { if(root==null) return false; return hasPathSumHelper(root,sum,0); } public boolean hasPathSumHelper(TreeNode node, int sum, int cur_sum){ if(node==null) return false; cur_sum += node.val; if(node.left==null && node.right==null){ // if(cur_sum == sum) // System.out.println("return when node val = " + node.val); return cur_sum==sum; } return hasPathSumHelper(node.left, sum, cur_sum) || hasPathSumHelper(node.right, sum, cur_sum); } @Override public boolean test(Object[] args, Object res) { // TODO Auto-generated method stub return hasPathSum((TreeNode)args[0],(Integer)res); } }
true
9c9135bd895b724e6b2f5d51a7e5cb1a4e24b9dc
Java
DeanLXY/apt-dggbinder
/dggcompiler/src/main/java/com/example/ProxyClass.java
UTF-8
1,057
2.421875
2
[]
no_license
package com.example; import java.util.ArrayList; import java.util.List; import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; /** * @Author: xujie.wang * @Email: xujie.wang@17zuoye.com * @Date: 2017/5/12 * @Project: DggBind */ public class ProxyClass { private TypeElement typeElement; private Elements elementUtils; public List<ViewBindingModel> viewBindingModels; public ProxyClass(TypeElement parentElement, Elements elementUtils) { this.typeElement = parentElement; this.elementUtils = elementUtils; this.viewBindingModels = new ArrayList<>(); } public void addViewBindingModel(ViewBindingModel viewBindingModel){ if (viewBindingModel != null) { viewBindingModels.add(viewBindingModel); } } public TypeElement getTypeElement() { return typeElement; } public Elements getElementUtils() { return elementUtils; } public List<ViewBindingModel> getViewBindingModels() { return viewBindingModels; } }
true
11820f7c9b45e4c706f12710837389a34f18314b
Java
bushixiaofan/template-archetype
/target/test-classes/projects/basic/project/basic/src/main/java/it/pkg/service/impl/HelloWorldServiceImpl.java
UTF-8
304
2.265625
2
[]
no_license
package it.pkg.service.impl; import it.pkg.service.HelloWorldService; public class HelloWorldServiceImpl implements HelloWorldService { @Override public String SayHelloWorld() { System.out.println("Hello World~"); return "执行业务方法的返回值为:Hello World"; } }
true
2b1f0ad61c79af0ba2a1740081edb04bd4f9e191
Java
Sainase/MonkeyAndroid
/app/src/main/java/com/sunjiajia/monkeyandroid/mustlearn/databinding/bean/User.java
UTF-8
2,162
2.21875
2
[]
no_license
/* * * * * * * * * * * =================================== * * * * Copyright (c) 2016. * * * * 作者:安卓猴 * * * * 微博:@安卓猴 * * * * 博客:http://sunjiajia.com * * * * Github:https://github.com/opengit * * * * * * * * 注意**:如果您使用或者修改该代码,请务必保留此版权信息。 * * * * =================================== * * * * * * * * * */ package com.sunjiajia.monkeyandroid.mustlearn.databinding.bean; import android.databinding.BaseObservable; import android.databinding.Bindable; import com.android.databinding.library.baseAdapters.BR; /** * Created by monkey on 16-7-14. */ public class User extends BaseObservable { private String username; private String password; private int age; private String email; private boolean vip; public User(String username, String password, int age, String email, boolean vip) { this.username = username; this.password = password; this.age = age; this.email = email; this.vip = vip; } @Bindable public String getUsername() { return username; } public void setUsername(String username) { this.username = username; notifyPropertyChanged(BR.username); } @Bindable public String getPassword() { return password; } public void setPassword(String password) { this.password = password; notifyPropertyChanged(BR.password); } @Bindable public int getAge() { return age; } public void setAge(int age) { this.age = age; notifyPropertyChanged(BR.age); } @Bindable public String getEmail() { return email; } public void setEmail(String email) { this.email = email; notifyPropertyChanged(BR.email); } @Bindable public boolean isVip() { return vip; } public void setVip(boolean vip) { this.vip = vip; notifyPropertyChanged(BR.vip); } @Override public String toString() { return "User{" + "username='" + username + '\'' + ", password='" + password + '\'' + ", age=" + age + ", email='" + email + '\'' + ", vip=" + vip + '}'; } }
true
f1aa8a74a0db9192f6293ebbb24e86df389aef1a
Java
thiagoalvesec/curso-java-basico
/src/com/loiane/cursojava/aula24/labs/Exercicio04.java
UTF-8
2,277
2.84375
3
[]
no_license
/* * 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.loiane.cursojava.aula24.labs; import java.util.Date; /** * * @author thiago */ public class Exercicio04 { public static void main(String[] args){ LivroDeBiblioteca agencia = new LivroDeBiblioteca(); agencia.titulo = "Agência de investigações holísticas"; agencia.autor = "Douglas Adams"; agencia.editora = "Arqueiro"; agencia.tamanho = "Pequeno"; agencia.numPaginas = 240; agencia.emprestado = false; agencia.reservado = true; agencia.dataEntrega = new Date(); LivroDeBiblioteca GOT = new LivroDeBiblioteca(); GOT.titulo = "A dança dos dragões"; GOT.autor = "George R. R. Martin"; GOT.editora = "LeYa"; GOT.tamanho = "Grande"; GOT.numPaginas = 1377; GOT.emprestado = true; GOT.emprestadoA = "João"; GOT.reservado = true; GOT.dataEntrega = new Date(); System.out.println("Título: " + agencia.titulo); System.out.println("Autor: " + agencia.autor); System.out.println("Editora: " + agencia.editora); System.out.println("Tamanho: " + agencia.tamanho); System.out.println("Páginas: " + agencia.numPaginas); System.out.println("Emprestado: " + agencia.emprestado); System.out.println("Reservado: " + agencia.reservado); System.out.println("Data de entrega: " + agencia.dataEntrega); System.out.println(); System.out.println("Título: " + GOT.titulo); System.out.println("Autor: " + GOT.autor); System.out.println("Editora: " + GOT.editora); System.out.println("Tamanho: " + GOT.tamanho); System.out.println("Páginas: " + GOT.numPaginas); System.out.println("Emprestado: " + GOT.emprestado); System.out.println("EmprestadoA " + GOT.emprestadoA); System.out.println("Reservado: " + GOT.reservado); System.out.println("Data de entrega: " + GOT.dataEntrega); } }
true
9383194a12f0c89c575ed2e5825b3af06abe8ad3
Java
cowwoc/requirements.java
/test/src/test/java/com/github/cowwoc/requirements/test/java/internal/terminal/TerminalTest.java
UTF-8
1,716
2.265625
2
[ "Apache-2.0", "EPL-1.0", "Classpath-exception-2.0", "LGPL-2.1-or-later", "CDDL-1.0", "MIT", "GPL-2.0-only", "LicenseRef-scancode-public-domain" ]
permissive
/* * Copyright (c) 2016 Gili Tzabari * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 */ package com.github.cowwoc.requirements.test.java.internal.terminal; import com.github.cowwoc.requirements.java.internal.scope.DefaultJvmScope; import com.github.cowwoc.requirements.java.internal.scope.JvmScope; import com.github.cowwoc.requirements.java.internal.terminal.Terminal; import com.github.cowwoc.requirements.natives.internal.terminal.NativeTerminal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; import java.io.IOException; import static com.github.cowwoc.requirements.natives.terminal.TerminalEncoding.NONE; import static com.github.cowwoc.requirements.natives.terminal.TerminalEncoding.RGB_888_COLORS; public final class TerminalTest { /** * Ensures that none of the native methods fail. * * @throws IOException if an operation fails */ @Test @SuppressWarnings("try") public void nativeMethods() throws IOException { try (JvmScope ignored = DefaultJvmScope.INSTANCE) { NativeTerminal terminal = new NativeTerminal(); terminal.connect(); terminal.isConnectedToStdout(); terminal.setEncoding(NONE); terminal.disconnect(); } } /** * Force verifiers to output using an encoding that might not be supported by the terminal. */ @Test public void forceUnsupportedEncoding() { try (DefaultJvmScope jvm = DefaultJvmScope.INSTANCE) { Terminal terminal = jvm.getTerminal(); Logger log = LoggerFactory.getLogger(TerminalTest.class); log.debug("*** The following exception is expected and does not denote a test failure ***"); terminal.setEncoding(RGB_888_COLORS); } } }
true
8a2c6f0c018e3cc1cd3137e7f2cc7382afc23890
Java
huyuanbin5/tms
/src/main/java/com/wh/tms/entity/po/WorkToolsMaintenance.java
UTF-8
7,097
2.046875
2
[]
no_license
package com.wh.tms.entity.po; import java.io.Serializable; import java.util.Date; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * 机具维修 * @ClassName: WorkToolsMaintenance * @Description: TODO * @author Huqk * @date 2018年5月2日 下午9:46:59 */ @Table(name = "t_work_tools_maintenance") public class WorkToolsMaintenance implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY,generator="JDBC") private Integer id; /** * 机具id */ private Integer toolsId; /** * 机具编码 */ private String toolsCode; /** * 机具管理类别id */ private Integer managerCategoryId; /** * 机具管理类别名称 */ private String managerCategoryName; /** * 机具种类id */ private Integer categoryId; /** * 机具种类编号 */ private String categoryNumber; /** * 机具种类名称 */ private String categoryName; /** * 借用人id */ private Integer borrowerUid; /** * 借用人员名称 */ private String borrowerName; /** * 维修人uid */ private Integer mUid; /** * 维修人名称 */ private String mUname; /** * 验收人uid */ private Integer checkUid; /** * 验收人名称 */ private String checkUsername; /** * 维修类别id */ private Integer sCategoryId; /** * 维修类别名称 */ private String sCategoryName; /** * 维修内容id */ private Integer sConId; /** * 维修内容 */ private String sCon; /** * 维修策略id */ private Integer mPolicyId; /** * 维修策略 */ private String mPolicyName; /** * 验收内容id */ private Integer aConId; /** * 验收内容 */ private String aCon; /** * 验收评价id */ private Integer aAssessId; /** * 验收评价 */ private String aAssess; /** * 维修状态标识,0:待处理,1:维修完毕入库,-1:建议报废 */ private Integer status; /** * 入库时间 */ private Date insertTime; /** * 计划日期 */ private Date planDate; /** * 实际维修时间 */ private Date mTime; /** * 验收时间 */ private Date aTime; private static final long serialVersionUID = 1L; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getToolsId() { return toolsId; } public void setToolsId(Integer toolsId) { this.toolsId = toolsId; } public String getToolsCode() { return toolsCode; } public void setToolsCode(String toolsCode) { this.toolsCode = toolsCode; } public Integer getCategoryId() { return categoryId; } public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } public String getCategoryNumber() { return categoryNumber; } public void setCategoryNumber(String categoryNumber) { this.categoryNumber = categoryNumber; } public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public Integer getBorrowerUid() { return borrowerUid; } public void setBorrowerUid(Integer borrowerUid) { this.borrowerUid = borrowerUid; } public String getBorrowerName() { return borrowerName; } public void setBorrowerName(String borrowerName) { this.borrowerName = borrowerName; } public Integer getCheckUid() { return checkUid; } public void setCheckUid(Integer checkUid) { this.checkUid = checkUid; } public String getCheckUsername() { return checkUsername; } public void setCheckUsername(String checkUsername) { this.checkUsername = checkUsername; } public Integer getsCategoryId() { return sCategoryId; } public void setsCategoryId(Integer sCategoryId) { this.sCategoryId = sCategoryId; } public String getsCategoryName() { return sCategoryName; } public void setsCategoryName(String sCategoryName) { this.sCategoryName = sCategoryName; } public Integer getsConId() { return sConId; } public void setsConId(Integer sConId) { this.sConId = sConId; } public String getsCon() { return sCon; } public void setsCon(String sCon) { this.sCon = sCon; } public Integer getmPolicyId() { return mPolicyId; } public void setmPolicyId(Integer mPolicyId) { this.mPolicyId = mPolicyId; } public String getmPolicyName() { return mPolicyName; } public void setmPolicyName(String mPolicyName) { this.mPolicyName = mPolicyName; } public Integer getaConId() { return aConId; } public void setaConId(Integer aConId) { this.aConId = aConId; } public String getaCon() { return aCon; } public void setaCon(String aCon) { this.aCon = aCon; } public Integer getaAssessId() { return aAssessId; } public void setaAssessId(Integer aAssessId) { this.aAssessId = aAssessId; } public String getaAssess() { return aAssess; } public void setaAssess(String aAssess) { this.aAssess = aAssess; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Date getInsertTime() { return insertTime; } public void setInsertTime(Date insertTime) { this.insertTime = insertTime; } public Date getPlanDate() { return planDate; } public void setPlanDate(Date planDate) { this.planDate = planDate; } public Date getmTime() { return mTime; } public void setmTime(Date mTime) { this.mTime = mTime; } public Date getaTime() { return aTime; } public void setaTime(Date aTime) { this.aTime = aTime; } public Integer getManagerCategoryId() { return managerCategoryId; } public void setManagerCategoryId(Integer managerCategoryId) { this.managerCategoryId = managerCategoryId; } public String getManagerCategoryName() { return managerCategoryName; } public void setManagerCategoryName(String managerCategoryName) { this.managerCategoryName = managerCategoryName; } public Integer getmUid() { return mUid; } public void setmUid(Integer mUid) { this.mUid = mUid; } public String getmUname() { return mUname; } public void setmUname(String mUname) { this.mUname = mUname; } }
true
b76cd0125b49c44421455114b24c6bbb17d9b82e
Java
Smart-Gates/capstone-spring-boot-server
/src/main/java/smartgate/capstonespringboot/models/Organization.java
UTF-8
1,359
2.09375
2
[]
no_license
package smartgate.capstonespringboot.models; import lombok.Data; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.validation.constraints.NotBlank; import org.hibernate.annotations.NaturalId; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) @Entity @Data @Table(name = "organization") public class Organization { private @Id @GeneratedValue Long id; @NaturalId @NotBlank private String name; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "acct_mngr_id", nullable = false) private User acct_mngr; @NotBlank private String street_address; @NotBlank private String zip; @NotBlank private String city; @NotBlank private String province_state; @NotBlank private String country; Organization() { } public Organization(String name, User user, String street_address, String zip, String city, String province_state, String country) { this.name = name; this.acct_mngr = user; this.street_address = street_address; this.zip = zip; this.city = city; this.province_state = province_state; this.country = country; } }
true
00307a8813070664f6e7d3e3570bc2f90c16785b
Java
CEYeYuan/Data-Structure-Algorithm
/cc150/9.3magicIndex.java
UTF-8
579
3.578125
4
[]
no_license
/*A magic index in an array A[0...n-1] is defined to be an index such that A[i]=i. Given a sorted array, write a method to find a magic index, if one exists, in array A. Follow up What if the values are not distinct */ class test{ public static void printIndex(int[] arr,int start){ if (start>=arr.length/*|| if duplicates are not allowed arr[start]>start*/) return; else{ if (arr[start]==start) System.out.println(start); printIndex(arr,start+1); } } public static void main (String[] args){ int[] arr=new int[]{-3,1,2,4,4}; printIndex(arr,0); } }
true
befbb3e6bd59a3ff0f8a34fd8a3e53b209f6c119
Java
smcclain56/semanticCache
/Java/VLC_QueryMain.java
UTF-8
4,821
2.359375
2
[]
no_license
package bcf; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.HashMap; import java.io.BufferedReader; import java.util.ArrayList; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.StringTokenizer; import bcf.common.ActiveBitCollection; import bcf.common.PLWAHActiveBitCol; import bcf.common.VALActiveBitCollection; import bcf.common.VLCActiveBitCol; import bcf.query.CompressedBitmapReader; import bcf.query.PLWAHAndQuery; import bcf.query.PLWAHCompressedReader; import bcf.query.VALAndQuery; import bcf.query.VALCompressedReader; import bcf.query.VLCAndQuery; import bcf.query.VLCCompressedReader; public class VLC_QueryMain { public static void main(String[] args) { try { // Total time to address all queries double totalTime = 0.0; // the query engine VLCAndQuery queryEng = new VLCAndQuery(); ////////////////////////////////////////////////////////////////////////////////////////////////////////// //THERE MUST BE SOME STATIC THINGS THAT THE JVM DOESN'T INITIALIZE UNTIL QUERY IS CALLED //WITHOUT THIS START UP RUN THE QUERY TIMES TAKE A BIG INITIAL HIT ActiveBitCollection delme = new VLCActiveBitCol(28,"-9"); delme.appendLiteral(35); queryEng.AndQuery(delme,delme); /////////////////////////////////////////////////////////////////////////////////////////////////////// // map that will hold all the read in query columns might get too // big HashMap<String, ActiveBitCollection> alreadyLoaded = new HashMap<String, ActiveBitCollection>(); // create object used to read compressed bitmap files CompressedBitmapReader cbr = new VLCCompressedReader(); // Set up some variables String qhf, query, output; // Open a reader to the query files qhf = "C:\\Jason\\Research\\Bitmap\\TestDataSet\\test1Query.txt"; FileReader qfr = new FileReader(qhf); BufferedReader qbr = new BufferedReader(qfr); // Get the first line query file query = qbr.readLine(); while (query != null && !query.equals("")) { // Split the query by the comma's in the file StringTokenizer strtoken = new StringTokenizer(query, ","); // This nextToken is to read the queryID strtoken.nextToken(); // Find the column id of the first column to be queried. int value = Integer.parseInt((strtoken.nextToken()).trim()); // Start a new tokenizer strtoken = new StringTokenizer(query, ","); // Get the queryid String queryid = strtoken.nextToken(); // Set an array for the 4 columns to be read in. String[] qs = new String[4]; // Get the number of tokens int toke = strtoken.countTokens(); // Grab each token and stick it in our array. for (int i = 0; i < toke; i++) { qs[i] = strtoken.nextToken(); } // Single point query if (qs[0].equals(qs[1])) { // Take two columns and AND them together. // Start timer if (!alreadyLoaded.containsKey(qs[0])) { File inf = new File( "C:\\Jason\\Research\\Bitmap\\TestDataSet\\Compressed\\test3_col_" + qs[0] + ".dat"); FileInputStream file_input = new FileInputStream(inf); DataInputStream data_in = new DataInputStream( file_input); // The cbr.readColumn reads the data in the file and // returns an ActiveBit collection ActiveBitCollection a = cbr.readColumn(data_in); alreadyLoaded.put(qs[0], a); } if (!alreadyLoaded.containsKey(qs[2]) && !qs[0].equals(qs[2])) { File inf = new File( "C:\\Jason\\Research\\Bitmap\\TestDataSet\\Compressed\\test3_col_" + qs[2] + ".dat"); FileInputStream file_input = new FileInputStream(inf); DataInputStream data_in = new DataInputStream( file_input); // The cbr.readColumn reads the data in the file and // returns an ActiveBit collection ActiveBitCollection a = cbr.readColumn(data_in); alreadyLoaded.put(qs[2], a); } ActiveBitCollection ans =null; long start = System.nanoTime(); if (!qs[0].equals(qs[2])) { ans = queryEng.AndQuery(alreadyLoaded .get(qs[0]), alreadyLoaded.get(qs[2])); }else{ ans= alreadyLoaded.get(qs[0]); } totalTime += (System.nanoTime() - start) / 1000000.0; System.out.println("Result of "+alreadyLoaded.get(qs[0])+" AND "+alreadyLoaded.get(qs[2])+" : "+ans); System.out.println("\tTotal time thus far = "+totalTime); } query = qbr.readLine(); } } catch (Exception e) { e.printStackTrace(); } } }
true
24f99cc80701e9ef9a7cbe7d8dfd5df6ad0b42f2
Java
OnabanjoTitus/SpringBootE_Note
/Entry.java
UTF-8
335
2.0625
2
[]
no_license
package com.notePad.notepad.Model; import com.fasterxml.jackson.annotation.JsonProperty; public class Entry { private final String EntryBody; public Entry(@JsonProperty("EntryBody") String entryBody) { EntryBody = entryBody; } public String getEntryBody() { return EntryBody; } }
true
231df788de433151260eff7d5c49d6c1359e9c4e
Java
BenHilderman/Assignment-5
/Maze.java
UTF-8
5,372
3.421875
3
[]
no_license
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; import java.util.concurrent.TimeUnit; import java.nio.file.Files; import java.nio.file.StandardCopyOption; /** * Class Maze. * @author BenHilderman * @version 1.0 * @since 2020-05-25 */ public class Maze { // Variables private String outputFilename; static Scanner scanner = new Scanner(System.in); private char[][] mazeSelected; private int columnStart, rowStart; private int rows, columns; public static void main(String[] args) throws IOException{ // Ask user which maze they want to complete System.out.println("What maze do you want the bot to complete? (1 , 2 , 3)"); int choice = scanner.nextInt(); if (choice == 1) { // Copies original maze to seperate file to be completed File maze1Unfinished = new File("maze1Unfinished.txt"); File Maze = new File("maze1.txt"); Files.copy(maze1Unfinished.toPath(), Maze.toPath(), StandardCopyOption.REPLACE_EXISTING); try { new Maze("maze1.txt"); System.out.println("File has been output!"); } catch (Exception e) { System.out.println("ERROR : "+e.getMessage()); e.printStackTrace(); } } if (choice == 2) { // Copies original maze to seperate file to be completed File maze2Unfinished = new File("maze2Unfinished.txt"); File Maze = new File("maze2.txt"); Files.copy(maze2Unfinished.toPath(), Maze.toPath(), StandardCopyOption.REPLACE_EXISTING); try { new Maze("maze2.txt"); System.out.println("File has been output!"); } catch (Exception e) { System.out.println("ERROR : "+e.getMessage()); e.printStackTrace(); } } if (choice == 3) { // Copies original maze to seperate file to be completed File maze3Unfinished = new File("maze3Unfinished.txt"); File Maze = new File("maze3.txt"); Files.copy(maze3Unfinished.toPath(), Maze.toPath(), StandardCopyOption.REPLACE_EXISTING); try { new Maze("maze3.txt"); System.out.println("File has been output!"); } catch (Exception e) { System.out.println("ERROR : "+e.getMessage()); e.printStackTrace(); } } // If user doesn't input 1, 2 or 3 if (choice != 1 && choice != 2 && choice != 3) { System.out.println("Invalid input, you mush enter one of the options."); } } public boolean complete(int row, int column) { // North, South, East, West directions with recursion char goNorth = this.mazeSelected[row - 1][column]; char goEast = this.mazeSelected[row][column + 1]; char goSouth = this.mazeSelected[row + 1][column]; char goWest = this.mazeSelected[row][column - 1]; if (goNorth == 'G' || goSouth == 'G' || goEast == 'G' || goWest == 'G') { // When bot completes maze this.mazeSelected[row][column] = '+'; this.printMaze(); return true; } // Recursion to choose direction boolean completed = false; if (this.mazeSelected[row][column] != 'S') { this.mazeSelected[row][column] = '+'; } // Bot checks north if it is open if (goNorth == '.' && !completed) { // x - 1 moves up completed = complete(row - 1, column); } if (goEast == '.' && !completed) { // y + 1 moves up completed = complete(row, column + 1); } if (goSouth == '.' && !completed) { // x + 1 moves up completed = complete(row + 1, column); } if (goWest == '.' && !completed) { // y - 1 moves up completed = complete(row, column - 1); } if (!completed) { // If it is not completed this.mazeSelected[row][column] = '.'; } try { // 1 second break to show bot process Thread.sleep(1000); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } this.printMaze(); return completed; } public Maze(String filename) throws IOException { try { this.outputFilename = filename; Scanner scan = new Scanner(new File(filename)); StringBuilder sb = new StringBuilder(); while (scan.hasNext()) { sb.append(scan.nextLine()); this.rows++; } this.columns = sb.length() / this.rows; this.mazeSelected = new char[this.rows][this.columns]; int a = 0; System.out.println(); for (int i = 0; i < this.rows; i++) { for (int j = 0; j < this.columns; j++) { this.mazeSelected[i][j] = sb.charAt(a++); } } scan.close(); findStart(); complete(this.rowStart, this.columnStart); } catch (FileNotFoundException e) { e.printStackTrace(); System.out.println("ERROR : " + e.getMessage()); } } private void findStart() { for (int i = 0; i < this.rows; i++) { for (int j = 0; j < this.columns; j++) { if (mazeSelected[i][j] == 'S') { this.rowStart = i; this.columnStart = j; } } } } public void printMaze() { try { File mazeFile = new File(this.outputFilename); PrintWriter writer = new PrintWriter(mazeFile); for (int i = 0; i < this.rows; i++) { for (int j = 0; j < this.columns; j++) { writer.print(this.mazeSelected[i][j]); } // Print .txt file writer.println(); } // Closes .txt file writer.close(); } catch (FileNotFoundException e) { System.out.println("ERROR : " + e.getMessage()); } } }
true
7825afb888a8807a788ea301d174e86dc0afeb73
Java
mahindajayakody/pawn-pmb
/pawn/src/java/com/m4/pawning/dao/impl/PawnerDAOImpl.java
UTF-8
8,278
2.0625
2
[]
no_license
package com.m4.pawning.dao.impl; import java.text.DecimalFormat; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.Criteria; import org.hibernate.FetchMode; import org.hibernate.LockMode; import org.hibernate.Query; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import org.hibernate.transform.ResultTransformer; import com.m4.core.exception.CommonDataAccessException; import com.m4.core.util.DataBag; import com.m4.core.util.MasterDAOSupport; import com.m4.core.util.QueryCriteria; import com.m4.core.util.UserConfig; import com.m4.pawning.dao.PawnerDAO; import com.m4.pawning.domain.Article; import com.m4.pawning.domain.MapPawner; import com.m4.pawning.domain.Pawner; import com.m4.pawning.domain.PawnerType; public class PawnerDAOImpl extends MasterDAOSupport implements PawnerDAO{ private static final Logger logger = Logger.getLogger(PawnerDAOImpl.class); public void createPawner(UserConfig userConfig, Pawner pawner) { logger.debug("**** Enter in to createPawner method ****"); Criteria criteria = getSession().createCriteria(Pawner.class); criteria.add(Restrictions.eq("idOrBrNo", pawner.getIdOrBrNo())); criteria.setProjection(Projections.rowCount()); int count = ((Integer) criteria.uniqueResult()).intValue(); if (count !=0) throw new CommonDataAccessException("errors.recordexist"); initializeDomainObject(userConfig, pawner); getHibernateTemplate().save(pawner); DecimalFormat format = new DecimalFormat("00000000"); pawner.setPawnerCode(format.format(pawner.getPawnerId())); for(MapPawner mapPawner:pawner.getMapPawner()){ initializeDomainObject(userConfig, mapPawner); mapPawner.setPawner(pawner); mapPawner.setPawnerId(pawner.getPawnerId()); mapPawner.setPawnerType((PawnerType)getSession().get(PawnerType.class,mapPawner.getPawnerTypeId())); getHibernateTemplate().save(mapPawner); } logger.debug("**** Leaving from createPawner method ****"); } public void updatePawner(UserConfig userConfig, Pawner pawner) { logger.debug("**** Enter in to updatePawner method ****"); initializeDomainObject(userConfig, pawner); getHibernateTemplate().update(pawner); String hql = "DELETE FROM MapPawner map WHERE map.pawnerId=" + pawner.getPawnerId(); getSession().createQuery(hql).executeUpdate(); for(MapPawner mapPawner:pawner.getMapPawner()){ initializeDomainObject(userConfig, mapPawner); mapPawner.setPawner(pawner); mapPawner.setPawnerId(pawner.getPawnerId()); mapPawner.setPawnerType((PawnerType)getSession().get(PawnerType.class,mapPawner.getPawnerTypeId())); getHibernateTemplate().save(mapPawner); } logger.debug("**** Leaving from updatePawner method ****"); } public DataBag getAllPawner(UserConfig userConfig, List<QueryCriteria> criteriaList) { logger.debug("**** Enter in to getAllPawner method ****"); DataBag pawnerBag = null; Criteria criteria = getSession().createCriteria(Pawner.class); criteria.add(Restrictions.eq("pawnerStatus", 1)); criteria.setFetchMode("mapPawner", FetchMode.JOIN); criteria.setFetchMode("mapPawner.pawnerType", FetchMode.JOIN); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); pawnerBag = getDataList(getHibernateTemplate(), criteriaList,criteria ); logger.debug("**** Leaving from getAllPawner method ****"); return pawnerBag; } public Pawner getPawnerByCode(UserConfig userConfig, String code) { logger.debug("**** Enter in to getPawnerByCode method ****"); Pawner pawner = null; Criteria criteria = getSession().createCriteria(Pawner.class); criteria.add(Restrictions.eq("pawnerCode", code)); //criteria.add(Restrictions.eq("pawnerStatus", 1)); criteria.setFetchMode("mapPawner",FetchMode.JOIN); criteria.setFetchMode("mapPawner.pawnerType",FetchMode.JOIN); pawner = (Pawner)criteria.uniqueResult(); if(pawner == null){ throw new CommonDataAccessException("errors.recordnotfound"); }else if(pawner.getPawnerStatus() != 1){ throw new CommonDataAccessException("errors.blacklisted"); } logger.debug("**** Leaving from getPawnerByCode method ****"); return pawner; } public Pawner getPawnerById(UserConfig userConfig, int recordId) { logger.debug("**** Enter in to getPawnerById method ****"); Pawner pawner = null; Criteria criteria = getSession().createCriteria(Pawner.class); criteria.add(Restrictions.eq("pawnerId", recordId)); criteria.setFetchMode("mapPawner",FetchMode.JOIN); criteria.setFetchMode("mapPawner.pawnerType",FetchMode.JOIN); pawner = (Pawner)criteria.uniqueResult(); if(pawner == null){ throw new CommonDataAccessException("errors.recordnotfound"); }else if(pawner.getPawnerStatus() != 1){ throw new CommonDataAccessException("errors.blacklisted"); } logger.debug("**** Leaving from getPawnerById method ****"); return pawner; } public Pawner getPawnerByCodeAndType(UserConfig userConfig, String code,String type) { logger.debug("**** Enter in to getPawnerByCodeAndType method ****"); MapPawner mapPawner = null; Criteria criteria = getSession().createCriteria(MapPawner.class); criteria.add(Restrictions.eq("pawner.pawnerCode", code)); criteria.add(Restrictions.eq("pawnerType.code", type)); criteria.add(Restrictions.eq("pawnerStatus", 1)); criteria.setFetchMode("pawner", FetchMode.JOIN); criteria.setFetchMode("pawnerType", FetchMode.JOIN); mapPawner = (MapPawner)criteria.uniqueResult(); if(mapPawner == null) throw new CommonDataAccessException("errors.recordnotfound"); logger.debug("**** Leaving from getPawnerByCodeAndType method ****"); return mapPawner.getPawner(); } public Pawner getPawnerByIdOrBr(UserConfig userConfig, String idOrBr) { logger.debug("**** Enter in to getPawnerByIdOrBr method ****"); Pawner pawner = null; Criteria criteria = getSession().createCriteria(Pawner.class); criteria.add(Restrictions.eq("idOrBrNo", idOrBr)); criteria.setFetchMode("mapPawner",FetchMode.JOIN); criteria.setFetchMode("mapPawner.pawnerType",FetchMode.JOIN); pawner = (Pawner)criteria.uniqueResult(); if(pawner == null){ throw new CommonDataAccessException("errors.recordnotfound"); }else if(pawner.getPawnerStatus() != 1){ throw new CommonDataAccessException("errors.blacklisted"); } logger.debug("**** Leaving from getPawnerByIdOrBr method ****"); return pawner; } public List getPawnerName(UserConfig userConfig, int recordId){ String hql = "SELECT pawnerCode,title,initials,surName FROM Pawner WHERE pawnerId=" + recordId; Query query = getSession().createQuery(hql); List list = query.list(); if(list == null) throw new CommonDataAccessException("errors.recordnotfound"); return list; } public List<Pawner> getAllPawnerByType(UserConfig userConfig, String type) { logger.debug("**** Enter in to getAllPawnerByType method ****"); List<Pawner> list = null; String hql = "SELECT DISTINCT map.pawner FROM MapPawner map INNER JOIN map.pawner WHERE map.pawnerType.code=:code " + " AND map.companyId=:companyId AND map.pawner.pawnerStatus=:pawnerStatus"; Query query = getSession().createQuery(hql); query.setReadOnly(true); query.setString("code", type); query.setInteger("companyId", userConfig.getCompanyId()); query.setInteger("pawnerStatus", 1); list = query.list(); logger.debug("**** Leaving from getAllPawnerByType method ****"); return list; } public List<Pawner> getAllPawnerBySQL(UserConfig userConfig, String sql) { logger.debug("**** Enter in to getAllPawnerByType method ****"); List<Pawner> list = null; String hql = "SELECT DISTINCT map.pawner FROM MapPawner map INNER JOIN map.pawner INNER JOIN map.pawnerType WHERE " + " map.companyId=:companyId AND map.pawner.pawnerStatus=:pawnerStatus" + sql; Query query = getSession().createQuery(hql); query.setReadOnly(true); query.setInteger("companyId", userConfig.getCompanyId()); query.setInteger("pawnerStatus", 1); list = query.list(); logger.debug("**** Leaving from getAllPawnerByType method ****"); return list; } }
true
52763a4ebcd72667cc9d0dbd4534282eae8ac6bf
Java
ini8262/jpa-study
/src/main/java/jpa/entity/BaseEntity.java
UTF-8
225
2.0625
2
[]
no_license
package jpa.entity; import javax.persistence.MappedSuperclass; import java.time.LocalDateTime; @MappedSuperclass public abstract class BaseEntity { private String createdId; private LocalDateTime createdDateTime; }
true
983642233d6089bd98c56a47fbaf45e4f221317f
Java
tenji/ecommerce
/src/main/java/com/tenjishen/service/affiliate/impl/StateServiceImpl.java
UTF-8
647
1.8125
2
[]
no_license
package com.tenjishen.service.affiliate.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.tenjishen.dao.StateDao; import com.tenjishen.model.affiliate.State; import com.tenjishen.service.BaseServiceImpl; import com.tenjishen.service.affiliate.StateService; @Service @Transactional public class StateServiceImpl extends BaseServiceImpl<State, Long> implements StateService { @Resource private StateDao stateDao; @Resource public void setBaseDao(StateDao stateDao) { super.setBaseDao(stateDao); } }
true
2b7c8af58f550dd0c00569c26c7771ef03eeee5f
Java
Rhadamys/ddm-usach
/src/Vistas/SubVistaCuadroDialogo.java
UTF-8
3,131
2.46875
2
[]
no_license
/* * 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 Vistas; import Controladores.ControladorPrincipal; import Otros.BotonImagen; import Otros.Constantes; import Otros.VistaPersonalizada; import java.awt.Color; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JLabel; /** * * @author mam28 */ public class SubVistaCuadroDialogo extends VistaPersonalizada{ private final JLabel labelMensaje; private final BotonImagen boton1; private BotonImagen boton2; private ControladorPrincipal contPrin; public SubVistaCuadroDialogo(String mensaje, String textoBoton){ this.labelMensaje = new JLabel("<html><center>" + mensaje + "</center></html>"); this.boton1 = new BotonImagen(Constantes.BTN_NORMAL); this.add(labelMensaje); this.add(boton1); this.boton1.setSize(200, 40); this.boton1.setLocation(300, 360); this.boton1.setText(textoBoton); SubVistaCuadroDialogo visMen = this; this.boton1.addMouseListener(new MouseAdapter(){ @Override public void mouseReleased(MouseEvent e){ visMen.dispose(); } }); this.labelMensaje.setSize(580, 100); this.labelMensaje.setHorizontalAlignment(JLabel.CENTER); this.labelMensaje.setVerticalAlignment(JLabel.CENTER); this.labelMensaje.setLocation(110, 220); this.labelMensaje.setFont(Constantes.FUENTE_24PX); this.labelMensaje.setForeground(Color.white); this.setImagenFondo(Constantes.FONDO_CUADRO_DIALOGO); } public SubVistaCuadroDialogo(String mensaje, String textoBoton1, String textoBoton2){ this.labelMensaje = new JLabel("<html><center>" + mensaje + "</center></html>"); this.boton1 = new BotonImagen(Constantes.BTN_NORMAL); this.boton2 = new BotonImagen(Constantes.BTN_NORMAL); this.add(labelMensaje); this.add(boton1); this.add(boton2); this.boton1.setSize(200, 40); this.boton1.setLocation(170, 360); this.boton1.setText(textoBoton1); ; this.boton2.setSize(200, 40); this.boton2.setLocation(410, 360); this.boton2.setText(textoBoton2); this.labelMensaje.setSize(580, 100); this.labelMensaje.setHorizontalAlignment(JLabel.CENTER); this.labelMensaje.setVerticalAlignment(JLabel.CENTER); this.labelMensaje.setLocation(110, 220); this.labelMensaje.setFont(Constantes.FUENTE_24PX); this.labelMensaje.setForeground(Color.white); this.setImagenFondo(Constantes.FONDO_CUADRO_DIALOGO); } public BotonImagen getBoton1() { return boton1; } public BotonImagen getBoton2() { return boton2; } }
true
6f1574ff7b825321485ca79611b0450bded8e128
Java
a20103111/thumbsup
/src/main/java/com/thumbsup/service/ILoginService.java
UTF-8
423
1.523438
2
[]
no_license
package com.thumbsup.service; import com.thumbsup.dto.TStudent; import com.thumbsup.vo.VO4Login_Rtn; public interface ILoginService { public VO4Login_Rtn selectStudentByUserName(String StudentUserName,String StudentPassWord); public VO4Login_Rtn selectTeacherByUserName(String StudentUserName,String StudentPassWord); public VO4Login_Rtn selectAdminByUserName(String StudentUserName,String StudentPassWord); }
true
071f458c48bdbce4b4f1d2969331cc0d6763b315
Java
flywelkin/welkin-fast
/welkin-im/src/test/java/io/gitee/welkinfast/im/ImAppTest.java
UTF-8
868
1.71875
2
[]
no_license
package io.gitee.welkinfast.im; import io.gitee.welkinfast.im.distributed.LocalNodeProcesser; import org.apache.curator.framework.CuratorFramework; import org.apache.zookeeper.CreateMode; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; /** * @Author yuanjg * @CreateTime 2021/03/21 09:19 * @Version 1.0.0 */ @SpringBootTest public class ImAppTest { @Autowired CuratorFramework curatorFramework; @Autowired private LocalNodeProcesser localNodeProcesser; @Test public void test1() throws Exception { curatorFramework .create() .creatingParentsIfNeeded() .withProtection() .withMode(CreateMode.PERSISTENT) .forPath("/managePath"); } }
true
7221fc6363d312d47946ee190b1ade73cc211f6a
Java
BAschl/MMu18RetRiot
/app/src/main/java/at/ac/tuwien/ims/uemultimediatemplate/GameActivity.java
UTF-8
749
2.171875
2
[]
no_license
package at.ac.tuwien.ims.uemultimediatemplate; import android.annotation.SuppressLint; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; import android.view.MotionEvent; import android.view.View; /** * The main game takes place in this activity. It contains only a {@Link GameSurfaceview}. * TODO: Make it fullscreen. * @author Bernhard Aschl */ public class GameActivity extends AppCompatActivity { /** * Pretty much standard onCreate * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); } }
true
f1c02b687297a378ab128854d39e85f18abcc6d8
Java
albertPu/YtAndroid
/net/src/main/java/com/yt/net/client/ApiStore.java
UTF-8
3,354
2.40625
2
[]
no_license
package com.yt.net.client; import android.app.Application; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import java.util.concurrent.TimeUnit; /** * created by Albert */ public class ApiStore { private static Retrofit retrofit; private static OkHttpClient okHttpClient; //private static final String BASE_URL = "http://192.168.0.9:8080/"; private static final String BASE_URL = "http://192.168.43.136/"; private static final long DEFAULT_TIME_OUT = 20; private static final long DEFAULT_READ_TIME_OUT = 20; public static Application application; public static void init(Application application){ ApiStore.application=application; } public static <T> T create(Class<T> cls) { if (retrofit == null) { retrofit = new Retrofit.Builder() .client(getOkHttpClient()) .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); } return retrofit.create(cls); } private static OkHttpClient getOkHttpClient() { if (okHttpClient == null) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.connectTimeout(DEFAULT_TIME_OUT, TimeUnit.SECONDS);//连接超时时间 builder.writeTimeout(DEFAULT_READ_TIME_OUT, TimeUnit.SECONDS);//写操作 超时时间 builder.readTimeout(DEFAULT_READ_TIME_OUT, TimeUnit.SECONDS);//读操作超时时间 HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() { private StringBuilder messages = new StringBuilder(); private final int JSON_INDENT = 2; @Override public void log(String message) { try { if (message.startsWith("{") && message.endsWith("}")) { JSONObject jsonObject = new JSONObject(message); message = jsonObject.toString(JSON_INDENT); } else if (message.startsWith("[") && message.endsWith("]")) { JSONArray jsonArray = new JSONArray(message); message = jsonArray.toString(JSON_INDENT); } } catch (JSONException e) { e.printStackTrace(); } messages.append(message); messages.append("\n"); if (message.startsWith("<-- END HTTP")) { Log.i("ApiRequest",messages.toString()); messages.delete(0, messages.length()); } } }); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); builder.addNetworkInterceptor(interceptor); okHttpClient = builder.build(); } return okHttpClient; } }
true
167f2a1b0a90fc4a79dd0ca782e15c879b24e94d
Java
yoboitel/Udacity-BuildItBigger
/jokesandroidlibrary/src/main/java/yohan/builditbigger/com/jokesandroidlibrary/DisplayJokeFromIntent.java
UTF-8
812
2.109375
2
[]
no_license
package yohan.builditbigger.com.jokesandroidlibrary; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import android.widget.Toast; /** * Created by Yohan on 17/06/2018. */ public class DisplayJokeFromIntent extends AppCompatActivity { TextView tv_joke; public static final String JOKE_ID = "joke"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.displayjoke); tv_joke=(TextView) findViewById(R.id.jokelabel); String jokestring = getIntent().getStringExtra(JOKE_ID); if (jokestring != null) { tv_joke.setText(jokestring); } else { tv_joke.setText("error"); } } }
true
5f8070c0cb941ca5af87bb9a81c3846ed3f14781
Java
1456017852/springboot
/springboot-day01-helloworld/src/main/java/com/naruto/springboot/SpringbootHelloworldApplication.java
UTF-8
4,334
2.78125
3
[]
no_license
package com.naruto.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 一、springboot简介 * 1、简介 * (1)、springboot是spring家族中的一个全新的框架,它用来简化spring应用程序的创建和开发,也就是说springboot能简化我们之前用的ssm框架进行开发的过程 * (2)、在我们以往采用ssm框架开发的时候,塔尖和整合三大框架我们要做许多的工作,比如配置web.xml,配置mybatis,配置spring,并将它们整合到一起,而Springboot框架对此工程进行了革命性的颠覆,springboot抛弃了繁琐的xml配置过程,采用大量的默认配置简化我们的开发! * (3)、springboot可以快速的创建基于spring框架的应用程序,它让编码变简单,配置变简单,部署变简单,监控变简单! * 2、特性 * (1)、能够快速的创建基于spring的应用程序, * (2)、能够直接Java main方法启动内嵌的servlet容器,运行springboot程序,不需要部署war包 * (3)、起步依赖-提供约定的starter POM 来简化Maven配置,让Maven的配置变得更简单! * (4)、自动配置-根据项目得起步以来,springboot自动配置spring,springmvc,mybatis等 * (5)、健康检查-提供了程序的健康检查 * (6)、基本可以完全不使用xml配置文件,采用注解配置 * 3、四大核心 * (1)、自动配置:针对spring应用程序常见的应用功能,springboot能自动提供相关的配置 * (2)、起步依赖:告诉springboot需要什么功能,他就能引入需要的类库; * (3)、Actuator:让你能够深入运行中的springboot应用程序中,一探springboot的内部信息 * (4)、命令行界面:这是springboot的可选特性,主要针对Groovy语言 */ /** * 二、springboot自动配置原理 * @SpringBootApplication :springboot的核心注解,该注解的作用开启自动扫描包和自动配置, * 该注解为一个组合注解;配置在某个类上,表明这个类是springboot的入口类及主配置类, * springboot就会运行该类的main方法来启动springboot服务. * * @SpringBootApplication由以下注解组成: * 1、@SpringBootConfiguration 【@Configration】: * 配置类上标注这个注解,配置类类似于我们过去用的xml配置文件,配置类也是spring中的组件 * * 2、@EnableAutoConfiguration【@AutoConfigurationPackage @Import({AutoConfigurationImportSelector.class})】 * @EnableAutoConfiguration告诉springboot开启自动配置功能和包扫描,这样自动配置才能生效 * * (1)、@AutoConfigurationPackage【@Import({Registrar.class})】: * 自动扫描包,由spring的底层注解@import实现, * 通过Registrar类的registerBeanDefinitions方法将注解所在包及其所有子包下的组件注入到springIOC容器中 * (2)、Spring的底层注解@Import,给容器中导入一些组件,导入那些组件由AutoConfigurationImportSelector.class 来指定 * AutoConfigurationImportSelector:自动配置选择器,其中的getAutoConfigurationEntry方法 * 将需要自动配置的组件以配置类的类全名的方式返回,这样许多场景的自动配置类就注入到IOC容器中了; * 有了自动配置类,自动配置类就为我们配置了许多的组件, 就免去了我们手动编写配置注入功能组件的工作 * * 这些配置类都配置在META-INF/spring.factories下面 * * Spring全家桶的整体整合解决方案和自动配置都在 spring-boot-autoconfigure-RELEASE.jar 下 * 这些自动配置类在一定的 条件下才能生效 * 我们可以在springboot的核心配置文件中配置debug=true,运行springboot的入口类来看那些配置类生效,那些配置类没有生效 * * * * */ //springboot项目的入口,启动springboot了程序,启动内嵌的tomcat,@SpringBootApplication // 是springboot的核心注解,主要作用是开启spring的自动配置 @SpringBootApplication public class SpringbootHelloworldApplication { public static void main(String[] args) { SpringApplication.run(SpringbootHelloworldApplication.class, args); } }
true
3330f0b43ef664f751ee69366dfa25a0cec19046
Java
AngelineKeshya/Pubhub100-core-maven
/src/com/bookapp/model/TestUser.java
UTF-8
425
2.578125
3
[]
no_license
package com.bookapp.model; import com.bookapp.model.User; public class TestUser { public static void main(String[] args) { User user=new User(); user.setId(101); user.getId(); System.out.println("The user id is"+user.getId()); user.setName("Angel"); user.getName(); System.out.println("My Nameis:"+user.getName()); System.out.println("My Details are"+user.toString()); } }
true
6f132c79e36029082cd8e89ba9ad440cbbe83166
Java
thinkaboutgod/dsmp
/src/main/java/com/dsmp/service/impl/TopicServiceImpl.java
UTF-8
14,301
2.3125
2
[]
no_license
package com.dsmp.service.impl; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.dsmp.mapper.TbOptionMapper; import com.dsmp.mapper.TbParameterMapper; import com.dsmp.mapper.TbTopicMapper; import com.dsmp.pojo.MyResult; import com.dsmp.pojo.TbMistakeCollection; import com.dsmp.pojo.TbOption; import com.dsmp.pojo.TbTopic; import com.dsmp.service.MistakeCollectionService; import com.dsmp.service.TopicService; import com.dsmp.utils.GsonUtils; @Service public class TopicServiceImpl implements TopicService { @Autowired private TbTopicMapper tbTopicMapper; @Autowired private MistakeCollectionService mistakeCollectionService; @Autowired private TbOptionMapper tbOptionMapper; @Autowired private TbParameterMapper tbParameterMapper; @Override public TbTopic findTopic(Integer topId) { return tbTopicMapper.findTopic(topId); } /** * @param topicAmount 出题数量 * @return 随机产生一份题目数量为topicAmount的试卷 */ @Override public List<TbTopic> findManyTopic(Integer topicAmount,Integer subId) { List<TbTopic> topicList = tbTopicMapper.findManyTopic(subId);//从数据库题目表查出所有试题 topicList = randomTopic(topicList,topicAmount); return topicList; } /** * 从数据库题库里随机产生一张考卷,题目数量是(出一张卷子出几道题)topicAmount * * @param topicList 从数据库题目表查出所有的题目(包括题目下的选项) * @param topicAmount 出题数量 * @return 产生的一套题量为topicAmount的模拟卷(如果出题量topicAmount小于等于题库题目数量则按出题量出题;如果出题量topicAmount大于题库题目数量,则按题库已有数量出题) */ public List<TbTopic> randomTopic(List<TbTopic> topicList, Integer topicAmount) { List<TbTopic> randomTopicList = new ArrayList<TbTopic>(); Random ran = new Random(); // System.out.println("题库题目数量:" + topicList.size()); if (topicList.size() >= topicAmount) {// 如果题库题目数比出题数topicAmount大(或等于),则可以出题 for (int i = 0; i < topicAmount; i++) {// 循环次数topicAmount,每次从题库拿到一道题放入到我的卷子中 int ranIndex = ran.nextInt(topicList.size()); TbTopic topic = topicList.get(ranIndex); randomTopicList.add(topic); // 把已经插入的题目从集合移除掉 topicList.remove(ranIndex); } } else {// 如果出题数量大于题库题数,则把所有的题目都出掉 randomTopicList = topicList; } return randomTopicList; } /** * @param studentId 学员id * @param exResultMap 学员提交一份模拟卷时候的map集合,key-题目id,value-该题学员做对了(yes)还是错了(no) * 错了就往错题集表里插入记录,对了就看错题集里面是否有这条记录,有则删除。 */ @Transactional @Override public void addOrDelMistakeCollection(Integer studentId, Map<String, String> exResultMap) { Set<String> keySet = exResultMap.keySet(); Iterator<String> iterator = keySet.iterator(); while (iterator.hasNext()) { String topId = iterator.next(); String optionRes = exResultMap.get(topId); // System.out.println("topId:" + topId + ",optionRes:" + optionRes); // 先查看一下这条记录是否已经存在: TbMistakeCollection mistakeCollection = mistakeCollectionService.findMistakeTopicBySidAndTopId(studentId, topId); boolean topicExist = true;// 错题集存在这题 if (null == mistakeCollection) { topicExist = false;// 错题集不存在这题 } if ("no".equals(optionRes)) {// 如果这一题选错的话 // 记录插入到错题集表里: if (!topicExist) {// 错题集不存在这题 // System.out.println("错题集不存在这题,可执行插入:"); boolean addres = mistakeCollectionService.addMistakeTopic(studentId, topId); if (addres) { // System.out.println("插入studentId&topId:" + studentId + "," + topId + "成功!"); } } else { // System.out.println("学员做错了,但错题集已经存在这题,无需插入!"); } } else if ("yes".equals(optionRes)) {// 如果这一题选对的话 // 从错题集中删除这条记录: if (topicExist) {// 错题集存在这题 // System.out.println("学员做对了,错题集存在这题,可执行删除:"); boolean delres = mistakeCollectionService.delMistakeTopic(studentId, topId); if (delres) { // System.out.println("删除studentId&topId:" + studentId + "," + topId + "成功!"); } } } } } /**通过学员id查询出该学员的错题集 * @param stuId 学员id * @return 错题集 */ @Override public List<TbTopic> findMistakeTopic(Integer stuId) { return tbTopicMapper.findMistakeTopic(stuId); } @Override public List<TbTopic> findAllTopic(Integer subId) { List<TbTopic> topicList = tbTopicMapper.findManyTopic(subId);//从数据库题目表查出所有试题 return topicList; } /**(单题目类型)选错时,加入错题集 * @param studentId 学员id * @param subId 科目id * @param topId 选对的题目id */ @Transactional @Override public void addMistakeCollection2exercise(Integer studentId, Integer subId, String topId) { //先查看一下这条记录是否已经存在: TbMistakeCollection mistakeCollection = mistakeCollectionService.findMistakeTopicBySidAndTopId(studentId, topId); boolean topicExist = true;//错题集存在这题 if(null==mistakeCollection) { topicExist = false;//错题集不存在这题 } //记录插入到错题集表里: if(!topicExist) {//错题集不存在这题 // System.out.println("错题集不存在这题,可执行插入:"); boolean addres = mistakeCollectionService.addMistakeTopic(studentId, topId); if(addres) { // System.out.println("插入studentId&topId:"+studentId+","+topId+"成功!"); } }else { // System.out.println("学员做错了,但错题集已经存在这题,无需插入!"); } } /**(单题目类型)选对时,加入错题集 * @param studentId 学员id * @param subId 科目id * @param topId 选对的题目id */ @Transactional @Override public void delMistakeCollection2exercise(Integer studentId, Integer subId, String topId) { //先查看一下这条记录是否已经存在: TbMistakeCollection mistakeCollection = mistakeCollectionService.findMistakeTopicBySidAndTopId(studentId, topId); boolean topicExist = true;//错题集存在这题 if(null==mistakeCollection) { topicExist = false;//错题集不存在这题 } //从错题集中删除这条记录: if(topicExist) {//错题集存在这题 // System.out.println("学员做对了,错题集存在这题,可执行删除:"); boolean delres = mistakeCollectionService.delMistakeTopic(studentId, topId); if(delres) { // System.out.println("删除studentId&topId:"+studentId+","+topId+"成功!"); } } } // 查询所有科一题目 @Override public List<TbTopic> searchAllTopic(String subId) { return tbTopicMapper.findManyTopic(Integer.valueOf(subId)); } // 修改科目一题目方法 @Override public String changeTopic(HttpServletRequest request,MultipartFile newImg) { return doTOpic(request,newImg, "change"); } // 增加科目一题目方法 @Override public String addTopic(HttpServletRequest request, MultipartFile addnewImg) { return doTOpic(request, addnewImg, "add"); } // 科目一题目修改和增加共用 @Transactional // 事务注解,dotype为修改还是增加的类型 public String doTOpic(HttpServletRequest request, MultipartFile img, String doType) { String result = null; // Map<String, Object> map2 = GsonUtils.fromJson(map, HashMap.class); // TbTopic tbTopic = GsonUtils.fromJson(map2.get("topic").toString(), TbTopic.class); // TbOption optionA = GsonUtils.fromJson(map2.get("optionA").toString(), TbOption.class); // TbOption optionB = GsonUtils.fromJson(map2.get("optionB").toString(), TbOption.class); TbTopic tbTopic = new TbTopic(Integer.valueOf(request.getParameter("topId")), request.getParameter("topTopic"), request.getParameter("topAnswerDetail")); TbOption optionA = new TbOption(Integer.valueOf(request.getParameter("aoptId")), request.getParameter("aoptOption"), request.getParameter("aoptStatus")); TbOption optionB = new TbOption(Integer.valueOf(request.getParameter("boptId")), request.getParameter("boptOption"), request.getParameter("boptStatus")); String type =request.getParameter("type"); // String type =String.valueOf(map2.get("type")); changeTopicImage(request, tbTopic, img, doType);// 是否更新图片方法 if (type.equals("1.0") || type.equals("2.0")) {// 4个选项类型 // TbOption optionC = GsonUtils.fromJson(map2.get("optionC").toString(), TbOption.class); // TbOption optionD = GsonUtils.fromJson(map2.get("optionD").toString(), TbOption.class); TbOption optionC = new TbOption(Integer.valueOf(request.getParameter("coptId")), request.getParameter("coptOption"), request.getParameter("coptStatus")); TbOption optionD = new TbOption(Integer.valueOf(request.getParameter("doptId")), request.getParameter("doptOption"), request.getParameter("doptStatus")); if (optionA.getOptStatus().equals("yes")) {// 得到正确选项是哪个 tbTopic.setTopAnswer("A"); } else if (optionB.getOptStatus().equals("yes")) { tbTopic.setTopAnswer("B"); } else if (optionC.getOptStatus().equals("yes")) { tbTopic.setTopAnswer("C"); } else { tbTopic.setTopAnswer("D"); } int tb = 0, a = 0, b = 0, c = 0, d = 0; switch (doType) { case "change":// 修改题目 tb = tbTopicMapper.updateByPrimaryKeySelective(tbTopic);// 更新题目记录 a = tbOptionMapper.updateByPrimaryKeySelective(optionA);// 更新选项 b = tbOptionMapper.updateByPrimaryKeySelective(optionB); c = tbOptionMapper.updateByPrimaryKeySelective(optionC); d = tbOptionMapper.updateByPrimaryKeySelective(optionD); break; case "add":// 增加题目 tbTopic.setSubId(1); tb = tbTopicMapper.insertSelective(tbTopic);// 插入题目 int topId = tbTopicMapper.selecttopId();// 查询刚插入题目的id optionA.setTopId(topId); optionB.setTopId(topId); optionC.setTopId(topId); optionD.setTopId(topId); a = tbOptionMapper.insertSelective(optionA);// 插入选项 b = tbOptionMapper.insertSelective(optionB); c = tbOptionMapper.insertSelective(optionC); d = tbOptionMapper.insertSelective(optionD); break; } if (tb > 0 && a > 0 && b > 0 && c > 0 && d > 0) { result = "success"; } else { result = "false"; } } else {// 2个选项题目类型 if (optionA.getOptStatus().equals("yes")) {// 得到正确选项是哪个 tbTopic.setTopAnswer("A"); } else if (optionB.getOptStatus().equals("yes")) { tbTopic.setTopAnswer("B"); } int tb = 0, a = 0, b = 0; switch (doType) { case "change": tb = tbTopicMapper.updateByPrimaryKeySelective(tbTopic);// 更新题目记录 a = tbOptionMapper.updateByPrimaryKeySelective(optionA);// 更新选项 b = tbOptionMapper.updateByPrimaryKeySelective(optionB); break; case "add": tbTopic.setSubId(1); tb = tbTopicMapper.insertSelective(tbTopic);// 插入题目 int topId = tbTopicMapper.selecttopId();// 查询刚插入题目的id optionA.setTopId(topId); optionB.setTopId(topId); a = tbOptionMapper.insertSelective(optionA);// 插入选项 b = tbOptionMapper.insertSelective(optionB); break; } if (tb > 0 && a > 0 && b > 0) { result = "success"; } else { result = "false"; } } return result; } // 是否更新图片判断 public void changeTopicImage(HttpServletRequest request, TbTopic tbTopic, MultipartFile newImg, String doType) { if ("" == newImg.getOriginalFilename()) {// 没有更新图片 tbTopic.setTopImg(null); } else {// 有更新图片 String fileName = System.currentTimeMillis() + "_" + newImg.getOriginalFilename(); tbTopic.setTopImg(fileName); String filePath = tbParameterMapper.selectParamter("系统文件存储路径");//获取系统文件储存路径 String path = filePath+"/images/topic/"; File file = new File(path); if (!file.exists()) { file.mkdirs(); } try { newImg.transferTo(new File(path, fileName));// 插入图片 if (doType.equals("change")) {// 如果是修改图片,需要删除旧图片 String deleteFileName = tbTopicMapper.selecttopImg(tbTopic.getTopId()); File deleteFile = new File(path + deleteFileName); if (deleteFile.exists()) { deleteFile.delete(); } } } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } // 删除题目 @Transactional @Override public MyResult deleteTopic(HttpServletRequest request, String topId) { int op = tbOptionMapper.deleteByTopId(Integer.valueOf(topId));// 删除选项,先删选项,因为和题目主外键关系 int res = tbTopicMapper.deleteByPrimaryKey(Integer.valueOf(topId)); MyResult myResult = new MyResult(); if (res > 0 && op > 0) { myResult.setMyresult("success"); } else { myResult.setMyresult("failed"); } return myResult; } }
true
77fad6a4f78340ac58588ac2daa1562cf890b6f9
Java
Baibhabswain/PP2_JAVA
/chapter 4/Queue/Queue.java
UTF-8
4,301
3.625
4
[ "Apache-2.0" ]
permissive
import java.util.*; class arrayQueue { protected int Queue[] ; protected int front, rear, size, len; public arrayQueue(int n) { size = n; len = 0; Queue = new int[size]; front = -1; rear = -1; } public boolean isEmpty() { return front == -1; } public boolean isFull() { return front==0 && rear == size -1 ; } public int getSize() { return len ; } public int peek() { if (isEmpty()) throw new NoSuchElementException("Underflow Exception"); return Queue[front]; } public void insert(int i) { if (rear == -1) { front = 0; rear = 0; Queue[rear] = i; } else if (rear + 1 >= size) throw new IndexOutOfBoundsException("Overflow Exception"); else if ( rear + 1 < size) Queue[++rear] = i; len++ ; } public int remove() { if (isEmpty()) throw new NoSuchElementException("Underflow Exception"); else { len-- ; int ele = Queue[front]; if ( front == rear) { front = -1; rear = -1; } else front++; return ele; } } public void display() { System.out.print("Queue = "); if (len == 0) { System.out.print("Empty"); return ; } for (int i = front; i <= rear; i++) System.out.print(Queue[i]+" "); System.out.println(); } } public class Queue { @SuppressWarnings("resource") public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter Size of Integer Queue "); int n = scan.nextInt(); arrayQueue q = new arrayQueue(n); char ch; do{ System.out.println("Queue Operations"); System.out.println("1. insert"); System.out.println("2. remove"); System.out.println("3. peek"); System.out.println("4. check empty"); System.out.println("5. check full"); System.out.println("6. size"); int choice = scan.nextInt(); switch (choice) { case 1 : System.out.println("Enter integer element to insert"); try { q.insert( scan.nextInt() ); } catch(Exception e) { System.out.println("Error : " +e.getMessage()); } break; case 2 : try { System.out.println("Removed Element = "+q.remove()); } catch(Exception e) { System.out.println("Error : " +e.getMessage()); } break; case 3 : try { System.out.println("Peek Element = "+q.peek()); } catch(Exception e) { System.out.println("Error : "+e.getMessage()); } break; case 4 : System.out.println("Empty status = "+q.isEmpty()); break; case 5 : System.out.println("Full status = "+q.isFull()); break; case 6 : System.out.println("Size = "+ q.getSize()); break; default : System.out.println("Wrong Entry"); break; } q.display(); System.out.println("\nDo you want to continue (Type y or n)"); ch = scan.next().charAt(0); } while (ch == 'Y'|| ch == 'y'); } }
true
55f8625be3922cf919607cd212508506367623fa
Java
goodCardTeam/goodCard2
/app/src/main/java/com/dytj/goodcard/ui/fragment/HomeFragment.java
UTF-8
4,989
1.8125
2
[]
no_license
package com.dytj.goodcard.ui.fragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.Toast; import com.dytj.goodcard.R; import com.dytj.goodcard.base.LifecycleLazyFragment; import com.dytj.goodcard.model.MenuEntity; import com.dytj.goodcard.presenter.TestContact; import com.dytj.goodcard.ui.activity.MyTradeOrderActivity; import com.dytj.goodcard.ui.adapter.MenuItemLvAdapter; import com.dytj.goodcard.view.ListViewForScrollView; import com.lzj.gallery.library.views.BannerViewPager; import java.util.ArrayList; import java.util.List; import androidx.annotation.Nullable; /** * Created by MaRufei * on 2019-09-29. * Email: www.867814102@qq.com * Phone:13213580912 * Purpose:TODO * update: */ public class HomeFragment extends LifecycleLazyFragment implements View.OnClickListener { private BannerViewPager homeBanner; private Toast toast; private View view; private LinearLayout homeBt1; private ListViewForScrollView homeMenu; private MenuItemLvAdapter adapter; @Override public TestContact.presenter initPresenter() { return presenter; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = View.inflate(getActivity(), R.layout.fragment_home, null); initView(); initData(); return view; } private void initData() { List urlList = new ArrayList<>(); urlList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1543221773&di=c63f30c7809e518cafbff961bcd9ec2a&imgtype=jpg&er=1&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F0116605851154fa8012060c8587ca1.jpg"); urlList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1542627042541&di=3ad9deeefff266e76d1f5d57a58f63d1&imgtype=0&src=http%3A%2F%2Fpic.90sjimg.com%2Fdesign%2F00%2F69%2F99%2F66%2F9fce5755f081660431464492a9aeb003.jpg"); urlList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1542627042539&di=95bd41d43c335e74863d9bb540361906&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F019a0558be22d6a801219c77d0578a.jpg%402o.jpg"); urlList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1542627042539&di=cdd54bffd2aac448c70ae6b416a004d4&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F01edb3555ea8100000009af0ba36f5.jpg%401280w_1l_2o_100sh.jpg"); homeBanner.initBanner(urlList, true)//开启3D画廊效果 .addPageMargin(-12, 20)//参数1page之间的间距,参数2中间item距离边界的间距 .addPoint(6)//添加指示器 .addStartTimer(3)//自动轮播间隔 .addPointBottom(7) .addRoundCorners(5)//圆角 .finishConfig()//这句必须加 .addBannerListener(new BannerViewPager.OnClickBannerListener() { @Override public void onBannerClick(int position) { //点击item showShort("效果1点击" + position); Log.i("test", "--------------position:" + position); } }); List<MenuEntity> list = new ArrayList<>(); for (int i = 0; i < 3; i++) { MenuEntity menuEntity = new MenuEntity(); menuEntity.setTitle("一级分类" + i); List<MenuEntity.MenuItemEntity> menuItemEntityList = new ArrayList<>(); for (int k = 0; k < 4; k++) { MenuEntity.MenuItemEntity menuItemEntity = new MenuEntity.MenuItemEntity(); menuItemEntity.setName("二级分类" + k); menuItemEntityList.add(menuItemEntity); } menuEntity.setMenuItemEntityList(menuItemEntityList); list.add(menuEntity); } adapter.setList(list); adapter.notifyDataSetChanged(); homeBanner.setFocusable(true); homeBanner.setFocusableInTouchMode(true); } private void initView() { homeBanner = view.findViewById(R.id.home_banner); homeBt1 = view.findViewById(R.id.home_bt1); homeBt1.setOnClickListener(this); homeMenu = view.findViewById(R.id.home_menu); adapter = new MenuItemLvAdapter(getActivity()); homeMenu.setAdapter(adapter); } /** * @param text */ public void showShort(String text) { if (toast == null) toast = Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT); else toast.setText(text); toast.show(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.home_bt1: MyTradeOrderActivity.start(getActivity()); break; } } }
true
fd02d9ec2bbf766546b0e78cd32be6f914390529
Java
rodrigojasa/api-taxi24
/src/main/java/com/taxi/dominio/properties/ApplicationProperties.java
UTF-8
308
1.953125
2
[]
no_license
package com.taxi.dominio.properties; /** * * @author rjacome */ public interface ApplicationProperties<T> { /** * Obtener propiedades de archivo de configuracion * @param source * @return * @throws Exception */ public T getProperties(String source) throws Exception; }
true
30fb130836c5128647e10f9beabb37536cb81d89
Java
leeqiang250/Android_Reader
/PengBaoBao/src/main/java/cn/com/pyc/media/MediaBaseAdapter.java
UTF-8
9,548
2.296875
2
[ "MIT" ]
permissive
package cn.com.pyc.media; import android.content.Context; import android.graphics.Bitmap; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.view.LayoutInflater; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.BaseAdapter; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import com.qlk.util.global.GlobalLruCache; import com.qlk.util.media.ISelection; import com.qlk.util.tool.Util.ScreenUtil; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import cn.com.pyc.pbb.reader.R; import cn.com.pyc.utils.Dirs; /** * 适用于本程序的Video、Music、Pdf、Image的Adapter <br> * 调用类退出时最好调用下本类的exit()方法 * * @author QiLiKing 2015-7-30 上午11:04:00 */ public abstract class MediaBaseAdapter extends BaseAdapter implements ISelection { private final ArrayList<String> mPaths; // 数据源 protected final Context mContext; protected final LayoutInflater mInflater; private Bitmap mDefaultBitmap; // 默认显示的图片 protected int mThumbSize; private BlockingQueue<String> mThumbTasks; private ThumbThread mThread1, mThread2; private int mScrollState; public MediaBaseAdapter(Context context, ArrayList<String> paths) { mContext = context; mPaths = paths; mInflater = LayoutInflater.from(context); if (isSupportThumbView()) { mThumbSize = ScreenUtil.getScreenWidth(context) / 3; mDefaultBitmap = MyBitmapFactory.getResourcesThumbnail(context, R.drawable.media_default, mThumbSize); mThumbTasks = new LinkedBlockingQueue<>(); } setSelectListener(null); } public void changeScrollState(AbsListView view, int state) { mScrollState = state; if (state == OnScrollListener.SCROLL_STATE_IDLE) { refresh(view); } } /** * 是否支持缩略图浏览,如果是则需要重写getThumbTask * * @return */ protected abstract boolean isSupportThumbView(); /** * 各个子类实现,如果不需要缩略图,则不用重写 * <p> * 实现:需要将取到的缩略图存储于GLC中 * <p> * 操作之前再次检查GLC中是否有缓存了 * * @param path * @return */ protected Runnable getThumbTask(String path) { return null; } /** * 结束线程 */ public void exit() { if (mThread1 != null && mThread1.isAlive()) { mThread1.interrupt(); } if (mThread2 != null && mThread2.isAlive()) { mThread2.interrupt(); } } /** * 只有这个方法才会加载缩略图 * * 要刷新的第一个item * 从第一个item开始刷新total个 */ public void refresh(AbsListView view) { if (!isSupportThumbView()) { notifyDataSetChanged(); return; } // 主要提防删除 int first = view.getFirstVisiblePosition(); int last = view.getLastVisiblePosition(); if (last > mPaths.size() - 1) { last = mPaths.size() - 1; } /* 是否有缩略图需要更新 */ mThumbTasks.clear(); // 清空已不可见的加载任务 for (int i = first; i <= last; i++) { final String path = mPaths.get(i); Bitmap bm = GlobalLruCache.getGLC().get(path); if (bm == null || bm.isRecycled()) { startThread(); // 1分钟超时,thread就被终止了 mThumbTasks.offer(path); } } /*- * 以上操作只有在新加入缩略图时才刷新,但如果是某些图片被删除则也需要更新 */ notifyDataSetChanged(); } private void startThread() { if (mThread1 == null || !mThread1.isAlive()) { mThread1 = new ThumbThread(); mThread1.start(); } if (mThread2 == null || !mThread2.isAlive()) { mThread2 = new ThumbThread(); mThread2.start(); } } private final Handler mRefreshHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { super.handleMessage(msg); notifyDataSetChanged(); } }; class ThumbThread extends Thread { @Override public void run() { super.run(); while(true) { try { String path = mThumbTasks.poll(1, TimeUnit.MINUTES); if (path == null) { break; // 1分钟还没有新任务就退出线程,节省资源 } getThumbTask(path).run(); mRefreshHandler.sendEmptyMessage(0); } catch (InterruptedException e) { e.printStackTrace(); } } } } // private class ThumbTask implements Runnable // { // private ReturnInfo info; // // /** // * desPath和desBuffer置空表示明文阅读,有一个不为空表示密文阅读 // * // * @param srcPath // * @param desPath // * @param desBuffer // */ // public ThumbTask(ReturnInfo info) // { // this.info = info; // } // // @Override // public void run() // { // // desBuffer或者desPath不为空时肯定是密文图片的缩略图 // Bitmap thumb = null; // if (info.desBuffer != null) // { // thumb = MyBitmapFactory.getImageThumbnail(info.desBuffer, // mThumbSize); // } // else if (info.desPath != null) // { // thumb = MyBitmapFactory.getImageThumbnail(info.desPath, // mThumbSize); // } // else // { // if (type.equals(GlobalData.Video)) // { // thumb = MyBitmapFactory.getVideoThumbnail(info.srcPath, // mThumbSize); // } // else // { // thumb = MyBitmapFactory.getImageThumbnail(info.srcPath, // mThumbSize); // } // } // // // 有的图片不能生成缩略图,put的话会出错 // if (thumb != null) // { // GlobalLruCache.getGLC().put(info.srcPath, thumb); // PbbBaseActivity.UIHandler.post(refreshRunnable); // } // } // } // 因缩略图是异步加载,所以在未得出缩略图之前要显示默认图片 protected Bitmap getBitmap(int position) { String path = mPaths.get(position); Bitmap bm = GlobalLruCache.getGLC().get(path); if (bm == null || bm.isRecycled()) { bm = mDefaultBitmap; if (mScrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { startThread(); // 1分钟超时,thread就被终止了 mThumbTasks.offer(path); } } return bm; } @Override public int getCount() { return mPaths.size(); } @Override public String getItem(int position) { return mPaths.get(position); } @Override public long getItemId(int position) { return 0; } /*-********************************************* * TODO Select ***********************************************/ private ISelectListener mSelectListener; protected final HashSet<String> mSelectPaths = new HashSet<>(); /** Used by subclass. */ protected boolean isSelectable = false; @Override public void setSelectListener(ISelectListener listener) { mSelectListener = listener; if (mSelectListener == null) { mSelectListener = new ISelectListener() { @Override public void onSelcetChanged(boolean overflow, int total, boolean allSelected) { /* Do not care the listener's value is null when using. */ } }; } } @Override public void setSelectable(boolean selectable) { this.isSelectable = selectable; /* In select mode, user may call setItemSelect(). */ if (!selectable) { mSelectPaths.clear(); } notifyDataSetChanged(); mSelectListener.onSelcetChanged(false, mSelectPaths.size(), mSelectPaths.size() == mPaths.size()); } @Override public void clearSelected() { mSelectPaths.clear(); notifyDataSetChanged(); mSelectListener.onSelcetChanged(false, mSelectPaths.size(), mSelectPaths.size() == mPaths.size()); } @Override public boolean isSelecting() { return isSelectable; } @Override public void setItemSelected(int position) { if (position < 0) { return; } String path = getItem(position); if (mSelectPaths.contains(path)) { mSelectPaths.remove(path); } else { mSelectPaths.add(path); } notifyDataSetChanged(); mSelectListener.onSelcetChanged(isSpaceOverflow(mSelectPaths), mSelectPaths.size(), mSelectPaths.size() == mPaths.size()); } @Override public Collection<String> getSelected() { return mSelectPaths; } private boolean isSpaceOverflow(Collection<String> paths) { long needDiskSpace = 0; for (String path : paths) { needDiskSpace += new File(path).length(); } ArrayList<String> cardsPaths = Dirs.getCardsPaths(); for (String dir : cardsPaths) { if (new File(dir).getUsableSpace() > needDiskSpace) { return false; } } return true; } /** Used by subclass. */ protected OnCheckedChangeListener onCheckedChangedListener = new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String path = (String) buttonView.getTag(); if (isChecked) { mSelectPaths.add(path); } else { mSelectPaths.remove(path); } mSelectListener.onSelcetChanged(isSpaceOverflow(mSelectPaths), mSelectPaths.size(), mSelectPaths.size() == mPaths.size()); } }; }
true
d195e7eb06a029b66dbf2ee2107f4218ed9b7ca4
Java
Rdore88/robot
/src/main/java/Robot/VolcanoRobot.java
UTF-8
1,298
3.078125
3
[]
no_license
package Robot; public class VolcanoRobot { String status; String name; String location; int speed; public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getName() { return name; } public void setName(String name) { this.name = name; } float temperature; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public int getSpeed() { return speed; } public void setSpeed(int speed) { this.speed = speed; } public float getTemperature() { return temperature; } public void setTemperature(float temperature) { this.temperature = temperature; } void checkTemperature() { if (temperature > 660){ status = "returning home"; speed = 5; } } void showAttributes() { System.out.println("Name: " + name); System.out.println("Location: " + location); System.out.println("Status: " + status); System.out.println("Speed: " + speed); System.out.println("temperature: " + temperature); } }
true
9b26619e7732f42f5e231084d0e543c77c92ccfc
Java
Nathan2k/secv
/src/main/java/mbean/ChartPieMBean.java
UTF-8
1,127
2.28125
2
[]
no_license
package mbean; import java.util.List; import javax.faces.bean.ManagedBean; import org.primefaces.model.chart.LegendPlacement; import org.primefaces.model.chart.PieChartModel; import DAO.GraficosDAO; import entity.GraficoPizza; @ManagedBean public class ChartPieMBean { private PieChartModel pieModel1; private GraficosDAO gDao = new GraficosDAO(); public PieChartModel getPieModel1() { return pieModel1; } public ChartPieMBean() { createPieModel1(); } private void createPieModel1() { pieModel1 = initPieChartModel(); pieModel1.setTitle("Cursos"); pieModel1.setLegendPosition("e"); pieModel1.setLegendPlacement(LegendPlacement.INSIDE); pieModel1.setShadow(false); pieModel1.setShowDataLabels(true); } private PieChartModel initPieChartModel() { PieChartModel model = new PieChartModel(); List<GraficoPizza> lista = gDao.contarCurso(); for (GraficoPizza cs : lista) { model.set(cs.getCurso(), cs.getQtd()); model.setSeriesColors( "800000,cc0000,d11a00,d63300,db4c00,e06600,e68000,eb9900,f0b200,f5cc00,fae600,e06600"); } // model.addSeries(boys); return model; } }
true
c7c3ee9305dc7124ce5b2f262160a5db32169ce0
Java
RockwellC09/APD2_Repo_CRockwell
/Release/Ratebox/src/com/RockwellChristopher/ratebox/StoresArrayAdapter.java
UTF-8
1,892
2.859375
3
[]
no_license
/* * Author: Christopher Rockwell * * Project: Ratebox * * Package: com.RockwellChristopher.ratebox * * File: MoviesArrayAdapter.java * * Purpose: This custom array adapter will get the movie title and poster image and populate my ListView. * */ package com.RockwellChristopher.ratebox; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class StoresArrayAdapter extends ArrayAdapter<Store>{ Context context; private TextView storeText; static String TAG = "NETWORK DATA - MAINACTIVITY"; private List<Store> stores = new ArrayList<Store>(); public StoresArrayAdapter(Context context, int textViewResourceId, List<Store> objects) { super(context, textViewResourceId, objects); this.context = context; this.stores = objects; } public Store getItem(int index) { return this.stores.get(index); } // get the ListView row and inflate it public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; // author: Android Cookbook // *** Begin *** // inflate list row if (row == null) { LayoutInflater inflater = (LayoutInflater) this.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.list_row2, parent, false); } // *** End *** // Get item by position Store store = getItem(position); storeText = (TextView) row.findViewById(R.id.storeText); // set list item row values storeText.setText(store.storeStr); // custom typeface for movie title Typeface customFont = Typeface.createFromAsset(getContext().getAssets(), "MarkoOne-Regular.ttf"); storeText.setTypeface(customFont); return row; } }
true
8993a26bd8c6923472617f5e29ed0fd2967f68f8
Java
sleepygarden/Color2
/src/color2/space/Color2Activity.java
UTF-8
5,914
2.625
3
[]
no_license
package color2.space; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; /////////////////////////////////////////////////////////////////////// //Importing android views and widgets is a must for almost every task, //but only Activity and Bundle are auto imported //when you create a new project. You can, however, type //in the code, hover your mouse over the error notification, and the //assist screen that pops up will direct you on the import package /////////////////////////////////////////////////////////////////////// public class Color2Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //importing the res/layout/main.xml file to be used as the main view. //Also, connecting the model and the controller //tying java items to their respective XML components. Also, building specific communication channels in the bridge between Model and Controller final Button buttonBlack = (Button) findViewById(R.id.buttonBlack); final Button buttonRed = (Button) findViewById(R.id.buttonRed); final Button buttonGreen = (Button) findViewById(R.id.buttonGreen); final Button buttonBlue = (Button) findViewById(R.id.buttonBlue); final Button buttonYellow = (Button) findViewById(R.id.buttonYellow); final Button ok = (Button) findViewById(R.id.ok); final TextView screen = (TextView) findViewById(R.id.tvScreen); // final String colorGreen = (String) findViewById(R.string.colorGreen); //Checking is Java/XML item buttonBlack is pressed, then creating an onClick event (prefab code, think toString) buttonBlack.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Color2Activity.this, "Black Selected", Toast.LENGTH_SHORT).show(); //Toast.make a message appear(where, what to display, display duration) display method call //altering the java item 'screen' affects XML item tvScreen instantly, no drawing or refreshing required screen.setBackgroundColor(0xFF000000); screen.setTextColor(0xFFFFFFFF); screen.setText("Hello World! in Black"); screen.setTextSize(18); } }); buttonRed.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Color2Activity.this, "Red Selected", Toast.LENGTH_SHORT).show(); screen.setBackgroundColor(0xFFFF0000); screen.setTextColor(0xFFFFFFFF); screen.setText("Hello World! in Red"); screen.setTextSize(18); } }); buttonGreen.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Color2Activity.this, "Green Selected", Toast.LENGTH_SHORT).show(); screen.setBackgroundColor(0xFF00FF00); screen.setTextColor(0xFF000000); screen.setText("Hello World! in Green"); screen.setTextSize(18); } }); buttonYellow.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Color2Activity.this, "Yellow Selected", Toast.LENGTH_SHORT).show(); screen.setBackgroundColor(0xFFeeee00); screen.setTextColor(0xFF000000); screen.setText("Hello World! in Yellow"); screen.setTextSize(18); } }); buttonBlue.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Color2Activity.this, "Blue Selected", Toast.LENGTH_SHORT).show(); screen.setBackgroundColor(0xFF0000FF); screen.setTextColor(0xff000000); screen.setText("Hello World! in Blue"); screen.setTextSize(18); } }); ok.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Color2Activity.this, "White Selected", Toast.LENGTH_SHORT).show(); screen.setBackgroundColor(0xFFFFFFFF); screen.setTextColor(0xFF000000); screen.setTextSize(9); screen.setText("Hello World! in White. \nIf you've noticed, " + "not only has the background color been changing, the text color " + "has also been changing. \nAll this has been accomplished by tethering " + "our Java TextView item 'screen' to 'tvScreen', a XML item. To modify this 'screen' " + "we also tethered our buttons similarly, and added an OnClick event method. \nAlso, " + "this White block uses smaller text. Another text field you see popping up is " + "a Toast message. It is an easy and convienent system message with a simple format " + "and a modifiable delay. Toast may also output variables using get methods, such " + "as 'tv.getText'. \nYou may use RGB or hex when calling numbers in XML but you must " + "use number format when calling them in Java, or source them " + "from R (auto generated resource class), when they are in number format either way."); } }); } }
true
4e5d0de9eeaa6f3bf2d44be79226964eff20eafb
Java
Fed-or/Mate_Homework
/src/com/fediroryshchuk/homework3/carconstructor/CarWheel.java
UTF-8
897
3.640625
4
[]
no_license
package com.fediroryshchuk.homework3.carconstructor; public class CarWheel { private double tyreIntegrity; private static final double GOOD_TYRE = 1; private static final double BAD_TYRE = 0; public CarWheel() { tyreIntegrity = GOOD_TYRE; } public CarWheel(double stateWheels) { if (stateWheels > BAD_TYRE && stateWheels <= GOOD_TYRE) { this.tyreIntegrity = stateWheels; } } public void changeTyre() { if (tyreIntegrity > 0 && tyreIntegrity < 0.5) { tyreIntegrity = GOOD_TYRE; } } public void toWipeTyre(double wipe) { tyreIntegrity = ((tyreIntegrity - wipe/100) > 0) ? tyreIntegrity : 0; } public double stateTyre() { return tyreIntegrity; } public void printStateType() { System.out.println("Integrity of Tyre is: " + tyreIntegrity); } }
true
36d8438fa62a9c6cbe71179f2a615135bfd03964
Java
GuilhermeINF3A/aula-java-git
/ProjetoGitJava/src/br/edu/ifro/Calculadora.java
UTF-8
453
2.921875
3
[]
no_license
package br.edu.ifro; /** * * @author 02233249224 */ public class Calculadora { public double soma(double num1, double num2){ return num1+num2; } public double subtracao(double num1, double num2){ return num1-num2; } public double multiplica(double num1, double num2){ return num1*num2; } public double divisao(double num1, double num2){ return num1/num2; } }
true
e8c53b92498359a3a35dfd4a900078887bea6573
Java
alisabudur/Final-project-AOP
/src/main/java/security/ILoginService.java
UTF-8
199
1.71875
2
[]
no_license
package security; import org.springframework.security.core.Authentication; /** * Created by Alisa on 5/15/2017. */ public interface ILoginService { Authentication getAuthenticationToken(); }
true
0713faeccd6e65b67bf4837e008360db423ee056
Java
command7/spark_data_lake_capstone
/src/com/datageneration/TitleEpisode.java
UTF-8
678
2.484375
2
[]
no_license
package com.datageneration; import org.json.JSONObject; public class TitleEpisode extends DataUnit { public TitleEpisode() { super("title_episodes_sampled.csv"); } @Override public JSONObject convertToJson(String[] rowData) { JSONObject dataInJson = new JSONObject(); this.insertIntoJsonObject(dataInJson, "tconst", rowData[0], "string"); this.insertIntoJsonObject(dataInJson, "parentTconst", rowData[1], "string"); this.insertIntoJsonObject(dataInJson, "seasonNumber", rowData[2], "integer"); this.insertIntoJsonObject(dataInJson, "episodeNumber", rowData[3], "integer"); return dataInJson; } }
true
dcf3f4310429e3bbe929ce16de7f57049a7c13f2
Java
nagyist/quandl4j
/core/src/main/java/com/jimmoores/quandl/processing/Request.java
UTF-8
491
2.671875
3
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
package com.jimmoores.quandl.processing; /** * Interface implemented by all request classes containing visitor accept * method for RequestProcessors. Also acts as a marker interface. */ public interface Request { /** * Process this request using the provided processor. * @param <T> the type returned by the request processor * @param processor the request processor * @return the result from the request processor */ <T> T accept(RequestProcessor<T> processor); }
true
2139450e548b76e09fe465529b49ae19e2368737
Java
coolyboy/ruoyi-flowable
/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowSaveXmlVo.java
UTF-8
392
1.5
2
[ "MIT" ]
permissive
package com.ruoyi.flowable.domain.dto; import lombok.Data; import java.io.Serializable; /** * @author XuanXuan * @date 2021/3/28 19:48 */ @Data public class FlowSaveXmlVo implements Serializable { /** * 流程名称 */ private String name; /** * 流程分类 */ private String category; /** * xml 文件 */ private String xml; }
true
9ffcfe3bcb742e13a415123598233f135124c1a0
Java
fakhriariza/androidapp
/java/com/lpikitb/lpikitbmobile/Activity/LoginActivity.java
UTF-8
3,422
2.015625
2
[]
no_license
package com.lpikitb.lpikitbmobile.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.lpikitb.lpikitbmobile.R; import com.lpikitb.lpikitbmobile.Network.ApiClient; import com.lpikitb.lpikitbmobile.Network.ApiServices; import com.rengwuxian.materialedittext.MaterialEditText; public class LoginActivity extends AppCompatActivity { MaterialEditText etEmail, etPassword; TextView tvregister; Button btnLogin; ApiServices apiservice; SharedPreferences sp; FirebaseAuth auth; private static final String TAG ="LoginActivity"; protected void onCreate(Bundle saveInstanceState){ super.onCreate(saveInstanceState); setContentView(R.layout.activity_login); auth = FirebaseAuth.getInstance(); etEmail= (MaterialEditText) findViewById(R.id.etemail); etPassword = (MaterialEditText) findViewById(R.id.etpassword); btnLogin = (Button) findViewById(R.id.btnLogin); tvregister = (TextView) findViewById(R.id.tvregister); sp = getSharedPreferences("login",MODE_PRIVATE); apiservice = ApiClient.getClient().create(ApiServices.class); btnLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { loginUser(); } }); tvregister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { register_user(); } }); } private void register_user() { Intent i = new Intent(this,RegisterActivity.class); startActivity(i); } private void loginUser() { String strEmail = etEmail.getText().toString(); String strPassword = etPassword.getText().toString(); if (TextUtils.isEmpty(strEmail) || TextUtils.isEmpty(strPassword)){ Toast.makeText(LoginActivity.this, "Semua Kolom Harus Diisi", Toast.LENGTH_SHORT).show(); } else { auth.signInWithEmailAndPassword(strEmail, strPassword) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()){ Intent intent = new Intent(LoginActivity.this, MainActivity2.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } else { Toast.makeText(LoginActivity.this, "Login Gagal", Toast.LENGTH_SHORT).show(); } } }); } } }
true
e54d29fb751b51389eef23b72c2f727cdb4949c3
Java
abhinavsarma98/ConnectFour
/ConnectFour.java
UTF-8
2,180
2.71875
3
[]
no_license
import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridLayout; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class ConnectFour { static JFrame frame = new JFrame(); static JFrame frame2 = new JFrame(); static JPanel panel = new JPanel(); static JPanel panel2 = new JPanel(); static JPanel panel3 = new JPanel(); static JLabel label = new JLabel(); static JTextField text0 = new JTextField(20); enum lastColor {Red, Yellow}; public static Color oldColor = null; static int redCounter = 0; static int yellowCounter = 0; public static int playerTurn = 0; static int Rows = 7; static int Colums = 6; int turns = 2; static int Board[][] = new int [Rows][Colums]; public static void reset() { text0.setText(""); for(int i =0; i < 7; i++) { for(int j = 0; j< 6; j++) { ConnectFour.GameBoard[i][j].setColor(Color.gray); ConnectFour.GameBoard[i][j].Label.repaint(); } } } public static void main(String[] args) { testerLogic test = new testerLogic(); ConnectFour four = new ConnectFour(); FlowLayout flowl = new FlowLayout(); panel2.setLayout(flowl); panel2.setBackground(Color.BLUE); frame.add(panel2); panel2.add(text0); frame.add(panel2); JButton resetGame = new JButton("Restart"); resetGame.addActionListener(event -> reset()); panel2.add(resetGame); frame.add(panel2); for(int row =0; row < Board.length; row++) { for(int col = 0; col< Board[row].length; col++) { CircleView sview = new CircleView(); frame.add(panel2); panel2.add(sview.Label); frame.add(panel2); myArray.add(sview); GameBoard[row][col] = sview; sview.changeColor(four,row,col); } } frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(380, 470); frame.setVisible(true); frame.setLocation(250, 0); } public static CircleView GameBoard[][] = new CircleView [Rows][Colums]; public static ArrayList<CircleView> myArray = new ArrayList<>(); }
true
439d0902f02f59b58c8f5c472f595841e8851c33
Java
AnantLabs/conquiris
/conquiris/conquiris-core/src/main/java/net/conquiris/api/index/Subindexer.java
UTF-8
1,069
2
2
[]
no_license
/* * Copyright (C) the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.conquiris.api.index; /** * Interface for subindexers. * @author Andres Rodriguez */ public interface Subindexer { /** * Performs part of an indexing batch. * @param writer Writer to use. * @throws IndexException if there's a problem with the index. * @throws InterruptedException if the current task has been interrupted. */ void index(DocumentWriter writer) throws InterruptedException, IndexException; }
true
ecca3f8f88bd900ac9e02c43ab0e857641e5f157
Java
koalaanntree/ssh2-springboot
/src/main/java/com/sam/ssh2springboot/util/DataFormatUtil.java
UTF-8
845
2.140625
2
[]
no_license
package com.sam.ssh2springboot.util; import com.sam.ssh2springboot.dataobject.TopResult; import java.util.Map; import java.util.UUID; /** * @Author: huangxin * @Date: Created in 下午2:09 2018/3/19 * @Description: */ public class DataFormatUtil { public static TopResult formatTopResult(Map<String, String> topResultMap,String hostIp){ TopResult topResult = new TopResult(); topResult.setAlarmId(UUID.randomUUID().toString().substring(0,8)); topResult.setProcessId(topResultMap.get("PID")); topResult.setProcessName(topResultMap.get("CMD")); topResult.setMemPercent(topResultMap.get("MEMPerUsed")); topResult.setCpuPercent(topResultMap.get("CPUPerUsed")); topResult.setProcessState(topResultMap.get("S")); topResult.setHostIP(hostIp); return topResult; } }
true
9e0eaa5b5f0c93bee627fb1e13582a80c0250da9
Java
mtiasp/foodfavorites
/app/src/main/java/se/mtiasp/foodfavorites/model/SearchRepository.java
UTF-8
6,490
2.28125
2
[]
no_license
package se.mtiasp.foodfavorites.model; import android.text.TextUtils; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import io.realm.Case; import io.realm.Realm; import io.realm.RealmQuery; import okhttp3.ResponseBody; import retrofit2.Response; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; import se.mtiasp.foodfavorites.AppApplication; import se.mtiasp.foodfavorites.AppConstants; import se.mtiasp.foodfavorites.SearchContract; import se.mtiasp.foodfavorites.model.api.ApiService; import se.mtiasp.foodfavorites.model.api.response.Food; import se.mtiasp.foodfavorites.model.api.response.FoodResponse; import se.mtiasp.foodfavorites.model.realm.FoodRealmObject; import se.mtiasp.foodfavorites.utils.NetworkUtils; import timber.log.Timber; public class SearchRepository implements SearchContract.Model { @Inject public ApiService apiService; private Realm realmUI; private Subscription fetchSubscription; private String query; private SearchContract.Presenter presenter; public SearchRepository() { AppApplication.getInstance().getApiServiceComponent().inject(this); realmUI = Realm.getDefaultInstance(); } @Override public void setPresenter(SearchContract.Presenter presenter) { this.presenter = presenter; } @Override public void searchForFood(String query) { this.query = query; if (NetworkUtils.isNetworkConnected(AppApplication.getInstance())) { Timber.d("Online"); fetchAndStoreResultsFromAPI(query); } else { Timber.d("Offline"); fetchResultsFromRealm(); } } private void fetchAndStoreResultsFromAPI(String query) { fetchSubscription = apiService.getFood(AppConstants.TOKEN, query) .subscribeOn(Schedulers.io()) .observeOn(Schedulers.computation()) .map(this::writeToRealm) .observeOn(AndroidSchedulers.mainThread()) .subscribe(foodList -> fetchResultsFromRealm(), this::handleApiError); } private List<Food> writeToRealm(Response<FoodResponse> foodResponse) { List<Food> foodList = new ArrayList<>(); try { foodList = foodResponse.body().getFood(); } catch (Exception e ) { Timber.d("No foodlist in response"); return null; } for (Food food : foodList) { Realm realm = Realm.getDefaultInstance(); realm.executeTransaction(transactionRealm -> { FoodRealmObject foodRealm = findInRealm(transactionRealm, food.getId()); if (foodRealm == null) { foodRealm = transactionRealm.createObject(FoodRealmObject.class, food.getId()); } foodRealm.setTitle(food.getTitle()); foodRealm.setCaloriesDescription(extractCaloriesDescription(food)); }); realm.close(); } return foodList; } private FoodRealmObject findInRealm(Realm realm, Integer id) { return realm.where(FoodRealmObject.class).equalTo("id", id).findFirst(); } private void handleApiError(Throwable e) { Timber.e(e.getLocalizedMessage()); fetchResultsFromRealm(); } private void fetchResultsFromRealm() { Timber.d("Reading from db for query: " + this.query); RealmQuery<FoodRealmObject> realmQuery = realmUI.where(FoodRealmObject.class).contains("title", this.query, Case.INSENSITIVE); List<FoodRealmObject> results = realmUI.copyFromRealm(realmQuery.findAllSorted("title")); ArrayList<FoodItem> foodArrayList = new ArrayList<>(); for (FoodRealmObject foodRealmObject : results) { FoodItem foodItem = new FoodItem(foodRealmObject); foodArrayList.add(foodItem); } Timber.d("doCallback"); presenter.onSearchCompleted(foodArrayList); } @Override public void getAllSelectedFoodItems() { RealmQuery<FoodRealmObject> query = realmUI.where(FoodRealmObject.class).equalTo("isSelected", true); List<FoodRealmObject> results = realmUI.copyFromRealm(query.findAllSorted("title")); ArrayList<FoodItem> foodArrayList = new ArrayList<>(); for (FoodRealmObject foodRealmObject : results) { Timber.d("Fetched from realm: " + foodRealmObject.getTitle() + " for query: " + this.query); FoodItem foodItem = new FoodItem(foodRealmObject); foodArrayList.add(foodItem); } presenter.onAllSelectedFoodFetched(foodArrayList); } @Override public void updateSelectedForFoodItem(FoodItem foodItem, boolean selected) { Realm realm = Realm.getDefaultInstance(); realm.executeTransaction(transactionRealm -> { FoodRealmObject foodRealm = findInRealm(transactionRealm, foodItem.getId()); foodRealm.setSelected(selected); }); realm.close(); } @Override public void onDestroy() { if (fetchSubscription != null) { fetchSubscription.unsubscribe(); } realmUI.close(); } private String extractCaloriesDescription(Food food) { String caloriesDescription = ""; try { float caloriesPer100Gram = food.getCalories(); // hack to avoid unrealistic values since I don't understand the model yet :-) if (caloriesPer100Gram > 1000) { return ""; } float caloriesPerGram = caloriesPer100Gram / 100; Double servingInGram; if (!TextUtils.isEmpty(food.getPcstext())) { servingInGram = food.getPcsingram(); } else { servingInGram = food.getGramsperserving(); } String calories; if (servingInGram != null && servingInGram > 0) { long caloriesPerPcsRounded = Math.round(caloriesPerGram * servingInGram); calories = String.valueOf(caloriesPerPcsRounded); } else { return ""; } caloriesDescription = calories + " kcal"; } catch (Exception e) { Timber.e(e, "Failed to calculate kcal"); } return caloriesDescription; } }
true
6f86f23c091a5825b1c90ee7f43a242fdd25d2b2
Java
Suryansh-Bhadouria-007/gfg
/leetcode/src/main/java/PreDivBy5.java
UTF-8
1,487
3.34375
3
[]
no_license
import java.util.Arrays; public class PreDivBy5 { private static String processNumber(int A[]) { int length = A.length; StringBuilder sb = new StringBuilder(); StringBuilder result = new StringBuilder(); if (length % 2 != 0) { sb.append('0'); length += 1; } for (int elem : A) { sb.append(elem); } for (int i = length - 1; i >= 0; i = i - 2) { char lsbChar = sb.charAt(i); char msbChar = sb.charAt(i - 1); int lsb = lsbChar == '0' ? 0 : 1; int msb = msbChar == '0' ? 0 : 1; int base4Digit = lsb * 1 + msb * 2; result.append(base4Digit); } return result.reverse().toString(); } private static boolean checkDivisibiltyBy11(String number) { int isOddDigit = 1; int odd_sum = 0, even_sum = 0; for (int i = 0; i < number.length(); i++) { // if digit of base 4 is at odd place, then // add it to odd_sum if (isOddDigit != 0) odd_sum += number.charAt(i); // else digit of base 4 is at even place, // add it to even_sum else even_sum += number.charAt(i); isOddDigit ^= 1; } if (Math.abs(odd_sum - even_sum) % 5 == 0) return true; return false; } public static void main(String[] args) { } }
true
9d97f04c977364b0fccee238c56af39783afda47
Java
infernix/Cloudfeeds
/src/net/cloudfeeds/exception/ErrorViewExceptionResolver.java
UTF-8
785
2.078125
2
[]
no_license
package net.cloudfeeds.exception; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; public class ErrorViewExceptionResolver extends SimpleMappingExceptionResolver { @Override protected Integer determineStatusCode(HttpServletRequest request, String viewName) { return Integer.parseInt(viewName); } @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { //logException(ex, request); logger.warn("Error", ex); return super.resolveException(request, response, handler, ex); } }
true
3ba3523990099d85553efa9ad0325e2eb98ba64b
Java
rogervaas/Mutters
/mutters-templated-intent/src/test/java/com/rabidgremlin/mutters/TestDateSlot.java
UTF-8
8,164
2.484375
2
[ "Apache-2.0" ]
permissive
/* Licensed under Apache-2.0 */ package com.rabidgremlin.mutters; import static com.google.common.truth.Truth.assertThat; import java.time.LocalDate; import java.util.Locale; import java.util.TimeZone; import org.junit.jupiter.api.Test; import com.rabidgremlin.mutters.core.Context; import com.rabidgremlin.mutters.core.SlotMatch; import com.rabidgremlin.mutters.core.Slots; import com.rabidgremlin.mutters.slots.DateSlot; import com.rabidgremlin.mutters.templated.SimpleTokenizer; import com.rabidgremlin.mutters.templated.TemplatedUtterance; import com.rabidgremlin.mutters.templated.TemplatedUtteranceMatch; class TestDateSlot { private final SimpleTokenizer tokenizer = new SimpleTokenizer(); @Test void testBasicMatch() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("for the {date}")); String[] input = tokenizer.tokenize("for the 30th May 1974"); Slots slots = new Slots(); Context context = new Context(); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); assertThat(match.getSlotMatches()).hasSize(1); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); assertThat(slotMatch).isNotNull(); assertThat(slotMatch.getOriginalValue()).isEqualTo("30th May 1974"); assertThat(slotMatch.getValue()).isEqualTo(LocalDate.of(1974, 5, 30)); } @Test void testMatchWithTimeZone() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("for the {date}")); String[] input = tokenizer.tokenize("for the 30th May 1974"); Slots slots = new Slots(); Context context = new Context(); context.setTimeZone(TimeZone.getTimeZone("Africa/Johannesburg")); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); assertThat(match.getSlotMatches()).hasSize(1); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); assertThat(slotMatch).isNotNull(); assertThat(slotMatch.getOriginalValue()).isEqualTo("30th May 1974"); assertThat(slotMatch.getValue()).isEqualTo(LocalDate.of(1974, 5, 30)); } @Test void testDontMatchOnJustTime() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("10pm"); Slots slots = new Slots(); Context context = new Context(); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isFalse(); } @Test void testNZDateFullNumeric() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("20/5/2016"); Slots slots = new Slots(); Context context = new Context(); context.setLocale(new Locale("en", "NZ")); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); LocalDate dateMatch = (LocalDate) slotMatch.getValue(); assertThat(dateMatch.getDayOfMonth()).isEqualTo(20); assertThat(dateMatch.getMonth().getValue()).isEqualTo(5); assertThat(dateMatch.getYear()).isEqualTo(2016); } @Test void testNZDateShortYear() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("20/5/16"); Slots slots = new Slots(); Context context = new Context(); context.setLocale(new Locale("en", "NZ")); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); LocalDate dateMatch = (LocalDate) slotMatch.getValue(); assertThat(dateMatch.getDayOfMonth()).isEqualTo(20); assertThat(dateMatch.getMonth().getValue()).isEqualTo(5); assertThat(dateMatch.getYear()).isEqualTo(2016); } @Test void testNZDateDayMonthOnly() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("20/5"); Slots slots = new Slots(); Context context = new Context(); context.setLocale(new Locale("en", "NZ")); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); LocalDate dateMatch = (LocalDate) slotMatch.getValue(); assertThat(dateMatch.getDayOfMonth()).isEqualTo(20); assertThat(dateMatch.getMonth().getValue()).isEqualTo(5); assertThat(dateMatch.getYear()).isEqualTo(LocalDate.now().getYear()); } @Test void testNZDateDayMonthAsTextOnly() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("1 dec"); Slots slots = new Slots(); Context context = new Context(); context.setLocale(new Locale("en", "NZ")); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); LocalDate dateMatch = (LocalDate) slotMatch.getValue(); assertThat(dateMatch.getDayOfMonth()).isEqualTo(1); assertThat(dateMatch.getMonth().getValue()).isEqualTo(12); assertThat(dateMatch.getYear()).isEqualTo(LocalDate.now().getYear()); } // TODO handle different TZ in context @Test void testToday() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("today"); Slots slots = new Slots(); Context context = new Context(); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); LocalDate dateMatch = (LocalDate) slotMatch.getValue(); LocalDate today = LocalDate.now(); assertThat(dateMatch).isEqualTo(today); } // TODO handle different TZ in context @Test void testTomorrow() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("tomorrow"); Slots slots = new Slots(); Context context = new Context(); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isTrue(); SlotMatch<?> slotMatch = match.getSlotMatches().get(slot); LocalDate dateMatch = (LocalDate) slotMatch.getValue(); LocalDate tommorrow = LocalDate.now().plusDays(1); assertThat(dateMatch).isEqualTo(tommorrow); } @Test void testMismatch() { TemplatedUtterance utterance = new TemplatedUtterance(tokenizer.tokenize("{date}")); String[] input = tokenizer.tokenize("book auckland to wellington for friday"); Slots slots = new Slots(); Context context = new Context(); DateSlot slot = new DateSlot("date"); slots.add(slot); TemplatedUtteranceMatch match = utterance.matches(input, slots, context); assertThat(match).isNotNull(); assertThat(match.isMatched()).isFalse(); } }
true
765ccb4a3f92192fa05accc0092afff75705c5cf
Java
UCOld/UnderCurrentBlocks
/src/main/java/undercurrentblocks/definitions/UCMobCounterDefinition.java
UTF-8
705
2.1875
2
[]
no_license
package undercurrentblocks.definitions; import api.undercurrent.iface.UCCollection; import api.undercurrent.iface.UCTileDefinition; import api.undercurrent.iface.editorTypes.InfoEditorType; import net.minecraft.inventory.IInventory; import java.util.List; /** * Created by Niel on 10/16/2015. */ public class UCMobCounterDefinition extends UCTileDefinition { public UCMobCounterDefinition(int mobCount) throws Exception { UCCollection collection = new UCCollection("Mob Counter"); collection.getEditableFields().add(new InfoEditorType("mobCount", "Mob Count", "The amount of mobs around the block", String.valueOf(mobCount))); getCollections().add(collection); } }
true
eb598c91b2dfbb95620c7d302395ef288d550ca4
Java
LoMoon/SpringTutorial
/src/main/Collections/ArrayListDemo.java
UTF-8
632
3.546875
4
[]
no_license
package main.Collections; import java.util.ArrayList; public class ArrayListDemo { public static void main(String[] args) { ArrayList arrayList = new ArrayList(); System.out.println( "Initial size of al: "+ arrayList.size() ); arrayList.add("C"); arrayList.add("A"); arrayList.add("E"); arrayList.add("B"); arrayList.add("D"); arrayList.add("F"); arrayList.add(1, "A2"); System.out.println("Size of al after additions: " + arrayList.size()); // display the array list System.out.println("Contents of al: " + arrayList); } }
true
f743648adef04128a257d025c1a9420bed8a7230
Java
Glenn-Aaron-Fisher-BP/CircleReboot
/src/Shapes/Circle.java
UTF-8
625
2.796875
3
[]
no_license
package Shapes; import Points.Point; public class Circle { Point center; int scale; double radius; double thickness; CircleData circleData; Circle (Point center, int scale, double radius, double thickness) { this.center = center; this.scale = scale; this.radius = radius; this.thickness = thickness; } public interface CircleData { double sampleSize(Point center, double radius, double thickness); double error(Point center, double radius, double thickness); double[] gradient(Point center, double radius, double thickness); } }
true
5d55b474ab9a3630dc1d539755eb9bc1a8c5070a
Java
smilemahi7/ReverseStringProject
/ReverseString.java
UTF-8
306
3.515625
4
[]
no_license
package Practice; public class ReverseString { public static void main(String[] args) { String str = "HELLO"; int len = str.length(); String rev = ""; for(int i=len-1; i>=0; i--) { rev= rev + str.charAt(i); } System.out.println("1st Reverse String = "+rev); } }
true
f43d3200ebd14389cebdc4b5f71f23a0ece4c6ed
Java
zhfang9915/rapp
/rapp-comm/src/main/java/org/rapp/comm/velocity/VelocityTemplate.java
UTF-8
1,941
2.453125
2
[]
no_license
package org.rapp.comm.velocity; import java.io.IOException; import java.io.StringWriter; import java.util.Properties; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.log.NullLogChute; /** * velocity模版 * @author 张芳 * */ public class VelocityTemplate { private Template template = null; public VelocityTemplate() { super(); } public VelocityTemplate(String templateSrc) { try { Properties p = new Properties(); p.put("file.resource.loader.class","org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); p.setProperty(Velocity.ENCODING_DEFAULT, "UTF-8"); p.setProperty(Velocity.INPUT_ENCODING, "UTF-8"); p.setProperty(Velocity.OUTPUT_ENCODING, "UTF-8"); Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new NullLogChute()); Velocity.init(p); try { template = Velocity.getTemplate(templateSrc); } catch (ResourceNotFoundException rnfe) { System.out.println("Example : error : cannot find template " + templateSrc); } catch (ParseErrorException pee) { System.out.println("Example : Syntax error in template " + templateSrc + ":" + pee); } } catch (Exception e) { e.printStackTrace(); } } public String merge(VelocityContext context){ String msg=null; StringWriter sw=null; try { sw=new StringWriter(); if (template!=null){ template.merge(context, sw); msg = sw.toString(); } sw.flush(); } catch (Exception e) { e.printStackTrace(); }finally{ try { if(sw!=null){ sw.close(); } } catch (IOException e) { e.printStackTrace(); } } return msg; } }
true
725fef580ea929803ea790cd84e55d25ef78af1e
Java
mmnaseri/spring-data-mock
/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimestampDateLastModifiedDate.java
UTF-8
711
2.21875
2
[ "MIT" ]
permissive
package com.mmnaseri.utils.spring.data.sample.models; import org.springframework.data.annotation.LastModifiedDate; import java.sql.Timestamp; /** * @author Milad Naseri (m.m.naseri@gmail.com) * @since 1.0 (4/12/16, 5:20 PM) */ @SuppressWarnings("unused") public class EntityWithTimestampDateLastModifiedDate { private String id; @LastModifiedDate private Timestamp lastModifiedDate; public String getId() { return id; } public void setId(String id) { this.id = id; } public Timestamp getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(Timestamp lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } }
true
78cb87888c6aa47aca88975402ec5b0076069605
Java
NomBytes/Paint
/src/controller/AbstractAnimation.java
UTF-8
3,178
3.125
3
[]
no_license
/** * */ package controller; import java.awt.event.ActionListener; import java.awt.geom.GeneralPath; import java.awt.geom.Path2D; import java.awt.geom.Point2D; import java.awt.geom.RectangularShape; import java.util.List; import javax.swing.JPanel; import model.ArtModel; import model.ShapeProperties; /** * Project 2 * TCSS 305 * @author Athena Castillo * @version 6/11/15 */ public abstract class AbstractAnimation implements ActionListener{ /** * artmodel. */ protected ArtModel myArtMod; /** * the pane. */ protected JPanel myPanel; /** * horizontal movement. */ protected int myHorizontalMove; /** * vertical movement. */ protected int myVerticalMove; /** * my speed. */ protected int mySpeed; /** * list of shape props. */ protected List<ShapeProperties> myShapePropList; /** * * @param thePanel panel being animated on. * @param theArtMod model being used. */ public AbstractAnimation(final JPanel thePanel, final ArtModel theArtMod) { myPanel = thePanel; myArtMod = theArtMod; myShapePropList = myArtMod.getList(); mySpeed = 1; myHorizontalMove = mySpeed; myVerticalMove = mySpeed; } /** * steps foward the animation. */ public abstract void fastForward(); /** * updates horizontal movement. */ public void updateHorizontalMove() { for (ShapeProperties i : myShapePropList) { if (i.getShape() instanceof RectangularShape) { if (((RectangularShape) i.getShape()).getMaxX() > myPanel.getWidth()) { myHorizontalMove = -mySpeed; }else if(i.getShape() instanceof Path2D){ Point2D point = ((GeneralPath) i.getShape()).getCurrentPoint(); if(point.getX() > myPanel.getWidth()){ myVerticalMove = -mySpeed; }else if(point.getX() <= 0){ myVerticalMove = mySpeed; } } } } } /** * updates vertical movement. */ public void updateVerticalMove() { for (ShapeProperties i : myShapePropList) { if (i.getShape() instanceof RectangularShape) { if (((RectangularShape) i.getShape()).getMaxY() > myPanel.getHeight()) { myVerticalMove = -mySpeed; } else if (((RectangularShape) i.getShape()).getMinY() <= 0) { myVerticalMove = mySpeed; //System.out.println("updateHorizontalMove() in animation 1"); //System.out.println(horizontalMove); } }else if(i.getShape() instanceof Path2D){ Point2D point = ((GeneralPath) i.getShape()).getCurrentPoint(); if(point.getY() > myPanel.getHeight()){ myVerticalMove = -mySpeed; }else if(point.getY() <= 0){ myVerticalMove = mySpeed; } } } } }
true
525f553e8fcdb90d54742bff88f384a828b89582
Java
mesilat/oracle-htp-plugin
/src/main/java/com/mesilat/ora/PlsqlCacheImpl.java
UTF-8
7,177
1.976563
2
[]
no_license
package com.mesilat.ora; import com.atlassian.confluence.core.BodyContent; import com.atlassian.confluence.event.events.content.page.PageCreateEvent; import com.atlassian.confluence.event.events.content.page.PageRemoveEvent; import com.atlassian.confluence.event.events.content.page.PageRestoreEvent; import com.atlassian.confluence.event.events.content.page.PageTrashedEvent; import com.atlassian.confluence.event.events.content.page.PageUpdateEvent; import com.atlassian.confluence.pages.Page; import com.atlassian.confluence.pages.PageManager; import com.atlassian.event.api.EventListener; import com.atlassian.event.api.EventPublisher; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; public class PlsqlCacheImpl implements PlsqlCache, InitializingBean, DisposableBean { private static final String MACRO_DEFAULT = "__DEFAULT__"; private static final Logger LOGGER = LoggerFactory.getLogger("oracle-htp-plugin"); private static PlsqlCacheImpl instance; private final PageManager pageManager; private final EventPublisher eventPublisher; private final Map<Long,Map<String, MacroInfo>> cache = new HashMap<>(); @Override public void afterPropertiesSet() throws Exception { eventPublisher.register(this); instance = this; LOGGER.debug("Page event listener started"); } @Override public void destroy() throws Exception { eventPublisher.unregister(this); instance = null; LOGGER.debug("Page event listener stopped"); } @EventListener public void onPageCreateEvent(PageCreateEvent event) { synchronized(cache){ cache.remove(event.getPage().getId()); } } @EventListener public void onPageUpdateEvent(PageUpdateEvent event) { synchronized(cache){ cache.remove(event.getPage().getId()); } } @EventListener public void pageTrashedEvent(PageTrashedEvent event) { synchronized(cache){ cache.remove(event.getPage().getId()); } } @EventListener public void pageRemoveEvent(PageRemoveEvent event) { synchronized(cache){ cache.remove(event.getPage().getId()); } } @EventListener public void pageRestoreEvent(PageRestoreEvent event) { synchronized(cache){ cache.remove(event.getPage().getId()); } } private void parse(Page page){ Map<String, MacroInfo> macros = parsePage(page); synchronized(cache){ cache.put(page.getId(), macros); } } public Map<String, MacroInfo> parsePage(Page page){ Map<String, MacroInfo> macros = new HashMap<>(); for (BodyContent content : page.getBodyContents()) { Document doc = Jsoup.parse(new StringBuilder() .append("<body>") .append(content.getBody()) .append("</body>") .toString(), ""); for (Element elt : doc.getElementsByTag("ac:structured-macro")) { if (!"oracle-htp-macro".equals(elt.attr("ac:name"))){ continue; } MacroInfo macro = parseMacro(elt); if (macros.isEmpty()) { macros.put(MACRO_DEFAULT, macro); } if (macro.getId() != null){ macros.put(macro.getId(), macro); } } } return macros; } public MacroInfo parseMacro(Element macro) { String macroId = null; StringBuilder body = new StringBuilder(); Map<String,String> params = new HashMap<>(); for (Element bodyElt : macro.getElementsByTag("ac:plain-text-body")) { String text = getText(bodyElt); body.append(text); } for (Element paramElt : macro.getElementsByTag("ac:parameter")){ String text = getText(paramElt); params.put(paramElt.attr("ac:name"), text); if ("myid".equals(paramElt.attr("ac:name"))){ macroId = text; } } String _body = body.toString(); if (macroId == null || macroId.isEmpty()){ macroId = createMacroKey(_body, params); } return new MacroInfo(macroId, _body, params); } protected static String getText(Element elt) { StringBuilder sb = new StringBuilder(); for (Node node : elt.childNodes()) { if (node instanceof TextNode) { TextNode txt = (TextNode)node; sb.append(txt.getWholeText()); } } return sb.toString(); } public static String createMacroKey(String body, Map<String,String> params){ try { byte[] separator = "~\n~".getBytes(); MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(body.getBytes()); for (Entry<String,String> e : params.entrySet()){ if (": = | RAW | = :".equals(e.getKey())){ continue; } md.update(separator); md.update(e.getKey().getBytes()); md.update(separator); md.update(e.getValue().getBytes()); } UUID id = UUID.nameUUIDFromBytes(md.digest()); return id.toString(); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex); } } public PlsqlCacheImpl(PageManager pageManager, EventPublisher eventPublisher) { this.pageManager = pageManager; this.eventPublisher = eventPublisher; } public MacroInfo _getMacroInfo(long pageId, String macroId) { synchronized(cache){ if (cache.containsKey(pageId)){ Map<String, MacroInfo> map = cache.get(pageId); String key = (macroId == null || macroId.isEmpty())? MACRO_DEFAULT: macroId; return map.get(key); } } Page page = pageManager.getPage(pageId); if (page == null){ return null; } else { parse(page); } synchronized(cache){ if (cache.containsKey(pageId)){ Map<String, MacroInfo> map = cache.get(pageId); String key = (macroId == null || macroId.isEmpty())? MACRO_DEFAULT: macroId; return map.get(key); } } return null; } public static MacroInfo getMacroInfo(long pageId, String macroId){ if (instance == null){ return null; } else { return instance._getMacroInfo(pageId, macroId); } } }
true
8df326867ef3eb5ba07cb7f1f8b6b59c225e698c
Java
zhengqingya/java-workspace
/SpringBoot系列/10-整合MinIO实现文件上传与下载/分片上传&断点续传&秒传/demo/demo-api/src/main/java/com/zhengqing/demo/model/vo/FileUploadVO.java
UTF-8
1,198
2.15625
2
[ "MIT" ]
permissive
package com.zhengqing.demo.model.vo; import io.minio.messages.Part; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; /** * <p>文件上传-响应参数</p> * * @author zhengqingya * @description * @date 2023/01/05 16:40 */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @ApiModel public class FileUploadVO { @ApiModelProperty("是否上传完成(1:是 0:否)") private Boolean isFinish; @ApiModelProperty("文件地址") private String path; @ApiModelProperty("上传记录") private TaskRecord taskRecord; @Data @Builder @NoArgsConstructor @AllArgsConstructor public static class TaskRecord { @ApiModelProperty("文件唯一标识(md5)") private String fileMd5; @ApiModelProperty("每个分片大小(byte)") private Long chunkSize; @ApiModelProperty("分片数量") private Integer chunkNum; @ApiModelProperty("已上传完的分片") private List<Part> exitPartList; } }
true
21e36d6c953c3611083635d7bf255fa4408098a6
Java
jcustovic/CChat
/CChat/src/main/java/hr/chus/cchat/struts2/action/common/Default.java
UTF-8
307
1.625
2
[]
no_license
package hr.chus.cchat.struts2.action.common; import com.opensymphony.xwork2.ActionSupport; /** * Web GET or POST action that returns nothing (Struts2 SUCCESS is always returned). * * @author Jan Čustović (jan.custovic@gmail.com) */ @SuppressWarnings("serial") public class Default extends ActionSupport { }
true
8c26ddf6f83eaef06b5413915de4f362dff2e792
Java
ad-freiburg/pdfact
/pdfact-core/src/main/java/pdfact/core/pipes/parse/stream/pdfbox/operators/graphic/BeginMarkedContent.java
UTF-8
701
1.921875
2
[ "Apache-2.0" ]
permissive
package pdfact.core.pipes.parse.stream.pdfbox.operators.graphic; import java.io.IOException; import java.util.List; import org.apache.pdfbox.contentstream.operator.Operator; import org.apache.pdfbox.cos.COSBase; import pdfact.core.model.Page; import pdfact.core.model.Document; import pdfact.core.pipes.parse.stream.pdfbox.operators.OperatorProcessor; /** * BMC: begin marked content. * * @author Claudius Korzen */ public class BeginMarkedContent extends OperatorProcessor { @Override public void process(Document pdf, Page page, Operator op, List<COSBase> args) throws IOException { // context.beginMarkedContent(); } @Override public String getName() { return "BMC"; } }
true
f9b824c20cf5e24580cafa20a4bc68c5402eed6a
Java
apiportal/abyss-portal
/src/main/java/com/verapi/portal/controller/ForgotPasswordPortalController.java
UTF-8
13,872
1.859375
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2019 Verapi Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.verapi.portal.controller; import com.verapi.abyss.common.Config; import com.verapi.abyss.common.Constants; import com.verapi.key.generate.impl.Token; import com.verapi.key.model.AuthenticationInfo; import com.verapi.portal.common.MailUtil; import io.reactivex.Single; import io.reactivex.exceptions.CompositeException; import io.vertx.core.AsyncResult; import io.vertx.core.eventbus.Message; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.ext.sql.ResultSet; import io.vertx.ext.sql.UpdateResult; import io.vertx.reactivex.ext.auth.jdbc.JDBCAuth; import io.vertx.reactivex.ext.jdbc.JDBCClient; import io.vertx.reactivex.ext.sql.SQLConnection; import io.vertx.reactivex.ext.web.RoutingContext; import org.apache.http.HttpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.UnsupportedEncodingException; @AbyssController(routePathGET = "forgot-password", routePathPOST = "forgot-password", htmlTemplateFile = "forgot-password.html", isPublic = true) public class ForgotPasswordPortalController extends AbstractPortalController { private static final Logger LOGGER = LoggerFactory.getLogger(ForgotPasswordPortalController.class); private Integer subjectId; private String subjectUUID; private String email; private String authToken; public ForgotPasswordPortalController(JDBCAuth authProvider, JDBCClient jdbcClient) { super(authProvider, jdbcClient); } @Override public void defaultGetHandler(RoutingContext routingContext) { LOGGER.trace("ForgotPasswordPortalController.defaultGetHandler invoked..."); renderTemplate(routingContext, getClass().getAnnotation(AbyssController.class).htmlTemplateFile()); } @Override public void handle(RoutingContext routingContext) { LOGGER.trace("ForgotPasswordPortalController.handle invoked.."); String username = routingContext.request().getFormAttribute("username"); LOGGER.trace("Received username: {}", username); //TODO: OWASP Email Validate jdbcClient.rxGetConnection().flatMap((SQLConnection resConn) -> resConn .setQueryTimeout(Config.getInstance().getConfigJsonObject().getInteger(Constants.PORTAL_DBQUERY_TIMEOUT)) // Disable auto commit to handle transaction manually .rxSetAutoCommit(false) // Switch from Completable to default Single value .toSingleDefault(Boolean.FALSE) //Check if user already exists .flatMap((Boolean resQ) -> resConn.rxQueryWithParams("SELECT * FROM subject WHERE subjectName = ? and isDeleted = false" , new JsonArray().add(username))) .flatMap((ResultSet resultSet) -> { int numOfRows = resultSet.getNumRows(); if (numOfRows == 0) { LOGGER.error("username NOT found..."); return Single.error(new Exception("Username not found in our records")); } else if (numOfRows == 1) { JsonObject row = resultSet.getRows(true).get(0); if (!row.getBoolean("isActivated")) { LOGGER.error("account connected to username is NOT activated"); return Single.error(new Exception("Please activate your account by clicking the link inside activation mail.")); } else { subjectId = row.getInteger("id"); subjectUUID = row.getString("uuid"); email = row.getString("email"); String displayName = row.getString("display_name"); LOGGER.info("Activated account found:[{}({})]. Email:[{}] Display Name:[{}] Reset password token is going to be created..." , subjectId, subjectUUID, email, displayName); //Generate and Persist Reset Password Token Token tokenGenerator = new Token(); AuthenticationInfo authInfo; try { authInfo = tokenGenerator .generateToken(Config .getInstance() .getConfigJsonObject() .getInteger("token.activation.renewal.password.ttl") * (long) Constants.ONE_MINUTE_IN_SECONDS, username, routingContext.vertx().getDelegate()); LOGGER.trace("Reset Password: token is created successfully: {}", authInfo.getToken()); authToken = authInfo.getToken(); } catch (UnsupportedEncodingException e) { LOGGER.error("Reset Password: tokenGenerator.generateToken: {}", e.getLocalizedMessage()); return Single.error(new Exception("Reset Password: token could not be generated")); } return resConn.rxUpdateWithParams("INSERT INTO subject_activation (" + "organizationId," + "crudSubjectId," + "subjectId," + "expireDate," + "token," + "tokenType, " + "email," + "nonce," + "userData) " + "VALUES (CAST(? AS uuid), CAST(? AS uuid), CAST(? AS uuid), ?, ?, ?, ?, ?, ?)", new JsonArray() .add(Constants.DEFAULT_ORGANIZATION_UUID) .add(Constants.SYSTEM_USER_UUID) .add(subjectUUID) .add(authInfo.getExpireDate()) .add(authInfo.getToken()) .add(Constants.RESET_PASSWORD_TOKEN) .add(email) .add(authInfo.getNonce()) .add(authInfo.getUserData()) ); } } else { LOGGER.error("email is connected to multiple accounts [{}]", numOfRows); return Single.error(new Exception("This email is connected to multiple accounts. " + "Please correct the other accounts by getting help from administration of your organization and try again.")); } }) .flatMap((UpdateResult updateResult) -> { LOGGER.trace("ForgotPasswordPortalController - Deactivating Subject with id:[{}({})] -> {}" , subjectId, subjectUUID, updateResult.getKeys().encodePrettily()); if (updateResult.getUpdated() == 1) { return resConn.rxUpdateWithParams("UPDATE subject SET " + "updated = now()," + "crudSubjectId = CAST(? AS uuid)," + "isActivated = false" + " WHERE " + "id = ?;", new JsonArray() .add(Constants.SYSTEM_USER_UUID) .add(subjectId)); } else { return Single.error(new Exception("Activation Update Error Occurred")); } }) // commit if all succeeded .flatMap((UpdateResult updateResult) -> { if (updateResult.getUpdated() == 1) { LOGGER.trace("Activate Account - Subject Activation Update Result information: {}", updateResult.getKeys().encodePrettily()); return resConn.rxCommit().toSingleDefault(Boolean.TRUE); } else { return Single.error(new Exception("Activation Update Error Occurred")); } }) // Rollback if any failed with exception propagation .onErrorResumeNext(ex -> resConn.rxRollback().toSingleDefault(Boolean.TRUE) .onErrorResumeNext(ex2 -> Single.error(new CompositeException(ex, ex2))) .flatMap(ignore -> Single.error(ex)) ) .doAfterSuccess((Boolean succ) -> { LOGGER.trace("Reset password token is created and persisted successfully"); JsonObject json = new JsonObject(); json.put(Constants.EB_MSG_TOKEN, authToken); json.put(Constants.EB_MSG_TO_EMAIL, email); json.put(Constants.EB_MSG_TOKEN_TYPE, Constants.RESET_PASSWORD_TOKEN); json.put(Constants.EB_MSG_HTML_STRING, MailUtil.renderForgotPasswordMailBody(routingContext, Config .getInstance() .getConfigJsonObject() .getString(Constants.MAIL_BASE_URL) + Constants.RESET_PASSWORD_PATH + "/?v=" + authToken, Constants.RESET_PASSWORD_TEXT)); LOGGER.trace("Forgot Password mail is rendered successfully"); routingContext.vertx().getDelegate().eventBus() .<JsonObject>send(Constants.ABYSS_MAIL_CLIENT, json, (AsyncResult<Message<JsonObject>> result) -> { if (result.succeeded()) { LOGGER.trace("Forgot Password Mailing Event Bus Result: {} | Result: {}" , result, result.result().body().encodePrettily()); } else { LOGGER.error("Forgot Password Mailing Event Bus Result: {} | Cause: {}", result, result.cause().getMessage()); } }); LOGGER.trace("Forgot Password mail is sent to Mail Verticle over Event Bus"); }) // close the connection regardless succeeded or failed .doAfterTerminate(resConn::close) ).subscribe((Boolean result) -> { LOGGER.info("Subscription to Forgot Password successfull: {}", result); showTrxResult(routingContext, LOGGER, HttpStatus.SC_OK , "Reset Password Code is sent to your email address!" , "Please check spam folder also...", "Please click the link inside the mail"); }, (Throwable t) -> { LOGGER.error("Forgot Password Error", t); //Due to OWASP regulations same output should be given even if error occured. showTrxResult(routingContext, LOGGER, HttpStatus.SC_OK , "Reset Password Code is sent to your email address!" , "Please check spam folder also...", "Please click the link inside the mail"); //showTrxResult(routingContext, LOGGER, 401, "Error in Forgot Password Occured!", t.getLocalizedMessage(), ""); } ); } }
true
378b9527ca1623a03257e125574980154c257976
Java
lastwhispers/project
/project-param-validate/src/main/java/cn/lastwhisper/project/validator/annotation/CheckPhone.java
UTF-8
1,085
2.109375
2
[]
no_license
package cn.lastwhisper.project.validator.annotation; import cn.lastwhisper.project.validator.PhoneValidator; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.*; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * * @author lastwhisper * @date 2020/5/28 */ @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER}) @Retention(RUNTIME) @Documented @Constraint(validatedBy = {PhoneValidator.class}) public @interface CheckPhone { // 指定多个时使用 @Target({FIELD, METHOD, PARAMETER, ANNOTATION_TYPE}) @Retention(RUNTIME) @Documented @interface List { CheckPhone[] value(); } // 默认错误消息 String message() default "非法手机号"; // 分组 Class<?>[] groups() default {}; // 负载 Class<? extends Payload>[] payload() default {}; }
true
5d9f3f3af33e9472eed15e29f7b88ac55a66f19b
Java
pengzhetech/leetcode
/editor/cn/IncreasingSubsequences_491.java
UTF-8
995
3.296875
3
[]
no_license
//给定一个整型数组, 你的任务是找到所有该数组的递增子序列,递增子序列的长度至少是2。 // // 示例: // // //输入: [4, 6, 7, 7] //输出: [[4, 6], [4, 7], [4, 6, 7], [4, 6, 7, 7], [6, 7], [6, 7, 7], [7,7], [4,7,7 //]] // // 说明: // // // 给定数组的长度不会超过15。 // 数组中的整数范围是 [-100,100]。 // 给定数组中可能包含重复数字,相等的数字应该被视为递增的一种情况。 // // Related Topics 深度优先搜索 // 👍 217 👎 0 import java.util.List; public class IncreasingSubsequences_491 { public static void main(String[] args) { Solution solution = new IncreasingSubsequences_491().new Solution(); } //leetcode submit region begin(Prohibit modification and deletion) class Solution { public List<List<Integer>> findSubsequences(int[] nums) { return null; } } //leetcode submit region end(Prohibit modification and deletion) }
true
5f6e3293f99bc61e66f7f921282ab0de0175ae2a
Java
jasond1016/learnAlgorithm
/java/leetcode/p0028_implement_strstr/Solution.java
UTF-8
1,536
3.515625
4
[ "Apache-2.0" ]
permissive
package leetcode.p0028_implement_strstr; /** * @author Wang Botai * @date 2022/08/26 18:06 */ public class Solution { public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.strStr("hello", "ll")); // 2 System.out.println(solution.strStr("aaaaa", "bba")); // -1 } public int strStr(String haystack, String needle) { String pat = needle; String txt = haystack; int m = pat.length(); int n = txt.length(); // dp[j][c] = next // 当前是状态 j,遇到了字符 c,应该转义到状态 next int[][] dp = new int[m][256]; // base case dp[0][pat.charAt(0)] = 1; // 为了构建dp数组,需要辅助状态 x // 它永远比当前状态 j 落后一个状态,拥有和 j 最长的相同前缀 int x = 0; for (int i = 1; i < m; i++) { for (int c = 0; c < 256; c++) { if (pat.charAt(i) == c) { // 遇到的字符和 pat 一致,前进一步 dp[i][c] = i + 1; } else { // 不一致则回退,退到哪取决于 x dp[i][c] = dp[x][c]; } } x = dp[x][pat.charAt(i)]; } int j = 0; for (int i = 0; i < n; i++) { j = dp[j][txt.charAt(i)]; if (j == m) { return i - m + 1; } } return -1; } }
true
e270b25d3347dcf0c7e8aee6daaa480e87168078
Java
aws/aws-sdk-java
/aws-java-sdk-quicksight/src/main/java/com/amazonaws/services/quicksight/model/transform/DataBarsOptionsMarshaller.java
UTF-8
2,602
1.820313
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.quicksight.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.quicksight.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * DataBarsOptionsMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DataBarsOptionsMarshaller { private static final MarshallingInfo<String> FIELDID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("FieldId").build(); private static final MarshallingInfo<String> POSITIVECOLOR_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("PositiveColor").build(); private static final MarshallingInfo<String> NEGATIVECOLOR_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("NegativeColor").build(); private static final DataBarsOptionsMarshaller instance = new DataBarsOptionsMarshaller(); public static DataBarsOptionsMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(DataBarsOptions dataBarsOptions, ProtocolMarshaller protocolMarshaller) { if (dataBarsOptions == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dataBarsOptions.getFieldId(), FIELDID_BINDING); protocolMarshaller.marshall(dataBarsOptions.getPositiveColor(), POSITIVECOLOR_BINDING); protocolMarshaller.marshall(dataBarsOptions.getNegativeColor(), NEGATIVECOLOR_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
true
ea16fc645f2c8195bed920ecfb199759545b6abd
Java
abishekvashok/vCare
/app/src/main/java/io/github/pranavgade20/pennapps/BackgroundJobService.java
UTF-8
7,176
1.75
2
[]
no_license
package io.github.pranavgade20.pennapps; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.job.JobParameters; import android.app.job.JobService; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Build; import androidx.annotation.RequiresApi; import androidx.core.app.NotificationCompat; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInOptionsExtension; import com.google.android.gms.fitness.Fitness; import com.google.android.gms.fitness.FitnessOptions; import com.google.android.gms.fitness.data.DataPoint; import com.google.android.gms.fitness.data.DataSet; import com.google.android.gms.fitness.data.DataType; import com.google.android.gms.fitness.data.Field; import com.google.android.gms.fitness.request.DataReadRequest; import com.google.android.gms.fitness.result.DataReadResponse; import com.google.android.gms.fitness.result.DataReadResult; import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.Tasks; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import io.github.pranavgade20.pennapps.networkmanager.Request; import static java.text.DateFormat.getDateInstance; @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class BackgroundJobService extends JobService { private static final String PRIMARY_CHANNEL_ID = "primary_notification_channel"; NotificationManager mNotifyManager; @Override public boolean onStartJob(JobParameters params) { createNotificationChannel(); PendingIntent contentPendingIntent = PendingIntent.getActivity (this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder (this, PRIMARY_CHANNEL_ID) .setContentTitle(getString(R.string.app_name)) .setContentText("Checking your daily activity against our model") .setContentIntent(contentPendingIntent) .setSmallIcon(R.mipmap.ic_launcher_round) .setPriority(NotificationCompat.PRIORITY_HIGH) .setDefaults(NotificationCompat.DEFAULT_ALL) .setAutoCancel(true); mNotifyManager.notify(0, builder.build()); Calendar cal = Calendar.getInstance(); Date now = new Date(); cal.setTime(now); long endTime = cal.getTimeInMillis(); cal.add(Calendar.WEEK_OF_YEAR, -1); long startTime = cal.getTimeInMillis(); java.text.DateFormat dateFormat = getDateInstance(); GoogleSignInOptionsExtension fitnessOptions = FitnessOptions.builder() .addDataType(DataType.TYPE_HEART_RATE_BPM, FitnessOptions.ACCESS_READ) .build(); GoogleSignInAccount googleSignInAccount = GoogleSignIn.getAccountForExtension(this, fitnessOptions); Task<DataReadResponse> response = Fitness.getHistoryClient(this, googleSignInAccount) .readData(new DataReadRequest.Builder() .read(DataType.TYPE_HEART_RATE_BPM) .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS) .bucketByTime(1, TimeUnit.DAYS) .enableServerQueries() .build()); new Thread(new Runnable() { @Override public void run() { DataReadResponse readDataResult = null; try { readDataResult = Tasks.await(response); } catch (ExecutionException e) { e.printStackTrace(); return; } catch (InterruptedException e) { e.printStackTrace(); return; } DataSet dataSet = readDataResult.getDataSet(DataType.TYPE_HEART_RATE_BPM); SharedPreferences sharedPref = getSharedPreferences(getString(R.string.user_data_file), Context.MODE_PRIVATE); int i = sharedPref.getInt("i", 0); int a[] = new int[4]; if(i != 0){ for(int j = 0; j < i; j++){ String key = "h".concat(Integer.toString(i)); a[j] = sharedPref.getInt(key, 0); if(a[j] == 0){ i = j; break; } } } ArrayList<Integer> results = new ArrayList<Integer>(); for(DataPoint dp: dataSet.getDataPoints()){ int beats = Integer.parseInt(dp.getValue(Field.FIELD_BPM).toString()); a[i] = beats; i++; String key = "h".concat(Integer.toString(i)); sharedPref.edit().putInt(key, beats).apply(); if(i == 4){ results.add(Request.make(sharedPref.getInt("AGE", 65), sharedPref.getInt("GENDER", 0), a[0], a[1], a[2], a[3])); i = 0; } } for(int result: results){ if(result == 1){ Intent intent = new Intent(getApplicationContext(), NotifyActivity.class); startActivity(intent); break; } } } }).start(); mNotifyManager.cancelAll(); return false; } @Override public boolean onStopJob(JobParameters params) { return false; } /** * Creates a Notification channel, for OREO and higher. */ public void createNotificationChannel() { // Create a notification manager object. mNotifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Notification channels are only available in OREO and higher. // So, add a check on SDK version. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { // Create the NotificationChannel with all the parameters. NotificationChannel notificationChannel = new NotificationChannel (PRIMARY_CHANNEL_ID, getString(R.string.app_name), NotificationManager.IMPORTANCE_HIGH); notificationChannel.enableLights(true); notificationChannel.setLightColor(Color.RED); notificationChannel.enableVibration(true); notificationChannel.setDescription("Sync updates"); mNotifyManager.createNotificationChannel(notificationChannel); } } }
true
c18285177000394dd34dd5578627cbf684178aec
Java
zim846/5kmSystem
/src/main/java/com/system/Service/AdvertisementService.java
UTF-8
7,608
2.125
2
[]
no_license
package com.system.Service; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.system.Enum.ResultEnum; import com.system.Exception.SystemException; import com.system.Model.Advertisement; import com.system.Model.User; import com.system.Model.Voucher; import com.system.Properties.FileProperties; import com.system.Repository.AdvertisementRepository; import com.system.Repository.UserRepository; import com.system.Repository.VoucherRepository; import com.system.utils.UploadUtil; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.CriteriaSpecification; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import org.hibernate.sql.JoinType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @Service @Transactional public class AdvertisementService { @Autowired private AdvertisementRepository advertisementRepository; @Autowired private UserRepository userRepository; @Autowired private ObjectMapper mapper; @Autowired private FileProperties fileProperties; @Autowired private SessionFactory sessionFactory; public void create(JsonNode data) throws Exception{ User user = userRepository.findOneById(data.get("user_id").intValue()); if (user == null){ throw new SystemException(ResultEnum.USER_NOT_FOUND.getCode(),ResultEnum.USER_NOT_FOUND.getMsg()); } Advertisement advertisement = new Advertisement(); advertisement.setUser(user); advertisement.setLocation(data.get("location").textValue()); advertisement.setLng(data.get("lng").floatValue()); advertisement.setLat(data.get("lat").floatValue()); advertisement.setMoney(data.get("money").intValue()); advertisement.setQuantity(data.get("quantity").intValue()); advertisement.setRemaining(data.get("remaining").intValue()); advertisement.setTitle(data.get("title").textValue()); advertisement.setContent(data.get("content").textValue()); advertisement.setPics(data.get("pics").textValue()); Date create_time = new Date(); advertisement.setCreate_time(create_time); advertisementRepository.save(advertisement); } public void update(JsonNode data) throws Exception{ Advertisement advertisement = advertisementRepository.findOneById(data.get("adID").intValue()); if (advertisement == null){ throw new SystemException(ResultEnum.OBJECT_NOT_FOUND.getCode(),ResultEnum.OBJECT_NOT_FOUND.getMsg()); } advertisement.setRemaining(data.get("remaining").intValue()); advertisement.setStatus(data.get("status").intValue()); advertisementRepository.save(advertisement); } public ObjectNode get(String orderBy,String order,Integer pageSize,Integer pageNo,String keyword,Integer status,Integer adID,String startTime,String endTime) throws Exception{ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Session session = sessionFactory.getCurrentSession(); Criteria criteria = session.createCriteria(Advertisement.class,"advertisement"); criteria.createAlias("advertisement.user","user", JoinType.LEFT_OUTER_JOIN); //输入的keyword是这种格式 id = xxxx or username = xxx or tel = xxxx if(keyword!=null){ String[] keywords = keyword.split("or"); for (int i =0;i<keywords.length;i++){ String key = keywords[i].split("=")[0]; String value = keywords[i].split("=")[1]; if(key.equals("user_id")){ criteria.add(Restrictions.eq("user.user_id",value)); continue; } criteria.add(Restrictions.eq("advertisement."+key,value)); } } if(adID!=null){ criteria.add(Restrictions.eq("advertisement.id",adID)); } if(status!=null){ criteria.add(Restrictions.eq("advertisement.status",status)); } if(startTime!=null&&endTime!=null){ criteria.add(Restrictions.between("advertisement.create_time",format.parse(startTime),format.parse(endTime))); } Number totalNumber = (Number) criteria.setProjection(Projections.rowCount()).uniqueResult(); int total = totalNumber.intValue(); criteria.setProjection(null); criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY); if(order!=null&&orderBy!=null){ if(order.equals("desc")){ criteria.addOrder(Order.desc("advertisement."+order)); }else if(order.equals("asc")){ criteria.addOrder(Order.asc("advertisement."+order)); } } if(pageSize!=null&&pageNo!=null){ criteria.setFirstResult((pageNo-1)*pageSize); criteria.setMaxResults(pageSize); } List<Advertisement> advertisements = criteria.list(); ArrayNode array = mapper.createArrayNode(); for(Advertisement item: advertisements){ ObjectNode node = mapper.createObjectNode(); node.put("id",item.getId()); node.put("user_id",item.getUser().getId()); node.put("location",item.getLocation()); node.put("lng",item.getLng()); node.put("lat",item.getLat()); node.put("money",item.getMoney()); node.put("title",item.getTitle()); node.put("content",item.getContent()); node.put("pics",item.getPics()); node.put("quantity",item.getQuantity()); node.put("remaining",item.getRemaining()); node.put("create_time",format.format(item.getCreate_time())); node.put("status",item.getStatus()); array.addPOJO(node); } ObjectNode result = mapper.createObjectNode(); result.put("orderBy",orderBy); result.put("order",order); result.put("pageSize",pageSize); result.put("pageNo",pageNo); result.put("totalCount",totalNumber+""); result.putPOJO("list",array); return result; } public Boolean delete(JsonNode data) throws Exception{ Advertisement advertisement = advertisementRepository.findOneById(data.get("adID").intValue()); if (advertisement == null){ throw new SystemException(ResultEnum.OBJECT_NOT_FOUND.getCode(),ResultEnum.OBJECT_NOT_FOUND.getMsg()); }else { advertisementRepository.delete(advertisement); return true; } } /** * 上传广告图片 * @param stream * @param contentType * @return * @throws Exception */ public String uploadAdImage(InputStream stream, String contentType) throws Exception{ String name = UploadUtil.generatorName(); String out = fileProperties.getAdvertisementPath() + UploadUtil.separatar + name + "." + contentType; UploadUtil.upload(stream, out); String link = fileProperties.getAdvertisementUrl() +"/"+ name + "." + contentType; return link; } }
true
5c1e0432535c0c60749d55d98acd918a5ae18688
Java
kimbs0301/junit4
/src/test/java/com/example/junit/PrivateTest.java
UTF-8
1,483
2.609375
3
[]
no_license
package com.example.junit; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; import junit.extensions.PA; import org.hamcrest.CoreMatchers; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.example.model.Person; import com.example.util.TestUtils; /** * @author gimbyeongsu * */ public class PrivateTest { private static final Logger LOGGER = LoggerFactory.getLogger(PrivateTest.class); // http://egloos.zum.com/benelog/v/2685835 // https://code.google.com/archive/p/privilegedaccessor/ @Test public void test_private() throws Exception { final String nameBeforeChanging = "Ryu"; final String nameAfterChanging = "Choo"; // 보이지 않는 생성자를 호출할 수 있다. Person person = (Person) PA.instantiate(Person.class, nameBeforeChanging); assertThat(person.getName(), CoreMatchers.is(nameBeforeChanging)); assertThat(person.getName(), CoreMatchers.is(not(nameAfterChanging))); // private 메소드 호출 // person.changeName(nameAfterChanging); LOGGER.debug("{}", PA.getMethodSignatures(person)); // PA.invokeMethod(person, "changeName(java.lang.String)", nameAfterChanging); PA.invokeMethod(person, TestUtils.getMethodSignature("changeName", PA.getMethodSignatures(person)), nameAfterChanging); assertThat(person.getName(), CoreMatchers.is(not(nameBeforeChanging))); assertThat(person.getName(), CoreMatchers.is(nameAfterChanging)); } }
true
c8b51799a4b2e58b7921cc74f71a55155e554f4e
Java
nicho96/Practice
/Practise/src/com/github/practise/world/World.java
UTF-8
521
2.796875
3
[]
no_license
package com.github.practise.world; import java.io.IOException; import com.github.practise.file.WorldLoader; public class World { private int[][] map; public World(String url, String name){ try { map = WorldLoader.loadMap(url); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } } public int[][] getMap(){ return map; } public Tile getTile(int x, int y){ if(x < 0 || x >= map.length || y < 0 || y >= map[0].length) return null; return Tile.getTile(map[x][y]); } }
true
b40dd080ee84011dc117119fba218c70887f8265
Java
brothersome/ecm
/src/main/java/nl/brothersome/ecm/module/LdapCommunicator.java
UTF-8
6,096
2.3125
2
[ "BSD-3-Clause" ]
permissive
package nl.brothersome.ecm.module; import javafx.util.Pair; import nl.brothersome.ecm.configuration.LdapConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.AttributesMapper; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.support.LdapNameBuilder; import org.springframework.ldap.support.LdapUtils; import org.springframework.stereotype.Service; import javax.naming.Name; import javax.naming.NamingException; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.springframework.ldap.query.LdapQueryBuilder.query; @Service public class LdapCommunicator implements ILdapCommunicator, Closeable { private static Logging logger = new Logging(LdapCommunicator.class); @Autowired private LdapConfiguration ldapConfiguration; private static LdapTemplate ldapTemplate = null; public LdapCommunicator () { // } public boolean authenticate() { boolean result; DirContext contextSource; ldapTemplate = ldapConfiguration.ldapTemplate(); contextSource = null; try { contextSource = ldapConfiguration.getContextSource().getContext(ldapConfiguration.getUser(), ldapConfiguration.getPassword()); result = true; } catch (Exception e) { // Context creation failed - authentication did not succeed logger.error("Login failed", e); result = false; } finally { // It is imperative that the created DirContext instance is always closed LdapUtils.closeContext(contextSource); } System.out.println("Authenticated: " + result); return result; } public void createEntry(Name dn, List<String> objectClasses, Map<String,String> attributes) { System.out.println("Creating entry begin"); DirContextAdapter context = new DirContextAdapter(dn); if (objectClasses != null) { if (objectClasses.size() > 0) { String[] objscls = objectClasses.toArray(new String[0]); context.setAttributeValues("objectclass", objscls); } } if (attributes != null) { for (Map.Entry<String, String> entry : attributes.entrySet()) { context.setAttributeValue(entry.getKey(), entry.getValue()); } } ldapTemplate.bind(context); System.out.println("Creating entry end"); } public Name buildDn_cn(String s1) { return LdapNameBuilder.newInstance() .add("CN",s1) .build(); } public Name buildDn_cn(String s1,String s2) { return LdapNameBuilder.newInstance() .add("CN",s1) .add("CN",s2) .build(); } public Name buildDn_cn(String s1,String s2,String s3) { return LdapNameBuilder.newInstance() .add("CN",s1) .add("CN",s2) .add("CN",s3) .build(); } public Name buildDn_cn(String s1,String s2,String s3,String s4) { return LdapNameBuilder.newInstance() .add("CN",s1) .add("CN",s2) .add("CN",s3) .add("CN",s4) .build(); } public Name buildDn_cn(String s1,String s2,String s3,String s4, String s5) { return LdapNameBuilder.newInstance() .add("CN",s1) .add("CN",s2) .add("CN",s3) .add("CN",s4) .add("CN",s5) .build(); } @Override public void createContainer(Name dn,String name) { List<String> ocs = new ArrayList<>(); Map<String,String> atrs = new HashMap<>(); ocs.add("top"); ocs.add("container"); atrs.put("cn",name); atrs.put("name",name); createEntry(dn,ocs,atrs); } public Pair<String,String> newPair(String k, String v) { return new Pair(k,v); } public void createContainer(String name) { Name dn = buildDn_cn(name); createContainer(dn,name); } public void createUser(Name dn, String name, Map<String,String> extraAttribs) { List<String> ocs = new ArrayList<>(); Map<String,String> atrs = new HashMap<>(); ocs.add("top"); ocs.add("user"); if (extraAttribs!=null) { atrs.putAll(extraAttribs); } atrs.put("cn",name); atrs.put("name",name); createEntry(dn,ocs,atrs); } @Override public void createGroup(Name dn,String name,Map<String,String> extraAttribs) { List<String> ocs = new ArrayList<>(); Map<String,String> atrs = new HashMap<>(); ocs.add("top"); ocs.add("group"); if (extraAttribs!=null) { atrs.putAll(extraAttribs); } atrs.put("cn",name); atrs.put("name",name); createEntry(dn,ocs,atrs); } @Override public int removeEntry(String dn) { return 0; } @Override public List<String> getAttributesFromObjectClass(String objectClassName, String attributeName) { return ldapTemplate.search( query().where("objectclass").is(objectClassName), new AttributesMapper<String>() { public String mapFromAttributes(Attributes attrs) throws NamingException, javax.naming.NamingException { return attrs.get("cn").get().toString(); } }); } @Override public List<String> getObjectClasses(String dn) { return ldapTemplate.search( query().base(dn), new AttributesMapper<String>() { public String mapFromAttributes(Attributes attrs) throws NamingException, javax.naming.NamingException { return attrs.get("objectclass").get().toString(); } }); } @Override public boolean exist(String rdn) { try { ldapTemplate.lookup(rdn); // System.out.println("RDN exists: " + rdn); return true; } catch (org.springframework.ldap.NamingException ne) { // System.out.println("RDN does not exists: " + rdn); return false; } } @Override public boolean exist(Name dn) { try { ldapTemplate.lookup(dn); return true; } catch (org.springframework.ldap.NamingException ne) { return false; } } public void hello() { System.out.println("Hello"); } @Override public void close() throws IOException { } }
true
36bd264b0fb3bfaf15c02a492059aa541563de1f
Java
liexiaofen/GitSource
/OASystem/src/com/lw/oa/pa/master/pa006/IPA006Service.java
UTF-8
270
1.609375
2
[]
no_license
package com.lw.oa.pa.master.pa006; import javax.servlet.http.HttpServletRequest; /** **@author yuliang */ public interface IPA006Service { public PA006Command pa006001view(String empid); public int pa006001save(PA006Command command, HttpServletRequest request); }
true
455db22d5fcd1782d16d43e44b6ae26bc4a3155b
Java
FAP-Team/Fap-Module
/fap/test/messages/MessagesTest.java
UTF-8
347
1.992188
2
[]
no_license
package messages; import static org.junit.Assert.*; import org.junit.Test; import net.sf.oval.constraint.AssertFalse; public class MessagesTest { @Test public void noMessages(){ assertFalse(Messages.hasMessages()); } @Test public void addMessages(){ Messages.error("mensaje de error"); assertTrue(Messages.hasMessages()); } }
true
e32a2e8f7f1e577b316841ef7ba410102f222269
Java
orlyda/spl191BookStore
/src/main/java/bgu/spl/mics/application/services/ResourceService.java
UTF-8
1,890
2.796875
3
[]
no_license
package bgu.spl.mics.application.services; import bgu.spl.mics.Callback; import bgu.spl.mics.Future; import bgu.spl.mics.MicroService; import bgu.spl.mics.application.messages.GetCarEvent; import bgu.spl.mics.application.messages.ReleaseCarEvent; import bgu.spl.mics.application.messages.TerminateBroadcast; import bgu.spl.mics.application.passiveObjects.DeliveryVehicle; import bgu.spl.mics.application.passiveObjects.ResourcesHolder; /** * ResourceService is in charge of the store resources - the delivery vehicles. * Holds a reference to the {@link ResourceHolder} singleton of the store. * This class may not hold references for objects which it is not responsible for: * {@link MoneyRegister}, {@link Inventory}. * * You can add private fields and public methods to this class. * You MAY change constructor signatures and even add new public constructors. */ public class ResourceService extends MicroService{ private static int waitingTime =20; private ResourcesHolder resourcesHolderRef; public ResourceService(String name){ super(name); resourcesHolderRef = ResourcesHolder.getInstance(); } @Override protected void initialize() { Callback<GetCarEvent> getCarEventCallback =c-> { Future<DeliveryVehicle> f = resourcesHolderRef.acquireVehicle(); this.complete(c,f); }; Callback<ReleaseCarEvent> releaseCarEventCallback = c->{ Future<DeliveryVehicle> f = c.getDeliveryVehicle(); while(!f.isDone()) try{Thread.sleep(waitingTime);} catch (InterruptedException e) { e.printStackTrace(); } resourcesHolderRef.releaseVehicle(f.get()); complete(c,null);}; this.subscribeEvent(GetCarEvent.class,getCarEventCallback); this.subscribeEvent(ReleaseCarEvent.class,releaseCarEventCallback); this.subscribeBroadcast(TerminateBroadcast.class, c->this.terminate()); } }
true
481642ac3309707f45525de3ec80bfd5c428502d
Java
MatteoT9890/BLETracking
/BeaconProject/BlueGiga/src/org/thingml/bglib/gio/BleCodes.java
UTF-8
70,579
2.484375
2
[]
no_license
package org.thingml.bglib.gio; /** * Questa classe contiene diversi metodi, usati per ottenere il significato dei vari codici (es: codici errore) del protocollo BGAPI * @author Giorgio Avalle */ public class BleCodes { //stampa a schermo private static void _line(String msg){ System.out.println(msg); } //Le varie enum seguono, nell'ordine, quelle delle specifiche BGAPI public static String AttributeValueType(int t){ switch(t){ case 0: return new String("read"); case 1: return new String("notify"); case 2: return new String("indicate"); case 3: return new String("read_by_type"); case 4: return new String("read_blob"); case 5: return new String("indicate_rsp_req"); default: return new String("unknown (" + t + ")"); } } public static String AttributeChangeReason(int t){ switch(t){ case 0: return new String("​write_request"); case 1: return new String("​write_command"); case 2: return new String("​write_request_user"); default: return new String("unknown (" + t + ")"); } } public static String AttributeStatusFlag(int t){ switch(t){ case 1: return new String("​flag_notify"); case 2: return new String("​flag_indicate"); default: return new String("unknown (" + t + ")"); } } public static void ConnectionStatusFlag(int i){ //considero solo i bit 0 - 3 boolean connected = (i/128) == 1; boolean encrypted = ((i/64)%2) == 1; boolean completed = ((i/32)%2) == 1; boolean parametersChange = ((i/16)%2) == 1; _line("Connesso: " + connected); _line("Cifratura: " + encrypted); _line("Completata: " + completed); _line("Parametri modificati: " + parametersChange); } public static String ADFlag(int t){ switch(t){ case 1: return new String("​LIMITED_DISCOVERABLE"); case 2: return new String("​GENERAL_DISCOVERABLE"); case 4: return new String("​BREDR_NOT_SUPPORTED"); case 0x10: return new String("SIMULTANEOUS_LEBREDR_CTRL​"); case 0x20: return new String("SIMULTANEOUS_LEBREDR_HOST​"); case 0x1F: return new String("​MASK"); default: return new String("unknown (" + t + ")"); } } public static String ADTypeFlag(int t){ switch(t){ case 0: return new String("​none"); case 1: return new String("​flags"); case 2: return new String("​services_16bit_more"); case 3: return new String("​services_16bit_all"); case 4: return new String("​services_32bit_more"); case 5: return new String("​services_32bit_all"); case 6: return new String("​services_128bit_more"); case 7: return new String("​services_128bit_all"); case 8: return new String("​localname_short"); case 9: return new String("​localname_complete"); case 10: return new String("​txpower"); default: return new String("unknown (" + t + ")"); } } public static String AdvertisingPolicy(int t){ switch(t){ case 0: return new String("​all"); case 1: return new String("​whitelist_scan"); case 2: return new String("​whitelist_connect"); case 3: return new String("​whitelist_all"); default: return new String("unknown (" + t + ")"); } } public static String BluetoothAddressTypes(int t){ switch(t){ case 0: return new String("​public"); case 1: return new String("​random"); default: return new String("unknown (" + t + ")"); } } public static String GAPConnectableMode(int t){ switch(t){ case 0: return new String("​non_connectable"); case 1: return new String("​directed_connectable"); case 2: return new String("​undirected_connectable"); case 3: return new String("​scannable_non_connectable"); default: return new String("unknown (" + t + ")"); } } public static String GAPDiscoverableMode(int t){ switch(t){ case 0: return new String("​non_discoverable"); case 1: return new String("​limited_discoverable"); case 2: return new String("​general_discoverable"); case 3: return new String("​broadcast"); case 4: return new String("​user_data"); case 0x80: return new String("​enhanced_broadcasting"); default: return new String("unknown (" + t + ")"); } } public static String GAPDiscoverMode(int t){ switch(t){ case 0: return new String("​limited"); case 1: return new String("​generic"); case 2: return new String("​observation"); default: return new String("unknown (" + t + ")"); } } public static String SCAN_HEADER_FLAGS(int t){ switch(t){ case 0: return new String("​ADV_IND"); case 1: return new String("​ADV_DIRECT_IND"); case 2: return new String("​ADV_NONCONN_IND"); case 3: return new String("​SCAN_REQ"); case 4: return new String("​SCAN_RSP"); case 5: return new String("​CONNECT_REQ"); case 6: return new String("​ADV_DISCOVER_IND"); default: return new String("unknown (" + t + ")"); } } public static String ScanPolicy(int t){ switch(t){ case 0: return new String("​all"); case 1: return new String("​whitelist"); default: return new String("unknown (" + t + ")"); } } public static String BondingKeys(int t){ switch(t){ case 1: return new String("​ltk"); case 2: return new String("​addr_public"); case 4: return new String("​addr_static"); case 8: return new String("​irk"); case 0x10: return new String("​edivrand"); case 0x20: return new String("​csrk"); case 0x40: return new String("​masterid"); default: return new String("unknown (" + t + ")"); } } public static String SMPIOCapabilities(int t){ switch(t){ case 0: return new String("​displayonly"); case 1: return new String("​displayyesno"); case 2: return new String("​keyboardonly"); case 3: return new String("​noinputnooutput"); case 4: return new String("​keyboarddisplay"); default: return new String("unknown (" + t + ")"); } } public static String Endpoints(int t){ switch(t){ case 0: return new String("​api"); case 1: return new String("​test"); case 2: return new String("​script"); case 3: return new String("​usb"); case 4: return new String("​uart0"); case 5: return new String("​uart1"); default: return new String("unknown (" + t + ")"); } } /** * Ritorna il significato di un codice errore * @param code è il codice errore (intero) */ public static String error(int code) { String name; //codice errore esadecimale String s = BleUtil.toHex((byte) (code/256), (byte) (code % 256)); switch(s){ case "0180": name = new String("Invalid parameter"); break; case "0181": name = new String("Device in wrong state"); break; case "0182": name = new String("Out of memory"); break; case "0183": name = new String("Feature not implemented"); break; case "0184": name = new String("Command not recognized"); break; case "0185": name = new String("Timeout"); break; case "0186": name = new String("Not connected"); break; case "0187": name = new String("Flow"); break; case "0188": name = new String("User attribute"); break; case "0189": name = new String("Invalid License Key"); break; case "018A": name = new String("Command too long"); break; case "018B": name = new String("Out of bonds"); break; case "0205": name = new String("Authentication failure"); break; case "0206": name = new String("Pin or Key missing"); break; case "0207": name = new String("Memory Capacity exceeded"); break; case "0208": name = new String("Connection Timeout"); break; case "0209": name = new String("Connection Limit Exceeded"); break; case "020C": name = new String("Command Disallowed"); break; case "0212": name = new String("Invalid command parameter"); break; case "0213": name = new String("Remote user terminated connection"); break; case "0216": name = new String("Connection terminated by local host"); break; case "0222": name = new String("LL Response Timeout"); break; case "0228": name = new String("LL Instant Passed"); break; case "023A": name = new String("Controller Busy"); break; case "023B": name = new String("Unaccettable connection interval"); break; case "023C": name = new String("Directed Advertising Timeout"); break; case "023D": name = new String("MIC Failure"); break; case "023E": name = new String("Connection failed to be established"); break; case "0301": name = new String("Passkey Entry Failed"); break; case "0302": name = new String("OOB Data is not available"); break; case "0303": name = new String("Authentication Requirements"); break; case "0304": name = new String("Confirm Value Failed"); break; case "0305": name = new String("Pairing not supported"); break; case "0306": name = new String("Encryption key size"); break; case "0307": name = new String("Command not supported"); break; case "0308": name = new String("Unspecified Reason"); break; case "0309": name = new String("Repeated Attempts"); break; case "030A": name = new String("Invalid parameter"); break; case "0401": name = new String("Invalid Handle"); break; case "0402": name = new String("Read not permitted"); break; case "0403": name = new String("Write not permitted"); break; case "0404": name = new String("Invalid PDU"); break; case "0405": name = new String("Insufficient Authentication"); break; case "0406": name = new String("Request not supported"); break; case "0407": name = new String("Invalid offset"); break; case "0408": name = new String("Insufficient authorization"); break; case "0409": name = new String("Prepare Queue Full"); break; case "040A": name = new String("Attribute Not Found"); break; case "040B": name = new String("Attribute Not Long"); break; case "040C": name = new String("Insufficient Encryption Key Size"); break; case "040D": name = new String("Invalid Attribute Value Length"); break; case "040E": name = new String("Unlikely Error"); break; case "040F": name = new String("Insufficient Encryption"); break; case "0410": name = new String("Unsupported group type"); break; case "0411": name = new String("Insufficient resources"); break; case "0480": name = new String("Application Error Codes"); break; default: name = new String("Descrizione dell'errore non disponibile (codice: " + code + ")"); } return name; } /** Crea il nome esteso del tipo di AD Struct * <br> <a target="_parent" href="https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile">Riferimento web</a> * * @return String */ public static String createExtendedType(String type) { switch(type) { case "01": return "Flags"; case "02": return "Incomplete List of 16-bit Service Class UUIDs"; case "03": return "Complete List of 16-bit Service Class UUIDs"; case "04": return "Incomplete List of 32-bit Service Class UUIDs"; case "05": return "Complete List of 32-bit Service Class UUIDs"; case "06": return "Incomplete List of 128-bit Service Class UUIDs"; case "07": return "Complete List of 128-bit Service Class UUIDs"; case "08": return "Shortened Local Name"; case "09": return "Complete Local Name"; case "0A": return "Tx Power Level"; case "0D": return "Class of Device"; case "0E": return "Simple Pairing Hash C"; case "0F": return "Simple Pairing Randomizer R"; case "10": return "Security Manager TK Value"; case "11": return "Security Manager Out of Band Flags"; case "12": return "Slave Connection Interval Range"; case "14": return "List of 16-bit Service Solicitation UUIDs"; case "1F": return "List of 32-bit Service Solicitation UUIDs"; case "15": return "List of 128-bit Service Solicitation UUIDs"; case "16": return "Service Data - 16-bit UUID"; case "20": return "Service Data - 32-bit UUID"; case "21": return "Service Data - 128-bit UUID"; case "22": return "​LE Secure Connections Confirmation Value"; case "23": return "​LE Secure Connections Random Value"; case "24": return "URI"; case "25": return "Indoor Positioning"; case "26": return "Transport Discovery Data"; case "17": return "Public Target Address"; case "18": return "Random Target Address"; case "19": return "Appearance"; case "1A": return "Advertising Interval"; case "1B": return "​LE Bluetooth Device Address"; case "1C": return "​LE Role"; case "1D": return "​Simple Pairing Hash C-256"; case "1E": return "​Simple Pairing Randomizer R-256"; case "3D": return "3D Information Data"; case "FF": return "Manufacturer Specific Data"; default : return new String("non riconosciuto (" + type + ")"); } } /** * Crea il dominio dell'URL di un dispositivo Eddystone, a partire dal codice esadecimale * @param code è il codice esadecimale del dominio * @return */ public static String ES_UrlDomain(String code) { switch(code) { case "00": return new String(".com/"); case "01": return new String(".org/"); case "02": return new String(".edu/"); case "03": return new String(".net/"); case "04": return new String(".info/"); case "05": return new String(".biz/"); case "06": return new String(".gov/"); case "07": return new String(".com"); case "08": return new String(".org"); case "09": return new String(".edu"); case "0A": return new String(".net"); case "0B": return new String(".info"); case "0C": return new String(".biz"); case "0D": return new String(".gov"); default: return new String("[Reserved character for future use]"); } } /** * Crea lo schema URL per un dispositivo Eddystone, a partire dal codice esadecimale * @param code è il codice esadecimale dello schema * @return */ public static String ES_UrlScheme(String code) { switch(code){ case "00": return new String("http://www."); case "01": return new String("https://www."); case "02": return new String("http://"); case "03": return new String("https://"); default: return new String("[Not recognized URL Scheme (" + code + ")]"); } } /** * Crea il tipo di frame Eddystone, partendo dal codice esadecimale * @param code * @return */ public static String ES_FrameType(String code) { switch(code){ case "00": return new String("Eddystone-UID"); case "10": return new String("Eddystone-URL"); case "20": return new String("Eddystone-TLM"); default: return new String("Unrecognized frame type ("+ code + ")"); } } /** * Ritorna il significato di una flag (ADStruct = Flag), a partire dal codice esadecimale * @param code è il codice esadecimale della flag * @return */ public static String flag(String code) { switch(code) { case "00": return new String("​LE Limited Discoverable Mode"); case "01": return new String("​LE General Discoverable Mode"); case "02": return new String("​BR/EDR not Supported"); case "03": return new String("​Simultaneous LE adn BR/EDR (Controller)"); case "04": return new String("​Simultaneous LE adn BR/EDR (Host)"); case "06": return new String("Non-connectable, undirected advertising, single-mode device"); //TODO: sicuro? default: return new String("​Not recognized (" + code + ")"); } } /** * Ritorna il ruolo del dispositivo, a partire dal suo codice esadecimale * @param code è il codice esadecimale del ruolo * @return */ public static String role(String code) { switch(code){ case "00": return new String("Only Peripheral"); case "01": return new String("Only Central"); case "02": return new String("Peripheral preferred"); case "03": return new String("Central preferred"); default: return new String("Non riconosciuto (" + code + ")"); } } /** * Crea il campo "manufacturer", contenente il nome del produttore del dispositivo * <br> <a target="_parent" href="https://www.bluetooth.com/specifications/assigned-numbers/company-Identifiers">Riferimento web</a> */ public static String manufacturer(String code) { switch(code) { case "0000": return new String("​​Ericsson Technology Licensing"); case "0001": return new String("​Nokia Mobile Phones"); case "0002": return new String("​Intel Corp."); case "0003": return new String("​IBM Corp."); case "0004": return new String("​Toshiba Corp."); case "0005": return new String("​3Com"); case "0006": return new String("​Microsoft"); case "0007": return new String("​Lucent"); case "0008": return new String("​Motorola"); case "0009": return new String("​Infineon Technologies AG"); case "000A": return new String("​Cambridge Silicon Radio"); case "000B": return new String("​Silicon Wave"); case "000C": return new String("​Digianswer A/S"); case "000D": return new String("​Texas Instruments Inc."); case "000E": return new String("​Ceva, Inc. (formerly Parthus Technologies, Inc.)"); case "000F": return new String("​Broadcom Corporation"); case "0010": return new String("​Mitel Semiconductor"); case "0011": return new String("​Widcomm, Inc"); case "0012": return new String("​Zeevo, Inc."); case "0013": return new String("​Atmel Corporation"); case "0014": return new String("​Mitsubishi Electric Corporation"); case "0015": return new String("​RTX Telecom A/S"); case "0016": return new String("​KC Technology Inc."); case "0017": return new String("​NewLogic"); case "0018": return new String("​Transilica, Inc."); case "0019": return new String("​Rohde & Schwarz GmbH & Co. KG"); case "001A": return new String("​TTPCom Limited"); case "001B": return new String("​Signia Technologies, Inc."); case "001C": return new String("​Conexant Systems Inc."); case "001D": return new String("​Qualcomm"); case "001E": return new String("​Inventel"); case "001F": return new String("​AVM Berlin"); case "0020": return new String("​BandSpeed, Inc."); case "0021": return new String("​Mansella Ltd"); case "0022": return new String("​NEC Corporation"); case "0023": return new String("​WavePlus Technology Co., Ltd."); case "0024": return new String("​Alcatel"); case "0025": return new String("​NXP Semiconductors (formerly Philips Semiconductors)"); case "0026": return new String("​C Technologies"); case "0027": return new String("​Open Interface"); case "0028": return new String("​R F Micro Devices"); case "0029": return new String("​Hitachi Ltd"); case "002A": return new String("​Symbol Technologies, Inc."); case "002B": return new String("​Tenovis"); case "002C": return new String("​Macronix International Co. Ltd."); case "002D": return new String("​GCT Semiconductor"); case "002E": return new String("​Norwood Systems"); case "002F": return new String("​MewTel Technology Inc."); case "0030": return new String("​ST Microelectronics"); case "0031": return new String("​Synopsis"); case "0032": return new String("​Red-M (Communications) Ltd"); case "0033": return new String("​Commil Ltd"); case "0034": return new String("​Computer Access Technology Corporation (CATC)"); case "0035": return new String("​Eclipse (HQ Espana) S.L."); case "0036": return new String("​Renesas Electronics Corporation"); case "0037": return new String("​Mobilian Corporation"); case "0038": return new String("​Terax"); case "0039": return new String("​Integrated System Solution Corp."); case "003A": return new String("​Matsushita Electric Industrial Co., Ltd."); case "003B": return new String("​Gennum Corporation"); case "003C": return new String("​BlackBerry Limited (formerly Research In Motion)"); case "003D": return new String("​IPextreme, Inc."); case "003E": return new String("​Systems and Chips, Inc."); case "003F": return new String("​Bluetooth SIG, Inc."); case "0040": return new String("​Seiko Epson Corporation"); case "0041": return new String("​Integrated Silicon Solution Taiwan, Inc."); case "0042": return new String("​CONWISE Technology Corporation Ltd"); case "0043": return new String("​PARROT SA"); case "0044": return new String("​Socket Mobile"); case "0045": return new String("​Atheros Communications, Inc."); case "0046": return new String("​MediaTek, Inc."); case "0047": return new String("​Bluegiga"); case "0048": return new String("​Marvell Technology Group Ltd."); case "0049": return new String("​3DSP Corporation"); case "004A": return new String("​Accel Semiconductor Ltd."); case "004B": return new String("​Continental Automotive Systems"); case "004C": return new String("​Apple, Inc."); case "004D": return new String("​Staccato Communications, Inc."); case "004E": return new String("​Avago Technologies"); case "004F": return new String("​APT Licensing Ltd."); case "0050": return new String("​SiRF Technology"); case "0051": return new String("​Tzero Technologies, Inc."); case "0052": return new String("​J&M Corporation"); case "0053": return new String("​Free2move AB"); case "0054": return new String("​3DiJoy Corporation"); case "0055": return new String("​Plantronics, Inc."); case "0056": return new String("​Sony Ericsson Mobile Communications"); case "0057": return new String("​Harman International Industries, Inc."); case "0058": return new String("​Vizio, Inc."); case "0059": return new String("​Nordic Semiconductor ASA"); case "005A": return new String("​EM Microelectronic-Marin SA"); case "005B": return new String("​Ralink Technology Corporation"); case "005C": return new String("​Belkin International, Inc."); case "005D": return new String("​Realtek Semiconductor Corporation"); case "005E": return new String("​Stonestreet One, LLC"); case "005F": return new String("​Wicentric, Inc."); case "0060": return new String("​RivieraWaves S.A.S"); case "0061": return new String("​RDA Microelectronics"); case "0062": return new String("​Gibson Guitars"); case "0063": return new String("​MiCommand Inc."); case "0064": return new String("​Band XI International, LLC"); case "0065": return new String("​Hewlett-Packard Company"); case "0066": return new String("​9Solutions Oy"); case "0067": return new String("​GN Netcom A/S"); case "0068": return new String("​General Motors"); case "0069": return new String("​A&D Engineering, Inc."); case "006A": return new String("​MindTree Ltd."); case "006B": return new String("​Polar Electro OY"); case "006C": return new String("​Beautiful Enterprise Co., Ltd."); case "006D": return new String("​BriarTek, Inc."); case "006E": return new String("​Summit Data Communications, Inc."); case "006F": return new String("​Sound ID"); case "0070": return new String("​Monster, LLC"); case "0071": return new String("​connectBlue AB"); case "0072": return new String("​ShangHai Super Smart Electronics Co. Ltd."); case "0073": return new String("​Group Sense Ltd."); case "0074": return new String("​Zomm, LLC"); case "0075": return new String("​Samsung Electronics Co. Ltd."); case "0076": return new String("​Creative Technology Ltd."); case "0077": return new String("​Laird Technologies"); case "0078": return new String("​Nike, Inc."); case "0079": return new String("​lesswire AG"); case "007A": return new String("​MStar Semiconductor, Inc."); case "007B": return new String("​Hanlynn Technologies"); case "007C": return new String("​A & R Cambridge"); case "007D": return new String("​Seers Technology Co. Ltd"); case "007E": return new String("​Sports Tracking Technologies Ltd."); case "007F": return new String("​Autonet Mobile"); case "0080": return new String("​DeLorme Publishing Company, Inc."); case "0081": return new String("​WuXi Vimicro"); case "0082": return new String("​Sennheiser Communications A/S"); case "0083": return new String("​TimeKeeping Systems, Inc."); case "0084": return new String("​Ludus Helsinki Ltd."); case "0085": return new String("​BlueRadios, Inc."); case "0086": return new String("​equinox AG"); case "0087": return new String("​Garmin International, Inc."); case "0088": return new String("​Ecotest"); case "0089": return new String("​GN ReSound A/S"); case "008A": return new String("​Jawbone"); case "008B": return new String("​Topcorn Positioning Systems, LLC"); case "008C": return new String("​Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.)​​"); case "008D": return new String("​Zscan Software"); case "008E": return new String("​Quintic Corp."); case "008F": return new String("​Stollman E+V GmbH"); case "0090": return new String("​Funai Electric Co., Ltd."); case "0091": return new String("​Advanced PANMOBIL Systems GmbH & Co. KG"); case "0092": return new String("​ThinkOptics, Inc."); case "0093": return new String("​Universal Electronics, Inc."); case "0094": return new String("​Airoha Technology Corp."); case "0095": return new String("​NEC Lighting, Ltd."); case "0096": return new String("​ODM Technology, Inc."); case "0097": return new String("​ConnecteDevice Ltd."); case "0098": return new String("​zer01.tv GmbH"); case "0099": return new String("​i.Tech Dynamic Global Distribution Ltd."); case "009A": return new String("​Alpwise"); case "009B": return new String("​Jiangsu Toppower Automotive Electronics Co., Ltd."); case "009C": return new String("​Colorfy, Inc."); case "009D": return new String("​Geoforce Inc."); case "009E": return new String("​Bose Corporation"); case "009F": return new String("​Suunto Oy"); case "00A0": return new String("​Kensington Computer Products Group"); case "00A1": return new String("​SR-Medizinelektronik"); case "00A2": return new String("​Vertu Corporation Limited"); case "00A3": return new String("​Meta Watch Ltd."); case "00A4": return new String("​LINAK A/S"); case "00A5": return new String("​OTL Dynamics LLC"); case "00A6": return new String("​Panda Ocean Inc."); case "00A7": return new String("​Visteon Corporation"); case "00A8": return new String("​ARP Devices Limited"); case "00A9": return new String("​Magneti Marelli S.p.A"); case "00AA": return new String("​CAEN RFID srl"); case "00AB": return new String("​Ingenieur-Systemgruppe Zahn GmbH"); case "00AC": return new String("​Green Throttle Games"); case "00AD": return new String("​Peter Systemtechnik GmbH"); case "00AE": return new String("​Omegawave Oy"); case "00AF": return new String("​Cinetix"); case "00B0": return new String("​Passif Semiconductor Corp"); case "00B1": return new String("​Saris Cycling Group, Inc"); case "00B2": return new String("​​Bekey A/S"); case "00B3": return new String("​​Clarinox Technologies Pty. Ltd."); case "00B4": return new String("​​BDE Technology Co., Ltd."); case "00B5": return new String("​Swirl Networks"); case "00B6": return new String("​​Meso international"); case "00B7": return new String("​​TreLab Ltd"); case "00B8": return new String("​​Qualcomm Innovation Center, Inc. (QuIC)"); case "00B9": return new String("​​​Johnson Controls, Inc."); case "00BA": return new String("​​Starkey Laboratories Inc."); case "00BB": return new String("​​​S-Power Electronics Limited"); case "00BC": return new String("​​​Ace Sensor Inc"); case "00BD": return new String("​​​Aplix Corporation"); case "00BE": return new String("​​​AAMP of America"); case "00BF": return new String("​​​Stalmart Technology Limited"); case "00C0": return new String("​​​AMICCOM Electronics Corporation"); case "00C1": return new String("​​​Shenzhen Excelsecu Data Technology Co.,Ltd"); case "00C2": return new String("​​​Geneq Inc."); case "00C3": return new String("​​​adidas AG"); case "00C4": return new String("​​​LG Electronics​"); case "00C5": return new String("​​Onset Computer Corporation"); case "00C6": return new String("​​Selfly BV"); case "00C​7": return new String("​​Quuppa Oy."); case "00C8": return new String("​GeLo Inc"); case "00C9": return new String("​Evluma"); case "00CA": return new String("MC10"); case "00CB": return new String("​Binauric SE"); case "00CC": return new String("​Beats Electronics"); case "00CD": return new String("​Microchip Technology Inc."); case "00CE": return new String("​Elgato Systems GmbH"); case "00CF": return new String("​ARCHOS SA"); case "00D0": return new String("​Dexcom, Inc."); case "00D1": return new String("​Polar Electro Europe B.V."); case "00D2": return new String("​Dialog Semiconductor B.V."); case "00D3": return new String("​Taixingbang Technology (HK) Co,. LTD."); case "00D4": return new String("​Kawantech"); case "00D5": return new String("​Austco Communication Systems"); case "00D6": return new String("​Timex Group USA, Inc."); case "00D7": return new String("​Qualcomm Technologies, Inc."); case "00D8": return new String("​Qualcomm Connected Experiences, Inc."); case "00D9": return new String("​Voyetra Turtle Beach"); case "00DA": return new String("​txtr GmbH"); case "00DB": return new String("​Biosentronics"); case "00DC": return new String("​Procter & Gamble"); case "00DD": return new String("​Hosiden Corporation"); case "00DE": return new String("​Muzik LLC"); case "00DF": return new String("​Misfit Wearables Corp"); case "00E0": return new String("​Google"); case "00E1": return new String("​Danlers Ltd"); case "00E2": return new String("​Semilink Inc"); case "00E3": return new String("​inMusic Brands, Inc"); case "00E4": return new String("​L.S. Research Inc."); case "00E5": return new String("​Eden Software Consultants Ltd."); case "00E6": return new String("​Freshtemp"); case "00E7": return new String("​​KS Technologies"); case "00E8": return new String("​​ACTS Technologies"); case "00E9": return new String("​​Vtrack Systems"); case "00EA": return new String("​​Nielsen-Kellerman Company"); case "00EB": return new String("​​Server Technology, Inc."); case "00EC": return new String("​​BioResearch Associates"); case "00ED": return new String("​​Jolly Logic, LLC"); case "00EE": return new String("​​Above Average Outcomes, Inc."); case "00EF": return new String("​​Bitsplitters GmbH"); case "00F0": return new String("​​PayPal, Inc."); case "00F1": return new String("​​Witron Technology Limited"); case "00F2": return new String("​​Aether Things Inc. (formerly Morse Project Inc.)"); case "00F3": return new String("​​Kent Displays Inc."); case "00F4": return new String("​Nautilus Inc​."); case "00F5": return new String("​​Smartifier Oy"); case "00F6": return new String("​​Elcometer Limited"); case "00F7": return new String("​​VSN Technologies Inc."); case "00F8": return new String("​​AceUni Corp., Ltd."); case "00F9": return new String("​​StickNFind"); case "00FA": return new String("​​Crystal Code AB"); case "00FB": return new String("​​KOUKAAM a.s."); case "00FC": return new String("​Delphi Corporation"); case "00FD": return new String("​​ValenceTech Limited"); case "00FE": return new String("​Reserved"); case "00FF": return new String("​​Typo Products, LLC"); case "0100": return new String("​​TomTom International BV"); case "0101": return new String("​​Fugoo, Inc"); case "0102": return new String("​​Keiser Corporation"); case "0103": return new String("​​Bang & Olufsen A/S"); case "0104": return new String("​​PLUS Locations Systems Pty Ltd"); case "0105": return new String("​​Ubiquitous Computing Technology Corporation"); case "0106": return new String("​​Innovative Yachtter Solutions"); case "0107": return new String("​​William Demant Holding A/S"); case "0108": return new String("​​Chicony Electronics Co., Ltd."); case "0109": return new String("​​Atus BV"); case "010A": return new String("​​Codegate Ltd."); case "010B": return new String("​ERi, Inc."); case "010C": return new String("​​Transducers Direct, LLC"); case "010D": return new String("​​Fujitsu Ten Limited"); case "010E": return new String("​​Audi AG"); case "010F": return new String("​​HiSilicon Technologies Co., Ltd."); case "0110": return new String("​​Nippon Seiki Co., Ltd."); case "0111": return new String("​​Steelseries ApS"); case "0112": return new String("​Visybl Inc."); case "0113": return new String("​​Openbrain Technologies, Co., Ltd."); case "0114": return new String("​​Xensr"); case "0115": return new String("​e.solutions"); case "0116": return new String("​​1OAK Technologies"); case "0117": return new String("​​Wimoto Technologies Inc"); case "0118": return new String("​​Radius Networks, Inc."); case "0119": return new String("​​Wize Technology Co., Ltd."); case "011A": return new String("​​Qualcomm Labs, Inc."); case "011B": return new String("​​Aruba Networks"); case "011C": return new String("​​Baidu"); case "011D": return new String("​​Arendi AG"); case "011E": return new String("​​Skoda Auto a.s."); case "011F": return new String("​​Volkswagon AG"); case "0120": return new String("​​Porsche AG"); case "0121": return new String("​​Sino Wealth Electronic Ltd."); case "0122": return new String("​​AirTurn, Inc."); case "0123": return new String("​​Kinsa, Inc."); case "0124": return new String("​​HID Global"); case "0125": return new String("​​SEAT es"); case "0126": return new String("​​Promethean Ltd."); case "0127": return new String("​​Salutica Allied Solutions"); case "0128": return new String("​​GPSI Group Pty Ltd"); case "0129": return new String("​​Nimble Devices Oy"); case "012A": return new String("​​Changzhou Yongse Infotech Co., Ltd"); case "012B": return new String("​​SportIQ"); case "012C": return new String("​​TEMEC Instruments B.V."); case "012D": return new String("​​Sony Corporation"); case "012E": return new String("​​ASSA ABLOY"); case "012F": return new String("​​Clarion Co., Ltd."); case "0130": return new String("​​Warehouse Innovations"); case "0131": return new String("​​Cypress Semiconductor Corporation"); case "0132": return new String("​​MADS Inc"); case "0133": return new String("​​Blue Maestro Limited"); case "0134": return new String("​​Resolution Products, Inc."); case "0135": return new String("​​Airewear LLC"); case "0136": return new String("​Seed Labs, Inc. (formerly ETC sp. z.o.o.)​"); case "0137": return new String("​​Prestigio Plaza Ltd."); case "0138": return new String("​​NTEO Inc."); case "0139": return new String("​​Focus Systems Corporation"); case "013A": return new String("​​Tencent Holdings Limited"); case "013B": return new String("​​Allegion"); case "013C": return new String("​​Murata Manufacuring Co., Ltd."); case "013E": return new String("​​Nod, Inc."); case "013F": return new String("​​B&B Manufacturing Company"); case "0140": return new String("​​Alpine Electronics (China) Co., Ltd"); case "0141": return new String("​​FedEx Services"); case "0142": return new String("​​Grape Systems Inc."); case "0143": return new String("​​Bkon Connect"); case "0144": return new String("​​Lintech GmbH"); case "0145": return new String("​​Novatel Wireless"); case "0146": return new String("​​Ciright"); case "0147": return new String("​​Mighty Cast, Inc."); case "0148": return new String("​​Ambimat Electronics"); case "0149": return new String("​​Perytons Ltd."); case "014A": return new String("​​Tivoli Audio, LLC"); case "014B": return new String("​​Master Lock"); case "014C": return new String("​​Mesh-Net Ltd"); case "014D": return new String("​​Huizhou Desay SV Automotive CO., LTD."); case "014E": return new String("​Tangerine, Inc."); case "014F": return new String("​B&W Group Ltd."); case "0150": return new String("​​Pioneer Corporation"); case "0151": return new String("​​OnBeep"); case "0152": return new String("​​Vernier Software & Technology"); case "0153": return new String("​​ROL Ergo"); case "0154": return new String("​​Pebble Technology"); case "0155": return new String("​​NETATMO"); case "0156": return new String("​​Accumulate AB"); case "0157": return new String("​​Anhui Huami Information Technology Co., Ltd."); case "0158": return new String("​​Inmite s.r.o."); case "0159": return new String("​​ChefSteps, Inc."); case "015A": return new String("​​micas AG"); case "015B": return new String("​​Biomedical Research Ltd."); case "015C": return new String("​Pitius Tec S.L."); case "015D": return new String("​Estimote, Inc."); case "015E": return new String("​Unikey Technologies, Inc."); case "015F": return new String("​Timer Cap Co."); case "0160": return new String("​AwoX"); case "0161": return new String("​yikes"); case "0162": return new String("​MADSGlobal NZ Ltd."); case "0163": return new String("​PCH International"); case "0164": return new String("​Qingdao Yeelink Information Technology Co., Ltd."); case "0165": return new String("​Milwaukee Tool (formerly Milwaukee Electric Tools)"); case "0166": return new String("​MISHIK Pte Ltd"); case "0167": return new String("​Bayer HealthCare"); case "0168": return new String("​Spicebox LLC"); case "0169": return new String("​emberlight"); case "016A": return new String("​Cooper-Atkins Corporation"); case "016B": return new String("​Qblinks"); case "016C": return new String("​MYSPHERA"); case "016D": return new String("​LifeScan Inc"); case "016E": return new String("​Volantic AB"); case "016F": return new String("​Podo Labs, Inc"); case "0170": return new String("​F. Hoffmann-La Roche AG"); case "0171": return new String("​Amazon Fulfillment Service"); case "0172": return new String("​Connovate Technology Private Limited"); case "0173": return new String("​Kocomojo, LLC"); case "0174": return new String("​Everykey LLC"); case "0175": return new String("​Dynamic Controls"); case "0176": return new String("​SentriLock"); case "0177": return new String("​I-SYST inc."); case "0178": return new String("​CASIO COMPUTER CO., LTD."); case "0179": return new String("​LAPIS Semiconductor Co., Ltd."); case "017A": return new String("​Telemonitor, Inc."); case "017B": return new String("​taskit GmbH"); case "017C": return new String("​Daimler AG"); case "017D": return new String("​BatAndCat"); case "017E": return new String("​BluDotz Ltd"); case "017F": return new String("​XTel ApS"); case "0180": return new String("​Gigaset Communications GmbH"); case "0181": return new String("​Gecko Health Innovations, Inc."); case "0182": return new String("​HOP Ubiquitous"); case "0183": return new String("​To Be Assigned"); case "0184": return new String("​Nectar"); case "0185": return new String("​bel'apps LLC"); case "0186": return new String("​CORE Lighting Ltd"); case "0187": return new String("​Seraphim Sense Ltd"); case "0188": return new String("​Unico RBC"); case "0189": return new String("​Physical Enterprises Inc."); case "018A": return new String("​Able Trend Technology Limited"); case "018B": return new String("​Konica Minolta, Inc."); case "018C": return new String("​Wilo SE"); case "018D": return new String("​Extron Design Services"); case "018E": return new String("​Fitbit, Inc."); case "018F": return new String("​Fireflies Systems"); case "0190": return new String("​Intelletto Technologies Inc."); case "0191": return new String("​FDK CORPORATION"); case "0192": return new String("​Cloudleaf, Inc"); case "0193": return new String("​Maveric Automation LLC"); case "0194": return new String("​Acoustic Stream Corporation"); case "0195": return new String("​Zuli"); case "0196": return new String("​Paxton Access Ltd"); case "0197": return new String("​WiSilica Inc"); case "0198": return new String("​Vengit Limited"); case "0199": return new String("​SALTO SYSTEMS S.L."); case "019A": return new String("​TRON Forum (formerly T-Engine Forum)"); case "019B": return new String("​CUBETECH s.r.o."); case "019C": return new String("​Cokiya Incorporated"); case "019D": return new String("​CVS Health"); case "019E": return new String("​Ceruus"); case "019F": return new String("​Strainstall Ltd"); case "01A0": return new String("​Channel Enterprises (HK) Ltd."); case "01A1": return new String("​FIAMM"); case "01A2": return new String("​GIGALANE.CO.,LTD"); case "01A3": return new String("​EROAD"); case "01A4": return new String("​Mine Safety Appliances"); case "01A5": return new String("​Icon Health and Fitness"); case "01A6": return new String("​Asandoo GmbH"); case "01A7": return new String("​ENERGOUS CORPORATION"); case "01A8": return new String("​Taobao"); case "01A9": return new String("​Canon Inc."); case "01AA": return new String("​Geophysical Technology Inc."); case "01AB": return new String("​Facebook, Inc."); case "01AC": return new String("​Nipro Diagnostics, Inc."); case "01AD": return new String("​FlightSafety International"); case "01AE": return new String("​Earlens Corporation"); case "01AF": return new String("​Sunrise Micro Devices, Inc."); case "01B0": return new String("​Star Micronics Co., Ltd."); case "01B1": return new String("​Netizens Sp. z o.o."); case "01B2": return new String("​Nymi Inc."); case "01B3": return new String("​Nytec, Inc."); case "01B4": return new String("​Trineo Sp. z o.o."); case "01B5": return new String("​Nest Labs Inc."); case "01B6": return new String("​LM Technologies Ltd"); case "01B7": return new String("​General Electric Company"); case "01B8": return new String("​i+D3 S.L."); case "01B9": return new String("​HANA Micron"); case "01BA": return new String("​Stages Cycling LLC"); case "01BB": return new String("​Cochlear Bone Anchored Solutions AB"); case "01BC": return new String("​SenionLab AB"); case "01BD": return new String("​Syszone Co., Ltd"); case "01BE": return new String("​Pulsate Mobile Ltd."); case "01BF": return new String("​Hong Kong HunterSun Electronic Limited"); case "01C0": return new String("​pironex GmbH"); case "01C1": return new String("​BRADATECH Corp."); case "01C2": return new String("​Transenergooil AG"); case "01C3": return new String("​Bunch"); case "01C4": return new String("​DME Microelectronics"); case "01C5": return new String("​Bitcraze AB"); case "01C6": return new String("​HASWARE Inc."); case "01C7": return new String("​Abiogenix Inc."); case "01C8": return new String("​Poly-Control ApS"); case "01C9": return new String("​Avi-on"); case "01CA": return new String("​Laerdal Medical AS"); case "01CB": return new String("​Fetch My Pet"); case "01CC": return new String("​Sam Labs Ltd."); case "01CD": return new String("​Chengdu Synwing Technology Ltd"); case "01CE": return new String("​HOUWA SYSTEM DESIGN, k.k."); case "01CF": return new String("​BSH"); case "01D0": return new String("​Primus Inter Pares Ltd"); case "01D1": return new String("​August"); case "01D2": return new String("​Gill Electronics"); case "01D3": return new String("​Sky Wave Design"); case "01D4": return new String("​Newlab S.r.l."); case "01D5": return new String("​ELAD srl​"); case "01D6": return new String("​​G-wearables inc."); case "01D7": return new String("​​Squadrone Systems Inc."); case "01D8": return new String("​​Code Corporation"); case "01D9": return new String("​​Savant Systems LLC"); case "01DA": return new String("​​Logitech International SA"); case "01DB": return new String("​​Innblue Consulting"); case "01DC": return new String("​​iParking Ltd."); case "01DD": return new String("​​Koninklijke Philips Electronics N.V."); case "01DE": return new String("​​Minelab Electronics Pty Limited"); case "01DF": return new String("​​Bison Group Ltd."); case "01E0": return new String("​​Widex A/S"); case "01E1": return new String("​​Jolla Ltd"); case "01E2": return new String("​​Lectronix, Inc."); case "01E3": return new String("​​Caterpillar Inc"); case "01E4": return new String("​​Freedom Innovations"); case "01E5": return new String("​​Dynamic Devices Ltd"); case "01E6": return new String("​​Technology Solutions (UK) Ltd"); case "01E7": return new String("​​IPS Group Inc."); case "01E8": return new String("​​STIR"); case "01E9": return new String("​Sano, Inc​"); case "01EA": return new String("​Advanced Application Design, Inc.​"); case "01EB": return new String("AutoMap LLC​"); case "01EC": return new String("​​Spreadtrum Communications Shanghai Ltd"); case "01ED": return new String("​​CuteCircuit LTD"); case "01EE": return new String("​​Valeo Service"); case "01EF": return new String("​​Fullpower Technologies, Inc."); case "01F0": return new String("​​KloudNation"); case "01F1": return new String("​​Zebra Technologies Corporation"); case "01F2": return new String("​​Itron, Inc."); case "01F3": return new String("​​The University of Tokyo"); case "01F4": return new String("​​UTC Fire and Security"); case "01F5": return new String("​​Cool Webthings Limited"); case "01F6": return new String("​​DJO Global"); case "01F7": return new String("​​Gelliner Limited"); case "01F8": return new String("​​Anyka (Guangzhou) Microelectronics Technology Co, LTD"); case "01F9": return new String("​​Medtronic, Inc."); case "01FA": return new String("​​Gozio, Inc."); case "01FB": return new String("​​Form Lifting, LLC"); case "01FC": return new String("​​Wahoo Fitness, LLC"); case "01FD": return new String("​​Kontakt Micro-Location Sp. z o.o."); case "01FE": return new String("​​Radio System Corporation"); case "01FF": return new String("​​Freescale Semiconductor, Inc."); case "0200": return new String("​​Verifone Systems PTe Ltd. Taiwan Branch"); case "0201": return new String("​​AR Timing"); case "0202": return new String("​​Rigado LLC"); case "0203": return new String("​​Kemppi Oy"); case "0204": return new String("​Tapcentive Inc."); case "0205": return new String("Smartbotics Inc.​"); case "0206": return new String("​Otter Products, LLC​"); case "0207": return new String("​STEMP Inc."); case "0208": return new String("​​LumiGeek LLC"); case "0209": return new String("​InvisionHeart Inc."); case "020A": return new String("​Macnica Inc. ​"); case "020B": return new String("​​Jaguar Land Rover Limited"); case "020C": return new String("​​CoroWare Technologies, Inc"); case "020D": return new String("​​Simplo Technology Co., LTD"); case "020E": return new String("​​Omron Healthcare Co., LTD"); case "020F": return new String("​​Comodule GMBH"); case "0210": return new String("​​ikeGPS"); case "0211": return new String("​​Telink Semiconductor Co. Ltd"); case "0212": return new String("​​Interplan Co., Ltd"); case "0213": return new String("​​Wyler AG"); case "0214": return new String("​​IK Multimedia Production srl"); case "0215": return new String("​​Lukoton Experience Oy"); case "0216": return new String("​​MTI Ltd"); case "0217": return new String("​​Tech4home, Lda"); case "0218": return new String("​​Hiotech AB"); case "0219": return new String("​​DOTT Limited"); case "021A": return new String("​​Blue Speck Labs, LLC"); case "021B": return new String("​​Cisco Systems Inc"); case "021C": return new String("​​Mobicomm Inc"); case "021D": return new String("​​Edamic"); case "021E": return new String("​​Goodnet Ltd"); case "021F": return new String("​​Luster Leaf Products Inc"); case "0220": return new String("​​Manus Machina BV"); case "0221": return new String("​​Mobiquity Networks Inc"); case "0222": return new String("​​Praxis Dynamics"); case "0223": return new String("​​Philip Morris Products S.A."); case "0224": return new String("​Comarch SA"); case "0225": return new String("​Nestlé Nespresso S.A."); case "0226": return new String("​​Merlinia A/S"); case "0227": return new String("​LifeBEAM Technologies"); case "0228": return new String("​​Twocanoes Labs, LLC"); case "0229": return new String("​​Muoverti Limited"); case "022A": return new String("​Stamer Musikanlagen GMBH"); case "022B": return new String("​​Tesla Motors"); case "022C": return new String("​​Pharynks Corporation"); case "022D": return new String("​​Lupine"); case "022E": return new String("​​Siemens AG"); case "022F": return new String("​​Huami (Shanghai) Culture Communication CO., LTD"); case "0230": return new String("​​Foster Electric Company, Ltd"); case "0231": return new String("​ETA SA"); case "0232": return new String("​x-Senso Solutions Kft"); case "0233": return new String("​​Shenzhen SuLong Communication Ltd"); case "0234": return new String("​​FengFan (BeiJing) Technology Co, Ltd"); case "0235": return new String("​​Qrio Inc"); case "0236": return new String("​​Pitpatpet Ltd"); case "0237": return new String("​​MSHeli s.r.l."); case "0238": return new String("​​Trakm8 Ltd"); case "0239": return new String("​​JIN CO, Ltd"); case "023A": return new String("​​Alatech Technology"); case "023B": return new String("​​Beijing CarePulse Electronic Technology Co, Ltd"); case "023C": return new String("​​Awarepoint"); case "023D": return new String("​​ViCentra B.V."); case "023E": return new String("​​Raven Industries"); case "023F": return new String("​​WaveWare Technologies"); case "0240": return new String("​​Argenox Technologies"); case "0241": return new String("​​Bragi GmbH"); case "0242": return new String("​​16Lab Inc"); case "0243": return new String("​​Masimo Corp"); case "0244": return new String("​​Iotera Inc."); case "0245": return new String("​​Endress+Hauser"); case "0246": return new String("​​ACKme Networks, Inc."); case "0247": return new String("​​FiftyThree Inc."); case "0248": return new String("​Parker Hannifin Corp​"); case "0249": return new String("​​Transcranial Ltd"); case "024A": return new String("​​Uwatec AG"); case "024B": return new String("​​Orlan LLC"); case "024C": return new String("​​Blue Clover Devices"); case "024D": return new String("​​M-Way Solutions GmbH"); case "024E": return new String("​​Microtronics Engineering GmbH"); case "024F": return new String("​​Schneider Schreibgeräte GmbH"); case "0250": return new String("​​Sapphire Circuits LLC"); case "0251": return new String("​​Lumo Bodytech Inc."); case "0252": return new String("​​UKC Technosolution"); case "0253": return new String("​​Xicato Inc."); case "0254": return new String("​​Playbrush"); case "0255": return new String("​​Dai Nippon Printing Co., Ltd."); case "0256": return new String("​​G24 Power Limited"); case "0257": return new String("​​AdBabble Local Commerce Inc."); case "0258": return new String("​​Devialet SA"); case "0259": return new String("​​ALTYOR"); case "025A": return new String("​​University of Applied Sciences Valais/Haute Ecole Valaisanne"); case "025B": return new String("​​Five Interactive, LLC dba Zendo"); case "025C": return new String("​​NetEase (Hangzhou) Network co.Ltd."); case "025D": return new String("​​Lexmark International Inc."); case "025E": return new String("​​Fluke Corporation"); case "025F": return new String("​Yardarm Technologies​"); case "0260": return new String("​​SensaRx"); case "0261": return new String("​​SECVRE GmbH"); case "0262": return new String("​​Glacial Ridge Technologies"); case "0263": return new String("​​Identiv, Inc."); case "0264": return new String("DDS, Inc."); case "0265": return new String("​​SMK Corporation"); case "0266": return new String("​​Schawbel Technologies LLC"); case "0267": return new String("​​XMI Systems SA"); case "0268": return new String("​​Cerevo"); case "0269": return new String("​​​Torrox GmbH & Co KG"); case "026A": return new String("​​​Gemalto"); case "026B": return new String("​​DEKA Research & Development Corp.​"); case "026C": return new String("​​Domster Tadeusz Szydlowski"); case "026D": return new String("​​Technogym SPA​"); case "026E": return new String("​​FLEURBAEY BVBA"); case "026F": return new String("​​Aptcode Solutions​"); case "0270": return new String("​​LSI ADL Technology​"); case "0271": return new String("​​Animas Corp"); case "0272": return new String("​​Alps Electric Co., Ltd."); case "0273": return new String("​​OCEASOFT"); case "0274": return new String("​​Motsai Research"); case "0275": return new String("​​Geotab"); case "0276": return new String("​​E.G.O. Elektro-Gerätebau GmbH"); case "0277": return new String("​​​bewhere inc"); case "0278": return new String("​​Johnson Outdoors Inc"); case "0279": return new String("​​steute Schaltgerate GmbH & Co. KG"); case "027A": return new String("​​Ekomini in​c.​"); case "027B": return new String("​DEFA AS"); case "027C": return new String("​Aseptika Ltd​"); case "027D": return new String("​​HUAWEI Technologies Co., Ltd. ( 华为技术有限公司 )​"); case "027E": return new String("​HabitAware, LLC"); case "027F": return new String("​​ruwido austria gmbh​"); case "0280": return new String("​​ITEC corporation"); case "0281": return new String("​​StoneL​"); case "0282": return new String("​Sonova AG"); case "0283": return new String("​​Maven Machines, Inc."); case "0284": return new String("​​Synapse Electronics"); case "0285": return new String("​​Standard Innovation Inc."); case "0286": return new String("​​RF Code, Inc."); case "0287": return new String("​​Wally Ventures S.L."); case "0288": return new String("​​Willowbank Electronics Ltd"); case "0289": return new String("​​SK Telecom"); case "028A": return new String("​​Jetro AS"); case "028B": return new String("​​Code Gears LTD"); case "028C": return new String("​​NANOLINK APS"); case "028D": return new String("​​​IF, LLC"); case "028E": return new String("​​RF Digital Corp"); case "028F": return new String("​​Church & Dwight Co., Inc"); case "0290": return new String("​​Multibit Oy​"); case "0291": return new String("​​CliniCloud Inc​"); case "0292": return new String("​​​SwiftSensors"); case "0293": return new String("​Blue Bite​​"); case "0294": return new String("​​​ELIAS GmbH"); case "0295": return new String("​​Sivantos GmbH"); case "0296": return new String("​​Petzl​"); case "0297": return new String("​​storm power ltd"); case "0298": return new String("​​EISST Ltd​"); case "0299": return new String("​​Inexess Technology Simma KG​"); case "029A": return new String("​​​Currant, Inc."); case "029B": return new String("​​C2 Development, Inc.​"); case "029C": return new String("​​Blue Sky Scientific, LLC"); case "029D": return new String("​​ALOTTAZS LABS, LLC"); case "029E": return new String("​​Kupson spol. s r.o."); case "029F": return new String("​​Areus Engineering GmbH​"); case "02A0": return new String("​​Impossible Camera GmbH"); case "02A1": return new String("​​InventureTrack Systems​"); case "02A2": return new String("​​​LockedUp"); case "02A3": return new String("​​Itude"); case "02A4": return new String("​​Pacific Lock Company"); case "02A5": return new String("​​Tendyron Corporation ( 天地融科技股份有限公司 )​"); case "02A6": return new String("​​Robert Bosch GmbH"); case "02A7": return new String("​​Illuxtron international B.V."); case "02A8": return new String("​​miSport Ltd."); case "02A9": return new String("​​Chargelib"); case "02AA": return new String("​​​Doppler Lab"); case "02AB": return new String("​​BBPOS Limited"); case "02AC": return new String("​​RTB Elektronik GmbH & Co. KG​​"); case "02AD": return new String("​​Rx Networks, Inc."); case "02AE": return new String("​​​WeatherFlow, Inc."); case "02AF": return new String("​Technicolor USA Inc.​"); case "02B0": return new String("​​Bestechnic(Shanghai),Ltd"); case "02B1": return new String("​​​Raden Inc"); case "02B2": return new String("​​JouZen Oy"); case "02B3": return new String("​CLABER S.P.A."); case "02B4": return new String("​​Hyginex, Inc."); case "02B5": return new String("​​HANSHIN ELECTRIC RAILWAY CO.,LTD.​"); case "02B6": return new String("​​Schneider Electric"); case "02B7": return new String("​​Oort Technologies LLC​"); case "02B8": return new String("​​Chrono Therapeutics"); case "02B9": return new String("​Rinnai Corporation"); case "02BA": return new String("​​​Swissprime Technologies AG"); case "02BB": return new String("​​Koha.,Co.Ltd"); case "02BC": return new String("​​Genevac Ltd​"); case "02BD": return new String("​​​Chemtronics"); case "02BE": return new String("​​Seguro Technology Sp. z o.o."); case "02BF": return new String("​​Redbird Flight Simulations"); case "02C0": return new String("​​Dash Robotics"); case "02C1": return new String("​​LINE Corporation​"); case "02C2": return new String("​​​Guillemot Corporation"); case "02C3": return new String("​​Techtronic Power Tools Technology Limited"); case "02C4": return new String("​​Wilson Sporting Goods"); case "02C5": return new String("​​Lenovo (Singapore) Pte Ltd. ( 联想(新加坡) )​"); case "02C6": return new String("​​Ayatan Sensors"); case "02C7": return new String("​​Electronics Tomorrow Limited"); case "02C8": return new String("​​VASCO Data Security International, Inc.​"); case "02C9": return new String("​​PayRange Inc.​"); case "02CA": return new String("​​ABOV ​Semiconductor"); case "02CB": return new String("​​​AINA-Wireless Inc.​"); case "02CC": return new String("​​​Eijkelkamp Soil & Water"); case "02CD": return new String("​​BMA ergonomics b.v."); case "02CE": return new String("​​​Teva Branded Pharmaceutical Products R&D, Inc.​"); case "02CF": return new String("​​Anima"); case "02D0": return new String("​​3M"); case "02D1": return new String("​​​Empatica Srl"); case "02D2": return new String("​​​​Afero, Inc."); case "02D3": return new String("​​Powercast Corporation"); case "02D4": return new String("​​Secuyou ApS"); case "02D5": return new String("​​​OMRON Corporation"); case "02D6": return new String("​​Send Solutions"); case "02D7": return new String("​​​NIPPON SYSTEMWARE CO.,LTD."); case "02D8": return new String("​​Neosfar"); case "02D9": return new String("​​Fliegl Agrartechnik GmbH"); case "02DA": return new String("​​​Gilvader​"); case "02DB": return new String("​​Digi International Inc (R)"); case "02DC": return new String("​​DeWalch Technologies, Inc.​"); case "02DD": return new String("​​Flint Rehabilitation Devices, LLC"); case "02DE": return new String("​​​Samsung SDS Co., Ltd."); case "02DF": return new String("​​Blur Product Development​"); case "02E0": return new String("​​University of Michigan"); case "02E1": return new String("​​Victron Energy BV​"); case "02E2": return new String("​​​​NTT docomo"); case "02E3": return new String("​​Carmanah Technologies Corp.​"); case "02E4": return new String("​​​Bytestorm Ltd."); case "02E5": return new String("​​Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )"); case "02E6": return new String("​​Unwire​"); case "02E7": return new String("​​Connected Yard, Inc."); case "02E8": return new String("​​American Music Environments"); case "02E9": return new String("​​Sensogram Technologies, Inc."); case "02EA": return new String("​​Fujitsu Limited"); case "02EB": return new String("​​Ardic Technology"); case "02EC": return new String("​​Delta Systems, Inc"); case "02ED": return new String("​​HTC Corporation"); case "02EE": return new String("​​Citizen Holdings Co., Ltd."); case "02EF": return new String("​​SMART-INNOVATION.inc"); case "02F0": return new String("​​Blackrat Software"); case "02F1": return new String("​The Idea Cave, LLC"); case "02F2": return new String("​GoPro, Inc."); case "02F3": return new String("​AuthAir, Inc"); case "02F4": return new String("​Vensi, Inc."); case "02F5": return new String("​Indagem Tech LLC"); case "02F6": return new String("​Intemo Technologies"); case "02F7": return new String("​DreamVisions co., Ltd."); case "02F8": return new String("​Runteq Oy Ltd "); case "02F9": return new String("​IMAGINATION TECHNOLOGIES LTD "); case "02FA": return new String("​CoSTAR Technologies "); case "02FB": return new String("​Clarius Mobile Health Corp. "); case "02FC": return new String("​Shanghai Frequen Microelectronics Co., Ltd. "); case "02FD": return new String("​Uwanna, Inc. "); case "02FE": return new String("​Lierda Science & Technology Group Co., Ltd."); case "02FF": return new String("​Silicon Laboratories"); case "0300": return new String("​World Moto Inc."); case "0301": return new String("​Giatec Scientific Inc."); case "0302": return new String("​Loop Devices, Inc"); case "0303": return new String("​IACA electronique "); case "0304": return new String("​Martians Inc "); case "0305": return new String("​Swipp ApS "); case "0306": return new String("​Life Laboratory Inc. "); case "0307": return new String("​FUJI INDUSTRIAL CO.,LTD."); case "0308": return new String("​Surefire, LLC "); case "0309": return new String("​Dolby Labs "); case "030A": return new String("​Ellisys "); case "030B": return new String("​Magnitude Lighting Converters "); case "030C": return new String("​Hilti AG "); case "030D": return new String("​Devdata S.r.l. "); case "030E": return new String("​Deviceworx "); case "030F": return new String("​Shortcut Labs "); case "0310": return new String("​SGL Italia S.r.l."); case "0311": return new String("​PEEQ DATA"); case "0312": return new String("​Ducere Technologies Pvt Ltd"); case "0313": return new String("​DiveNav, Inc."); case "0314": return new String("​RIIG AI Sp. z o.o."); case "0315": return new String("​Thermo Fisher Scientific"); case "0316": return new String("​AG Measurematics Pvt. Ltd. "); case "0317": return new String("​CHUO Electronics CO., LTD. "); case "0318": return new String("​Aspenta International "); case "0319": return new String("​Eugster Frismag AG "); case "031A": return new String("​Amber wireless GmbH"); case "031B": return new String("​HQ Inc"); case "031C": return new String("​Lab Sensor Solutions"); case "031D": return new String("​Enterlab ApS"); case "031E": return new String("​Eyefi, Inc."); case "031F": return new String("​MetaSystem S.p.A"); case "0320": return new String("​SONO ELECTRONICS. CO., LTD"); case "0321": return new String("​Jewelbots"); case "0322": return new String("​Compumedics Limited "); case "0323": return new String("​Rotor Bike Components "); case "0324": return new String("​Astro, Inc."); case "0325": return new String("​Amotus Solutions "); case "0326": return new String("​Healthwear Technologies (Changzhou)Ltd "); case "0327": return new String("​Essex Electronics "); case "0328": return new String("​Grundfos A/S "); case "0329": return new String("​Eargo, Inc. "); case "032A": return new String("​Electronic Design Lab "); case "032B": return new String("​ESYLUX "); case "032C": return new String("​NIPPON SMT.CO.,Ltd "); case "032D": return new String("​BM innovations GmbH"); case "032E": return new String("​indoormap "); case "032F": return new String("​OttoQ Inc "); case "0330": return new String("​North Pole Engineering "); case "0331": return new String("​3flares Technologies Inc. "); case "0332": return new String("​Electrocompaniet A.S. "); case "0333": return new String("​Mul-T-Lock "); case "0334": return new String("​Corentium AS "); case "0335": return new String("​Enlighted Inc "); case "0336": return new String("​GISTIC "); case "0337": return new String("​AJP2 Holdings, LLC "); case "0338": return new String("​COBI GmbH "); case "0339": return new String("​Blue Sky Scientific, LLC "); case "033A": return new String("​Appception, Inc. "); case "033B": return new String("​Courtney Thorne Limited "); case "033C": return new String("​Virtuosys "); case "033D": return new String("​TPV Technology Limited "); case "033E": return new String("​Monitra SA "); case "033F": return new String("​Automation Components, Inc. "); case "0340": return new String("​Letsense s.r.l. "); case "0341": return new String("​Etesian Technologies LLC "); case "0342": return new String("​GERTEC BRASIL LTDA."); case "0343": return new String("​Drekker Development Pty. Ltd. "); case "0344": return new String("​Whirl Inc "); case "0345": return new String("​Locus Positioning "); case "0346": return new String("​Acuity Brands Lighting, Inc "); case "0347": return new String("​Prevent Biometrics "); case "0348": return new String("​Arioneo "); case "0349": return new String("​VersaMe "); case "034A": return new String("​Vaddio "); case "034B": return new String("​Libratone A/S "); case "034C": return new String("​HM Electronics, Inc. "); case "034D": return new String("​TASER International, Inc. "); case "034E": return new String("​Safe Trust Inc."); case "034F": return new String("​Heartland Payment Systems "); case "0350": return new String("​Bitstrata Systems Inc. "); case "0351": return new String("​Pieps GmbH "); case "0352": return new String("​iRiding(Xiamen)Technology Co.,Ltd. "); case "0353": return new String("​Alpha Audiotronics, Inc. "); case "0354": return new String("​TOPPAN FORMS CO.,LTD. "); case "FFFF": return new String("​​Generic"); default: return new String("​​Not recognized (" + code + ")"); } } /** * Ritorna il nome esteso del codice di tipo pacchetto * @param packetType è il codice (decimale) del tipo di pacchetto * @return */ public static String packetType(int packetType) { switch(packetType) { case 0: return new String("Connectable Advertisement packet"); case 2: return new String("Non Connectable Advertisement packet"); case 4: return new String("Scan response packet"); case 6: return new String("Discoverable advertisement packet"); default: return new String("Not recognized (" + packetType + ")"); } } }
true
c925641912d9a4ad995d9325a63ad9f1aafe8a40
Java
wanghengjie563135/gitresp2
/src/whj/edu/tjcu/Test/jacksonTest.java
UTF-8
3,636
2.859375
3
[]
no_license
package whj.edu.tjcu.Test; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; import whj.edu.tjcu.domain.Person; import javax.xml.crypto.Data; import java.io.File; import java.io.FileWriter; import java.util.*; public class jacksonTest { @Test public void test() throws Exception { //创建persond对象 Person person = new Person(); person.setUsername("王恒杰"); person.setAge(21); person.setGender("男"); //创建jackson的核心对象 objectMapper对象解析器(对象映射器) ObjectMapper mapper = new ObjectMapper(); //3;转换 //String value = mapper.writeValueAsString(person); //System.out.println(value); //用writeValue(file,person)写一个a.txt文件 //mapper.writeValue(new File("d://a.txt"),person); mapper.writeValue(new FileWriter("d://b.txt"), person); } @Test public void test1() throws Exception { //创建person对象 Person person = new Person(); person.setUsername("王思楠"); person.setAge(20); person.setGender("女"); person.setBirthday(new Date()); //创建json的Jackson核心类:objectMapper(对象映射器) ObjectMapper mapper = new ObjectMapper(); //转换 String value = mapper.writeValueAsString(person); System.out.println(value); //{"username":"王思楠","age":20,"gender":"女","birthday":1620112346417} // @JsonIgnore:{"username":"王思楠","age":20,"gender":"女"} // @JsonFormat(pattern = "YYYY-MM-dd"):{"username":"王思楠","age":20,"gender":"女","birthday":"2021-05-04"} } @Test public void test2() throws Exception { //创建person对象 Person person = new Person(); person.setUsername("王思楠"); person.setAge(20); person.setGender("女"); person.setBirthday(new Date()); Person person1 = new Person(); person.setUsername("王思楠"); person.setAge(20); person.setGender("女"); person.setBirthday(new Date()); Person person2 = new Person(); person.setUsername("王思楠"); person.setAge(20); person.setGender("女"); person.setBirthday(new Date()); //创建数组 List<Person> list = new ArrayList<Person>(); list.add(person); list.add(person1); list.add(person2); //创建json的Jackson核心类:objectMapper(对象映射器) ObjectMapper mapper = new ObjectMapper(); //转换 String value = mapper.writeValueAsString(list); System.out.println(value); } @Test public void test3() throws Exception { Map<String, Object> map = new HashMap<String, Object>(); map.put("username", "王恒杰"); map.put("age", 22); map.put("gender", "男"); //创建json的Jackson核心类:objectMapper(对象映射器) ObjectMapper mapper = new ObjectMapper(); //转换 String value = mapper.writeValueAsString(map); System.out.println(value); } @Test public void test4() throws Exception { //初始化字符串 String json="{\"username\":\"王思楠\",\"age\":20,\"gender\":\"女\",\"birthday\":1620112346417}"; //jackson核心类objectMapper ObjectMapper mapper = new ObjectMapper(); Person person = mapper.readValue(json, Person.class); System.out.println(person); } }
true
357e3e97c75ad8643a75907a7104cd5b55d7c265
Java
MatthieuPauchet/JavaNetbeans
/GreenVillage/src/main/java/DAL/Rubrique.java
UTF-8
1,284
2.359375
2
[]
no_license
/* * 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 DAL; /** * * @author 80010-58-17 */ public class Rubrique { private int id; private String nom; private String libelle; private String photo; private int Id1; public Rubrique() { } public Rubrique(int id, String nom, String libelle, String photo, int rubId) { this.id = id; this.nom = nom; this.libelle = libelle; this.photo = photo; this.Id1 = rubId; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getLibelle() { return libelle; } public void setLibelle(String libelle) { this.libelle = libelle; } public String getPhoto() { return photo; } public void setPhoto(String photo) { this.photo = photo; } public int getId1() { return Id1; } public void setId1(int Id1) { this.Id1 = Id1; } }
true
75699f69c179e7c0f2f8ced0eea4bb37ec2d45cb
Java
alexandraback/datacollection
/solutions_2755486_0/java/GregD/Wall.java
UTF-8
10,168
3.078125
3
[]
no_license
/* * Google Code Challenge Java * * Code written for the Google Code Challenge by Greg Dougherty * Created: May 20, 2011 * * Copyright 2011 by Greg Dougherty */ package com.google.GregTD.CodeJam2013.Round1C.Problem3; import java.io.*; import java.text.NumberFormat; import java.util.*; /** * Class that lets you pass in a double value to a routine that can then modify it, * i.e. pass the double by reference * @author Greg Dougherty */ class ModInt { int value; } /** * Class that lets you pass in a double value to a routine that can then modify it, * i.e. pass the double by reference * @author Greg Dougherty */ class ModLong { long value; } /** * Class that lets you pass in a double value to a routine that can then modify it, * i.e. pass the double by reference * @author Greg Dougherty */ class ModDouble { double value; } /** * @author Greg Dougherty * */ public class Wall implements Runnable { private int[][] results; private int[][] values; private int numFactors; private int maxFactor; private int numOutputs; private int first; private int last; static PrintStream out; static BufferedReader dataReader; static Deque<String> lineStack = new ArrayDeque<String> (); static Deque<String> wordStack = new ArrayDeque<String> (); static NumberFormat format; static boolean debugging = true; private static final int kNumThreads = 20; /** * @param results * @param values * @param numFactors * @param maxFactor * @param numOutputs * @param first * @param last */ public Wall (int[][] results, int[][] values, int numFactors, int maxFactor, int numOutputs, int first, int last) { this.results = results; this.values = values; this.numFactors = numFactors; this.maxFactor = maxFactor; this.numOutputs = numOutputs; this.first = first; this.last = last; } private static final int kAttackDay = 0; private static final int kAttackCount = kAttackDay + 1; private static final int kAttackStart = kAttackCount + 1; private static final int kAttackEnd = kAttackStart + 1; private static final int kAttackStrength = kAttackEnd + 1; private static final int kDaysBetweenAttacks = kAttackStrength + 1; private static final int kAttackDistance = kDaysBetweenAttacks + 1; private static final int kStrengthDelta = kAttackDistance + 1; private static final int kTribeData = kStrengthDelta + 1; /** * @param args */ public static void main (String[] args) { getDataReader (args); try { String line = readLine (); // Get the number of test cases String[] numbers; int numCases = Integer.parseInt (line); for (int i = 0; i < numCases; ++i) { line = readLine (); int numTribes = Integer.parseInt (line); List<long[]> tribes = new ArrayList<long[]> (); Map<Long, Long> theWall = new HashMap<Long, Long> (); Map<Long, Long> newWall = new HashMap<Long, Long> (); for (int j = 0; j < numTribes; ++j) { line = readLine (); numbers = line.split (" "); long[] row = new long[8]; for (int k = 0; k < kTribeData; ++k) row[k] = Long.parseLong (numbers[k]); tribes.add (row); } int count = 0; while (!tribes.isEmpty ()) { Iterator<long[]> iter = tribes.iterator (); while (iter.hasNext ()) { long[] tribe = iter.next (); if (tribe[kAttackDay] > 0) { --(tribe[kAttackDay]); continue; } tribe[kAttackDay] = tribe[kDaysBetweenAttacks] - 1; count += doAttack (tribe, theWall, newWall); long attacksLeft = tribe[kAttackCount] - 1; if (attacksLeft <= 0) { iter.remove (); continue; } tribe[kAttackCount] = attacksLeft; long dist = tribe[kAttackDistance]; tribe[kAttackStart] += dist; tribe[kAttackEnd] += dist; tribe[kAttackStrength] += tribe[kStrengthDelta]; } theWall.putAll (newWall); newWall.clear (); } // Thread[] threads = new Thread[kNumThreads]; // int block = numCases / kNumThreads; // int min = 0; // int max = block; // for (int j = 0; j < kNumThreads; ++j) // { // } // try // { // for (int j = 0; j < kNumThreads; ++j) // threads[i].join (); // } // catch (InterruptedException oops) // { // oops.printStackTrace (); // } println ("Case #" + (i + 1) + ": " + count); // println ("Case #1:"); // for (int i = 0; i < numLines; ++i) // { // int[] row = results[i]; // for (int k = 0; k < numOutputs; ++k) // print ("" + row[k]); // println (""); // } } close (); } catch (IOException ioE) { ioE.printStackTrace (); } } /** * * @param tribe * @param theWall * @param newWall * @return */ private static int doAttack (long[] tribe, Map<Long, Long> theWall, Map<Long, Long> newWall) { long strength = tribe[kAttackStrength]; long start = tribe[kAttackStart] * 2; long end = tribe[kAttackEnd] * 2; boolean success = false; for (long pos = start; pos <= end; ++pos) { Long key = Long.valueOf (pos); Long value = theWall.get (key); long height = 0; if (value != null) height = value.longValue (); if (height < strength) { success = true; value = newWall.get (key); if (value != null) height = value.longValue (); if (height < strength) newWall.put (key, Long.valueOf (strength)); } } if (success) return 1; return 0; } /* (non-Javadoc) * @see java.lang.Runnable#run() */ public void run () { // Run its cases for (int i = first; i < last; ++i) { int[] products = values[i]; int[] result = new int[numOutputs]; results[i] = result; } } /** * Print a String to System.out, and to the output file, if it exists * @param outString String to print */ protected static final void print (String outString) { if (debugging) System.out.print (outString); if (out != null) out.print (outString); } /** * Println a String to System.out, and to the output file, if it exists * @param outString String to print */ protected static final void println (String outString) { if (debugging) System.out.println (outString); if (out != null) out.println (outString); } /** * Take a line that had been read, and put it back for the next call to get * @param line line that caller doesn't need after all. */ static void unreadLine (String line) { lineStack.addFirst (line); } /** * Get the most recently unread line. If there are no lines that have been read from * the data file and then "unread", get the next lien from the data file * Note; This ignores the contents of the Word Stack. Perhaps it shouldn't? in any case, * when using both readLine and readWord, be aware of the potential for issues to crop up * @return the next line of text * @throws IOException */ static String readLine () throws IOException { if (!lineStack.isEmpty ()) return lineStack.removeFirst (); if (dataReader == null) return null; return dataReader.readLine (); } /** * Take a word that had been read, and puts it back on the stack to be read again. * Major use is when there are multiple tokens in one "word" * @param word The String caller wants to leave for the next caller of readWord */ static void unreadWord (String word) { wordStack.addFirst (word); } /** * Gets the next word from the Word Stack, or from the data file / Line Stack if the * Word Stack is empty. Note that once their are words in the Word Stack, they are decoupled * from the line reading. This might be a bad thing. As a minimum, callers should be aware of * the potential for trouble. * @return The next word * @throws IOException */ static String readWord () throws IOException { while (wordStack.isEmpty ()) { String line = readLine (); if (line == null) return null; String[] splits = line.split ("\\s"); if ((splits != null) && (splits.length > 0)) { for (int i = splits.length - 1; i >= 0; --i) { if (splits[i].length () > 0) wordStack.addFirst (splits[i]); } } } return wordStack.removeFirst (); } /** * Routine that gets the data reader we will use to get all our data * @param args Arguments passed in by caller. First arg should be name * of input data file * result: BufferedReader for the data file, or for stdin if no data file name given or * the file doesn't exist. Note it is not returned to the caller, because callers should only * access this through readLine and readWord. */ private static void getDataReader (String[] args) { File dataFile = null; dataReader = null; if (args.length > 0) dataFile = new File (args[0]); try { // If have a data file, try to open it if (dataFile != null) dataReader = new BufferedReader (new FileReader (dataFile)); } catch (IOException ioE) { ioE.printStackTrace (); dataReader = null; } // If couldn't open a data file, get data from stdin if (dataReader == null) { dataReader = new BufferedReader (new InputStreamReader (System.in)); out = null; debugging = true; // Have to write to System.out } else { String[] nameComponents = args[0].split ("\\."); int numComponents = nameComponents.length; if (nameComponents[numComponents - 1].equalsIgnoreCase ("in")) --numComponents; StringBuilder name = new StringBuilder (); for (int i = 0; i < numComponents; ++i) name.append (nameComponents[i] + "."); name.append ("out"); try { out = new PrintStream (new File (name.toString ())); } catch (FileNotFoundException ioE) { out = null; debugging = true; // Have to write to System.out } } } /** * Close everything we opened */ private static void close () { try { if (dataReader != null) dataReader.close (); if (out != null) out.close (); } catch (IOException oops) { // Ignore } dataReader = null; out = null; } }
true
99292b7443c4d9ea81e598aac6e57a648774b12c
Java
BenMaGit/Hypnosis
/src/gameobject/items/Light.java
UTF-8
1,362
2.65625
3
[]
no_license
/* * 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 gameobject.items; import gameobject.GameObject; import gameobject.ObjectID; import java.awt.Graphics; import scene.Animation; import scene.Texture; /** * * @author alank */ public class Light extends GameObject{ Texture tex = Texture.getInstance(); private Animation Shining; public Light(int x, ObjectID id) { super(x,110,id); this.width = 200; this.height = 200; Shining = new Animation(17, tex.light[0], tex.light[1], tex.light[2], tex.light[3], tex.light[2], tex.light[1], tex.light[0]); } public Light(int x,int y, ObjectID id) { super(x,y,id); this.width = 120; this.height = 120; Shining = new Animation(10, tex.light[0], tex.light[1], tex.light[2], tex.light[3], tex.light[2], tex.light[1], tex.light[0]); } @Override public void tick() { x += xVel; this.Shining.runAnimation(); } @Override public void render(Graphics g) { this.Shining.renderAnimation(g, x, y, width, height); } public void sceneRender(Graphics g) { g.drawImage(tex.light[3], x, y, width, height, null); } }
true
9c1abd5b5dca348b3fc75415fda94f92b373ed5f
Java
saya-ac-cn/dubbo-nacos
/dubbo-nacos-provider1/src/main/java/ac/cn/saya/mapper/OrderMapper.java
UTF-8
685
1.851563
2
[]
no_license
package ac.cn.saya.mapper; /** * Created by Administrator on 2019/4/3 0003. */ import ac.cn.saya.entity.OrderEntity; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; /** * 订单Dao * @Title: OrderMapper * @ProjectName dubbo-nacos * @Description: TODO * @Author Administrator * @Date: 2019/4/3 0003 15:22 * @Description: */ @Mapper @Repository("orderMapper") public interface OrderMapper { /** * @描述 创建订单 * @参数 * @返回值 * @创建人 saya.ac.cn-刘能凯 * @创建时间 2019/4/3 0003 * @修改人和其它信息 */ public Integer create(OrderEntity entity); }
true
929944d2fc34673156d246c8d67c70e6ee391bd9
Java
imzxx/spring-demo
/spring-cloud/rabbitmq-consumer/src/main/java/com/example/rabbitmq/service/FanoutSmsService.java
UTF-8
570
1.929688
2
[]
no_license
package com.example.rabbitmq.service; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Service; /** * @ClassName FanoutEmailService * @Description TODO * @Author zxx * @Date 2021/3/24 2:55 * @Version 1.0 **/ @RabbitListener(queues = {"sms.fanout.queue"}) @Service public class FanoutSmsService { @RabbitHandler public void reviceMessage(String message) { System.out.println("SMS 监听到消息-------》"+message); } }
true
392536ae4570db65a872dfd2b7698bae6053a118
Java
syedzaidahmed/bank
/src/com/bank/dao/IFarmerHouseDao.java
UTF-8
716
1.953125
2
[]
no_license
package com.bank.dao; import java.util.List; import com.bank.beans.Farmer; import com.bank.beans.FarmerHouse; import com.bank.beans.FarmerHouseExample; import com.common.dao.GenericDAO; public interface IFarmerHouseDao extends GenericDAO<FarmerHouse, Long> { public int countByExample(FarmerHouseExample example); public List<FarmerHouse> getHousesByFarmerId(Long farmerId); public int findTotalNumberByFarmerId(Long farmerId); public List<FarmerHouse> findPagingByFarmerId(int pageIndex,int pageSize,String sortField, String sortOrder,Long farmerId); public List<Farmer> findByFarmers(List<Long> farmerIds); public List<FarmerHouse> selectByExample(FarmerHouseExample example); }
true
e427eb67ca17bdfa3852dd65b76bb691e5a11f9b
Java
Ranunculus/znamenka
/src/main/java/ru/znamenka/service/page/client/ClientPageService.java
UTF-8
788
1.828125
2
[]
no_license
package ru.znamenka.service.page.client; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import ru.znamenka.api.domain.ClientApi; import ru.znamenka.jpa.repository.EntityRepository; import ru.znamenka.service.ApiStore; import java.util.List; /** * Created by Сережа on 31.08.2016. */ @Service @Slf4j public class ClientPageService { @Autowired private EntityRepository repo; @Autowired @Qualifier("dataService") private ApiStore service; public List<ClientApi> getClients(){ List<ClientApi> clientApiList = service.findAll(ClientApi.class); return clientApiList; } }
true