blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
0e4a1448fb599d0bc29e346c12cb8a82aba6679f
19263ed5bc56a318a368f0f483082b710afd3ba6
/breadmote/src/main/java/com/cypher/breadmote/Error.java
2bd909b3c55ac0493c8c300bc4ed7958222d4c8a
[ "MIT" ]
permissive
ScottCypher/BreadMote-Android
ba86df36a801f7f87b1b31277d8e3d39e2ce5784
ac5fe2013546f8503686a01164945b257bcb6f09
refs/heads/master
2020-04-10T04:01:53.989647
2017-06-18T03:54:00
2017-06-18T03:54:00
50,319,000
0
0
null
null
null
null
UTF-8
Java
false
false
903
java
package com.cypher.breadmote; import java.util.Date; /** * Represents an error generated by the hardware or by the BreadMote SDK. */ public class Error { private final String tag; private final String message; private final Date timeStamp; /** * @param tag Used to identify the source of the error * @param message The reason for the error. */ public Error(String tag, String message) { this.tag = tag; this.message = message; this.timeStamp = new Date(); } /** * * @return The time this error was created. */ public Date getTimeStamp() { return timeStamp; } /** * * @return The source of the error */ public String getTag() { return tag; } /** * @return The reason for the error */ public String getMessage() { return message; } }
[ "scottcypher14@gmail.com" ]
scottcypher14@gmail.com
5c3f386a0ac522bb6c6c0c6bf0fc29bc0bcff2ef
b4cd197eecd6ebc79efb17e91e2936851a3ec96c
/src/main/java/edu/gslis/temporal/util/ValueComparableMap.java
936a5653f0752d20be0a7937e099136c6c22d599
[]
no_license
craig-willis/temporal
168f6c373c5e40c0d18b26974ed233fafabaffde
45a73c4d8eb17dbddc1effdc380c40e8550bf4aa
refs/heads/master
2020-05-19T15:35:43.350338
2017-10-07T22:51:11
2017-10-07T22:51:11
23,710,436
0
0
null
null
null
null
UTF-8
Java
false
false
1,334
java
package edu.gslis.temporal.util; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; import com.google.common.base.Functions; import com.google.common.collect.Ordering; public class ValueComparableMap<K extends Comparable<K>,V> extends TreeMap<K,V> { //A map for doing lookups on the keys for comparison so we don't get infinite loops private final Map<K, V> valueMap; public ValueComparableMap(final Ordering<? super V> partialValueOrdering) { this(partialValueOrdering, new HashMap<K,V>()); } private ValueComparableMap(Ordering<? super V> partialValueOrdering, HashMap<K, V> valueMap) { super(partialValueOrdering //Apply the value ordering .onResultOf(Functions.forMap(valueMap)) //On the result of getting the value for the key from the map .compound(Ordering.natural())); //as well as ensuring that the keys don't get clobbered this.valueMap = valueMap; } public V put(K k, V v) { if (valueMap.containsKey(k)){ //remove the key in the sorted set before adding the key again remove(k); } valueMap.put(k,v); //To get "real" unsorted values for the comparator return super.put(k, v); //Put it in value order } }
[ "willis8@illinois.edu" ]
willis8@illinois.edu
3cdfb8e5b7d726385e5994f4b8fcecba9f4e2663
4025af4d2bacf3568cfdd55d85573ed26d606236
/mybatis-demo-2018/day02-MyBatis-01/src/main/java/com/moon/mapper/UserMapper.java
831c8c6a879b42cccd32c641f1fec977df484511
[]
no_license
MooNkirA/mybatis-note
f3e1ede680b0f511346a649895ae1bf71c69d616
25e952c13406fd0579750b25089d2cf2b1bdacec
refs/heads/master
2022-03-04T20:11:26.770175
2021-12-18T02:31:10
2021-12-18T02:31:10
223,528,278
0
0
null
2021-12-18T02:31:13
2019-11-23T04:04:03
Java
UTF-8
Java
false
false
926
java
package com.moon.mapper; import java.util.List; import com.moon.entity.QueryVo; import com.moon.entity.User; /** * MyBatis:Mapper动态代理方式开发dao * @author MoonZero */ public interface UserMapper { /** * 根据id查询 */ User findUserById(Integer id); /** * 根据用户名模糊查询 */ List<User> queryUserByCondition(QueryVo queryVo); /** * 插入数据 */ void insertUser(User user); /** * 统计用户数量 */ int countUsers(); /** * 根据用户名称和性别查询用户 */ List<User> queryUserByNameAndSex(User user); /** * 动态更新用户 */ void dynamicUpdateUser(User user); /** * 批量新增用户 */ void batchInsertUsers(List<User> list); /** * 批量删除用户 */ void batchDeleteUsers(Integer[] ids); /** * 查询用户数据,并且关联查询出用户的所有订单数据 */ List<User> queryUsersAndOrders(); }
[ "lje888@126.com" ]
lje888@126.com
74b0ee0eb9720224b483fd350a87b9cc8f8d3a75
ad05ca4744f637cce2b143bcee5d095d61c08c07
/src/main/java/com/devopstools/portal/PortalApplication.java
be671728a8d06ebb795bd3edc37ced0dd655eadf
[]
no_license
pwelagedara/sample
81bd1f26601188dc288fe49fbce0cf3ad79ade0c
2040c4d6681bb7a5531d9e507be151da0633c6cd
refs/heads/master
2020-03-23T13:06:53.283406
2018-07-19T15:50:09
2018-07-19T15:50:09
141,600,803
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.devopstools.portal; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * Created by pubudu on 4/13/18. */ @SpringBootApplication public class PortalApplication { public static void main(String[] args) { SpringApplication.run(PortalApplication.class, args); } }
[ "pubuduwelagedara@gmail.com" ]
pubuduwelagedara@gmail.com
ace218cff1611128fac738e52abe9f743f7e6f12
3c77716112cef47da6fddd6c090292142b26b9ec
/dosirak/src/main/java/com/join/dao/DietDAOImpl.java
c1585b87b840a9efcd38e40b0edb4d0098f03fff
[]
no_license
sumin729/dosirakProject
b3e284fc073331318306f141c704b1908645ea36
ee2871036de36f5280b5afb467d5c8d04160da42
refs/heads/master
2023-02-26T14:27:00.674297
2021-02-01T05:40:58
2021-02-01T05:40:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,212
java
package com.join.dao; import java.util.List; import java.util.Map; import javax.inject.Inject; import org.apache.ibatis.session.SqlSession; import org.springframework.stereotype.Repository; import com.join.dto.FoodCalory; import com.join.dto.UserCalory; @Repository("dietDao") public class DietDAOImpl implements DietDAO { @Inject private SqlSession sqlSession; private static final String Namespace = "com.join.mapper.caloryMapper"; @Override public int setCalory(Map<String, Object> paramMap) { return sqlSession.insert(Namespace+".insertCalory", paramMap); } @Override public List<FoodCalory> getFoodCalory() throws Exception { List<FoodCalory> foodCalory = sqlSession.selectList(Namespace+".selectFoodName"); return foodCalory; } @Override public List<UserCalory> getUserCalory(String param) throws Exception { return sqlSession.selectList(Namespace+".getUserCalory", param); } @Override public UserCalory selectDailyView(Map<String, Object> paramMap) throws Exception { return sqlSession.selectOne(Namespace+".selectdailyView", paramMap); } }
[ "User@DESKTOP-KQEP2CV" ]
User@DESKTOP-KQEP2CV
837912d113fc40e0e37c5b469609cddba8ac39fd
b66d90cbd7fe61f897a66824ded5ed541b89322c
/BridgeUtilities.java
6b86dbd81b575dc39ae14f0af95aefffcca94701
[]
no_license
smulwa/a4Bentley
99ac22f94139820600993645fcc17d3b0d1f91e1
2279ea885408bc6cd27581b15b6daccc1f66111a
refs/heads/master
2021-04-15T05:57:25.259429
2018-03-31T05:29:50
2018-03-31T05:29:50
126,904,077
0
0
null
null
null
null
UTF-8
Java
false
false
1,626
java
public class BridgeUtilities { /* * constructor to ensure no objects of type BridgeUtilities can be created * outside this class */ private BridgeUtilities() { } /* * Iterate through array and return the number of cards that have the input * value */ private static int countValue(Card[] arr, int specificValue) { int numberOfCards = 0; for (int i = 0; i < arr.length; i++) { if (arr[i].getValue() == specificValue) { numberOfCards++; } } return numberOfCards; } /* * Iterate through a given array and return the number of cards the specified * suit */ private static int countSuit(Card[] inputArr, String inputSuit) { int numberOfCards = 0; for (int i = 0; i < inputArr.length; i++) { if (inputArr[i].getSuit().equalsIgnoreCase(inputSuit)) { numberOfCards++; } } return numberOfCards; } public static int countPoints(Card[] arr) { int points = 0; int extra = 0; // determine how many points hand is worth by calling countValue method points += countValue(arr, 1) * 4; points += countValue(arr, 13) * 3; points += countValue(arr, 12) * 2; points += countValue(arr, 11) * 1; // determine extra points that the hand is worth if (countSuit(arr, "hearts") > 4) { extra += countSuit(arr, "hearts") - 4; } if (countSuit(arr, "spades") > 4) { extra += countSuit(arr, "spades") - 4; } if (countSuit(arr, "clubs") > 4) { extra += countSuit(arr, "clubs") - 4; } if (countSuit(arr, "diamonds") > 4) { extra += countSuit(arr, "diamonds") - 4; } // overall points that a hand is worth return (points + extra); } }
[ "35940989+smulwa@users.noreply.github.com" ]
35940989+smulwa@users.noreply.github.com
409d817a4ba72aa8f3685c2a4b706ec678ee1461
4dca4a02d16197b5683c924e748fb9cb34481f36
/src/main/java/cn/touchmedia/sean/dualscreen/InMemoryMessageRepository.java
da0e16417fd98f1de51d64cd076185787aab3f5e
[]
no_license
elesteel/dual-screen
0560cd7824ebb0c4b63f4c7cf6d98c9d2c1c1434
330c41f43ea5f283d27cb80d0afce10f62fa7dc8
refs/heads/master
2016-09-06T21:26:40.126125
2015-04-14T07:10:23
2015-04-14T07:10:23
33,715,226
0
0
null
null
null
null
UTF-8
Java
false
false
668
java
package cn.touchmedia.sean.dualscreen; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import org.springframework.stereotype.Repository; @Repository public class InMemoryMessageRepository implements MessageRepository { BlockingQueue<String> messages = new LinkedBlockingQueue<String>(); @Override public String getMessage() { try { return messages.take(); } catch ( InterruptedException e ) { throw new RuntimeException(e); } } @Override public void addMessage(String message) { try { messages.put(message); } catch ( InterruptedException e ) { throw new RuntimeException(e); } } }
[ "elesteel@gmial.com" ]
elesteel@gmial.com
a15d69cc79289037e521402eb87c66ffeb820574
5d42d0fb4eb9f9d9cbc546446d38c996ff15da8b
/src/main/java/org/practise/algorithm/leetcode/design/MyHashMap.java
fe19fe47c757c4cb045ced31f3c7993c497d5a1b
[]
no_license
aarthiarun/algorithm
52bd42b4d3b9a6eea23b12af10fa43700d326e7a
e35bac371ed0fffb12a1caffd78a7f71a7d2cd82
refs/heads/master
2023-06-08T13:50:22.364536
2019-01-13T17:48:29
2019-01-13T17:48:29
151,794,626
0
1
null
2023-03-09T08:10:32
2018-10-06T01:32:33
Java
UTF-8
Java
false
false
1,945
java
package org.practise.algorithm.leetcode.design; import java.util.Iterator; import java.util.LinkedList; public class MyHashMap { private LinkedList<Node>[] nodes; /** Initialize your data structure here. */ public MyHashMap() { nodes = new LinkedList[10000]; } /** value will always be non-negative. */ public void put(int key, int value) { int index = findIndex(key); if (nodes[index] == null) { nodes[index] = new LinkedList<>(); } boolean notUpdated = true; for (Node node : nodes[index]) { if (node.key == key) { node.value = value; notUpdated = false; } } if (notUpdated) { nodes[index].offer(new Node(key, value)); } } private int findIndex(int key) { return Integer.hashCode(key) % nodes.length; } /** Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */ public int get(int key) { int index = findIndex(key); if (nodes[index] == null) return -1; for (Node node : nodes[index]) { if (node.key == key) { return node.value; } } return -1; } /** Removes the mapping of the specified value key if this map contains a mapping for the key */ public void remove(int key) { int index = findIndex(key); if (nodes[index] == null) return; Iterator iterator = nodes[index].iterator(); while (iterator.hasNext()) { Node node = (Node) iterator.next(); if (node.key == key) { iterator.remove(); break; } } } class Node { int key; int value; public Node(int key, int value) { this.key = key; this.value = value; } } }
[ "arunmohzi@oath.com" ]
arunmohzi@oath.com
ad9f229aaee885493f7c058c5a4dbd9836ace1a0
d70a85ce8ad5f8979efe5c5ac0a7787f6db6e643
/src/main/java/leetCodeTest/PalindromeNumber.java
13ee60c4a34041cf66a9129e995dd8c5418817ae
[]
no_license
MacMargo/CodeTest
894a5f10fe43535cdbd1f8276a571a516e4318ed
8941d177975e6bf766166c707850a7c657db66ff
refs/heads/master
2022-06-21T23:42:58.325313
2019-12-01T11:48:54
2019-12-01T11:48:54
99,217,216
0
0
null
2022-06-17T02:05:00
2017-08-03T09:46:37
Java
UTF-8
Java
false
false
1,063
java
package leetCodeTest; /** * @author maniansheng * @date 2019/6/30 * @description 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 * <p> * 示例 1: * <p> * 输入: 121 * 输出: true * 示例 2: * <p> * 输入: -121 * 输出: false * 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 * 示例 3: * <p> * 输入: 10 * 输出: false * 解释: 从右向左读, 为 01 。因此它不是一个回文数。 * 进阶: * <p> * 你能不将整数转为字符串来解决这个问题吗? * 取余,负数肯定不是 * <p> **/ public class PalindromeNumber { public boolean isPalindrome(int x) { // 如果是负数,肯定不是 if (x < 0) { return false; } long org = x; long reverse = 0; while (x / 10 != 0 || x % 10 != 0) { reverse = reverse * 10 + x % 10; x /= 10; } return reverse == org; } }
[ "MacMargo@163.com" ]
MacMargo@163.com
7bebd6a68ee60e71fd1048ec3b982e3db977a800
5649995d64e448b028abfd53d9e57aaa22a346cc
/EcoCicle/app/src/main/java/com/e2g/ecocicle/LoginFragment.java
91da59ed390327a30850a72717f0e5817a7fe8fb
[]
no_license
global-urban-datafest/Eco2Cycle
bb7d559a784eee50788c79ad330a1c86496c8bd6
ad07fee0dd034aebe1ee90896600b555b3d7e77c
refs/heads/master
2021-01-23T12:18:04.969262
2015-03-23T00:28:40
2015-03-23T00:28:40
31,785,272
1
1
null
null
null
null
UTF-8
Java
false
false
6,008
java
package com.e2g.ecocicle; import android.content.Context; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.e2g.ecocicle.Model.Client; import com.e2g.ecocicle.Util.Main; import com.e2g.ecocicle.WebService.WebServiceCliente; import com.google.gson.Gson; /** * Created by tigrao on 09/03/15. */ public class LoginFragment extends Fragment implements View.OnClickListener{ //Configurações globais so sistema public static final String URL_PREF = "LoginFragment"; private SharedPreferences prefMain; private SharedPreferences.Editor editor; private View rootView; private Fragment fragment; private FragmentManager fragmentManager; public LoginFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_login, container, false); rootView.setFocusableInTouchMode(true); rootView.requestFocus(); rootView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK){ ((Mapa)getActivity()).changeMenuLateral(""); return true; }else if(keyCode == KeyEvent.KEYCODE_MENU){ ((Mapa)getActivity()).abreFechaMenu(); return true; }else{ return false; } } }); (rootView.findViewById(R.id.frag_btn_entrar)).setOnClickListener(this); (rootView.findViewById(R.id.btn_cadastra)).setOnClickListener(this); (rootView.findViewById(R.id.btn_cancelar)).setOnClickListener(this); fragment = new Fragment(); fragmentManager = getActivity().getSupportFragmentManager(); return rootView; } @Override public void onClick(View v) { switch (v.getId()){ case R.id.frag_btn_entrar: tentarLogin(); break; case R.id.btn_cadastra: Fragment fragmentCadastro = new CadastroFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragmentCadastro).commit(); break; case R.id.btn_cancelar: ((Mapa)getActivity()).changeMenuLateral(""); //fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); break; } } private void tentarLogin(){ TextView textLogin = (TextView) rootView.findViewById(R.id.fragEditLogin); TextView textSenha = (TextView) rootView.findViewById(R.id.fragEditSenha); if(textSenha.getText().toString().equals("") || textLogin.getText().toString().equals("")){ Toast.makeText(getActivity(), "Fill out all fields!", Toast.LENGTH_LONG).show(); }else{ InputMethodManager imm = (InputMethodManager) getActivity().getSystemService( Context.INPUT_METHOD_SERVICE ); imm.hideSoftInputFromWindow(textSenha.getWindowToken(), 0); new RecuperaLogin(textSenha.getText().toString(), textLogin.getText().toString()).execute(); } } class RecuperaLogin extends AsyncTask<Void, Void, Client> { private String login; private String senha; RecuperaLogin(String senha, String login) { this.senha = senha; this.login = login; } @Override protected Client doInBackground(Void... params) { String url = "http://ecocicle.mybluemix.net/api/client/login"; Client cliente = new Client(senha,login); Gson gson = new Gson(); String clienteJson = gson.toJson(cliente); String respota[] = new WebServiceCliente().post(url, clienteJson); Client clientPopulace = null; if(respota[0].equals("200")){ clientPopulace = gson.fromJson(respota[1], Client.class); } return clientPopulace; } @Override protected void onPostExecute(Client client) { if(client == null || client.getIdCliente() == 0){ Toast.makeText(getActivity(), "User or password is incorrect!", Toast.LENGTH_LONG).show(); }else{ /* preferencias da Activity... */ ((Main)getActivity().getApplication()).setUsuarioNaApp(client); prefMain = getActivity().getSharedPreferences(URL_PREF, Context.MODE_PRIVATE); editor = prefMain.edit(); String login = prefMain.getString("login", ""); String senha = prefMain.getString("senha", ""); if (login.equals("")) editor.putString("login", client.getLogin().toString()); if (senha.equals("")) editor.putString("senha", client.getPass().toString()); editor.commit(); //((Main)getActivity().getApplication()).setUsuarioNaApp(client); Toast.makeText(getActivity(), "Welcome, " + client.getName() + "!", Toast.LENGTH_LONG).show(); ((Mapa)getActivity()).changeMenuLateral(client.getName()); //fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); } } } }
[ "adams.lucass@gmail.com" ]
adams.lucass@gmail.com
1355e09f869ce73c8cea7b069cb71452cea37fa2
12a4cc462a35c0dd0e1229a9c9618c64a7f7a932
/app/src/main/java/com/abhishek/saveropedia/model/story/UserDetailModel.java
21ab4d54aff204aa6f1704e43bfa0fd3a3c59e19
[]
no_license
abhishek-120902/saveropedia
cef310488d5a5f2005719e07bf3d867f5698ab05
cdfc9a948ab5420ba795d48b623c3ba0d31b4035
refs/heads/master
2023-06-18T15:16:53.607002
2021-07-16T10:06:50
2021-07-16T10:06:50
386,588,436
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.abhishek.saveropedia.model.story; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class UserDetailModel implements Serializable { @SerializedName("user") private User user; public User getUser() { return user; } public void setUser(User user) { this.user = user; } }
[ "abhi120902@gmail.com" ]
abhi120902@gmail.com
75788f3ccd50ce43aa9941f4e31405f0b9f104f3
b1438078879a3709c973ac3dcf6a5acaff805919
/customer/food_delivering_app/app/src/main/java/com/perfresh/food_delivering_app/fragments/home_fragment.java
53c5b4c987d526e34f1bcf6353cd8d209fd3d5e4
[]
no_license
rk891014/PerfreshApp
70c3a4ace2b06a7cfedfe66985ca6e8d7b8d02ff
3d176e85ce4c50822dc4e117022b335bd17f39ed
refs/heads/master
2022-12-11T08:13:45.511586
2020-09-17T08:36:34
2020-09-17T08:36:34
296,265,808
0
0
null
null
null
null
UTF-8
Java
false
false
15,252
java
package com.perfresh.food_delivering_app.fragments; import android.content.ActivityNotFoundException; import android.content.Intent; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.provider.Settings; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupMenu; import android.widget.TextView; import com.perfresh.food_delivering_app.BuildConfig; import com.perfresh.food_delivering_app.R; import com.Perfresh.food_delivering_app.adapter.MyAdapter2; import com.perfresh.food_delivering_app.activities.AboutUsActivity; import com.perfresh.food_delivering_app.activities.AppReviewActivity; import com.perfresh.food_delivering_app.activities.MainActivity; import com.perfresh.food_delivering_app.adapter.MyAdapter; import com.perfresh.food_delivering_app.adapter.SliderAdapterperfresh; import com.perfresh.food_delivering_app.model.Model; import com.perfresh.food_delivering_app.model.Model2; import com.perfresh.food_delivering_app.model.SliderItem; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.smarteist.autoimageslider.IndicatorView.animation.type.IndicatorAnimationType; import com.smarteist.autoimageslider.IndicatorView.draw.controller.DrawController; import com.smarteist.autoimageslider.SliderAnimations; import com.smarteist.autoimageslider.SliderView; import com.smarteist.autoimageslider.SliderViewAdapter; import java.util.ArrayList; import java.util.Collections; public class home_fragment extends Fragment { TextView category,popular; RecyclerView recyclerView; RecyclerView recyclerView2; DatabaseReference reference; CardView cardro; StorageReference mStorageref; ArrayList<Model> imageList = new ArrayList<>(); ArrayList<Model2> popularlist = new ArrayList<>(); ArrayList<SliderItem> centerImagelist = new ArrayList<>(); ImageView showpopup; LinearLayout card1; PopupMenu popup; CardView card2; TextView contactno2,itemnottaken; SliderView sliderView; String DeviceID; TextView homeaddres,buddy; public home_fragment() {} @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fragment_home_fragment, container, false); recyclerView = view.findViewById(R.id.rv); recyclerView2 = view.findViewById(R.id.rv2); category = view.findViewById(R.id.categories); popular = view.findViewById(R.id.popular); card1=view.findViewById(R.id.card1); showpopup=view.findViewById(R.id.showPopup); cardro=view.findViewById(R.id.cardro); cardro.setVisibility(View.GONE); card2=view.findViewById(R.id.card2); homeaddres=view.findViewById(R.id.homeaddress); buddy=view.findViewById(R.id.buddy); itemnottaken=view.findViewById(R.id.itemnottaken); sliderView = view.findViewById(R.id.imageSlider); contactno2=view.findViewById(R.id.contactno2); DeviceID = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); reference = FirebaseDatabase.getInstance().getReference(); reference.keepSynced(true); recyclerView.setHasFixedSize(true); recyclerView2.setHasFixedSize(true); // recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); recyclerView.setLayoutManager(new GridLayoutManager(getContext(),3)); recyclerView2.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); mStorageref = FirebaseStorage.getInstance().getReference(); imageList = new ArrayList<>(); popularlist=new ArrayList<>(); centerImagelist=new ArrayList<>(); init(); init2(); initprofile(); initpopular(); safetyimagequery(); showpopup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popup = new PopupMenu(getContext(), v); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.menu, popup.getMenu()); showMenu(v); } }); card1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((MainActivity)getActivity()).setCurrentItem (3, true); } }); card2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((MainActivity)getActivity()).setCurrentItem (1, true); } }); if(!MainActivity.itemnottaken.equals("")){ itemnottaken.setText(MainActivity.itemnottaken); cardro.setVisibility(View.VISIBLE); } return view; } public void showMenu(View v) { popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.appreviews: Intent i=new Intent(getContext(), AppReviewActivity.class); startActivity(i); return true; case R.id.call: dialContactPhone(contactno2.getText().toString()); return true; case R.id.share: try { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); String s=homeaddres.getText().toString(); String[] parts1 = s.split("-"); String part1 = parts1[1]; shareIntent.putExtra(Intent.EXTRA_SUBJECT, "My application name"); String message="We are Purfresh, delivering veggies, groceries, dairy products, ice cream, chocolate, cake, " + "with in 30 mins to your home. Hope this helps.\n Stay in. Stay safe.\n\n"; String shareMessage=message+ "\nLet me recommend you this application\n"; shareMessage = shareMessage + "https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID +"\n\n" +"Coupon Code : "+part1+"\n\n"+" copy this code to get coins"+"\n\n"; shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage); startActivity(Intent.createChooser(shareIntent, "choose one")); } catch(Exception e) { ((MainActivity)getActivity()).setCurrentItem (3, true); } return true; case R.id.rate: try{ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+BuildConfig.APPLICATION_ID))); } catch (ActivityNotFoundException e){ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+BuildConfig.APPLICATION_ID))); } return true; case R.id.aboutus: Intent intent=new Intent(getContext(), AboutUsActivity.class); startActivity(intent); return true; default: return false; } } }); popup.show(); } private void dialContactPhone(final String phoneNumber) { startActivity(new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", phoneNumber, null))); } private void safetyimagequery(){ DatabaseReference query2 = FirebaseDatabase.getInstance().getReference("whole"); query2.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { String categorii=dataSnapshot.child("category").getValue().toString(); category.setText(categorii); String popu=dataSnapshot.child("popular").getValue().toString(); popular.setText(popu); String contactnoo=dataSnapshot.child("contactno").getValue().toString(); contactno2.setText(contactnoo); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("ErrorTAG", "loadPost:onCancelled", databaseError.toException()); } }); } private void initprofile() { clearAll(); DatabaseReference query3 = FirebaseDatabase.getInstance().getReference("customer detail").child(DeviceID); query3.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.exists()) { String addres = dataSnapshot.child("address").getValue().toString(); String mobileno = dataSnapshot.child("mobileno").getValue().toString(); homeaddres.setText(addres + " - " + mobileno); String names = dataSnapshot.child("name").getValue().toString(); buddy.setText(names); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("ErrorTAG", "loadPost:onCancelled", databaseError.toException()); } }); } private void init2() { clearAll(); DatabaseReference query = FirebaseDatabase.getInstance().getReference("centerimage"); query.addValueEventListener( new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { centerImagelist.clear(); for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { SliderItem modelll = postSnapshot.getValue(SliderItem.class); centerImagelist.add(modelll); } SliderViewAdapter adapter=new SliderAdapterperfresh(getContext(),centerImagelist,getActivity()); sliderView.setSliderAdapter(adapter); sliderView.setIndicatorAnimation(IndicatorAnimationType.WORM); //set indicator animation by using SliderLayout.IndicatorAnimations. :WORM or THIN_WORM or COLOR or DROP or FILL or NONE or SCALE or SCALE_DOWN or SLIDE and SWAP!! sliderView.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION); sliderView.setAutoCycleDirection(SliderView.AUTO_CYCLE_DIRECTION_BACK_AND_FORTH); sliderView.setIndicatorSelectedColor(Color.WHITE); sliderView.setIndicatorUnselectedColor(Color.GRAY); sliderView.setScrollTimeInSec(3); sliderView.setAutoCycle(true); sliderView.startAutoCycle(); sliderView.setOnIndicatorClickListener(new DrawController.ClickListener() { @Override public void onIndicatorClicked(int position) { Log.i("GGG", "onIndicatorClicked: " + sliderView.getCurrentPagePosition()); } }); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { // Getting Post failed, log a message Log.e("ErrorTAG", "loadPost:onCancelled", databaseError.toException()); } }); } private void init() { clearAll(); DatabaseReference query = FirebaseDatabase.getInstance().getReference("profiles"); query.addValueEventListener( new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { imageList.clear(); for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { Model model = postSnapshot.getValue(Model.class); imageList.add(model); } MyAdapter adapter=new MyAdapter(imageList,getContext()); Collections.reverse(imageList); recyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { // Getting Post failed, log a message Log.e("ErrorTAG", "loadPost:onCancelled", databaseError.toException()); } }); } private void clearAll() { if(imageList!=null){ imageList.clear(); } imageList = new ArrayList<>(); } private void initpopular() { DatabaseReference query = FirebaseDatabase.getInstance().getReference("popular"); query.addValueEventListener( new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { popularlist.clear(); for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { Model2 model2 = postSnapshot.getValue(Model2.class); popularlist.add(model2); } MyAdapter2 adapter2=new MyAdapter2(popularlist,getContext()); Collections.reverse(popularlist); recyclerView2.setAdapter(adapter2); adapter2.notifyDataSetChanged(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { // Getting Post failed, log a message Log.e("ErrorTAG", "loadPost:onCancelled", databaseError.toException()); } }); } }
[ "rkrjptrohit@gmail.com" ]
rkrjptrohit@gmail.com
21333f8a5d5c7f09bf5ff0e7cc9aa8430df30e16
02037e7f1d53edae78681211237220f4cf8e3965
/aws-service/StockerCloud/src/main/java/com/stockercloud/aws/item/ValidationException.java
d2636d67679cb5dc7af59e91f2943e196cf80f1f
[]
no_license
ryanxie0/stocker-cloud
995732326bac2c862671b89a9c7a54ece289aa10
f80436bff9080f1249225d0579e9709932347347
refs/heads/master
2020-04-05T01:58:46.457736
2018-12-14T02:44:45
2018-12-14T02:44:45
156,114,233
0
0
null
2018-11-05T20:48:18
2018-11-04T18:54:33
Java
UTF-8
Java
false
false
168
java
package com.stockercloud.aws.item; public class ValidationException extends RuntimeException { public ValidationException(String message) { super(message); } }
[ "chickenfeet300@gmail.com" ]
chickenfeet300@gmail.com
837ab1f769b8e591593f2ee2d66a0530d7fb1855
cda3816a44e212b52fdf1b9578e66a4543445cbb
/trunk/Src/l2next/gameserver/templates/item/WeaponTemplate.java
a03e1db8d25d54c6317076eaefed19308a7adff5
[]
no_license
gryphonjp/L2J
556d8b1f24971782f98e1f65a2e1c2665a853cdb
003ec0ed837ec19ae7f7cf0e8377e262bf2d6fe4
refs/heads/master
2020-05-18T09:51:07.102390
2014-09-16T14:25:06
2014-09-16T14:25:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,692
java
package l2next.gameserver.templates.item; import l2next.gameserver.stats.Stats; import l2next.gameserver.stats.funcs.FuncTemplate; import l2next.gameserver.templates.StatsSet; public final class WeaponTemplate extends ItemTemplate { private final int _soulShotCount; private final int _spiritShotCount; private final int _kamaelConvert; private final int _rndDam; private final int _atkReuse; private final int _mpConsume; private int _critical; public enum WeaponType implements ItemType { NONE(1, "Shield", null), SWORD(2, "Sword", Stats.SWORD_WPN_VULNERABILITY), BLUNT(3, "Blunt", Stats.BLUNT_WPN_VULNERABILITY), DAGGER(4, "Dagger", Stats.DAGGER_WPN_VULNERABILITY), BOW(5, "Bow", Stats.BOW_WPN_VULNERABILITY), POLE(6, "Pole", Stats.POLE_WPN_VULNERABILITY), ETC(7, "Etc", null), FIST(8, "Fist", Stats.FIST_WPN_VULNERABILITY), DUAL(9, "Dual Sword", Stats.DUAL_WPN_VULNERABILITY), DUALFIST(10, "Dual Fist", Stats.FIST_WPN_VULNERABILITY), BIGSWORD(11, "Big Sword", Stats.SWORD_WPN_VULNERABILITY), // Two // Handed // Swords PET(12, "Pet", Stats.FIST_WPN_VULNERABILITY), ROD(13, "Rod", null), BIGBLUNT(14, "Big Blunt", Stats.BLUNT_WPN_VULNERABILITY), CROSSBOW(15, "Crossbow", Stats.CROSSBOW_WPN_VULNERABILITY), RAPIER(16, "Rapier", Stats.DAGGER_WPN_VULNERABILITY), ANCIENTSWORD(17, "Ancient Sword", Stats.SWORD_WPN_VULNERABILITY), // Kamael // 2h // sword DUALDAGGER(18, "Dual Dagger", Stats.DAGGER_WPN_VULNERABILITY), DUALBLUNT(19, "Dual Blunt", null); public final static WeaponType[] VALUES = values(); private final long _mask; private final String _name; private final Stats _defence; private WeaponType(int id, String name, Stats defence) { _mask = 1L << id; _name = name; _defence = defence; } @Override public long mask() { return _mask; } public Stats getDefence() { return _defence; } @Override public String toString() { return _name; } } public WeaponTemplate(StatsSet set) { super(set); type = set.getEnum("type", WeaponType.class); _soulShotCount = set.getInteger("soulshots", 0); _spiritShotCount = set.getInteger("spiritshots", 0); _kamaelConvert = set.getInteger("kamael_convert", 0); _rndDam = set.getInteger("rnd_dam", 0); _atkReuse = set.getInteger("atk_reuse", type == WeaponType.BOW ? 1500 : type == WeaponType.CROSSBOW ? 820 : 0); _mpConsume = set.getInteger("mp_consume", 0); if(getItemType() == WeaponType.NONE) { _type1 = TYPE1_SHIELD_ARMOR; _type2 = TYPE2_SHIELD_ARMOR; } else { _type1 = TYPE1_WEAPON_RING_EARRING_NECKLACE; _type2 = TYPE2_WEAPON; } if(getItemType() == WeaponType.PET) { _type1 = ItemTemplate.TYPE1_WEAPON_RING_EARRING_NECKLACE; if(_bodyPart == ItemTemplate.SLOT_WOLF) { _type2 = ItemTemplate.TYPE2_PET_WOLF; } else if(_bodyPart == ItemTemplate.SLOT_GWOLF) { _type2 = ItemTemplate.TYPE2_PET_GWOLF; } else if(_bodyPart == ItemTemplate.SLOT_HATCHLING) { _type2 = ItemTemplate.TYPE2_PET_HATCHLING; } else { _type2 = ItemTemplate.TYPE2_PET_STRIDER; } _bodyPart = ItemTemplate.SLOT_R_HAND; } } /** * Returns the type of Weapon * * @return L2WeaponType */ @Override public WeaponType getItemType() { return (WeaponType) type; } /** * Returns the ID of the Etc item after applying the mask. * * @return int : ID of the Weapon */ @Override public long getItemMask() { return getItemType().mask(); } /** * Returns the quantity of SoulShot used. * * @return int */ public int getSoulShotCount() { return _soulShotCount; } /** * Returns the quatity of SpiritShot used. * * @return int */ public int getSpiritShotCount() { return _spiritShotCount; } public int getCritical() { return _critical; } /** * Returns the random damage inflicted by the weapon * * @return int */ public int getRandomDamage() { return _rndDam; } /** * Return the Attack Reuse Delay of the L2Weapon.<BR> * <BR> * * @return int */ public int getAttackReuseDelay() { return _atkReuse; } /** * Returns the MP consumption with the weapon * * @return int */ public int getMpConsume() { return _mpConsume; } /** * Возвращает разницу между длиной этого оружия и стандартной, то есть x-40 */ public int getAttackRange() { switch(getItemType()) { case BOW: return 460; case CROSSBOW: return 360; case POLE: return 40; default: return 0; } } @Override public void attachFunc(FuncTemplate f) { // TODO для параметров set с дп,может считать стат с L2ItemInstance? // (VISTALL) if(f._stat == Stats.CRITICAL_BASE && f._order == 0x08) { _critical = (int) Math.round(f._value / 10); } super.attachFunc(f); } public int getKamaelConvert() { return _kamaelConvert; } public final SoulshotGrade getSoulshotGradeForItem() { switch(getItemGrade()) { case NONE: return SoulshotGrade.SS_NG; case D: return SoulshotGrade.SS_D; case C: return SoulshotGrade.SS_C; case B: return SoulshotGrade.SS_B; case A: return SoulshotGrade.SS_A; case S: case S80: case S84: return SoulshotGrade.SS_S; case R: case R95: case R99: return SoulshotGrade.SS_R; } return SoulshotGrade.SS_NG; } }
[ "tuningxtreme@108c6750-40d5-47c8-815d-bc471747907c" ]
tuningxtreme@108c6750-40d5-47c8-815d-bc471747907c
864682cea52d1fe7967d7e1b36bdf04d97abea42
0d8e9b6a62ea5b796836fcde413a5566cf37998a
/src/entity/UniversityClass.java
2c866f6ca8cd56e34afa21691c06fedc432e73bc
[ "MIT" ]
permissive
igorpapr/CSP_university_schedule_maker
d30d990d7b691d160bf5aaf86faefa757876601b
6719f3c5645e2f1666abd4feda0e63c3693d2c73
refs/heads/main
2023-01-07T02:41:14.165541
2020-11-09T13:42:39
2020-11-09T13:42:39
307,828,828
0
0
null
null
null
null
UTF-8
Java
false
false
4,857
java
package entity; import java.util.*; import java.util.stream.Collectors; //means university class (a.k.a lesson) public class UniversityClass { private final UUID uuid; private Subject subject; private ScheduleSlot scheduleSlot; private List<ScheduleSlot> availableSlots; private boolean isLection; private Teacher teacher; private HashSet<Student> students = new HashSet<>(); //The list of connected univ classes to the current by common teachers or students private List<UniversityClass> neighbors; private final Map<UUID, List<ScheduleSlot>> removedByForwardCheckingValuesMap; public UniversityClass(Subject subject, boolean isLection, Teacher teacher, List<Student> students) { this.uuid = UUID.randomUUID(); this.subject = subject; this.isLection = isLection; this.teacher = teacher; this.students.addAll(students); this.neighbors = new LinkedList<>(); this.availableSlots = new ArrayList<>(); this.removedByForwardCheckingValuesMap = new HashMap<>(); } public List<ScheduleSlot> getAvailableSlots() { return availableSlots; } public void setAvailableSlots(List<ScheduleSlot> availableSlots) { this.availableSlots = availableSlots; } public List<UniversityClass> getNeighbors() { return neighbors; } public void setNeighbors(List<UniversityClass> neighbors) { this.neighbors = neighbors; } public ScheduleSlot getScheduleSlot() { return scheduleSlot; } public void setScheduleSlot(ScheduleSlot scheduleSlot) { this.scheduleSlot = scheduleSlot; } public Subject getSubject() { return subject; } public void setSubject(Subject subject) { this.subject = subject; } public ClassTime getClassTime() { if(this.scheduleSlot != null) return this.scheduleSlot.classTime; return null; } public DayOfTheWeek getDayOfTheWeek() { if (this.scheduleSlot != null) return this.scheduleSlot.dayOfTheWeek; return null; } public UUID getUuid() { return uuid; } public boolean isLection() { return isLection; } public void setLection(boolean lection) { isLection = lection; } public Teacher getTeacher() { return teacher; } public void setTeacher(Teacher teacher) { this.teacher = teacher; } public Set<Student> getStudents() { return students; } public void setStudents(Collection<Student> students) { this.students.addAll(students); } public Classroom getClassroom() { if(this.scheduleSlot != null){ return this.scheduleSlot.classroom; } return null; } public boolean isAssigned(){ return this.scheduleSlot != null; } public void setStudents(HashSet<Student> students) { this.students = students; } public Map<UUID, List<ScheduleSlot>> getRemovedByForwardCheckingValuesMap() { return removedByForwardCheckingValuesMap; } /** * removes value from available values list * @param value to remove */ public void removeFromAvailableValues(ScheduleSlot value){ this.setAvailableSlots( this.getAvailableSlots().stream().filter( v -> !v.equals(value)).collect(Collectors.toList() ) ); } /** * Checks if there are any values that are conflicting by the time to the given value * @param value - given value * @return - True - if the conflicting by the time values are present in the available slots list */ public boolean checkPresenceOfRestrictingValues(ScheduleSlot value){ for (ScheduleSlot slot : availableSlots) { return (!slot.classTime.equals(value.classTime) || slot.dayOfTheWeek.equals(value.dayOfTheWeek)); //if(slot.classTime.equals(value.classTime) && slot.dayOfTheWeek.equals(value.dayOfTheWeek)) // return true; } return false; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UniversityClass that = (UniversityClass) o; return isLection == that.isLection && Objects.equals(subject, that.subject) && Objects.equals(scheduleSlot, that.scheduleSlot) && Objects.equals(availableSlots, that.availableSlots) && Objects.equals(teacher, that.teacher) && Objects.equals(students, that.students) && Objects.equals(neighbors, that.neighbors); } @Override public int hashCode() { return Objects.hash(subject, scheduleSlot, availableSlots, isLection, teacher, students); } @Override public String toString() { String res = "Lesson [\n" + (isLection ? " LECTION " : " PRACTICE ") + "\n" + subject; if (this.scheduleSlot != null){ //res += " | ClassTime=" + this.scheduleSlot.classTime; //res += " | DayOfTheWeek=" + this.scheduleSlot.dayOfTheWeek; res += "\nClassroom = " + this.scheduleSlot.classroom; }else { res += " | {The value of time,day and classroom is not assigned yet}"; } res += "\nTeacher: " + teacher + "\nStudents: " + students + "]"; return res; } }
[ "igorpapr@gmail.com" ]
igorpapr@gmail.com
923ef488b946d935133d9a6fe9524815d3239301
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
/Code Snippet Repository/Hibernate/Hibernate3156.java
61a80b7bcef609176b1fb33a20a7a2e92841da10
[]
no_license
saber13812002/DeepCRM
3336a244d4852a364800af3181e03e868cf6f9f5
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
refs/heads/master
2023-03-16T00:08:06.473699
2018-04-18T05:29:50
2018-04-18T05:29:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
@Override public QueryImplementor createQuery(CriteriaUpdate criteriaUpdate) { checkOpen(); try { return criteriaCompiler().compile( (CompilableCriteria) criteriaUpdate ); } catch ( RuntimeException e ) { throw exceptionConverter.convert( e ); } }
[ "Qing.Mi@my.cityu.edu.hk" ]
Qing.Mi@my.cityu.edu.hk
fbcb62f71e12dfc269723975699f7f45c236d1a6
c5a3c6d763b70f2fe229b5decb861789996f83fd
/groo/src/main/java/com/chiralBehaviors/groo/configuration/ChakaalConfiguration.java
169eb63b0d6f7b23a04be1f5d10bdc0a67ac5911
[ "Apache-2.0" ]
permissive
ChiralBehaviors/Groo
16d6c44cd70c6b735526e284b85c381aa5bdcd6d
8361deca66b15ed017c2bc3aa759b98a78cd4bbe
refs/heads/master
2020-05-17T23:09:23.761594
2014-12-12T23:52:32
2014-12-12T23:52:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,556
java
/* * (C) Copyright 2014 Chiral Behaviors, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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.chiralBehaviors.groo.configuration; import java.io.IOException; import java.io.InputStream; import java.lang.management.ManagementFactory; import java.util.Collections; import java.util.List; import java.util.Map; import javax.management.InstanceAlreadyExistsException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; import javax.security.auth.Subject; import com.chiralBehaviors.disovery.configuration.DiscoveryModule; import com.chiralBehaviors.groo.Chakaal; import com.chiralBehaviors.groo.Groo; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.hellblazer.slp.InvalidSyntaxException; import com.hellblazer.slp.ServiceScope; import com.hellblazer.slp.config.ServiceScopeConfiguration; /** * @author hhildebrand * */ public class ChakaalConfiguration { public static ChakaalConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(new DiscoveryModule()); return mapper.readValue(yaml, ChakaalConfiguration.class); } public String chakaalName = "com.chiralBehaviors.groo:type=chakaal"; public ServiceScopeConfiguration discovery; public GrooConfiguration groo = new GrooConfiguration(); public String grooName = "com.chiralBehaviors.groo:type=groo"; public List<String> queries = Collections.emptyList(); public Map<String, String> serviceQueries = Collections.emptyMap(); public List<String> services = Collections.emptyList(); public Map<String, ?> sourceMap; public Subject subject; public Chakaal construct() throws Exception { return construct(ManagementFactory.getPlatformMBeanServer()); } public Chakaal construct(MBeanServer mbs) throws Exception { return construct(mbs, groo.construct(), subject); } public Chakaal construct(MBeanServer mbs, Groo groo, Subject subject) throws Exception { ServiceScope scope = discovery.construct(); scope.start(); return construct(mbs, groo, subject, scope); } public Chakaal construct(MBeanServer mbs, Groo groo, Subject subject, ServiceScope scope) throws InvalidSyntaxException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, MalformedObjectNameException { Chakaal chakaal = new Chakaal(groo, scope, sourceMap, subject); for (String service : services) { chakaal.listenForService(service); } for (String query : queries) { chakaal.listenFor(query); } for (Map.Entry<String, String> entry : serviceQueries.entrySet()) { chakaal.listenForService(entry.getKey(), entry.getValue()); } mbs.registerMBean(groo, ObjectName.getInstance(grooName)); mbs.registerMBean(chakaal, ObjectName.getInstance(chakaalName)); return chakaal; } }
[ "hellblazer@me.com" ]
hellblazer@me.com
2141b878588aeb519c9cab89a798cc478d8fe3ae
00d6b8240283d4108232e1407d495d21bef1664b
/src/cl/blueprintsit/apps/mediaman/launcher/MediaProcessor.java
cabea8c678409e0284ea8f0edbe70b6423780659
[]
no_license
afarias/mediamanager
cb36c2ed8c8c2ca992e283e6ea3ece27ccc6cda3
fee172c69c50111181b7ef5cc32871db3fb56d45
refs/heads/master
2021-01-22T06:11:07.948371
2017-12-31T17:43:51
2017-12-31T17:43:51
92,526,234
0
0
null
null
null
null
UTF-8
Java
false
false
1,751
java
package cl.blueprintsit.apps.mediaman.launcher; import cl.blueprintsit.apps.mediaman.MediaManager; import cl.blueprintsit.apps.mediaman.analyser.DateConsolidator; import cl.blueprintsit.apps.mediaman.mediaitem.MediaFactory; import cl.blueprintsit.apps.mediaman.mediaitem.MediaItem; import cl.blueprintsit.utils.TagUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.swing.*; import java.io.File; import static javax.swing.JFileChooser.DIRECTORIES_ONLY; /** * This class aims to provide a program for searching media in a given folder */ public class MediaProcessor extends JPanel { private static final Logger logger = LoggerFactory.getLogger(MediaProcessor.class); public static void main(String[] args) { /* The library is created */ TagUtils tagUtils = new TagUtils("[", "]"); MediaItem library = new MediaFactory(tagUtils).createMedia(new File("/Volumes/Andres HD/"), tagUtils); logger.info("Media Processor Started!"); /* Let's consolidate the dates */ MediaManager manager = new MediaManager(); new DateConsolidator().consolidateDates(library, true); /* Modificar el nombre de los items para ver si deben ser vistos ("[2C]") */ manager.fixTags(library); manager.consolidateToBeSeen(library); } /** * This method is responsible for selecting a directory. * * @return The directory selected by the user. */ private static File selectFile() { JFileChooser jfc = new JFileChooser(new File("/Volumes/Andres HD")); jfc.setFileSelectionMode(DIRECTORIES_ONLY); jfc.showDialog(new MediaProcessor(), "Select a directory"); return jfc.getCurrentDirectory(); } }
[ "andres.farias@oracle.com" ]
andres.farias@oracle.com
af3e10e9252e7159f3f1bb0718e560df6dd39830
a6188b2a99be12a10fe5dc2eb334a30bf5356ae6
/BookStore5/src/bean/Page.java
eb3a05445f6f1b97d5f854a8b8e18fc299ecf428
[]
no_license
copyengineer/javaWeb
3c67494bdf4dcb195ea472b8f96579115dc038e1
4ff498da1e39ea40fb220e86fe84c79121b71033
refs/heads/main
2023-05-03T13:57:16.806207
2021-05-20T10:58:08
2021-05-21T01:19:44
369,177,281
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
3,655
java
/** * */ package bean; import java.util.Map; /** * @author 22364 *·ÖÒ³µÄÒµÎñbean */ public class Page { private String lastPage; private Map<String, Integer> pagechoice1; private String omit1; private Map<String, Integer> pagechoice2; private Map<String, Integer> pagechoice3; private Map<String, Integer> pagechoice4; private Map<String, Integer> pagechoice5; private Map<String, Integer> pagechoice6; private String omit2; private Map<String, Integer> pagechoice7; private String omit3; private Map<String, Integer> pagechoice8; public String getLastPage() { return lastPage; } public void setLastPage(String lastPage) { this.lastPage = lastPage; } public Map<String, Integer> getPagechoice1() { return pagechoice1; } public void setPagechoice1(Map<String, Integer> pagechoice1) { this.pagechoice1 = pagechoice1; } public String getOmit1() { return omit1; } public void setOmit1(String omit1) { this.omit1 = omit1; } public Map<String, Integer> getPagechoice2() { return pagechoice2; } public void setPagechoice2(Map<String, Integer> pagechoice2) { this.pagechoice2 = pagechoice2; } public Map<String, Integer> getPagechoice3() { return pagechoice3; } public void setPagechoice3(Map<String, Integer> pagechoice3) { this.pagechoice3 = pagechoice3; } public Map<String, Integer> getPagechoice4() { return pagechoice4; } public void setPagechoice4(Map<String, Integer> pagechoice4) { this.pagechoice4 = pagechoice4; } public Map<String, Integer> getPagechoice5() { return pagechoice5; } public void setPagechoice5(Map<String, Integer> pagechoice5) { this.pagechoice5 = pagechoice5; } public Map<String, Integer> getPagechoice6() { return pagechoice6; } public void setPagechoice6(Map<String, Integer> pagechoice6) { this.pagechoice6 = pagechoice6; } public String getOmit2() { return omit2; } public void setOmit2(String omit2) { this.omit2 = omit2; } public Map<String, Integer> getPagechoice7() { return pagechoice7; } public void setPagechoice7(Map<String, Integer> pagechoice7) { this.pagechoice7 = pagechoice7; } public String getOmit3() { return omit3; } public void setOmit3(String omit3) { this.omit3 = omit3; } public Map<String, Integer> getPagechoice8() { return pagechoice8; } public void setPagechoice8(Map<String, Integer> pagechoice8) { this.pagechoice8 = pagechoice8; } public Page(String lastPage, Map<String, Integer> pagechoice1, String omit1, Map<String, Integer> pagechoice2, Map<String, Integer> pagechoice3, Map<String, Integer> pagechoice4, Map<String, Integer> pagechoice5, Map<String, Integer> pagechoice6, String omit2, Map<String, Integer> pagechoice7, String omit3, Map<String, Integer> pagechoice8) { super(); this.lastPage = lastPage; this.pagechoice1 = pagechoice1; this.omit1 = omit1; this.pagechoice2 = pagechoice2; this.pagechoice3 = pagechoice3; this.pagechoice4 = pagechoice4; this.pagechoice5 = pagechoice5; this.pagechoice6 = pagechoice6; this.omit2 = omit2; this.pagechoice7 = pagechoice7; this.omit3 = omit3; this.pagechoice8 = pagechoice8; } @Override public String toString() { return "Page [lastPage=" + lastPage + ", pagechoice1=" + pagechoice1 + ", omit1=" + omit1 + ", pagechoice2=" + pagechoice2 + ", pagechoice3=" + pagechoice3 + ", pagechoice4=" + pagechoice4 + ", pagechoice5=" + pagechoice5 + ", pagechoice6=" + pagechoice6 + ", omit2=" + omit2 + ", pagechoice7=" + pagechoice7 + ", omit3=" + omit3 + ", pagechoice8=" + pagechoice8 + "]"; } public Page() { super(); // TODO Auto-generated constructor stub } }
[ "2236492050@qq.com" ]
2236492050@qq.com
57fe584d6127186b75804016d5283b3ffedc6313
8ca5238c0cbd23a2ff01a4ca94916680de7acb46
/Module02/src/Demo10/Demo02Calendar.java
3e53d1735453f905b3f936b51c950d885436b01f
[]
no_license
Roytforever/java
fd9e698a3412e91c50985645dc89a7639e27bf1c
e204a6b143045648816bf4edfa0774cd56fbf019
refs/heads/master
2022-07-22T02:55:05.815910
2019-07-24T11:52:57
2019-07-24T11:52:57
198,580,962
0
0
null
2022-06-21T04:12:59
2019-07-24T07:22:06
Java
UTF-8
Java
false
false
3,828
java
package Demo10; import java.util.Calendar; import java.util.Date; /* Calendar类的常用成员方法: public int get(int field):返回给定日历字段的值。 public void set(int field, int value):将给定的日历字段设置为给定值。 public abstract void add(int field, int amount):根据日历的规则,为给定的日历字段添加或减去指定的时间量。 public Date getTime():返回一个表示此Calendar时间值(从历元到现在的毫秒偏移量)的Date对象。 成员方法的参数: int field:日历类的字段,可以使用Calendar类的静态成员变量获取 public static final int YEAR = 1; 年 public static final int MONTH = 2; 月 public static final int DATE = 5; 月中的某一天 public static final int DAY_OF_MONTH = 5;月中的某一天 public static final int HOUR = 10; 时 public static final int MINUTE = 12; 分 public static final int SECOND = 13; 秒 */ public class Demo02Calendar { public static void main(String[] args) { //demo01(); //demo02(); //demo03(); demo04(); } /* public Date getTime():返回一个表示此Calendar时间值(从历元到现在的毫秒偏移量)的Date对象。 把日历对象,转换为日期对象 */ private static void demo04(){ //使用getInstance方法获取Calendar对象 Calendar c = Calendar.getInstance(); Date date = c.getTime(); System.out.println(date); } /* public abstract void add(int field, int amount):根据日历的规则,为给定的日历字段添加或减去指定的时间量。 把指定的字段增加/减少指定的值 参数: int field:传递指定的日历字段(YEAR,MONTH...) int amount:增加/减少指定的值 正数:增加 负数:减少 */ private static void demo03(){ Calendar c = Calendar.getInstance(); c.add(Calendar.YEAR,2); c.add(Calendar.MARCH,-3); int year = c.get(Calendar.YEAR); System.out.println(year); int month = c.get(Calendar.MONTH); System.out.println(month);//西方的月份0-11 东方:1-12 int date = c.get(Calendar.DATE); System.out.println(date); } /* public void set(int field, int value):将给定的日历字段设置为给定值。 参数: int field:传递指定的日历字段(YEAR,MONTH...) int value:给指定字段设置的值 */ private static void demo02(){ //使用getInstance方法获取Calendar对象 Calendar c = Calendar.getInstance(); //设置年为9999 c.set(Calendar.YEAR,9999); //设置月为9月 c.set(Calendar.MONTH,9); //设置日9日 c.set(Calendar.DATE,9); //同时设置年月日,可以使用set的重载方法 c.set(8888,8,8); } /* public Date getTime():返回一个表示此Calendar时间值(从历元到现在的毫秒偏移量)的Date对象。 把日历对象,转换为日期对象 */ private static void demo01(){ //使用getInstance方法获取Calendar对象 Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); System.out.println(year); int month = c.get(Calendar.MARCH);//西方的月份0-11 东方:1-12 System.out.println(month); //int date = c.get(Calendar.DAY_OF_MONTH); int date = c.get(Calendar.DATE); System.out.println(date); } }
[ "375560026@qq.com" ]
375560026@qq.com
7b940c55f3a121057bbe810e3972a5646d4b7da0
cd633c2084427729df769d54d8d73d2a41e04b3a
/src/main/java/me/darkeyedragon/enchants/enchant/RetaliateEnchantment.java
cde1ad1829c3ffb410baaf62a08eca5f29f419e4
[]
no_license
DarkEyeDragon/GlobalEnchants
9084e9eeea2edd56a8bfc9c1fff766b44f09d59b
71394173346418a865438e2e2d02a0d73fd46de7
refs/heads/master
2022-05-28T20:37:43.345481
2020-04-19T22:20:18
2020-04-19T22:20:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package me.darkeyedragon.enchants.enchant; import org.bukkit.event.entity.EntityDamageByEntityEvent; public interface RetaliateEnchantment { void retaliate(EntityDamageByEntityEvent event, int lvl); }
[ "joshua.tack@student.vives.be" ]
joshua.tack@student.vives.be
8e4641d2d38a40ee781d6379251583dcf3eb7e8e
9b5500f72b252da7e3e44359ca309e91353347c5
/src/test/java/org/querybyexample/jpa/app/Account_.java
0957b8c39e1d6baa9c93c544b4392af515f38b22
[]
no_license
luiz158/jpa-query-by-example
0cbc4c3bb1f2135941f54dacac135ca534489447
48b1e81b8ef2afdd9880fb85bd5c909b0d8ee7d2
refs/heads/master
2021-01-18T03:46:25.013229
2012-12-04T19:05:01
2012-12-04T19:05:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
/* * Copyright 2012 JAXIO http://www.jaxio.com * * 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.querybyexample.jpa.app; import java.util.Date; import javax.persistence.metamodel.ListAttribute; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @StaticMetamodel(Account.class) public abstract class Account_ { // Raw attributes public static volatile SingularAttribute<Account, String> id; public static volatile SingularAttribute<Account, String> username; public static volatile SingularAttribute<Account, String> password; public static volatile SingularAttribute<Account, String> email; public static volatile SingularAttribute<Account, Boolean> isEnabled; public static volatile SingularAttribute<Account, Date> birthDate; // Technical attributes for query by example public static volatile SingularAttribute<Account, Integer> addressId; // Many to one public static volatile SingularAttribute<Account, Address> homeAddress; // Many to many public static volatile ListAttribute<Account, Role> roles; }
[ "nromanetti@jaxio.com" ]
nromanetti@jaxio.com
222c6201b713664f9200253ea1f6914c917a2095
937a638ffc7b08be37d4b7efebd23c7a581b4be7
/[Compi2A-]Proy1_201442819/ServidorProyecto1/build/generated/src/org/apache/jsp/VentanaLista_jsp.java
4b70cc5d6f1e316d5e357a74004d66925f104767
[]
no_license
jerduar/Compi2
5fad9d6452229a4b55acb43c56458b706fc5df47
1cb99955cc54dbb1b84498b73212e0c2cf10a3fb
refs/heads/master
2020-04-12T03:54:02.911258
2016-10-04T05:43:07
2016-10-04T05:43:07
64,909,775
0
0
null
null
null
null
UTF-8
Java
false
false
3,320
java
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class VentanaLista_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { public int factorial(int num) { if (num == 0) { return 1; } else if (num < 0) { return -1; } else { return num * factorial(num - 1); } } private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List<String> _jspx_dependants; private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector; public java.util.List<String> getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write('\n'); out.write('\n'); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!DOCTYPE html>\n"); out.write("<html>\n"); out.write(" <head>\n"); out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); out.write(" <title>Lienzos Web</title>\n"); out.write(" </head>\n"); out.write(" <body background=\"/home/jerduar/Escritorio/fondo.jpg\">\n"); out.write(" <h1><s>Cálculo del factoria</s>l</h1>\n"); out.write(" <form action=\"VentanaLista.jsp\" method=\"get\">\n"); out.write(" <p>Número: <input type=\"text\" name=\"num\">\n"); out.write(" <input type=\"submit\" value=\"Calcular\"></p>\n"); out.write(" </form>\n"); out.write("\n"); out.write(" "); String num = request.getParameter("num"); if (num != null) { out.println(factorial(Integer.parseInt(num))); } out.write("\n"); out.write("\n"); out.write(" </body>\n"); out.write("</html>\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "jerduar@gmail.com" ]
jerduar@gmail.com
bf52e73dcf7d1be85c3987f0d588228898d954df
1460eec209c36bf16ca852453c351c58a3c1cc5d
/src/main/java/com/matryxaccess/config/ThymeleafConfiguration.java
4a6d65b1ed816863f15eaaa29e27cd599ee08c30
[]
no_license
aranga-nana/RegSearch
7b3e4cd9fa9bb0a655c595284271e3a4cee0818f
65a68895177a1cbad97aa3e5ea648baa79b04a4b
refs/heads/master
2020-03-20T19:09:56.036441
2018-06-17T02:51:47
2018-06-17T02:51:47
137,624,537
0
0
null
null
null
null
UTF-8
Java
false
false
985
java
package com.matryxaccess.config; import org.apache.commons.lang3.CharEncoding; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.*; import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; @Configuration public class ThymeleafConfiguration { @SuppressWarnings("unused") private final Logger log = LoggerFactory.getLogger(ThymeleafConfiguration.class); @Bean @Description("Thymeleaf template resolver serving HTML 5 emails") public ClassLoaderTemplateResolver emailTemplateResolver() { ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver(); emailTemplateResolver.setPrefix("mails/"); emailTemplateResolver.setSuffix(".html"); emailTemplateResolver.setTemplateMode("HTML5"); emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8); emailTemplateResolver.setOrder(1); return emailTemplateResolver; } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
b5d0d22eaabc2d1fbc0a07a63e6b793b91280573
5a5f605dedcec77832ebf9c988cbc06739a0445d
/app/src/main/java/com/animsh/moviem/activities/MainActivity.java
3b53225a94a0c563c0f50454aec86f314f9e973c
[]
no_license
ladroshan/Moviem
6466cc3f984f76341d1e8f1fcaaa77e5a0f7f34d
a6da8bf313fb9fdfdc74da238065059a37cdfb81
refs/heads/master
2023-05-09T11:24:10.907850
2021-02-15T08:59:28
2021-02-15T08:59:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
867
java
package com.animsh.moviem.activities; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.ui.NavigationUI; import com.animsh.moviem.R; import com.google.android.material.bottomnavigation.BottomNavigationView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BottomNavigationView bottomNavigationView = findViewById(R.id.bottomNavigationView); NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment); NavigationUI.setupWithNavController(bottomNavigationView, navHostFragment.getNavController()); } }
[ "animsh.more@gmail.com" ]
animsh.more@gmail.com
28685db888ca0aad8d7bbd78788a332ba8f9dc30
22ce92ebe08587604439792da8e9c8ae572f44fe
/src/com/pattern/Flyweight/LBox.java
01f6ebfc5264fc27af6a97963bf35b28810b0d4b
[]
no_license
TiancaixZ/design_patterns
4438695fde53d2f05e35b217cf29fa0198d5f39d
71e213cc88d4a2c9b9ce729f54a319aa17e91e04
refs/heads/master
2023-07-18T17:14:09.081882
2021-08-17T14:56:24
2021-08-17T14:56:24
387,807,505
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package com.pattern.Flyweight; /** * @program: design_patterns * @description: * @author: Chen2059 * @create: 2021-08-01 **/ public class LBox extends AbstractBox{ @Override public String getShape() { return "L"; } }
[ "chen2059thisway@gmail.com" ]
chen2059thisway@gmail.com
d29c55e43a21c94bba43b1191687aad5445f4849
ee96ae685e371696c0effba8499f3ea4cafcbc61
/src/com/wxf/data/enumm/SolveFullPermutation.java
3b2898d439d0feac6b2788fd3d78de4c41e03a3a
[]
no_license
jaydenwen123/Algorithms-java
24b7478c3b5f599201b2e7c9dcf591334dffa898
f04ef1d4ae9da15c8cafd63ebe472c5e91479c4e
refs/heads/master
2021-03-03T08:42:45.035079
2020-03-09T05:53:22
2020-03-09T05:53:22
245,947,384
0
0
null
null
null
null
GB18030
Java
false
false
3,675
java
package com.wxf.data.enumm; import java.util.Stack; /** * 通过增量穷举法求解全排列问题 * * @author Administrator * */ public class SolveFullPermutation { /** * 抽象出的实体类,表示一次排列的对象 * * @author Administrator * */ public static final int MAXN = 10; public static class Unit { // 用来表示依次排列的数组元素 public int[] data; // 元素的个数 public int n; public Unit() { // TODO Auto-generated constructor stub } public Unit(int[] data, int n) { super(); this.data = data; this.n = n; } } /** * 通过递归方式解决全排列问题 * * @param data * @param n * @param k */ public static void solveFullPermutation(int data[], int n, int k) { if (k == n) { display(data); } else { for (int i = 1; i <= n; i++) { boolean flag = false; for (int j = 0; j < k; j++) { if (data[j] == i) { flag = true; } } if (!flag) { data[k] = i; solveFullPermutation(data, n, k + 1); } } } } /** * 通过增量穷举法解决 * * @param n */ public static void solveFullPermutation(int n) { // 通过增量穷举法解决全排列问题的思路如下: // 1.首先初始化一个栈 // 2.然后初始化一个元素进行入栈 // 3.当栈不为空时,一直执行 // 4.弹出栈顶元素,然后不断的插入新的元素 // 5.并将新的元素进行入栈 Stack<Unit> stack = new Stack<>(); Unit unit = new Unit(new int[] { 1 }, 1); Unit temp = null; Unit pre = null; stack.push(unit); int count = 0; while (!stack.isEmpty()) { // 弹出栈顶元素 temp = stack.pop(); int[] arr = new int[temp.n]; copyArray(temp.data, arr, temp.n); // 保存上次的排列的顺序 if (temp.n == n) { // 当排列的元素的个数为n时,说明已经排好序直接输出即可 count++; display(temp.data); } else if (temp.n < n) { // 执行插入,并且入栈从2开始到n,其中i表示的是要插入的位置,n个元素由n+1个空挡 for (int i = 0; i < temp.n + 1; i++) { int[] dest = new int[temp.n + 1]; insertToArray(arr, temp.n + 1, i, temp.n + 1, dest); pre = new Unit(dest, dest.length); stack.push(pre); } } } System.out.println(); System.out.println("排列的个数为:" + count); } /** * 给数组array中的index位置插入元素el * * @param array * @param index * @param el */ public static void insertToArray(int[] srarr, int m, int index, int el, int[] dest) { if (index < 0 || index > m) return; System.arraycopy(srarr, 0, dest, 0, srarr.length); for (int i = dest.length - 1; i > index; i--) { dest[i] = dest[i - 1]; } dest[index] = el; } /** * 将a数组中的m个数据元素复制到b数组中 * * @param a * @param b * @param m */ public static void copyArray(int[] a, int b[], int m) { for (int i = 0; i < m; i++) { b[i] = a[i]; } } public static void display(int[] data) { for (int i = 0; i < data.length; i++) System.out.print(data[i]); System.out.print("\t"); } public static void main(String[] args) { // System.out.println("通过增量穷举法解决全排列问题:"); // System.out.println("3的全排列如下:"); // solveFullPermutation(3); // System.out.println("4的全排列如下:"); // solveFullPermutation(4); // System.out.println("5的全排列如下:"); // solveFullPermutation(5); System.out.println("递归方式结合穷举法解决全排列问题:"); int n = 3; int a[] = new int[n]; solveFullPermutation(a, n, 0); } }
[ "228186474@qq.com" ]
228186474@qq.com
35bfc9370985fdc2fb55d08247a54251e84ddebd
45b033618f9cd9f9f1a3f58bda6d7d797983b680
/src/main/java/com/nowcoder/community/util/CommunityConstant.java
1e09f80542899ed37a6e283485dc33c703ca6e89
[]
no_license
A11Might/community
7ba23711046e6fc9adc0df3951626b759fe1c616
314c7e217ca4f5b2563b8eb1f92a6f791ecec290
refs/heads/master
2022-06-26T02:03:02.514995
2019-12-06T13:24:58
2019-12-06T13:24:58
216,225,195
2
1
null
2022-06-17T02:35:30
2019-10-19T15:10:07
Java
UTF-8
Java
false
false
1,297
java
package com.nowcoder.community.util; /** * @author qhhu * @date 2019/10/22 - 19:10 */ public interface CommunityConstant { // 激活成功 int ACTIVATION_SUCCESS = 0; // 重复激活 int ACTIVATION_REPEAT = 1; // 激活失败 int ACTIVATION_FAILURE = 2; // 默认状态的登录凭证的超时时间 int DEFAULT_EXPIRED_SECONDS = 3600 * 12; // 记住状态的登录凭证超时时间 int REMEMBERME_EXPIRED_SECONDS = 3600 * 24 * 100; // 实体类型: 帖子 int ENTITY_TYPE_POST = 1; // 实体类型: 评论 int ENTITY_TYPE_COMMENT = 2; // 实体类型: 用户 int ENTITY_TYPE_USER = 3; // kafka主题: 评论 String TOPIC_COMMENT = "comment"; // kafka主题: 点赞 String TOPIC_LIKE = "like"; // kafka主题: 关注 String TOPIC_FOLLOW = "follow"; // kafka主题: 发帖 String TOPIC_PUBLISH = "publish"; // kafka主题: 删帖 String TOPIC_DELETE = "delete"; // kafka主题: 分享 String TOPIC_SHARE = "share"; // 系统用户ID int SYSTEM_USER_ID = 1; // 权限: 普通用户 String AUTHORITY_USER = "user"; // 权限: 管理员 String AUTHORITY_ADMIN = "admin"; // 权限: 版主 String AUTHORITY_MODERATOR = "moderator"; }
[ "qihanghu@foxmail.com" ]
qihanghu@foxmail.com
9f997c4f3091793a2300a5bd094f8fa098d28e23
e1bfb07d5f98414803be7c9bd9cba57d08949848
/src/main/java/unitec/elementosmvc/Tarjeta.java
1d7be26b12c73b6130b8b12ddbead4b8e0eac5db
[]
no_license
mabetoca/elementos-mvc
f15cc6be77b998d9a0d9c3b60a268ee161485727
239dc18e255b010b4871ad1a2c1844702623168d
refs/heads/master
2020-03-17T22:52:46.186293
2018-06-30T02:01:25
2018-06-30T02:01:25
134,021,694
0
0
null
null
null
null
UTF-8
Java
false
false
1,289
java
package unitec.elementosmvc; public class Tarjeta { private int numero; private float saldo; private String nombre; public Tarjeta(float saldo, String nombre) { this.saldo = saldo; this.nombre = nombre; } public Tarjeta(String nombre) { this.nombre = nombre; } public Tarjeta(float saldo) { this.saldo = saldo; } public Tarjeta(int numero) { this.numero = numero; } public Tarjeta(int numero, float saldo, String nombre) { this.numero = numero; this.saldo = saldo; this.nombre = nombre; } @Override public String toString() { return "Tarjeta{" + "numero=" + numero + ", saldo=" + saldo + ", nombre=" + nombre + '}'; } public Tarjeta() { } public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } public float getSaldo() { return saldo; } public void setSaldo(float saldo) { this.saldo = saldo; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } }
[ "T-107@PC190.mshome.net" ]
T-107@PC190.mshome.net
20ee03ed5a2ff7d2c88b238708658d0986c147c7
031f66322c9c08ae07c4b1711a2312c70cf01948
/JenkinsPractice/src/test/java/com/org/jenkinsLearning/JenkinsPractice/AppTest.java
2676718f8938caf740e161f7deda34ee62221b2a
[]
no_license
practice512/JenkinsPractice
0c6643182db2b59edb69a2dd69b36fe5b985296d
7b0f9738515a7454adcc356ecc625da96a066217
refs/heads/master
2021-01-02T08:58:17.155246
2017-08-02T10:54:50
2017-08-02T10:54:50
99,106,016
0
0
null
null
null
null
UTF-8
Java
false
false
667
java
package com.org.jenkinsLearning.JenkinsPractice; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "sandeep.kancharla@gallop.net" ]
sandeep.kancharla@gallop.net
b9e9c7d107d7b3fcf5a0e2de6921c509f5c5ff70
31105a1dad7233e7681a8000eb0df4a2965b68fc
/src/main/java/com/in28minutes/springboot/microservice/example/currencyconversion/springbootmicroservicecurrencyconversion/SpringBootMicroserviceCurrencyConversionApplication.java
cc002868ca16c53af2c79bca288fd88bfb5dab22
[]
no_license
code-Baldie/spring-boot-microservice-currency-conversion
a25a22395986cde22de4cff4f831946d5da307f1
3b0c474c1aed6271f385c19faca3224ace48dab2
refs/heads/master
2020-04-14T08:51:26.238825
2019-01-02T04:23:58
2019-01-02T04:23:58
163,744,879
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.in28minutes.springboot.microservice.example.currencyconversion.springbootmicroservicecurrencyconversion; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication @EnableFeignClients("com.in28minutes.springboot.microservice.example.currencyconversion.springbootmicroservicecurrencyconversion") @EnableDiscoveryClient public class SpringBootMicroserviceCurrencyConversionApplication { public static void main(String[] args) { SpringApplication.run(SpringBootMicroserviceCurrencyConversionApplication.class, args); } }
[ "rondell318@gmail.com" ]
rondell318@gmail.com
13bc9b9f7563eb241d70120781f1d993d428953b
571fc48d53e6377d2fe266f84c35181aacc80202
/Fgcm/app/src/main/java/com/fanwang/fgcm/model/MeUpdateModel.java
80c0727e55687f6fa42564526014581bbb45072e
[]
no_license
edcedc/Fg
618a381d4399664d3fac9e04dd7a11b62b752f7e
19fd32837347fd17f9b43e816e3cc9fd0c207eb4
refs/heads/master
2020-04-04T10:08:23.469555
2019-06-29T06:09:21
2019-06-29T06:09:21
155,843,816
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package com.fanwang.fgcm.model; import com.fanwang.fgcm.presenter.listener.OnMeUpdateListener; /** * Created by Administrator on 2018/6/1. */ public interface MeUpdateModel { void ajaxUserUpdate(String path,String nick, String phone, int sex, OnMeUpdateListener listener); }
[ "501807647@qq.com" ]
501807647@qq.com
26495f7a858119614e9f7a97124daf6cb75d775c
ef38f7de1121afa3c8d61927607d6814ac074e16
/src/main/java/com/irurueta/navigation/frames/converters/ECItoECEFFrameConverter.java
be7e5d32a26b8411bc88fb7a71169e25c94d3627
[ "Apache-2.0" ]
permissive
yxw027/irurueta-navigation
951e2d1d153cc1441bac63b2da3c2f45cef0dd8e
0d9cdcaabf36772217c1ee242ba6bda35dd48750
refs/heads/master
2023-01-10T16:09:33.751999
2020-11-13T23:34:15
2020-11-13T23:34:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,264
java
/* * Copyright (C) 2019 Alberto Irurueta Carro (alberto@irurueta.com) * * 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.irurueta.navigation.frames.converters; import com.irurueta.algebra.Matrix; import com.irurueta.algebra.WrongSizeException; import com.irurueta.geometry.InvalidRotationMatrixException; import com.irurueta.navigation.frames.CoordinateTransformation; import com.irurueta.navigation.frames.ECEFFrame; import com.irurueta.navigation.frames.ECIFrame; import com.irurueta.navigation.frames.FrameType; import com.irurueta.navigation.frames.InvalidSourceAndDestinationFrameTypeException; import com.irurueta.navigation.geodesic.Constants; import com.irurueta.units.Time; import com.irurueta.units.TimeConverter; import com.irurueta.units.TimeUnit; /** * Converts from ECI frame to ECEF frame. * This implementation is based on the equations defined in "Principles of GNSS, Inertial, and Multisensor * Integrated Navigation Systems, Second Edition" and on the companion software available at: * https://github.com/ymjdz/MATLAB-Codes/blob/master/ECI_to_ECEF.m */ @SuppressWarnings("WeakerAccess") public class ECItoECEFFrameConverter implements TimeIntervalFrameConverter<ECIFrame, ECEFFrame> { /** * Earth rotation rate expressed in radians per second (rad/s). */ public static final double EARTH_ROTATION_RATE = Constants.EARTH_ROTATION_RATE; /** * Converts source ECI frame to a new ECEF frame instance. * * @param timeInterval a time interval expressed in seconds (s). * @param source source frame to convert from. * @return a new destination frame instance. */ @Override public ECEFFrame convertAndReturnNew(double timeInterval, final ECIFrame source) { return convertECItoECEFAndReturnNew(timeInterval, source); } /** * Converts source frame to a new destination frame instance. * * @param timeInterval a time interval. * @param source source frame to convert from. * @return a new destination frame instance. */ @Override public ECEFFrame convertAndReturnNew(final Time timeInterval, final ECIFrame source) { return convertECItoECEFAndReturnNew(timeInterval, source); } /** * Converts source ECI frame to destination ECEF frame. * * @param timeInterval a time interval expressed in seconds (s). * @param source source frame to convert from. * @param destination destination frame instance to convert to. */ @Override public void convert(final double timeInterval, final ECIFrame source, final ECEFFrame destination) { convertECItoECEF(timeInterval, source, destination); } /** * Converts source frame to destination frame. * * @param timeInterval a time interval. * @param source source frame to convert from. * @param destination destination frame instance to covert to. */ @Override public void convert(final Time timeInterval, final ECIFrame source, final ECEFFrame destination) { convertECItoECEF(timeInterval, source, destination); } /** * Gets source frame type. * * @return source frame type. */ @Override public FrameType getSourceType() { return FrameType.EARTH_CENTERED_INERTIAL_FRAME; } /** * Gets destination frame type. * * @return destination frame type. */ @Override public FrameType getDestinationType() { return FrameType.EARTH_CENTERED_EARTH_FIXED_FRAME; } /** * Converts source ECI frame to a new ECEF frame instance. * * @param timeInterval a time interval expressed in seconds (s). * @param source source frame to convert from. * @return a new destination frame instance. */ public static ECEFFrame convertECItoECEFAndReturnNew(final double timeInterval, final ECIFrame source) { final ECEFFrame result = new ECEFFrame(); convertECItoECEF(timeInterval, source, result); return result; } /** * Convers source ECI frame to a new ECEF frame instance. * * @param timeInterval a time interval. * @param source source frame to convert from. * @return a new destination frame instance. */ public static ECEFFrame convertECItoECEFAndReturnNew(final Time timeInterval, final ECIFrame source) { return convertECItoECEFAndReturnNew(TimeConverter.convert(timeInterval.getValue().doubleValue(), timeInterval.getUnit(), TimeUnit.SECOND), source); } /** * Converts source ECI frame to destination ECEF frame. * * @param timeInterval a time interval expressed in seconds (s). * @param source source frame to convert from. * @param destination destination frame instance to convert to. */ public static void convertECItoECEF(final double timeInterval, final ECIFrame source, final ECEFFrame destination) { try { // Calculate ECEF to ECI coordinate transformation matrix using (2.145) final double alpha = EARTH_ROTATION_RATE * timeInterval; final Matrix cie = CoordinateTransformation.eciToEcefMatrixFromAngle(alpha); // Transform position using (2.146) final Matrix rIbi = new Matrix(ECIFrame.NUM_POSITION_COORDINATES, 1); rIbi.setElementAtIndex(0, source.getX()); rIbi.setElementAtIndex(1, source.getY()); rIbi.setElementAtIndex(2, source.getZ()); final Matrix rEbe = cie.multiplyAndReturnNew(rIbi); destination.setCoordinates(rEbe.getElementAtIndex(0), rEbe.getElementAtIndex(1), rEbe.getElementAtIndex(2)); // Transform velocity using (2.145) final Matrix tmp = new Matrix(ECIFrame.NUM_POSITION_COORDINATES, 1); tmp.setElementAtIndex(0, -source.getY()); tmp.setElementAtIndex(1, source.getX()); tmp.setElementAtIndex(2, 0.0); tmp.multiplyByScalar(-EARTH_ROTATION_RATE); final Matrix vIbi = new Matrix(ECIFrame.NUM_VELOCITY_COORDINATES, 1); vIbi.setElementAtIndex(0, source.getVx()); vIbi.setElementAtIndex(1, source.getVy()); vIbi.setElementAtIndex(2, source.getVz()); vIbi.add(tmp); // vIbi - omega * [-y;x;0] final Matrix vEbe = cie.multiplyAndReturnNew(vIbi); destination.setVelocityCoordinates(vEbe.getElementAtIndex(0), vEbe.getElementAtIndex(1), vEbe.getElementAtIndex(2)); // Transform attitude using (2.15) // cbe = cie * cbi final Matrix cbi = source.getCoordinateTransformationMatrix(); cie.multiply(cbi); final CoordinateTransformation c = new CoordinateTransformation(cie, FrameType.BODY_FRAME, FrameType.EARTH_CENTERED_EARTH_FIXED_FRAME); destination.setCoordinateTransformation(c); } catch (WrongSizeException | InvalidSourceAndDestinationFrameTypeException | InvalidRotationMatrixException ignore) { // never happens } } /** * Converts source ECI frame to destination ECEF frame. * * @param timeInterval a time interval. * @param source source frame to convert from. * @param destination destination frame instance to convert to. */ public static void convertECItoECEF(final Time timeInterval, final ECIFrame source, final ECEFFrame destination) { convertECItoECEF(TimeConverter.convert(timeInterval.getValue().doubleValue(), timeInterval.getUnit(), TimeUnit.SECOND), source, destination); } }
[ "alberto@irurueta.com" ]
alberto@irurueta.com
c75d021c09ebf42e7ab07456ec52bb0e9fc11830
5feb555778caf493f99810418832c806f2bd7019
/gm4g_pos_server_dev_phk/src/app/Main.java
32da37cc53303e81c034179e2922d7f4ef055628
[]
no_license
Juliezmx/pos-training
8fe5ae9efa896515c87149d1305d78fcab8042ce
8842ebc0ee9696e4bc0128b5d60d8c6cb2efa870
refs/heads/master
2020-05-18T05:43:06.929447
2019-04-30T07:39:27
2019-04-30T07:39:27
184,214,589
0
0
null
null
null
null
UTF-8
Java
false
false
3,866
java
package app; import java.util.HashMap; import lang.LangResource; import om.OmWsClient; import om.OmWsClientGlobal; import om.PosConfig; import om.PosInterfaceConfigList; import om.PosItemRemindRuleList; import om.WohAwardSettingList; import virtualui.VirtualUIForwarder; import virtualui.VirtualUITerm; import externallib.TCPLib; public class Main { public static void main(String[] args) { int iPortNo = 6001; String sClientUDID = ""; String sLoginID = ""; String sLoginPassword = ""; String sLoginCardNo = ""; String sDisplayMode = ""; String sAccessToken = ""; int iSwitchOutletId = 0; if(args.length > 0){ try{ iPortNo = Integer.parseInt(args[0]); // System.out.println("-=-=--=-=-=-=-=-=-=-=" + iPortNo); if(args.length >= 2){ sClientUDID = args[1]; // System.out.println("-=-=--=-=-=-=-=-=-=-=" + sClientUDID); if(args.length >= 3){ sLoginID = args[2]; // System.out.println("-=-=--=-=-=-=-=-=-=-=-=" + sLoginID); if(args.length >= 4){ sLoginPassword = args[3]; // System.out.println("-=-=--=-=-=-=-=-=-=-=-=-=" + sLoginPassword); if(args.length >= 5){ sLoginCardNo = args[4]; // System.out.println("-=-=--=-=-=-=-=-=-=-=-=-=" + sLoginPassword); if(args.length >= 6){ sDisplayMode = args[5]; // System.out.println("-=-=--=-=-=-=-=-=-=-=-=-=" + sDisplayMode); if(args.length >= 7){ sAccessToken = args[6]; // System.out.println("-=-=--=-=-=-=-=-=-=-=-=-=" + sAccessToken); if(args.length >= 8){ iSwitchOutletId = Integer.parseInt(args[7]); // System.out.println("-=-=--=-=-=-=-=-=-=-=-=-=" + iOutletId); } } } } } } } }catch (Exception e) { AppGlobal.stack2Log(e); } } // Un-comment to test code //if(testCode()) // return; // Initialize the language AppGlobal.g_oLang.set(new LangResource()); AppGlobal.g_oLang.get().switchLocale("en"); // Initialize the menu item and menu cache AppGlobal.g_oFuncMenu.set(new FuncMenu()); // Initialize the term AppGlobal.g_oTerm.set(new VirtualUITerm()); // Initialize the web service client OmWsClientGlobal.g_oWsClient.set(new OmWsClient()); // Initialize the web service client for loyalty OmWsClientGlobal.g_oWsClientForHq.set(new OmWsClient()); // Initialize the language index AppGlobal.g_oCurrentLangIndex.set(new Integer(1)); // Initialize the action log AppGlobal.g_oActionLog.set(new FuncActionLog()); // Initialize TCP object AppGlobal.g_oTCP.set(new TCPLib()); // Initialize device manager connection element AppGlobal.g_oDeviceManagerElement.set(new VirtualUIForwarder()); AppGlobal.g_oPosInterfaceConfigList.set(new PosInterfaceConfigList()); AppGlobal.g_oWohAwardSettingList.set(new WohAwardSettingList()); AppGlobal.g_oPosItemRemindRuleList.set(new PosItemRemindRuleList()); AppGlobal.g_oPosConfigList.set(new HashMap<String, HashMap<String, PosConfig>>()); // Initialize the octopus function AppGlobal.g_oFuncOctopus.set(new FuncOctopus()); // Initialize the result for auto function AppGlobal.g_sResultForAutoFunction.set(AppGlobal.AUTO_FUNCTIONS_RESULT_LIST.fail.name()); // Init the socket if (AppGlobal.g_oTerm.get().waitForClient(sClientUDID, iPortNo) == false){ // Fail to init socket // Write error log return; } // POS operation // Show the main form FormMain oFormMain = new FormMain(null); if(oFormMain.init(sLoginID, sLoginPassword, sLoginCardNo, sDisplayMode, sAccessToken, iSwitchOutletId)) oFormMain.show(); // Quit program AppGlobal.g_oTerm.get().closeTerm(); } }
[ "admin@DESKTOP-34K1G8K" ]
admin@DESKTOP-34K1G8K
5a22c44b29581cd9659c31eb9b0f97ed7bef63e5
4dc877953dd3b19f63c7dcda376fb2a69f54d988
/app/src/test/java/com/example/mike/softkeyboardedittext1/ExampleUnitTest.java
b47e54b58af4de7c8d7a520c163f36f581ed631f
[]
no_license
manirudh74/Android-Hide-Soft-Keyboard-Multiple-EditText
1c96123651db3ff71544816b735b1edcb7ed8642
ff2cd3446357bcebf2befb142d55b0f090396a49
refs/heads/master
2020-03-14T10:13:21.482112
2017-12-16T21:31:44
2017-12-16T21:31:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.example.mike.softkeyboardedittext1; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "msaffold805@gmail.com" ]
msaffold805@gmail.com
3a3dabe9dc9a27e6157370f3f5079a7e2464203c
5ca3901b424539c2cf0d3dda52d8d7ba2ed91773
/src_cfr/com/google/protobuf/DoubleValue$1.java
4655cfec6e050fd1c7cf5a48a1e604289445440e
[]
no_license
fjh658/bindiff
c98c9c24b0d904be852182ecbf4f81926ce67fb4
2a31859b4638404cdc915d7ed6be19937d762743
refs/heads/master
2021-01-20T06:43:12.134977
2016-06-29T17:09:03
2016-06-29T17:09:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
/* * Decompiled with CFR 0_115. */ package com.google.protobuf; import com.google.protobuf.AbstractParser; import com.google.protobuf.CodedInputStream; import com.google.protobuf.DoubleValue; import com.google.protobuf.ExtensionRegistryLite; import com.google.protobuf.InvalidProtocolBufferException; final class DoubleValue$1 extends AbstractParser { DoubleValue$1() { } @Override public DoubleValue parsePartialFrom(CodedInputStream codedInputStream, ExtensionRegistryLite extensionRegistryLite) { try { return new DoubleValue(codedInputStream, extensionRegistryLite, null); } catch (RuntimeException var3_3) { if (!(var3_3.getCause() instanceof InvalidProtocolBufferException)) throw var3_3; throw (InvalidProtocolBufferException)var3_3.getCause(); } } }
[ "manouchehri@riseup.net" ]
manouchehri@riseup.net
e38f6c9cca531e16e792383e5d7655a50c6c9fb7
87ca0ceb85ed1d9e117e1866d217fde2241846a8
/task-management/src/main/java/com/oscartraining/taskmanagement/web/CustomizeController.java
b2b78ee6801914f3c59912fe86a594dfb0ed098f
[]
no_license
oscar7pro/task-management
9102522df04f1bafdbbff57a29b67d9274cae714
2ad0e7febf87767bd4aa75feb668d28358dfbe76
refs/heads/master
2023-02-10T04:15:59.200944
2020-08-11T17:57:36
2020-08-11T17:57:36
286,804,731
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.oscartraining.taskmanagement.web; import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletRequest; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @Controller public class CustomizeController implements ErrorController { @GetMapping("/error") public String handleError(HttpServletRequest request) { String errorPage = "error"; // default Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); if (status != null) { Integer statusCode = Integer.valueOf(status.toString()); if (statusCode == HttpStatus.NOT_FOUND.value()) { // handle HTTP 404 Not Found error errorPage = "error/404"; } else if (statusCode == HttpStatus.FORBIDDEN.value()) { // handle HTTP 403 Forbidden error errorPage = "error/403"; } else if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR.value()) { // handle HTTP 500 Internal Server error errorPage = "error/500"; } } return errorPage; } @Override public String getErrorPath() { return "/error"; } }
[ "adonay@adonay-Precision-M4800" ]
adonay@adonay-Precision-M4800
419bce28db270801b78b3b5442ea9b29843f54f0
69799e6fcd0570a9b26cb418e94ab0064884de60
/app/src/main/java/com/example/thirdparty/rxjava/RxJavaContacts.java
456aed9e20b868ea339879c26cedcca6fcd19702
[]
no_license
zhooker/ThirdPartyLibraryDemo
c226099e44f323c79e6530ed08b22c14e5613ff9
db7416b415a2be3059811ad09ecd188f5b32e9d7
refs/heads/master
2021-01-12T12:31:22.699068
2017-12-07T02:59:52
2017-12-07T02:59:52
72,524,948
0
0
null
2017-06-22T03:51:12
2016-11-01T10:08:51
HTML
UTF-8
Java
false
false
309
java
package com.example.thirdparty.rxjava; import android.content.Context; import java.util.List; /** * Created by zhuangsj on 16-11-2. */ public interface RxJavaContacts { interface IView { void updateList(List<Model> models); } interface IPresenter { void getData(); } }
[ "zhuangsj@gionee.com" ]
zhuangsj@gionee.com
7396b812c848c615e67cdc0c5b9f7131e77c3f58
66ed0f3998a8b94d89aed48abe907405f01f26a7
/ms-tmdp/src/main/java/com/zhuanjingkj/stpbe/tmdp/dto/tp/TpTfSiteDTO.java
9b6d90103cc4804d129dda6c611edc06d4be83f1
[]
no_license
shell22/stpbe
a47f337782ba7a2613e693b24d7c0b225f5af8e2
c8ea6b80e714e638e36f61a271dc1fc7c3079761
refs/heads/master
2023-02-24T01:15:28.578592
2021-01-28T06:36:42
2021-01-28T06:36:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,151
java
package com.zhuanjingkj.stpbe.tmdp.dto.tp; import com.alibaba.fastjson.annotation.JSONField; import com.zhuanjingkj.stpbe.data.dto.BaseDTO; public class TpTfSiteDTO extends BaseDTO { @JSONField(name = "siteId") private long siteId; @JSONField(name = "siteName") private String siteName; @JSONField(name = "lng") private double lng; @JSONField(name = "lat") private double lat; public TpTfSiteDTO(long siteId, String siteName, double lng, double lat) { this.siteId = siteId; this.siteName = siteName; this.lng = lng; this.lat = lat; } public long getSiteId() { return siteId; } public void setSiteId(long siteId) { this.siteId = siteId; } public String getSiteName() { return siteName; } public void setSiteName(String siteName) { this.siteName = siteName; } public double getLng() { return lng; } public void setLng(double lng) { this.lng = lng; } public double getLat() { return lat; } public void setLat(double lat) { this.lat = lat; } }
[ "13052510071@163.com" ]
13052510071@163.com
97f82dfcb074ba5683d10da04cea57afb1c3e568
6e8ed39021fb71d2013fb40f4c351c6480a278a3
/src/main/java/com/cngc/pm/service/RecordsService.java
6ee1544a0a58c38fad2390abf59822c3568fc28b
[]
no_license
magiczero/SpringMVCHibernate
a0cbf866a1e481f22300b515f481515976f7994e
9474d85d725e7a99341bb127d592a0925edafdb1
refs/heads/master
2021-04-24T15:41:34.765208
2019-02-01T06:21:41
2019-02-01T06:21:41
39,990,190
0
1
null
2016-06-06T08:12:22
2015-07-31T06:26:27
JavaScript
UTF-8
Java
false
false
678
java
package com.cngc.pm.service; import java.text.ParseException; import java.util.List; import com.cngc.pm.model.Records; import com.cngc.pm.model.SysUser; import com.googlecode.genericdao.search.SearchResult; public interface RecordsService { void save(Records record); List<Records> getListAll(); SearchResult<Records> getAllWithPage(String roleName, Integer offset, Integer maxResults); /** * 根据角色获得用户 * @param roles 多个角色 * @return */ List<SysUser> getUsersByRole(String...names); List<Records> searchList(String username, List<Integer> typeList, String start, String end) throws ParseException; }
[ "younghappy7@msn.com" ]
younghappy7@msn.com
c072832adc96fe52a05dbf4f1387e422d8d3a7d2
d751a9c11173f1a99e9102da13fda15df26e52f0
/src/main/java/com/algorithm/SolutionQ15.java
fc64cce0cb06fcc3e2be1350841fddc89864a7f0
[]
no_license
StevenWord/Leetcode_Java02_new1
8133a10f8c8aee4d4ab87f5611621e70cc524f68
abdc7b0e22891389721b6919eb9a56ae9e44afcf
refs/heads/master
2022-12-29T16:18:07.982161
2020-06-05T05:29:37
2020-06-05T05:29:37
269,538,810
0
0
null
2020-10-13T22:34:25
2020-06-05T05:29:28
Java
UTF-8
Java
false
false
1,433
java
package com.algorithm; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class SolutionQ15 { public static List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums); List<List<Integer>> lists = new ArrayList<List<Integer>>(); int i=0; while(i<nums.length){ int left=i+1; int right=nums.length-1; while(left<right){ if(nums[i]+nums[left]+nums[right]==0){ List<Integer> temp =new ArrayList<Integer>(); temp.add(nums[i]); temp.add(nums[left]); temp.add(nums[right]); lists.add(temp); left = getLeftPlace(left,nums); } else if(nums[i]+nums[left]+nums[right]>0){ right = getRightPlace(right,nums); } else if(nums[i]+nums[left]+nums[right]<0){ left = getLeftPlace(left,nums); } } i = getLeftPlace(i,nums); } return lists; } public static int getLeftPlace(int i,int [] nums){ while((i+1)<nums.length&&nums[i]==nums[i+1]) i++; return i+1; } public static int getRightPlace(int i,int [] nums){ while((i-1)>=0&&nums[i]==nums[i-1]) i--; return i-1; } }
[ "1035305087@qq.com" ]
1035305087@qq.com
19a13d501da034f28d95a5e8f623570e7850e7a8
38e6a670236f5b0812f8a5cac4aa67dabd1eae25
/src/main/java/cn/edu/service/userwebService/DeleteResponse.java
64e9b0358db76cbd8b37166edaf7657fa5c65cc6
[]
no_license
wzd1003/telediagnosis-server
a27c1bdcf33c3af4407b756319cd6cc23dd3240d
648157749e7cb9fcee7062645c1586260a1da45b
refs/heads/master
2022-07-09T08:30:32.052655
2019-10-20T07:45:06
2019-10-20T07:45:06
214,972,943
1
0
null
2022-06-29T17:42:27
2019-10-14T07:11:10
Java
GB18030
Java
false
false
1,431
java
package cn.edu.service.userwebService; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>deleteResponse complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="deleteResponse"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="return" type="{http://webservice.openmeetings.apache.org/}serviceResult" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "deleteResponse", propOrder = { "_return" }) public class DeleteResponse { @XmlElement(name = "return") protected ServiceResult _return; /** * 获取return属性的值。 * * @return * possible object is * {@link ServiceResult } * */ public ServiceResult getReturn() { return _return; } /** * 设置return属性的值。 * * @param value * allowed object is * {@link ServiceResult } * */ public void setReturn(ServiceResult value) { this._return = value; } }
[ "460205875@qq.com" ]
460205875@qq.com
98cedb662da63f16522504dce8e760ea25985c01
5717a36ead2bbc3bb3c35db84c6a59aea4285885
/src/main/java/com/xiaobo/xiaomaolv/config/ApplicationConfig.java
b4c97f40b59c00c620e6d59c99ac8055138c9a1b
[]
no_license
xiaomaolv-company/xiaomaolv-server
010af7876e4b7e47ef6f855925383c5c079d18bd
3d2e2c148f5aba74addf84d06b1f7c6146eadb18
refs/heads/master
2022-11-22T21:36:56.264951
2020-01-16T12:03:04
2020-01-16T12:03:04
225,126,581
0
0
null
2022-11-16T08:57:30
2019-12-01T08:03:40
Java
UTF-8
Java
false
false
1,870
java
package com.xiaobo.xiaomaolv.config; import com.xiaobo.xiaomaolv.Service.SysOperationService; import com.xiaobo.xiaomaolv.Service.VisitLogService; import com.xiaobo.xiaomaolv.util.OperationLogUtil; import com.xiaobo.xiaomaolv.util.Redis.JedisUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class ApplicationConfig implements WebMvcConfigurer{ Logger logger = LoggerFactory.getLogger(ApplicationConfig.class); @Autowired private JedisUtil jedisUtil; @Autowired private SysOperationService sysOperationService; @Autowired private VisitLogService visitLogService; @Autowired private LoginInterceptor loginInterceptor; @Bean public OperationLogUtil operationLogUtil(){ OperationLogUtil operationLogUtil = new OperationLogUtil(); operationLogUtil.setVisitLogService(visitLogService); operationLogUtil.setSysOperationService(sysOperationService); operationLogUtil.setJedisUtil(jedisUtil); logger.info("初始化OperationLogUtil成功"); return operationLogUtil; } /** *注册登录拦截器 * @param registry */ @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(loginInterceptor); logger.info("登录拦截器注册成功"); } }
[ "xiaobohj@163.com" ]
xiaobohj@163.com
b9a0ae2b83c7bc66cf7f9215fed1204f3721a06b
a6d6cb82683a5c923d510c87084b481f8b0e137f
/lms/cmsproject/src/main/java/com/dxc/cms/Menu.java
72985648b96fe638ebc5e29c0230320676fb6d4b
[]
no_license
ShankaraSrinivasan-DXC/dxc
b118f0f6b296b348c3045a62403b3201b69a5bb0
ce2ce1bd28c3178fdf4df2a767088fc8d0281b69
refs/heads/master
2022-12-15T07:36:53.740742
2020-09-08T06:34:44
2020-09-08T06:34:44
293,722,147
0
0
null
null
null
null
UTF-8
Java
false
false
3,930
java
package com.dxc.cms; import java.util.Objects; /** * Menu class used to display menu information. * @author hexware */ public class Menu { /** * foodId to store foodId. */ private int foodId; /** * foodName to store Item Name. */ private String foodName; /** * foodName to store Item details. */ private double foodPrice; /** * foodName to store Item price. */ private String foodDetail; /** * foodName to store Item Status. */ private FoodStatus foodStatus; /** * foodName to store Item Rate. */ private String foodRating; /** * Default Constructor. */ public Menu() { } /** * @param argfoodId to initialize food id. * @param argFoodName to initialize food Name. * @param argFoodPrice to initialize food price. * @param argFoodDetail to initialize food Detail. * @param argFoodStatus to initialize food Status. * @param argFoodRating to initialize food Rating. * used to get details through constructor. */ public Menu( final int argfoodId, final String argFoodName, final String argFoodDetail, final double argFoodPrice, final FoodStatus argFoodStatus, final String argFoodRating) { this.foodId = argfoodId; this.foodName = argFoodName; this.foodDetail = argFoodDetail; this.foodPrice = argFoodPrice; this.foodStatus = argFoodStatus; this.foodRating = argFoodRating; } @Override public final boolean equals(final Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Menu menu = (Menu) obj; if (Objects.equals(foodId, menu.foodId) && Objects.equals(foodName, menu.foodName) && Objects.equals(foodDetail, menu.foodDetail) && Objects.equals(foodPrice, menu.foodPrice) && Objects.equals(foodStatus, menu.foodStatus) && Objects.equals(foodRating, menu.foodRating)) { return true; } return false; } @Override public final int hashCode() { return Objects.hash(foodId, foodName, foodDetail, foodPrice, foodStatus, foodRating); } /** * @return this food ID. */ public final int getFoodId() { return foodId; } /** * @param argFoodId gets the food id. */ public final void setFoodId(final int argFoodId) { this.foodId = argFoodId; } /** * @return this food ID. */ public final double getFoodPrice() { return foodPrice; } /** * @param argFoodPrice gets the food id. */ public final void setFoodPrice(final double argFoodPrice) { this.foodPrice = argFoodPrice; } /** * @return this food ID. */ public final FoodStatus getFoodStatus() { return foodStatus; } /** * @param argFoodStatus gets the food id. */ public final void setFoodStatus(final FoodStatus argFoodStatus) { this.foodStatus = argFoodStatus; } /** * @return this food ID. */ public final String getFoodRating() { return foodRating; } /** * @param argFoodRating gets the food id. */ public final void setFoodRating(final String argFoodRating) { this.foodRating = argFoodRating; } /** * @return this food ID. */ public final String getFoodDetail() { return foodDetail; } /** * @param argFoodDetail gets the food id. */ public final void setFoodDetail(final String argFoodDetail) { this.foodDetail = argFoodDetail; } /** * @return this food Item Name. */ public final String getFoodName() { return foodName; } /** * @param argFoodName gets the food Name. */ public final void setFoodName(final String argFoodName) { this.foodName = argFoodName; } @Override public final String toString() { return String.format("%-15s %-25s %-15s %-15s %-15s %-15s", foodId, foodName, foodPrice, foodStatus, foodDetail, foodRating); } }
[ "srinivasanshankara98@gmail.com" ]
srinivasanshankara98@gmail.com
cafbfb13b61b9f7cddc898c4cfe0edb1d254eb75
0e971a4283079ad83ea5824b1cff1f713dfe7292
/app/src/main/java/com/example/orderfoodsapp/ViewHolder/CartAdapter.java
f40d7d5385edf51a9365876b0be1f7b71a335d4e
[]
no_license
DiepDang98/OrderClient
95cf178afde33807e88370b9e6072554b4f7b6eb
3df79c2637925ee484ef4f4a04444d51e3b284af
refs/heads/master
2022-09-03T03:59:39.620716
2020-05-31T02:07:31
2020-05-31T02:07:31
267,098,259
0
0
null
null
null
null
UTF-8
Java
false
false
3,195
java
package com.example.orderfoodsapp.ViewHolder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton; import com.example.orderfoodsapp.Cart; import com.example.orderfoodsapp.Common.Common; import com.example.orderfoodsapp.Database.Database; import com.example.orderfoodsapp.Model.Order; import com.example.orderfoodsapp.R; import com.squareup.picasso.Picasso; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import java.util.Locale; public class CartAdapter extends RecyclerView.Adapter<CartViewHolder> { private List<Order> listData = new ArrayList<>(); private Cart cart; public CartAdapter(List<Order> listData, Cart cart) { this.listData = listData; this.cart = cart; } @Override public CartViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(cart); View itemView = inflater.inflate(R.layout.cart_item, parent, false); return new CartViewHolder(itemView); } @Override public void onBindViewHolder(CartViewHolder holder, final int position) { holder.btn_quantity.setNumber(listData.get(position).getQuantity()); holder.btn_quantity.setOnValueChangeListener(new ElegantNumberButton.OnValueChangeListener() { @Override public void onValueChange(ElegantNumberButton view, int oldValue, int newValue) { Order order = listData.get(position); order.setQuantity(String.valueOf(newValue)); new Database(cart).updateCart(order); double total = 0; List<Order> orders = new Database(cart).getCarts(Common.currentUser.getPhone()); for (Order item : orders) { total += (Double.parseDouble(item.getPrice())) * (Integer.parseInt(item.getQuantity())); Locale locale = new Locale("en", "US"); NumberFormat fmt = NumberFormat.getCurrencyInstance(locale); cart.txtTotalPrice.setText(fmt.format(total)); } } }); Locale locale = new Locale("en", "US"); NumberFormat fmt = NumberFormat.getCurrencyInstance(locale); double price = (Double.parseDouble(listData.get(position).getPrice())); holder.txt_price.setText(fmt.format(price)); holder.txt_cart_name.setText(listData.get(position).getProductName()); //Get image from food list Picasso.get().load(listData.get(position).getImage()).resize(50, 50).centerCrop().into(holder.cart_image); } @Override public int getItemCount() { return listData.size(); } public Order getItem(int position){ return listData.get(position); } public void removeItem(int position){ listData.remove(position); notifyItemRemoved(position); } public void restoreItem(int position,Order item){ listData.add(position,item); notifyItemInserted(position); } }
[ "dangthibichdiep207@gmail.com" ]
dangthibichdiep207@gmail.com
56c9e394aa57ff95d3912ca821369bf9dfbb28d9
c495226e7406f21c40ed1553c9144e7e8e37d1c9
/app/src/main/java/security/bercy/com/week5weekendmutaualmobile/model/NA.java
aac6cb405e3b471e21b7d2b28ba83ba00e85f99a
[]
no_license
BercyW/MutaualMobile
443741d57bf3ee2bb72e28d3790bf5455a3eb2a5
2883ce0f0c3f086bbe59a52e461c46f54b1f4e36
refs/heads/master
2021-09-04T15:13:35.412976
2018-01-19T18:06:05
2018-01-19T18:06:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
861
java
package security.bercy.com.week5weekendmutaualmobile.model; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class NA implements Serializable { @SerializedName("unit") private String unit; @SerializedName("quantity") private double quantity; @SerializedName("label") private String label; public void setUnit(String unit){ this.unit = unit; } public String getUnit(){ return unit; } public void setQuantity(double quantity){ this.quantity = quantity; } public double getQuantity(){ return quantity; } public void setLabel(String label){ this.label = label; } public String getLabel(){ return label; } @Override public String toString(){ return "NA{" + "unit = '" + unit + '\'' + ",quantity = '" + quantity + '\'' + ",label = '" + label + '\'' + "}"; } }
[ "adnmks@gmail.com" ]
adnmks@gmail.com
238941c194355dbb0fc9552c5413cc505a77670b
fd08c249d552150dfabc98fc9b9ee886bff6d914
/src/breakout_proper/Ball.java
502fbc00114ae0113189df7b4f31493e17e6f546
[]
no_license
KrzynKrzyn/PROZ_Breakout_2018_05_25
e494909e565a5c852ef362cba2314dcb718131b0
bc1456c964d99372d1111d760cb774140ecd7e49
refs/heads/master
2020-05-15T18:23:55.694596
2019-04-20T16:15:20
2019-04-20T16:15:20
182,424,379
1
0
null
null
null
null
UTF-8
Java
false
false
1,701
java
package breakout_proper; import game_objects.*; public class Ball extends Circle2d implements Movable { private Vector2d movement = new Vector2d(); public Vector2d getMovement() { return this.movement; } public void setMovement(Vector2d m) { this.movement = m; } private boolean destructible = false; public boolean isDestructible() { return destructible; } public void setIndestructible() { destructible = false; } public void setDestructible() { destructible = true; } private int durability = 1; public int getDurablility() { return durability; } public void setDurability(int dur) { durability = dur; } public void decDurability() { durability -= 1; } //------------------------------------------------ public void setSpeed(double v) { movement.normalize().factor(v); } public void changeSpeed(double f) { movement.factor(f); } public void move(Vector2d v) { this.getPoint().add(v); } public void move() { this.getPoint().add(movement); } public void bounce(Shape2d gobj) { movement = movement.getReflection(gobj.collisionVector(this)); } public void bounce(Vector2d vc) { movement = movement.getReflection(vc); } public Vector2d bouncevector(Shape2d gobj) { return gobj.collisionVector(this); } //------------------------------------------------ public Ball(Ball gobj) { super(gobj); this.movement = new Vector2d(gobj.getMovement()); this.destructible = gobj.destructible; this.durability = gobj.durability; } public Ball(double x, double y, double r, Vector2d v) { super(x, y, r); movement = v; } public Ball(Point2d point, double r, Vector2d v) { super(point, r); movement = v; } }
[ "K.Najda@stud.elka.pw.edu.pl" ]
K.Najda@stud.elka.pw.edu.pl
7df0f0cfc3a1e4956fb2c906622ec07d1d76c1d0
713f37e3e8c4f768d0833c05c883f3c37463e311
/app/src/androidTest/java/com/example/beket/newsapp/ExampleInstrumentedTest.java
035cddfdbfce59981761aa78f2822500f1963109
[]
no_license
bekecsillatimea/NewsApp
083cbfa966fe338946bd62c6a3457e4f07c64e22
faf5504e8ea9b33bfa4bc48aa1696eb84aa50690
refs/heads/master
2020-04-05T04:00:22.802146
2018-11-07T11:13:53
2018-11-07T11:13:53
156,534,650
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package com.example.beket.newsapp; 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.beket.newsapp", appContext.getPackageName()); } }
[ "beketimeacsilla@gmail.com" ]
beketimeacsilla@gmail.com
2401d3bdb2943b1023b098ab2f435e8f302789e4
4c67f7fac4197f40cf861ff94f099add4571c8e1
/algoritmo9/src/test/java/br/ufg/inf/es/construcao/primo/PrimoTest.java
a3b6e89e76587440b718f676f8747ada75f472dc
[]
no_license
matheuspiment/algoritmos
5e47eb95024aaf47c445ffb92da643a307f6bf04
e3db88f8f8751723aa6ae7fbf9b7bef1b0aa8a7d
refs/heads/master
2021-01-10T07:21:56.329091
2017-04-23T21:57:11
2017-04-23T21:57:11
45,215,132
0
1
null
2017-04-20T21:30:17
2015-10-29T22:44:53
Java
UTF-8
Java
false
false
530
java
package br.ufg.inf.es.construcao.primo; import org.junit.Assert; import org.junit.Test; public class PrimoTest { @Test(expected = IllegalArgumentException.class) public void testParametroInvalido() { Primo.primo(1); } @Test public void testNumerosPrimos() { Assert.assertTrue(Primo.primo(2)); Assert.assertTrue(Primo.primo(11)); } @Test public void testNumerosNaoPrimos() { Assert.assertFalse(Primo.primo(4)); Assert.assertFalse(Primo.primo(6)); } }
[ "matheuspiment@hotmail.com" ]
matheuspiment@hotmail.com
260e48e38e0c9b8f7291236dbdde4d256774fd80
ee54744f58904bfbbc53ceffba0c27a54fdf1f72
/ComunicacaoSerial/src/comunicacaoserial/ControlePorta.java
21c19886d2d611006821a5c77657442543145f3b
[]
no_license
Luan-Michel/robotica
f486671a4379aa372949b8cdfad7201f51d8a37d
4a1fea0b70319e703a2436121c6993a392d7eeec
refs/heads/master
2020-05-07T15:04:45.614081
2019-04-10T16:37:08
2019-04-10T16:37:08
180,622,266
0
0
null
null
null
null
UTF-8
Java
false
false
2,706
java
package comunicacaoserial; import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.SerialPort; import java.io.IOException; import java.io.OutputStream; import javax.swing.JOptionPane; public class ControlePorta { private OutputStream serialOut; private int taxa; private String portaCOM; /** * Construtor da classe ControlePorta * @param portaCOM - Porta COM que será utilizada para enviar os dados para o arduino * @param taxa - Taxa de transferência da porta serial geralmente é 9600 */ public ControlePorta(String portaCOM, int taxa) { this.portaCOM = portaCOM; this.taxa = taxa; this.initialize(); } /** * Médoto que verifica se a comunicação com a porta serial está ok */ private void initialize() { try { //Define uma variável portId do tipo CommPortIdentifier para realizar a comunicação serial CommPortIdentifier portId = null; try { //Tenta verificar se a porta COM informada existe portId = CommPortIdentifier.getPortIdentifier(this.portaCOM); }catch (NoSuchPortException npe) { //Caso a porta COM não exista será exibido um erro JOptionPane.showMessageDialog(null, "Porta COM não encontrada.", "Porta COM", JOptionPane.PLAIN_MESSAGE); } //Abre a porta COM SerialPort port = (SerialPort) portId.open("Comunicação serial", this.taxa); serialOut = port.getOutputStream(); port.setSerialPortParams(this.taxa, //taxa de transferência da porta serial SerialPort.DATABITS_8, //taxa de 10 bits 8 (envio) SerialPort.STOPBITS_1, //taxa de 10 bits 1 (recebimento) SerialPort.PARITY_NONE); //receber e enviar dados }catch (Exception e) { e.printStackTrace(); } } /** * Método que fecha a comunicação com a porta serial */ public void close() { try { serialOut.close(); }catch (IOException e) { JOptionPane.showMessageDialog(null, "Não foi possível fechar porta COM.", "Fechar porta COM", JOptionPane.PLAIN_MESSAGE); } } /** * @param opcao - Valor a ser enviado pela porta serial */ public void enviaDados(int opcao){ try { String str = Integer.toString(opcao); for(int i=0; i<str.length();i++) serialOut.write(str.charAt(i));//escreve o valor na porta serial para ser enviado serialOut.write('C'); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Não foi possível enviar o dado. ", "Enviar dados", JOptionPane.PLAIN_MESSAGE); } } }
[ "luanmichel96@gmail.com" ]
luanmichel96@gmail.com
b04745dceff9d71f984f2a3db3d1b30d87503a4c
eb37a64c985dd1f395bd3c1d3aea74739bbd7181
/src/main/java/com/liuhaozzu/netty/investigation/codec/Integer2StringDecoder.java
969b826f1d4e57db06fa9cccf082bb30f8ca7a56
[ "Apache-2.0" ]
permissive
liuhaozzu/netty-investigation
ae81ee596d244331d4ddca7938926a721cb82676
eaf6593c26fa91f0e3505f262d907572de68de2d
refs/heads/master
2022-10-08T21:11:04.502174
2019-07-21T08:32:28
2019-07-21T08:32:28
172,220,792
0
0
Apache-2.0
2022-10-04T23:50:28
2019-02-23T14:01:34
Java
UTF-8
Java
false
false
438
java
package com.liuhaozzu.netty.investigation.codec; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; import java.util.List; /** * @Author Administrator * @create 2019/3/9 0009 22:38 */ public class Integer2StringDecoder extends MessageToMessageDecoder<Integer> { @Override protected void decode(ChannelHandlerContext ctx, Integer msg, List out) throws Exception { } }
[ "liuhao01@zhuanzhuan.com" ]
liuhao01@zhuanzhuan.com
9aaaf3ec955127e68924e230bcb08f90898a874d
d6f5a82c6c32b98e13a6435c3a7637caa3740d17
/src/test/java/io/github/dbgsprw/booklog/book/BookRepositoryTests.java
98e5151219718becffbe6940b96914140d9bdf52
[]
no_license
dbgsprw/book-log-api
80c96c188eda505f2e131faa92e9766edddb342f
58fc61d90cd22620ae58814e5e950d521281ccc2
refs/heads/master
2022-12-23T17:01:18.232104
2020-10-01T14:24:30
2020-10-01T14:24:46
299,618,387
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
package io.github.dbgsprw.booklog.book; import io.github.dbgsprw.booklog.test.DataInitializeExecutionListener; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestExecutionListeners; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest @TestExecutionListeners( listeners = DataInitializeExecutionListener.class, mergeMode = TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS) public class BookRepositoryTests { @Autowired private BookRepository bookRepository; @Test void insert() { Book book = Fixtures.getBook(); this.bookRepository.insert(book); assertThat(this.bookRepository.findAll()).isNotEmpty(); Book savedBook = this.bookRepository.findById(book.getIsbn()).get(); assertThat(savedBook).isEqualTo(book); assertThat(savedBook.getBookAuthors()).extracting("name") .contains("Hans Rosling", "Ola Rosling", "Anna Rosling"); } }
[ "dbgsprw@gmail.com" ]
dbgsprw@gmail.com
98f34a2fb97ecbb817701cd725953d50a5afe4c8
0612a474904ab3ce22f084672d72b5781c754114
/west.twouse.language.owl2fs/src/west/twouse/language/owl2fs/AnnotationSubject.java
dba10dc09b4b9a81258a399f3ff0855d4a9c072c
[]
no_license
harendra-kumar/twouse
170683464f100e5da3cfa2ba2017014bcef5cadd
0505d5dedd8c605f117158a5d8dea19a9ca37d6b
refs/heads/master
2021-01-10T11:33:21.651431
2010-12-10T09:12:13
2010-12-10T09:12:13
50,262,555
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
/** * <copyright> * </copyright> * * $Id$ */ package west.twouse.language.owl2fs; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Annotation Subject</b></em>'. * <!-- end-user-doc --> * * * @see west.twouse.language.owl2fs.Owl2fsPackage#getAnnotationSubject() * @model abstract="true" * @generated */ public interface AnnotationSubject extends EObject { } // AnnotationSubject
[ "schneider_mark@web.de" ]
schneider_mark@web.de
8862ed687b7ad5b19c36d298ffd3239941d05745
eea0fe7168456ab818a1a7ec0ffbe1b85fd2ae4b
/app/src/main/java/com/example/a21__void/afroturf/pkgStylist/pakages/ViewPagerAdapter.java
1798566dd3297d80941d8f0725a0dcba0cce013a
[]
no_license
JeffNCoda/AfroTurf
6941c741b1fb61f1a2c6a1e29e72535cde251f56
df64ef944693e26db8aeb42a2df794e49b6478e1
refs/heads/master
2020-03-21T11:34:59.578782
2018-09-24T20:32:18
2018-09-24T20:32:18
138,512,702
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package com.example.a21__void.afroturf.pkgStylist.pakages; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import java.util.ArrayList; import java.util.List; public class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); public ViewPagerAdapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment) { mFragmentList.add(fragment); } }
[ "mathonsiphumzile@gmail.com" ]
mathonsiphumzile@gmail.com
efcb5a2c590658c760893e5ea2562add45db11ef
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/plugin/fav/ui/gallery/c.java
9dea3f8f30abc59a207bf9388ec35afd8d5c8c35
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
24,499
java
package com.tencent.mm.plugin.fav.ui.gallery; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.os.Process; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.a; import androidx.recyclerview.widget.RecyclerView.b; import androidx.recyclerview.widget.RecyclerView.l; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.hardcoder.WXHardCoderJNI; import com.tencent.mm.modelimage.r; import com.tencent.mm.plugin.fav.a.ab; import com.tencent.mm.plugin.fav.a.g; import com.tencent.mm.plugin.fav.a.z; import com.tencent.mm.plugin.fav.ui.FavSearchUI; import com.tencent.mm.plugin.fav.ui.FavoriteImageServer; import com.tencent.mm.plugin.fav.ui.o; import com.tencent.mm.plugin.fav.ui.o.a; import com.tencent.mm.plugin.fav.ui.q.a; import com.tencent.mm.plugin.fav.ui.q.e; import com.tencent.mm.plugin.fav.ui.q.i; import com.tencent.mm.protocal.protobuf.arx; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.mm.ui.base.k; import com.tencent.mm.ui.base.w; import com.tencent.mm.vfs.y; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public final class c implements f.b, g.b { private FavoriteImageServer AfM; arx Aia; g.a AmS; private RelativeLayout AmT; private LinearLayout AmU; TextView AmV; private TextView AmW; private ImageButton AmX; private ImageButton AmY; private boolean AmZ; private int Ana; public a Anb; private long Anc; private View.OnClickListener Ane; private View.OnClickListener Anf; private View.OnClickListener Ang; public List<d> Anh; Activity hHU; public View lBX; private TextView lMW; int lyw; private RecyclerView mRecyclerView; private long mxe; private long oCx; private ProgressDialog wQT; boolean wRl; private int wRm; public c(Activity paramActivity, View paramView, FavoriteImageServer paramFavoriteImageServer) { AppMethodBeat.i(274510); this.AmZ = false; this.Ana = -1; this.wRl = true; this.mxe = 0L; this.oCx = 0L; this.Ane = new c.3(this); this.Anf = new c.4(this); this.Ang = new View.OnClickListener() { public final void onClick(View paramAnonymousView) { AppMethodBeat.i(107370); com.tencent.mm.hellhoundlib.b.b localb = new com.tencent.mm.hellhoundlib.b.b(); localb.cH(paramAnonymousView); com.tencent.mm.hellhoundlib.a.a.c("com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$5", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V", this, localb.aYj()); if (c.this.AmS != null) { c.this.AmS.MN(((Integer)paramAnonymousView.getTag()).intValue()); } com.tencent.mm.hellhoundlib.a.a.a(this, "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$5", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V"); AppMethodBeat.o(107370); } }; this.Anh = new ArrayList(); this.hHU = paramActivity; this.lBX = paramView; this.AfM = paramFavoriteImageServer; this.AmZ = true; paramFavoriteImageServer = g.c.AnT; paramView = null; switch (9.Anm[paramFavoriteImageServer.ordinal()]) { } for (paramActivity = paramView;; paramActivity = new h(paramActivity)) { paramActivity.a(this); this.Aia = new arx(); this.Aia.scene = 2; this.Aia.AcJ = 2; this.Aia.index = 0; this.Aia.sessionId = ""; this.Aia.query = ""; this.Aia.AcL = ""; this.AmT = ((RelativeLayout)this.lBX.findViewById(q.e.history_option_bar)); this.AmU = ((LinearLayout)this.lBX.findViewById(q.e.history_edit_option_bar)); this.AmV = ((TextView)this.lBX.findViewById(q.e.album_tips_bar)); this.lMW = ((TextView)this.lBX.findViewById(q.e.search_nothing_hint)); this.mRecyclerView = ((RecyclerView)this.lBX.findViewById(q.e.history_recycler_view)); this.AmX = ((ImageButton)this.lBX.findViewById(q.e.history_edit_forward)); this.AmY = ((ImageButton)this.lBX.findViewById(q.e.history_edit_delete)); this.mRecyclerView.setLayoutManager(this.AmS.fT(this.hHU)); this.mRecyclerView.a(this.AmS.gl(this.hHU)); this.mRecyclerView.setAdapter(this.AmS.c(this.AfM)); ((f)this.AmS.dSN()).Aia = this.Aia; this.mRecyclerView.setHasFixedSize(true); this.mRecyclerView.setOnScrollListener(new c.1(this)); this.mRecyclerView.a(new RecyclerView.l() { private Runnable wRo; private void np(boolean paramAnonymousBoolean) { AppMethodBeat.i(274496); if (paramAnonymousBoolean) { c.this.AmV.removeCallbacks(this.wRo); if (c.this.AmV.getVisibility() != 0) { c.this.AmV.clearAnimation(); Animation localAnimation = AnimationUtils.loadAnimation(c.this.hHU, q.a.fast_faded_in); c.this.AmV.setVisibility(0); c.this.AmV.startAnimation(localAnimation); AppMethodBeat.o(274496); } } else { c.this.AmV.removeCallbacks(this.wRo); c.this.AmV.postDelayed(this.wRo, 256L); } AppMethodBeat.o(274496); } public final void onScrollStateChanged(RecyclerView paramAnonymousRecyclerView, int paramAnonymousInt) { AppMethodBeat.i(274499); Object localObject = new com.tencent.mm.hellhoundlib.b.b(); ((com.tencent.mm.hellhoundlib.b.b)localObject).cH(paramAnonymousRecyclerView); ((com.tencent.mm.hellhoundlib.b.b)localObject).sc(paramAnonymousInt); com.tencent.mm.hellhoundlib.a.a.c("com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$2", "androidx/recyclerview/widget/RecyclerView$OnScrollListener", "onScrollStateChanged", "(Landroidx/recyclerview/widget/RecyclerView;I)V", this, ((com.tencent.mm.hellhoundlib.b.b)localObject).aYj()); int i; if (1 == paramAnonymousInt) { np(true); WXHardCoderJNI.stopPerformance(WXHardCoderJNI.hcMediaGalleryScrollEnable, c.this.lyw); localObject = c.this; boolean bool = WXHardCoderJNI.hcMediaGalleryScrollEnable; int j = WXHardCoderJNI.hcMediaGalleryScrollDelay; int k = WXHardCoderJNI.hcMediaGalleryScrollCPU; int m = WXHardCoderJNI.hcMediaGalleryScrollIO; if (WXHardCoderJNI.hcMediaGalleryScrollThr) { i = Process.myTid(); ((c)localObject).lyw = WXHardCoderJNI.startPerformance(bool, j, k, m, i, WXHardCoderJNI.hcMediaGalleryScrollTimeout, 703, WXHardCoderJNI.hcMediaGalleryScrollAction, "MicroMsg.MediaHistoryGalleryUI"); } } for (;;) { if ((paramAnonymousRecyclerView.getLayoutManager() instanceof LinearLayoutManager)) { if ((((LinearLayoutManager)paramAnonymousRecyclerView.getLayoutManager()).Ju() == 0) && (!c.this.wRl)) { c.this.AmS.I(false, -1); } c.this.wRl = false; r.bKe().onScrollStateChanged(paramAnonymousInt); } com.tencent.mm.hellhoundlib.a.a.a(this, "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$2", "androidx/recyclerview/widget/RecyclerView$OnScrollListener", "onScrollStateChanged", "(Landroidx/recyclerview/widget/RecyclerView;I)V"); AppMethodBeat.o(274499); return; i = 0; break; if (paramAnonymousInt == 0) { np(false); } } } public final void onScrolled(RecyclerView paramAnonymousRecyclerView, int paramAnonymousInt1, int paramAnonymousInt2) { AppMethodBeat.i(274498); Object localObject = new com.tencent.mm.hellhoundlib.b.b(); ((com.tencent.mm.hellhoundlib.b.b)localObject).cH(paramAnonymousRecyclerView); ((com.tencent.mm.hellhoundlib.b.b)localObject).sc(paramAnonymousInt1); ((com.tencent.mm.hellhoundlib.b.b)localObject).sc(paramAnonymousInt2); com.tencent.mm.hellhoundlib.a.a.c("com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$2", "androidx/recyclerview/widget/RecyclerView$OnScrollListener", "onScrolled", "(Landroidx/recyclerview/widget/RecyclerView;II)V", this, ((com.tencent.mm.hellhoundlib.b.b)localObject).aYj()); super.onScrolled(paramAnonymousRecyclerView, paramAnonymousInt1, paramAnonymousInt2); localObject = (LinearLayoutManager)c.this.AmS.fT(c.this.hHU); paramAnonymousRecyclerView = (f)c.this.AmS.dSN(); localObject = paramAnonymousRecyclerView.MM(((LinearLayoutManager)localObject).Ju()); if (localObject == null) { com.tencent.mm.hellhoundlib.a.a.a(this, "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$2", "androidx/recyclerview/widget/RecyclerView$OnScrollListener", "onScrolled", "(Landroidx/recyclerview/widget/RecyclerView;II)V"); AppMethodBeat.o(274498); return; } paramAnonymousRecyclerView = paramAnonymousRecyclerView.kD(((f.d)localObject).timeStamp); c.this.AmV.setText(Util.nullAs(paramAnonymousRecyclerView, "")); com.tencent.mm.hellhoundlib.a.a.a(this, "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery$2", "androidx/recyclerview/widget/RecyclerView$OnScrollListener", "onScrolled", "(Landroidx/recyclerview/widget/RecyclerView;II)V"); AppMethodBeat.o(274498); } }); this.AmW = ((TextView)this.lBX.findViewById(q.e.select_btn)); this.AmW.setOnClickListener(this.Ane); this.AmX.setTag(Integer.valueOf(0)); this.AmX.setOnClickListener(this.Ang); this.AmY.setTag(Integer.valueOf(1)); this.AmY.setOnClickListener(this.Ang); AppMethodBeat.o(274510); return; } } private void no(boolean paramBoolean) { AppMethodBeat.i(107390); Log.i("MicroMsg.MediaHistoryGalleryUI", "[setProgress] isVisible:%s", new Object[] { Boolean.valueOf(paramBoolean) }); if (paramBoolean) { this.wQT = w.a(this.hHU, this.hHU.getString(q.i.loading_tips), true, 0, null); AppMethodBeat.o(107390); return; } if ((this.wQT != null) && (this.wQT.isShowing())) { this.wQT.dismiss(); this.wQT = null; } AppMethodBeat.o(107390); } private void pv(boolean paramBoolean) { AppMethodBeat.i(107387); this.AmX.setEnabled(paramBoolean); this.AmY.setEnabled(paramBoolean); AppMethodBeat.o(107387); } public final void F(boolean paramBoolean, int paramInt) { AppMethodBeat.i(107383); Log.i("MicroMsg.MediaHistoryGalleryUI", "[onDataLoaded] isFirst:%s addCount:%s mIntentPos:%s", new Object[] { Boolean.valueOf(paramBoolean), Integer.valueOf(paramInt), Integer.valueOf(this.Ana) }); int i; if (this.Anb != null) { i = (int)(System.currentTimeMillis() - this.Anc); this.Anb.hl(i, paramInt); } if (paramBoolean) { no(false); this.mRecyclerView.getAdapter().bZE.notifyChanged(); RecyclerView localRecyclerView; com.tencent.mm.hellhoundlib.b.a locala; if (this.Ana > 0) { if (this.Ana % 4 == 0) { this.Ana += 1; } localRecyclerView = this.mRecyclerView; locala = com.tencent.mm.hellhoundlib.b.c.a(this.Ana, new com.tencent.mm.hellhoundlib.b.a()); com.tencent.mm.hellhoundlib.a.a.b(localRecyclerView, locala.aYi(), "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery", "onDataLoaded", "(ZI)V", "Undefined", "scrollToPosition", "(I)V"); localRecyclerView.scrollToPosition(((Integer)locala.sb(0)).intValue()); com.tencent.mm.hellhoundlib.a.a.c(localRecyclerView, "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery", "onDataLoaded", "(ZI)V", "Undefined", "scrollToPosition", "(I)V"); } while (paramInt <= 0) { this.lMW.setVisibility(0); this.mRecyclerView.setVisibility(8); this.lMW.setText(this.hHU.getString(q.i.fav_filter_img_video_noting_hint)); AppMethodBeat.o(107383); return; i = this.mRecyclerView.getAdapter().getItemCount(); localRecyclerView = this.mRecyclerView; locala = com.tencent.mm.hellhoundlib.b.c.a(i - 1, new com.tencent.mm.hellhoundlib.b.a()); com.tencent.mm.hellhoundlib.a.a.b(localRecyclerView, locala.aYi(), "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery", "onDataLoaded", "(ZI)V", "Undefined", "scrollToPosition", "(I)V"); localRecyclerView.scrollToPosition(((Integer)locala.sb(0)).intValue()); com.tencent.mm.hellhoundlib.a.a.c(localRecyclerView, "com/tencent/mm/plugin/fav/ui/gallery/FavMediaHistoryGallery", "onDataLoaded", "(ZI)V", "Undefined", "scrollToPosition", "(I)V"); } this.lMW.setVisibility(8); this.mRecyclerView.setVisibility(0); AppMethodBeat.o(107383); return; } if (paramInt > 0) { this.mRecyclerView.getAdapter().bZE.notifyChanged(); AppMethodBeat.o(107383); return; } this.mRecyclerView.getAdapter().fV(0); AppMethodBeat.o(107383); } public final void ML(int paramInt) { AppMethodBeat.i(107384); if (dSE()) { if (paramInt <= 0) { break label31; } } label31: for (boolean bool = true;; bool = false) { pv(bool); AppMethodBeat.o(107384); return; } } public final void dRJ() { AppMethodBeat.i(274513); if (this.Anb != null) { this.Anb.dRJ(); } AppMethodBeat.o(274513); } public final void dRL() { AppMethodBeat.i(274515); if (this.Anb != null) { this.Anb.dRL(); } AppMethodBeat.o(274515); } public final void dRM() { AppMethodBeat.i(274516); if (this.Anb != null) { this.Anb.dRM(); } AppMethodBeat.o(274516); } public final void dRN() { AppMethodBeat.i(274518); if (this.Anb != null) { this.Anb.dRN(); } AppMethodBeat.o(274518); } public final void dSC() { AppMethodBeat.i(274514); if (this.Anb != null) { this.Anb.dRK(); } AppMethodBeat.o(274514); } public final void dSD() { AppMethodBeat.i(107376); if (this.AmS != null) { this.Anc = System.currentTimeMillis(); this.AmS.I(true, this.Ana); } AppMethodBeat.o(107376); } public final boolean dSE() { AppMethodBeat.i(107381); if (this.AmS == null) { AppMethodBeat.o(107381); return false; } boolean bool = this.AmS.dSE(); AppMethodBeat.o(107381); return bool; } public final void dSF() { AppMethodBeat.i(107385); if (this.AmS != null) { this.AmS.dSF(); } this.AmT.setVisibility(8); this.AmU.setVisibility(0); pv(false); AppMethodBeat.o(107385); } public final void dSG() { AppMethodBeat.i(107386); if (this.AmS != null) { this.AmS.dSG(); } this.AmT.setVisibility(0); this.AmU.setVisibility(8); AppMethodBeat.o(107386); } public final void fN(List<d> paramList) { int i = 0; AppMethodBeat.i(107388); if ((paramList == null) || (paramList.size() <= 0)) { AppMethodBeat.o(107388); return; } this.Anh.clear(); this.Anh.addAll(paramList); Intent localIntent = new Intent(); localIntent.putExtra("Select_Conv_Type", 3); localIntent.putExtra("mutil_select_is_ret", true); Object localObject1; Object localObject2; String str; if (this.Anh.size() == 1) { localObject1 = (d)paramList.get(0); localObject2 = com.tencent.mm.plugin.fav.a.b.a(((d)localObject1).hIT); str = com.tencent.mm.plugin.fav.a.b.d(((d)localObject1).hIT); if (y.ZC((String)localObject2)) { localIntent.putExtra("image_path", (String)localObject2); if ((((d)localObject1).dSJ()) || (((d)localObject1).dSH())) { i = 1; } localIntent.putExtra("Retr_Msg_Type", i); localIntent.putExtra("select_is_ret", true); if (((d)localObject1).xvD != null) { ((ab)com.tencent.mm.kernel.h.ax(ab.class)).c(Long.valueOf(((d)localObject1).xvD.field_localId)); } } } for (;;) { com.tencent.mm.br.c.d(this.hHU, ".ui.transmit.SelectConversationUI", localIntent, 1); paramList = paramList.iterator(); while (paramList.hasNext()) { com.tencent.mm.plugin.fav.a.h.I(((d)paramList.next()).xvD.field_localId, 1); } localIntent.putExtra("image_path", str); break; localIntent.putExtra("scene_from", 1); localIntent.putExtra("Retr_Msg_Type", 17); localIntent.putExtra("select_fav_select_count", this.Anh.size()); localObject1 = this.Anh.iterator(); while (((Iterator)localObject1).hasNext()) { localObject2 = (d)((Iterator)localObject1).next(); if ((localObject2 != null) && (((d)localObject2).xvD != null)) { ((ab)com.tencent.mm.kernel.h.ax(ab.class)).c(Long.valueOf(((d)localObject2).xvD.field_localId)); } } } if (this.Anb != null) { this.Anb.MH(this.Anh.size()); } AppMethodBeat.o(107388); } public final void fO(final List<d> paramList) { AppMethodBeat.i(107389); if ((paramList == null) || (paramList.size() <= 0)) { AppMethodBeat.o(107389); return; } Object localObject = new ArrayList(); final boolean bool = false; HashSet localHashSet = new HashSet(); Iterator localIterator = paramList.iterator(); paramList = null; while (localIterator.hasNext()) { paramList = ((d)localIterator.next()).xvD; if ((paramList != null) && ((paramList.field_type == 18) || (paramList.field_type == 14))) { bool = true; localHashSet.add(Long.valueOf(paramList.field_localId)); } else { ((ArrayList)localObject).add(paramList); } } if (((ArrayList)localObject).size() == 0) { if (localHashSet.size() >= 2) { FavSearchUI.au(this.hHU); AppMethodBeat.o(107389); return; } localObject = new com.tencent.mm.ui.widget.a.g.a(this.hHU); ((com.tencent.mm.ui.widget.a.g.a)localObject).bDE(this.hHU.getString(q.i.favorite_delete_select_from_record_note)); ((com.tencent.mm.ui.widget.a.g.a)localObject).bDJ(this.hHU.getString(q.i.favorite_cancel)); ((com.tencent.mm.ui.widget.a.g.a)localObject).bDI(this.hHU.getString(q.i.favorite_go_detail)); ((com.tencent.mm.ui.widget.a.g.a)localObject).a(new com.tencent.mm.ui.widget.a.g.c()new com.tencent.mm.ui.widget.a.g.c { public final void onDialogClick(boolean paramAnonymousBoolean, String paramAnonymousString) {} }, new com.tencent.mm.ui.widget.a.g.c() { public final void onDialogClick(boolean paramAnonymousBoolean, String paramAnonymousString) { AppMethodBeat.i(274494); c.this.Aia.index = -1; ((z)com.tencent.mm.kernel.h.ax(z.class)).a(c.this.hHU, paramList, c.this.Aia); AppMethodBeat.o(274494); } }); ((com.tencent.mm.ui.widget.a.g.a)localObject).show(); AppMethodBeat.o(107389); return; } k.a(this.hHU, this.hHU.getString(q.i.favorite_delete_items_confirm), "", new DialogInterface.OnClickListener() { public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) { AppMethodBeat.i(274493); o.a(c.this.hHU, this.sfJ, new o.a() { public final void dRQ() { AppMethodBeat.i(274476); Log.v("MicroMsg.MediaHistoryGalleryUI", "do refresh job"); c.this.AmS.I(true, -1); AppMethodBeat.o(274476); } }); if (bool) { FavSearchUI.au(c.this.hHU); } if (c.this.Anb != null) { paramAnonymousDialogInterface = c.this.Anb; this.sfJ.size(); paramAnonymousDialogInterface.dRK(); } AppMethodBeat.o(274493); } }, null); AppMethodBeat.o(107389); } public final void nm(boolean paramBoolean) { AppMethodBeat.i(107382); if (paramBoolean) { no(true); AppMethodBeat.o(107382); return; } this.wRm = ((GridLayoutManager)this.mRecyclerView.getLayoutManager()).Jw(); AppMethodBeat.o(107382); } public final void onDestroy() { AppMethodBeat.i(107379); if (this.AmS != null) { this.AmS.onDetach(); } AppMethodBeat.o(107379); } public final void onPause() { AppMethodBeat.i(107378); WXHardCoderJNI.stopPerformance(WXHardCoderJNI.hcMediaGalleryScrollEnable, this.lyw); this.lyw = 0; if ((com.tencent.matrix.c.isInstalled()) && (com.tencent.matrix.c.avW().ai(com.tencent.matrix.trace.b.class) != null)) { com.tencent.matrix.trace.tracer.b localb = ((com.tencent.matrix.trace.b)com.tencent.matrix.c.avW().ai(com.tencent.matrix.trace.b.class)).fdr; if (localb != null) { this.mxe = Math.max(0L, localb.ffH - this.mxe); } } if (Util.nowSecond() > this.oCx) {} for (long l = Util.nowSecond() - this.oCx;; l = 1L) { this.oCx = l; WXHardCoderJNI.reportFPS(703, WXHardCoderJNI.hcMediaGalleryScrollAction, 1, this.mxe, this.oCx); this.mxe = 0L; this.oCx = 0L; AppMethodBeat.o(107378); return; } } public final void onResume() { AppMethodBeat.i(107377); this.oCx = Util.nowSecond(); if ((com.tencent.matrix.c.isInstalled()) && (com.tencent.matrix.c.avW().ai(com.tencent.matrix.trace.b.class) != null)) { com.tencent.matrix.trace.tracer.b localb = ((com.tencent.matrix.trace.b)com.tencent.matrix.c.avW().ai(com.tencent.matrix.trace.b.class)).fdr; if (localb != null) { this.mxe = localb.ffH; } } if (this.AmS != null) { this.AmS.onResume(); } if (this.AmZ) { if ((this.AmS == null) || (!this.AmS.dSE())) { break label118; } dSF(); } for (;;) { this.AmZ = false; AppMethodBeat.o(107377); return; label118: dSG(); } } public final void setVisibility(int paramInt) { AppMethodBeat.i(107380); this.lBX.setVisibility(paramInt); AppMethodBeat.o(107380); } public static abstract interface a { public abstract void MH(int paramInt); public abstract void dRJ(); public abstract void dRK(); public abstract void dRL(); public abstract void dRM(); public abstract void dRN(); public abstract void hl(int paramInt1, int paramInt2); } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes6.jar * Qualified Name: com.tencent.mm.plugin.fav.ui.gallery.c * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
0872eec8227ca69262b853149cd8df99aae5efd4
c4ac66584ceca02d6f3bf69aa3c7e95dc37e0838
/jetfuel-core/src/main/java/com/eixox/adapters/BigDecimalAdapter.java
f6351757c380f77c458e6ac183da264a3e0b2ad7
[ "Apache-2.0" ]
permissive
EixoX/jetfuel
96a3785b3ff0f23e6751dbc8a37299f4af21c379
d9cd30ef28f14f31ea4d57b2c8c25c7cfc4485ca
refs/heads/master
2021-06-23T17:37:20.409286
2019-01-23T18:06:58
2019-01-23T18:06:58
97,074,305
4
2
Apache-2.0
2021-06-15T14:33:07
2017-07-13T03:03:47
Java
UTF-8
Java
false
false
1,195
java
package com.eixox.adapters; import java.math.BigDecimal; import java.util.Date; /** * An adapter that can convert, parse and format BigDecimal objects; * * @author Rodrigo Portela * */ public class BigDecimalAdapter extends Adapter<BigDecimal> { /** * Creates a new BigDecimal adapter object; */ public BigDecimalAdapter() { super(BigDecimal.class); } /** * Parses the input source string into a BigDecimal object; */ @Override public BigDecimal parse(String source) { return source == null || source.isEmpty() ? whenNull() : new BigDecimal(source); } /** * Changes the type of the source to a BigDecimal object; */ @Override protected BigDecimal changeType(Class<?> sourceClass, Object source) { if (Number.class.isAssignableFrom(sourceClass)) return BigDecimal.valueOf(((Number) source).doubleValue()); else if (Date.class.isAssignableFrom(sourceClass)) return BigDecimal.valueOf(((Date) source).getTime()); else return super.changeType(sourceClass, source); } /** * Gets the value of a BigDecimal when the input for conversion is null; */ @Override public BigDecimal whenNull() { return BigDecimal.valueOf(0.0); } }
[ "rodrigo.portela@gmail.com" ]
rodrigo.portela@gmail.com
1ed8d3e7b31f7f3c7c1da58a60326da96aa177c7
ded15e84ea46b8b7486548667360685321a57985
/edziennik/src/com/polsl/edziennik/desktopclient/controller/teacher/activities/ReportsAction.java
089c173cf1b2918a7989b6b8e055f258d7efa540
[]
no_license
mateuszgolab/edziennik-desktop-client
59d96c979cd1801ee1612049e402c744a9b110dc
9ae378e5046de9532d67b0faa1c7c71d710653df
refs/heads/master
2016-09-05T15:34:58.944767
2012-05-09T16:17:45
2012-05-09T16:17:45
32,699,821
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
999
java
package com.polsl.edziennik.desktopclient.controller.teacher.activities; import java.awt.event.ActionEvent; import javax.swing.ImageIcon; import com.polsl.edziennik.desktopclient.controller.teacher.TeacherAction; import com.polsl.edziennik.desktopclient.view.teacher.ReportsForTeacher; import com.polsl.edziennik.desktopclient.view.teacher.TeacherMainView; /** * * Klasa odpowiedzialna za wykonanie akcji uruchomienia modułu sprawozdań na * poziomie prowadzącego * * @author Mateusz Gołąb * */ public class ReportsAction extends TeacherAction { private static String title = menu.getString("reports"); public ReportsAction(TeacherMainView parent) { super(title); this.parent = parent; } @Override public void actionPerformed(ActionEvent e) { ReportsForTeacher reports = new ReportsForTeacher(); parent.addTab(title + " ", reports, new ImageIcon(bundle.getString("reportIcon"))); parent.invalidate(); parent.validate(); } }
[ "Mathgol@gmail.com@9a3c01a8-007e-c14a-894e-62519730d3a8" ]
Mathgol@gmail.com@9a3c01a8-007e-c14a-894e-62519730d3a8
e6e50813e5169a785f60d6c2d2eb59a75b1cdae5
5cb14bda6cbdcad2daa7209cbc476fcac6eeed10
/app/src/main/java/com/example/akshay/timetable888/modules/Notification.java
062654859f7b61e5a600228da3bdea310f532eff
[]
no_license
akshaykumaru18/Dynamic-Timetable-Management
e186493853b21dd9e4a7df7802e376d00162ddd1
f7c954c1724a51609a014f2c18643154ad73bf7b
refs/heads/master
2020-05-21T08:29:01.576527
2019-05-10T12:27:21
2019-05-10T12:27:21
185,982,378
0
1
null
2019-10-24T12:52:14
2019-05-10T12:12:06
Java
UTF-8
Java
false
false
2,028
java
package com.example.akshay.timetable888.modules; public class Notification { private String FacultyName; private String user_id; private String From; private String To; private String Message; private String Date; private String Time; private String Token_id; private String Current_id; public Notification(String facultyName, String user_id, String from, String to, String message, String date, String time, String token_id, String current_id) { FacultyName = facultyName; this.user_id = user_id; From = from; To = to; Message = message; Date = date; Time = time; Token_id = token_id; Current_id = current_id; } public Notification() { } public String getFacultyName() { return FacultyName; } public void setFacultyName(String facultyName) { FacultyName = facultyName; } public String getUser_id() { return user_id; } public void setUser_id(String user_id) { this.user_id = user_id; } public String getFrom() { return From; } public void setFrom(String from) { From = from; } public String getTo() { return To; } public void setTo(String to) { To = to; } public String getMessage() { return Message; } public void setMessage(String message) { Message = message; } public String getDate() { return Date; } public void setDate(String date) { Date = date; } public String getTime() { return Time; } public void setTime(String time) { Time = time; } public String getToken_id() { return Token_id; } public void setToken_id(String token_id) { Token_id = token_id; } public String getCurrent_id() { return Current_id; } public void setCurrent_id(String current_id) { Current_id = current_id; } }
[ "akshayapsangi123@gmail.com" ]
akshayapsangi123@gmail.com
9adfa8036747189df0d511b3d8c5a3ddd07504df
53e2f9b5c23a6545c16c79e7cb4b9feede0d6f2f
/src/lcs/android/site/type/House.java
39a8d8b82e0bff84cd8c3fa29b84d01b1fae4d06
[]
no_license
sidav/liberalcrimesquadandroid
0a7787ab9f0fb8e1eabe2a2668dd6360e059c112
d6c91bec2058b8cd16e12cd0879a473aa78ee0b0
refs/heads/master
2020-04-02T06:08:58.812021
2018-10-22T12:14:42
2018-10-22T12:14:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,643
java
package lcs.android.site.type; import static lcs.android.game.Game.*; import lcs.android.basemode.iface.Location; import lcs.android.game.Game; import lcs.android.politics.Alignment; import lcs.android.politics.Issue; import lcs.android.site.map.SpecialBlocks; import lcs.android.util.Xml; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @Xml.Name(name = "CORPORATE_HOUSE") public @NonNullByDefault class House extends AbstractSiteType { @Override public String alarmResponseString() { return ": MERCENARIES RESPONDING"; } @Override public String carChaseCar() { return i.rng.choice("VEHICLE_SUV", "VEHICLE_JEEP"); } @Override public String carChaseCreature() { return "MERC"; } @Override public int carChaseIntensity(final int siteCrime) { return i.rng.nextInt(siteCrime / 5 + 1) + 1; } @Override public int carChaseMax() { return 6; } @Override public String ccsSiteName() { return "Richard Dawkins Food Bank."; } @Override @Nullable public SpecialBlocks firstSpecial() { return SpecialBlocks.HOUSE_PHOTOS; } @Override public void generateName(final Location l) { if (i.issue(Issue.CORPORATECULTURE).law() == Alignment.ARCHCONSERVATIVE && i.issue(Issue.TAX).law() == Alignment.ARCHCONSERVATIVE) { l.setName("CEO Castle"); } else { l.setName("CEO Residence"); } } @Override public String lcsSiteOpinion() { return ", a building with enough square footage enough to house a hundred people if it weren't in Conservative Hands."; } @Override public Issue[] opinionsChanged() { return new Issue[] { Issue.TAX, Issue.CEOSALARY }; } @Override public int priority(final int oldPriority) { return oldPriority * 2; } @Override public String randomLootItem() { if (i.rng.chance(50)) { return i.rng.choice("ARMOR_EXPENSIVEDRESS", "ARMOR_EXPENSIVESUIT", "ARMOR_EXPENSIVESUIT", "ARMOR_EXPENSIVESUIT", "ARMOR_BONDAGEGEAR"); } if (i.rng.chance(8)) { return "LOOT_TRINKET"; } else if (i.rng.chance(7)) { return "LOOT_WATCH"; } else if (i.rng.chance(6)) { return "LOOT_PDA"; } else if (i.rng.chance(5)) { return "LOOT_CELLPHONE"; } else if (i.rng.chance(4)) { return "LOOT_SILVERWARE"; } else if (i.rng.chance(3)) { return "LOOT_CHEAPJEWELERY"; } else if (i.rng.chance(2)) { return "LOOT_FAMILYPHOTO"; } return "LOOT_COMPUTER"; } @Override public String siegeUnit() { return "MERC"; } /** * */ private static final long serialVersionUID = Game.VERSION; }
[ "addiemacgruer@googlemail.com" ]
addiemacgruer@googlemail.com
25988238bf2857c0fbd40b713f22af66c7e016f9
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/er/src/main/java/com/huaweicloud/sdk/er/v3/model/DeleteResourceTagResponse.java
41d8e603c7413b757eeb3995ee9d13c7672df7d4
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
1,752
java
package com.huaweicloud.sdk.er.v3.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.huaweicloud.sdk.core.SdkResponse; import java.util.Objects; /** * Response Object */ public class DeleteResourceTagResponse extends SdkResponse { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "body") private String body; public DeleteResourceTagResponse withBody(String body) { this.body = body; return this; } /** * Get body * @return body */ public String getBody() { return body; } public void setBody(String body) { this.body = body; } @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } DeleteResourceTagResponse that = (DeleteResourceTagResponse) obj; return Objects.equals(this.body, that.body); } @Override public int hashCode() { return Objects.hash(body); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeleteResourceTagResponse {\n"); sb.append(" body: ").append(toIndentedString(body)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
111106f5a5bae38c27600f73b631ab1996940918
27f649c606bc2cdf839c175219fcfbf1af9b1f32
/src/main/java/net/bdsc/listener/CartEventListener.java
9b179e723cdcfb5808f1787a10c0a91184cf3f23
[]
no_license
heyewei/block
38717394de805c9205755e7a46f46faa8a097415
849655194551d8c93a61545b959a1e74e99bd7bb
refs/heads/master
2023-01-28T22:25:00.012454
2020-12-10T05:16:15
2020-12-10T05:16:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
/* * Copyright 2008-2018 shopxx.net. All rights reserved. * Support: localhost * License: localhost/license * FileId: hvwINUhSMmGk7zZMnMHUMdSGetjZvP/n */ package net.bdsc.listener; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import net.bdsc.entity.Cart; import net.bdsc.entity.Member; import net.bdsc.event.CartEvent; import net.bdsc.service.UserService; import net.bdsc.util.WebUtils; /** * Listener - 购物车事件 * * @author 好源++ Team * @version 6.1 */ @Component public class CartEventListener { @Inject private UserService userService; /** * 事件处理 * * @param cartEvent * 购物车事件 */ @EventListener public void handle(CartEvent cartEvent) { HttpServletRequest request = WebUtils.getRequest(); HttpServletResponse response = WebUtils.getResponse(); Cart cart = cartEvent.getCart(); Member currentUser = userService.getCurrent(Member.class); if (currentUser != null) { WebUtils.removeCookie(request, response, Cart.KEY_COOKIE_NAME); } else { WebUtils.addCookie(request, response, Cart.KEY_COOKIE_NAME, cart.getKey(), Cart.TIMEOUT); } WebUtils.addCookie(request, response, Cart.TAG_COOKIE_NAME, cart.getTag()); } }
[ "1169794338@qq.com" ]
1169794338@qq.com
1a54e9267286c834ec9fd676524ddcc04f4b0878
e64a4c76a19c1d16cd8d78571efe328e2a12174a
/junit/generator/javatests/com/google/j2cl/junit/apt/JUnit4AbstractTestCase.java
08db40f82779205e736c90cad0071fc86b1c7d84
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
FrankHossfeld/j2cl
7d2f019233c7b124ae54010bce944d0273b2be9c
953573c82f91e77c60fbb8e310fef2873842a39c
refs/heads/rebased_master
2022-05-29T17:10:20.214052
2020-02-13T02:20:37
2020-02-17T15:34:57
180,630,428
0
0
Apache-2.0
2019-04-10T17:25:04
2019-04-10T17:25:04
null
UTF-8
Java
false
false
1,041
java
/* * Copyright 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.j2cl.junit.apt; import org.junit.Test; /** A simple Unit test to test processing in {@link J2clTestingProcessingStepTest}. */ public abstract class JUnit4AbstractTestCase { @Test public abstract void testOverriddenWithTest(); @Test public abstract void testOverriddenWithoutTest(); @Test public abstract void testOverriddenWithTestAndIgnore(); @Test public abstract void testOverriddenWithIgnoreButNoTest(); }
[ "copybara-worker@google.com" ]
copybara-worker@google.com
4afb999e6844115cf2bacefbb6e4f4df05be5ab8
4741224b19b63f2812da49aef190db042699322f
/chapter_005/src/test/java/list/SimpleArrayListTest.java
ba9a143a194d0dacda7321dd7376b6944fd7466f
[ "Apache-2.0" ]
permissive
ShamRail/job4j
884855508b5e08e517819a6f69bc60107bf58fab
1036cc2c2e72d1b5db027d334607e151c41c4018
refs/heads/master
2022-11-29T22:16:09.575583
2020-02-07T07:16:16
2020-02-07T07:16:16
139,074,546
0
1
Apache-2.0
2022-11-16T05:30:05
2018-06-28T22:33:28
Java
UTF-8
Java
false
false
2,748
java
package list; import org.hamcrest.core.Is; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class SimpleArrayListTest { SimpleArrayList<Integer> numbers = new SimpleArrayList<>(); @Before public void setup() { numbers.add(1); numbers.add(2); numbers.add(3); numbers.add(4); numbers.add(5); } @Test public void whenTestAddAndGetMethods() { Assert.assertThat(numbers.get(0), Is.is(5)); Assert.assertThat(numbers.get(1), Is.is(4)); Assert.assertThat(numbers.get(2), Is.is(3)); Assert.assertThat(numbers.get(3), Is.is(2)); Assert.assertThat(numbers.get(4), Is.is(1)); } @Test public void whenDeleteFirstElement() { Assert.assertThat(numbers.delete(), Is.is(5)); Assert.assertThat(numbers.get(0), Is.is(4)); Assert.assertThat(numbers.get(1), Is.is(3)); Assert.assertThat(numbers.get(2), Is.is(2)); Assert.assertThat(numbers.get(3), Is.is(1)); } @Test public void whenDeleteOneElementFromListThatContainsOneElement() { numbers = new SimpleArrayList<>(); numbers.add(1); Assert.assertThat(numbers.delete(), Is.is(1)); Assert.assertThat(numbers.size(), Is.is(0)); } @Test public void whenDeleteOneElementFromListThatContainsTwoElements() { numbers = new SimpleArrayList<>(); numbers.add(1); numbers.add(2); Assert.assertThat(numbers.delete(), Is.is(2)); Assert.assertThat(numbers.get(0), Is.is(1)); } @Test public void whenDeleteOneLastElementFromListThatContainsOneElement() { numbers = new SimpleArrayList<>(); numbers.add(1); Assert.assertThat(numbers.deleteLast(), Is.is(1)); Assert.assertThat(numbers.size(), Is.is(0)); } @Test public void whenDeleteOneLastElementFromListThatContainsTwoElements() { numbers = new SimpleArrayList<>(); numbers.add(1); numbers.add(2); Assert.assertThat(numbers.deleteLast(), Is.is(1)); Assert.assertThat(numbers.get(0), Is.is(2)); } @Test public void whenDeleteLastElemet() { Assert.assertThat(numbers.deleteLast(), Is.is(1)); Assert.assertThat(numbers.get(0), Is.is(5)); Assert.assertThat(numbers.get(1), Is.is(4)); Assert.assertThat(numbers.get(2), Is.is(3)); Assert.assertThat(numbers.get(3), Is.is(2)); } @Test public void whenListIsEmptyDeleteMethodsMustReturnNull() { numbers = new SimpleArrayList<>(); Assert.assertThat(numbers.delete(), Is.is((Integer) null)); Assert.assertThat(numbers.deleteLast(), Is.is((Integer) null)); } }
[ "rail1999g102r@mail.ru" ]
rail1999g102r@mail.ru
fec91ec4b28ada68ff3fc2f01bd4e70c43b1e231
271eb615da69ad165a2ecebb6865dbd6bc59f6f3
/src/main/java/milo/utils/validators/Iban.java
019bc093035914ccb6b7a0808858a2fa9fcf9b84
[ "MIT" ]
permissive
caricsvk/banking-webapp
59ea66135ce4811ad08246bb1866d16f60e57b27
dda282cfcf6c03513ff954abfd0c25f5112363b7
refs/heads/master
2021-05-11T03:07:14.859051
2018-01-24T00:24:49
2018-01-24T00:24:49
117,159,746
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package milo.utils.validators; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target({ METHOD, FIELD, PARAMETER }) @Retention(RUNTIME) @Constraint(validatedBy = IbanValidator.class) public @interface Iban { String message() default "IBAN is invalid"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; }
[ "caricsvk@gmail.com" ]
caricsvk@gmail.com
a369b979d46ebf43f009b4e19a345daabef45a0d
0c359e241cce729ce777db41d3a4feefa48c30c0
/src/main/java/com/controllerface/cmdr_j/classes/modules/optional/limpets/collectorlimpet/size7/CollectorLimpet_7A.java
cde567e1a1800d330b582775616c245e45e55c37
[]
no_license
controllerface/CMDR-J
760cafe4b89fc86715ee7941d66eaaf7978cf067
9fc70e1ae2f2119e3dc93bbc9a26544526beb56a
refs/heads/main
2022-09-29T02:43:58.308231
2022-09-12T02:09:01
2022-09-12T02:09:01
128,938,494
1
1
null
2021-11-21T01:42:20
2018-04-10T13:37:30
Java
UTF-8
Java
false
false
1,486
java
package com.controllerface.cmdr_j.classes.modules.optional.limpets.collectorlimpet.size7; import com.controllerface.cmdr_j.classes.data.ItemEffects; import com.controllerface.cmdr_j.classes.data.ItemEffectData; import com.controllerface.cmdr_j.classes.modules.optional.limpets.collectorlimpet.AbstractCollectorLimpet; import com.controllerface.cmdr_j.enums.equipment.modules.stats.ItemEffect; public class CollectorLimpet_7A extends AbstractCollectorLimpet { public CollectorLimpet_7A() { super("7A Collector Limpet Controller", new ItemEffects( new ItemEffectData(ItemEffect.Size, 7.0), new ItemEffectData(ItemEffect.Class, "A"), new ItemEffectData(ItemEffect.Mass, 128d), new ItemEffectData(ItemEffect.Integrity, 183d), new ItemEffectData(ItemEffect.PowerDraw, 0.97d), new ItemEffectData(ItemEffect.BootTime, 6d), new ItemEffectData(ItemEffect.MaxActiveDrones, 4d), new ItemEffectData(ItemEffect.DroneTargetRange, 2040d), new ItemEffectData(ItemEffect.DroneLifeTime, 720d), new ItemEffectData(ItemEffect.DroneSpeed, 200d), new ItemEffectData(ItemEffect.DroneMultiTargetSpeed, 60d) )); } @Override public long price() { return 6_998_400; } }
[ "controll.face@gmail.com" ]
controll.face@gmail.com
7bd9e2983858af5faf3c252bb325929263ad9cf6
434d1ca1295fbee39b48de570918db9a3d928321
/app/build/generated/source/buildConfig/debug/xyz/elfanrodhian/myfamilylocator/BuildConfig.java
f411070b6d41b75ebf3bd9224ded6f3b9b3738d9
[]
no_license
vickazy/MyFamilyLocator
5b7d383be481785af43776e968cb936a8816c7d2
cac81be61c051aa08f17033930abe0acfa9657f9
refs/heads/master
2021-01-01T09:56:13.645614
2019-01-02T07:07:06
2019-01-02T07:07:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
/** * Automatically generated file. DO NOT MODIFY */ package xyz.elfanrodhian.myfamilylocator; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "xyz.elfanrodhian.myfamilylocator"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
[ "elfanapoywali@gmail.com" ]
elfanapoywali@gmail.com
c8b6a980fe2e0d59fd2aeb7418a780fe81a7f46e
1be2531a7f72fd5d780edf5fcb475a875cb9053d
/src/main/java/org/cyclops/integratedtunnels/core/part/PartTypeTunnelAspectsWorld.java
d4ada46d98a8fcfd3532a34dc0ca5b5d6fe3ca0b
[ "MIT" ]
permissive
CyclopsMC/IntegratedTunnels
630f348f5a322a106e6a799709ed3edac5e161b3
a69941c8c96f00a192f9310c702b0bc7bcfd9ee4
refs/heads/master-1.18
2023-07-19T18:50:28.013367
2023-07-08T12:40:29
2023-07-08T12:40:29
69,093,816
29
24
MIT
2022-05-11T07:25:21
2016-09-24T09:45:58
Java
UTF-8
Java
false
false
765
java
package org.cyclops.integratedtunnels.core.part; import org.cyclops.integrateddynamics.api.part.PartRenderPosition; import org.cyclops.integrateddynamics.api.part.write.IPartStateWriter; import org.cyclops.integrateddynamics.api.part.write.IPartTypeWriter; /** * Base part for a tunnels with aspects. * @author rubensworks */ public abstract class PartTypeTunnelAspectsWorld<P extends IPartTypeWriter<P, S>, S extends IPartStateWriter<P>> extends PartTypeTunnelAspects<P, S> { public PartTypeTunnelAspectsWorld(String name) { super(name, new PartRenderPosition(0.1875F, 0.1875F, 0.625F, 0.625F)); } @Override public int getConsumptionRate(S state) { return state.hasVariable() ? 32 : super.getConsumptionRate(state); } }
[ "rubensworks@gmail.com" ]
rubensworks@gmail.com
2a77e1e85bf173d1fd3596329b92ba3388f598db
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/22/22_26c988a391ea0f5d427b4b024e820b453a17379e/TransformationMetadata/22_26c988a391ea0f5d427b4b024e820b453a17379e_TransformationMetadata_t.java
05b785da82a0eb8046f9acba6d26d3d935fe2c4b
[]
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
46,656
java
/* * JBoss, Home of Professional Open Source. * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Some portions may be licensed * to Red Hat, Inc. under one or more contributor license agreements. * * 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., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. */ package org.teiid.query.metadata; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; import org.jboss.virtual.VirtualFile; import org.teiid.adminapi.impl.VDBMetaData; import org.teiid.api.exception.query.QueryMetadataException; import org.teiid.core.TeiidComponentException; import org.teiid.core.types.BlobImpl; import org.teiid.core.types.ClobImpl; import org.teiid.core.types.DataTypeManager; import org.teiid.core.types.InputStreamFactory; import org.teiid.core.types.SQLXMLImpl; import org.teiid.core.util.ArgCheck; import org.teiid.core.util.LRUCache; import org.teiid.core.util.ObjectConverterUtil; import org.teiid.core.util.StringUtil; import org.teiid.metadata.AbstractMetadataRecord; import org.teiid.metadata.Column; import org.teiid.metadata.ColumnSet; import org.teiid.metadata.Datatype; import org.teiid.metadata.ForeignKey; import org.teiid.metadata.KeyRecord; import org.teiid.metadata.Procedure; import org.teiid.metadata.ProcedureParameter; import org.teiid.metadata.Schema; import org.teiid.metadata.Table; import org.teiid.metadata.BaseColumn.NullType; import org.teiid.metadata.Column.SearchType; import org.teiid.metadata.ProcedureParameter.Type; import org.teiid.query.QueryPlugin; import org.teiid.query.function.FunctionLibrary; import org.teiid.query.function.FunctionTree; import org.teiid.query.mapping.relational.QueryNode; import org.teiid.query.mapping.xml.MappingDocument; import org.teiid.query.mapping.xml.MappingLoader; import org.teiid.query.mapping.xml.MappingNode; import org.teiid.query.sql.lang.SPParameter; /** * Teiid's implementation of the QueryMetadataInterface that reads columns, groups, models etc. * from the metadata object model. */ public class TransformationMetadata extends BasicQueryMetadata implements Serializable { private final class VirtualFileInputStreamFactory extends InputStreamFactory { private final VirtualFile f; private VirtualFileInputStreamFactory(VirtualFile f) { this.f = f; } @Override public InputStream getInputStream() throws IOException { return f.openStream(); } @Override public long getLength() { try { return f.getSize(); } catch (IOException e) { } return super.getLength(); } @Override public void free() throws IOException { f.close(); } } public static class Resource { public Resource(VirtualFile file, boolean visible) { this.file = file; this.visible = visible; } VirtualFile file; boolean visible; } private static final long serialVersionUID = 1058627332954475287L; /** Delimiter character used when specifying fully qualified entity names */ public static final char DELIMITER_CHAR = StringUtil.Constants.DOT_CHAR; public static final String DELIMITER_STRING = String.valueOf(DELIMITER_CHAR); // error message cached to avoid i18n lookup each time public static String NOT_EXISTS_MESSAGE = StringUtil.Constants.SPACE+QueryPlugin.Util.getString("TransformationMetadata.does_not_exist._1"); //$NON-NLS-1$ private static Properties EMPTY_PROPS = new Properties(); private final CompositeMetadataStore store; private Map<String, Resource> vdbEntries; private FunctionLibrary functionLibrary; private VDBMetaData vdbMetaData; /* * TODO: move caching to jboss cache structure */ private final Map<String, Object> metadataCache = Collections.synchronizedMap(new LRUCache<String, Object>(250)); private final Map<String, Object> groupInfoCache = Collections.synchronizedMap(new LRUCache<String, Object>(250)); private final Map<String, Collection<Table>> partialNameToFullNameCache = Collections.synchronizedMap(new LRUCache<String, Collection<Table>>(1000)); private final Map<String, Collection<StoredProcedureInfo>> procedureCache = Collections.synchronizedMap(new LRUCache<String, Collection<StoredProcedureInfo>>(200)); /** * TransformationMetadata constructor * @param context Object containing the info needed to lookup metadta. */ public TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<String, Resource> vdbEntries, FunctionTree systemFunctions, Collection<FunctionTree> functionTrees) { ArgCheck.isNotNull(store); this.vdbMetaData = vdbMetadata; this.store = store; if (vdbEntries == null) { this.vdbEntries = Collections.emptyMap(); } else { this.vdbEntries = vdbEntries; } if (functionTrees == null) { this.functionLibrary = new FunctionLibrary(systemFunctions); } else { this.functionLibrary = new FunctionLibrary(systemFunctions, functionTrees.toArray(new FunctionTree[functionTrees.size()])); } } //================================================================================== // I N T E R F A C E M E T H O D S //================================================================================== public Object getElementID(final String elementName) throws TeiidComponentException, QueryMetadataException { int columnIndex = elementName.lastIndexOf(TransformationMetadata.DELIMITER_STRING); if (columnIndex == -1) { throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE); } Table table = this.store.findGroup(elementName.substring(0, columnIndex).toLowerCase()); String shortElementName = elementName.substring(columnIndex + 1); for (Column column : (List<Column>)getElementIDsInGroupID(table)) { if (column.getName().equalsIgnoreCase(shortElementName)) { return column; } } throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE); } public Table getGroupID(final String groupName) throws TeiidComponentException, QueryMetadataException { return getMetadataStore().findGroup(groupName.toLowerCase()); } public Collection<String> getGroupsForPartialName(final String partialGroupName) throws TeiidComponentException, QueryMetadataException { ArgCheck.isNotEmpty(partialGroupName); Collection<Table> matches = this.partialNameToFullNameCache.get(partialGroupName); if (matches == null) { String partialName = DELIMITER_CHAR + partialGroupName.toLowerCase(); matches = getMetadataStore().getGroupsForPartialName(partialName); this.partialNameToFullNameCache.put(partialGroupName, matches); } if (matches.isEmpty()) { return Collections.emptyList(); } Collection<String> filteredResult = new ArrayList<String>(matches.size()); for (Table table : matches) { if (vdbMetaData == null || vdbMetaData.isVisible(table.getParent().getName())) { filteredResult.add(table.getFullName()); } } return filteredResult; } public Object getModelID(final Object groupOrElementID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(AbstractMetadataRecord.class, groupOrElementID); AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) groupOrElementID; AbstractMetadataRecord parent = metadataRecord.getParent(); if (parent instanceof Schema) { return parent; } if (parent == null) { throw createInvalidRecordTypeException(groupOrElementID); } parent = parent.getParent(); if (parent instanceof Schema) { return parent; } throw createInvalidRecordTypeException(groupOrElementID); } public String getFullName(final Object metadataID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID); AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getFullName(); } public String getFullElementName(final String fullGroupName, final String shortElementName) throws TeiidComponentException, QueryMetadataException { ArgCheck.isNotEmpty(fullGroupName); ArgCheck.isNotEmpty(shortElementName); return fullGroupName + DELIMITER_CHAR + shortElementName; } public String getShortElementName(final String fullElementName) throws TeiidComponentException, QueryMetadataException { ArgCheck.isNotEmpty(fullElementName); int index = fullElementName.lastIndexOf(DELIMITER_CHAR); if(index >= 0) { return fullElementName.substring(index+1); } return fullElementName; } /** * Return the text portion of the fullElementName representing a group. * That means that this should only return text that is part of the * fullElementName and not look up new IDs or do much of anything fancy. * This method is used by the resolver to decide which portion of a fully- * qualified element name is the group name. It will compare whatever comes * back with the actual group names and aliases in the query, which is * why it is important not to introduce new metadata here. Also, returning * null indicates that no portion of the fullElementName is a * group name - that is ok as it will be resolved as an ambiguous element. * @see org.teiid.query.metadata.QueryMetadataInterface#getGroupName(java.lang.String) */ public String getGroupName(final String fullElementName) throws TeiidComponentException, QueryMetadataException { ArgCheck.isNotEmpty(fullElementName); int index = fullElementName.lastIndexOf(DELIMITER_CHAR); if(index >= 0) { return fullElementName.substring(0, index); } return null; } public List getElementIDsInGroupID(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); return ((Table)groupID).getColumns(); } public Object getGroupIDForElementID(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { Column columnRecord = (Column) elementID; return this.getGroupID(getGroupName(columnRecord.getFullName())); } else if(elementID instanceof ProcedureParameter){ ProcedureParameter columnRecord = (ProcedureParameter) elementID; return this.getGroupID(getGroupName(columnRecord.getFullName())); } else { throw createInvalidRecordTypeException(elementID); } } public StoredProcedureInfo getStoredProcedureInfoForProcedure(final String fullyQualifiedProcedureName) throws TeiidComponentException, QueryMetadataException { ArgCheck.isNotEmpty(fullyQualifiedProcedureName); String lowerGroupName = fullyQualifiedProcedureName.toLowerCase(); Collection<StoredProcedureInfo> results = this.procedureCache.get(lowerGroupName); if (results == null) { Collection<Procedure> procRecords = getMetadataStore().getStoredProcedure(lowerGroupName); results = new ArrayList<StoredProcedureInfo>(procRecords.size()); for (Procedure procRecord : procRecords) { String procedureFullName = procRecord.getFullName(); // create the storedProcedure info object that would hold procedure's metadata StoredProcedureInfo procInfo = new StoredProcedureInfo(); procInfo.setProcedureCallableName(procedureFullName); procInfo.setProcedureID(procRecord); // modelID for the procedure procInfo.setModelID(procRecord.getParent()); // get the parameter metadata info for (ProcedureParameter paramRecord : procRecord.getParameters()) { String runtimeType = paramRecord.getRuntimeType(); int direction = this.convertParamRecordTypeToStoredProcedureType(paramRecord.getType()); // create a parameter and add it to the procedure object SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction, paramRecord.getFullName()); spParam.setMetadataID(paramRecord); spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType)); procInfo.addParameter(spParam); } // if the procedure returns a resultSet, obtain resultSet metadata if(procRecord.getResultSet() != null) { ColumnSet<Procedure> resultRecord = procRecord.getResultSet(); // resultSet is the last parameter in the procedure int lastParamIndex = procInfo.getParameters().size() + 1; SPParameter param = new SPParameter(lastParamIndex, SPParameter.RESULT_SET, resultRecord.getFullName()); param.setClassType(java.sql.ResultSet.class); param.setMetadataID(resultRecord); for (Column columnRecord : resultRecord.getColumns()) { String colType = columnRecord.getRuntimeType(); param.addResultSetColumn(columnRecord.getFullName(), DataTypeManager.getDataTypeClass(colType), columnRecord); } procInfo.addParameter(param); } // if this is a virtual procedure get the procedure plan if(procRecord.isVirtual()) { QueryNode queryNode = new QueryNode(procedureFullName, procRecord.getQueryPlan()); procInfo.setQueryPlan(queryNode); } //subtract 1, to match up with the server procInfo.setUpdateCount(procRecord.getUpdateCount() -1); results.add(procInfo); } this.procedureCache.put(lowerGroupName, results); } StoredProcedureInfo result = null; for (StoredProcedureInfo storedProcedureInfo : results) { Schema schema = (Schema)storedProcedureInfo.getModelID(); if(fullyQualifiedProcedureName.equalsIgnoreCase(storedProcedureInfo.getProcedureCallableName()) || vdbMetaData == null || vdbMetaData.isVisible(schema.getName())){ if (result != null) { throw new QueryMetadataException(QueryPlugin.Util.getString("ambiguous_procedure", fullyQualifiedProcedureName)); //$NON-NLS-1$ } result = storedProcedureInfo; } } if (result == null) { throw new QueryMetadataException(fullyQualifiedProcedureName+NOT_EXISTS_MESSAGE); } return result; } /** * Method to convert the parameter type returned from a ProcedureParameterRecord * to the parameter type expected by StoredProcedureInfo * @param parameterType * @return */ private int convertParamRecordTypeToStoredProcedureType(final ProcedureParameter.Type parameterType) { switch (parameterType) { case In : return SPParameter.IN; case Out : return SPParameter.OUT; case InOut : return SPParameter.INOUT; case ReturnValue : return SPParameter.RETURN_VALUE; default : return -1; } } public String getElementType(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getRuntimeType(); } else if(elementID instanceof ProcedureParameter){ return ((ProcedureParameter) elementID).getRuntimeType(); } else { throw createInvalidRecordTypeException(elementID); } } public Object getDefaultValue(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getDefaultValue(); } else if(elementID instanceof ProcedureParameter){ return ((ProcedureParameter) elementID).getDefaultValue(); } else { throw createInvalidRecordTypeException(elementID); } } public Object getMinimumValue(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getMinimumValue(); } else if(elementID instanceof ProcedureParameter){ return null; } else { throw createInvalidRecordTypeException(elementID); } } public Object getMaximumValue(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getMaximumValue(); } else if(elementID instanceof ProcedureParameter){ return null; } else { throw createInvalidRecordTypeException(elementID); } } public boolean isVirtualGroup(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); return ((Table) groupID).isVirtual(); } /** * @see org.teiid.query.metadata.QueryMetadataInterface#isProcedureInputElement(java.lang.Object) * @since 4.2 */ public boolean isProcedure(final Object groupID) throws TeiidComponentException, QueryMetadataException { if(groupID instanceof Procedure) { return true; } if(groupID instanceof Table){ return false; } throw createInvalidRecordTypeException(groupID); } public boolean isVirtualModel(final Object modelID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Schema.class, modelID); Schema modelRecord = (Schema) modelID; return !modelRecord.isPhysical(); } public QueryNode getVirtualPlan(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; if (!tableRecord.isVirtual()) { throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.QueryPlan_could_not_be_found_for_physical_group__6")+tableRecord.getFullName()); //$NON-NLS-1$ } String transQuery = tableRecord.getSelectTransformation(); QueryNode queryNode = new QueryNode(tableRecord.getFullName(), transQuery); // get any bindings and add them onto the query node List bindings = tableRecord.getBindings(); if(bindings != null) { for(Iterator bindIter = bindings.iterator();bindIter.hasNext();) { queryNode.addBinding((String)bindIter.next()); } } return queryNode; } public String getInsertPlan(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecordImpl = (Table)groupID; if (!tableRecordImpl.isVirtual()) { throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.InsertPlan_could_not_be_found_for_physical_group__8")+tableRecordImpl.getFullName()); //$NON-NLS-1$ } return ((Table)groupID).getInsertPlan(); } public String getUpdatePlan(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecordImpl = (Table)groupID; if (!tableRecordImpl.isVirtual()) { throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.InsertPlan_could_not_be_found_for_physical_group__10")+tableRecordImpl.getFullName()); //$NON-NLS-1$ } return ((Table)groupID).getUpdatePlan(); } public String getDeletePlan(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecordImpl = (Table)groupID; if (!tableRecordImpl.isVirtual()) { throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.DeletePlan_could_not_be_found_for_physical_group__12")+tableRecordImpl.getFullName()); //$NON-NLS-1$ } return ((Table)groupID).getDeletePlan(); } public boolean modelSupports(final Object modelID, final int modelConstant) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Schema.class, modelID); switch(modelConstant) { default: throw new UnsupportedOperationException(QueryPlugin.Util.getString("TransformationMetadata.Unknown_support_constant___12") + modelConstant); //$NON-NLS-1$ } } public boolean groupSupports(final Object groupID, final int groupConstant) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; switch(groupConstant) { case SupportConstants.Group.UPDATE: return tableRecord.supportsUpdate(); default: throw new UnsupportedOperationException(QueryPlugin.Util.getString("TransformationMetadata.Unknown_support_constant___12") + groupConstant); //$NON-NLS-1$ } } public boolean elementSupports(final Object elementID, final int elementConstant) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { Column columnRecord = (Column) elementID; switch(elementConstant) { case SupportConstants.Element.NULL: return columnRecord.getNullType() == NullType.Nullable; case SupportConstants.Element.NULL_UNKNOWN: return columnRecord.getNullType() == NullType.Unknown; case SupportConstants.Element.SEARCHABLE_COMPARE: return (columnRecord.getSearchType() == SearchType.Searchable || columnRecord.getSearchType() == SearchType.All_Except_Like); case SupportConstants.Element.SEARCHABLE_LIKE: return (columnRecord.getSearchType() == SearchType.Searchable || columnRecord.getSearchType() == SearchType.Like_Only); case SupportConstants.Element.SELECT: return columnRecord.isSelectable(); case SupportConstants.Element.UPDATE: return columnRecord.isUpdatable(); case SupportConstants.Element.DEFAULT_VALUE: Object defaultValue = columnRecord.getDefaultValue(); if(defaultValue == null) { return false; } return true; case SupportConstants.Element.AUTO_INCREMENT: return columnRecord.isAutoIncremented(); case SupportConstants.Element.CASE_SENSITIVE: return columnRecord.isCaseSensitive(); case SupportConstants.Element.SIGNED: return columnRecord.isSigned(); default: throw new UnsupportedOperationException(QueryPlugin.Util.getString("TransformationMetadata.Unknown_support_constant___12") + elementConstant); //$NON-NLS-1$ } } else if(elementID instanceof ProcedureParameter) { ProcedureParameter columnRecord = (ProcedureParameter) elementID; switch(elementConstant) { case SupportConstants.Element.NULL: return columnRecord.getNullType() == NullType.Nullable; case SupportConstants.Element.NULL_UNKNOWN: return columnRecord.getNullType() == NullType.Unknown; case SupportConstants.Element.SEARCHABLE_COMPARE: case SupportConstants.Element.SEARCHABLE_LIKE: return false; case SupportConstants.Element.SELECT: return columnRecord.getType() != Type.In; case SupportConstants.Element.UPDATE: return false; case SupportConstants.Element.DEFAULT_VALUE: Object defaultValue = columnRecord.getDefaultValue(); if(defaultValue == null) { return false; } return true; case SupportConstants.Element.AUTO_INCREMENT: return false; case SupportConstants.Element.CASE_SENSITIVE: return false; case SupportConstants.Element.SIGNED: return true; default: throw new UnsupportedOperationException(QueryPlugin.Util.getString("TransformationMetadata.Unknown_support_constant___12") + elementConstant); //$NON-NLS-1$ } } else { throw createInvalidRecordTypeException(elementID); } } private IllegalArgumentException createInvalidRecordTypeException(Object elementID) { return new IllegalArgumentException(QueryPlugin.Util.getString("TransformationMetadata.Invalid_type", elementID.getClass().getName())); //$NON-NLS-1$ } public int getMaxSetSize(final Object modelID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Schema.class, modelID); return 0; } public Collection getIndexesInGroup(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); return ((Table)groupID).getIndexes(); } public Collection getUniqueKeysInGroup(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecordImpl = (Table)groupID; ArrayList<ColumnSet> result = new ArrayList<ColumnSet>(tableRecordImpl.getUniqueKeys()); if (tableRecordImpl.getPrimaryKey() != null) { result.add(tableRecordImpl.getPrimaryKey()); } for (KeyRecord key : tableRecordImpl.getIndexes()) { if (key.getType() == KeyRecord.Type.Unique) { result.add(key); } } return result; } public Collection getForeignKeysInGroup(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); return ((Table)groupID).getForeignKeys(); } public Object getPrimaryKeyIDForForeignKeyID(final Object foreignKeyID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(ForeignKey.class, foreignKeyID); ForeignKey fkRecord = (ForeignKey) foreignKeyID; return fkRecord.getPrimaryKey(); } public Collection getAccessPatternsInGroup(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); return ((Table)groupID).getAccessPatterns(); } public List getElementIDsInIndex(final Object index) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(ColumnSet.class, index); return ((ColumnSet)index).getColumns(); } public List getElementIDsInKey(final Object key) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(ColumnSet.class, key); return ((ColumnSet)key).getColumns(); } public List getElementIDsInAccessPattern(final Object accessPattern) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(ColumnSet.class, accessPattern); return ((ColumnSet)accessPattern).getColumns(); } public boolean isXMLGroup(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; return tableRecord.getTableType() == Table.Type.Document; } /** * @see org.teiid.query.metadata.QueryMetadataInterface#hasMaterialization(java.lang.Object) * @since 4.2 */ public boolean hasMaterialization(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; return tableRecord.isMaterialized(); } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getMaterialization(java.lang.Object) * @since 4.2 */ public Object getMaterialization(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; if(tableRecord.isMaterialized()) { return tableRecord.getMaterializedTable(); } return null; } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getMaterializationStage(java.lang.Object) * @since 4.2 */ public Object getMaterializationStage(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; if(tableRecord.isMaterialized()) { return tableRecord.getMaterializedStageTable(); } return null; } public MappingNode getMappingNode(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; final String groupName = tableRecord.getFullName(); if(tableRecord.isVirtual()) { // get mappin transform String document = tableRecord.getSelectTransformation(); InputStream inputStream = new ByteArrayInputStream(document.getBytes()); MappingLoader reader = new MappingLoader(); MappingDocument mappingDoc = null; try{ mappingDoc = reader.loadDocument(inputStream); mappingDoc.setName(groupName); } catch (Exception e){ throw new TeiidComponentException(e, QueryPlugin.Util.getString("TransformationMetadata.Error_trying_to_read_virtual_document_{0},_with_body__n{1}_1", groupName, mappingDoc)); //$NON-NLS-1$ } finally { try { inputStream.close(); } catch(Exception e) {} } return (MappingDocument)mappingDoc.clone(); } return null; } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getVirtualDatabaseName() */ public String getVirtualDatabaseName() throws TeiidComponentException, QueryMetadataException { if (vdbMetaData == null) { return null; } return vdbMetaData.getName(); } public int getVirtualDatabaseVersion() { if (vdbMetaData == null) { return 0; } return vdbMetaData.getVersion(); } public VDBMetaData getVdbMetaData() { return vdbMetaData; } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getXMLTempGroups(java.lang.Object) */ public Collection getXMLTempGroups(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; if(tableRecord.getTableType() == Table.Type.Document) { return this.store.getXMLTempGroups(tableRecord); } return Collections.EMPTY_SET; } public int getCardinality(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); return ((Table) groupID).getCardinality(); } public List<SQLXMLImpl> getXMLSchemas(final Object groupID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(Table.class, groupID); Table tableRecord = (Table) groupID; // lookup transformation record for the group String groupName = tableRecord.getFullName(); // get the schema Paths List<String> schemaPaths = tableRecord.getSchemaPaths(); List<SQLXMLImpl> schemas = new LinkedList<SQLXMLImpl>(); if (schemaPaths == null) { return schemas; } File f = new File(tableRecord.getResourcePath()); String path = f.getParent(); if (File.separatorChar != '/') { path = path.replace(File.separatorChar, '/'); } for (String string : schemaPaths) { String parentPath = path; boolean relative = false; while (string.startsWith("../")) { //$NON-NLS-1$ relative = true; string = string.substring(3); parentPath = new File(parentPath).getParent(); } SQLXMLImpl schema = null; if (!relative) { schema = getVDBResourceAsSQLXML(string); } if (schema == null) { if (!parentPath.endsWith("/")) { //$NON-NLS-1$ parentPath += "/"; //$NON-NLS-1$ } schema = getVDBResourceAsSQLXML(parentPath + string); } if (schema == null) { throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.Error_trying_to_read_schemas_for_the_document/table____1")+groupName); //$NON-NLS-1$ } schemas.add(schema); } return schemas; } public String getNameInSource(final Object metadataID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID); return ((AbstractMetadataRecord) metadataID).getNameInSource(); } public int getElementLength(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getLength(); } else if(elementID instanceof ProcedureParameter){ return ((ProcedureParameter) elementID).getLength(); } else { throw createInvalidRecordTypeException(elementID); } } public int getPosition(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getPosition(); } else if(elementID instanceof ProcedureParameter) { return ((ProcedureParameter) elementID).getPosition(); } else { throw createInvalidRecordTypeException(elementID); } } public int getPrecision(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getPrecision(); } else if(elementID instanceof ProcedureParameter) { return ((ProcedureParameter) elementID).getPrecision(); } else { throw createInvalidRecordTypeException(elementID); } } public int getRadix(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getRadix(); } else if(elementID instanceof ProcedureParameter) { return ((ProcedureParameter) elementID).getRadix(); } else { throw createInvalidRecordTypeException(elementID); } } public String getFormat(Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getFormat(); } throw createInvalidRecordTypeException(elementID); } public int getScale(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getScale(); } else if(elementID instanceof ProcedureParameter) { return ((ProcedureParameter) elementID).getScale(); } else { throw createInvalidRecordTypeException(elementID); } } public int getDistinctValues(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getDistinctValues(); } else if(elementID instanceof ProcedureParameter) { return -1; } else { throw createInvalidRecordTypeException(elementID); } } public int getNullValues(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getNullValues(); } else if(elementID instanceof ProcedureParameter) { return -1; } else { throw createInvalidRecordTypeException(elementID); } } public String getNativeType(final Object elementID) throws TeiidComponentException, QueryMetadataException { if(elementID instanceof Column) { return ((Column) elementID).getNativeType(); } else if(elementID instanceof ProcedureParameter) { return null; } else { throw createInvalidRecordTypeException(elementID); } } public Properties getExtensionProperties(final Object metadataID) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID); AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; Map<String, String> result = metadataRecord.getProperties(); if (result == null) { return EMPTY_PROPS; } Properties p = new Properties(); p.putAll(result); return p; } /** * @see org.teiid.query.metadata.BasicQueryMetadata#getBinaryVDBResource(java.lang.String) * @since 4.3 */ public byte[] getBinaryVDBResource(String resourcePath) throws TeiidComponentException, QueryMetadataException { final VirtualFile f = getFile(resourcePath); if (f == null) { return null; } try { return ObjectConverterUtil.convertToByteArray(f.openStream()); } catch (IOException e) { throw new TeiidComponentException(e); } } public ClobImpl getVDBResourceAsClob(String resourcePath) { final VirtualFile f = getFile(resourcePath); if (f == null) { return null; } return new ClobImpl(new VirtualFileInputStreamFactory(f), -1); } public SQLXMLImpl getVDBResourceAsSQLXML(String resourcePath) { final VirtualFile f = getFile(resourcePath); if (f == null) { return null; } return new SQLXMLImpl(new VirtualFileInputStreamFactory(f)); } public BlobImpl getVDBResourceAsBlob(String resourcePath) { final VirtualFile f = getFile(resourcePath); if (f == null) { return null; } return new BlobImpl(new VirtualFileInputStreamFactory(f)); } private VirtualFile getFile(String resourcePath) { if (resourcePath == null) { return null; } Resource r = this.vdbEntries.get(resourcePath); if (r != null) { return r.file; } return null; } /** * @see org.teiid.query.metadata.BasicQueryMetadata#getCharacterVDBResource(java.lang.String) * @since 4.3 */ public String getCharacterVDBResource(String resourcePath) throws TeiidComponentException, QueryMetadataException { try { byte[] bytes = getBinaryVDBResource(resourcePath); if (bytes == null) { return null; } return ObjectConverterUtil.convertToString(new ByteArrayInputStream(bytes)); } catch (IOException e) { throw new TeiidComponentException(e); } } public CompositeMetadataStore getMetadataStore() { return this.store; } /** * @see org.teiid.query.metadata.BasicQueryMetadata#getVDBResourcePaths() * @since 4.3 */ public String[] getVDBResourcePaths() throws TeiidComponentException, QueryMetadataException { LinkedList<String> paths = new LinkedList<String>(); for (Map.Entry<String, Resource> entry : this.vdbEntries.entrySet()) { paths.add(entry.getKey()); } return paths.toArray(new String[paths.size()]); } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getModeledType(java.lang.Object) * @since 5.0 */ public String getModeledType(final Object elementID) throws TeiidComponentException, QueryMetadataException { Datatype record = getDatatypeRecord(elementID); if (record != null) { return record.getDatatypeID(); } return null; } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getModeledBaseType(java.lang.Object) * @since 5.0 */ public String getModeledBaseType(final Object elementID) throws TeiidComponentException, QueryMetadataException { Datatype record = getDatatypeRecord(elementID); if (record != null) { return record.getBasetypeID(); } return null; } /** * @see org.teiid.query.metadata.QueryMetadataInterface#getModeledPrimitiveType(java.lang.Object) * @since 5.0 */ public String getModeledPrimitiveType(final Object elementID) throws TeiidComponentException, QueryMetadataException { Datatype record = getDatatypeRecord(elementID); if (record != null) { return record.getPrimitiveTypeID(); } return null; } private Datatype getDatatypeRecord(final Object elementID) { if (elementID instanceof Column) { return ((Column)elementID).getDatatype(); } else if (elementID instanceof ProcedureParameter) { return ((ProcedureParameter)elementID).getDatatype(); } else { throw createInvalidRecordTypeException(elementID); } } @Override public Object addToMetadataCache(Object metadataID, String key, Object value) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID); boolean groupInfo = key.startsWith(GroupInfo.CACHE_PREFIX); key = getCacheKey(key, (AbstractMetadataRecord)metadataID); if (groupInfo) { return this.groupInfoCache.put(key, value); } return this.metadataCache.put(key, value); } @Override public Object getFromMetadataCache(Object metadataID, String key) throws TeiidComponentException, QueryMetadataException { ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID); boolean groupInfo = key.startsWith(GroupInfo.CACHE_PREFIX); key = getCacheKey(key, (AbstractMetadataRecord)metadataID); if (groupInfo) { return this.groupInfoCache.get(key); } return this.metadataCache.get(key); } private String getCacheKey(String key, AbstractMetadataRecord record) { return record.getUUID() + "/" + key; //$NON-NLS-1$ } @Override public FunctionLibrary getFunctionLibrary() { return this.functionLibrary; } @Override public Object getPrimaryKey(Object metadataID) { ArgCheck.isInstanceOf(Table.class, metadataID); Table table = (Table)metadataID; return table.getPrimaryKey(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
95c416a7caede10376b44dff9e0163725f21b76e
3f5227a34aebf68b753ca5cc82e387fd980d3e67
/TraditionalT9/src/main/java/org/nyanya/android/traditionalt9/TraditionalT9.java
59e00f0b50d4fce7a5f9784b2d91ca1fd6ae99b3
[ "LicenseRef-scancode-public-domain" ]
permissive
Wolf4D/TraditionalT9
c40dbbb3e6038e506290725dd19e47d5ed56a14f
833161537a6d26b7f8d0083e02f5da4e0844e375
refs/heads/master
2021-01-13T17:01:31.508311
2017-02-26T16:06:44
2017-02-26T16:06:44
76,749,385
1
1
null
2016-12-17T22:14:33
2016-12-17T22:14:32
null
UTF-8
Java
false
false
49,256
java
package org.nyanya.android.traditionalt9; import java.util.AbstractList; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Timer; import java.util.TimerTask; import android.os.SystemClock; import android.accessibilityservice.AccessibilityServiceInfo; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.inputmethodservice.InputMethodService; import android.inputmethodservice.KeyboardView; import android.os.Handler; import android.preference.PreferenceManager; import android.text.InputType; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.widget.Toast; import android.text.TextUtils; public class TraditionalT9 extends InputMethodService implements KeyboardView.OnKeyboardActionListener { private CharSequence toastLT; private String wnf; private Toast toast; private CandidateView mCandidateView; private InterfaceHandler interfacehandler = null; private StringBuilder mComposing = new StringBuilder(); private StringBuilder mComposingI = new StringBuilder(); private ArrayList<String> mSuggestionStrings = new ArrayList<String>(10); private ArrayList<Integer> mSuggestionInts = new ArrayList<Integer>(10); private AbstractList<String> mSuggestionSym = new ArrayList<String>(16); private static final int NON_EDIT = 0; private static final int EDITING = 1; private static final int EDITING_NOSHOW = 2; private int mEditing = NON_EDIT; private boolean mGaveUpdateWarn = false; private boolean mFirstPress = false; private boolean mIgnoreDPADKeyUp = false; private KeyEvent mDPADkeyEvent = null; protected boolean mWordFound = true; private AbsSymDialog mSymbolPopup = null; private AbsSymDialog mSmileyPopup = null; protected boolean mAddingWord = false; // private boolean mAddingSkipInput = false; private int mPrevious; private int mCharIndex; private String mPreviousWord = ""; private int mCapsMode; private int mLang; private int mLangIndex; private int[] mLangsAvailable = null; private static final int CAPS_OFF = 0; private static final int CAPS_SINGLE = 1; private static final int CAPS_ALL = 2; private final static int[] CAPS_CYCLE = { CAPS_OFF, CAPS_SINGLE, CAPS_ALL }; private final static int T9DELAY = 900; final Handler t9releasehandler = new Handler(); Runnable mt9release = new Runnable() { @Override public void run() { commitReset(); } }; private T9DB db; public static final int MODE_LANG = 0; public static final int MODE_TEXT = 1; public static final int MODE_NUM = 2; private static final int[] MODE_CYCLE = { MODE_LANG, MODE_TEXT, MODE_NUM }; private int mKeyMode; private InputConnection currentInputConnection = null; private SharedPreferences pref; private Toast wordNotFound; /** * Main initialization of the input method component. Be sure to call to * super class. */ @Override public void onCreate() { super.onCreate(); mPrevious = -1; mCharIndex = 0; db = T9DB.getInstance(this); pref = PreferenceManager.getDefaultSharedPreferences(this); mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null)); toast = Toast.makeText(this, "", Toast.LENGTH_SHORT); wordNotFound = Toast.makeText(this, "", Toast.LENGTH_SHORT); if (interfacehandler == null) { interfacehandler = new InterfaceHandler(getLayoutInflater().inflate(R.layout.mainview, null), this); } } @Override public boolean onEvaluateInputViewShown() { Log.d("T9.onEvaluateInputViewShown", "whatis"); if (mEditing == EDITING_NOSHOW) { return false; } if (interfacehandler != null) { return false; } return true; } /** * Called by the framework when your view for creating input needs to be * generated. This will be called the first time your input method is * displayed, and every time it needs to be re-created such as due to a * configuration change. */ @Override public View onCreateInputView() { //updateKeyMode(); View v = getLayoutInflater().inflate(R.layout.mainview, null); interfacehandler.changeView(v); if (mKeyMode == MODE_LANG) { interfacehandler.showHold(true); } else { interfacehandler.showHold(false); } return v; } /** * Called by the framework when your view for showing candidates needs to be * generated, like {@link #onCreateInputView}. */ @Override public View onCreateCandidatesView() { mCandidateView = new CandidateView(this); return mCandidateView; } protected void showSymbolPage() { if (mSymbolPopup == null) { mSymbolPopup = new SymbolDialog(this, getLayoutInflater().inflate(R.layout.symbolview, null)); } mSymbolPopup.doShow(getWindow().getWindow().getDecorView()); } protected void showSmileyPage() { if (mSmileyPopup == null) { mSmileyPopup = new SmileyDialog(this, getLayoutInflater().inflate(R.layout.symbolview, null)); } mSmileyPopup.doShow(getWindow().getWindow().getDecorView()); } private void clearState() { mSuggestionStrings.clear(); mSuggestionInts.clear(); mSuggestionSym.clear(); mPreviousWord = ""; mComposing.setLength(0); mComposingI.setLength(0); mWordFound = true; } private String getSurroundingWord() { CharSequence before = currentInputConnection.getTextBeforeCursor(50, 0); CharSequence after = currentInputConnection.getTextAfterCursor(50, 0); int bounds = -1; if (!TextUtils.isEmpty(before)) { bounds = before.length() -1; while (bounds > 0 && !Character.isWhitespace(before.charAt(bounds))) { bounds--; } before = before.subSequence(bounds, before.length()); } if (!TextUtils.isEmpty(after)) { bounds = 0; while (bounds < after.length() && !Character.isWhitespace(after.charAt(bounds))) { bounds++; } Log.d("getSurroundingWord", "after:"+after.toString()); after = after.subSequence(0, bounds); } return before.toString().trim() + after.toString().trim(); } protected void showAddWord() { if (mKeyMode == MODE_LANG) { // decide if we are going to look for work to base on String template = mComposing.toString(); if (template.length() == 0) { //get surrounding word: template = getSurroundingWord(); } Log.d("showAddWord", "WORD: " + template); Intent awintent = new Intent(TraditionalT9.this, AddWordAct.class); awintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); awintent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // awintent.putExtra("org.nyanya.android.traditionalt9.word", mComposing.toString()); awintent.putExtra("org.nyanya.android.traditionalt9.word", template); awintent.putExtra("org.nyanya.android.traditionalt9.lang", mLang); clearState(); // InputConnection ic = getCurrentInputConnection(); // ic.setComposingText("", 0); // ic.finishComposingText(); currentInputConnection.setComposingText("", 0); currentInputConnection.finishComposingText(); updateCandidates(); //onFinishInput(); mWordFound = true; startActivity(awintent); } } // sanitize lang and set index for cycling lang // Need to check if last lang is available, if not, set index to -1 and set lang to default to 0 private int sanitizeLang(int lang) { if (mLangsAvailable.length < 1 || lang == -1) { Log.w("T9.sanitizeLang", "This shouldn't happen."); return 0; } if (lang >= LangHelper.NLANGS) { Log.w("T9.sanitizeLang", "Previous lang not supported: " + lang + " langs: " + Arrays.toString(LangHelper.LANGS)); return mLangsAvailable[0]; } else { int index = LangHelper.findIndex(mLangsAvailable, lang); if (index == -1) { mLangIndex = 1; return mLangsAvailable[mLangIndex]; } else { mLangIndex = index; return lang; } } } /** * This is the main point where we do our initialization of the input method * to begin operating on an application. At this point we have been bound to * the client, and are now receiving all of the detailed information about * the target of our edits. */ @Override public void onStartInput(EditorInfo attribute, boolean restarting) { super.onStartInput(attribute, restarting); // Log.d("onStartInput", "attribute.inputType: " + attribute.inputType + // " restarting? " + restarting); //Utils.printFlags(attribute.inputType); currentInputConnection = getCurrentInputConnection(); if (attribute.inputType == 0 || attribute.inputType == 3) { // don't do anything when not in any kind of edit field. // should also turn off input screen and stuff mEditing = NON_EDIT; requestHideSelf(0); hideStatusIcon(); if (interfacehandler != null) { interfacehandler.hideView(); } return; } mFirstPress = true; mEditing = EDITING; // Reset our state. We want to do this even if restarting, because // the underlying state of the text editor could have changed in any // way. clearState(); mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null)); mLang = sanitizeLang(pref.getInt("last_lang", 0)); updateCandidates(); //TODO: Check if "restarting" variable will make things faster/more effecient mKeyMode = MODE_TEXT; // We are now going to initialize our state based on the type of // text being edited. switch (attribute.inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: case InputType.TYPE_CLASS_DATETIME: // Numbers and dates default to the symbols keyboard, with // no extra features. mKeyMode = MODE_NUM; break; case InputType.TYPE_CLASS_PHONE: // Phones will also default to the symbols keyboard, though // often you will want to have a dedicated phone keyboard. mKeyMode = MODE_NUM; break; case InputType.TYPE_CLASS_TEXT: // This is general text editing. We will default to the // normal alphabetic keyboard, and assume that we should // be doing predictive text (showing candidates as the // user types). mKeyMode = Integer.parseInt(pref.getString("pref_inputmode", "0")); // We now look for a few special variations of text that will // modify our behavior. int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION; if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) { // Do not display predictions / what the user is typing // when they are entering a password. mKeyMode = MODE_TEXT; } if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS || variation == InputType.TYPE_TEXT_VARIATION_URI || variation == InputType.TYPE_TEXT_VARIATION_FILTER) { // Our predictions are not useful for e-mail addresses // or URIs. mKeyMode = MODE_TEXT; } if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) { // If this is an auto-complete text view, then our predictions // will not be shown and instead we will allow the editor // to supply their own. We only show the editor's // candidates when in fullscreen mode, otherwise relying // own it displaying its own UI. // ???? mKeyMode = Integer.parseInt(pref.getString("pref_inputmode", "0")); } // handle filter list cases... do not hijack DPAD center and make // sure back's go through proper if ((attribute.inputType & InputType.TYPE_TEXT_VARIATION_FILTER) != 0) { mEditing = EDITING_NOSHOW; } // We also want to look at the current state of the editor // to decide whether our alphabetic keyboard should start out // shifted. updateShiftKeyState(attribute); break; default: Log.d("onStartInput", "defaulting"); // For all unknown input types, default to the alphabetic // keyboard with no special features. updateShiftKeyState(attribute); } // Special case for Softbank Sharp 007SH phone book. if (attribute.inputType == 65633) { mKeyMode = MODE_TEXT; } String prevword = null; if (attribute.privateImeOptions != null && attribute.privateImeOptions.equals("org.nyanya.android.traditionalt9.addword=true")) { mAddingWord = true; // mAddingSkipInput = true; // Log.d("onStartInput", "ADDING WORD"); mKeyMode = MODE_TEXT; } else { mAddingWord = false; // Log.d("onStartInput", "not adding word"); prevword = pref.getString("last_word", null); if (prevword != null) { onText(prevword); Editor prefedit = pref.edit(); prefedit.remove("last_word"); prefedit.commit(); } } // Update the label on the enter key, depending on what the application // says it will do. // mCurKeyboard.setImeOptions(getResources(), attribute.imeOptions); setSuggestions(null, -1); setCandidatesViewShown(false); mSuggestionStrings.clear(); mSuggestionInts.clear(); mSuggestionSym.clear(); if (interfacehandler != null) { interfacehandler.midButtonUpdate(false); } updateKeyMode(); // show Window()? } /** * This is called when the user is done editing a field. We can use this to * reset our state. */ @Override public void onFinishInput() { super.onFinishInput(); // Log.d("onFinishInput", "When is this called?"); Editor prefedit = pref.edit(); prefedit.putInt("last_lang", mLang); prefedit.commit(); if (mEditing == EDITING) { commitTyped(); finish(); } } // @Override public void onFinishInputView (boolean finishingInput) { // Log.d("onFinishInputView", "? " + finishingInput); // } private void finish() { // Log.d("finish", "why?"); // Clear current composing text and candidates. // pickSelectedCandidate(getCurrentInputConnection()); pickSelectedCandidate(currentInputConnection); clearState(); // updateCandidates(); // We only hide the candidates window when finishing input on // a particular editor, to avoid popping the underlying application // up and down if the user is entering text into the bottom of // its window. // setCandidatesViewShown(false); // TODO: check this? mEditing = NON_EDIT; hideWindow(); hideStatusIcon(); } @Override public void onDestroy() { db.close(); super.onDestroy(); } // @Override public void onStartInputView(EditorInfo attribute, boolean // restarting) { // Log.d("onStartInputView", "attribute.inputType: " + attribute.inputType + // " restarting? " + restarting); // //super.onStartInputView(attribute, restarting); // } /** * Deal with the editor reporting movement of its cursor. */ @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) { super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd, candidatesStart, candidatesEnd); if (mKeyMode == MODE_TEXT) { return; } // stops the ghost fast-type commit // If the current selection in the text view changes, we should // clear whatever candidate text we have. if ((mComposing.length() > 0 || mComposingI.length() > 0) && (newSelStart != candidatesEnd || newSelEnd != candidatesEnd)) { mComposing.setLength(0); mComposingI.setLength(0); updateCandidates(); // InputConnection ic = getCurrentInputConnection(); // if (ic != null) { // ic.finishComposingText(); if (currentInputConnection != null) { currentInputConnection.finishComposingText(); } } } /** * This tells us about completions that the editor has determined based on * the current text in it. We want to use this in fullscreen mode to show * the completions ourself, since the editor can not be seen in that * situation. */ @Override public void onDisplayCompletions(CompletionInfo[] completions) { // ?????????????? } /* (non-Javadoc) * @see android.inputmethodservice.InputMethodService#onKeyMultiple(int, int, android.view.KeyEvent) */ /** * Use this to monitor key events being delivered to the application. We get * first crack at them, and can either resume them or let them continue to * the app. */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.d("onKeyDown", "Key: " + event + " repeat?: " + event.getRepeatCount() + " long-time: " + event.isLongPress()); if (mEditing == NON_EDIT) { // // catch for UI weirdness on up event thing return false; } mFirstPress = false; // Log.d("onKeyDown", "Key: " + keyCode); // TODO: remove emulator special keys switch (keyCode) { case 75: keyCode = KeyEvent.KEYCODE_POUND; break; case 74: keyCode = KeyEvent.KEYCODE_STAR; break; case 72: keyCode = KeyEvent.KEYCODE_SOFT_RIGHT; break; case 71: keyCode = KeyEvent.KEYCODE_SOFT_LEFT; break; } switch (keyCode) { /* case KeyEvent.KEYCODE_DPAD_CENTER: if (interfacehandler != null) { interfacehandler.setPressed(keyCode, true); } // pass-through case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: if (mEditing == EDITING_NOSHOW) { return false; } return handleDPAD(keyCode, event, true); */ case KeyEvent.KEYCODE_SOFT_RIGHT: case KeyEvent.KEYCODE_SOFT_LEFT: if (!isInputViewShown()) { return super.onKeyDown(keyCode, event); } break; case KeyEvent.KEYCODE_DEL: // Special handling of the delete key: if we currently are // composing text for the user, we want to modify that instead // of let the application to the delete itself. // if (mComposing.length() > 0) { onKey(keyCode, null); return true; // } // break; } // only handle first press except for delete if (event.getRepeatCount() != 0) { return true; } if (mKeyMode == MODE_TEXT) { t9releasehandler.removeCallbacks(mt9release); } switch (keyCode) { case KeyEvent.KEYCODE_BACK: // The InputMethodService already takes care of the back // key for us, to dismiss the input method if it is shown. // but we will manage it ourselves because native Android handling // of the input view is ... flakey at best. // Log.d("onKeyDown", "back pres"); return isInputViewShown(); case KeyEvent.KEYCODE_ENTER: // Let the underlying text editor always handle these. return false; // special case for softkeys case KeyEvent.KEYCODE_SOFT_RIGHT: case KeyEvent.KEYCODE_SOFT_LEFT: if (interfacehandler != null) { interfacehandler.setPressed(keyCode, true); } // pass-through case KeyEvent.KEYCODE_0: case KeyEvent.KEYCODE_1: case KeyEvent.KEYCODE_2: case KeyEvent.KEYCODE_3: case KeyEvent.KEYCODE_4: case KeyEvent.KEYCODE_5: case KeyEvent.KEYCODE_6: case KeyEvent.KEYCODE_7: case KeyEvent.KEYCODE_8: case KeyEvent.KEYCODE_9: case KeyEvent.KEYCODE_POUND: case KeyEvent.KEYCODE_STAR: if (!isInputViewShown()) { showWindow(true); } event.startTracking(); return true; default: // KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD).getNumber(keyCode) // Log.w("onKeyDown", "Unhandled Key: " + keyCode + "(" + // event.toString() + ")"); } Log.w("onKeyDown", "Unhandled Key: " + keyCode + "(" + event.toString() + ")"); commitReset(); return super.onKeyDown(keyCode, event); } /* (non-Javadoc) * @see android.inputmethodservice.InputMethodService#onKeyMultiple(int, int, android.view.KeyEvent) */ protected void launchOptions() { Intent awintent = new Intent(this, TraditionalT9Settings.class); awintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); awintent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); if (interfacehandler != null) { interfacehandler.setPressed(KeyEvent.KEYCODE_SOFT_RIGHT, false); } hideWindow(); startActivity(awintent); } protected void speakKeymode(int position) { switch (position) { case 1: if (mLangIndex == 1){ toastLT = getResources().getString(R.string.toastLTRU); } else if (mLangIndex == 0){ toastLT = getResources().getString(R.string.toastLTEN); } break; case 2: if (mCapsMode == CAPS_ALL){ toastLT = getResources().getString(R.string.toastLTcapsALL); } else if (mCapsMode == CAPS_SINGLE){ toastLT = getResources().getString(R.string.toastLTcapsSINGLE); } else if (mCapsMode == CAPS_OFF){ toastLT = getResources().getString(R.string.toastLTcapsOFF); } break; case 3: if (mKeyMode == MODE_LANG) { toastLT = getResources().getString(R.string.toastLT_T9); } else if (mKeyMode == MODE_TEXT) { toastLT = getResources().getString(R.string.toastLT_text); } else if (mKeyMode == MODE_NUM) { toastLT = getResources().getString(R.string.toastLT_numbers); } break; } toast.setText(toastLT); toast.show(); toast.cancel(); } @Override public boolean onKeyLongPress(int keyCode, KeyEvent event) { // consume since we will assume we have already handled the long press // if greater than 1 if (event.getRepeatCount() != 1) { return true; } // TODO: remove emulator special keys switch (keyCode) { case 75: keyCode = KeyEvent.KEYCODE_POUND; break; case 74: keyCode = KeyEvent.KEYCODE_STAR; break; case 72: keyCode = KeyEvent.KEYCODE_SOFT_RIGHT; break; case 71: keyCode = KeyEvent.KEYCODE_SOFT_LEFT; break; } // Log.d("onLongPress", "LONG PRESS: " + keyCode); // HANDLE SPECIAL KEYS switch (keyCode) { case KeyEvent.KEYCODE_POUND: if (mKeyMode != MODE_NUM) { if (mLangsAvailable.length > 1){ nextLang(); speakKeymode(1); } else { showSmileyPage(); // TODO: replace with lang select if lang thing } return true; } break; /* commitReset(); onText("\n");FLAG_ACTIVITY_PREVIOUS_IS_TOP return true;*/ case KeyEvent.KEYCODE_STAR: if (mKeyMode != MODE_NUM) { Intent awintent = new Intent(this, Menu1.class); awintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); awintent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); awintent.putExtra("org.nyanya.android.traditionalt9.word", mComposing.toString()); awintent.putExtra("org.nyanya.android.traditionalt9.lang", mLang); clearState(); InputConnection ic = getCurrentInputConnection(); ic.setComposingText("", 0); ic.finishComposingText(); updateCandidates(); //onFinishInput(); mWordFound = true; startActivity(awintent); } break; case KeyEvent.KEYCODE_SOFT_LEFT: if (interfacehandler != null) { interfacehandler.setPressed(keyCode, false); } if (mKeyMode == MODE_LANG) { if (mWordFound) { showAddWord(); } else { showSymbolPage(); } } break; case KeyEvent.KEYCODE_SOFT_RIGHT: if (interfacehandler != null) { interfacehandler.setPressed(keyCode, false); } launchOptions(); // show Options return true; } if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) { if (mKeyMode == MODE_LANG) { commitTyped(); onText(String.valueOf(keyCode - KeyEvent.KEYCODE_0)); } else if (mKeyMode == MODE_TEXT) { commitReset(); onText(String.valueOf(keyCode - KeyEvent.KEYCODE_0)); } else if (mKeyMode == MODE_NUM) { if (keyCode == KeyEvent.KEYCODE_0) { onText("+"); } } } return true; } private Timer mDoubleClickTimer; private boolean possibleDoubleClick = false; /** * Use this to monitor key events being delivered to the application. We get * first crack at them, and can either resume them or let them continue to * the app. */ private Handler mTimerHandler = new Handler(); @Override public boolean onKeyUp(int keyCode, KeyEvent event) { // Log.d("onKeyUp", "Key: " + keyCode + " repeat?: " + // event.getRepeatCount()); if (mEditing == NON_EDIT) { // if (mButtonClose) { // //handle UI weirdness on up event // mButtonClose = false; // return true; // } // Log.d("onKeyDown", "returned false"); return false; } else if (mFirstPress) { // to make sure changing between input UI elements works correctly. return super.onKeyUp(keyCode, event); } // TODO: remove emulator special keys switch (keyCode) { case 75: keyCode = KeyEvent.KEYCODE_POUND; break; case 74: keyCode = KeyEvent.KEYCODE_STAR; break; case 72: keyCode = KeyEvent.KEYCODE_SOFT_RIGHT; break; case 71: keyCode = KeyEvent.KEYCODE_SOFT_LEFT; break; } switch (keyCode) { case KeyEvent.KEYCODE_POUND: if(keyCode==KeyEvent.KEYCODE_POUND){ //or whatever key you want to check for double-clicks if(mDoubleClickTimer!=null) {mDoubleClickTimer.cancel();} if(!possibleDoubleClick){ if ((event.getFlags() & KeyEvent.FLAG_CANCELED_LONG_PRESS) == 0) { possibleDoubleClick = true; mDoubleClickTimer = new Timer(); mDoubleClickTimer.schedule(new TimerTask() { @Override public void run() { if (mKeyMode == MODE_NUM) { handleCharacter(KeyEvent.KEYCODE_POUND); } else { new Thread(new Runnable() { public void run() { handleShift(); speakKeymode(2); toast.cancel(); } }).start(); } //single click detected //handle it here possibleDoubleClick = false; } },350); } }else{ nextKeyMode(); speakKeymode(3); //double click detected //handle it here possibleDoubleClick = false; } //... other key processing if you need it return false; } break; } switch (keyCode) { case KeyEvent.KEYCODE_STAR: if(keyCode==KeyEvent.KEYCODE_STAR){ //or whatever key you want to check for double-clicks if(mDoubleClickTimer!=null) {mDoubleClickTimer.cancel();} if(!possibleDoubleClick){ if ((event.getFlags() & KeyEvent.FLAG_CANCELED_LONG_PRESS) == 0) { possibleDoubleClick = true; mDoubleClickTimer = new Timer(); mDoubleClickTimer.schedule(new TimerTask() { @Override public void run() { if (mKeyMode == MODE_NUM) { handleCharacter(KeyEvent.KEYCODE_STAR); } else { mTimerHandler.post(new Runnable() { public void run() { if (mWordFound) { if (mKeyMode != MODE_NUM && mComposing.length() == 0) { showSmileyPage(); } else if (mKeyMode != MODE_NUM && mComposing.length() > 0) { handleDPAD(KeyEvent.KEYCODE_STAR, mDPADkeyEvent, false); } } else { showAddWord(); } } }); } //single click detected //handle it here possibleDoubleClick = false; } },350); } }else{ if (mKeyMode != MODE_NUM && mComposing.length() > 0) { handleDPAD(KeyEvent.KEYCODE_DPAD_UP, event, false); } if (mKeyMode != MODE_NUM && mComposing.length() == 0) { showSymbolPage(); } //double click detected //handle it here possibleDoubleClick = false; } //... other key processing if you need it return false; } break; } switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: { InputConnection ic = getCurrentInputConnection(); ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER)); } break; /* case KeyEvent.KEYCODE_DPAD_CENTER: if (interfacehandler != null) { interfacehandler.setPressed(keyCode, false); } case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: if (mEditing == EDITING_NOSHOW) { return false; } return handleDPAD(keyCode, event, false); */ case KeyEvent.KEYCODE_SOFT_RIGHT: case KeyEvent.KEYCODE_SOFT_LEFT: if (!isInputViewShown()) { return super.onKeyDown(keyCode, event); } break; } if (event.isCanceled()) { return true; } switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (isInputViewShown()) { hideWindow(); return true; } return false; case KeyEvent.KEYCODE_DEL: return true; case KeyEvent.KEYCODE_ENTER: return false; // special case for softkeys case KeyEvent.KEYCODE_SOFT_RIGHT: case KeyEvent.KEYCODE_SOFT_LEFT: // if (mAddingWord){ // Log.d("onKeyUp", "key: " + keyCode + " skip: " + // mAddingSkipInput); // if (mAddingSkipInput) { // //mAddingSkipInput = false; // return true; // } // } if (interfacehandler != null) { interfacehandler.setPressed(keyCode, false); } // pass-through case KeyEvent.KEYCODE_0: case KeyEvent.KEYCODE_1: case KeyEvent.KEYCODE_2: case KeyEvent.KEYCODE_3: case KeyEvent.KEYCODE_4: case KeyEvent.KEYCODE_5: case KeyEvent.KEYCODE_6: case KeyEvent.KEYCODE_7: case KeyEvent.KEYCODE_8: case KeyEvent.KEYCODE_9: // if (!isInputViewShown()){ // Log.d("onKeyUp", "showing window."); // //showWindow(true); // } onKey(keyCode, null); return true; default: // KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD).getNumber(keyCode) Log.w("onKeyUp", "Unhandled Key: " + keyCode + "(" + event.toString() + ")"); } commitReset(); return super.onKeyUp(keyCode, event); } /** * Helper function to commit any text being composed in to the editor. */ // private void commitTyped() { commitTyped(getCurrentInputConnection()); } private void commitTyped() { if (interfacehandler != null) { interfacehandler.midButtonUpdate(false); interfacehandler.showNotFound(false); } // pickSelectedCandidate(ic); pickSelectedCandidate(currentInputConnection); clearState(); updateCandidates(); setCandidatesViewShown(false); } /** * Helper to update the shift state of our keyboard based on the initial * editor state. */ private void updateShiftKeyState(EditorInfo attr) { // Log.d("updateShift", "CM start: " + mCapsMode); if (attr != null && mCapsMode != CAPS_ALL) { int caps = 0; if (attr.inputType != InputType.TYPE_NULL) { // caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType); caps = currentInputConnection.getCursorCapsMode(attr.inputType); } // mInputView.setShifted(mCapsLock || caps != 0); // Log.d("updateShift", "caps: " + caps); if ((caps & TextUtils.CAP_MODE_CHARACTERS) == TextUtils.CAP_MODE_CHARACTERS) { mCapsMode = CAPS_ALL; } else if ((caps & TextUtils.CAP_MODE_SENTENCES) == TextUtils.CAP_MODE_SENTENCES) { mCapsMode = CAPS_SINGLE; } else if ((caps & TextUtils.CAP_MODE_WORDS) == TextUtils.CAP_MODE_WORDS) { mCapsMode = CAPS_SINGLE; } else { mCapsMode = CAPS_OFF; } updateKeyMode(); } // Log.d("updateShift", "CM end: " + mCapsMode); } /** * Helper to send a key down / key up pair to the current editor. NOTE: Not * supposed to use this apparently. Need to use it for DEL. For other things * I'll have to onText */ private void keyDownUp(int keyEventCode) { // InputConnection ic = getCurrentInputConnection(); // KeyEvent kv = KeyEvent.changeFlags(new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode), // KeyEvent.FLAG_SOFT_KEYBOARD); // ic.sendKeyEvent(kv); //kv = KeyEvent.changeFlags(new KeyEvent(KeyEvent.ACTION_UP, keyEventCode), // KeyEvent.FLAG_SOFT_KEYBOARD); // ic.sendKeyEvent(kv); currentInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode)); currentInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEventCode)); } private void keyDownUp(String keys) { currentInputConnection.sendKeyEvent(new KeyEvent(SystemClock.uptimeMillis(), keys, 0, 0)); } // Implementation of KeyboardViewListener @Override public void onKey(int keyCode, int[] keyCodes) { // Log.d("OnKey", "pri: " + keyCode); // Log.d("onKey", "START Cm: " + mCapsMode); // HANDLE SPECIAL KEYS switch (keyCode) { case KeyEvent.KEYCODE_DEL: handleBackspace(); break; // change case case KeyEvent.KEYCODE_BACK: handleClose(); break; // space case KeyEvent.KEYCODE_0: handleCharacter(KeyEvent.KEYCODE_0); break; case KeyEvent.KEYCODE_SOFT_LEFT: if (mWordFound) { showSymbolPage(); } else { showAddWord(); } break; case KeyEvent.KEYCODE_SOFT_RIGHT: nextKeyMode(); break; default: if (keyCode >= KeyEvent.KEYCODE_1 && keyCode <= KeyEvent.KEYCODE_9) { handleCharacter(keyCode); } else { Log.e("onKey", "This shouldn't happen, unknown key"); } } // Log.d("onKey", "END Cm: " + mCapsMode); } @Override public void onText(CharSequence text) { // InputConnection ic = getCurrentInputConnection(); // if (ic == null) if (currentInputConnection == null) return; // ic.beginBatchEdit(); currentInputConnection.beginBatchEdit(); if (mComposing.length() > 0 || mComposingI.length() > 0) { // commitTyped(ic); commitTyped(); } // ic.commitText(text, 1); // ic.endBatchEdit(); currentInputConnection.commitText(text, 1); currentInputConnection.endBatchEdit(); updateShiftKeyState(getCurrentInputEditorInfo()); } /** * Used from interface to either close the input UI if not composing text or * to accept the composing text */ protected void handleMidButton() { if (!isInputViewShown()) { showWindow(true); return; } if (mComposing.length() > 0) { switch (mKeyMode) { case MODE_LANG: commitTyped(); break; case MODE_TEXT: commitTyped(); charReset(); break; case MODE_NUM: // shouldn't happen break; } } else { hideWindow(); } } /** * Update the list of available candidates from the current composing text. * Do a lot of complicated stuffs. */ private void updateCandidates() { updateCandidates(false); } private void updateCandidates(boolean backspace) { if (mKeyMode == MODE_LANG) { int len = mComposingI.length(); if (len > 0) { if (mComposingI.charAt(len - 1) == '1') { boolean suggestions = !mSuggestionStrings.isEmpty(); String prefix = ""; if (mPreviousWord.length() == 0) { if (suggestions && !backspace) { prefix = mPreviousWord = mSuggestionStrings.get(mCandidateView.mSelectedIndex); } } else { if (backspace) { prefix = mPreviousWord; } else { if (suggestions) { if (mCandidateView.mSelectedIndex == -1) { mCandidateView.mSelectedIndex = 0; } prefix = mPreviousWord = mSuggestionStrings.get(mCandidateView.mSelectedIndex); } else { prefix = mPreviousWord; } } } mSuggestionInts.clear(); mSuggestionStrings.clear(); mSuggestionSym.clear(); db.updateWords("1", mSuggestionSym, mSuggestionInts, mCapsMode, mLang); for (String a : mSuggestionSym) { if (!prefix.equals("")) { mSuggestionStrings.add(prefix + a); } else { mSuggestionStrings.add(String.valueOf(a)); mComposingI.setLength(0); mComposingI.append("1"); } } } else { db.updateWords(mComposingI.toString(), mSuggestionStrings, mSuggestionInts, mCapsMode, mLang); } if (!mSuggestionStrings.isEmpty()) { mWordFound = true; mComposing.setLength(0); mComposing.append(mSuggestionStrings.get(0)); if (interfacehandler != null) { interfacehandler.showNotFound(false); } } else { mWordFound = false; mComposingI.setLength(len - 1); setCandidatesViewShown(false); if (interfacehandler != null) { interfacehandler.showNotFound(true); } wnf = getResources().getString(R.string.word_not_found); wordNotFound.setText(wnf); wordNotFound.show(); } setSuggestions(mSuggestionStrings, 0); } else { setSuggestions(null, -1); setCandidatesViewShown(false); if (interfacehandler != null) { interfacehandler.showNotFound(false); } } } else if (mKeyMode == MODE_TEXT) { if (mComposing.length() > 0) { mSuggestionStrings.clear(); char[] ca = CharMap.T9TABLE[mLang][mPrevious]; for (char c : ca) { mSuggestionStrings.add(String.valueOf(c)); } setSuggestions(mSuggestionStrings, mCharIndex); } else { setSuggestions(null, -1); } } } private void setSuggestions(List<String> suggestions, int initialSel) { if (suggestions != null && suggestions.size() > 0) { setCandidatesViewShown(true); /*String selectedWord = mSuggestionStrings.get(mCandidateView.mSelectedIndex); Toast.makeText(this, selectedWord, Toast.LENGTH_SHORT).show();*/ } if (mCandidateView != null) { mCandidateView.setSuggestions(suggestions, initialSel); } } private void handleBackspace() { final int length = mComposing.length(); final int length2 = mComposingI.length(); if (mKeyMode == MODE_TEXT) { charReset(); if (interfacehandler != null) { interfacehandler.midButtonUpdate(false); } setCandidatesViewShown(false); } if (length2 > 1) { if (mComposingI.charAt(length2-1) == '1' ) { // revert previous word mPreviousWord = mPreviousWord.substring(0, mPreviousWord.length()-1); } mComposingI.delete(length2 - 1, length2); if (length2-1 > 1) { if (mComposingI.charAt(length2-2) != '1') { if (mComposingI.indexOf("1") == -1) { // no longer contains punctuation so we no longer care mPreviousWord = ""; } } } else { mPreviousWord = ""; } updateCandidates(true); // getCurrentInputConnection().setComposingText(mComposing, 1); currentInputConnection.setComposingText(mComposing, 1); } else if (length > 0 || length2 > 0) { mComposing.setLength(0); mComposingI.setLength(0); interfacehandler.midButtonUpdate(false); interfacehandler.showNotFound(false); mSuggestionStrings.clear(); mPreviousWord = ""; // getCurrentInputConnection().commitText("", 0); currentInputConnection.commitText("", 0); updateCandidates(); } else { mPreviousWord = ""; keyDownUp(KeyEvent.KEYCODE_DEL); } updateShiftKeyState(getCurrentInputEditorInfo()); // Log.d("handleBS", "Cm: " + mCapsMode); // Why do I need to call this twice, android... updateShiftKeyState(getCurrentInputEditorInfo()); } Handler handler1 = new Handler(); public void handleShift() { handler1.post(new Runnable() { public void run() { // do my own thing here if (mCapsMode == CAPS_CYCLE.length - 1) { mCapsMode = 0; } else { mCapsMode++; } if (mKeyMode == MODE_LANG && mComposing.length() > 0) { updateCandidates(); // getCurrentInputConnection().setComposingText(mComposing, 1); currentInputConnection.setComposingText(mComposing, 1); } updateKeyMode(); } }); } /** * handle input of a character. Precondition: ONLY 0-9 AND *# ARE ALLOWED * * @param keyCode */ private void handleCharacter(int keyCode) { switch (mKeyMode) { case MODE_LANG: // it begins // on POUND commit and space if (keyCode == KeyEvent.KEYCODE_0) { if (mComposing.length() > 0) { commitTyped(); } //or whatever key you want to check for double-clicks if(mDoubleClickTimer!=null) {mDoubleClickTimer.cancel();} if(!possibleDoubleClick){ possibleDoubleClick = true; mDoubleClickTimer = new Timer(); mDoubleClickTimer.schedule(new TimerTask() { @Override public void run() { new Thread(new Runnable() { public void run() { onText(" "); } }).start(); //single click detected //handle it here possibleDoubleClick = false; } },350); }else{ onText("\n"); //double click detected //handle it here possibleDoubleClick = false; } //... other key processing if you need it } else { // do things if (interfacehandler != null) { interfacehandler.midButtonUpdate(true); } keyCode = keyCode - KeyEvent.KEYCODE_0; mComposingI.append(keyCode); updateCandidates(); // getCurrentInputConnection().setComposingText(mComposing, 1); currentInputConnection.setComposingText(mComposing, 1); } break; case MODE_TEXT: t9releasehandler.removeCallbacks(mt9release); if (keyCode == KeyEvent.KEYCODE_POUND) { keyCode--; } keyCode = keyCode - KeyEvent.KEYCODE_0; // Log.d("handleChar", "PRIMARY CODE (num): " + keyCode); boolean newChar = false; if (mPrevious == keyCode) { mCharIndex++; } else { // commitTyped(getCurrentInputConnection()); commitTyped(); newChar = true; mCharIndex = 0; mPrevious = keyCode; } // start at caps if CapMode // Log.d("handleChar", "Cm: " + mCapsMode); if (mCharIndex == 0 && mCapsMode != CAPS_OFF) { mCharIndex = CharMap.T9CAPSTART[mLang][keyCode]; } // private int mPrevious; // private int mCharindex; mComposing.setLength(0); mComposingI.setLength(0); char[] ca = CharMap.T9TABLE[mLang][keyCode]; if (mCharIndex >= ca.length) { mCharIndex = 0; } mComposing.append(ca[mCharIndex]); // mComposingI.append(keyCode); // getCurrentInputConnection().setComposingText(mComposing, 1); currentInputConnection.setComposingText(mComposing, 1); t9releasehandler.postDelayed(mt9release, T9DELAY); if (newChar) { // consume single caps if (mCapsMode == CAPS_SINGLE) { mCapsMode = CAPS_OFF; } } updateCandidates(); updateShiftKeyState(getCurrentInputEditorInfo()); break; case MODE_NUM: switch (keyCode) { // Manual this case KeyEvent.KEYCODE_POUND: onText("#"); break; case KeyEvent.KEYCODE_STAR: onText("*"); break; default: onText(String.valueOf(keyCode - KeyEvent.KEYCODE_0)); } break; default: Log.e("handleCharacter", "Unknown input?"); } } // This is a really hacky way to handle DPAD long presses in a way that we can pass them on to // the underlying edit box in a somewhat reliable manner. // (somewhat because there are a few cases where this doesn't work properly or acts strangely.) private boolean handleDPAD(int keyCode, KeyEvent event, boolean keyDown) { // Log.d("handleConsumeDPAD", "keyCode: " + keyCode + " isKeyDown: " + // isKeyDown); if (keyDown) { // track key, if seeing repeat count < 0, start sending this event // and previous to super if (event.getRepeatCount() == 0) { // store event mDPADkeyEvent = event; return true; } else { if (mIgnoreDPADKeyUp) { // pass events to super return super.onKeyDown(keyCode, event); } else { // pass previous event and future events to super mIgnoreDPADKeyUp = true; // getCurrentInputConnection().sendKeyEvent(mDPADkeyEvent); currentInputConnection.sendKeyEvent(mDPADkeyEvent); return super.onKeyDown(keyCode, event); } } } else { // if we have been sending previous down events to super, do the // same for up, else process the event if (mIgnoreDPADKeyUp) { mIgnoreDPADKeyUp = false; return super.onKeyUp(keyCode, event); } else { if (mKeyMode != MODE_NUM && mComposing.length() > 0) { switch (keyCode) { case KeyEvent.KEYCODE_STAR: mCandidateView.scrollSuggestion(1); mCandidateView.requestFocus(); // getCurrentInputConnection().setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); // currentInputConnection.setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); if (mSuggestionStrings.size() > mCandidateView.mSelectedIndex) currentInputConnection.setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); return true; case KeyEvent.KEYCODE_DPAD_UP: mCandidateView.scrollSuggestion(-1); //getCurrentInputConnection().setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); //currentInputConnection.setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); if (mSuggestionStrings.size() > mCandidateView.mSelectedIndex) currentInputConnection.setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); return true; case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: if (mKeyMode == MODE_LANG) { commitTyped(); } else if (mKeyMode == MODE_TEXT) { commitReset(); } // getCurrentInputConnection().sendKeyEvent(mDPADkeyEvent); // currentInputConnection.sendKeyEvent(mDPADkeyEvent); // return super.onKeyUp(keyCode, event); return true; } } switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: handleMidButton(); return true; default: // Send stored event to input connection then pass current // event onto super getCurrentInputConnection().sendKeyEvent(mDPADkeyEvent); return super.onKeyUp(keyCode, event); } } } } private void commitReset() { // commitTyped(getCurrentInputConnection()); commitTyped(); charReset(); if (mCapsMode == CAPS_SINGLE) { mCapsMode = CAPS_OFF; } // Log.d("commitReset", "CM pre: " + mCapsMode); updateShiftKeyState(getCurrentInputEditorInfo()); // Log.d("commitReset", "CM post: " + mCapsMode); } private void charReset() { t9releasehandler.removeCallbacks(mt9release); mPrevious = -1; mCharIndex = 0; } private void handleClose() { // commitTyped(getCurrentInputConnection()); commitTyped(); requestHideSelf(0); } protected void nextKeyMode() { if (mKeyMode == MODE_CYCLE.length - 1) { mKeyMode = 0; } else { mKeyMode++; } updateKeyMode(); resetKeyMode(); } private void nextLang() { mLangIndex++; if (mLangIndex == mLangsAvailable.length) { mLangIndex = 0; } mLang = mLangsAvailable[mLangIndex]; updateKeyMode(); } private void resetKeyMode() { charReset(); if (mKeyMode != MODE_NUM) { commitTyped(); } mComposing.setLength(0); mComposingI.setLength(0); // getCurrentInputConnection().finishComposingText(); currentInputConnection.finishComposingText(); } /** * Set the status icon that is appropriate in current mode (based on * openwmm-legacy) */ private void updateKeyMode() { int icon = 0; switch (mKeyMode) { case MODE_TEXT: interfacehandler.showHold(false); icon = LangHelper.ICONMAP[mLang][mKeyMode][mCapsMode]; break; case MODE_LANG: if (!db.ready) { if (!mGaveUpdateWarn) { Toast.makeText(this, getText(R.string.updating_database_unavailable), Toast.LENGTH_LONG).show(); mGaveUpdateWarn = true; } nextKeyMode(); return; } if (mLangIndex == -1) { nextKeyMode(); return; } if (mAddingWord) { interfacehandler.showHold(false); } else { interfacehandler.showHold(true); } //Log.d("T9.updateKeyMode", "lang: " + mLang + " mKeyMode: " + mKeyMode + " mCapsMode" // + mCapsMode); icon = LangHelper.ICONMAP[mLang][mKeyMode][mCapsMode]; break; case MODE_NUM: interfacehandler.showHold(false); icon = R.drawable.ime_number; break; default: Log.e("updateKeyMode", "How."); break; } showStatusIcon(icon); } private void pickSelectedCandidate(InputConnection ic) { pickSuggestionManually(-1, ic); } private void pickSuggestionManually(int index, InputConnection ic) { // Log.d("pickSuggestMan", "Doing"); if (mComposing.length() > 0 || mComposingI.length() > 0) { // If we were generating candidate suggestions for the current // text, we would commit one of them here. But for this sample, // we will just commit the current text. if (!mSuggestionStrings.isEmpty()) { if (index < 0) { // Log.d("pickSuggestMan", "picking SELECTED: " + // mSuggestionStrings.get(mCandidateView.mSelectedIndex)); // get and commit selected suggestion ic.commitText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1); if (mKeyMode == MODE_LANG) { // update freq db.incrementWord(mSuggestionInts.get(mCandidateView.mSelectedIndex)); } } else { // commit suggestion index ic.commitText(mSuggestionStrings.get(index), 1); if (mKeyMode == MODE_LANG) { db.incrementWord(mSuggestionInts.get(index)); } } } } } /** * Ignore this for now. */ @Override public void swipeRight() { // if (mPredictionOn) { // pickDefaultCandidate(); // } } @Override public void swipeLeft() { handleBackspace(); } @Override public void swipeDown() { handleClose(); } @Override public void swipeUp() { } @Override public void onPress(int primaryCode) { } @Override public void onRelease(int primaryCode) { } }
[ "Wolf4D@list.ru" ]
Wolf4D@list.ru
afe9332b14de6f72966b43469afd1d9996d1c393
f7fbe2cd2a7f0fbc436d14981399677be5526f5e
/app/src/main/java/com/example/administrator/getuitest/demo/ui/fragment/HomeFragment.java
4bc89c30ce13f84b4919b4e72bdaa7f2db1886e5
[]
no_license
shenshouGO/CognitionApp
50223c02e2cb51de9d17cd528103e9229548ca0c
c25fd69a7b4f18cd302171262bbdcaf84c143b37
refs/heads/master
2023-06-23T06:22:06.278462
2021-07-27T02:01:04
2021-07-27T02:01:04
334,168,096
0
0
null
null
null
null
UTF-8
Java
false
false
7,704
java
package com.example.administrator.getuitest.demo.ui.fragment; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.administrator.getuitest.demo.DemoApplication; import com.example.administrator.getuitest.demo.receiver.AlarmUtils; import com.example.administrator.getuitest.demo.ui.presenter.AuthInteractor; import com.example.administrator.getuitest.demo.ui.presenter.HomePresenter; import com.igexin.sdk.PushManager; import static android.content.Context.ALARM_SERVICE; import static android.content.Context.MODE_PRIVATE; import static com.example.administrator.getuitest.demo.config.Config.AUTH_ACTION; /** * Time:2019/9/17 * Decription:主页面 透传/通知栏测试 * Author:jimlee. */ public class HomeFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, View.OnClickListener, HomePresenter.HomeView { private static final String TAG = HomeFragment.class.getSimpleName(); public TextView tvClientId; public TextView tvLog; public TextView tvCidState; SharedPreferences sp; private Toast toast; private CheckBox cbSdkServer; private HomePresenter homePresenter; private AlarmManager manager = (AlarmManager) DemoApplication.appContext.getSystemService(ALARM_SERVICE); public static HomeFragment newInstance() { return new HomeFragment(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = null; // view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home, container, false); initViews(view); // 应用未启动, 个推 service已经被唤醒,显示该时间段内离线消息 if (DemoApplication.payloadData != null) { tvLog.append(DemoApplication.payloadData); } if (!TextUtils.isEmpty(DemoApplication.isCIDOnLine)) { // tvCidState.setText(DemoApplication.isCIDOnLine.equals("true") ? getString(R.string.online) : getString(R.string.offline)); } if (!TextUtils.isEmpty(DemoApplication.cid)) { tvClientId.setText(DemoApplication.cid); } return view; } private void initViews(View view) { homePresenter = new HomePresenter(this); // tvLog = view.findViewById(R.id.tvLog); // tvLog.setMovementMethod(ScrollingMovementMethod.getInstance()); // tvClientId = view.findViewById(R.id.tv_clientid); // cbSdkServer = view.findViewById(R.id.cb_sdk_server); // cbSdkServer.setClickable(true); // sp = getActivity().getSharedPreferences("data", MODE_PRIVATE); // cbSdkServer.setChecked(sp.getBoolean("isServiceOn", true)); // cbSdkServer.setOnCheckedChangeListener(this); // tvCidState = view.findViewById(R.id.tv_cid_state); // //通知栏 // Button btnNotification = view.findViewById(R.id.btn_notification); // btnNotification.setOnClickListener(this); // //透传 // Button btnTransmission = view.findViewById(R.id.btn_transmission); // btnTransmission.setOnClickListener(this); // Button btnCopyCid = view.findViewById(R.id.btn_copy_cid); // btnCopyCid.setOnClickListener(this); // ImageView btnDeleteLog = view.findViewById(R.id.iv_clear_log); // btnDeleteLog.setOnClickListener(this); } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // if (isChecked) { // PushManager.getInstance().turnOnPush(getActivity()); // showToast(getString(R.string.start)); // } else { // PushManager.getInstance().turnOffPush(getActivity()); // showToast(getString(R.string.stop)); // } sp.edit().putBoolean("isServiceOn", isChecked).apply(); } @Override public void onClick(View v) { switch (v.getId()) { // case R.id.btn_notification: // homePresenter.sendNotification(); // break; // case R.id.btn_transmission: // homePresenter.sendTransmission(); // break; // case R.id.btn_copy_cid: // copyCid(); // break; // case R.id.iv_clear_log: // tvLog.setText(""); // DemoApplication.payloadData.delete(0, DemoApplication.payloadData.length()); // showToast(getString(R.string.log_cleared)); // break; } } private void copyCid() { String content = tvClientId.getText().toString(); // if (TextUtils.isEmpty(content) || content.equals(getString(R.string.no_clientid))) { // showToast(getString(R.string.cid_empty)); // return; // // } // ClipboardManager cm = getActivity() == null ? null : (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); // if (cm != null) { // ClipData mClipData = ClipData.newPlainText("Label", content);// 将文本内容放到系统剪贴板里。 // cm.setPrimaryClip(mClipData); // showToast(getString(R.string.copy_successed)); // } } private void showToast(String content) { if (Looper.getMainLooper() != Looper.myLooper()) { return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BASE) {//9.0以上toast直接用原生的方法即可,并不用setText防止重复的显示的问题 Toast.makeText(DemoApplication.appContext, content, Toast.LENGTH_SHORT).show(); return; } if (toast != null) { toast.setText(content); toast.setDuration(Toast.LENGTH_SHORT); } else { toast = Toast.makeText(DemoApplication.appContext, content, Toast.LENGTH_SHORT); } toast.show(); } @Override public void onNotificationSended(String msg) { showToast(msg); Log.i(TAG, "onNotificationSendFailed = " + msg); if (msg.equals("not_auth")) { if (AuthInteractor.isTimeCorrect != null && !AuthInteractor.isTimeCorrect) { showToast("鉴权失败,请同步本地时间后重启应用"); return; } showToast("鉴权失败,请检查签名参数及本地时间"); AlarmUtils.startAuthAlram(manager,false,5); } } @Override public void onNotificationSendFailed(String msg) { showToast(msg); } @Override public void onDestroy() { super.onDestroy(); if (homePresenter != null) { homePresenter.onDestroy(); } Intent intent = new Intent(AUTH_ACTION); PendingIntent pendingintent = PendingIntent.getBroadcast(DemoApplication.appContext, 0, intent, PendingIntent.FLAG_NO_CREATE); if (pendingintent != null) { manager.cancel(pendingintent); } } }
[ "839533925@qq.com" ]
839533925@qq.com
f66bf790ba61d8fe0321bffc4730dc881e010b9f
b249746fe9816f80c21cabe8cef6a6a99561d596
/spring-teste/src/br/gustavo/spring/controller/AutorizadorInterceptor.java
8c6418d4de1a26573be7b556512eb630cd740e08
[]
no_license
Queiroz21/Sistemas_de_Ingresso
c0cd2698f06b300dd70975124905bf2f1848c425
4c76ad30144a5848f279eb5f104f320843b1e2f3
refs/heads/master
2020-05-07T16:09:04.490905
2019-04-10T22:14:03
2019-04-10T22:14:03
180,670,479
0
0
null
null
null
null
UTF-8
Java
false
false
924
java
package br.gustavo.spring.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; public class AutorizadorInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object controller) throws Exception { String uri = request.getRequestURI(); if(uri.endsWith("loginForm") || uri.endsWith("efetuaLogin") || uri.contains("resources") ||uri.contains("cliente") ||uri.contains("cliente/add")){ return true; } if(request.getSession().getAttribute("usuarioLogado") != null) { return true; } response.sendRedirect("loginForm"); return false; } }
[ "noreply@github.com" ]
noreply@github.com
89585fca67170bee869200fbaa2671193f5c1e05
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a091/A091956Test.java
e08d51ce9be8e5f53be2d30b053a8c17a50e56ba
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package irvine.oeis.a091; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A091956Test extends AbstractSequenceTest { @Override protected int maxTerms() { return 7; } }
[ "sairvin@gmail.com" ]
sairvin@gmail.com
8c02586f59024d02789a690dcf8058d838bc55d0
c46e83f84e900b542b48dddedda458e0a6e8cb3b
/src/Main.java
2a709c309fa2baf25c7aa400ff39f0e95a12ec83
[]
no_license
ArulMuralidharan/Lab3
7b62e7c4dab37d02ef3434abfd2e61939cef8794
e4184fff0cbc17590743566052a3067c2a9e87d4
refs/heads/master
2020-03-29T00:45:45.297256
2018-09-18T21:36:24
2018-09-18T21:36:24
149,354,872
0
0
null
null
null
null
UTF-8
Java
false
false
1,911
java
import java.io.IOException; import java.net.URL; import java.util.Scanner; public class Main { /** * Retrieve contents from a URL and return them as a string. * * @param url url to retrieve contents from * @return the contents from the url as a string, or an empty string on error */ public static String urlToString(final String url) { Scanner urlScanner; try { urlScanner = new Scanner(new URL(url).openStream(), "UTF-8"); } catch (IOException e) { return ""; } String contents = urlScanner.useDelimiter("\\A").next(); urlScanner.close(); return contents; } public static void main(String[] args) { System.out.println(urlToString("http://erdani.com/tdpl/hamlet.txt")); int wordCount = computeWordCount(urlToString("http://erdani.com/tdpl/hamlet.txt")); System.out.println("Word Count: " + wordCount); Scanner lineScanner = new Scanner(System.in); System.out.println("Enter a word to search in the url: "); String searchTerm = lineScanner.nextLine(); int oneWordCount = computeOneWordCount(urlToString("http://erdani.com/tdpl/hamlet.txt"), searchTerm); System.out.println(searchTerm + " Appears " + oneWordCount + " times in the URL"); } public static int computeWordCount(String contents) { String[] contentsArray = contents.split(" "); return contentsArray.length; } public static int computeOneWordCount(String contents, String searchTerm) { String[] contentsArray = contents.split(" "); int wordCount = 0; for (int i = 0; i < contentsArray.length; i++) { System.out.println(contentsArray[i]); if (contentsArray[i].equalsIgnoreCase(searchTerm)) { wordCount ++; } } return wordCount; } }
[ "arulvel2@illinois.edu" ]
arulvel2@illinois.edu
34b9c579f87021227cc4f31967644c11af51c781
d1a57d3af688135d7534ee7d1a09c6111655850d
/CH08CLASS/app/src/test/java/com/example/hope/ch08class/ExampleUnitTest.java
403e1fe9878bb64fd652d9c274ee7907aeb54083
[]
no_license
zoiechow/android-projects
b74c03e383d36ca331bfc6f6c6afc6084c2df65c
323c1d61301faca94566992796ca0e40753f5720
refs/heads/master
2021-09-04T00:10:12.517106
2018-01-13T05:32:59
2018-01-13T05:32:59
117,315,143
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.example.hope.ch08class; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "zoie2chow@gmail.com" ]
zoie2chow@gmail.com
816d7bffb56329bb3079e92cd5add97b6c95c173
438eb882be9309fbe7d6a997e1d63195bdcfff8d
/app/src/main/java/com/example/administrator/smartcity/fragments/ContentFragment.java
8b85d8302188141ccfaa841e0b4b6a7633ba4cf5
[]
no_license
sunnnydaydev/SmartCity
d6aba9e2e49d4a78b011a72e646d2d23c0c295f2
0ce703a1e3de9a6bef8fe962f5afdeb706f897af
refs/heads/master
2020-04-24T01:50:08.166127
2019-03-29T04:08:13
2019-03-29T04:08:13
171,614,231
4
1
null
null
null
null
UTF-8
Java
false
false
4,334
java
package com.example.administrator.smartcity.fragments; import android.support.v4.widget.DrawerLayout; import android.view.LayoutInflater; import android.view.View; import com.ashokvarma.bottomnavigation.BottomNavigationBar; import com.ashokvarma.bottomnavigation.BottomNavigationItem; import com.example.administrator.smartcity.Adapters.ContentAadpter; import com.example.administrator.smartcity.R; import com.example.administrator.smartcity.base.BasePage; import com.example.administrator.smartcity.base.impl.VideoPage; import com.example.administrator.smartcity.base.impl.HomePage; import com.example.administrator.smartcity.base.impl.NewsCenterPage; import com.example.administrator.smartcity.base.impl.SettingPage; import com.example.administrator.smartcity.base.impl.PhotoPage; import com.example.administrator.smartcity.views.NoScrollViewPager; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import static com.ashokvarma.bottomnavigation.BottomNavigationBar.BACKGROUND_STYLE_RIPPLE; /** * Create by SunnyDay on 2019/02/21 */ public class ContentFragment extends BaseFragment { @BindView(R.id.bottom_navigation) public BottomNavigationBar bottomNavigationBar; @BindView(R.id.vp_content) public NoScrollViewPager mViewPager; private View view; private List<BasePage> list; private DrawerLayout drawerLayout; @Override public View initView() { view = LayoutInflater.from(mActivity).inflate(R.layout.fragment_content, null); return view; } @Override public void initData() { ButterKnife.bind(this, view); initViewPager(); initNavagation(); // 手动禁掉首页的侧边栏 if (mViewPager.getCurrentItem()==0){ drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } } /** * viewpager的操作 */ public void initViewPager() { list = new ArrayList<>(); list.add(new HomePage(mActivity)); list.add(new NewsCenterPage(mActivity)); list.add(new PhotoPage(mActivity)); list.add(new VideoPage(mActivity)); list.add(new SettingPage(mActivity)); mViewPager.setAdapter(new ContentAadpter(list)); } /** * 底部导航的操作 */ public void initNavagation() { drawerLayout = mActivity.findViewById(R.id.drawable_layout); bottomNavigationBar .setBackgroundStyle(BACKGROUND_STYLE_RIPPLE) // 点击样式 .setBarBackgroundColor(R.color.orange) // 字体 、图标 背景颜色 .setInActiveColor(R.color.gray) // 未选中状态颜色 .setActiveColor(R.color.white) // 条目背景色 .addItem(new BottomNavigationItem(R.drawable.home, "首页")) .addItem(new BottomNavigationItem(R.drawable.newscenter, "新闻中心")) .addItem(new BottomNavigationItem(R.drawable.smartservice, "组图")) .addItem(new BottomNavigationItem(R.drawable.govaffairs, "快看")) .addItem(new BottomNavigationItem(R.drawable.setting, "设置")) .initialise(); bottomNavigationBar.setTabSelectedListener(new BottomNavigationBar.OnTabSelectedListener() { @Override public void onTabSelected(int position) { mViewPager.setCurrentItem(position, false);// false表示去掉滑动动画 if (position == 0 || position == list.size() - 1) { // 首页和设置页面禁用侧边栏 也就是关闭手势滑动即可 setLeftMenuEnable(false); }else{ setLeftMenuEnable(true); } } @Override public void onTabUnselected(int position) { } @Override public void onTabReselected(int position) { } }); } /** * 设置侧边栏是否可首饰滑动 * */ public void setLeftMenuEnable(boolean enable) { if (enable){ drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); }else{ drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } } }
[ "1246771571@qq.com" ]
1246771571@qq.com
09a9117e4dd39907314d655e9f2fe03eeb55e5fc
cd7aef02585a365414bbda2d46bd2d765a4d730c
/src/day37_methods_overloading/VarArgs.java
e25366fab8794114b31f005704bcb23024d0bd12
[]
no_license
dilya1983/java-programming
a2071a3b593464a8bfbe3ad764191f738bf32d6d
5c8f4758810e9eafda6970a669c6d7bf8c93b2a2
refs/heads/master
2023-04-03T21:04:23.293278
2021-05-01T21:08:02
2021-05-01T21:08:02
363,507,555
0
0
null
null
null
null
UTF-8
Java
false
false
440
java
package day37_methods_overloading; public class VarArgs { public static void main(String[] args) { addNumbers(10,5); addNumbers(100,200,300); addNumbers(23,45,54,67,87,67,556,980,786,78,65,44,32,67,23); addNumbers(); } public static void addNumbers(int... nums){ int sum = 0; for(int n : nums){ sum += n; } System.out.println("sum = " + sum); } }
[ "dkhamidova1@gmail.com" ]
dkhamidova1@gmail.com
9b019a49992919fad93382ad2074fbd4232cd654
c5a661f93510686fd9c6f8c1262821c8bac83dd3
/LongProjects/lp6/cs6301/g00/SinglyLinkedList.java
a4f502463c67cebd518e6791534b5e7a13f80236
[]
no_license
saikumarsuvanam/ImplementationofAdvancedDataStructures
086330feb0b9b3f5425f4c6ab4d77eaec0df3999
c48afcc7579900ec123b2e93b49bb24f12df5281
refs/heads/master
2021-09-07T12:14:07.985208
2018-02-22T18:22:37
2018-02-22T18:22:37
115,026,364
0
4
null
null
null
null
UTF-8
Java
false
false
4,436
java
/** @author rbk * Singly linked list: for instructional purposes only * Ver 1.0: 2017/08/08 * Ver 1.1: 2017/08/30: Fixed error: If last element of list is removed, * "tail" is no longer a valid value. Subsequently, if items are added * to the list, code would do the wrong thing. */ package cs6301.g00; import java.util.Iterator; import java.util.Scanner; import java.util.NoSuchElementException; public class SinglyLinkedList<T> implements Iterable<T> { /** Class Entry holds a single node of the list */ public static class Entry<T> { public T element; public Entry<T> next; public Entry(T x, Entry<T> nxt) { element = x; next = nxt; } } // Dummy header is used. tail stores reference of tail element of list protected Entry<T> head, tail; protected int size; public SinglyLinkedList() { head = new Entry<>(null, null); tail = head; size = 0; } public Iterator<T> iterator() { return new SLLIterator<>(this); } private class SLLIterator<E> implements Iterator<E> { SinglyLinkedList<E> list; Entry<E> cursor, prev; boolean ready; // is item ready to be removed? SLLIterator(SinglyLinkedList<E> list) { this.list = list; cursor = list.head; prev = null; ready = false; } public boolean hasNext() { return cursor.next != null; } public E next() { prev = cursor; cursor = cursor.next; ready = true; return cursor.element; } // Removes the current element (retrieved by the most recent next()) // Remove can be called only if next has been called and the element has // not been removed public void remove() { if (!ready) { throw new NoSuchElementException(); } prev.next = cursor.next; // Handle case when tail of a list is deleted if (cursor == list.tail) { list.tail = prev; } cursor = prev; ready = false; // Calling remove again without calling next will // result in exception thrown size--; } } // Add new elements to the end of the list public void add(T x) { tail.next = new Entry<>(x, null); tail = tail.next; size++; } public void printList() { /* * Code without using implicit iterator in for each loop: * * Entry<T> x = head.next; while(x != null) { System.out.print(x.element * + " "); x = x.next; } */ System.out.print(this.size + ": "); for (T item : this) { System.out.print(item + " "); } System.out.println(); } // Rearrange the elements of the list by linking the elements at even index // followed by the elements at odd index. Implemented by rearranging // pointers // of existing elements without allocating any new elements. public void unzip() { if (size < 3) { // Too few elements. No change. return; } Entry<T> tail0 = head.next; Entry<T> head1 = tail0.next; Entry<T> tail1 = head1; Entry<T> c = tail1.next; int state = 0; // Invariant: tail0 is the tail of the chain of elements with even // index. // tail1 is the tail of odd index chain. // c is current element to be processed. // state indicates the state of the finite state machine // state = i indicates that the current element is added after taili // (i=0,1). while (c != null) { if (state == 0) { tail0.next = c; tail0 = c; c = c.next; } else { tail1.next = c; tail1 = c; c = c.next; } state = 1 - state; } tail0.next = head1; tail1.next = null; } public static void main(String[] args) throws NoSuchElementException { int n = 10; if (args.length > 0) { n = Integer.parseInt(args[0]); } SinglyLinkedList<Integer> lst = new SinglyLinkedList<>(); for (int i = 1; i <= n; i++) { lst.add(new Integer(i)); } lst.printList(); Iterator<Integer> it = lst.iterator(); Scanner in = new Scanner(System.in); whileloop: while (in.hasNext()) { int com = in.nextInt(); switch (com) { case 1: // Move to next element and print it if (it.hasNext()) { System.out.println(it.next()); } else { break whileloop; } break; case 2: // Remove element it.remove(); lst.printList(); break; default: // Exit loop break whileloop; } } lst.printList(); lst.unzip(); lst.printList(); } } /* Sample input: 1 2 1 2 1 1 1 2 1 1 2 0 Sample output: 10: 1 2 3 4 5 6 7 8 9 10 1 9: 2 3 4 5 6 7 8 9 10 2 8: 3 4 5 6 7 8 9 10 3 4 5 7: 3 4 6 7 8 9 10 6 7 6: 3 4 6 8 9 10 6: 3 4 6 8 9 10 6: 3 6 9 4 8 10 */
[ "saikumar.kumar08@gmail.com" ]
saikumar.kumar08@gmail.com
41986837120d1484b5a0015c25f58209f51c33c2
d6fde5b17d715978b41305465a6762e4f7726d1c
/src/main/java/com/sevelli/controller/SpeechController.java
9665474d644e21f7587946f148627fee9416acf3
[]
no_license
jwg666/portal
50f52c50e5190ca958cf381bc04ebf1efdaca4f0
9150f514f584929d92eb344f72d4eae67069f7a3
refs/heads/master
2021-01-23T18:21:47.598086
2015-04-15T07:28:23
2015-04-15T07:28:23
33,979,518
0
0
null
null
null
null
UTF-8
Java
false
false
3,575
java
package com.sevelli.controller; import com.iflytek.cloud.speech.*; import org.apache.commons.io.FileUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * Created by sevelli on 15-3-23. */ @Controller @RequestMapping("/speech") public class SpeechController extends BaseController{ @RequestMapping("convert") public ResponseEntity<byte[]> convert() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); headers.setContentDispositionFormData("attachment", "1.mp3"); return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(new File("/home/sevelli/Music/1.mp3")),headers, HttpStatus.CREATED); } @RequestMapping("tts") @ResponseBody public Map tts(String text){ // SpeechUtility.createUtility(context, SpeechConstant.APPID + "=12345678"); // /1.创建 SpeechSynthesizer 对象 SpeechSynthesizer mTts= SpeechSynthesizer.createSynthesizer( ); //2.合成参数设置,详见《iFlytek MSC Reference Manual》SpeechSynthesizer 类 mTts.setParameter(SpeechConstant.VOICE_NAME, "xiaoyan");//设置发音人 mTts.setParameter(SpeechConstant.SPEED, "50");//设置语速 mTts.setParameter(SpeechConstant.VOLUME, "80");//设置音量,范围 0~100 //设置合成音频保存位置(可自定义保存位置),保存在“./iflytek.pcm” //如果不需要保存合成音频,注释该行代码 mTts.setParameter(SpeechConstant.TTS_AUDIO_PATH, "/home/sevelli/iflytek.pcm"); //3.开始合成 mTts.startSpeaking("科大讯飞,让世界聆听我们的声音", mSynListener); String uri = ""; mTts.synthesizeToUri("科大讯飞,让世界聆听我们的声音",uri,uriListener); logger.debug(uri); Map map = new HashMap(); map.put("tts","ooooooooo"); return map; } private SynthesizeToUriListener uriListener = new SynthesizeToUriListener(){ @Override public void onBufferProgress(int i) { } @Override public void onSynthesizeCompleted(String s, SpeechError speechError) { } }; //合成监听器 private SynthesizerListener mSynListener = new SynthesizerListener(){ //会话结束回调接口,没有错误时,error为null public void onCompleted(SpeechError error) { } //缓冲进度回调 //percent为缓冲进度0~100, beginPos为缓冲音频在文本中开始位置, endPos表示缓冲音频在文本中结束位置,info为附加信息。 public void onBufferProgress(int percent, int beginPos, int endPos, String info) {} //开始播放 public void onSpeakBegin() {} //暂停播放 public void onSpeakPaused() {} //播放进度回调 //percent为播放进度0~100,beginPos为播放音频在文本中开始位置,endPos表示播放音频在文本中结束位置. public void onSpeakProgress(int percent, int beginPos, int endPos) {} //恢复播放回调接口 public void onSpeakResumed() {} }; }
[ "123jwg@163.com" ]
123jwg@163.com
6856dd9d9cd17993360cc42c218be868ffa8eb05
963212f9ece3f4e13a4f0213e7984dab1df376f5
/qardio_source/cfr_dec/com/google/android/gms/common/zzh.java
edaa01043d3fba8c5c83dd48ed633ed05aebb706
[]
no_license
weitat95/mastersDissertation
2648638bee64ea50cc93344708a58800a0f2af14
d465bb52b543dea05c799d1972374e877957a80c
refs/heads/master
2020-06-08T17:31:51.767796
2019-12-15T19:09:41
2019-12-15T19:09:41
193,271,681
0
0
null
null
null
null
UTF-8
Java
false
false
3,025
java
/* * Decompiled with CFR 0.147. * * Could not load the following classes: * android.os.RemoteException * android.util.Log */ package com.google.android.gms.common; import android.os.RemoteException; import android.util.Log; import com.google.android.gms.common.internal.zzat; import com.google.android.gms.common.internal.zzau; import com.google.android.gms.common.internal.zzbq; import com.google.android.gms.common.util.zzl; import com.google.android.gms.dynamic.IObjectWrapper; import com.google.android.gms.dynamic.zzn; import java.io.UnsupportedEncodingException; import java.util.Arrays; abstract class zzh extends zzau { private int zzflb; protected zzh(byte[] arrby) { boolean bl = false; Object object = arrby; if (arrby.length != 25) { int n = arrby.length; object = zzl.zza(arrby, 0, arrby.length, false); Log.wtf((String)"GoogleCertificates", (String)new StringBuilder(String.valueOf(object).length() + 51).append("Cert hash data has incorrect length (").append(n).append("):\n").append((String)object).toString(), (Throwable)new Exception()); object = Arrays.copyOfRange(arrby, 0, 25); if (((byte[])object).length == 25) { bl = true; } n = ((byte[])object).length; zzbq.checkArgument(bl, new StringBuilder(55).append("cert hash data has incorrect length. length=").append(n).toString()); } this.zzflb = Arrays.hashCode(object); } protected static byte[] zzfx(String arrby) { try { arrby = arrby.getBytes("ISO-8859-1"); return arrby; } catch (UnsupportedEncodingException unsupportedEncodingException) { throw new AssertionError(unsupportedEncodingException); } } public boolean equals(Object arrby) { block6: { block5: { if (arrby == null || !(arrby instanceof zzat)) { return false; } try { arrby = (zzat)arrby; if (arrby.zzagb() == this.hashCode()) break block5; return false; } catch (RemoteException remoteException) { Log.e((String)"GoogleCertificates", (String)"Failed to get Google certificates from remote", (Throwable)remoteException); return false; } } arrby = arrby.zzaga(); if (arrby != null) break block6; return false; } arrby = (byte[])zzn.zzx((IObjectWrapper)arrby); boolean bl = Arrays.equals(this.getBytes(), arrby); return bl; } abstract byte[] getBytes(); public int hashCode() { return this.zzflb; } @Override public final IObjectWrapper zzaga() { return zzn.zzz(this.getBytes()); } @Override public final int zzagb() { return this.hashCode(); } }
[ "weitat95@live.com" ]
weitat95@live.com
bb6b764b00165091d9aa9609af55444769eb3beb
007d1bcaa8525b2e555b02f48562c09c87811ecd
/xfsw-service/xfsw-service-account/src/main/java/com/xfsw/account/service/RoleCategoryAuthorityServiceImpl.java
464932a3450c5ea06fdca25073dce28a5d1b6770
[]
no_license
derekzhang79/xfsw
e6d621c27b17516b8d7e9f49bca84b23c44d186e
0dd8bcd398fe647a5bb277c6795685cb5519c28f
refs/heads/master
2021-01-21T10:49:07.068729
2017-08-30T11:36:30
2017-08-30T11:36:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,259
java
package com.xfsw.account.service; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.xfsw.account.entity.RoleCategoryAuthority; import com.xfsw.account.service.RoleCategoryAuthorityService; import com.xfsw.common.mapper.ICommonMapper; import com.xfsw.common.util.ArrayUtil; @Service("roleCategoryAuthorityService") public class RoleCategoryAuthorityServiceImpl implements RoleCategoryAuthorityService { @Resource(name="accountCommonMapper") private ICommonMapper commonMapper; @Transactional public void delete(Integer authorityId,String operator){ RoleCategoryAuthority roleAuthority = new RoleCategoryAuthority(); roleAuthority.setAuthorityId(authorityId); commonMapper.deleteAndBak(RoleCategoryAuthority.class, roleAuthority, operator); } @SuppressWarnings("unchecked") public List<Integer> selectAuthorityIdsByRoleId(Integer roleId){ return (List<Integer>) commonMapper.selectList("RoleCategoryAuthority.selectAuthorityIdsByRoleId",roleId); } public void insertRoleCategoryAuthorityList(Integer roleId,List<Integer> addAuthorityIds,String operator){ Map<String,Object> params = new HashMap<String,Object>(); params.put("roleId", roleId); params.put("authorityIds", addAuthorityIds); params.put("lastUpdater", operator); commonMapper.insert("RoleCategoryAuthority.insertRoleCategoryAuthorityList", params); } @Transactional public void deleteAndBakByRoleIdAndAuthorityIds(Integer roleId,Integer[] delAuthorityIds){ if(ArrayUtil.isEmpty(delAuthorityIds)){ return; } Map<String,Object> params = new HashMap<String,Object>(); params.put("roleId", roleId); params.put("authorityIds", delAuthorityIds); commonMapper.insert("RoleCategoryAuthority.bakByRoleIdAndAuthorityIds", params);//备份 commonMapper.delete("RoleCategoryAuthority.deleteByRoleIdAndAuthorityIds", params);//删除 } public void deleteByRoleId(Integer roleId,String operator){ Map<String,Object> params = new HashMap<String,Object>(); params.put("roleId", roleId); commonMapper.deleteAndBak(RoleCategoryAuthority.class, params, operator); } }
[ "277192937@qq.com" ]
277192937@qq.com
af4686f61af526898752692748cee241209e9fe6
fd431c99a3cefebe3556fa30ce3768f904128496
/JF-THIRD-PAY/pay_cpmponent_entity/src/main/java/com/pay/business/record/mapper/Payv2StatisticsDayCompanyMapper.java
c20bae76ac2796f2351af99adf7dbeb119499adb
[]
no_license
liushengmz/scpc
d2140cb24d0af16c39e4fef4c0cd1422b144e238
f760bf2c3b1ec45fd06d0d89018a3bfae3c9748c
refs/heads/master
2021-06-19T15:49:59.928248
2018-10-16T08:24:18
2018-10-16T08:24:18
95,423,982
2
4
null
2017-06-28T02:35:14
2017-06-26T08:13:22
null
UTF-8
Java
false
false
646
java
package com.pay.business.record.mapper; import java.util.List; import java.util.Map; import com.core.teamwork.base.mapper.BaseMapper; import com.pay.business.record.entity.Payv2StatisticsDayCompany; /** * @author cyl * @version */ public interface Payv2StatisticsDayCompanyMapper extends BaseMapper<Payv2StatisticsDayCompany>{ /** * 批量插入 * @param insertList * @return */ int insertBatchToStatisticsDayCompany(List<Map<String, Object>> insertList); /** * 查询关键数据指标(非今天) * @param paramMap * @return */ Map<String, Object> getCurrentStatisticsDayCompany( Map<String, Object> paramMap); }
[ "liushengmz@163.com" ]
liushengmz@163.com
c665a88d358b3950449b6dc70d8e44a98fc8095b
c508e47f03a648c5a4125d7877972cc359189f32
/app/src/main/java/com/alex/weatherapp/LoadingSystem/WUndergroundLayer/IRetrofitGeolookup.java
fbcaefab4083021f53fe7e24e5a632b7c1fbbed1
[]
no_license
AlexShutov/WeatherApp
035e066f707e3eb0b064d5248a54f6df77c02116
4f3d607d36a5f75255f1d46abeac0b5fb6078e1f
refs/heads/master
2021-01-13T00:49:00.215549
2015-12-08T08:30:55
2015-12-08T08:30:55
43,863,770
0
0
null
null
null
null
UTF-8
Java
false
false
573
java
package com.alex.weatherapp.LoadingSystem.WUndergroundLayer; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Path; /** * Created by Alex on 05.09.2015. */ /** * @Param(lat) latitude * @Param(lon) longitude */ public interface IRetrofitGeolookup { @GET("/api/{app_id}/geolookup/q/{lat},{lon}.json") Call<WUndergroundGeolookupData> getGeolookupData(@Path("app_id") String appID, @Path("lat") double lat, @Path("lon") double lon); }
[ "Alekcey_Shutov@mail.ru" ]
Alekcey_Shutov@mail.ru
142cf2a5471f919f50f46073ffa8b072d8b32dd0
56680ae450a36545943b359238414ee1de2950ca
/eureka-server/src/main/java/lyf/eurekaserver/EurekaServerApplication.java
572db091bef5e38c2a995e0d0f94434a50d48846
[]
no_license
lyfZhixing/springcloudfirst
0a954e63270c91095f3a2751833ad12f084a61a8
db17a2556288dff76e6a7181130871b14c8dd5e4
refs/heads/master
2020-03-25T19:33:44.740488
2018-09-11T02:14:06
2018-09-11T02:14:06
144,088,964
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package lyf.eurekaserver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } }
[ "liyufenglyff@163.com" ]
liyufenglyff@163.com
d98ab17dc81ae8819779a4b5e2aa3a5597690bed
6223d3c9edefe26ec2508618cd5038cc0db5369f
/wba2-2/src/semester/MiSemester.java
426e62cf350b42393bdf926559b433a1cf755082
[]
no_license
Butterfly3108/wba2_phase2
8d3f4fb12248261c44729f55498c2c979828a5d5
ecef01d1682f0d049e397e3621a6162783e3faff
refs/heads/master
2021-01-13T01:37:38.258151
2013-05-15T12:23:48
2013-05-15T12:23:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,694
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // 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: 2013.05.14 at 05:23:46 PM MESZ // package semester; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="semester"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="zeitpunkt"> * &lt;complexType> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="kuerzel" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * &lt;/element> * &lt;element name="modulplan"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="modul" maxOccurs="unbounded" minOccurs="0"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="titel" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="dozent" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;attribute name="credits" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="aufwand" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="termin" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "semester" }) @XmlRootElement(name = "mi_semester") public class MiSemester { @XmlElement(required = true) protected MiSemester.Semester semester; /** * Gets the value of the semester property. * * @return * possible object is * {@link MiSemester.Semester } * */ public MiSemester.Semester getSemester() { return semester; } /** * Sets the value of the semester property. * * @param value * allowed object is * {@link MiSemester.Semester } * */ public void setSemester(MiSemester.Semester value) { this.semester = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="zeitpunkt"> * &lt;complexType> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="kuerzel" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * &lt;/element> * &lt;element name="modulplan"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="modul" maxOccurs="unbounded" minOccurs="0"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="titel" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="dozent" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;attribute name="credits" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="aufwand" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="termin" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "zeitpunkt", "modulplan" }) public static class Semester { @XmlElement(required = true) protected MiSemester.Semester.Zeitpunkt zeitpunkt; @XmlElement(required = true) protected MiSemester.Semester.Modulplan modulplan; /** * Gets the value of the zeitpunkt property. * * @return * possible object is * {@link MiSemester.Semester.Zeitpunkt } * */ public MiSemester.Semester.Zeitpunkt getZeitpunkt() { return zeitpunkt; } /** * Sets the value of the zeitpunkt property. * * @param value * allowed object is * {@link MiSemester.Semester.Zeitpunkt } * */ public void setZeitpunkt(MiSemester.Semester.Zeitpunkt value) { this.zeitpunkt = value; } /** * Gets the value of the modulplan property. * * @return * possible object is * {@link MiSemester.Semester.Modulplan } * */ public MiSemester.Semester.Modulplan getModulplan() { return modulplan; } /** * Sets the value of the modulplan property. * * @param value * allowed object is * {@link MiSemester.Semester.Modulplan } * */ public void setModulplan(MiSemester.Semester.Modulplan value) { this.modulplan = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="modul" maxOccurs="unbounded" minOccurs="0"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="titel" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="dozent" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;attribute name="credits" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="aufwand" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="termin" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "modul" }) public static class Modulplan { protected List<MiSemester.Semester.Modulplan.Modul> modul; /** * Gets the value of the modul property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the modul property. * * <p> * For example, to add a new item, do as follows: * <pre> * getModul().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link MiSemester.Semester.Modulplan.Modul } * * */ public List<MiSemester.Semester.Modulplan.Modul> getModul() { if (modul == null) { modul = new ArrayList<MiSemester.Semester.Modulplan.Modul>(); } return this.modul; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="titel" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="dozent" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;attribute name="credits" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="aufwand" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="termin" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "titel", "dozent" }) public static class Modul { @XmlElement(required = true) protected String titel; @XmlElement(required = true) protected String dozent; @XmlAttribute protected String credits; @XmlAttribute protected String aufwand; @XmlAttribute protected String termin; /** * Gets the value of the titel property. * * @return * possible object is * {@link String } * */ public String getTitel() { return titel; } /** * Sets the value of the titel property. * * @param value * allowed object is * {@link String } * */ public void setTitel(String value) { this.titel = value; } /** * Gets the value of the dozent property. * * @return * possible object is * {@link String } * */ public String getDozent() { return dozent; } /** * Sets the value of the dozent property. * * @param value * allowed object is * {@link String } * */ public void setDozent(String value) { this.dozent = value; } /** * Gets the value of the credits property. * * @return * possible object is * {@link String } * */ public String getCredits() { return credits; } /** * Sets the value of the credits property. * * @param value * allowed object is * {@link String } * */ public void setCredits(String value) { this.credits = value; } /** * Gets the value of the aufwand property. * * @return * possible object is * {@link String } * */ public String getAufwand() { return aufwand; } /** * Sets the value of the aufwand property. * * @param value * allowed object is * {@link String } * */ public void setAufwand(String value) { this.aufwand = value; } /** * Gets the value of the termin property. * * @return * possible object is * {@link String } * */ public String getTermin() { return termin; } /** * Sets the value of the termin property. * * @param value * allowed object is * {@link String } * */ public void setTermin(String value) { this.termin = value; } } } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="kuerzel" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public static class Zeitpunkt { @XmlValue protected String value; @XmlAttribute @XmlSchemaType(name = "anySimpleType") protected String kuerzel; /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the kuerzel property. * * @return * possible object is * {@link String } * */ public String getKuerzel() { return kuerzel; } /** * Sets the value of the kuerzel property. * * @param value * allowed object is * {@link String } * */ public void setKuerzel(String value) { this.kuerzel = value; } } } }
[ "daniela.kucharczyk@gmx.de" ]
daniela.kucharczyk@gmx.de
6ce82e03cfaa3c7d1f19327035c1927b60b82d35
13c12d231484e37d741da0a79d751645da12b991
/src/main/java/controller/IndexController.java
5572461a67af7d8ed80c33b1c6d23c568bc50f17
[]
no_license
osztrovszkij/projectx
d5a6bdd103415e8289c49eb41998af78963bfc36
933a9ec0cebc7db9adeb5421da5a149a4940aee3
refs/heads/master
2021-01-21T14:23:11.647249
2016-06-17T16:44:34
2016-06-17T16:44:34
59,250,857
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package controller; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by roski on 20.5.16. */ @WebServlet(name = "IndexController", urlPatterns = "/") public class IndexController extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher("main.jsp").forward(request, response); } }
[ "v.osztrovszkij@mail.com" ]
v.osztrovszkij@mail.com
459fc3813623f04e5934d52ad5e370df79d22f75
12f5611bac9f44431f5d6b95525a4f3b23d98423
/src/seleniumsessions/e2e.java
97d07616a3455038ffbc48d4ec1cec3c4a360799
[]
no_license
shobhitm1/SeleniumTesting
a728bd8b1e1ff289c05701c8aae5711a6cbe17e4
3593610e91d2620090e304ff7051e4a5380eaf24
refs/heads/master
2023-05-20T10:24:05.201998
2021-06-10T05:14:36
2021-06-10T05:14:36
252,112,283
0
0
null
null
null
null
UTF-8
Java
false
false
1,689
java
package seleniumsessions; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; import io.github.bonigarcia.wdm.WebDriverManager; public class e2e { public static void main(String[] args) throws InterruptedException { WebDriverManager.chromedriver().setup(); // System.setProperty("webdriver.chrome.driver","C:\\Users\\Shobhit\\Downloads\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://spicejet.com"); // URL in the browser driver.manage().window().maximize(); driver.findElement(By.id("ctl00_mainContent_ddl_originStation1_CTXT")).click(); driver.findElement(By.xpath("//a[@value='DEL']")).click(); Thread.sleep(2000); driver.findElement(By.xpath("(//a[@value='MAA'])[2]")).click(); driver.findElement(By.cssSelector(".ui-state-default.ui-state-highlight.ui-state-active")).click(); if (driver.findElement(By.id("Div1")).getAttribute("style").contains("1")) { System.out.println("It is enabled"); Assert.assertTrue(false); } else { System.out.println("It is not enabled"); Assert.assertTrue(true); } driver.findElement(By.id("ctl00_mainContent_chk_SeniorCitizenDiscount")).click(); // driver.findElement(By.id("divpaxinfo")).click(); Select s = new Select(driver.findElement(By.xpath("//*[@id='ctl00_mainContent_DropDownListCurrency']"))); s.selectByValue("AED"); driver.findElement(By.cssSelector("input[value='Search']")).click(); System.out.println("Success Search"); Thread.sleep(5000); System.out.println("New title is:>>" + " " + driver.getTitle()); } }
[ "shobhitm182@gmail.com" ]
shobhitm182@gmail.com
a3c5b42666fc7b3eb32d778d6dbde145c75f6b51
d1557408eec11a505b4c766db7455426319792ce
/src/main/java/com/divergent/clinicmanagement/crud/Drugs.java
b4221ea097d7b141342459656355ab54380e0e3a
[]
no_license
DevendraBagwala/CMS-Spring
4819ef8d559b93162a75650239a98e03eb081fc6
cc3fe8def11c5f33d45e9215f1f8d0aeb50029f2
refs/heads/master
2023-04-18T18:24:21.958039
2021-05-05T06:49:07
2021-05-05T06:49:07
364,487,927
0
0
null
null
null
null
UTF-8
Java
false
false
4,649
java
package com.divergent.clinicmanagement.crud; /** * this class is used for perform CRUD operations on Drugs */ import java.util.List; import java.util.Scanner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.divergent.clinicmanagement.dao.DrugsDao; import com.divergent.clinicmanagement.dto.DrugsDto; @Component public class Drugs { private static Logger logger = LoggerFactory.getLogger(Drugs.class); @Autowired DrugsDao ddao; /* * @Autowired Drugs drugs; */ @Autowired Admin admin; public Admin getAdmin() { return admin; } public void setAdmin(Admin admin) { this.admin = admin; } /* * public Drugs getDrugs() { return drugs; } * * public void setDrugs(Drugs drugs) { this.drugs = drugs; } */ public DrugsDao getDdao() { return ddao; } public void setDdao(DrugsDao ddao) { this.ddao = ddao; } Scanner in = new Scanner(System.in); /** * this method take choice from admin and perform operations like add drug, * delete drug, update drug and see drug list */ public void drugsCRUDOperations() { System.out.println("1. Add Drug\n2. Update Drug data\n3. See Drug List\n4. Delete Drug\n5. Back"); System.out.println("Enter choice:"); int choice = in.nextInt(); switch (choice) { case 1: addDrug(); break; case 2: updateDrug(); break; case 3: seeDrug(); break; case 4: deleteDrug(); break; case 5: admin.adminOperations(); break; } } private void addDrug() { DrugsDto ddto = new DrugsDto(); System.out.println("Enter Drug Name:"); ddto.setDrugName(in.next()); System.out.println("Enter Weight of Drug:"); ddto.setDrugWeight(in.next()); System.out.println("Enter Drug Content:"); ddto.setDrugContent(in.next()); System.out.println("Enter expiry date of drug:"); ddto.setExpiryDate(in.next()); System.out.println("Enter Brand Name of Drug:"); ddto.setBrandName(in.next()); System.out.println("Enter MRP of drug:"); ddto.setDrugMRP(in.nextInt()); if (ddto.getDrugName().equals("") || ddto.getDrugWeight().equals("") || ddto.getDrugContent().equals("") || ddto.getExpiryDate().equals("") || ddto.getBrandName().equals("") || ddto.getDrugMRP().equals("")) { logger.info("All fields are mandadatary"); } else { ddto.setDrugId(ddto.getDrugId()); ddto.setDrugName(ddto.getDrugName()); ddto.setDrugWeight(ddto.getDrugWeight()); ddto.setDrugContent(ddto.getDrugContent()); ddto.setExpiryDate(ddto.getExpiryDate()); ddto.setBrandName(ddto.getBrandName()); ddto.setDrugMRP(ddto.getDrugMRP()); ddao.insert(ddto); } drugsCRUDOperations(); } private void updateDrug() { DrugsDto ddto = new DrugsDto(); System.out.println("Enter drug id:"); ddto.setDrugId(in.nextInt()); System.out.println("Enter Drug Name:"); ddto.setDrugName(in.next()); System.out.println("Enter Weight of Drug:"); ddto.setDrugWeight(in.next()); System.out.println("Enter Drug Content:"); ddto.setDrugContent(in.next()); System.out.println("Enter expiry date of drug:"); ddto.setExpiryDate(in.next()); System.out.println("Enter Brand Name of Drug:"); ddto.setBrandName(in.next()); System.out.println("Enter MRP of drug:"); ddto.setDrugMRP(in.nextInt()); ddto.setDrugId(ddto.getDrugId()); ddto.setDrugName(ddto.getDrugName()); ddto.setDrugWeight(ddto.getDrugWeight()); ddto.setDrugContent(ddto.getDrugContent()); ddto.setExpiryDate(ddto.getExpiryDate()); ddto.setBrandName(ddto.getBrandName()); ddto.setDrugMRP(ddto.getDrugMRP()); ddao.update(ddto); drugsCRUDOperations(); } private void seeDrug() { System.out.println("Data of Doctors"); System.out.printf("%-22s%-22s%-22s%-22s%-22s%-22s%-22s\n", "DrugId", "DrugName", "DrugWeight", "DrugContent", "expiryDate", "BrandName", "DrugMRP"); List<DrugsDto> list = ddao.list(); for (DrugsDto ddto : list) { System.out.printf("%-22d%-22s%-22s%-22s%-22s%-22s%-22d\n", ddto.getDrugId(), ddto.getDrugName(), ddto.getDrugWeight(), ddto.getDrugContent(), ddto.getExpiryDate(), ddto.getBrandName(), ddto.getDrugMRP()); } drugsCRUDOperations(); } private void deleteDrug() { DrugsDto ddto = new DrugsDto(); System.out.println("Enter drug id:"); ddto.setDrugId(in.nextInt()); System.out.println("Do you really want to delete drugs data \n press Y for yes and N for no:"); char ch = in.next().charAt(0); if (ch == 'Y') { ddto.setDrugId(ddto.getDrugId()); ddao.delete(ddto); } drugsCRUDOperations(); } }
[ "amit.uniyal@serole.com" ]
amit.uniyal@serole.com
497c53ff2848cca695354187f405840921d42a90
a12d6ab3dbe22ded84a1671011f68255ab93f356
/server/src/main/java/cc/sc/common/json/JsonResult.java
6ec37c767ca74554858413f2c6ea478b4c748777
[ "Apache-2.0" ]
permissive
BruceChen5683/WS
541b5cea0770aa92b5760456551c06b1517fc0ae
9e731b2668aa3994f36064067c5efdf32934b15e
refs/heads/master
2021-09-07T17:00:09.685058
2018-02-26T12:50:52
2018-02-26T12:50:52
117,941,118
0
1
null
2018-01-31T11:13:23
2018-01-18T06:17:55
C
UTF-8
Java
false
false
6,349
java
package cc.sc.common.json; import java.io.Serializable; import java.util.ArrayList; import java.util.Map; import org.apache.log4j.Logger; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; import org.springframework.util.StringUtils; import cc.sc.common.persistence.Page; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** * @description: Json结果集 * @author: liun * @date: 2016年12月28日 上午11:52:55 * @version: V1.0 */ @Repository @Scope(value = "request") @JsonIgnoreProperties(value = { "advisors", "targetSource", "targetObject", "targetClass", "frozen", "exposeProxy", "preFiltered", "proxyTargetClass", "proxiedInterfaces" }) public class JsonResult implements Serializable { /** * */ private static final long serialVersionUID = 1L; static final Logger logger = Logger.getLogger(JsonResult.class); /** * 结果消息 */ String resultMsg = "OK"; /** * 结果Code */ Integer resultCode = JsonCode.SUCCESS; /** * 长度 */ // long len; /** * 结果信息 */ Object resultInfo; /** * csrf非法访问token */ String token; /** * 分页对象 */ Page page; /** * 取得结果消息 * @return 结果消息 */ public String getResultMsg() { return resultMsg; } /** * 设置结果消息 * @param resultMsg 结果消息 */ public void setResultMsg(String resultMsg) { this.resultMsg = resultMsg; } /** * 取得token消息 * @return token消息 */ public String getToken() { return token; } /** * 设置token消息 * @param token token消息 */ public void setToken(String token) { this.token = token; } /** * 取得结果Code * @return 结果Code */ public Integer getResultCode() { return resultCode; } /** * Description: 设置结果Code * @param resultCode JSON CODE * @since 2016年12月28日 上午11:15:21 */ public void setResultCode(Integer resultCode) { this.resultCode = resultCode; this.setResultMsg(JsonCode.getMsgMap().get(resultCode)); } /** * 取得结果Code * @return 结果Code */ public Object getResultInfo() { return resultInfo; } /** * 设置结果信息 * @param resultInfo 结果信息 */ public void setResultInfo(Object resultInfo) { this.resultInfo = resultInfo; } /** * Description: 构造函数 * @param jsonResult jsonResult对象 * @since 2016年12月28日 上午11:49:56 */ public JsonResult(JsonResult r) { resultMsg = r.getResultMsg(); resultCode = r.getResultCode(); resultInfo = r.getResultInfo(); } /** * Description: 构造函数 * @since 2016年12月28日 上午11:55:15 */ public JsonResult() { } /** * Description: 构造函数 * @param code 消息code * @since 2016年12月28日 下午2:02:29 */ public JsonResult(Integer code) { this.resultCode = code; if (code != null && code > 0) { Map<Integer, String> msgMap = JsonCode.getMsgMap(); String msg = msgMap.get(code); if (!StringUtils.isEmpty(msg)) this.resultMsg = msg; } } /** * Description: 构造函数 * @param code 消息code * @param msg 消息内容 * @since 2016年12月28日 下午2:02:29 */ public JsonResult(Integer code, String msg) { this.resultCode = code; this.resultMsg = msg; } /** * Description: 构造函数 * @param data 数据 * @since 2016年12月28日 下午2:02:29 */ public JsonResult(Object data) { this.resultInfo = data instanceof ArrayList ? JsonUtils.encode(data) : data; } /** * Description: 构造函数 * @param code 消息code * @param msg 消息内容 * @param data 数据 * @since 2016年12月28日 下午2:02:29 */ public JsonResult(Integer code, String msg, Object data) { this.resultCode = code; this.resultMsg = msg; this.resultInfo = data instanceof ArrayList ? JsonUtils.encode(data) : data; } /** * Description: 构造函数 * @param code 消息code * @param msg 消息内容 * @param data 数据 * @param len 长度 * @since 2016年12月28日 下午2:02:29 */ public JsonResult(Integer code, String msg, Object data, long len) { this.resultCode = code; this.resultMsg = msg; this.resultInfo = data instanceof ArrayList ? JsonUtils.encode(data) : data; // this.len = len; } /** * Description: 构造函数 * @param data 数据 * @param len 长度 * @since 2016年12月28日 下午2:02:29 */ public JsonResult(Object data, long len) { this.resultInfo = data instanceof ArrayList ? JsonUtils.encode(data) : data; // this.len = len; } /** * 设置数据 * @param data 数据 */ public void setData(Object data) { this.resultInfo = data instanceof ArrayList ? JsonUtils.encode(data) : data; } /** * 取得长度 * @return 长度 */ // public long getLen() { // return len; // } // // /** // * 设置长度 // * @param len 长度 // */ // public void setLen(long len) { // this.len = len; // } /** * Description: 判断结果信息是否存在 * @return 是否存在的标志位 * @since 2016年12月28日 下午2:02:29 */ // public boolean isExistsData() { // if (this.resultInfo != null) { // return true; // } else { // return false; // } // } /** * Description: 将当前JsonResult对象转换成JSON字符串。 * @return 转换后的Json字符串 * @since 2016年6月28日 下午2:02:29 */ public String objectToJsonStr() { return JsonUtils.encode(this); } /** * Description: 将指定的Json字符串转换成JsonResult对象。 * @param s 指定的Json字符串 * @return 转换后的JsonResult对象 */ public static JsonResult jsonStrToObject(String s) { return JsonUtils.decode(s, JsonResult.class); } /** * Description: 判断是否成功。 * @return 是否成功的标志位 */ // public boolean isSuccess() { // return JsonCode.SUCCESS == this.resultCode; // } /** * 取得数据长度 * @return 数据长度 */ // public long getDataLength() { // if (this.resultInfo != null) { // return this.len; // } else { // return 0; // } // } public static JsonResult getOkJson(Object data) { JsonResult jsonResult = new JsonResult(); jsonResult.setResultInfo(data); jsonResult.setResultCode(JsonCode.SUCCESS); return jsonResult; } public Page getPage() { return page; } public void setPage(Page page) { this.page = page; } }
[ "362726904@qq.com" ]
362726904@qq.com
9b68e8398506932603b2ef0bf40b6e1b871026e5
b309385422db2966b4edb29b1e25b63147a0f6e1
/app/src/test/java/com/tq/thingsmanager/ExampleUnitTest.java
96a70a47b2cff192d607302e46c886a8db7b4a0b
[]
no_license
thomqq/ThingsManager
cbcadfbbc20f6b57b2d8bf9d69cdf2aa0070b579
2a675229d5f3948f0eed056d4dff1a7b40e3cc70
refs/heads/master
2020-07-21T18:54:17.337944
2019-10-12T11:51:43
2019-10-12T11:51:43
206,949,097
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
package com.tq.thingsmanager; 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); } }
[ "tomasz.kudas@itsoft.pl" ]
tomasz.kudas@itsoft.pl
6d7c1772ebd0e6e892e88e8cbe3b2ffa431a0dc4
d64c274d75c571dc7e44cdb72209ce3c3fe03720
/src/main/java/com/example/Service.java
b4a21b311cb3655448abe327c3b0a22ecddbd6a9
[]
no_license
githubwzh/redis-distributed-lock
3dface6cbb562a710e08ee6ccceee4d412c0418d
9d404736c0adf1b323fbddb19d102160ba08ecd7
refs/heads/master
2021-07-06T00:00:22.911377
2017-09-29T08:10:01
2017-09-29T08:10:01
104,734,936
0
0
null
null
null
null
UTF-8
Java
false
false
5,165
java
package com.example; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.Transaction; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * ClassDescribe: * Author :wangzhanhua * Date: 2017-09-25 * Since * To change this template use File | Settings | File Templates. */ public class Service { private static JedisPool pool = null; public static Map<Long, StockInfo> map = new HashMap<Long, StockInfo>() { /** * 0-99共一百个库存 */ { for (long i = 0; i < 15; i++) { StockInfo stockInfo = new StockInfo(); stockInfo.setStockid(i); stockInfo.setStocknum(0); stockInfo.setPickoutnum(0); put(i, stockInfo); } } }; static { JedisPoolConfig config = new JedisPoolConfig(); // 设置最大连接数 config.setMaxTotal(200); // 设置最大空闲数 config.setMaxIdle(8); // 设置最大等待时间 config.setMaxWaitMillis(3600); // 在borrow一个jedis实例时,是否需要验证,若为true,则所有jedis实例均是可用的 config.setTestOnBorrow(true); pool = new JedisPool(config, "127.0.0.1", 6379, 3000); } DistributedLock lock = new DistributedLock(pool); public static void main(String[] args) { Jedis jedis = pool.getResource(); String lockKey = "lockKey"; String watch = jedis.watch(lockKey); System.out.println(watch + "******"); transcationTest(jedis, lockKey, "wzh1"); transcationTest(jedis, lockKey, "wzh3"); } private static void transcationTest(Jedis jedis, String lockKey, String name) { Transaction transaction = jedis.multi(); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } transaction.set(lockKey, name); System.out.println(jedis.watch(lockKey)); List<Object> results = transaction.exec(); if (results == null) { System.out.println("------事物执行结果-null---" + results); } else { System.out.println("------事物执行结果----" + results); } } int n = 500; /** * 模拟秒杀商品 */ public void seckill() { // 返回锁的value值,供释放锁时候进行判断 String indentifier = null; try { indentifier = lock.lockWithTimeout("resource", 5000, 1000); System.out.println(--n); lock.releaseLock("resource", indentifier); } catch (Exception e) { e.printStackTrace(); } } /** * 模拟单库存并发操作 */ public void processStockInfo(StockInfo stockInfo) { String lockname = "stockinfo:" + stockInfo.getStockid(); // 返回锁的value值,供释放锁时候进行判断,获取锁的时间为10秒,锁过期时间60秒 String indentifier = null; try { indentifier = lock.lockWithTimeout(lockname, 10000, 60000); StockInfo currStockInfo = Service.map.get(stockInfo.getStockid()); System.out.println("操作前的库存:" + currStockInfo); currStockInfo.setStocknum(currStockInfo.getStocknum() + 1); // try { // Thread.sleep(200); // } catch (InterruptedException e) { // e.printStackTrace(); // } lock.releaseLock(lockname, indentifier); } catch (Exception e) { e.printStackTrace(); } } public void lockArrays(List<StockInfo> stockInfos) { try { String[] locknames = new String[stockInfos.size()]; for (int i = 0; i < locknames.length; i++) { Long stockid = stockInfos.get(i).getStockid(); locknames[i] = stockid.toString(); } //获取锁超时时间30秒,锁被获取后有效期60秒。 Map<String, String> stringStringMap = lock.lockWithTimeout(locknames, 30000, 60000); if (stringStringMap != null && stringStringMap.size() > 0) { //获得锁成功,执行业务逻辑 System.out.println("--------处理业务逻辑---start-----" + Thread.currentThread().getName() + "--***--" + Service.map); for (StockInfo stockInfo : stockInfos) { StockInfo stockInfoPara = Service.map.get(stockInfo.getStockid());//模拟数据库取数据,更新库存 Thread.sleep(200); stockInfoPara.setStocknum(stockInfoPara.getStocknum() + 1); } System.out.println("--------处理业务逻辑---end-----" + Thread.currentThread().getName() + "--***--" + Service.map); lock.releaseLock(stringStringMap); } } catch (Exception e) { e.printStackTrace(); } } }
[ "772049311@qq.com" ]
772049311@qq.com
a493d08e935eaa016081f533fa95e7bb117fc58c
0844d96d5a618905daa47423f0ec461d9218aa6b
/cpc/CPC_Test/templates/project1/src/test/BigClass.java
aea9918aaf20a258402c645ab38af344fe1baae9
[]
no_license
ag-se/ecg
f7515d644ee3c0110346e357b9cd9c02b179aec0
2fe6511027431fdb30dd50aa492fa64dc6d1fe3a
refs/heads/master
2020-06-04T10:45:16.005646
2015-08-25T16:13:25
2015-08-25T16:13:25
41,373,269
2
0
null
null
null
null
UTF-8
Java
false
false
10,006
java
/******************************************************************************* * Copyright (c) 2006 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 *******************************************************************************/ package test; import java.util.*; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.mapping.ResourceTraversal; import org.eclipse.core.runtime.IPath; /** * Helper class that accumulates several traversals in order * to generate a final set of traversals and to perform certain * queries on a set of traversals. * * TODO: This class was copied from the Team Core plugin since it was an internal * class. It should probably be made API at some point. */ public class CompoundResourceTraversal { private Set deepFolders = new HashSet(); private Set shallowFolders = new HashSet(); private Set zeroFolders = new HashSet(); private Set files = new HashSet(); public void addTraversals(ResourceTraversal[] traversals) { for (int i = 0; i < traversals.length; i++) { ResourceTraversal traversal = traversals[i]; addTraversal(traversal); } } public void addTraversal(ResourceTraversal traversal) { IResource[] resources = traversal.getResources(); for (int i = 0; i < resources.length; i++) { IResource resource = resources[i]; addResource(resource, traversal.getDepth()); } } public void addResource(IResource resource, int depth) { if (resource.getType() == IResource.FILE) { if (!isCovered(resource, IResource.DEPTH_ZERO)) files.add(resource); } switch (depth) { case IResource.DEPTH_INFINITE: addDeepFolder(resource); break; case IResource.DEPTH_ONE: addShallowFolder(resource); break; case IResource.DEPTH_ZERO: addZeroFolder(resource); break; } } private void addShallowFolder(IResource resource) { if (!isCovered(resource, IResource.DEPTH_ONE)) { shallowFolders.add(resource); removeDescendants(resource, IResource.DEPTH_ONE); } } public boolean isCovered(IResource resource, int depth) { IPath fullPath = resource.getFullPath(); // Regardless of the depth, look for a deep folder that covers the resource for (Iterator iter = deepFolders.iterator(); iter.hasNext();) { IResource deepFolder = (IResource) iter.next(); if (deepFolder.getFullPath().isPrefixOf(fullPath)) { return true; } } // For files, look in the shallow folders and files if (resource.getType() == IResource.FILE) { return (shallowFolders.contains(resource.getParent()) || files.contains(resource)); } // For folders, look in appropriate sets switch (depth) { case IResource.DEPTH_ONE: return (shallowFolders.contains(resource)); case IResource.DEPTH_ZERO: return (shallowFolders.contains(resource.getParent()) || zeroFolders.contains(resource)); } return false; } private void addZeroFolder(IResource resource) { if (!isCovered(resource, IResource.DEPTH_ZERO)) zeroFolders.add(resource); } private void addDeepFolder(IResource resource) { if (!isCovered(resource, IResource.DEPTH_INFINITE)) { deepFolders.add(resource); removeDescendants(resource, IResource.DEPTH_INFINITE); } } private void removeDescendants(IResource resource, int depth) { IPath fullPath = resource.getFullPath(); // First, remove any files that are now covered for (Iterator iter = files.iterator(); iter.hasNext();) { IResource child = (IResource) iter.next(); switch (depth) { case IResource.DEPTH_INFINITE: if (fullPath.isPrefixOf(child.getFullPath())) { iter.remove(); } break; case IResource.DEPTH_ONE: if (fullPath.equals(child.getFullPath().removeLastSegments(1))) { iter.remove(); } break; } } // Now, remove any shallow folders if (depth == IResource.DEPTH_INFINITE) { for (Iterator iter = shallowFolders.iterator(); iter.hasNext();) { IResource child = (IResource) iter.next(); if (fullPath.isPrefixOf(child.getFullPath())) { iter.remove(); } } } // Finally, remove any zero folders for (Iterator iter = zeroFolders.iterator(); iter.hasNext();) { IResource child = (IResource) iter.next(); switch (depth) { case IResource.DEPTH_INFINITE: if (fullPath.isPrefixOf(child.getFullPath())) { iter.remove(); } break; case IResource.DEPTH_ONE: // TODO: Is a zero folder covered by a shallow folder? if (fullPath.equals(child.getFullPath().removeLastSegments(1))) { iter.remove(); } break; } } } public void add(CompoundResourceTraversal compoundTraversal) { addResources( (IResource[]) compoundTraversal.deepFolders.toArray(new IResource[compoundTraversal.deepFolders.size()]), IResource.DEPTH_INFINITE); addResources( (IResource[]) compoundTraversal.shallowFolders.toArray(new IResource[compoundTraversal.shallowFolders.size()]), IResource.DEPTH_ONE); addResources( (IResource[]) compoundTraversal.zeroFolders.toArray(new IResource[compoundTraversal.zeroFolders.size()]), IResource.DEPTH_ZERO); addResources( (IResource[]) compoundTraversal.files.toArray(new IResource[compoundTraversal.files.size()]), IResource.DEPTH_ZERO); } public void addResources(IResource[] resources, int depth) { for (int i = 0; i < resources.length; i++) { IResource resource = resources[i]; addResource(resource, depth); } } /** * Return the resources contained in the given traversals that are not covered by this traversal * @param traversals the traversals being testes * @return the resources contained in the given traversals that are not covered by this traversal */ public IResource[] getUncoveredResources(ResourceTraversal[] traversals) { CompoundResourceTraversal newTraversals = new CompoundResourceTraversal(); newTraversals.addTraversals(traversals); return getUncoveredResources(newTraversals); } /* * Return any resources in the other traversal that are not covered by this traversal */ private IResource[] getUncoveredResources(CompoundResourceTraversal otherTraversal) { Set result = new HashSet(); for (Iterator iter = otherTraversal.files.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ZERO)) { result.add(resource); } } for (Iterator iter = otherTraversal.zeroFolders.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ZERO)) { result.add(resource); } } for (Iterator iter = otherTraversal.shallowFolders.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ONE)) { result.add(resource); } } for (Iterator iter = otherTraversal.deepFolders.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_INFINITE)) { result.add(resource); } } return (IResource[]) result.toArray(new IResource[result.size()]); } public ResourceTraversal[] asTraversals() { List result = new ArrayList(); if (!files.isEmpty() || ! zeroFolders.isEmpty()) { Set combined = new HashSet(); combined.addAll(files); combined.addAll(zeroFolders); result.add(new ResourceTraversal((IResource[]) combined.toArray(new IResource[combined.size()]), IResource.DEPTH_ZERO, IResource.NONE)); } if (!shallowFolders.isEmpty()) { result.add(new ResourceTraversal((IResource[]) shallowFolders.toArray(new IResource[shallowFolders.size()]), IResource.DEPTH_ONE, IResource.NONE)); } if (!deepFolders.isEmpty()) { result.add(new ResourceTraversal((IResource[]) deepFolders.toArray(new IResource[deepFolders.size()]), IResource.DEPTH_INFINITE, IResource.NONE)); } return (ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]); } public IResource[] getRoots() { List result = new ArrayList(); result.addAll(files); result.addAll(zeroFolders); result.addAll(shallowFolders); result.addAll(deepFolders); return (IResource[]) result.toArray(new IResource[result.size()]); } public ResourceTraversal[] getUncoveredTraversals(ResourceTraversal[] traversals) { CompoundResourceTraversal other = new CompoundResourceTraversal(); other.addTraversals(traversals); return getUncoveredTraversals(other); } public ResourceTraversal[] getUncoveredTraversals(CompoundResourceTraversal otherTraversal) { CompoundResourceTraversal uncovered = new CompoundResourceTraversal(); for (Iterator iter = otherTraversal.files.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ZERO)) { uncovered.addResource(resource, IResource.DEPTH_ZERO); } } for (Iterator iter = otherTraversal.zeroFolders.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ZERO)) { uncovered.addResource(resource, IResource.DEPTH_ZERO); } } for (Iterator iter = otherTraversal.shallowFolders.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ONE)) { uncovered.addResource(resource, IResource.DEPTH_ONE); } } for (Iterator iter = otherTraversal.deepFolders.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_INFINITE)) { uncovered.addResource(resource, IResource.DEPTH_INFINITE); } } return uncovered.asTraversals(); } public void clear() { deepFolders.clear(); shallowFolders.clear(); zeroFolders.clear(); files.clear(); } }
[ "weckerle@3537aeea-94f2-0310-a3c2-ed66167d6be7" ]
weckerle@3537aeea-94f2-0310-a3c2-ed66167d6be7
cb0cf6bf1f022b7b0fa12d98fe4556052f0908ec
63b181f0d65c1e4eebec9888d469c1659f8150ae
/data/maven/sourceCode/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java
82d27b3bb24ac7094ed5ce2dcd8b39a2696d71e0
[]
no_license
ceparadise/IntrermingualLang
9077570b3093b6952a37331dc604f9170a4a34e2
e212c67e9f2fc093915f388c03464564b74eb65b
refs/heads/master
2021-06-25T11:22:09.356438
2019-09-26T04:06:39
2019-09-26T04:06:39
146,329,452
0
0
null
null
null
null
UTF-8
Java
false
false
4,401
java
package org.apache.maven.tools.plugin.generator; /* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; import org.codehaus.plexus.component.repository.ComponentDependency; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.util.List; /** * @author <a href="mailto:jason@maven.org">Jason van Zyl </a> * @version $Id: PluginDescriptorGeneratorTest.java,v 1.1.1.1 2004/08/09 * 18:43:10 jvanzyl Exp $ */ public class PluginDescriptorGeneratorTest extends AbstractGeneratorTestCase { protected void validate(File destinationDirectory) throws Exception { PluginDescriptorBuilder pdb = new PluginDescriptorBuilder(); File pluginDescriptorFile = new File( destinationDirectory, "plugin.xml" ); String pd = readFile( pluginDescriptorFile ); PluginDescriptor pluginDescriptor = pdb.build( new StringReader( pd ) ); assertEquals( 1, pluginDescriptor.getMojos().size() ); MojoDescriptor mojoDescriptor = (MojoDescriptor) pluginDescriptor.getMojos().get( 0 ); checkMojo( mojoDescriptor ); // ---------------------------------------------------------------------- // Dependencies // ---------------------------------------------------------------------- List dependencies = pluginDescriptor.getDependencies(); checkDependency( "testGroup", "testArtifact", "0.0.0", (ComponentDependency) dependencies.get( 0 ) ); assertEquals( 1, dependencies.size() ); ComponentDependency dependency = (ComponentDependency) dependencies.get( 0 ); assertEquals( "testGroup", dependency.getGroupId() ); assertEquals( "testArtifact", dependency.getArtifactId() ); assertEquals( "0.0.0", dependency.getVersion() ); } private String readFile( File pluginDescriptorFile ) throws IOException { StringWriter sWriter = new StringWriter(); PrintWriter pWriter = new PrintWriter( sWriter ); BufferedReader reader = new BufferedReader( new FileReader( pluginDescriptorFile ) ); String line = null; while ( ( line = reader.readLine() ) != null ) { pWriter.println( line ); } reader.close(); return sWriter.toString(); } private void checkMojo( MojoDescriptor mojoDescriptor ) { assertEquals( "test:testGoal", mojoDescriptor.getFullGoalName() ); assertEquals( "org.apache.maven.tools.plugin.generator.TestMojo", mojoDescriptor.getImplementation() ); // The following should be defaults assertEquals( "per-lookup", mojoDescriptor.getInstantiationStrategy() ); assertNotNull( mojoDescriptor.isDependencyResolutionRequired() ); // check the parameter. checkParameter( (Parameter) mojoDescriptor.getParameters().get( 0 ) ); } private void checkParameter( Parameter parameter ) { assertEquals( "dir", parameter.getName() ); assertEquals( String.class.getName(), parameter.getType() ); assertTrue( parameter.isRequired() ); } private void checkDependency( String groupId, String artifactId, String version, ComponentDependency dependency ) { assertNotNull( dependency ); assertEquals( groupId, dependency.getGroupId() ); assertEquals( artifactId, dependency.getArtifactId() ); assertEquals( version, dependency.getVersion() ); } }
[ "yliu26@nd.edu" ]
yliu26@nd.edu
ff5e5a47a60842a3f3228f5724ccd521d8525ce0
309086a1a6b32bf467f8a3968135da8d7d6e23f9
/todo-microservice/src/test/java/com/todo/ms/AppTest.java
cc61a0d2a3347fab6066b00807dac843cf47aaa1
[]
no_license
radheshyam97/todo-service
692f4c2a2878576ae6f062ef789145ce3ac46b02
2302e2bd883da0d0520dabcc6a997a42b9f2d64f
refs/heads/master
2021-06-25T06:45:47.763274
2019-11-20T08:18:51
2019-11-20T08:18:51
222,879,966
0
0
null
2021-06-04T02:19:21
2019-11-20T07:46:33
Java
UTF-8
Java
false
false
639
java
package com.todo.ms; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "radheshyam.choudhary@alacriti.com" ]
radheshyam.choudhary@alacriti.com
9dd7e99030867a20048240ba574c9eb34ba14825
8a1407de3d43c5cacd06422a50a4815eced31ba8
/Texai/RDFEntityManager/src/main/java/org/texai/subsumptionReasoner/package-info.java
2762b67839aaa744c286bdc3dfd4ba73ddc39f29
[]
no_license
whitten/texai
cc094822307821f9bbf031979a441acf7dffed67
e26df6418fd6e2e3c2ec0a9eee3242f1ad8106b0
refs/heads/master
2020-05-29T08:49:06.949454
2015-12-17T07:02:04
2015-12-17T07:02:04
54,853,779
2
0
null
2016-03-28T00:04:00
2016-03-28T00:04:00
null
UTF-8
Java
false
false
119
java
/** The subsumption reasoner which performs RDF type and subclass inference. */ package org.texai.subsumptionReasoner;
[ "stephenreed@yahoo.com" ]
stephenreed@yahoo.com
3df92fd943e463939a5a24d335b8272549619f3c
1de9fb86c3fb4a4cac82f70bc38d3bf26d4aaaf3
/solutions/leetcode_406/src/Solution.java
2e08db7968cb70ac2db7411f19f3d9e59aef4c86
[ "MIT" ]
permissive
sarmnoo/leetcode
315510a1cb9fc3e711143dcaf0c882b9e537a95a
d6c0328e31b62d7a980dbf2f1c31084448f3da37
refs/heads/master
2022-03-17T00:29:19.977809
2022-02-26T15:22:04
2022-02-26T15:22:04
116,024,082
0
0
null
null
null
null
UTF-8
Java
false
false
1,892
java
import java.util.Arrays; import java.util.Comparator; public class Solution { public static void main (String[] args) { Solution pro = new Solution(); int[][] people = {{7,0},{4,4},{7,1},{5,0},{6,1},{5,2}}; int[][] result = pro.reconstructQueue(people); } public int[][] reconstructQueue(int[][] people){ int[][] result = new int[0][]; sort(people); for(int i = 0; i < people.length; i++){ result = insert(people[i],result,people[i][1]); } for(int i = 0; i < result.length; i++){ for(int j = 0; j < result[i].length; j++){ System.out.print(result[i][j]+" "); } System.out.println(); } return result; } public void sort(int[][] people){ Arrays.sort(people,new Comparator<Object>(){ @Override public int compare(Object o1, Object o2) { int[] one = (int[]) o1; int[] two = (int[]) o2; if(one[0] > two[0]){ return -1; } else if(one[0] < two[0]){ return 1; } else{ if(one[1] > two[1]){ return 1; } else if(one[1] < two[1]){ return -1; } else return 0; } } }); } public int[][] insert(int[] array,int[][] result,int k){ int[][] newResult = new int[result.length + 1][]; for(int i = 0; i < k; i++){ newResult[i] = result[i]; } newResult[k] = array; for(int i = k; i < result.length; i++){ newResult[i+1] = result[i]; } return newResult; } }
[ "627883745@qq.com" ]
627883745@qq.com
f6f122c959e6177a1811faf0a3a5bcbd053f0335
e0ce3633c879b16e956c0bd1c7bab2f089aa6fb0
/src/socket/msg/combat/req/PerformOkReq.java
afc47d4921b64e8e6b71cdb6b420ba86e891fdba
[]
no_license
minghuijiang/XwyCore
3d9f7e48ab6e188b5384cc97bd83605d82f81a23
88a1d6ddd2180c84f3c2da5bcd9219fd1d198671
refs/heads/master
2021-01-10T06:42:44.364641
2016-02-01T15:40:40
2016-02-01T15:40:40
50,793,273
0
0
null
null
null
null
UTF-8
Java
false
false
101
java
package socket.msg.combat.req; public class PerformOkReq extends socket.msg.basic.EmptyMessage { }
[ "minghuijiang32@gmail.com" ]
minghuijiang32@gmail.com
d71d2317c7c33645ec33a145ecdbfc6bac66f8fc
dd80a584130ef1a0333429ba76c1cee0eb40df73
/external/apache-harmony/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/InvalidAlgorithmParameterExceptionTest.java
edf702a68832be73d4cc1b90cd9aca771dd03fb8
[ "MIT", "Apache-2.0" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
2,004
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. */ /** * @author Vera Y. Petrashkova */ package org.apache.harmony.security.tests.java.security.serialization; import java.security.InvalidAlgorithmParameterException; import org.apache.harmony.testframework.serialization.SerializationTest; /** * Test for InvalidAlgorithmParameterException serialization * */ public class InvalidAlgorithmParameterExceptionTest extends SerializationTest { public static String[] msgs = { "New message", "Long message for Exception. Long message for Exception. Long message for Exception." }; protected Object[] getData() { Exception cause = new Exception(msgs[1]); InvalidAlgorithmParameterException dExc = new InvalidAlgorithmParameterException(msgs[0], cause); String msg = null; Throwable th = null; return new Object[] { new InvalidAlgorithmParameterException(), new InvalidAlgorithmParameterException(msg), new InvalidAlgorithmParameterException(msgs[1]), new InvalidAlgorithmParameterException(new Throwable()), new InvalidAlgorithmParameterException(th), new InvalidAlgorithmParameterException(msgs[1], dExc) }; } }
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
f3f2feeeedc78678b088a160484376233eaf0b48
b19bb152ec161fc7936f93d154511ef181ea323b
/sources/com/google/android/apps/camera/legacy/app/filmstrip/GlideConfiguration.java
770a0e114c855a89f39f305d0252c1d92cdc7d89
[]
no_license
hiepgaf/Camera-APK
fa893c5165ae3b73d630943d640163aaf7a0447e
2c314aba059c5551166e90fb9a3f521346a92bb5
refs/heads/master
2020-04-05T02:29:18.095598
2018-09-04T06:32:22
2018-09-04T06:32:22
156,478,724
1
0
null
null
null
null
UTF-8
Java
false
false
286
java
package com.google.android.apps.camera.legacy.app.filmstrip; import p000.apn; /* compiled from: PG */ public class GlideConfiguration implements apn { /* renamed from: b */ public final void mo318b() { } /* renamed from: c */ public final void mo319c() { } }
[ "dewanshrawat15@gmail.com" ]
dewanshrawat15@gmail.com
4463008e82e78d126a748b967eed9503c81ecf81
d9518ffe768af0e4e40b28d7ac66b9465e00778d
/src/pkg/PopupWindow.java
53d1d746eae0d9307e3534fcc33063b097742f79
[]
no_license
jonmcclung/Pacman
c0638ea9ad46372c82702dc372267ddea18faacd
048e2e9418c563b477ca3004ba8515e0e6d77fef
refs/heads/master
2020-05-29T08:40:44.160979
2016-10-03T18:30:35
2016-10-03T18:30:35
69,885,037
0
0
null
null
null
null
UTF-8
Java
false
false
4,178
java
package pkg; import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.KeyStroke; import javax.swing.text.DefaultStyledDocument; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import net.miginfocom.swing.MigLayout; public class PopupWindow extends JPanel { public static Font font; public static int xOffset, yOffset, width, textHeight, defaultOption; public Button[] button; public String [] commands; public int bw = 90, bh = 35; Main main; class ChangeFocusAction extends AbstractAction { String key; ChangeFocusAction(String key) { this.key = key; } @Override public void actionPerformed(ActionEvent e) { switch(key) { case "RIGHT": { if (button.length == 1) { button[0].selected = true; button[0].repaint(); } else { button[defaultOption].selected = false; button[defaultOption].repaint(); defaultOption = (defaultOption + 1)%button.length; button[defaultOption].selected = true; button[defaultOption].repaint(); } break; } case "ENTER": { button[defaultOption].pressed = true; main.doAction(button[defaultOption].command); break; } case "LEFT": { if (button.length == 1) { button[defaultOption].selected = true; button[defaultOption].repaint(); } else { button[defaultOption].selected = false; button[defaultOption].repaint(); defaultOption = (defaultOption + button.length - 1)%button.length; button[defaultOption].selected = true; button[defaultOption].repaint(); } break; } } } } PopupWindow (String msg, int width, int height, int textHeight, String[] buttonText, String [] commands, int defaultOption, Main main) { this.main = main; PopupWindow.defaultOption = defaultOption; Game.ready = false; Game.shouldRender = false; button = new Button[buttonText.length]; this.commands = commands; PopupWindow.width = width; PopupWindow.textHeight = textHeight; xOffset = (int) ((Main.pane.getPreferredSize().getWidth()-width)/2); yOffset = (int) ((Main.pane.getPreferredSize().getHeight()-height)/2); setBackground(Main.dark); font = Main.font; setLayout(new BorderLayout()); JTextPane text = new JTextPane(); StyledDocument doc = new DefaultStyledDocument(); text.setDocument(doc); text.setFont(font.deriveFont(24f)); text.setEditable(false); text.setBackground(Main.dark); text.setForeground(Main.light); text.setText(msg); add(text, BorderLayout.NORTH); JPanel buttonPanel; add(buttonPanel = new JPanel(new MigLayout("ins 0, ","[50%][50%]", "")), BorderLayout.CENTER); buttonPanel.setBackground(Main.dark); String gap = ", gapleft 8, gaptop 8"; String dimensions = ""; String wrap = ""; for (int i = 0; i < buttonText.length; i++) { if (i < 6) { if (i%2 == 1 && i != 0) wrap = ", wrap"; else wrap = ""; if (buttonText.length != 1) { if (i%2 == 1) dimensions = "left"+gap+wrap; else dimensions = "right"+gap+wrap; } if (i == buttonText.length-1 && buttonText.length%2 == 1) dimensions = "span, center"+gap; button[i] = new Button(buttonText[i], commands[i], main); buttonPanel.add(button[i], dimensions); } } SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); setBounds(xOffset, yOffset, width, height); Main.pane.setLayer(this, new Integer(1)); Main.pane.add(this); button[defaultOption].selected = true; button[defaultOption].repaint(); setBindings(); } public void setBindings() { String [] keys= {"RIGHT", "ENTER", "LEFT"}; for (int i=0; i<keys.length; i++) { String s = keys[i]; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(s), i); getActionMap().put(i, new ChangeFocusAction(s)); } } }
[ "jonmcclung@gmail.com" ]
jonmcclung@gmail.com
d85a76898b1c84c15124221ca1d390fd11083241
ac0a1fc8789e5efc128fd9f2068d43ee76698af6
/app/src/main/java/com/example/yoshitake/openyoapplication/MainActivity.java
dccd46e8575044c31e024234bad56a739875d378
[]
no_license
lastcat/OpenYoForAndroid
6c41d4d6e72ad2dfd07b913bc2ad2da0bf4860d5
a6f64f0b20d9697d4b57158fec13cf6c0fa1c1d4
refs/heads/master
2021-01-25T07:08:19.524157
2017-05-12T16:54:03
2017-05-12T16:54:03
24,415,742
0
0
null
2014-10-12T18:46:24
2014-09-24T13:21:52
Java
UTF-8
Java
false
false
11,742
java
package com.example.yoshitake.openyoapplication; import android.app.Activity; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.google.android.gms.gcm.GoogleCloudMessaging; import org.json.JSONObject; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; //TODO:起動時に自動的エンドポイント,アカウントがセットされてしまうのをなんとかしたい //TODO:アカウントのCRUDアクションを整えるべき? //TODO:そもそもUIがクソ public class MainActivity extends Activity { private RequestQueue mQueue; private GoogleCloudMessaging gcm; private Context context; private SQLiteDatabase db; YoUtils yoClient; AccountDBHelper DBHelper; ArrayAdapter<String> endPointAdapter; YoAccountdapter accountAdapter; @InjectView(R.id.toUsername) EditText toUsername; @InjectView(R.id.username) EditText userName; @InjectView(R.id.password) EditText password; @InjectView(R.id.endpointEditText) EditText endpointEditText; @InjectView(R.id.endpointSpinner) Spinner endpointSpinner; @InjectView(R.id.accountSpinner) Spinner accountSpinner; @OnClick(R.id.sendYoButton) void sendYo(){ yoClient.sendYo(toUsername.getText().toString(),mQueue,context); } @OnClick(R.id.sendAllButton) void sendAll(){ yoClient.sendYoAll(mQueue,context); } @OnClick(R.id.countTotalFriendsButton) void countTotalFriends(){ yoClient.countTotalFriends(mQueue,context); } @OnClick(R.id.listFriendsButton) void listFriends(){ yoClient.listFriends(mQueue,context); } @OnClick(R.id.createUserButton) void createUser(){ yoClient.setProjectNumber(this.getString(R.string.project_number)); yoClient.createUser(userName.getText().toString(),password.getText().toString(),mQueue,context); } @OnClick(R.id.saveButton) void saveAccount(){ if(yoClient.getUserNmae()!=null && yoClient.getApi_token()!=null){ DBHelper.insertNewAccount(db,yoClient); accountAdapter.add(yoClient); accountSpinner.setAdapter(accountAdapter); } } @OnClick(R.id.saveEndpointButton) void saveEndPoint(){ endPointAdapter.clear(); DBHelper.insertNewEndpointt(db,endpointEditText.getText().toString()); ArrayList<String> endpointList = DBHelper.selectAllEndpoint(db); for(int i = 0;i < endpointList.size();i++){ endPointAdapter.add(endpointList.get(i)); } endpointSpinner.setAdapter(endPointAdapter); yoClient.setEndPointUrl(endpointEditText.getText().toString()); ArrayList<YoUtils> AccountList = DBHelper.selectAccounts(db,yoClient.getEndPointUrl()); accountAdapter = new YoAccountdapter(getApplicationContext(),R.layout.yo_account_item,AccountList); accountSpinner.setAdapter(accountAdapter); accountAdapter.setDropDownViewResource(R.layout.dropdown_item); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.inject(this); //このあたり綺麗にしないといけない context = getApplication(); yoClient = new YoUtils(); yoClient.setEndPointUrl(""); mQueue = Volley.newRequestQueue(this); DBHelper = new AccountDBHelper(this); db = DBHelper.getWritableDatabase(); endPointAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item); ArrayList<String> endpointList = DBHelper.selectAllEndpoint(db); for(int i = 0;i < endpointList.size();i++){ endPointAdapter.add(endpointList.get(i)); } endpointSpinner.setAdapter(endPointAdapter); endPointAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); endpointSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view,int position, long id) { Spinner spinner = (Spinner) parent; String item = (String) spinner.getSelectedItem(); Toast.makeText(getApplicationContext(), "エンドポイントが"+item+"に設定されました", Toast.LENGTH_LONG).show(); yoClient.setEndPointUrl(item); ArrayList<YoUtils> AccountList = DBHelper.selectAccounts(db,yoClient.getEndPointUrl()); accountAdapter = new YoAccountdapter(getApplicationContext(),R.layout.yo_account_item,AccountList); accountSpinner.setAdapter(accountAdapter); accountAdapter.setDropDownViewResource(R.layout.dropdown_item); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); accountSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Spinner spinner = (Spinner) parent; YoUtils item = (YoUtils)spinner.getSelectedItem(); Toast.makeText(getApplicationContext(), item.getUserNmae(), Toast.LENGTH_LONG).show(); yoClient = item; } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } //このアプリケーションではエンドポイント、アカウント情報をDBで管理する。 static final String DB = "account.db"; static final int DB_VERSION = 1; static final String CREATE_ACCOUNT_TABLE = "create table account_table ( _id integer primary key autoincrement not null, " + "endpoint text not null," + "username text not null," + "api_token text UNIQUE not null );"; static final String CREATE_ENDPOINT_TABLE = "create table endpoint_table ( _id integer primary key autoincrement not null," + "endpoint text UNIQUE not null);"; static final String DROP_TABLE = "drop table mytable;"; private static class AccountDBHelper extends SQLiteOpenHelper { public AccountDBHelper(Context context) { super(context, DB, null, DB_VERSION); } public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_ACCOUNT_TABLE); db.execSQL(CREATE_ENDPOINT_TABLE); } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL(DROP_TABLE); onCreate(db); } public void insertNewEndpointt(SQLiteDatabase db,String endpointUrl){ ContentValues val = new ContentValues(); val.put("endpoint",endpointUrl); try { db.insert("endpoint_table", null, val); } catch(Exception e){ e.printStackTrace(); } } public void insertNewAccount(SQLiteDatabase db,YoUtils yoClient){ if(yoClient.getEndPointUrl()==null||yoClient.getUserNmae()==null||yoClient.getApi_token()==null) return; ContentValues val = new ContentValues(); val.put("endpoint",yoClient.getEndPointUrl()); val.put("username",yoClient.getUserNmae()); val.put("api_token",yoClient.getApi_token()); try { db.insert("account_table",null,val); } catch(Exception e){ e.printStackTrace(); } } public ArrayList<String> selectAllEndpoint(SQLiteDatabase db){ Cursor cursor = null; cursor = db.query("endpoint_table",null,null,null,null,null,null); ArrayList<String> endpointList = new ArrayList<String>(); int index = cursor.getColumnIndex("endpoint"); while(cursor.moveToNext()){ String endpoint = cursor.getString(index); endpointList.add(endpoint); } return endpointList; } public ArrayList<YoUtils> selectAccounts(SQLiteDatabase db,String endpoint){ Cursor cursor = null; String[] strArg = {endpoint}; cursor = db.query("account_table",null,"endpoint=?",strArg,null,null,null); //cursor = db.query("account_table",null,null,null,null,null,null); ArrayList<YoUtils> accountList = new ArrayList<YoUtils>(); int endPointIndex = cursor.getColumnIndex("endpoint"); int nameIndex = cursor.getColumnIndex("username"); int tokenIndex = cursor.getColumnIndex("api_token"); while(cursor.moveToNext()){ YoUtils yoAccount = new YoUtils(); yoAccount.setEndPointUrl(cursor.getString(endPointIndex)); yoAccount.setUsername(cursor.getString(nameIndex)); yoAccount.setApi_token(cursor.getString(tokenIndex)); accountList.add(yoAccount); } return accountList; } } public class YoAccountdapter extends ArrayAdapter<YoUtils> { private LayoutInflater layoutInflater_; public YoAccountdapter(Context context, int textViewResourceId, List<YoUtils> objects) { super(context, textViewResourceId, objects); layoutInflater_ = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { YoUtils item = (YoUtils)getItem(position); if (null == convertView) { convertView = layoutInflater_.inflate(R.layout.yo_account_item, null); } TextView textView; textView = (TextView)convertView.findViewById(R.id.yoAccountName); textView.setText(item.getUserNmae()); return convertView; } } }
[ "kokodoko966@gmail.com" ]
kokodoko966@gmail.com