blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
4210b11477879b2926b2387fe800c7fdf83f8ff9
1b2f09e8d8aec33514260aa9fb098b259ea12c46
/src/main/java/br/edu/iff/pooa20152/ssl_suplementos/activity/PoliticaActivity.java
abca951f69ccaf2b63496560098e9caeb69ad964
[]
no_license
alvesdealmeida/SSL_P2_APP
ebab392e60f2cfb1b8a13543718d2afc56379cf8
dd05e45a9e161dfd4f9a7b3abe30dcfc38a0b242
refs/heads/master
2020-12-25T15:51:39.748735
2016-05-21T00:33:10
2016-05-21T00:33:10
59,331,424
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package br.edu.iff.pooa20152.ssl_suplementos.activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import br.edu.iff.pooa20152.ssl_suplementos.R; public class PoliticaActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_politica); } public void returnMenu(View v) { startActivity(new Intent(this, MenuActivity.class)); } }
d94ecc1026801d1f2b7574d83f0bf5ae35380db6
792e6f9bfdf5adf9e57ff89d6801dae9f3a5eb02
/src/main/java/com/hee/book/springboot/web/dto/PostsResponseDto.java
e1e32e8f789c2d69d539202d45c1c1d30ddb6c76
[]
no_license
hglee93/Board
fff3751ca08364cbb9ba2404aba39991efd794e7
7f664d09ee05d5a70b34a423d12cddf7080771cb
refs/heads/master
2022-11-11T05:12:14.732321
2020-06-19T14:17:01
2020-06-19T14:17:01
270,373,803
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package com.hee.book.springboot.web.dto; import com.hee.book.springboot.domain.posts.Posts; import lombok.Getter; @Getter public class PostsResponseDto { private Long id; private String title; private String content; private String author; public PostsResponseDto(Posts entity) { this.id = entity.getId(); this.title = entity.getTitle(); this.content = entity.getContent(); this.author = entity.getAuthor(); } }
b6f4f449413c958b26df5bf47daa3ed0dcaf5091
78e95efc4370a6b504012c0ef13809b0bbeffbe4
/app/src/main/java/info/ogpguinee/ogp/WebActivity.java
1caac14e3316903682e63a1596d4af128c8a5dca
[]
no_license
jk2386/ogp
f887537a9ec276c5285c610e96a83adb79b2fc66
105c5e12f1a01aab53512ca97aeee2d78226ffec
refs/heads/master
2020-04-01T05:35:23.077886
2018-10-21T05:59:30
2018-10-21T05:59:30
152,910,438
0
0
null
null
null
null
UTF-8
Java
false
false
2,386
java
package info.ogpguinee.ogp; import android.os.Build; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.ViewById; @EActivity(R.layout.slide_menu_fragment) public class WebActivity extends BaseActivity { @ViewById(R.id.web_view) WebView mWebView; String mUrl; @Bean CustomProgressDialog mProgressDialog; private WebViewClient mClient; @AfterViews void setUpView() { showHideProgress(true); if (18 < Build.VERSION.SDK_INT) { mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); } setUpWebView(); mWebView.loadUrl(mUrl); } private void showHideProgress(boolean show) { if(mProgressDialog==null) return; if (show) mProgressDialog.showDialog(); else mProgressDialog.dismissDialog(); } private void setUpClientView() { mClient = new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { showHideProgress(false); } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { showHideProgress(false); } }; } private void setUpWebView() { setUpClientView(); mWebView.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { if (newProgress == 30) showHideProgress(false); // Your custom code. } }); mWebView.setWebViewClient(mClient); mWebView.clearCache(true); mWebView.clearHistory(); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); } }
cae6c8152ae3f19772901627858065f4cba17d98
8c730f82e7e036538dc60617230b16b22d967de2
/DemoSwingApp/src/com/mng/test/ComboTest.java
7bd297db3eec31ce699c6088c0e578118a8240f0
[]
no_license
NagendraMekala/Swing-Space
3cbefae7967956f95d309fa6fa247f0992ee54f4
7c8cd379e55a43a2edb371aa5d0c0de86980f7b4
refs/heads/master
2020-07-29T12:05:16.638345
2019-09-20T13:18:06
2019-09-20T13:18:06
209,794,016
0
0
null
null
null
null
UTF-8
Java
false
false
1,570
java
package com.mng.test; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; public class ComboTest extends JPanel implements ActionListener, Runnable { private final JComboBox combo1 = new JComboBox( new String[]{"Course 1", "Course 2", "Course 3"}); private final JComboBox combo2 = new JComboBox(); private ComboBoxModel[] models = new ComboBoxModel[3]; public ComboTest() { models[0] = new DefaultComboBoxModel( new String[]{"A1", "A2"}); models[1] = new DefaultComboBoxModel( new String[]{"B1", "B2", "B3", "B4"}); models[2] = new DefaultComboBoxModel( new String[]{"C1", "C2"}); combo2.setModel(models[0]); this.add(combo1); this.add(combo2); combo1.addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { int i = combo1.getSelectedIndex(); combo2.setModel(models[i]); } @Override public void run() { JFrame f = new JFrame("ComboTest"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(this); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new ComboTest()); } }
ba6b09bb867628e7ead645e66d536e44532d8871
01bfc9b2d50fe83499325d8678f4fbf6d3f7020e
/src/main/java/mvc/pull/from/scratch/util/Observer.java
41273a5b799ef0364e2837f6fdb7401159f10ecc
[]
no_license
domiq44/mvc_push_pull
39624c0dfc3e405467b5726b188b0ac6e00ed73e
7e54f9fc06b516f268f3c8620f043cc6a74898aa
refs/heads/master
2023-02-16T21:58:18.553639
2021-01-21T19:06:41
2021-01-21T19:06:41
331,724,658
0
0
null
null
null
null
UTF-8
Java
false
false
83
java
package mvc.pull.from.scratch.util; public interface Observer { void update(); }
f3d9328d6c217c3fd43242e4be23c3a49b3b22d7
92845ed38cc90f426d819b020d701e26de947db2
/app/src/main/java/com/example/raceapp/Adapter/UserAdapter.java
27b7b64d1eadefab4c8a534ddb1335143f9a98f6
[]
no_license
DreadPirate09/RaceApp
af5de4d7267f86904776be20b4ccc5f31bbb3fca
e162f1b8be81f5e577aa53e30999bb1c1398f9c1
refs/heads/main
2023-05-14T22:02:38.497552
2021-06-06T17:57:24
2021-06-06T17:57:24
372,867,608
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
package com.example.raceapp.Adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.example.raceapp.Model.User; import com.example.raceapp.R; import java.util.List; public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> { private Context mContext; private List<User> mUsers; public UserAdapter(Context mContext, List<User> mUsers){ this.mUsers = mUsers; this.mContext = mContext; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.user_item, parent, false); return new UserAdapter.ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { User user = mUsers.get(position); holder.username.setText(user.getUsername()); if(user.getImageURL().equals("default")){ holder.profile_image.setImageResource(R.mipmap.ic_launcher); }else{ Glide.with(mContext).load(user.getImageURL()).into(holder.profile_image); } } @Override public int getItemCount() { return 0; } public class ViewHolder extends RecyclerView.ViewHolder{ public TextView username; public ImageView profile_image; public ViewHolder(View itemView){ super(itemView); username = itemView.findViewById(R.id.username); profile_image = itemView.findViewById(R.id.profile_image); } } }
f5cbb3c9a4b0fad93d24ff4faf61b7342519b205
a80d17ef94fb335bb7f1797146950b3aa6ff38cd
/src/com/coolweather/app/db/CoolWeatherOpenHelper.java
257580036b717155c13ce3aac58e8f35bf4c292e
[ "Apache-2.0" ]
permissive
zhihua09/coolweather
e41327b37d6155444bb43de1f18119524f3edcee
9c271451c0423be754ba64d0cad7bc03da635cef
refs/heads/master
2021-01-10T01:48:58.435255
2016-02-01T15:07:44
2016-02-01T15:07:44
50,661,618
0
0
null
null
null
null
GB18030
Java
false
false
1,446
java
package com.coolweather.app.db; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class CoolWeatherOpenHelper extends SQLiteOpenHelper { /** * province表建表语句 */ public static final String CREATE_PROVINCE = "create table Province (" + "id integer primary key autoincrement," + "province_name text," + "province_code text)"; /** * city表建表语句 */ public static final String CREATE_CITY = "create table City (" + "id integer primary key autoincrement," + "city_name text," + "city_code text," + "province_id integer)"; /** * county表建表语句 */ public static final String CREATE_COUNTY = "create table County (" + "id integer primary key autoincrement," + "county_name text," + "county_code text," + "city_id integer)"; public CoolWeatherOpenHelper(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(CREATE_PROVINCE); db.execSQL(CREATE_CITY); db.execSQL(CREATE_COUNTY); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub } }
9d6de83af4be1b6aea4c35770ac19342d0584d9d
21cc4b00914768c5fdc155c5d5e5b8ddb271b61e
/src/com/dmilut/lesson_04/homework/HomeworkYulia.java
d47a7a42bee84ff20ca9cbe883e026711e22100a
[]
no_license
Dmilut/JavaBasic
293427cdad14444e1b3f7732b5707e6edf250483
b96900c116bbe49bd4aaf43ef6ae161550be61f8
refs/heads/master
2022-12-28T04:53:59.753697
2020-10-16T20:41:53
2020-10-16T20:42:28
285,476,903
1
0
null
2020-09-30T19:11:02
2020-08-06T04:53:49
Java
UTF-8
Java
false
false
12,289
java
package com.dmilut.lesson_04.homework; public class HomeworkYulia { public static void main(String[] args) { // Easy level /* Арифметические операторы ----------------------------------- + Складывает значения по обе стороны от оператора - Вычитает правый операнд из левого операнда * Умножает значения по обе стороны от оператора / Оператор деления делит левый операнд на правый операнд % Делит левый операнд на правый операнд и возвращает остаток ++ Инкремент - увеличивает значение операнда на 1 -- Декремент - уменьшает значение операнда на 1 */ /* TODO: 2020-08-05 1.1. Создать переменные a и b типа int 1.2. Инициализировать переменные любыми значениями 1.3. Написать по 2-3 примера с каждым арифметическим оператором 1.4. Вывести результат в консоль Пример решения: int a = 1; int b = 2; System.out.println(a + b); System.out.println(a - b); */ int a = 29; int b = 15; System.out.println("Задача 1."); System.out.println(b + a); System.out.println(b - a); System.out.println(a - b + a); System.out.println(a * b); System.out.println(a * b / 2); System.out.println(a / b); System.out.println(a / b - b); System.out.println(a % b); System.out.println(a % b + b); System.out.println(++a); System.out.println(++b); System.out.println(a + b); /* Операторы сравнения --------------------------------------- == Проверяет, равны или нет значения двух операндов, если да, то условие становится истинным != Проверяет, равны или нет значения двух операндов, если значения не равны, то условие становится истинным > Проверяет, является ли значение левого операнда больше, чем значение правого операнда, если да, то условие становится истинным < Проверяет, является ли значение левого операнда меньше, чем значение правого операнда, если да, то условие становится истинным >= Проверяет, является ли значение левого операнда больше или равно значению правого операнда, если да, то условие становится истинным <= Проверяет, если значение левого операнда меньше или равно значению правого операнда, если да, то условие становится истинным */ /* TODO: 2020-08-07 2.1. Создать переменные a и b типа int 2.2. Инициализировать переменные любыми значениями 2.3. Написать по 2-3 примера с каждым оператором сравнения 2.4. Вывести результат в консоль Пример решения: int a = 1; int b = 2; System.out.println("a == b = " + (a == b)); */ int c = 5; int d = 10; System.out.println("Задача 2."); System.out.println("c == d = " + (c == d)); System.out.println("c != d =" + (c != d)); System.out.println("d < c =" + (d < c)); System.out.println("d > c =" + (d > c)); System.out.println("c >= d =" + (c >= d)); System.out.println("d <= d =" + (d <= d)); /* Логические операторы --------------------------------------- && Называется логический оператор «И». Если оба операнда являются не равны нулю, то условие становится истинным || Называется логический оператор «ИЛИ». Если любой из двух операндов не равен нулю, то условие становится истинным ! Называется логический оператор «НЕ». Использование меняет логическое состояние своего операнда. Если условие имеет значение true, то оператор логического «НЕ» будет делать false */ /* TODO: 2020-08-07 3.1. Создать переменные a и b типа boolean 3.2. Инициализировать переменные любыми значениями 3.3. Написать по 2-3 примера с каждым логическим оператором 3.4. Вывести результат в консоль Пример решения: boolean a = true; boolean b = false; System.out.println("a && b = " + (a&&b)); */ boolean e = false, f = false; boolean g = true, h = true; System.out.println("Задача 3."); System.out.println("e && f = " + (e && f)); System.out.println("g && h = " + (g && h)); System.out.println("e && h = " + (e && h)); System.out.println("g && f = " + (g && f)); System.out.println("e || f = " + (e || f)); System.out.println("g || h = " + (g || h)); System.out.println("e || h = " + (e || h)); System.out.println("g || f = " + (g || f)); System.out.println("!g = " + !g); System.out.println("!e = " + !e + " !h = " + !h); /* Операторы присваивания -------------------------------------- = Простой оператор присваивания, присваивает значения из правой стороны операндов к левому операнду += Оператор присваивания «Добавления», он присваивает левому операнду значения правого -= Оператор присваивания «Вычитания», он вычитает из правого операнда левый операнд *= Оператор присваивания «Умножение», он умножает правый операнд на левый операнд /= Оператор присваивания «Деление», он делит левый операнд на правый операнд %= Оператор присваивания «Модуль», он принимает модуль, с помощью двух операндов и присваивает его результат левому операнду */ /* TODO: 2020-08-07 4.1. Создать переменные a и b типа int 4.2. Инициализировать переменные любыми значениями 4.3. Написать по 2-3 примера с каждым оператором присваивания 4.4. Вывести результат в консоль Пример решения: int a = 1; int b = 2; int c = 0; c = a + b; System.out.println("c = a + b = " + c ); */ int i = 5; int j = 7; int k; k = i + j; System.out.println("Задача 4."); System.out.println("k = i+j = " + k); k += 5; System.out.println("k +=5 " + k); k -= j; System.out.println("k -=j " + k); k *= i; System.out.println("k *=i " + k); k /= j; System.out.println("k /=j " + k); k %= i; System.out.println("k %=i " + k); /* TODO: 2020-08-07 5.1. Создать переменую String со значением "Я разбираюсь в циклах!" 5.2. Используя цикл for вывести значение переменной в консоль 10 раз 5.3. Сделать п.5.2. используя цикл while -------------------------------------------------------------------- 6.1. Создать переменную int со значением 0 6.2. Используя созданную переменную и цикл for вывести в консоль числа 0, 2, 4, 6, 8 6.3. Сделать п.6.2. используя цикл while -------------------------------------------------------------------- 7.1. Создать переменную int со значением 10 7.2. Используя созданную переменную и цикл for вывести в консоль числа 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 7.3. Сделать п.7.2. используя цикл while -------------------------------------------------------------------- */ // #5.1 String Loop = "I'm good in loops "; // #5.2 System.out.println("Задача 5.2."); for (int l = 0; l < 10; l++) { System.out.println(Loop + l); } // #5.3 int m = 9; System.out.println("Задача 5.3."); while (m >= 0) { System.out.println(Loop + m); m--; } // #6.2 System.out.println("Задача 6.2."); for (int n = 0; n <= 8; n += 2) { System.out.println(n); } // #6.1 and 6.3 int o = 0; System.out.println("Задача 6.3."); while (o <= 8) { System.out.println("while loop " + o); o += 2; } // #7.2 System.out.println("Задача 7.2."); for (int p = 10; p >= 0; p--) { System.out.println("for loop - " + p); } // # 7.1 and 7.3 int q = 10; System.out.println("Задача 7.3."); while (q >= 0) { System.out.println("while loop - " + q); q--; } // Middle level /* TODO: 2020-08-07 8.1. Используя вложенныe циклы for вывести в консоль "Я люблю Java!" 10 раз -------------------------------------------------------------------- 9.1. Используя цикл for со значением счетчика от 0 до 10 вывести в консоль "Ох уж эти циклы!" 5 раз */ // Hard level /* TODO: 2020-08-07 10.1. Используя цикл for со значением счетчика от 0 до 10 вывести "Я действительно разбираюсь в циклах!" 20 раз */ } }
9b634b8d02f39c9e8851bea33a1f8d2f6cfd5091
856d119faa0daecbe01ffdb20a4437a163db0224
/MNZ/src/mention/AlarmReceiver.java
30ba98c2fc6fc9e7c8f3e862f9b2e01784ca8472
[]
no_license
hidoler/training
48e77385698f8da972b5111c2875fb5186a6f590
f98e7d599155dfad8f3278e8c092203cb47d7603
refs/heads/master
2016-09-05T13:53:03.474775
2014-06-27T15:00:32
2014-06-27T15:00:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
103
java
/** * */ package mention; /** * @author Richard 2014.06.27 * */ public class AlarmReceiver { }
26b4ceffed2f9a049916d8f868d5e208ddc1008e
2f65d1ad2dfbfe9923b75bf48039dbfd6c692327
/spring_data_jpa_myrepository/src/main/java/com/youyuan/dao/MyRepositoryImpl.java
2c8912b4cbe0700c98d574ea3a20f786e28d09eb
[]
no_license
zhangyu2046196/SpringData
58ad92753ffd5b4865b7041ffdaba7c15c56113f
d46cb1c8424d4237436eaf6bc49d4a41213de609
refs/heads/master
2022-12-23T07:55:23.945743
2019-09-12T06:09:28
2019-09-12T06:09:28
207,976,434
0
0
null
2022-12-16T03:43:25
2019-09-12T06:04:01
Java
UTF-8
Java
false
false
664
java
package com.youyuan.dao; import org.springframework.stereotype.Service; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.List; /** * @author zhangyu * @version 1.0 * @description 自定义Repository接口实现类 * @date 2019/3/8 20:01 */ @Service public class MyRepositoryImpl<T> implements MyRepository<T> { @PersistenceContext(name="entityManagerFactory") private EntityManager entityManager; @Override public T findById(Class<T> tClass, Integer id) { return entityManager.find(tClass,id); } }
2eeca33cd0666a6e8bc454c699943f74661c6b19
846552849f282dc9493403aff65e6db99a952d18
/Primer-Parcial/src/main/java/com/comisiones/ClsComisiones.java
f9a0bf516fd636fb87ab783414e71fdd1b3f6784
[]
no_license
jcalderasl/Parcial-1
1e7994ecbf9c5beea181b876c6fc98b0f8f9bef3
d43ddc0fd06c341145f918a9a740d87ffc2393e6
refs/heads/master
2023-07-07T19:45:37.240698
2021-08-06T19:16:48
2021-08-06T19:16:48
393,478,727
0
0
null
null
null
null
UTF-8
Java
false
false
2,424
java
package com.comisiones; import com.Gastos.ClsGastos; public class ClsComisiones { private String[][]comisiones; private static final int NUMERO_UNIDADES =0; private static final int DESCRIPCIÓN =1; private static final int VALOR_FACTURA =2; private static final int GASTO_VALOR =3; private static final int GASTO_PESO =4; private static final int COSTOxUNIDAD =5; private static final int COSTO_TOTAL =6; private int filaActual = 0; private final int MAX_FILAS = 5; private final int MAX_COLUMNAS = 7; private int totalFilas=0; public ClsComisiones(int filas){ if (filas > MAX_FILAS){ throw (new IllegalArgumentException());//lanzamos la excepcion }else{ totalFilas = filas; comisiones = new String[totalFilas][MAX_COLUMNAS]; } } public String AgregarVendedorMatriz(ClsGastos vende){ if (filaActual >= MAX_FILAS){ return "Ya llegaste al final"; }else{ comisiones[filaActual][NUMERO_UNIDADES]=vende.getNumero_Unidades()+""; comisiones[filaActual][DESCRIPCIÓN]=vende.getDescripcion(); comisiones[filaActual][VALOR_FACTURA]=vende.getValor_Factura()+""; comisiones[filaActual][GASTO_VALOR]=vende.getGasto_valor()+""; comisiones[filaActual][GASTO_PESO]=vende.getGasto_peso()+""; comisiones[filaActual][COSTO_TOTAL]=vende.getCosto_total()+""; filaActual = filaActual+1; } return"ok"; } public void imprimirDecorado(){ for (int x = 0; x < comisiones.length; x++) { System.out.print("|"); for (int y = 0; y < comisiones[x].length; y++) { System.out.print(comisiones[x] [y]); if (y != comisiones[x].length - 1) { System.out.print("\t"); } } System.out.println("|"); } } public double sumaFila(int fila){ double total=0; for (int y=2; y<5; y++){ String fil = comisiones[fila][y]; total = total + Double.valueOf(fil); } comisiones[fila][COSTOxUNIDAD]=total+""; return total; } }
[ "PC@CALDERAS" ]
PC@CALDERAS
441a5f2685dfa6a56aaba8c842d8b29a2c721b7f
3f7ac7742748e673baa4b9419ac860d5d0137ef1
/android/app/src/main/java/com/smitslms/MainApplication.java
4778ffc6887fd7416792fec20fb205dd3853bbe7
[]
no_license
workdone0/slms-native-app
c199383d1fd2e34e36516e88abbc581cb1ac4f94
10f55801169cfe5c2b8d35962d907693d0e31abd
refs/heads/master
2023-01-10T05:20:21.201000
2020-11-08T15:26:45
2020-11-08T15:26:45
310,673,672
0
0
null
null
null
null
UTF-8
Java
false
false
2,599
java
package com.smitslms; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.smitslms.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
14cfa55aa4eda026819984237a2db32bf4d38458
97fd02f71b45aa235f917e79dd68b61c62b56c1c
/src/main/java/com/tencentcloudapi/es/v20180416/models/IndexOptionsField.java
2b6915fd2406775001f4a1e715d5d07369721034
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-java
7df922f7c5826732e35edeab3320035e0cdfba05
09fa672d75e5ca33319a23fcd8b9ca3d2afab1ec
refs/heads/master
2023-09-04T10:51:57.854153
2023-09-01T03:21:09
2023-09-01T03:21:09
129,837,505
537
317
Apache-2.0
2023-09-13T02:42:03
2018-04-17T02:58:16
Java
UTF-8
Java
false
false
8,558
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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.tencentcloudapi.es.v20180416.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class IndexOptionsField extends AbstractModel{ /** * 过期时间 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("ExpireMaxAge") @Expose private String ExpireMaxAge; /** * 过期大小 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("ExpireMaxSize") @Expose private String ExpireMaxSize; /** * 滚动周期 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("RolloverMaxAge") @Expose private String RolloverMaxAge; /** * 是否开启动态滚动 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("RolloverDynamic") @Expose private String RolloverDynamic; /** * 是否开启动态分片 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("ShardNumDynamic") @Expose private String ShardNumDynamic; /** * 时间分区字段 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("TimestampField") @Expose private String TimestampField; /** * 写入模式 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("WriteMode") @Expose private String WriteMode; /** * Get 过期时间 注意:此字段可能返回 null,表示取不到有效值。 * @return ExpireMaxAge 过期时间 注意:此字段可能返回 null,表示取不到有效值。 */ public String getExpireMaxAge() { return this.ExpireMaxAge; } /** * Set 过期时间 注意:此字段可能返回 null,表示取不到有效值。 * @param ExpireMaxAge 过期时间 注意:此字段可能返回 null,表示取不到有效值。 */ public void setExpireMaxAge(String ExpireMaxAge) { this.ExpireMaxAge = ExpireMaxAge; } /** * Get 过期大小 注意:此字段可能返回 null,表示取不到有效值。 * @return ExpireMaxSize 过期大小 注意:此字段可能返回 null,表示取不到有效值。 */ public String getExpireMaxSize() { return this.ExpireMaxSize; } /** * Set 过期大小 注意:此字段可能返回 null,表示取不到有效值。 * @param ExpireMaxSize 过期大小 注意:此字段可能返回 null,表示取不到有效值。 */ public void setExpireMaxSize(String ExpireMaxSize) { this.ExpireMaxSize = ExpireMaxSize; } /** * Get 滚动周期 注意:此字段可能返回 null,表示取不到有效值。 * @return RolloverMaxAge 滚动周期 注意:此字段可能返回 null,表示取不到有效值。 */ public String getRolloverMaxAge() { return this.RolloverMaxAge; } /** * Set 滚动周期 注意:此字段可能返回 null,表示取不到有效值。 * @param RolloverMaxAge 滚动周期 注意:此字段可能返回 null,表示取不到有效值。 */ public void setRolloverMaxAge(String RolloverMaxAge) { this.RolloverMaxAge = RolloverMaxAge; } /** * Get 是否开启动态滚动 注意:此字段可能返回 null,表示取不到有效值。 * @return RolloverDynamic 是否开启动态滚动 注意:此字段可能返回 null,表示取不到有效值。 */ public String getRolloverDynamic() { return this.RolloverDynamic; } /** * Set 是否开启动态滚动 注意:此字段可能返回 null,表示取不到有效值。 * @param RolloverDynamic 是否开启动态滚动 注意:此字段可能返回 null,表示取不到有效值。 */ public void setRolloverDynamic(String RolloverDynamic) { this.RolloverDynamic = RolloverDynamic; } /** * Get 是否开启动态分片 注意:此字段可能返回 null,表示取不到有效值。 * @return ShardNumDynamic 是否开启动态分片 注意:此字段可能返回 null,表示取不到有效值。 */ public String getShardNumDynamic() { return this.ShardNumDynamic; } /** * Set 是否开启动态分片 注意:此字段可能返回 null,表示取不到有效值。 * @param ShardNumDynamic 是否开启动态分片 注意:此字段可能返回 null,表示取不到有效值。 */ public void setShardNumDynamic(String ShardNumDynamic) { this.ShardNumDynamic = ShardNumDynamic; } /** * Get 时间分区字段 注意:此字段可能返回 null,表示取不到有效值。 * @return TimestampField 时间分区字段 注意:此字段可能返回 null,表示取不到有效值。 */ public String getTimestampField() { return this.TimestampField; } /** * Set 时间分区字段 注意:此字段可能返回 null,表示取不到有效值。 * @param TimestampField 时间分区字段 注意:此字段可能返回 null,表示取不到有效值。 */ public void setTimestampField(String TimestampField) { this.TimestampField = TimestampField; } /** * Get 写入模式 注意:此字段可能返回 null,表示取不到有效值。 * @return WriteMode 写入模式 注意:此字段可能返回 null,表示取不到有效值。 */ public String getWriteMode() { return this.WriteMode; } /** * Set 写入模式 注意:此字段可能返回 null,表示取不到有效值。 * @param WriteMode 写入模式 注意:此字段可能返回 null,表示取不到有效值。 */ public void setWriteMode(String WriteMode) { this.WriteMode = WriteMode; } public IndexOptionsField() { } /** * NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy, * and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy. */ public IndexOptionsField(IndexOptionsField source) { if (source.ExpireMaxAge != null) { this.ExpireMaxAge = new String(source.ExpireMaxAge); } if (source.ExpireMaxSize != null) { this.ExpireMaxSize = new String(source.ExpireMaxSize); } if (source.RolloverMaxAge != null) { this.RolloverMaxAge = new String(source.RolloverMaxAge); } if (source.RolloverDynamic != null) { this.RolloverDynamic = new String(source.RolloverDynamic); } if (source.ShardNumDynamic != null) { this.ShardNumDynamic = new String(source.ShardNumDynamic); } if (source.TimestampField != null) { this.TimestampField = new String(source.TimestampField); } if (source.WriteMode != null) { this.WriteMode = new String(source.WriteMode); } } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "ExpireMaxAge", this.ExpireMaxAge); this.setParamSimple(map, prefix + "ExpireMaxSize", this.ExpireMaxSize); this.setParamSimple(map, prefix + "RolloverMaxAge", this.RolloverMaxAge); this.setParamSimple(map, prefix + "RolloverDynamic", this.RolloverDynamic); this.setParamSimple(map, prefix + "ShardNumDynamic", this.ShardNumDynamic); this.setParamSimple(map, prefix + "TimestampField", this.TimestampField); this.setParamSimple(map, prefix + "WriteMode", this.WriteMode); } }
b97a7c1703aaaf3b9cef24081c977d097fa07a5d
5ef7e9d78999509c2f6cd9aff1139392cf922d4f
/VehiclesProject-Fase03/src/com/vehicles/project/domains/Bike.java
d60074d75027299ed1ddc88e21e3fcd56436f22c
[]
no_license
vickycampo/Vehicles
51c534e97abfc753117f52253e4d30ea898eae89
8cfef7373ae55ead20225ee401c2ff095230a3df
refs/heads/master
2020-08-06T01:03:24.335957
2019-10-17T11:08:28
2019-10-17T11:08:28
212,779,179
0
0
null
null
null
null
UTF-8
Java
false
false
915
java
package com.vehicles.project.domains; import java.util.List; public class Bike extends Vehicle { public Bike(String plate, String brand, String color) { super(plate, brand, color); } public void addWheels(List<Wheel> frontWheels, List<Wheel> backWheels) throws Exception { addMultipleWheels(frontWheels); addMultipleWheels(backWheels); } public void addMultipleWheels(List<Wheel> wheels) throws Exception { if (wheels.size() == 0) throw new Exception(); if ( wheels.size() == 2 ) { Wheel rightWheel = wheels.get(0); Wheel leftWheel = wheels.get(1); if (!rightWheel.equals(leftWheel)) throw new Exception(); } for ( Wheel singleWheel : wheels) { this.wheels.add(singleWheel); } } public void addOneWheels(List<Wheel> wheels) throws Exception { if (wheels.size() != 1) throw new Exception(); Wheel oneWheel = wheels.get(0); this.wheels.add(oneWheel); } }
04f22da75d54afe7f43178b1939eff55f40c32f8
c150176c3e6ce17401aaa8fb9e76c47f988a330c
/Factory_Pattern/src/com/example/shape/Circle.java
ad1d304d5df06ff943b353c6239fc66a68be99e3
[]
no_license
Wahed08/Design-Pattern
10b958d8903d5b94f410456a1033b50ae5135e9c
b883f257f0c3fd5fea2e66d67ae9f9ced958c83e
refs/heads/master
2023-05-31T23:23:28.654057
2021-06-28T19:48:29
2021-06-28T19:48:29
380,444,659
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package com.example.shape; public class Circle implements Shape{ @Override public void draw() { System.out.println("Inside Circle::draw() method."); } }
e167f2ff31daaa88e94a91bf48570e4be0587efb
84c3301dd799d1d0e7de58ed50f30719568760e6
/pu/puorder/src/private/nc/bs/pu/m21/state/row/OrderRowCloseState.java
8bcf8f6a130d5eae65c5c8ae4d07e714b5b281b5
[]
no_license
hljlgj/YonyouNC
264d1f38b76fb3c9937603dd48753a9b2666c3ee
fec9955513594a3095be76c4d7f98b0927d721b6
refs/heads/master
2020-06-12T08:25:44.710709
2018-07-04T09:11:33
2018-07-04T09:11:33
null
0
0
null
null
null
null
GB18030
Java
false
false
5,800
java
/** * $文件说明$ * * @author zhaoyha * @version 6.0 * @see * @since 6.0 * @time 2010-1-12 上午09:52:06 */ package nc.bs.pu.m21.state.row; import java.util.ArrayList; import java.util.List; import nc.bs.pu.m21.plugin.OrderPluginPoint; import nc.bs.pu.m21.state.AbstractOrderRowState; import nc.bs.pu.m21.state.IOrderState; import nc.bs.pu.m21.state.ITransitionState; import nc.bs.pu.m21.state.OrderCloseStateUtil; import nc.bs.pu.m21.state.bill.OrderFinalCloseState; import nc.bs.pu.m21.state.rule.CloseUpdateReceivePlanRule; import nc.bs.pu.m21.state.rule.OpenUpdateReceivePlanRule; import nc.bs.pu.m21.state.rule.RowCloseEventAfterRule; import nc.bs.pu.m21.state.rule.RowCloseEventBeforeRule; import nc.bs.pu.m21.state.rule.RowOpenEventAfterRule; import nc.bs.pu.m21.state.rule.RowOpenEventBeforeRule; import nc.bs.pu.m21.state.rule.StateMPPCtrlCheckRule; import nc.bs.pu.m21.state.rule.UnChgStateRowFilterRule; import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery; import nc.vo.pu.m21.entity.OrderCloseVO; import nc.vo.pu.m21.entity.OrderItemVO; import nc.vo.pu.m21.entity.OrderVO; import nc.vo.pu.m21.enumeration.EnumActive; import nc.vo.pu.tbb.BillOperationEnum; import nc.vo.pub.lang.UFBoolean; import nc.vo.scmpub.res.billtype.POBillType; /** * <p> * <b>本类主要完成以下功能:</b> * <ul> * <li>行关闭/打开 * </ul> * <p> * <p> * * @version 6.0 * @since 6.0 * @author zhaoyha * @time 2010-1-12 上午09:52:06 */ public class OrderRowCloseState extends AbstractOrderRowState<OrderCloseVO> implements ITransitionState<OrderCloseVO, OrderVO> { private Integer value; public OrderRowCloseState(EnumActive value) { super(OrderItemVO.class, OrderItemVO.FISACTIVE, value.value()); this.value = (Integer) value.value(); } @Override public IOrderState<OrderVO> getTransitTargetState() { if (EnumActive.CLOSE.value().equals(this.value)) { return new OrderFinalCloseState(UFBoolean.TRUE); } else if (EnumActive.ACTIVE.value().equals(this.value)) { return new OrderFinalCloseState(UFBoolean.FALSE); } return null; } /** * @return value */ public Integer getValue() { return this.value; } @Override public boolean isAutoTransitable(OrderCloseVO vo) { if (EnumActive.CLOSE.value().equals(this.value)) { return OrderCloseStateUtil.getInstance().isRowClosable(vo); } return OrderCloseStateUtil.getInstance().isRowOpenable(vo); } @Override public boolean isPrevStateValid(OrderCloseVO vo) { return true; } @Override public List<IOrderState<OrderCloseVO>> nextState() { List<IOrderState<OrderCloseVO>> nextStates = new ArrayList<IOrderState<OrderCloseVO>>(); if (EnumActive.CLOSE.value().equals(this.value)) { // 同时进行到货关闭 nextStates.add(new OrderArriveCloseState(UFBoolean.TRUE)); // 同时进行入库关闭 nextStates.add(new OrderStoreCloseState(UFBoolean.TRUE)); // 同时进行发票关闭 nextStates.add(new OrderInvoiceCloseState(UFBoolean.TRUE)); // 同时进行付款关闭 nextStates.add(new OrderPayCloseState(UFBoolean.TRUE)); } else { // 同时进行到货打开 nextStates.add(new OrderArriveCloseState(UFBoolean.FALSE)); // 同时进行入库打开 nextStates.add(new OrderStoreCloseState(UFBoolean.FALSE)); // 同时进行发票打开 nextStates.add(new OrderInvoiceCloseState(UFBoolean.FALSE)); // 同时进行付款打开 nextStates.add(new OrderPayCloseState(UFBoolean.FALSE)); } return nextStates; } @Override public void setState(OrderCloseVO[] views) { AroundProcesser<OrderCloseVO> processer = null; if (EnumActive.CLOSE.value().equals(this.value)) { processer = new AroundProcesser<OrderCloseVO>(OrderPluginPoint.ROW_CLOSE); } else { processer = new AroundProcesser<OrderCloseVO>(OrderPluginPoint.ROW_OPEN); } this.addBeforeRule(processer); this.addAfterRule(processer); OrderCloseVO[] beforedViews = processer.before(views); super.setState(beforedViews); processer.after(beforedViews); } /** * @param value 要设置的 value */ public void setValue(Integer value) { this.value = value; } private void addAfterRule(AroundProcesser<OrderCloseVO> processer) { if (EnumActive.CLOSE.value().equals(this.value)) { processer.addAfterRule(new CloseUpdateReceivePlanRule()); // mengjian by 20150120 if (SysInitGroupQuery.isMPPEnabled()) { processer.addAfterRule(new StateMPPCtrlCheckRule(POBillType.Order .getCode(), BillOperationEnum.CLOSE)); } processer.addBeforeRule(new RowCloseEventAfterRule()); } else if (EnumActive.ACTIVE.value().equals(this.value)) { processer.addAfterRule(new OpenUpdateReceivePlanRule()); // mengjian by 20150120 if (SysInitGroupQuery.isMPPEnabled()) { processer.addAfterRule(new StateMPPCtrlCheckRule(POBillType.Order .getCode(), BillOperationEnum.OPEN)); } processer.addBeforeRule(new RowOpenEventAfterRule()); } } private void addBeforeRule(AroundProcesser<OrderCloseVO> processer) { if (EnumActive.CLOSE.value().equals(this.value)) { processer.addBeforeRule(new UnChgStateRowFilterRule( OrderItemVO.FISACTIVE, EnumActive.CLOSE.value())); processer.addBeforeRule(new RowCloseEventBeforeRule()); } else if (EnumActive.ACTIVE.value().equals(this.value)) { processer.addBeforeRule(new UnChgStateRowFilterRule( OrderItemVO.FISACTIVE, EnumActive.ACTIVE.value())); processer.addBeforeRule(new RowOpenEventBeforeRule()); } } }
9f7a98be317b5cc0d6296c9387db5d7aa968077e
6cfb913ad6b8ed6257d8360e57433e6309b6e247
/netty/src/main/java/com/luban/netty/sixdome/DataInfo.java
601ea6cb02cc0a1445544398fb7cc5c9c5dba3a3
[]
no_license
congzhizhi/monitor26
220273f825eaf96738b1ef7d96fce6856c9223fc
5ffe5545e898680d06c27f567f1f3481ea72a03c
refs/heads/master
2022-12-08T20:55:45.197269
2020-08-30T01:07:30
2020-08-30T01:07:30
293,264,003
0
0
null
null
null
null
UTF-8
Java
false
true
116,379
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: persons.proto package com.luban.netty.sixdome; public final class DataInfo { private DataInfo() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } public interface MyObjectOrBuilder extends // @@protoc_insertion_point(interface_extends:com.gupao.protobuf.MyObject) com.google.protobuf.MessageOrBuilder { /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ boolean hasDataType(); /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ MyObject.DataType getDataType(); /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ boolean hasStudent(); /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ Student getStudent(); /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ StudentOrBuilder getStudentOrBuilder(); /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ boolean hasTeacher(); /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ Teacher getTeacher(); /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ TeacherOrBuilder getTeacherOrBuilder(); /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ boolean hasPatriarch(); /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ Patriarch getPatriarch(); /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ PatriarchOrBuilder getPatriarchOrBuilder(); public MyObject.DataBodyCase getDataBodyCase(); } /** * Protobuf type {@code com.gupao.protobuf.MyObject} */ public static final class MyObject extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.gupao.protobuf.MyObject) MyObjectOrBuilder { private static final long serialVersionUID = 0L; // Use MyObject.newBuilder() to construct. private MyObject(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private MyObject() { dataType_ = 0; } @Override @SuppressWarnings({"unused"}) protected Object newInstance( UnusedPrivateParameter unused) { return new MyObject(); } @Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private MyObject( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 8: { int rawValue = input.readEnum(); @SuppressWarnings("deprecation") DataType value = DataType.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(1, rawValue); } else { bitField0_ |= 0x00000001; dataType_ = rawValue; } break; } case 18: { Student.Builder subBuilder = null; if (dataBodyCase_ == 2) { subBuilder = ((Student) dataBody_).toBuilder(); } dataBody_ = input.readMessage(Student.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((Student) dataBody_); dataBody_ = subBuilder.buildPartial(); } dataBodyCase_ = 2; break; } case 26: { Teacher.Builder subBuilder = null; if (dataBodyCase_ == 3) { subBuilder = ((Teacher) dataBody_).toBuilder(); } dataBody_ = input.readMessage(Teacher.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((Teacher) dataBody_); dataBody_ = subBuilder.buildPartial(); } dataBodyCase_ = 3; break; } case 34: { Patriarch.Builder subBuilder = null; if (dataBodyCase_ == 4) { subBuilder = ((Patriarch) dataBody_).toBuilder(); } dataBody_ = input.readMessage(Patriarch.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((Patriarch) dataBody_); dataBody_ = subBuilder.buildPartial(); } dataBodyCase_ = 4; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_MyObject_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_MyObject_fieldAccessorTable .ensureFieldAccessorsInitialized( MyObject.class, Builder.class); } /** * Protobuf enum {@code com.gupao.protobuf.MyObject.DataType} */ public enum DataType implements com.google.protobuf.ProtocolMessageEnum { /** * <code>StudentType = 0;</code> */ StudentType(0), /** * <code>TeacherType = 1;</code> */ TeacherType(1), /** * <code>PatriarchType = 2;</code> */ PatriarchType(2), ; /** * <code>StudentType = 0;</code> */ public static final int StudentType_VALUE = 0; /** * <code>TeacherType = 1;</code> */ public static final int TeacherType_VALUE = 1; /** * <code>PatriarchType = 2;</code> */ public static final int PatriarchType_VALUE = 2; public final int getNumber() { return value; } /** * @deprecated Use {@link #forNumber(int)} instead. */ @Deprecated public static DataType valueOf(int value) { return forNumber(value); } public static DataType forNumber(int value) { switch (value) { case 0: return StudentType; case 1: return TeacherType; case 2: return PatriarchType; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<DataType> internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap< DataType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<DataType>() { public DataType findValueByNumber(int number) { return DataType.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return MyObject.getDescriptor().getEnumTypes().get(0); } private static final DataType[] VALUES = values(); public static DataType valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int value; private DataType(int value) { this.value = value; } // @@protoc_insertion_point(enum_scope:com.gupao.protobuf.MyObject.DataType) } private int bitField0_; private int dataBodyCase_ = 0; private Object dataBody_; public enum DataBodyCase implements com.google.protobuf.Internal.EnumLite { STUDENT(2), TEACHER(3), PATRIARCH(4), DATABODY_NOT_SET(0); private final int value; private DataBodyCase(int value) { this.value = value; } /** * @deprecated Use {@link #forNumber(int)} instead. */ @Deprecated public static DataBodyCase valueOf(int value) { return forNumber(value); } public static DataBodyCase forNumber(int value) { switch (value) { case 2: return STUDENT; case 3: return TEACHER; case 4: return PATRIARCH; case 0: return DATABODY_NOT_SET; default: return null; } } public int getNumber() { return this.value; } }; public DataBodyCase getDataBodyCase() { return DataBodyCase.forNumber( dataBodyCase_); } public static final int DATA_TYPE_FIELD_NUMBER = 1; private int dataType_; /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ public boolean hasDataType() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ public DataType getDataType() { @SuppressWarnings("deprecation") DataType result = DataType.valueOf(dataType_); return result == null ? DataType.StudentType : result; } public static final int STUDENT_FIELD_NUMBER = 2; /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public boolean hasStudent() { return dataBodyCase_ == 2; } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Student getStudent() { if (dataBodyCase_ == 2) { return (Student) dataBody_; } return Student.getDefaultInstance(); } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public StudentOrBuilder getStudentOrBuilder() { if (dataBodyCase_ == 2) { return (Student) dataBody_; } return Student.getDefaultInstance(); } public static final int TEACHER_FIELD_NUMBER = 3; /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public boolean hasTeacher() { return dataBodyCase_ == 3; } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Teacher getTeacher() { if (dataBodyCase_ == 3) { return (Teacher) dataBody_; } return Teacher.getDefaultInstance(); } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public TeacherOrBuilder getTeacherOrBuilder() { if (dataBodyCase_ == 3) { return (Teacher) dataBody_; } return Teacher.getDefaultInstance(); } public static final int PATRIARCH_FIELD_NUMBER = 4; /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public boolean hasPatriarch() { return dataBodyCase_ == 4; } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Patriarch getPatriarch() { if (dataBodyCase_ == 4) { return (Patriarch) dataBody_; } return Patriarch.getDefaultInstance(); } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public PatriarchOrBuilder getPatriarchOrBuilder() { if (dataBodyCase_ == 4) { return (Patriarch) dataBody_; } return Patriarch.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; if (!hasDataType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { output.writeEnum(1, dataType_); } if (dataBodyCase_ == 2) { output.writeMessage(2, (Student) dataBody_); } if (dataBodyCase_ == 3) { output.writeMessage(3, (Teacher) dataBody_); } if (dataBodyCase_ == 4) { output.writeMessage(4, (Patriarch) dataBody_); } unknownFields.writeTo(output); } @Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(1, dataType_); } if (dataBodyCase_ == 2) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, (Student) dataBody_); } if (dataBodyCase_ == 3) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, (Teacher) dataBody_); } if (dataBodyCase_ == 4) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, (Patriarch) dataBody_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof MyObject)) { return super.equals(obj); } MyObject other = (MyObject) obj; if (hasDataType() != other.hasDataType()) return false; if (hasDataType()) { if (dataType_ != other.dataType_) return false; } if (!getDataBodyCase().equals(other.getDataBodyCase())) return false; switch (dataBodyCase_) { case 2: if (!getStudent() .equals(other.getStudent())) return false; break; case 3: if (!getTeacher() .equals(other.getTeacher())) return false; break; case 4: if (!getPatriarch() .equals(other.getPatriarch())) return false; break; case 0: default: } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasDataType()) { hash = (37 * hash) + DATA_TYPE_FIELD_NUMBER; hash = (53 * hash) + dataType_; } switch (dataBodyCase_) { case 2: hash = (37 * hash) + STUDENT_FIELD_NUMBER; hash = (53 * hash) + getStudent().hashCode(); break; case 3: hash = (37 * hash) + TEACHER_FIELD_NUMBER; hash = (53 * hash) + getTeacher().hashCode(); break; case 4: hash = (37 * hash) + PATRIARCH_FIELD_NUMBER; hash = (53 * hash) + getPatriarch().hashCode(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static MyObject parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static MyObject parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static MyObject parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static MyObject parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static MyObject parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static MyObject parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static MyObject parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static MyObject parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static MyObject parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static MyObject parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static MyObject parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static MyObject parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(MyObject prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @Override protected Builder newBuilderForType( BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.gupao.protobuf.MyObject} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.gupao.protobuf.MyObject) MyObjectOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_MyObject_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_MyObject_fieldAccessorTable .ensureFieldAccessorsInitialized( MyObject.class, Builder.class); } // Construct using com.gupao.netty.sixdome.DataInfo.MyObject.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @Override public Builder clear() { super.clear(); dataType_ = 0; bitField0_ = (bitField0_ & ~0x00000001); dataBodyCase_ = 0; dataBody_ = null; return this; } @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return DataInfo.internal_static_com_luban_protobuf_MyObject_descriptor; } @Override public MyObject getDefaultInstanceForType() { return MyObject.getDefaultInstance(); } @Override public MyObject build() { MyObject result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @Override public MyObject buildPartial() { MyObject result = new MyObject(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.dataType_ = dataType_; if (dataBodyCase_ == 2) { if (studentBuilder_ == null) { result.dataBody_ = dataBody_; } else { result.dataBody_ = studentBuilder_.build(); } } if (dataBodyCase_ == 3) { if (teacherBuilder_ == null) { result.dataBody_ = dataBody_; } else { result.dataBody_ = teacherBuilder_.build(); } } if (dataBodyCase_ == 4) { if (patriarchBuilder_ == null) { result.dataBody_ = dataBody_; } else { result.dataBody_ = patriarchBuilder_.build(); } } result.bitField0_ = to_bitField0_; result.dataBodyCase_ = dataBodyCase_; onBuilt(); return result; } @Override public Builder clone() { return super.clone(); } @Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.setField(field, value); } @Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { return super.setRepeatedField(field, index, value); } @Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.addRepeatedField(field, value); } @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof MyObject) { return mergeFrom((MyObject)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(MyObject other) { if (other == MyObject.getDefaultInstance()) return this; if (other.hasDataType()) { setDataType(other.getDataType()); } switch (other.getDataBodyCase()) { case STUDENT: { mergeStudent(other.getStudent()); break; } case TEACHER: { mergeTeacher(other.getTeacher()); break; } case PATRIARCH: { mergePatriarch(other.getPatriarch()); break; } case DATABODY_NOT_SET: { break; } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @Override public final boolean isInitialized() { if (!hasDataType()) { return false; } return true; } @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { MyObject parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (MyObject) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int dataBodyCase_ = 0; private Object dataBody_; public DataBodyCase getDataBodyCase() { return DataBodyCase.forNumber( dataBodyCase_); } public Builder clearDataBody() { dataBodyCase_ = 0; dataBody_ = null; onChanged(); return this; } private int bitField0_; private int dataType_ = 0; /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ public boolean hasDataType() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ public DataType getDataType() { @SuppressWarnings("deprecation") DataType result = DataType.valueOf(dataType_); return result == null ? DataType.StudentType : result; } /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ public Builder setDataType(DataType value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; dataType_ = value.getNumber(); onChanged(); return this; } /** * <code>required .com.gupao.protobuf.MyObject.DataType data_type = 1;</code> */ public Builder clearDataType() { bitField0_ = (bitField0_ & ~0x00000001); dataType_ = 0; onChanged(); return this; } private com.google.protobuf.SingleFieldBuilderV3< Student, Student.Builder, StudentOrBuilder> studentBuilder_; /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public boolean hasStudent() { return dataBodyCase_ == 2; } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Student getStudent() { if (studentBuilder_ == null) { if (dataBodyCase_ == 2) { return (Student) dataBody_; } return Student.getDefaultInstance(); } else { if (dataBodyCase_ == 2) { return studentBuilder_.getMessage(); } return Student.getDefaultInstance(); } } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Builder setStudent(Student value) { if (studentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } dataBody_ = value; onChanged(); } else { studentBuilder_.setMessage(value); } dataBodyCase_ = 2; return this; } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Builder setStudent( Student.Builder builderForValue) { if (studentBuilder_ == null) { dataBody_ = builderForValue.build(); onChanged(); } else { studentBuilder_.setMessage(builderForValue.build()); } dataBodyCase_ = 2; return this; } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Builder mergeStudent(Student value) { if (studentBuilder_ == null) { if (dataBodyCase_ == 2 && dataBody_ != Student.getDefaultInstance()) { dataBody_ = Student.newBuilder((Student) dataBody_) .mergeFrom(value).buildPartial(); } else { dataBody_ = value; } onChanged(); } else { if (dataBodyCase_ == 2) { studentBuilder_.mergeFrom(value); } studentBuilder_.setMessage(value); } dataBodyCase_ = 2; return this; } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Builder clearStudent() { if (studentBuilder_ == null) { if (dataBodyCase_ == 2) { dataBodyCase_ = 0; dataBody_ = null; onChanged(); } } else { if (dataBodyCase_ == 2) { dataBodyCase_ = 0; dataBody_ = null; } studentBuilder_.clear(); } return this; } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public Student.Builder getStudentBuilder() { return getStudentFieldBuilder().getBuilder(); } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ public StudentOrBuilder getStudentOrBuilder() { if ((dataBodyCase_ == 2) && (studentBuilder_ != null)) { return studentBuilder_.getMessageOrBuilder(); } else { if (dataBodyCase_ == 2) { return (Student) dataBody_; } return Student.getDefaultInstance(); } } /** * <code>optional .com.gupao.protobuf.Student student = 2;</code> */ private com.google.protobuf.SingleFieldBuilderV3< Student, Student.Builder, StudentOrBuilder> getStudentFieldBuilder() { if (studentBuilder_ == null) { if (!(dataBodyCase_ == 2)) { dataBody_ = Student.getDefaultInstance(); } studentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< Student, Student.Builder, StudentOrBuilder>( (Student) dataBody_, getParentForChildren(), isClean()); dataBody_ = null; } dataBodyCase_ = 2; onChanged();; return studentBuilder_; } private com.google.protobuf.SingleFieldBuilderV3< Teacher, Teacher.Builder, TeacherOrBuilder> teacherBuilder_; /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public boolean hasTeacher() { return dataBodyCase_ == 3; } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Teacher getTeacher() { if (teacherBuilder_ == null) { if (dataBodyCase_ == 3) { return (Teacher) dataBody_; } return Teacher.getDefaultInstance(); } else { if (dataBodyCase_ == 3) { return teacherBuilder_.getMessage(); } return Teacher.getDefaultInstance(); } } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Builder setTeacher(Teacher value) { if (teacherBuilder_ == null) { if (value == null) { throw new NullPointerException(); } dataBody_ = value; onChanged(); } else { teacherBuilder_.setMessage(value); } dataBodyCase_ = 3; return this; } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Builder setTeacher( Teacher.Builder builderForValue) { if (teacherBuilder_ == null) { dataBody_ = builderForValue.build(); onChanged(); } else { teacherBuilder_.setMessage(builderForValue.build()); } dataBodyCase_ = 3; return this; } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Builder mergeTeacher(Teacher value) { if (teacherBuilder_ == null) { if (dataBodyCase_ == 3 && dataBody_ != Teacher.getDefaultInstance()) { dataBody_ = Teacher.newBuilder((Teacher) dataBody_) .mergeFrom(value).buildPartial(); } else { dataBody_ = value; } onChanged(); } else { if (dataBodyCase_ == 3) { teacherBuilder_.mergeFrom(value); } teacherBuilder_.setMessage(value); } dataBodyCase_ = 3; return this; } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Builder clearTeacher() { if (teacherBuilder_ == null) { if (dataBodyCase_ == 3) { dataBodyCase_ = 0; dataBody_ = null; onChanged(); } } else { if (dataBodyCase_ == 3) { dataBodyCase_ = 0; dataBody_ = null; } teacherBuilder_.clear(); } return this; } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public Teacher.Builder getTeacherBuilder() { return getTeacherFieldBuilder().getBuilder(); } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ public TeacherOrBuilder getTeacherOrBuilder() { if ((dataBodyCase_ == 3) && (teacherBuilder_ != null)) { return teacherBuilder_.getMessageOrBuilder(); } else { if (dataBodyCase_ == 3) { return (Teacher) dataBody_; } return Teacher.getDefaultInstance(); } } /** * <code>optional .com.gupao.protobuf.Teacher teacher = 3;</code> */ private com.google.protobuf.SingleFieldBuilderV3< Teacher, Teacher.Builder, TeacherOrBuilder> getTeacherFieldBuilder() { if (teacherBuilder_ == null) { if (!(dataBodyCase_ == 3)) { dataBody_ = Teacher.getDefaultInstance(); } teacherBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< Teacher, Teacher.Builder, TeacherOrBuilder>( (Teacher) dataBody_, getParentForChildren(), isClean()); dataBody_ = null; } dataBodyCase_ = 3; onChanged();; return teacherBuilder_; } private com.google.protobuf.SingleFieldBuilderV3< Patriarch, Patriarch.Builder, PatriarchOrBuilder> patriarchBuilder_; /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public boolean hasPatriarch() { return dataBodyCase_ == 4; } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Patriarch getPatriarch() { if (patriarchBuilder_ == null) { if (dataBodyCase_ == 4) { return (Patriarch) dataBody_; } return Patriarch.getDefaultInstance(); } else { if (dataBodyCase_ == 4) { return patriarchBuilder_.getMessage(); } return Patriarch.getDefaultInstance(); } } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Builder setPatriarch(Patriarch value) { if (patriarchBuilder_ == null) { if (value == null) { throw new NullPointerException(); } dataBody_ = value; onChanged(); } else { patriarchBuilder_.setMessage(value); } dataBodyCase_ = 4; return this; } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Builder setPatriarch( Patriarch.Builder builderForValue) { if (patriarchBuilder_ == null) { dataBody_ = builderForValue.build(); onChanged(); } else { patriarchBuilder_.setMessage(builderForValue.build()); } dataBodyCase_ = 4; return this; } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Builder mergePatriarch(Patriarch value) { if (patriarchBuilder_ == null) { if (dataBodyCase_ == 4 && dataBody_ != Patriarch.getDefaultInstance()) { dataBody_ = Patriarch.newBuilder((Patriarch) dataBody_) .mergeFrom(value).buildPartial(); } else { dataBody_ = value; } onChanged(); } else { if (dataBodyCase_ == 4) { patriarchBuilder_.mergeFrom(value); } patriarchBuilder_.setMessage(value); } dataBodyCase_ = 4; return this; } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Builder clearPatriarch() { if (patriarchBuilder_ == null) { if (dataBodyCase_ == 4) { dataBodyCase_ = 0; dataBody_ = null; onChanged(); } } else { if (dataBodyCase_ == 4) { dataBodyCase_ = 0; dataBody_ = null; } patriarchBuilder_.clear(); } return this; } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public Patriarch.Builder getPatriarchBuilder() { return getPatriarchFieldBuilder().getBuilder(); } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ public PatriarchOrBuilder getPatriarchOrBuilder() { if ((dataBodyCase_ == 4) && (patriarchBuilder_ != null)) { return patriarchBuilder_.getMessageOrBuilder(); } else { if (dataBodyCase_ == 4) { return (Patriarch) dataBody_; } return Patriarch.getDefaultInstance(); } } /** * <code>optional .com.gupao.protobuf.Patriarch patriarch = 4;</code> */ private com.google.protobuf.SingleFieldBuilderV3< Patriarch, Patriarch.Builder, PatriarchOrBuilder> getPatriarchFieldBuilder() { if (patriarchBuilder_ == null) { if (!(dataBodyCase_ == 4)) { dataBody_ = Patriarch.getDefaultInstance(); } patriarchBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< Patriarch, Patriarch.Builder, PatriarchOrBuilder>( (Patriarch) dataBody_, getParentForChildren(), isClean()); dataBody_ = null; } dataBodyCase_ = 4; onChanged();; return patriarchBuilder_; } @Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.gupao.protobuf.MyObject) } // @@protoc_insertion_point(class_scope:com.gupao.protobuf.MyObject) private static final MyObject DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new MyObject(); } public static MyObject getDefaultInstance() { return DEFAULT_INSTANCE; } @Deprecated public static final com.google.protobuf.Parser<MyObject> PARSER = new com.google.protobuf.AbstractParser<MyObject>() { @Override public MyObject parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new MyObject(input, extensionRegistry); } }; public static com.google.protobuf.Parser<MyObject> parser() { return PARSER; } @Override public com.google.protobuf.Parser<MyObject> getParserForType() { return PARSER; } @Override public MyObject getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface StudentOrBuilder extends // @@protoc_insertion_point(interface_extends:com.gupao.protobuf.Student) com.google.protobuf.MessageOrBuilder { /** * <code>optional string name = 1;</code> */ boolean hasName(); /** * <code>optional string name = 1;</code> */ String getName(); /** * <code>optional string name = 1;</code> */ com.google.protobuf.ByteString getNameBytes(); /** * <code>optional int32 age = 2;</code> */ boolean hasAge(); /** * <code>optional int32 age = 2;</code> */ int getAge(); /** * <code>optional string address = 3;</code> */ boolean hasAddress(); /** * <code>optional string address = 3;</code> */ String getAddress(); /** * <code>optional string address = 3;</code> */ com.google.protobuf.ByteString getAddressBytes(); } /** * Protobuf type {@code com.gupao.protobuf.Student} */ public static final class Student extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.gupao.protobuf.Student) StudentOrBuilder { private static final long serialVersionUID = 0L; // Use Student.newBuilder() to construct. private Student(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Student() { name_ = ""; address_ = ""; } @Override @SuppressWarnings({"unused"}) protected Object newInstance( UnusedPrivateParameter unused) { return new Student(); } @Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Student( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; name_ = bs; break; } case 16: { bitField0_ |= 0x00000002; age_ = input.readInt32(); break; } case 26: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; address_ = bs; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_Student_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_Student_fieldAccessorTable .ensureFieldAccessorsInitialized( Student.class, Builder.class); } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile Object name_; /** * <code>optional string name = 1;</code> */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> */ public String getName() { Object ref = name_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * <code>optional string name = 1;</code> */ public com.google.protobuf.ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int AGE_FIELD_NUMBER = 2; private int age_; /** * <code>optional int32 age = 2;</code> */ public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> */ public int getAge() { return age_; } public static final int ADDRESS_FIELD_NUMBER = 3; private volatile Object address_; /** * <code>optional string address = 3;</code> */ public boolean hasAddress() { return ((bitField0_ & 0x00000004) != 0); } /** * <code>optional string address = 3;</code> */ public String getAddress() { Object ref = address_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { address_ = s; } return s; } } /** * <code>optional string address = 3;</code> */ public com.google.protobuf.ByteString getAddressBytes() { Object ref = address_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt32(2, age_); } if (((bitField0_ & 0x00000004) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, address_); } unknownFields.writeTo(output); } @Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, age_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, address_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Student)) { return super.equals(obj); } Student other = (Student) obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (!getName() .equals(other.getName())) return false; } if (hasAge() != other.hasAge()) return false; if (hasAge()) { if (getAge() != other.getAge()) return false; } if (hasAddress() != other.hasAddress()) return false; if (hasAddress()) { if (!getAddress() .equals(other.getAddress())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasAge()) { hash = (37 * hash) + AGE_FIELD_NUMBER; hash = (53 * hash) + getAge(); } if (hasAddress()) { hash = (37 * hash) + ADDRESS_FIELD_NUMBER; hash = (53 * hash) + getAddress().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static Student parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Student parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Student parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Student parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Student parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Student parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Student parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static Student parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static Student parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static Student parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static Student parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static Student parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(Student prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @Override protected Builder newBuilderForType( BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.gupao.protobuf.Student} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.gupao.protobuf.Student) StudentOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_Student_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_Student_fieldAccessorTable .ensureFieldAccessorsInitialized( Student.class, Builder.class); } // Construct using com.gupao.netty.sixdome.DataInfo.Student.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @Override public Builder clear() { super.clear(); name_ = ""; bitField0_ = (bitField0_ & ~0x00000001); age_ = 0; bitField0_ = (bitField0_ & ~0x00000002); address_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return DataInfo.internal_static_com_luban_protobuf_Student_descriptor; } @Override public Student getDefaultInstanceForType() { return Student.getDefaultInstance(); } @Override public Student build() { Student result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @Override public Student buildPartial() { Student result = new Student(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) != 0)) { result.age_ = age_; to_bitField0_ |= 0x00000002; } if (((from_bitField0_ & 0x00000004) != 0)) { to_bitField0_ |= 0x00000004; } result.address_ = address_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } @Override public Builder clone() { return super.clone(); } @Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.setField(field, value); } @Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { return super.setRepeatedField(field, index, value); } @Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.addRepeatedField(field, value); } @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof Student) { return mergeFrom((Student)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(Student other) { if (other == Student.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasAge()) { setAge(other.getAge()); } if (other.hasAddress()) { bitField0_ |= 0x00000004; address_ = other.address_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @Override public final boolean isInitialized() { return true; } @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Student parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (Student) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private Object name_ = ""; /** * <code>optional string name = 1;</code> */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> */ public String getName() { Object ref = name_; if (!(ref instanceof String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return (String) ref; } } /** * <code>optional string name = 1;</code> */ public com.google.protobuf.ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string name = 1;</code> */ public Builder setName( String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } /** * <code>optional string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <code>optional string name = 1;</code> */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } private int age_ ; /** * <code>optional int32 age = 2;</code> */ public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> */ public int getAge() { return age_; } /** * <code>optional int32 age = 2;</code> */ public Builder setAge(int value) { bitField0_ |= 0x00000002; age_ = value; onChanged(); return this; } /** * <code>optional int32 age = 2;</code> */ public Builder clearAge() { bitField0_ = (bitField0_ & ~0x00000002); age_ = 0; onChanged(); return this; } private Object address_ = ""; /** * <code>optional string address = 3;</code> */ public boolean hasAddress() { return ((bitField0_ & 0x00000004) != 0); } /** * <code>optional string address = 3;</code> */ public String getAddress() { Object ref = address_; if (!(ref instanceof String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { address_ = s; } return s; } else { return (String) ref; } } /** * <code>optional string address = 3;</code> */ public com.google.protobuf.ByteString getAddressBytes() { Object ref = address_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string address = 3;</code> */ public Builder setAddress( String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; address_ = value; onChanged(); return this; } /** * <code>optional string address = 3;</code> */ public Builder clearAddress() { bitField0_ = (bitField0_ & ~0x00000004); address_ = getDefaultInstance().getAddress(); onChanged(); return this; } /** * <code>optional string address = 3;</code> */ public Builder setAddressBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; address_ = value; onChanged(); return this; } @Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.gupao.protobuf.Student) } // @@protoc_insertion_point(class_scope:com.gupao.protobuf.Student) private static final Student DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new Student(); } public static Student getDefaultInstance() { return DEFAULT_INSTANCE; } @Deprecated public static final com.google.protobuf.Parser<Student> PARSER = new com.google.protobuf.AbstractParser<Student>() { @Override public Student parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Student(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Student> parser() { return PARSER; } @Override public com.google.protobuf.Parser<Student> getParserForType() { return PARSER; } @Override public Student getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface TeacherOrBuilder extends // @@protoc_insertion_point(interface_extends:com.gupao.protobuf.Teacher) com.google.protobuf.MessageOrBuilder { /** * <code>optional string name = 1;</code> */ boolean hasName(); /** * <code>optional string name = 1;</code> */ String getName(); /** * <code>optional string name = 1;</code> */ com.google.protobuf.ByteString getNameBytes(); /** * <code>optional int32 age = 2;</code> */ boolean hasAge(); /** * <code>optional int32 age = 2;</code> */ int getAge(); /** * <code>optional string duty = 3;</code> */ boolean hasDuty(); /** * <code>optional string duty = 3;</code> */ String getDuty(); /** * <code>optional string duty = 3;</code> */ com.google.protobuf.ByteString getDutyBytes(); } /** * Protobuf type {@code com.gupao.protobuf.Teacher} */ public static final class Teacher extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.gupao.protobuf.Teacher) TeacherOrBuilder { private static final long serialVersionUID = 0L; // Use Teacher.newBuilder() to construct. private Teacher(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Teacher() { name_ = ""; duty_ = ""; } @Override @SuppressWarnings({"unused"}) protected Object newInstance( UnusedPrivateParameter unused) { return new Teacher(); } @Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Teacher( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; name_ = bs; break; } case 16: { bitField0_ |= 0x00000002; age_ = input.readInt32(); break; } case 26: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; duty_ = bs; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_Teacher_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_Teacher_fieldAccessorTable .ensureFieldAccessorsInitialized( Teacher.class, Builder.class); } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile Object name_; /** * <code>optional string name = 1;</code> */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> */ public String getName() { Object ref = name_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * <code>optional string name = 1;</code> */ public com.google.protobuf.ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int AGE_FIELD_NUMBER = 2; private int age_; /** * <code>optional int32 age = 2;</code> */ public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> */ public int getAge() { return age_; } public static final int DUTY_FIELD_NUMBER = 3; private volatile Object duty_; /** * <code>optional string duty = 3;</code> */ public boolean hasDuty() { return ((bitField0_ & 0x00000004) != 0); } /** * <code>optional string duty = 3;</code> */ public String getDuty() { Object ref = duty_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { duty_ = s; } return s; } } /** * <code>optional string duty = 3;</code> */ public com.google.protobuf.ByteString getDutyBytes() { Object ref = duty_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); duty_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt32(2, age_); } if (((bitField0_ & 0x00000004) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, duty_); } unknownFields.writeTo(output); } @Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, age_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, duty_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Teacher)) { return super.equals(obj); } Teacher other = (Teacher) obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (!getName() .equals(other.getName())) return false; } if (hasAge() != other.hasAge()) return false; if (hasAge()) { if (getAge() != other.getAge()) return false; } if (hasDuty() != other.hasDuty()) return false; if (hasDuty()) { if (!getDuty() .equals(other.getDuty())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasAge()) { hash = (37 * hash) + AGE_FIELD_NUMBER; hash = (53 * hash) + getAge(); } if (hasDuty()) { hash = (37 * hash) + DUTY_FIELD_NUMBER; hash = (53 * hash) + getDuty().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static Teacher parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Teacher parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Teacher parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Teacher parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Teacher parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Teacher parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Teacher parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static Teacher parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static Teacher parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static Teacher parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static Teacher parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static Teacher parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(Teacher prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @Override protected Builder newBuilderForType( BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.gupao.protobuf.Teacher} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.gupao.protobuf.Teacher) TeacherOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_Teacher_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_Teacher_fieldAccessorTable .ensureFieldAccessorsInitialized( Teacher.class, Builder.class); } // Construct using com.gupao.netty.sixdome.DataInfo.Teacher.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @Override public Builder clear() { super.clear(); name_ = ""; bitField0_ = (bitField0_ & ~0x00000001); age_ = 0; bitField0_ = (bitField0_ & ~0x00000002); duty_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return DataInfo.internal_static_com_luban_protobuf_Teacher_descriptor; } @Override public Teacher getDefaultInstanceForType() { return Teacher.getDefaultInstance(); } @Override public Teacher build() { Teacher result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @Override public Teacher buildPartial() { Teacher result = new Teacher(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) != 0)) { result.age_ = age_; to_bitField0_ |= 0x00000002; } if (((from_bitField0_ & 0x00000004) != 0)) { to_bitField0_ |= 0x00000004; } result.duty_ = duty_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } @Override public Builder clone() { return super.clone(); } @Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.setField(field, value); } @Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { return super.setRepeatedField(field, index, value); } @Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.addRepeatedField(field, value); } @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof Teacher) { return mergeFrom((Teacher)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(Teacher other) { if (other == Teacher.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasAge()) { setAge(other.getAge()); } if (other.hasDuty()) { bitField0_ |= 0x00000004; duty_ = other.duty_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @Override public final boolean isInitialized() { return true; } @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Teacher parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (Teacher) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private Object name_ = ""; /** * <code>optional string name = 1;</code> */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> */ public String getName() { Object ref = name_; if (!(ref instanceof String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return (String) ref; } } /** * <code>optional string name = 1;</code> */ public com.google.protobuf.ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string name = 1;</code> */ public Builder setName( String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } /** * <code>optional string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <code>optional string name = 1;</code> */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } private int age_ ; /** * <code>optional int32 age = 2;</code> */ public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> */ public int getAge() { return age_; } /** * <code>optional int32 age = 2;</code> */ public Builder setAge(int value) { bitField0_ |= 0x00000002; age_ = value; onChanged(); return this; } /** * <code>optional int32 age = 2;</code> */ public Builder clearAge() { bitField0_ = (bitField0_ & ~0x00000002); age_ = 0; onChanged(); return this; } private Object duty_ = ""; /** * <code>optional string duty = 3;</code> */ public boolean hasDuty() { return ((bitField0_ & 0x00000004) != 0); } /** * <code>optional string duty = 3;</code> */ public String getDuty() { Object ref = duty_; if (!(ref instanceof String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { duty_ = s; } return s; } else { return (String) ref; } } /** * <code>optional string duty = 3;</code> */ public com.google.protobuf.ByteString getDutyBytes() { Object ref = duty_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); duty_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string duty = 3;</code> */ public Builder setDuty( String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; duty_ = value; onChanged(); return this; } /** * <code>optional string duty = 3;</code> */ public Builder clearDuty() { bitField0_ = (bitField0_ & ~0x00000004); duty_ = getDefaultInstance().getDuty(); onChanged(); return this; } /** * <code>optional string duty = 3;</code> */ public Builder setDutyBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; duty_ = value; onChanged(); return this; } @Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.gupao.protobuf.Teacher) } // @@protoc_insertion_point(class_scope:com.gupao.protobuf.Teacher) private static final Teacher DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new Teacher(); } public static Teacher getDefaultInstance() { return DEFAULT_INSTANCE; } @Deprecated public static final com.google.protobuf.Parser<Teacher> PARSER = new com.google.protobuf.AbstractParser<Teacher>() { @Override public Teacher parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Teacher(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Teacher> parser() { return PARSER; } @Override public com.google.protobuf.Parser<Teacher> getParserForType() { return PARSER; } @Override public Teacher getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface PatriarchOrBuilder extends // @@protoc_insertion_point(interface_extends:com.gupao.protobuf.Patriarch) com.google.protobuf.MessageOrBuilder { /** * <code>optional string name = 1;</code> */ boolean hasName(); /** * <code>optional string name = 1;</code> */ String getName(); /** * <code>optional string name = 1;</code> */ com.google.protobuf.ByteString getNameBytes(); /** * <code>optional int32 id = 2;</code> */ boolean hasId(); /** * <code>optional int32 id = 2;</code> */ int getId(); } /** * Protobuf type {@code com.gupao.protobuf.Patriarch} */ public static final class Patriarch extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.gupao.protobuf.Patriarch) PatriarchOrBuilder { private static final long serialVersionUID = 0L; // Use Patriarch.newBuilder() to construct. private Patriarch(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Patriarch() { name_ = ""; } @Override @SuppressWarnings({"unused"}) protected Object newInstance( UnusedPrivateParameter unused) { return new Patriarch(); } @Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Patriarch( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; name_ = bs; break; } case 16: { bitField0_ |= 0x00000002; id_ = input.readInt32(); break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_Patriarch_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_Patriarch_fieldAccessorTable .ensureFieldAccessorsInitialized( Patriarch.class, Builder.class); } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile Object name_; /** * <code>optional string name = 1;</code> */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> */ public String getName() { Object ref = name_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * <code>optional string name = 1;</code> */ public com.google.protobuf.ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ID_FIELD_NUMBER = 2; private int id_; /** * <code>optional int32 id = 2;</code> */ public boolean hasId() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 id = 2;</code> */ public int getId() { return id_; } private byte memoizedIsInitialized = -1; @Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt32(2, id_); } unknownFields.writeTo(output); } @Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, id_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Patriarch)) { return super.equals(obj); } Patriarch other = (Patriarch) obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (!getName() .equals(other.getName())) return false; } if (hasId() != other.hasId()) return false; if (hasId()) { if (getId() != other.getId()) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasId()) { hash = (37 * hash) + ID_FIELD_NUMBER; hash = (53 * hash) + getId(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static Patriarch parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Patriarch parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Patriarch parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Patriarch parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Patriarch parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static Patriarch parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static Patriarch parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static Patriarch parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static Patriarch parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static Patriarch parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static Patriarch parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static Patriarch parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(Patriarch prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @Override protected Builder newBuilderForType( BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.gupao.protobuf.Patriarch} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.gupao.protobuf.Patriarch) PatriarchOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return DataInfo.internal_static_com_luban_protobuf_Patriarch_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { return DataInfo.internal_static_com_luban_protobuf_Patriarch_fieldAccessorTable .ensureFieldAccessorsInitialized( Patriarch.class, Builder.class); } // Construct using com.gupao.netty.sixdome.DataInfo.Patriarch.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @Override public Builder clear() { super.clear(); name_ = ""; bitField0_ = (bitField0_ & ~0x00000001); id_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return DataInfo.internal_static_com_luban_protobuf_Patriarch_descriptor; } @Override public Patriarch getDefaultInstanceForType() { return Patriarch.getDefaultInstance(); } @Override public Patriarch build() { Patriarch result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @Override public Patriarch buildPartial() { Patriarch result = new Patriarch(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) != 0)) { result.id_ = id_; to_bitField0_ |= 0x00000002; } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @Override public Builder clone() { return super.clone(); } @Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.setField(field, value); } @Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { return super.setRepeatedField(field, index, value); } @Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return super.addRepeatedField(field, value); } @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof Patriarch) { return mergeFrom((Patriarch)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(Patriarch other) { if (other == Patriarch.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasId()) { setId(other.getId()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @Override public final boolean isInitialized() { return true; } @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Patriarch parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (Patriarch) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private Object name_ = ""; /** * <code>optional string name = 1;</code> */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> */ public String getName() { Object ref = name_; if (!(ref instanceof String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return (String) ref; } } /** * <code>optional string name = 1;</code> */ public com.google.protobuf.ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string name = 1;</code> */ public Builder setName( String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } /** * <code>optional string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <code>optional string name = 1;</code> */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } private int id_ ; /** * <code>optional int32 id = 2;</code> */ public boolean hasId() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 id = 2;</code> */ public int getId() { return id_; } /** * <code>optional int32 id = 2;</code> */ public Builder setId(int value) { bitField0_ |= 0x00000002; id_ = value; onChanged(); return this; } /** * <code>optional int32 id = 2;</code> */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000002); id_ = 0; onChanged(); return this; } @Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.gupao.protobuf.Patriarch) } // @@protoc_insertion_point(class_scope:com.gupao.protobuf.Patriarch) private static final Patriarch DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new Patriarch(); } public static Patriarch getDefaultInstance() { return DEFAULT_INSTANCE; } @Deprecated public static final com.google.protobuf.Parser<Patriarch> PARSER = new com.google.protobuf.AbstractParser<Patriarch>() { @Override public Patriarch parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Patriarch(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Patriarch> parser() { return PARSER; } @Override public com.google.protobuf.Parser<Patriarch> getParserForType() { return PARSER; } @Override public Patriarch getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_luban_protobuf_MyObject_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_luban_protobuf_MyObject_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_luban_protobuf_Student_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_luban_protobuf_Student_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_luban_protobuf_Teacher_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_luban_protobuf_Teacher_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_luban_protobuf_Patriarch_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_luban_protobuf_Patriarch_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { String[] descriptorData = { "\n\rpersons.proto\022\022com.gupao.protobuf\"\245\002\n\010" + "MyObject\0228\n\tdata_type\030\001 \002(\0162%.com.gupao." + "protobuf.MyObject.DataType\022.\n\007student\030\002 " + "\001(\0132\033.com.gupao.protobuf.StudentH\000\022.\n\007te" + "acher\030\003 \001(\0132\033.com.gupao.protobuf.Teacher" + "H\000\0222\n\tpatriarch\030\004 \001(\0132\035.com.gupao.protob" + "uf.PatriarchH\000\"?\n\010DataType\022\017\n\013StudentTyp" + "e\020\000\022\017\n\013TeacherType\020\001\022\021\n\rPatriarchType\020\002B" + "\n\n\010DataBody\"5\n\007Student\022\014\n\004name\030\001 \001(\t\022\013\n\003" + "age\030\002 \001(\005\022\017\n\007address\030\003 \001(\t\"2\n\007Teacher\022\014\n" + "\004name\030\001 \001(\t\022\013\n\003age\030\002 \001(\005\022\014\n\004duty\030\003 \001(\t\"%" + "\n\tPatriarch\022\014\n\004name\030\001 \001(\t\022\n\n\002id\030\002 \001(\005B#\n" + "\027com.gupao.netty.sixdomeB\010DataInfo" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }); internal_static_com_luban_protobuf_MyObject_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_com_luban_protobuf_MyObject_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_luban_protobuf_MyObject_descriptor, new String[] { "DataType", "Student", "Teacher", "Patriarch", "DataBody", }); internal_static_com_luban_protobuf_Student_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_com_luban_protobuf_Student_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_luban_protobuf_Student_descriptor, new String[] { "Name", "Age", "Address", }); internal_static_com_luban_protobuf_Teacher_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_com_luban_protobuf_Teacher_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_luban_protobuf_Teacher_descriptor, new String[] { "Name", "Age", "Duty", }); internal_static_com_luban_protobuf_Patriarch_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_com_luban_protobuf_Patriarch_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_luban_protobuf_Patriarch_descriptor, new String[] { "Name", "Id", }); } // @@protoc_insertion_point(outer_class_scope) }
291756eba8f34d7e58ad48a11f6f96244bfe40f8
cba86fc39209a9bb273ed9a8f1620068909578c1
/刘美宁/java+appium+testng/EnjoyBall/src/base/BaseTest.java
1ae53d10eadf61ceca667cd4b4c9425552cfbc27
[]
no_license
fengrao1/practice
c2303b7ca71e38f0029a251d2b9842384a856eb8
701f5d910ec39d6f575f219bf7c8f53f94b98c82
refs/heads/master
2022-11-06T05:34:13.782766
2020-06-07T02:25:51
2020-06-07T02:25:51
258,391,682
1
0
null
null
null
null
UTF-8
Java
false
false
1,383
java
package base; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; public class BaseTest { URL url; public AndroidDriver<AndroidElement> driver; Dimension dim; @BeforeClass public void startUp() throws MalformedURLException, InterruptedException{ url = new URL("http://127.0.0.1:4723/wd/hub"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("deviceName", "8KE5T19B11004244"); capabilities.setCapability("appPackage", "com.example.lenovo.enjoyball"); capabilities.setCapability("appActivity", "com.example.lenovo.Activity.LoginActivity"); capabilities.setCapability("noReset",true); driver = new AndroidDriver<AndroidElement>( url,capabilities); driver.manage().timeouts(). implicitlyWait(30, TimeUnit.SECONDS); dim = driver.manage().window().getSize(); } @AfterClass public void teardown() { // TODO Auto-generated method stub driver.quit(); } }
364b9ab6f13a116b5d468559dd242cbfde71e63f
bb02b758c692a774d2378e362d88c9840ae2f71e
/Habitat.java
8ac907f7bd1c79cb7beb6399bd6decc2e24786f7
[ "MIT" ]
permissive
KonstantinFed12344/SpeciesDatabase
b7989ec173eced72d6a864f66f8a7bc3c8be15fd
9937db329a335ac545ba065a570f1b01f8866669
refs/heads/master
2020-04-13T14:27:08.987301
2018-12-27T07:49:30
2018-12-27T07:49:30
163,263,075
0
0
null
null
null
null
UTF-8
Java
false
false
1,867
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package assign3; /** * * @author Konstantin */ public class Habitat extends Database { private String provinceTerritory; private int utmZone; private double latitude; private double longitude; private double area; public Habitat(String provTerr, int utmZone, double latitude, double longitude, double area) { provinceTerritory = provTerr; this.utmZone = utmZone; this.latitude = latitude; this.longitude = longitude; this.area = area; } public double getArea() { return area; } public double getLatitude() { return latitude; } public double getLongitude() { return longitude; } public String getProvinceTerritory() { return provinceTerritory; } public int getUtmZone() { return utmZone; } public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (obj.getClass() != this.getClass()) { return false; } Habitat hab = (Habitat) obj; return this.provinceTerritory.equals(hab.provinceTerritory) && this.utmZone == hab.utmZone && this.latitude == hab.latitude && this.longitude == hab.longitude && this.area == hab.area; } public String toString() { return "Province Territory: " + provinceTerritory + ", UTMZone: " + utmZone + ", Latitude: " + latitude + ", Longitude: " + longitude + ", HabitatArea: " + area; } }
4371e59299341e18cdae1785203ee73649bda6c4
5a754786bc8605df01d18f9fb731f43e80bcb1ea
/app/src/main/java/com/autumn/framework/music/MainActivity.java
1b460b5618947a5c208f9269e9ac258ad6f3c409
[]
no_license
zhangzhaohong/QD-STANDARD-ANDROID
fec73dc044614e7e2fa3411e74bd958feaf91c3a
9b31c7332e233f5c199783c1fc4e15a424d4ba66
refs/heads/master
2022-03-31T05:30:04.337774
2020-01-31T03:45:15
2020-01-31T03:45:15
237,353,577
0
0
null
null
null
null
UTF-8
Java
false
false
12,945
java
package com.autumn.framework.music; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.SeekBar; import android.widget.TextView; import com.autumn.framework.music.log.MyLog; import com.autumn.reptile.MyApplication; import com.autumn.reptile.R; import com.liyi.sutils.utils.io.FileUtil; import com.ywl5320.bean.TimeBean; import com.ywl5320.libenum.MuteEnum; import com.ywl5320.libenum.SampleRateEnum; import com.ywl5320.libmusic.WlMusic; import com.ywl5320.listener.OnCompleteListener; import com.ywl5320.listener.OnErrorListener; import com.ywl5320.listener.OnInfoListener; import com.ywl5320.listener.OnLoadListener; import com.ywl5320.listener.OnPreparedListener; import com.ywl5320.listener.OnRecordListener; import com.ywl5320.listener.OnShowPcmDataListener; import com.ywl5320.listener.OnVolumeDBListener; import com.ywl5320.util.WlTimeUtil; public class MainActivity extends AppCompatActivity { private TextView tvTime; private TextView tvTime2; private TextView tvStyle; private TextView tvRecord; private TextView tvRecordStatus; private WlMusic wlMusic; private SeekBar seekBar; private SeekBar seekBar2; private CheckBox checkBox; private int position = 0; private String spStyle = "正常播放1.0x"; private String muStyle = "立体声"; private Bundle extras; private String key; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); extras = getIntent().getExtras(); key = extras.getString("key"); setContentView(R.layout.activity_music_settings); tvTime = findViewById(R.id.tv_time); tvTime2 = findViewById(R.id.tv_time2); seekBar = findViewById(R.id.seek_bar); seekBar2 = findViewById(R.id.seek_bar2); checkBox = findViewById(R.id.checkbox); tvStyle = findViewById(R.id.tv_style); tvRecord = findViewById(R.id.tv_record); tvRecordStatus = findViewById(R.id.tv_record_status); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { wlMusic.setPlayCircle(isChecked); } }); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { position = wlMusic.getDuration() * progress / 100; } @Override public void onStartTrackingTouch(SeekBar seekBar) { wlMusic.seek(position, false, false); } @Override public void onStopTrackingTouch(SeekBar seekBar) { wlMusic.seek(position, true, true); } }); seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { wlMusic.setVolume(seekBar.getProgress()); tvTime2.setText("音量:" + progress + "%"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); wlMusic = WlMusic.getInstance(); wlMusic.setCallBackPcmData(true);//是否返回音频PCM数据 wlMusic.setShowPCMDB(true);//是否返回音频分贝大小 wlMusic.setPlayCircle(true);//循环播放 wlMusic.setVolume(65);//声音大小65% wlMusic.setPlaySpeed(1.0f);//播放速度正常 wlMusic.setPlayPitch(1.0f);//播放音调正常 wlMusic.setConvertSampleRate(SampleRateEnum.RATE_44100);//设定恒定采样率(null为取消) tvTime2.setText("音量:" + wlMusic.getVolume() + "%"); seekBar2.setProgress(wlMusic.getVolume()); checkBox.setChecked(wlMusic.isPlayCircle()); setStyle(); wlMusic.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared() { MyLog.d("onparpared"); wlMusic.start(); } }); wlMusic.setOnErrorListener(new OnErrorListener() { @Override public void onError(int code, String msg) { MyLog.d("code :" + code + ", msg :" + msg); Log.d("ywl5320", "code :" + code + ", msg :" + msg); } }); wlMusic.setOnLoadListener(new OnLoadListener() { @Override public void onLoad(boolean load) { MyLog.d("load --> " + load); } }); wlMusic.setOnInfoListener(new OnInfoListener() { @Override public void onInfo(TimeBean timeBean) { MyLog.d("curr:" + timeBean.getCurrSecs() + ", total:" + timeBean.getTotalSecs()); Message message = Message.obtain(); message.obj = timeBean; message.what = 1; handler.sendMessage(message); } }); wlMusic.setOnCompleteListener(new OnCompleteListener() { @Override public void onComplete() { MyLog.d("complete"); } }); wlMusic.setOnVolumeDBListener(new OnVolumeDBListener() { @Override public void onVolumeDB(int db) { MyLog.d("db is : " + db); } }); wlMusic.setOnRecordListener(new OnRecordListener() { @Override public void onRecordTime(int scds) { Message message = Message.obtain(); message.obj = scds; message.what = 2; handler.sendMessage(message); MyLog.d("record time is:" + scds); } @Override public void onRecordComplete() { Message message = Message.obtain(); message.what = 3; handler.sendMessage(message); } @Override public void onRecordPauseResume(boolean pause) { Message message = Message.obtain(); message.obj = pause; message.what = 4; handler.sendMessage(message); } }); wlMusic.setOnShowPcmDataListener(new OnShowPcmDataListener() { @Override public void onPcmInfo(int samplerate, int bit, int channels) { MyLog.d(samplerate + "---" + bit + "---" + channels); } @Override public void onPcmData(byte[] pcmdata, int size, long clock) { MyLog.d("pcm size is : " + size + " time is : " + clock); } }); } @SuppressLint("HandlerLeak") Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: TimeBean timeBean = (TimeBean) msg.obj; seekBar.setProgress(timeBean.getCurrSecs() * 100 / timeBean.getTotalSecs()); tvTime.setText("时间:" + WlTimeUtil.secdsToDateFormat(timeBean.getCurrSecs(), timeBean.getTotalSecs()) + "/" + WlTimeUtil.secdsToDateFormat(timeBean.getTotalSecs(), timeBean.getTotalSecs())); break; case 2: int secd = (int) msg.obj; tvRecord.setText("录音时间:" + WlTimeUtil.secdsToDateFormat(secd, 0)); tvRecordStatus.setText("正在录音"); break; case 3: tvRecordStatus.setText("录音完成"); break; case 4: boolean pause = (boolean) msg.obj; if(pause) { tvRecordStatus.setText("正在暂停"); } break; default: break; } } }; @Override protected void onDestroy() { super.onDestroy(); wlMusic.stop(); } @Override public void onBackPressed(){ super.onBackPressed(); Intent intent = new Intent(this, com.autumn.reptile.MainActivity.class); startActivity(intent); } public void pause(View view) { wlMusic.pause(); } public void resume(View view) { wlMusic.resume(); } public void stop(View view) { wlMusic.stop(); } public void start(View view) { if (key == null) wlMusic.setSource("http://mpge.5nd.com/2015/2015-11-26/69708/1.mp3"); else if (key.equals("")) wlMusic.setSource("http://mpge.5nd.com/2015/2015-11-26/69708/1.mp3"); else wlMusic.setSource(key); // wlMusic.setSource(Environment.getExternalStorageDirectory().getAbsolutePath() + "/林俊杰 - 爱不会绝迹.wav"); // wlMusic.setSource("https://vips-static.pnlyy.com/Fn57-AhK0RjfjymvEoIErGKmmcPm"); wlMusic.prePared(); } public void change(View view) { // wlMusic.playNext("http://mpge.5nd.com/2015/2015-11-26/69708/1.mp3"); if (key == null) wlMusic.playNext("http://ngcdn004.cnr.cn/live/dszs/index.m3u8"); else if (key.equals("")) wlMusic.playNext("http://ngcdn004.cnr.cn/live/dszs/index.m3u8"); else wlMusic.playNext(key); //wlMusic.playNext("http://ngcdn004.cnr.cn/live/dszs/index.m3u8"); } public void fast(View view) { wlMusic.setPlaySpeed(1.5f); wlMusic.setPlayPitch(1.0f); spStyle = "变速不变调1.5x"; setStyle(); } public void slow(View view) { wlMusic.setPlaySpeed(0.5f); wlMusic.setPlayPitch(1.0f); spStyle = "变速不变调0.5x"; setStyle(); } public void normal(View view) { wlMusic.setPlaySpeed(1f); wlMusic.setPlayPitch(1.0f); spStyle = "变速不变调1.0x"; setStyle(); } public void left(View view) { wlMusic.setMute(MuteEnum.MUTE_LEFT); muStyle = "左声道"; setStyle(); } public void right(View view) { wlMusic.setMute(MuteEnum.MUTE_RIGHT); muStyle = "右声道"; setStyle(); } public void center(View view) { wlMusic.setMute(MuteEnum.MUTE_CENTER); muStyle = "立体声"; setStyle(); } public void fpitch(View view) { wlMusic.setPlayPitch(1.5f); wlMusic.setPlaySpeed(1.0f); spStyle = "变调不变速1.5x"; setStyle(); } public void spitch(View view) { wlMusic.setPlayPitch(0.5f); wlMusic.setPlaySpeed(1.0f); spStyle = "变调不变速0.5x"; setStyle(); } public void npitch(View view) { wlMusic.setPlayPitch(1f); wlMusic.setPlaySpeed(1.0f); spStyle = "变调不变速1.0x"; setStyle(); } public void sffast(View view) { wlMusic.setPlaySpeed(1.5f); wlMusic.setPlayPitch(1.5f); spStyle = "变调又变速1.5x"; setStyle(); } public void sfslow(View view) { wlMusic.setPlaySpeed(0.5f); wlMusic.setPlayPitch(0.5f); spStyle = "变调又变速0.5x"; setStyle(); } public void sfnormal(View view) { wlMusic.setPlayPitch(1); wlMusic.setPlaySpeed(1); spStyle = "变调又变速1.0x"; setStyle(); } private void setStyle() { tvStyle.setText(spStyle + " -- " + muStyle); } public void startrecord(View view) { FileUtil.getInstance().createDir(Environment.getExternalStorageDirectory().getPath() + MyApplication.getAppContext().getString(R.string.files_path) + "/shared/Other"); wlMusic.startRecordPlaying(Environment.getExternalStorageDirectory().getPath() + MyApplication.getAppContext().getString(R.string.files_path) + "/shared/Other", "myrecord");//生成的录音文件为:myrecord.aac } public void stoprecord(View view) { wlMusic.stopRecordPlaying(); } public void pauserecord(View view) { wlMusic.pauseRecordPlaying(); } public void resumerecord(View view) { wlMusic.resumeRecordPlaying(); } }
be50d725663d2419b5b458bebb336b599a1d2143
7364144e8fd7b0382a8dbc2a91dcefbee1b5ee10
/qiankun/pure-html/src/com/key/dwsurvey/service/AnEnumquManager.java
6fed07eaa5b105642c14077d1125387779b28f0c
[]
no_license
libyasdf/frame-learn
2b9ba596d12cb014b7ef9f9689f19142f90b2374
322fbd21cf4389d5f453de2568d1f9b11888ec10
refs/heads/master
2023-01-12T16:36:10.205017
2020-10-11T12:48:00
2020-10-11T12:48:00
299,892,834
0
0
null
2020-10-01T14:10:32
2020-09-30T11:08:35
HTML
UTF-8
Java
false
false
527
java
package com.key.dwsurvey.service; import java.util.List; import com.key.common.service.BaseService; import com.key.dwsurvey.entity.TQuestion; import com.key.dwsurvey.entity.AnEnumqu; /** * 枚举题 * @author keyuan([email protected]) * * https://github.com/wkeyuan/DWSurvey * http://dwsurvey.net */ public interface AnEnumquManager extends BaseService<AnEnumqu, String> { public List<AnEnumqu> findAnswer(String belongAnswerId,String quId); public void findGroupStats(TQuestion question); }
e7fd92da6589df23f8ad5e8c5e0ad0f91976ee6b
e9ce83b6d3fb126c7860921c618d4e8af890dd70
/src/PdfUtils/Column.java
3d93474984b084f50f8fe9d5e9bf43d4d68ea5c1
[]
no_license
Kristaps-B/DB_EXPLORER
dec9317637d2739677078d096ab6e60a412bdece
2845d9d1903443bea1855504c4f06b1e38edf6f3
refs/heads/master
2021-03-30T18:28:56.681399
2018-01-10T20:02:26
2018-01-10T20:02:26
89,864,130
0
0
null
null
null
null
UTF-8
Java
false
false
465
java
package PdfUtils; public class Column { private String name; private float width; public Column(String name, float width) { this.name = name; this.width = width; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getWidth() { return width; } public void setWidth(float width) { this.width = width; } }
bd44b51d2abd074b63b9b89c31c22617809c9cb0
69313f739b91a84f58e68a6447f3fbff226e8dfc
/Math/LexicographicalNumbers.java
53a2d7fa9c6537bb5a02eda5af7360376ebe96fa
[]
no_license
jessexu20/Leetcode
e9ff4d81b903642320eee9aa0bf714c8a738454d
7a1844ebd1a7d1555af8fcded07cd6a9e550ee39
refs/heads/master
2020-04-06T15:50:45.394462
2016-10-09T20:04:02
2016-10-09T20:04:02
24,825,431
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
import java.util.*; public class LexicographicalNumbers { public List<Integer> lexicalOrder(int n) { List<Integer> result = new ArrayList<>(); for(int i = 1; i <= Math.min(9,n); i++) helper(result, i, n); return result; } public void helper(List<Integer> result, int cur, int n){ if(cur > n) return; result.add(cur); for(int i = 0; i <= 9; i++){ helper(result, cur * 10 + i, n); } } public static void main(String [] args){ LexicographicalNumbers ln = new LexicographicalNumbers(); System.out.println(ln.lexicalOrder(100)); } }
a0da4007dd603808cccd2f5600e85f8a36ff5f5e
6233867bcb4027f0c9385cd2432ee5ecabf85691
/app/src/main/java/com/android/gajju45/retrofitrecyclerview/responsemodel.java
32fa78b0d35145205b73701b331d123606811dae
[]
no_license
Gajju45/Retrofit
291785e9accbd61e3306a3f16c92d545c821c930
d602fb618e7f52e10e567f6441b0968d8a784a18
refs/heads/master
2023-06-14T18:24:21.108994
2021-07-12T08:00:14
2021-07-12T08:00:14
385,169,442
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package com.android.gajju45.retrofitrecyclerview; public class responsemodel { String id,title, body; public responsemodel() { } public responsemodel(String id, String title, String body) { this.id = id; this.title = title; this.body = body; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } }
0528319e76e613a52b4832021caea231fcf33aca
107504b27b98f24cd2d5a66ac34e3c3ebc2f31e9
/src/main/java/com/hx/service/TimelineService.java
d0d37ba074aa1a5f2f407eb9d5674c565231a3fb
[]
no_license
lan1994/weibo
96952e003e1ac747fd7327a66e84f34da92d07ac
faf5a3d1e84e4f1fd84b3d6e323fc2bf4644e2d6
refs/heads/master
2021-01-19T10:17:45.669135
2017-05-08T14:57:35
2017-05-08T14:57:35
82,173,186
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.hx.service; import com.hx.model.Feed; import org.springframework.stereotype.Service; import java.util.List; @Service public class TimelineService { public List<Feed> pull(int userId, int maxId, int count) { return null; } }
edb006dec40463c205bb7e3202a6a6d7e01101c0
b68ce4064c8e3e3e1243eb7d3830dde7543d2d29
/src/Project/Main.java
1906594102a58afa564182cd16cc471a0c1f8cdc
[]
no_license
Hussain1993/Maths-Quiz
e7678b29ef0c044bccfab15ab609df1bf629d383
6cce4dca9e18ca3f041da3f68bf5fef974274e7d
refs/heads/master
2016-09-05T10:38:06.769826
2012-09-12T14:20:56
2012-09-12T14:20:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Project; /** * * @author kk */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { new RegisterUser().setVisible(true); } }
9a6bb9c30b2a20a4cd96637ee1e157b8b4c84bbc
610845697138962e747878365436c1fcf4a8af6e
/testLibrary/src/main/java/com/xyzh/testLibrary/utils/PreferenceImpl.java
72f83d7bea0a31fcc60b35adeb154837579d0fef
[]
no_license
notigit/Test
2819695c2ac1405d318be08f0914e837bfb527df
6a34611bebc8885e94b915f507b6fc3d2ac52b42
refs/heads/master
2020-04-04T08:51:06.501918
2018-12-28T01:27:06
2018-12-28T01:27:06
155,797,152
1
0
null
null
null
null
UTF-8
Java
false
false
6,801
java
package com.xyzh.testLibrary.utils; /** * Author:Jenny * Date:2017/7/20 * E-mail:[email protected] */ import android.content.Context; import android.content.SharedPreferences; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; /** * 操作SharedPreferences的工具类 * @author: DINGXIUAN */ public class PreferenceImpl implements IPreference { private static IPreference iPreference; /** * 对象锁 */ private static final Object lock = new Object(); /** * 获取IPreference对象 * @param context * @return */ public static IPreference getPreference(Context context) { synchronized (lock) { if (iPreference == null) { initPreference(context, FILE_NAME); } } return iPreference; } /** * 获取IPreference对象 * @param context * @param fileName * @return */ public static IPreference getPreference(Context context, String fileName) { synchronized (lock) { if (iPreference == null) { initPreference(context, fileName); } } return iPreference; } /** * 初始化IPreference对象 * @param context * @param fileName */ private static synchronized void initPreference(Context context, String fileName) { if (iPreference == null) { iPreference = new PreferenceImpl(context, fileName); } } /** * 默认的文件名 */ private static final String FILE_NAME = "shared_preferences"; private SharedPreferences preferences; /** * Instantiates a new Pref manager. * * @param context the context */ public PreferenceImpl(Context context) { preferences = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); } /** * Instantiates a new Pref manager. * * @param context the context * @param fileName the file name */ public PreferenceImpl(Context context, String fileName) { preferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE); } @Override public void put(String key, Object value) { SharedPreferences.Editor edit = preferences.edit(); put(edit, key, value); edit.apply(); } /** * 保存一个Map集合 * @param map */ @Override public <T> void putAll(Map<String, T> map) { SharedPreferences.Editor edit = preferences.edit(); for (Map.Entry<String, T> entry : map.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); put(edit, key, value); } edit.apply(); } @Override public void putAll(String key, List<String> list) { putAll(key, list, new ComparatorImpl()); } @Override public void putAll(String key, List<String> list, Comparator<String> comparator) { Set<String> set = new TreeSet<>(comparator); for (String value : list) { set.add(value); } preferences.edit().putStringSet(key, set).apply(); } /** * 根据key取出一个数据 * @param key 键 */ @SuppressWarnings("unchecked") @Override public <T> T get(String key, DataType type) { return (T) getValue(key, type); } @Override public Map<String, ?> getAll() { return preferences.getAll(); } @Override public List<String> getAll(String key) { List<String> list = new ArrayList<String>(); Set<String> set = get(key, DataType.STRING_SET); for (String value : set) { list.add(value); } return list; } @Override public void remove(String key) { preferences.edit().remove(key).apply(); } @Override public void removeAll(List<String> keys) { SharedPreferences.Editor edit = preferences.edit(); for (String k : keys) { edit.remove(k); } edit.apply(); } @Override public void removeAll(String[] keys) { removeAll(Arrays.asList(keys)); } @Override public boolean contains(String key) { return preferences.contains(key); } @Override public void clear() { preferences.edit().clear().apply(); } @Override public String getString(String key) { return get(key, DataType.STRING); } @Override public float getFloat(String key) { return get(key, DataType.FLOAT); } @Override public int getInteger(String key) { return 1; } @Override public long getLong(String key) { return get(key, DataType.LONG); } @Override public Set<String> getSet(String key) { return get(key, DataType.STRING_SET); } @Override public boolean getBoolean(String key) { return get(key, DataType.BOOLEAN); } /** * 保存数据 * @param editor * @param key * @param obj */ @SuppressWarnings("unchecked") private void put(SharedPreferences.Editor editor, String key, Object obj) { // key 不为null时再存入,否则不存储 if (key != null) { if (obj instanceof Integer) { editor.putInt(key, (Integer) obj); } else if (obj instanceof Long) { editor.putLong(key, (Long) obj); } else if (obj instanceof Boolean) { editor.putBoolean(key, (Boolean) obj); } else if (obj instanceof Float) { editor.putFloat(key, (Float) obj); } else if (obj instanceof Set) { editor.putStringSet(key, (Set<String>) obj); } else if (obj instanceof String) { editor.putString(key, String.valueOf(obj)); } } } /** * 根据key和类型取出数据 * @param key * @return */ private Object getValue(String key, DataType type) { switch (type) { case INTEGER: return preferences.getInt(key, -1); case FLOAT: return preferences.getFloat(key, -1f); case BOOLEAN: return preferences.getBoolean(key, false); case LONG: return preferences.getLong(key, -1L); case STRING: return preferences.getString(key, null); case STRING_SET: return preferences.getStringSet(key, null); default: // 默认取出String类型的数据 return null; } } }
2ccab1e810d2b6c692a98be4059f1d6c0fafdfbc
e7d6238d48a17f37902fdf4c8de2098f32e8b9b3
/src/main/java/org/lsqt/sys/controller/ApplicationController.java
0d0809340ac7f22bbbff5fbb83bb7fcb3f479a55
[]
no_license
sadk/example
f693d752253ea888253552a2f0e9639fed652fce
fa1f651b1f81c933a847ceb5c85a68f9809d216f
refs/heads/master
2020-04-28T14:54:15.486889
2019-03-13T05:37:01
2019-03-13T05:37:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,847
java
package org.lsqt.sys.controller; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import org.lsqt.components.context.annotation.Cache; import org.lsqt.components.context.annotation.Controller; import org.lsqt.components.context.annotation.Inject; import org.lsqt.components.context.annotation.mvc.RequestMapping; import org.lsqt.components.context.annotation.mvc.RequestMapping.View; import org.lsqt.components.db.Db; import org.lsqt.components.db.Page; import org.lsqt.components.util.lang.StringUtil; import org.lsqt.sys.model.Application; import org.lsqt.sys.model.ApplicationQuery; import org.lsqt.sys.service.ApplicationService; import org.lsqt.uum.util.PermissionSQLUtil; @Controller(mapping={"/application"}) public class ApplicationController { @Inject private ApplicationService applicationService; @Inject private Db db; @RequestMapping(mapping = { "/health"},text="用于springcloud健康状态检查") public Map<String,String> health() { Map<String,String> rs = new HashMap<>(); rs.put("status", "UP"); return rs; } @RequestMapping(mapping = { "/page", "/m/page" }, view = View.JSON) public Page<Application> queryForPage(ApplicationQuery query) throws IOException { // HttpServletResponse res = ContextUtil.getResponse(); // ContextUtil.mvc.getResponse(); // ContextUtil.db.getDb(); // ContextUtil.user.getUserId(); // res.sendRedirect("http://sohu.com"); return applicationService.queryForPage(query); } @RequestMapping(mapping = { "/page_auth", "/m/page_auth" }, text="权限使用") public Page<Application> queryForPage4Auth(ApplicationQuery query) throws Exception { //PermissionSQLUtil.bindPermissionSQL(query); return applicationService.queryForPage(query); } @RequestMapping(mapping = { "/all", "/m/all" },view = View.JSON) public Collection<Application> getAll() { return applicationService.getAll(); } @RequestMapping(mapping = { "/list", "/m/list" },view = View.JSON) public Collection<Application> queryForList(ApplicationQuery query) { return db.queryForList("queryForPage", Application.class, query); } @RequestMapping(mapping = { "/list_auth", "/m/list_auth" }) public Collection<Application> queryForList4Auth(ApplicationQuery query) throws Exception{ PermissionSQLUtil.bindPermissionSQL(query); return db.queryForList("queryForPage", Application.class, query); } public static class Node { public Long id; public Long pid; public String name; public String code; } @RequestMapping(mapping = { "/all_tree", "/m/all_tree" },view = View.JSON) public Collection<Node> getAllTree() { Collection<Application> list = applicationService.getAll(); Node root = new Node(); root.id = 0L; root.name = "应用系统"; root.pid = -1L; root.code ="-1"; Collection<Node> rs = new ArrayList<>(); rs.add(root); for(Application e: list) { Node child = new Node(); child.id = e.getId(); child.name = e.getName(); child.pid = 0L; child.code = e.getCode(); rs.add(child); } return rs; } @Cache(evict = true) @RequestMapping(mapping = { "/save_or_update", "/m/save_or_update" }, view = View.JSON) public Application saveOrUpdate(Application form) { if(StringUtil.isBlank(form.getCode())) { form.setCode("code:"+System.currentTimeMillis()); } return applicationService.saveOrUpdate(form); } @Cache(evict = true) @RequestMapping(mapping = { "/delete", "/m/delete" },view = View.JSON) public int delete(String ids) { List<Long> list = StringUtil.split(Long.class, ids, ","); return applicationService.deleteById(list.toArray(new Long[list.size()])); } }
aa0ce9faa73e3bc416d198c94fcbdaab9f7f97c4
d531fc55b08a0cd0f71ff9b831cfcc50d26d4e15
/gen/main/java/org/hl7/fhir/CarePlanActivityKindList.java
f2649545482acdd4c04ef20edf90712e4a800d51
[]
no_license
threadedblue/fhir.emf
f2abc3d0ccce6dcd5372874bf1664113d77d3fad
82231e9ce9ec559013b9dc242766b0f5b4efde13
refs/heads/master
2021-12-04T08:42:31.542708
2021-08-31T14:55:13
2021-08-31T14:55:13
104,352,691
0
0
null
null
null
null
UTF-8
Java
false
false
11,129
java
/** */ package org.hl7.fhir; import java.lang.String; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Care Plan Activity Kind List</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see org.hl7.fhir.FhirPackage#getCarePlanActivityKindList() * @model extendedMetaData="name='CarePlanActivityKind-list'" * @generated */ public enum CarePlanActivityKindList implements Enumerator { /** * The '<em><b>Appointment</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Appointment * Appointment * Appuntamento * RendezVous * Cita * 预约 * <!-- end-model-doc --> * @see #APPOINTMENT_VALUE * @generated * @ordered */ APPOINTMENT(0, "Appointment", "Appointment"), /** * The '<em><b>Communication Request</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * CommunicationRequest * CommunicationRequest * RichiestaDiComunicazione * DemandeDeCommunication * ComunicaciónRequerimiento * 通讯请求 * <!-- end-model-doc --> * @see #COMMUNICATION_REQUEST_VALUE * @generated * @ordered */ COMMUNICATION_REQUEST(1, "CommunicationRequest", "CommunicationRequest"), /** * The '<em><b>Device Request</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * DeviceRequest * DeviceRequest * RichiestaDispositivo * DemandeUtilisationDispositif * SolicitudDeDispositivo * 装置请求 * <!-- end-model-doc --> * @see #DEVICE_REQUEST_VALUE * @generated * @ordered */ DEVICE_REQUEST(2, "DeviceRequest", "DeviceRequest"), /** * The '<em><b>Medication Request</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * MedicationRequest * MedicationRequest * PrescriptionMédicamenteuseTODO * 药物请求 * PrescripciónMedicaciónTODO /PrescripcionMedicamento * <!-- end-model-doc --> * @see #MEDICATION_REQUEST_VALUE * @generated * @ordered */ MEDICATION_REQUEST(3, "MedicationRequest", "MedicationRequest"), /** * The '<em><b>Nutrition Order</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * NutritionOrder * NutritionOrder * OrdreNutrition * OrdenNutrición * 营养医嘱 * <!-- end-model-doc --> * @see #NUTRITION_ORDER_VALUE * @generated * @ordered */ NUTRITION_ORDER(4, "NutritionOrder", "NutritionOrder"), /** * The '<em><b>Task</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Task * Task * Tarea * 任务 * <!-- end-model-doc --> * @see #TASK_VALUE * @generated * @ordered */ TASK(5, "Task", "Task"), /** * The '<em><b>Service Request</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * ServiceRequest * ServiceRequest * RichiestaDiServizio * DemandeService * PeticiónServicio * 服务项目请求 * <!-- end-model-doc --> * @see #SERVICE_REQUEST_VALUE * @generated * @ordered */ SERVICE_REQUEST(6, "ServiceRequest", "ServiceRequest"), /** * The '<em><b>Vision Prescription</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * VisionPrescription * VisionPrescription * PrescriptionVision * PrescripcionDeVision * 视力处方 * <!-- end-model-doc --> * @see #VISION_PRESCRIPTION_VALUE * @generated * @ordered */ VISION_PRESCRIPTION(7, "VisionPrescription", "VisionPrescription"); /** * The '<em><b>Appointment</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Appointment * Appointment * Appuntamento * RendezVous * Cita * 预约 * <!-- end-model-doc --> * @see #APPOINTMENT * @model name="Appointment" * @generated * @ordered */ public static final int APPOINTMENT_VALUE = 0; /** * The '<em><b>Communication Request</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * CommunicationRequest * CommunicationRequest * RichiestaDiComunicazione * DemandeDeCommunication * ComunicaciónRequerimiento * 通讯请求 * <!-- end-model-doc --> * @see #COMMUNICATION_REQUEST * @model name="CommunicationRequest" * @generated * @ordered */ public static final int COMMUNICATION_REQUEST_VALUE = 1; /** * The '<em><b>Device Request</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * DeviceRequest * DeviceRequest * RichiestaDispositivo * DemandeUtilisationDispositif * SolicitudDeDispositivo * 装置请求 * <!-- end-model-doc --> * @see #DEVICE_REQUEST * @model name="DeviceRequest" * @generated * @ordered */ public static final int DEVICE_REQUEST_VALUE = 2; /** * The '<em><b>Medication Request</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * MedicationRequest * MedicationRequest * PrescriptionMédicamenteuseTODO * 药物请求 * PrescripciónMedicaciónTODO /PrescripcionMedicamento * <!-- end-model-doc --> * @see #MEDICATION_REQUEST * @model name="MedicationRequest" * @generated * @ordered */ public static final int MEDICATION_REQUEST_VALUE = 3; /** * The '<em><b>Nutrition Order</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * NutritionOrder * NutritionOrder * OrdreNutrition * OrdenNutrición * 营养医嘱 * <!-- end-model-doc --> * @see #NUTRITION_ORDER * @model name="NutritionOrder" * @generated * @ordered */ public static final int NUTRITION_ORDER_VALUE = 4; /** * The '<em><b>Task</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Task * Task * Tarea * 任务 * <!-- end-model-doc --> * @see #TASK * @model name="Task" * @generated * @ordered */ public static final int TASK_VALUE = 5; /** * The '<em><b>Service Request</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * ServiceRequest * ServiceRequest * RichiestaDiServizio * DemandeService * PeticiónServicio * 服务项目请求 * <!-- end-model-doc --> * @see #SERVICE_REQUEST * @model name="ServiceRequest" * @generated * @ordered */ public static final int SERVICE_REQUEST_VALUE = 6; /** * The '<em><b>Vision Prescription</b></em>' literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * VisionPrescription * VisionPrescription * PrescriptionVision * PrescripcionDeVision * 视力处方 * <!-- end-model-doc --> * @see #VISION_PRESCRIPTION * @model name="VisionPrescription" * @generated * @ordered */ public static final int VISION_PRESCRIPTION_VALUE = 7; /** * An array of all the '<em><b>Care Plan Activity Kind List</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CarePlanActivityKindList[] VALUES_ARRAY = new CarePlanActivityKindList[] { APPOINTMENT, COMMUNICATION_REQUEST, DEVICE_REQUEST, MEDICATION_REQUEST, NUTRITION_ORDER, TASK, SERVICE_REQUEST, VISION_PRESCRIPTION, }; /** * A public read-only list of all the '<em><b>Care Plan Activity Kind List</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CarePlanActivityKindList> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Care Plan Activity Kind List</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param literal the literal. * @return the matching enumerator or <code>null</code>. * @generated */ public static CarePlanActivityKindList get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CarePlanActivityKindList result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Care Plan Activity Kind List</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param name the name. * @return the matching enumerator or <code>null</code>. * @generated */ public static CarePlanActivityKindList getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CarePlanActivityKindList result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Care Plan Activity Kind List</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the integer value. * @return the matching enumerator or <code>null</code>. * @generated */ public static CarePlanActivityKindList get(int value) { switch (value) { case APPOINTMENT_VALUE: return APPOINTMENT; case COMMUNICATION_REQUEST_VALUE: return COMMUNICATION_REQUEST; case DEVICE_REQUEST_VALUE: return DEVICE_REQUEST; case MEDICATION_REQUEST_VALUE: return MEDICATION_REQUEST; case NUTRITION_ORDER_VALUE: return NUTRITION_ORDER; case TASK_VALUE: return TASK; case SERVICE_REQUEST_VALUE: return SERVICE_REQUEST; case VISION_PRESCRIPTION_VALUE: return VISION_PRESCRIPTION; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CarePlanActivityKindList(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CarePlanActivityKindList
30ba4c782d11cfba5c2eb440d4f801b8bfdd9877
82cad419c7665658dad86ca966def1730c027d41
/Module 2 -DS/operation.java
67dc545fb3fb612a900467648d812ba3b0337dbd
[]
no_license
pritigarud93/edac-MAY-2021
27d43075533eeb02594c253be7c2e692eaf35caa
18d188451fa31fe516adcdf678dabd339c27f80e
refs/heads/main
2023-05-13T19:00:30.983601
2021-06-11T16:02:49
2021-06-11T16:02:49
365,246,762
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
import java.util.*; class operation{ public static void main(String args[]) { Scanner sc=new Scanner(System.in); System.out.println("Enter the size of Array :"); int n=sc.nextInt(); int a[]=new int[n]; int i; System.out.println("Enter the Elements in array:"); for(i=0;i<n;i++) { a[i]=sc.nextInt(); } //display for(int s:a) { System.out.print(s+" "); } //search System.out.println("Search Element :"); int element=sc.nextInt(); int flag=0; for(i=0;i<n;i++) { if(a[i]==element) { System.out.println("Element FOUND AT INDEX : "+i); flag=1; break; } } if(flag==0) { System.out.println("Element NOT FOUND"); } //delete Element System.out.println("Element TO delete :"); element=sc.nextInt(); for(i=0;i<n;i++) { if(a[i]==element) { a[i]=a[i++]; } } for(int s:a) { System.out.print(s+" "); } } }
fbb8a3dba25e8fce37dc801d10250ab2c6b04e0e
365e2d91297829979bd59965c90d967ed0e2f68a
/src/com/ratodigital/simplesms/GcmBroadcastReceiver.java
28e2260203834230a8657f0c3f175653a628cd6a
[]
no_license
ratodigital/simplesms-app
d5148a8c49909e3ded9d5ab67b3635f48d744f11
71684aaeb95af086b50d40502375ce42d7331f8e
refs/heads/master
2020-04-06T04:35:25.585680
2013-10-30T11:50:01
2013-10-30T11:50:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,358
java
/* * Copyright 2013 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.ratodigital.simplesms; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; public class GcmBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Start the service, keeping the device awake while it is launching. startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); } }
59b5d3e8fbdd5104f8daf2b89ee20b544a6c238f
1401443c2818cbc585ad207b2fd416826e4971bf
/src/MoseShipsBukkit/Listeners/ShipsCommands/Developer.java
3632390434ea7e8a05d03ef23c32a52e0fd1eb7f
[]
no_license
adventurousrockminecraft/Ships-5-Bukkit-Version
f2ef0a9ba356d7b01c6aa642a2d9d549cb01f54d
4a43529526d4f85d69de4cc907a960caacfe02f9
refs/heads/master
2021-01-18T05:03:25.847023
2015-05-20T15:46:14
2015-05-20T15:46:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,487
java
package MoseShipsBukkit.Listeners.ShipsCommands; import org.bukkit.ChatColor; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; import MoseShipsBukkit.Listeners.CommandLauncher; import MoseShipsBukkit.ShipTypes.VesselType; import MoseShipsBukkit.StillShip.Vessel; import MoseShipsBukkit.Utils.MaterialItem; import MoseShipsBukkit.Utils.ConfigLinks.MaterialsList; public class Developer extends CommandLauncher{ public Developer() { super("Developer", "", "All root commands", null, false, true); } @Override public void playerCommand(Player player, String[] args) { } @Override public void consoleCommand(ConsoleCommandSender sender, String[] args) { if (args.length == 1){ sender.sendMessage(ChatColor.GOLD + "/ships developer loadedVessels"); sender.sendMessage(ChatColor.GOLD + "/ships developer Vesseltypes"); sender.sendMessage(ChatColor.GOLD + "/ships developer materialsList"); sender.sendMessage(ChatColor.GOLD + "/ships developer ramMaterials"); sender.sendMessage(ChatColor.GOLD + "/ships developer all"); }else{ if (args[1].equalsIgnoreCase("loadedVessels")){ displayLoadedVessels(sender); } if (args[1].equalsIgnoreCase("Vesseltypes")){ displayVesselTypes(sender); } if (args[1].equalsIgnoreCase("materialsList")){ displayMaterialsList(sender); } if (args[1].equalsIgnoreCase("ramMaterials")){ displayRAMMaterialsList(sender); } if (args[1].equalsIgnoreCase("all")){ sender.sendMessage("-----[LoadedVessels]-----"); displayLoadedVessels(sender); sender.sendMessage("-----[Types]-----"); displayVesselTypes(sender); sender.sendMessage("-----[Materials]-----"); displayMaterialsList(sender); sender.sendMessage("-----[RAM]-----"); displayRAMMaterialsList(sender); } } } public void displayMaterialsList(ConsoleCommandSender sender){ sender.sendMessage("<Name> | <Value>"); MaterialsList list = MaterialsList.getMaterialsList(); for(MaterialItem item : list.getMaterials()){ sender.sendMessage(item.getMaterial().name() + " | " + item.getData()); } sender.sendMessage("Total number of Materials in Materials List: " + list.getMaterials().size()); } public void displayRAMMaterialsList(ConsoleCommandSender sender){ sender.sendMessage("<Name> | <Value>"); MaterialsList list = MaterialsList.getMaterialsList(); for(MaterialItem item : list.getRamMaterials()){ sender.sendMessage(item.getMaterial() + " | " + item.getData()); } sender.sendMessage("Total number of Materials in RAM Materials List: " + list.getMaterials().size()); } public void displayLoadedVessels(ConsoleCommandSender sender){ sender.sendMessage("<Name> | <Type> | <Owner> | <Location>"); for(Vessel vessel : Vessel.getVessels()){ sender.sendMessage(vessel.getName() + " | " + vessel.getVesselType().getName() + " | " + vessel.getOwner().getName() + " | " + (int)vessel.getTeleportLocation().getX() + "," + (int)vessel.getTeleportLocation().getY() + "," + (int)vessel.getTeleportLocation().getZ() + "," + vessel.getTeleportLocation().getWorld().getName()); } sender.sendMessage("Total number of Vessels loaded: " + Vessel.getVessels().size()); return; } public void displayVesselTypes(ConsoleCommandSender sender){ sender.sendMessage("<Type> | <Normal speed>"); for(VesselType vessel : VesselType.values()){ sender.sendMessage(vessel.getName() + " | " + vessel.getDefaultSpeed()); } return; } }
dcbcda7b82ca954f36fb90bd115eabc7a450b71e
acd0ba2dd66a7dd37f20c9545cd8406bc4330cd1
/flash-pay-payment-agent/flash-pay-payment-agent-api/src/main/java/com/flash/paymentagent/api/conf/WXConfigParam.java
4a6117ce5605685d982cd75253a889fa283677fa
[ "Apache-2.0" ]
permissive
iseeyo/flash-pay
a1fc195126f177063faca5a42c192c79aecaa20d
d15ddd70d75ed2998af99baba2650a96487a78f7
refs/heads/master
2023-07-13T17:16:25.667520
2021-09-02T12:31:51
2021-09-02T12:31:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
package com.flash.paymentagent.api.conf; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; /** * @author yuelimin */ @Data @NoArgsConstructor public class WXConfigParam implements Serializable { private static final long serialVersionUID = -5806509163128668855L; private String appId; //是APPID对应的接口密码, 用于获取接口调用凭证access_token时使用. private String appSecret; private String mchId; private String key; public String returnUrl; }
54c48d8bf2ea01a564b0c45cb019752c206d5ce0
97987fd9036663e98a04ac5c8c021caef0c608f3
/src/main/java/top/microfrank/ihat_location/util/MqttUtil.java
5a95f3beb4ab21762016c2b37780f187104a1a3f
[]
no_license
2php/ihat_location
03eeaafe6ad0334b27e76494b9c8f171e2f9969a
3106ea461b07b6441a1b5e534c1710e518c22aa2
refs/heads/master
2021-05-21T23:56:15.878721
2018-02-27T06:36:26
2018-02-27T06:36:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,038
java
package top.microfrank.ihat_location.util; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import top.microfrank.ihat_location.model.Config; import java.util.Random; @Configuration public class MqttUtil { @Autowired Config config; @Bean public MqttClient getClient() { int qos = 2;//最多一次(0)最少一次(1)只一次(2) String clientId = "local"; MemoryPersistence persistence = new MemoryPersistence(); try { MqttClient sampleClient = new MqttClient(config.getMqttbroker(), clientId, persistence); MqttConnectOptions connOpts = new MqttConnectOptions(); connOpts.setCleanSession(true); connOpts.setAutomaticReconnect(true); // connOpts.setUserName("java"); // connOpts.setPassword("123456".toCharArray()); System.out.println("-------------------------------"); System.out.println("Mqtt尝试连接..."); sampleClient.connect(connOpts); //连接成功 System.out.println("Mqtt连接成功,即将启动Tcp服务"); System.out.println("-------------------------------"); return sampleClient; } catch (MqttException me) { System.out.println("reason " + me.getReasonCode()); System.out.println("msg " + me.getMessage()); System.out.println("loc " + me.getLocalizedMessage()); System.out.println("cause " + me.getCause()); System.out.println("excep " + me); me.printStackTrace(); return null; } } }
4190d75c653e0a14b6f3c1f473ae49486a6d2ee1
50847664e2790c6594b1f6f327cd00936a136fbb
/discovery-plugin-framework/discovery-plugin-framework-starter/src/main/java/com/nepxion/discovery/plugin/framework/adapter/PluginConfigAdapter.java
b69549bb0d07735749d65f930c34012fff32404e
[ "Apache-2.0" ]
permissive
jiangAngel/Discovery
20313531cee18da6b67ed1ef714bec3fdce4038b
c51caaec4b44113226d074d983fd28745ff9d5a5
refs/heads/6.x.x
2023-07-11T02:41:49.569301
2021-08-15T00:47:05
2021-08-15T00:47:05
397,196,776
1
0
Apache-2.0
2021-08-17T09:47:02
2021-08-17T09:47:01
null
UTF-8
Java
false
false
380
java
package com.nepxion.discovery.plugin.framework.adapter; /** * <p>Title: Nepxion Discovery</p> * <p>Description: Nepxion Discovery</p> * <p>Copyright: Copyright (c) 2017-2050</p> * <p>Company: Nepxion</p> * @author Haojun Ren * @version 1.0 */ import com.nepxion.discovery.common.entity.ConfigType; public interface PluginConfigAdapter { ConfigType getConfigType(); }
a85da66539561b9f10fb9b866a9fc172a4a8c501
abaa5516c3b766f96fd93f57000a6066b7ccafb7
/src/test/java/ar/edu/unq/desapp/grupoB022015/modelo/TestEquipo.java
e85a70c9f7e5cc9640566afa2c43512ba08390ea
[]
no_license
Salormen/desapp-GrupoF022015-SuperGol-Backend
9d4b91bafc1cf892420d8b5fe854dda1780244c9
11f046033fd3b23b27563e8aed88b295473e4fe8
refs/heads/master
2020-04-01T16:34:02.455603
2015-08-25T20:01:16
2015-08-25T20:01:16
41,384,838
0
0
null
null
null
null
UTF-8
Java
false
false
3,185
java
package ar.edu.unq.desapp.grupoB022015.modelo; import org.junit.Test; import ar.edu.unq.desapp.grupoB022015.modelo.builders.EquipoBuilder; import ar.edu.unq.desapp.grupoB022015.modelo.builders.JugadorBuilder; import ar.edu.unq.desapp.grupoB022015.modelo.exceptions.NoPuedeHaberMasDeCuatroMediocampistasException; import ar.edu.unq.desapp.grupoB022015.modelo.exceptions.NoPuedeHaberMasDeTresDefensoresException; import ar.edu.unq.desapp.grupoB022015.modelo.exceptions.NoPuedeHaberMasDeTresDelanterosException; import ar.edu.unq.desapp.grupoB022015.modelo.exceptions.NoPuedeHaberMasDeUnArqueroException; import ar.edu.unq.desapp.grupoB022015.modelo.exceptions.NoSePuedeHaberMasDeOnceJugadoresException; import ar.edu.unq.desapp.grupoB022015.modelo.posiciones.Arquero; import junit.framework.TestCase; public class TestEquipo extends TestCase{ @Test public void test_todosLosJugadores_retornaATodosLosJugadoresDelEquipo(){ Equipo equipo = EquipoBuilder.algunEquipo().conPlantelCompleto().build(); assertEquals(equipo.todosLosJugadores().size(), 11); } @Test public void test_intentarAgregarMasDe11Jugadores_throwNoSePuedeHaberMasDeOnceJugadoresException(){ Equipo equipo = EquipoBuilder.algunEquipo().conPlantelCompleto().build(); try{ equipo.agregarJugador(JugadorBuilder.algunJugador().build()); // en esta operacion tira la excepcion fail(); }catch(NoSePuedeHaberMasDeOnceJugadoresException e){ assertTrue(true); } } @Test public void test_intentarAgregarMasDeUnArquero_throwsNoPuedeHaberMasDeUnArqueroException(){ Equipo equipo = EquipoBuilder.algunEquipo().conXArqueros(1).build(); try { equipo.agregarJugador(JugadorBuilder.algunArquero().build()); fail(); } catch (NoSePuedeHaberMasDeOnceJugadoresException e) { fail(); } catch (NoPuedeHaberMasDeUnArqueroException e) { assertTrue(true); } } @Test public void test_intentarAgregarMasDeTresDefensores_throwsNoPuedeHaberMasDeTresDefensoresException(){ Equipo equipo = EquipoBuilder.algunEquipo().conXDefensores(3).build(); try { equipo.agregarJugador(JugadorBuilder.algunDefensor().build()); fail(); } catch (NoSePuedeHaberMasDeOnceJugadoresException e) { fail(); } catch (NoPuedeHaberMasDeTresDefensoresException e) { assertTrue(true); } } @Test public void test_intentarAgregarMasDeCuatroMediocampistas_throwsNoPuedeHaberMasDeCuatroMediocampistasException(){ Equipo equipo = EquipoBuilder.algunEquipo().conXMediocampistas(4).build(); try { equipo.agregarJugador(JugadorBuilder.algunMediocampista().build()); fail(); } catch (NoSePuedeHaberMasDeOnceJugadoresException e) { fail(); } catch (NoPuedeHaberMasDeCuatroMediocampistasException e) { assertTrue(true); } } @Test public void test_intentarAgregarMasDeTresDelanteros_throwsNoPuedeHaberMasDeTresDelanterosException(){ Equipo equipo = EquipoBuilder.algunEquipo().conXDelanteros(3).build(); try { equipo.agregarJugador(JugadorBuilder.algunDelantero().build()); fail(); } catch (NoSePuedeHaberMasDeOnceJugadoresException e) { fail(); } catch (NoPuedeHaberMasDeTresDelanterosException e) { assertTrue(true); } } }
af28deb70ae8eb596df938f5461c3a8e063ae8dc
b9387140a2cd081ba1c4d56a991153d580572384
/src/platform/game/actor/Overlay.java
18e74666dff774406a0688a61f5b18d048daaa0f
[]
no_license
loriswit/platformgame
6a56fb58ba2dc3f2f361de14365cc706297ba1ae
63696fa18970f3b631fd796d78a188c8ec518f30
refs/heads/master
2021-03-27T09:47:49.291456
2016-12-21T22:26:53
2016-12-21T22:26:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,283
java
package platform.game.actor;// Created by Loris Witschard on 24.11.16. import platform.util.Box; import platform.util.Input; import platform.util.Output; import platform.util.Vector; /** * Group of hearts that floats over a player, displaying his health. */ public class Overlay extends Actor { private Player player; private final double SIZE = 0.25; private double countdown = 0; private final double countdownMax = 0.3; private double currentHealth = 0; /** * @param player the associated player */ public Overlay(Player player) { if(player == null) throw new NullPointerException(); this.player = player; currentHealth = player.getHealthMax() * 5; priority = 900; } @Override public void update(Input input) { super.update(input); countdown -= input.getDeltaTime(); if(player.getWorld() == null) player.getWorld().unregister(this); } @Override public void draw(Input input, Output output) { double health = (double) Math.round(10.0 * player.getHealth() / player.getHealthMax()) / 2; if(currentHealth != health) countdown = countdownMax; currentHealth = health; for(int i = 1; i <= 5; ++i) { String name; if(health >= i) name = "heart.full"; else if(health >= i - 0.5) name = "heart.half"; else name = "heart.empty"; double size = SIZE; if(countdown > 0) size += countdown / 3; Vector position = player.getPosition().add( new Vector(size * (i - 3), player.getBox().getHeight() / 2 + 0.25)); double angle = 0; if(health <= 1) { position = position.add(new Vector(0, Math.sin(input.getTime() * 20) / 24 * Math.pow(-1, i))); angle = Math.sin(input.getTime() * 40) / 10 * Math.pow(-1, i); } output.drawSprite(getSprite(name), new Box(position, size, size), angle); } } }
465bc253fd8403f3a8e5d11f06a31e4696f02a3e
4204769a01a2787e52793549b0a9cfd009926cb1
/project/src/main/java/com/example/project/repository/OrdersRepository.java
ef04c0a7550a7f392a7ad73fb9b0b58c71bfe18e
[ "MIT" ]
permissive
rafael-novais/spring-filesystem
8561276be0d244eee899b0aea5a9353cf8d444b4
e1085474d325889f79e288a642eeac2ca35c0ac1
refs/heads/master
2020-12-23T15:58:13.320751
2020-01-30T19:08:34
2020-01-30T19:08:34
237,196,758
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.example.project.repository; import com.example.project.domain.entities.Orders; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface OrdersRepository extends JpaRepository<Orders, Integer> { }
521027044d9d2b63e5c538731e60b978246dcd8b
ed5926ae512e238af0f14655a3187d7e7fbf7ef7
/chromium/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherAndStartSurfaceLayoutTest.java
74e52bb5269a5234cf3287f02693be342194cb4e
[ "BSD-3-Clause" ]
permissive
slimsag/mega
82595cd443d466f39836e24e28fc86d3f2f1aefd
37ef02d1818ae263956b7c8bc702b85cdbc83d20
refs/heads/master
2023-08-16T22:36:25.860917
2023-08-15T23:40:31
2023-08-15T23:40:31
41,717,977
5
1
null
null
null
null
UTF-8
Java
false
false
109,874
java
// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.tasks.tab_management; import static android.os.Build.VERSION_CODES.O_MR1; import static android.os.Build.VERSION_CODES.Q; import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.longClick; import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; import static androidx.test.espresso.assertion.ViewAssertions.matches; import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition; import static androidx.test.espresso.matcher.ViewMatchers.Visibility.VISIBLE; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withParent; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.not; import static org.hamcrest.core.AllOf.allOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.areAnimatorsEnabled; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.closeFirstTabInTabSwitcher; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.createTabGroup; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.createTabs; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.enterTabSwitcher; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.finishActivity; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.getSwipeToDismissAction; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.leaveTabSwitcher; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.mergeAllNormalTabsToAGroup; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.switchTabModel; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.verifyTabModelTabCount; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.verifyTabSwitcherCardCount; import static org.chromium.components.embedder_support.util.UrlConstants.NTP_URL; import static org.chromium.ui.test.util.ViewUtils.onViewWaiting; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.os.Build; import android.os.Build.VERSION_CODES; import android.view.View; import androidx.annotation.Nullable; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.test.core.app.ApplicationProvider; import androidx.test.espresso.Espresso; import androidx.test.espresso.NoMatchingViewException; import androidx.test.espresso.ViewAssertion; import androidx.test.espresso.contrib.RecyclerViewActions; import androidx.test.filters.LargeTest; import androidx.test.filters.MediumTest; import androidx.test.platform.app.InstrumentationRegistry; import org.hamcrest.Matcher; import org.hamcrest.Matchers; import org.junit.After; import org.junit.Assume; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.Callback; import org.chromium.base.GarbageCollectionTestUtils; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.params.ParameterAnnotations.UseMethodParameter; import org.chromium.base.test.params.ParameterAnnotations.UseMethodParameterBefore; import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.ApplicationTestUtils; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.HistogramWatcher; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.compositor.layouts.Layout; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.layouts.LayoutTestUtils; import org.chromium.chrome.browser.layouts.LayoutType; import org.chromium.chrome.browser.night_mode.ChromeNightModeTestUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabUtils; import org.chromium.chrome.browser.tab.state.CriticalPersistedTabData; import org.chromium.chrome.browser.tabmodel.TabCreator; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupTitleUtils; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.undo_tab_close_snackbar.UndoBarController; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.features.start_surface.StartSurfaceTestUtils.LegacyTestParams; import org.chromium.chrome.features.start_surface.StartSurfaceTestUtils.RefactorTestParams; import org.chromium.chrome.features.start_surface.TabSwitcherAndStartSurfaceLayout; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.R; import org.chromium.chrome.test.util.ActivityTestUtils; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.MenuUtils; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.WebContentsUtils; import org.chromium.net.test.EmbeddedTestServer; import org.chromium.ui.base.PageTransition; import org.chromium.ui.test.util.DisableAnimationsTestRule; import org.chromium.ui.test.util.UiRestriction; import org.chromium.ui.test.util.ViewUtils; import org.chromium.ui.util.ColorUtils; import org.chromium.ui.widget.ViewLookupCachingFrameLayout; import java.io.FileOutputStream; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; // clang-format off /** Tests for the {@link TabSwitcherAndStartSurfaceLayout} */ @SuppressWarnings("ConstantConditions") @RunWith(ParameterizedRunner.class) @UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "force-fieldtrials=Study/Group"}) @EnableFeatures({ChromeFeatureList.EMPTY_STATES}) @Restriction( {UiRestriction.RESTRICTION_TYPE_PHONE, Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE}) public class TabSwitcherAndStartSurfaceLayoutTest { // clang-format on private static final String BASE_PARAMS = "force-fieldtrial-params=" + "Study.Group:skip-slow-zooming/false/zooming-min-memory-mb/512"; private static final String TEST_URL = "/chrome/test/data/android/google.html"; // Tests need animation on. @ClassRule public static DisableAnimationsTestRule sEnableAnimationsRule = new DisableAnimationsTestRule(true); @Rule public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ChromeRenderTestRule mRenderTestRule = ChromeRenderTestRule.Builder.withPublicCorpus() .setRevision(2) .setBugComponent(ChromeRenderTestRule.Component.UI_BROWSER_MOBILE_START) .build(); @SuppressWarnings("FieldCanBeLocal") private EmbeddedTestServer mTestServer; @Nullable private TabSwitcherAndStartSurfaceLayout mTabSwitcherAndStartSurfaceLayout; @Nullable private TabSwitcherLayout mTabSwitcherLayout; private String mUrl; private int mRepeat; private List<WeakReference<Bitmap>> mAllBitmaps = new LinkedList<>(); private Callback<Bitmap> mBitmapListener = (bitmap) -> mAllBitmaps.add(new WeakReference<>(bitmap)); private TabSwitcher.TabListDelegate mTabListDelegate; private boolean mIsStartSurfaceRefactorEnabled; @UseMethodParameterBefore(RefactorTestParams.class) public void setupRefactorTest(boolean isStartSurfaceRefactorEnabled) { mIsStartSurfaceRefactorEnabled = isStartSurfaceRefactorEnabled; } @UseMethodParameterBefore(LegacyTestParams.class) public void setupLegacyTest(boolean isStartSurfaceRefactorEnabled) { mIsStartSurfaceRefactorEnabled = isStartSurfaceRefactorEnabled; } @Before public void setUp() throws ExecutionException { mTestServer = mActivityTestRule.getTestServer(); ChromeFeatureList.sStartSurfaceRefactor.setForTesting(mIsStartSurfaceRefactorEnabled); // After setUp, Chrome is launched and has one NTP. mActivityTestRule.startMainActivityWithURL(NTP_URL); ChromeTabbedActivity cta = mActivityTestRule.getActivity(); Layout layout = TabUiTestHelper.getTabSwitcherLayoutAndVerify( mIsStartSurfaceRefactorEnabled, cta.getLayoutManager()); if (mIsStartSurfaceRefactorEnabled) { mTabSwitcherLayout = (TabSwitcherLayout) layout; } else { mTabSwitcherAndStartSurfaceLayout = (TabSwitcherAndStartSurfaceLayout) layout; } mUrl = mTestServer.getURL("/chrome/test/data/android/navigate/simple.html"); mRepeat = 1; mTabListDelegate = getTabListDelegateFromUIThread(); mTabListDelegate.setBitmapCallbackForTesting(mBitmapListener); assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting()); mActivityTestRule.getActivity().getTabContentManager().setCaptureMinRequestTimeForTesting( 0); CriteriaHelper.pollUiThread( mActivityTestRule.getActivity().getTabModelSelector()::isTabStateInitialized); assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting()); } @After public void tearDown() { TestThreadUtils.runOnUiThreadBlocking( ChromeNightModeTestUtils::tearDownNightModeAfterChromeActivityDestroyed); TestThreadUtils.runOnUiThreadBlocking( () -> ChromeAccessibilityUtil.get().setAccessibilityEnabledForTesting(null)); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @DisableAnimationsTestRule.EnsureAnimationsOn @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "crbug.com/1469431") public void testRenderGrid_3WebTabs(boolean isStartSurfaceRefactorEnabled) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(3, 0, "about:blank"); // Make sure all thumbnails are there before switching tabs. enterGTSWithThumbnailRetry(); leaveTabSwitcher(cta); ChromeTabUtils.switchTabInCurrentTabModel(cta, 0); enterTabSwitcher(cta); mRenderTestRule.render(cta.findViewById(R.id.tab_list_view), "3_web_tabs"); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.THUMBNAIL_CACHE_REFACTOR, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @DisableAnimationsTestRule.EnsureAnimationsOn @CommandLineFlags.Add({BASE_PARAMS}) public void testRenderGrid_3WebTabs_ThumbnailCacheRefactor(boolean isStartSurfaceRefactorEnabled) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(3, 0, mTestServer.getURL(TEST_URL)); // Make sure all thumbnails are there before switching tabs. enterGTSWithThumbnailRetry(); leaveTabSwitcher(cta); ChromeTabUtils.switchTabInCurrentTabModel(cta, 0); enterGTSWithThumbnailRetry(); mRenderTestRule.render( cta.findViewById(R.id.tab_list_view), "3_web_tabs_thumbnail_cache_refactor"); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @DisableAnimationsTestRule.EnsureAnimationsOn @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testRenderGrid_10WebTabs(boolean isStartSurfaceRefactorEnabled) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(10, 0, "about:blank"); // Make sure all thumbnails are there before switching tabs. enterGTSWithThumbnailRetry(); leaveTabSwitcher(cta); ChromeTabUtils.switchTabInCurrentTabModel(cta, 0); enterTabSwitcher(cta); mRenderTestRule.render(cta.findViewById(R.id.tab_list_view), "10_web_tabs"); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testRenderGrid_10WebTabs_InitialScroll(boolean isStartSurfaceRefactorEnabled) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(10, 0, "about:blank"); assertEquals(9, cta.getTabModelSelector().getCurrentModel().index()); enterGTSWithThumbnailRetry(); // Make sure the grid tab switcher is scrolled down to show the selected tab. mRenderTestRule.render(cta.findViewById(R.id.tab_list_view), "10_web_tabs-select_last"); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testSwitchTabModel_ScrollToSelectedTab(boolean isStartSurfaceRefactorEnabled) throws IOException { ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(10, 0, "about:blank"); assertEquals(9, cta.getCurrentTabModel().index()); createTabs(cta, true, 1); CriteriaHelper.pollUiThread(() -> cta.getCurrentTabModel().isIncognito()); enterTabSwitcher(cta); switchTabModel(cta, false); // Make sure the grid tab switcher is scrolled down to show the selected tab. onView(tabSwitcherViewMatcher()).check((v, noMatchException) -> { if (noMatchException != null) throw noMatchException; assertTrue(v instanceof RecyclerView); LinearLayoutManager layoutManager = (LinearLayoutManager) ((RecyclerView) v).getLayoutManager(); assertEquals(9, layoutManager.findLastVisibleItemPosition()); }); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) @DisableIf.Build(message = "Flaky on emulators; see https://crbug.com/1324721 " + "and crbug.com/1077552", supported_abis_includes = "x86") public void testRenderGrid_Incognito(boolean isStartSurfaceRefactorEnabled) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Prepare some incognito tabs and enter tab switcher. prepareTabs(1, 3, "about:blank"); assertTrue(cta.getCurrentTabModel().isIncognito()); // Make sure all thumbnails are there before switching tabs. enterGTSWithThumbnailRetry(); leaveTabSwitcher(cta); ChromeTabUtils.switchTabInCurrentTabModel(cta, 0); enterTabSwitcher(cta); ChromeRenderTestRule.sanitize(cta.findViewById(R.id.tab_list_view)); mRenderTestRule.render(cta.findViewById(R.id.tab_list_view), "3_incognito_web_tabs"); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) @DisableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION}) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @DisableIf.Build(message = "Flaky on emulators; see https://crbug.com/1313747", supported_abis_includes = "x86") public void testRenderGrid_3NativeTabs(boolean isStartSurfaceRefactorEnable) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Prepare some incognito native tabs and enter tab switcher. // NTP in incognito mode is chosen for its consistency in look, and we don't have to mock // away the MV tiles, login promo, feed, etc. prepareTabs(1, 3, null); assertTrue(cta.getCurrentTabModel().isIncognito()); // Make sure all thumbnails are there before switching tabs. enterGTSWithThumbnailRetry(); leaveTabSwitcher(cta); // Espresso.pressBack(); ChromeTabUtils.switchTabInCurrentTabModel(cta, 0); enterTabSwitcher(cta); mRenderTestRule.render(cta.findViewById(R.id.tab_list_view), "3_incognito_ntps"); } @Test @MediumTest @Feature({"RenderTest"}) @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.THUMBNAIL_CACHE_REFACTOR}) @DisableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION}) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @DisableIf.Build(message = "Flaky on emulators; see https://crbug.com/1313747", supported_abis_includes = "x86") public void testRenderGrid_3NativeTabs_ThumbnailCacheRefactor(boolean isStartSurfaceRefactorEnable) throws IOException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Prepare some incognito native tabs and enter tab switcher. // NTP in incognito mode is chosen for its consistency in look, and we don't have to mock // away the MV tiles, login promo, feed, etc. prepareTabs(1, 3, null); assertTrue(cta.getCurrentTabModel().isIncognito()); // Make sure all thumbnails are there before switching tabs. enterGTSWithThumbnailRetry(); leaveTabSwitcher(cta); // Espresso.pressBack(); ChromeTabUtils.switchTabInCurrentTabModel(cta, 0); enterTabSwitcher(cta); mRenderTestRule.render( cta.findViewById(R.id.tab_list_view), "3_incognito_ntps_thumbnail_cache_refactor"); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) @CommandLineFlags.Add({BASE_PARAMS}) @DisableIf.Build(message = "https://crbug.com/1365708", supported_abis_includes = "x86", sdk_is_greater_than = O_MR1, sdk_is_less_than = Q) public void testTabToGridFromLiveTab(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); assertEquals(3_000, mTabListDelegate.getSoftCleanupDelayForTesting()); assertEquals(30_000, mTabListDelegate.getCleanupDelayForTesting()); prepareTabs(2, 0, NTP_URL); testTabToGrid(mUrl); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study") @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "crbug.com/991852 This test is flaky") public void testTabToGridFromLiveTabAnimation(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertTrue( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(2, 0, NTP_URL); testTabToGrid(mUrl); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) @DisableIf.Build(message = "https://crbug.com/1365708", supported_abis_includes = "x86", sdk_is_greater_than = O_MR1, sdk_is_less_than = Q) public void testTabToGridFromLiveTabWarm(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); assertEquals(3_000, mTabListDelegate.getSoftCleanupDelayForTesting()); assertEquals(30_000, mTabListDelegate.getCleanupDelayForTesting()); prepareTabs(2, 0, NTP_URL); testTabToGrid(mUrl); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study") @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "https://crbug.com/1207875") public void testTabToGridFromLiveTabWarmAnimation(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertTrue( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(2, 0, NTP_URL); testTabToGrid(mUrl); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) public void testTabToGridFromLiveTabSoft(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); assertEquals(3_000, mTabListDelegate.getSoftCleanupDelayForTesting()); assertEquals(30_000, mTabListDelegate.getCleanupDelayForTesting()); prepareTabs(2, 0, NTP_URL); testTabToGrid(mUrl); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study") @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "https://crbug.com/1272561") public void testTabToGridFromLiveTabSoftAnimation(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertTrue( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(2, 0, NTP_URL); testTabToGrid(mUrl); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testTabToGridFromNtp(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { prepareTabs(2, 0, NTP_URL); testTabToGrid(NTP_URL); } /** * Make Chrome have {@code numTabs} of regular Tabs and {@code numIncognitoTabs} of incognito * tabs with {@code url} loaded, and assert no bitmap fetching occurred. * * @param numTabs The number of regular tabs. * @param numIncognitoTabs The number of incognito tabs. * @param url The URL to load. */ private void prepareTabs(int numTabs, int numIncognitoTabs, @Nullable String url) { int oldCount = mTabListDelegate.getBitmapFetchCountForTesting(); TabUiTestHelper.prepareTabsWithThumbnail(mActivityTestRule, numTabs, numIncognitoTabs, url); assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting() - oldCount); } private void testTabToGrid(String fromUrl) throws InterruptedException { mActivityTestRule.loadUrl(fromUrl); for (int i = 0; i < mRepeat; i++) { enterGTSWithThumbnailChecking(); leaveGTSAndVerifyThumbnailsAreReleased(); } } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testGridToTabToCurrentNTP(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { prepareTabs(1, 0, NTP_URL); testGridToTab(false, false); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testGridToTabToOtherNTP(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { prepareTabs(2, 0, NTP_URL); testGridToTab(true, false); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) @DisableIf.Build(message = "https://crbug.com/1365708", supported_abis_includes = "x86", sdk_is_greater_than = O_MR1, sdk_is_less_than = Q) public void testGridToTabToCurrentLive(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(1, 0, mUrl); testGridToTab(false, false); } // From https://stackoverflow.com/a/21505193 private static boolean isEmulator() { return Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("unknown") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) || "google_sdk".equals(Build.PRODUCT); } /** * Test that even if there are tabs with stuck pending thumbnail readback, it doesn't block * thumbnail readback for the current tab. */ @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) // clang-format off @DisableIf.Build(message = "Flaky on emulators; see https://crbug.com/1094492", supported_abis_includes = "x86") public void testGridToTabToCurrentLiveDetached(boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); // This works on emulators but not on real devices. See crbug.com/986047. if (!isEmulator()) return; for (int i = 0; i < 10; i++) { ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Quickly create some tabs, navigate to web pages, and don't wait for thumbnail // capturing. mActivityTestRule.loadUrl(mUrl); ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), cta, false, false); mActivityTestRule.loadUrl(mUrl); // Hopefully we are in a state where some pending readbacks are stuck because their tab // is not attached to the view. if (cta.getTabContentManager().getPendingReadbacksForTesting() > 0) { break; } // Restart Chrome. // Although we're destroying the activity, the Application will still live on since its // in the same process as this test. TestThreadUtils.runOnUiThreadBlocking(() -> cta.getTabModelSelector().closeAllTabs()); TabUiTestHelper.finishActivity(cta); mActivityTestRule.startMainActivityOnBlankPage(); assertEquals(1, mActivityTestRule.tabsCount(false)); } ChromeTabbedActivity cta = mActivityTestRule.getActivity(); assertNotEquals(0, cta.getTabContentManager().getPendingReadbacksForTesting()); assertEquals(1, cta.getCurrentTabModel().index()); // The last tab should still get thumbnail even though readbacks for other tabs are stuck. enterTabSwitcher(cta); TabUiTestHelper.checkThumbnailsExist(cta.getTabModelSelector().getCurrentTab()); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study") @DisabledTest(message = "crbug.com/993201 This test fails deterministically on Nexus 5X") public void testGridToTabToCurrentLiveWithAnimation(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertTrue( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(1, 0, mUrl); testGridToTab(false, false); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) @DisabledTest(message = "crbug.com/1313972") public void testGridToTabToOtherLive(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(2, 0, mUrl); testGridToTab(true, false); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study") @DisabledTest(message = "crbug.com/993201 This test fails deterministically on Nexus 5X") public void testGridToTabToOtherLiveWithAnimation(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertTrue( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(2, 0, mUrl); testGridToTab(true, false); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @DisableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) @DisabledTest(message = "crbug.com/1237623 test is flaky") public void testGridToTabToOtherFrozen(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { assertFalse( TabUiFeatureUtilities.isTabToGtsAnimationEnabled(mActivityTestRule.getActivity())); prepareTabs(2, 0, mUrl); testGridToTab(true, true); } private void testGridToTab(boolean switchToAnotherTab, boolean killBeforeSwitching) throws InterruptedException { for (int i = 0; i < mRepeat; i++) { enterGTSWithThumbnailChecking(); final int index = mActivityTestRule.getActivity().getCurrentTabModel().index(); final int targetIndex = switchToAnotherTab ? 1 - index : index; Tab targetTab = mActivityTestRule.getActivity().getCurrentTabModel().getTabAt(targetIndex); if (killBeforeSwitching) { WebContentsUtils.simulateRendererKilled(targetTab.getWebContents()); } if (switchToAnotherTab) { waitForCaptureRateControl(); } onView(tabSwitcherViewMatcher()).perform(actionOnItemAtPosition(targetIndex, click())); CriteriaHelper.pollUiThread(() -> { boolean doneHiding = !mActivityTestRule.getActivity().getLayoutManager().isLayoutVisible( LayoutType.TAB_SWITCHER); if (!doneHiding) { // Before overview hiding animation is done, the tab index should not change. Criteria.checkThat(mActivityTestRule.getActivity().getCurrentTabModel().index(), Matchers.is(index)); } return doneHiding; }, "Overview not hidden yet"); int delta; if (switchToAnotherTab && !UrlUtilities.isNTPUrl(mActivityTestRule.getActivity() .getCurrentWebContents() .getLastCommittedUrl())) { // Capture the original tab. delta = 1; } else { delta = 0; } } } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testRestoredTabsDontFetch(boolean isStartSurfaceRefactorEnabled) throws Exception { prepareTabs(2, 0, mUrl); int oldCount = mTabListDelegate.getBitmapFetchCountForTesting(); // Restart Chrome. // Although we're destroying the activity, the Application will still live on since its in // the same process as this test. TabUiTestHelper.finishActivity(mActivityTestRule.getActivity()); mActivityTestRule.startMainActivityOnBlankPage(); assertEquals(3, mActivityTestRule.tabsCount(false)); TabUiTestHelper.getTabSwitcherLayoutAndVerify( mIsStartSurfaceRefactorEnabled, mActivityTestRule.getActivity().getLayoutManager()); assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting() - oldCount); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testInvisibleTabsDontFetch(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // Open a few new tabs. final int count = mTabListDelegate.getBitmapFetchCountForTesting(); for (int i = 0; i < 3; i++) { MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), R.id.new_tab_menu_id); } // Fetching might not happen instantly. Thread.sleep(1000); // No fetching should happen. assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting() - count); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "crbug.com/1130830") public void testInvisibleTabsDontFetchWarm(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // Get the GTS in the warm state. prepareTabs(2, 0, NTP_URL); testTabToGrid(NTP_URL); Thread.sleep(1000); // Open a few new tabs. final int count = mTabListDelegate.getBitmapFetchCountForTesting(); for (int i = 0; i < 3; i++) { MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), R.id.new_tab_menu_id); } // Fetching might not happen instantly. Thread.sleep(1000); // No fetching should happen. assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting() - count); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "crbug.com/1130830") public void testInvisibleTabsDontFetchSoft(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // Get the GTS in the soft cleaned up state. prepareTabs(2, 0, NTP_URL); testTabToGrid(NTP_URL); Thread.sleep(1000); // Open a few new tabs. final int count = mTabListDelegate.getBitmapFetchCountForTesting(); for (int i = 0; i < 3; i++) { MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), R.id.new_tab_menu_id); } // Fetching might not happen instantly. Thread.sleep(1000); // No fetching should happen. assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting() - count); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "http://crbug/1005865 - Test was previously flaky but only on bots." + "Was not locally reproducible. Disabling until verified that it's deflaked on bots.") public void testIncognitoEnterGts(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on prepareTabs(1, 1, null); enterGTSWithThumbnailChecking(); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(1)); onView(tabSwitcherViewMatcher()).perform(actionOnItemAtPosition(0, click())); LayoutTestUtils.waitForLayout( mActivityTestRule.getActivity().getLayoutManager(), LayoutType.BROWSING); enterGTSWithThumbnailChecking(); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(1)); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) // clang-format off @DisableIf.Build(message = "Flaky on Android P, see https://crbug.com/1063991", sdk_is_greater_than = VERSION_CODES.O_MR1, sdk_is_less_than = VERSION_CODES.Q) public void testIncognitoToggle_tabCount(boolean isStartSurfaceRefactorEnabled) throws InterruptedException{ // clang-format on mActivityTestRule.loadUrl(mUrl); ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Prepare two incognito tabs and enter tab switcher. createTabs(cta, true, 2); enterTabSwitcher(cta); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(2)); for (int i = 0; i < mRepeat; i++) { switchTabModel(cta, false); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(1)); switchTabModel(cta, true); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(2)); } leaveGTSAndVerifyThumbnailsAreReleased(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @DisabledTest(message = "https://crbug.com/1233169") public void testIncognitoToggle_thumbnailFetchCount(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); int oldFetchCount = mTabListDelegate.getBitmapFetchCountForTesting(); // Prepare two incognito tabs and enter tab switcher. prepareTabs(1, 2, mUrl); enterGTSWithThumbnailChecking(); int currentFetchCount = mTabListDelegate.getBitmapFetchCountForTesting(); assertEquals(2, currentFetchCount - oldFetchCount); oldFetchCount = currentFetchCount; int oldHistogramRecord = RecordHistogram.getHistogramValueCountForTesting( TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT, TabContentManager.ThumbnailFetchingResult.GOT_JPEG); for (int i = 0; i < mRepeat; i++) { switchTabModel(cta, false); currentFetchCount = mTabListDelegate.getBitmapFetchCountForTesting(); int currentHistogramRecord = RecordHistogram.getHistogramValueCountForTesting( TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT, TabContentManager.ThumbnailFetchingResult.GOT_JPEG); assertEquals(1, currentFetchCount - oldFetchCount); assertEquals(1, currentHistogramRecord - oldHistogramRecord); oldFetchCount = currentFetchCount; oldHistogramRecord = currentHistogramRecord; switchTabModel(cta, true); currentFetchCount = mTabListDelegate.getBitmapFetchCountForTesting(); currentHistogramRecord = RecordHistogram.getHistogramValueCountForTesting( TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT, TabContentManager.ThumbnailFetchingResult.GOT_JPEG); assertEquals(2, currentFetchCount - oldFetchCount); assertEquals(2, currentHistogramRecord - oldHistogramRecord); oldFetchCount = currentFetchCount; oldHistogramRecord = currentHistogramRecord; } leaveGTSAndVerifyThumbnailsAreReleased(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testUrlUpdatedNotCrashing_ForUndoableClosedTab( boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on mActivityTestRule.getActivity().getSnackbarManager().disableForTesting(); prepareTabs(2, 0, null); enterGTSWithThumbnailChecking(); Tab tab = mActivityTestRule.getActivity().getTabModelSelector().getCurrentTab(); TestThreadUtils.runOnUiThreadBlocking(() -> { mActivityTestRule.getActivity().getTabModelSelector().getCurrentModel().closeTab( tab, false, false, true); }); mActivityTestRule.loadUrlInTab( mUrl, PageTransition.TYPED | PageTransition.FROM_ADDRESS_BAR, tab); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testUrlUpdatedNotCrashing_ForTabNotInCurrentModel( boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(1, 1, null); enterGTSWithThumbnailChecking(); Tab tab = cta.getTabModelSelector().getCurrentTab(); switchTabModel(cta, false); mActivityTestRule.loadUrlInTab( mUrl, PageTransition.TYPED | PageTransition.FROM_ADDRESS_BAR, tab); } private int getTabCountInCurrentTabModel() { return mActivityTestRule.getActivity().getTabModelSelector().getCurrentModel().getCount(); } @Test @MediumTest @Feature("TabSuggestion") @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study", ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) @DisabledTest(message = "https://crbug.com/1458026 for RefactorDisabled") public void testTabSuggestionMessageCard_dismiss(boolean isStartSurfaceRefactorEnable) throws InterruptedException { // clang-format on Assume.assumeFalse("crbug/1455473", isStartSurfaceRefactorEnable); prepareTabs(3, 0, null); // TODO(meiliang): Avoid using static variable for tracking state, // TabSuggestionMessageService.isSuggestionAvailableForTesting(). Instead, we can add a // mock/fake MessageObserver to track the availability of the suggestions. CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(3))); mayEnterGTSAndLeave(mActivityTestRule.getActivity()); enterGTSWithThumbnailChecking(); // TODO(meiliang): Avoid using static variable for tracking state, // TabSwitcherCoordinator::hasAppendedMessagesForTesting. Instead, we can query the number // of items that the inner model of the TabSwitcher has. CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); ViewUtils.onViewWaiting(withId(R.id.tab_grid_message_item)).check(matches(isDisplayed())); onView(allOf(withId(R.id.close_button), withParent(withId(R.id.tab_grid_message_item)))) .perform(click()); onView(withId(R.id.tab_grid_message_item)).check(doesNotExist()); } @Test @MediumTest @Feature("TabSuggestion") @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study", ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) @DisabledTest(message = "https://crbug.com/1447282 for refactor disabled case.") public void testTabSuggestionMessageCard_review(boolean isStartSurfaceRefactorEnable) throws InterruptedException { // clang-format on prepareTabs(3, 0, null); CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(3))); mayEnterGTSAndLeave(mActivityTestRule.getActivity()); enterGTSWithThumbnailChecking(); CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); ViewUtils.onViewWaiting(withId(R.id.tab_grid_message_item)).check(matches(isDisplayed())); ViewUtils .onViewWaiting(allOf( withId(R.id.action_button), withParent(withId(R.id.tab_grid_message_item)))) .perform(click()); TabSelectionEditorTestingRobot tabSelectionEditorTestingRobot = new TabSelectionEditorTestingRobot(); tabSelectionEditorTestingRobot.resultRobot.verifyTabSelectionEditorIsVisible(); Espresso.pressBack(); tabSelectionEditorTestingRobot.resultRobot.verifyTabSelectionEditorIsHidden(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @Feature("TabSuggestion") @DisabledTest(message = "https://crbug.com/1230107, crbug.com/1130621") // clang-format off @EnableFeatures({ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study", ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) public void testShowOnlyOneTabSuggestionMessageCard_withSoftCleanup( boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on verifyOnlyOneTabSuggestionMessageCardIsShowing(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @Feature("TabSuggestion") // clang-format off @EnableFeatures({ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study", ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) @DisabledTest(message = "https://crbug.com/1198484, crbug.com/1130621") public void testShowOnlyOneTabSuggestionMessageCard_withHardCleanup( boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on verifyOnlyOneTabSuggestionMessageCardIsShowing(); } @Test @MediumTest @Feature("TabSuggestion") @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study", ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) @DisabledTest(message = "https://crbug.com/1311825") public void testTabSuggestionMessageCardDismissAfterTabClosing( boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on prepareTabs(3, 0, mUrl); CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(3))); mayEnterGTSAndLeave(mActivityTestRule.getActivity()); enterGTSWithThumbnailChecking(); CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); ViewUtils.onViewWaiting(withId(R.id.tab_grid_message_item)).check(matches(isDisplayed())); closeFirstTabInTabSwitcher(mActivityTestRule.getActivity()); CriteriaHelper.pollUiThread( () -> !TabSuggestionMessageService.isSuggestionAvailableForTesting()); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(2))); onView(tabSwitcherViewMatcher()) .check(TabUiTestHelper.ChildrenCountAssertion.havingTabSuggestionMessageCardCount( 0)); onView(withId(R.id.tab_grid_message_item)).check(doesNotExist()); } @Test @MediumTest @Feature("TabSuggestion") @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study", ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) @DisabledTest(message = "https://crbug.com/1326533") public void testTabSuggestionMessageCard_orientation(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); prepareTabs(3, 0, null); View parentView = cta.getCompositorViewHolderForTesting(); CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(3))); mayEnterGTSAndLeave(mActivityTestRule.getActivity()); enterGTSWithThumbnailChecking(); CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); // Force portrait mode since the device can be wrongly in landscape. See crbug/1063639. ActivityTestUtils.rotateActivityToOrientation(cta, Configuration.ORIENTATION_PORTRAIT); CriteriaHelper.pollUiThread(() -> parentView.getHeight() > parentView.getWidth()); // Ensure the message card is visible so we can get its view holder. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.scrollToPosition(3)) .check(MessageCardWidthAssertion.checkMessageItemSpanSize(3, 2)); ActivityTestUtils.rotateActivityToOrientation(cta, Configuration.ORIENTATION_LANDSCAPE); CriteriaHelper.pollUiThread(() -> parentView.getHeight() < parentView.getWidth()); // Ensure the message card is visible so we can get its view holder. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.scrollToPosition(3)) .check(MessageCardWidthAssertion.checkMessageItemSpanSize(3, 3)); ActivityTestUtils.clearActivityOrientation(mActivityTestRule.getActivity()); } private static class MessageCardWidthAssertion implements ViewAssertion { private int mIndex; private int mSpanCount; public static MessageCardWidthAssertion checkMessageItemSpanSize(int index, int spanCount) { return new MessageCardWidthAssertion(index, spanCount); } public MessageCardWidthAssertion(int index, int spanCount) { mIndex = index; mSpanCount = spanCount; } @Override public void check(View view, NoMatchingViewException noMatchException) { if (noMatchException != null) throw noMatchException; float tabListPadding = TabUiThemeProvider.getTabGridCardMargin(view.getContext()); float messageCardMargin = TabUiThemeProvider.getMessageCardMarginDimension(view.getContext()); assertTrue(view instanceof RecyclerView); RecyclerView recyclerView = (RecyclerView) view; GridLayoutManager layoutManager = (GridLayoutManager) recyclerView.getLayoutManager(); assertEquals(mSpanCount, layoutManager.getSpanCount()); RecyclerView.ViewHolder messageItemViewHolder = recyclerView.findViewHolderForAdapterPosition(mIndex); assertNotNull(messageItemViewHolder); assertEquals(TabProperties.UiType.MESSAGE, messageItemViewHolder.getItemViewType()); View messageItemView = messageItemViewHolder.itemView; // The message card item width should always be recyclerView width minus padding and // margin. assertEquals(recyclerView.getWidth() - 2 * tabListPadding - 2 * messageCardMargin, (float) messageItemView.getWidth(), 1.0f); } } @Test @LargeTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study", ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/enable_launch_polish/true"}) @DisabledTest(message = "https://crbug.com/1122657") public void testThumbnailAspectRatio_default(boolean isStartSurfaceRefactorEnabled) { // clang-format on prepareTabs(2, 0, "about:blank"); enterTabSwitcher(mActivityTestRule.getActivity()); onViewWaiting(tabSwitcherViewMatcher()) .check(ThumbnailAspectRatioAssertion.havingAspectRatio( TabUtils.getTabThumbnailAspectRatio(mActivityTestRule.getActivity(), mActivityTestRule.getActivity().getBrowserControlsManager()))); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testThumbnailFetchingResult_liveLayer(boolean isStartSurfaceRefactorEnabled) throws Exception { // May be called when setting both grid card size and thumbnail fetcher. var histograms = HistogramWatcher.newBuilder() .expectIntRecord(TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT, TabContentManager.ThumbnailFetchingResult.GOT_NOTHING) .allowExtraRecords(TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT) .build(); prepareTabs(1, 0, "about:blank"); enterTabSwitcher(mActivityTestRule.getActivity()); // There might be an additional one from capturing thumbnail for the live layer. CriteriaHelper.pollUiThread( () -> Criteria.checkThat(mAllBitmaps.size(), Matchers.greaterThanOrEqualTo(1))); histograms.assertExpected(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testThumbnailFetchingResult_jpeg(boolean isStartSurfaceRefactorEnabled) throws Exception { // May be called when setting both grid card size and thumbnail fetcher. var histograms = HistogramWatcher.newBuilder() .expectIntRecord(TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT, TabContentManager.ThumbnailFetchingResult.GOT_JPEG) .allowExtraRecords(TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT) .build(); prepareTabs(1, 0, "about:blank"); simulateJpegHasCachedWithDefaultAspectRatio(); enterTabSwitcher(mActivityTestRule.getActivity()); // There might be an additional one from capturing thumbnail for the live layer. CriteriaHelper.pollUiThread( () -> Criteria.checkThat(mAllBitmaps.size(), Matchers.greaterThanOrEqualTo(1))); histograms.assertExpected(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testThumbnailFetchingResult_changingAspectRatio( boolean isStartSurfaceRefactorEnabled) throws Exception { // May be called when setting both grid card size and thumbnail fetcher. var histograms = HistogramWatcher.newBuilder() .expectIntRecord(TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT, TabContentManager.ThumbnailFetchingResult .GOT_DIFFERENT_ASPECT_RATIO_JPEG) .allowExtraRecords(TabContentManager.UMA_THUMBNAIL_FETCHING_RESULT) .build(); prepareTabs(1, 0, "about:blank"); // Simulate Jpeg has cached with default aspect ratio. simulateJpegHasCachedWithAspectRatio(0.7); enterTabSwitcher(mActivityTestRule.getActivity()); // There might be an additional one from capturing thumbnail for the live layer. CriteriaHelper.pollUiThread( () -> Criteria.checkThat(mAllBitmaps.size(), Matchers.greaterThanOrEqualTo(1))); histograms.assertExpected(); onViewWaiting(tabSwitcherViewMatcher()) .check(ThumbnailAspectRatioAssertion.havingAspectRatio( TabUtils.THUMBNAIL_ASPECT_RATIO)); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) @DisabledTest(message = "https://crbug.com/1297930") public void testRecycling_defaultAspectRatio(boolean isStartSurfaceRefactorEnabled) { prepareTabs(10, 0, mUrl); ChromeTabUtils.switchTabInCurrentTabModel(mActivityTestRule.getActivity(), 0); enterTabSwitcher(mActivityTestRule.getActivity()); onView(tabSwitcherViewMatcher()).perform(RecyclerViewActions.scrollToPosition(9)); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testExpandTab(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on prepareTabs(1, 0, mUrl); enterTabSwitcher(mActivityTestRule.getActivity()); leaveGTSAndVerifyThumbnailsAreReleased(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.THUMBNAIL_CACHE_REFACTOR, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS}) public void testExpandTab_ThumbnailCacheRefactor(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { // clang-format on prepareTabs(1, 0, mUrl); enterTabSwitcher(mActivityTestRule.getActivity()); leaveGTSAndVerifyThumbnailsAreReleased(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testCloseTabViaCloseButton(boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on mActivityTestRule.getActivity().getSnackbarManager().disableForTesting(); prepareTabs(1, 0, null); enterGTSWithThumbnailChecking(); onView(allOf(withId(R.id.action_button), withParent(withId(R.id.content_view)), withEffectiveVisibility(VISIBLE))) .perform(click()); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @CommandLineFlags.Add({BASE_PARAMS}) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @DisabledTest(message = "Flaky - https://crbug.com/1124041, crbug.com/1061178") public void testSwipeToDismiss_GTS(boolean isStartSurfaceRefactorEnabled) { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Create 3 tabs and merge the first two tabs into one group. createTabs(cta, false, 3); enterTabSwitcher(cta); TabModel normalTabModel = cta.getTabModelSelector().getModel(false); List<Tab> tabGroup = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(0), normalTabModel.getTabAt(1))); createTabGroup(cta, false, tabGroup); verifyTabSwitcherCardCount(cta, 2); verifyTabModelTabCount(cta, 3, 0); // Swipe to dismiss a single tab card. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.actionOnItemAtPosition( 1, getSwipeToDismissAction(false))); verifyTabSwitcherCardCount(cta, 1); verifyTabModelTabCount(cta, 2, 0); // Swipe to dismiss a tab group card. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.actionOnItemAtPosition( 0, getSwipeToDismissAction(true))); verifyTabSwitcherCardCount(cta, 0); verifyTabModelTabCount(cta, 0, 0); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID + "<Study"}) @CommandLineFlags.Add({BASE_PARAMS + "/enable_launch_polish/true"}) public void testCloseButtonDescription(boolean isStartSurfaceRefactorEnabled) { String expectedDescription = "Close New tab tab"; // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); enterTabSwitcher(cta); // Test single tab. onView(allOf(withParent(withId(R.id.content_view)), withId(R.id.action_button), withEffectiveVisibility(VISIBLE))) .check(ViewContentDescription.havingDescription(expectedDescription)); // Create 2 tabs and merge them into one group. createTabs(cta, false, 2); enterTabSwitcher(cta); TabModel normalTabModel = cta.getTabModelSelector().getModel(false); List<Tab> tabGroup = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(0), normalTabModel.getTabAt(1))); createTabGroup(cta, false, tabGroup); verifyTabSwitcherCardCount(cta, 1); // Test group tab. expectedDescription = "Close tab group with 2 tabs"; onView(allOf(withParent(withId(R.id.content_view)), withId(R.id.action_button), withEffectiveVisibility(VISIBLE))) .check(ViewContentDescription.havingDescription(expectedDescription)); } private static class ViewContentDescription implements ViewAssertion { private String mExpectedDescription; public static ViewContentDescription havingDescription(String description) { return new ViewContentDescription(description); } public ViewContentDescription(String description) { mExpectedDescription = description; } @Override public void check(View view, NoMatchingViewException noMatchException) { if (noMatchException != null) throw noMatchException; assertEquals(mExpectedDescription, view.getContentDescription()); } } private static class TabCountAssertion implements ViewAssertion { private int mExpectedCount; public static TabCountAssertion havingTabCount(int tabCount) { return new TabCountAssertion(tabCount); } public TabCountAssertion(int expectedCount) { mExpectedCount = expectedCount; } @Override public void check(View view, NoMatchingViewException noMatchException) { if (noMatchException != null) throw noMatchException; RecyclerView.Adapter adapter = ((RecyclerView) view).getAdapter(); assertEquals(mExpectedCount, adapter.getItemCount()); } } private static class ThumbnailAspectRatioAssertion implements ViewAssertion { private double mExpectedRatio; public static ThumbnailAspectRatioAssertion havingAspectRatio(double ratio) { return new ThumbnailAspectRatioAssertion(ratio); } private ThumbnailAspectRatioAssertion(double expectedRatio) { mExpectedRatio = expectedRatio; } @Override public void check(View view, NoMatchingViewException noMatchException) { if (noMatchException != null) throw noMatchException; RecyclerView recyclerView = (RecyclerView) view; RecyclerView.Adapter adapter = recyclerView.getAdapter(); boolean hasAtLeastOneValidViewHolder = false; for (int i = 0; i < adapter.getItemCount(); i++) { RecyclerView.ViewHolder viewHolder = recyclerView.findViewHolderForAdapterPosition(i); if (viewHolder != null) { hasAtLeastOneValidViewHolder = true; ViewLookupCachingFrameLayout tabView = (ViewLookupCachingFrameLayout) viewHolder.itemView; TabGridThumbnailView thumbnail = (TabGridThumbnailView) tabView.fastFindViewById(R.id.tab_thumbnail); double thumbnailViewRatio = thumbnail.getWidth() * 1.0 / thumbnail.getHeight(); int pixelDelta = Math.abs((int) Math.round(thumbnail.getHeight() * mExpectedRatio) - thumbnail.getWidth()); assertTrue("Actual ratio: " + thumbnailViewRatio + "; Expected ratio: " + mExpectedRatio + "; Pixel delta: " + pixelDelta, pixelDelta <= thumbnail.getWidth() * TabContentManager.PIXEL_TOLERANCE_PERCENT); } } assertTrue("should have at least one valid ViewHolder", hasAtLeastOneValidViewHolder); } } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) @DisableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION}) @DisabledTest(message = "crbug.com/1096997") public void testTabGroupManualSelection(boolean isStartSurfaceRefactorEnabled) throws InterruptedException { ChromeTabbedActivity cta = mActivityTestRule.getActivity(); TabSelectionEditorTestingRobot robot = new TabSelectionEditorTestingRobot(); createTabs(cta, false, 3); enterTabSwitcher(cta); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(3)); enterTabSelectionEditor(cta); robot.resultRobot.verifyTabSelectionEditorIsVisible(); // Group first two tabs. robot.actionRobot.clickItemAtAdapterPosition(0); robot.actionRobot.clickItemAtAdapterPosition(1); robot.actionRobot.clickToolbarMenuButton().clickToolbarMenuItem("Group tabs"); // Exit manual selection mode, back to tab switcher. robot.resultRobot.verifyTabSelectionEditorIsHidden(); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(2)); onViewWaiting(withText("2 tabs grouped")); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION}) public void testTabSelectionEditor_SystemBackDismiss(boolean isStartSurfaceRefactorEnabled) { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); TabSelectionEditorTestingRobot robot = new TabSelectionEditorTestingRobot(); createTabs(cta, false, 2); enterTabSwitcher(cta); onView(tabSwitcherViewMatcher()).check(TabCountAssertion.havingTabCount(2)); enterTabSelectionEditor(cta); robot.resultRobot.verifyTabSelectionEditorIsVisible(); // Pressing system back should dismiss the selection editor. Espresso.pressBack(); robot.resultRobot.verifyTabSelectionEditorIsHidden(); } @Test @MediumTest @Feature("TabSuggestion") @UseMethodParameter(LegacyTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.CLOSE_TAB_SUGGESTIONS + "<Study"}) @DisableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION}) @CommandLineFlags.Add({BASE_PARAMS + "/baseline_tab_suggestions/true" + "/baseline_close_tab_suggestions/true/min_time_between_prefetches/0"}) @DisabledTest(message = "https://crbug.com/1449985") public void testTabGroupManualSelection_AfterReviewTabSuggestion( boolean isStartSurfaceRefactorEnable) throws InterruptedException { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); TabSelectionEditorTestingRobot robot = new TabSelectionEditorTestingRobot(); createTabs(cta, false, 3); // Review closing tab suggestion. CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(3))); mayEnterGTSAndLeave(cta); // Entering GTS with thumbnail checking here is trying to reduce flakiness that is caused by // the TabContextObserver. TabContextObserver listens to // TabObserver#didFirstVisuallyNonEmptyPaint and invalidates the suggestion. Do the // thumbnail checking here is to ensure the suggestion is valid when entering tab switcher. enterGTSWithThumbnailChecking(); CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); onView(withId(R.id.tab_grid_message_item)).check(matches(isDisplayed())); onView(allOf(withId(R.id.action_button), withParent(withId(R.id.tab_grid_message_item)))) .perform(click()); robot.resultRobot.verifyTabSelectionEditorIsVisible().verifyToolbarActionViewEnabled( R.id.tab_selection_editor_close_menu_item); robot.actionRobot.clickToolbarActionView(R.id.tab_selection_editor_close_menu_item); robot.resultRobot.verifyTabSelectionEditorIsHidden(); CriteriaHelper.pollUiThread(() -> { Criteria.checkThat(mActivityTestRule.getActivity().getCurrentTabModel().getCount(), Matchers.is(0)); }); // Show Manual Selection Mode. createTabs(cta, false, 3); TabUiTestHelper.enterTabSwitcher(mActivityTestRule.getActivity()); enterTabSelectionEditor(cta); robot.resultRobot.verifyTabSelectionEditorIsVisible(); // Group first two tabs. robot.actionRobot.clickItemAtAdapterPosition(0); robot.actionRobot.clickItemAtAdapterPosition(1); robot.actionRobot.clickToolbarMenuButton().clickToolbarMenuItem("Group tabs"); // Exit manual selection mode, back to tab switcher. robot.resultRobot.verifyTabSelectionEditorIsHidden(); onViewWaiting(withText("2 tabs grouped")); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) @DisabledTest(message = "crbug.com/1187320 This doesn't work with FeedV2 and crbug.com/1096295") public void testActivityCanBeGarbageCollectedAfterFinished( boolean isStartSurfaceRefactorEnabled) throws Exception { prepareTabs(1, 0, "about:blank"); WeakReference<ChromeTabbedActivity> activityRef = new WeakReference<>(mActivityTestRule.getActivity()); ChromeTabbedActivity activity = ApplicationTestUtils.recreateActivity(mActivityTestRule.getActivity()); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); mTabSwitcherAndStartSurfaceLayout = null; mTabSwitcherLayout = null; mTabListDelegate = null; mActivityTestRule.setActivity(activity); // A longer timeout is needed. Achieve that by using the CriteriaHelper.pollUiThread. CriteriaHelper.pollUiThread( () -> GarbageCollectionTestUtils.canBeGarbageCollected(activityRef)); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void testTabGroupNotFormDuringRestore(boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on // Finish the activity and disable the ChromeFeatureList.TAB_GROUPS_ANDROID flag. finishActivity(mActivityTestRule.getActivity()); ChromeFeatureList.sTabGroupsAndroid.setForTesting(false); mActivityTestRule.startMainActivityOnBlankPage(); final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); mActivityTestRule.loadUrl(mUrl); Tab parentTab = cta.getTabModelSelector().getCurrentTab(); // Create a tab whose parent tab is parentTab. TabCreator tabCreator = TestThreadUtils.runOnUiThreadBlockingNoException(() -> cta.getTabCreator(false)); LoadUrlParams loadUrlParams = new LoadUrlParams(mUrl); TestThreadUtils.runOnUiThreadBlocking( () -> tabCreator.createNewTab( loadUrlParams, TabLaunchType.FROM_LONGPRESS_BACKGROUND, parentTab)); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); // Restart activity with tab group enabled, and the tabs should remain as single tabs. finishActivity(cta); ChromeFeatureList.sTabGroupsAndroid.setForTesting(true); mActivityTestRule.startMainActivityOnBlankPage(); final ChromeTabbedActivity ctaRestarted = mActivityTestRule.getActivity(); assertTrue(ctaRestarted.getTabModelSelector() .getTabModelFilterProvider() .getCurrentTabModelFilter() instanceof TabGroupModelFilter); enterTabSwitcher(ctaRestarted); verifyTabSwitcherCardCount(ctaRestarted, 3); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) public void verifyTabGroupStateAfterReparenting(boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); assertTrue(cta.getTabModelSelector().getTabModelFilterProvider().getCurrentTabModelFilter() instanceof TabGroupModelFilter); mActivityTestRule.loadUrl(mUrl); Tab parentTab = cta.getTabModelSelector().getCurrentTab(); // Create a tab group. TabCreator tabCreator = TestThreadUtils.runOnUiThreadBlockingNoException(() -> cta.getTabCreator(false)); LoadUrlParams loadUrlParams = new LoadUrlParams(mUrl); TestThreadUtils.runOnUiThreadBlocking( () -> tabCreator.createNewTab(loadUrlParams, TabLaunchType.FROM_LONGPRESS_BACKGROUND_IN_GROUP, parentTab)); Tab childTab = cta.getTabModelSelector().getCurrentModel().getTabAt(1); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 1); TabGroupModelFilter filter = (TabGroupModelFilter) cta.getTabModelSelector() .getTabModelFilterProvider() .getCurrentTabModelFilter(); TestThreadUtils.runOnUiThreadBlocking(() -> filter.moveTabOutOfGroup(childTab.getId())); verifyTabSwitcherCardCount(cta, 2); TestThreadUtils.runOnUiThreadBlocking( () -> ChromeNightModeTestUtils.setUpNightModeForChromeActivity(true)); final ChromeTabbedActivity ctaNightMode = ActivityTestUtils.waitForActivity( InstrumentationRegistry.getInstrumentation(), ChromeTabbedActivity.class); assertTrue(ColorUtils.inNightMode(ctaNightMode)); CriteriaHelper.pollUiThread(ctaNightMode.getTabModelSelector()::isTabStateInitialized); enterTabSwitcher(ctaNightMode); verifyTabSwitcherCardCount(ctaNightMode, 2); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study", ChromeFeatureList.START_SURFACE_WITH_ACCESSIBILITY}) // clang-format off @CommandLineFlags.Add({ "enable-features=" + ChromeFeatureList.TAB_GROUPS_CONTINUATION_ANDROID + "<Study", "force-fieldtrials=Study/Group", "force-fieldtrial-params=Study.Group:gts-low-end-support/true" + "/gts-accessibility-support/true"}) // clang-format on public void testUndoClosure_AccessibilityMode(boolean isStartSurfaceRefactorEnabled) throws Exception { TestThreadUtils.runOnUiThreadBlocking( () -> ChromeAccessibilityUtil.get().setAccessibilityEnabledForTesting(true)); ChromeTabbedActivity cta = mActivityTestRule.getActivity(); SnackbarManager snackbarManager = mActivityTestRule.getActivity().getSnackbarManager(); createTabs(cta, false, 3); // When grid tab switcher is enabled for accessibility mode, tab closure should still show // undo snack bar. enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 3); assertNull(snackbarManager.getCurrentSnackbarForTesting()); closeFirstTabInTabSwitcher(cta); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoBarController); verifyTabSwitcherCardCount(cta, 2); CriteriaHelper.pollInstrumentationThread(TabUiTestHelper::verifyUndoBarShowingAndClickUndo); verifyTabSwitcherCardCount(cta, 3); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) // clang-format off @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.INSTANT_START, ChromeFeatureList.TAB_TO_GTS_ANIMATION + "<Study"}) // TODO(crbug.com/1112557): Remove this test when critical tests in StartSurfaceLayoutTest are // running with InstantStart on. public void testSetup_WithInstantStart(boolean isStartSurfaceRefactorEnabled) throws Exception { // clang-format on ChromeTabbedActivity cta = mActivityTestRule.getActivity(); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 1); // Verify TabModelObserver is correctly setup by checking if tab switcher changes with tab // closure. closeFirstTabInTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 0); // Verify TabGroupModelFilter is correctly setup by checking if tab switcher changes with // tab grouping. createTabs(cta, false, 3); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); mergeAllNormalTabsToAGroup(cta); verifyTabSwitcherCardCount(cta, 1); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) public void testUndoGroupClosureInTabSwitcher(boolean isStartSurfaceRefactorEnabled) { final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); SnackbarManager snackbarManager = mActivityTestRule.getActivity().getSnackbarManager(); createTabs(cta, false, 2); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); // Create a tab group. mergeAllNormalTabsToAGroup(cta); verifyTabSwitcherCardCount(cta, 1); assertNotNull(snackbarManager.getCurrentSnackbarForTesting()); // Verify close this tab group and undo in tab switcher. closeFirstTabInTabSwitcher(cta); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoBarController); verifyTabSwitcherCardCount(cta, 0); CriteriaHelper.pollInstrumentationThread(TabUiTestHelper::verifyUndoBarShowingAndClickUndo); verifyTabSwitcherCardCount(cta, 1); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) public void testLongPressTab_entryInTabSwitcher_verifyNoSelectionOccurs( boolean isStartSurfaceRefactorEnable) { TabUiFeatureUtilities.setTabSelectionEditorLongPressEntryEnabledForTesting(true); final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); createTabs(cta, false, 2); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); // LongPress entry to TabSelectionEditor. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.actionOnItemAtPosition(0, longClick())); TabSelectionEditorTestingRobot mSelectionEditorRobot = new TabSelectionEditorTestingRobot(); mSelectionEditorRobot.resultRobot.verifyTabSelectionEditorIsVisible(); // Verify no selection action occurred to switch the selected tab in the tab model Criteria.checkThat( mActivityTestRule.getActivity().getCurrentTabModel().index(), Matchers.is(1)); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) public void testLongPressTabGroup_entryInTabSwitcher(boolean isStartSurfaceRefactorEnable) { TabUiFeatureUtilities.setTabSelectionEditorLongPressEntryEnabledForTesting(true); final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); createTabs(cta, false, 2); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); // Create a tab group. mergeAllNormalTabsToAGroup(cta); verifyTabSwitcherCardCount(cta, 1); // LongPress entry to TabSelectionEditor. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.actionOnItemAtPosition(0, longClick())); TabSelectionEditorTestingRobot mSelectionEditorRobot = new TabSelectionEditorTestingRobot(); mSelectionEditorRobot.resultRobot.verifyTabSelectionEditorIsVisible(); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) public void testLongPressTab_verifyPostLongPressClickNoSelectionEditor( boolean isStartSurfaceRefactorEnabled) { TabUiFeatureUtilities.setTabSelectionEditorLongPressEntryEnabledForTesting(true); final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); createTabs(cta, false, 2); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); // LongPress entry to TabSelectionEditor. onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.actionOnItemAtPosition(0, longClick())); TabSelectionEditorTestingRobot mSelectionEditorRobot = new TabSelectionEditorTestingRobot(); mSelectionEditorRobot.resultRobot.verifyTabSelectionEditorIsVisible(); mSelectionEditorRobot.actionRobot.clickItemAtAdapterPosition(0); mSelectionEditorRobot.resultRobot.verifyItemSelectedAtAdapterPosition(0); Espresso.pressBack(); onView(tabSwitcherViewMatcher()) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); // Check the selected tab in the tab model switches from the second tab to the first to // verify clicking the tab worked. Criteria.checkThat( mActivityTestRule.getActivity().getCurrentTabModel().index(), Matchers.is(0)); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) public void testUndoGroupMergeInTabSwitcher_TabToTab(boolean isStartSurfaceRefactorEnabled) { final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); SnackbarManager snackbarManager = mActivityTestRule.getActivity().getSnackbarManager(); createTabs(cta, false, 2); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 2); // Create a tab group. mergeAllNormalTabsToAGroup(cta); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); // Undo merge in tab switcher. verifyTabSwitcherCardCount(cta, 1); assertEquals("2", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); CriteriaHelper.pollInstrumentationThread(TabUiTestHelper::verifyUndoBarShowingAndClickUndo); verifyTabSwitcherCardCount(cta, 2); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) public void testUndoGroupMergeInTabSwitcher_TabToGroupAdjacent( boolean isStartSurfaceRefactorEnabled) { final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); SnackbarManager snackbarManager = mActivityTestRule.getActivity().getSnackbarManager(); createTabs(cta, false, 3); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 3); // Merge first two tabs into a group. TabModel normalTabModel = cta.getTabModelSelector().getModel(false); List<Tab> tabGroup = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(0), normalTabModel.getTabAt(1))); createTabGroup(cta, false, tabGroup); TestThreadUtils.runOnUiThreadBlocking(() -> { TabGroupTitleUtils.storeTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(0)).getRootId(), "Foo"); }); verifyTabSwitcherCardCount(cta, 2); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); assertEquals("2", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); // Merge tab group of 2 at first index with the 3rd tab. mergeAllNormalTabsToAGroup(cta); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); // Undo merge in tab switcher. verifyTabSwitcherCardCount(cta, 1); assertEquals("3", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); CriteriaHelper.pollInstrumentationThread(TabUiTestHelper::verifyUndoBarShowingAndClickUndo); verifyTabSwitcherCardCount(cta, 2); TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals("Foo", TabGroupTitleUtils.getTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(1)).getRootId())); assertNull(TabGroupTitleUtils.getTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(2)).getRootId())); }); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) public void testUndoGroupMergeInTabSwitcher_GroupToGroupNonAdjacent( boolean isStartSurfaceRefactorEnabled) { final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); SnackbarManager snackbarManager = mActivityTestRule.getActivity().getSnackbarManager(); createTabs(cta, false, 5); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 5); // Merge last two tabs into a group. TabModel normalTabModel = cta.getTabModelSelector().getModel(false); List<Tab> tabGroup = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(3), normalTabModel.getTabAt(4))); createTabGroup(cta, false, tabGroup); verifyTabSwitcherCardCount(cta, 4); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); assertEquals("2", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); // Merge first two tabs into a group. List<Tab> tabGroup2 = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(0), normalTabModel.getTabAt(1))); createTabGroup(cta, false, tabGroup2); verifyTabSwitcherCardCount(cta, 3); TestThreadUtils.runOnUiThreadBlocking(() -> { TabGroupTitleUtils.storeTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(3)).getRootId(), "Foo"); TabGroupTitleUtils.storeTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(1)).getRootId(), "Bar"); }); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); assertEquals("2", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); // Merge the two tab groups into a group. List<Tab> tabGroup3 = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(0), normalTabModel.getTabAt(3))); createTabGroup(cta, false, tabGroup3); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); // Undo merge in tab switcher. verifyTabSwitcherCardCount(cta, 2); assertEquals("4", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); CriteriaHelper.pollInstrumentationThread(TabUiTestHelper::verifyUndoBarShowingAndClickUndo); verifyTabSwitcherCardCount(cta, 3); TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals("Foo", TabGroupTitleUtils.getTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(4)).getRootId())); assertEquals("Bar", TabGroupTitleUtils.getTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(0)).getRootId())); }); } @Test @MediumTest @UseMethodParameter(RefactorTestParams.class) @EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) public void testUndoGroupMergeInTabSwitcher_PostMergeGroupTitleCommit( boolean isStartSurfaceRefactorEnabled) { final ChromeTabbedActivity cta = mActivityTestRule.getActivity(); SnackbarManager snackbarManager = mActivityTestRule.getActivity().getSnackbarManager(); createTabs(cta, false, 3); enterTabSwitcher(cta); verifyTabSwitcherCardCount(cta, 3); // Merge first two tabs into a group. TabModel normalTabModel = cta.getTabModelSelector().getModel(false); List<Tab> tabGroup = new ArrayList<>( Arrays.asList(normalTabModel.getTabAt(0), normalTabModel.getTabAt(1))); createTabGroup(cta, false, tabGroup); TestThreadUtils.runOnUiThreadBlocking(() -> { TabGroupTitleUtils.storeTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(0)).getRootId(), "Foo"); }); verifyTabSwitcherCardCount(cta, 2); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); assertEquals("2", snackbarManager.getCurrentSnackbarForTesting().getTextForTesting()); // Merge tab group of 2 at first index with the 3rd tab. mergeAllNormalTabsToAGroup(cta); assertTrue(snackbarManager.getCurrentSnackbarForTesting().getController() instanceof UndoGroupSnackbarController); // Check that the old group title was deleted when the group merge is committed. TestThreadUtils.runOnUiThreadBlocking(() -> snackbarManager.dismissAllSnackbars()); TestThreadUtils.runOnUiThreadBlocking(() -> { assertNull(TabGroupTitleUtils.getTabGroupTitle( CriticalPersistedTabData.from(normalTabModel.getTabAt(1)).getRootId())); }); } @Test @MediumTest public void testEmptyStateView_DeleteLastNormalTab() throws Exception { prepareTabs(1, 0, NTP_URL); enterGTSWithThumbnailChecking(); // Close the last tab. Tab tab = mActivityTestRule.getActivity().getTabModelSelector().getCurrentTab(); TestThreadUtils.runOnUiThreadBlocking(() -> { mActivityTestRule.getActivity().getTabModelSelector().getCurrentModel().closeTab( tab, false, false, true); }); // Check empty view should show up. onView(allOf(withId(R.id.empty_state_container), withParent(withId(TabUiTestHelper.getTabSwitcherParentId( ApplicationProvider.getApplicationContext()))))) .check(matches(isDisplayed())); } @Test @MediumTest public void testEmptyStateView_ToggleIncognito() throws Exception { mActivityTestRule.loadUrl(mUrl); ChromeTabbedActivity cta = mActivityTestRule.getActivity(); // Prepare one incognito tab and one normal and enter tab switcher. createTabs(cta, true, 1); createTabs(cta, false, 1); enterTabSwitcher(cta); // Go into normal tab switcher. switchTabModel(cta, false); // Close the last normal tab. Tab tab = mActivityTestRule.getActivity().getTabModelSelector().getCurrentTab(); TestThreadUtils.runOnUiThreadBlocking(() -> { mActivityTestRule.getActivity().getTabModelSelector().getCurrentModel().closeTab( tab, false, false, true); }); // Go into incognito tab switcher. switchTabModel(cta, true); // Check empty view should never show up in incognito tab switcher. onView(allOf(withId(R.id.empty_state_container), withParent(withId(TabUiTestHelper.getTabSwitcherParentId( ApplicationProvider.getApplicationContext()))))) .check(matches(not(isDisplayed()))); // Close the last incognito tab. Tab incognitoTab = mActivityTestRule.getActivity().getTabModelSelector().getCurrentTab(); TestThreadUtils.runOnUiThreadBlocking(() -> { mActivityTestRule.getActivity().getTabModelSelector().getCurrentModel().closeTab( incognitoTab, false, false, true); }); // Incognito tab switcher should exit to go to normal tab switcher and we should see empty // view. onView(allOf(withId(R.id.empty_state_container), withParent(withId(TabUiTestHelper.getTabSwitcherParentId( ApplicationProvider.getApplicationContext()))))) .check(matches(isDisplayed())); } private TabSwitcher.TabListDelegate getTabListDelegateFromUIThread() { AtomicReference<TabSwitcher.TabListDelegate> tabListDelegate = new AtomicReference<>(); TestThreadUtils.runOnUiThreadBlocking( () -> tabListDelegate.set(mIsStartSurfaceRefactorEnabled ? mTabSwitcherLayout.getTabSwitcherForTesting() .getTabListDelegate() : mTabSwitcherAndStartSurfaceLayout .getStartSurfaceForTesting() .getGridTabListDelegate())); return tabListDelegate.get(); } private void enterTabSelectionEditor(ChromeTabbedActivity cta) { MenuUtils.invokeCustomMenuActionSync( InstrumentationRegistry.getInstrumentation(), cta, R.id.menu_select_tabs); } /** * TODO(wychen): move some of the callers to {@link TabUiTestHelper#enterTabSwitcher}. */ private void enterGTSWithThumbnailChecking() throws InterruptedException { Tab currentTab = mActivityTestRule.getActivity().getTabModelSelector().getCurrentTab(); // Native tabs need to be invalidated first to trigger thumbnail taking, so skip them. boolean checkThumbnail = !currentTab.isNativePage(); if (checkThumbnail) { TestThreadUtils.runOnUiThreadBlocking(() -> { mActivityTestRule.getActivity().getTabContentManager().removeTabThumbnail( currentTab.getId()); }); } waitForCaptureRateControl(); // TODO(wychen): use TabUiTestHelper.enterTabSwitcher() instead. // Might increase flakiness though. See crbug.com/1024742. LayoutTestUtils.startShowingAndWaitForLayout( mActivityTestRule.getActivity().getLayoutManager(), LayoutType.TAB_SWITCHER, true); // Make sure the fading animation is done. int delta; if (UrlUtilities.isNTPUrl(mActivityTestRule.getActivity() .getCurrentWebContents() .getLastCommittedUrl())) { // NTP is not invalidated, so no new captures. delta = 0; } else { // The final capture at StartSurfaceLayout#finishedShowing time. delta = 1; if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_TO_GTS_ANIMATION) && areAnimatorsEnabled()) { // The faster capturing without writing back to cache. delta += 1; } } TabUiTestHelper.verifyAllTabsHaveThumbnail( mActivityTestRule.getActivity().getCurrentTabModel()); } /** * Like {@link TabUiTestHelper#enterTabSwitcher}, but make sure all tabs have thumbnail. */ private void enterGTSWithThumbnailRetry() { enterTabSwitcher(mActivityTestRule.getActivity()); try { TabUiTestHelper.verifyAllTabsHaveThumbnail( mActivityTestRule.getActivity().getCurrentTabModel()); } catch (AssertionError ae) { // If the last thumbnail is missing, try without animation. Espresso.pressBack(); TestThreadUtils.runOnUiThreadBlocking( () -> mActivityTestRule.getActivity().getLayoutManager().showLayout( LayoutType.TAB_SWITCHER, false)); TabUiTestHelper.verifyAllTabsHaveThumbnail( mActivityTestRule.getActivity().getCurrentTabModel()); } } /** * If thumbnail checking is not needed, use {@link TabUiTestHelper#leaveTabSwitcher} instead. */ private void leaveGTSAndVerifyThumbnailsAreReleased() throws InterruptedException { assertTrue(mActivityTestRule.getActivity().getLayoutManager().isLayoutVisible( LayoutType.TAB_SWITCHER)); TabUiTestHelper.pressBackOnTabSwitcher(mIsStartSurfaceRefactorEnabled, mTabSwitcherLayout, mTabSwitcherAndStartSurfaceLayout); // TODO(wychen): using default timeout or even converting to // OverviewModeBehaviorWatcher shouldn't increase flakiness. LayoutTestUtils.waitForLayout( mActivityTestRule.getActivity().getLayoutManager(), LayoutType.BROWSING); assertThumbnailsAreReleased(); } /** * Enters the GTS and leaves if Start surface refactoring isn't enabled. TODO( */ private void mayEnterGTSAndLeave(ChromeTabbedActivity cta) throws InterruptedException { if (mIsStartSurfaceRefactorEnabled) return; enterTabSwitcher(cta); assertTrue(mActivityTestRule.getActivity().getLayoutManager().isLayoutVisible( LayoutType.TAB_SWITCHER)); TabUiTestHelper.pressBackOnTabSwitcher(mIsStartSurfaceRefactorEnabled, mTabSwitcherLayout, mTabSwitcherAndStartSurfaceLayout); // TODO(wychen): using default timeout or even converting to // OverviewModeBehaviorWatcher shouldn't increase flakiness. LayoutTestUtils.waitForLayout( mActivityTestRule.getActivity().getLayoutManager(), LayoutType.BROWSING); } private void waitForCaptureRateControl() throws InterruptedException { // Needs to wait for at least |kCaptureMinRequestTimeMs| in order to capture another one. // TODO(wychen): find out why waiting is still needed after setting // |kCaptureMinRequestTimeMs| to 0. Thread.sleep(2000); } private void assertThumbnailsAreReleased() { // Could not directly assert canAllBeGarbageCollected() because objects can be in Cleaner. CriteriaHelper.pollUiThread(() -> canAllBeGarbageCollected(mAllBitmaps)); mAllBitmaps.clear(); } private boolean canAllBeGarbageCollected(List<WeakReference<Bitmap>> bitmaps) { for (WeakReference<Bitmap> bitmap : bitmaps) { if (!GarbageCollectionTestUtils.canBeGarbageCollected(bitmap)) { return false; } } return true; } private void simulateJpegHasCachedWithAspectRatio(double aspectRatio) throws IOException { TabModel currentModel = mActivityTestRule.getActivity().getCurrentTabModel(); int jpegWidth = 125; int jpegHeight = (int) (jpegWidth * 1.0 / aspectRatio); for (int i = 0; i < currentModel.getCount(); i++) { Tab tab = currentModel.getTabAt(i); Bitmap bitmap = Bitmap.createBitmap(jpegWidth, jpegHeight, Config.ARGB_8888); encodeJpeg(tab, bitmap); } } private void simulateJpegHasCachedWithDefaultAspectRatio() throws IOException { simulateJpegHasCachedWithAspectRatio( TabUtils.getTabThumbnailAspectRatio(mActivityTestRule.getActivity(), mActivityTestRule.getActivity().getBrowserControlsManager())); } private void simulateAspectRatioChangedToPoint75() throws IOException { TabModel currentModel = mActivityTestRule.getActivity().getCurrentTabModel(); for (int i = 0; i < currentModel.getCount(); i++) { Tab tab = currentModel.getTabAt(i); Bitmap bitmap = TabContentManager.getJpegForTab(tab.getId(), null); bitmap = Bitmap.createScaledBitmap( bitmap, bitmap.getWidth(), (int) (bitmap.getWidth() * 1.0 / 0.75), false); encodeJpeg(tab, bitmap); } } private void encodeJpeg(Tab tab, Bitmap bitmap) throws IOException { FileOutputStream outputStream = new FileOutputStream(TabContentManager.getTabThumbnailFileJpeg(tab.getId())); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, outputStream); outputStream.close(); } private void verifyAllThumbnailHasAspectRatio(double ratio) { TabModel currentModel = mActivityTestRule.getActivity().getCurrentTabModel(); for (int i = 0; i < currentModel.getCount(); i++) { Tab tab = currentModel.getTabAt(i); Bitmap bitmap = TabContentManager.getJpegForTab(tab.getId(), null); double bitmapRatio = bitmap.getWidth() * 1.0 / bitmap.getHeight(); int pixelDelta = Math.abs((int) Math.round(bitmap.getHeight() * ratio) - bitmap.getWidth()); assertTrue("Actual ratio: " + bitmapRatio + "; Expected ratio: " + ratio + "; Pixel delta: " + pixelDelta, pixelDelta <= bitmap.getWidth() * TabContentManager.PIXEL_TOLERANCE_PERCENT); } } private void verifyOnlyOneTabSuggestionMessageCardIsShowing() throws InterruptedException { String suggestionMessageTemplate = mActivityTestRule.getActivity().getString( R.string.tab_suggestion_close_stale_message); String suggestionMessage = String.format(Locale.getDefault(), suggestionMessageTemplate, "3"); prepareTabs(3, 0, mUrl); CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(getTabCountInCurrentTabModel(), Matchers.is(3))); mayEnterGTSAndLeave(mActivityTestRule.getActivity()); enterGTSWithThumbnailChecking(); CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); onView(allOf(withText(suggestionMessage), withParent(withId(R.id.tab_grid_message_item)))) .check(matches(isDisplayed())); leaveGTSAndVerifyThumbnailsAreReleased(); // With soft or hard clean up depends on the soft-cleanup-delay and cleanup-delay params. enterGTSWithThumbnailChecking(); CriteriaHelper.pollUiThread(TabSwitcherCoordinator::hasAppendedMessagesForTesting); // This will fail with error "matched multiple views" when there is more than one suggestion // message card. onView(allOf(withText(suggestionMessage), withParent(withId(R.id.tab_grid_message_item)))) .check(matches(isDisplayed())); } private Matcher<View> tabSwitcherViewMatcher() { return allOf(withParent(withId(TabUiTestHelper.getTabSwitcherParentId( mActivityTestRule.getActivity()))), withId(R.id.tab_list_view)); } }
aa3b629ea07a95869a160d785fce6c310cc660f4
f1d2b441cfff169329045fd8a5c918dd05bf7635
/backend-spring-boot/src/main/java/com/example/tasks/controller/TasksController.java
167e4acaaa736aea56b36ccd2ee035f715345a39
[]
no_license
jfgeiger/tasks
69b341345273087a37272d4e7559bba8e6f557f5
972184418c9ed262a6dc2df35a96985d5ab89b0a
refs/heads/main
2023-01-31T14:31:00.427621
2020-12-14T15:24:58
2020-12-14T15:24:58
321,374,291
0
0
null
null
null
null
UTF-8
Java
false
false
2,732
java
package com.example.tasks.controller; import com.example.tasks.boundary.TasksService; import com.example.tasks.entity.Task; import com.example.tasks.exception.TaskAlreadyExistingException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import java.text.MessageFormat; import java.util.List; import java.util.Objects; import java.util.logging.Logger; @RestController @RequestMapping("api/tasks") public class TasksController { private static final Logger LOGGER = Logger.getLogger(TasksController.class.getName()); private final TasksService tasksService; public TasksController(TasksService tasksService) { this.tasksService = tasksService; } @GetMapping public List<Task> read() { LOGGER.info("GET /tasks"); return this.tasksService.read(); } @PostMapping(consumes = "application/json") public void create(@RequestBody final TaskDTO taskDTO) { final String name = taskDTO.getName(); LOGGER.info(MessageFormat.format("POST /tasks ({0})", name)); this.tasksService.create(name); } @ExceptionHandler({TaskAlreadyExistingException.class}) public ResponseEntity<Void> handleTaskAlreadyExistingException(TaskAlreadyExistingException taskAlreadyExistingException) { final String path = TasksController.getReplacedPath(ServletUriComponentsBuilder.fromCurrentRequestUri()); final String name = taskAlreadyExistingException.getName(); final String location = ServletUriComponentsBuilder.fromCurrentRequestUri() .replacePath(path) .build(name) .toString(); return ResponseEntity.status(HttpStatus.SEE_OTHER) .header(HttpHeaders.LOCATION, location) .build(); } private static String getReplacedPath(ServletUriComponentsBuilder servletUriComponentsBuilder) { final RequestMapping sourceRequestMapping = Objects.requireNonNull(TasksController.class.getAnnotation(RequestMapping.class)); final RequestMapping targetRequestMapping = Objects.requireNonNull(TasksController.class.getAnnotation(RequestMapping.class)); final String relativeSourcePath = String.join("", sourceRequestMapping.value()); final String relativeTargetPath = String.join("", targetRequestMapping.value()); final String absolutePath = Objects.requireNonNull(servletUriComponentsBuilder.build().getPath()); return absolutePath.replace(relativeSourcePath, relativeTargetPath); } }
0498a6e96b8026f53520ccbeeba6328af2c604df
15d1123c07d27e598c5d1056a023f60e2847c458
/src/test/java/be/intecbrussel/jackson/e03_json_property_order/Test.java
2b5ea0fb73afb432cdf61acdde0400cce2026f03
[]
no_license
Mert1980/JSON_Practice
6b5b8588115292f30ac57f697e833b0d071ad5dc
00483680f8bc17b7ee0cce161940464d1affc73f
refs/heads/main
2023-04-18T23:43:44.634789
2021-04-30T07:20:43
2021-04-30T07:20:43
361,004,750
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package be.intecbrussel.jackson.e03_json_property_order; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; public class Test { @org.junit.Test public void whenSerializingUsingJsonPropertyOrder_thenCorrect() throws JsonProcessingException { MyBean bean = new MyBean(1, "My bean"); String result = new ObjectMapper().writeValueAsString(bean); System.out.println(result); assertThat(result, containsString("My bean")); assertThat(result, containsString("1")); } }
f0d30324d8cd7c34357ae93fdc1f4f5f0003f9b7
86a1cf0b6fec24203b9d9ad15a26a7518e599ada
/app/src/main/java/com/example/vinhntph08047_lab3/DetailActivity.java
453ae9939f65ac97f5f198381ec4df53e6fb48ca
[]
no_license
mahuha80/Lab3
de5e3d93e6558b758571b6588421466321729437
3c3540da25714bf42625244cf42102dd6b6f5cc3
refs/heads/master
2022-11-19T20:20:30.006566
2020-07-17T16:37:00
2020-07-17T16:37:00
280,208,395
0
0
null
null
null
null
UTF-8
Java
false
false
2,159
java
package com.example.vinhntph08047_lab3; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; import java.util.List; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; public class DetailActivity extends AppCompatActivity { Disposable disposable; String id; private TextView tvID; private TextView tvModified; private TextView tvTitle; private TextView tvContent; CompositeDisposable compositeDisposable = new CompositeDisposable(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); tvID = (TextView) findViewById(R.id.tvID); tvModified = (TextView) findViewById(R.id.tvModified); tvTitle = (TextView) findViewById(R.id.tvTitle); tvContent = (TextView) findViewById(R.id.tvContent); getAgrument(); getDataFromServer(); } private void getDataFromServer() { disposable = NetModule.getAPIService() .getDetalItem(id) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).subscribe(this::OnSuccess, this::OnFailure); compositeDisposable.add(disposable); } private void OnSuccess(DetailClass detailClasses) { tvID.setText(String.valueOf(detailClasses.getId())); tvContent.setText(detailClasses.getContent().rendered.toString()); tvModified.setText(detailClasses.getModified().toString()); tvTitle.setText(detailClasses.getTitle().toString()); } private void OnFailure(Throwable throwable) { } private void getAgrument() { Intent intent = getIntent(); String id = intent.getStringExtra("id"); this.id = id; } @Override protected void onDestroy() { super.onDestroy(); compositeDisposable.clear(); } }
91b2493dce555b52c3cfce9f76476eb0b9147a14
20c952f4214f5e7817393ce74fdd15b06964e93e
/src/entities/objects/statics/WallTextBoard.java
0a35bdfe89845a94a663d7bc01b0d31ae7668c08
[]
no_license
eggonz/legend-tesla
d339867a1752afde8f99e43e66b23447091aefb6
7bea4a52983cd2f70411f8001a735fd21fb9529a
refs/heads/master
2021-07-07T08:17:12.350014
2021-03-30T09:20:17
2021-03-30T09:20:17
230,483,441
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package entities.objects.statics; import assets.Assets; import entities.Entity; import events.InteractionEvent; import legendtesla.Handler; public class WallTextBoard extends StaticWorldObject { private String text; // TODO change text display public WallTextBoard(Handler handler, int x, int y, String text) { super(handler, x, y, 1, 1, true, new InteractionEvent() { @Override public void trigger(Entity e) { ((WallTextBoard) e).displayText(); } }, Assets.wallTextBoard); this.text = text; } public void displayText(){ handler.getSfxPlayer().play(1); // TODO display text } // Getters and Setters public String getText(){ return text; } }
d7dc24c1ccb7e32c5f7392dadb9812e349602158
8150d9eddf1a9c92ae612d5780b98ad7fd8223de
/src/main/java/com/nelson/project/domain/Project.java
2bb8627a7aee0970525bb4938c01f2471a87fb0f
[]
no_license
NELSON1994/PortalProject
abb025fdc2e894170ff6dd25bcfb5a5d3df9950f
73ab53c60a9a34413a1821915fa6be63ea37525b
refs/heads/master
2020-06-04T13:46:16.080020
2019-06-17T07:57:24
2019-06-17T07:57:24
192,048,488
0
0
null
2019-06-17T07:57:25
2019-06-15T07:09:22
Java
UTF-8
Java
false
false
3,652
java
package com.nelson.project.domain; import com.fasterxml.jackson.annotation.JsonFormat; import javax.persistence.*; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.util.Date; @Entity public class Project { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotBlank(message = "project name is required") private String projectName; @NotBlank(message = "projectidentifier name is required") @Size(min = 4, max = 5, message = "4or 5 characters required") @Column(updatable = false, unique = true) private String projectIdentifier; @NotBlank(message = "project description is required") private String description; @JsonFormat(pattern = "yyyy-mm-dd") private Date start_date; @JsonFormat(pattern = "yyyy-mm-dd") private Date end_date; @JsonFormat(pattern = "yyyy-mm-dd") private Date created_At; @JsonFormat(pattern = "yyyy-mm-dd") private Date updated_At; public Project() { } public Project(String projectName, String projectIdentifier, String description, Date start_date, Date end_date, Date created_At, Date updated_At) { this.projectName = projectName; this.projectIdentifier = projectIdentifier; this.description = description; this.start_date = start_date; this.end_date = end_date; this.created_At = created_At; this.updated_At = updated_At; } public Long getId() { return id; } public Project setId(Long id) { this.id = id; return this; } public String getProjectName() { return projectName; } public Project setProjectName(String projectName) { this.projectName = projectName; return this; } public String getProjectIdentifier() { return projectIdentifier; } public Project setProjectIdentifier(String projectIdentifier) { this.projectIdentifier = projectIdentifier; return this; } public String getDescription() { return description; } public Project setDescription(String description) { this.description = description; return this; } public Date getStart_date() { return start_date; } public Project setStart_date(Date start_date) { this.start_date = start_date; return this; } public Date getEnd_date() { return end_date; } public Project setEnd_date(Date end_date) { this.end_date = end_date; return this; } public Date getCreated_At() { return created_At; } public Project setCreated_At(Date created_At) { this.created_At = created_At; return this; } public Date getUpdated_At() { return updated_At; } public Project setUpdated_At(Date updated_At) { this.updated_At = updated_At; return this; } @PrePersist protected void onCreate(){ this.created_At = new Date(); } @PreUpdate protected void onUpdate(){ this.updated_At = new Date(); } @Override public String toString() { return "Project{" + "id=" + id + ", projectName='" + projectName + '\'' + ", projectIdentifier='" + projectIdentifier + '\'' + ", description='" + description + '\'' + ", start_date=" + start_date + ", end_date=" + end_date + ", created_At=" + created_At + ", updated_At=" + updated_At + '}'; } }
de27683f43a58ed29cea9c8be16baf08b3b35b2f
dade8c6f8a648e0ee399cab770812122c3d15ea3
/src/main/java/ru/sem/repository/NotesRepository.java
ec2a3183263882ede13d2a128af63a27cb2323ed
[]
no_license
ttx777/crudangular
b4362715202dbfe78adde1723c842420302500fd
eacd1941a96422e264cd1a37b9772cc2a7278eea
refs/heads/master
2021-04-28T18:30:34.198759
2018-02-17T17:03:40
2018-02-17T17:03:40
121,874,229
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package ru.sem.repository; import ru.sem.model.Note; import java.util.List; /** * Created by Admin on 08.02.2018. */ public interface NotesRepository { List<Note> getAll(); Note getById(int id); Note save(Note note); boolean delete(int id); }
0fffe06abf10dd16f37745c9eaee7aece44b1c92
6ba962a0990fef972814c7632ea82b16ac6429a5
/src/main/java/co/com/choucair/retobanitsmo/questions/Answer.java
e4e41ffcb8a8e3757889fe817cb69f447a9a809c
[]
no_license
joseale21/RetoBanitsmo
6183b45feee7af57ae174cc6bc16b1ec4949cca6
002fc080854034b3b41258253d74825efc5d88e1
refs/heads/main
2023-07-01T07:25:46.717665
2021-08-03T17:26:10
2021-08-03T17:26:10
392,385,283
0
0
null
null
null
null
UTF-8
Java
false
false
727
java
package co.com.choucair.retobanitsmo.questions; import net.serenitybdd.core.Serenity; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Question; public class Answer implements Question<Boolean> { private String question; public Answer(String question) { this.question = question; } public static Answer toThe(String question) { return new Answer(question); } @Override public Boolean answeredBy(Actor actor) { Boolean result= false; String verifyResult = Serenity.getWebdriverManager().getCurrentDriver().getCurrentUrl(); if (verifyResult.contains(question)){ result = true; } return result; } }
d665ba30cb11e2d48e18251799c2a8e9678a4b4a
9c3ce869e57dcc18118e41fdda886a5a57f85b3a
/JavaGame/test/audio/AudioHandlerTest.java
d4bc15e934c1c77e077654a4f80640be503cc22b
[]
no_license
dipsatch/JavaGame
c80f63565e4e81cc4cd0776b790df6ae313ee604
4a83f6c9c60f0598ab61d50ca0643360675737fa
refs/heads/master
2021-05-08T20:50:00.907410
2018-01-31T02:05:35
2018-01-31T02:05:35
119,620,624
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.redomar.game.audio; import org.junit.Before; import org.junit.Test; import java.io.File; import static org.junit.Assert.*; public class AudioHandlerTest { @Test public void bgMusicExists() throws Exception { File sfx = new File("res/music/Towards The End.mp3"); assertTrue(sfx.exists()); } }
8de25d314621bce9a692a1dd3d687c7c25129583
0f6b8f7da092f9e7b7317187329a427b34cf9dd9
/demo-2/src/main/java/com/datangdu/cn/service/lmpl/EcommerceServicelmpl.java
ed7c4b56a6b26b7e24726cc41bab966bf5da50cc
[]
no_license
Krislee123/xindaSystem
6088b5b386aa23498c104a9907ee0cffbfcf8037
7c76a0a614818e73fd0cd45bf1b73c207a59f945
refs/heads/master
2020-08-31T13:29:57.512315
2019-12-11T06:35:56
2019-12-11T06:35:56
218,700,912
1
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.datangdu.cn.service.lmpl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.datangdu.cn.dao.mapper.BusinessOrderMapper; import com.datangdu.cn.model.bus_order.BusinessOrder; import com.datangdu.cn.model.bus_order.BusinessOrderExample; import com.datangdu.cn.service.EcomerceService; @Service public class EcommerceServicelmpl implements EcomerceService { @Resource BusinessOrderMapper busoMapper; }
86078b83a8817226e72daee55abeb1e2e636f479
aa7f0a996930f6e6c8f894ae3fc584c89b250217
/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/NotifyServiceImpl.java
26a95b34d76e0364d41c7de0b45489a6aa109768
[ "MIT" ]
permissive
dut3062796s/bk-job
17906c71055f9917241d100509f79e56efaa0ef7
1c11c9b8e4ef035d3dcca9266afc63f20e6f4f46
refs/heads/master
2023-06-07T10:53:34.347767
2021-07-05T06:20:28
2021-07-05T06:20:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,167
java
/* * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. * * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. * * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. * * License for BK-JOB蓝鲸智云作业平台: * -------------------------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ package com.tencent.bk.job.execute.service.impl; import com.tencent.bk.job.common.i18n.MessageI18nService; import com.tencent.bk.job.common.i18n.locale.LocaleUtils; import com.tencent.bk.job.common.model.dto.ApplicationInfoDTO; import com.tencent.bk.job.common.model.dto.UserRoleInfoDTO; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.date.DateUtils; import com.tencent.bk.job.execute.client.ServiceNotificationResourceClient; import com.tencent.bk.job.execute.client.ServiceUserResourceClient; import com.tencent.bk.job.execute.common.constants.TaskStartupModeEnum; import com.tencent.bk.job.execute.config.JobExecuteConfig; import com.tencent.bk.job.execute.model.NotifyDTO; import com.tencent.bk.job.execute.model.StepInstanceDTO; import com.tencent.bk.job.execute.model.TaskInstanceDTO; import com.tencent.bk.job.execute.model.TaskNotifyDTO; import com.tencent.bk.job.execute.service.ApplicationService; import com.tencent.bk.job.execute.service.NotifyService; import com.tencent.bk.job.execute.service.TaskInstanceService; import com.tencent.bk.job.manage.common.consts.notify.ExecuteStatusEnum; import com.tencent.bk.job.manage.common.consts.notify.NotifyConsts; import com.tencent.bk.job.manage.common.consts.notify.ResourceTypeEnum; import com.tencent.bk.job.manage.common.consts.notify.TriggerTypeEnum; import com.tencent.bk.job.manage.common.consts.task.TaskStepTypeEnum; import com.tencent.bk.job.manage.model.inner.ServiceNotificationMessage; import com.tencent.bk.job.manage.model.inner.ServiceNotificationTriggerDTO; import com.tencent.bk.job.manage.model.inner.ServiceTemplateNotificationDTO; import com.tencent.bk.job.manage.model.inner.ServiceTriggerTemplateNotificationDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.*; @Slf4j @Service public class NotifyServiceImpl implements NotifyService { private static final Properties templatePropsEN = new Properties(); private static final Properties templatePropsZH = new Properties(); static { loadNotifyTemplate(); } private final JobExecuteConfig jobExecuteConfig; private final ServiceNotificationResourceClient notificationResourceClient; private final ServiceUserResourceClient userResourceClient; private final ApplicationService applicationService; private final TaskInstanceService taskInstanceService; private final MessageI18nService i18nService; @Autowired public NotifyServiceImpl(JobExecuteConfig jobExecuteConfig, ServiceNotificationResourceClient notificationResourceClient, ServiceUserResourceClient userResourceClient, ApplicationService applicationService, TaskInstanceService taskInstanceService, MessageI18nService i18nService) { this.jobExecuteConfig = jobExecuteConfig; this.notificationResourceClient = notificationResourceClient; this.userResourceClient = userResourceClient; this.applicationService = applicationService; this.taskInstanceService = taskInstanceService; this.i18nService = i18nService; } private static void loadNotifyTemplate() { log.info("Load notification template!"); try (InputStream inputStream = new ClassPathResource("notification-template/notification_zh.properties").getInputStream(); InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { templatePropsZH.load(reader); } catch (IOException e) { log.error("Fail to load notification template for ZH", e); } try (InputStream inputStream = new ClassPathResource("notification-template/notification_en.properties").getInputStream(); InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { templatePropsEN.load(reader); } catch (IOException e) { log.error("Fail to load notification template for EN", e); } log.info("Load notification template successfully!"); } private static String formatCostTime(Long costInMills) { if (costInMills == null) { return ""; } if (costInMills < 60_000) { String cost = ""; if (costInMills < 1_000) { DecimalFormat df = new DecimalFormat("0.000"); cost = df.format(costInMills / 1000.0d); } else { DecimalFormat df = new DecimalFormat("#.000"); cost = df.format(costInMills / 1000.0d); } if (isChineseLocale()) { return cost + " 秒"; } else { return cost + " seconds"; } } if (costInMills > 60_000L && costInMills < 3_600_000L) { long minutes = costInMills / 60_000; long seconds = (costInMills - minutes * 60_000) / 1000; if (isChineseLocale()) { return minutes + "分 " + seconds + "秒"; } else { return minutes + " minutes " + seconds + " seconds"; } } else { long hours = costInMills / 3_600_000; long left = costInMills - hours * 3600_000; long minutes = left / 60_000; long seconds = (left - minutes * 60_000) / 1000; if (isChineseLocale()) { return hours + "小时 " + minutes + "分 " + seconds + "秒"; } else { return hours + " hours " + minutes + " minutes " + seconds + " seconds"; } } } private static boolean isChineseLocale() { // Locale locale = LocaleContextHolder.getLocale(); // log.info("locale={}", locale); // return (locale == null || locale.equals(Locale.SIMPLIFIED_CHINESE) || locale.equals(Locale.CHINA)); return true; } @Override public void notifyTaskFail(TaskNotifyDTO taskNotifyDTO) { notifyCommon(taskNotifyDTO, ExecuteStatusEnum.FAIL); } private ServiceNotificationTriggerDTO buildQueryTrigger(TaskNotifyDTO taskNotifyDTO) { ServiceNotificationTriggerDTO trigger = new ServiceNotificationTriggerDTO(); trigger.setAppId(taskNotifyDTO.getAppId()); trigger.setTriggerUser(taskNotifyDTO.getOperator()); Integer startupMode = taskNotifyDTO.getStartupMode(); if (startupMode.equals(TaskStartupModeEnum.NORMAL.getValue())) { trigger.setTriggerType(TriggerTypeEnum.PAGE_EXECUTE.getType()); } else if (startupMode.equals(TaskStartupModeEnum.API.getValue())) { trigger.setTriggerType(TriggerTypeEnum.API_INVOKE.getType()); } else if (startupMode.equals(TaskStartupModeEnum.CRON.getValue())) { trigger.setTriggerType(TriggerTypeEnum.TIMER_TASK.getType()); } else { log.warn("Invalid startup mode!"); } trigger.setResourceExecuteStatus(taskNotifyDTO.getResourceExecuteStatus()); trigger.setResourceType(taskNotifyDTO.getResourceType()); trigger.setResourceId(taskNotifyDTO.getResourceId()); return trigger; } private String buildContentTemplateKey(String executeStatusKey, String channelKey) { return "task." + executeStatusKey + ".msg.content.template." + channelKey; } private String buildTitleTemplateKey(String executeStatusKey, String channelKey) { return "task." + executeStatusKey + ".msg.title.template." + channelKey; } private String getExecuteStatusKey(ExecuteStatusEnum executeStatus) { String executeStatusKey = ""; if (executeStatus == ExecuteStatusEnum.FAIL) { executeStatusKey = "fail"; } else if (executeStatus == ExecuteStatusEnum.SUCCESS) { executeStatusKey = "success"; } else if (executeStatus == ExecuteStatusEnum.READY) { executeStatusKey = "waiting"; } return executeStatusKey; } private String getChannelKey(String channel) { String channelKey = ""; if (StringUtils.isEmpty(channel)) { return "common"; } if (channel.equalsIgnoreCase("weixin")) { channelKey = "weixin"; } else if (channel.equalsIgnoreCase("work-weixin")) { channelKey = "weixin"; } else if (channel.equalsIgnoreCase("sms")) { channelKey = "sms"; } else if (channel.equalsIgnoreCase("mail")) { channelKey = "mail"; } else { channelKey = "common"; } return channelKey; } private String replaceTemplatePlaceHolder(String template, Map<String, String> replacements) { String result = template; for (Map.Entry<String, String> replacement : replacements.entrySet()) { result = result.replaceAll("\\{" + replacement.getKey() + "}", replacement.getValue()); } return result; } private String getTemplate(String key) { if (isChineseLocale()) { return templatePropsZH.getProperty(key); } else { return templatePropsEN.getProperty(key); } } private String buildJobExecuteDetailUrl(Long taskInstanceId) { return jobExecuteConfig.getJobWebUrl() + "/api_execute/" + taskInstanceId; } @Override public void notifyTaskSuccess(TaskNotifyDTO taskNotifyDTO) { notifyCommon(taskNotifyDTO, ExecuteStatusEnum.SUCCESS); } private String getTemplateCodeByExecuteStatus(ExecuteStatusEnum executeStatus) { if (executeStatus == ExecuteStatusEnum.SUCCESS) { return NotifyConsts.NOTIFY_TEMPLATE_CODE_EXECUTE_SUCCESS; } else if (executeStatus == ExecuteStatusEnum.FAIL) { return NotifyConsts.NOTIFY_TEMPLATE_CODE_EXECUTE_FAILURE; } else if (executeStatus == ExecuteStatusEnum.READY) { return NotifyConsts.NOTIFY_TEMPLATE_CODE_CONFIRMATION; } else { log.error("Not supported executeStatus:{}", executeStatus.name()); return null; } } private void notifyCommon(TaskNotifyDTO taskNotifyDTO, ExecuteStatusEnum executeStatus) { ServiceNotificationTriggerDTO trigger = buildQueryTrigger(taskNotifyDTO); ServiceTriggerTemplateNotificationDTO triggerTemplateNotificationDTO = new ServiceTriggerTemplateNotificationDTO(); triggerTemplateNotificationDTO.setTriggerDTO(trigger); triggerTemplateNotificationDTO.setTemplateCode(getTemplateCodeByExecuteStatus(executeStatus)); triggerTemplateNotificationDTO.setVariablesMap(getTemplateVariablesMap(taskNotifyDTO, executeStatus)); notificationResourceClient.triggerTemplateNotification(triggerTemplateNotificationDTO); } private Map<String, String> getTemplateVariablesMap(TaskNotifyDTO taskNotifyDTO, ExecuteStatusEnum executeStatus) { Map<String, String> variablesMap = new HashMap<>(); variablesMap.put("task.id", taskNotifyDTO.getTaskInstanceId().toString()); variablesMap.put("task.name", taskNotifyDTO.getTaskInstanceName()); variablesMap.put("task.app.name", applicationService.getAppById(taskNotifyDTO.getAppId()).getName()); variablesMap.put("task.app.id", String.valueOf(taskNotifyDTO.getAppId())); String detailUrl = buildJobExecuteDetailUrl(taskNotifyDTO.getTaskInstanceId()); variablesMap.put("task.detail.url", detailUrl); variablesMap.put("task.url", detailUrl); TaskInstanceDTO taskInstanceDTO = taskInstanceService.getTaskInstance(taskNotifyDTO.getTaskInstanceId()); variablesMap.put("task.start_time", DateUtils.formatUnixTimestampWithZone(taskInstanceDTO.getStartTime(), ChronoUnit.MILLIS)); List<Long> stepIdList = taskInstanceService.getTaskStepIdList(taskInstanceDTO.getId()); variablesMap.put("task.step.total_seq_cnt", "" + stepIdList.size()); Long currentStepId = taskInstanceDTO.getCurrentStepId(); variablesMap.put("task.step.current_seq_id", "" + (stepIdList.indexOf(currentStepId) + 1)); StepInstanceDTO stepInstanceDTO = taskInstanceService.getStepInstanceDetail(currentStepId); if (executeStatus == ExecuteStatusEnum.FAIL || executeStatus == ExecuteStatusEnum.SUCCESS) { if (stepInstanceDTO.getTotalTime() != null) { variablesMap.put("task.step.duration", "" + stepInstanceDTO.getTotalTime() / 1000.0); } if (taskInstanceDTO.getTotalTime() != null) { variablesMap.put("task.total_duration", "" + taskInstanceDTO.getTotalTime() / 1000.0); } variablesMap.put("task.step.failed_cnt", "" + stepInstanceDTO.getFailIPNum()); variablesMap.put("task.step.success_cnt", "" + stepInstanceDTO.getSuccessIPNum()); } // 国际化处理 Long appId = taskNotifyDTO.getAppId(); ApplicationInfoDTO applicationInfoDTO = applicationService.getAppById(appId); String userLang = JobContextUtil.getUserLang(); if (userLang == null) { String appLang = applicationInfoDTO.getLanguage(); if ("1".equals(appLang)) { userLang = LocaleUtils.LANG_ZH_CN; } else if ("2".equals(appLang)) { userLang = LocaleUtils.LANG_EN_US; } else { log.warn("appLang=null, use zh_CN, appId={}", appId); userLang = LocaleUtils.LANG_ZH_CN; } } Locale locale; if (userLang.equals(LocaleUtils.LANG_ZH_CN) || userLang.equals(LocaleUtils.LANG_ZH)) { locale = Locale.CHINA; } else { locale = Locale.ENGLISH; } if (taskNotifyDTO.getResourceType() == ResourceTypeEnum.SCRIPT.getType()) { variablesMap.put("task.type", i18nService.getI18n("task.type.name.fast_execute_script", locale)); } else if (taskNotifyDTO.getResourceType() == ResourceTypeEnum.FILE.getType()) { variablesMap.put("task.type", i18nService.getI18n("task.type.name.fast_push_file", locale)); } else if (taskNotifyDTO.getResourceType() == ResourceTypeEnum.JOB.getType()) { variablesMap.put("task.type", i18nService.getI18n("task.type.name.job", locale)); } else { variablesMap.put("task.type", "Unknown"); log.error("Not supported resourceType:{}", taskNotifyDTO.getResourceType()); } variablesMap.put("task.operator", taskNotifyDTO.getOperator()); variablesMap.put("current.date", DateUtils.formatLocalDateTime(LocalDateTime.now(), "yyyy-MM-dd")); variablesMap.put("task.step.name", stepInstanceDTO.getName()); if (stepInstanceDTO.getStepType().equals(TaskStepTypeEnum.SCRIPT.getType())) { variablesMap.put("task.step.type", i18nService.getI18n("task.step.type.name.script")); } else if (stepInstanceDTO.getStepType().equals(TaskStepTypeEnum.FILE.getType())) { variablesMap.put("task.step.type", i18nService.getI18n("task.step.type.name.file")); } else if (stepInstanceDTO.getStepType().equals(TaskStepTypeEnum.APPROVAL.getType())) { variablesMap.put("task.step.type", i18nService.getI18n("task.step.type.name.manual_confirm")); } if (executeStatus == ExecuteStatusEnum.SUCCESS) { variablesMap.put("task.cost", formatCostTime(taskNotifyDTO.getCost())); } else if (executeStatus == ExecuteStatusEnum.READY) { variablesMap.put("confirm.message", String.valueOf(taskNotifyDTO.getConfirmMessage())); variablesMap.put("task.step.confirm_info", String.valueOf(taskNotifyDTO.getConfirmMessage())); Set<String> receiverSet = new HashSet<>(taskNotifyDTO.getNotifyDTO().getReceiverUsers()); receiverSet.addAll(userResourceClient.getUsersByRoles( appId, taskNotifyDTO.getOperator(), taskNotifyDTO.getResourceType(), taskNotifyDTO.getResourceId(), new HashSet<>(taskNotifyDTO.getNotifyDTO().getReceiverRoles())).getData() ); variablesMap.put("task.step.confirmer", String.join(",", receiverSet)); } return variablesMap; } private Map<String, ServiceNotificationMessage> buildNotificationMessage(ExecuteStatusEnum executeStatus, Collection<String> notifyChannels, Map<String, String> placeholders) { Map<String, ServiceNotificationMessage> messageMap = new HashMap<>(); for (String notifyChannel : notifyChannels) { String executeStatusKey = getExecuteStatusKey(executeStatus); String channelKey = getChannelKey(notifyChannel); String contentTemplateKey = buildContentTemplateKey(executeStatusKey, channelKey); String titleTemplateKey = buildTitleTemplateKey(executeStatusKey, channelKey); String title = getTemplate(titleTemplateKey); String contentTemplate = getTemplate(contentTemplateKey); if (StringUtils.isBlank(contentTemplate)) { title = getTemplate(buildTitleTemplateKey(executeStatusKey, "common")); contentTemplate = getTemplate(buildContentTemplateKey(executeStatusKey, "common")); } String content = replaceTemplatePlaceHolder(contentTemplate, placeholders); ServiceNotificationMessage notificationMessage = new ServiceNotificationMessage(title, content); messageMap.put(notifyChannel, notificationMessage); } return messageMap; } @Override public void notifyTaskConfirm(TaskNotifyDTO taskNotifyDTO) { if (taskNotifyDTO.getNotifyDTO() != null) { NotifyDTO notifyDTO = taskNotifyDTO.getNotifyDTO(); ServiceTemplateNotificationDTO serviceTemplateNotificationDTO = new ServiceTemplateNotificationDTO(); serviceTemplateNotificationDTO.setAppId(taskNotifyDTO.getAppId()); serviceTemplateNotificationDTO.setActiveChannels(notifyDTO.getChannels()); serviceTemplateNotificationDTO.setTriggerUser(taskNotifyDTO.getOperator()); serviceTemplateNotificationDTO.setResourceType(ResourceTypeEnum.JOB.getType()); serviceTemplateNotificationDTO.setResourceId(taskNotifyDTO.getResourceId()); UserRoleInfoDTO userRoleInfoDTO = new UserRoleInfoDTO(); userRoleInfoDTO.setUserList(notifyDTO.getReceiverUsers()); userRoleInfoDTO.setRoleList(notifyDTO.getReceiverRoles()); serviceTemplateNotificationDTO.setReceiverInfo(userRoleInfoDTO); serviceTemplateNotificationDTO.setTemplateCode(NotifyConsts.NOTIFY_TEMPLATE_CODE_CONFIRMATION); Map<String, String> variablesMap = getTemplateVariablesMap(taskNotifyDTO, ExecuteStatusEnum.READY); serviceTemplateNotificationDTO.setVariablesMap(variablesMap); notificationResourceClient.sendTemplateNotification(serviceTemplateNotificationDTO); } } }
225fdf5e00f59ea999432722773b8f2535a1f039
dfac59fcd76bebeb967de9dfe8a2848331e6fe2d
/src/main/java/com/cnpiec/ireader/config/DruidConfiguration.java
7e8fb7d21f158021fbc0c6c2b52c6e4446a6990f
[]
no_license
miyewd/iReader
618a322b5852abdc56d33396b1d7ee16b26e0f05
81371f55e6b6d05d623fce0e2e48f5627c1d4444
refs/heads/master
2020-04-12T01:10:09.908415
2018-12-18T03:17:08
2018-12-18T03:17:08
162,223,573
0
0
null
null
null
null
UTF-8
Java
false
false
2,304
java
package com.cnpiec.ireader.config; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.alibaba.druid.support.http.StatViewServlet; import com.alibaba.druid.support.http.WebStatFilter; /** * druid 配置. * * 这样的方式不需要添加注解:@ServletComponentScan * * @author Administrator * */ @Configuration public class DruidConfiguration { /** * 注册一个StatViewServlet * * @return */ @Bean public ServletRegistrationBean<StatViewServlet> druidStatViewServle2() { // org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册. ServletRegistrationBean<StatViewServlet> servletRegistrationBean = new ServletRegistrationBean<StatViewServlet>(new StatViewServlet(), "/druid/*"); // 添加初始化参数:initParams // 白名单: servletRegistrationBean.addInitParameter("allow", ""); // IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to // view this page. servletRegistrationBean.addInitParameter("deny", ""); // 登录查看信息的账号密码. servletRegistrationBean.addInitParameter("loginUsername", "admin"); servletRegistrationBean.addInitParameter("loginPassword", "admin"); // 是否能够重置数据. servletRegistrationBean.addInitParameter("resetEnable", "false"); return servletRegistrationBean; } /** * 注册一个:filterRegistrationBean * * @return */ @Bean public FilterRegistrationBean<WebStatFilter> druidStatFilter2() { FilterRegistrationBean<WebStatFilter> filterRegistrationBean = new FilterRegistrationBean<WebStatFilter>(new WebStatFilter()); // 添加过滤规则. filterRegistrationBean.addUrlPatterns("/*"); // 添加不需要忽略的格式信息. filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid2/*"); return filterRegistrationBean; } }
73ca20cbc7f387d6c305117c041235f33ca2fcbc
081b42417479f03cab5046e3337d8ca80d52564d
/drools-planner-core/src/main/java/org/drools/planner/core/domain/solution/SolutionDescriptor.java
813b1eb9d2bbfb8057ffbc26b9545724fbddfdfb
[ "Apache-2.0" ]
permissive
cyrilsochor/drools-planner
bc40e0bc4847ef88cfc706729ee7923bd51157d3
a1bf71943ff47bbb134772fb9b2f31fc0889ccfa
refs/heads/master
2021-01-18T06:20:05.256052
2012-05-16T15:31:36
2012-05-16T15:34:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,660
java
/* * Copyright 2011 JBoss 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 org.drools.planner.core.domain.solution; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.Serializable; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.drools.planner.api.domain.solution.PlanningEntityCollectionProperty; import org.drools.planner.api.domain.solution.PlanningEntityProperty; import org.drools.planner.core.domain.common.DescriptorUtils; import org.drools.planner.core.domain.entity.PlanningEntityDescriptor; import org.drools.planner.core.domain.variable.PlanningVariableDescriptor; import org.drools.planner.core.solution.Solution; public class SolutionDescriptor { private final Class<? extends Solution> solutionClass; private final BeanInfo solutionBeanInfo; private final Map<String, PropertyDescriptor> propertyDescriptorMap; private final Map<String, PropertyDescriptor> entityPropertyDescriptorMap; private final Map<String, PropertyDescriptor> entityCollectionPropertyDescriptorMap; private final Map<Class<?>, PlanningEntityDescriptor> planningEntityDescriptorMap; public SolutionDescriptor(Class<? extends Solution> solutionClass) { this.solutionClass = solutionClass; try { solutionBeanInfo = Introspector.getBeanInfo(solutionClass); } catch (IntrospectionException e) { throw new IllegalStateException("The solutionClass (" + solutionClass + ") is not a valid java bean.", e); } int mapSize = solutionBeanInfo.getPropertyDescriptors().length; propertyDescriptorMap = new HashMap<String, PropertyDescriptor>(mapSize); entityPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>(mapSize); entityCollectionPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>(mapSize); planningEntityDescriptorMap = new HashMap<Class<?>, PlanningEntityDescriptor>(mapSize); } public void processAnnotations() { processPropertyAnnotations(); } private void processPropertyAnnotations() { boolean noPlanningEntityPropertyAnnotation = true; for (PropertyDescriptor propertyDescriptor : solutionBeanInfo.getPropertyDescriptors()) { propertyDescriptorMap.put(propertyDescriptor.getName(), propertyDescriptor); Method propertyGetter = propertyDescriptor.getReadMethod(); if (propertyGetter != null) { if (propertyGetter.isAnnotationPresent(PlanningEntityProperty.class)) { noPlanningEntityPropertyAnnotation = false; entityPropertyDescriptorMap.put(propertyDescriptor.getName(), propertyDescriptor); } else if (propertyGetter.isAnnotationPresent(PlanningEntityCollectionProperty.class)) { noPlanningEntityPropertyAnnotation = false; if (!Collection.class.isAssignableFrom(propertyDescriptor.getPropertyType())) { throw new IllegalStateException("The solutionClass (" + solutionClass + ") has a PlanningEntityCollection annotated property (" + propertyDescriptor.getName() + ") that does not return a Collection."); } entityCollectionPropertyDescriptorMap.put(propertyDescriptor.getName(), propertyDescriptor); } } } if (noPlanningEntityPropertyAnnotation) { throw new IllegalStateException("The solutionClass (" + solutionClass + ") should have at least 1 getter with a PlanningEntityCollection or PlanningEntityProperty" + " annotation."); } } public Class<? extends Solution> getSolutionClass() { return solutionClass; } public PropertyDescriptor getPropertyDescriptor(String propertyName) { return propertyDescriptorMap.get(propertyName); } public void addPlanningEntityDescriptor(PlanningEntityDescriptor planningEntityDescriptor) { planningEntityDescriptorMap.put(planningEntityDescriptor.getPlanningEntityClass(), planningEntityDescriptor); } public Set<Class<?>> getPlanningEntityImplementationClassSet() { return planningEntityDescriptorMap.keySet(); } public Collection<PlanningEntityDescriptor> getPlanningEntityDescriptors() { return planningEntityDescriptorMap.values(); } public boolean hasPlanningEntityDescriptor(Class<?> planningEntityImplementationClass) { PlanningEntityDescriptor planningEntityDescriptor = null; Class<?> planningEntityClass = planningEntityImplementationClass; while (planningEntityClass != null) { planningEntityDescriptor = planningEntityDescriptorMap.get(planningEntityClass); if (planningEntityDescriptor != null) { return true; } planningEntityClass = planningEntityClass.getSuperclass(); } return false; } public PlanningEntityDescriptor getPlanningEntityDescriptor(Class<?> planningEntityImplementationClass) { PlanningEntityDescriptor planningEntityDescriptor = null; Class<?> planningEntityClass = planningEntityImplementationClass; while (planningEntityClass != null) { planningEntityDescriptor = planningEntityDescriptorMap.get(planningEntityClass); if (planningEntityDescriptor != null) { return planningEntityDescriptor; } planningEntityClass = planningEntityClass.getSuperclass(); } throw new IllegalArgumentException("A planningEntity is an instance of a planningEntityImplementationClass (" + planningEntityImplementationClass + ") that is not configured as a planningEntity.\n" + "If that class (" + planningEntityImplementationClass.getSimpleName() + ") is not a " + "planningEntityClass (or subclass thereof), check your Solution implementation's annotated methods.\n" + "If it is, check your solver configuration."); } public Collection<PlanningVariableDescriptor> getChainedVariableDescriptors() { Collection<PlanningVariableDescriptor> chainedVariableDescriptors = new ArrayList<PlanningVariableDescriptor>(); for (PlanningEntityDescriptor entityDescriptor : planningEntityDescriptorMap.values()) { for (PlanningVariableDescriptor variableDescriptor : entityDescriptor.getPlanningVariableDescriptors()) { if (variableDescriptor.isChained()) { chainedVariableDescriptors.add(variableDescriptor); } } } return chainedVariableDescriptors; } public Collection<Object> getAllFacts(Solution solution) { Collection<Object> facts = new ArrayList<Object>(); facts.addAll(solution.getProblemFacts()); for (PropertyDescriptor entityPropertyDescriptor : entityPropertyDescriptorMap.values()) { Object entity = extractPlanningEntity(entityPropertyDescriptor, solution); if (entity != null) { PlanningEntityDescriptor planningEntityDescriptor = getPlanningEntityDescriptor(entity.getClass()); if (planningEntityDescriptor.isInitialized(entity)) { facts.add(entity); } } } for (PropertyDescriptor entityCollectionPropertyDescriptor : entityCollectionPropertyDescriptorMap.values()) { Collection<?> entityCollection = extractPlanningEntityCollection( entityCollectionPropertyDescriptor, solution); for (Object entity : entityCollection) { PlanningEntityDescriptor planningEntityDescriptor = getPlanningEntityDescriptor(entity.getClass()); if (planningEntityDescriptor.isInitialized(entity)) { facts.add(entity); } } } return facts; } public List<Object> getPlanningEntityList(Solution solution) { List<Object> planningEntityList = new ArrayList<Object>(); for (PropertyDescriptor entityPropertyDescriptor : entityPropertyDescriptorMap.values()) { Object entity = extractPlanningEntity(entityPropertyDescriptor, solution); if (entity != null) { planningEntityList.add(entity); } } for (PropertyDescriptor entityCollectionPropertyDescriptor : entityCollectionPropertyDescriptorMap.values()) { Collection<?> entityCollection = extractPlanningEntityCollection( entityCollectionPropertyDescriptor, solution); planningEntityList.addAll(entityCollection); } return planningEntityList; } public List<Object> getPlanningEntityListByPlanningEntityClass(Solution solution, Class<?> planningEntityClass) { List<Object> planningEntityList = new ArrayList<Object>(); for (PropertyDescriptor entityPropertyDescriptor : entityPropertyDescriptorMap.values()) { if (entityPropertyDescriptor.getPropertyType().isAssignableFrom(planningEntityClass)) { Object entity = extractPlanningEntity(entityPropertyDescriptor, solution); if (entity != null && planningEntityClass.isInstance(entity)) { planningEntityList.add(entity); } } } for (PropertyDescriptor entityCollectionPropertyDescriptor : entityCollectionPropertyDescriptorMap.values()) { // TODO if (entityCollectionPropertyDescriptor.getPropertyType().getElementType().isAssignableFrom(planningEntityClass)) { Collection<?> entityCollection = extractPlanningEntityCollection( entityCollectionPropertyDescriptor, solution); for (Object entity : entityCollection) { if (planningEntityClass.isInstance(entity)) { planningEntityList.add(entity); } } } return planningEntityList; } /** * @param solution never null * @return >= 0 */ public int getPlanningEntityCount(Solution solution) { return getPlanningEntityList(solution).size(); } /** * Calculates an indication on how big this problem instance is. * This is intentionally very loosely defined for now. * @param solution never null * @return >= 0 */ public long getProblemScale(Solution solution) { long problemScale = 0L; for (PropertyDescriptor entityPropertyDescriptor : entityPropertyDescriptorMap.values()) { Object entity = extractPlanningEntity(entityPropertyDescriptor, solution); if (entity != null) { PlanningEntityDescriptor planningEntityDescriptor = getPlanningEntityDescriptor(entity.getClass()); problemScale += planningEntityDescriptor.getProblemScale(solution, entity); } } for (PropertyDescriptor entityCollectionPropertyDescriptor : entityCollectionPropertyDescriptorMap.values()) { Collection<?> entityCollection = extractPlanningEntityCollection( entityCollectionPropertyDescriptor, solution); for (Object entity : entityCollection) { PlanningEntityDescriptor planningEntityDescriptor = getPlanningEntityDescriptor(entity.getClass()); problemScale += planningEntityDescriptor.getProblemScale(solution, entity); } } return problemScale; } /** * @param solution never null * @return true if all the planning entities are initialized */ public boolean isInitialized(Solution solution) { for (PropertyDescriptor entityPropertyDescriptor : entityPropertyDescriptorMap.values()) { Object entity = extractPlanningEntity(entityPropertyDescriptor, solution); if (entity == null) { return false; } PlanningEntityDescriptor planningEntityDescriptor = getPlanningEntityDescriptor(entity.getClass()); if (!planningEntityDescriptor.isInitialized(entity)) { return false; } } for (PropertyDescriptor entityCollectionPropertyDescriptor : entityCollectionPropertyDescriptorMap.values()) { Collection<?> entityCollection = extractPlanningEntityCollection( entityCollectionPropertyDescriptor, solution); for (Object entity : entityCollection) { PlanningEntityDescriptor planningEntityDescriptor = getPlanningEntityDescriptor(entity.getClass()); if (!planningEntityDescriptor.isInitialized(entity)) { return false; } } } return true; } private Object extractPlanningEntity(PropertyDescriptor entityPropertyDescriptor, Solution solution) { return DescriptorUtils.executeGetter(entityPropertyDescriptor, solution); } private Collection<?> extractPlanningEntityCollection( PropertyDescriptor entityCollectionPropertyDescriptor, Solution solution) { Collection<?> entityCollection = (Collection<?>) DescriptorUtils.executeGetter(entityCollectionPropertyDescriptor, solution); if (entityCollection == null) { throw new IllegalArgumentException("The solutionClass (" + solutionClass + ")'s entityCollectionProperty (" + entityCollectionPropertyDescriptor.getName() + ") should never return null."); } return entityCollection; } @Override public String toString() { return getClass().getSimpleName() + "(" + solutionClass.getName() + ")"; } }
e9d72950be89011393bf226ba81559e6e1365ca3
69097786402baaa802f781a1dba28bb48960351e
/src/com/fruitjanissary/UI/MainMenuUI.java
90631b84f3aa73a0b7d2c0536903869d240f72e0
[]
no_license
feravsar/FruitJannissary
9e915a612c54df53ccfff16ccd30bdafec3d3fd4
745134835230b70476ce855b0ff47f4dfb4376f9
refs/heads/master
2020-10-01T05:38:30.029960
2019-12-11T22:29:40
2019-12-11T22:29:40
227,469,783
0
0
null
null
null
null
UTF-8
Java
false
false
3,405
java
package com.fruitjanissary.UI; import com.fruitjanissary.Game; import com.fruitjanissary.Player; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.text.Font; public class MainMenuUI extends Pane { Player player; public MainMenuUI(BorderPane stage, Player player) { this.player = player; // ImageView backGround = new ImageView("file:sprites/mainMenuBG.png"); backGround.fitWidthProperty().bind(widthProperty()); backGround.fitHeightProperty().bind(heightProperty()); // Label fruitJanissary = new Label("FRUIT JANISSARY"); fruitJanissary.setFont(Font.loadFont("file:sprites/lsun.otf", 70)); HBox fruitBox = new HBox(); fruitBox.setPrefSize(710, 100); fruitBox.setAlignment(Pos.CENTER); fruitBox.setSpacing(20); fruitBox.setPadding(new Insets(0, 100, 0, 100)); fruitBox.setLayoutX(0); fruitBox.setLayoutY(140); fruitBox.getChildren().add(fruitJanissary); // Button buttonPlay = new Button("PLAY"); buttonPlay.setFont(Font.loadFont("file:sprites/Evogria.otf", 30)); buttonPlay.setFocusTraversable(false); buttonPlay.setPrefSize(150, 40); buttonPlay.setLayoutX(280); buttonPlay.setLayoutY(260); // Button scoreBoard = new Button("Score Board"); scoreBoard.setFont(Font.loadFont("file:sprites/Evogria.otf", 30)); scoreBoard.setFocusTraversable(false); scoreBoard.setPrefSize(250, 40); scoreBoard.setLayoutX(230); scoreBoard.setLayoutY(350); // Label userInfo = new Label(); userInfo.setText("Logged as " + player.getNickname()); userInfo.setFont(Font.loadFont("file:sprites/Evogria.otf", 25)); userInfo.setTextFill(Color.ORANGE); HBox userInfoBox = new HBox(); userInfoBox.setPrefSize(710, 100); userInfoBox.setAlignment(Pos.CENTER); userInfoBox.setSpacing(20); userInfoBox.setPadding(new Insets(0, 100, 0, 100)); userInfoBox.setLayoutX(0); userInfoBox.setLayoutY(420); userInfoBox.getChildren().add(userInfo); // Button logOut = new Button("Log Out"); logOut.setFont(Font.loadFont("file:sprites/Evogria.otf", 25)); logOut.setFocusTraversable(false); logOut.setPrefSize(150, 50); logOut.setLayoutX(280); logOut.setLayoutY(500); // getChildren().addAll(backGround, fruitBox, buttonPlay, scoreBoard, userInfoBox, logOut); // buttonPlay.setOnMouseClicked(e -> { stage.getChildren().remove(this); stage.setCenter(new Game(stage, player)); }); // logOut.setOnMouseClicked(e -> { stage.getChildren().remove(this); stage.setCenter(new LogInUI(stage)); }); scoreBoard.setOnMouseClicked(e->{ stage.getChildren().remove(this); stage.setCenter(new ScoreTableUI(stage,player)); }); } }
0d70996bb2a12af7d2e276cbbcdbdaa41dd98088
d99e6aa93171fafe1aa0bb39b16c1cc3b63c87f1
/stress/src/main/java/com/stress/sub0/sub0/sub3/Class163.java
d433741856b9889aa2ce68e359ecad7b915b8c5d
[]
no_license
jtransc/jtransc-examples
291c9f91c143661c1776ddb7a359790caa70a37b
f44979531ac1de72d7af52545c4a9ef0783a0d5b
refs/heads/master
2021-01-17T13:19:55.535947
2017-09-13T06:31:25
2017-09-13T06:31:25
51,407,684
14
4
null
2017-07-04T10:18:40
2016-02-09T23:11:45
Java
UTF-8
Java
false
false
386
java
package com.stress.sub0.sub0.sub3; import com.jtransc.annotation.JTranscKeep; @JTranscKeep public class Class163 { public static final String static_const_163_0 = "Hi, my num is 163 0"; static int static_field_163_0; int member_163_0; public void method163() { System.out.println(static_const_163_0); } public void method163_1(int p0, String p1) { System.out.println(p1); } }
62bd86319ba0c662164ab9288e6ae6bda62fe0d0
b20c789009e0c631c6dd550e33e31ce613568bf0
/org.eclipse.featuremodel.metamodel/src/org/eclipse/featuremodel/impl/AttributeImpl.java
1eb308b4817dfcec5107859398d5fd886026dbcc
[]
no_license
rytina/featuremodel.metamodel
fa3f7ba1ae8cfc76db84e17657c3af49e9815232
49c8d8ab61549ec592db6c70c682d0dae92c018f
refs/heads/master
2021-01-18T05:04:59.573182
2012-08-07T14:45:24
2012-08-07T14:45:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,907
java
/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.featuremodel.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.featuremodel.Attribute; import org.eclipse.featuremodel.AttributeType; import org.eclipse.featuremodel.AttributeValue; import org.eclipse.featuremodel.Description; import org.eclipse.featuremodel.FeatureModelPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Attribute</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.featuremodel.impl.AttributeImpl#getId <em>Id</em>}</li> * <li>{@link org.eclipse.featuremodel.impl.AttributeImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.featuremodel.impl.AttributeImpl#isSetable <em>Setable</em>}</li> * <li>{@link org.eclipse.featuremodel.impl.AttributeImpl#getDescription <em>Description</em>}</li> * <li>{@link org.eclipse.featuremodel.impl.AttributeImpl#getDefaultValue <em>Default Value</em>}</li> * <li>{@link org.eclipse.featuremodel.impl.AttributeImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class AttributeImpl extends EObjectImpl implements Attribute { /** * The default value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected static final String ID_EDEFAULT = null; /** * The cached value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected String id = ID_EDEFAULT; /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The default value of the '{@link #isSetable() <em>Setable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isSetable() * @generated * @ordered */ protected static final boolean SETABLE_EDEFAULT = false; /** * The cached value of the '{@link #isSetable() <em>Setable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isSetable() * @generated * @ordered */ protected boolean setable = SETABLE_EDEFAULT; /** * The cached value of the '{@link #getDescription() <em>Description</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDescription() * @generated * @ordered */ protected Description description; /** * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDefaultValue() * @generated * @ordered */ protected AttributeValue defaultValue; /** * The cached value of the '{@link #getType() <em>Type</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected AttributeType type; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AttributeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return FeatureModelPackage.Literals.ATTRIBUTE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getId() { return id; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setId(String newId) { String oldId = id; id = newId; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__ID, oldId, id)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetable() { return setable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSetable(boolean newSetable) { boolean oldSetable = setable; setable = newSetable; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__SETABLE, oldSetable, setable)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Description getDescription() { return description; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDescription(Description newDescription, NotificationChain msgs) { Description oldDescription = description; description = newDescription; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__DESCRIPTION, oldDescription, newDescription); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDescription(Description newDescription) { if (newDescription != description) { NotificationChain msgs = null; if (description != null) msgs = ((InternalEObject)description).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FeatureModelPackage.ATTRIBUTE__DESCRIPTION, null, msgs); if (newDescription != null) msgs = ((InternalEObject)newDescription).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FeatureModelPackage.ATTRIBUTE__DESCRIPTION, null, msgs); msgs = basicSetDescription(newDescription, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__DESCRIPTION, newDescription, newDescription)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AttributeValue getDefaultValue() { return defaultValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDefaultValue(AttributeValue newDefaultValue, NotificationChain msgs) { AttributeValue oldDefaultValue = defaultValue; defaultValue = newDefaultValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE, oldDefaultValue, newDefaultValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDefaultValue(AttributeValue newDefaultValue) { if (newDefaultValue != defaultValue) { NotificationChain msgs = null; if (defaultValue != null) msgs = ((InternalEObject)defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE, null, msgs); if (newDefaultValue != null) msgs = ((InternalEObject)newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE, null, msgs); msgs = basicSetDefaultValue(newDefaultValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE, newDefaultValue, newDefaultValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AttributeType getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetType(AttributeType newType, NotificationChain msgs) { AttributeType oldType = type; type = newType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__TYPE, oldType, newType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(AttributeType newType) { if (newType != type) { NotificationChain msgs = null; if (type != null) msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FeatureModelPackage.ATTRIBUTE__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FeatureModelPackage.ATTRIBUTE__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FeatureModelPackage.ATTRIBUTE__TYPE, newType, newType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case FeatureModelPackage.ATTRIBUTE__DESCRIPTION: return basicSetDescription(null, msgs); case FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE: return basicSetDefaultValue(null, msgs); case FeatureModelPackage.ATTRIBUTE__TYPE: return basicSetType(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case FeatureModelPackage.ATTRIBUTE__ID: return getId(); case FeatureModelPackage.ATTRIBUTE__NAME: return getName(); case FeatureModelPackage.ATTRIBUTE__SETABLE: return isSetable() ? Boolean.TRUE : Boolean.FALSE; case FeatureModelPackage.ATTRIBUTE__DESCRIPTION: return getDescription(); case FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE: return getDefaultValue(); case FeatureModelPackage.ATTRIBUTE__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case FeatureModelPackage.ATTRIBUTE__ID: setId((String)newValue); return; case FeatureModelPackage.ATTRIBUTE__NAME: setName((String)newValue); return; case FeatureModelPackage.ATTRIBUTE__SETABLE: setSetable(((Boolean)newValue).booleanValue()); return; case FeatureModelPackage.ATTRIBUTE__DESCRIPTION: setDescription((Description)newValue); return; case FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE: setDefaultValue((AttributeValue)newValue); return; case FeatureModelPackage.ATTRIBUTE__TYPE: setType((AttributeType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case FeatureModelPackage.ATTRIBUTE__ID: setId(ID_EDEFAULT); return; case FeatureModelPackage.ATTRIBUTE__NAME: setName(NAME_EDEFAULT); return; case FeatureModelPackage.ATTRIBUTE__SETABLE: setSetable(SETABLE_EDEFAULT); return; case FeatureModelPackage.ATTRIBUTE__DESCRIPTION: setDescription((Description)null); return; case FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE: setDefaultValue((AttributeValue)null); return; case FeatureModelPackage.ATTRIBUTE__TYPE: setType((AttributeType)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case FeatureModelPackage.ATTRIBUTE__ID: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); case FeatureModelPackage.ATTRIBUTE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case FeatureModelPackage.ATTRIBUTE__SETABLE: return setable != SETABLE_EDEFAULT; case FeatureModelPackage.ATTRIBUTE__DESCRIPTION: return description != null; case FeatureModelPackage.ATTRIBUTE__DEFAULT_VALUE: return defaultValue != null; case FeatureModelPackage.ATTRIBUTE__TYPE: return type != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (id: "); result.append(id); result.append(", name: "); result.append(name); result.append(", setable: "); result.append(setable); result.append(')'); return result.toString(); } } //AttributeImpl
[ "amaass@6b51397f-a277-0410-b26a-91128d44d38f" ]
amaass@6b51397f-a277-0410-b26a-91128d44d38f
de336b739cf82f6faff8b6844c1465bbc59eb151
77997eb4a617052eb59b371f023894122b3b2add
/rest/03RestWithSpring/src/main/java/com/github/alien11689/webservices/restwithspring03/withInterface/ProjectResourceInterface.java
54f72acc135ff0f65ff8f07aa60dfd2dae8f96f3
[]
no_license
alien11689/webservices-in-java
6acc4e5fff8e479c725c3b7e5dbdadfb84b12e31
093aade589e7c94c580ca2e71fa2b041f5a2b1dc
refs/heads/master
2021-01-21T21:54:05.843815
2016-05-19T20:14:12
2016-05-19T20:14:12
35,843,577
1
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.github.alien11689.webservices.restwithspring03.withInterface; import com.github.alien11689.webservices.model.Project; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.Collection; @Path("/withInterface/project") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public interface ProjectResourceInterface { @GET Project get(@QueryParam("name")String name); @POST @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) void create(Project p); @DELETE void deleteProjects(); }
2bc473fa60cb7329d7a6d9d5dc33c1f95aed093d
1e46e1648464f7263fd7386a456b6ac83d70dd46
/app/src/main/java/com/rokomari_coding_test/db_access/TaskDAO.java
d66bbe64023a56ac3fd2b599c17f9653c461d5b8
[]
no_license
shakiz/rokomari_coding_test
b8e3c0ec4bbaa74dbe2591343a74c36d6b8cf91f
ce2c6f6340b4688a27177c1d9fe7323709c7b69f
refs/heads/master
2023-09-02T18:55:57.197454
2021-11-06T14:43:04
2021-11-06T14:43:04
424,696,137
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package com.rokomari_coding_test.db_access; import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; import androidx.room.OnConflictStrategy; import androidx.room.Query; import androidx.room.Update; import com.rokomari_coding_test.model.Task; import java.util.List; @Dao public interface TaskDAO { @Insert void insert(Task task); @Update(onConflict = OnConflictStrategy.REPLACE) void update(Task task); @Delete void delete(Task task); @Query("select * from Task order by RecordId desc") LiveData<List<Task>> getAllTasks(); @Query("SELECT * FROM Task WHERE Status = :status") LiveData<List<Task>> getAllTasksByStatus(int status); }
77ae6856e766f604164b1bc1c47562c0bf29f30b
2b3aab56fdd6bbd222c35198b282a8bc68367f95
/zhh_ec/src/main/java/com/example/zhh/ec/main/index/IndexDataConverter.java
7be1528f91f3cd94907aeae8bf830c444557e01f
[]
no_license
zhh2222/OldFastEc
d3401e57aac5c278216f3d42b037f915d1234e08
8d1af59782adae529fac25bd8ac0c8dde1225c30
refs/heads/master
2020-04-29T10:06:00.118756
2019-03-29T11:35:59
2019-03-29T11:35:59
176,049,097
0
0
null
null
null
null
UTF-8
Java
false
false
2,399
java
package com.example.zhh.ec.main.index; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.example.zhh_ui.recycler.DataConverter; import com.example.zhh_ui.recycler.ItemType; import com.example.zhh_ui.recycler.MultipleFields; import com.example.zhh_ui.recycler.MultipleItemEntity; import java.util.ArrayList; /** * @author brett-zhu * created at 2019/3/9 14:41 */ public class IndexDataConverter extends DataConverter { @Override public ArrayList<MultipleItemEntity> convert() { final JSONArray dataArray = JSON.parseObject(getJsonData()).getJSONArray("data"); final int size = dataArray.size(); for (int i = 0; i < size; i++) { final JSONObject data = dataArray.getJSONObject(i); final String imageUrl = data.getString("imageUrl"); final String text = data.getString("text"); final int spanSize = data.getInteger("spanSize"); final int id = data.getInteger("goodsId"); final JSONArray banners = data.getJSONArray("banners"); final ArrayList<String> bannerImages = new ArrayList<>(); int type = 0; if (imageUrl == null && text != null) { type = ItemType.TEXT; } else if (imageUrl != null && text == null) { type = ItemType.IMAGE; } else if (imageUrl != null) { type = ItemType.TEXT_IMAGE; } else if (banners != null) { type = ItemType.BANNER; //Banner的初始化 final int bannerSize = banners.size(); for (int j = 0; j < bannerSize; j++) { final String banner = banners.getString(j); bannerImages.add(banner); } } final MultipleItemEntity entity = MultipleItemEntity.builder() .setField(MultipleFields.ITEM_TYPE,type) .setField(MultipleFields.SPAN_SIZE,spanSize) .setField(MultipleFields.ID,id) .setField(MultipleFields.TEXT,text) .setField(MultipleFields.IMAGE_URL,imageUrl) .setField(MultipleFields.BANNERS,bannerImages) .build(); ENTITIES.add(entity); } return ENTITIES; } }
73595ecfcd56add8cda4dacfcd15dce599759b13
4dbe4494cca7b405ddeba267def52d5f8b919f8e
/src/main/java/com/hsc/cat/VO/EmployeeDetailsVO.java
9c9fae735c8cc651ca592c30593b4ae3c4354628
[]
no_license
ricks92/cat-orig-junit-5June
87cba7a24dd92281b170f326f4f7c8c60463b971
ac8e13407afd95cd3ce96500f80336ad74ccdf6c
refs/heads/master
2020-03-19T07:57:20.243809
2018-06-11T10:01:44
2018-06-11T10:01:44
136,163,542
0
0
null
null
null
null
UTF-8
Java
false
false
2,699
java
package com.hsc.cat.VO; public class EmployeeDetailsVO { private String username; private String password; private String role; private String firstName; private String lastName; private String department; private String managerId; private String securityQues1; private String securityAns1; private String securityQues2; private String securityAns2; private String email; public EmployeeDetailsVO() { } public EmployeeDetailsVO(String username, String password, String role, String firstName, String lastName, String department, String managerId, String securityQues1, String securityAns1, String securityQues2, String securityAns2, String email) { super(); this.username = username; this.password = password; this.role = role; this.firstName = firstName; this.lastName = lastName; this.department = department; this.managerId = managerId; this.securityQues1 = securityQues1; this.securityAns1 = securityAns1; this.securityQues2 = securityQues2; this.securityAns2 = securityAns2; this.email = email; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getManagerId() { return managerId; } public void setManagerId(String managerId) { this.managerId = managerId; } public String getSecurityQues1() { return securityQues1; } public void setSecurityQues1(String securityQues1) { this.securityQues1 = securityQues1; } public String getSecurityAns1() { return securityAns1; } public void setSecurityAns1(String securityAns1) { this.securityAns1 = securityAns1; } public String getSecurityQues2() { return securityQues2; } public void setSecurityQues2(String securityQues2) { this.securityQues2 = securityQues2; } public String getSecurityAns2() { return securityAns2; } public void setSecurityAns2(String securityAns2) { this.securityAns2 = securityAns2; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
f723bd969f0797e4a01cd710c3970f7d0b0d0c9d
b34d4e31e89b59cb4835ec0bf01de17a5112d1dd
/TEXT1/src/ByteArrayInputStreamDemo.java
ce870de0785f446e1d296775c5706328fabb004e
[]
no_license
jun0315/OOBNpuHomework
1ca71cbc255eecf7213fd64272240e8d17c2ce44
1c5e9201b127b042bda068c80a42bab96083a180
refs/heads/master
2020-04-27T08:42:48.092484
2019-03-06T16:33:32
2019-03-06T16:33:32
174,181,079
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
939
java
//ByteArrayInputStreamDemo.java import java.io.*; public class ByteArrayInputStreamDemo { private static final String NEW_LINE = System.getProperty("line.separator"); public static void main(String[] args) throws IOException { String s = "happy new year!happy everyday!" +NEW_LINE+"wish fulfillment!ÄãºÃ"+NEW_LINE; byte[] bytes = s.getBytes(); ByteArrayInputStream in1 = new ByteArrayInputStream(bytes); /* */ int intTemp = in1.read(); while(intTemp!=-1){ System.out.println(intTemp); //System.out.println(" = "+(char)intTemp); intTemp = in1.read(); } in1.close(); System.err.println("End of byte stream"); /* byte[] buffer = new byte[2048]; int byteLength = in1.read(buffer,0,2048); String str = new String(buffer,0,byteLength); System.out.println(str); in1.close(); System.err.println("End of byte stream"); */ } }
7bbb7a06f43ba9b75b2ee20c2515f74f680af9e5
d97a41ee7e0190050118589e653e1857f0101f0e
/app/src/main/java/codepath/com/codepath_instagram_app/model/Post.java
c3ed777d8dd9045841678dd2effdf8398ff8fd8d
[ "Apache-2.0" ]
permissive
ruth-ann/codepath-instagram-app
05fd7c51c8080e0df25a6751eaa61ad0a84f9aa3
e75b66d6bd1a9a5f9ef2cc6cb3a7954c7119653e
refs/heads/master
2020-06-17T10:23:32.776872
2019-07-13T03:01:22
2019-07-13T03:01:22
195,894,381
0
0
null
null
null
null
UTF-8
Java
false
false
3,599
java
package codepath.com.codepath_instagram_app.model; import com.parse.ParseClassName; import com.parse.ParseFile; import com.parse.ParseObject; import com.parse.ParseQuery; import com.parse.ParseUser; import org.json.JSONArray; import org.json.JSONException; import java.util.ArrayList; import java.util.Date; //ensures that any logic around accessing and mutating the Parse user //object is handled here @ParseClassName("Post") public class Post extends ParseObject { private static String KEY_DESCRIPTION = "description"; private static String KEY_IMAGE = "image"; private static String KEY_USER = "user"; private static String KEY_CREATED_AT = "createdAt"; private static String KEY_LIKED_BY = "likedBy"; //accessors and mutators for our private strings //description public String getDescription(){ return getString(KEY_DESCRIPTION); } public void setDescription(String description){ put(KEY_DESCRIPTION, description); } //image public ParseFile getImage(){ //ParseFile is a class in the SDK that allows us to easily access images return getParseFile(KEY_IMAGE); } public void setImage(ParseFile image){ put(KEY_IMAGE, image); } //user public ParseUser getUser(){ return getParseUser(KEY_USER); } public void setUser(ParseUser user){ put(KEY_USER, user); } //time stamp public Date getCreatedDate() { return getCreatedAt(); } //modifying and accessing like public JSONArray getLikedBy() { JSONArray likedArray = getJSONArray(KEY_LIKED_BY); if (likedArray == null){ return new JSONArray(); }else{ return likedArray; } } public boolean isLiked() { JSONArray likedArray = getLikedBy(); for (int i = 0; i < likedArray.length(); i++){ try{ if (likedArray.getJSONObject(i).getString("objectId").equals(ParseUser.getCurrentUser().getObjectId())){ return true; } }catch (JSONException e){ e.printStackTrace(); } } return false; } public void like() { ParseUser user = ParseUser.getCurrentUser(); add(KEY_LIKED_BY, user); } public void unlike() { ParseUser user = ParseUser.getCurrentUser(); ArrayList<ParseUser> unlikedArray = new ArrayList<>(); unlikedArray.add(user); removeAll(KEY_LIKED_BY, unlikedArray); //removes any user inside this array from the likedBy array on the server } public int getNumLikes() { return getLikedBy().length(); } //query of a post class public static class Query extends ParseQuery<Post> { //constructor public Query(){ super(Post.class); } //gets the top 20 posts public Query getTop(int limit){ setLimit(limit); return this; //builder pattern allows users to chain methods } //the post unpacks the associated user public Query withUser(){ include("user"); return this; } public Query sortDescending(){ addDescendingOrder(KEY_CREATED_AT); return this; } public Query sortAscending(){ addAscendingOrder(KEY_CREATED_AT); return this; } public Query getUserPosts(){ whereEqualTo(KEY_USER, ParseUser.getCurrentUser()); return this; } } }
d1ba207434f1a71811fe961f1d3aca2a5e0da072
aec3d39d9cfca8b0179ff3e0436a593ed2ea4c28
/src/main/java/com/rea/botsim/commands/PlaceCommand.java
85f0f5f4ebb60e7b03136036e8a4809636350b5e
[]
no_license
sujaybhowmick/botsim
55c8a47467d6623e563391995569ab9b03e5e8bd
77cbad977fb119de7d56ee69b5359911e1707959
refs/heads/master
2021-05-02T01:27:20.706665
2017-01-16T10:21:31
2017-01-16T10:21:31
79,054,107
0
0
null
null
null
null
UTF-8
Java
false
false
1,677
java
package com.rea.botsim.commands; import com.rea.botsim.exceptions.InvalidPlacementException; import com.rea.botsim.model.Context; import com.rea.botsim.model.Coordinate; import com.rea.botsim.model.Direction; import com.rea.botsim.model.Position; /** * Author: Sujay Bhowmick * Created Date: 1/15/17 * Name: PlaceCommand.java * Purpose: Robot's Place Command implementation */ public class PlaceCommand implements Command { public final CommandType commandType = CommandType.PLACE; private final String[] parsedArgs; public PlaceCommand(String args) { this.parsedArgs = parseArgs(args); } private String[] parseArgs(String args) { String[] parsedArgs = args.split(","); String[] sanitizedArgs = new String[parsedArgs.length]; for (int i = 0; i < parsedArgs.length; i++) { sanitizedArgs[i] = parsedArgs[i].trim(); } return sanitizedArgs; } @Override public void execute(Context context) { int x = Integer.parseInt(this.parsedArgs[0]); int y = Integer.parseInt(this.parsedArgs[1]); Direction direction = Direction.valueOf(this.parsedArgs[2]); Coordinate origin = new Coordinate(x, y); Position position = new Position(origin, direction); if (context.isValidPlacement(origin)) { context.setCurrentPosition(position); } else { throw new InvalidPlacementException(String.format("Invalid placement position %s", position)); } } @Override public String toString() { return commandType.toString() + " " + parsedArgs[0] + "," + parsedArgs[1] + "," + parsedArgs[2]; } }
df9c0828b0088f41490a0d4feca259fc4270d621
4b4fedbfcbe633875d857941b8d9b926dc46ca7c
/app/src/main/java/com/example/jntuhr13syllabusbook/Mathematics_1.java
c1ea8cbabb4c22cd7bee8939285dc27c3b9492b2
[]
no_license
gnani9999/Android
72f1a2cb8df16e9468d5cea707f51ecc850980d1
e0e1c8ed6eb09196013d4f40ad9537b41648903d
refs/heads/master
2020-06-03T08:12:45.340658
2018-08-20T00:09:25
2018-08-20T00:09:25
94,122,736
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package com.example.jntuhr13syllabusbook; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class Mathematics_1 extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mathematics_1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.mathematics_1, menu); return true; } }
9d26b6e8ebd90d1938533601f976f4d655fab96e
19c1458e0470090256d0a0c7313d0c28d81f346e
/src/main/java/com/notronix/etsy/impl/listings/method/EtsyGetListingInventoryMethod.java
88ab87f52948769f4fd79097ab54881d9203cf36
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Notronix/JEtsy
b7584816b209917ee0d3bc7cbbf5f7665ffe79cc
c2a04ad9e0addab22f622cd148e62f52638e2052
refs/heads/master
2023-07-01T01:11:00.111986
2023-06-24T01:07:03
2023-06-24T01:07:03
197,250,001
9
9
Apache-2.0
2022-10-09T20:15:01
2019-07-16T18:48:44
Java
UTF-8
Java
false
false
2,843
java
package com.notronix.etsy.impl.listings.method; import com.google.api.client.http.HttpContent; import com.notronix.etsy.api.Unmarshaller; import com.notronix.etsy.api.authentication.model.AccessToken; import com.notronix.etsy.api.common.method.OAuthMethod; import com.notronix.etsy.api.listings.method.GetListingInventoryMethod; import com.notronix.etsy.api.listings.model.InventoryIncludes; import com.notronix.etsy.api.listings.model.ListingInventory; import com.notronix.etsy.impl.AbstractEtsyMethod; import com.notronix.etsy.impl.listings.model.EtsyListingInventory; import static com.notronix.etsy.api.MethodUtils.addIfProvided; import static com.notronix.etsy.api.MethodUtils.addIncludes; import static java.util.Objects.requireNonNull; public class EtsyGetListingInventoryMethod extends AbstractEtsyMethod<ListingInventory> implements GetListingInventoryMethod<HttpContent>, OAuthMethod { private AccessToken accessToken; private Long listingId; private Boolean showDeleted; private InventoryIncludes[] includes; @Override public EtsyListingInventory buildResponseBody(Unmarshaller unmarshaller, String payload) { return unmarshaller.unmarshal(payload, EtsyListingInventory.class); } @Override protected String getURI() { String uri = "/application/listings/" + requireNonNull(listingId) + "/inventory"; uri = addIfProvided(uri, "show_deleted", showDeleted); uri = addIncludes(uri, includes); return uri; } public Long getListingId() { return listingId; } @Override public void setListingId(Long listingId) { this.listingId = listingId; } public EtsyGetListingInventoryMethod withListingId(Long listingId) { this.listingId = listingId; return this; } public Boolean getShowDeleted() { return showDeleted; } @Override public void setShowDeleted(Boolean showDeleted) { this.showDeleted = showDeleted; } public EtsyGetListingInventoryMethod withShowDeleted(Boolean showDeleted) { this.showDeleted = showDeleted; return this; } public InventoryIncludes[] getIncludes() { return includes; } @Override public void setIncludes(InventoryIncludes[] includes) { this.includes = includes; } public EtsyGetListingInventoryMethod withIncludes(InventoryIncludes[] includes) { this.includes = includes; return this; } @Override public AccessToken getAccessToken() { return accessToken; } public void setAccessToken(AccessToken accessToken) { this.accessToken = accessToken; } public EtsyGetListingInventoryMethod withAccessToken(AccessToken accessToken) { this.accessToken = accessToken; return this; } }
fa9229389f170731744c590a7ba848d4ed3e36f4
19c103a26a52370eaea9e59a2c4d92ae2a89476b
/devel/HyperSpeedith/src/speedith/openproof/editor/SpiderExternalEditor.java
ace68de2633af9a30cbad4df99e01eed49285a4a
[ "MIT" ]
permissive
ZohrehShams/iCon
eed2c9be7109bd3293f7aa8bb9433fd739a10f26
00714c6d9303db8aba852302bab2ebdb27c25d6d
refs/heads/master
2022-11-17T06:53:31.942329
2020-04-01T09:10:55
2020-04-01T09:10:55
117,549,412
0
0
MIT
2022-11-15T23:22:53
2018-01-15T13:32:59
Java
UTF-8
Java
false
false
1,707
java
package speedith.openproof.editor; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import openproof.awt.OPUndoManager; import openproof.util.Gestalt; import openproof.zen.repeditor.ChangeReporter; import openproof.zen.repeditor.DiagrammaticRepresentationEditor; import speedith.core.lang.SpiderDiagram; import speedith.ui.SpiderDiagramPanel; public class SpiderExternalEditor extends SpiderDiagramPanel implements DiagrammaticRepresentationEditor { private JFrame frame; public SpiderExternalEditor() { super.setFont(new Font(Gestalt.FONT_STRING_NAME_LPL, Font.PLAIN, 10)); } public Color getBackgroundColor() { return null; } public String getTitle() { return "Spider Editor"; } public void init(Color bgcolor) { } public void setBackgroundColor(Color bgcolor) { } /** * Object o must be an array with one element, which is a SpiderDiagram */ public void setEditorInfo(Object o, boolean redraw, boolean focusStep) { if (!focusStep) return; SpiderDiagram d = (SpiderDiagram) ((Object[]) o)[0]; setDiagram(d); showFrame(); } public void setReporter(ChangeReporter r) { } public void setUndoManager(OPUndoManager undoManager) { } public boolean testAndClearInScopeFF() { return false; } public boolean testAndSetInScopeFF() { return true; } public boolean testInScopeFF() { return false; } public void clearInScopeFF() { } /** * Display a JFrame which contains the panel. * Returns the JFrame. */ public JFrame showFrame() { if (frame == null) { frame = new JFrame("Spider"); frame.setSize(300, 200); frame.getContentPane().add(this); frame.pack(); } frame.setVisible(true); return frame; } }
d5fc0da51c2109056d6153c62d1f71cad308e4a7
601e6e57abffb13ba0f66189f07b7d36db75c0fb
/mobile-notification-service/src/main/java/com/mobile/notification/service/NotificationService.java
e041a014c1bea959831f0bc72fb856c198b8b7f4
[ "MIT" ]
permissive
jayeshgangadharan/mobile-notification-api
d71b86bb281979b1db60893db325b7f718c81b0a
0a7413af269d3b70c8256e709609e791c1d2efaf
refs/heads/master
2021-01-23T13:44:58.434235
2015-07-22T04:51:23
2015-07-22T04:51:23
39,259,299
1
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.mobile.notification.service; import com.mobile.notification.dto.Notification; import com.mobile.notification.dto.NotifyResponse; /** * User: Jayesh * Date: 7/17/15 * Time: 12:57 PM */ public interface NotificationService { public NotifyResponse sendNotification(Notification notification); }
05c1a9da16f21c4aa818120452cb8a5ea62eb707
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/CreateLanguageModelRequestMarshaller.java
8a8519f326615d844e5f7149409ed3fa7aa45533
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
3,082
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.transcribe.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.transcribe.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * CreateLanguageModelRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class CreateLanguageModelRequestMarshaller { private static final MarshallingInfo<String> LANGUAGECODE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("LanguageCode").build(); private static final MarshallingInfo<String> BASEMODELNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("BaseModelName").build(); private static final MarshallingInfo<String> MODELNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("ModelName").build(); private static final MarshallingInfo<StructuredPojo> INPUTDATACONFIG_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("InputDataConfig").build(); private static final CreateLanguageModelRequestMarshaller instance = new CreateLanguageModelRequestMarshaller(); public static CreateLanguageModelRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(CreateLanguageModelRequest createLanguageModelRequest, ProtocolMarshaller protocolMarshaller) { if (createLanguageModelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createLanguageModelRequest.getLanguageCode(), LANGUAGECODE_BINDING); protocolMarshaller.marshall(createLanguageModelRequest.getBaseModelName(), BASEMODELNAME_BINDING); protocolMarshaller.marshall(createLanguageModelRequest.getModelName(), MODELNAME_BINDING); protocolMarshaller.marshall(createLanguageModelRequest.getInputDataConfig(), INPUTDATACONFIG_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
f867c50677fc393989fc4dc333f660cb8faad7e8
40de6418fb65bce6d18c3bab7cd029d53b66b27e
/Meus Exercícios em Java/Exercicio Java3/src/modelo/Animal.java
be4e74f02b5bcb53e62bd3e49417265b7f31c7f2
[]
no_license
Hamilton1210/Exercitando-C-digos-em-Java
c0c325cd78d9a9cf7a4d021d21d110bd65daab3b
02ca0c3cd8b15469dda358adfe6290390d0cb15b
refs/heads/master
2020-06-22T05:57:43.256262
2019-07-18T20:25:04
2019-07-18T20:25:04
197,651,103
0
0
null
null
null
null
UTF-8
Java
false
false
870
java
package modelo; public class Animal { private String nomeDoAnimal; private int idade; private String dono; public boolean animalEhMamifero(){ return true; } public String getNomeDoAnimal() { return nomeDoAnimal; } public void setNomeDoAnimal(String nomeDoAnimal) { this.nomeDoAnimal = nomeDoAnimal; } public int getIdade() { return idade; } public void setIdade(int idade) { this.idade = idade; } public String getDono() { return dono; } public void setDono(String dono) { this.dono = dono; } public Animal (){ } public Animal (String nomeDoAnimal, int idade, String dono){ this.nomeDoAnimal = nomeDoAnimal; this.idade = idade; this.dono = dono; } }
b247185191ecaf93f51f8ebb42efc6d67504984a
f316770e07e8a39ede93349ba6d3baa62d7aded4
/src/main/java/com/blitzware/gestaoAPI/model/UserModel.java
73ebe2bb5f3597210a9e946c449d51dd58dfb4a6
[]
no_license
jglopes91/JWT_IMPL
e4e3cda86ae845676cda26d217fe4b47001a92aa
e3b2a5570d2ae77636c26aaa718a1f0ddc35dcda
refs/heads/master
2022-04-08T16:14:25.869884
2020-03-24T21:41:51
2020-03-24T21:41:51
249,824,227
0
0
null
null
null
null
UTF-8
Java
false
false
1,764
java
package com.blitzware.gestaoAPI.model; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Entity @Table(name = "TB_USER") @Getter @Setter @Data @NoArgsConstructor @AllArgsConstructor public class UserModel { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @NotBlank @NotEmpty @Column(name = "STR_EMAIL", unique = true) private String email; @Lob @NotNull @NotEmpty @NotBlank @Column(name = "STR_PASSWORD") private String password; @NotNull @NotEmpty @NotBlank private String fullName; @Temporal(TemporalType.DATE) @Column(name = "DT_CREATED_AT") private Date createdAt = new Date(); @OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) private RoleModel role; @Column(name = "isEnable") private boolean enable = true; public void setPassword(String password) { PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); this.password = passwordEncoder.encode(password); } }
811d347c5842a02821a44e794c12bf136127d994
2d4ea8675c6b575e157c8bcf3a03a8f7d12b408f
/src/main/java/javademo/ArrayBlockingQueueExample.java
5ee16679fdab642a789b03c56bcf0e2cd21372f3
[]
no_license
zhouyang0105/TestDemo
6c9ac2bf664a327c977d92b722a1b757451e007c
38d008ebf049c32018dbf3c5a4b5ec88bc03dfd5
refs/heads/main
2023-08-28T01:43:53.644471
2021-11-10T02:02:07
2021-11-10T02:02:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,801
java
package javademo; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * @ClassName: ArrayBlockingQueueExample * @Description:有界的阻塞队列 * 特点: * 1. ArrayBlockingQueue是一个用数组实现的有界阻塞队列,此队列按照先进先出(FIFO)的原则对元素进行排序。 * 2. ArrayBlockingQueue是基于数组实现的,也就具有数组的特性:一旦初始化,大小就无法修改。 * * @Author: Yangyang * @Date: 2021/10/28 11:27 星期四 * @Version: 1.0 */ public class ArrayBlockingQueueExample { public static void main(String[] args) throws InterruptedException { // add(); // offer(); // put(); // poll(); // peek(); // element(); //remove(); // take(); // size(); // contains; } /** 如果可以在不超过队列的容量的情况下立即将其指定的元素插入到该队列的尾部, 如果队列已满,则返回 true并抛出 IllegalStateException 。 执行结果: =====执行add()签名方法-开始===== arrayBlockingQueue.add()执行返回结果:true arrayBlockingQueue.add()执行返回结果:true arrayBlockingQueue.add()执行返回结果:true Exception in thread "main" java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:98) at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:312) at com.yuanxw.thread.chapter25.ArrayBlockingQueueExample.add(ArrayBlockingQueueExample.java:28) at com.yuanxw.thread.chapter25.ArrayBlockingQueueExample.main(ArrayBlockingQueueExample.java:7) */ public static void add() { System.out.println("=====执行add()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); System.out.println("arrayBlockingQueue.add()执行返回结果:"+arrayBlockingQueue.add("Message 1")); System.out.println("arrayBlockingQueue.add()执行返回结果:"+arrayBlockingQueue.add("Message 2")); System.out.println("arrayBlockingQueue.add()执行返回结果:"+arrayBlockingQueue.add("Message 3")); System.out.println("arrayBlockingQueue.add()执行返回结果:"+arrayBlockingQueue.add("Message 4")); System.out.println("=====执行add()签名方法-结束====="); } /** * 如果可以在不超过队列容量的情况下立即将其指定的元素插入该队列的尾部, * 则在成功时true如果该队列已满,则返回false 。 执行结果: =====执行offer()签名方法-开始===== arrayBlockingQueue.offer()执行返回结果:true arrayBlockingQueue.offer()执行返回结果:true arrayBlockingQueue.offer()执行返回结果:true arrayBlockingQueue.offer()执行返回结果:false =====执行offer()签名方法-结束===== */ public static void offer(){ System.out.println("=====执行offer()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); System.out.println("arrayBlockingQueue.offer()执行返回结果:"+arrayBlockingQueue.offer("Message 1")); System.out.println("arrayBlockingQueue.offer()执行返回结果:"+arrayBlockingQueue.offer("Message 2")); System.out.println("arrayBlockingQueue.offer()执行返回结果:"+arrayBlockingQueue.offer("Message 3")); System.out.println("arrayBlockingQueue.offer()执行返回结果:"+arrayBlockingQueue.offer("Message 4")); System.out.println("=====执行offer()签名方法-结束====="); } /** * 在该队列的尾部插入指定的元素,如果队列已满,则等待空间变为可用。 执行结果: =====执行put()签名方法-开始===== 当前arrayBlockingQueue对象中的个数:3 当前arrayBlockingQueue对象中的容量:0 当前arrayBlockingQueue对象中take()数据值为:Message 1 Message 2 Message 3 Message 4 =====执行put()签名方法-结束===== */ public static void put() throws InterruptedException { System.out.println("=====执行put()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); arrayBlockingQueue.put("Message 1"); arrayBlockingQueue.put("Message 2"); arrayBlockingQueue.put("Message 3"); Executors.newSingleThreadExecutor().execute(()->{ System.out.println("当前arrayBlockingQueue对象中的个数:" + arrayBlockingQueue.size()); System.out.println("当前arrayBlockingQueue对象中的容量:" + arrayBlockingQueue.remainingCapacity()); try { TimeUnit.SECONDS.sleep(5); // 检索并删除此队列的头 Object take = arrayBlockingQueue.take(); System.out.println("当前arrayBlockingQueue对象中take()数据值为:" + take); } catch (InterruptedException e) { e.printStackTrace(); } }); arrayBlockingQueue.put("Message 4"); arrayBlockingQueue.forEach(System.out::println); System.out.println("=====执行put()签名方法-结束====="); } /** * 检索并删除此队列的头,则等待空间变为可用。 执行结果: =====执行poll()签名方法-开始===== 当前arrayBlockingQueue对象中的个数:【3】,容量:【0】 当前arrayBlockingQueue对象中poll()数据值为:Message 1 当前arrayBlockingQueue对象中poll()数据值为:Message 2 当前arrayBlockingQueue对象中的个数:【1】,容量:【2】 当前arrayBlockingQueue对象中poll()数据值为:Message 3 当前arrayBlockingQueue对象中poll()数据值为:null 当前arrayBlockingQueue对象中poll()数据值为:null =====执行poll()签名方法-结束===== */ public static void poll() throws InterruptedException { System.out.println("=====执行poll()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); arrayBlockingQueue.put("Message 1"); arrayBlockingQueue.put("Message 2"); arrayBlockingQueue.put("Message 3"); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中poll()数据值为:" + arrayBlockingQueue.poll()); System.out.println("当前arrayBlockingQueue对象中poll()数据值为:" + arrayBlockingQueue.poll()); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中poll()数据值为:" + arrayBlockingQueue.poll()); System.out.println("当前arrayBlockingQueue对象中poll()数据值为:" + arrayBlockingQueue.poll()); System.out.println("当前arrayBlockingQueue对象中poll()数据值为:" + arrayBlockingQueue.poll()); System.out.println("=====执行poll()签名方法-结束====="); } /** * 检索但不删除此队列的头,如果此队列为空,则返回 null。 执行结果: =====执行peek()签名方法-开始===== 当前arrayBlockingQueue对象中的个数:【3】,容量:【0】 当前arrayBlockingQueue对象中peek()数据值为:Message 1 当前arrayBlockingQueue对象中peek()数据值为:Message 1 当前arrayBlockingQueue对象中的个数:【3】,容量:【0】 当前arrayBlockingQueue对象中peek()数据值为:Message 1 当前arrayBlockingQueue对象中peek()数据值为:Message 1 当前arrayBlockingQueue对象中peek()数据值为:Message 1 =====执行peek()签名方法-结束===== */ public static void peek() throws InterruptedException { System.out.println("=====执行peek()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); arrayBlockingQueue.put("Message 1"); arrayBlockingQueue.put("Message 2"); arrayBlockingQueue.put("Message 3"); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中peek()数据值为:" + arrayBlockingQueue.peek()); System.out.println("当前arrayBlockingQueue对象中peek()数据值为:" + arrayBlockingQueue.peek()); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中peek()数据值为:" + arrayBlockingQueue.peek()); System.out.println("当前arrayBlockingQueue对象中peek()数据值为:" + arrayBlockingQueue.peek()); System.out.println("当前arrayBlockingQueue对象中peek()数据值为:" + arrayBlockingQueue.peek()); System.out.println("=====执行peek()签名方法-结束====="); } /** * 检索,但不删除,这个队列的头。 此方法与peek的不同之处在于,如果此队列为空,它将抛出异常。 执行结果: =====执行element()签名方法-开始===== 当前arrayBlockingQueue对象中的个数:【3】,容量:【0】 当前arrayBlockingQueue对象中take()数据值为:Message 1 当前arrayBlockingQueue对象中take()数据值为:Message 2 当前arrayBlockingQueue对象中take()数据值为:Message 3 当前arrayBlockingQueue对象中的个数:【0】,容量:【3】 Exception in thread "main" java.util.NoSuchElementException at java.util.AbstractQueue.element(AbstractQueue.java:136) at com.yuanxw.thread.chapter25.ArrayBlockingQueueExample.element(ArrayBlockingQueueExample.java:182) at com.yuanxw.thread.chapter25.ArrayBlockingQueueExample.main(ArrayBlockingQueueExample.java:14) */ public static void element() throws InterruptedException { System.out.println("=====执行element()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); arrayBlockingQueue.put("Message 1"); arrayBlockingQueue.put("Message 2"); arrayBlockingQueue.put("Message 3"); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中take()数据值为:" + arrayBlockingQueue.take()); System.out.println("当前arrayBlockingQueue对象中take()数据值为:" + arrayBlockingQueue.take()); System.out.println("当前arrayBlockingQueue对象中take()数据值为:" + arrayBlockingQueue.take()); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中element()数据值为:" + arrayBlockingQueue.element()); System.out.println("=====执行element()签名方法-结束====="); } /** * 检索并删除此队列的头。 此方法与poll不同之处在于,如果此队列为空,它将抛出异常。 执行结果: =====执行remove()签名方法-开始===== 当前arrayBlockingQueue对象中的个数:【3】,容量:【0】 当前arrayBlockingQueue对象中remove()数据值为:Message 1 当前arrayBlockingQueue对象中remove()数据值为:Message 2 当前arrayBlockingQueue对象中remove()数据值为:Message 3 Exception in thread "main" java.util.NoSuchElementException at java.util.AbstractQueue.remove(AbstractQueue.java:117) at com.yuanxw.thread.chapter25.ArrayBlockingQueueExample.remove(ArrayBlockingQueueExample.java:212) at com.yuanxw.thread.chapter25.ArrayBlockingQueueExample.main(ArrayBlockingQueueExample.java:15) */ public static void remove() throws InterruptedException { System.out.println("=====执行remove()签名方法-开始====="); ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(3); arrayBlockingQueue.put("Message 1"); arrayBlockingQueue.put("Message 2"); arrayBlockingQueue.put("Message 3"); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("当前arrayBlockingQueue对象中remove()数据值为:" + arrayBlockingQueue.remove()); System.out.println("当前arrayBlockingQueue对象中remove()数据值为:" + arrayBlockingQueue.remove()); System.out.println("当前arrayBlockingQueue对象中remove()数据值为:" + arrayBlockingQueue.remove()); System.out.println("当前arrayBlockingQueue对象中remove()数据值为:" + arrayBlockingQueue.remove()); System.out.println(String.format("当前arrayBlockingQueue对象中的个数:【%s】,容量:【%s】", arrayBlockingQueue.size(),arrayBlockingQueue.remainingCapacity())); System.out.println("=====执行remove()签名方法-结束====="); } }
f920be1b09604fc470a7506769e670050971c42b
0248a148476caca8a5dd37fdcda921c0081cddf5
/src/com/usr/badcompany/Main.java
de85ffc31227b7659504ed5f4440adfd0232a5e9
[]
no_license
engeloac/controlMusical
9ae5ebd2647d6fcafae911221f995abcdfe6ac25
4fe92836e093f9a16fa7a0c1f1c073adce91d829
refs/heads/master
2021-03-13T01:20:44.676133
2017-05-23T02:38:32
2017-05-23T02:38:32
91,474,476
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.usr.badcompany; import com.local.interfaces.TaddSong; import com.local.interfaces.TmainWindow; /** * * @author sirbobby */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here TaddSong frame = new TaddSong(); frame.setVisible(true); frame.setLocationRelativeTo(null); } }
[ "sirbobby@sirbobby-Inspiron-3442" ]
sirbobby@sirbobby-Inspiron-3442
134bd21f3d7b5c4bafb43d5cdc561831748bf1af
b1e5275db9899c6037d2e353fe35e389bf1abcb4
/game-client/src/main/java/com/s4game/client/ClientMain.java
caee7b8a67051fef44b0c5ab3bc5bf3b7148c2c6
[ "Apache-2.0" ]
permissive
zuesgooogle/game
95f47e76d011bdb4a0addfeae1bf8ce7860d3f97
6d3505a798f33c1a37abeada5e5651d4f792f1f1
refs/heads/master
2020-04-06T07:09:34.292196
2016-09-09T08:45:51
2016-09-09T08:45:51
62,873,406
1
0
null
null
null
null
UTF-8
Java
false
false
987
java
package com.s4game.client; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.s4game.client.spring.ApplicationInit; import com.s4game.core.net.ClientListener; import com.s4game.protocol.Message.Request; public class ClientMain { private static Logger LOG = LoggerFactory.getLogger(ClientMain.class); public static void main(String[] args) throws Exception { ApplicationInit.init(); LOG.info("client starting success."); ClientListener client = ApplicationInit.getApplicationContext().getBean(ClientListener.class); while (true) { Request request = Request.newBuilder() .setCommand(System.currentTimeMillis() + "") .setData("bbbbb000000000000000000000000000") .build(); client.sendMessage(request); TimeUnit.MILLISECONDS.sleep(1); } } }
a4e4913c72abe27d7fe9fec4d899a3ea7faab32a
c318e54efcb62ae1816c0bab462b06c94fcc0a03
/src/com/ithxh/xhh/task/CatchUrlTask.java
021fcf3aa65910be40bba9653681f95c3a64edfd
[ "Apache-2.0" ]
permissive
jianhh/downloadImg
c0455eef3d91688a39d42f6982d360e1f5c2e371
8cdedac13e77562c471b171e50b326acd209d41b
refs/heads/master
2020-12-05T07:41:07.614475
2016-09-11T14:22:37
2016-09-11T14:22:37
66,053,358
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.ithxh.xhh.task; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.SchedulerContext; import org.quartz.SchedulerException; import org.springframework.context.ApplicationContext; import org.springframework.scheduling.quartz.QuartzJobBean; import com.ithxh.xhh.service.impl.LSMAdaptor; public class CatchUrlTask extends QuartzJobBean{ @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { String type = (String) context.getJobDetail().getJobDataMap().get("type"); System.out.println("任务开始:扒取网页地址-->"+type); try { SchedulerContext schCtx = context.getScheduler().getContext(); //获取Spring中的上下文 ApplicationContext appCtx = (ApplicationContext)schCtx.get("applicationContext"); LSMAdaptor lsmAdaptor = (LSMAdaptor) appCtx.getBean("lsmAdaptor"); if (lsmAdaptor==null) { System.out.println("我真的操你妹"); }else { lsmAdaptor.parseForum(); } } catch (SchedulerException e) { e.printStackTrace(); } } }
863b3a910f11c61efd8a152e1da6a34aa66e2e29
deccc9f5abf05c71ac614419b0973f949c4f7d4c
/src/design/principles/programmingToAnInterface/Monitor.java
de3debcaa26772993efe1d2daa18911a9da008e3
[]
no_license
vlasquez/JavaDesignPatterns
0ac830d85d3336ddcddc540de7a2bec451539644
b3219a5901b8f5ca61dac4ae0d56d51a4402f465
refs/heads/master
2020-04-27T09:58:25.723802
2019-11-27T23:02:15
2019-11-27T23:02:15
174,235,722
1
0
null
null
null
null
UTF-8
Java
false
false
208
java
package design.principles.programmingToAnInterface; public class Monitor implements IDisplayModule { @Override public void display() { System.out.println("Display through Monitor"); } }
cb5f50bf087549fa1fffa20e1a951956641894bc
7847606efde553dc43c6ab3b60dada87cfdc873d
/reservation-api/src/main/java/com/marinho/event/driven/example/controller/CreateReservationRequestDto.java
778f60c3eee00b323a6559feef5c0b331d8ae87e
[]
no_license
maxsuelmarinho/spring-boot-event-driven-example
1dfa96329c03dea26ad2596cb5cefa1533dca304
3fce64df10a3762125daa4e891e2f02099eb8d7f
refs/heads/master
2020-03-29T10:14:55.051217
2019-04-01T04:11:41
2019-04-01T04:11:41
149,795,747
1
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.marinho.event.driven.example.controller; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public class CreateReservationRequestDto { private final String name; private final String email; private final int seats; @JsonCreator public CreateReservationRequestDto( @JsonProperty("name") String name, @JsonProperty("email") String email, @JsonProperty("seats") int seats) { this.name = name; this.email = email; this.seats = seats; } public String getName() { return name; } public String getEmail() { return email; } public int getSeats() { return seats; } }
4e171f12511b6686942134b1151742979a403fd7
dfc2d24310b242b6510c2291fc6f737b4930ba7d
/Output/EvoSuite-Generation/test_bpmail3/ch/bluepenguin/email/client/service/impl/EmailFacadeStateEvoSuiteTest.java
94fc8265df304e77836d87bb581ac0a4ead81a51
[]
no_license
jakepetrovic/Jesh_Jacob_QualityOfTestsPaper
e06a97b0b0a1c647cbe499f37b958affff3c34aa
2945d31c76bb4bdc65a7c95061758d9b7c4fe497
refs/heads/master
2016-09-16T04:07:10.088029
2015-07-04T21:10:20
2015-07-04T21:10:20
20,139,705
0
1
null
null
null
null
UTF-8
Java
false
false
4,840
java
/* * This file was automatically generated by EvoSuite */ package ch.bluepenguin.email.client.service.impl; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; import ch.bluepenguin.email.client.service.impl.EmailFacadeState; public class EmailFacadeStateEvoSuiteTest { //Test case number: 0 /* * 4 covered goals: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.setAll(Z)V: I11 Branch 2 IFEQ L48 - false * 2 ch.bluepenguin.email.client.service.impl.EmailFacadeState.setState(Ljava/lang/Integer;Z)V: root-Branch * 3 ch.bluepenguin.email.client.service.impl.EmailFacadeState.<init>()V: root-Branch * 4 ch.bluepenguin.email.client.service.impl.EmailFacadeState.setAll(Z)V: I11 Branch 2 IFEQ L48 - true */ @Test public void test0() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); emailFacadeState0.setState((Integer) null, false); assertEquals(true, emailFacadeState0.isAllClean()); emailFacadeState0.setAll(true); assertEquals(false, emailFacadeState0.isAllClean()); } //Test case number: 1 /* * 1 covered goal: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.clear()V: root-Branch */ @Test public void test1() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); emailFacadeState0.clear(); assertEquals(false, emailFacadeState0.isAllClean()); } //Test case number: 2 /* * 5 covered goals: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isDirty(Ljava/lang/Integer;)Z: I11 Branch 1 IFNONNULL L42 - true * 2 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I5 Branch 3 IFNE L56 - true * 3 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I19 Branch 4 IFEQ L58 - true * 4 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I19 Branch 4 IFEQ L58 - false * 5 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I31 Branch 5 IFEQ L60 - true */ @Test public void test2() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); assertEquals(false, emailFacadeState0.isAllClean()); Integer integer0 = new Integer(469); emailFacadeState0.setState(integer0, false); boolean boolean0 = emailFacadeState0.isAllClean(); assertEquals(true, emailFacadeState0.isAllClean()); assertEquals(true, boolean0); } //Test case number: 3 /* * 1 covered goal: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isDirty(Ljava/lang/Integer;)Z: I11 Branch 1 IFNONNULL L42 - false */ @Test public void test3() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); Integer integer0 = new Integer(0); boolean boolean0 = emailFacadeState0.isDirty(integer0); assertEquals(true, boolean0); } //Test case number: 4 /* * 1 covered goal: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.setAll(Z)V: I11 Branch 2 IFEQ L48 - true */ @Test public void test4() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); emailFacadeState0.setAll(true); assertEquals(false, emailFacadeState0.isAllClean()); } //Test case number: 5 /* * 1 covered goal: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I5 Branch 3 IFNE L56 - false */ @Test public void test5() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); boolean boolean0 = emailFacadeState0.isAllClean(); assertEquals(false, boolean0); } //Test case number: 6 /* * 6 covered goals: * 1 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I31 Branch 5 IFEQ L60 - false * 2 ch.bluepenguin.email.client.service.impl.EmailFacadeState.setState(Ljava/lang/Integer;Z)V: root-Branch * 3 ch.bluepenguin.email.client.service.impl.EmailFacadeState.<init>()V: root-Branch * 4 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I5 Branch 3 IFNE L56 - true * 5 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isAllClean()Z: I19 Branch 4 IFEQ L58 - false * 6 ch.bluepenguin.email.client.service.impl.EmailFacadeState.isDirty(Ljava/lang/Integer;)Z: I11 Branch 1 IFNONNULL L42 - true */ @Test public void test6() throws Throwable { EmailFacadeState emailFacadeState0 = new EmailFacadeState(); Integer integer0 = new Integer((-1398)); emailFacadeState0.setState(integer0, true); boolean boolean0 = emailFacadeState0.isAllClean(); assertEquals(false, emailFacadeState0.isAllClean()); assertEquals(false, boolean0); } }
14a5e48b6b5bf6ea98c62c1597727fc62f86618a
2daf4150dbaf412689170b006baa72c755a1bd8d
/primeraMaven/src/main/java/com/jarroba/ejemplo/primeraMaven/Botones.java
e8b937d94e25a8d1e3ffe0e1dd2fc0464134c78d
[]
no_license
giorocor/MavenFundacionSplai
bb7b50421a69d4a306676c3d3dacd1c72abdf72b
fe5ee5e7c3619f3ac402999cccafe25083c44e79
refs/heads/master
2023-03-17T14:52:10.333640
2021-03-08T13:12:01
2021-03-08T13:12:01
344,442,766
0
0
null
null
null
null
UTF-8
Java
false
false
1,851
java
package com.jarroba.ejemplo.primeraMaven; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JButton; import java.awt.Font; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class Botones extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Botones frame = new Botones(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Botones() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(null); setContentPane(contentPane); final JLabel lblNewLabel = new JLabel("Has pulsado:"); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 20)); lblNewLabel.setBounds(79, 46, 289, 35); contentPane.add(lblNewLabel); final JButton btnNewButton = new JButton("Boton 1"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblNewLabel.setText("Has pulsado: "+" "+btnNewButton.getText()); } }); btnNewButton.setBounds(79, 104, 119, 76); contentPane.add(btnNewButton); final JButton btnNewButton_1 = new JButton("Boton 2"); btnNewButton_1.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblNewLabel.setText("Has pulsado: "+" "+btnNewButton_1.getText()); } }); btnNewButton_1.setBounds(249, 104, 119, 76); contentPane.add(btnNewButton_1); } }
df795de33db73c39df7c58f826e245b5969daafd
b191196816405182488a2b97605a0aac96303749
/app/src/androidTest/java/com/wangbin/androiddemo/ExampleInstrumentedTest.java
c1993b3704a68614040ef3c5457eb9cc0ead6b21
[]
no_license
NiceMobile/DragDemo
e4cc59770cfef7786389aba3d9505018fe3a8699
f4cf0446eb8a1c30d31e7c35dcf76d4233fcb074
refs/heads/master
2020-04-26T18:07:00.675146
2019-03-04T12:07:15
2019-03-04T12:07:15
173,734,652
0
0
null
null
null
null
UTF-8
Java
false
false
730
java
package com.wangbin.androiddemo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.wangbin.androiddemo", appContext.getPackageName()); } }
8a4eb64e0b2c05bbed6602186b3b4fede2ce16d9
65e0dc397fba29c5258013fbed812984604e012c
/MasterMindTest/Game.java
595d43cc59ed48ade3e7e8c5e9bcba19538c5b2f
[]
no_license
veyselkurhan/TDDexamples
2000571130a9e2973a155049155398129ee49cfb
55480d2acc17810363895d1975ffcb9f8eab59ed
refs/heads/master
2021-01-16T21:00:35.833047
2016-06-18T10:06:35
2016-06-18T10:06:35
61,416,501
0
0
null
null
null
null
UTF-8
Java
false
false
2,079
java
import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; public class Game { int realnumber; int counter=0; ArrayList<Integer>digits=new ArrayList<Integer>(); Predictions lastPrediction=new Predictions(); public Game() { realnumber=createRandomNumber(); } public boolean correctPrediction(int a) { if(a==realnumber)return true; return false; } public ArrayList<Integer> theMakeDigits(int a) {ArrayList<Integer>digits=new ArrayList<Integer>(); int digit=a/1000; digits.add(digit); a=a%1000; digit=a/100; digits.add(digit); a=a%100; digit=a/10; digits.add(digit); a=a%10; digits.add(a); return digits; } public String wrongPrediction(int a){ int wrongPlace=0; int correctPlace=0; ArrayList<Integer>realDigits=theMakeDigits(realnumber); ArrayList<Integer>predictionDigits=theMakeDigits(a); for(int c=0;c<realDigits.size();c++) { if(realDigits.contains(predictionDigits.get(c))) { if(predictionDigits.get(c)==realDigits.get(c))correctPlace++; else wrongPlace++; } } return correctPlace+"+"+" "+wrongPlace+"-"; } public void predict(Predictions p) { lastPrediction=p; counter++; if(p.number==realnumber){ finish(); } else wrongPrediction(p.number); } public int getRealNumber() { return realnumber; } public void finish(){ System.out.println("congratulations! you completed in tries"+getCounter()); } public int getCounter(){ return counter++; } public int createRandomNumber() { ArrayList<Integer>numbers=new ArrayList<Integer>(); ArrayList<Integer>random=new ArrayList<Integer>(); for(int a=0;a<10;a++) numbers.add(a); Collections.shuffle(numbers); for(int a=0;a<4;a++) { if(a==0) { while(numbers.get(a)==0) { Collections.shuffle(numbers); } random.add(numbers.get(a)); } else { while(random.contains(numbers.get(a))) { Collections.shuffle(numbers); } random.add(numbers.get(a)); } String randomNumber=""; for(int c=0;c<random.size();c++) { randomNumber+=random.get(c); } realnumber=Integer.parseInt(randomNumber); } return realnumber; } }
c5ae5869c1902cdbe673d360ea6d4b11eae53545
3642344f84b736286c0f1a2cd4ef8d86fd754454
/core/jreleaser-model/src/main/java/org/jreleaser/model/Environment.java
8392b35b81d0c27ceefcbe9d1aff64a4f27c6f4c
[ "Apache-2.0" ]
permissive
wmacgyver/jreleaser
553202e21af455d896be347baa923876d71f8d9e
dc4bb3770b4e411b18465d7477985f2b4ed02814
refs/heads/main
2023-09-03T11:20:57.105638
2021-11-17T09:12:42
2021-11-17T09:12:42
428,939,590
0
0
Apache-2.0
2021-11-17T06:54:21
2021-11-17T06:54:20
null
UTF-8
Java
false
false
7,056
java
/* * SPDX-License-Identifier: Apache-2.0 * * Copyright 2020-2021 The JReleaser authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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.jreleaser.model; import org.jreleaser.bundle.RB; import org.jreleaser.config.JReleaserConfigLoader; import org.jreleaser.config.JReleaserConfigParser; import org.jreleaser.util.Env; import java.io.FileInputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; import java.util.Properties; import java.util.ServiceLoader; import static org.jreleaser.util.StringUtils.getPropertyNameForLowerCaseHyphenSeparatedName; import static org.jreleaser.util.StringUtils.isBlank; import static org.jreleaser.util.StringUtils.isNotBlank; /** * @author Andres Almiray * @since 0.1.0 */ public class Environment implements Domain { private final Map<String, Object> properties = new LinkedHashMap<>(); private PropertiesSource propertiesSource; private String variables; private Properties vars; private Path propertiesFile; void setAll(Environment environment) { this.variables = environment.variables; setProperties(environment.properties); setPropertiesSource(environment.propertiesSource); } public String getVariable(String key) { return vars.getProperty(Env.prefix(key)); } public boolean isSet() { return isNotBlank(variables) || !properties.isEmpty(); } public PropertiesSource getPropertiesSource() { return propertiesSource; } public void setPropertiesSource(PropertiesSource propertiesSource) { this.propertiesSource = propertiesSource; if (null != this.propertiesSource) { properties.putAll(propertiesSource.getProperties()); } } public String getVariables() { return variables; } public void setVariables(String variables) { this.variables = variables; } public Map<String, Object> getProperties() { return properties; } public void setProperties(Map<String, Object> properties) { this.properties.putAll(properties); } public Path getPropertiesFile() { return propertiesFile; } @Override public Map<String, Object> asMap(boolean full) { Map<String, Object> map = new LinkedHashMap<>(); map.put("variables", variables); map.put("properties", properties); return map; } public void initProps(JReleaserContext context) { if (null == vars) { vars = new Properties(); String home = System.getenv("JRELEASER_USER_HOME"); if (isBlank(home)) { home = System.getProperty("user.home"); } Path configDirectory = Paths.get(home).resolve(".jreleaser"); loadVariables(context, resolveConfigFileAt(configDirectory) .orElse(configDirectory.resolve("config.properties"))); if (isNotBlank(variables)) { loadVariables(context, context.getBasedir().resolve(variables.trim())); } if (null != propertiesSource) { properties.putAll(propertiesSource.getProperties()); } } } private void loadVariables(JReleaserContext context, Path file) { propertiesFile = file; context.getLogger().info(RB.$("environment.load.variables"), file.toAbsolutePath()); if (Files.exists(file)) { try { if (file.getFileName().toString().endsWith(".properties")) { try (FileInputStream in = new FileInputStream(file.toFile())) { vars.load(in); } } else { vars.putAll(JReleaserConfigLoader.loadProperties(file)); } } catch (IOException e) { context.getLogger().debug(RB.$("environment.variables.load.error"), file.toAbsolutePath(), e); } } else { context.getLogger().warn(RB.$("environment.variables.source.missing"), file.toAbsolutePath()); } } private Optional<Path> resolveConfigFileAt(Path directory) { ServiceLoader<JReleaserConfigParser> parsers = ServiceLoader.load(JReleaserConfigParser.class, JReleaserConfigParser.class.getClassLoader()); for (JReleaserConfigParser parser : parsers) { Path file = directory.resolve("config." + parser.getPreferredFileExtension()); if (Files.exists(file)) { return Optional.of(file); } } return Optional.empty(); } public interface PropertiesSource { Map<String, String> getProperties(); } public static abstract class AbstractPropertiesSource implements PropertiesSource { @Override public Map<String, String> getProperties() { Map<String, String> props = doGetProperties(); Map<String, String> map = new LinkedHashMap<>(); props.forEach((key, value) -> { if (key.startsWith("JRELEASER_")) return; String k = key.replace(".", "-"); k = getPropertyNameForLowerCaseHyphenSeparatedName(k); map.put(k, value); }); return map; } protected abstract Map<String, String> doGetProperties(); } public static class PropertiesPropertiesSource extends AbstractPropertiesSource { private final Properties properties; public PropertiesPropertiesSource(Properties properties) { this.properties = properties; } @Override protected Map<String, String> doGetProperties() { Map<String, String> map = new LinkedHashMap<>(); properties.forEach((k, v) -> map.put(String.valueOf(k), String.valueOf(v))); return map; } } public static class MapPropertiesSource extends AbstractPropertiesSource { private final Map<String, ?> properties; public MapPropertiesSource(Map<String, ?> properties) { this.properties = properties; } @Override protected Map<String, String> doGetProperties() { Map<String, String> map = new LinkedHashMap<>(); properties.forEach((k, v) -> map.put(k, String.valueOf(v))); return map; } } }
957d9db148a8cf3c9cece8e4d6d237125bc6085b
bdbe5a43b629821d04c6f27dc86bd6671a859cd5
/src/main/java/com/yundao/customer/h5/util/ArgsUtils.java
05ce473faa37f388ecb2c6fd16c7e425fc40fbda
[]
no_license
wucaiqiang/yundao-customer_h5
dabc4f26b1f4c0c3561384044571642cc5b16010
f27c4acae98bbd70d1587c66cac55e65532a93ab
refs/heads/master
2021-08-30T15:03:15.191146
2017-12-18T11:16:00
2017-12-18T11:16:00
114,631,913
0
0
null
null
null
null
UTF-8
Java
false
false
2,801
java
package com.yundao.customer.h5.util; import com.yundao.core.code.config.CommonCode; import com.yundao.core.exception.BaseRuntimeException; import com.yundao.core.log.Log; import com.yundao.core.log.LogFactory; import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.apache.commons.lang3.StringUtils; /** * 参数工具类 * * @author jan * @create 2017-07-01 PM3:40 **/ public class ArgsUtils { private static Log log = LogFactory.getLog(ArgsUtils.class); /** * Bean转换为Map * * @param obj Bean实体 * @return Map */ public static Map<String, Object> toMap(Object obj) { if(obj == null){ return null; } Map<String, Object> map = new HashMap<String, Object>(); try { BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor property : propertyDescriptors) { String key = property.getName(); // 过滤class属性,paginationSupport分页属性 if (!key.equals("class") && !key.equals("paginationSupport")) { // 得到property对应的getter方法 Method getter = property.getReadMethod(); Object value = getter.invoke(obj); if(value !=null && StringUtils.isNotBlank(String.valueOf(value))){ if(value instanceof Date){ SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); String dataStr=format.format(value); map.put(key, dataStr); continue; } map.put(key, value); } } } } catch (Exception e) { throw new BaseRuntimeException(CommonCode.COMMON_1007, e); } return map; } /** * 单参数转换为map * * @param obj 值 * @param keyName map的键 * @return map */ public static Map<String, Object> toIdMap(Object obj, String keyName) { Map<String, Object> map = new HashMap<>(1); map.put(keyName, obj); return map; } /** * id转换为map * * @param obj id值 * @return map */ public static Map<String, Object> toIdMap(Object obj) { Map<String, Object> map = new HashMap<>(1); map.put("id", obj); return map; } }
594edce7973f322e5684e3a23010504b8d1f6757
c24b09bd2a7e77058370e94dee4f3ac0d893666c
/system-common/src/main/java/com/cctv/service/SysDictionariesService.java
b5d1d4c9965d0ddd53cb8f3b089a87fcf159097c
[]
no_license
Han153653/system-aliyun
07bd093133a8aae8d18b9d9ceb21a36332da4f3a
287986cc1ce33c80e29687bab9a57d39049794c4
refs/heads/master
2022-07-15T04:06:40.748478
2019-12-30T08:20:52
2019-12-30T08:20:52
230,839,956
0
0
null
2022-07-06T20:45:48
2019-12-30T03:21:46
Java
UTF-8
Java
false
false
1,765
java
package com.cctv.service; import com.cctv.entity.SysDictionariesEntity; import java.util.List; import java.util.Map; /** * 字典表 * */ public interface SysDictionariesService { SysDictionariesEntity queryObject(Long id); List<SysDictionariesEntity> queryList(Map<String, Object> map); int queryTotal(Map<String, Object> map); void save(SysDictionariesEntity sysDictionaries); void update(SysDictionariesEntity sysDictionaries); void delete(Long id); void deleteBatch(Long[] ids); /** * 查询字典树 * @return */ public List<SysDictionariesEntity> queryListForDictTree(); /** * 根据父级id查询 * @param parentId * @return */ public List<SysDictionariesEntity> queryDictionaryByParentId(Long parentId); /** * 根据父级id查询子类 * @param params * @return */ public List<SysDictionariesEntity> queryDicByParentIds(Map<String,Object> params); /** * 根据条件查询 * @param params * @return */ public List<SysDictionariesEntity> queryDictionaryByCondition(Map<String,Object> params); /** * 根据code条件查询 * @param code * @return */ public String getValueByCode(String code); /** * 根据父类编码查询子类 * @param code * @return */ public List<SysDictionariesEntity> queryDictionaryByParentCode(String code); /** * 根据父类编码查询子类编码和值 * @param code * @return */ public Map<String,Object> getCodeValueByParentCode(String code); /** * 根据父类编码查询子类 * @param code * @return */ public List<Map<String,Object>> queryDictionaryMapByParentCode(String code); /** * 依据code查询信息 * @param string * @return */ SysDictionariesEntity queryDictionaryByCode(String code); }
[ "CTVIT@DESKTOP-DHKS90T" ]
CTVIT@DESKTOP-DHKS90T
7a2b67624f2a4a79ca0365de6a51b428d1786e2a
5d9f48a6b40be10116edf97a1abac7d9b8b94e2b
/Calculator/src/Main.java
7a46f1bf14a5c87a0264997ba835a67d11510691
[]
no_license
balram12345/Calculator
15ac751c66ebcd0fb6e8d1b141ad2e6962c446ba
36264a9eb93012f2ac405d6891af29bba5ce8b1b
refs/heads/master
2020-09-27T08:46:29.448573
2019-12-07T08:25:32
2019-12-07T08:25:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
import javax.swing.*; import java.awt.event.*; public class Main extends JFrame implements ActionListener { JButton b1,b2,b3,b4,b5; Main() { setSize(500,500); setVisible(true); setLayout(null); b1=new JButton("Calculator"); b1.setBounds(50,50,200,100); b1.addActionListener(this); add(b1); } public static void main(String args[]) { Main m=new Main(); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource()==b1) { Calculator c=new Calculator(); } } }
263bea9155bea3eaae67edf7dafdb8286316d0e8
ade5e4c34a709c13bf8e391f2224c54493f1110f
/src/main/java/cn/wolfcode/crm/service/impl/CheckinginServiceImpl.java
1cf3d6ad30c9a2ca3b446b794cdf9c348bdce2b6
[]
no_license
fhlbjay/carinsurance-linzhijian-
6384ddb1acbcdb62bb0f686d0b3ee5cc92b58f26
72f4f0d08a2a13a947c4f93f3084ab159d342565
refs/heads/master
2021-03-16T05:56:07.675433
2017-12-27T13:49:37
2017-12-27T13:49:37
115,525,725
0
0
null
null
null
null
UTF-8
Java
false
false
2,211
java
package cn.wolfcode.crm.service.impl; import cn.wolfcode.crm.domain.Checkingin; import cn.wolfcode.crm.domain.Employee; import cn.wolfcode.crm.mapper.CheckinginMapper; import cn.wolfcode.crm.page.PageResult; import cn.wolfcode.crm.query.QueryObject; import cn.wolfcode.crm.service.ICheckinginService; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; @Service public class CheckinginServiceImpl implements ICheckinginService { @Autowired CheckinginMapper checkinginMapper; @Override public int insert() { Checkingin record = new Checkingin(); // 获取当前对象 Subject currentUser = SecurityUtils.getSubject(); Employee principal = (Employee) currentUser.getPrincipal(); record.setEmpId(principal); return checkinginMapper.insert(record); } @Override public int back(Checkingin record) { // 获取当前对象 Subject currentUser = SecurityUtils.getSubject(); Employee principal = (Employee) currentUser.getPrincipal(); record.setEmpId(principal); return checkinginMapper.back(record); } @Override public int updata(Checkingin record) { // 获取当前对象 Subject currentUser = SecurityUtils.getSubject(); Employee principal = (Employee) currentUser.getPrincipal(); record.setEmpId(principal); return checkinginMapper.updata(record); } @Override public PageResult query(QueryObject queryObject) { int count = checkinginMapper.queryCount(queryObject); if (count > 0) { return new PageResult(count, checkinginMapper.queryList(queryObject)); } return new PageResult(count, Collections.emptyList()); } @Override public int deleteByPrimaryKey(Long id) { // TODO Auto-generated method stub return 0; } @Override public Checkingin selectByPrimaryKey(Long id) { // TODO Auto-generated method stub return null; } @Override public List<Checkingin> selectAll() { // TODO Auto-generated method stub return null; } @Override public int updateByPrimaryKey(Checkingin record) { // TODO Auto-generated method stub return 0; } }
0d9ee05c62eea57f4f2a83a06ecd0d67890b8190
bdf922e940dd74785b6415d2f0554f22ce18864e
/app/src/main/java/net/glochat/dev/utils/NumberFormatter.java
206a2d8f4e2d8eacabbfc8a60b3b97846bf5653b
[]
no_license
DaZealous/glochat
2f8619bdf3bb15cc329ab484528161cdefdccb5a
39cfe3adc4ce078b58da42196b4b695b26a5a24e
refs/heads/main
2023-06-14T01:40:53.095021
2020-12-26T10:32:41
2020-12-26T10:32:41
301,383,535
0
0
null
2020-10-05T11:23:01
2020-10-05T11:23:01
null
UTF-8
Java
false
false
1,270
java
package net.glochat.dev.utils; import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; public class NumberFormatter { private static final NavigableMap<Long, String> suffixes = new TreeMap<>(); static { suffixes.put(1_000L, "k"); suffixes.put(1_000_000L, "M"); suffixes.put(1_000_000_000L, "G"); suffixes.put(1_000_000_000_000L, "T"); suffixes.put(1_000_000_000_000_000L, "P"); suffixes.put(1_000_000_000_000_000_000L, "E"); } public static String format(long value) { //Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here if (value == Long.MIN_VALUE) return format(Long.MIN_VALUE + 1); if (value < 0) return "-" + format(-value); if (value < 1000) return Long.toString(value); //deal with easy case Map.Entry<Long, String> e = suffixes.floorEntry(value); assert e != null; Long divideBy = e.getKey(); String suffix = e.getValue(); long truncated = value / (divideBy / 10); //the number part of the output times 10 boolean hasDecimal = truncated < 100 && (truncated / 10d) != (truncated / 10); return hasDecimal ? (truncated / 10d) + suffix : (truncated / 10) + suffix; } }
08198e5d7e9f2f747f73d436153f4055d7f69dc9
3b91ed788572b6d5ac4db1bee814a74560603578
/com/tencent/mm/plugin/n/a$b.java
8d1ea82e30f5f068d89a49bada155a9e89a49209
[]
no_license
linsir6/WeChat_java
a1deee3035b555fb35a423f367eb5e3e58a17cb0
32e52b88c012051100315af6751111bfb6697a29
refs/heads/master
2020-05-31T05:40:17.161282
2018-08-28T02:07:02
2018-08-28T02:07:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,113
java
package com.tencent.mm.plugin.n; public final class a$b { public static final int BW_10 = 2131689472; public static final int BW_100 = 2131689473; public static final int BW_20 = 2131689474; public static final int BW_50 = 2131689475; public static final int BW_70 = 2131689476; public static final int BW_95 = 2131689477; public static final int ConversationVoiceTextColor = 2131689485; public static final int White = 2131689490; public static final int abc_background_cache_hint_selector_material_dark = 2131690203; public static final int abc_background_cache_hint_selector_material_light = 2131690204; public static final int abc_color_highlight_material = 2131690205; public static final int abc_input_method_navigation_guard = 2131689498; public static final int abc_primary_text_disable_only_material_dark = 2131690206; public static final int abc_primary_text_disable_only_material_light = 2131690207; public static final int abc_primary_text_material_dark = 2131690208; public static final int abc_primary_text_material_light = 2131690209; public static final int abc_search_url_text = 2131690210; public static final int abc_search_url_text_normal = 2131689499; public static final int abc_search_url_text_pressed = 2131689500; public static final int abc_search_url_text_selected = 2131689501; public static final int abc_secondary_text_material_dark = 2131690211; public static final int abc_secondary_text_material_light = 2131690212; public static final int accent_material_dark = 2131689502; public static final int accent_material_light = 2131689503; public static final int account_delete_text_color = 2131689504; public static final int action_bar_color = 2131689506; public static final int action_bar_tittle_color = 2131689507; public static final int action_bar_tittle_color_selector = 2131690213; public static final int actionbar_bg_color = 2131689511; public static final int actionbar_devider_color = 2131689512; public static final int actionbar_selector_color = 2131689513; public static final int actionbar_subtitle_color = 2131689514; public static final int actionbar_subtitle_light_color = 2131689515; public static final int actionbar_text_white_selector = 2131690214; public static final int actionbar_title_color = 2131689516; public static final int actionbar_title_light_color = 2131689517; public static final int ad_landing_pages_player_controller = 2131689518; public static final int ad_player_controller = 2131689519; public static final int album_ui_bg = 2131689527; public static final int alert_btn_color_no = 2131689528; public static final int alert_btn_color_warn = 2131689529; public static final int alpha_white_text_color = 2131689530; public static final int app_brand_jslogin_auth_desc_color = 2131689546; public static final int app_brand_jslogin_devide_line_color = 2131689547; public static final int app_brand_jslogin_login_accept_color = 2131689548; public static final int app_brand_jslogin_login_reject_color = 2131689549; public static final int app_brand_jslogin_wechat_auth_color = 2131689550; public static final int available_device_name_color = 2131689558; public static final int background_floating_material_dark = 2131689559; public static final int background_floating_material_light = 2131689560; public static final int background_material_dark = 2131689561; public static final int background_material_light = 2131689562; public static final int big_line_color = 2131689569; public static final int black = 2131689572; public static final int black_text_color = 2131689573; public static final int black_text_color_disabled = 2131689574; public static final int black_text_color_pressed = 2131689575; public static final int black_text_color_selector = 2131690215; public static final int blue = 2131689576; public static final int blue_text_color = 2131689577; public static final int bottom_cell_bg_color = 2131689578; public static final int bottom_cell_bg_press_color = 2131689579; public static final int bottom_sheet_text_color = 2131689580; public static final int bottom_sheet_text_color_disable = 2131689581; public static final int bottom_sheet_text_desc_color = 2131689582; public static final int bottom_sheet_title_text_color = 2131689583; public static final int bright_foreground_disabled_material_dark = 2131689584; public static final int bright_foreground_disabled_material_light = 2131689585; public static final int bright_foreground_inverse_material_dark = 2131689586; public static final int bright_foreground_inverse_material_light = 2131689587; public static final int bright_foreground_material_dark = 2131689588; public static final int bright_foreground_material_light = 2131689589; public static final int btn_gold_red_color_disable = 2131689593; public static final int btn_gold_red_color_normal = 2131689594; public static final int btn_gold_red_color_pressed = 2131689595; public static final int btn_green_color_disable = 2131689596; public static final int btn_green_color_normal = 2131689597; public static final int btn_green_color_pressed = 2131689598; public static final int btn_green_outline_color_disable = 2131689599; public static final int btn_green_outline_color_normal = 2131689600; public static final int btn_green_outline_color_pressed = 2131689601; public static final int btn_grey_outline_color_disable = 2131689602; public static final int btn_grey_outline_color_normal = 2131689603; public static final int btn_grey_outline_color_pressed = 2131689604; public static final int btn_red_color_disable = 2131689605; public static final int btn_red_color_normal = 2131689606; public static final int btn_red_color_pressed = 2131689607; public static final int btn_red_outline_color_disable = 2131689608; public static final int btn_red_outline_color_normal = 2131689609; public static final int btn_red_outline_color_pressed = 2131689610; public static final int btn_white_color_disable = 2131689611; public static final int btn_white_color_normal = 2131689612; public static final int btn_white_color_pressed = 2131689613; public static final int bubble_chat_from_bg_color = 2131689614; public static final int bubble_chat_to_bg_color = 2131689615; public static final int button_material_dark = 2131689616; public static final int button_material_light = 2131689617; public static final int cancel_btn_color = 2131689619; public static final int chat_card_hint_color = 2131689652; public static final int chat_img_default_bg_color = 2131689654; public static final int chat_img_mask_color = 2131689655; public static final int chat_item_biz_slot_divider = 2131689656; public static final int chat_item_default_mucic_mask_color = 2131689657; public static final int chat_item_file_progress_color = 2131689658; public static final int chat_item_footer_mask_color = 2131689659; public static final int chat_url_color = 2131689660; public static final int chatting_banner_expose_text_color = 2131689661; public static final int chatting_bg_biz_purecolor = 2131689662; public static final int chatting_bg_purecolor = 2131689663; public static final int chatting_item_dyeing_template_divider_color = 2131689665; public static final int chatting_panel_bg_color = 2131689666; public static final int chatting_sight_alert_text_color = 2131689667; public static final int conatct_info_summary_color = 2131689669; public static final int conatct_info_weibo_link_color = 2131689670; public static final int confirm_edit_text_color = 2131689671; public static final int cursor_handle_color = 2131689672; public static final int dark_actionbar_color = 2131689673; public static final int dark_alpha_black = 2131689674; public static final int dark_bg_color = 2131689675; public static final int dark_bg_line_color = 2131689676; public static final int darkgrey = 2131689677; public static final int default_background_color = 2131689680; public static final int desc_text_color = 2131689682; public static final int design_fab_shadow_end_color = 2131689683; public static final int design_fab_shadow_mid_color = 2131689684; public static final int design_fab_shadow_start_color = 2131689685; public static final int design_fab_stroke_end_inner_color = 2131689686; public static final int design_fab_stroke_end_outer_color = 2131689687; public static final int design_fab_stroke_top_inner_color = 2131689688; public static final int design_fab_stroke_top_outer_color = 2131689689; public static final int design_snackbar_background_color = 2131689690; public static final int design_textinput_error_color_dark = 2131689691; public static final int design_textinput_error_color_light = 2131689692; public static final int dialog_bg = 2131689701; public static final int dialog_content_bg = 2131689702; public static final int dialog_content_bg_press = 2131689703; public static final int dialog_divider_line_color = 2131689704; public static final int dialog_msg_color = 2131689705; public static final int dialog_msg_title_color = 2131689706; public static final int dialog_transparent = 2131689707; public static final int dim_foreground_disabled_material_dark = 2131689708; public static final int dim_foreground_disabled_material_light = 2131689709; public static final int dim_foreground_material_dark = 2131689710; public static final int dim_foreground_material_light = 2131689711; public static final int disable_text_color = 2131689712; public static final int emoji_download_finish_color = 2131689715; public static final int emoji_load_text_color = 2131689716; public static final int fav_listitem_image_bg_edge_color = 2131689749; public static final int footer_text_color = 2131689762; public static final int foreground_material_dark = 2131689763; public static final int foreground_material_light = 2131689764; public static final int form_hint_text_color = 2131689765; public static final int general_sub_background_color = 2131689812; public static final int green_text_color = 2131689822; public static final int green_text_color_selector = 2131690219; public static final int grey = 2131689823; public static final int grey_background_text_color = 2131689824; public static final int grey_bg_color = 2131689825; public static final int grey_btn_color_disable = 2131689826; public static final int grey_btn_color_normal = 2131689827; public static final int grey_btn_color_pressed = 2131689828; public static final int grey_btn_stroke_color_disable = 2131689829; public static final int grey_btn_stroke_color_normal = 2131689830; public static final int grey_btn_stroke_color_pressed = 2131689831; public static final int grey_color_01 = 2131689832; public static final int grey_text_color = 2131689833; public static final int half_alpha_black = 2131689835; public static final int half_alpha_white = 2131689836; public static final int highlighted_text_material_dark = 2131689839; public static final int highlighted_text_material_light = 2131689840; public static final int hint_color_white_bg = 2131689842; public static final int hint_foreground_material_dark = 2131689843; public static final int hint_foreground_material_light = 2131689844; public static final int hint_text_color = 2131689845; public static final int hint_text_color_dark_bg = 2131689846; public static final int image_gallery_mask = 2131689857; public static final int last_msg_tv_color = 2131689867; public static final int launcher_tab_text_color = 2131689868; public static final int launcher_tab_text_color_press = 2131689869; public static final int launcher_tab_text_selector = 2131690222; public static final int light_bg_color = 2131689870; public static final int light_bg_hint_color = 2131689871; public static final int light_blue_bg_color = 2131689872; public static final int light_grey = 2131689873; public static final int light_grey_text_color = 2131689874; public static final int light_text_color = 2131689875; public static final int lightgrey = 2131689876; public static final int line_color = 2131689877; public static final int link_color = 2131689878; public static final int link_color_pressed = 2131689879; public static final int link_color_selector = 2131690223; public static final int list_devider_color = 2131689880; public static final int list_divider_color_black = 2131689881; public static final int list_top_bg_color = 2131689882; public static final int loading_bg_color = 2131689883; public static final int lucky_money_goldstyle_text_color = 2131689902; public static final int material_blue_grey_800 = 2131689926; public static final int material_blue_grey_900 = 2131689927; public static final int material_blue_grey_950 = 2131689928; public static final int material_deep_teal_200 = 2131689929; public static final int material_deep_teal_500 = 2131689930; public static final int material_grey_100 = 2131689931; public static final int material_grey_300 = 2131689932; public static final int material_grey_50 = 2131689933; public static final int material_grey_600 = 2131689934; public static final int material_grey_800 = 2131689935; public static final int material_grey_850 = 2131689936; public static final int material_grey_900 = 2131689937; public static final int menu_devider_color = 2131689938; public static final int menu_pressed_color = 2131689939; public static final int mm_actbtn_text = 2131690225; public static final int mm_choice_text_color = 2131690226; public static final int mm_edit_text_color = 2131690227; public static final int mm_hyper_text = 2131690228; public static final int mm_list_textcolor_one = 2131690229; public static final int mm_list_textcolor_spuser = 2131690230; public static final int mm_list_textcolor_three = 2131690231; public static final int mm_list_textcolor_time = 2131690232; public static final int mm_list_textcolor_two = 2131690233; public static final int mm_list_textcolor_unread = 2131690234; public static final int mm_open_status = 2131690235; public static final int mm_pref_summary = 2131690236; public static final int mm_pref_title = 2131690237; public static final int mm_smiley_tab_color = 2131690238; public static final int mm_title_btn_text = 2131690239; public static final int navbar_text_focus = 2131689952; public static final int navbar_text_normal = 2131689953; public static final int navpage = 2131689954; public static final int nickname_normal_color = 2131689958; public static final int normal_actionbar_color = 2131689960; public static final int normal_bg_color = 2131689961; public static final int normal_color = 2131689962; public static final int normal_text = 2131689965; public static final int normal_text_color = 2131689966; public static final int notice_publish_time = 2131689970; public static final int pic_thum_bg_color = 2131689974; public static final int pin_progress_default_circle_color = 2131689975; public static final int pin_progress_default_progress_color = 2131689976; public static final int press_color_for_darkbg = 2131689978; public static final int press_color_for_lightbg = 2131689979; public static final int primary_dark_material_dark = 2131689980; public static final int primary_dark_material_light = 2131689981; public static final int primary_material_dark = 2131689982; public static final int primary_material_light = 2131689983; public static final int primary_text_default_material_dark = 2131689984; public static final int primary_text_default_material_light = 2131689985; public static final int primary_text_disabled_material_dark = 2131689986; public static final int primary_text_disabled_material_light = 2131689987; public static final int progress_bar_grey = 2131689991; public static final int radar_disable_text_color = 2131689995; public static final int radar_quit_text_color = 2131689996; public static final int red = 2131690016; public static final int red_text_color = 2131690017; public static final int red_text_color_selector = 2131690243; public static final int ripple_material_dark = 2131690021; public static final int ripple_material_light = 2131690022; public static final int secondary_text_default_material_dark = 2131690034; public static final int secondary_text_default_material_light = 2131690035; public static final int secondary_text_disabled_material_dark = 2131690036; public static final int secondary_text_disabled_material_light = 2131690037; public static final int selected_blue = 2131690040; public static final int semitransparent = 2131690045; public static final int send_data_bg_color = 2131690046; public static final int send_data_cancel = 2131690047; public static final int send_data_divider_line = 2131690048; public static final int send_data_sending = 2131690049; public static final int send_data_to_device_backgroud_color = 2131690050; public static final int send_state_text_failed = 2131690051; public static final int service_normal_color = 2131690052; public static final int settings_bg = 2131690054; public static final int sight_chatting_shuffer_color = 2131690065; public static final int small_line_color = 2131690068; public static final int smiley_panel_btn_text_color = 2131690069; public static final int smiley_panel_btn_text_color_selector = 2131690246; public static final int sns_content_collapse_hint_bg = 2131690076; public static final int sns_like_color = 2131690079; public static final int sns_link_bg_color = 2131690081; public static final int sns_link_color = 2131690082; public static final int sns_lucky_item_gold = 2131690089; public static final int sns_sight_desc_color = 2131690096; public static final int sns_word_color = 2131690104; public static final int status_bar_color = 2131690107; public static final int statusbar_fg_color = 2131690108; public static final int statusbar_fg_drak_color = 2131690109; public static final int sub_menu_pressed_color = 2131690110; public static final int switch_btn_off_color = 2131690112; public static final int switch_btn_on_color = 2131690113; public static final int switch_thumb_disabled_material_dark = 2131690114; public static final int switch_thumb_disabled_material_light = 2131690115; public static final int switch_thumb_material_dark = 2131690247; public static final int switch_thumb_material_light = 2131690248; public static final int switch_thumb_normal_material_dark = 2131690116; public static final int switch_thumb_normal_material_light = 2131690117; public static final int text_btn_color_pressed = 2131690127; public static final int text_input_limit_tips = 2131690128; public static final int text_input_limit_warn = 2131690129; public static final int time_progress_white = 2131690131; public static final int tipsbar_black_bg_color = 2131690132; public static final int tipsbar_green_bg_color = 2131690133; public static final int tipsbar_grey_bg_color = 2131690134; public static final int tipsbar_orange_bg_color = 2131690135; public static final int tipsbar_red_bg_color = 2131690136; public static final int tipsbar_text_color = 2131690137; public static final int tipsbar_white_bg_color = 2131690138; public static final int toasterro = 2131690139; public static final int transparent = 2131690140; public static final int view_question_link_color = 2131690150; public static final int warning_text_color = 2131690179; public static final int webview_logo_bg_color = 2131690188; public static final int webview_logo_text_color = 2131690189; public static final int webwx_bg_color = 2131690192; public static final int wechat_green = 2131690193; public static final int wechat_green_quarter_alpha = 2131690194; public static final int wechat_light_green = 2131690195; public static final int white = 2131690197; public static final int white_color = 2131690198; public static final int white_text_color = 2131690199; public static final int white_text_color_disabled = 2131690200; public static final int white_text_color_pressed = 2131690201; public static final int white_text_color_selector = 2131690253; }
bcf5be37191054aeba5a32c1d5b35487f651ca23
097df92ce1bfc8a354680725c7d10f0d109b5b7d
/com/amazon/ws/emr/hadoop/fs/shaded/com/amazonaws/transform/SimpleTypeStaxUnmarshallers$CharacterJsonUnmarshaller.java
1e8a1e22ac53a4a799c4935dbe43a4fd505ac2d7
[]
no_license
cozos/emrfs-hadoop
7a1a1221ffc3aa8c25b1067cf07d3b46e39ab47f
ba5dfa631029cb5baac2f2972d2fdaca18dac422
refs/heads/master
2022-10-14T15:03:51.500050
2022-10-06T05:38:49
2022-10-06T05:38:49
233,979,996
2
2
null
2022-10-06T05:41:46
2020-01-15T02:24:16
Java
UTF-8
Java
false
false
1,142
java
package com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.transform; import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.SdkClientException; public class SimpleTypeStaxUnmarshallers$CharacterJsonUnmarshaller implements Unmarshaller<Character, StaxUnmarshallerContext> { public Character unmarshall(StaxUnmarshallerContext unmarshallerContext) throws Exception { String charString = unmarshallerContext.readText(); if (charString == null) { return null; } charString = charString.trim(); if ((charString.isEmpty()) || (charString.length() > 1)) { throw new SdkClientException("'" + charString + "' cannot be converted to Character"); } return Character.valueOf(charString.charAt(0)); } private static final CharacterJsonUnmarshaller instance = new CharacterJsonUnmarshaller(); public static CharacterJsonUnmarshaller getInstance() { return instance; } } /* Location: * Qualified Name: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.transform.SimpleTypeStaxUnmarshallers.CharacterJsonUnmarshaller * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
fcc8c9d332ff4a83e6f5470f38ffbc1bc211d806
10b6a31165e77a66a06aeff776d6c30349f70a33
/src/com/startboardland/common/MySQLiteHelper.java
34341a72ead8020844e88c369ea07a303bbe87f9
[ "Apache-2.0" ]
permissive
jlbao/Android-Step-Counter
5004f3d8923cdce4a030718335decf4f16be7b1b
320e335cd939128a96713f5ca7eb242e9087ac6b
refs/heads/master
2020-06-01T01:31:52.783012
2015-03-20T06:48:29
2015-03-20T06:48:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
package com.startboardland.common; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; /** * Created by Jialiang on 3/16/15. */ public class MySQLiteHelper extends SQLiteOpenHelper { public static final String TABLE_MY_SEGMENT = "MySegment"; public static final String SEGMENT_ID = "_id"; public static final String STEP_COUNT = "step"; private static final String DATABASE_NAME = "test"; private static final int DATABASE_VERSION = 1; // // Database creation sql statement // private static final String DATABASE_CREATE = "create table " // + TABLE_MY_SEGMENT + "(" + SEGMENT_ID // + " integer primary key, " + STEP_COUNT // + " integer not null);"; // Database creation sql statement private static final String DATABASE_CREATE = "create table MySegment (_id integer, dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, step integer not null, PRIMARY KEY (_id, dt));"; public MySQLiteHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase database) { database.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(MySQLiteHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + TABLE_MY_SEGMENT); onCreate(db); } }
f4e50d5716384ae93eeb49ec77f01b7a3a3b3e7c
64aa2eaddeff25040d871a0cb9d40a4973766ee7
/src/main/java/net/gcardone/junidecode/X9e.java
cf76f480cfacd1113aed60c059e351ec101c0535
[ "Apache-2.0" ]
permissive
putragraha/junidecode
83d4cf67630a7e4abb3f1bb444ee47524dc77608
c87fff490196dcfd366fdbaee1e74c11385b37c0
refs/heads/master
2020-03-28T15:11:17.800061
2018-09-12T07:26:35
2018-09-12T07:26:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,991
java
/* * Copyright (C) 2015 Giuseppe Cardone <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.gcardone.junidecode; /** * Character map for Unicode characters with codepoint U+9Exx. * @author Giuseppe Cardone * @version 0.1 */ class X9e { public static final String[] map = new String[]{ "Shu ", // 0x00 "Luo ", // 0x01 "Qi ", // 0x02 "Yi ", // 0x03 "Ji ", // 0x04 "Zhe ", // 0x05 "Yu ", // 0x06 "Zhan ", // 0x07 "Ye ", // 0x08 "Yang ", // 0x09 "Pi ", // 0x0a "Ning ", // 0x0b "Huo ", // 0x0c "Mi ", // 0x0d "Ying ", // 0x0e "Meng ", // 0x0f "Di ", // 0x10 "Yue ", // 0x11 "Yu ", // 0x12 "Lei ", // 0x13 "Bao ", // 0x14 "Lu ", // 0x15 "He ", // 0x16 "Long ", // 0x17 "Shuang ", // 0x18 "Yue ", // 0x19 "Ying ", // 0x1a "Guan ", // 0x1b "Qu ", // 0x1c "Li ", // 0x1d "Luan ", // 0x1e "Niao ", // 0x1f "Jiu ", // 0x20 "Ji ", // 0x21 "Yuan ", // 0x22 "Ming ", // 0x23 "Shi ", // 0x24 "Ou ", // 0x25 "Ya ", // 0x26 "Cang ", // 0x27 "Bao ", // 0x28 "Zhen ", // 0x29 "Gu ", // 0x2a "Dong ", // 0x2b "Lu ", // 0x2c "Ya ", // 0x2d "Xiao ", // 0x2e "Yang ", // 0x2f "Ling ", // 0x30 "Zhi ", // 0x31 "Qu ", // 0x32 "Yuan ", // 0x33 "Xue ", // 0x34 "Tuo ", // 0x35 "Si ", // 0x36 "Zhi ", // 0x37 "Er ", // 0x38 "Gua ", // 0x39 "Xiu ", // 0x3a "Heng ", // 0x3b "Zhou ", // 0x3c "Ge ", // 0x3d "Luan ", // 0x3e "Hong ", // 0x3f "Wu ", // 0x40 "Bo ", // 0x41 "Li ", // 0x42 "Juan ", // 0x43 "Hu ", // 0x44 "E ", // 0x45 "Yu ", // 0x46 "Xian ", // 0x47 "Ti ", // 0x48 "Wu ", // 0x49 "Que ", // 0x4a "Miao ", // 0x4b "An ", // 0x4c "Kun ", // 0x4d "Bei ", // 0x4e "Peng ", // 0x4f "Qian ", // 0x50 "Chun ", // 0x51 "Geng ", // 0x52 "Yuan ", // 0x53 "Su ", // 0x54 "Hu ", // 0x55 "He ", // 0x56 "E ", // 0x57 "Gu ", // 0x58 "Qiu ", // 0x59 "Zi ", // 0x5a "Mei ", // 0x5b "Mu ", // 0x5c "Ni ", // 0x5d "Yao ", // 0x5e "Weng ", // 0x5f "Liu ", // 0x60 "Ji ", // 0x61 "Ni ", // 0x62 "Jian ", // 0x63 "He ", // 0x64 "Yi ", // 0x65 "Ying ", // 0x66 "Zhe ", // 0x67 "Liao ", // 0x68 "Liao ", // 0x69 "Jiao ", // 0x6a "Jiu ", // 0x6b "Yu ", // 0x6c "Lu ", // 0x6d "Xuan ", // 0x6e "Zhan ", // 0x6f "Ying ", // 0x70 "Huo ", // 0x71 "Meng ", // 0x72 "Guan ", // 0x73 "Shuang ", // 0x74 "Lu ", // 0x75 "Jin ", // 0x76 "Ling ", // 0x77 "Jian ", // 0x78 "Xian ", // 0x79 "Cuo ", // 0x7a "Jian ", // 0x7b "Jian ", // 0x7c "Yan ", // 0x7d "Cuo ", // 0x7e "Lu ", // 0x7f "You ", // 0x80 "Cu ", // 0x81 "Ji ", // 0x82 "Biao ", // 0x83 "Cu ", // 0x84 "Biao ", // 0x85 "Zhu ", // 0x86 "Jun ", // 0x87 "Zhu ", // 0x88 "Jian ", // 0x89 "Mi ", // 0x8a "Mi ", // 0x8b "Wu ", // 0x8c "Liu ", // 0x8d "Chen ", // 0x8e "Jun ", // 0x8f "Lin ", // 0x90 "Ni ", // 0x91 "Qi ", // 0x92 "Lu ", // 0x93 "Jiu ", // 0x94 "Jun ", // 0x95 "Jing ", // 0x96 "Li ", // 0x97 "Xiang ", // 0x98 "Yan ", // 0x99 "Jia ", // 0x9a "Mi ", // 0x9b "Li ", // 0x9c "She ", // 0x9d "Zhang ", // 0x9e "Lin ", // 0x9f "Jing ", // 0xa0 "Ji ", // 0xa1 "Ling ", // 0xa2 "Yan ", // 0xa3 "Cu ", // 0xa4 "Mai ", // 0xa5 "Mai ", // 0xa6 "Ge ", // 0xa7 "Chao ", // 0xa8 "Fu ", // 0xa9 "Mian ", // 0xaa "Mian ", // 0xab "Fu ", // 0xac "Pao ", // 0xad "Qu ", // 0xae "Qu ", // 0xaf "Mou ", // 0xb0 "Fu ", // 0xb1 "Xian ", // 0xb2 "Lai ", // 0xb3 "Qu ", // 0xb4 "Mian ", // 0xb5 "[?] ", // 0xb6 "Feng ", // 0xb7 "Fu ", // 0xb8 "Qu ", // 0xb9 "Mian ", // 0xba "Ma ", // 0xbb "Mo ", // 0xbc "Mo ", // 0xbd "Hui ", // 0xbe "Ma ", // 0xbf "Zou ", // 0xc0 "Nen ", // 0xc1 "Fen ", // 0xc2 "Huang ", // 0xc3 "Huang ", // 0xc4 "Jin ", // 0xc5 "Guang ", // 0xc6 "Tian ", // 0xc7 "Tou ", // 0xc8 "Heng ", // 0xc9 "Xi ", // 0xca "Kuang ", // 0xcb "Heng ", // 0xcc "Shu ", // 0xcd "Li ", // 0xce "Nian ", // 0xcf "Chi ", // 0xd0 "Hei ", // 0xd1 "Hei ", // 0xd2 "Yi ", // 0xd3 "Qian ", // 0xd4 "Dan ", // 0xd5 "Xi ", // 0xd6 "Tuan ", // 0xd7 "Mo ", // 0xd8 "Mo ", // 0xd9 "Qian ", // 0xda "Dai ", // 0xdb "Chu ", // 0xdc "You ", // 0xdd "Dian ", // 0xde "Yi ", // 0xdf "Xia ", // 0xe0 "Yan ", // 0xe1 "Qu ", // 0xe2 "Mei ", // 0xe3 "Yan ", // 0xe4 "Jing ", // 0xe5 "Yu ", // 0xe6 "Li ", // 0xe7 "Dang ", // 0xe8 "Du ", // 0xe9 "Can ", // 0xea "Yin ", // 0xeb "An ", // 0xec "Yan ", // 0xed "Tan ", // 0xee "An ", // 0xef "Zhen ", // 0xf0 "Dai ", // 0xf1 "Can ", // 0xf2 "Yi ", // 0xf3 "Mei ", // 0xf4 "Dan ", // 0xf5 "Yan ", // 0xf6 "Du ", // 0xf7 "Lu ", // 0xf8 "Zhi ", // 0xf9 "Fen ", // 0xfa "Fu ", // 0xfb "Fu ", // 0xfc "Min ", // 0xfd "Min ", // 0xfe "Yuan " // 0xff }; }
bffc13305624169356ec12f9e889e178c2889a97
9096e6a857e5e051bca29a9d3b290e2800fc3f97
/JavaSE/MyJavaSE/src/seawave/day13/stringbuffer/Demo7_StringBuffer.java
eaa5f20e372c7bb19a28b72582244cc129c95bbe
[ "Apache-2.0" ]
permissive
seawaveai/MyFiling
84962fcfb5b49fb5220f20d4b3f0eb5155873099
42d7fe2d01021e3ac1c412598a31b52da064d303
refs/heads/master
2021-06-27T06:11:58.770641
2020-09-27T09:26:00
2020-09-27T09:26:00
143,843,615
0
0
null
null
null
null
UTF-8
Java
false
false
903
java
package seawave.day13.stringbuffer; public class Demo7_StringBuffer { /** * * A:形式参数问题 * String作为参数传递 * StringBuffer作为参数传递 * B:案例演示 * String和StringBuffer分别作为参数传递问题 * 基本数据类型的值传递,不改变其值 引用数据类型的值传递,改变其值 String类虽然是引用数据类型,但是他当作参数传递时和基本数据类型是一样的 */ public static void main(String[] args) { String s = "heima"; System.out.println(s); change(s); System.out.println(s); System.out.println("---------------------"); StringBuffer sb = new StringBuffer(); sb.append("heima"); System.out.println(sb); change(sb); System.out.println(sb); } public static void change(StringBuffer sb) { sb.append("itcast"); } public static void change(String s) { s += "itcast"; } }
dcccae5633be31418f7df5485ecc90e413fb518d
119d806f26146b6d43a22e082183b0c644118bad
/2017-10-20 jeonheejae/src/Starcraft/Terran.java
8d9e97d7eba123558a1bef973b04db802189398f
[]
no_license
kaeloh/CBNU-JAVA
a4a8435845420b894dcf741c8b527a72eda127ce
5df18e6de18dc07cc075f0ec0678049ef383d197
refs/heads/master
2021-05-05T10:49:53.299940
2017-12-15T06:52:58
2017-12-15T06:52:58
104,446,704
0
0
null
null
null
null
UHC
Java
false
false
229
java
package Starcraft; public class Terran extends Starcraft { // 추상 클래스는 오버라이딩 해서 사용 @Override public void attack() { System.out.println("테란의 공격"); } }
[ "CBNU@CBNU-PC" ]
CBNU@CBNU-PC
676e845896700b83de52bf600a77956e8ace23a0
649ab419067c9d82dd836b1046e411e4e04aa287
/src/main/java/com/udacity/dog_api/resolver/Query.java
2d9a167ad675774b198b13f0a406d756d448e7c6
[]
no_license
princelewis/graphql-implementation
2ca8e5da92a58b084f746fc8fab2a8da67a4c808
182097a86621349f075022e675fca077fd0a9ca8
refs/heads/master
2023-06-06T13:33:44.377574
2021-06-29T13:04:10
2021-06-29T13:04:10
381,365,299
0
0
null
null
null
null
UTF-8
Java
false
false
892
java
package com.udacity.dog_api.resolver; import com.coxautodev.graphql.tools.GraphQLQueryResolver; import com.udacity.dog_api.entity.Dog; import com.udacity.dog_api.exception.DogIdNotFoundException; import com.udacity.dog_api.repository.DogRepository; import org.springframework.stereotype.Component; import java.util.List; import java.util.Optional; @Component public class Query implements GraphQLQueryResolver { private DogRepository dogRepository; public Query(DogRepository dogRepository) { this.dogRepository = dogRepository; } public Dog findDogById(Long id) { Optional<Dog> optDog = dogRepository.findById(id); if (optDog.isPresent()) return optDog.get(); else throw new DogIdNotFoundException("Dog with id " + id + "was not found", id); } public List<Dog> findAllDogs() { return dogRepository.findAll(); } }
6a5151ea26b1bfdc30319fb4773c12b167069f40
fb2de81ae88d1030b92fa3b243887f9656358283
/src/java_practic/lectures/lecture_16/task_4/ObjectOutputStreamExample.java
d33c8ad2d82d57355beeb8aad59bd7a38b10670c
[]
no_license
RomanMakarevich/Java_practice
0ff58dbbeed4fa8795effa1c7a84e7c8143488cd
b36ad8e7200f3137515b1da36ec51c064f8b4d29
refs/heads/master
2020-05-14T16:50:50.623704
2019-07-20T11:54:35
2019-07-20T11:54:35
181,879,989
0
0
null
null
null
null
UTF-8
Java
false
false
710
java
package java_practic.lectures.lecture_16.task_4; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class ObjectOutputStreamExample { private static final String FILE_PATH = "D:\\Java_Practice\\src\\java_practic\\lectures\\lecture_16\\task_4\\File"; public static void main(String[] args) { try (FileOutputStream fos = new FileOutputStream(FILE_PATH)){ ObjectOutputStream oos= new ObjectOutputStream(fos); Employee person = new Employee("Jake", 25, "Manager", 5); oos.writeObject(person); oos.flush(); } catch (IOException e) { e.printStackTrace(); } } }
e1252db9aa6cd412f338b1b84078580b70405a28
fd066712bcbc2e9d3c51e7ca88e2f3db8d8db7db
/codding/src/main/java/com/dzc/work/ParseBusinType.java
e44c195b716f60daa353259d9c094a08767a41f8
[]
no_license
DongZcC/coddding
ee88acb9d005b2743bf28fb90b134c3419036d27
bb91b4582adbd5091e82d46002175a924559fd36
refs/heads/master
2022-10-17T12:00:03.510024
2022-10-11T01:15:38
2022-10-11T01:15:38
161,160,347
0
1
null
2018-12-10T10:53:35
2018-12-10T10:53:34
null
UTF-8
Java
false
false
879
java
package com.dzc.work; import org.apache.commons.lang.StringUtils; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; public class ParseBusinType { public static void main(String[] args) throws Exception { try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("d:/busin.txt")))) { String line; int no = 271000; int zno = 274000; int wno = 277000; while ((line = br.readLine()) != null) { String[] busins = line.split(" "); for (String busin : busins) { if (StringUtils.isEmpty(busin)) continue; System.out.println("|" + busin + "|" + (no++) + "|" + (zno++) + "|" + wno++ + "|"); } } } } }
5521b7bfa07d41137fe62941c3babe9acaa65652
f822e4abb0ca705bb0ed3d4cf0ed4a3bf9be11ed
/src/main/java/org/zmlx/hg4idea/command/HgRemoveCommand.java
2337abbdded78883a4d8ae52320eb274f7fb8130
[ "Apache-2.0" ]
permissive
consulo/consulo-mercurial
4c642efb28bb7ef2809df1d3bd827d75221cf40e
58bc2eb6353f348254be1e716c05156040e6acae
refs/heads/master
2023-07-20T06:35:47.330892
2023-06-05T13:32:57
2023-06-05T13:32:57
19,280,973
0
0
null
2015-02-20T22:20:22
2014-04-29T15:14:40
Python
UTF-8
Java
false
false
2,058
java
// Copyright 2008-2010 Victor Iacoban // // 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.zmlx.hg4idea.command; import consulo.project.Project; import consulo.versionControlSystem.util.VcsFileUtil; import consulo.virtualFileSystem.VirtualFile; import jakarta.annotation.Nonnull; import org.zmlx.hg4idea.HgFile; import org.zmlx.hg4idea.execution.HgCommandExecutor; import org.zmlx.hg4idea.util.HgUtil; import java.util.*; /** * A wrapper for the 'hg remove' command. */ public class HgRemoveCommand { private final Project myProject; public HgRemoveCommand(Project project) { myProject = project; } /** * Removes given files from their Mercurial repositories. * * @param hgFiles files to be removed. */ public void executeInCurrentThread(@Nonnull HgFile... hgFiles) { executeInCurrentThread(Arrays.asList(hgFiles)); } /** * Removes given files from their Mercurial repositories. * * @param hgFiles files to be removed. */ public void executeInCurrentThread(@Nonnull Collection<HgFile> hgFiles) { for (Map.Entry<VirtualFile, List<String>> entry : HgUtil.getRelativePathsByRepository(hgFiles).entrySet()) { List<String> filePaths = entry.getValue(); for (List<String> chunkFiles : VcsFileUtil.chunkArguments(filePaths)) { List<String> parameters = new LinkedList<>(); parameters.addAll(chunkFiles); parameters.add(0, "--after"); new HgCommandExecutor(myProject).executeInCurrentThread(entry.getKey(), "remove", parameters); } } } }
aaf6d6988c69d2c3370dec6ebb35f334aa5d406f
1283903f71bc64da812823cbdb2578d9e01f142d
/jsf_jpa_ejb_prime_glassFish/ProjetoEjbClient/ejbModule/br/com/tutorial/entidade/Clientes.java
05c3340a67f5f220fb56d1f3a3f40bc626f228cd
[]
no_license
titodeabreu/ProjetoEstudo
d660ab64bf5e3b4f08e923abc83ba1b6200d1526
2bcc908d6f4ba4942044fb4b42476394851ddaa7
refs/heads/master
2021-01-22T03:50:01.239193
2014-04-02T19:56:26
2014-04-02T19:56:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,365
java
package br.com.tutorial.entidade; import java.io.Serializable; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="Clientes") public class Clientes implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="id_cliente" , unique=true, nullable = false) private Integer idCliente; @Column(name="cpf" , unique=true, nullable = false, length =11) private String cpf; @Column(name="nome",unique=true, nullable=false, length=150) private String nome; @OneToMany(mappedBy="cliente") private List<Pedidos> pedidos; //GETTERS AND SETTERS public Integer getIdCliente() { return idCliente; } public void setIdCliente(Integer idCliente) { this.idCliente = idCliente; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public List<Pedidos> getPedidos() { return pedidos; } public void setPedidos(List<Pedidos> pedidos) { this.pedidos = pedidos; } }
0d6afd511ec2df681860c3a2a39961df983d1611
694b749b1f02dd9dd44451aa5a36e032531bb9dd
/src/main/java/com/task/exchangerates/util/converter/CurrencyToCurrencyDtoConverter.java
ea50d172b373922cb62e58b6075280f85aaaf3b8
[]
no_license
Artur711/Exchange-rates
a9523d74c4b4f2f58c4e00cdd292d2a894bd88a5
3161ac2f0e33f2ce2b72d022b6e8aeab2b01f2d8
refs/heads/main
2023-05-10T16:08:17.267619
2021-06-06T14:38:20
2021-06-06T14:38:20
365,279,356
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
package com.task.exchangerates.util.converter; import com.task.exchangerates.dto.CurrencyDto; import com.task.exchangerates.util.enums.Currency; import org.springframework.stereotype.Component; import java.util.List; import java.util.stream.Collectors; @Component public class CurrencyToCurrencyDtoConverter { public CurrencyDto convert(Currency currency) { return new CurrencyDto(currency.getName(), currency.toString()); } public List<CurrencyDto> convertAll(List<Currency> currencies) { return currencies.stream() .map(this::convert) .collect(Collectors.toList()); } }
a1bd580506440c770e1b9fb45d80e4759b9b86b9
41120da488b02da098eadea8799cf896aad44d65
/NetBeans/Java WEB/Estudo/(Estudo Web JEE) MyExampleServletApp3/src/java/devmedia/xmlservlet/ListOfUsers.java
5870d6d97d4b6e0ca9c08646b348b44e32e31ec5
[]
no_license
RUB3XT0R/java_projects
b9a78fb113e43b4db4f9d3ec72b860ea1e897f45
007b5ac6828143e270ff8e4f132d64a3516b2877
refs/heads/master
2021-01-23T21:28:06.517991
2013-01-13T13:23:08
2013-01-13T13:23:08
62,026,819
1
0
null
2016-06-27T05:04:13
2016-06-27T05:04:10
null
UTF-8
Java
false
false
686
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package devmedia.xmlservlet; import java.io.Serializable; import java.util.List; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Administrador */ @XmlRootElement(name="users") public class ListOfUsers implements Serializable{ @XmlElementWrapper private List<User> users; public ListOfUsers(List<User> users) { this.users = users; } public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } }
996e59fe66a64d92300917a15d38bfb27868d77c
be1bdec994c8ef5e139de80ba4dad934881e02f2
/app/src/main/java/transfer/service/ingenico/domains/Transfer.java
142f14cac53a2873f51f03ef6c6e75bf7df0f8ba
[]
no_license
rafaelmchaves/transferService
f9c77445a2f26fe2441f1a10557f940738a25d85
a3950879a257471eaae956173a5ed10393ca1bcd
refs/heads/master
2022-05-18T06:25:19.604925
2022-05-01T12:04:54
2022-05-01T12:04:54
109,508,071
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
package transfer.service.ingenico.domains; import lombok.*; import org.springframework.data.annotation.CreatedDate; import javax.persistence.*; import java.io.Serializable; import java.math.BigDecimal; import java.util.Calendar; @Getter @Setter @Entity @Table(name = "transfer") @Builder @NoArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) public class Transfer implements Serializable { private static final long serialVersionUID = 632380474910793338L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @ManyToOne @JoinColumn(referencedColumnName = "id") private Account senderAccountId; @ManyToOne @JoinColumn(referencedColumnName = "id") private Account recipientAccountId; @Column(name = "value") private BigDecimal value; @Column(name = "status") private TransferStatus status; }
4b4d672d0b3c419271c2a658b89dd26e2aa135fa
cfde4e9d805f82f8ec4905ae74cf661731c4e8d2
/JavaBase/src/main/java/com/yjl/javabase/thinkinjava/generics/GenericVarargs.java
1c136a63a01d1d1742c887d4504935ed1bd1575b
[ "Apache-2.0" ]
permissive
yangjunlin-const/WhileTrueCoding
096ee1adff6e972240595436486d02a69eacecd1
db45d5739483acf664d653ca8047e33e8d012377
refs/heads/master
2021-01-10T01:22:11.893902
2016-08-18T09:37:48
2016-08-18T09:37:48
47,909,082
2
0
null
null
null
null
UTF-8
Java
false
false
667
java
package com.yjl.javabase.thinkinjava.generics;//: generics/GenericVarargs.java import java.util.*; public class GenericVarargs { public static <T> List<T> makeList(T... args) { List<T> result = new ArrayList<T>(); for(T item : args) result.add(item); return result; } public static void main(String[] args) { List<String> ls = makeList("A"); System.out.println(ls); ls = makeList("A", "B", "C"); System.out.println(ls); ls = makeList("ABCDEFFHIJKLMNOPQRSTUVWXYZ".split("")); System.out.println(ls); } } /* Output: [A] [A, B, C] [, A, B, C, D, E, F, F, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z] *///:~
e5aca1865cf009761cb0ee364b56e8d633d56b6e
9c71472a8be60c38706b286de0c9a5f3036f23cf
/src/main/java/com/hsy/compartment/dto/purchase/purchaseTakeOver/PurchaseListProductRespDto.java
68dc7c52336dd41b1e98d52d69250de1d89cfd40
[]
no_license
jianzhangg/hsy-compartment
cc541eac38e0bf282ab62ec6ad098d3a3ef98099
49fbf06247245c4f50bda7f74d90853954bf0ed1
refs/heads/master
2020-06-06T09:07:33.551403
2019-06-19T09:03:49
2019-06-19T09:03:49
192,696,996
0
0
null
null
null
null
UTF-8
Java
false
false
824
java
package com.hsy.compartment.dto.purchase.purchaseTakeOver; import java.io.Serializable; import java.math.BigDecimal; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @author 刘志恒 * @date 2019年6月6日下午3:12 * @description */ @Data @ApiModel(description = "采购单商品列表返回dto") public class PurchaseListProductRespDto implements Serializable { private static final long serialVersionUID = -7296754350974609600L; @ApiModelProperty(value = "商家id") private Integer sellerId; @ApiModelProperty(value = "货品id") private Integer productGoodsId; @ApiModelProperty(value = "商品id") private Integer productId; @ApiModelProperty(value = "商品数量") private Integer number; }