blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
0b3c47982c62b68e8555c590201606b257349d25
9f6adf799657bdf9d05c2f7a59a6eba00e431137
/sdk/src/main/java/com/teethen/sdk/xwidget/autolayout/widget/AutoTableLayout.java
a4073b58452e32d06f72e1bf1d70a87ca9d56073
[ "Apache-2.0" ]
permissive
teethen/xsdk
4e96fb44d4a2447429c1f43c44620a622288a05c
1cbaa9993ebab14fd43b6d0e2d94ed2bc34b7827
refs/heads/master
2021-09-19T18:21:10.723517
2018-07-30T07:26:11
2018-07-30T07:26:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,956
java
package com.teethen.sdk.xwidget.autolayout.widget; import android.content.Context; import android.util.AttributeSet; import android.view.ViewGroup; import android.widget.TableLayout; import com.teethen.sdk.xwidget.autolayout.AutoLayoutInfo; import com.teethen.sdk.xwidget.autolayout.utils.AutoLayoutHelper; public class AutoTableLayout extends TableLayout { private AutoLayoutHelper mHelper = new AutoLayoutHelper(this); public AutoTableLayout(Context context) { super(context); } public AutoTableLayout(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (!isInEditMode()) mHelper.adjustChildren(); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); } @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } public static class LayoutParams extends TableLayout.LayoutParams implements AutoLayoutHelper.AutoLayoutParams { private AutoLayoutInfo mAutoLayoutInfo; public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo(c, attrs); } @Override public AutoLayoutInfo getAutoLayoutInfo() { return mAutoLayoutInfo; } public LayoutParams(int width, int height) { super(width, height); } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } public LayoutParams(MarginLayoutParams source) { super(source); } } }
[ "wanda360@qq.com" ]
wanda360@qq.com
adadb48ca6cd158da47e3890fdff997faf3e7ae7
f6286ac3462cb103b9d5de3937345d362e1e9cec
/src/com/uniwin/webkey/core/ui/UsersQueryWin.java
b8fc89bb5cd3a1f714a26768f8a70aadea85fca8
[]
no_license
hebut/Collection
55fb4a8a781b01e9ef0624feb4d013e297301ad7
d5e10dda8fdf1123e8995851b5a8473ba7323d33
refs/heads/master
2016-09-05T15:41:35.899529
2014-01-19T06:16:37
2014-01-19T06:16:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,182
java
package com.uniwin.webkey.core.ui; import java.util.List; import org.zkoss.spring.SpringUtil; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.ext.AfterCompose; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listitem; import org.zkoss.zul.Window; import com.uniwin.webkey.common.exception.DataAccessException; import com.uniwin.webkey.core.itf.IUsersManager; import com.uniwin.webkey.core.model.Users; public class UsersQueryWin extends Window implements AfterCompose { private Listbox users; private IUsersManager usersManager; public List getUsersData() { return usersData; } public void setUsersData(List usersData) { this.usersData = usersData; } public List usersData; public UsersQueryWin() { usersManager = (IUsersManager) SpringUtil.getBean("usersManager"); Listitem item = null; Listcell cell = null; try { usersData = usersManager.getAllUser(); for (Object user : usersData) { item = new Listitem(); cell = new Listcell(((Users) user).getName()); cell.setLabel(((Users) user).getName()); item.appendChild(cell); } } catch (DataAccessException e) { e.printStackTrace(); } } public void afterCompose() { users = (Listbox) this.getFellow("users"); Listitem item = null; Listcell cell = null; try { usersData = usersManager.getAllUser(); for (Object user : usersData) { item = new Listitem(); cell = new Listcell(((Users) user).getName()); cell.setLabel(((Users) user).getName()); item.appendChild(cell); users.appendChild(item); } } catch (DataAccessException e) { e.printStackTrace(); } } public void onPaging$usersPage(Event event) { } }
[ "770506199@qq.com" ]
770506199@qq.com
63799c8d54d360817d8432213707fe1062a20dc3
353bc9732f3fd0c706d1873ac0854a7501164241
/src/main/java/com/deep/application/CorsConfig.java
2675105972420790742bace1ad62ff19dc101dbb
[ "Apache-2.0" ]
permissive
mrHuangWenHai/deep
36156e093c6f7695423d6a867c2b93e8ac058cfd
a37a78ab79a88529cf831a17ae94f9c41c2cd485
refs/heads/master
2021-05-09T01:11:28.026278
2018-08-15T05:53:51
2018-08-15T05:53:51
119,779,509
3
3
null
null
null
null
UTF-8
Java
false
false
953
java
package com.deep.application; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * 说明:跨域请求 * * @author WangBin * @version v1.0 * @date 2018/1/21/ */ //@Configuration //@EnableWebMvc //public class CorsConfig implements WebMvcConfigurer { // // @Override // public void addCorsMappings(CorsRegistry registry) { // //设置允许跨域的路径 //// registry.addMapping("/**"); // //设置允许跨域请求的域名 // // .allowedOrigins("localhost"); // //是否允许证书 不再默认开启 // // .allowCredentials(false) // //设置允许的方法 // // .allowedMethods("*") // //跨域允许时间 // // .maxAge(3600); // } //}
[ "wenhai.hwh@alibaba-inc.com" ]
wenhai.hwh@alibaba-inc.com
3ae207ab893d2b44680d840e7aee23fdbed4b3f9
f11956e0590fdd355da02688f1419c53ffc52f85
/app/src/main/java/com/example/socialize/Posts.java
1ad2e1f72f05044dc336e300ceef3976e9789827
[ "Apache-2.0" ]
permissive
manantyagi25/Socialize
793fa262b71a0faa3bd27b56fea572217ab58b64
dacb96986a31ad71c686f60a7ceb2869cde040f0
refs/heads/main
2023-04-23T03:08:34.330735
2021-05-05T16:36:52
2021-05-05T16:36:52
361,213,769
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package com.example.socialize; import com.google.firebase.database.ServerValue; import java.util.Map; public class Posts { public String postText; public String postBy; public String authorUID; public int likes; public LikedBy likedBy; //public Map<String, Object> date; public String getPostText() { return postText; } public void setPostText(String postText) { this.postText = postText; } public String getPostBy() { return postBy; } public void setPostBy(String postBy) { this.postBy = postBy; } public int getLikes() { return likes; } public void setLikes(int likes) { this.likes = likes; } public LikedBy getLikedBy() { return likedBy; } public void setLikedBy(LikedBy likedBy) { this.likedBy = likedBy; } public String getAuthorUID() { return authorUID; } public void setAuthorUID(String authorUID) { this.authorUID = authorUID; } public Posts(){ } public Posts(String postText, String postBy, int likes, String authorUID, LikedBy likedBy) { this.postText = postText; this.postBy = postBy; this.likes = likes; this.authorUID = authorUID; this.likedBy = likedBy; //this.date = ServerValue.TIMESTAMP; } }
[ "manantyagi24@gmail.com" ]
manantyagi24@gmail.com
680b8caf825b5dec638131505ea9e26a2facf8f1
aad413ba84a801b8d29fa2d9e1fdedeb65ac37b8
/src/example/Tower.java
3cbc98fe25c31f274fa5271d5d2d46a2f47459db
[]
no_license
pankneo/jpa-jws
6ebf90706a710d3e712c3bb6a05d9f27f741c50e
964d4a8556046bd370f39ae474e1b12191ceacd2
refs/heads/master
2021-01-10T20:26:26.694144
2015-10-10T03:57:13
2015-10-10T03:57:13
33,959,188
0
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
package example; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Tower { @Id private int id; private String name; private Double height; private int sides; private int siteId; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getHeight() { return height; } public void setHeight(Double height) { this.height = height; } public int getSides() { return sides; } public void setSides(int sides) { this.sides = sides; } public int getSiteId() { return siteId; } public void setSiteId(int siteId) { this.siteId = siteId; } public Tower(int id, String name, Double height, int sides, int siteId) { super(); this.id = id; this.name = name; this.height = height; this.sides = sides; this.siteId = siteId; } public Tower() { super(); // TODO Auto-generated constructor stub } }
[ "pankneo@gmail.com" ]
pankneo@gmail.com
78d2b04134f60ee5ac3aabdfc05d638ede6327bc
873ba033d4c470f88512544bbaeab2a5dbfbf7a6
/Java/CSC130.hansrajd.lab5a/src/QueueADT.java
859c5b7eb7a438911ab84996c9ff5863177d0733
[]
no_license
derickh93/School-Code
a888c88d8cf1270865b84867c4ed4dcaee619613
fea2081956ceb9941f3ceb58e04fbe8f5b7b4f23
refs/heads/main
2023-05-27T04:41:42.522130
2021-06-10T05:22:04
2021-06-10T05:22:04
301,509,770
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
/** * Title: CSC130hansrajd.lab5a * Filename: QueueADT.java * Date Written: October 19, 2017 * Due Date: October 21, 2017 * Description: This interface defines the methods in a Queue. * *@author Derick Hansraj and Wenjie Cao */ public interface QueueADT<T> { /** Adds one item to the rear of the queue. */ public void enqueue(T d) throws QueueException; /** Removes and returns the item at the front of the queue. */ public T dequeue() throws QueueException; /** Returns without removing the item at the front of the queue. */ public T front()throws QueueException; /** Returns without removing the item at the rear of the queue. */ public T rear()throws QueueException; /** Determines whether or not the queue is empty. */ public boolean isFull(); /** Determines whether or not the queue is empty. */ public boolean isEmpty(); /** Returns a string representing the state of the queue. */ public int getSize(); }
[ "derickhansraj@ymail.com" ]
derickhansraj@ymail.com
c3385c6f64b972383e5fd6e1df41552c08be63db
0f3324cc66e8ccfbcf4f253bd7d0ca2de7c3071f
/src/it/holiday69/tinydb/bitcask/vo/AppendInfo.java
82fe95365d78d57eef9162ba4a5d4ebde0219f71
[]
no_license
fratuz610/TinyDB
2173049359830559eefc8dcfc2fad31ed7d9ec4f
f84d08ead819bee60bca306e86fa2c231f1ce10b
refs/heads/master
2020-02-26T15:10:07.568227
2013-07-30T10:04:59
2013-07-30T10:04:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,129
java
/* Copyright 2013 Stefano Fratini (mail@stefanofratini.it) 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 it.holiday69.tinydb.bitcask.vo; import java.io.File; /** * * @author Stefano */ public class AppendInfo { public File appendFile; public int keySize; public int valueSize; public long valuePosition; public long timestamp; @Override public String toString() { return "AppendInfo{" + "appendFile=" + appendFile + ", keySize=" + keySize + ", valueSize=" + valueSize + ", valuePosition=" + valuePosition + ", timestamp=" + timestamp + '}'; } }
[ "stefano@holiday69.it" ]
stefano@holiday69.it
c6d745c7f7cc4a9965d849bdd1587b585be5e446
8ce2a5ccd8f4557c785650956a78f730d5870609
/ListaLavori.java
2261b2edcf56422705feb13302c94693f71d62c6
[]
no_license
Pbnst/progettoferribonsanto
e272ecac4e70641c834813df758742c337404afd
854a4cfa68fc4e63770b52d714afc048d0c8cead
refs/heads/main
2023-08-26T15:53:55.912842
2021-10-14T08:00:33
2021-10-14T08:00:33
396,801,778
0
0
null
null
null
null
UTF-8
Java
false
false
2,507
java
package com.example.progettooop.model; import java.util.*; import org.json.*; //DA FARE MIRACCOMANDO //import com.example.progettooop.utility.Filtri; //import com.example.progettooop.utility.Filtriuti; public class ListaLavori implements Filtri<Job, Object[]> { private ArrayList<Job> listalavori; private FiltriUti<Job> utils; /* costruttore della lista (oggetto) */ public ListaLavori(ArrayList<Job> listalavori,FiltriUti<Job> utils) { this.listalavori=listalavori; this.utils=utils; } /** costruttore oggetto * */ ListaLavori(ArrayList<Job> listalavori) { this.listalavori=listalavori; this.utils=new FiltriUti<Job>(); } /*metodo che restituisce contenuti della lista * */ public ArrayList<Job> getListalavori(){ return listalavori; } /**metodo che setta nuova lista di job * @param listalavori Oggetti job da immettere */ public void SetListalavori(ArrayList<Job> listalavori) { this.listalavori=listalavori; } /** metodo che restituisce le statistiche sui lavori non in remoto *@param place è il luogo in cui si tiene il lavoro *@return ritorna il numero di lavori in presenza */ public int getFrequenzaplace(String place) { int jobplace=0; for (Job j: listalavori) { if(j.getplace()==place) {jobplace++;} } return jobplace; } /**metodo che calcola il numero di lavori in un luogo particolare * @return ritorna il numero di lavori trovati per quel particolare luogo * */ public int getJoblocated() { int jobloc=0; for (Job j: listalavori) { if(j.getplace()!= null) {jobloc++;} } return jobloc; } /**metodo che calcola il numero di lavori fulltime *@param fulltime indica che il lavoro in questione è fulltime *@return ritorna il numero di lavori fulltime * */ public int getJobfulltime(String fulltime) { int jobfull=0; for(Job j: listalavori) { if(j.getFulltime()!= fulltime) {jobfull++;} } return jobfull; } /**metodo che applica i filtri alla lista *@return listalavori filtrata */ @Override public ArrayList<Job> campoFiltro(String nomeCampo, String operatoreLogico, Object...valore) { return (ArrayList<Job>) utils.select(this.getListalavori(), nomeCampo, operatoreLogico, valore); } /** metodo che inserisce il lavoro passato come argomento alla lista *@param j (job) da inserire * */ public void inserisciJob(Job j) { listalavori.add(j); } /**costruttore senza passaggio di parametri * */ public ListaLavori() { listalavori= new Arraylist<Job>(); } }
[ "noreply@github.com" ]
Pbnst.noreply@github.com
81d3e6152e68511bbe0b91492b9558cab49a2651
ae95c2accc6aa55497d826aecf4e79bc7b59217a
/app/src/main/java/com/israelbulcaotavares/filmespopulares/constants/Constants.java
ab87f21845da994e8a6af95caedd5525bac1b956
[]
no_license
israelbulcaotavares/FilmesPopulares1
a6c46b280db44adec90cc5c27fd34cbd3b78175c
3996fd0a6611c109e9988e0ac9c3709a78175cf3
refs/heads/master
2023-06-22T15:14:47.580748
2021-07-26T15:30:55
2021-07-26T15:30:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,522
java
package com.israelbulcaotavares.filmespopulares.constants; import com.israelbulcaotavares.filmespopulares.util.QueryUtils; public class Constants { public static final String LOG_TAG = QueryUtils.class.getSimpleName(); public static final int CONN_READ_TIME = 10000; public static final int CONN_CONNECT_TIME = 15000; public static final String JSON_ARRAY_RESULTS = "results"; public static final String JSON_KEY_ID = "id"; public static final String JSON_KEY_TITULO = "title"; //titulo public static final String JSON_KEY_VOTACAO = "vote_average"; //media de votacao public static final String JSON_KEY_POSTER_PATH = "poster_path"; //capa do poster public static final String JSON_KEY_SINOPSE = "overview"; //sinopse public static final String JSON_KEY_DATA_LANCAMENTO = "release_date"; //data de lancamento public static final String THE_MOVIE_DB_REQUEST_URL = "https://api.themoviedb.org/3/movie/"; public static final String PARAM_API_KEY = "api_key"; public static final String GET = "GET"; public static final String API_KEY = "BuildConfig.API_KEY"; //TODO: local para API deixei na gradle.properties public static final String PARAM_LANGUAGE = "language"; //lingua public static final String PT_BR = "pt-BR"; //pt-br public static final String PARAM_REGIAO = "region"; //lingua public static final String REGIAO_BR = "BR"; //lingua public static final String THE_MOVIE_DB_IMAGE_REQUEST_URL = "https://image.tmdb.org/t/p/w185"; }
[ "israelbulcaotavares@gmail.com" ]
israelbulcaotavares@gmail.com
226261d3ca41ef6f4e8d192f9895b906f9223dd1
2046e29ffa09fb0399220caac4113eea8a14e668
/AeG2/ListaSimplesEncadeada.java
2608bce3e41682129d956ba9c4a443ea8b4459de
[]
no_license
JulioSilveiraFTTB/estrutura_de_dados
701a5300a03ec8d11e3e3deba1707739140fdeba
277e64dcceeb04254efb0d956ed33cd12a65b12f
refs/heads/main
2023-07-14T05:52:44.498983
2021-08-28T17:49:42
2021-08-28T17:49:42
377,971,995
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
1,552
java
public class ListaSimplesEncadeada { private Celula primeiro; private Celula ultimo; private Celula posAtual; // Adicionar uma pessoa ao final da lista public void adicionar(Pessoa valor){ Celula celula = new Celula(); celula.setValor(valor); if(primeiro == null && ultimo == null){ primeiro = celula; ultimo = celula; } else{ ultimo.setProximo(celula); ultimo = celula; } } // Remove uma pessoa do final da lista public void remover(){ if(primeiro.getProximo() != null){ Celula celula = this.recuperarPenultimo(this.primeiro); ultimo = celula; celula.setProximo(null); } else { primeiro = ultimo = null; } } // Recupera o penúltimo item da lista private Celula recuperarPenultimo(Celula celula){ if(celula.getProximo().equals(ultimo)){ return celula; } return recuperarPenultimo(celula.getProximo()); } public boolean temProximo(){ if(primeiro == null){ return false; } else if(posAtual == null) { posAtual = primeiro; return true; } else { boolean temProximo = posAtual.getProximo() != null ? true : false; posAtual = posAtual.getProximo(); return temProximo; } } public Celula getPosAtual(){ return this.posAtual; } }
[ "noreply@github.com" ]
JulioSilveiraFTTB.noreply@github.com
9184836ca86d58d0fe79839488719fe4f3ba5a9c
55033e61f7ddae9eb63e7183650151fb7787f01b
/kraken-engine/src/main/java/kraken/runtime/engine/events/ValueChangedEvent.java
7ddeea1ddb5f615495ebd8cf6c22da8a7b9dcf87
[ "Apache-2.0" ]
permissive
cothong/kraken-rules
7e53a47a44cbd4ecdb940542f0b44d3daaf3035b
920a5a23492b8bc0a1c4621f674a145c53dea5c6
refs/heads/main
2023-08-30T00:50:14.186463
2021-11-15T16:12:36
2021-11-15T16:12:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,110
java
/* * Copyright 2019 EIS Ltd and/or one of its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package kraken.runtime.engine.events; import kraken.annotations.API; import kraken.runtime.engine.context.data.DataContext; /** * Event fired by derive loop when value of attribute is changed by rule engine * * @author rimas * @since 1.0 */ @API public class ValueChangedEvent implements RuleEvent { /** * Target path to changed field attribute */ private String attributeTarget; /** * Context definition name for context on which event was emitted */ private String contextName; /** * Context instance identification string for context on which event was emitted */ private String contextId; /** * New field value */ private Object newValue; /** * Old field value */ private Object previousValue; public ValueChangedEvent(DataContext context, String path, Object oldValue, Object newValue) { this.contextName = context.getContextName(); this.contextId = context.getContextId(); this.attributeTarget = path; this.previousValue = oldValue; this.newValue = newValue; } public String getAttributeTarget() { return attributeTarget; } public String getContextName() { return contextName; } public Object getNewValue() { return newValue; } public Object getPreviousValue() { return previousValue; } public String getContextId() { return contextId; } }
[ "rzukaitis@eisgroup.com" ]
rzukaitis@eisgroup.com
b3abbcf54bf5d47a5dee11dc6ddb4054103f28b9
af1ab3b6ed945a53742891afb85871f0df4bc0d1
/03.IteratorsAndComparators/HomeworkIteratorAndComparators/src/p05_comparingObjects/Human.java
4e6b9ea7ebe3bb9d3404e09f3db9d4f276413c8f
[]
no_license
vasilgramov/java-oop-advanced
94f5321e89c0d9e446a80e1bff38947c22c5364d
909ef2abfdd225db09f29e5fec578a1edd493006
refs/heads/master
2021-06-13T22:37:19.852587
2017-04-21T16:19:58
2017-04-21T16:19:58
84,982,046
2
0
null
null
null
null
UTF-8
Java
false
false
147
java
package p05_comparingObjects; public interface Human extends Comparable<Human>{ String getName(); int getAge(); String getTown(); }
[ "gramovv@gmail.com" ]
gramovv@gmail.com
9ff3bc3e1d68336cf8c8a3e508ff183c28c4c09f
7637bf5f141be579ae7728511ba93b13bf0bb768
/nenr/zad2/src/hr/fer/zemris/fuzzy/Tests.java
f1a04b252e020f7471fbe6a07768c6744cbd5a55
[]
no_license
antifriz/sedmestar
6d402a983abb48dcdeda2f7ed05ff8d865cb5cd2
6045c01255819aa5fcbe896301bda30ae9136648
refs/heads/master
2021-01-18T02:42:59.955671
2016-03-28T11:51:47
2016-03-28T11:51:47
44,000,772
0
0
null
null
null
null
UTF-8
Java
false
false
6,571
java
package hr.fer.zemris.fuzzy; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; import static junit.framework.TestCase.assertEquals; /** * Created by ivan on 10/22/15. */ public class Tests { private final ByteArrayOutputStream mByteArrayOutputStream = new ByteArrayOutputStream(); private final PrintStream mOut = System.out; @Before public void setUp() throws Exception { System.setOut(new PrintStream(mByteArrayOutputStream)); } private void assertEqualsOut(String path) { try (Scanner s = new Scanner(new File(path)).useDelimiter("\\Z")) { String string = mByteArrayOutputStream.toString().trim(); assertEquals(s.next().trim(), string); mOut.print(string); } catch (FileNotFoundException e) { } } @Test public void primjer1() { IDomain u = Domain.intRange(1, 6); // {1,2,3,4,5} IDomain u2 = Domain.combine(u, u); IFuzzySet r1 = new MutableFuzzySet(u2) .set(DomainElement.of(1, 1), 1) .set(DomainElement.of(2, 2), 1) .set(DomainElement.of(3, 3), 1) .set(DomainElement.of(4, 4), 1) .set(DomainElement.of(5, 5), 1) .set(DomainElement.of(3, 1), 0.5) .set(DomainElement.of(1, 3), 0.5); IFuzzySet r2 = new MutableFuzzySet(u2) .set(DomainElement.of(1, 1), 1) .set(DomainElement.of(2, 2), 1) .set(DomainElement.of(3, 3), 1) .set(DomainElement.of(4, 4), 1) .set(DomainElement.of(5, 5), 1) .set(DomainElement.of(3, 1), 0.5) .set(DomainElement.of(1, 3), 0.1); IFuzzySet r3 = new MutableFuzzySet(u2) .set(DomainElement.of(1, 1), 1) .set(DomainElement.of(2, 2), 1) .set(DomainElement.of(3, 3), 0.3) .set(DomainElement.of(4, 4), 1) .set(DomainElement.of(5, 5), 1) .set(DomainElement.of(1, 2), 0.6) .set(DomainElement.of(2, 1), 0.6) .set(DomainElement.of(2, 3), 0.7) .set(DomainElement.of(3, 2), 0.7) .set(DomainElement.of(3, 1), 0.5) .set(DomainElement.of(1, 3), 0.5); IFuzzySet r4 = new MutableFuzzySet(u2) .set(DomainElement.of(1, 1), 1) .set(DomainElement.of(2, 2), 1) .set(DomainElement.of(3, 3), 1) .set(DomainElement.of(4, 4), 1) .set(DomainElement.of(5, 5), 1) .set(DomainElement.of(1, 2), 0.4) .set(DomainElement.of(2, 1), 0.4) .set(DomainElement.of(2, 3), 0.5) .set(DomainElement.of(3, 2), 0.5) .set(DomainElement.of(1, 3), 0.4) .set(DomainElement.of(3, 1), 0.4); boolean test1 = Relations.isUTimesURelation(r1); System.out.println("r1 je definiran nad UxU? " + test1); boolean test2 = Relations.isSymmetric(r1); System.out.println("r1 je simetrična? " + test2); boolean test3 = Relations.isSymmetric(r2); System.out.println("r2 je simetrična? " + test3); boolean test4 = Relations.isReflexive(r1); System.out.println("r1 je refleksivna? " + test4); boolean test5 = Relations.isReflexive(r3); System.out.println("r3 je refleksivna? " + test5); boolean test6 = Relations.isMaxMinTransitive(r3); System.out.println("r3 je max-min tranzitivna? " + test6); boolean test7 = Relations.isMaxMinTransitive(r4); System.out.println("r4 je max-min tranzitivna? " + test7); assertEqualsOut("primjer1.txt"); } @Test public void primjer2() { IDomain u1 = Domain.intRange(1, 5); // {1,2,3,4} IDomain u2 = Domain.intRange(1, 4); // {1,2,3} IDomain u3 = Domain.intRange(1, 5); // {1,2,3,4} IFuzzySet r1 = new MutableFuzzySet(Domain.combine(u1, u2)) .set(DomainElement.of(1, 1), 0.3) .set(DomainElement.of(1, 2), 1) .set(DomainElement.of(3, 3), 0.5) .set(DomainElement.of(4, 3), 0.5); IFuzzySet r2 = new MutableFuzzySet(Domain.combine(u2, u3)) .set(DomainElement.of(1, 1), 1) .set(DomainElement.of(2, 1), 0.5) .set(DomainElement.of(2, 2), 0.7) .set(DomainElement.of(3, 3), 1) .set(DomainElement.of(3, 4), 0.4); IFuzzySet r1r2 = Relations.compositionOfBinaryRelations(r1, r2); for (DomainElement e : r1r2.getDomain()) { System.out.println("mu(" + e.toString() + ")=" + r1r2.getValueAt(e)); } assertEqualsOut("primjer2.txt"); } @Test public void primjer3() { IDomain u = Domain.intRange(1, 5); // {1,2,3,4} IFuzzySet r = new MutableFuzzySet(Domain.combine(u, u)) .set(DomainElement.of(1, 1), 0.9) .set(DomainElement.of(2, 2), 1) .set(DomainElement.of(3, 3), 1) .set(DomainElement.of(4, 4), 1) .set(DomainElement.of(1, 2), 0.3) .set(DomainElement.of(2, 1), 0.3) .set(DomainElement.of(2, 3), 0.5) .set(DomainElement.of(3, 2), 0.5) .set(DomainElement.of(3, 4), 0.2) .set(DomainElement.of(4, 3), 0.2); IFuzzySet r2 = r; System.out.println( "Početna relacija je neizrazita relacija ekvivalencije? " + Relations.isFuzzyEquivalence(r2)); System.out.println(); for (int i = 1; i <= 3; i++) { r2 = Relations.compositionOfBinaryRelations(r2, r); System.out.println( "Broj odrađenih kompozicija: " + i + ". Relacija je:"); for (DomainElement e : r2.getDomain()) { System.out.println("mu(" + e + ")=" + r2.getValueAt(e)); } System.out.println( "Ova relacija je neizrazita relacija ekvivalencije? " + Relations.isFuzzyEquivalence(r2)); System.out.println(); } assertEqualsOut("primjer3.txt"); } @After public void tearDown() throws Exception { System.setOut(mOut); } }
[ "ivan.jurin93@gmail.com" ]
ivan.jurin93@gmail.com
698456d6fc532667a38297cba29f80e6cd82d39e
b4bd4f75642545bb87417980f680d5e020d76a61
/RememberRows/src/youth/hong/dao/ItemsDao.java
e9d86c4ad062d3f363c8ec2f95c8ea2557ec9d3f
[]
no_license
yomea/Java2
9404299fa08b9be32c5577be8f2d90d00604eac8
78abbf319b1c950a977391171fa49235481dfb49
refs/heads/master
2021-09-04T05:15:57.560334
2018-01-16T06:12:45
2018-01-16T06:12:45
72,603,240
1
0
null
null
null
null
UTF-8
Java
false
false
2,094
java
package youth.hong.dao; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import youth.hong.DB.DBHelper; import youth.hong.items.Items; public class ItemsDao { public List<Items> getAllItems() { List<Items> items = new ArrayList<Items>(); Connection conn = DBHelper.getConn(); Statement stmt = DBHelper.getStmt(conn); String sql = "select * from items"; ResultSet rs = DBHelper.getRs(stmt, sql); try { while(rs.next()) { Items item = new Items(); item.setId(rs.getInt("id")); item.setName(rs.getString("name")); item.setCity(rs.getString("city")); item.setNumber(rs.getInt("number")); item.setPrice(rs.getInt("price")); item.setPicture(rs.getString("picture")); items.add(item); } } catch (SQLException e) { e.printStackTrace(); } finally { DBHelper.close(rs); DBHelper.close(stmt); DBHelper.close(conn); } return items; } public Items getItemById(int id) { Connection conn = DBHelper.getConn(); Statement stmt = DBHelper.getStmt(conn); Items item = null; String sql = "select * from items where id=" + id; ResultSet rs = DBHelper.getRs(stmt, sql); try { while(rs.next()) { item = new Items(); item.setId(rs.getInt("id")); item.setName(rs.getString("name")); item.setCity(rs.getString("city")); item.setNumber(rs.getInt("number")); item.setPrice(rs.getInt("price")); item.setPicture(rs.getString("picture")); } } catch (SQLException e) { e.printStackTrace(); } finally { DBHelper.close(rs); DBHelper.close(stmt); DBHelper.close(conn); } return item; } public List<Items> getItems(String str) { List<Items> items = new ArrayList<Items>(); if(str != null && str.length() > 0) { String[] idArray = str.split(","); for(int i = 0; i < idArray.length; i++) { items.add(this.getItemById(Integer.parseInt(idArray[i]))); } } return items; } }
[ "951645267@qq.com" ]
951645267@qq.com
4c208338ddfcd525cd96100a0051344447054add
135c8219e4f24cbb49e1eb799489b7bbc65858a7
/javaDir/Thread/src/com/list/First.java
c336f9e02b9e2edb59e5b17790086a905f1ee528
[]
no_license
usb0823/Study
cab53e76f88cde469aede8831119ce0b22c24b09
90c755df029e82c8cb4cceba9525a24a0723c51b
refs/heads/master
2020-04-25T03:52:54.379238
2019-05-08T18:00:27
2019-05-08T18:00:27
172,491,795
0
0
null
null
null
null
UTF-8
Java
false
false
100
java
package com.list; public abstract class First implements Base { public abstract void iamBase(); }
[ "14042095@cnsuning.com" ]
14042095@cnsuning.com
aa8c998f382184d39c5c87e571d722ee4fecd37f
e6489112cc2e4341b6422e7e5e093e44f3d93aa9
/src/main/java/com/stackroute/muzixservice/domain/TrackDetails.java
3cac2f2ba3b9222d1164e6972f331b24d0b6ff1f
[]
no_license
Shivani123789/Spting_Boot_Muzix_Service_Mysql
7549a5647bc20c12b76ba3cf419b720777671f7f
52d43f7551ad3f71a2057350aaa997e078b46ee0
refs/heads/master
2022-07-23T16:13:42.582209
2019-06-04T07:53:53
2019-06-04T07:53:53
190,154,986
0
0
null
2022-06-21T01:13:23
2019-06-04T07:50:44
Java
UTF-8
Java
false
false
528
java
package com.stackroute.muzixservice.domain; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.Entity; import javax.persistence.Id; @Entity @Data @NoArgsConstructor @Builder public class TrackDetails { @Id int trackId; String trackName; String trackComment; public TrackDetails(int trackId, String trackName, String trackComment) { this.trackId = trackId; this.trackName = trackName; this.trackComment = trackComment; } }
[ "shivanipawar1995@gmail.com" ]
shivanipawar1995@gmail.com
3ef3ce5ac52af15e6aca74899d9f20f8cd3e07be
fa9ff16433d7c5b5c9d72dcb219e7991db8664f9
/src/domain/data/Book.java
7cb4a9b71da49f6148410527b86c7770aff14687
[]
no_license
FranckAlter/cleanexamen
8100ea6c4d3d20fbf53b5aa5acb2e9e6269629b9
5c0f59eb4899eaf09b72f7d15b8a51621e317174
refs/heads/master
2023-02-27T00:26:28.587613
2021-02-09T05:18:58
2021-02-09T05:18:58
337,057,878
0
0
null
null
null
null
UTF-8
Java
false
false
678
java
package domain.data; public class Book { private String title; private String author; private boolean available; public String getTitle() { return title; } public String getAuthor() { return author; } public boolean isAvailable() { return available; } public Book(String title, String author) { this.title = title; this.author = author; this.available = true; } @Override public String toString() { return title + " de " + author; } public void setAvailable(boolean available) { this.available = available; } }
[ "franck@alter-si.fr" ]
franck@alter-si.fr
74cd8fa3263b72aedab61dfc14f0ca628fe0d94f
0730228d6664af39b7dd6a5aa2a967c15d13be99
/app/src/main/java/com/example/android/recyclerview/database/JSONuse.java
3e2449fbac73e8ea30c658efeed1a391bf288dcb
[]
no_license
chukrav/myGrocery
00b86cfd484fb49e776aa6f09b961a37af7da298
bc24fcd4caa78e99eca038067cdac057646900e8
refs/heads/master
2022-04-25T18:30:15.810885
2020-04-23T06:41:31
2020-04-23T06:41:31
258,126,504
0
0
null
null
null
null
UTF-8
Java
false
false
2,018
java
package com.example.android.recyclerview.database; import android.content.Context; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.io.InputStream; import static android.app.PendingIntent.getActivity; public class JSONuse { private static String TAG = JSONuse.class.getSimpleName(); public static String loadJSONFromAsset(Context context) { String json = null; try { // InputStream is = getActivity().getAssets().open("yourfilename.json"); InputStream is = context.getAssets().open("ListL00.json"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; } public static JSONArray readJSONArray(String jsonStr) { JSONArray jsonArray = null; try { jsonArray = new JSONArray(jsonStr); } catch (Exception e) { e.printStackTrace(); } return jsonArray; } public static TaskEntry readJObject(JSONArray array, int i) { int id; String name; String category; float cost; float amount; try { JSONObject ob = (JSONObject) array.get(i); id = Integer.valueOf((String) ob.get("ID")); name = (String) ob.get("name"); amount = Float.valueOf((String) ob.get("amount")); cost = Float.valueOf((String) ob.get("cost")); category = (String) ob.get("category"); Log.d(TAG, "" + id + "," + name + "," + cost + "," + amount + "," + category); return new TaskEntry(id, name, cost, amount, category); } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "alexei@Alexeis-Mac-mini.local" ]
alexei@Alexeis-Mac-mini.local
9f83bd42745be54be68a80c05b56ec95e9f8d1da
db19f7dec17f07aea1222b065489b1b796d80c6e
/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/NoReplicationStrategy.java
43347f6892a46224a9d90fc365379fb440d24065
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
erandiganepola/asterixdb
418dcc89e164d84b951c6323fb3424b35ab20c3a
4671f7127c484b805b22ad3ff95c08c47a031d12
refs/heads/master
2020-12-30T16:47:49.473029
2017-05-11T16:13:57
2017-05-11T20:43:30
91,035,520
1
0
null
2017-05-12T00:44:12
2017-05-12T00:44:12
null
UTF-8
Java
false
false
1,581
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.asterix.common.replication; import java.util.Collections; import java.util.Set; import org.apache.asterix.event.schema.cluster.Cluster; public class NoReplicationStrategy implements IReplicationStrategy { @Override public boolean isMatch(int datasetId) { return false; } @Override public boolean isParticipant(String nodeId) { return false; } @Override public Set<Replica> getRemotePrimaryReplicas(String nodeId) { return Collections.emptySet(); } @Override public Set<Replica> getRemoteReplicas(String node) { return Collections.emptySet(); } @Override public NoReplicationStrategy from(Cluster cluster) { return new NoReplicationStrategy(); } }
[ "bamousaa@gmail.com" ]
bamousaa@gmail.com
fc96230900b7f10937511593da791966f13857d3
5de5d7c0e8b6ced0c264eb028235949d67532af1
/src/controlpanel/ControlPanel.java
19b872d363a57f37aae4e2c800c439d8d1474cd5
[]
no_license
Houley01/CAB302_Assignment_Group_12
3fff91aba8fa468acb18258e0916d5116c2f53ab
dc91e7189e6e4b650cd5e2f8236f5bf9672849b7
refs/heads/master
2022-09-30T04:32:07.504103
2020-05-31T11:56:42
2020-05-31T11:56:42
247,607,489
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package controlpanel; //import resources.GetPropertyValues; import javax.swing.*; import java.awt.*; import java.io.*; /** * The main renderer for the Control Panel, encompasses all other windows * that relate to modifying and creation of billboards and users. * @see Controller for majority of logic * @see ControlPanel for JFrame rendering configuration and intialization * * - Todo add all members to an authors list and copy and paste in all documents * * @version %I%, %G% * @since JDK13 */ public class ControlPanel extends JFrame { // private static final boolean CLOSABLE = true; // private static final boolean ICONIFIABLE = true; // private static final boolean MAXIMIZABLE = true; // private static final boolean RESIZABLE = true; public static final int WINDOWWIDTH = 1000; public static final int WINDOWHEIGHT = 800; public static final Font titleFont = new Font("Ariel", Font.BOLD, 20); public static void main(String[] args) throws IOException, ClassNotFoundException { new ControlPanelFrameHandler(); } }
[ "ethouley@gmail.com" ]
ethouley@gmail.com
ba8b17656516eac293a0b78ad406ab00acc4b3ef
181fcc8e98348b7d32f2426799aee505bb9ecb61
/BiSrearchTree/95.不同的二叉搜索树-ii.java
e48fd53e8310f1cd952aaf38c14d090658ed4044
[]
no_license
doyoudooo/DS
9e9bddc9a333fd8a060b8da89cde9ec44e8b49d3
5c0338728ecad22fedd45773599a78fa74fbab99
refs/heads/main
2023-03-15T13:37:52.028348
2021-03-08T13:55:19
2021-03-08T13:55:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,821
java
import java.util.LinkedList; import java.util.List; import javax.swing.tree.TreeNode; import jdk.nashorn.api.tree.Tree; /* * @lc app=leetcode.cn id=95 lang=java * * [95] 不同的二叉搜索树 II */ // @lc code=start /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { this.val = val; } * TreeNode(int val, TreeNode left, TreeNode right) { * this.val = val; * this.left = left; * this.right = right; * } * } */ class Solution { public List<TreeNode> generateTrees(int n) { if (n == 0) { return new LinkedList<TreeNode>(); } return generateTrees(1, n); } public List<TreeNode> generateTrees(int start, int end) { List<TreeNode> allTrees = new LinkedList<TreeNode>(); if (start > end) { allTrees.add(null); return allTrees; } // 枚举可行根节点 for (int i = start; i <= end; i++) { // 获得所有可行的左子树集合 List<TreeNode> leftTrees = generateTrees(start, i - 1); // 获得所有可行的右子树集合 List<TreeNode> rightTrees = generateTrees(i + 1, end); // 从左子树集合中选出一棵左子树,从右子树集合中选出一棵右子树,拼接到根节点上 for (TreeNode left : leftTrees) { for (TreeNode right : rightTrees) { TreeNode currTree = new TreeNode(i); currTree.left = left; currTree.right = right; allTrees.add(currTree); } } } return allTrees; } } // @lc code=end
[ "2854697833@qq.com" ]
2854697833@qq.com
831e07001ba431bd7e3d90c9995e9f4c9467435f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/15/15_4c01323440daa5d04c70a8271de1f235c2393cd1/ScalaProtoBufPluginInJava/15_4c01323440daa5d04c70a8271de1f235c2393cd1_ScalaProtoBufPluginInJava_t.java
b4422b35a496e6c50404e5a4127d5bf96c2fd003
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
7,283
java
package pl.project13.protoscala.gen; import com.google.protobuf.DescriptorProtos; import google.protobuf.compiler.Plugin; import pl.project13.protoscala.utils.CommentsGenerator; import pl.project13.protoscala.utils.ScalaNameMangler; import pl.project13.protoscala.utils.SourceStringBuilder; import java.util.List; import java.util.logging.Logger; import static com.google.common.collect.Lists.newArrayList; /** * Date: 3/27/11 * * @author Konrad Malawski */ public class ScalaProtoBufPluginInJava { Logger log = Logger.getLogger(getClass().getSimpleName()); private SourceStringBuilder sourceStringBuilder = new SourceStringBuilder(); // todo may get more specialized? private ScalaNameMangler nameManglerNameMangler = new ScalaNameMangler(); private CommentsGenerator commentsGenerator = new CommentsGenerator(); // code generators private MessageFieldGenerator messageFieldGenerator; private RepeatedFieldGenerator repeatedFieldGenerator; public Plugin.CodeGeneratorResponse handle(Plugin.CodeGeneratorRequest request) { Plugin.CodeGeneratorResponse.Builder responseBuilder = Plugin.CodeGeneratorResponse.newBuilder(); try { // todo the app's heart and soul for (DescriptorProtos.FileDescriptorProto protoFile : request.getProtoFileList()) { log.info("handleOneProtoFile: name: " + protoFile.getName() + ", package: " + protoFile.getPackage()); handleOneProtoFile(responseBuilder, protoFile); } } catch (Exception ex) { responseBuilder.setError("An '" + ex.getClass().getSimpleName() + "' exception occurred, could not compile proto file!"); } log.info("Done."); return responseBuilder.build(); } private void handleOneProtoFile(Plugin.CodeGeneratorResponse.Builder responseBuilder, DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { Plugin.CodeGeneratorResponse.File.Builder fileBuilder = Plugin.CodeGeneratorResponse.File.getDefaultInstance().newBuilderForType(); handleInitialComments(protoFile); handlePackage(protoFile); handleDependencies(protoFile); handleClassBody(protoFile); String fileName = nameManglerNameMangler.escapeFileName(protoFile.getName()); fileBuilder.setName(fileName); String sourceCode = sourceStringBuilder.toString(); fileBuilder.setContent(sourceCode); responseBuilder.addFile(fileBuilder); } private void handleInitialComments(DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { commentsGenerator.initialComment(sourceStringBuilder, protoFile); } private void handlePackage(DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { String javaPackage = protoFile.getOptions().getJavaPackage(); sourceStringBuilder.declarePackage(javaPackage); } private void handleDependencies(DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { // todo that's most probably wrong ;-) for (String dependency : protoFile.getDependencyList()) { log.info("Add dependency + " + dependency); sourceStringBuilder.importThe(dependency); } } /* * todo this will have a better architecture (a waaaay batter one, I'm just looking at what we have to code against :-)) */ private void handleClassBody(DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { //todo fix this, inner loops suck for (DescriptorProtos.DescriptorProto descriptorProto : protoFile.getMessageTypeList()) { // declare class declaration handleClassDeclaration(descriptorProto, protoFile); // handle enum types for (DescriptorProtos.EnumDescriptorProto enumDescriptor : descriptorProto.getEnumTypeList()) { handleEnumType(enumDescriptor, protoFile); } // handle nested types // todo this would be generated inner classes etc, hm... for (DescriptorProtos.DescriptorProto nestedType : descriptorProto.getNestedTypeList()) { handleNestedType(sourceStringBuilder, nestedType); // for example like this } // handle extensions // todo maybe later on for (DescriptorProtos.FieldDescriptorProto fieldDescriptorProto : descriptorProto.getExtensionList()) { handleExtension(fieldDescriptorProto, protoFile); } // handle extension ranges // todo maybe later on for (DescriptorProtos.DescriptorProto.ExtensionRange extensionRange : descriptorProto.getExtensionRangeList()) { handleExtensionRange(extensionRange, protoFile); //todo not sure what "extension range" is for now } } } private void handleClassDeclaration(DescriptorProtos.DescriptorProto descriptorProto, DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { String className = descriptorProto.getName(); log.info("Generating class: " + className); // handle all fields List<String> params = handleFields(descriptorProto.getFieldList()); sourceStringBuilder.declareCaseClass(className, params); } private void handleNestedType(SourceStringBuilder sourceStringBuilder, DescriptorProtos.DescriptorProto nestedType) { // todo handle this with THIS class? Rename it to Type generator maybe etc? } private void handleExtensionRange(DescriptorProtos.DescriptorProto.ExtensionRange extensionRange, DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { //todo handle me (use *FieldGenerator) } private void handleExtension(DescriptorProtos.FieldDescriptorProto field, DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { //todo handle me (use *FieldGenerator) } private void handleEnumType(DescriptorProtos.EnumDescriptorProto enumDesc, DescriptorProtos.FileDescriptorProtoOrBuilder protoFile) { //todo handle me (use *FieldGenerator) } /** * Returns a list of field definitions ready to be joined and inserted into the case class definition * * @param fieldList a list of all fields to be prepared * @return a list containing prepared definitions, such as: "name: Type" or "name: Type = defaultVal" */ // todo this will look good rewritten in scala :d private List<String> handleFields(List<DescriptorProtos.FieldDescriptorProto> fieldList) { List<String> params = newArrayList(); for (DescriptorProtos.FieldDescriptorProto field : fieldList) { String fieldName = field.getName(); String typeName = field.getTypeName(); String parameter; if (field.hasDefaultValue()) { String defaultValue = field.getDefaultValue(); parameter = parameterDefinition(fieldName, typeName, defaultValue); } else { parameter = parameterDefinition(fieldName, typeName); } params.add(parameter); } return params; } // todo externalize private String parameterDefinition(String name, String type, String defaultValue) { String parameter = parameterDefinition(name, type); return String.format("%s = %s", parameter, defaultValue); } // todo externalize, and have fun with currying private String parameterDefinition(String name, String type) { return String.format("%s: %s", name, type); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b48d25c751e397e6ad20f4a736f2be21d7b9d31d
7c3d3c644cb9732e1da101b15a0cf5601e1d3e9a
/src/main/java/com/shd/linebot/model/UserLogPayment.java
6f2df3e7c130853b361dc6b3a3b0e91e299020b7
[ "MIT" ]
permissive
Kanchana-Kadmai/line-bot-medium
79905dc59ccfde22ce630da2463726eab011db4d
62f9a85fcb4a01b3e240116241588a3b2c623f01
refs/heads/master
2021-06-26T06:49:25.628451
2020-01-29T04:02:40
2020-01-29T04:02:40
226,828,902
0
0
MIT
2021-06-04T02:26:12
2019-12-09T09:04:33
Java
UTF-8
Java
false
false
724
java
package com.shd.linebot.model; import java.security.Timestamp; import lombok.Data; @Data public class UserLogPayment { public enum statusPayment {DEFAULT,PAYMENT}; public statusPayment getStatusBot() { return statusBot; } public void setStatusBot(statusPayment statusBot) { this.statusBot = statusBot; } public UserLogPayment(String userID, statusPayment statusBot) { this.userID = userID; this.statusBot = statusBot; } public UserLogPayment() { } private String userID; private Integer leaveID; private statusPayment statusBot; private String leaveType; private String detail; private Timestamp startDate; private Timestamp end_Date; private String empCode; private String period; }
[ "kanchana.khadmai@gmail.com" ]
kanchana.khadmai@gmail.com
81c84a7314d1e6de3ea4e49d59e1693add04b687
719b6851ad070fd6499087c5b5f9c63f12a08921
/app/src/androidTest/java/com/rainbowcl/leger/mobileparifoot/app/ApplicationTest.java
a3a5e7ee0e9b953e847e91454f132f57e06a34d4
[]
no_license
Lfoposse/Mobile-PariFoot
149273ff1be5785d9ea3466e4160d2a05fab36bd
8477760cfbeedf9829bc671aaff6ddfea9e6a540
refs/heads/master
2020-04-30T17:28:16.891055
2015-05-13T09:15:42
2015-05-13T09:15:42
35,518,429
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.rainbowcl.leger.mobileparifoot.app; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "foposseleger@gmail.com" ]
foposseleger@gmail.com
5b763f01f7cb5d7f512303e3363a55f173dbdb22
40ba512c27282febd226541cf2292b2c87c3a53a
/src/main/java/io/github/datasketches/theta/Aggregate.java
66d5af1b99bf79fcdfe9cce1a150593ef77fb467
[ "Apache-2.0" ]
permissive
AndrewKuzmin/apache-spark-for-java-developers-examples
425be40a540d376eebba32d15d2607673526b5b2
ff3277a8c7fb8e6f43d56704340ff663fe39fdca
refs/heads/master
2020-03-14T03:00:29.834969
2019-05-13T10:05:54
2019-05-13T10:05:54
131,411,118
4
1
null
null
null
null
UTF-8
Java
false
false
2,363
java
package io.github.datasketches.theta; import com.yahoo.sketches.theta.CompactSketch; import com.yahoo.sketches.theta.PairwiseSetOperations; import com.yahoo.sketches.theta.UpdateSketch; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.Function2; /** * Created by Andrew on 6/23/2018. * * Building one sketch using old Spark API: * */ public class Aggregate { public static void main(final String[] args) { final SparkConf conf = new SparkConf() .setAppName("Aggregate"); final JavaSparkContext context = new JavaSparkContext(conf); final JavaRDD<String> lines = context.textFile("data/phylosoft/words.txt"); // one word per line final ThetaSketchJavaSerializable initialValue = new ThetaSketchJavaSerializable(); final ThetaSketchJavaSerializable sketch = lines.aggregate(initialValue, new Add(), new Combine()); System.out.println("Unique count: " + String.format("%,f", sketch.getEstimate())); } static class Add implements Function2<ThetaSketchJavaSerializable, String, ThetaSketchJavaSerializable> { public ThetaSketchJavaSerializable call(final ThetaSketchJavaSerializable sketch, final String value) throws Exception { sketch.update(value); return sketch; } } static class Combine implements Function2<ThetaSketchJavaSerializable, ThetaSketchJavaSerializable, ThetaSketchJavaSerializable> { static final ThetaSketchJavaSerializable emptySketchWrapped = new ThetaSketchJavaSerializable(UpdateSketch.builder().build().compact()); public ThetaSketchJavaSerializable call(final ThetaSketchJavaSerializable sketch1, final ThetaSketchJavaSerializable sketch2) throws Exception { if (sketch1.getSketch() == null && sketch2.getSketch() == null) return emptySketchWrapped; if (sketch1.getSketch() == null) return sketch2; if (sketch2.getSketch() == null) return sketch1; final CompactSketch compactSketch1 = sketch1.getCompactSketch(); final CompactSketch compactSketch2 = sketch2.getCompactSketch(); return new ThetaSketchJavaSerializable(PairwiseSetOperations.union(compactSketch1, compactSketch2)); } } }
[ "andrew.kuzmin@gmail.com" ]
andrew.kuzmin@gmail.com
d5d3cd99658f59937830f32f58e6be270cef3f98
1f64d553ddfa2052f76fffc7282571f27c70de23
/app/src/main/java/com/yarolegovich/motionink/util/Permissions.java
106e741a20c11543b81d874309ce2655246284c9
[]
no_license
hudawei996/MotionInk
820c712b5a8d148fa0d815db49ea651fd293986c
f58592bb98627b834d78ecaa40295828270f7211
refs/heads/master
2022-06-26T01:13:01.768402
2016-09-29T11:43:06
2016-09-29T11:43:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,277
java
package com.yarolegovich.motionink.util; import android.app.Activity; import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; /** * Created by yarolegovich on 04.06.2016. */ public class Permissions { private static final int REQUEST_PERMISSION = 7; private Activity activity; private PermittedAction permittedAction; public Permissions(Activity activity) { this.activity = activity; } public void doIfPermitted(PermittedAction permittedAction, String permission) { if (ActivityCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) { this.permittedAction = permittedAction; ActivityCompat.requestPermissions( activity, new String[]{permission}, REQUEST_PERMISSION); } else { permittedAction.doAction(); } } public void handleGrantResults(int[] grantResults) { int grantedResult = grantResults[0]; if (grantedResult == PackageManager.PERMISSION_GRANTED) { if (permittedAction != null) { permittedAction.doAction(); } } } public interface PermittedAction { void doAction(); } }
[ "yarolegovich@gmail.com" ]
yarolegovich@gmail.com
1a628f9b12988526129582d061a687e1bf86e302
ef8b741f00c98916d5091b1def5c71e3c6183e4f
/app/src/main/java/com/sachtech/datingapp/ui/explore/adapter/listener/OnProfilesMatch.java
e326da4e7f319272e4fc3b5013a25482789e7bb6
[]
no_license
ChetnaSlaria/project_android
cf3f7da2491c30473284c1eac28b4bd2f6d8b5af
8dde12a3e1f8865f7e4d0c49662327609544c015
refs/heads/master
2022-11-08T14:25:12.107389
2020-06-14T07:29:20
2020-06-14T07:29:20
273,943,992
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.sachtech.datingapp.ui.explore.adapter.listener; import com.sachtech.datingapp.data.User; import org.jetbrains.annotations.NotNull; public interface OnProfilesMatch { void matchedProfile(@NotNull User var1); void OnMessageClick(@NotNull User var1); }
[ "naveenpanghal575@gmail.com" ]
naveenpanghal575@gmail.com
c01825230d1d677367469332cf75198c3e3c0617
95ba37bdf3c5c8b6b44431c81c6253e9fd8d9b95
/ms-cobranca/src/main/java/br/com/dfframeworck/converters/DoubleConverter.java
2986f16cac882e9590c2b752ad36da00b09e0811
[]
no_license
dinarte/ms-cobranca
e3f00800f1b6efea6bf9907d996e224c59072fc3
e91b33a546500c1d6858e41db29679667d401d7e
refs/heads/master
2020-08-28T11:58:02.984341
2020-06-11T10:51:25
2020-06-11T10:51:25
217,692,183
2
0
null
null
null
null
UTF-8
Java
false
false
434
java
package br.com.dfframeworck.converters; import org.springframework.stereotype.Component; import br.com.dfframeworck.autocrud.Periodo; @Component @EnableDataConver(types= {Periodo.class}, enableForForm=true, enableForMigration=true) public class DoubleConverter implements IConverter<Periodo> { @Override public Periodo parse(String value, Class<?> type) { Periodo p = new Periodo(); p.setPeriodo(value); return p; } }
[ "dinarte@192.168.0.61" ]
dinarte@192.168.0.61
3397d59b34f39620bd97f7f6bfd9a26aea90905f
01e55a2513bc1ad4d395874ae251e3cfc60669d0
/app/src/main/java/com/swdn/utils/HttpUtil1.java
200ed5b9b77edc07e787a62ec2f7fef32dd88f2c
[]
no_license
bob001/MobileOperationApp
b2e685c664b17fabed1cbc324d8d6e594dd86e08
ac711112c9673e6b0ca440cef363db5cbacf93e4
refs/heads/master
2020-06-23T18:29:04.766383
2016-11-24T05:52:24
2016-11-24T05:52:24
74,641,895
0
0
null
null
null
null
UTF-8
Java
false
false
9,647
java
package com.swdn.utils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; public class HttpUtil1 { private static final int TIMEOUT_IN_MILLIONS = 5000; /** * 通过get方法获取服务器数据 * @param url * @return * @throws Exception */ public static String get(String url) throws Exception { StringBuffer buffer = new StringBuffer(); // 建立HTTP Get联机 HttpGet httpRequest = new HttpGet(url); // 取得默认的HttpClient HttpClient httpClient = new DefaultHttpClient(); // 设置网络超时参数 HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, 1000); HttpConnectionParams.setSoTimeout(params, 5000); // 取得HttpResponse HttpResponse response = httpClient.execute(httpRequest); HttpEntity entity = response.getEntity(); // 若状态码为200,表示连接成功 if (response.getStatusLine().getStatusCode() == 200) { if (entity != null) { // entity.getContent()取得返回的字符串 BufferedReader reader = new BufferedReader( new InputStreamReader(entity.getContent())); String line = null; while ((line = reader.readLine()) != null) { buffer.append(line); } } } return buffer.toString(); } /** * 通过post获取服务器方法 * * @param url * @return * @throws Exception */ public static String post(String url,Map<String,String> rawParams) throws Exception { StringBuffer buffer = new StringBuffer(); // 建立HTTP Post联机 HttpPost httpRequest = new HttpPost(url); // 取得默认的HttpClient HttpClient httpClient = new DefaultHttpClient(); // 如果传递参数个数比较多的话可以对传递的参数进行封装 List<NameValuePair> params = new ArrayList<NameValuePair>(); for (String key : rawParams.keySet()) { // 封装请求参数 params.add(new BasicNameValuePair(key, rawParams.get(key))); } // 设置请求参数 httpRequest.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); // 设置网络超时参数 HttpParams httpParams = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 1000); HttpConnectionParams.setSoTimeout(httpParams, 5000); // 取得HttpResponse HttpResponse response = httpClient.execute(httpRequest); HttpEntity entity = response.getEntity(); // 若状态码为200,表示连接成功 if (response.getStatusLine().getStatusCode() == 200) { if (entity != null) { // entity.getContent()取得返回的字符串 BufferedReader reader = new BufferedReader( new InputStreamReader(entity.getContent())); String line = null; while ((line = reader.readLine()) != null) { buffer.append(line); } } } return buffer.toString(); } /** * 通过post获取服务器方法 * * @param url * @return * @throws Exception */ public static String post(String url,String rawParams) throws Exception { StringBuffer buffer = new StringBuffer(); // 建立HTTP Post联机 HttpPost httpRequest = new HttpPost(url); // 取得默认的HttpClient HttpClient httpClient = new DefaultHttpClient(); // 如果传递参数个数比较多的话可以对传递的参数进行封装 List<NameValuePair> params = new ArrayList<NameValuePair>(); // 封装请求参数 params.add(new BasicNameValuePair("paramJson", rawParams)); // 设置请求参数 httpRequest.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); // 设置网络超时参数 HttpParams httpParams = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 1000); HttpConnectionParams.setSoTimeout(httpParams, 5000); // 取得HttpResponse HttpResponse response = httpClient.execute(httpRequest); HttpEntity entity = response.getEntity(); // 若状态码为200,表示连接成功 if (response.getStatusLine().getStatusCode() == 200) { if (entity != null) { // entity.getContent()取得返回的字符串 BufferedReader reader = new BufferedReader( new InputStreamReader(entity.getContent())); String line = null; while ((line = reader.readLine()) != null) { buffer.append(line); } } } return buffer.toString(); } /** * Get请求,获得返回数据 * * @param urlStr * @return * @throws Exception */ public static String doGet(String urlStr) { URL url = null; HttpURLConnection conn = null; InputStream is = null; ByteArrayOutputStream baos = null; try { url = new URL(urlStr); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(TIMEOUT_IN_MILLIONS); conn.setConnectTimeout(TIMEOUT_IN_MILLIONS); conn.setRequestMethod("GET"); conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); if (conn.getResponseCode() == 200) { is = conn.getInputStream(); baos = new ByteArrayOutputStream(); int len = -1; byte[] buf = new byte[128]; while ((len = is.read(buf)) != -1) { baos.write(buf, 0, len); } baos.flush(); return baos.toString(); } else { throw new RuntimeException(" responseCode is not 200 ... "); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (is != null) is.close(); } catch (IOException e) { } try { if (baos != null) baos.close(); } catch (IOException e) { } conn.disconnect(); } return null ; } /** * 向指定 URL 发送POST方法的请求 * * @param url * 发送请求的 URL * @param param * 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 * @return 所代表远程资源的响应结果 * @throws Exception */ public static String doPost(String url, String param) { PrintWriter out = null; BufferedReader in = null; String result = ""; try { URL realUrl = new URL(url); // 打开和URL之间的连接 HttpURLConnection conn = (HttpURLConnection) realUrl .openConnection(); // 设置通用的请求属性 conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("charset", "utf-8"); conn.setUseCaches(false); // 发送POST请求必须设置如下两行 conn.setDoOutput(true); conn.setDoInput(true); conn.setReadTimeout(TIMEOUT_IN_MILLIONS); conn.setConnectTimeout(TIMEOUT_IN_MILLIONS); if (param != null && !param.trim().equals("")) { // 获取URLConnection对象对应的输出流 out = new PrintWriter(conn.getOutputStream()); // 发送请求参数 out.print(param); // flush输出流的缓冲 out.flush(); } // 定义BufferedReader输入流来读取URL的响应 in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String line; while ((line = in.readLine()) != null) { result += line; } } catch (Exception e) { e.printStackTrace(); } // 使用finally块来关闭输出流、输入流 finally { try { if (out != null) { out.close(); } if (in != null) { in.close(); } } catch (IOException ex) { ex.printStackTrace(); } } return result; } }
[ "919264104@qq.com" ]
919264104@qq.com
b1f94041da3df2ffad372c38c5c6d7744d4aeab2
34f44ab2e9015fe977588d93fd47fad670c54094
/SIG/Smartphone.java
c956e255c7515b26ed17a1590b4601409ecf79a0
[]
no_license
iadrio/SIG
f4d2b97b055086210fb7fc04068e28ad7a1bd2c3
b27f3f8c2c04c28cec04a45864e7dd72f9985182
refs/heads/main
2023-01-31T18:16:23.240291
2020-12-19T00:25:02
2020-12-19T00:25:02
322,732,293
0
0
null
null
null
null
UTF-8
Java
false
false
1,966
java
/** * Define las características de un smartphone * * @author Iván Adrio Muñiz * @version 2018.04.22 */ public class Smartphone extends Informatica { private String subSeccion = "Telefonia"; private String ram, procesador, almacenamiento,tamañoPantalla,resolucionPantalla,bateria; /** * Crea productos tipo smartphone * @param codigoDeProducto número de identificación del producto * @param marca fabricante del producto * @param modelo * @param color * @param precio * @param cantidad cantidad de productos en el almacen * @param ram memoria ram del sistema * @param almacenamiento memoria disponible * @param tamañoPantalla tamaño de pantalla * @param resolucionPantalla resolución de pantalla * @param procesador modelo de procesador * @param bateria tamaño de la bateria */ public Smartphone(String codigoDeProducto,String marca, String modelo,String color, double precio, int cantidad,String tamañoPantalla, String resolucionPantalla,String ram , String almacenamiento,String procesador,String bateria) { super(codigoDeProducto,marca,modelo,color,precio,cantidad); this.ram=ram; this.procesador=procesador; this.almacenamiento=almacenamiento; this.tamañoPantalla=tamañoPantalla; this.resolucionPantalla=resolucionPantalla; this.bateria=bateria; setTipo("Smartphone"); } /** * Ofrece una breve descripción del producto * @return descripción del producto */ public String toString() { return(super.toString()+ "\n"+formatea("memoria ram: "+ram,30)+formatea("almacenamiento: "+almacenamiento,30)+formatea("procesador: "+procesador,60)+ "\n"+formatea("tamaño de pantalla: "+tamañoPantalla+"pulgadas",30)+formatea("resolucion de pantalla: "+resolucionPantalla,30)+formatea("bateria: "+bateria,30)); } }
[ "iadrio@hotmail.com" ]
iadrio@hotmail.com
f13c54141cf0df61102bdaca92b6c89770e31ece
6b37157ada25c8f1a73409101128e172ad8db8d0
/src/main/java/Models/Radiator.java
e397a9ad7626b03a4bb1b2ccf08dc2b81bee1d08
[]
no_license
MarcusFSorensen/SE2Project
577caad40d533d8925893d9eef360e044be45028
8c96b56773b3256a66399d35c8b329478e183d23
refs/heads/master
2023-04-09T23:10:23.358072
2019-10-17T06:02:43
2019-10-17T06:02:43
213,563,030
0
0
null
2019-10-17T06:02:44
2019-10-08T06:17:16
Java
UTF-8
Java
false
false
173
java
package Models; public class Radiator { private int voltage; public Radiator(){ } public Radiator(int voltage){ this.voltage = voltage; } }
[ "marcus.f.s@hotmail.com" ]
marcus.f.s@hotmail.com
20340ab6344b5149409b3c458dacd8109a684b1d
d22f33ed111256f2f87403961888547f860c646b
/Marker3/src/org/guohao/whosbitch/errorActivity.java
0b91822bc1bce20457b3e59c9f3a6c053a86c296
[]
no_license
HyperToxic/mess_android
34d175d9da7dff1c262e48737cd029ae3ee94d16
9099a850d4f2ed044b50762b1fad70f88197e19f
refs/heads/master
2021-01-15T13:45:05.299105
2013-04-22T14:09:46
2013-04-22T14:09:46
null
0
0
null
null
null
null
GB18030
Java
false
false
1,416
java
package org.guohao.whosbitch; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; //import android.text.Editable; public class errorActivity extends Activity { int[] images = new int[] { R.drawable.error, }; int currentImage = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 设置全屏 requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_null); LinearLayout main = (LinearLayout) findViewById(R.id.error); // 获取线性布局管理器 final ImageView image = new ImageView(this); // 创建ImageView组件 main.addView(image); // 把ImageView加进线性布局管理器 image.setImageResource(images[0]);// 初始化时显示第一张照片 image.setOnClickListener(new OnClickListener() { // 新建一个接听器匿名类 @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(errorActivity.this, guohaoActivity.class); startActivity(intent); errorActivity.this.finish(); } }); } }
[ "1163397166@qq.com" ]
1163397166@qq.com
45be0ff5a8784c6760829821ade3c57c840752a0
eda1e9355b7f57b0fe7d499dcd5b803e7738b44f
/com/mongodb/ServerAddressSelector.java
2fd0de41c77809966ed3b28956480556cd24f58f
[]
no_license
TheS7W/HCTeams
55190c7101bbd2ebbb9d7670e9d7a7d14e2f1afe
0a69b9be1909828be3916eef329fd9f4a8e96216
refs/heads/master
2020-12-27T20:39:37.989216
2014-12-19T19:24:37
2014-12-19T19:24:37
34,543,926
0
1
null
2015-04-24T21:58:17
2015-04-24T21:58:15
null
UTF-8
Java
false
false
449
java
package com.mongodb; import java.util.*; class ServerAddressSelector implements ServerSelector { private final ServerAddress address; public ServerAddressSelector(final ServerAddress address) { super(); this.address = address; } public List<ServerDescription> choose(final ClusterDescription clusterDescription) { return Arrays.asList(clusterDescription.getByServerAddress(this.address)); } }
[ "crusader@goat.si" ]
crusader@goat.si
fd5720baf4cfd16485c45d2baa147c5b294be03d
24e60b1618b0e4915066ad619580d1f22585dd8b
/src/com/collection/queueList.java
8acf59bda3847042eff42cfe1ee915d8acc08e81
[]
no_license
nsfunky/Core_Java_Practices
c8969e74342adb6ca2172080687a689c97b57505
237dc5b656a9a88e47ee4851ba97cf541d2179c0
refs/heads/master
2020-09-12T12:17:29.124641
2019-11-18T15:12:21
2019-11-18T15:12:21
222,422,168
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
package com.collection; //import java.util.Iterator; import java.util.*; public class queueList { public static void main(String[] args) { Queue<String> queue = new LinkedList<>(); queue.add("one"); queue.add("two"); queue.add("three"); queue.add("four"); System.out.println(queue); queue.remove("three"); System.out.println(queue); System.out.println("Queue Size: " + queue.size()); queue.peek(); System.out.println("Queue Size: " + queue.size()); System.out.println(queue); System.out.println("Queue Contains element 'two' or not? : " + queue.contains("two")); // To empty the queue queue.clear(); System.out.println(queue.peek()); // Java Array to Queue String nums[] = {"one","two","three","four","five"}; Queue<String> queue1 = new LinkedList<>(); Collections.addAll(queue1, nums); System.out.println(queue1); } }
[ "kumar7.nishant@gmail.com" ]
kumar7.nishant@gmail.com
3824fbf22c3ec45a2ed6ce2757251f56646efc1b
ca87f2c2e46be07c54f5579b0bec802fa0daba49
/src/main/java/com/demo/api/commons/exception/ErrorExcetpion.java
2ef9068f8b8d57f2a8bfce1617bb4ef251e6cc73
[]
no_license
wanghws/SpringBootMVC
81f338c01f436b59f2b6e8161e1af0c9a84e888d
9e9d6d550f187500114c4b103c446c830c46df53
refs/heads/master
2020-05-20T11:16:48.341745
2019-05-08T07:50:58
2019-05-08T07:50:58
185,546,224
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package com.demo.api.commons.exception; import lombok.Getter; import lombok.Setter; /** * Created by wanghw on 2019-03-11. */ public class ErrorExcetpion extends RuntimeException { public ErrorExcetpion(String code){ super(code); this.code = code; } @Getter @Setter private String code; }
[ "wanghws@gmail.com" ]
wanghws@gmail.com
033d08ad0d7f7a6d242d78e937c0ff6319c2ce42
5993a5710e6fde7637acd6106a67923b4a73b3ed
/androidOne/src/com/sd/one/model/Content.java
a1bfc657a282712543f797eba5044c4d9d6d1f51
[]
no_license
MTJH/one
eb84f5584f9165850e097e5b66d584292142661b
1b7e0ad44268ae9490cb252833a759dbac6a78d4
refs/heads/master
2021-01-15T12:53:55.108831
2014-08-21T02:48:19
2014-08-21T02:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,388
java
package com.sd.one.model; import com.sd.one.model.base.BaseModel; /** * [A brief description] * * @author: devin.hu * @version: 1.0 * @date: Nov 25 private String 2013 */ public class Content extends BaseModel { /** * serialVersionUID */ private static final long serialVersionUID = 2623885391084633943L; private String id;// 414 private String sortDate;// 1373268103000 private String topLevel;// 0 private String hasTitleImg;// false private String recommend;// false private String status;// 2 private String viewsDay;// 0 private String commentsDay;// 0 private String downloadsDay;// 0 private String upsDay;// 0 private String author;// null private String origin;// null private String originUrl;// null private String releaseDate;// 1373268103000 private String mediaPath;// null private String mediaType;// null private String titleImg;// null private String contentImg;// null private String typeImg;// null private String link;// null private String ups;// 7 private String downs;// 5 private String views;// 22 private String title;// 基金业将迈入千基时代 呼唤退出机制 private String tagStr;// null public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSortDate() { return sortDate; } public void setSortDate(String sortDate) { this.sortDate = sortDate; } public String getTopLevel() { return topLevel; } public void setTopLevel(String topLevel) { this.topLevel = topLevel; } public String getHasTitleImg() { return hasTitleImg; } public void setHasTitleImg(String hasTitleImg) { this.hasTitleImg = hasTitleImg; } public String getRecommend() { return recommend; } public void setRecommend(String recommend) { this.recommend = recommend; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getViewsDay() { return viewsDay; } public void setViewsDay(String viewsDay) { this.viewsDay = viewsDay; } public String getCommentsDay() { return commentsDay; } public void setCommentsDay(String commentsDay) { this.commentsDay = commentsDay; } public String getDownloadsDay() { return downloadsDay; } public void setDownloadsDay(String downloadsDay) { this.downloadsDay = downloadsDay; } public String getUpsDay() { return upsDay; } public void setUpsDay(String upsDay) { this.upsDay = upsDay; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getOrigin() { return origin; } public void setOrigin(String origin) { this.origin = origin; } public String getOriginUrl() { return originUrl; } public void setOriginUrl(String originUrl) { this.originUrl = originUrl; } public String getReleaseDate() { return releaseDate; } public void setReleaseDate(String releaseDate) { this.releaseDate = releaseDate; } public String getMediaPath() { return mediaPath; } public void setMediaPath(String mediaPath) { this.mediaPath = mediaPath; } public String getMediaType() { return mediaType; } public void setMediaType(String mediaType) { this.mediaType = mediaType; } public String getTitleImg() { return titleImg; } public void setTitleImg(String titleImg) { this.titleImg = titleImg; } public String getContentImg() { return contentImg; } public void setContentImg(String contentImg) { this.contentImg = contentImg; } public String getTypeImg() { return typeImg; } public void setTypeImg(String typeImg) { this.typeImg = typeImg; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } public String getUps() { return ups; } public void setUps(String ups) { this.ups = ups; } public String getDowns() { return downs; } public void setDowns(String downs) { this.downs = downs; } public String getViews() { return views; } public void setViews(String views) { this.views = views; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getTagStr() { return tagStr; } public void setTagStr(String tagStr) { this.tagStr = tagStr; } @Override public String toString() { return "Content [id=" + id + ", sortDate=" + sortDate + ", topLevel=" + topLevel + ", hasTitleImg=" + hasTitleImg + ", recommend=" + recommend + ", status=" + status + ", viewsDay=" + viewsDay + ", commentsDay=" + commentsDay + ", downloadsDay=" + downloadsDay + ", upsDay=" + upsDay + ", author=" + author + ", origin=" + origin + ", originUrl=" + originUrl + ", releaseDate=" + releaseDate + ", mediaPath=" + mediaPath + ", mediaType=" + mediaType + ", titleImg=" + titleImg + ", contentImg=" + contentImg + ", typeImg=" + typeImg + ", link=" + link + ", ups=" + ups + ", downs=" + downs + ", views=" + views + ", title=" + title + ", tagStr=" + tagStr + "]"; } }
[ "wosunmo@gmail.com" ]
wosunmo@gmail.com
aab6ce9a07116e45dfb8d5c05a27f5d81f53cef8
60cd4c737dcdcf203737bb96861762c98cd24f35
/src/main/java/com/bupt/client/controller/main/LoginController.java
ef59d6f2dd85e6e91e2e2b255fe3e2d5bdf0e8bb
[]
no_license
xiahui-7/client
a915e14a20203d452b3f74088e90dc7351385c95
c1ebeb7cdf536e54d3502c314ba03d35b0789af7
refs/heads/master
2021-09-07T23:36:28.675707
2018-03-03T08:48:42
2018-03-03T08:48:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,951
java
package com.bupt.client.controller.main; import javax.servlet.http.HttpSession; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.bupt.client.constants.Constants; import com.bupt.client.entity.security.User; import com.bupt.client.service.security.UserService; @Controller @RequestMapping("/main") public class LoginController { @Autowired private UserService userService; @RequestMapping(value = "/login", method = RequestMethod.GET) public String login() { return LOGIN; } @RequestMapping(value = "/login", method = RequestMethod.POST) public String login(User user, HttpSession session) { // 登录认证 Subject subject = SecurityUtils.getSubject(); AuthenticationToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword()); subject.login(token); // 登录成功 User dbUser = userService.findUser(user.getUsername()); session.setAttribute(Constants.CURRENT_USER, dbUser); return "redirect:/main/index"; } @ExceptionHandler(AuthenticationException.class) public String handlerFailLogin(Model model) { model.addAttribute("error", "用户名/密码错误"); return LOGIN; } @RequestMapping("/logout") public String logout() { // 退出 Subject subject = SecurityUtils.getSubject(); subject.logout(); return LOGIN; } private static final String LOGIN = "main/login"; }
[ "515065283@qq.com" ]
515065283@qq.com
a016578b6cf833b9ae623e86007c93a1cd909cdb
c69043826d4239d1f7656cf9934e3b7c189d8476
/src/main/java/io/github/jhipster/sample/repository/EntityWithServiceImplPaginationAndDTORepository.java
298779c44873a09735d455b7133727e6a4de2496
[]
no_license
pascalgrimaud/jh-vuejs-191015
51f2bcb1d68577d80a1722eb39ef9dff18433838
9b740d15d32091f691d94fc744d81ac23a72c23b
refs/heads/master
2022-12-22T20:56:12.136726
2019-10-14T21:21:28
2019-10-14T21:21:39
215,213,636
0
0
null
2022-12-16T04:40:29
2019-10-15T05:25:48
Java
UTF-8
Java
false
false
493
java
package io.github.jhipster.sample.repository; import io.github.jhipster.sample.domain.EntityWithServiceImplPaginationAndDTO; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data repository for the EntityWithServiceImplPaginationAndDTO entity. */ @SuppressWarnings("unused") @Repository public interface EntityWithServiceImplPaginationAndDTORepository extends JpaRepository<EntityWithServiceImplPaginationAndDTO, Long> { }
[ "pascalgrimaud@gmail.com" ]
pascalgrimaud@gmail.com
442b285b442c797614360df01f9f53bbbeccaf94
7f075e0aa61bfb72b6e9c3a0996672003b5cd7c6
/dynamicProxy/src/main/java/com/ding/aop/ProxyInvocation.java
ec44552c381913334f07a5c33acf422ff4600554
[]
no_license
konexiaobo/SpringAop
8c5e370ec7261b1c9a1c8ada3f3c5e5e2a1143ab
58ddbca4f3a3791229374b8824a5dadf4b811c8d
refs/heads/master
2022-11-26T03:21:40.899591
2020-08-03T09:20:48
2020-08-03T09:22:54
284,653,509
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
package com.ding.aop; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; public class ProxyInvocation implements InvocationHandler { //要代理的接口 private Object target; //设置接口 public void setTarget(Object target) { this.target = target; } //根据设置的接口获取代理的对象 public Object getProxy() { return Proxy.newProxyInstance(this.getClass().getClassLoader(), target.getClass().getInterfaces(), this); } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { log("invoke target method"); return method.invoke(target, args); } private void log(String msg) { System.out.println(msg); } }
[ "dingxiaobo@xcuni.com" ]
dingxiaobo@xcuni.com
d55b21ccd86c594c6805c015c08847e141b75806
6c971fa6b375951a53efacf48e3cfce6400d1a2d
/utilities/SerialTermForThemis/src/MidiCC.java
cbbdfe53871b9fbe9a7453da4bf788da4a15765d
[]
no_license
reynal/themis
f36e9cbb10e42a3f55c69becfc21eedd5949ef21
062ee86f7b5246eead6c04c3b51c70e69a38d97f
refs/heads/master
2023-01-10T15:27:57.132363
2023-01-03T22:46:30
2023-01-03T22:46:30
150,987,765
7
11
null
2020-04-21T09:15:09
2018-09-30T17:09:44
C
UTF-8
Java
false
false
754
java
/** * An enum for Midi Control Change codes * @author sydxrey * */ public enum MidiCC { WAVE_3340(9), DETUNE_13700(10), WAVE_13700(11), PWM_3340(14), LEVEL_3340(15), LEVEL_13700(16), VCF_CUTOFF(19), VCF_RESONANCE(21), VCF_KBDTRACKING(22), VCF_ATTACK(23), VCF_DECAY(24), VCF_SUSTAIN(25), VCF_RELEASE(26), VCF_EG(27), VCA_ATTACK(28), VCA_DECAY(29), VCA_SUSTAIN(30), VCA_RELEASE(31), OCTAVE_3340(74), OCTAVE_13700(75), SYNC_3340(77), VCA_VELOCITY_SENSITIVITY(104), VCF_ORDER(109), VCF_VELOCITY_SENSITIVITY(110), CALIBRATE(127); int code; /** * @return the MIDI code for this Control Change */ public int getCode() { return code; } /** * @param code */ private MidiCC(int code) { this.code = code; } }
[ "reynal@ensea.fr" ]
reynal@ensea.fr
21f150429baf34dd2a23a767ae33f9746f26f363
2038aa4bb053a8b79867a70ea4d2b99b8e9f8abb
/src/main/java/lin/community/communtiy/service/UserService.java
0ce12ee4a2e26230916b01b126844da50d27c14e
[]
no_license
lin0130/community
2e4da3c1a21a4a23d9d4172d1c47c990b6ccfa66
1e01998a066c9f26fd2cfbae18f89b0e40298d0d
refs/heads/master
2022-07-09T16:16:19.567264
2021-04-16T03:49:49
2021-04-16T03:49:49
233,790,658
1
0
null
2022-06-17T02:51:12
2020-01-14T08:14:47
JavaScript
UTF-8
Java
false
false
1,431
java
package lin.community.communtiy.service; import lin.community.communtiy.mapper.UserMapper; import lin.community.communtiy.model.User; import lin.community.communtiy.model.UserExample; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserService { @Autowired private UserMapper userMapper; public void CreateOrUpdate(User user) { UserExample userExample = new UserExample(); userExample.createCriteria() .andAccountIdEqualTo(user.getAccountId()); List<User> users = userMapper.selectByExample(userExample); if (users.size()==0) { user.setGmtCreate(System.currentTimeMillis()); user.setGmtModified(user.getGmtCreate()); userMapper.insert(user); //插入 }else { User dbUser = users.get(0); User updateUser = new User(); updateUser.setGmtModified(System.currentTimeMillis()); updateUser.setAvatarUrl(user.getAvatarUrl()); updateUser.setName(user.getName()); updateUser.setToken(user.getToken()); UserExample example = new UserExample(); example.createCriteria() .andIdEqualTo(dbUser.getId()); userMapper.updateByExampleSelective(updateUser, example); //更新 } } }
[ "1638419085@qq.com" ]
1638419085@qq.com
1b53b25ee5a15921a897fe18f892d36cd5a494f3
b2f6e3f57a3a3149e1bb4dc6126ed1df9a353ed0
/org.summer.sdt.core/compiler/org/summer/sdt/internal/compiler/lookup/ReferenceBinding.java
275cbefe410b26b6d4115745fa4a4bd1e638535b
[]
no_license
zwgirl/summer-javacc
f561b50faaf08b21779fbc4c2483bdaadf9b27a6
d9414aaf63465bf73d2379d4e64ced768135d4f9
refs/heads/master
2020-12-25T19:04:14.226032
2014-07-30T01:30:34
2014-07-30T01:30:34
22,399,252
1
0
null
null
null
null
UTF-8
Java
false
false
78,980
java
/******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for * bug 349326 - [1.7] new warning for missing try-with-resources * bug 186342 - [compiler][null] Using annotations for null checking * bug 365519 - editorial cleanup after bug 186342 and bug 365387 * bug 358903 - Filter practically unimportant resource leak warnings * bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults * bug 388281 - [compiler][null] inheritance of null annotations as an option * bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation. * bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types * bug 400421 - [compiler] Null analysis for fields does not take @com.google.inject.Inject into account * bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions * bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis * Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations * Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099 * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables * Bug 400874 - [1.8][compiler] Inference infrastructure should evolve to meet JLS8 18.x (Part G of JSR335 spec) * Bug 423504 - [1.8] Implement "18.5.3 Functional Interface Parameterization Inference" * Bug 426792 - [1.8][inference][impl] generify new type inference engine * Bug 428019 - [1.8][compiler] Type inference failure with nested generic invocation. * Bug 427199 - [1.8][resource] avoid resource leak warnings on Streams that have no resource * Bug 418743 - [1.8][null] contradictory annotations on invocation of generic method not reported * Bug 429958 - [1.8][null] evaluate new DefaultLocation attribute of @NonNullByDefault * Bug 431581 - Eclipse compiles what it should not * Jesper S Moller - Contributions for * bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression * bug 412153 - [1.8][compiler] Check validity of annotations which may be repeatable *******************************************************************************/ package org.summer.sdt.internal.compiler.lookup; import java.util.Arrays; import java.util.Comparator; import org.summer.sdt.core.compiler.CharOperation; import org.summer.sdt.core.compiler.InvalidInputException; import org.summer.sdt.internal.compiler.ast.MethodDeclaration; import org.summer.sdt.internal.compiler.classfmt.ClassFileConstants; import org.summer.sdt.internal.compiler.impl.CompilerOptions; import org.summer.sdt.internal.compiler.util.SimpleLookupTable; /* Not all fields defined by this type (& its subclasses) are initialized when it is created. Some are initialized only when needed. Accessors have been provided for some public fields so all TypeBindings have the same API... but access public fields directly whenever possible. Non-public fields have accessors which should be used everywhere you expect the field to be initialized. null is NOT a valid value for a non-public field... it just means the field is not initialized. */ abstract public class ReferenceBinding extends TypeBinding { public char[][] compoundName; public char[] sourceName; public int modifiers; public PackageBinding fPackage; char[] fileName; char[] constantPoolName; char[] signature; private SimpleLookupTable compatibleCache; int typeBits; // additional bits characterizing this type protected MethodBinding [] singleAbstractMethod; public static final ReferenceBinding LUB_GENERIC = new ReferenceBinding() { /* used for lub computation */ { this.id = TypeIds.T_undefined; } public boolean hasTypeBit(int bit) { return false; } }; private static final Comparator<FieldBinding> FIELD_COMPARATOR = new Comparator<FieldBinding>() { public int compare(FieldBinding o1, FieldBinding o2) { char[] n1 = o1.name; char[] n2 = o2.name; return ReferenceBinding.compare(n1, n2, n1.length, n2.length); } }; private static final Comparator<MethodBinding> METHOD_COMPARATOR = new Comparator<MethodBinding>() { public int compare(MethodBinding o1, MethodBinding o2) { MethodBinding m1 = o1; MethodBinding m2 = o2; char[] s1 = m1.selector; char[] s2 = m2.selector; int c = ReferenceBinding.compare(s1, s2, s1.length, s2.length); return c == 0 ? m1.parameters.length - m2.parameters.length : c; } }; static protected ProblemMethodBinding samProblemBinding = new ProblemMethodBinding(TypeConstants.ANONYMOUS_METHOD, null, ProblemReasons.NoSuchSingleAbstractMethod); public ReferenceBinding(ReferenceBinding prototype) { super(prototype); this.compoundName = prototype.compoundName; this.sourceName = prototype.sourceName; this.modifiers = prototype.modifiers; this.fPackage = prototype.fPackage; this.fileName = prototype.fileName; this.constantPoolName = prototype.constantPoolName; this.signature = prototype.signature; this.compatibleCache = prototype.compatibleCache; this.typeBits = prototype.typeBits; this.singleAbstractMethod = prototype.singleAbstractMethod; } public ReferenceBinding() { super(); } public static FieldBinding binarySearch(char[] name, FieldBinding[] sortedFields) { if (sortedFields == null) return null; int max = sortedFields.length; if (max == 0) return null; int left = 0, right = max - 1, nameLength = name.length; int mid = 0; char[] midName; while (left <= right) { mid = left + (right - left) /2; int compare = compare(name, midName = sortedFields[mid].name, nameLength, midName.length); if (compare < 0) { right = mid-1; } else if (compare > 0) { left = mid+1; } else { return sortedFields[mid]; } } return null; } /** * Returns a combined range value representing: (start + (end<<32)), where start is the index of the first matching method * (remember methods are sorted alphabetically on selectors), and end is the index of last contiguous methods with same * selector. * -1 means no method got found * @param selector * @param sortedMethods * @return (start + (end<<32)) or -1 if no method found */ public static long binarySearch(char[] selector, MethodBinding[] sortedMethods) { if (sortedMethods == null) return -1; int max = sortedMethods.length; if (max == 0) return -1; int left = 0, right = max - 1, selectorLength = selector.length; int mid = 0; char[] midSelector; while (left <= right) { mid = left + (right - left) /2; int compare = compare(selector, midSelector = sortedMethods[mid].selector, selectorLength, midSelector.length); if (compare < 0) { right = mid-1; } else if (compare > 0) { left = mid+1; } else { int start = mid, end = mid; // find first method with same selector while (start > left && CharOperation.equals(sortedMethods[start-1].selector, selector)){ start--; } // find last method with same selector while (end < right && CharOperation.equals(sortedMethods[end+1].selector, selector)){ end++; } return start + ((long)end<< 32); } } return -1; } /** * Compares two strings lexicographically. * The comparison is based on the Unicode value of each character in * the strings. * * @return the value <code>0</code> if the str1 is equal to str2; * a value less than <code>0</code> if str1 * is lexicographically less than str2; * and a value greater than <code>0</code> if str1 is * lexicographically greater than str2. */ static int compare(char[] str1, char[] str2, int len1, int len2) { int n= Math.min(len1, len2); int i= 0; while (n-- != 0) { char c1= str1[i]; char c2= str2[i++]; if (c1 != c2) { return c1 - c2; } } return len1 - len2; } /** * Sort the field array using a quicksort */ public static void sortFields(FieldBinding[] sortedFields, int left, int right) { Arrays.sort(sortedFields, left, right, FIELD_COMPARATOR); } /** * Sort the field array using a quicksort */ public static void sortMethods(MethodBinding[] sortedMethods, int left, int right) { Arrays.sort(sortedMethods, left, right, METHOD_COMPARATOR); } /** * Return the array of resolvable fields (resilience) */ public FieldBinding[] availableFields() { return fields(); } /** * Return the array of resolvable methods (resilience) */ public MethodBinding[] availableMethods() { return methods(); } /** * Answer true if the receiver can be instantiated */ public boolean canBeInstantiated() { return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) == 0; } /** * Answer true if the receiver is visible to the invocationPackage. */ public boolean canBeSeenBy(PackageBinding invocationPackage) { if (isPublic()) return true; if (isPrivate()) return false; // isProtected() or isDefault() return invocationPackage == this.fPackage; } /** * Answer true if the receiver is visible to the receiverType and the invocationType. */ public boolean canBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType) { if (isPublic()) return true; if (TypeBinding.equalsEquals(invocationType, this) && TypeBinding.equalsEquals(invocationType, receiverType)) return true; if (isProtected()) { // answer true if the invocationType is the declaringClass or they are in the same package // OR the invocationType is a subclass of the declaringClass // AND the invocationType is the invocationType or its subclass // OR the type is a static method accessed directly through a type // OR previous assertions are true for one of the enclosing type if (TypeBinding.equalsEquals(invocationType, this)) return true; if (invocationType.fPackage == this.fPackage) return true; TypeBinding currentType = invocationType.erasure(); TypeBinding declaringClass = enclosingType().erasure(); // protected types always have an enclosing one if (TypeBinding.equalsEquals(declaringClass, invocationType)) return true; if (declaringClass == null) return false; // could be null if incorrect top-level protected type //int depth = 0; do { if (currentType.findSuperTypeOriginatingFrom(declaringClass) != null) return true; //depth++; currentType = currentType.enclosingType(); } while (currentType != null); return false; } if (isPrivate()) { // answer true if the receiverType is the receiver or its enclosingType // AND the invocationType and the receiver have a common enclosingType receiverCheck: { if (!(TypeBinding.equalsEquals(receiverType, this) || TypeBinding.equalsEquals(receiverType, enclosingType()))) { // special tolerance for type variable direct bounds, but only if compliance <= 1.6, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=334622 if (receiverType.isTypeVariable()) { TypeVariableBinding typeVariable = (TypeVariableBinding) receiverType; if (typeVariable.environment.globalOptions.complianceLevel <= ClassFileConstants.JDK1_6 && (typeVariable.isErasureBoundTo(erasure()) || typeVariable.isErasureBoundTo(enclosingType().erasure()))) break receiverCheck; } return false; } } if (TypeBinding.notEquals(invocationType, this)) { ReferenceBinding outerInvocationType = invocationType; ReferenceBinding temp = outerInvocationType.enclosingType(); while (temp != null) { outerInvocationType = temp; temp = temp.enclosingType(); } ReferenceBinding outerDeclaringClass = (ReferenceBinding)erasure(); temp = outerDeclaringClass.enclosingType(); while (temp != null) { outerDeclaringClass = temp; temp = temp.enclosingType(); } if (TypeBinding.notEquals(outerInvocationType, outerDeclaringClass)) return false; } return true; } // isDefault() if (invocationType.fPackage != this.fPackage) return false; ReferenceBinding currentType = receiverType; TypeBinding originalDeclaringClass = (enclosingType() == null ? this : enclosingType()).original(); do { if (currentType.isCapture()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 if (TypeBinding.equalsEquals(originalDeclaringClass, currentType.erasure().original())) return true; } else { if (TypeBinding.equalsEquals(originalDeclaringClass, currentType.original())) return true; } PackageBinding currentPackage = currentType.fPackage; // package could be null for wildcards/intersection types, ignore and recurse in superclass if (currentPackage != null && currentPackage != this.fPackage) return false; } while ((currentType = currentType.superclass()) != null); return false; } /** * Answer true if the receiver is visible to the type provided by the scope. */ public boolean canBeSeenBy(Scope scope) { if (isPublic()) return true; SourceTypeBinding invocationType = scope.enclosingSourceType(); if (TypeBinding.equalsEquals(invocationType, this)) return true; if (invocationType == null) // static import call return !isPrivate() && scope.getCurrentPackage() == this.fPackage; if (isProtected()) { // answer true if the invocationType is the declaringClass or they are in the same package // OR the invocationType is a subclass of the declaringClass // AND the invocationType is the invocationType or its subclass // OR the type is a static method accessed directly through a type // OR previous assertions are true for one of the enclosing type if (invocationType.fPackage == this.fPackage) return true; TypeBinding declaringClass = enclosingType(); // protected types always have an enclosing one if (declaringClass == null) return false; // could be null if incorrect top-level protected type declaringClass = declaringClass.erasure();// erasure cannot be null TypeBinding currentType = invocationType.erasure(); // int depth = 0; do { if (TypeBinding.equalsEquals(declaringClass, invocationType)) return true; if (currentType.findSuperTypeOriginatingFrom(declaringClass) != null) return true; // depth++; currentType = currentType.enclosingType(); } while (currentType != null); return false; } if (isPrivate()) { // answer true if the receiver and the invocationType have a common enclosingType // already know they are not the identical type ReferenceBinding outerInvocationType = invocationType; ReferenceBinding temp = outerInvocationType.enclosingType(); while (temp != null) { outerInvocationType = temp; temp = temp.enclosingType(); } ReferenceBinding outerDeclaringClass = (ReferenceBinding)erasure(); temp = outerDeclaringClass.enclosingType(); while (temp != null) { outerDeclaringClass = temp; temp = temp.enclosingType(); } return TypeBinding.equalsEquals(outerInvocationType, outerDeclaringClass); } // isDefault() return invocationType.fPackage == this.fPackage; } public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) { boolean isMemberOfGeneric = isMemberType() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0; if (typeVariables == Binding.NO_TYPE_VARIABLES && !isMemberOfGeneric) { return signature(); } StringBuffer sig = new StringBuffer(10); if (isMemberOfGeneric) { char[] typeSig = enclosingType().genericTypeSignature(); sig.append(typeSig, 0, typeSig.length-1); // copy all but trailing semicolon sig.append('.'); // NOTE: cannot override trailing ';' with '.' in enclosing signature, since shared char[] sig.append(this.sourceName); } else { char[] typeSig = signature(); sig.append(typeSig, 0, typeSig.length-1); // copy all but trailing semicolon } if (typeVariables == Binding.NO_TYPE_VARIABLES) { sig.append(';'); } else { sig.append('<'); for (int i = 0, length = typeVariables.length; i < length; i++) { sig.append(typeVariables[i].genericTypeSignature()); } sig.append(">;"); //$NON-NLS-1$ } int sigLength = sig.length(); char[] result = new char[sigLength]; sig.getChars(0, sigLength, result, 0); return result; } public void computeId() { // note that more (configurable) ids are assigned from PackageBinding#checkIfNullAnnotationType() // try to avoid multiple checks against a package/type name switch (this.compoundName.length) { case 3 : char[] packageName = this.compoundName[0]; // expect only java.*.* and javax.*.* and junit.*.* and org.junit.* switch (packageName.length) { case 3: // only one type in this group, yet: if (CharOperation.equals(TypeConstants.ORG_JUNIT_ASSERT, this.compoundName)) this.id = TypeIds.T_OrgJunitAssert; return; case 4: if (!CharOperation.equals(TypeConstants.JAVA, packageName)) return; break; // continue below ... case 5: switch (packageName[1]) { case 'a': if (CharOperation.equals(TypeConstants.JAVAX_ANNOTATION_INJECT_INJECT, this.compoundName)) this.id = TypeIds.T_JavaxInjectInject; return; case 'u': if (CharOperation.equals(TypeConstants.JUNIT_FRAMEWORK_ASSERT, this.compoundName)) this.id = TypeIds.T_JunitFrameworkAssert; return; } return; default: return; } // ... at this point we know it's java.*.* packageName = this.compoundName[1]; if (packageName.length == 0) return; // just to be safe char[] typeName = this.compoundName[2]; if (typeName.length == 0) return; // just to be safe // remaining types MUST be in java.*.* if (!CharOperation.equals(TypeConstants.LANG, this.compoundName[1])) { switch (packageName[0]) { case 'i' : if (CharOperation.equals(packageName, TypeConstants.IO)) { switch (typeName[0]) { case 'C' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_CLOSEABLE[2])) this.typeBits |= TypeIds.BitCloseable; // don't assign id, only typeBit (for analysis of resource leaks) return; case 'E' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_EXTERNALIZABLE[2])) this.id = TypeIds.T_JavaIoExternalizable; return; case 'I' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_IOEXCEPTION[2])) this.id = TypeIds.T_JavaIoException; return; case 'O' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_OBJECTSTREAMEXCEPTION[2])) this.id = TypeIds.T_JavaIoObjectStreamException; return; case 'P' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_PRINTSTREAM[2])) this.id = TypeIds.T_JavaIoPrintStream; return; case 'S' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_SERIALIZABLE[2])) this.id = TypeIds.T_JavaIoSerializable; return; } } return; case 'u' : if (CharOperation.equals(packageName, TypeConstants.UTIL)) { switch (typeName[0]) { case 'C' : if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_COLLECTION[2])) this.id = TypeIds.T_JavaUtilCollection; return; case 'I' : if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_ITERATOR[2])) this.id = TypeIds.T_JavaUtilIterator; return; case 'O' : if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_OBJECTS[2])) this.id = TypeIds.T_JavaUtilObjects; return; } } return; } return; } // remaining types MUST be in java.lang.* switch (typeName[0]) { case 'A' : switch(typeName.length) { case 13 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_AUTOCLOSEABLE[2])) { this.id = TypeIds.T_JavaLangAutoCloseable; this.typeBits |= TypeIds.BitAutoCloseable; } return; case 14: if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ASSERTIONERROR[2])) this.id = TypeIds.T_JavaLangAssertionError; return; } return; case 'B' : switch (typeName.length) { case 4 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_BYTE[2])) this.id = TypeIds.T_JavaLangByte; return; case 7 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_BOOLEAN[2])) this.id = TypeIds.T_JavaLangBoolean; return; } return; case 'C' : switch (typeName.length) { case 5 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_CLASS[2])) this.id = TypeIds.T_JavaLangClass; return; case 9 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_CHARACTER[2])) this.id = TypeIds.T_JavaLangCharacter; else if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_CLONEABLE[2])) this.id = TypeIds.T_JavaLangCloneable; return; case 22 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_CLASSNOTFOUNDEXCEPTION[2])) this.id = TypeIds.T_JavaLangClassNotFoundException; return; } return; case 'D' : switch (typeName.length) { case 6 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_DOUBLE[2])) this.id = TypeIds.T_JavaLangDouble; return; case 10 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_DEPRECATED[2])) this.id = TypeIds.T_JavaLangDeprecated; return; } return; case 'E' : switch (typeName.length) { case 4 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ENUM[2])) this.id = TypeIds.T_JavaLangEnum; return; case 5 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ERROR[2])) this.id = TypeIds.T_JavaLangError; return; case 9 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_EXCEPTION[2])) this.id = TypeIds.T_JavaLangException; return; } return; case 'F' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_FLOAT[2])) this.id = TypeIds.T_JavaLangFloat; else if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_FUNCTIONAL_INTERFACE[2])) this.id = TypeIds.T_JavaLangFunctionalInterface; return; case 'I' : switch (typeName.length) { case 7 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_INTEGER[2])) this.id = TypeIds.T_JavaLangInteger; return; case 8 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ITERABLE[2])) this.id = TypeIds.T_JavaLangIterable; return; case 24 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ILLEGALARGUMENTEXCEPTION[2])) this.id = TypeIds.T_JavaLangIllegalArgumentException; return; } return; case 'L' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_LONG[2])) this.id = TypeIds.T_JavaLangLong; return; case 'N' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_NOCLASSDEFERROR[2])) this.id = TypeIds.T_JavaLangNoClassDefError; return; case 'O' : switch (typeName.length) { case 6 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_OBJECT[2])) this.id = TypeIds.T_JavaLangObject; return; case 8 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_OVERRIDE[2])) this.id = TypeIds.T_JavaLangOverride; return; } return; case 'R' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_RUNTIMEEXCEPTION[2])) this.id = TypeIds.T_JavaLangRuntimeException; break; case 'S' : switch (typeName.length) { case 5 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_SHORT[2])) this.id = TypeIds.T_JavaLangShort; return; case 6 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_STRING[2])) this.id = TypeIds.T_JavaLangString; else if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_SYSTEM[2])) this.id = TypeIds.T_JavaLangSystem; return; case 11 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_SAFEVARARGS[2])) this.id = TypeIds.T_JavaLangSafeVarargs; return; case 12 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_STRINGBUFFER[2])) this.id = TypeIds.T_JavaLangStringBuffer; return; case 13 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_STRINGBUILDER[2])) this.id = TypeIds.T_JavaLangStringBuilder; return; case 16 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS[2])) this.id = TypeIds.T_JavaLangSuppressWarnings; return; } return; case 'T' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_THROWABLE[2])) this.id = TypeIds.T_JavaLangThrowable; return; case 'V' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_VOID[2])) this.id = TypeIds.T_JavaLangVoid; return; } break; case 4: // expect one type from com.*.*.*: if (CharOperation.equals(TypeConstants.COM_GOOGLE_INJECT_INJECT, this.compoundName)) { this.id = TypeIds.T_ComGoogleInjectInject; return; } // otherwise only expect java.*.*.* if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])) return; packageName = this.compoundName[1]; if (packageName.length == 0) return; // just to be safe packageName = this.compoundName[2]; if (packageName.length == 0) return; // just to be safe typeName = this.compoundName[3]; if (typeName.length == 0) return; // just to be safe switch (packageName[0]) { case 'a' : if (CharOperation.equals(packageName, TypeConstants.ANNOTATION)) { switch (typeName[0]) { case 'A' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_ANNOTATION[3])) this.id = TypeIds.T_JavaLangAnnotationAnnotation; return; case 'D' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED[3])) this.id = TypeIds.T_JavaLangAnnotationDocumented; return; case 'E' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE[3])) this.id = TypeIds.T_JavaLangAnnotationElementType; return; case 'I' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_INHERITED[3])) this.id = TypeIds.T_JavaLangAnnotationInherited; return; case 'R' : switch (typeName.length) { case 9 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_RETENTION[3])) this.id = TypeIds.T_JavaLangAnnotationRetention; return; case 10 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_REPEATABLE[3])) this.id = TypeIds.T_JavaLangAnnotationRepeatable; return; case 15 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY[3])) this.id = TypeIds.T_JavaLangAnnotationRetentionPolicy; return; } return; case 'T' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_ANNOTATION_TARGET[3])) this.id = TypeIds.T_JavaLangAnnotationTarget; return; } } return; case 'i': if (CharOperation.equals(packageName, TypeConstants.INVOKE)) { if (typeName.length == 0) return; // just to be safe switch (typeName[0]) { case 'M' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE[3])) this.id = TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature; return; } } return; case 'r' : if (CharOperation.equals(packageName, TypeConstants.REFLECT)) { switch (typeName[0]) { case 'C' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_REFLECT_CONSTRUCTOR[2])) this.id = TypeIds.T_JavaLangReflectConstructor; return; case 'F' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_REFLECT_FIELD[2])) this.id = TypeIds.T_JavaLangReflectField; return; case 'M' : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_REFLECT_METHOD[2])) this.id = TypeIds.T_JavaLangReflectMethod; return; } } return; } break; case 5 : packageName = this.compoundName[0]; switch (packageName[0]) { case 'j' : if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])) return; packageName = this.compoundName[1]; if (packageName.length == 0) return; // just to be safe if (CharOperation.equals(TypeConstants.LANG, packageName)) { packageName = this.compoundName[2]; if (packageName.length == 0) return; // just to be safe switch (packageName[0]) { case 'i' : if (CharOperation.equals(packageName, TypeConstants.INVOKE)) { typeName = this.compoundName[3]; if (typeName.length == 0) return; // just to be safe switch (typeName[0]) { case 'M' : char[] memberTypeName = this.compoundName[4]; if (memberTypeName.length == 0) return; // just to be safe if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE[3]) && CharOperation.equals(memberTypeName, TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE[4])) this.id = TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature; return; } } return; } return; } return; case 'o': if (!CharOperation.equals(TypeConstants.ORG, this.compoundName[0])) return; packageName = this.compoundName[1]; if (packageName.length == 0) return; // just to be safe switch (packageName[0]) { case 'e': if (CharOperation.equals(TypeConstants.ECLIPSE, packageName)) { packageName = this.compoundName[2]; if (packageName.length == 0) return; // just to be safe switch (packageName[0]) { case 'c' : if (CharOperation.equals(packageName, TypeConstants.CORE)) { typeName = this.compoundName[3]; if (typeName.length == 0) return; // just to be safe switch (typeName[0]) { case 'r' : char[] memberTypeName = this.compoundName[4]; if (memberTypeName.length == 0) return; // just to be safe if (CharOperation.equals(typeName, TypeConstants.ORG_ECLIPSE_CORE_RUNTIME_ASSERT[3]) && CharOperation.equals(memberTypeName, TypeConstants.ORG_ECLIPSE_CORE_RUNTIME_ASSERT[4])) this.id = TypeIds.T_OrgEclipseCoreRuntimeAssert; return; } } return; } return; } return; case 'a': if (CharOperation.equals(TypeConstants.APACHE, packageName)) { if (CharOperation.equals(TypeConstants.COMMONS, this.compoundName[2])) { if (CharOperation.equals(TypeConstants.ORG_APACHE_COMMONS_LANG_VALIDATE, this.compoundName)) this.id = TypeIds.T_OrgApacheCommonsLangValidate; else if (CharOperation.equals(TypeConstants.ORG_APACHE_COMMONS_LANG3_VALIDATE, this.compoundName)) this.id = TypeIds.T_OrgApacheCommonsLang3Validate; } } return; } return; case 'c': if (!CharOperation.equals(TypeConstants.COM, this.compoundName[0])) return; if (CharOperation.equals(TypeConstants.COM_GOOGLE_COMMON_BASE_PRECONDITIONS, this.compoundName)) this.id = TypeIds.T_ComGoogleCommonBasePreconditions; return; } break; case 6: if (!CharOperation.equals(TypeConstants.JDT, this.compoundName[2]) || !CharOperation.equals(TypeConstants.ITYPEBINDING, this.compoundName[5])) return; if (CharOperation.equals(TypeConstants.ORG_ECLIPSE_JDT_CORE_DOM_ITYPEBINDING, this.compoundName)) this.typeBits |= TypeIds.BitUninternedType; break; case 7 : if (!CharOperation.equals(TypeConstants.JDT, this.compoundName[2]) || !CharOperation.equals(TypeConstants.TYPEBINDING, this.compoundName[6])) return; if (CharOperation.equals(TypeConstants.ORG_ECLIPSE_JDT_INTERNAL_COMPILER_LOOKUP_TYPEBINDING, this.compoundName)) this.typeBits |= TypeIds.BitUninternedType; break; } } /** * p.X<T extends Y & I, U extends Y> {} -> Lp/X<TT;TU;>; */ public char[] computeUniqueKey(boolean isLeaf) { if (!isLeaf) return signature(); return genericTypeSignature(); } /** * Answer the receiver's constant pool name. * * NOTE: This method should only be used during/after code gen. */ public char[] constantPoolName() /* java/lang/Object */ { if (this.constantPoolName != null) return this.constantPoolName; return this.constantPoolName = CharOperation.concatWith(this.compoundName, '/'); } public String debugName() { return (this.compoundName != null) ? this.hasTypeAnnotations() ? annotatedDebugName() : new String(readableName()) : "UNNAMED TYPE"; //$NON-NLS-1$ } public int depth() { int depth = 0; ReferenceBinding current = this; while ((current = current.enclosingType()) != null) depth++; return depth; } public boolean detectAnnotationCycle() { if ((this.tagBits & TagBits.EndAnnotationCheck) != 0) return false; // already checked if ((this.tagBits & TagBits.BeginAnnotationCheck) != 0) return true; // in the middle of checking its methods this.tagBits |= TagBits.BeginAnnotationCheck; MethodBinding[] currentMethods = methods(); boolean inCycle = false; // check each method before failing for (int i = 0, l = currentMethods.length; i < l; i++) { TypeBinding returnType = currentMethods[i].returnType.leafComponentType().erasure(); if (TypeBinding.equalsEquals(this, returnType)) { if (this instanceof SourceTypeBinding) { MethodDeclaration decl = (MethodDeclaration) currentMethods[i].sourceMethod(); ((SourceTypeBinding) this).scope.problemReporter().annotationCircularity(this, this, decl != null ? decl.returnType : null); } } else if (returnType.isAnnotationType() && ((ReferenceBinding) returnType).detectAnnotationCycle()) { if (this instanceof SourceTypeBinding) { MethodDeclaration decl = (MethodDeclaration) currentMethods[i].sourceMethod(); ((SourceTypeBinding) this).scope.problemReporter().annotationCircularity(this, returnType, decl != null ? decl.returnType : null); } inCycle = true; } } if (inCycle) return true; this.tagBits |= TagBits.EndAnnotationCheck; return false; } public final ReferenceBinding enclosingTypeAt(int relativeDepth) { ReferenceBinding current = this; while (relativeDepth-- > 0 && current != null) current = current.enclosingType(); return current; } public int enumConstantCount() { int count = 0; FieldBinding[] fields = fields(); for (int i = 0, length = fields.length; i < length; i++) { if ((fields[i].modifiers & ClassFileConstants.AccEnum) != 0) count++; } return count; } public int fieldCount() { return fields().length; } public FieldBinding[] fields() { return Binding.NO_FIELDS; } public final int getAccessFlags() { return this.modifiers & ExtraCompilerModifiers.AccJustFlag; } /** * @return the JSR 175 annotations for this type. */ public AnnotationBinding[] getAnnotations() { return retrieveAnnotations(this); } /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits() */ public long getAnnotationTagBits() { return this.tagBits; } /** * @return the enclosingInstancesSlotSize */ public int getEnclosingInstancesSlotSize() { if (isStatic()) return 0; return enclosingType() == null ? 0 : 1; } public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) { return null; } public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) { return null; } public FieldBinding getField(char[] fieldName, boolean needResolve) { return null; } /** * @see org.eclipse.jdt.internal.compiler.env.IDependent#getFileName() */ public char[] getFileName() { return this.fileName; } public ReferenceBinding getMemberType(char[] typeName) { ReferenceBinding[] memberTypes = memberTypes(); for (int i = memberTypes.length; --i >= 0;) if (CharOperation.equals(memberTypes[i].sourceName, typeName)) return memberTypes[i]; return null; } public MethodBinding[] getMethods(char[] selector) { return Binding.NO_METHODS; } // Answer methods named selector, which take no more than the suggestedParameterLength. // The suggested parameter length is optional and may not be guaranteed by every type. public MethodBinding[] getMethods(char[] selector, int suggestedParameterLength) { return getMethods(selector); } /** * @return the outerLocalVariablesSlotSize */ public int getOuterLocalVariablesSlotSize() { return 0; } public PackageBinding getPackage() { return this.fPackage; } public TypeVariableBinding getTypeVariable(char[] variableName) { TypeVariableBinding[] typeVariables = typeVariables(); for (int i = typeVariables.length; --i >= 0;) if (CharOperation.equals(typeVariables[i].sourceName, variableName)) return typeVariables[i]; return null; } public int hashCode() { // ensure ReferenceBindings hash to the same position as UnresolvedReferenceBindings so they can be replaced without rehashing // ALL ReferenceBindings are unique when created so equals() is the same as == return (this.compoundName == null || this.compoundName.length == 0) ? super.hashCode() : CharOperation.hashCode(this.compoundName[this.compoundName.length - 1]); } /** * Returns true if the two types have an incompatible common supertype, * e.g. List<String> and List<Integer> */ public boolean hasIncompatibleSuperType(ReferenceBinding otherType) { if (TypeBinding.equalsEquals(this, otherType)) return false; ReferenceBinding[] interfacesToVisit = null; int nextPosition = 0; ReferenceBinding currentType = this; TypeBinding match; do { match = otherType.findSuperTypeOriginatingFrom(currentType); if (match != null && match.isProvablyDistinct(currentType)) return true; ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { if (interfacesToVisit == null) { interfacesToVisit = itsInterfaces; nextPosition = interfacesToVisit.length; } else { int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); nextInterface : for (int a = 0; a < itsLength; a++) { ReferenceBinding next = itsInterfaces[a]; for (int b = 0; b < nextPosition; b++) if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface; interfacesToVisit[nextPosition++] = next; } } } } while ((currentType = currentType.superclass()) != null); for (int i = 0; i < nextPosition; i++) { currentType = interfacesToVisit[i]; if (TypeBinding.equalsEquals(currentType, otherType)) return false; match = otherType.findSuperTypeOriginatingFrom(currentType); if (match != null && match.isProvablyDistinct(currentType)) return true; ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); nextInterface : for (int a = 0; a < itsLength; a++) { ReferenceBinding next = itsInterfaces[a]; for (int b = 0; b < nextPosition; b++) if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface; interfacesToVisit[nextPosition++] = next; } } } return false; } public boolean hasMemberTypes() { return false; } /** * Answer whether a @NonNullByDefault is applicable at the reference binding, * for 1.8 check if the default is applicable to the given kind of location. */ // pre: null annotation analysis is enabled boolean hasNonNullDefaultFor(int location, boolean useTypeAnnotations) { // Note, STB overrides for correctly handling local types ReferenceBinding currentType = this; while (currentType != null) { if (useTypeAnnotations) { int nullDefault = ((ReferenceBinding)currentType.original()).getNullDefault(); if (nullDefault != 0) return (nullDefault & location) != 0; } else { if ((currentType.tagBits & TagBits.AnnotationNonNullByDefault) != 0) return true; if ((currentType.tagBits & TagBits.AnnotationNullUnspecifiedByDefault) != 0) return false; } currentType = currentType.enclosingType(); } // package if (useTypeAnnotations) return (this.getPackage().defaultNullness & location) != 0; else return this.getPackage().defaultNullness == NONNULL_BY_DEFAULT; } int getNullDefault() { return 0; } public final boolean hasRestrictedAccess() { return (this.modifiers & ExtraCompilerModifiers.AccRestrictedAccess) != 0; } /** Answer true if the receiver implements anInterface or is identical to anInterface. * If searchHierarchy is true, then also search the receiver's superclasses. * * NOTE: Assume that anInterface is an interface. */ public boolean implementsInterface(ReferenceBinding anInterface, boolean searchHierarchy) { if (TypeBinding.equalsEquals(this, anInterface)) return true; ReferenceBinding[] interfacesToVisit = null; int nextPosition = 0; ReferenceBinding currentType = this; do { ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { // in code assist cases when source types are added late, may not be finished connecting hierarchy if (interfacesToVisit == null) { interfacesToVisit = itsInterfaces; nextPosition = interfacesToVisit.length; } else { int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); nextInterface : for (int a = 0; a < itsLength; a++) { ReferenceBinding next = itsInterfaces[a]; for (int b = 0; b < nextPosition; b++) if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface; interfacesToVisit[nextPosition++] = next; } } } } while (searchHierarchy && (currentType = currentType.superclass()) != null); for (int i = 0; i < nextPosition; i++) { currentType = interfacesToVisit[i]; if (currentType.isEquivalentTo(anInterface)) return true; ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { // in code assist cases when source types are added late, may not be finished connecting hierarchy int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); nextInterface : for (int a = 0; a < itsLength; a++) { ReferenceBinding next = itsInterfaces[a]; for (int b = 0; b < nextPosition; b++) if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface; interfacesToVisit[nextPosition++] = next; } } } return false; } // Internal method... assume its only sent to classes NOT interfaces boolean implementsMethod(MethodBinding method) { char[] selector = method.selector; ReferenceBinding type = this; while (type != null) { MethodBinding[] methods = type.methods(); long range; if ((range = ReferenceBinding.binarySearch(selector, methods)) >= 0) { int start = (int) range, end = (int) (range >> 32); for (int i = start; i <= end; i++) { if (methods[i].areParametersEqual(method)) return true; } } type = type.superclass(); } return false; } /** * Answer true if the receiver is an abstract type */ public final boolean isAbstract() { return (this.modifiers & ClassFileConstants.AccAbstract) != 0; } public boolean isAnnotationType() { return (this.modifiers & ClassFileConstants.AccAnnotation) != 0; } public final boolean isBinaryBinding() { return (this.tagBits & TagBits.IsBinaryBinding) != 0; } public boolean isClass() { return (this.modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) == 0; } public boolean isProperType(boolean admitCapture18) { ReferenceBinding outer = enclosingType(); if (outer != null && !outer.isProperType(admitCapture18)) return false; return super.isProperType(admitCapture18); } /** * Answer true if the receiver type can be assigned to the argument type (right) * In addition to improving performance, caching also ensures there is no infinite regression * since per nature, the compatibility check is recursive through parameterized type arguments (122775) */ public boolean isCompatibleWith(TypeBinding otherType, /*@Nullable*/ Scope captureScope) { if (equalsEquals(otherType, this)) return true; if (otherType.id == TypeIds.T_JavaLangObject) return true; Object result; if (this.compatibleCache == null) { this.compatibleCache = new SimpleLookupTable(3); result = null; } else { result = this.compatibleCache.get(otherType); // [dbg reset] this.compatibleCache.put(otherType,null) if (result != null) { return result == Boolean.TRUE; } } this.compatibleCache.put(otherType, Boolean.FALSE); // protect from recursive call if (isCompatibleWith0(otherType, captureScope)) { this.compatibleCache.put(otherType, Boolean.TRUE); return true; } if (captureScope == null && this instanceof TypeVariableBinding && ((TypeVariableBinding)this).firstBound instanceof ParameterizedTypeBinding) { // see https://bugs.eclipse.org/395002#c9 // in this case a subsequent check with captureScope != null may actually get // a better result, reset this info to ensure we're not blocking that re-check. this.compatibleCache.put(otherType, null); } return false; } /** * Answer true if the receiver type can be assigned to the argument type (right) */ private boolean isCompatibleWith0(TypeBinding otherType, /*@Nullable*/ Scope captureScope) { if (TypeBinding.equalsEquals(otherType, this)) return true; if (otherType.id == TypeIds.T_JavaLangObject) return true; // equivalence may allow compatibility with array type through wildcard // bound if (isEquivalentTo(otherType)) return true; switch (otherType.kind()) { case Binding.WILDCARD_TYPE : case Binding.INTERSECTION_TYPE: return false; // should have passed equivalence check above if // wildcard case Binding.TYPE_PARAMETER : // check compatibility with capture of ? super X if (otherType.isCapture()) { CaptureBinding otherCapture = (CaptureBinding) otherType; TypeBinding otherLowerBound; if ((otherLowerBound = otherCapture.lowerBound) != null) { if (otherLowerBound.isArrayType()) return false; return isCompatibleWith(otherLowerBound); } } //$FALL-THROUGH$ case Binding.GENERIC_TYPE : case Binding.TYPE : case Binding.PARAMETERIZED_TYPE : case Binding.RAW_TYPE : switch (kind()) { case Binding.GENERIC_TYPE : case Binding.PARAMETERIZED_TYPE : case Binding.RAW_TYPE : if (TypeBinding.equalsEquals(erasure(), otherType.erasure())) return false; // should have passed equivalence check // above if same erasure } ReferenceBinding otherReferenceType = (ReferenceBinding) otherType; if (otherReferenceType.isInterface()) { // could be annotation type if (implementsInterface(otherReferenceType, true)) return true; if (this instanceof TypeVariableBinding && captureScope != null) { TypeVariableBinding typeVariable = (TypeVariableBinding) this; if (typeVariable.firstBound instanceof ParameterizedTypeBinding) { TypeBinding bound = typeVariable.firstBound.capture(captureScope, -1); // no position needed as this capture will never escape this context return bound.isCompatibleWith(otherReferenceType); } } } if (isInterface()) // Explicit conversion from an interface // to a class is not allowed return false; return otherReferenceType.isSuperclassOf(this); default : return false; } } public boolean isSubtypeOf(TypeBinding other) { if (isSubTypeOfRTL(other)) return true; // TODO: if this has wildcards, perform capture before the next call: TypeBinding candidate = findSuperTypeOriginatingFrom(other); if (candidate == null) return false; if (TypeBinding.equalsEquals(candidate, other)) return true; // T<Ai...> <: T#RAW: if (other.isRawType() && TypeBinding.equalsEquals(candidate.erasure(), other.erasure())) return true; TypeBinding[] sis = other.typeArguments(); TypeBinding[] tis = candidate.typeArguments(); if (tis == null || sis == null) return false; if (sis.length != tis.length) return false; for (int i = 0; i < sis.length; i++) { if (!tis[i].isTypeArgumentContainedBy(sis[i])) return false; } return true; } protected boolean isSubTypeOfRTL(TypeBinding other) { if (TypeBinding.equalsEquals(this, other)) return true; if (other instanceof CaptureBinding) { // for this one kind we must first unwrap the rhs: TypeBinding lower = ((CaptureBinding) other).lowerBound; return (lower != null && isSubtypeOf(lower)); } if (other instanceof ReferenceBinding) { TypeBinding[] intersecting = ((ReferenceBinding) other).getIntersectingTypes(); if (intersecting != null) { for (int i = 0; i < intersecting.length; i++) { if (!isSubtypeOf(intersecting[i])) return false; } return true; } } return false; } /** * Answer true if the receiver has default visibility */ public final boolean isDefault() { return (this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate)) == 0; } /** * Answer true if the receiver is a deprecated type */ public final boolean isDeprecated() { return (this.modifiers & ClassFileConstants.AccDeprecated) != 0; } public boolean isEnum() { return (this.modifiers & ClassFileConstants.AccEnum) != 0; } /** * Answer true if the receiver is final and cannot be subclassed */ public final boolean isFinal() { return (this.modifiers & ClassFileConstants.AccFinal) != 0; } /** * Returns true if the type hierarchy is being connected */ public boolean isHierarchyBeingConnected() { return (this.tagBits & TagBits.EndHierarchyCheck) == 0 && (this.tagBits & TagBits.BeginHierarchyCheck) != 0; } /** * Returns true if the type hierarchy is being connected "actively" i.e not paused momentatrily, * while resolving type arguments. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057 */ public boolean isHierarchyBeingActivelyConnected() { return (this.tagBits & TagBits.EndHierarchyCheck) == 0 && (this.tagBits & TagBits.BeginHierarchyCheck) != 0 && (this.tagBits & TagBits.PauseHierarchyCheck) == 0; } /** * Returns true if the type hierarchy is connected */ public boolean isHierarchyConnected() { return true; } public boolean isInterface() { // consider strict interfaces and annotation types return (this.modifiers & ClassFileConstants.AccInterface) != 0; } public boolean isFunctionalInterface(Scope scope) { MethodBinding method; return isInterface() && (method = getSingleAbstractMethod(scope, true)) != null && method.isValidBinding(); } /** * Answer true if the receiver has private visibility */ public final boolean isPrivate() { return (this.modifiers & ClassFileConstants.AccPrivate) != 0; } /** * Answer true if the receiver or any of its enclosing types have private visibility */ public final boolean isOrEnclosedByPrivateType() { if (isLocalType()) return true; // catch all local types ReferenceBinding type = this; while (type != null) { if ((type.modifiers & ClassFileConstants.AccPrivate) != 0) return true; type = type.enclosingType(); } return false; } /** * Answer true if the receiver has protected visibility */ public final boolean isProtected() { return (this.modifiers & ClassFileConstants.AccProtected) != 0; } /** * Answer true if the receiver has public visibility */ public final boolean isPublic() { return (this.modifiers & ClassFileConstants.AccPublic) != 0; } /** * Answer true if the receiver is a static member type (or toplevel) */ public final boolean isStatic() { return (this.modifiers & (ClassFileConstants.AccStatic | ClassFileConstants.AccInterface)) != 0 || (this.tagBits & TagBits.IsNestedType) == 0; } /** * Answer true if all float operations must adher to IEEE 754 float/double rules */ public final boolean isStrictfp() { return (this.modifiers & ClassFileConstants.AccStrictfp) != 0; } /** * Answer true if the receiver is in the superclass hierarchy of aType * NOTE: Object.isSuperclassOf(Object) -> false */ public boolean isSuperclassOf(ReferenceBinding otherType) { while ((otherType = otherType.superclass()) != null) { if (otherType.isEquivalentTo(this)) return true; } return false; } /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isThrowable() */ public boolean isThrowable() { ReferenceBinding current = this; do { switch (current.id) { case TypeIds.T_JavaLangThrowable : case TypeIds.T_JavaLangError : case TypeIds.T_JavaLangRuntimeException : case TypeIds.T_JavaLangException : return true; } } while ((current = current.superclass()) != null); return false; } /** * JLS 11.5 ensures that Throwable, Exception, RuntimeException and Error are directly connected. * (Throwable<- Exception <- RumtimeException, Throwable <- Error). Thus no need to check #isCompatibleWith * but rather check in type IDs so as to avoid some eager class loading for JCL writers. * When 'includeSupertype' is true, answers true if the given type can be a supertype of some unchecked exception * type (i.e. Throwable or Exception). * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isUncheckedException(boolean) */ public boolean isUncheckedException(boolean includeSupertype) { switch (this.id) { case TypeIds.T_JavaLangError : case TypeIds.T_JavaLangRuntimeException : return true; case TypeIds.T_JavaLangThrowable : case TypeIds.T_JavaLangException : return includeSupertype; } ReferenceBinding current = this; while ((current = current.superclass()) != null) { switch (current.id) { case TypeIds.T_JavaLangError : case TypeIds.T_JavaLangRuntimeException : return true; case TypeIds.T_JavaLangThrowable : case TypeIds.T_JavaLangException : return false; } } return false; } /** * Answer true if the receiver has private visibility and is used locally */ public final boolean isUsed() { return (this.modifiers & ExtraCompilerModifiers.AccLocallyUsed) != 0; } /** * Answer true if the receiver is deprecated (or any of its enclosing types) */ public final boolean isViewedAsDeprecated() { return (this.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0 || getPackage().isViewedAsDeprecated(); } public ReferenceBinding[] memberTypes() { return Binding.NO_MEMBER_TYPES; } public MethodBinding[] methods() { return Binding.NO_METHODS; } public final ReferenceBinding outermostEnclosingType() { ReferenceBinding current = this; while (true) { ReferenceBinding last = current; if ((current = current.enclosingType()) == null) return last; } } /** * Answer the source name for the type. * In the case of member types, as the qualified name from its top level type. * For example, for a member type N defined inside M & A: "A.M.N". */ public char[] qualifiedSourceName() { if (isMemberType()) return CharOperation.concat(enclosingType().qualifiedSourceName(), sourceName(), '.'); return sourceName(); } /** * Answer the receiver's signature. * * NOTE: This method should only be used during/after code gen. */ public char[] readableName() /*java.lang.Object, p.X<T> */ { char[] readableName; if (isMemberType()) { readableName = CharOperation.concat(enclosingType().readableName(), this.sourceName, '.'); } else { readableName = CharOperation.concatWith(this.compoundName, '.'); } TypeVariableBinding[] typeVars; if ((typeVars = typeVariables()) != Binding.NO_TYPE_VARIABLES) { StringBuffer nameBuffer = new StringBuffer(10); nameBuffer.append(readableName).append('<'); for (int i = 0, length = typeVars.length; i < length; i++) { if (i > 0) nameBuffer.append(','); nameBuffer.append(typeVars[i].readableName()); } nameBuffer.append('>'); int nameLength = nameBuffer.length(); readableName = new char[nameLength]; nameBuffer.getChars(0, nameLength, readableName, 0); } return readableName; } protected void appendNullAnnotation(StringBuffer nameBuffer, CompilerOptions options) { if (options.isAnnotationBasedNullAnalysisEnabled) { // restore applied null annotation from tagBits: if ((this.tagBits & TagBits.AnnotationNonNull) != 0) { char[][] nonNullAnnotationName = options.nonNullAnnotationName; nameBuffer.append('@').append(nonNullAnnotationName[nonNullAnnotationName.length-1]).append(' '); } if ((this.tagBits & TagBits.AnnotationNullable) != 0) { char[][] nullableAnnotationName = options.nullableAnnotationName; nameBuffer.append('@').append(nullableAnnotationName[nullableAnnotationName.length-1]).append(' '); } } } public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) { SimpleLookupTable store = storedAnnotations(forceInitialization); return store == null ? null : (AnnotationHolder) store.get(binding); } AnnotationBinding[] retrieveAnnotations(Binding binding) { AnnotationHolder holder = retrieveAnnotationHolder(binding, true); return holder == null ? Binding.NO_ANNOTATIONS : holder.getAnnotations(); } public void setAnnotations(AnnotationBinding[] annotations) { storeAnnotations(this, annotations); } public void setContainerAnnotationType(ReferenceBinding value) { // Leave this to subclasses } public void tagAsHavingDefectiveContainerType() { // Leave this to subclasses } /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#nullAnnotatedReadableName(CompilerOptions,boolean) */ public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) { if (shortNames) return nullAnnotatedShortReadableName(options); return nullAnnotatedReadableName(options); } char[] nullAnnotatedReadableName(CompilerOptions options) { StringBuffer nameBuffer = new StringBuffer(10); if (isMemberType()) { nameBuffer.append(enclosingType().nullAnnotatedReadableName(options, false)); nameBuffer.append('.'); appendNullAnnotation(nameBuffer, options); nameBuffer.append(this.sourceName); } else if (this.compoundName != null) { int i; int l=this.compoundName.length; for (i=0; i<l-1; i++) { nameBuffer.append(this.compoundName[i]); nameBuffer.append('.'); } appendNullAnnotation(nameBuffer, options); nameBuffer.append(this.compoundName[i]); } else { // case of TypeVariableBinding with nullAnnotationTagBits: appendNullAnnotation(nameBuffer, options); if (this.sourceName != null) nameBuffer.append(this.sourceName); else // WildcardBinding, CaptureBinding have no sourceName nameBuffer.append(this.readableName()); } TypeBinding [] arguments = typeArguments(); if (arguments != null && arguments.length > 0) { // empty arguments array happens when PTB has been created just to capture type annotations nameBuffer.append('<'); for (int i = 0, length = arguments.length; i < length; i++) { if (i > 0) nameBuffer.append(','); nameBuffer.append(arguments[i].nullAnnotatedReadableName(options, false)); } nameBuffer.append('>'); } int nameLength = nameBuffer.length(); char[] readableName = new char[nameLength]; nameBuffer.getChars(0, nameLength, readableName, 0); return readableName; } char[] nullAnnotatedShortReadableName(CompilerOptions options) { StringBuffer nameBuffer = new StringBuffer(10); if (isMemberType()) { nameBuffer.append(enclosingType().nullAnnotatedReadableName(options, true)); nameBuffer.append('.'); appendNullAnnotation(nameBuffer, options); nameBuffer.append(this.sourceName); } else { appendNullAnnotation(nameBuffer, options); if (this.sourceName != null) nameBuffer.append(this.sourceName); else // WildcardBinding, CaptureBinding have no sourceName nameBuffer.append(this.shortReadableName()); } TypeBinding [] arguments = typeArguments(); if (arguments != null && arguments.length > 0) { // empty arguments array happens when PTB has been created just to capture type annotations nameBuffer.append('<'); for (int i = 0, length = arguments.length; i < length; i++) { if (i > 0) nameBuffer.append(','); nameBuffer.append(arguments[i].nullAnnotatedReadableName(options, true)); } nameBuffer.append('>'); } int nameLength = nameBuffer.length(); char[] shortReadableName = new char[nameLength]; nameBuffer.getChars(0, nameLength, shortReadableName, 0); return shortReadableName; } public char[] shortReadableName() /*Object*/ { char[] shortReadableName; if (isMemberType()) { shortReadableName = CharOperation.concat(enclosingType().shortReadableName(), this.sourceName, '.'); } else { shortReadableName = this.sourceName; } TypeVariableBinding[] typeVars; if ((typeVars = typeVariables()) != Binding.NO_TYPE_VARIABLES) { StringBuffer nameBuffer = new StringBuffer(10); nameBuffer.append(shortReadableName).append('<'); for (int i = 0, length = typeVars.length; i < length; i++) { if (i > 0) nameBuffer.append(','); nameBuffer.append(typeVars[i].shortReadableName()); } nameBuffer.append('>'); int nameLength = nameBuffer.length(); shortReadableName = new char[nameLength]; nameBuffer.getChars(0, nameLength, shortReadableName, 0); } return shortReadableName; } public char[] signature() /* Ljava/lang/Object; */ { if (this.signature != null) return this.signature; return this.signature = CharOperation.concat('L', constantPoolName(), ';'); } public char[] sourceName() { return this.sourceName; } void storeAnnotationHolder(Binding binding, AnnotationHolder holder) { if (holder == null) { SimpleLookupTable store = storedAnnotations(false); if (store != null) store.removeKey(binding); } else { SimpleLookupTable store = storedAnnotations(true); if (store != null) store.put(binding, holder); } } void storeAnnotations(Binding binding, AnnotationBinding[] annotations) { AnnotationHolder holder = null; if (annotations == null || annotations.length == 0) { SimpleLookupTable store = storedAnnotations(false); if (store != null) holder = (AnnotationHolder) store.get(binding); if (holder == null) return; // nothing to delete } else { SimpleLookupTable store = storedAnnotations(true); if (store == null) return; // not supported holder = (AnnotationHolder) store.get(binding); if (holder == null) holder = new AnnotationHolder(); } storeAnnotationHolder(binding, holder.setAnnotations(annotations)); } SimpleLookupTable storedAnnotations(boolean forceInitialize) { return null; // overrride if interested in storing annotations for the receiver, its fields and methods } public ReferenceBinding superclass() { return null; } public ReferenceBinding[] superInterfaces() { return Binding.NO_SUPERINTERFACES; } public ReferenceBinding[] syntheticEnclosingInstanceTypes() { if (isStatic()) return null; ReferenceBinding enclosingType = enclosingType(); if (enclosingType == null) return null; return new ReferenceBinding[] {enclosingType}; } MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types return methods(); } public FieldBinding[] unResolvedFields() { return Binding.NO_FIELDS; } /* * If a type - known to be a Closeable - is mentioned in one of our white lists * answer the typeBit for the white list (BitWrapperCloseable or BitResourceFreeCloseable). */ protected int applyCloseableClassWhitelists() { switch (this.compoundName.length) { case 3: if (CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])) { if (CharOperation.equals(TypeConstants.IO, this.compoundName[1])) { char[] simpleName = this.compoundName[2]; int l = TypeConstants.JAVA_IO_WRAPPER_CLOSEABLES.length; for (int i = 0; i < l; i++) { if (CharOperation.equals(simpleName, TypeConstants.JAVA_IO_WRAPPER_CLOSEABLES[i])) return TypeIds.BitWrapperCloseable; } l = TypeConstants.JAVA_IO_RESOURCE_FREE_CLOSEABLES.length; for (int i = 0; i < l; i++) { if (CharOperation.equals(simpleName, TypeConstants.JAVA_IO_RESOURCE_FREE_CLOSEABLES[i])) return TypeIds.BitResourceFreeCloseable; } } } break; case 4: if (CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])) { if (CharOperation.equals(TypeConstants.UTIL, this.compoundName[1])) { if (CharOperation.equals(TypeConstants.ZIP, this.compoundName[2])) { char[] simpleName = this.compoundName[3]; int l = TypeConstants.JAVA_UTIL_ZIP_WRAPPER_CLOSEABLES.length; for (int i = 0; i < l; i++) { if (CharOperation.equals(simpleName, TypeConstants.JAVA_UTIL_ZIP_WRAPPER_CLOSEABLES[i])) return TypeIds.BitWrapperCloseable; } } } } break; } int l = TypeConstants.OTHER_WRAPPER_CLOSEABLES.length; for (int i = 0; i < l; i++) { if (CharOperation.equals(this.compoundName, TypeConstants.OTHER_WRAPPER_CLOSEABLES[i])) return TypeIds.BitWrapperCloseable; } return 0; } /* * If a type - known to be a Closeable - is mentioned in one of our white lists * answer the typeBit for the white list (BitWrapperCloseable or BitResourceFreeCloseable). */ protected int applyCloseableInterfaceWhitelists() { switch (this.compoundName.length) { case 4: if (CharOperation.equals(this.compoundName, TypeConstants.RESOURCE_FREE_CLOSEABLE_STREAM)) return TypeIds.BitResourceFreeCloseable; break; } return 0; } private MethodBinding [] getInterfaceAbstractContracts(Scope scope) throws InvalidInputException { if (!isInterface() || !isValidBinding()) { throw new InvalidInputException("Not a functional interface"); //$NON-NLS-1$ } MethodBinding [] methods = methods(); MethodBinding [] contracts = new MethodBinding[0]; int contractsCount = 0; int contractsLength = 0; ReferenceBinding [] superInterfaces = superInterfaces(); for (int i = 0, length = superInterfaces.length; i < length; i++) { MethodBinding [] superInterfaceContracts = superInterfaces[i].getInterfaceAbstractContracts(scope); final int superInterfaceContractsLength = superInterfaceContracts == null ? 0 : superInterfaceContracts.length; if (superInterfaceContractsLength == 0) continue; if (contractsLength < contractsCount + superInterfaceContractsLength) { System.arraycopy(contracts, 0, contracts = new MethodBinding[contractsLength = contractsCount + superInterfaceContractsLength], 0, contractsCount); } System.arraycopy(superInterfaceContracts, 0, contracts, contractsCount, superInterfaceContractsLength); contractsCount += superInterfaceContractsLength; } for (int i = 0, length = methods == null ? 0 : methods.length; i < length; i++) { final MethodBinding method = methods[i]; if (method == null || method.isStatic() || method.redeclaresPublicObjectMethod(scope)) continue; if (!method.isValidBinding()) throw new InvalidInputException("Not a functional interface"); //$NON-NLS-1$ if (method.isDefaultMethod()) { for (int j = 0; j < contractsCount; j++) { if (contracts[j] == null) continue; if (MethodVerifier.doesMethodOverride(method, contracts[j], scope.environment())) { contractsCount--; // abstract method from super type rendered default by present interface ==> contracts[j] = null; if (j < contractsCount) System.arraycopy(contracts, j+1, contracts, j, contractsCount - j); } } continue; // skip default method itself } if (contractsCount == contractsLength) { System.arraycopy(contracts, 0, contracts = new MethodBinding[contractsLength += 16], 0, contractsCount); } contracts[contractsCount++] = method; } if (contractsCount < contractsLength) { System.arraycopy(contracts, 0, contracts = new MethodBinding[contractsCount], 0, contractsCount); } return contracts; } public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcards) { int index = replaceWildcards ? 0 : 1; if (this.singleAbstractMethod != null) { if (this.singleAbstractMethod[index] != null) return this.singleAbstractMethod[index]; } else { this.singleAbstractMethod = new MethodBinding[2]; } if (this.compoundName != null) scope.compilationUnitScope().recordQualifiedReference(this.compoundName); MethodBinding[] methods = null; try { methods = getInterfaceAbstractContracts(scope); if (methods == null || methods.length == 0) return this.singleAbstractMethod[index] = samProblemBinding; int contractParameterLength = 0; char [] contractSelector = null; for (int i = 0, length = methods.length; i < length; i++) { MethodBinding method = methods[i]; if (method == null) continue; if (contractSelector == null) { contractSelector = method.selector; contractParameterLength = method.parameters == null ? 0 : method.parameters.length; } else { int methodParameterLength = method.parameters == null ? 0 : method.parameters.length; if (methodParameterLength != contractParameterLength || !CharOperation.equals(method.selector, contractSelector)) return this.singleAbstractMethod[index] = samProblemBinding; } } } catch (InvalidInputException e) { return this.singleAbstractMethod[index] = samProblemBinding; } if (methods.length == 1) return this.singleAbstractMethod[index] = methods[0]; final LookupEnvironment environment = scope.environment(); boolean genericMethodSeen = false; int length = methods.length; next:for (int i = length - 1; i >= 0; --i) { MethodBinding method = methods[i], otherMethod = null; if (method.typeVariables != Binding.NO_TYPE_VARIABLES) genericMethodSeen = true; for (int j = 0; j < length; j++) { if (i == j) continue; otherMethod = methods[j]; if (otherMethod.typeVariables != Binding.NO_TYPE_VARIABLES) genericMethodSeen = true; if (genericMethodSeen) { // adapt type parameters. otherMethod = MethodVerifier.computeSubstituteMethod(otherMethod, method, environment); if (otherMethod == null) continue next; } if (!MethodVerifier.isSubstituteParameterSubsignature(method, otherMethod, environment) || !MethodVerifier.areReturnTypesCompatible(method, otherMethod, environment)) continue next; } // If we reach here, we found a method that is override equivalent with every other method and is also return type substitutable. Compute kosher exceptions now ... ReferenceBinding [] exceptions = new ReferenceBinding[0]; int exceptionsCount = 0, exceptionsLength = 0; final MethodBinding theAbstractMethod = method; boolean shouldEraseThrows = theAbstractMethod.typeVariables == Binding.NO_TYPE_VARIABLES && genericMethodSeen; boolean shouldAdaptThrows = theAbstractMethod.typeVariables != Binding.NO_TYPE_VARIABLES; final int typeVariableLength = theAbstractMethod.typeVariables.length; none:for (i = 0; i < length; i++) { method = methods[i]; ReferenceBinding[] methodThrownExceptions = method.thrownExceptions; int methodExceptionsLength = methodThrownExceptions == null ? 0: methodThrownExceptions.length; if (methodExceptionsLength == 0) break none; if (shouldAdaptThrows && method != theAbstractMethod) { System.arraycopy(methodThrownExceptions, 0, methodThrownExceptions = new ReferenceBinding[methodExceptionsLength], 0, methodExceptionsLength); for (int tv = 0; tv < typeVariableLength; tv++) { if (methodThrownExceptions[tv] instanceof TypeVariableBinding) { methodThrownExceptions[tv] = theAbstractMethod.typeVariables[tv]; } } } nextException: for (int j = 0; j < methodExceptionsLength; j++) { ReferenceBinding methodException = methodThrownExceptions[j]; if (shouldEraseThrows) methodException = (ReferenceBinding) methodException.erasure(); nextMethod: for (int k = 0; k < length; k++) { if (i == k) continue; otherMethod = methods[k]; ReferenceBinding[] otherMethodThrownExceptions = otherMethod.thrownExceptions; int otherMethodExceptionsLength = otherMethodThrownExceptions == null ? 0 : otherMethodThrownExceptions.length; if (otherMethodExceptionsLength == 0) break none; if (shouldAdaptThrows && otherMethod != theAbstractMethod) { System.arraycopy(otherMethodThrownExceptions, 0, otherMethodThrownExceptions = new ReferenceBinding[otherMethodExceptionsLength], 0, otherMethodExceptionsLength); for (int tv = 0; tv < typeVariableLength; tv++) { if (otherMethodThrownExceptions[tv] instanceof TypeVariableBinding) { otherMethodThrownExceptions[tv] = theAbstractMethod.typeVariables[tv]; } } } for (int l = 0; l < otherMethodExceptionsLength; l++) { ReferenceBinding otherException = otherMethodThrownExceptions[l]; if (shouldEraseThrows) otherException = (ReferenceBinding) otherException.erasure(); if (methodException.isCompatibleWith(otherException)) continue nextMethod; } continue nextException; } // If we reach here, method exception or its super type is covered by every throws clause. if (exceptionsCount == exceptionsLength) { System.arraycopy(exceptions, 0, exceptions = new ReferenceBinding[exceptionsLength += 16], 0, exceptionsCount); } exceptions[exceptionsCount++] = methodException; } } if (exceptionsCount != exceptionsLength) { System.arraycopy(exceptions, 0, exceptions = new ReferenceBinding[exceptionsCount], 0, exceptionsCount); } this.singleAbstractMethod[index] = new MethodBinding(theAbstractMethod.modifiers | ClassFileConstants.AccSynthetic, theAbstractMethod.selector, theAbstractMethod.returnType, theAbstractMethod.parameters, exceptions, theAbstractMethod.declaringClass); this.singleAbstractMethod[index].typeVariables = theAbstractMethod.typeVariables; return this.singleAbstractMethod[index]; } return this.singleAbstractMethod[index] = samProblemBinding; } // See JLS 4.9 bullet 1 public static boolean isConsistentIntersection(TypeBinding[] intersectingTypes) { TypeBinding[] ci = new TypeBinding[intersectingTypes.length]; for (int i = 0; i < ci.length; i++) { TypeBinding current = intersectingTypes[i]; ci[i] = (current.isClass() || current.isArrayType()) ? current : current.superclass(); } TypeBinding mostSpecific = ci[0]; for (int i = 1; i < ci.length; i++) { TypeBinding current = ci[i]; // when invoked during type inference we only want to check inconsistency among real types: if (current.isTypeVariable() || current.isWildcard() || !current.isProperType(true)) continue; if (mostSpecific.isSubtypeOf(current)) continue; else if (current.isSubtypeOf(mostSpecific)) mostSpecific = current; else return false; } return true; } }
[ "1141196380@qq.com" ]
1141196380@qq.com
b67bfbadb2f7f36f1f2173935b1ee0c7121e0073
40455b8221e3e9c9318e600bd68fd28893b94a8b
/android-ngn-stack/src/main/java/org/doubango/ngn/datatype/ms/cms/mcpttUserProfile/McpttUserProfile.java
e7c24a3cda3e6cb60fdba095a0095834c22693bd
[]
no_license
jonirazabal/BomberosTFG
d64615a9c4240525051f503794bb0020eaa4f415
622f10adbd5f61fa658b7d3caf4bc51ea8d499f5
refs/heads/master
2021-05-17T12:59:07.197671
2020-03-28T12:15:47
2020-03-28T12:15:47
250,788,142
1
0
null
null
null
null
UTF-8
Java
false
false
4,224
java
/* * Copyright (C) 2017, University of the Basque Country (UPV/EHU) * * Contact for licensing options: <licensing-mcpttclient(at)mcopenplatform(dot)com> * * This file is part of MCOP MCPTT Client * * This is free software: you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * This is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.doubango.ngn.datatype.ms.cms.mcpttUserProfile; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Namespace; import org.simpleframework.xml.NamespaceList; import org.simpleframework.xml.Root; import java.util.List; @Root(strict=false, name = "mcptt-user-profile") @NamespaceList({ @Namespace(reference = "urn:3gpp:mcptt:user-profile:1.0"), @Namespace(prefix = "xml", reference = "http://www.w3.org/XML/1998/namespace") }) public class McpttUserProfile { @ElementList(required=false,inline=true,entry = "ProfileName") protected List<NameType> profileName; @ElementList(required=false,inline=true,entry = "Name") protected List<NameType> name; @ElementList(required=false,inline=true,entry = "Pre-selected-indication") protected List<EmptyType> preSelectedIndication; @ElementList(required=false,inline=true,entry = "Common") protected List<CommonType> common; @ElementList(required=false,inline=true,entry = "OnNetwork") protected List<OnNetworkType> onNetwork; @ElementList(required=false,inline=true,entry = "OffNetwork") protected List<OffNetworkType> offNetwork; @Element(required=false,name = "Status") protected boolean status; @Element(required=false,name = "ruleset") protected Ruleset ruleset; @Attribute(required = false , name = "XUI-URI") protected String xuiuri; @Attribute(required = false , name = "user-profile-index") protected Short userProfileIndex; public List<NameType> getProfileName() { return profileName; } public void setProfileName(List<NameType> profileName) { this.profileName = profileName; } public List<NameType> getName() { return name; } public void setName(List<NameType> name) { this.name = name; } public List<EmptyType> getPreSelectedIndication() { return preSelectedIndication; } public void setPreSelectedIndication(List<EmptyType> preSelectedIndication) { this.preSelectedIndication = preSelectedIndication; } public List<CommonType> getCommon() { return common; } public void setCommon(List<CommonType> common) { this.common = common; } public List<OnNetworkType> getOnNetwork() { return onNetwork; } public void setOnNetwork(List<OnNetworkType> onNetwork) { this.onNetwork = onNetwork; } public List<OffNetworkType> getOffNetwork() { return offNetwork; } public void setOffNetwork(List<OffNetworkType> offNetwork) { this.offNetwork = offNetwork; } public boolean isStatus() { return status; } public void setStatus(boolean status) { this.status = status; } public String getXUIURI() { return xuiuri; } public void setXUIURI(String value) { this.xuiuri = value; } public Short getUserProfileIndex() { return userProfileIndex; } public void setUserProfileIndex(Short value) { this.userProfileIndex = value; } public Ruleset getRuleset() { return ruleset; } public void setRuleset(Ruleset ruleset) { this.ruleset = ruleset; } }
[ "jonirazabal14@gmail.com" ]
jonirazabal14@gmail.com
bf92e68bc84ac971ca0e1eeaf2c0361d5149f0be
cb415da83080326737ca98d04854d8705a36cdba
/app/src/test/java/mpip/finki/ukim/googlenearbyplaces/ExampleUnitTest.java
b89f2b9504aca4ccf8fb0f9d829dba7710d9f09c
[]
no_license
kostadinljatkoski/GoogleNearbyPlacesMobileApp
7faa527773e2c533e85715e4a7235265a40f1441
da531e810afd730b9aee3a00b2cd40818c6d0fd6
refs/heads/master
2021-05-17T16:08:03.764059
2020-03-28T18:11:51
2020-03-28T18:11:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package mpip.finki.ukim.googlenearbyplaces; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "kostadinljatkoski@hotmail.com" ]
kostadinljatkoski@hotmail.com
3a0eb5d1645aba595e0cd9158185784050d926e0
c46c4bab8f0411876e52eefd4502715924dbaed1
/challenges/src/main/java/com/clozarr/hackerrank/thirtydaysofcode/StacksAndQueues.java
9459ff1d413d0c39de0a676cee3cbb5f2f5b58a3
[]
no_license
clozarr/HackerRankChallenges
e2c5a6388c20d5e34178693e789517edd66c4333
58956c75e9ca20a1432daf64ca7a8036336de5d5
refs/heads/master
2021-05-21T22:39:37.185586
2021-01-08T04:18:42
2021-01-08T04:18:42
252,835,972
0
0
null
2020-10-13T21:20:14
2020-04-03T20:39:48
Java
UTF-8
Java
false
false
680
java
package com.clozarr.hackerrank.thirtydaysofcode; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; /** * <p> * Challenge Day 18: Queues and Stacks * </p> * * @see <a href= "https://www.hackerrank.com/challenges/30-queues-stacks/problem"> * Queues and Stacks</a> * * * @author clozarr **/ class StacksAndQueues { Stack<Character> stack = new Stack<>(); Queue<Character> queue = new LinkedList<Character>(); public void pushCharacter(char ch) { stack.add(ch); } void enqueueCharacter(char ch) { queue.add(ch); } char popCharacter() { return stack.pop(); } char dequeueCharacter() { return queue.remove(); } }
[ "=" ]
=
64af96441891e7890b4644bf5ce74d3611691ad4
99da3402172372971877019da126ca5b2765ca39
/Hackerrank/com/practice/java/hackerrank/warmup/Sock_Merchant.java
1faeea08f4813923d670c74c13a888bae7fe503b
[]
no_license
ramyps/java_training
bac7a717a658a612abf590d9bea27b03e9c7c864
471985f06f7417437ecd89933328b55512e54922
refs/heads/master
2022-12-22T10:09:46.523618
2019-08-12T19:26:44
2019-08-12T19:26:44
187,083,989
0
0
null
null
null
null
UTF-8
Java
false
false
1,544
java
/** * */ package com.practice.java.hackerrank.warmup; /** * @author Ramy * */ import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Sock_Merchant { // Complete the sockMerchant function below. static int sockMerchantm(int n, int[] ar) { int sale = 0; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { while(i!=j){ // System.out.println(ar[i] +" "+ ar[j]); if(ar[i] == ar[j] &&ar[i]!=0 &&ar[j]!=0 ) { System.out.println(ar[i] +" matches "+ ar[j]); ar[i]=0; ar[j]=1; sale =sale+1; break; }break; }break; } } System.out.println(sale); //sale = sale/2; return sale; } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws IOException { // BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH"))); int n = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int[] ar = new int[n]; String[] arItems = scanner.nextLine().split(" "); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); for (int i = 0; i < n; i++) { int arItem = Integer.parseInt(arItems[i]); ar[i] = arItem; } int result = sockMerchantm(n, ar); System.out.println(result); /* bufferedWriter.write(String.valueOf(result)); bufferedWriter.newLine(); bufferedWriter.close();*/ scanner.close(); } }
[ "ramya.nagavarapu@gmail.com" ]
ramya.nagavarapu@gmail.com
9b1bbe53f78d633faf5a4524575cc96dc363394b
6fecf0d0e0960611facad20879d8a710998b98f0
/src/com/freeman/all/ListActivity.java
3cf7e756c2536d8a6762b5af75bdddb9be2c4de9
[]
no_license
sgidr/aide_code
5f666fd5d1acc7a1c778d00c64e8962798412bc1
44c70ce130715ab36cb59a14cb99a918730eb713
refs/heads/master
2022-10-23T08:13:12.802876
2016-10-13T12:50:59
2016-10-13T12:50:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,530
java
package com.freeman.all; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.view.View; import android.view.ViewGroup; import android.content.Context; import android.view.LayoutInflater; import android.widget.Toast; import android.widget.ListView; import android.widget.TextView; import java.util.Random; import android.widget.CheckBox; import android.widget.ListAdapter; public class ListActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO: Implement this method super.onCreate(savedInstanceState); setContentView(R.layout.list); ListAdapter ma=new MyAdapter(this,new String[]{"apple","banana","cat","dog","eve","fly","girl"}); ((ListView)findViewById(R.id.listListView1)).setAdapter(ma); } } class MyAdapter extends ArrayAdapter<String> { public MyAdapter(Context context,String[] values) { super(context,R.layout.list_item,values); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater ll=LayoutInflater.from(getContext()); View view=ll.inflate(R.layout.list_item,parent,false); String text=getItem(position);//获取item上的字 ((TextView)view.findViewById(R.id.listitemTextView1)).setText(text); ((TextView)view.findViewById(R.id.listitemTextView2)).setText(new Random().nextInt(10000)+""); ((CheckBox)view.findViewById(R.id.listitemCheckBox1)).setChecked(new Random().nextBoolean()); // TODO: Implement this method return view; } }
[ "1879541824@qq.com" ]
1879541824@qq.com
b3f667d251cda54b41cf0e67cd79550558d067fd
a3fbe2a65913a4afad0111b6327ea21990a0e5be
/HashMaps/src/test/com/technicalquestions/ValidAnagramTest.java
a493d097537fbe976e5b7e234bdfcd8cb0d8255d
[]
no_license
icrona/DailyByte
f59c0c0028eebbd6a95dc9d4db268454bf0d5bb8
d8fa8d82fdc78e79b905df8889961f2a310b3f45
refs/heads/master
2022-12-23T22:48:52.564237
2020-10-06T17:22:58
2020-10-06T17:22:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
package com.technicalquestions; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; public class ValidAnagramTest { ValidAnagram validAnagram = new ValidAnagram(); String[] testStrings1 = new String[]{"cat", "listen", "program"} ; String[] testStrings2 = new String[]{"tac", "silent", "function"}; @Test void ValidAnagramTest1(){ assertTrue(validAnagram.validAnagram(testStrings1[0],testStrings2[0])); } @Test void ValidAnagramTest2(){ assertTrue(validAnagram.validAnagram(testStrings1[1],testStrings2[1])); } @Test void ValidAnagramTest3(){ assertFalse(validAnagram.validAnagram(testStrings1[2],testStrings2[2])); } }
[ "jared.c.caldwell@gmail.com" ]
jared.c.caldwell@gmail.com
a08a2bc2bd6b3bcb5e25fa310f030923ea09f7eb
a37dbdf10c20eecb4a75617fe0d7d6787f74069c
/MyApp/app/src/main/java/com/sohu110/airapp/ui/device/DevicerReformActivity.java
9c8d8ad440971d935f224b51db2297c4a65e0b42
[]
no_license
wangy0331/AirApp
70c37bc4cc82af7fe549545a2c5e76f147b170ad
bd410e4bb934c08cfeaf0494a5e002d968e4ffb1
refs/heads/master
2021-01-17T05:06:47.258992
2016-08-01T03:31:03
2016-08-01T03:31:03
56,297,148
0
0
null
null
null
null
UTF-8
Java
false
false
13,145
java
package com.sohu110.airapp.ui.device; import android.Manifest; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.v4.app.ActivityCompat; import android.text.format.DateFormat; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.Toast; import com.sohu110.airapp.R; import com.sohu110.airapp.bean.DeviceReform; import com.sohu110.airapp.bean.Result; import com.sohu110.airapp.kit.StringKit; import com.sohu110.airapp.log.Logger; import com.sohu110.airapp.service.ServiceCenter; import com.sohu110.airapp.ui.BaseActivity; import com.sohu110.airapp.utils.UploadUtil; import com.sohu110.airapp.widget.LibConfig; import com.sohu110.airapp.widget.LibToast; import com.sohu110.airapp.widget.LoadProcessDialog; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Calendar; import java.util.Locale; /** * 设备改造 * Created by Aaron on 2016/5/9. */ public class DevicerReformActivity extends BaseActivity { // private EditText private ImageButton pushPhoto; private EditText mTemp; private EditText mJzf; private EditText mCgq; private EditText mAzp; private EditText mXsq; private EditText mDj; private EditText mDy; private EditText mFj; private String pushImagePath; private Button devicePhone; private static String path;// sd路径 private Bitmap head;// 头像Bitmap @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_device_reform); setTitle(R.string.sbgz_btn); getBtnRight().setImageResource(R.drawable.btn_push); initView(); } private void initView() { devicePhone = (Button) findViewById(R.id.device_phone); devicePhone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showPhoneDialog(); } }); pushPhoto = (ImageButton) findViewById(R.id.push_photo); mTemp = (EditText) findViewById(R.id.pqwdcgq); mJzf = (EditText) findViewById(R.id.jzf); mCgq = (EditText) findViewById(R.id.ylcgq); mAzp = (EditText) findViewById(R.id.azp); mXsq = (EditText) findViewById(R.id.xsq); mDj = (EditText) findViewById(R.id.djx); mDy = (EditText) findViewById(R.id.dyx); mFj = (EditText) findViewById(R.id.fj); pushPhoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialog(); } }); getBtnRight().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DeviceReform info = new DeviceReform(); info.setPaiqiTemp(mTemp.getText().toString()); info.setJiazaifa(mJzf.getText().toString()); info.setPressCgq(mCgq.getText().toString()); info.setInstallChicun(mAzp.getText().toString()); info.setDisplayChicun(mXsq.getText().toString()); info.setDianjiChicun(mDj.getText().toString()); info.setPowerChicun(mDy.getText().toString()); info.setPicUrl(pushImagePath); new memberSubmitTask(info).execute(); } }); } /** * 调用照片 */ private String[] items = new String[]{"选择本地图片", "拍照"}; /* 头像名称 */ private void showDialog() { new AlertDialog.Builder(DevicerReformActivity.this).setTitle("上传照片").setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { // 从相册里面取照片 case 0: Intent intent1 = new Intent(Intent.ACTION_PICK, null); intent1.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(intent1, 1); break; // 调用相机拍照 case 1: Intent intent2 = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent2, 2);// 采用ForResult打开 break; } } }).setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).show(); } public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case 1: if (resultCode == DevicerReformActivity.this.RESULT_OK) { if (data != null) { Uri uri = data.getData(); if (!StringKit.isEmpty(uri.getAuthority())) { Cursor cursor = getContentResolver().query(uri, new String[]{MediaStore.Images.Media.DATA}, null, null, null); if (null == cursor) { Toast.makeText(this, "图片没找到", Toast.LENGTH_SHORT).show(); return; } cursor.moveToFirst(); path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA)); cursor.close(); } else { path = uri.getPath(); } String imagePath = path.substring(0, path.lastIndexOf("/") + 1); String imageName = path.substring(path.lastIndexOf("/") + 1, path.length()); new PushImageTask(imagePath, imageName).execute(); } else { Toast.makeText(this, "图片没找到", Toast.LENGTH_SHORT).show(); return; } } break; case 2: if (resultCode == DevicerReformActivity.this.RESULT_OK) { String sdStatus = Environment.getExternalStorageState(); if (!sdStatus.equals(Environment.MEDIA_MOUNTED)) { // 检测sd是否可用 Log.i("TestFile", "SD card is not avaiable/writeable right now."); return; } String name = new DateFormat().format("yyyyMMdd_hhmmss", Calendar.getInstance(Locale.CHINA)) + ".jpg"; // Toast.makeText(this, name, Toast.LENGTH_LONG).show(); Bundle bundle = data.getExtras(); Bitmap bitmap = (Bitmap) bundle.get("data");// 获取相机返回的数据,并转换为Bitmap图片格式 FileOutputStream b = null; //为什么不能直接保存在系统相册位置呢 path = LibConfig.getCacheImagePath(); Log.e("aaron", path); File file = new File(path); file.mkdirs();// 创建文件夹 String fileName = path + name; try { b = new FileOutputStream(fileName); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, b);// 把数据写入文件 } catch (FileNotFoundException e) { e.printStackTrace(); } finally { try { b.flush(); b.close(); } catch (IOException e) { e.printStackTrace(); } } new PushImageTask(LibConfig.getCacheImagePath(), name).execute(); } break; default: break; } super.onActivityResult(requestCode, resultCode, data); } class PushImageTask extends AsyncTask<Void, Void, String> { private String imagePath; private String imageName; public PushImageTask(String path, String imageFileName) { imagePath = path; imageName = imageFileName; } @Override protected String doInBackground(Void... params) { try { return UploadUtil.ftpUpload(imagePath, imageName); } catch (Exception e) { Logger.e("", "", e); } return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); if (result != null) { Log.e("FTP_PATH", result); pushImagePath = result; LibToast.show(DevicerReformActivity.this, "上传成功"); } else { pushImagePath = ""; LibToast.show(DevicerReformActivity.this, "上传失败"); } } } class memberSubmitTask extends AsyncTask<Void, Void, Result<DeviceReform>> { DeviceReform mInfo = new DeviceReform(); LoadProcessDialog mLoadDialog; public memberSubmitTask(DeviceReform info) { mInfo = info; mLoadDialog = new LoadProcessDialog(DevicerReformActivity.this); } @Override protected void onPreExecute() { super.onPreExecute(); mLoadDialog.show(); } @Override protected Result<DeviceReform> doInBackground(Void... params) { try { return ServiceCenter.submitDevice(mInfo); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Result<DeviceReform> result) { super.onPostExecute(result); mLoadDialog.dismiss(); if(result != null) { if(result.isSuceed()) { LibToast.show(DevicerReformActivity.this, R.string.member_edit_success); DevicerReformActivity.this.finish(); } else if(StringKit.isNotEmpty(result.getMessage())) { LibToast.show(DevicerReformActivity.this, result.getMessage()); DevicerReformActivity.this.finish(); } else { LibToast.show(DevicerReformActivity.this, R.string.member_detail_failure); } } else { LibToast.show(DevicerReformActivity.this, R.string.member_register_network); } } } public void showPhoneDialog() { new AlertDialog.Builder(DevicerReformActivity.this).setTitle(R.string.callPhone) .setMessage(R.string.service_phone).setCancelable(false) .setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intentPhone = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + getString(R.string.service_phone))); if (ActivityCompat.checkSelfPermission(DevicerReformActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } startActivity(intentPhone); } }).setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); } }
[ "aaron.wang@icitymobile.com" ]
aaron.wang@icitymobile.com
ae2fa5245260a64c0143aa2f1854b5797c16b77d
fb8c416e1951d5d4e9d5e521fe56ccb0aaa72f07
/app/src/main/java/com/example/kitcheninventory/activity/masters/cat/CategoryList.java
af809a1a420c0fb6e39b8c4266e3cd8d4997ab5b
[]
no_license
Sivaranjane29/kitchen-inventory
dc0bfbd73b719de72a821b2f5293082c09896b55
90ebbcfef1930bc560d81e89fff5738cbf48c3fc
refs/heads/master
2023-04-06T04:29:15.617972
2021-04-27T16:04:05
2021-04-27T16:04:05
362,004,459
1
0
null
null
null
null
UTF-8
Java
false
false
3,539
java
/* * Copyright (c) 2021. */ package com.example.kitcheninventory.activity.masters.cat; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.MenuItem; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.kitcheninventory.R; import com.example.kitcheninventory.utils.CommonUtils; import com.example.kitcheninventory.utils.PrefManager; import com.example.kitcheninventory.adaptor.CategoryAdaptor; import com.example.kitcheninventory.db.DatabaseClient; import com.example.kitcheninventory.db.master.MCategory; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.List; import java.util.Objects; public class CategoryList extends AppCompatActivity { private CommonUtils mUtils; private PrefManager mPref; RecyclerView mRecycleView; List<MCategory> mCategoryList; CategoryAdaptor mAdapter; FloatingActionButton fabAddCus; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_category_list); Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Category"); mUtils = new CommonUtils(CategoryList.this); mPref = new PrefManager(CategoryList.this); mRecycleView = findViewById(R.id.recycleCategory); mRecycleView.setHasFixedSize(true); mRecycleView.setLayoutManager(new LinearLayoutManager(this)); fabAddCus = findViewById(R.id.fabCategoryAdd); fabAddCus.setOnClickListener(v -> { startActivity(new Intent(CategoryList.this, AddCategory.class)); }); //fetchCategory new fetchCategory().execute(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; } return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { finish(); } class fetchCategory extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... voids) { try { mCategoryList = DatabaseClient .getInstance(getApplicationContext()) .getAppDatabase() .mCategory_dao() .getAll(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if (mCategoryList.size() == 0) { mUtils.showInfo("No category Found"); } loadDataList(mCategoryList); } } private void loadDataList(List<MCategory> mList) { mAdapter = new CategoryAdaptor(CategoryList.this, mList); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(CategoryList.this); mRecycleView.setLayoutManager(layoutManager); mRecycleView.setAdapter(mAdapter); } @Override protected void onResume() { super.onResume(); new fetchCategory().execute(); } }
[ "sivaranjaneanand@gmail.com" ]
sivaranjaneanand@gmail.com
074d2d116a0bc7058045c009d08921e39a6482da
57c3eeff8c947a0973d3cb96900ffab13f72aa10
/MynewJavaProject/src/Selenium2.java
c2adad6770ccc1ecc65afdb0558304716b3f8492
[]
no_license
Shallu-s-26/NewRepository1
3b5a47250ae0118d178234c1b238749d792deeaa
c7fad6861d848c23ed15d066262ffa185155ceef
refs/heads/main
2023-06-14T19:00:26.374014
2021-07-09T01:22:43
2021-07-09T01:22:43
359,046,549
0
0
null
null
null
null
UTF-8
Java
false
false
1,006
java
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; public class Selenium2 { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "Driver\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String a = "https://the-internet.herokuapp.com/dropdown"; driver.get(a); //driver.findElement(By.cssSelector("#username")).sendKeys("username"); //driver.findElement(By.cssSelector("#password")).sendKeys("password"); //driver.findElement(By.cssSelector("div.row:nth-child(2) div.large-12.columns:nth-child(2) div.example form:nth-child(3) button.radius:nth-child(3) > i.fa.fa-2x.fa-sign-in")).click(); Select shallu = new Select(driver.findElement(By.xpath("//select[@id='dropdown']"))); //shallu.selectByValue("Option 1"); //shallu.selectByIndex(1); shallu.selectByVisibleText("1"); } }
[ "shallusharma440@gmail.com" ]
shallusharma440@gmail.com
62d67a5a3cfb869092fc1fc636e430299d8f2566
fed41971c78ff70c701d754cfd023e3ea671ee85
/gd-api-web/src/main/java/com/gudeng/commerce/gd/support/SubsidyCallBack.java
7678ffbe7ce6b5a390086d7fa8314e0ef831821c
[]
no_license
f3226912/gd
204647c822196b52513e5f0f8e475b9d47198d2a
882332a9da91892a38e38443541d93ddd91c7fec
refs/heads/master
2021-01-19T06:47:44.052835
2017-04-07T03:42:12
2017-04-07T03:42:12
87,498,686
0
6
null
null
null
null
UTF-8
Java
false
false
239
java
package com.gudeng.commerce.gd.support; import java.util.List; import com.gudeng.commerce.gd.supplier.dto.ProductDto; public interface SubsidyCallBack { public void appendAuditInfo(List<ProductDto> refusedList) throws Exception; }
[ "253332973@qq.com" ]
253332973@qq.com
49380889d2f3fdf3e634491475a314e016a3b8b3
18cc9453ebc3b58309aa6a05990ba6393a322df0
/datatools/src/test/java/ru/prolib/aquila/datatools/storage/model/SecuritySessionPropertiesEntityTest.java
499c4c61ee7c52ea8a9b05b95035df62303895d7
[]
no_license
robot-aquila/aquila
20ef53d813074e2346bfbd6573ffb0737bef5412
056af30a3610366fe47d97d0c6d53970e3ee662b
refs/heads/develop
2022-11-30T01:54:52.653013
2020-12-07T00:18:01
2020-12-07T00:18:01
20,706,073
3
2
null
2022-11-24T08:58:08
2014-06-11T00:00:34
Java
UTF-8
Java
false
false
2,896
java
package ru.prolib.aquila.datatools.storage.model; import static org.junit.Assert.*; import java.time.LocalDateTime; import org.junit.Before; import org.junit.Test; import ru.prolib.aquila.core.BusinessEntities.Symbol; import ru.prolib.aquila.core.BusinessEntities.SymbolType; import ru.prolib.aquila.datatools.storage.model.SymbolEntity; import ru.prolib.aquila.datatools.storage.model.SecuritySessionPropertiesEntity; public class SecuritySessionPropertiesEntityTest { private Symbol symbol; private SymbolEntity symbolEntity; private SecuritySessionPropertiesEntity entity; @Before public void setUp() throws Exception { symbol = new Symbol("SPY", "ARCA", "USD", SymbolType.FUTURES); symbolEntity = new SymbolEntity(); symbolEntity.setSymbol(symbol); entity = new SecuritySessionPropertiesEntity(); } @Test public void testCtor_Defaults() { assertNull(entity.getId()); assertNull(entity.getSymbol()); assertNull(entity.getSymbolInfo()); assertNull(entity.getScale()); assertNull(entity.getTickCost()); assertNull(entity.getInitialMarginCost()); assertNull(entity.getInitialPrice()); assertNull(entity.getLowerPriceLimit()); assertNull(entity.getUpperPriceLimit()); assertNull(entity.getLotSize()); assertNull(entity.getTickSize()); assertNull(entity.getSnapshotTime()); assertNull(entity.getClearingTime()); } @Test public void testSettersAndGetters() throws Exception { entity.setId(280L); entity.setSymbol(symbolEntity); entity.setScale(2); entity.setTickCost(12.34); entity.setInitialMarginCost(22897.86); entity.setInitialPrice(102310d); entity.setLowerPriceLimit(90000d); entity.setUpperPriceLimit(110000d); entity.setLotSize(1); entity.setTickSize(10d); entity.setSnapshotTime(LocalDateTime.of(2001, 1, 10, 20, 30, 0, 954)); entity.setClearingTime(LocalDateTime.of(2001, 1, 11, 18, 45, 0, 0)); assertEquals(new Long(280), entity.getId()); assertSame(symbolEntity, entity.getSymbol()); assertEquals(new Integer(2), entity.getScale()); assertEquals(new Double(12.34), entity.getTickCost(), 0.01); assertEquals(new Double(22897.86), entity.getInitialMarginCost(), 0.01); assertEquals(new Double(102310.0), entity.getInitialPrice(), 0.1); assertEquals(new Double(90000.0), entity.getLowerPriceLimit(), 0.1); assertEquals(new Double(110000.0), entity.getUpperPriceLimit(), 0.1); assertEquals(new Integer(1), entity.getLotSize()); assertEquals(new Double(10.0), entity.getTickSize(), 0.1); assertEquals(LocalDateTime.of(2001, 1, 10, 20, 30, 0, 954), entity.getSnapshotTime()); assertEquals(LocalDateTime.of(2001, 1, 11, 18, 45, 0, 0), entity.getClearingTime()); } @Test public void testGetSymbol() throws Exception { entity.setSymbol(symbolEntity); assertSame(symbol, entity.getSymbolInfo()); } }
[ "dmitry.zolotarev@gmail.com" ]
dmitry.zolotarev@gmail.com
c8c4d5e9021a5eb79f1d3c4b51331ed01df9d76a
746fe83dcba9cdcdaa25105dd3efbc20534a9d23
/src/main/java/com/k2/common/reflector/GeneralScopes.java
6ffdf7d296df58b6a004e5e8cab9adce68171a60
[]
no_license
simonemmott/K2Common
152a245eb761b96fca601f903d1aefe7c2c97976
dc13d29abfc5ec230eed7d4ee00de97261dcdb37
refs/heads/master
2020-03-28T20:03:25.977953
2018-10-25T19:42:09
2018-10-25T19:42:09
149,033,876
0
0
null
null
null
null
UTF-8
Java
false
false
235
java
package com.k2.common.reflector; public enum GeneralScopes implements ReflectionScope { GENERAL, CLASS, ENTITY, TRANSIENT, TYPE, FIELD, CRITERIA, TYPEVALUE; @Override public String getScope() { return this.name(); } }
[ "simon.emmott@yahoo.co.uk" ]
simon.emmott@yahoo.co.uk
7191ad4a3a1bd1b450b3490b40b0b48b505798f1
2e76cc8bb19613d86164e6640d438e3209b6dd79
/app/src/main/java/com/example/buran/archery_competition/MainActivity.java
85d76f8f5f89c32d1f05a6e7beda19696eb1d2d3
[]
no_license
aolikas/Archery-Competition
f514f7790018f50fd9f327a67765a59852cc3db9
ad8878795cc2604b0a9b68c759e86d8ae412a30f
refs/heads/master
2020-04-17T07:39:32.506815
2019-01-31T17:23:55
2019-01-31T17:23:55
166,378,906
1
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package com.example.buran.archery_competition; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.buran.archery_competition.BowClass.BowClassActivity; import com.example.buran.archery_competition.Participants.ParticipantsActivity; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button btnParticipants; private Button btnBowClass; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnParticipants = (Button) findViewById(R.id.btn_participant); btnParticipants.setOnClickListener(this); btnBowClass = (Button) findViewById(R.id.btn_bow_class); btnBowClass.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_participant: Intent intentParticipants = new Intent(MainActivity.this, ParticipantsActivity.class); startActivity(intentParticipants); break; case R.id.btn_bow_class: Intent intentBowClass = new Intent(MainActivity.this, BowClassActivity.class); startActivity(intentBowClass); } } }
[ "olkaspark@gmail.com" ]
olkaspark@gmail.com
7bc7d72ac7f0abe1d03f639c82a4bbfe7d7e5246
6f9fb551fb146a9e22711817ae3c54926a5ff0c8
/src/main/java/org/attribyte/api/NOOPLogger.java
52294144862c7f65a4b8995ed72d7e57c9ee063d
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
attribyte/shared-base
9419762f062ce0c53572ede4d8a3007fcc9bed4d
63b57838dba637b4f8665ff68d9ef65ca9947290
refs/heads/master
2023-06-22T12:16:40.128501
2022-01-18T13:41:19
2022-01-18T13:41:19
26,281,957
0
0
null
2023-06-14T22:28:46
2014-11-06T17:42:47
Java
UTF-8
Java
false
false
1,072
java
/* * Copyright 2010 Attribyte, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. * */ package org.attribyte.api; /** * A logger that ignores all messages. */ public class NOOPLogger implements Logger { @Override public void debug(String msg) { } @Override public void info(String msg) { } @Override public void warn(String msg) { } @Override public void warn(String msg, Throwable t) { } @Override public void error(String msg) { } @Override public void error(String msg, Throwable t) { } }
[ "matt@attribyte.com" ]
matt@attribyte.com
7e59ef0de5463b9baccb4ed9cd19fc7cccda4bb6
f6cfaa69a202f0253a5610b6aec17c53b998b07c
/app/src/main/java/com/demo/zk/mynews/bean/NewsChannel.java
79f824ac7e3b43608748334de4b8b59416f0eb87
[]
no_license
zkzqzzz/MyNews
a42b57a0fbb7db856a5cfbca3e3a21d1a38be38b
40664b9f9e52d79bf49079b7b38afc74d1e8fb29
refs/heads/master
2020-02-26T16:10:59.717828
2016-09-21T06:31:28
2016-09-21T06:31:28
68,779,501
0
0
null
null
null
null
UTF-8
Java
false
false
1,501
java
package com.demo.zk.mynews.bean; /** * ClassName: NewsChannel<p> * Fuction: 频道管理的封装<p> * UpdateUser: <p> * UpdateDate: <p> */ public class NewsChannel { /** * 频道名称 */ private String mName; /** * 频道是否固定频道 */ private boolean mFixed; /** * 新闻的id */ private String mId; /** * 新闻类型 */ private String mType; /** * 位置 */ private int mIndex; public NewsChannel(String name) { mName = name; } public NewsChannel(String name, boolean fixed) { mName = name; mFixed = fixed; } public NewsChannel(String name, boolean fixed, String id, String type, int index) { mName = name; mFixed = fixed; mId = id; mType = type; mIndex = index; } public String getId() { return mId; } public void setId(String id) { mId = id; } public String getType() { return mType; } public void setType(String type) { mType = type; } public int getIndex() { return mIndex; } public void setIndex(int index) { mIndex = index; } public boolean isFixed() { return mFixed; } public void setFixed(boolean fixed) { mFixed = fixed; } public String getName() { return mName; } public void setName(String name) { mName = name; } }
[ "1256019611@qq.com" ]
1256019611@qq.com
9342ce1a789188f522128638502b203a8ad13ec0
1186c55198844e28204b6044ec358cf571d8ec94
/plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/UUIDMapper.java
790ee568c74bd1e80af91c1251dddff566fe6e25
[ "Apache-2.0" ]
permissive
oscarruesga/cassandra-lucene-index
9d71afa7c64124ef2b9265f334b476bcdac69e98
ffd1394b55a2eb1e9d602529199b45c12797e781
refs/heads/branch-2.1.11
2021-01-22T14:19:45.718443
2015-10-30T12:25:48
2015-10-30T12:25:48
45,298,471
1
0
null
2015-10-31T11:02:23
2015-10-31T11:02:23
null
UTF-8
Java
false
false
3,757
java
/* * Licensed to STRATIO (C) under one or more contributor license agreements. * See the NOTICE file distributed with this work for additional information * regarding copyright ownership. The STRATIO (C) licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.stratio.cassandra.lucene.schema.mapping; import com.google.common.primitives.Longs; import com.stratio.cassandra.lucene.IndexException; import com.stratio.cassandra.lucene.util.ByteBufferUtils; import org.apache.cassandra.db.marshal.AsciiType; import org.apache.cassandra.db.marshal.TimeUUIDType; import org.apache.cassandra.db.marshal.UTF8Type; import org.apache.cassandra.db.marshal.UUIDType; import java.nio.ByteBuffer; import java.util.UUID; /** * A {@link Mapper} to map a UUID field. * * @author Andres de la Pena {@literal <adelapena@stratio.com>} */ public class UUIDMapper extends KeywordMapper { /** * Builds a new {@link UUIDMapper}. * * @param field The name of the field. * @param column The name of the column to be mapped. * @param indexed If the field supports searching. * @param sorted If the field supports sorting. */ public UUIDMapper(String field, String column, Boolean indexed, Boolean sorted) { super(field, column, indexed, sorted, AsciiType.instance, UTF8Type.instance, UUIDType.instance, TimeUUIDType.instance); } /** {@inheritDoc} */ @Override protected String doBase(String name, Object value) { if (value instanceof UUID) { UUID uuid = (UUID) value; return serialize(uuid); } else if (value instanceof String) { try { String string = (String) value; UUID uuid = UUID.fromString(string); return serialize(uuid); } catch (IllegalArgumentException e) { throw new IndexException(e, "Field '%s' with value '%s' can not be parsed as UUID", name, value); } } throw new IndexException("Field '%s' requires an UUID, but found '%s'", name, value); } /** * Returns the {@link String} representation of the specified {@link UUID}. The returned value has the same * collation as {@link UUIDType}. * * @param uuid The {@link UUID} to be serialized. * @return The {@link String} representation of the specified {@link UUID}. */ public static String serialize(UUID uuid) { StringBuilder sb = new StringBuilder(); // Get UUID type version ByteBuffer bb = UUIDType.instance.decompose(uuid); int version = (bb.get(bb.position() + 6) >> 4) & 0x0f; // Add version at the beginning sb.append(ByteBufferUtils.toHex((byte) version)); // If it's a time based UUID, add the UNIX timestamp if (version == 1) { long timestamp = uuid.timestamp(); String timestampHex = ByteBufferUtils.toHex(Longs.toByteArray(timestamp)); sb.append(timestampHex); } // Add the UUID itself sb.append(ByteBufferUtils.toHex(bb)); return sb.toString(); } }
[ "a.penya.garcia@gmail.com" ]
a.penya.garcia@gmail.com
c0b361941a8b102bcc305ce61d63642b4968ef49
92b1d116ed2532be2e46bfdab8432db396a17bab
/app/src/main/java/com/techhaven/schooltweets/activity/SigninActivity.java
2824a50098b84ce34af3944536743b2705306ee7
[]
no_license
yomiolatunji/SchoolTweets
53594bee5493349949680330463de1606f2e9be8
f5df3531c6c48bec7e00ad2867f85771ecfbfb9f
refs/heads/master
2021-05-31T12:37:35.590896
2016-04-07T15:26:17
2016-04-07T15:26:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.techhaven.schooltweets.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.techhaven.schooltweets.R; public class SigninActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signin); } }
[ "dovercomer1@gmail.com" ]
dovercomer1@gmail.com
1c75aaaed97ff1fd1dcf6ecd2ff8c2de94b2ef08
3514c6b26cd973a25596d5f2c4e6e58c115c1824
/SimpleMovieMaker/src/guzdial/SearchMethods.java
6cc3f1c364310d11da88bdb542ebf97a8dfcc93d
[]
no_license
JustinTom/VideoManipulation
f7af3a5655634c0e276324a2b23edf400c43a391
9506d7e623f9e3e98fb334c59fd4a071ef3de675
refs/heads/master
2016-08-12T19:42:07.091454
2015-10-24T01:49:12
2015-10-24T01:49:12
44,833,453
1
0
null
null
null
null
UTF-8
Java
false
false
1,421
java
package guzdial; /** * Demonstrate search algorithms **/ public class SearchMethods { /** * Implement a linear search through the list **/ static public String lfind(String target, String[] list){ for (int index=0; index < list.length; index++) { if (target.compareTo(list[index]) == 0) {return("Found it!"); } } return("Not found"); } /** * Implement a simple binary search through the list **/ static public String find(String target, String[] list){ int start = 0; int end = list.length - 1; int checkpoint = 0; while (start <= end) { //While there are more to search // find the middle checkpoint = (int)((start+end)/2.0); System.out.println("Checking at: "+checkpoint+" start="+start+" end="+end); if ((checkpoint < 0) || (checkpoint > list.length)){ break;} if (target.compareTo(list[checkpoint]) == 0) { return "Found it!";} if (target.compareTo(list[checkpoint]) > 0) { start=checkpoint + 1;} if (target.compareTo(list[checkpoint]) < 0) { end=checkpoint - 1;} } return "Not found"; } static public void main(String[] args){ String[] searchMe = {"apple","bear","cat","dog","elephant"}; System.out.println(find("apple",searchMe)); System.out.println(find("cat",searchMe)); System.out.println(find("giraffe",searchMe)); } }
[ "cyclostofu@hotmail.com" ]
cyclostofu@hotmail.com
1fd4a7cff453da713074196e753ec9c2cd02b94c
bf76610da52d350668df2b7df069a38e13e2772f
/src/org/mogware/msgs/transports/tcp/Ctcp.java
05db3a197eed24372dab341c5edcbb036309a6ba
[]
no_license
mogware/msgs
e08be37a0564312dbda53338dbc4ad3d24c8dc04
da29cb972efe59d8873ce02e7a50dbb7a74d4a50
refs/heads/master
2016-09-06T09:59:36.408798
2015-09-06T16:28:38
2015-09-06T16:28:38
35,335,084
0
0
null
null
null
null
UTF-8
Java
false
false
11,995
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) // Source File Name: Ctcp.java package org.mogware.msgs.transports.tcp; import java.net.*; import org.mogware.msgs.aio.*; import org.mogware.msgs.core.*; import org.mogware.msgs.transports.Transport; import org.mogware.msgs.transports.utils.*; import org.mogware.msgs.utils.ErrnoException; // Referenced classes of package org.mogware.msgs.transports.tcp: // Stcp, Tcp public class Ctcp { public Ctcp(final Endpoint ep) throws ErrnoException { Ctcp ctcp = this; epbase = new EndpointBase(ctcp) { protected void onStop() throws ErrnoException { ctcp.fsm.stop(); } final Ctcp val$ctcp; final Ctcp this$0; { this.this$0 = Ctcp.this; ctcp = ctcp1; super(ep); } } ; String addr = epbase.addr(); int colon = addr.lastIndexOf(':'); if(colon < 0) throw new ErrnoException(0x9523dd7); String addrStr = addr.substring(0, colon); String portStr = addr.substring(colon + 1); Port.resolve(portStr); int semicolon = addrStr.indexOf(';'); String hostname = semicolon >= 0 ? addrStr.substring(semicolon + 1) : addrStr; int ipv4only = ((Integer)epbase.opt(1, 14)).intValue(); if(!Dns.checkHostname(hostname) && Literal.resolve(hostname, ipv4only > 0) == null) throw new ErrnoException(0x9523dd7); if(semicolon > 0) { addrStr = addrStr.substring(0, semicolon); if(Iface.resolve(addrStr, ipv4only > 0) == null) throw new ErrnoException(0x9523dd7); } fsm = new Fsm(ctcp) { protected void onProgress(int src, int type, Object srcObj) throws ErrnoException { switch(ctcp.state) { case 1: // '\001' switch(src) { case -2: switch(type) { case -2: ctcp.startConnecting(); return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); case 2: // '\002' switch(src) { case 1: // '\001' switch(type) { case 1: // '\001' ctcp.stcp.start(ctcp.usock); ctcp.state = 3; ctcp.epbase.statIncrement(202, -1); ctcp.epbase.statIncrement(101, 1); ctcp.epbase.clearError(); return; case 5: // '\005' ctcp.epbase.setError(ctcp.usock.errno()); ctcp.usock.stop(); ctcp.state = 5; ctcp.epbase.statIncrement(202, -1); ctcp.epbase.statIncrement(105, 1); return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); case 3: // '\003' switch(src) { case 2: // '\002' switch(type) { case 1: // '\001' ctcp.stcp.stop(); ctcp.state = 4; ctcp.epbase.statIncrement(104, 1); return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); case 4: // '\004' switch(src) { case 2: // '\002' switch(type) { case 8: // '\b' return; case 2: // '\002' ctcp.usock.stop(); ctcp.state = 5; return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); case 5: // '\005' switch(src) { case 1: // '\001' switch(type) { case 8: // '\b' return; case 7: // '\007' ctcp.retry.start(); ctcp.state = 6; return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); case 6: // '\006' switch(src) { case 2: // '\002' switch(type) { case 1: // '\001' ctcp.retry.stop(); ctcp.state = 7; return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); case 7: // '\007' switch(src) { case 2: // '\002' switch(type) { case 2: // '\002' ctcp.startConnecting(); return; } throw new FsmBadActionException(ctcp.state, src, type); } throw new FsmBadSourceException(ctcp.state, src, type); } throw new FsmBadStateException(ctcp.state, src, type); } protected void onShutdown(int src, int type, Object srcObj) throws ErrnoException { if(src == -2 && type == -3) { if(!ctcp.stcp.isIdle()) { ctcp.epbase.statIncrement(103, 1); ctcp.stcp.stop(); } ctcp.state = 8; } if(ctcp.state == 8) { if(!ctcp.stcp.isIdle()) return; ctcp.retry.stop(); ctcp.usock.stop(); ctcp.state = 9; } if(ctcp.state == 9) { if(!ctcp.retry.isIdle() || !ctcp.usock.isIdle()) { return; } else { ctcp.state = 1; ctcp.fsm.stoppedNoEvent(); ctcp.epbase.stopped(); return; } } else { throw new FsmBadStateException(ctcp.state, src, type); } } final Ctcp val$ctcp; final Ctcp this$0; { this.this$0 = Ctcp.this; ctcp = ctcp1; super(ctx); } } ; state = 1; int reconnect_ivl = ((Integer)epbase.opt(1, 6)).intValue(); int reconnect_ivl_max = ((Integer)epbase.opt(1, 7)).intValue(); if(reconnect_ivl_max == 0) reconnect_ivl_max = reconnect_ivl; retry = new Backoff(2, reconnect_ivl, reconnect_ivl_max, fsm); usock = new SockClient(1, fsm); stcp = new Stcp(2, epbase, fsm); fsm.start(); } public static EndpointBase create(Endpoint ep) throws ErrnoException { Ctcp ctcp = new Ctcp(ep); return ctcp.epbase; } private void startConnecting() throws ErrnoException { String addr = epbase.addr(); int colon = addr.lastIndexOf(':'); if(colon < 0) throw new ErrnoException(0x9523dd7); String addrStr = addr.substring(0, colon); String portStr = addr.substring(colon + 1); int port = Port.resolve(portStr); int ipv4only = ((Integer)epbase.opt(1, 14)).intValue(); int semicolon = addrStr.indexOf(';'); InetAddress local; if(semicolon < 0) local = Iface.resolve("*", ipv4only > 0); else local = Iface.resolve(addrStr.substring(0, semicolon), ipv4only > 0); if(local == null) { retry.start(); state = 6; return; } InetAddress remote; if(semicolon < 0) remote = Dns.resolve(addrStr, ipv4only > 0); else remote = Dns.resolve(addrStr.substring(semicolon + 1), ipv4only > 0); if(remote == null) { retry.start(); state = 6; return; } try { usock.start(); } catch(ErrnoException ex) { retry.start(); state = 6; return; } usock.opt(StandardSocketOptions.SO_SNDBUF, Integer.valueOf(((Integer)epbase.opt(1, 2)).intValue())); usock.opt(StandardSocketOptions.SO_RCVBUF, Integer.valueOf(((Integer)epbase.opt(1, 3)).intValue())); usock.opt(StandardSocketOptions.TCP_NODELAY, Boolean.valueOf(((Integer)epbase.opt(-3, 1)).intValue() == 0)); try { usock.bind(new InetSocketAddress(local, 0)); } catch(ErrnoException ex) { retry.start(); state = 6; return; } usock.connect(new InetSocketAddress(remote, port)); state = 2; epbase.statIncrement(202, 1); } private static final int STATE_IDLE = 1; private static final int STATE_CONNECTING = 2; private static final int STATE_ACTIVE = 3; private static final int STATE_STOPPING_STCP = 4; private static final int STATE_STOPPING_USOCK = 5; private static final int STATE_WAITING = 6; private static final int STATE_STOPPING_BACKOFF = 7; private static final int STATE_STOPPING_STCP_FINAL = 8; private static final int STATE_STOPPING = 9; private static final int SRC_USOCK = 1; private static final int SRC_RECONNECT_TIMER = 2; private static final int SRC_STCP = 2; private final Fsm fsm; private final EndpointBase epbase; private final SockClient usock; private final Backoff retry; private final Stcp stcp; private int state; }
[ "mjensen@sirsi.dk" ]
mjensen@sirsi.dk
4957c39accfb0c2880404c58a95fd83adeeaed14
a834e2b6524799c01fa5f0b0591011a6303db479
/src/test/java/com/kattysoft/core/dao/RegistrationListDaoPgIT.java
c3f15460c280bd86b3d35b018be45717a26ab2e1
[]
no_license
AnatolyR/sokolrm
1ac947eec70b813d46b910d4db0686f689c71126
27361f9afe222eafe7e153efb690d9095f53212a
refs/heads/master
2022-02-15T19:16:45.932108
2019-05-27T10:00:36
2019-05-27T10:00:36
54,663,494
0
0
null
null
null
null
UTF-8
Java
false
false
3,519
java
package com.kattysoft.core.dao; import com.kattysoft.core.model.Document; import com.kattysoft.core.specification.*; import org.apache.commons.dbutils.DbUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import javax.sql.DataSource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; /** * Author: Anatolii Rakovskii (rtolik@yandex.ru) * Date: 22.07.2016 */ @TestExecutionListeners({SqlScriptsTestExecutionListener.class}) @ContextConfiguration(locations = { "classpath:applicationContextForTests.xml" }) public class RegistrationListDaoPgIT extends AbstractTestNGSpringContextTests { @Autowired private ApplicationContext applicationContext; private RegistrationListDao registrationListDao; @Autowired @Qualifier("pgDb") private DataSource dataSource; @BeforeClass public void setup() { registrationListDao = (RegistrationListDao) applicationContext.getAutowireCapableBeanFactory().createBean(RegistrationListDaoPg.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true); } @Test @Sql("file:db/registrationlists.sql") @Sql("file:db/sampleData/registrationlistsData.sql") public void updateCounter() { assertThat(registrationListDao.produceNextNumber(UUID.fromString("d48c9468-e328-4108-a08a-535931a25040")), equalTo(3)); assertThat(registrationListDao.produceNextNumber(UUID.fromString("d48c9468-e328-4108-a08a-535931a25040")), equalTo(4)); assertThat(registrationListDao.produceNextNumber(UUID.fromString("d48c9468-e328-4108-a08a-535931a25040")), equalTo(5)); // Runnable runnable = new Runnable() { // @Override // public void run() { // RegistrationListDaoPg registrationListDao = new RegistrationListDaoPg(); // registrationListDao.setDataSource(dataSource); // System.out.println(Thread.currentThread().getId() + " >>>> " + registrationListDao.produceNextNumber(UUID.fromString("d48c9468-e328-4108-a08a-535931a25040"))); // System.out.println(Thread.currentThread().getId() + " >>>> " + registrationListDao.produceNextNumber(UUID.fromString("d48c9468-e328-4108-a08a-535931a25040"))); // System.out.println(Thread.currentThread().getId() + " >>>> " + registrationListDao.produceNextNumber(UUID.fromString("d48c9468-e328-4108-a08a-535931a25040"))); // } // }; // // for (int i = 0; i < 5; i++) { // new Thread(runnable).start(); // } } public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } }
[ "rtolik@yandex.ru" ]
rtolik@yandex.ru
b488b1fb0ed066627c5ca20ac567016ba28ce598
dc723ba04d723b077a723bebb02813b8009f6e9e
/system/services/frontend/website/fake-search-service/src/main/java/com/ssrn/frontend/website/fake_search_service/ServiceConfiguration.java
e69b0aba1cd98256b2fff0f8b66c9cecf626ce01
[]
no_license
ngelsevier/preprint
e33247cb589d3de505f219d0242a3738d5455648
0a6a57bc962c29e277f105070977867280381d85
refs/heads/master
2020-03-20T23:42:53.825949
2018-06-19T08:06:36
2018-06-19T08:06:36
137,859,617
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package com.ssrn.frontend.website.fake_search_service; import ch.qos.logback.classic.Level; import io.dropwizard.logging.DefaultLoggingFactory; public class ServiceConfiguration extends io.dropwizard.Configuration { public ServiceConfiguration() { DefaultLoggingFactory loggingFactory = new DefaultLoggingFactory(); loggingFactory.setLevel(Level.INFO.toString()); setLoggingFactory(loggingFactory); } }
[ "r.ng@elsevier.com" ]
r.ng@elsevier.com
7412b8e09c76527111db347799477ba21d887663
8c81eeaa4bde7c4f9e402c1647940de5deb146fc
/src/firstReverseTry.java
46a73cd847f6bd7d0b21ba6cf6c2fb8f377f19c1
[]
no_license
Luciwar/Example
f4b51b53eef6189ba18ea7714f5ee38be4287864
15b5d4d48e930d75597555b1c9c128b8501812f4
refs/heads/master
2020-06-04T23:41:07.098593
2018-10-11T15:31:24
2018-10-11T15:31:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
/* Reversing an array can be a tough task, especially for a novice programmer. Mary just started coding, so she would like to start with something basic at first. Instead of reversing the array entirely, she wants to swap just its first and last elements. Given an array arr, swap its first and last elements and return the resulting array. Example For arr = [1, 2, 3, 4, 5], the output should be firstReverseTry(arr) = [5, 2, 3, 4, 1]. */ int[] firstReverseTry(int[] arr) { if(arr.length==1||arr.length==0) return arr; int temp=arr[0]; arr[0]=arr[arr.length-1]; arr[arr.length-1]=temp; return arr; }
[ "linhhoang13k@gmail.com" ]
linhhoang13k@gmail.com
17f17d9949f5cad560b94bb810cecfee8123c303
d60bd7144cb4428a6f7039387c3aaf7b295ecc77
/ScootAppSource/com/google/android/gms/common/n.java
1dfc25393c2cc30a9c734857985bdaadc8f70839
[]
no_license
vaquarkhan/Scoot-mobile-app
4f58f628e7e2de0480f7c41998cdc38100dfef12
befcfb58c1dccb047548f544dea2b2ee187da728
refs/heads/master
2020-06-10T19:14:25.985858
2016-12-08T04:39:10
2016-12-08T04:39:10
75,902,491
1
0
null
null
null
null
UTF-8
Java
false
false
812
java
package com.google.android.gms.common; import java.lang.ref.WeakReference; abstract class n extends l { private static final WeakReference<byte[]> b = new WeakReference(null); private WeakReference<byte[]> a = b; n(byte[] paramArrayOfByte) { super(paramArrayOfByte); } byte[] c() { try { byte[] arrayOfByte2 = (byte[])this.a.get(); byte[] arrayOfByte1 = arrayOfByte2; if (arrayOfByte2 == null) { arrayOfByte1 = d(); this.a = new WeakReference(arrayOfByte1); } return arrayOfByte1; } finally {} } protected abstract byte[] d(); } /* Location: D:\Android\dex2jar-2.0\classes-dex2jar.jar!\com\google\android\gms\common\n.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "vaquar.khan@gmail.com" ]
vaquar.khan@gmail.com
c19891cc591b8d71bbec3f4d5fdd0bd3bbe335fe
e9d9b668e83560be78b1816f1bbb89d0757c22ce
/ForestryManagement_Collections/src/com/fms/exception/NullObjectException.java
155a3bb3abc347e8354186329c56f46d200bf881
[]
no_license
Vishruth-Subramanyam/ForestryManagement_Collections
9eb066100baaa96fd54906a630f538385c9caa53
8059258ece7b3c5086867cdf975e0a4b9dd897a2
refs/heads/master
2022-02-19T16:43:46.046363
2019-08-26T09:16:00
2019-08-26T09:16:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
package com.fms.exception; @SuppressWarnings("serial") public class NullObjectException extends RuntimeException{ public NullObjectException(String message) { System.out.println("something went Wrong; object returns NULL @ "+ message); } }
[ "dell@dell-Inspiron-3558" ]
dell@dell-Inspiron-3558
b5d2b67413c520a77b4a87b24f7726cf00abe4f2
d120fcae36f9a15155b1c238703d1b410f67eb3b
/cinema-stage/src/main/java/com/woniu/service/CinemaService.java
512db8116e693bb7baad060c34828dfa6608adc6
[]
no_license
qian-qian/tickets-online
2baaf65faedc6a33c615a36537b7acffc710bdc2
883f7ad3a8803e07ac55eb80ef4ea834d53cee30
refs/heads/master
2022-06-27T03:48:20.933944
2019-09-17T12:55:56
2019-09-17T12:55:56
207,703,167
2
1
null
2022-06-17T02:29:05
2019-09-11T02:14:13
JavaScript
UTF-8
Java
false
false
591
java
package com.woniu.service; import com.woniu.entity.Cinema; import java.util.List; public interface CinemaService { //查询出所有的影院 public List<Cinema> selectAll(Integer pageIndex, Integer num); //根据影院id查询影院的相应信息 public Cinema selectById(Integer cid); //查询电影表中的总数 public Integer count(); //新增一家电影院 public Integer insert(Cinema cinema); //根据id删除一家影院 public Integer delete(Integer cid); //根据id更新一家影院 public Integer update(Cinema cinema); }
[ "971872973@qq.com" ]
971872973@qq.com
91777fc77fd5a027d689d3bb532406fe4ee04c44
e30a873dbb2e83d199228d837f9a4d141dfb63ab
/EasyMockExamples/src/main/java/com/easyMock/ICoffeeMachine.java
9b2888aeb9d96b5015df267a2f019d2ef0efd0c7
[]
no_license
kkasiviswanath628/MockitoandEasyMock
27fc77bbc7761d79af0c5c602e26fe466a13269e
9551cc25da0df5e377b86f9475b410be16b8e4d6
refs/heads/master
2020-04-14T12:21:46.335921
2019-01-02T12:26:04
2019-01-02T12:26:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package com.easyMock; public interface ICoffeeMachine { public boolean makeCoffee(Portion portion) throws NotEnoughException; public IContainer getCoffeeContainer(); public IContainer getWaterContainer(); }
[ "kasi.viswanath@karvy.com" ]
kasi.viswanath@karvy.com
35d01158353058e7ba95d4ac00583be3c247f016
49828af0b65390366ab5987d0eced439fb6eb4dd
/lbm/src/main/java/com/lazooz/lbm/Analytics.java
7eaa814be9426c7d9df24d9dfed6bc884875d69f
[]
no_license
zero-code/lbm-client
d6f61ba6636af7ebdee89a5b52d538354db68483
db250c0b1d7d0760dbcf15704b56bcb325a073d6
refs/heads/master
2020-03-24T13:27:30.479946
2015-05-31T22:50:43
2015-05-31T22:50:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,264
java
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.lazooz.lbm; import com.google.android.gms.analytics.Logger; import com.google.android.gms.analytics.Tracker; import com.google.android.gms.analytics.GoogleAnalytics; import android.support.multidex.MultiDexApplication; import java.util.HashMap; public class Analytics extends MultiDexApplication { // The following line should be changed to include the correct property id. private static final String PROPERTY_ID = "UA-55856450-1"; public static int GENERAL_TRACKER = 0; public enum TrackerName { APP_TRACKER, // Tracker used only in this app. GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking. ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a company. } HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>(); public Analytics() { super(); } synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.app_tracker) : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker( R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker); // t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); } }
[ "orenyodfat" ]
orenyodfat
841b1199a22065578ed9e60c7377c169ee719b4d
b56dbfdb32aeeeb9965f9bdea45f2022453a26e3
/app/src/androidTest/java/com/codelab/helmi/mytestingapp/ExampleInstrumentedTest.java
1d294b858b105fb52b7e33db7198120df2af7b95
[]
no_license
zhikariz/MyTestingApp
b03981c25d390fd9f79704bd047ae146e97b67f3
08fa3da2ce87e36b6eb433c075b7597557143d6c
refs/heads/master
2020-03-21T06:44:13.995996
2018-06-22T01:16:49
2018-06-22T01:16:49
138,238,707
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package com.codelab.helmi.mytestingapp; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.codelab.helmi.mytestingapp", appContext.getPackageName()); } }
[ "helmi.prasetyo12@gmail.com" ]
helmi.prasetyo12@gmail.com
b41b1f1dd8950f73d338f1195bfbbc1b7812af6f
6c17a35ba67d61f6d9aff1d6c3c6e957c9ab4cd4
/projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/matchers/TraceTreeMatchers.java
debdd7ab61f7cc56c9b3de1c68f6ce4091e2500a
[ "Apache-2.0" ]
permissive
batfish/batfish
5e8bef0c6977cd7062f2ad03611f496b38d019a1
bfd39eb34e3a7b677bb186b6fc647aac5cb7558f
refs/heads/master
2023-09-01T08:13:38.211980
2023-08-30T21:42:47
2023-08-30T21:42:47
27,507,850
981
249
Apache-2.0
2023-09-12T09:53:49
2014-12-03T21:10:18
Java
UTF-8
Java
false
false
5,083
java
package org.batfish.datamodel.matchers; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import java.util.Arrays; import java.util.List; import java.util.ListIterator; import org.batfish.datamodel.TraceElement; import org.batfish.datamodel.matchers.TraceTreeMatchersImpl.HasChildren; import org.batfish.datamodel.matchers.TraceTreeMatchersImpl.HasTraceElement; import org.batfish.datamodel.trace.TraceTree; import org.hamcrest.Matcher; import org.hamcrest.Matchers; public final class TraceTreeMatchers { private TraceTreeMatchers() {} /** A {@link TraceTree} matcher on {@link TraceTree#getTraceElement()}. */ public static Matcher<TraceTree> hasTraceElement(Matcher<? super TraceElement> subMatcher) { return new HasTraceElement(subMatcher); } /** A {@link TraceTree} matcher on {@link TraceTree#getTraceElement()}. */ public static Matcher<TraceTree> hasTraceElement(String text) { return new HasTraceElement(equalTo(TraceElement.of(text))); } /** A {@link TraceTree} matcher on {@link TraceTree#getTraceElement()}. */ public static Matcher<TraceTree> hasTraceElement(TraceElement traceElement) { return new HasTraceElement(equalTo(traceElement)); } /** * A {@link TraceTree} matcher combining {@link TraceTreeMatchers#hasTraceElement(String)} and * {@link TraceTreeMatchers#hasNoChildren()}. */ public static Matcher<TraceTree> isTraceTree(String text) { return allOf(hasTraceElement(text), hasNoChildren()); } /** * A {@link TraceTree} matcher combining {@link TraceTreeMatchers#hasTraceElement(TraceElement)} * and {@link TraceTreeMatchers#hasNoChildren()}. */ public static Matcher<TraceTree> isTraceTree(TraceElement traceElement) { return allOf(hasTraceElement(traceElement), hasNoChildren()); } /** * A {@link TraceTree} matcher combining {@link TraceTreeMatchers#hasTraceElement(TraceElement)}, * {@link TraceTreeMatchers#hasChildren}, and {@link Matchers#contains}. */ @SafeVarargs @SuppressWarnings({"varargs"}) public static Matcher<TraceTree> isTraceTree( TraceElement traceElement, Matcher<? super TraceTree>... childMatchers) { return allOf(hasTraceElement(traceElement), hasChildren(contains(childMatchers))); } /** * A {@link TraceTree} matcher combining {@link TraceTreeMatchers#hasTraceElement(String)}, {@link * TraceTreeMatchers#hasChildren}, and {@link Matchers#contains}. */ @SafeVarargs @SuppressWarnings({"varargs"}) public static Matcher<TraceTree> isTraceTree( String traceElement, Matcher<? super TraceTree>... childMatchers) { return allOf(hasTraceElement(traceElement), hasChildren(contains(childMatchers))); } /** * A {@link TraceTree} matcher combining {@link TraceTreeMatchers#hasTraceElement(Matcher)}, * {@link TraceTreeMatchers#hasChildren}, and {@link Matchers#contains}. */ @SafeVarargs @SuppressWarnings({"varargs"}) public static Matcher<TraceTree> isTraceTree( Matcher<? super TraceElement> traceElementMatcher, Matcher<? super TraceTree>... childMatchers) { return allOf(hasTraceElement(traceElementMatcher), hasChildren(contains(childMatchers))); } /** A {@link TraceTree} matcher on {@link TraceTree#getChildren()}. */ public static Matcher<TraceTree> hasChildren(Matcher<? super List<TraceTree>> subMatcher) { return new HasChildren(subMatcher); } /** A {@link TraceTree} matcher on {@link TraceTree#getChildren()}. */ @SafeVarargs @SuppressWarnings({"varargs"}) public static Matcher<TraceTree> hasChildren(Matcher<? super TraceTree>... subMatchers) { return new HasChildren(contains(subMatchers)); } /** A {@link TraceTree} matcher on {@link TraceTree#getChildren()}. */ public static Matcher<TraceTree> hasNoChildren() { return new HasChildren(empty()); } /** * A {@link TraceTree} matcher matching trees where: * <li>the root and all descendants each have at most one child, such that the tree has no * branching * <li>the tree is the same size as {@code traceElements} * <li>each node's {@link TraceElement}, starting at the root, matches the same-index element in * {@code traceElements} */ public static Matcher<TraceTree> isChainOfSingleChildren(TraceElement... traceElements) { if (traceElements.length == 0) { return hasNoChildren(); } // Iterate backwards through traceElements to start from the leaf child's trace element ListIterator<TraceElement> iterator = Arrays.asList(traceElements).listIterator(traceElements.length); // Matcher for last child's trace element Matcher<TraceTree> matcher = isTraceTree(iterator.previous()); // For each parent going up, apply the matcher to its child and assert on its trace element while (iterator.hasPrevious()) { matcher = isTraceTree(iterator.previous(), matcher); } // Finalized matcher should match on the root node return matcher; } }
[ "noreply@github.com" ]
batfish.noreply@github.com
506bee367509c51b84b414b1150c38d528c2ee46
bcd5d921e2c2cf042d822b0a5a896b3bcd624ba7
/pet-clinic-web/src/main/java/com/example/petclinicproject/PetClinicProjectApplication.java
5802d9ac3085900f6ae703a11351cc618e7dcd1c
[]
no_license
Fady-Ramsis/Pet-Clinic
5b0898da9bf1a336d1f0c67be11a2a262d5af114
01019308c0bce0ddaf4a0152a7fd9c389d96bc40
refs/heads/master
2023-04-07T20:01:06.876726
2021-04-12T18:30:10
2021-04-12T18:30:10
349,377,048
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.example.petclinicproject; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class PetClinicProjectApplication { public static void main(String[] args) { SpringApplication.run(PetClinicProjectApplication.class, args); } }
[ "fadyrmais0@gmail.com" ]
fadyrmais0@gmail.com
efea6870e449cc7e93d4fe67078568e71d1876a9
421f0a75a6b62c5af62f89595be61f406328113b
/generated_tests/model_seeding/92_jcvi-javacommon-org.jcvi.jillion.trace.sff.Sff454NameUtil-1.0-1/org/jcvi/jillion/trace/sff/Sff454NameUtil_ESTest.java
a10d97850a6e4edf1fc28968f9d7f1c90f9d0f32
[]
no_license
tigerqiu712/evosuite-model-seeding-empirical-evaluation
c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6
11a920b8213d9855082d3946233731c843baf7bc
refs/heads/master
2020-12-23T21:04:12.152289
2019-10-30T08:02:29
2019-10-30T08:02:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
/* * This file was automatically generated by EvoSuite * Fri Oct 25 11:36:11 GMT 2019 */ package org.jcvi.jillion.trace.sff; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class Sff454NameUtil_ESTest extends Sff454NameUtil_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pderakhshanfar@bsr01.win.tue.nl" ]
pderakhshanfar@bsr01.win.tue.nl
2a672949a2851d4bec7d6f660031bf3d93bb440d
608cf243607bfa7a2f4c91298463f2f199ae0ec1
/android/versioned-abis/expoview-abi40_0_0/src/main/java/abi40_0_0/expo/modules/location/exceptions/LocationUnavailableException.java
4b77f221558efeeef96603e3fc2ea4f7be4bdbd8
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
kodeco835/symmetrical-happiness
ca79bd6c7cdd3f7258dec06ac306aae89692f62a
4f91cb07abef56118c35f893d9f5cc637b9310ef
refs/heads/master
2023-04-30T04:02:09.478971
2021-03-23T03:19:05
2021-03-23T03:19:05
350,565,410
0
1
MIT
2023-04-12T19:49:48
2021-03-23T03:18:02
Objective-C
UTF-8
Java
false
false
495
java
package abi40_0_0.expo.modules.location.exceptions; import abi40_0_0.org.unimodules.core.interfaces.CodedThrowable; import abi40_0_0.org.unimodules.core.errors.CodedException; public class LocationUnavailableException extends CodedException implements CodedThrowable { public LocationUnavailableException() { super("Location provider is unavailable. Make sure that location services are enabled."); } @Override public String getCode() { return "E_LOCATION_UNAVAILABLE"; } }
[ "81201147+kodeco835@users.noreply.github.com" ]
81201147+kodeco835@users.noreply.github.com
9f3dcd09ec13114085079a75b54d63e8cb517a06
d2296af526d2ea3cff5da0c13ed5d1ee080f9175
/app/src/androidTest/java/com/vogue/socket/ExampleInstrumentedTest.java
cb980b53c7f842acd684eee5e49bd97efc2e1828
[]
no_license
HeroBarry/OkSocketDemo
cc4acc953ba642c34cc471fa55997d31ef0419a1
da402af154e77e61ad6786392f20f1e46e5e0b0d
refs/heads/master
2020-07-24T17:04:58.820033
2019-09-12T07:30:07
2019-09-12T07:30:07
207,990,923
1
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.vogue.socket; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.vogue.socket", appContext.getPackageName()); } }
[ "qiaozhi_china@163.com" ]
qiaozhi_china@163.com
a2e47e345a628826335a8dc271a4aaa141df7e7a
5d35c4dc18fc807ce02edc2e38c6cf08eff97071
/src/test/java/com/els/uitests/runner/model/WebElementModel.java
a8a103975c278d88b29a968b650c9664bc1806f9
[ "MIT" ]
permissive
magic-joon/bdd-selenium-uiframework
94795797f224919fff013dc39902ffebf9d88232
c72b005a97807ba8bd2e7da1eb39ea9f4d7f26fd
refs/heads/main
2023-03-17T13:40:43.439971
2021-03-28T06:43:30
2021-03-28T06:43:30
352,158,257
3
0
null
null
null
null
UTF-8
Java
false
false
751
java
package com.els.uitests.runner.model; public class WebElementModel { private String name; private String cssSelector; private String type; private String value; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCssSelector() { return cssSelector; } public void setCssSelector(String cssSelector) { this.cssSelector = cssSelector; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
[ "magic@manishs-MacBook-Pro.local" ]
magic@manishs-MacBook-Pro.local
24e053f10f1ecdea1e22e01d92813ccdb174e2a5
c9219258cbf477adadcc88fb235348e7088e4147
/SA_Alert/gen/com/anassaeed/sa_alert/BuildConfig.java
98159eccc91caf1684970ec7f67258f0a4982e04
[]
no_license
anassaeed72/Android
081535cd95f982bd8dd6930e4cd10e90d552a6e8
a09f779a16b23d43426e6a549588f07143af286a
refs/heads/master
2021-01-17T07:41:02.176642
2016-07-21T12:58:48
2016-07-21T12:58:48
31,976,980
0
0
null
null
null
null
UTF-8
Java
false
false
164
java
/** Automatically generated file. DO NOT MODIFY */ package com.anassaeed.sa_alert; public final class BuildConfig { public final static boolean DEBUG = true; }
[ "anassaeed@Anass-MacBook-Pro.local" ]
anassaeed@Anass-MacBook-Pro.local
13c326e187ecc918bc13de237499f626373b4aa8
4807c6e453fd2b19a9c02c2cbb96ec2eb301eab6
/src/by/belhard/j20/lessons/lesson12/projectExample/exceptions/NoSuchPupilException.java
ece4db3ceb32d9ebc5af80e6b4fcae338403d81f
[]
no_license
anikalaeu/BH-J20
ef2461cd856a3df306f114393e5435cba095c172
012370a85c3056570c8279f944626134264608bc
refs/heads/master
2021-03-20T22:15:09.423997
2020-03-13T15:34:11
2020-03-13T15:34:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package by.belhard.j20.lessons.lesson12.projectExample.exceptions; public class NoSuchPupilException extends RuntimeException { public NoSuchPupilException(String message) { super(message); } }
[ "avangard.npaper@gmail.com" ]
avangard.npaper@gmail.com
817687f5d2971ff74838ad09ecba64a66d4d904b
df79d26b07efa724a27eb1f8d57bb9f5b22bc999
/src/topK/KLargestNumbers.java
6adbb5612f7d1ade9522248b95a9e1fb821a5956
[]
no_license
binge-watcher/GrokkingPatternsForCodingQuestions
e9d65d133b2d293aafb2a435982cfce6d6038c59
d7ba435850c26bd94bf5ffa4735b1db1ff0a4808
refs/heads/master
2023-05-31T14:37:44.709249
2021-06-25T16:40:29
2021-06-25T16:40:29
361,088,123
0
0
null
null
null
null
UTF-8
Java
false
false
1,078
java
package topK; import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; public class KLargestNumbers { private static PriorityQueue<Integer> minheap = new PriorityQueue<>((n1,n2)-> n1-n2); public static List<Integer> findKLargestNumbers(int[] nums, int k) { for(int i=0;i<nums.length;i++){ add(nums[i],k); } return new ArrayList<>(minheap); } private static void add(int num, int k) { if(minheap.size()<k) minheap.add(num); else{ if(minheap.peek()<num){ minheap.poll(); minheap.add(num); } } } public static void main(String[] args) { //List<Integer> result = KLargestNumbers.findKLargestNumbers(new int[] { 3, 1, 5, 12, 2, 11 }, 3); //System.out.println("Here are the top K numbers: " + result); List<Integer> result = KLargestNumbers.findKLargestNumbers(new int[] { 5, 12, 11, -1, 12 }, 3); System.out.println("Here are the top K numbers: " + result); } }
[ "sam_saini12@yahoo.com" ]
sam_saini12@yahoo.com
340d58bc83a1d89f93c9a547f8191dd17ec6b8f9
0896db713002b410787a3705dff4201d662dbd8b
/sample-chat/src/com/injoit/examplechat/jmc/StanzaReader.java
cdc9d314c5faae9c29b3c932e9bd3ef9711e5312
[]
no_license
QuickBlox/quickblox-blackberry5-6-7-sdk
b435ec1c445a8580b2f2aa40d2e1f075f5bd041a
ec2d128f8add38fd72d4b0f84c00805615422fe6
refs/heads/master
2020-05-29T11:58:51.125858
2014-06-13T15:14:21
2014-06-13T15:14:21
10,073,101
0
2
null
null
null
null
UTF-8
Java
false
false
50,859
java
/** * * MicroJabber, jabber for light java devices. Copyright (C) 2004, Gregoire Athanase * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA. */ package com.injoit.examplechat.jmc; import net.rim.device.api.system.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import javax.microedition.lcdui.StringItem; import java.util.Vector; import com.injoit.examplechat.xmlstreamparser.*; import com.injoit.examplechat.util.Datas; import com.injoit.examplechat.util.Util; import com.injoit.examplechat.util.Base64; import com.injoit.examplechat.util.ExceptionListener; import com.injoit.examplechat.jabber.conversation.*; import com.injoit.examplechat.jabber.JabberListener; import com.injoit.examplechat.jabber.roster.Jid; import com.injoit.examplechat.jabber.roster.Jud; import com.injoit.examplechat.jabber.presence.*; import com.injoit.examplechat.jabber.subscription.*; import com.injoit.examplechat.jabber.conversation.Configuration.*; import com.injoit.examplechat.util.Contents; import com.twmacinta.util.MD5; import com.injoit.examplechat.utils.*; /** * Class for reading incoming stanzas */ public class StanzaReader { private ExceptionListener exceptionListener; private JabberListener jabberListener; // common attributes for stanzas protected String stanzaId; protected String stanzaType; protected String stanzaFrom; protected String stanzaTo; protected int internalstate; protected final int WAIT_LOGIN_PARAMS = 0; protected final int WAIT_LOGIN_RESULT = 1; protected final int WAIT_SESSION = 2; protected final int WAIT_ROSTER = 3; protected final int CONNECTION_COMPLETED = 4; protected final int REGISTRATION = 5; public StanzaReader(ExceptionListener _exceptionListener, JabberListener _jabberListener, int state) { exceptionListener = _exceptionListener; jabberListener = _jabberListener; internalstate = state;//registration(4) or login (0) } /** * Read the Node objet in argument *@param Node */ public void read(Node _node) { // common attributes for stanzas: stanzaId = _node.getValue("id"); stanzaType = _node.getValue("type"); stanzaFrom = _node.getValue("from"); stanzaTo = _node.getValue("to"); if (_node.name.equals("iq")) { readIq(_node); } else if (_node.name.equals("presence")) { readPresence(_node); } else if (_node.name.equals("message")) { readMessage(_node); } else if (_node.name.equals("stream:error")) { // unrecoverable error exceptionListener.reportException(new Exception("Stream Error " + _node.text)); } else if (_node.name.equals("stream:features")) { boolean found = false; if (_node.getChild("mechanisms") != null) { try { Vector mec = _node.getChild("mechanisms").getChildren(); for (int j=0; j<mec.size(); j++) { if (((Node)mec.elementAt(j)).text.equals("PLAIN")) { found = true; break; } } } catch(Exception e) { } } if (found && !Datas.hostname.equals("gmail.com")) { // PLAIN authorization System.out.println("Using plain authorization"); String resp = "\0" + Datas.jid.getUsername() + "\0" + Datas.getPassword(); Datas.writerThread.write("<auth id='sasl2' xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">" + MD5.toBase64(resp.getBytes()) + "</auth>"); internalstate = WAIT_LOGIN_RESULT; } else { //try with old auth Datas.writerThread.write( "<iq id='s1' type='get'><query xmlns='jabber:iq:auth'>" + "<username>" + Util.escapeCDATA(Datas.jid.getUsername()) + "</username>" + "</query></iq>"); internalstate = WAIT_LOGIN_PARAMS; } } else if (_node.name.equals("success")) { Datas.writerThread.write("<iq type=\"set\" id=\"bind3\">" + "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" + "<resource>" + Datas.jid.getResource() + "</resource></bind></iq>"); System.out.println("Binding resource"); internalstate = WAIT_SESSION; } else if (_node.name.equals("failure")) { //perhaps user not registered, try it! Datas.writerThread.write("<iq type='set' id='reg1'><query xmlns='jabber:iq:register'><username>" + Util.escapeCDATA(Datas.jid.getUsername()) + "</username><password>" + Datas.getPassword() + "</password><email>" + Datas.jid.getMail() + "</email></query></iq>"); internalstate = REGISTRATION; return; } } /** * Reads an iq stanza and answers to the server * Modified by Gabriele Bianchi 04/01/2006 * Modified by Vladimir Slatvinskiy * @param _node */ protected void readIq(Node _node) { //System.out.println("+readIQ+"); StringBuffer res = new StringBuffer(0); String pass = ""; if (stanzaType.equals("error")) { //error response if (stanzaId.equals("discoitem1")) { Node error = _node.getChild("error"); showAlert("Discovery error: " + ((Node)error.children.elementAt(0)).name); } else if (stanzaId.equals("delete1")) { Node error = _node.getChild("error"); showAlert("Deleting error: " + ((Node)error.children.elementAt(0)).name); } else if (internalstate == WAIT_LOGIN_RESULT || internalstate == WAIT_LOGIN_PARAMS) { //perhaps user not registered, try it! Datas.writerThread.write("<iq type='set' id='reg1'><query xmlns='jabber:iq:register'><username>" + Util.escapeCDATA(Datas.jid.getUsername()) + "</username><password>" + Datas.getPassword() + "</password><email>" + Datas.jid.getMail() + "</email></query></iq>"); internalstate = REGISTRATION; return; } else if (internalstate == REGISTRATION) { Node error = _node.getChild("error"); String exception = ""; if (error.children.size()>0) { Node errorType = (Node)error.children.elementAt(0); exception = errorType.name; } else exception = error.text; exceptionListener.reportRegistrationError(new Exception("Registration failed: "+exception), true); return; } else if (stanzaId.equals("jud_reg")) { //jud registration error System.out.print("Error in Jud registration"); exceptionListener.reportRegistrationError(new Exception("Jud Registration failed"), false); return; } else if (stanzaId.equals("regGateway")) { //Gateway registration error System.out.print("Error in Gateway registration"); exceptionListener.reportRegistrationError(new Exception("Gateway Registration failed"), false); return; } else if (stanzaId.equals("getNum")) { System.out.print("Error in getting phone number"); return; } else if (stanzaId.equals("vc1")) { System.out.print("Error in setting vcard"); return; } else if (stanzaId.equals("vc2")) { System.out.print("Error in getting vcard"); return; } else if (stanzaId.equals("bind3")) { System.out.print("Error in binding"); jabberListener.unauthorizedEvent("Cannot bind to the server"); return; } else if (stanzaId.equals("sess_1")) { System.out.print("Error in session"); jabberListener.unauthorizedEvent("Cannot open session with the server"); return; } else { Node error = _node.getChild("error"); String code = Contents.errorCode; if (error != null && error.getChildren() != null && !error.getChildren().isEmpty()) code = ((Node)error.getChildren().firstElement()).name + " (error code:" + error.getValue("code") + ")"; else if (error != null) code = error.text; jabberListener.notifyPresenceError(code); return; } } else if (stanzaType.equals("result")) { //ok response if (stanzaId.equals("config1")) { Node query = _node.getChild("query"); if (query != null) { Node x = query.getChild("x"); if(x != null) { Configuration conf = new Configuration(x); GroupChat chat = (GroupChat)Datas.multichat.get(stanzaFrom); if(chat!=null) { chat.setConfiguration(conf); this.jabberListener.RoomConfiguration(); } } } } else if (stanzaId.equals("config2")) { UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Status.show("Room configured succesfully!"); } }); } else if (stanzaId.equals("create1")) { String nick = ""; Vector up = SavedData.getUserInfo(); if (up != null) { try { nick = (String)up.elementAt(3); } catch(Exception ex) { //do nothing } } else { nick = Datas.jid.getUsername(); } ChatHelper.groupExistingChatJoin(Datas.jid.getUsername(), stanzaFrom.substring(0,stanzaFrom.indexOf("@")), stanzaFrom.substring(stanzaFrom.indexOf("@")+1)); } else if (stanzaId.equals("discoitem1")) { Node query = _node.getChild("query"); Vector items = query.getChildren(); if (query != null && items != null && items.size() > 0) { //get items for (int i = 0; i < items.size(); i++) { Node item = (Node)items.elementAt(i); if (item.name.equals("item")) { if (item.getValue("name") != null) Datas.server_services.addElement(new StringItem(item.getValue("name"), item.getValue("jid"))); else Datas.server_services.addElement(new StringItem("", item.getValue("jid"))); } } } }//rooms discovery else if (stanzaId.equals("discoRooms")) { Node query = _node.getChild("query"); Vector items = query.getChildren(); if (query != null && items != null && items.size() > 0) { //get items Datas.rooms = new Vector(2); for (int i = 0; i < items.size() /*&& i < 10*/; i++) { //display max 12 rooms Node item = (Node)items.elementAt(i); if (item.name.equals("item")) { Datas.rooms.addElement(item.getValue("jid")); } } } this.jabberListener.DiscoverRooms(); RequestRoomsMembers(); return; } else if (stanzaId.equals("members1")) { Vector members = new Vector(2); Node query = _node.getChild("query"); Vector items = query.getChildren(); if (query != null && items != null && items.size() > 0) { //get items for (int i = 0; i < items.size() /*&& i < 10*/; i++) { //display max 12 rooms Node item = (Node)items.elementAt(i); if (item.name.equals("item")) { members.addElement(item.getValue("jid")); } } } this.jabberListener.UpdateRoomMembersCount(stanzaFrom , members.size()); return; } else if (stanzaId.equals("reg1")) { //TODO:forse va cambiato qui res.append("<iq id='s1' type='get'><query xmlns='jabber:iq:auth' ><username>").append(Util.escapeCDATA(Datas.jid.getUsername())).append("</username></query></iq>"); internalstate = WAIT_LOGIN_PARAMS; } else if (stanzaId.equals("getNum")) { if (_node.getChild("query") != null) { Node n = (Node)_node.getChild("query").getChildren().firstElement(); if (n.getChildren().size() == 0) { return; } n = (Node)n.getChildren().firstElement(); String jid = n.getValue("user"); Jid j = (Jid)Datas.roster.get(Jid.getLittleJid(jid)); if (j == null) return; j.phone = n.text; } return; } else if (stanzaId.equals("setNum")) { System.out.println("Phone number saved"); return; } else if (stanzaId.equals("roster_2")) { System.out.println("Contact deleted"); this.jabberListener.updateScreen(); return; } else if (stanzaId.equals("roster_rename")) { System.out.println("Contact renamed"); this.jabberListener.updateScreen(); return; } else if (stanzaId.equals("vc1")) { //AVATAR set return; } else if (stanzaId.equals("vc2")) { System.out.print("getting vcard"); Node vcard =_node.getChild("vCard"); Jid user = (Jid)Datas.roster.get(Jid.getLittleJid(stanzaFrom)); if (user != null && vcard != null && vcard.getChild("PHOTO") != null) { Node binval = vcard.getChild("PHOTO").getChild("BINVAL"); try { if (binval != null && binval.text != null) { byte[] img = Base64.decode(binval.text); if (img != null) { user.setAvatar(img); } } } catch(Exception e) { System.out.println("AVATAR error:"+e.getMessage()); } } return; } else if (internalstate == WAIT_LOGIN_PARAMS) { try { if (_node.getChild("query").getChild("digest") == null) { pass = "<password>" + Datas.getPassword() + "</password>"; } else pass = "<digest>" + Datas.getDigestPassword() + "</digest>"; String resourceNode = ""; if (_node.getChild("query").getChild("resource") != null) { resourceNode = "<resource>" + Util.escapeCDATA(Datas.jid.getResource()) + "</resource>"; } // else forget about the resource res.append("<iq id='s2' type='set'><query xmlns='jabber:iq:auth'><username>"); res.append(Util.escapeCDATA(Datas.jid.getUsername())).append("</username>"); res.append(resourceNode).append(pass).append("</query></iq>"); internalstate = WAIT_LOGIN_RESULT; } catch(Exception ex) { } } else if (internalstate == WAIT_LOGIN_RESULT) { //old auth // we are connected res.append("<iq id='s3' type='get'><query xmlns='jabber:iq:roster'/></iq>"); internalstate = WAIT_ROSTER; res.append("<iq type='get' from='").append(Datas.jid.getFullJid()).append("' to='").append(Datas.hostname).append("' id='discoitem1'><query xmlns='http://jabber.org/protocol/disco#items'/></iq>"); } else if (internalstate == WAIT_SESSION) { res.append("<iq to=\"" + Datas.hostname + "\" type=\"set\" id=\"sess_1\">" + "<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"/></iq>"); internalstate = WAIT_ROSTER; } else if (stanzaId.equals("sess_1")) { res.append("<iq id='s3' type='get'><query xmlns='jabber:iq:roster'/></iq>"); internalstate = WAIT_ROSTER; res.append("<iq type='get' from='").append(Datas.jid.getFullJid()).append("' to='").append(Datas.hostname).append("' id='discoitem1'><query xmlns='http://jabber.org/protocol/disco#items'/></iq>"); } else if (stanzaId.equals("s3")) { internalstate = CONNECTION_COMPLETED; //send AVATAR byte[] img = Datas.jid.getAvatar(); Datas.jid.setPresence(Presence.getPresence("online")); // sends the presence if (img != null) { try { res.append(Presence.sendFirstVCard(img)); res.append(Presence.sendFirstPresence(img)); } catch (Exception e) { res.append("<presence/>"); } } else res.append("<presence/>"); //Read roster readRoster(_node); } else if (stanzaId.equals("jud_reg")) { //jud registration success System.out.println("Success: jud registration"); //alert to midlet jabberListener.notifyJudInfo(Contents.jud_success); return; } else if (stanzaId.equals("jud_search")) { //jud search success //alert to midlet String info = Jud.getJidfromResponse(_node); System.out.println("Success: jud search:" + info); jabberListener.notifyJudInfo(Contents.jud_search + info); return; } else if (stanzaId.equals("regGateway")) //gateway registration { System.out.println("Success: gateway registration"); } else if (stanzaId.equals("unregGateway")) //gateway registration { System.out.println("Success: gateway unregistered"); } else if (internalstate == CONNECTION_COMPLETED) { } } else if (stanzaType.equals("set")) { if (_node.getChild("query") != null && _node.getChild("query").getValue("xmlns") != null) { if (_node.getChild("query").getValue("xmlns").equals("jabber:iq:roster")) readRoster(_node); } } if (res.length() > 0) { Datas.writerThread.write(res.toString()); } } public void RequestRoomsMembers() { Runnable task = new Runnable() { public void run() { for(int i=0; i<Datas.rooms.size(); i++) { String roomJid = (String) Datas.rooms.elementAt(i); ChatHelper.RequestMembersCount(roomJid); } } }; new Thread(task).run(); }; /** * Reads a presence node and notify to midlet * Modified by Gabriele Bianchi 04/01/2006 * Modified by Vladimir Slatvinskiy * @param _node */ protected void readPresence(Node _node) { Node x; Node status; // default stanza type if not specified. if (stanzaType == null) { if(_node.getChild("show") == null) { stanzaType = "online"; } else if (_node.getChild("show").text.equals("xa")) { stanzaType = "away"; } else { stanzaType = _node.getChild("show").text; } //check if is a chat presence.. if((x = _node.getChild("x", "xmlns", "http://jabber.org/protocol/muc#user")) != null) { String role = ""; String affiliation = ""; stanzaType = "groupchat"; Vector children = x.getChildren(); Vector partners = new Vector(1); for (int i = 0; i < children.size(); i++) { Node child = (Node)children.elementAt(i); if (child.name.equals("item")) { try { affiliation = new String(child.getValue("affiliation")); role = new String(child.getValue("role")); } catch(Exception ex) { } if (child.getValue("jid") == null) { partners.addElement(stanzaFrom.substring(stanzaFrom.indexOf("/") + 1, stanzaFrom.length())); break; } String temp = new String(child.getValue("jid")); partners.addElement(temp); } } String littleFrom = stanzaFrom; String nick = Datas.jid.getLittleJid();//? if (stanzaFrom.indexOf("/") != -1) { littleFrom = stanzaFrom.substring(0, stanzaFrom.indexOf("/")); nick = stanzaFrom.substring(stanzaFrom.indexOf("/") + 1, stanzaFrom.length()); } if (Datas.multichat.get(littleFrom) != null) { //already exists GroupChat update = (GroupChat)Datas.multichat.remove(littleFrom); if (!update.jids.contains(partners.firstElement())) update.jids.addElement(partners.firstElement()); update.userRole = role; update.userAffiliation = affiliation; Datas.multichat.put(littleFrom, update); return; } //Conversation conversation = ChatHelper.createChat(partners, littleFrom, nick); Conversation conversation = ChatHelper.createChat(partners, littleFrom, nick, role, affiliation); conversation.isMulti = true; Datas.conversations.addElement(conversation); jabberListener.newConversationEvent(conversation); return; } } if (stanzaType.equals("error")) { // error! Node error = _node.getChild("error"); String code = Contents.errorCode; if (error != null && error.getChildren() != null && !error.getChildren().isEmpty()) { code = ((Node)error.getChildren().firstElement()).name +" (error code:"+ error.getValue("code")+")"; } else if (error != null) { if (error.getValue("code") != null && error.getValue("code").equals("407")) { code = "Register to the gateway first"; } else if (error.getValue("code") != null && error.getValue("code").startsWith("5")) { code = "Jabber Server Error: "+ error.text; } else code = error.text; } jabberListener.notifyPresenceError(code); return; } else if (stanzaType.equals("online") || stanzaType.equals("unavailable") || stanzaType.equals("away") || stanzaType.equals("dnd")) { if (stanzaFrom.indexOf("@") == -1) //not a user return; //check if is my presence if (stanzaFrom.equals(Datas.jid.getFullJid())) return; //skip //check if is group chat presence signal.. if ((x = _node.getChild("x", "xmlns","http://jabber.org/protocol/muc#user")) != null) { Vector conversations = Datas.conversations; // finds out the conversation int i=0; boolean found = false; Conversation conversation = null; while ((i<conversations.size()) && !found) { conversation = (Conversation) conversations.elementAt(i); found = conversation.match(_node); i++; } if (found) { Node item = x.getChild("item"); String usr; if (item == null || item.getValue("jid") == null && stanzaFrom.indexOf('/') != -1) { usr = stanzaFrom.substring(stanzaFrom.indexOf('/') + 1, stanzaFrom.length()); } else usr = item.getValue("jid"); conversation.appendToMe(new Message("", usr + " is " + stanzaType, Jid.getLittleJid(stanzaFrom))); if (stanzaType.equals("unavailable")) ChatHelper.deleteMember(stanzaFrom, usr); else ChatHelper.addMember(stanzaFrom, usr); if(stanzaType.equals("unavailable") && Datas.jid.getLittleJid().indexOf(usr)!=-1) { jabberListener.newMessageEvent(null); } else { jabberListener.newMessageEvent(conversation); } return; } }//avatar management else if ((x = _node.getChild("x", "xmlns","vcard-temp:x:update")) != null) { try { Node hash = x.getChild("photo"); //AVATAR if (hash != null && hash.text != null && !hash.text.equals("")) { Jid rost = (Jid)Datas.roster.get(Jid.getLittleJid(stanzaFrom)); if (rost != null) { if (rost.avatarHash == null) { //No avatar yet rost.avatarHash = hash.text; //ask for avatar Presence.getVCard(rost.getLittleJid()); } else if (!rost.avatarHash.equals(hash.text)) { Presence.getVCard(rost.getLittleJid());//update avatar } } } } catch (Exception e) { System.out.println(e.getMessage()); } } Jid rost = new Jid(stanzaFrom); if (_node.getChild("status") != null) { status = _node.getChild("status"); rost.setPresence(Presence.getPresence(stanzaType), status.text); } else { rost.setPresence(Presence.getPresence(stanzaType)); } jabberListener.notifyPresence(rost, stanzaType); } else if (stanzaType.equals("subscribe")) { // roster wants to subscribe for my presence events Jid rost = new Jid(stanzaFrom); if (stanzaFrom.indexOf("@") == -1 || Datas.isGateway(rost.getServername())) //service subscription { Subscribe.acceptSubscription(rost); return; } jabberListener.notifyPresence(rost, stanzaType); } else if (stanzaType.equals("subscribed")) { // roster granted my "subscribe wish" Jid rost = new Jid(stanzaFrom); jabberListener.notifyPresence(rost, stanzaType); } else if (stanzaType.equals("unsubscribe")) { // roster wants to unsubscribe for my presence events } else if (stanzaType.equals("unsubscribed")) { // roster unsubscribed me for his presence events // or my "subscribe wish" was declined Jid rost = new Jid(stanzaFrom); jabberListener.notifyPresence(rost, stanzaType); } else if (stanzaType.equals("probe")) { // roster/server probes my presence } } /** * Reads a roster stanza, saves info in Datas and notify to midlet * @author Gabriele Bianchi * Modified by Vladimir Slatvinskiy * @param _node */ protected void readRoster(Node _node) { System.out.println("+readRoster+"); Node root = _node.getChild("query"); Vector children = root.getChildren(); for (int i=0; i<children.size();i++) { Node child = (Node)children.elementAt(i); Jid newjid = new Jid(child.getValue("jid")); //nickname if(child.getValue("name")!=null) { newjid.setNick(child.getValue("name")); } else { String jname = child.getValue("jid"); if(jname.indexOf("@")!=-1) { newjid.setNick(jname.substring(0, jname.indexOf("@"))); } else { newjid.setNick(jname); } } //check group if (child.getChild("group") != null) { newjid.group = child.getChild("group").text; } if (newjid.getUsername() == newjid.getServername()) continue; if (Datas.roster.get(newjid.getLittleJid()) != null ) { if (child.getValue("subscription") != null && (child.getValue("subscription").equals("none") || child.getValue("subscription").equals("from"))) { ((Jid)Datas.roster.get(newjid.getLittleJid())).setPresence(Presence.getPresence("unsubscribed")); } else if (child.getValue("subscription") != null && child.getValue("subscription").equals("remove")) { Datas.roster.remove(newjid.getLittleJid()); Vector conversations = Datas.conversations; for (int k=0; k<conversations.size(); k++) { Conversation c = (Conversation) conversations.elementAt(k); if (c.name.equals(newjid.getUsername())) { conversations.removeElementAt(k); break; } } } return; } else { if (child.getValue("subscription") != null && (child.getValue("subscription").equals("none") || child.getValue("subscription").equals("from"))) { newjid.setPresence(Presence.getPresence("unsubscribed")); } Datas.registerRoster(newjid); jabberListener.updateScreen(); } } if (!Datas.readRoster) { Datas.readRoster = true; jabberListener.notifyRoster(); } } /** * Reads a message stanza and notify to midlet * Modified by Gabriele Bianchi 17/01/2006 * Modified by Vladimir Slatvinskiy * @param _node */ protected void readMessage(Node _node) { Message message = new Message(_node); // takes the subject&body of the message String threadId = ""; Conversation conversation = null; // conversation corresponding to the message Jid rosterFrom; if (_node.getChild("thread") != null) { threadId = _node.getChild("thread").text; } else { // _node has no "thread" child: server message? if (message.from.equalsIgnoreCase(Datas.hostname) || Datas.isGateway(message.from)) { System.out.println("server message"); conversation = new Conversation(message.from); conversation.appendToMe(message); jabberListener.newMessageEvent(conversation); return; } } //groupchat invitation management if ((stanzaType == null || stanzaType.equals("normal")) || _node.getChild("x", "xmlns", "jabber:x:conference") != null) { String jidfrom = ""; String room = ""; String reason = ""; //check if server uses new MUC protocol if (_node.getChild("x", "xmlns", "http://jabber.org/protocol/muc#user") != null) { Node invite = _node.getChild("x", "xmlns", "http://jabber.org/protocol/muc#user"); if (invite.getChild("invite") != null) { jidfrom = invite.getChild("invite").getValue("from"); room = stanzaFrom; Node r = invite.getChild("invite").getChild("reason"); if(r!=null) { reason = r.text; jabberListener.newInvitationEvent(jidfrom, room, reason); } else { jabberListener.newInvitationEvent(jidfrom, room); } return; } }//check if server uses old protocol else if (_node.getChild("body") != null && _node.getChild("body").text.startsWith("You have been invited")) { Node invite = _node.getChild("x", "xmlns", "jabber:x:conference"); jidfrom = stanzaFrom; room = invite.getValue("jid"); jabberListener.newInvitationEvent(jidfrom, room); return; } } //Composing management else if (stanzaType.equals("chat") && _node.getChild("composing", "xmlns", "http://jabber.org/protocol/chatstates") != null) { Vector conversations = Datas.conversations; Conversation convers = null; // finds out the conversation, if already exists for(int i=0; i<conversations.size(); i++) { convers = (Conversation) conversations.elementAt(i); if (convers.match(_node)) { convers.composing = Jid.getUsername(convers.name) + Contents.composing; jabberListener.newComposingEvent(convers); break; } } return; } else if (stanzaType.equals("chat") && _node.getChild("inactive", "xmlns", "http://jabber.org/protocol/chatstates") != null) { Vector conversations = Datas.conversations; Conversation convers = null; // finds out the conversation, if already exists for(int i=0; i<conversations.size(); i++) { convers = (Conversation) conversations.elementAt(i); if (convers.match(_node)) { convers.composing = Jid.getUsername(convers.name) + Contents.inactive; jabberListener.newComposingEvent(convers); break; } } return; } else if (stanzaType.equals("chat") && _node.getChild("x", "xmlns", "jabber:x:event") != null && _node.getChild("body") == null) { Node x = _node.getChild("x", "xmlns", "jabber:x:event"); if (x.getChild("composing") != null) { Vector conversations = Datas.conversations; Conversation convers = null; for(int i=0; i<conversations.size(); i++) { convers = (Conversation) conversations.elementAt(i); if (convers.match(_node)) { convers.composing = Jid.getUsername(convers.name) + Contents.composing; jabberListener.newComposingEvent(convers); break; } } return; } } Vector conversations = Datas.conversations; // finds out the conversation, if already exists int i=0; boolean found=false; while ((i<conversations.size()) && !found) { conversation = (Conversation) conversations.elementAt(i); found = conversation.match(_node); i++; } // default stanza type if not specified. if(stanzaType == null) { stanzaType = "normal"; } if (found == false) { // no conversation with this roster is running if (stanzaType.equals("error")) { message.addError(_node.getChild("error").text); jabberListener.notifyError(null, message); } else if (stanzaType.equals("normal") || stanzaType.equals("chat") ) { rosterFrom = (Jid) Datas.roster.get(Jid.getLittleJid(stanzaFrom)); if (rosterFrom == null) { // the roster is not known Jid newjid = new Jid(stanzaFrom, "online"); rosterFrom = newjid; Datas.registerRoster(newjid); } // normal: default message type. reply expected. no history. // chat: peer to peer communication. with history. SingleChat chat = new SingleChat(rosterFrom, stanzaType, threadId); chat.appendToMe(message); // registers this new conversation conversations.addElement(chat); jabberListener.newConversationEvent(chat); } else if (stanzaType.equals("groupchat")) { System.out.println("My message"); return; } else if (stanzaType.equals("headline")) { rosterFrom = (Jid) Datas.roster.get(stanzaFrom); if (rosterFrom == null) { // the roster is not known Jid newjid = new Jid(stanzaFrom); rosterFrom = newjid; if (stanzaFrom.indexOf("@") != -1) //is user { Datas.registerRoster(newjid); } } // no reply expected. (e.g. news, ads...) conversation = new Conversation(rosterFrom.getUsername()); conversation.appendToMe(message); // registers this new conversation jabberListener.newMessageEvent(conversation); } } else { // conversation already exists if (stanzaType.equals("error")) { // should find the message in the conversation, append the error to it and // display the error msg *** message.addError(_node.getChild("error").text); jabberListener.notifyError(conversation, message); } else { if (message.body.equals("") && message.subject.equals("")) return; //taglia i messaggi vuoti, come ad esempio gli eventi MSN ("composing..") conversation.appendToMe(message); conversation.composing = ""; jabberListener.newMessageEvent(conversation); } } } public void setRosterState() { internalstate = WAIT_ROSTER; } public void showAlert(final String text) { UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Status.show(text); } }); } }
[ "igor@quickblox.com" ]
igor@quickblox.com
79e58880187d9d08bd6b524e92650c0026bf21ff
9ad9a6a0fc54273ea2899523d7cc726f061b612d
/src/com/Monkey/common/GameSetting.java
310bc6b942bf1988c3384a0966d6574bc0ce2151
[]
no_license
panda926/ApkCake
60b275d2f8bfa709df4fbe5217812a3e5460480a
d57974f4847bc6c03463dc544535ff5dafb9f393
refs/heads/master
2021-01-10T05:24:28.666027
2016-03-17T13:46:34
2016-03-17T13:47:31
54,121,048
0
0
null
null
null
null
UTF-8
Java
false
false
2,737
java
package com.Monkey.common; import org.cocos2d.nodes.CCDirector; import android.content.SharedPreferences; /** * program`s setting model */ public class GameSetting{ public static final String PREFS_NAME = "ApeGameSettings"; public static SharedPreferences m_settings; public static boolean isContain( String strKey ){ return m_settings.contains(strKey); } public static int getIntValue( String strKey, int nDefValue ){ return (Integer) m_settings.getInt(strKey, nDefValue); } public static boolean getBooleanValue( String strKey, boolean bDefValue ){ return m_settings.getBoolean(strKey, bDefValue); } public static float getFloatValue( String strKey, float ftDefValue ){ return m_settings.getFloat(strKey, ftDefValue); } public static long getLongValue( String strKey, long lDefValue ){ return m_settings.getLong(strKey, lDefValue); } public static String getStringValue( String strKey, String strDefValue ){ return m_settings.getString(strKey, strDefValue); } public static void putValue( String strKey, int nValue ){ SharedPreferences.Editor edit = m_settings.edit(); edit.putInt(strKey, nValue); edit.commit(); } public static void putValue( String strKey, boolean bValue ){ SharedPreferences.Editor edit = m_settings.edit(); edit.putBoolean(strKey, bValue); edit.commit(); } public static void putValue( String strKey, float ftValue ){ SharedPreferences.Editor edit = m_settings.edit(); edit.putFloat(strKey, ftValue); edit.commit(); } public static void putValue( String strKey, long lValue ){ SharedPreferences.Editor edit = m_settings.edit(); edit.putLong(strKey, lValue); edit.commit(); } public static void putValue( String strKey, String strValue ){ SharedPreferences.Editor edit = m_settings.edit(); edit.putString(strKey, strValue); edit.commit(); } public static void remove( String strKey ){ SharedPreferences.Editor edit = m_settings.edit(); edit.remove(strKey); edit.commit(); } public static void removeAll(){ SharedPreferences.Editor edit = m_settings.edit(); edit.clear(); edit.commit(); } /** initialize setting */ public static void initialize(){ m_settings = CCDirector.sharedDirector().getActivity().getSharedPreferences(PREFS_NAME, 0); removeAll(); if( getBooleanValue("FIRST_INSTALL_FLAG", true) ){ removeAll(); putValue("FIRST_INSTALL_FLAG", false); // Game Info putValue("LEVEL_INFO", 0); // settings putValue("SOUND_VOLUME", 0.5f); putValue("EFFECT_VOLUME", 0.5f); // state putValue("HIGH_SCORE", 0); } } }
[ "panda926@outlook.com" ]
panda926@outlook.com
51094d80669297bbc3dcabda7dae634e3dce6bc8
41a3705c51ee004432447f73b278071656dd84d5
/src/com/leila/metodos/pedirDatos.java
16f4af8e632a384b1e2627a2f469debf403bce6f
[]
no_license
LeilaRomero/Boletin21
910a5cdd0bbcb7829acb124aeae1c55e12d32299
efaefcd8cdbfe6f5f779dde7687a5d52f3ea8d35
refs/heads/master
2021-02-05T22:10:07.396826
2020-02-28T19:36:34
2020-02-28T19:36:34
243,840,591
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.leila.metodos; import javax.swing.JOptionPane; /** * * @author Leila */ public class pedirDatos { private final int numero = 0; private final float numeros=0; public static float pedirFloat(String mensaje) { float numeros = Float.parseFloat(JOptionPane.showInputDialog(mensaje)); return numeros; } public static int pedirInt(String mensaje) { int numero = Integer.parseInt(JOptionPane.showInputDialog(mensaje)); return numero; } public static String pedirString(String mensaje) { String datos = (JOptionPane.showInputDialog(mensaje)); return datos; } }
[ "Leila@LAPTOP-V2HI2OPE" ]
Leila@LAPTOP-V2HI2OPE
8f49a62f9f59a26ada61497d1d415406841cb134
3c2dc4f201e6b46f1d710b1ede66125f5b7feedb
/project-est-impl/src/main/java/org/project/company/greenhomes/common/filefilters/LandMarkMeasuresFileFilter.java
c51ea26bac6c721f3ea03a972cf6b1f5db73f4df
[]
no_license
mononokehime/pdf-generation
1b15154ae110b2c87c106e8ea55e05c67c7c5322
c38fec39f7a3bba6b08fc6a68442891769848609
refs/heads/master
2020-06-04T22:10:14.117443
2014-12-02T13:31:05
2014-12-02T13:31:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
package org.project.company.greenhomes.common.filefilters; import java.io.File; import java.io.FilenameFilter; /** * Makes sure only files containing measures are returned. We look for the text <code>recommendations</code> * * */ public class LandMarkMeasuresFileFilter implements FilenameFilter { private final String extension = "recommendations"; public boolean accept (File dir, String name) { if (null == name) { return false; } return name.toLowerCase().indexOf(extension) != -1; } }
[ "root@fergus-macdermots-macbook-pro.local" ]
root@fergus-macdermots-macbook-pro.local
91b5c63daaf61809a957ea314b15cf074c11a93f
015d341378b024545cb730026cb2cec6be796f57
/GoodGuy.java
6600007a4e926c2ca61c8eac27824daafe20fc48
[]
no_license
AndYetItCompilesFinal/BattleTester
ce54ed9db71c514d6d6ebf309283aee64b5c93c3
64892efe61abef889edb9947bce5c19735228990
refs/heads/master
2021-01-10T00:59:51.661143
2015-03-11T01:53:27
2015-03-11T01:53:27
31,868,355
0
0
null
null
null
null
UTF-8
Java
false
false
1,219
java
import java.util.Scanner; public abstract class GoodGuy extends Character { String attack1; String attack2; String attack3; public String printStats() { return toString() +"\n"+ "HP: "+this.HP+"\nDefense: "+this.defense+"\nSpeed: "+this.speed+"\nAttack: "+this.attack; } public void addHP(int h){ HP = HP + h; if(HP >= maxHP) { HP = maxHP; System.out.println(name + " was fully healed!"); }else{ System.out.println(name + " has healed " + h + "hit points. They are at " + HP + " out of " + maxHP + " hit points."); } } public int chooseAttack(){ int att = 0; while(att < 1 || att > 3) { System.out.println("Choose your Attack!"); System.out.println("1. " + attack1); System.out.println("2. " + attack2); System.out.println("3. " + attack3); Scanner sc = new Scanner(System.in); System.out.println("Enter number now: "); att = sc.nextInt(); } int base; if( att == 1){ base = attack1(); }else if( att == 2){ base = attack2(); }else{ base = attack3(); } return base; } }//end of class
[ "zcbaker@ymail.com" ]
zcbaker@ymail.com
1c93905c0d23216a25a8745f4db99b0e290f9e96
886520c8715d532efe4baaaac0297eb3c33301b4
/src/cscie97/asn1/knowledge/engine/Node.java
d9b9554d81b2a0ac61f03515346e7f2f221cccde
[]
no_license
phatosas/cscie97-asn1
2615a5a238e562a0c5a37b7878a0540102d6e138
b4b57ad97472b78c247e34b37eaf667a3e3e1263
refs/heads/master
2020-03-23T14:22:48.447712
2013-09-19T02:07:56
2013-09-19T02:07:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,106
java
package cscie97.asn1.knowledge.engine; /** * Represents a Node, which is part of a Triple. A Node can represent the "subject" of a Triple, * or the "object". There should only be 1 unique instance of each Node, and this uniqueness is enforced * by the KnowledgeGraph class. * * @author David Killeffer <rayden7@gmail.com> * @version 1.0 * @see Triple */ public class Node { /** * Private unique (use Flyweight pattern) non mutable identifier for the Node. * Node identifiers are case insensitive. */ private String identifier; /** * Returns the Node string identifier. * * @return the string identifier for this Node */ public String getIdentifier() { return identifier; } /** * Class constructor. Sets the string identifier for the Node. * * @param identifier the string that should uniquely identify this Node from all others; * uniqueness of Nodes is enforced by the KnowledgeGraph class */ public Node(String identifier) { this.identifier = identifier; } }
[ "rayden7@gmail.com" ]
rayden7@gmail.com
736dfae6abd536b9e18e26924b7ae7367f385967
cb99c11c514f465ea1e7e114a1bb2992789e563e
/greendao/src/main/java/com/example/greendao/User.java
c7f8dc40dd871b709a8983bbcc02c4ebb08f50dd
[]
no_license
fengyuehan/Test
a79630452e282a17ded6b6c6318a0d252c8207ff
453496cbf26449241f303a5b39a603e7aa6fe158
refs/heads/master
2022-05-26T23:38:20.196093
2022-03-17T04:35:52
2022-03-17T04:35:52
174,118,194
8
0
null
null
null
null
UTF-8
Java
false
false
723
java
package com.example.greendao; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Generated; @Entity public class User { @Id(autoincrement = true) private Long id; private String name; @Generated(hash = 873297011) public User(Long id, String name) { this.id = id; this.name = name; } @Generated(hash = 586692638) public User() { } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } }
[ "zhangzhenfeng@qianbaocard.com" ]
zhangzhenfeng@qianbaocard.com
42965e9f457c5844dfd80fc9b074895a11946385
20d2448c9a26bd49b1617bd68efba6c625f2a339
/src/api/model/service/ImagemEquipamentoService.java
3bb0a53a63d5282f094b71b5e2217d5fcf1c0a2b
[]
no_license
janainaemilia/emcontrol-api
42338ad8cd83d404aa14a294946ff6882aa2b68c
5dfba42e5f787667a960dc748cd8118f25912ec3
refs/heads/master
2022-12-25T10:45:24.956061
2019-10-28T22:51:03
2019-10-28T22:51:03
216,275,819
0
0
null
2022-12-16T06:57:02
2019-10-19T22:01:36
TSQL
UTF-8
Java
false
false
1,000
java
package api.model.service; import java.io.IOException; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import api.model.entity.Equipamento; import api.model.entity.ImagemEquipamento; import api.model.dao.ImagemEquipamentoDAO; @Service public class ImagemEquipamentoService { @Autowired private ImagemEquipamentoDAO dao; public ImagemEquipamento inserir(ImagemEquipamento imagem) throws IOException{ return dao.inserir(imagem); } public ImagemEquipamento buscar(int id) throws IOException{ return dao.buscar(id); } @SuppressWarnings("unchecked") public List<ImagemEquipamento> listarImagemEquipamento() throws IOException{ return dao.listarImagemEquipamento(); } @SuppressWarnings("unchecked") public List<ImagemEquipamento> listarImagemEquipamento(Equipamento equipamento) throws IOException{ return dao.listarImagemEquipamento(equipamento); } }
[ "janaina.abc3@gmail.com" ]
janaina.abc3@gmail.com
c41d3debca34a6db28f996fa704d7aa801e442bd
91c623e7a1239b21862d307049ec2b1f56c08e84
/ComputerSaleSys/src/main/java/com/scs/daoImp/SalaryDaoImpl.java
2d0fe38c7786636878bf9a7b6d2c04346c16729d
[]
no_license
Negen9527/ComputerSaleSys
0851e6d1180318ae8e5fde384fa0c777ad1b6e27
a72543d4d85ce55298f5447621756a38bf3effef
refs/heads/master
2020-04-03T15:13:05.652225
2018-12-25T09:21:18
2018-12-25T09:21:18
155,355,403
1
0
null
null
null
null
UTF-8
Java
false
false
2,695
java
package com.scs.daoImp; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.springframework.orm.hibernate5.HibernateCallback; import org.springframework.orm.hibernate5.support.HibernateDaoSupport; import org.springframework.stereotype.Repository; import com.scs.dao.SalaryDao; import com.scs.entity.User; @Repository("salaryDao") public class SalaryDaoImpl extends HibernateDaoSupport implements SalaryDao{ @Override public Object selectAllByMonth(final String yearAndMonth) { return getHibernateTemplate().execute(new HibernateCallback<Object>() { @Override public Object doInHibernate(Session session) throws HibernateException { try { String sqlStr = "SELECT\r\n" + "user.id AS userId,user.username AS username,SUM(sales.outPrice - product.inPrice) AS total,COUNT(sales.outPrice) AS COUNT\r\n" + "FROM\r\n" + " db_computer_sale.product\r\n" + " INNER JOIN db_computer_sale.sales\r\n" + " ON (product.id = sales.productId)\r\n" + " INNER JOIN db_computer_sale.user \r\n" + " ON (user.id = sales.salesManId)\r\n" + " WHERE DATE_FORMAT(sales.salesTime, '%Y%m')='"+yearAndMonth+"' GROUP BY user.username ORDER BY total DESC "; Query query = session.createSQLQuery(sqlStr); // query.setString(0, yearAndMonth); return query.list(); } catch (Exception e) { e.printStackTrace(); return null; } } }); } /** * 查询个人工资情况 * @param userId 用户id * @param yearAndMonth 年月 */ @Override public Object selectOneByMonth(final Integer userId, final String yearAndMonth) { try { return getHibernateTemplate().execute(new HibernateCallback<Object>() { @Override public Object doInHibernate(Session session) throws HibernateException { String sqlStr = "SELECT\r\n" + "user.id,user.username,user.basicSalary,user.inTime,SUM(sales.outPrice - product.inPrice) AS total,COUNT(*) AS _count\r\n" + "FROM\r\n" + " db_computer_sale.sales\r\n" + " INNER JOIN db_computer_sale.user \r\n" + " ON (sales.salesManId = user.id)\r\n" + " INNER JOIN db_computer_sale.product\r\n" + " ON (product.id = sales.productId)"+ " WHERE user.id="+userId+" AND DATE_FORMAT(sales.salesTime,'%Y%m')='"+yearAndMonth+"'"; Query query = session.createSQLQuery(sqlStr); // query.setInteger(0, userId); // query.setString(1, yearAndMonth); return query.list(); } }); } catch (Exception e) { e.printStackTrace(); return null; } } }
[ "1096041251@qq.com" ]
1096041251@qq.com
8361a2b7afc500bbf958d608770ba05d06503b44
f8038329c8bc01877d1cf754351190954dc69384
/src/queueArray/QueueLinkedList.java
65f678aa95ca5accc60bcbf15567811564cf68e8
[]
no_license
AhuvaFoxman/foxman-mco-264
80679560a266e6f206c960ee506a9b8916875fb2
4c4ea9c5ecabcf992f6d830832dca6e6178797d3
refs/heads/master
2016-09-01T14:51:59.363779
2016-01-14T04:39:17
2016-01-14T04:39:17
49,622,998
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package queueArray; public class QueueLinkedList<T> { private Node<T> head; private Node<T> tail; public QueueLinkedList(){ head = tail = null; } public void enqueue(T data){ if(head == null && tail == null){ Node<T> newNode = new Node<T>(data); head = tail = newNode; } else{ Node<T> newNode = new Node<T>(data); tail.setNext(newNode);//first make the connection tail = newNode; //then move the tail } } public T dequeue(){ if(isEmpty()){ return null; } else{ T value = head.getData(); head = head.getNext(); if(head == null){ tail = null; } return value; } } public void removeAll(){ head = tail = null; } public boolean isEmpty(){ return head == null; } public static void main (String[] args){ QueueLinkedList<String> names = new QueueLinkedList<String>(); names.enqueue("Libby"); names.enqueue("Rena"); names.enqueue("Ahuva"); names.enqueue("Leba"); while (!names.isEmpty()){ System.out.println(names.dequeue()); } names.enqueue("Chava"); while(!names.isEmpty()){ System.out.println(names.dequeue()); } } }
[ "afoxman36@gmail.com" ]
afoxman36@gmail.com
5f8c7caf47b33062d0909c0b125a37a900299400
1475e1bf5565c8d91bef63a50a6dc1f125bc4364
/src/main/java/com/finuniversally/service/impl/TradePlatformServiceImpl.java
30ea6cfcac84aedc5f0700dfcebc6417676d52d6
[]
no_license
Jumy126/Golden_FIN_Universally
2396e34cdcd85c055bd80f548b17a49da8e9b733
bd2cc99fedb10a5bafa87522f1dcdb4f6004f5e7
refs/heads/master
2020-03-11T01:57:16.355745
2018-05-09T02:40:33
2018-05-09T02:40:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package com.finuniversally.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import com.finuniversally.mapper.TradePlatformMapper; import com.finuniversally.model.TradePlatform; import com.finuniversally.service.TradePlatformService; import com.finuniversally.untils.TransFormDataSource; @Component public class TradePlatformServiceImpl implements TradePlatformService{ @Autowired private TradePlatformMapper tradePlatformMapper; @Override public List<TradePlatform> getAllPlatform() { return tradePlatformMapper.getAllPlatform(); } }
[ "li1284537512@gmail.com" ]
li1284537512@gmail.com
e523d0c58ef95caabe40205f286da597b8fc06f8
3027ab86acb71fe19b340ec90eb9be748ead09fb
/src/main/java/com/augurit/awater/bpm/sggc/web/form/GxSggcLogForm.java
0004c7a387a4ee176a9dcf7d682a3c26a509be8e
[]
no_license
vae5340/psxj
fcb9275dc6ba539acfe8ab5f0bd6abc1990d4ca0
da2a77fae82c958143af11375846e2a664a8b5bf
refs/heads/master
2020-04-04T01:04:52.546318
2018-12-18T01:14:26
2018-12-18T01:14:26
155,666,904
0
1
null
null
null
null
UTF-8
Java
false
false
2,909
java
package com.augurit.awater.bpm.sggc.web.form; import com.augurit.agcloud.bsc.domain.BscAttForm; import com.augurit.awater.bpm.xcyh.report.web.form.DetailFilesForm; import java.util.List; public class GxSggcLogForm { // 属性 private Long id; private String lx; private String username; private Long time; private String content; private String sgjd; private String sjid; private String loginname; private String opUser; private String opUserPhone; private String linkName; private String opinion; private String nextOpUser; private String nextOpUserPhone; private String reassignComments; public String getLoginname() { return loginname; } public void setLoginname(String loginname) { this.loginname = loginname; } public String getReassignComments() { return reassignComments; } public void setReassignComments(String reassignComments) { this.reassignComments = reassignComments; } public String getNextOpUser() { return nextOpUser; } public void setNextOpUser(String nextOpUser) { this.nextOpUser = nextOpUser; } public String getNextOpUserPhone() { return nextOpUserPhone; } public void setNextOpUserPhone(String nextOpUserPhone) { this.nextOpUserPhone = nextOpUserPhone; } public String getOpUser() { return opUser; } public void setOpUser(String opUser) { this.opUser = opUser; } public String getOpUserPhone() { return opUserPhone; } public void setOpUserPhone(String opUserPhone) { this.opUserPhone = opUserPhone; } public String getLinkName() { return linkName; } public void setLinkName(String linkName) { this.linkName = linkName; } public String getOpinion() { return opinion; } public void setOpinion(String opinion) { this.opinion = opinion; } private List<BscAttForm> files; private List<DetailFilesForm> attFiles; public List<DetailFilesForm> getAttFiles() { return attFiles; } public void setAttFiles(List<DetailFilesForm> attFiles) { this.attFiles = attFiles; } public List<BscAttForm> getFiles() { return files; } public void setFiles(List<BscAttForm> files) { this.files = files; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getLx() { return this.lx; } public void setLx(String lx) { this.lx = lx; } public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } public Long getTime() { return this.time; } public void setTime(Long time) { this.time = time; } public String getContent() { return this.content; } public void setContent(String content) { this.content = content; } public String getSgjd() { return this.sgjd; } public void setSgjd(String sgjd) { this.sgjd = sgjd; } public String getSjid() { return this.sjid; } public void setSjid(String sjid) { this.sjid = sjid; } }
[ "1763352208@qq.com" ]
1763352208@qq.com
31f2c38719b2c0bfa0d2198624ea61404fa96672
d883f3b07e5a19ff8c6eb9c3a4b03d9f910f27b2
/Tools/OracleJavaGen/src/main/resources/oracle_service_project/OracleDataService/src/main/java/com/sandata/lab/rest/oracle/model/PatientSupervisoryVisitFrequency.java
80a955b74e5589da8153433f1efe2866e8c150f3
[]
no_license
dev0psunleashed/Sandata_SampleDemo
ec2c1f79988e129a21c6ddf376ac572485843b04
a1818601c59b04e505e45e33a36e98a27a69bc39
refs/heads/master
2021-01-25T12:31:30.026326
2017-02-20T11:49:37
2017-02-20T11:49:37
82,551,409
0
0
null
null
null
null
UTF-8
Java
false
false
2,495
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.11.27 at 10:53:27 PM EST // package com.sandata.lab.rest.oracle.model; import com.sandata.lab.data.model.*; import com.google.gson.annotations.SerializedName; import com.sandata.lab.data.model.base.BaseObject; import com.sandata.lab.data.model.dl.annotation.Mapping; import com.sandata.lab.data.model.dl.annotation.OracleMetadata; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for Patient_Supervisory_Visit_Frequency. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="Patient_Supervisory_Visit_Frequency"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;maxLength value="50"/> * &lt;enumeration value="Every 14 Days"/> * &lt;enumeration value="Every 30 Days"/> * &lt;enumeration value="Every 60 Days"/> * &lt;enumeration value="Every 90 Days"/> * &lt;enumeration value="Every 120 Days"/> * &lt;enumeration value="Every 180 Days"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "Patient_Supervisory_Visit_Frequency") @XmlEnum public enum PatientSupervisoryVisitFrequency { @XmlEnumValue("Every 14 Days") EVERY_14_DAYS("Every 14 Days"), @XmlEnumValue("Every 30 Days") EVERY_30_DAYS("Every 30 Days"), @XmlEnumValue("Every 60 Days") EVERY_60_DAYS("Every 60 Days"), @XmlEnumValue("Every 90 Days") EVERY_90_DAYS("Every 90 Days"), @XmlEnumValue("Every 120 Days") EVERY_120_DAYS("Every 120 Days"), @XmlEnumValue("Every 180 Days") EVERY_180_DAYS("Every 180 Days"); private final String value; PatientSupervisoryVisitFrequency(String v) { value = v; } public String value() { return value; } public static PatientSupervisoryVisitFrequency fromValue(String v) { for (PatientSupervisoryVisitFrequency c: PatientSupervisoryVisitFrequency.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
[ "pradeep.ganesh@softcrylic.co.in" ]
pradeep.ganesh@softcrylic.co.in
b7d7ee209972f41401d9d0f95c0caf45fad7266c
375d64e50c7e15c03220de5b2045c3ba1bf0f81c
/src/fileReader/TableauCalculation.java
c2946cb7a833077f6995b5b43c1a85059c5efdec
[]
no_license
gravesds/Tableau-Datasource-Auditor
453e00c4ccb648a932ee2ab9d41e1dd37d97073f
ab7b2291f34afbfb23f74e2577f2bc51cbccc0e4
refs/heads/master
2020-04-22T11:06:02.630558
2019-05-17T12:43:44
2019-05-17T12:43:44
170,327,943
0
0
null
null
null
null
UTF-8
Java
false
false
1,264
java
package fileReader; import java.util.regex.*; @SuppressWarnings("unused") public class TableauCalculation { String workbook; String tableauVersion; String name; String formula; String caption; TableauCalculation(String workbook, String tableauVersion, String name, String formula, String caption) { this.workbook = workbook; this.tableauVersion = tableauVersion; this.name = name; this.formula = formula; this.caption = caption; } boolean containsCalculation() { Pattern pattern = Pattern.compile("\\[Calculation_\\d+\\]"); Matcher m = pattern.matcher(this.formula); return m.find(); } boolean isLOD() { Pattern pattern = Pattern.compile("\\{"); Matcher m = pattern.matcher(this.formula); return m.find(); } void printCalculation() { System.out.println("Workbook: " + this.workbook); System.out.println("Versoin: " + this.tableauVersion); System.out.println("Field Name: " + this.name); System.out.println("Formula:\n" + this.formula); System.out.println("Calculation: " + this.caption); if (this.containsCalculation()) {System.out.println("This calculation references another calculation");} if (this.isLOD()) { System.out.println("This is a Level of Detail expression");} System.out.println(); } }
[ "daniel.graves@sunlife.com" ]
daniel.graves@sunlife.com
b6b3f93e09ade726fe5826e2b940eb9183e16867
d61f73352e82d47443e85929d27e85b22cabc784
/src/jp/ac/isc/cloud/UserUpdateServlet.java
6114d3f0bc1e02c6e4e1d3dab8c7fb92e2e7a7bb
[]
no_license
takusankun/systemDevelopment2021
e127a16486850331ea335463a7eaba57eb5be5f1
26c39118f92a046f456f38c9510150b2228d60f5
refs/heads/master
2023-07-01T13:03:08.922313
2021-07-27T14:05:19
2021-07-27T14:05:19
389,466,088
0
0
null
null
null
null
UTF-8
Java
false
false
1,435
java
package jp.ac.isc.cloud; import java.sql.*; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/UserUpdateServlet") public class UserUpdateServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Connection users = null; try { request.setCharacterEncoding("utf-8"); Class.forName("com.mysql.jdbc.Driver"); users = DriverManager.getConnection("jdbc:mysql://localhost/servlet_db","root",""); String id = request.getParameter("updateId"); String name = request.getParameter("updateName"); //String picture = request.getParameter("updatePicture"); Statement state = users.createStatement(); state.executeUpdate("UPDATE user_table SET name='" + name + "' WHERE id ='" + id + "'"); state.close(); users.close(); response.sendRedirect("/select"); //UserSelectServletを呼び出す }catch(ClassNotFoundException e) { e.printStackTrace(); } }catch(SQLException e){ e.printStackTrace(); } } }
[ "cath1200223@gn.iwasaki.ac.jp" ]
cath1200223@gn.iwasaki.ac.jp
2c25482b18ff41a66f718655cb8196e5fd4ac893
2e5c7b8c36e25dd7330a7c468453504a14983303
/src/main/java/util/ClassUtil.java
7a742d9f53411f213a61546931e0576b7c0d4da3
[]
no_license
a1isillusion/ourbatis
599ffb839c25228e6199aa7a84af63b1e600322e
64b810ff16d4686eef31abcb3efe023b9e5be50f
refs/heads/master
2020-04-08T06:15:48.816115
2018-11-27T03:10:23
2018-11-27T03:10:23
159,090,932
0
0
null
null
null
null
UTF-8
Java
false
false
6,448
java
package util; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.net.JarURLConnection; import java.net.URL; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; public class ClassUtil { /** * 通过包名获取包内所有类 * * @param pkg * @return */ public static List<Class<?>> getAllClassByPackageName(String packageName) { // 获取当前包下以及子包下所以的类 List<Class<?>> returnClassList = getClasses(packageName); return returnClassList; } /** * 通过接口名取得某个接口下所有实现这个接口的类 */ public static List<Class<?>> getAllClassByInterface(Class<?> c) { List<Class<?>> returnClassList = null; if (c.isInterface()) { // 获取当前的包名 String packageName = c.getPackage().getName(); // 获取当前包下以及子包下所以的类 List<Class<?>> allClass = getClasses(packageName); if (allClass != null) { returnClassList = new ArrayList<Class<?>>(); for (Class<?> cls : allClass) { // 判断是否是同一个接口 if (c.isAssignableFrom(cls)) { // 本身不加入进去 if (!c.equals(cls)) { returnClassList.add(cls); } } } } } return returnClassList; } /** * 取得某一类所在包的所有类名 不含迭代 */ public static String[] getPackageAllClassName(String classLocation, String packageName) { // 将packageName分解 String[] packagePathSplit = packageName.split("[.]"); String realClassLocation = classLocation; int packageLength = packagePathSplit.length; for (int i = 0; i < packageLength; i++) { realClassLocation = realClassLocation + File.separator + packagePathSplit[i]; } File packeageDir = new File(realClassLocation); if (packeageDir.isDirectory()) { String[] allClassName = packeageDir.list(); return allClassName; } return null; } /** * 从包package中获取所有的Class * * @param pack * @return */ private static List<Class<?>> getClasses(String packageName) { // 第一个class类的集合 List<Class<?>> classes = new ArrayList<Class<?>>(); // 是否循环迭代 boolean recursive = true; // 获取包的名字 并进行替换 String packageDirName = packageName.replace('.', '/'); // 定义一个枚举的集合 并进行循环来处理这个目录下的things Enumeration<URL> dirs; try { dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName); // 循环迭代下去 while (dirs.hasMoreElements()) { // 获取下一个元素 URL url = dirs.nextElement(); // 得到协议的名称 String protocol = url.getProtocol(); // 如果是以文件的形式保存在服务器上 if ("file".equals(protocol)) { // 获取包的物理路径 String filePath = URLDecoder.decode(url.getFile(), "UTF-8"); // 以文件的方式扫描整个包下的文件 并添加到集合中 findAndAddClassesInPackageByFile(packageName, filePath, recursive, classes); } else if ("jar".equals(protocol)) { // 如果是jar包文件 // 定义一个JarFile JarFile jar; try { // 获取jar jar = ((JarURLConnection) url.openConnection()).getJarFile(); // 从此jar包 得到一个枚举类 Enumeration<JarEntry> entries = jar.entries(); // 同样的进行循环迭代 while (entries.hasMoreElements()) { // 获取jar里的一个实体 可以是目录 和一些jar包里的其他文件 如META-INF等文件 JarEntry entry = entries.nextElement(); String name = entry.getName(); // 如果是以/开头的 if (name.charAt(0) == '/') { // 获取后面的字符串 name = name.substring(1); } // 如果前半部分和定义的包名相同 if (name.startsWith(packageDirName)) { int idx = name.lastIndexOf('/'); // 如果以"/"结尾 是一个包 if (idx != -1) { // 获取包名 把"/"替换成"." packageName = name.substring(0, idx).replace('/', '.'); } // 如果可以迭代下去 并且是一个包 if ((idx != -1) || recursive) { // 如果是一个.class文件 而且不是目录 if (name.endsWith(".class") && !entry.isDirectory()) { // 去掉后面的".class" 获取真正的类名 String className = name.substring(packageName.length() + 1, name.length() - 6); try { // 添加到classes classes.add(Class.forName(packageName + '.' + className)); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } } } } catch (IOException e) { e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } return classes; } /** * 以文件的形式来获取包下的所有Class * * @param packageName * @param packagePath * @param recursive * @param classes */ private static void findAndAddClassesInPackageByFile(String packageName, String packagePath, final boolean recursive, List<Class<?>> classes) { // 获取此包的目录 建立一个File File dir = new File(packagePath); // 如果不存在或者 也不是目录就直接返回 if (!dir.exists() || !dir.isDirectory()) { return; } // 如果存在 就获取包下的所有文件 包括目录 File[] dirfiles = dir.listFiles(new FileFilter() { // 自定义过滤规则 如果可以循环(包含子目录) 或则是以.class结尾的文件(编译好的java类文件) public boolean accept(File file) { return (recursive && file.isDirectory()) || (file.getName().endsWith(".class")); } }); // 循环所有文件 for (File file : dirfiles) { // 如果是目录 则继续扫描 if (file.isDirectory()) { findAndAddClassesInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), recursive, classes); } else { // 如果是java类文件 去掉后面的.class 只留下类名 String className = file.getName().substring(0, file.getName().length() - 6); try { // 添加到集合中去 classes.add(Class.forName(packageName + '.' + className)); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } } }
[ "543436798@qq.com" ]
543436798@qq.com
3df5460c00c6416042e87475ef75dc3c8d0d3d95
9241200fc2c38c75553309432ace2794ae7299b8
/LeetCode41_Add Two Numbers.java
6a65ba2c74149f46ec6e789e39ae52b24b36e2b9
[]
no_license
ankitmodi/My-Programming-Pearls
c178046145b4ab83fea79c24945651ecb98ef260
4d459ab34599c8adbeb0a786a0c64ca214d30f00
refs/heads/master
2020-07-25T12:07:58.310349
2015-05-17T07:09:25
2015-05-17T07:09:25
20,020,278
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
/*You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8*/ /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ public class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { int carry = 0; ListNode x = new ListNode(-1); ListNode res = x; while(l1 != null || l2 !=null) { int temp =-1; if(l1 == null && l2 != null) { temp = l2.val; l2 = l2.next; } else if(l1 != null && l2 == null) { temp = l1.val; l1 = l1.next; } else { temp = l1.val + l2.val; l1 = l1.next; l2=l2.next; } temp += carry; x.next = new ListNode(temp%10); x = x.next; carry = temp/10; } if(carry > 0) { x.next = new ListNode(carry); x = x.next; } return res.next; } }
[ "a.modi1422@gmail.com" ]
a.modi1422@gmail.com
9c6cb665cca9da22b355436296600d2c502baa0c
fb6d0d895223e7a991fbff4ec4a602e76b0b8492
/src/main/java/com/muraslab/post/model/Post.java
cc2039770584d0d46ac14befdcf2a7f435bfc9e7
[]
no_license
mnurdin/Post
0d666643dbb2a390b07bd2ac2cafc7cdd4dac311
9d822d74d6bdd79a727bc47ae37a96c211abd2e3
refs/heads/master
2020-09-13T16:21:15.764134
2019-11-20T03:08:02
2019-11-20T03:08:02
222,839,707
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package com.muraslab.post.model; import lombok.Data; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import javax.persistence.*; import java.time.LocalDateTime; import java.util.List; @Entity @Table @Data public class Post { @Id @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "native") private Long id; private String title; @Column(columnDefinition = "text") private String shortDescription; @Column(columnDefinition = "text") private String longDescription; @Column @ManyToOne() private Author author; @CreationTimestamp private LocalDateTime created_at; @UpdateTimestamp private LocalDateTime updated_at; @OneToMany(mappedBy = "post") List<Comment> comments; }
[ "nmamatzhan@gmail.com" ]
nmamatzhan@gmail.com
b25030a887ceffdadf6789934c7848a45f83bdcd
b86a2acf7782f14016a503e14c6b6d9b88025739
/src/main/java/com/cxy/redisclient/dto/ContainerKeyInfo.java
8dfc2322fe9a3a2bcccff624c8444e4c69ba94fa
[]
no_license
maximus0/redis-client
e933dbc70d7bbbcc5de17d8bc6561221fb36ed49
8ee744d22682c88a7c59ee05a28f95527ed060fe
refs/heads/master
2020-04-12T23:51:22.733804
2014-07-30T05:58:48
2014-07-30T06:08:09
22,410,950
0
0
null
null
null
null
UTF-8
Java
false
false
1,173
java
package com.cxy.redisclient.dto; import com.cxy.redisclient.domain.ContainerKey; public class ContainerKeyInfo { private int id; private String serverName; private int db; private ContainerKey container; public ContainerKeyInfo() { super(); this.id = -1; this.db = -1; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getDb() { return db; } public void setDb(int db) { this.db = db; } public ContainerKey getContainer() { return container; } public String getContainerStr() { return container == null?"":container.getContainerKey(); } public String getContainerOnly() { return container == null?"":container.getContainerOnly(); } public void setContainer(ContainerKey container) { this.container = container; } public void setContainer(ContainerKey container, String key) { String con = container == null?"":container.getContainerKey(); this.container = new ContainerKey(con + key); } public String getServerName() { return serverName; } public void setServerName(String serverName) { this.serverName = serverName; } }
[ "chenweichao@news.cn" ]
chenweichao@news.cn
f82533c03e5520231b770431929735f848a7b726
003901a6b3d30751d1ac76798007e4c6830ffb74
/commons/src/main/java/com/epam/eco/kafkamanager/ConfigValue.java
8930c290524a8903447ad1b8011f8786f9bb8fb9
[ "Apache-2.0" ]
permissive
octodemo/eco-kafka-manager
45dce4ffe98366ba4784c9538709a1d98bc0c395
a4c45edb0b2a7baff2f6ce9ac0a1ec517a1f19f6
refs/heads/master
2023-04-19T06:44:18.436606
2020-05-14T19:42:10
2020-05-14T19:42:10
264,008,635
0
0
Apache-2.0
2021-04-26T20:46:19
2020-05-14T19:39:35
Java
UTF-8
Java
false
false
3,420
java
/* * Copyright 2019 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.epam.eco.kafkamanager; import java.util.Objects; import org.apache.commons.lang3.Validate; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; /** * @author Andrei_Tytsik */ public class ConfigValue { private final String name; private final String value; private final boolean isDefault; private final boolean isSensitive; private final boolean isReadOnly; public ConfigValue(String name, String value) { this(name, value, false, false, false); } public ConfigValue(String name, Object value) { this(name, value, false, false, false); } public ConfigValue( String name, Object value, boolean isDefault, boolean isSensitive, boolean isReadOnly) { this(name, Objects.toString(value, null), isDefault, isSensitive, isReadOnly); } @JsonCreator public ConfigValue( @JsonProperty("name") String name, @JsonProperty("value") String value, @JsonProperty("default") boolean isDefault, @JsonProperty("sensitive") boolean isSensitive, @JsonProperty("readOnly") boolean isReadOnly) { Validate.notBlank(name, "Name is blank"); this.name = name; this.value = value; this.isDefault = isDefault; this.isSensitive = isSensitive; this.isReadOnly = isReadOnly; } public String getName() { return name; } public String getValue() { return value; } public boolean isDefault() { return isDefault; } public boolean isSensitive() { return isSensitive; } public boolean isReadOnly() { return isReadOnly; } @Override public int hashCode() { return Objects.hash(name, value, isDefault, isSensitive, isReadOnly); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } ConfigValue that = (ConfigValue)obj; return Objects.equals(this.name, that.name) && Objects.equals(this.value, that.value) && Objects.equals(this.isDefault, that.isDefault) && Objects.equals(this.isSensitive, that.isSensitive) && Objects.equals(this.isReadOnly, that.isReadOnly); } @Override public String toString() { return "{name: " + name + ", value: " + value + ", isDefault: " + isDefault + ", isSensitive: " + isSensitive + ", isReadOnly: " + isReadOnly + "}"; } }
[ "Andrei_Tytsik@epam.com" ]
Andrei_Tytsik@epam.com
64e7a2423848f7e9ab20947ec9d5321dc1efcbb2
e5c1c70dcadf63e352e8a44cc8966b64d6a92a02
/src/br/ifpi/dao/JPAUtil.java
79828a839a0597cc9cbd954f284569179e57facb
[]
no_license
luizamffn/AtividadeJ
23495d5c8e70ae4b9b6e07392fe72bf84278490a
d0573c8bd2300cf00475e53838fd4842c8197869
refs/heads/master
2021-01-23T13:54:53.083027
2016-07-29T12:39:01
2016-07-29T12:39:01
64,423,759
0
0
null
null
null
null
UTF-8
Java
false
false
926
java
package br.ifpi.dao; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class JPAUtil { private static final EntityManagerFactory emf = Persistence.createEntityManagerFactory("evento"); private static ThreadLocal<EntityManager> ems = new ThreadLocal<EntityManager>(); // Fecha o EntityManager atrelado ah Thread atual e retira-o // da ThreadLocal. public static void closeCurrentEntityManager() { EntityManager em = ems.get(); if (em != null && em.isOpen()) { em.close(); // em.flush(); } ems.set(null); } // Obtem o EntityManager vinculado a Thread atual. Se ele ainda // nao existir, eh criado e depois, vinculado a Thread atual. public static EntityManager getCurrentEntityManager() { EntityManager em = ems.get(); if (em == null) { em = emf.createEntityManager(); ems.set(em); } return em; } }
[ "l.luiza.furtado@hotmail.com" ]
l.luiza.furtado@hotmail.com